2 * Copyright (c) 1997 Adrian Sun (asun@zoology.washington.edu)
3 * All Rights Reserved. See COPYRIGHT.
8 #endif /* HAVE_CONFIG_H */
17 #include <sys/socket.h>
18 #include <netinet/in.h>
19 #include <arpa/inet.h>
21 #include <atalk/logger.h>
22 #include <atalk/util.h>
23 #include <atalk/dsi.h>
24 #include <atalk/afp.h>
25 #include <atalk/compat.h>
26 #include <atalk/server_child.h>
27 #include <atalk/globals.h>
28 #include <atalk/errchk.h>
31 #include <atalk/ldapconfig.h>
34 #include "afp_config.h"
38 #include "afp_zeroconf.h"
42 * Free and cleanup all linked DSI objects from config
44 * Preserve object pointed to by "dsi".
45 * "dsi" can be NULL in which case all DSI objects are freed
47 void configfree(AFPObj *obj, DSI *dsi)
51 afp_options_free(&obj->options);
53 for (p = obj->dsi; p; p = q) {
64 /* the master loaded the volumes for zeroconf, get rid of that */
69 * Get everything running
71 int configinit(AFPObj *obj)
74 DSI *dsi, **next = &obj->dsi;
77 LOG(log_debug, logtype_afpd, "DSIConfigInit: hostname: %s, listen: %s, port: %s",
78 obj->options.hostname,
79 obj->options.listen ? obj->options.listen : "(default: hostname)",
82 /* obj->options->listen is of the from "IP[:port][,IP:[PORT], ...]" */
83 /* obj->options->port is the default port to listen (548) */
85 EC_NULL( q = p = strdup(obj->options.listen) );
86 EC_NULL( p = strtok(p, ",") );
89 if ((dsi = dsi_init(obj, obj->options.hostname, p, obj->options.port)) == NULL)
92 status_init(obj, dsi);
96 LOG(log_note, logtype_afpd, "Netatalk AFP/TCP listening on %s:%d",
97 getip_string((struct sockaddr *)&dsi->server),
98 getip_port((struct sockaddr *)&dsi->server));
100 p = strtok(NULL, ",");
103 if (obj->dsi == NULL)
106 auth_load(obj->options.uampath, obj->options.uamlist);
107 set_signature(&obj->options);
110 /* Parse afp_ldap.conf */
111 acl_ldap_readconfig(obj->iniconfig);
112 #endif /* HAVE_LDAP */
114 /* Now register with zeroconf, we also need the volumes for that */
115 if (! (obj->options.flags & OPTION_NOZEROCONF)) {
117 zeroconf_register(obj);