- if (nbp_name(convname, &Obj, &Type, &Zone )) {
- LOG(log_error, logtype_afpd, "main: can't parse %s", options->server );
- goto serv_free_return;
- }
- if (convname)
- free (convname);
-
- /* dup Obj, Type and Zone as they get assigned to a single internal
- * buffer by nbp_name */
- if ((config->obj.Obj = strdup(Obj)) == NULL)
- goto serv_free_return;
-
- if ((config->obj.Type = strdup(Type)) == NULL) {
- free(config->obj.Obj);
- goto serv_free_return;
- }
-
- if ((config->obj.Zone = strdup(Zone)) == NULL) {
- free(config->obj.Obj);
- free(config->obj.Type);
- goto serv_free_return;
- }
-
- /* make sure we're not registered */
- nbp_unrgstr(Obj, Type, Zone, &options->ddpaddr);
- if (nbp_rgstr( atp_sockaddr( atp ), Obj, Type, Zone ) < 0 ) {
- LOG(log_error, logtype_afpd, "Can't register %s:%s@%s", Obj, Type, Zone );
- free(config->obj.Obj);
- free(config->obj.Type);
- free(config->obj.Zone);
- goto serv_free_return;
- }
-
- LOG(log_info, logtype_afpd, "%s:%s@%s started on %u.%u:%u (%s)", Obj, Type, Zone,
- ntohs( atp_sockaddr( atp )->sat_addr.s_net ),
- atp_sockaddr( atp )->sat_addr.s_node,
- atp_sockaddr( atp )->sat_port, VERSION );
-
- config->fd = atp_fileno(atp);
- config->obj.handle = asp;
- config->obj.config = config;
- config->obj.proto = AFPPROTO_ASP;
-
- memcpy(&config->obj.options, options, sizeof(struct afp_options));
- config->optcount = refcount;
- (*refcount)++;
-
- config->server_start = asp_start;
- config->server_cleanup = asp_cleanup;
-
- return config;
-
-serv_free_return:
- asp_close(asp);
- free(config);
- return NULL;
-}
-#endif /* no afp/asp */
-
-
-static AFPConfig *DSIConfigInit(const struct afp_options *options,
- unsigned char *refcount,
- const dsi_proto protocol)
-{
- AFPConfig *config;
- DSI *dsi;
- char *p, *q;
-
- if ((config = (AFPConfig *) calloc(1, sizeof(AFPConfig))) == NULL) {
- LOG(log_error, logtype_afpd, "DSIConfigInit: malloc(config): %s", strerror(errno) );
- return NULL;
- }
-
- LOG(log_debug, logtype_afpd, "DSIConfigInit: hostname: %s, ip/port: %s/%s, ",
- options->hostname,
- options->ipaddr ? options->ipaddr : "default",
- options->port ? options->port : "548");
-
- if ((dsi = dsi_init(protocol, "afpd", options->hostname,
- options->ipaddr, options->port,
- options->flags & OPTION_PROXY,
- options->server_quantum)) == NULL) {
- LOG(log_error, logtype_afpd, "main: dsi_init: %s", strerror(errno) );
- free(config);
- return NULL;
- }