]> arthur.barton.de Git - netatalk.git/blobdiff - etc/afpd/afp_config.c
Merge remote branch 'origin/product-2-2' into develop
[netatalk.git] / etc / afpd / afp_config.c
index 9ee170099f976c5902c3fb7be65f6e2568878cfd..ed8067048da2e483bec545c8f61ba4580f5f9dd8 100644 (file)
@@ -26,6 +26,8 @@
 #include <atalk/server_child.h>
 #include <atalk/globals.h>
 #include <atalk/errchk.h>
+#include <atalk/netatalk_conf.h>
+#include <atalk/fce_api.h>
 
 #ifdef HAVE_LDAP
 #include <atalk/ldapconfig.h>
@@ -48,6 +50,9 @@ void configfree(AFPObj *obj, DSI *dsi)
 {
     DSI *p, *q;
 
+    /* the master loaded the volumes for zeroconf, get rid of that */
+    unload_volumes(obj);
+
     for (p = obj->dsi; p; p = q) {
         q = p->next;
         if (p == dsi)
@@ -62,8 +67,6 @@ void configfree(AFPObj *obj, DSI *dsi)
         afp_options_free(&obj->options);
     }
 
-    /* the master loaded the volumes for zeroconf, get rid of that */
-    unload_volumes();
 }
 
 /*!
@@ -73,7 +76,8 @@ int configinit(AFPObj *obj)
 {
     EC_INIT;
     DSI *dsi, **next = &obj->dsi;
-    char *p = NULL, *q = NULL;
+    char *p = NULL, *q = NULL, *savep;
+    const char *r;
 
     auth_load(obj->options.uampath, obj->options.uamlist);
     set_signature(&obj->options);
@@ -88,7 +92,7 @@ int configinit(AFPObj *obj)
 
     if (obj->options.listen) {
         EC_NULL( q = p = strdup(obj->options.listen) );
-        EC_NULL( p = strtok(p, ", ") );
+        EC_NULL( p = strtok_r(p, ", ", &savep) );
     }
 
     while (1) {
@@ -105,7 +109,7 @@ int configinit(AFPObj *obj)
 
         if (p)
             /* p is NULL if ! obj->options.listen */
-            p = strtok(NULL, ", ");
+            p = strtok_r(NULL, ", ", &savep);
         if (!p)
             break;
     }
@@ -120,21 +124,21 @@ 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, NULL);
         zeroconf_register(obj);
     }
 
-    if ((p = iniparser_getstring(obj->iniconfig, INISEC_AFP, "fcelistener", NULL))) {
-               LOG(log_note, logtype_afpd, "Adding FCE listener: %s", p);
-               fce_add_udp_socket(p);
+    if ((r = iniparser_getstring(obj->iniconfig, INISEC_GLOBAL, "fce listener", NULL))) {
+               LOG(log_note, logtype_afpd, "Adding FCE listener: %s", r);
+               fce_add_udp_socket(r);
     }
-    if ((p = iniparser_getstring(obj->iniconfig, INISEC_AFP, "fcecoalesce", NULL))) {
-               LOG(log_note, logtype_afpd, "Fce coalesce: %s", p);
-               fce_set_coalesce(p);
+    if ((r = iniparser_getstring(obj->iniconfig, INISEC_GLOBAL, "fce coalesce", NULL))) {
+               LOG(log_note, logtype_afpd, "Fce coalesce: %s", r);
+               fce_set_coalesce(r);
     }
-    if ((p = iniparser_getstring(obj->iniconfig, INISEC_AFP, "fceevents", NULL))) {
-               LOG(log_note, logtype_afpd, "Fce events: %s", p);
-               fce_set_events(p);
+    if ((r = iniparser_getstring(obj->iniconfig, INISEC_GLOBAL, "fce events", NULL))) {
+               LOG(log_note, logtype_afpd, "Fce events: %s", r);
+               fce_set_events(r);
     }