]> arthur.barton.de Git - netatalk.git/commitdiff
Fix error in ad_openat(), bug #532
authorRalph Boehme <sloowfranklin@gmail.com>
Tue, 8 Oct 2013 10:36:25 +0000 (12:36 +0200)
committerRalph Boehme <sloowfranklin@gmail.com>
Tue, 8 Oct 2013 10:36:25 +0000 (12:36 +0200)
Saving from Word to a folder that is a symlink to a folder on another filesystem
results in a crash of the afpd process and the save to fail. This happens only
if the option "follow symlinks" is enabled.

NEWS
libatalk/adouble/ad_open.c

diff --git a/NEWS b/NEWS
index 6416a89ae0095d6e9bb69a3657f1537f62aee8ac..4a008b67320264a4d257b335bda36c1d1dc253f9 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -11,6 +11,10 @@ Changes in 3.0.6
 * FIX: Small fix in the DSI tickle handling. Bug #528.
 * UPD: Enhance handling of connection attempts when hitting the
        connection limit. Bug #529.
+* FIX: Saving from Word to a folder that is a symlink to a folder on
+       another filesystem results in a crash of the afpd process and
+       the save to fail. This happens only if the option
+       "follow symlinks" is enabled. Bug #532.
 
 Changes in 3.0.5
 ================
index 06c3c71e49a7cfaca6ada37276237d0a4ae66f4f..b333f8cdcfb2b37f1f717df1f76ead317a2a62b2 100644 (file)
@@ -1897,10 +1897,12 @@ int ad_openat(struct adouble  *ad,
     mode_t mode = 0;
 
     if (dirfd != -1) {
-        if ((cwdfd = open(".", O_RDONLY) == -1) || (fchdir(dirfd) != 0))
+        if (((cwdfd = open(".", O_RDONLY)) == -1) || (fchdir(dirfd) != 0))
             EC_FAIL;
     }
 
+    LOG(log_note, logtype_ad, "ad_openat: cwdfd: %d", cwdfd);
+
     va_start(args, adflags);
     if (adflags & ADFLAGS_CREATE)
         mode = (sizeof(mode_t) < sizeof(int) ? va_arg (args, int) : va_arg (args, mode_t));
@@ -1908,6 +1910,8 @@ int ad_openat(struct adouble  *ad,
 
     EC_NEG1( ad_open(ad, path, adflags, mode) );
 
+    LOG(log_note, logtype_ad, "ad_openat: cwdfd: %d", cwdfd);
+
     if (dirfd != -1) {
         if (fchdir(cwdfd) != 0) {
             AFP_PANIC("ad_openat: cant chdir back");