- syslog(LOG_INFO, "Sucessfully registered %s with SRVLOC", srvloc_url);
-
-srvloc_reg_err:
- SLPClose(hslp);
-#endif /* USE_SRVLOC */
-
-
- config->fd = dsi->serversock;
- config->obj.handle = dsi;
- config->obj.config = config;
- config->obj.proto = AFPPROTO_DSI;
-
- memcpy(&config->obj.options, options, sizeof(struct afp_options));
- /* get rid of any appletalk info. we use the fact that the DSI
- * stuff is done after the ASP stuff. */
- p = config->obj.options.server;
- if (p && (q = strchr(p, ':')))
- *q = '\0';
-
- config->optcount = refcount;
- (*refcount)++;
-
- config->server_start = dsi_start;
-#ifdef USE_SRVLOC
- config->server_cleanup = dsi_cleanup;
-#endif /* USE_SRVLOC */
- return config;
-}
-
-/* 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,
- const struct afp_options *defoptions)
-{
- AFPConfig *config = NULL, *next = NULL;
- unsigned char *refcount;
-
- if ((refcount = (unsigned char *)
- calloc(1, sizeof(unsigned char))) == NULL) {
- syslog( LOG_ERR, "AFPConfigInit: calloc(refcount): %s", strerror(errno) );
- return NULL;
- }
-
-#ifndef NO_DDP
- /* handle asp transports */
- if ((options->transports & AFPTRANS_DDP) &&
- (config = ASPConfigInit(options, refcount)))
- config->defoptions = defoptions;
-#endif /* NO_DDP */
-
- /* handle dsi transports and dsi proxies. we only proxy
- * for DSI connections. */
-
- /* this should have something like the following:
- * for (i=mindsi; i < maxdsi; i++)
- * if (options->transports & (1 << i) &&
- * (next = DSIConfigInit(options, refcount, i)))
- * next->defoptions = defoptions;
- */
- if ((options->transports & AFPTRANS_TCP) &&
- (((options->flags & OPTION_PROXY) == 0) ||
- ((options->flags & OPTION_PROXY) && config))
- && (next = DSIConfigInit(options, refcount, DSI_TCPIP)))
- next->defoptions = defoptions;
-
- /* load in all the authentication modules. we can load the same
- things multiple times if necessary. however, loading different
- things with the same names will cause complaints. by not loading
- in any uams with proxies, we prevent ddp connections from succeeding.
- */
- auth_load(options->uampath, options->uamlist);
-
- /* this should be able to accept multiple dsi transports. i think
- * the only thing that gets affected is the net addresses. */
- status_init(config, next, options);
-
- /* attach dsi config to tail of asp config */
- if (config) {
- config->next = next;
- return config;
- }
-
- return next;
-}
-
-/* fill in the appropriate bits for each interface */
-AFPConfig *configinit(struct afp_options *cmdline)
-{
- FILE *fp;
- char buf[LINESIZE + 1], *p, have_option = 0;
- struct afp_options options;
- AFPConfig *config, *first = NULL;
-
- /* if config file doesn't exist, load defaults */
- if ((fp = fopen(cmdline->configfile, "r")) == NULL)
- return AFPConfigInit(cmdline, cmdline);
-
- /* scan in the configuration file */
- while (!feof(fp)) {
- if (!fgets(buf, sizeof(buf), fp) || buf[0] == '#')
- continue;
-
- /* a little pre-processing to get rid of spaces and end-of-lines */
- p = buf;
- while (p && isspace(*p))
- p++;
- if (!p || (*p == '\0'))
- continue;
-
- have_option = 1;
-
- memcpy(&options, cmdline, sizeof(options));
- if (!afp_options_parseline(p, &options))
- continue;
-
- /* this should really get a head and a tail to simplify things. */
- if (!first) {
- if ((first = AFPConfigInit(&options, cmdline)))
- config = first->next ? first->next : first;
- } else if ((config->next = AFPConfigInit(&options, cmdline))) {
- config = config->next->next ? config->next->next : config->next;
- }