Fix symlink calls in all vfs modules.
authorJeremy Allison <jra@samba.org>
Mon, 19 Oct 2009 06:39:23 +0000 (08:39 +0200)
committerKarolin Seeger <kseeger@samba.org>
Tue, 20 Oct 2009 13:00:35 +0000 (15:00 +0200)
Additional patch to fix bug #6769.
(cherry picked from commit d8c7a5aafe0c17c69013766022418edcec481f8c)

source3/Makefile.in
source3/configure.in
source3/modules/nfs4_acls.c
source3/modules/vfs_afsacl.c
source3/modules/vfs_hpuxacl.c
source3/modules/vfs_xattr_tdb.c
source3/script/tests/test_local_s3.sh

index 97b86fc3f43f93855c7118cae7ecd0e75990c424..1484e111d94dee50cc7e7f53aef5ce0f16be2f62 100644 (file)
@@ -212,7 +212,7 @@ BIN_PROGS4 = bin/ldbedit@EXEEXT@ bin/ldbsearch@EXEEXT@ bin/ldbadd@EXEEXT@ \
 TORTURE_PROGS = bin/smbtorture@EXEEXT@ bin/msgtest@EXEEXT@ \
        bin/masktest@EXEEXT@ bin/locktest@EXEEXT@ \
        bin/locktest2@EXEEXT@ bin/nsstest@EXEEXT@ bin/vfstest@EXEEXT@ \
-       bin/pdbtest@EXEEXT@ bin/talloctort@EXEEXT@ bin/replacetort@EXEEXT@ \
+       bin/pdbtest@EXEEXT@ @BIN_TALLOCTORT@ bin/replacetort@EXEEXT@ \
        bin/tdbtorture@EXEEXT@ \
        bin/smbconftort@EXEEXT@ bin/vlp@EXEEXT@
 
@@ -220,7 +220,7 @@ BIN_PROGS = @EXTRA_BIN_PROGS@ \
        $(BIN_PROGS1) $(BIN_PROGS2) $(BIN_PROGS3) $(BIN_PROGS4) 
 
 EVERYTHING_PROGS = bin/debug2html@EXEEXT@ bin/smbfilter@EXEEXT@ \
-       bin/talloctort@EXEEXT@ bin/replacetort@EXEEXT@ \
+       @BIN_TALLOCTORT@ bin/replacetort@EXEEXT@ \
        bin/log2pcap@EXEEXT@ \
        bin/vlp@EXEEXT@ bin/smbiconv@EXEEXT@ \
        bin/dbwrap_tool@EXEEXT@
@@ -1276,7 +1276,7 @@ samba3-idl::
 #####################################################################
 
 
-everything:: all libtalloc libsmbclient libnetapi debug2html smbfilter talloctort replacetort smbconftort modules torture \
+everything:: all libtalloc libsmbclient libnetapi debug2html smbfilter @TALLOCTORT@ replacetort smbconftort modules torture \
        $(EVERYTHING_PROGS)
 
 .SUFFIXES:
index 74012ed7a3d77c76e5ca378da4d5b70118ba3948..dde0c6cf0016a5476e9de767f8f6bb8ef25ea612 100644 (file)
@@ -4750,6 +4750,10 @@ then
                LIBTALLOC_OBJ0="${LIBTALLOC_OBJ0} ${tallocdir}/${obj}"
        done
        AC_SUBST(LIBTALLOC_OBJ0)
+       BIN_TALLOCTORT="bin/talloctort"
+       AC_SUBST(BIN_TALLOCTORT)
+       TALLOCTORT="talloctort"
+       AC_SUBST(TALLOCTORT)
 else
        LIBTALLOC_LIBS="${TALLOC_LIBS}"
 fi
