]> arthur.barton.de Git - netatalk.git/commitdiff
options allow space and comma as seperators
authorFrank Lahm <franklahm@googlemail.com>
Wed, 15 Feb 2012 15:13:06 +0000 (16:13 +0100)
committerFrank Lahm <franklahm@googlemail.com>
Wed, 15 Feb 2012 15:13:06 +0000 (16:13 +0100)
etc/afpd/afp_options.c
etc/afpd/volume.c

index 705652a69d54ac379625c5b8aa09ea2f30ab00b2..34253ee837f5108600735daa4098bede8e5b1d28 100644 (file)
@@ -120,35 +120,37 @@ int afp_config_parse(AFPObj *AFPObj)
     setuplog(options->logconfig, options->logfile);
 
     /* [AFP] "options" options wo values */
-    p = iniparser_getstring(config, INISEC_AFP, "options", "");
-    strcpy(val, " ");
-    strlcat(val, p, MAXVAL);
-
-    if (strstr(val, " nozeroconf"))
-        options->flags |= OPTION_NOZEROCONF;
-    if (strstr(val, " icon"))
-        options->flags |= OPTION_CUSTOMICON;
-    if (strstr(val, " noicon"))
-        options->flags &= ~OPTION_CUSTOMICON;
-    if (strstr(val, " advertise_ssh"))
-        options->flags |= OPTION_ANNOUNCESSH;
-    if (strstr(val, " noacl2maccess"))
-        options->flags &= ~OPTION_ACL2MACCESS;
-    if (strstr(val, " keepsessions"))
-        options->flags |= OPTION_KEEPSESSIONS;
-    if (strstr(val, " closevol"))
-        options->flags |= OPTION_CLOSEVOL;
-    if (strstr(val, " client_polling"))
-        options->flags &= ~OPTION_SERVERNOTIF;
-    if (strstr(val, " nosavepassword"))
-        options->passwdbits |= PASSWD_NOSAVE;
-    if (strstr(val, " savepassword"))
-        options->passwdbits &= ~PASSWD_NOSAVE;
-    if (strstr(val, " nosetpassword"))
-        options->passwdbits &= ~PASSWD_SET;
-    if (strstr(val, " setpassword"))
-        options->passwdbits |= PASSWD_SET;
-
+    if (p = iniparser_getstrdup(config, INISEC_AFP, "options", NULL)) {
+        if (p = strtok(q, ", ")) {
+            while (p) {
+                if (strcasecmp(p, "nozeroconf"))
+                    options->flags |= OPTION_NOZEROCONF;
+                if (strcasecmp(p, "icon"))
+                    options->flags |= OPTION_CUSTOMICON;
+                if (strcasecmp(p, "noicon"))
+                    options->flags &= ~OPTION_CUSTOMICON;
+                if (strcasecmp(p, "advertise_ssh"))
+                    options->flags |= OPTION_ANNOUNCESSH;
+                if (strcasecmp(p, "noacl2maccess"))
+                    options->flags &= ~OPTION_ACL2MACCESS;
+                if (strcasecmp(p, "keepsessions"))
+                    options->flags |= OPTION_KEEPSESSIONS;
+                if (strcasecmp(p, "closevol"))
+                    options->flags |= OPTION_CLOSEVOL;
+                if (strcasecmp(p, "client_polling"))
+                    options->flags &= ~OPTION_SERVERNOTIF;
+                if (strcasecmp(p, "nosavepassword"))
+                    options->passwdbits |= PASSWD_NOSAVE;
+                if (strcasecmp(p, "savepassword"))
+                    options->passwdbits &= ~PASSWD_NOSAVE;
+                if (strcasecmp(p, "nosetpassword"))
+                    options->passwdbits &= ~PASSWD_SET;
+                if (strcasecmp(p, "setpassword"))
+                    options->passwdbits |= PASSWD_SET;
+                p = strtok(NULL, ",");
+            }
+        }
+    }
     /* figure out options w values */
 
     options->loginmesg      = iniparser_getstrdup(config, INISEC_AFP, "loginmesg",      "");
index 0a86cfd2c859b61f933d840bcd773458c2efa733..1c6f112aafe06d00d6461a44c4dae2af11f8dc9e 100644 (file)
@@ -417,7 +417,7 @@ static void volset(const dictionary *conf, const char *vol, struct vol_option *o
     }
 
     if (q = iniparser_getstrdup(conf, vol, "options", NULL)) {
-        if (p = strtok(q, ",")) {
+        if (p = strtok(q, ", ")) {
             while (p) {
                 if (strcasecmp(p, "ro") == 0)
                     options[VOLOPT_FLAGS].i_value |= AFPVOL_RO;