From: Jeremy Allison Date: Fri, 8 May 2009 18:31:34 +0000 (-0700) Subject: Fix bug #6330 - DFS doesn't work on AIX. Jeremy. X-Git-Tag: tdb-1.1.5~662 X-Git-Url: http://git.samba.org/samba.git/?p=kamenim%2Fsamba-autobuild%2F.git;a=commitdiff_plain;h=3d6f4a7af7b91d9f9ac9fd0b00af63bb23e371f7 Fix bug #6330 - DFS doesn't work on AIX. Jeremy. --- diff --git a/source3/configure.in b/source3/configure.in index b532372bfd6..b6cdcc86adc 100644 --- a/source3/configure.in +++ b/source3/configure.in @@ -5703,6 +5703,16 @@ fi AC_HAVE_DECL(splice, [#include ]) +############################################ +# 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 diff --git a/source3/smbd/msdfs.c b/source3/smbd/msdfs.c index 7bd32e82800..efbc05ceb00 100644 --- a/source3/smbd/msdfs.c +++ b/source3/smbd/msdfs.c @@ -413,7 +413,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 index 00000000000..a07e62aa754 --- /dev/null +++ b/tests/readlink.c @@ -0,0 +1,33 @@ +/* test whether readlink returns a short buffer correctly. */ + +#if defined(HAVE_UNISTD_H) +#include +#endif + +#include +#include +#include + +#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); +}