/*
- * $Id: afp_options.c,v 1.30.2.2.2.1 2003-09-09 16:42:19 didg Exp $
+ * $Id: afp_options.c,v 1.30.2.2.2.8 2004-06-09 02:07:15 bfernhomberg Exp $
*
* Copyright (c) 1997 Adrian Sun (asun@zoology.washington.edu)
* Copyright (c) 1990,1993 Regents of The University of Michigan.
#endif /* MIN */
/* FIXME CNID */
-char *Cnid_srv;
-int Cnid_port;
+char Cnid_srv[MAXHOSTNAMELEN + 1] = "localhost";
+int Cnid_port = 4700;
#define OPTIONS "dn:f:s:uc:g:P:ptDS:TL:F:U:Ivm:"
#define LENGTH 512
free(opt->uampath);
if (opt->uamlist && (opt->uamlist != save->uamlist))
free(opt->uamlist);
- if (opt->nlspath && (opt->nlspath != save->nlspath))
- free(opt->nlspath);
if (opt->passwdfile && (opt->passwdfile != save->passwdfile))
free(opt->passwdfile);
if (opt->signature && (opt->signature != save->signature))
options->defaultvol.name = _PATH_AFPDDEFVOL;
options->systemvol.name = _PATH_AFPDSYSVOL;
options->configfile = _PATH_AFPDCONF;
- options->nlspath = _PATH_AFPDNLSPATH;
options->uampath = _PATH_AFPDUAMPATH;
options->uamlist = "uams_clrtxt.so,uams_dhx.so";
options->guest = "nobody";
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->uampath = opt;
if ((c = getoption(buf, "-uamlist")) && (opt = strdup(c)))
options->uamlist = opt;
- if ((c = getoption(buf, "-nlspath")) && (opt = strdup(c)))
- options->nlspath = opt;
if ((c = getoption(buf, "-ipaddr"))) {
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_afpd, "WARNING: can't find %s\n", opt);
+ LOG(log_info, logtype_afpd, "WARNING: can't find %s", opt);
options->ipaddr = opt;
}
}
- /* FIXME CNID */
+ /* FIXME CNID Cnid_srv is a server attribute */
if ((c = getoption(buf, "-cnidserver"))) {
char *p;
-
- Cnid_srv = strdup(c);
- p = strchr(Cnid_srv, ':');
- *p = 0;
- Cnid_port = atoi(p +1);
+ int len;
+ p = strchr(c, ':');
+ if (p != NULL && (len = p - c) <= MAXHOSTNAMELEN) {
+ memcpy(Cnid_srv, c, len);
+ Cnid_srv[len] = 0;
+ Cnid_port = atoi(p +1);
+ }
}
if ((c = getoption(buf, "-port")))
if ((opt = strdup(c)))
options->fqdn = opt;
}
+ else {
+ LOG(log_error, logtype_afpd, "error parsing -fqdn, gethostbyname failed for: %s", c);
+ }
}
if ((c = getoption(buf, "-unixcodepage"))) {
- options->unixcodepage = c;
- if ( 0 == ( options->unixcharset = add_charset(options->unixcodepage)) ) {
- options->unixcodepage= "LOCALE";
- options->unixcharset = CH_UNIX;
+ if ((charset_t)-1 == ( options->unixcharset = add_charset(c)) ) {
+ options->unixcharset = CH_UNIX;
+ LOG(log_warning, logtype_afpd, "setting Unix codepage to '%s' failed", c);
}
+ else {
+ if ((opt = strdup(c)))
+ options->unixcodepage = opt;
+ }
}
if ((c = getoption(buf, "-maccodepage"))) {
- options->maccodepage = c;
- if ( 0 == ( options->maccharset = add_charset(options->maccodepage)) ) {
- options->maccodepage= "Mac_Roman";
- options->maccharset = CH_MAC;
+ if ((charset_t)-1 == ( options->maccharset = add_charset(c)) ) {
+ options->maccharset = CH_MAC;
+ LOG(log_warning, logtype_afpd, "setting Mac codepage to '%s' failed", c);
}
- LOG(log_debug, logtype_afpd, "Setting Mac Codepage to '%s'", options->maccodepage);
+ else {
+ if ((opt = strdup(c)))
+ options->maccodepage = opt;
+ }
}
return 1;