Option "vol dbpath" was broken in 3.1.1
authorRalph Boehme <rb@sernet.de>
Mon, 17 Mar 2014 10:08:57 +0000 (11:08 +0100)
committerRalph Boehme <rb@sernet.de>
Mon, 17 Mar 2014 10:13:51 +0000 (11:13 +0100)
Signed-off-by: Ralph Boehme <rb@sernet.de>
NEWS
doc/manpages/man5/afp.conf.5.xml
libatalk/util/netatalk_conf.c
man/man5/afp.conf.5.in

diff --git a/NEWS b/NEWS
index ef66971498b567fa30323bba94ea0a7e543e018f..823f9529f0cdbed4dd9128c10e644c0e69f09f94 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,7 @@
+Changes in 3.1.2
+================
+* FIX: Option "vol dbpath" was broken in 3.1.1
+
 Changes in 3.1.1
 ================
 * FIX: Add asprint() compatibility function for systems lacking it
index 8f398334ca45dbdcef3944e1674f4fd519f5eccc..cc46ce99880afd23d7b36b35167d772de81ff224 100644 (file)
 
         <varlistentry>
           <term>vol dbpath = <replaceable>path</replaceable>
-          <type>(G)</type></term>
+          <type>(G)/(V)</type></term>
 
           <listitem>
             <para>Sets the database information to be stored in path. You have
             to specify a writable location, even if the volume is read only.
             The default is
-            <filename>@localstatedir@/netatalk/CNID/</filename>.</para>
+            <filename>@localstatedir@/netatalk/CNID/$v/</filename>.</para>
           </listitem>
         </varlistentry>
 
index 78c8f331687df3023afacf6deaeb142a48e24544..4b4bcf6b2fe62b7dfafba17b8c165de5bc1baf70 100644 (file)
@@ -575,6 +575,8 @@ static struct vol *creatvol(AFPObj *obj,
     uint16_t    flags;
     const char  *val;
     char        *p, *q;
+    bstring     dbpath = NULL;
+    bstring     global_path_tmp = NULL;
 
     strlcpy(path, path_in, MAXPATHLEN);
 
@@ -671,16 +673,32 @@ static struct vol *creatvol(AFPObj *obj,
     if (atalk_iniparser_getboolean(obj->iniconfig, INISEC_GLOBAL, "vol dbnest", 0)) {
         EC_NULL( volume->v_dbpath = strdup(path) );
     } else {
-        bstring dbpath;
-        val = atalk_iniparser_getstring(obj->iniconfig, section, "vol dbpath", NULL);
+        char *global_path;
+        val = getoption(obj->iniconfig, section, "vol dbpath", preset, NULL);
+        if (val == NULL) {
+            /* check global option */
+            global_path = atalk_iniparser_getstring(obj->iniconfig,
+                                                    INISEC_GLOBAL,
+                                                    "vol dbpath",
+                                                    NULL);
+            if (global_path) {
+                /* check for pre 3.1.1 behaviour without variable */
+                if (strchr(global_path, '$') == NULL) {
+                    global_path_tmp = bformat("%s/%s/", global_path, tmpname);
+                    val = cfrombstr(global_path_tmp);
+                } else {
+                    val = global_path;
+                }
+            }
+        }
+
         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);
+                                             cfrombstr(dbpath), pwd, NULL, tmpname) );
     }
 
     if ((val = getoption(obj->iniconfig, section, "cnid scheme", preset, NULL)))
@@ -968,6 +986,10 @@ static struct vol *creatvol(AFPObj *obj,
 
 EC_CLEANUP:
     LOG(log_debug, logtype_afpd, "createvol: END: %d", ret);
+    if (dbpath)
+        bdestroy(dbpath);
+    if (global_path_tmp)
+        bdestroy(global_path_tmp);
     if (ret != 0) {
         if (volume)
             volume_free(volume);
index a375d44a6a19562149ab7d09e2aa4c5554c358fd..e90e4014ebd9438d1f78412a265496431bceced8 100644 (file)
@@ -643,10 +643,10 @@ veto message = \fIBOOLEAN\fR (default: \fIno\fR) \fB(G)\fR
 Send optional AFP messages for vetoed files\&. Then whenever a client tries to access any file or directory with a vetoed name, it will be sent an AFP message indicating the name and the directory\&.
 .RE
 .PP
-vol dbpath = \fIpath\fR \fB(G)\fR
+vol dbpath = \fIpath\fR \fB(G)/(V)\fR
 .RS 4
 Sets the database information to be stored in path\&. You have to specify a writable location, even if the volume is read only\&. The default is
-@localstatedir@/netatalk/CNID/\&.
+@localstatedir@/netatalk/CNID/$v/\&.
 .RE
 .PP
 vol dbnest = \fIBOOLEAN\fR (default: \fIno\fR) \fB(G)\fR