]> arthur.barton.de Git - netatalk.git/commitdiff
Fixes
authorFrank Lahm <franklahm@googlemail.com>
Wed, 15 Feb 2012 09:16:41 +0000 (10:16 +0100)
committerFrank Lahm <franklahm@googlemail.com>
Wed, 15 Feb 2012 09:16:41 +0000 (10:16 +0100)
etc/afpd/afp_config.c
etc/afpd/volume.c

index 028bcae77ee797c442608de8d3bdd50cc02bad79..d853e0b4ac2eb3893bca7c577e020b9d3a7120b2 100644 (file)
  * Free and cleanup all linked DSI objects from config
  *
  * Preserve object pointed to by "dsi".
- * "dsi" can be NULL in which case all DSI objects are freed
+ * "dsi" can be NULL in which case all DSI objects _and_ the options object are freed 
  */
 void configfree(AFPObj *obj, DSI *dsi)
 {
     DSI *p, *q;
 
-    afp_options_free(&obj->options);
-
     for (p = obj->dsi; p; p = q) {
         q = p->next;
         if (p == dsi)
@@ -60,7 +58,10 @@ void configfree(AFPObj *obj, DSI *dsi)
     if (dsi) {
         dsi->next = NULL;
         obj->dsi = dsi;
+    } else {
+        afp_options_free(&obj->options);
     }
+
     /* the master loaded the volumes for zeroconf, get rid of that */
     unload_volumes();
 }
index c7a262f6ea8821bfdacfee18005ad53932b8c3d7..78e1d74f1522aa58d2640a1507baccf672c63587 100644 (file)
@@ -908,11 +908,11 @@ static int volfile_changed(struct afp_options *p)
 
 static int vol_section(const char *sec)
 {
-    if (STRCMP(sec, ==, INISEC_GLOBAL) == 0)
+    if (STRCMP(sec, ==, INISEC_GLOBAL))
         return 0;
-    if (strcmp(sec, INISEC_AFP) == 0)
+    if (STRCMP(sec, ==, INISEC_AFP))
         return 0;
-    if (strcmp(sec, INISEC_CNID) == 0)
+    if (STRCMP(sec, ==, INISEC_CNID))
         return 0;
     return 1;
 }
@@ -951,6 +951,7 @@ static int readvolfile(AFPObj *obj, struct afp_volume_name *p1, struct passwd *p
     memcpy(save_options, default_options, sizeof(options));
 
     int secnum = iniparser_getnsec(obj->iniconfig);    
+    LOG(log_debug, logtype_afpd, "readvolfile: sections: %d", secnum);
     const char *secname;
 
     for (i = 0; i < secnum; i++) { 
@@ -958,11 +959,14 @@ static int readvolfile(AFPObj *obj, struct afp_volume_name *p1, struct passwd *p
         if (!vol_section(secname))
             continue;
 
+        strlcpy(volname, secname, AFPVOL_U8MNAMELEN);
+        LOG(log_debug, logtype_afpd, "readvolfile: volume: %s", volname);
+
         if ((p = iniparser_getstrdup(obj->iniconfig, secname, "path", NULL)) == NULL)
             continue;
         strlcpy(path, p, MAXPATHLEN);
         strcpy(tmp, path);
-        strlcpy(volname, secname, AFPVOL_U8MNAMELEN);
+
 
         if (!pwent && obj->username)
             pwent = getpwnam(obj->username);
@@ -1599,7 +1603,9 @@ void load_volumes(AFPObj *obj)
         break;
     }
 
-    iniparser_freedict(obj->iniconfig);
+    if (obj->iniconfig)
+        iniparser_freedict(obj->iniconfig);
+    LOG(log_debug, logtype_afpd, "load_volumes: reloading: %s", obj->options.configfile);
     obj->iniconfig = iniparser_load(obj->options.configfile);
 
     if (obj->username)