]> arthur.barton.de Git - netatalk.git/commitdiff
Fix a bug where only the first configured UAM was loaded
authorRalph Boehme <sloowfranklin@gmail.com>
Tue, 5 Nov 2013 09:57:17 +0000 (10:57 +0100)
committerRalph Boehme <sloowfranklin@gmail.com>
Tue, 5 Nov 2013 09:57:17 +0000 (10:57 +0100)
Caused by strtok() not being async signal safe, use strtok_r() instead.
Fixes bug #537.

etc/afpd/auth.c

index f04404edd2f469af47152fccf96db6ccae7d23e8..b4adf555092af6d19f92340449306400649f0dfd 100644 (file)
@@ -1020,7 +1020,7 @@ int auth_register(const int type, struct uam_obj *uam)
 /* load all of the modules */
 int auth_load(AFPObj *obj, const char *path, const char *list)
 {
-    char name[MAXPATHLEN + 1], buf[MAXPATHLEN + 1], *p;
+    char name[MAXPATHLEN + 1], buf[MAXPATHLEN + 1], *p, *last;
     struct uam_mod *mod;
     struct stat st;
     size_t len;
@@ -1028,8 +1028,10 @@ int auth_load(AFPObj *obj, const char *path, const char *list)
     if (!path || !*path || !list || (len = strlen(path)) > sizeof(name) - 2)
         return -1;
 
+    LOG(log_debug, logtype_afpd, "auth_load: %s, %s", path, list);
+
     strlcpy(buf, list, sizeof(buf));
-    if ((p = strtok(buf, ", ")) == NULL)
+    if ((p = strtok_r(buf, ", ", &last)) == NULL)
         return -1;
 
     strcpy(name, path);
@@ -1054,7 +1056,7 @@ int auth_load(AFPObj *obj, const char *path, const char *list)
         } else {
             LOG(log_info, logtype_afpd, "uam: uam not found (status=%d)", stat(name, &st));
         }
-        p = strtok(NULL, ", ");
+        p = strtok_r(NULL, ", ", &last);
     }
 
     return 0;