]> arthur.barton.de Git - netatalk.git/blobdiff - etc/afpd/afp_options.c
Merge from branch-2-1
[netatalk.git] / etc / afpd / afp_options.c
index 0a1c9e4d6a8516c49ea65ee8d299fe0da2ad50b9..ca1a040d338a4f260c34728a00764e331874da93 100644 (file)
@@ -1,6 +1,4 @@
 /*
- * $Id: afp_options.c,v 1.48 2009-11-05 14:38:07 franklahm 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.
@@ -49,6 +47,7 @@ char *strchr (), *strrchr ();
 #include "globals.h"
 #include "status.h"
 #include "auth.h"
+#include "dircache.h"
 
 #include <atalk/compat.h>
 
@@ -137,8 +136,8 @@ void afp_options_free(struct afp_options *opt,
         free(opt->uamlist);
     if (opt->passwdfile && (opt->passwdfile != save->passwdfile))
         free(opt->passwdfile);
-    if (opt->signature && (opt->signature != save->signature))
-       free(opt->signature);
+    if (opt->signatureopt && (opt->signatureopt != save->signatureopt))
+       free(opt->signatureopt);
     if (opt->k5service && (opt->k5service != save->k5service))
        free(opt->k5service);
     if (opt->k5realm && (opt->k5realm != save->k5realm))
@@ -154,6 +153,8 @@ void afp_options_free(struct afp_options *opt,
        free(opt->ntdomain);
     if (opt->ntseparator && (opt->ntseparator != save->ntseparator))
        free(opt->ntseparator);
+    if (opt->logconfig && (opt->logconfig != save->logconfig))
+       free(opt->logconfig);
 }
 
 /* initialize options */
@@ -165,6 +166,8 @@ void afp_options_init(struct afp_options *options)
     options->defaultvol.name = _PATH_AFPDDEFVOL;
     options->systemvol.name = _PATH_AFPDSYSVOL;
     options->configfile = _PATH_AFPDCONF;
+    options->sigconffile = _PATH_AFPDSIGCONF;
+    options->uuidconf = _PATH_AFPDUUIDCONF;
     options->uampath = _PATH_AFPDUAMPATH;
     options->uamlist = "uams_dhx.so,uams_dhx2.so";
     options->guest = "nobody";
@@ -176,7 +179,7 @@ void afp_options_init(struct afp_options *options)
     options->sleep = 10* 120; /* 10 h in 30 seconds tick */
     options->server_notif = 1;
     options->authprintdir = NULL;
-    options->signature = "host";
+    options->signatureopt = "auto";
     options->umask = 0;
 #ifdef ADMIN_GRP
     options->admingid = 0;
@@ -191,6 +194,13 @@ void afp_options_init(struct afp_options *options)
     options->volnamelen = 80; /* spec: 255, 10.1: 73, 10.4/10.5: 80 */
     options->ntdomain = NULL;
     options->ntseparator = NULL;
+#ifdef USE_SRVLOC
+    /* don't advertize slp by default */
+    options->flags |= OPTION_NOSLP;
+#endif
+    options->dircachesize = DEFAULT_MAX_DIRCACHE_SIZE;
+    options->flags |= OPTION_ACL2MACCESS;
+    options->flags |= OPTION_UUID;
 }
 
 /* parse an afpd.conf line. i'm doing it this way because it's
@@ -213,10 +223,13 @@ int afp_options_parseline(char *buf, struct afp_options *options)
     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, " -slp"))
+        options->flags &= ~OPTION_NOSLP;
+#endif
+#ifdef USE_ZEROCONF
+    if (strstr(buf, " -nozeroconf"))
+        options->flags |= OPTION_NOZEROCONF;
+#endif
     if (strstr(buf, " -nouservolfirst"))
         options->flags &= ~OPTION_USERVOLFIRST;
     if (strstr(buf, " -uservolfirst"))
@@ -233,6 +246,8 @@ int afp_options_parseline(char *buf, struct afp_options *options)
         options->flags |= OPTION_CUSTOMICON;
     if (strstr(buf, " -advertise_ssh"))
         options->flags |= OPTION_ANNOUNCESSH;
+    if (strstr(buf, " -noacl2maccess"))
+        options->flags &= ~OPTION_ACL2MACCESS;
 
     /* passwd bits */
     if (strstr(buf, " -nosavepassword"))
@@ -277,8 +292,22 @@ int afp_options_parseline(char *buf, struct afp_options *options)
         options->defaultvol.name = opt;
     if ((c = getoption(buf, "-systemvol")) && (opt = strdup(c)))
         options->systemvol.name = opt;
-    if ((c = getoption(buf, "-loginmesg")) && (opt = strdup(c)))
+    if ((c = getoption(buf, "-loginmesg")) && (opt = strdup(c))) {
+        int i = 0, j = 0;
+        while (c[i]) {
+            if (c[i] != '\\') {
+                opt[j++] = c[i];
+            } else {
+                i++;
+                if (c[i] == 'n')
+                    opt[j++] = '\n';
+            }
+            i++;
+        }
+        opt[j] = 0;
         options->loginmesg = opt;
+        
+    }
     if ((c = getoption(buf, "-guestname")) && (opt = strdup(c)))
         options->guest = opt;
     if ((c = getoption(buf, "-passwdfile")) && (opt = strdup(c)))