index 462e59313ab471884e0770ba9a61aa6ab67c9860..e58b2945b8b082b4df886cf21b26b334dcf83770 100644 (file)
@@ -165,10 +165,16 @@ static int smbacl4_GetFileOwner(struct connection_struct *conn,
                                const char *filename,
                                SMB_STRUCT_STAT *psbuf)
 {
+       int ret;
        memset(psbuf, 0, sizeof(SMB_STRUCT_STAT));
 
        /* Get the stat struct for the owner info. */
-       if (SMB_VFS_STAT(conn, filename, psbuf) != 0)
+       if (lp_posix_pathnames()) {
+               ret = SMB_VFS_LSTAT(conn, filename, psbuf);
+       } else {
+               ret = SMB_VFS_STAT(conn, filename, psbuf);
+       }
+       if (ret == -1)
        {
                DEBUG(8, ("SMB_VFS_STAT failed with error %s\n",
                        strerror(errno)));
index 8c89d2fd9f935026d9175694701bb3557571e64f..9588c2daf04bc00e533a4c60dd27abb42a11507f 100644 (file)
@@ -660,9 +660,15 @@ static size_t afs_to_nt_acl(struct afs_acl *afs_acl,
                            struct security_descriptor **ppdesc)
 {
        SMB_STRUCT_STAT sbuf;
+       int ret;
 
        /* Get the stat struct for the owner info. */
-       if(SMB_VFS_STAT(conn, name, &sbuf) != 0) {
+       if (lp_posix_pathnames()) {
+               ret = SMB_VFS_LSTAT(conn, name, &sbuf);
+       } else {
+               ret = SMB_VFS_STAT(conn, name, &sbuf);
+       }
+       if (ret == -1) {
                return 0;
        }
 
index f9293405fb41912083fd98330b54e0bcabadca4c..e75a9c64600cae9f6b66fd807c6d3c89970472c9 100644 (file)
@@ -248,7 +248,13 @@ int hpuxacl_sys_acl_set_file(vfs_handle_struct *handle,
         * that has _not_ been specified in "type" from the file first 
         * and concatenate it with the acl provided.
         */
-       if (SMB_VFS_STAT(handle->conn, name, &s) != 0) {
+       if (lp_posix_pathnames()) {
+               ret = SMB_VFS_LSTAT(handle->conn, name, &s);
+       } else {
+               ret = SMB_VFS_STAT(handle->conn, name, &s);
+       }
+
+       if (ret != 0) {
                DEBUG(10, ("Error in stat call: %s\n", strerror(errno)));
                goto done;
        }
index 4e37ed6477bd0a1eed7171c5a45df52b1491b189..3fe8f6d1f62b51ff9eec9b5c9b2b22bad3bfebb3 100644 (file)
@@ -212,10 +212,17 @@ static ssize_t xattr_tdb_getxattr(struct vfs_handle_struct *handle,
        SMB_STRUCT_STAT sbuf;
        struct file_id id;
        struct db_context *db;
+       int ret;
 
        SMB_VFS_HANDLE_GET_DATA(handle, db, struct db_context, return -1);
 
-       if (SMB_VFS_STAT(handle->conn, path, &sbuf) == -1) {
+       if (lp_posix_pathnames()) {
+               ret = SMB_VFS_LSTAT(handle->conn, path, &sbuf);
+       } else {
+               ret = SMB_VFS_STAT(handle->conn, path, &sbuf);
+       }
+
+       if (ret == -1) {
                return -1;
        }
 
@@ -334,10 +341,17 @@ static int xattr_tdb_setxattr(struct vfs_handle_struct *handle,
        SMB_STRUCT_STAT sbuf;
        struct file_id id;
        struct db_context *db;
+       int ret;
 
        SMB_VFS_HANDLE_GET_DATA(handle, db, struct db_context, return -1);
 
-       if (SMB_VFS_STAT(handle->conn, path, &sbuf) == -1) {
+       if (lp_posix_pathnames()) {
+               ret = SMB_VFS_LSTAT(handle->conn, path, &sbuf);
+       } else {
+               ret = SMB_VFS_STAT(handle->conn, path, &sbuf);
+       }
+
+       if (ret == -1) {
                return -1;
        }
 
@@ -439,10 +453,17 @@ static ssize_t xattr_tdb_listxattr(struct vfs_handle_struct *handle,
        SMB_STRUCT_STAT sbuf;
        struct file_id id;
        struct db_context *db;
+       int ret;
 
        SMB_VFS_HANDLE_GET_DATA(handle, db, struct db_context, return -1);
 
-       if (SMB_VFS_STAT(handle->conn, path, &sbuf) == -1) {
+       if (lp_posix_pathnames()) {
+               ret = SMB_VFS_LSTAT(handle->conn, path, &sbuf);
+       } else {
+               ret = SMB_VFS_STAT(handle->conn, path, &sbuf);
+       }
+
+       if (ret == -1) {
                return -1;
        }
 
@@ -539,10 +560,17 @@ static int xattr_tdb_removexattr(struct vfs_handle_struct *handle,
        SMB_STRUCT_STAT sbuf;
        struct file_id id;
        struct db_context *db;
+       int ret;
 
        SMB_VFS_HANDLE_GET_DATA(handle, db, struct db_context, return -1);
 
-       if (SMB_VFS_STAT(handle->conn, path, &sbuf) == -1) {
+       if (lp_posix_pathnames()) {
+               ret = SMB_VFS_LSTAT(handle->conn, path, &sbuf);
+       } else {
+               ret = SMB_VFS_STAT(handle->conn, path, &sbuf);
+       }
+
+       if (ret == -1) {
                return -1;
        }
 
@@ -621,7 +649,13 @@ static int xattr_tdb_unlink(vfs_handle_struct *handle, const char *path)
 
        SMB_VFS_HANDLE_GET_DATA(handle, db, struct db_context, return -1);
 
-       if (SMB_VFS_STAT(handle->conn, path, &sbuf) == -1) {
+       if (lp_posix_pathnames()) {
+               ret = SMB_VFS_LSTAT(handle->conn, path, &sbuf);
+       } else {
+               ret = SMB_VFS_STAT(handle->conn, path, &sbuf);
+       }
+
+       if (ret == -1) {
                return -1;
        }
 
@@ -660,7 +694,13 @@ static int xattr_tdb_rmdir(vfs_handle_struct *handle, const char *path)
 
        SMB_VFS_HANDLE_GET_DATA(handle, db, struct db_context, return -1);
 
-       if (SMB_VFS_STAT(handle->conn, path, &sbuf) == -1) {
+       if (lp_posix_pathnames()) {
+               ret = SMB_VFS_LSTAT(handle->conn, path, &sbuf);
+       } else {
+               ret = SMB_VFS_STAT(handle->conn, path, &sbuf);
+       }
+
+       if (ret == -1) {
                return -1;
        }
 
index 1840779085307cd09b65abb1fe50d3389eda3bca..79e48483efa475b61c33da462329d7d1ae5cdcc7 100755 (executable)
@@ -16,8 +16,10 @@ incdir=`dirname $0`
 
 failed=0
 
-testit "talloctort" $VALGRIND $BINDIR/talloctort || \
-    failed=`expr $failed + 1`
+test -x $BINDIR/talloctort && {
+       testit "talloctort" $VALGRIND $BINDIR/talloctort || \
+           failed=`expr $failed + 1`
+}
 
 testit "replacetort" $VALGRIND $BINDIR/replacetort || \
     failed=`expr $failed + 1`