]> arthur.barton.de Git - netatalk.git/blobdiff - libatalk/util/netatalk_conf.c
Merge remote branch 'netafp/master' into branch-allea
[netatalk.git] / libatalk / util / netatalk_conf.c
index dbdbc2942722eed74e12c236c8beed9c3e880fb4..8a4cfb2afe67ca42d3ee4e4eb837bd82ed843874 100644 (file)
@@ -46,6 +46,9 @@
 #include <atalk/netatalk_conf.h>
 
 #define VOLPASSLEN  8
+#ifndef UUID_PRINTABLE_STRING_LENGTH
+#define UUID_PRINTABLE_STRING_LENGTH 37
+#endif
 
 #define IS_VAR(a, b) (strncmp((a), (b), 2) == 0)
 
@@ -173,7 +176,7 @@ static int do_check_ea_support(const struct vol *vol)
 
     mktemp(eaname);
 
-//    become_root();
+    become_root();
 
     if ((sys_setxattr(vol->v_path, eaname, eacontent, 4, 0)) == 0) {
         sys_removexattr(vol->v_path, eaname);
@@ -184,7 +187,7 @@ static int do_check_ea_support(const struct vol *vol)
         haseas = 0;
     }
 
-//    unbecome_root();
+    unbecome_root();
 
     return haseas;
 }
@@ -437,7 +440,7 @@ static int hostaccessvol(const AFPObj *obj, const char *volname, const char *arg
     struct sockaddr_storage client;
     const DSI *dsi = obj->dsi;
 
-    if (!args)
+    if (!args || !dsi)
         return -1;
 
     strlcpy(buf, args, sizeof(buf));
@@ -953,8 +956,9 @@ static int readvolfile(AFPObj *obj, const struct passwd *pwent)
             continue;
         if (STRCMP(secname, ==, INISEC_HOMES)) {
             have_uservol = 1;
-            if (!obj->uid)
-                /* not an AFP session, but cnid daemon, dbd or ad util */
+            if (obj->username[0] == 0
+                || strcmp(obj->username, obj->options.guest) == 0)
+                /* not an AFP session, but cnid daemon, dbd or ad util, or guest login */
                 continue;
             strlcpy(tmp, pwent->pw_dir, MAXPATHLEN);
             strlcat(tmp, "/", MAXPATHLEN);
@@ -1278,13 +1282,13 @@ struct vol *getvolbypath(AFPObj *obj, const char *path)
     while (*p == '/')
         p++;
     EC_NULL_LOG( user = strdup(p) );
-    strlcpy(obj->username, user, MAXUSERLEN);
 
     if (prw = strchr(user, '/'))
         *prw++ = 0;
     if (prw != 0)
         subpath = prw;
 
+    strlcpy(obj->username, user, MAXUSERLEN);
     strlcat(tmpbuf, user, MAXPATHLEN);
     strlcat(tmpbuf, "/", MAXPATHLEN);