@@ -328,6 +357,7 @@ int afp_options_parseline(char *buf, struct afp_options *options)
         char *optstr;
         if ((optstr = getoption(c, "-setuplog"))) {
             setuplog(optstr);
+            options->logconfig = optstr; /* at least store the last (possibly only) one */
             c += sizeof("-setuplog");
         }
     }
@@ -365,6 +395,7 @@ int afp_options_parseline(char *buf, struct afp_options *options)
         options->uamlist = opt;
 
     if ((c = getoption(buf, "-ipaddr"))) {
+#if 0
         struct in_addr inaddr;
         if (inet_aton(c, &inaddr) && (opt = strdup(c))) {
             if (!gethostbyaddr((const char *) &inaddr, sizeof(inaddr), AF_INET))
@@ -374,6 +405,8 @@ int afp_options_parseline(char *buf, struct afp_options *options)
         else {
             LOG(log_error, logtype_afpd, "Error parsing -ipaddr, is %s in numbers-and-dots notation?", c);
         }
+#endif
+        options->ipaddr = strdup(c);
     }
 
     /* FIXME CNID Cnid_srv is a server attribute */
@@ -392,7 +425,7 @@ int afp_options_parseline(char *buf, struct afp_options *options)
     if ((c = getoption(buf, "-ddpaddr")))
         atalk_aton(c, &options->ddpaddr);
     if ((c = getoption(buf, "-signature")) && (opt = strdup(c)))
-        options->signature = opt;
+        options->signatureopt = opt;
 
     /* do a little checking for the domain name. */
     if ((c = getoption(buf, "-fqdn"))) {
@@ -441,6 +474,9 @@ int afp_options_parseline(char *buf, struct afp_options *options)
 
     if ((c = getoption(buf, "-ntseparator")) && (opt = strdup(c)))
        options->ntseparator = opt;
+
+    if ((c = getoption(buf, "-dircachesize")))
+        options->dircachesize = atoi(c);
      
     return 1;
 }
@@ -460,18 +496,21 @@ static void show_version( void )
 
        puts( "afpd has been compiled with support for these features:\n" );
 
-       printf( "        AFP3.1 support:\t" );
+       printf( "        AFP3.x support:\t" );
 #ifdef AFP3x
        puts( "Yes" );
 #else
        puts( "No" );
 #endif
 
-       printf( "      Transport layers:\t" );
+        printf( "        TCP/IP Support:\t" );
+        puts( "Yes" );
+
+       printf( "DDP(AppleTalk) Support:\t" );
 #ifdef NO_DDP
-       puts( "TCP/IP" );
+       puts( "No" );
 #else
-       puts( "TCP/IP DDP" );
+       puts( "Yes" );
 #endif
 
        printf( "         CNID backends:\t" );
@@ -518,6 +557,13 @@ static void show_version_extended(void )
        puts( "No" );
 #endif
 
+       printf( "      Zeroconf support:\t" );
+#ifdef USE_ZEROCONF
+       puts( "Yes" );
+#else
+       puts( "No" );
+#endif
+
        printf( "  TCP wrappers support:\t" );
 #ifdef TCPWRAP
        puts( "Yes" );
@@ -566,6 +612,23 @@ static void show_version_extended(void )
 #else
        puts( "No" );
 #endif
+
+       printf( "           ACL support:\t" );
+#ifdef HAVE_ACLS
+       puts( "Yes" );
+#else
+       puts( "No" );
+#endif
+
+       printf( "            EA support:\t" );
+       puts( EA_MODULES );
+
+       printf( "          LDAP support:\t" );
+#ifdef HAVE_LDAP
+       puts( "Yes" );
+#else
+       puts( "No" );
+#endif
 }
 
 /*
@@ -574,19 +637,21 @@ static void show_version_extended(void )
 static void show_paths( void )
 {
        printf( "             afpd.conf:\t%s\n", _PATH_AFPDCONF );
+       printf( "    afp_signature.conf:\t%s\n", _PATH_AFPDSIGCONF );
        printf( "   AppleVolumes.system:\t%s\n", _PATH_AFPDSYSVOL );
        printf( "  AppleVolumes.default:\t%s\n", _PATH_AFPDDEFVOL );
        printf( "       UAM search path:\t%s\n", _PATH_AFPDUAMPATH );
+    printf( "  Server messages path:\t%s\n", SERVERTEXT);
 }
 
 /*
- * Display usage information about adpd.
+ * Display usage information about afpd.
  */
 static void show_usage( char *name )
 {
-       fprintf( stderr, "Usage:\t%s [-dDIptTu] [-c maxconnections] [-f defaultvolumes] [-F config]\n", name );
-       fprintf( stderr, "\t     [-g guest] [-L message] [-m umask][-n nbpname] [-P pidfile]\n" );
-       fprintf( stderr, "\t     [-s systemvolumes] [-S port] [-U uams]\n" );
+       fprintf( stderr, "Usage:\t%s [-duptDTI] [-f defaultvolumes] [-s systemvolumes] [-n nbpname]\n", name );
+       fprintf( stderr, "\t     [-c maxconnections] [-g guest] [-P pidfile] [-S port] [-L message]\n" );
+       fprintf( stderr, "\t     [-F configfile] [-U uams] [-m umask]\n" );
        fprintf( stderr, "\t%s -h|-v|-V\n", name );
 }