Ralph Boehme [Sun, 15 Jun 2014 04:07:10 +0000 (06:07 +0200)]
Resource fork conversion from AppleDouble v2 broken, bug #568
Converting from AppleDouble v2 to ea may corrupt the resource fork. In
some circumstances an offset calculation is wrong resulting in corrupt
resource forks after the conversion.
Ensure the resource fork AppleDouble entry offset is always set up and
we don't rely on the manual offset calculation.
Skip ADEID_RFORK in ad_copy_header() and allow copying of AppleDouble
entry that have an initial zero size in the destination adouble.
Ralph Boehme [Wed, 18 Jun 2014 14:54:24 +0000 (16:54 +0200)]
Fix a crash when accessing ._ files, bug #564
At least FreeBSD is picky in that it requires PROT_READ if we're going
to read a mmap()ed memory region mapped, only specifying PROT_WRITE
doesn't imply PROT_READ. Other OSen seem to handle this differently.
Also add a missing pointer reinitialisation to the buf pointer.
Reported-by: Sean Eric Fagan Signed-off-by: Ralph Boehme <rb@sernet.de>
Ralph Boehme [Tue, 17 Jun 2014 15:02:20 +0000 (17:02 +0200)]
Unarchiving certain ZIP archives fails, bug #569
The current code that checks whether the client is allowed to use
pathnames starting with ._ checks whether the file is an AppleDouble
file, and if it is and the filler does not contain the magic string
"Mac OS X", access to the file is denied. This results in the
following sequence of steps:
* client created empty file "._NAME"
* client wants to stat the newly created file "._NAME"
* server checks whether access to the file is allowed
* check fails
Modify check in ad_valid_header_osx() to allow access to all .-
AppleDouble files where the filler string is not "Netatalk", which is
the magic string Netatalk puts there.
Ralph Boehme [Wed, 4 Jun 2014 20:42:37 +0000 (22:42 +0200)]
Spotlight: "spotlight expr = false" broke the default Spotlight query
The default Spotlight query a Mac uses is
*=="test*"cwd || kMDItemTextContent=="test*"cwd
which is of course using a logic expression. The parser has an extra
rule for catching this (MATCH or MATCH) for the purpose of munging
both expression into a single fts:match SPARQL query. Which means
we shouldn't check whether logic expressions are enabled or not.
Ralph Boehme [Wed, 21 May 2014 14:42:58 +0000 (16:42 +0200)]
getvolbypath returns incorrect volume, bug #563
getvolbypath() would match a given path "/foo/barbaz" with an existing
volume path of "/foo/bar" because the strings where compared with
strnlen() where n is the length of "/foo/bar", ie we did a substring
match.
I faintly remember there was a reason for this, but I couldn't come up
with any sensible configuration of usage of dbd that would not also
work by simply using strcmp() instead of strmcmp().
Of course, in order for dbd to work with paths that included a
trailing slash, there's a need to adding some slash stripping code,
because our code (somehow) ensures (hopefully!) that in struct
vol.v_path is always stored with trailinsh slashes stripped.
Ralph Boehme [Wed, 19 Feb 2014 15:19:42 +0000 (16:19 +0100)]
Support for using $u username variable in AFP volume definitions
* Prepare CNID backend dbd for user variable expansion
* Store a struct vol pointer in the CNID db handles.
* Pass three arguments to the CNID daemon:
- the afp.conf volume section name
- the volume path
- an optional username
* Rename several struct elements by prefixing them with a struct tag,
helps catching bad or missing assignments.
* Disable uniconv, doesn't use laod_volumes() and thus wont work with
the new CNID dbd backend.
Ralph Boehme [Thu, 1 May 2014 09:27:33 +0000 (11:27 +0200)]
locking: put the Solaris share reservation after our locking stuff
Fix for Bug 560: put the Solaris share reservation after our locking stuff.
Note that this still leaves room for a race condition where between placing our own
locks above and putting the Solaris share move below another client puts a lock.
We then end up with set locks from above and return with an error code, the proper
fix requires a sane cleanup function for the error path in this function.
Ralph Boehme [Fri, 14 Feb 2014 10:31:57 +0000 (11:31 +0100)]
Automatic conversion for OS X ._ AppleDouble files, bug #550
Add automatic on-access conversion for ._ AppleDouble files created by
OS X to Netatalk's AppleDouble format.
OS X .AppleDouble files most of the times contain a FinderInfo
AppleDouble entry with a size larger then 32 bytes, containing packed
xattrs. Netatalk fails to cleanly deal with these and logs them as
"bogus entry id 9".
When the AFP client uses FPSetForkParms to set the ressource fork
length to 0, Netatalk will call unlink() in ad_rtruncate() in
libatalk/adouble/ad_write.c in order to to unlink the files
AppleDouble ressource fork.
The function ad_rtruncate() gets just the filename as path from the
caller, so obviously at this point the caller should have ensured that
it had called chdir() to the enclosing directory of the file.
Frank Lahm [Mon, 28 Oct 2013 09:06:37 +0000 (10:06 +0100)]
Build fixes for the Kerberos UAM
o missing Kerberos includes and libraries
o conditional code that handled the case when Kerberos is not available
was c/p from etc/afp/status.c and wasn't updated for the changes introduced
in the bugfix for #531
Frank Lahm [Fri, 25 Oct 2013 09:42:06 +0000 (11:42 +0200)]
Remove obsolete compatibility function declarations for snprintf() and vsnprintf()
We were providing function declarations without ever providing function implementations.
Also, for some reason, this caues compilation issues on older Linux versions.
Ralph Boehme [Sun, 13 Oct 2013 14:16:54 +0000 (16:16 +0200)]
New MySQL CNID backend
o add configure check --with-mysql-config=PATH that searches for
the mysql-config binary
o add new MySQL CNID subdirectory and compilation infrastructure
o modify CNID header files for new backend
o add private CNID MySQL header file for private data
o add mysql config options
o add MySQL args to cnid_open()
o add support for MySQL CNID backend to dbd
Add MySQL libraries as deps to executables:
workaround libtool bug where the rpath of a dependent library (ie mysql) of a libtool
library (ie libatalk) gets stripped from the link flags when linking the final
executable, even though the library (mysql) is a non default OS dir.
Ralph Boehme [Wed, 2 Oct 2013 07:39:20 +0000 (09:39 +0200)]
Add recvfile support with splice() on Linux
o Global option "recvfile" controls whether splice() is used.
Ddefaults to false.
o Global option "splice size" limits the amount of data spliced.
Defaults to 64k.
Ralph Boehme [Tue, 8 Oct 2013 10:36:25 +0000 (12:36 +0200)]
Fix error in ad_openat(), bug #532
Saving from Word to a folder that is a symlink to a folder on another filesystem
results in a crash of the afpd process and the save to fail. This happens only
if the option "follow symlinks" is enabled.
Ralph Boehme [Wed, 18 Sep 2013 09:08:38 +0000 (11:08 +0200)]
Small fix in the DSI tickle handling
Due to a regression introduced in 9355ebcc5744bbd445a0c8cb8b0a0ca201d5499a
the server may send an extra DSI tickle immediately after a "volume modified"
DSI attention notification. This will only happen if the connection is
o completely idle, and
o the volume was modified by another AFP client
The result is an extra DSI tickle every 30 seconds.
Ralph Boehme [Fri, 13 Sep 2013 10:19:56 +0000 (12:19 +0200)]
Option "vol dbnest"
When set to true, the CNID database for a volume is stored in the volume root
of a share in a directory .AppleDB like in Netatalk 2. Defaults to false.