]> arthur.barton.de Git - netatalk.git/blobdiff - etc/afpd/afp_options.c
Add a configurable hold time option to FCE file modification event generation, defaul...
[netatalk.git] / etc / afpd / afp_options.c
index f3724c13cdbd6d05f8403b6a753839e9c1f207c0..b40f61debbeb58ca7a9e6917a8de300291728b85 100644 (file)
@@ -34,8 +34,9 @@
 #include <atalk/paths.h>
 #include <atalk/util.h>
 #include <atalk/compat.h>
+#include <atalk/globals.h>
+#include <atalk/fce_api.h>
 
-#include "globals.h"
 #include "status.h"
 #include "auth.h"
 #include "dircache.h"
@@ -139,6 +140,8 @@ void afp_options_free(struct afp_options *opt,
        free(opt->ntseparator);
     if (opt->logconfig && (opt->logconfig != save->logconfig))
        free(opt->logconfig);
+       if (opt->mimicmodel && (opt->mimicmodel != save->mimicmodel))
+       free(opt->mimicmodel);
 }
 
 /* initialize options */
@@ -189,6 +192,8 @@ void afp_options_init(struct afp_options *options)
     options->tcp_sndbuf = 0;    /* 0 means don't change OS default */
     options->tcp_rcvbuf = 0;    /* 0 means don't change OS default */
     options->dsireadbuf = 12;
+       options->mimicmodel = NULL;
+    options->fce_fmodwait = 60; /* put fmod events 60 seconds on hold */
 }
 
 /* parse an afpd.conf line. i'm doing it this way because it's
@@ -236,6 +241,10 @@ int afp_options_parseline(char *buf, struct afp_options *options)
         options->flags |= OPTION_ANNOUNCESSH;
     if (strstr(buf, " -noacl2maccess"))
         options->flags &= ~OPTION_ACL2MACCESS;
+    if (strstr(buf, " -keepsessions")) {
+        default_options.flags |= OPTION_KEEPSESSIONS;
+        options->flags |= OPTION_KEEPSESSIONS;
+    }
 
     /* passwd bits */
     if (strstr(buf, " -nosavepassword"))
@@ -318,9 +327,9 @@ int afp_options_parseline(char *buf, struct afp_options *options)
     }
 
     if ((c = getoption(buf, "-sleep"))) {
-        options->sleep = atoi(c) *120;
+        options->disconnected = options->sleep = atoi(c) * 120;
         if (options->sleep <= 4) {
-            options->sleep = 4;
+            options->disconnected = options->sleep = 4;
         }
     }
 
@@ -350,8 +359,11 @@ int afp_options_parseline(char *buf, struct afp_options *options)
     while (NULL != (c = strstr(c, "-setuplog"))) {
         char *optstr;
         if ((optstr = getoption(c, "-setuplog"))) {
+            /* hokey2: options->logconfig must be converted to store an array of logstrings */
+            if (options->logconfig)
+                free(options->logconfig);
+            options->logconfig = strdup(optstr);
             setuplog(optstr);
-            options->logconfig = optstr; /* at least store the last (possibly only) one */
             c += sizeof("-setuplog");
         }
     }
@@ -478,6 +490,25 @@ int afp_options_parseline(char *buf, struct afp_options *options)
     if ((c = getoption(buf, "-tcprcvbuf")))
         options->tcp_rcvbuf = atoi(c);
 
+       if ((c = getoption(buf, "-fcelistener"))) {
+               LOG(log_note, logtype_afpd, "Adding fce listener \"%s\"", c);
+               fce_add_udp_socket(c);
+       }
+       if ((c = getoption(buf, "-fcecoalesce"))) {
+               LOG(log_note, logtype_afpd, "Fce coalesce: %s", c);
+               fce_set_coalesce(c);
+       }
+       if ((c = getoption(buf, "-fceevents"))) {
+               LOG(log_note, logtype_afpd, "Fce events: %s", c);
+               fce_set_events(c);
+       }
+
+    if ((c = getoption(buf, "-fceholdfmod")))
+        options->fce_fmodwait = atoi(c);
+
+    if ((c = getoption(buf, "-mimicmodel")) && (opt = strdup(c)))
+       options->mimicmodel = opt;
+
     return 1;
 }
 
@@ -673,11 +704,14 @@ int afp_options_parse(int ac, char **av, struct afp_options *options)
         *p = '\0';
     }
 
+#ifdef ultrix
     if (NULL == ( p = strrchr( av[ 0 ], '/' )) ) {
         p = av[ 0 ];
     } else {
         p++;
     }
+    openlog( p, LOG_PID ); /* ultrix only */
+#endif /* ultrix */
 
     while (EOF != ( c = getopt( ac, av, OPTIONS )) ) {
         switch ( c ) {
@@ -769,11 +803,5 @@ int afp_options_parse(int ac, char **av, struct afp_options *options)
         exit( 2 );
     }
 
-#ifdef ultrix
-    openlog( p, LOG_PID ); /* ultrix only */
-#else
-    set_processname(p);
-#endif /* ultrix */
-
     return 1;
 }