]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
Fix bug #6330 - DFS doesn't work on AIX. Jeremy.
authorJeremy Allison <jra@samba.org>
Fri, 8 May 2009 18:31:34 +0000 (11:31 -0700)
committerKarolin Seeger <kseeger@samba.org>
Wed, 13 May 2009 09:58:04 +0000 (11:58 +0200)
This was commit 3d6f4a7af in master.

source/configure.in
source/smbd/msdfs.c
tests/readlink.c [new file with mode: 0644]

index 68b41195fbf2d46163ad10f8cfd03d09ceeeeb57..b350d81801d3c2c917762655f361871f6987c902 100644 (file)
@@ -5927,6 +5927,16 @@ fi
 
 AC_HAVE_DECL(splice, [#include <fcntl.h>])
 
+############################################
+# See if we have the a broken readlink syscall.
+
+AC_CACHE_CHECK([for a broken readlink syscall],samba_cv_HAVE_BROKEN_READLINK,[
+AC_TRY_RUN([#include "${srcdir-.}/../tests/readlink.c"],
+       samba_cv_HAVE_BROKEN_READLINK=no,samba_cv_HAVE_BROKEN_READLINK=yes,samba_cv_HAVE_BROKEN_READLINK=cross)
+])
+if test x"$samba_cv_HAVE_BROKEN_READLINK" = x"yes"; then
+       AC_DEFINE(HAVE_BROKEN_READLINK,1,[Whether the readlink syscall is broken])
+fi
 
 #################################################
 # Check whether winbind is supported on this platform.  If so we need to
index 1504b19169b90a75befc1b1bbcfd0db71492de8a..52b395e9ef23f0022b58e51350ab280f866c54ea 100644 (file)
@@ -402,7 +402,11 @@ static bool is_msdfs_link_internal(TALLOC_CTX *ctx,
 {
        SMB_STRUCT_STAT st;
        int referral_len = 0;
+#if defined(HAVE_BROKEN_READLINK)
+       char link_target_buf[PATH_MAX];
+#else
        char link_target_buf[7];
+#endif
        size_t bufsize = 0;
        char *link_target = NULL;
 
diff --git a/tests/readlink.c b/tests/readlink.c
new file mode 100644 (file)
index 0000000..a07e62a
--- /dev/null
@@ -0,0 +1,33 @@
+/* test whether readlink returns a short buffer correctly. */
+
+#if defined(HAVE_UNISTD_H)
+#include <unistd.h>
+#endif
+
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+
+#define DATA "readlink.test"
+#define FNAME "rdlnk.file"
+
+main()
+{
+       int buf[7];
+       int ret;
+       ssize_t rl_ret;
+
+       unlink(FNAME);
+       ret = symlink(DATA, FNAME);
+       if (ret == -1) {
+               exit(1);
+       }
+
+       rl_ret = readlink(FNAME, buf, sizeof(buf));
+       if (rl_ret == -1) {
+               unlink(FNAME);
+               exit(1);
+       }
+       unlink(FNAME);
+       exit(0);
+}