]> arthur.barton.de Git - netatalk.git/commitdiff
Automatic AppleDouble conversion to EAs failing for directories
authorRalph Boehme <sloowfranklin@gmail.com>
Mon, 14 Jan 2013 14:13:12 +0000 (15:13 +0100)
committerRalph Boehme <sloowfranklin@gmail.com>
Mon, 14 Jan 2013 14:15:27 +0000 (15:15 +0100)
of_stat() need be called before calling ad_convert() in order to
have a valid struct stat of the element to be converted.
Fixes bug #486.

NEWS
etc/afpd/enumerate.c

diff --git a/NEWS b/NEWS
index 08481d6435b668f912fbd2277bbcf7504277f0a9..c257225089e14b4382f2b278c0f67a0db6162606 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -27,6 +27,8 @@ Changes in 3.0.2
        Setting the option to true causes afpd to follow symlinks on the
        server. symlinks may point outside of the AFP volume, currently
        afpd doesn't do any checks for "wide symlinks".
        Setting the option to true causes afpd to follow symlinks on the
        server. symlinks may point outside of the AFP volume, currently
        afpd doesn't do any checks for "wide symlinks".
+* FIX: Automatic AppleDouble conversion to EAs failing for directories.
+       Fixes bug #486.
 
 Changes in 3.0.1
 ================
 
 Changes in 3.0.1
 ================
index 80141e801850fa54f047c28dfd57fcadc108289a..0c3c0576e5249f3b679bc4714f65c710847581a6 100644 (file)
@@ -346,15 +346,9 @@ static int enumerate(AFPObj *obj _U_, char *ibuf, size_t ibuflen _U_,
             sd.sd_last += len + 1;
             continue;
         }
             sd.sd_last += len + 1;
             continue;
         }
-        memset(&s_path, 0, sizeof(s_path));
 
 
-        /* conversions on the fly */
-        const char *convname;
+        memset(&s_path, 0, sizeof(s_path));
         s_path.u_name = sd.sd_last;
         s_path.u_name = sd.sd_last;
-        if (ad_convert(sd.sd_last, &s_path.st, vol, &convname) == 0 && convname) {
-            s_path.u_name = (char *)convname;
-        }
-
         if (of_stat(vol, &s_path) < 0 ) {
             /* so the next time it won't try to stat it again
              * another solution would be to invalidate the cache with 
         if (of_stat(vol, &s_path) < 0 ) {
             /* so the next time it won't try to stat it again
              * another solution would be to invalidate the cache with 
@@ -366,6 +360,12 @@ static int enumerate(AFPObj *obj _U_, char *ibuf, size_t ibuflen _U_,
             continue;
         }
 
             continue;
         }
 
+        /* conversions on the fly */
+        const char *convname;
+        if (ad_convert(sd.sd_last, &s_path.st, vol, &convname) == 0 && convname) {
+            s_path.u_name = (char *)convname;
+        }
+
         /* Fixup CNID db if ad_convert resulted in a rename (then convname != NULL) */
         if (convname) {
             s_path.id = cnid_lookup(vol->v_cdb, &s_path.st, curdir->d_did, sd.sd_last, strlen(sd.sd_last));
         /* Fixup CNID db if ad_convert resulted in a rename (then convname != NULL) */
         if (convname) {
             s_path.id = cnid_lookup(vol->v_cdb, &s_path.st, curdir->d_did, sd.sd_last, strlen(sd.sd_last));