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.
Frank Lahm [Wed, 14 Nov 2012 15:02:41 +0000 (16:02 +0100)]
Configurable symlink behaviour
Add a new volumes option 'follow symlinks'. The default setting is
false, symlinks are not followed on the server. This is the same
behaviour as OS X's AFP server.
Setting the option to true causes afpd to follow symlinks on the
server. symlinks may point outside of the AFP volume, currently
afpd doesn't do any checks for "wide symlinks".
In order to provide a somewhat consistent interface, add an API
of o* function wrappers for filesytem related functions.
These functions take an an additonal option arg (hence the o) which
tells the functions whether symlinks shall be followed or not.
Ralph Boehme [Mon, 10 Dec 2012 17:38:07 +0000 (18:38 +0100)]
Restructure opening and deleting the CNID dbs and CNID wraparound support
If opening the db fails, delete it and recreate a new empty one.
Add handling of CNID overflow, ie when the last used CNID reaches
its maximum (UINT32_MAX), wrap around to CNID_START. This then neccesites
a modification to get_id() where we used to just increment the last
used CNID counter and use that as next CNID.
Now we need to ensure that it isn't already used in the db and keep
searching for an used in case it is in a loop.
Move locking function back to main.c, as it's only used by cnid_dbd.
Modify dbd_add() such that it can add an entry with the CNID passed
in from the client, the CNID hint read from the adouble file.
Invalidate CNID hint in case lookup detected a problem
Ralph Boehme [Mon, 10 Dec 2012 13:55:41 +0000 (14:55 +0100)]
Ignore db stamp when reading CNID from adouble file
The db stamp (which is the ctime of the cnid2.db file stored in the
db at creation time) may change when running `dbd -f` or when deleting
the CNID db manually. But we don't want to reassing CNIDs in this case
(changed stamp) we really want to keep it.
Ralph Boehme [Fri, 7 Dec 2012 17:33:32 +0000 (18:33 +0100)]
Rewrite dbd to use CNID IPC instead of opening the db directly
In order to fix buf #447 (race condition between dbd and cnid_dbd)
dbd must be converted to work over the network IPC channel with
cnid_dbd instead of directly working on the BerkeleyDB CNID database.
Ralph Boehme [Tue, 11 Dec 2012 12:42:12 +0000 (13:42 +0100)]
Fix a possible crash when searching on large volumes
catsearch() used dirlookup() to lookup directories, but then it didn't
use movecwd() to cd into them, only lchdir(). This resulted in curdir
not being updated.
Then, while processing entries of directory and adding them to the
dircache, in case the dircache hit its maximum size limit, dircache
eviction would take place.
The dircache eviction will remove a fixed size number of directories
from the cache, but for every entry to be freed it will ensure that
it's nor curdir.
Unfortunately as catsearch didn't update that, the directory that
catsearch was working on was freed, which of course resulted in access
of invalid ressouces and possible crashes.
The fix is to just use movecwd() instead of lchdir()ing directly.
Ralph Boehme [Thu, 6 Dec 2012 08:55:53 +0000 (09:55 +0100)]
Fix an error where catalog search gave incomplete results
The bug was immediately solved when chaning the current implementation
of using the function dirlookup_bybath() with paths form the dirstack,
to dirlook() with dids stored in the dirstack.
Presumably something dirlookup_bybath() went wrong thus ceratain
folders weren't searched.