]> arthur.barton.de Git - netatalk.git/blobdiff - etc/afpd/afp_config.c
Merge from 2-1
[netatalk.git] / etc / afpd / afp_config.c
index 0a46ee2d63acf117d495260f5b81d52a69840715..cb836b81a7a19e7a760fbc1e77df1bf3cf077bf4 100644 (file)
@@ -1,6 +1,4 @@
 /*
- * $Id: afp_config.c,v 1.32 2010-03-29 15:22:57 franklahm Exp $
- *
  * Copyright (c) 1997 Adrian Sun (asun@zoology.washington.edu)
  * All Rights Reserved.  See COPYRIGHT.
  */
@@ -50,7 +48,7 @@ char *strchr (), *strrchr ();
 #ifdef USE_SRVLOC
 #include <slp.h>
 #endif /* USE_SRVLOC */
-#ifdef HAVE_NFSv4_ACLS
+#ifdef HAVE_ACLS
 #include <atalk/ldapconfig.h>
 #endif
 
@@ -58,6 +56,8 @@ char *strchr (), *strrchr ();
 #include "afp_config.h"
 #include "uam_auth.h"
 #include "status.h"
+#include "volume.h"
+#include "afp_zeroconf.h"
 
 #define LINESIZE 1024  
 
@@ -96,6 +96,9 @@ void configfree(AFPConfig *configs, const AFPConfig *config)
         }
         free(p);
     }
+
+    /* the master loaded the volumes for zeroconf, get rid of that */
+    unload_volumes_and_extmap();
 }
 
 #ifdef USE_SRVLOC
@@ -157,9 +160,9 @@ static char * srvloc_encode(const struct afp_options *options, const char *name)
 }
 #endif /* USE_SRVLOC */
 
-#ifdef USE_SRVLOC
 static void dsi_cleanup(const AFPConfig *config)
 {
+#ifdef USE_SRVLOC
     SLPError err;
     SLPError callbackerr;
     SLPHandle hslp;
@@ -192,8 +195,8 @@ static void dsi_cleanup(const AFPConfig *config)
 srvloc_dereg_err:
     dsi->srvloc_url[0] = '\0';
     SLPClose(hslp);
-}
 #endif /* USE_SRVLOC */
+}
 
 #ifndef NO_DDP
 static void asp_cleanup(const AFPConfig *config)
@@ -455,7 +458,6 @@ srvloc_reg_err:
     }
 #endif /* USE_SRVLOC */
 
-
     config->fd = dsi->serversock;
     config->obj.handle = dsi;
     config->obj.config = config;
@@ -478,7 +480,7 @@ srvloc_reg_err:
 /* allocate server configurations. this should really store the last
  * entry in config->last or something like that. that would make
  * supporting multiple dsi transports easier. */
-static AFPConfig *AFPConfigInit(const struct afp_options *options,
+static AFPConfig *AFPConfigInit(struct afp_options *options,
                                 const struct afp_options *defoptions)
 {
     AFPConfig *config = NULL, *next = NULL;
@@ -497,6 +499,10 @@ static AFPConfig *AFPConfigInit(const struct afp_options *options,
         config->defoptions = defoptions;
 #endif /* NO_DDP */
 
+
+    /* set signature */
+    set_signature(options);
+
     /* handle dsi transports and dsi proxies. we only proxy
      * for DSI connections. */
 
@@ -541,12 +547,10 @@ AFPConfig *configinit(struct afp_options *cmdline)
     struct afp_options options;
     AFPConfig *config=NULL, *first = NULL; 
 
-#ifdef HAVE_NFSv4_ACLS
+#ifdef HAVE_ACLS
     /* Parse afp_ldap.conf first so we can set the uuid option */
-    LOG(log_debug, logtype_afpd, "Start parsing afp_ldap.conf");
     acl_ldap_readconfig(_PATH_ACL_LDAPCONF);
-    LOG(log_debug, logtype_afpd, "Finished parsing afp_ldap.conf");
-#endif
+#endif /* HAVE_ACLS */
 
     /* if config file doesn't exist, load defaults */
     if ((fp = fopen(cmdline->configfile, "r")) == NULL)
@@ -556,8 +560,6 @@ AFPConfig *configinit(struct afp_options *cmdline)
         return AFPConfigInit(cmdline, cmdline);
     }
 
-    LOG(log_debug, logtype_afpd, "Loading ConfigFile"); 
-
     /* scan in the configuration file */
     len = 0;
     while (!feof(fp)) {
@@ -583,13 +585,15 @@ AFPConfig *configinit(struct afp_options *cmdline)
         if (!afp_options_parseline(p, &options))
             continue;
 
-#ifdef HAVE_NFSv4_ACLS
+#ifdef HAVE_ACLS
        /* Enable UUID support if LDAP config is complete */
-       if (ldap_config_valid)
-           options.flags |= OPTION_UUID;
-#endif
+        if (ldap_config_valid) {
+            LOG(log_info, logtype_afpd, "Enabling UUID support");
+            options.flags |= OPTION_UUID;
+        }
+#endif /* HAVE_ACLS */
 
-        /* this should really get a head and a tail to simplify things. */
+        /* AFPConfigInit can return two linked configs due to DSI and ASP */
         if (!first) {
             if ((first = AFPConfigInit(&options, cmdline)))
                 config = first->next ? first->next : first;
@@ -604,5 +608,9 @@ AFPConfig *configinit(struct afp_options *cmdline)
     if (!have_option)
         first = AFPConfigInit(cmdline, cmdline);
 
+    /* Now register with zeroconf, we also need the volumes for that */
+    load_volumes(&first->obj);
+    zeroconf_register(first);
+
     return first;
 }