]> arthur.barton.de Git - netatalk.git/blobdiff - etc/afpd/enumerate.c
Merge sf
[netatalk.git] / etc / afpd / enumerate.c
index 4867640d8d63d9884cb148c2c7360722f80f2a6a..80759a439cf61bfed6f088b0641bf5e4c48a907a 100644 (file)
@@ -23,6 +23,7 @@
 #include <atalk/bstrlib.h>
 #include <atalk/bstradd.h>
 #include <atalk/globals.h>
+#include <atalk/netatalk_conf.h>
 
 #include "desktop.h"
 #include "directory.h"
@@ -365,6 +366,10 @@ static int enumerate(AFPObj *obj _U_, char *ibuf, size_t ibuflen _U_,
 
         sd.sd_last += len + 1;
         s_path.m_name = NULL;
+
+        /* Convert adouble:v2 to adouble:ea on the fly */
+        (void)ad_convert(s_path.u_name, &s_path.st, vol);
+
         /*
          * If a fil/dir is not a dir, it's a file. This is slightly
          * inaccurate, since that means /dev/null is a file, /dev/printer
@@ -382,7 +387,7 @@ static int enumerate(AFPObj *obj _U_, char *ibuf, size_t ibuflen _U_,
                     return AFPERR_MISC;
                 }
             }
-            if ((ret = getdirparams(vol, dbitmap, &s_path, dir, data + header , &esz)) != AFP_OK)
+            if ((ret = getdirparams(obj, vol, dbitmap, &s_path, dir, data + header , &esz)) != AFP_OK)
                 return( ret );
 
         } else {
@@ -390,8 +395,8 @@ static int enumerate(AFPObj *obj _U_, char *ibuf, size_t ibuflen _U_,
                 continue;
             }
             /* files are added to the dircache in getfilparams() -> getmetadata() */
-            if (AFP_OK != ( ret = getfilparams(vol, fbitmap, &s_path, curdir, 
-                                     data + header , &esz )) ) {
+            if (AFP_OK != ( ret = getfilparams(obj, vol, fbitmap, &s_path, curdir, 
+                                               data + header , &esz )) ) {
                 return( ret );
             }
         }
@@ -440,6 +445,15 @@ static int enumerate(AFPObj *obj _U_, char *ibuf, size_t ibuflen _U_,
 
     if ( actcnt == 0 ) {
         sd.sd_did = 0;         /* invalidate sd struct to force re-read */
+        /*
+         * in case were converting adouble stuff:
+         * after enumerating the whole dir we should have converted everything
+         * thus the .AppleDouble dir shouls be empty thus we can no try to
+         * delete it
+         */
+        if (vol->v_adouble == AD_VERSION_EA && ! (vol->v_flags & AFPVOL_NOV2TOEACONV))
+            (void)rmdir(".AppleDouble");
+
         return( AFPERR_NOOBJ );
     }
     sd.sd_sindex = sindex + actcnt;