]> arthur.barton.de Git - netatalk.git/commitdiff
Merge branch 'branch-netatalk-3-1'
authorRalph Boehme <rb@sernet.de>
Sat, 1 Mar 2014 06:23:57 +0000 (07:23 +0100)
committerRalph Boehme <rb@sernet.de>
Sat, 1 Mar 2014 06:23:57 +0000 (07:23 +0100)
16 files changed:
NEWS
bin/ad/ad.c
etc/afpd/afp_config.c
etc/afpd/afp_dsi.c
etc/afpd/ofork.c
etc/afpd/volume.c
etc/cnid_dbd/cmd_dbd.c
etc/cnid_dbd/cmd_dbd_scanvol.c
etc/cnid_dbd/cnid_metad.c
etc/cnid_dbd/main.c
etc/netatalk/netatalk.c
include/atalk/netatalk_conf.h
include/atalk/volume.h
libatalk/util/netatalk_conf.c
man/man5/afp.conf.5.in
test/afpd/test.c

diff --git a/NEWS b/NEWS
index 9e62be4bf45990a6338f5106a47d6a564b3bb308..cce1114b516863e261eba643a86e3ad2410e141e 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -11,6 +11,9 @@ Changes in 3.1.1
 * FIX: dbd: remove orphaned ._ AppleDouble files. Bug #549.
 * NEW: afpd: Automatic conversion of ._ AppleDouble files
        created by OS X. Bug #550.
+* FIX: afpd: Fix a crash in of_closefork(). Bug #551.
+* FIX: dbd: Don't print message "Ignoring ._file" for every ._ file.
+       Bug #552.
 
 Changes in 3.1.0
 ================
index 3de3030b9a820bbde3c53caef74a27ac1b769482..fc8563c06f034a7c0a660ad0f3075f4946ef98b8 100644 (file)
@@ -58,7 +58,7 @@ int main(int argc, char **argv)
 
     setuplog("default:note", "/dev/tty");
 
-    if (load_volumes(&obj) != 0)
+    if (load_volumes(&obj, lv_none) != 0)
         return 1;
 
     if (STRCMP(argv[1], ==, "ls"))
index 149593431373c52dc3f56a41511cbfb9a4cf220f..c7246f1f2d4c4206292fb69ac3c063d5dd39865b 100644 (file)
@@ -209,7 +209,7 @@ int configinit(AFPObj *obj)
 
     /* Now register with zeroconf, we also need the volumes for that */
     if (! (obj->options.flags & OPTION_NOZEROCONF)) {
-        load_volumes(obj);
+        load_volumes(obj, lv_all);
         zeroconf_register(obj);
     }
 
index b64d49140f402fc1ddb0f1f0205263563e9808d1..eb4b19f35d5153302e189b8911bb6d853149ed7d 100644 (file)
@@ -533,7 +533,7 @@ void afp_over_dsi(AFPObj *obj)
 
         if (reload_request) {
             reload_request = 0;
-            load_volumes(AFPobj);
+            load_volumes(AFPobj, lv_none);
         }
 
         /* The first SIGINT enables debugging, the next restores the config */
index cf77d4906ad6edaf0a8dc82c40ba6f75f378be0d..7c975c38f9ed581702e74827aaaf2c2d863e8ce7 100644 (file)
@@ -408,9 +408,11 @@ int of_closefork(const AFPObj *obj, struct ofork *ofork)
     /* Somone has used write_fork, we assume file was changed, register it to file change event api */
     if (ofork->of_flags & AFPFORK_MODIFIED) {
         struct dir *dir =  dirlookup(ofork->of_vol, ofork->of_did);
-        bstring forkpath = bformat("%s/%s", bdata(dir->d_fullpath), of_name(ofork));
-        fce_register(FCE_FILE_MODIFY, bdata(forkpath), NULL, fce_file);
-        bdestroy(forkpath);
+        if (dir) {
+            bstring forkpath = bformat("%s/%s", bdata(dir->d_fullpath), of_name(ofork));
+            fce_register(FCE_FILE_MODIFY, bdata(forkpath), NULL, fce_file);
+            bdestroy(forkpath);
+        }
     }
 
     ad_unlock(ofork->of_ad, ofork->of_refnum, ofork->of_flags & AFPFORK_ERROR ? 0 : 1);
