Frank Lahm [Sat, 6 Apr 2013 15:08:37 +0000 (17:08 +0200)]
Fix an issue with filenames containing non-ASCII characters
Fix an issue with filenames containing non-ASCII characters that
lead to a failure setting the size of a files ressource fork.
This affected application like Adobe Photoshop where saving
files may fail. Fixes bug #511.
Ralph Boehme [Wed, 27 Mar 2013 16:18:22 +0000 (17:18 +0100)]
Opening files without metadata EA may result in broken metadata EA
ad_open_hf_ea() calls ad_flush() after initializing the new metadata,
but in ad_flush() ad_flush_ea() wasn't called because we didn't
yet increment the refcount.
Fix this by increasing the refcount in ad_open_hf() before calling
into ad_open_hf_ea(), decrementing it again in case of an error.
This ensure a valid metadata EA is created, but it still doesn't
set the CNID field values. Therefor in afp_openfork() we must check
whether the ad_open() created a metadata EA and then set the CNID
info.
Finally, check for malformed metadata EAs and delete them.
Ralph Boehme [Tue, 19 Mar 2013 14:26:03 +0000 (15:26 +0100)]
Increase IO size when sendfile() is not used
If sendfile() support is disabled, the current code results in an
IO size of 8k for transferring requested data to the client. Eg:
- client request to read DSI quantum size bytes (~250k) from a file
- afpd process loops read(8k, file) -> send(8k, client) until all
250k have been transferred
This should be modified to read the whole 250k in one swoop from the
file to a buffer and then send the whole buffer in one swoop to the
client.
Frank Lahm [Fri, 15 Mar 2013 08:19:40 +0000 (09:19 +0100)]
Use FreeBSD sendfile() capability to send protocol header
When transmitting file contents to a client with sendfile(), on
every platform other then Solaris (where we use sendfilev()), we
send the AFP the protocol header with an additional send with
MSG_MORE before calling sendfile().
FreeBSD sendfile() supports sending protocol header (and trailer)
data similarly to Solaris sendfilev().
Ralph Boehme [Mon, 11 Feb 2013 13:42:12 +0000 (14:42 +0100)]
Add dtrace provider 'afp' and dtrace probes
There are three dtrace probes:
- all AFP functions, passing the function name as argument
- AFP read and write, passing the IO size as argument
- all CNID functions
In order to be able to simply differintiate between disk IO and
network IO, replace all occurences of read and write on sockets
with send/recv, and replace the use of writev in the logging code
with two calls to write.
As a result, using dtrace probes for read() and write() syscalls
can be used to gather metrics for disk IO, while probing send(),
recv() and writev() probe network IO.
Ralph Boehme [Tue, 5 Feb 2013 16:25:27 +0000 (17:25 +0100)]
AFP statistics via dbus IPC
Fix PAM config installation. make distcheck was failing on Solaris
in uninstall, because the uninstall target ran some `rm -f PAMFILE`
where PAMFILE is hardcoded to /etc/pam.d. The resulting EPERM
causes the make target to fail.
Ralph Boehme [Tue, 19 Feb 2013 16:35:04 +0000 (17:35 +0100)]
Several fixes in ad_conv_dehex()
Testing whether we need to perform dehexing was done by a simple
strchr(':'), thus names only containing a single ':' would trigger
dehexing even though they might not contain the relevant strings
":2e" or :2f".
Also fix a ressource leak in bfindreplace() and simplify the
check whether a rename took place in enumerate.c.
Frank Lahm [Mon, 31 Dec 2012 13:50:50 +0000 (14:50 +0100)]
Consolidate all Netatalk specific conversion in pull_charset_flags()
Netatalk specific conversion like '/' <-> ':' and CAP de-/encoding
was performed partially in pull_charset_flags() and push_charset_flags().
The resulting code was unmaintainable and as a result it failed to
to the proper conversion of ':' to '/' for an UTF8 -> UTF8-MAC
conversion.
Moving all Netatalk specific conversion to pull_charset_flags()
we can now easily do the necessary conversion in one place.
* ":xx" CAP sequences are decoded if CONV_UNESCAPEHEX is used
* ':' and '/' are CAP encoded if CONV_ESCAPEHEX is used
* ':' is converted to '/' only for a conversion whos target charset
is UTF8-MAC and whos source charset is NOT UTF8-MAC
* '/' is converted to ':' only for a conversion whos source charset
is UTF8-MAC and whos target charset is NOT UTF8-MAC
* a leading '.' is CAP encoded if CONV_ESCAPEDOTS is used
This consolidation obsoletes both CONV_ALLOW_COLON and CONV_ALLOW_SLASH
conversion options.