/*
+ * $Id: afp_options.c,v 1.7 2001-06-20 18:33:04 rufustfirefly Exp $
+ *
* Copyright (c) 1997 Adrian Sun (asun@zoology.washington.edu)
* Copyright (c) 1990,1993 Regents of The University of Michigan.
* All Rights Reserved. See COPYRIGHT.
#ifdef HAVE_CONFIG_H
#include "config.h"
-#endif
+#endif /* HAVE_CONFIG_H */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
+#ifdef HAVE_UNISTD_H
#include <unistd.h>
+#endif /* HAVE_UNISTD_H */
#include <sys/param.h>
#include <sys/socket.h>
#include <syslog.h>
#include <netinet/in.h>
#include <arpa/inet.h>
+#ifdef HAVE_NETDB_H
#include <netdb.h>
+#endif /* HAVE_NETDB_H */
#include <atalk/paths.h>
+#include <atalk/util.h>
#include "globals.h"
#include "status.h"
#include "auth.h"
#include <atalk/compat.h>
+#ifdef ADMIN_GRP
+#include <grp.h>
+#include <sys/types.h>
+#endif /* ADMIN_GRP */
+
#ifndef MIN
#define MIN(a, b) ((a) < (b) ? (a) : (b))
-#endif
+#endif /* MIN */
#define OPTIONS "dn:f:s:uc:g:P:ptDS:TL:F:U:I"
#define LENGTH 512
options->transports = AFPTRANS_ALL;
options->passwdfile = _PATH_AFPDPWFILE;
options->tickleval = 30;
+ options->authprintdir = NULL;
+#ifdef ADMIN_GRP
+ options->admingid = 0;
+#endif /* ADMIN_GRP */
}
/* parse an afpd.conf line. i'm doing it this way because it's
if ((c = getoption(buf, "-tickleval")))
options->tickleval = atoi(c);
- if (c = getoption(buf, "-server_quantum"))
+ if ((c = getoption(buf, "-server_quantum")))
options->server_quantum = strtoul(c, NULL, 0);
+#ifdef ADMIN_GRP
+ if ((c = getoption(buf, "-admingroup"))) {
+ struct group *gr = getgrnam(c);
+ if (gr != NULL) {
+ options->admingid = gr->gr_gid;
+ }
+ }
+#endif /* ADMIN_GRP */
+
+ if ((c = getoption(buf, "-authprintdir")) && (opt = strdup(c)))
+ options->authprintdir = opt;
if ((c = getoption(buf, "-uampath")) && (opt = strdup(c)))
options->uampath = opt;
if ((c = getoption(buf, "-uamlist")) && (opt = strdup(c)))
if ((c = getoption(buf, "-nlspath")) && (opt = strdup(c)))
options->nlspath = opt;
- if (c = getoption(buf, "-ipaddr")) {
+ 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))
if ((c = getoption(buf, "-port")))
options->port = atoi(c);
- if (c = getoption(buf, "-ddpaddr"))
+ if ((c = getoption(buf, "-ddpaddr")))
atalk_aton(c, &options->ddpaddr);
/* do a little checking for the domain name. */
- if (c = getoption(buf, "-fqdn")) {
+ if ((c = getoption(buf, "-fqdn"))) {
char *p = strchr(c, ':');
if (p)
*p = '\0';
if (gethostbyname(c)) {
if (p)
*p = ':';
- if (opt = strdup(c))
+ if ((opt = strdup(c)))
options->fqdn = opt;
}
}
#ifdef ultrix
openlog( p, LOG_PID );
-#else ultrix
- openlog( p, LOG_NDELAY|LOG_PID, LOG_DAEMON );
-#endif ultrix
+#else /* ultrix */
+ openlog( p, LOG_NDELAY|LOG_PID, LOG_DAEMON);
+#endif /* ultrix */
return 1;
}