]> arthur.barton.de Git - netatalk.git/commitdiff
Removing ressource fork AppleDouble fails, bug #542
authorRalph Boehme <sloowfranklin@gmail.com>
Wed, 8 Jan 2014 00:30:47 +0000 (01:30 +0100)
committerRalph Boehme <rb@sernet.de>
Tue, 21 Jan 2014 10:35:13 +0000 (11:35 +0100)
When the AFP client uses FPSetForkParms to set the ressource fork
length to 0, Netatalk will call unlink() in ad_rtruncate() in
libatalk/adouble/ad_write.c in order to to unlink the files
AppleDouble ressource fork.

The function ad_rtruncate() gets just the filename as path from the
caller, so obviously at this point the caller should have ensured that
it had called chdir() to the enclosing directory of the file.

Fixes bug #542.

NEWS
etc/afpd/fork.c

diff --git a/NEWS b/NEWS
index 8ea8c21b7be3bc7e1dc26a99bb5068c5ba6215e4..2504a47d6c04f8adfa0276b9c6759b9d939d0ab0 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -6,6 +6,8 @@ Changes in 3.1.1
        Bug #537.
 * UPD: Add support for AFP 3.4. From FR #85.
 * FIX: Registering with mDNS crashed. Bug #540
+* FIX: Saving from applications like Photoshop may fail, because
+       removing the ressource fork AppleDouble file failed. Bug #542.
 
 Changes in 3.1.0
 ================
@@ -27,6 +29,9 @@ Changes in 3.0.7
 * UPD: Use dedicated exit code for AFP connections that were dropped
        by the client right after the TCP handshake
 * FIX: Workaround for a problem which cannot be advertized by Avahi. Bug #541.
+* FIX: Registering with mDNS crashed. Bug #540
+* FIX: Saving from applications like Photoshop may fail, because
+       removing the ressource fork AppleDouble file failed. Bug #542.
 
 Changes in 3.0.6
 ================
index 73abb1e9a102e5a5143303a08011b976cdc982f8..24284c1d745f0bc62fce6668637b7333943a8964 100644 (file)
@@ -500,6 +500,8 @@ openfork_err:
 int afp_setforkparams(AFPObj *obj, char *ibuf, size_t ibuflen, char *rbuf _U_, size_t *rbuflen)
 {
     struct ofork    *ofork;
+    struct vol      *vol;
+    struct dir      *dir;
     off_t       size;
     uint16_t       ofrefnum, bitmap;
     int                 err;
@@ -522,6 +524,16 @@ int afp_setforkparams(AFPObj *obj, char *ibuf, size_t ibuflen, char *rbuf _U_, s
         return( AFPERR_PARAM );
     }
 
+    vol = ofork->of_vol;
+    if ((dir = dirlookup(vol, ofork->of_did)) == NULL) {
+        LOG(log_error, logtype_afpd, "%s: bad fork did",  of_name(ofork));
+        return AFPERR_MISC;
+    }
+    if (movecwd(vol, dir) != 0) {
+        LOG(log_error, logtype_afpd, "%s: bad fork directory", dir->d_fullpath);
+        return AFPERR_MISC;
+    }
+
     if (ofork->of_vol->v_flags & AFPVOL_RO)
         return AFPERR_VLOCK;