]> arthur.barton.de Git - netatalk.git/blobdiff - etc/afpd/afp_config.c
Merge sf
[netatalk.git] / etc / afpd / afp_config.c
index 1fafee03a04641623c898de1a6af916260911ac7..27767c10b509378588ba3262783ee57d60361966 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();
 }
@@ -72,7 +73,10 @@ int configinit(AFPObj *obj)
 {
     EC_INIT;
     DSI *dsi, **next = &obj->dsi;
-    char *p, *q = NULL;
+    char *p = NULL, *q = NULL;
+
+    auth_load(obj->options.uampath, obj->options.uamlist);
+    set_signature(&obj->options);
 
     LOG(log_debug, logtype_afpd, "DSIConfigInit: hostname: %s, listen: %s, port: %s",
         obj->options.hostname,
@@ -82,10 +86,12 @@ int configinit(AFPObj *obj)
     /* obj->options->listen is of the from "IP[:port][,IP:[PORT], ...]" */
     /* obj->options->port is the default port to listen (548) */
 
-    EC_NULL( q = p = strdup(obj->options.listen) );
-    EC_NULL( p = strtok(p, ",") );
+    if (obj->options.listen) {
+        EC_NULL( q = p = strdup(obj->options.listen) );
+        EC_NULL( p = strtok(p, ", ") );
+    }
 
-    while (p) {
+    while (1) {
         if ((dsi = dsi_init(obj, obj->options.hostname, p, obj->options.port)) == NULL)
             break;
 
@@ -97,15 +103,16 @@ int configinit(AFPObj *obj)
             getip_string((struct sockaddr *)&dsi->server),
             getip_port((struct sockaddr *)&dsi->server));
 
-        p = strtok(NULL, ",");
+        if (p)
+            /* p is NULL if ! obj->options.listen */
+            p = strtok(NULL, ", ");
+        if (!p)
+            break;
     }
 
     if (obj->dsi == NULL)
         EC_FAIL;
 
-    auth_load(obj->options.uampath, obj->options.uamlist);
-    set_signature(&obj->options);
-
 #ifdef HAVE_LDAP
     /* Parse afp_ldap.conf */
     acl_ldap_readconfig(obj->iniconfig);
@@ -117,6 +124,20 @@ int configinit(AFPObj *obj)
         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 ((p = iniparser_getstring(obj->iniconfig, INISEC_AFP, "fcecoalesce", NULL))) {
+               LOG(log_note, logtype_afpd, "Fce coalesce: %s", p);
+               fce_set_coalesce(p);
+    }
+    if ((p = iniparser_getstring(obj->iniconfig, INISEC_AFP, "fceevents", NULL))) {
+               LOG(log_note, logtype_afpd, "Fce events: %s", p);
+               fce_set_events(p);
+    }
+
+
 EC_CLEANUP:
     if (q)
         free(q);