]> arthur.barton.de Git - netatalk.git/blobdiff - etc/afpd/afp_config.c
Merge 2-2
[netatalk.git] / etc / afpd / afp_config.c
index cdc9e4f0100ff50f8cf297cec0815d97d748d4f4..a61fe1022f551ccc84b9fef03c860cfe16c51a30 100644 (file)
@@ -50,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)
@@ -57,15 +60,13 @@ void configfree(AFPObj *obj, DSI *dsi)
         close(p->socket);
         free(p);
     }
+
     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();
 }
 
 /*!
@@ -75,7 +76,7 @@ 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);
@@ -91,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) {
@@ -101,6 +102,7 @@ int configinit(AFPObj *obj)
         status_init(obj, dsi);
         *next = dsi;
         next = &dsi->next;
+        dsi->AFPobj = obj;
 
         LOG(log_note, logtype_afpd, "Netatalk AFP/TCP listening on %s:%d",
             getip_string((struct sockaddr *)&dsi->server),
@@ -108,16 +110,13 @@ int configinit(AFPObj *obj)
 
         if (p)
             /* p is NULL if ! obj->options.listen */
-            p = strtok(NULL, ", ");
+            p = strtok_r(NULL, ", ", &savep);
         if (!p)
             break;
     }
 
-    if (obj->dsi == NULL)
-        EC_FAIL;
-
 #ifdef HAVE_LDAP
-    /* Parse afp_ldap.conf */
+    /* Parse afp.conf */
     acl_ldap_readconfig(obj->iniconfig);
 #endif /* HAVE_LDAP */
 
@@ -127,20 +126,19 @@ int configinit(AFPObj *obj)
         zeroconf_register(obj);
     }
 
-    if ((r = iniparser_getstring(obj->iniconfig, INISEC_AFP, "fcelistener", NULL))) {
+    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 ((r = iniparser_getstring(obj->iniconfig, INISEC_AFP, "fcecoalesce", NULL))) {
+    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 ((r = iniparser_getstring(obj->iniconfig, INISEC_AFP, "fceevents", NULL))) {
+    if ((r = iniparser_getstring(obj->iniconfig, INISEC_GLOBAL, "fce events", NULL))) {
                LOG(log_note, logtype_afpd, "Fce events: %s", r);
                fce_set_events(r);
     }
 
-
 EC_CLEANUP:
     if (q)
         free(q);