index 07cfb42b293f199e9c2eeec4a74975c0a500aeda..a3ee79278763d198029af7c35a0be3260cae17a2 100644 (file)
@@ -532,7 +532,7 @@ int afp_getsrvrparms(AFPObj *obj, char *ibuf _U_, size_t ibuflen _U_, char *rbuf
     size_t      len;
     uint32_t    aint;
 
-    load_volumes(obj);
+    load_volumes(obj, lv_none);
 
     data = rbuf + 5;
     for ( vcnt = 0, volume = getvolumes(); volume && vcnt < 255; volume = volume->v_next ) {
@@ -744,7 +744,7 @@ int afp_openvol(AFPObj *obj, char *ibuf, size_t ibuflen _U_, char *rbuf, size_t
     if ((len + 1) & 1) /* pad to an even boundary */
         ibuf++;
 
-    load_volumes(obj);
+    load_volumes(obj, lv_none);
 
     for ( volume = getvolumes(); volume; volume = volume->v_next ) {
         if ( strcasecmp_w( (ucs2_t*) volname, volume->v_name ) == 0 ) {
index 4018eecceb3e3814b030f7f94a5b0cbf883e07d3..266b986ba00da9905c56777b4ac5dff6f50b4625 100644 (file)
@@ -212,7 +212,7 @@ int main(int argc, char **argv)
     else
         setuplog("default:note", "/dev/tty");
 
-    if (load_volumes(&obj) != 0) {
+    if (load_volumes(&obj, lv_all) != 0) {
         dbd_log( LOGSTD, "Couldn't load volumes");
         exit(EXIT_FAILURE);
     }
index ba1cd623e0b54dd778ccf2b5a80cdfc3df0a72d4..8ce6fbf5d624989308b09269eea25d17da7b8279 100644 (file)
@@ -610,7 +610,7 @@ static cnid_t check_cnid(const char *name, cnid_t did, struct stat *st, int adfi
     return db_cnid;
 }
 
-static void check_orphaned(const char *name)
+static int check_orphaned(const char *name)
 {
     int rc;
     struct stat sb;
@@ -623,7 +623,9 @@ static void check_orphaned(const char *name)
     if (rc != 0 && errno == ENOENT) {
         dbd_log(LOGSTD, "Removing orphaned AppleDouble \"%s/%s\"", cwdbuf, name);
         unlink(name);
+        return 1;
     }
+    return 0;
 }
 
 /*
@@ -734,12 +736,13 @@ static int dbd_readdir(int volroot, cnid_t did)
         **************************************************************************/
 
         /* Check for invalid names and orphaned ._ files */
-        if (S_ISREG(st.st_mode) && (strncmp(ep->d_name, "._", strlen("._")) == 0))
-            check_orphaned(ep->d_name);
-
-        if (!vol->vfs->vfs_validupath(vol, ep->d_name)) {
-            dbd_log(LOGSTD, "Ignoring \"%s/%s\"", cwdbuf, ep->d_name);
-            continue;
+        if (S_ISREG(st.st_mode) && (strncmp(ep->d_name, "._", strlen("._")) == 0)) {
+            if (check_orphaned(ep->d_name))
+                continue;
+            if (vol->vfs->vfs_validupath(vol, ep->d_name)) {
+                dbd_log(LOGSTD, "Bad AppleDouble \"%s/%s\"", cwdbuf, ep->d_name);
+                continue;
+            }
         }
 
         /* Check for appledouble file, create if missing, but only if we have addir */
index 42b398f792c30707ad3c44db9d4e11353696256c..1b991cb8bf39d5f89a86d4f3c849e3d63b4379ce 100644 (file)
@@ -463,7 +463,7 @@ int main(int argc, char *argv[])
     if (afp_config_parse(&obj, "cnid_metad") != 0)
         daemon_exit(1);
 
-    if (load_volumes(&obj) != 0)
+    if (load_volumes(&obj, lv_all) != 0)
         daemon_exit(1);
 
     (void)setlimits();
@@ -565,7 +565,7 @@ int main(int argc, char *argv[])
 
         LOG(log_debug, logtype_cnid, "main: request for volume: %s", volpath);
 
-        if (load_volumes(&obj) != 0) {
+        if (load_volumes(&obj, lv_all) != 0) {
             LOG(log_severe, logtype_cnid, "main: error reloading config");
             goto loop_end;
         }
index 97dcd5579a62735aeeed38a541c3ad39f54464c6..994c8ff698f44776c92b8413e4f344ff38892661 100644 (file)
@@ -515,7 +515,7 @@ int main(int argc, char *argv[])
 
     EC_ZERO( afp_config_parse(&obj, "cnid_dbd") );
 
-    EC_ZERO( load_volumes(&obj) );
+    EC_ZERO( load_volumes(&obj, lv_all) );
     EC_NULL( vol = getvolbypath(&obj, volpath) );
     EC_ZERO( load_charset(vol) );
     pack_setvol(vol);
index 0e5c6554edcd0464cab4b8373a09f867b3b86ae5..4a20d7b787af5547dddd5f24e6b7ee89d26edc41 100644 (file)
@@ -351,7 +351,7 @@ int main(int argc, char **argv)
     if (afp_config_parse(&obj, "netatalk") != 0)
         netatalk_exit(EXITERR_CONF);
 
-    load_volumes(&obj);
+    load_volumes(&obj, lv_all);
 
     event_set_log_callback(libevent_logmsg_cb);
     event_set_fatal_callback(netatalk_exit);
index 858b4f1cd17a1107dbd017023c9c8ef77b2f7f28..5b30e0bf60fdc17c66573ac1669fa87f48989d19 100644 (file)
@@ -23,7 +23,7 @@
 extern int        afp_config_parse(AFPObj *obj, char *processname);
 extern void       afp_config_free(AFPObj *obj);
 extern int        load_charset(struct vol *vol);
-extern int        load_volumes(AFPObj *obj);
+extern int        load_volumes(AFPObj *obj, lv_flags_t flags);
 extern void       unload_volumes(AFPObj *obj);
 extern struct vol *getvolumes(void);
 extern struct vol *getvolbyvid(const uint16_t);
index 7172887a2d489947316df310aa44966277602cc6..e2728908a5010a6ffe388a62c0cecd4ea1d64679 100644 (file)
@@ -102,7 +102,7 @@ struct vol {
 };
 
 /* load_volumes() flags */
-#define LV_ALL (1 << 0)
+typedef enum {lv_none = 0, lv_all = 1} lv_flags_t;
 
 /* volume flags */
 #define AFPVOL_OPEN (1<<0)
index fa6fb8b57ca2084a95bf055af256fffd784b5e33..78c8f331687df3023afacf6deaeb142a48e24544 100644 (file)
@@ -668,14 +668,19 @@ static struct vol *creatvol(AFPObj *obj,
         if(tmpname[i] == '/') tmpname[i] = ':';
 
 
-    if (!atalk_iniparser_getboolean(obj->iniconfig, INISEC_GLOBAL, "vol dbnest", 0)) {
+    if (atalk_iniparser_getboolean(obj->iniconfig, INISEC_GLOBAL, "vol dbnest", 0)) {
+        EC_NULL( volume->v_dbpath = strdup(path) );
+    } else {
         bstring dbpath;
-        EC_NULL( val = atalk_iniparser_getstring(obj->iniconfig, INISEC_GLOBAL, "vol dbpath", _PATH_STATEDIR "CNID/") );
-        EC_NULL( dbpath = bformat("%s/%s/", val, tmpname) );
-        EC_NULL( volume->v_dbpath = strdup(cfrombstr(dbpath)) );
+        val = atalk_iniparser_getstring(obj->iniconfig, section, "vol dbpath", NULL);
+        if (val == NULL) {
+            EC_NULL( dbpath = bformat("%s/%s/", _PATH_STATEDIR "CNID/", tmpname) );
+        } else {
+            EC_NULL( dbpath = bfromcstr(val));
+        }
+        EC_NULL( volume->v_dbpath = volxlate(obj, NULL, MAXPATHLEN + 1,
+                                             cfrombstr(dbpath), pwd, NULL, NULL) );
         bdestroy(dbpath);
-    } else {
-        EC_NULL( volume->v_dbpath = strdup(path) );
     }
 
     if ((val = getoption(obj->iniconfig, section, "cnid scheme", preset, NULL)))
@@ -1335,12 +1340,10 @@ int load_charset(struct vol *vol)
 /*!
  * Initialize volumes and load ini configfile
  *
- * Depending on the value of obj->uid either access checks are done (!=0) or skipped (=0)
- *
- * @param obj       (r) handle
- * @param delvol_fn (r) callback called for deleted volumes
+ * @param obj      (r) handle
+ * @param flags    (r) flags controlling volume load behaviour
  */
-int load_volumes(AFPObj *obj)
+int load_volumes(AFPObj *obj, lv_flags_t flags)
 {
     EC_INIT;
 
@@ -1363,7 +1366,7 @@ int load_volumes(AFPObj *obj)
         EC_NULL( pwbuf = malloc(bufsize) );
     }
 
-    if (obj->uid) {
+    if (!(flags & lv_all) && obj->uid) {
         ret = getpwuid_r(obj->uid, &pwent, pwbuf, bufsize, &pwresult);
         if (pwresult == NULL) {
             LOG(log_error, logtype_afpd, "load_volumes: getpwuid_r: %s", strerror(errno));
index d993ce3f28182fe31223c738ae7a05e4858e5ab2..a375d44a6a19562149ab7d09e2aa4c5554c358fd 100644 (file)
@@ -2,12 +2,12 @@
 .\"     Title: afp.conf
 .\"    Author: [FIXME: author] [see http://docbook.sf.net/el/author]
 .\" Generator: DocBook XSL Stylesheets v1.78.0 <http://docbook.sf.net/>
-.\"      Date: 13 Sep 2013
+.\"      Date: 09 Feb 2013
 .\"    Manual: @NETATALK_VERSION@
 .\"    Source: @NETATALK_VERSION@
 .\"  Language: English
 .\"
-.TH "AFP\&.CONF" "5" "13 Sep 2013" "@NETATALK_VERSION@" "@NETATALK_VERSION@"
+.TH "AFP\&.CONF" "5" "09 Feb 2013" "@NETATALK_VERSION@" "@NETATALK_VERSION@"
 .\" -----------------------------------------------------------------
 .\" * Define some portability stuff
 .\" -----------------------------------------------------------------
@@ -568,6 +568,12 @@ cnid server = \fIipaddress[:port]\fR \fB(G)/(V)\fR
 Specifies the IP address and port of a cnid_metad server, required for CNID dbd backend\&. Defaults to localhost:4700\&. The network address may be specified either in dotted\-decimal format for IPv4 or in hexadecimal format for IPv6\&.\-
 .RE
 .PP
+dbus daemon = \fIpath\fR \fB(G)\fR
+.RS 4
+Sets the path to dbus\-daemon binary used by Spotlight feature\&. The default is
+/bin/dbus\-daemon\&.
+.RE
+.PP
 dircachesize = \fInumber\fR \fB(G)\fR
 .RS 4
 Maximum possible entries in the directory cache\&. The cache stores directories and files\&. It is used to cache the full path to directories and CNIDs which considerably speeds up directory enumeration\&.
@@ -591,13 +597,6 @@ AFP user home volume name\&. The default is
 \fIuser\*(Aqs home\fR\&.
 .RE
 .PP
-login message = \fImessage\fR \fB(G)/(V)\fR
-.RS 4
-Sets a message to be displayed when clients logon to the server\&. The message should be in
-\fBunix charset\fR
-and should be quoted\&. Extended characters are allowed\&.
-.RE
-.PP
 ignored attributes = \fIall | nowrite | nodelete | norename\fR \fB(G)/(V)\fR
 .RS 4
 Speficy a set of file and directory attributes that shall be ignored by the server,
@@ -608,6 +607,13 @@ In OS X when the Finder sets a lock on a file/directory or you set the BSD uchg
 \fIignored attributes = all\fR\&.
 .RE
 .PP
+login message = \fImessage\fR \fB(G)/(V)\fR
+.RS 4
+Sets a message to be displayed when clients logon to the server\&. The message should be in
+\fBunix charset\fR
+and should be quoted\&. Extended characters are allowed\&.
+.RE
+.PP
 mimic model = \fImodel\fR \fB(G)\fR
 .RS 4
 Specifies the icon model that appears on clients\&. Defaults to off\&. Note that afpd must support Zeroconf\&. Examples: RackMac (same as Xserve), PowerBook, PowerMac, Macmini, iMac, MacBook, MacBookPro, MacBookAir, MacPro, AppleTV1,1, AirPort\&.
@@ -627,7 +633,9 @@ Use share reservations on Solaris\&. Solaris CIFS server uses this too, so this
 .PP
 spotlight = \fIBOOLEAN\fR (default: \fIno\fR) \fB(G)/(V)\fR
 .RS 4
-Whether to enable Spotlight searches\&. Note: once the global option is enabled, any volume that is not enabled won\*(Aqt be searchable at all\&.
+Whether to enable Spotlight searches\&. Note: once the global option is enabled, any volume that is not enabled won\*(Aqt be searchable at all\&. See also
+\fIdbus daemon\fR
+option\&.
 .RE
 .PP
 veto message = \fIBOOLEAN\fR (default: \fIno\fR) \fB(G)\fR
@@ -1095,7 +1103,7 @@ Allows certain users and groups to have read/write access to a share\&. This fol
 .PP
 veto files = \fIvetoed names\fR \fB(V)\fR
 .RS 4
-hide files and directories,where the path matches one of the \*(Aq/\*(Aq delimited vetoed names\&. The veto string must always be terminated with a \*(Aq/\*(Aq, eg\&. "veto1/", "veto1/veto2/"\&.
+hide files and directories,where the path matches one of the \*(Aq/\*(Aq delimited vetoed names\&. The veto string must always be terminated with a \*(Aq/\*(Aq, eg\&. "veto files = veto1/", "veto files = veto1/veto2/"\&.
 .RE
 .SS "Volume options"
 .PP
index b25ec4dd9c9fd127a470463e0886d6eb18294fff..56a86e81d1037174e49c20d175e13e161179ac5c 100644 (file)
@@ -67,7 +67,7 @@ int main(int argc, char **argv)
     TEST_int( afp_config_parse(&obj, NULL), 0);
     TEST_int( configinit(&obj), 0);
     TEST( cnid_init() );
-    TEST( load_volumes(&obj) );
+    TEST( load_volumes(&obj, lv_all) );
     TEST_int( dircache_init(8192), 0);
     obj.afp_version = 32;