- char *c, *opt;
-
- /* handle server */
- if (*buf != '-' && (c = getoption(buf, NULL)) && (opt = strdup(c)))
- options->server = opt;
-
- /* parse toggles */
- if (strstr(buf, " -nodebug"))
- options->flags &= ~OPTION_DEBUG;
-
- if (strstr(buf, " -nouservolfirst"))
- options->flags &= ~OPTION_USERVOLFIRST;
- if (strstr(buf, " -uservolfirst"))
- options->flags |= OPTION_USERVOLFIRST;
- if (strstr(buf, " -nouservol"))
- options->flags |= OPTION_NOUSERVOL;
- if (strstr(buf, " -uservol"))
- options->flags &= ~OPTION_NOUSERVOL;
- if (strstr(buf, " -proxy"))
- options->flags |= OPTION_PROXY;
- if (strstr(buf, " -noicon"))
- options->flags &= ~OPTION_CUSTOMICON;
- if (strstr(buf, " -icon"))
- options->flags |= OPTION_CUSTOMICON;
-
- /* passwd bits */
- if (strstr(buf, " -nosavepassword"))
- options->passwdbits |= PASSWD_NOSAVE;
- if (strstr(buf, " -savepassword"))
- options->passwdbits &= ~PASSWD_NOSAVE;
- if (strstr(buf, " -nosetpassword"))
- options->passwdbits &= ~PASSWD_SET;
- if (strstr(buf, " -setpassword"))
- options->passwdbits |= PASSWD_SET;
-
- /* transports */
- if (strstr(buf, " -transall"))
- options->transports = AFPTRANS_ALL;
- if (strstr(buf, " -notransall"))
- options->transports = AFPTRANS_NONE;
- if (strstr(buf, " -tcp"))
- options->transports |= AFPTRANS_TCP;
- if (strstr(buf, " -notcp"))
- options->transports &= ~AFPTRANS_TCP;
- if (strstr(buf, " -ddp"))
- options->transports |= AFPTRANS_DDP;
- if (strstr(buf, " -noddp"))
- options->transports &= ~AFPTRANS_DDP;
-
- /* figure out options w/ values. currently, this will ignore the setting
- * if memory is lacking. */
- if ((c = getoption(buf, "-defaultvol")) && (opt = strdup(c)))
- options->defaultvol = opt;
- if ((c = getoption(buf, "-systemvol")) && (opt = strdup(c)))
- options->systemvol = opt;
- if ((c = getoption(buf, "-loginmesg")) && (opt = strdup(c)))
- options->loginmesg = opt;
- if ((c = getoption(buf, "-guestname")) && (opt = strdup(c)))
- options->guest = opt;
- if ((c = getoption(buf, "-passwdfile")) && (opt = strdup(c)))
- options->passwdfile = opt;
- if ((c = getoption(buf, "-passwdminlen")))
- options->passwdminlen = MIN(1, atoi(c));
- if ((c = getoption(buf, "-loginmaxfail")))
- options->loginmaxfail = atoi(c);
- if ((c = getoption(buf, "-tickleval")))
- options->tickleval = atoi(c);
-
- if ((c = getoption(buf, "-server_quantum")))
- options->server_quantum = strtoul(c, NULL, 0);
+ char *c, *opt;
+
+ /* handle server */
+ if (*buf != '-' && (c = getoption(buf, NULL)) && (opt = strdup(c)))
+ options->server = opt;
+
+ /* 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;
+ if (strstr(buf, " -uservolfirst"))
+ options->flags |= OPTION_USERVOLFIRST;
+ if (strstr(buf, " -nouservol"))
+ options->flags |= OPTION_NOUSERVOL;
+ if (strstr(buf, " -uservol"))
+ options->flags &= ~OPTION_NOUSERVOL;
+ if (strstr(buf, " -proxy"))
+ options->flags |= OPTION_PROXY;
+ if (strstr(buf, " -noicon"))
+ options->flags &= ~OPTION_CUSTOMICON;
+ if (strstr(buf, " -icon"))
+ options->flags |= OPTION_CUSTOMICON;
+ if (strstr(buf, " -advertise_ssh"))
+ options->flags |= OPTION_ANNOUNCESSH;
+
+ /* passwd bits */
+ if (strstr(buf, " -nosavepassword"))
+ options->passwdbits |= PASSWD_NOSAVE;
+ if (strstr(buf, " -savepassword"))
+ options->passwdbits &= ~PASSWD_NOSAVE;
+ if (strstr(buf, " -nosetpassword"))
+ options->passwdbits &= ~PASSWD_SET;
+ if (strstr(buf, " -setpassword"))
+ options->passwdbits |= PASSWD_SET;
+
+ /* transports */
+ if (strstr(buf, " -transall"))
+ options->transports = AFPTRANS_ALL;
+ if (strstr(buf, " -notransall"))
+ options->transports = AFPTRANS_NONE;
+ if (strstr(buf, " -tcp"))
+ options->transports |= AFPTRANS_TCP;
+ if (strstr(buf, " -notcp"))
+ options->transports &= ~AFPTRANS_TCP;
+ if (strstr(buf, " -ddp"))
+ 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. */
+ if ((c = getoption(buf, "-defaultvol")) && (opt = strdup(c)))
+ options->defaultvol.name = opt;
+ if ((c = getoption(buf, "-systemvol")) && (opt = strdup(c)))
+ options->systemvol.name = opt;
+ if ((c = getoption(buf, "-loginmesg")) && (opt = strdup(c)))
+ options->loginmesg = opt;
+ if ((c = getoption(buf, "-guestname")) && (opt = strdup(c)))
+ options->guest = opt;
+ if ((c = getoption(buf, "-passwdfile")) && (opt = strdup(c)))
+ options->passwdfile = opt;
+ if ((c = getoption(buf, "-passwdminlen")))
+ options->passwdminlen = MIN(1, atoi(c));
+ if ((c = getoption(buf, "-loginmaxfail")))
+ options->loginmaxfail = atoi(c);
+ if ((c = getoption(buf, "-tickleval"))) {
+ options->tickleval = atoi(c);
+ if (options->tickleval <= 0) {
+ options->tickleval = 30;
+ }
+ }
+ if ((c = getoption(buf, "-timeout"))) {
+ options->timeout = atoi(c);
+ if (options->timeout <= 0) {
+ options->timeout = 4;
+ }
+ }
+
+ if ((c = getoption(buf, "-sleep"))) {
+ options->sleep = atoi(c) *120;
+ if (options->sleep <= 4) {
+ options->sleep = 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);
+ }