]> arthur.barton.de Git - netatalk.git/blobdiff - etc/afpd/afp_options.c
commenting changes, more autoconf support in afpd, etc
[netatalk.git] / etc / afpd / afp_options.c
index 134bbf0d9ffe9ade0c5ed4eba5b28f83bd073c61..199d09f6e14cd1c415dc549beb0fb4f570347c3f 100644 (file)
@@ -1,4 +1,6 @@
 /* 
+ * $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
@@ -114,6 +126,10 @@ void afp_options_init(struct afp_options *options)
   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
@@ -194,10 +210,21 @@ int afp_options_parseline(char *buf, struct afp_options *options)
   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)))
@@ -205,7 +232,7 @@ int afp_options_parseline(char *buf, struct afp_options *options)
   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)) 
@@ -216,18 +243,18 @@ int afp_options_parseline(char *buf, struct afp_options *options)
 
   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;
     }
   }
@@ -328,9 +355,9 @@ int afp_options_parse(int ac, char **av, struct afp_options *options)
 
 #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;
 }