/*
- * $Id: afp_options.c,v 1.16 2002-01-04 04:45:47 sibaz Exp $
+ * $Id: afp_options.c,v 1.29 2003-01-12 14:39:57 didg Exp $
*
* Copyright (c) 1997 Adrian Sun (asun@zoology.washington.edu)
* Copyright (c) 1990,1993 Regents of The University of Michigan.
free(opt->nlspath);
if (opt->passwdfile && (opt->passwdfile != save->passwdfile))
free(opt->passwdfile);
+ if (opt->signature && (opt->signature != save->signature))
+ free(opt->signature);
}
/* initialize options */
options->passwdfile = _PATH_AFPDPWFILE;
options->tickleval = 30;
options->timeout = 4;
+ options->server_notif = 1;
options->authprintdir = NULL;
+ options->signature = "host";
options->umask = 0;
#ifdef ADMIN_GRP
options->admingid = 0;
/* parse toggles */
if (strstr(buf, " -nodebug"))
options->flags &= ~OPTION_DEBUG;
+#ifdef USE_SRVLOC
+ if (strstr(buf, " -noslp"))
+ options->flags |= OPTION_NOSLP;
+#endif /* USE_SRVLOC */
if (strstr(buf, " -nouservolfirst"))
options->flags &= ~OPTION_USERVOLFIRST;
options->transports |= AFPTRANS_DDP;
if (strstr(buf, " -noddp"))
options->transports &= ~AFPTRANS_DDP;
+ if (strstr(buf, "-client_polling"))
+ options->server_notif = 0;
/* figure out options w/ values. currently, this will ignore the setting
* if memory is lacking. */
options->loginmaxfail = atoi(c);
if ((c = getoption(buf, "-tickleval"))) {
options->tickleval = atoi(c);
- if (options->tickleval <= 0) {
- options->tickleval = 30;
- }
- }
+ if (options->tickleval <= 0) {
+ options->tickleval = 30;
+ }
+ }
if ((c = getoption(buf, "-timeout"))) {
options->timeout = atoi(c);
- if (options->timeout <= 0) {
- options->timeout = 4;
- }
- }
+ if (options->timeout <= 0) {
+ options->timeout = 4;
+ }
+ }
if ((c = getoption(buf, "-server_quantum")))
options->server_quantum = strtoul(c, NULL, 0);
+#ifndef DISABLE_LOGGER
+ /* -setuplogtype <syslog|filelog> <logtype> <loglevel> <filename>*/
+ /* -[no]setuplog <logtype> <loglevel> [<filename>]*/
+ if ((c = getoption(buf, "-setuplog")))
+ {
+ char *ptr, *logsource, *logtype, *loglevel, *filename;
+
+ LOG(log_debug6, logtype_afpd, "setting up logtype, c is %s", c);
+ ptr = c;
+
+ /*
+ logsource = ptr = c;
+ if (ptr)
+ {
+ ptr = strpbrk(ptr, " \t");
+ if (ptr)
+ {
+ *ptr++ = 0;
+ while (*ptr && isspace(*ptr))
+ ptr++;
+ }
+ }
+ */
+
+ logtype = ptr;
+ if (ptr)
+ {
+ ptr = strpbrk(ptr, " \t");
+ if (ptr)
+ {
+ *ptr++ = 0;
+ while (*ptr && isspace(*ptr))
+ ptr++;
+ }
+ }
+
+ loglevel = ptr;
+ if (ptr)
+ {
+ ptr = strpbrk(ptr, " \t");
+ if (ptr)
+ {
+ *ptr++ = 0;
+ while (*ptr && isspace(*ptr))
+ ptr++;
+ }
+ }
+
+ filename = ptr;
+ if (ptr)
+ {
+ ptr = strpbrk(ptr, " \t");
+ if (ptr)
+ {
+ *ptr++ = 0;
+ while (*ptr && isspace(*ptr))
+ ptr++;
+ }
+ }
+
+ LOG(log_debug7, logtype_afpd, "calling setuplog %s %s %s",
+ logtype, loglevel, filename);
+
+ setuplog(logtype, loglevel, filename);
+ }
+
+ if ((c = getoption(buf, "-unsetuplog")))
+ {
+ char *ptr, *logtype, *loglevel, *filename;
+
+ LOG(log_debug6, logtype_afpd, "unsetting up logtype, c is %s", c);
+
+ ptr = c;
+ logtype = ptr;
+ if (ptr)
+ {
+ ptr = strpbrk(ptr, " \t");
+ if (ptr)
+ {
+ *ptr++ = 0;
+ while (*ptr && isspace(*ptr))
+ ptr++;
+ }
+ }
+
+ loglevel = ptr;
+ if (ptr)
+ {
+ ptr = strpbrk(ptr, " \t");
+ if (ptr)
+ {
+ *ptr++ = 0;
+ while (*ptr && isspace(*ptr))
+ ptr++;
+ }
+ }
+
+ filename = ptr;
+ if (ptr)
+ {
+ ptr = strpbrk(ptr, " \t");
+ if (ptr)
+ {
+ *ptr++ = 0;
+ while (*ptr && isspace(*ptr))
+ ptr++;
+ }
+ }
+
+ LOG(log_debug7, logtype_afpd, "calling setuplog %s %s %s",
+ logtype, NULL, filename);
+ setuplog(logtype, NULL, filename);
+ }
+#endif /* DISABLE_LOGGER */
#ifdef ADMIN_GRP
if ((c = getoption(buf, "-admingroup"))) {
struct group *gr = getgrnam(c);
struct in_addr inaddr;
if (inet_aton(c, &inaddr) && (opt = strdup(c))) {
if (!gethostbyaddr((const char *) &inaddr, sizeof(inaddr), AF_INET))
- LOG(log_info, logtype_default, "WARNING: can't find %s\n", opt);
+ LOG(log_info, logtype_afpd, "WARNING: can't find %s\n", opt);
options->ipaddr = opt;
}
}
options->port = atoi(c);
if ((c = getoption(buf, "-ddpaddr")))
atalk_aton(c, &options->ddpaddr);
+ if ((c = getoption(buf, "-signature")) && (opt = strdup(c)))
+ options->signature = opt;
/* do a little checking for the domain name. */
if ((c = getoption(buf, "-fqdn"))) {
perror( "gethostname" );
return 0;
}
- if (( p = strchr(options->hostname, '.' )) != 0 ) {
+ if (NULL != ( p = strchr(options->hostname, '.' )) ) {
*p = '\0';
}
- if (( p = strrchr( av[ 0 ], '/' )) == NULL ) {
+ if (NULL == ( p = strrchr( av[ 0 ], '/' )) ) {
p = av[ 0 ];
} else {
p++;
}
- while (( c = getopt( ac, av, OPTIONS )) != EOF ) {
+ while (EOF != ( c = getopt( ac, av, OPTIONS )) ) {
switch ( c ) {
case 'd' :
options->flags |= OPTION_DEBUG;
options->flags |= OPTION_CUSTOMICON;
break;
case 'm':
- options->umask = strtol(optarg, &tmp, 8);
+ options->umask = strtoul(optarg, &tmp, 8);
if ((options->umask > 0777)) {
fprintf(stderr, "%s: out of range umask setting provided\n", p);
err++;