The branch, master has been updated
       via  8151ac2 s3: torture. Remove spurious lp_posix_pathnames() included 
by cut-and-paste error.
       via  6ae59eb s3: smbd: Modify vfs_stat_smb_basename() to take a const 
struct smb_filename * instead of const char *.
       via  125a1b5 s3: vfs: vfs_acl_tdb. Remove use of vfs_stat_smb_basename().
       via  f9dc022 s3: vfs: recycle. Remove use of vfs_stat_smb_basename().
       via  ce75fbf s3: smbd: Remove many common uses of lp_posix_pathnames().
       via  be56fff s3: smbd: Remove unneeded lp_posix_pathnames() check in 
SMB2 create.
       via  0f245c5 s3: posix_acls. Always use STAT, not LSTAT here.
       via  91c385c s3: vfs: Remove use of lp_posix_pathnames() below the VFS.
       via  dc5dad4 s3: Filenames: Add uint32_t flags parameter to 
synthetic_smb_fname().
       via  2e302d7 s3: smbd: Add uint32_t flags field to struct smb_filename.
       via  09325a0 s3:smbd: Move lp_posix_pathnames() out of 
ea_list_has_invalid_name().
       via  feb297c s3: vfs: vfs_afsacl. refuse_symlink() means we can always 
use STAT here.
       via  8d8c204 s3:smbd: Fix build for vfs_afsacl.c.
       via  8c90799 Fix an obvious error where we were converting a UNIX error 
to an NT STATUS but not returning it.
      from  5dccb19 selftest/Samba3: use the correct 
"SELFTEST_WINBINDD_SOCKET_DIR" for "net join"

https://git.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 8151ac21108374cd5b97cc22a81fe9097df8ee23
Author: Jeremy Allison <[email protected]>
Date:   Sat Mar 19 21:07:01 2016 -0700

    s3: torture. Remove spurious lp_posix_pathnames() included by cut-and-paste 
error.
    
    Signed-off-by: Jeremy Allison <[email protected]>
    Reviewed-by: Uri Simchoni <[email protected]>
    
    Autobuild-User(master): Jeremy Allison <[email protected]>
    Autobuild-Date(master): Fri Mar 25 02:23:56 CET 2016 on sn-devel-144

commit 6ae59eb6d1d2b4a9f3a7c1094c18abe6594aace2
Author: Jeremy Allison <[email protected]>
Date:   Fri Mar 18 22:17:30 2016 -0700

    s3: smbd: Modify vfs_stat_smb_basename() to take a const struct 
smb_filename * instead of const char *.
    
    Signed-off-by: Jeremy Allison <[email protected]>
    Reviewed-by: Uri Simchoni <[email protected]>

commit 125a1b50ab2532614cb7e53b2e2979666b02702f
Author: Jeremy Allison <[email protected]>
Date:   Fri Mar 18 22:15:12 2016 -0700

    s3: vfs: vfs_acl_tdb. Remove use of vfs_stat_smb_basename().
    
    We only need a basic STAT here.
    
    Signed-off-by: Jeremy Allison <[email protected]>
    Reviewed-by: Uri Simchoni <[email protected]>

commit f9dc02266c799d87f1dba7147f41b6946e0ba4c0
Author: Jeremy Allison <[email protected]>
Date:   Fri Mar 18 22:10:34 2016 -0700

    s3: vfs: recycle. Remove use of vfs_stat_smb_basename().
    
    We only need a basic STAT here.
    
    Signed-off-by: Jeremy Allison <[email protected]>
    Reviewed-by: Uri Simchoni <[email protected]>

commit ce75fbf4e3e59f6be131807e198045485646855f
Author: Jeremy Allison <[email protected]>
Date:   Fri Mar 18 21:58:20 2016 -0700

    s3: smbd: Remove many common uses of lp_posix_pathnames().
    
    Check the smb_filename->flags field, or req->posix_pathnames
    instead, depending on what is available.
    
    Signed-off-by: Jeremy Allison <[email protected]>
    Reviewed-by: Uri Simchoni <[email protected]>

commit be56fffe4b83ed14a5e84a5023d5c7a826911261
Author: Jeremy Allison <[email protected]>
Date:   Fri Mar 18 21:55:05 2016 -0700

    s3: smbd: Remove unneeded lp_posix_pathnames() check in SMB2 create.
    
    Add a comment reminding me to re-add the check when SMB2
    unix extensions are re-added.
    
    Signed-off-by: Jeremy Allison <[email protected]>
    Reviewed-by: Uri Simchoni <[email protected]>

commit 0f245c5ff4f175873f94b108b506527ee06d2a28
Author: Jeremy Allison <[email protected]>
Date:   Fri Mar 18 21:50:15 2016 -0700

    s3: posix_acls. Always use STAT, not LSTAT here.
    
    We have already refused acls on a symlink.
    
    Signed-off-by: Jeremy Allison <[email protected]>
    Reviewed-by: Uri Simchoni <[email protected]>

commit 91c385cfd3420873ad87731da0742e4d07bc4020
Author: Jeremy Allison <[email protected]>
Date:   Fri Mar 18 21:31:22 2016 -0700

    s3: vfs: Remove use of lp_posix_pathnames() below the VFS.
    
    We don't have access to a struct smb_filename here and
    can't get one, so simply always set AT_SYMLINK_NOFOLLOW
    and remove the optimization if we ended up fstatat()'ing
    a symlink, as we don't know if the caller wanted a link
    stat or not.
    
    Signed-off-by: Jeremy Allison <[email protected]>
    Reviewed-by: Uri Simchoni <[email protected]>

commit dc5dad48139a3dcb4544e4f31aabe269f6401849
Author: Jeremy Allison <[email protected]>
Date:   Fri Mar 18 21:19:38 2016 -0700

    s3: Filenames: Add uint32_t flags parameter to synthetic_smb_fname().
    
    Get it from parent/deriving smb_filename if present.
    Use 0 (as usually this a Windows-style lookup) if
    not.
    
    Signed-off-by: Jeremy Allison <[email protected]>
    Reviewed-by: Uri Simchoni <[email protected]>

commit 2e302d7007a58df972f7e63382ee8c9729f80560
Author: Jeremy Allison <[email protected]>
Date:   Thu Mar 17 16:20:17 2016 -0700

    s3: smbd: Add uint32_t flags field to struct smb_filename.
    
    Only one defined flag for now, SMB_FILENAME_POSIX_PATH.
    Define as the same as FSP_POSIX_FLAGS_PATHNAMES to keep
    the value consistent.
    
    Set this inside unix_convert() when a posix path parse
    is selected.
    
    Signed-off-by: Jeremy Allison <[email protected]>
    Reviewed-by: Uri Simchoni <[email protected]>

commit 09325a0ea64e43c2a4059289e3379e5543a6b76a
Author: Jeremy Allison <[email protected]>
Date:   Tue Mar 15 11:43:32 2016 -0700

    s3:smbd: Move lp_posix_pathnames() out of ea_list_has_invalid_name().
    
    External uses will be replaced by checks on struct smb_filename flags.
    
    Signed-off-by: Jeremy Allison <[email protected]>
    Reviewed-by: Uri Simchoni <[email protected]>

commit feb297ca73c03907cf1f379a97a4707ad034e7c3
Author: Jeremy Allison <[email protected]>
Date:   Tue Mar 15 11:46:58 2016 -0700

    s3: vfs: vfs_afsacl. refuse_symlink() means we can always use STAT here.
    
    For a posix acl call on a symlink, we've already refused it.
    For a Windows acl mapped call on a symlink, we want to follow
    it.
    
    Signed-off-by: Jeremy Allison <[email protected]>
    Reviewed-by: Uri Simchoni <[email protected]>

commit 8d8c204d37a2adb9e20a3de81da6cda138089dce
Author: Jeremy Allison <[email protected]>
Date:   Thu Mar 17 16:44:50 2016 -0700

    s3:smbd: Fix build for vfs_afsacl.c.
    
    Missed conversion of get_nt_acl_fn from const char *
    to const struct smb_filename *.
    
    Signed-off-by: Jeremy Allison <[email protected]>
    Reviewed-by: Uri Simchoni <[email protected]>

commit 8c9079991d61d3a140f0340fd166e3421c25b694
Author: Richard Sharpe <[email protected]>
Date:   Wed Mar 23 21:56:30 2016 -0700

    Fix an obvious error where we were converting a UNIX error to an NT STATUS 
but not returning it.
    
    Signed-off-by: Richard Sharpe <[email protected]>
    Reviewed-by: Jeremy Allison <[email protected]>

-----------------------------------------------------------------------

Summary of changes:
 source3/include/proto.h                |  3 +-
 source3/include/vfs.h                  |  9 ++++
 source3/lib/filename_util.c            | 19 +++++----
 source3/modules/nfs4_acls.c            |  2 +-
 source3/modules/non_posix_acls.c       |  2 +-
 source3/modules/vfs_acl_common.c       |  6 +--
 source3/modules/vfs_acl_tdb.c          | 14 ++++---
 source3/modules/vfs_afsacl.c           | 31 ++++++--------
 source3/modules/vfs_cap.c              | 21 ++++++----
 source3/modules/vfs_catia.c            | 27 ++++++++----
 source3/modules/vfs_default.c          | 18 +++++---
 source3/modules/vfs_fake_acls.c        |  2 +-
 source3/modules/vfs_fruit.c            | 22 +++++++---
 source3/modules/vfs_gpfs.c             |  2 +-
 source3/modules/vfs_hpuxacl.c          |  2 +-
 source3/modules/vfs_media_harmony.c    |  6 ++-
 source3/modules/vfs_nfs4acl_xattr.c    |  2 +-
 source3/modules/vfs_posix_eadb.c       |  2 +-
 source3/modules/vfs_recycle.c          | 18 +++++---
 source3/modules/vfs_shadow_copy.c      |  3 +-
 source3/modules/vfs_shadow_copy2.c     | 27 ++++++++----
 source3/modules/vfs_snapper.c          | 24 +++++++----
 source3/modules/vfs_streams_depot.c    | 77 ++++++++++++++++++++++++----------
 source3/modules/vfs_streams_xattr.c    | 18 +++++---
 source3/modules/vfs_unityed_media.c    |  6 ++-
 source3/modules/vfs_vxfs.c             |  2 +-
 source3/modules/vfs_xattr_tdb.c        |  6 +--
 source3/printing/nt_printing.c         |  2 +-
 source3/printing/printspoolss.c        |  2 +-
 source3/rpc_server/fss/srv_fss_agent.c |  2 +-
 source3/smbd/close.c                   | 17 +++++---
 source3/smbd/dir.c                     | 14 +++++--
 source3/smbd/dosmode.c                 | 16 ++++---
 source3/smbd/durable.c                 |  7 +++-
 source3/smbd/file_access.c             |  9 +++-
 source3/smbd/filename.c                |  5 ++-
 source3/smbd/files.c                   |  2 +-
 source3/smbd/msdfs.c                   | 19 ++++++---
 source3/smbd/nttrans.c                 |  3 +-
 source3/smbd/open.c                    | 38 +++++++++++------
 source3/smbd/pipes.c                   |  2 +-
 source3/smbd/posix_acls.c              | 17 ++++----
 source3/smbd/proto.h                   |  3 +-
 source3/smbd/pysmbd.c                  | 12 ++++--
 source3/smbd/reply.c                   | 12 ++++--
 source3/smbd/service.c                 |  7 +++-
 source3/smbd/smb2_create.c             |  6 +++
 source3/smbd/trans2.c                  | 62 ++++++++++++++++++++-------
 source3/smbd/vfs.c                     | 19 +++++----
 source3/torture/cmd_vfs.c              | 29 +++++++++----
 source3/torture/torture.c              |  2 +-
 51 files changed, 456 insertions(+), 222 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/include/proto.h b/source3/include/proto.h
index dc8fee9..8cdbadf 100644
--- a/source3/include/proto.h
+++ b/source3/include/proto.h
@@ -1139,7 +1139,8 @@ NTSTATUS get_full_smb_filename(TALLOC_CTX *ctx, const 
struct smb_filename *smb_f
 struct smb_filename *synthetic_smb_fname(TALLOC_CTX *mem_ctx,
                                         const char *base_name,
                                         const char *stream_name,
-                                        const SMB_STRUCT_STAT *psbuf);
+                                        const SMB_STRUCT_STAT *psbuf,
+                                        uint32_t flags);
 struct smb_filename *synthetic_smb_fname_split(TALLOC_CTX *ctx,
                                                const char *fname,
                                                bool posix_path);
diff --git a/source3/include/vfs.h b/source3/include/vfs.h
index 1c6bc2f..3a86c62 100644
--- a/source3/include/vfs.h
+++ b/source3/include/vfs.h
@@ -190,6 +190,7 @@
                const struct smb_filename * */
 /* Version 35 - Change streaminfo from const char *, to
                const struct smb_filename * */
+/* Version 35 - Add uint32_t flags to struct smb_filename */
 
 #define SMB_VFS_INTERFACE_VERSION 35
 
@@ -514,9 +515,17 @@ struct smb_filename {
        char *base_name;
        char *stream_name;
        char *original_lcomp;
+       uint32_t flags;
        SMB_STRUCT_STAT st;
 };
 
+/*
+ * smb_filename flags. Define in terms of the FSP_POSIX_FLAGS_XX
+ * to keep the numeric values consistent.
+ */
+
+#define SMB_FILENAME_POSIX_PATH                FSP_POSIX_FLAGS_PATHNAMES
+
 #define VFS_FIND(__fn__) while (handle->fns->__fn__##_fn==NULL) { \
                                handle = handle->next; \
                         }
diff --git a/source3/lib/filename_util.c b/source3/lib/filename_util.c
index 6ee91ec..3983aaa 100644
--- a/source3/lib/filename_util.c
+++ b/source3/lib/filename_util.c
@@ -53,13 +53,15 @@ NTSTATUS get_full_smb_filename(TALLOC_CTX *ctx,
 struct smb_filename *synthetic_smb_fname(TALLOC_CTX *mem_ctx,
                                         const char *base_name,
                                         const char *stream_name,
-                                        const SMB_STRUCT_STAT *psbuf)
+                                        const SMB_STRUCT_STAT *psbuf,
+                                        uint32_t flags)
 {
        struct smb_filename smb_fname_loc = { 0, };
 
        /* Setup the base_name/stream_name. */
        smb_fname_loc.base_name = discard_const_p(char, base_name);
        smb_fname_loc.stream_name = discard_const_p(char, stream_name);
+       smb_fname_loc.flags = flags;
 
        /* Copy the psbuf if one was given. */
        if (psbuf)
@@ -83,7 +85,11 @@ struct smb_filename *synthetic_smb_fname_split(TALLOC_CTX 
*ctx,
 
        if (posix_path) {
                /* No stream name looked for. */
-               return synthetic_smb_fname(ctx, fname, NULL, NULL);
+               return synthetic_smb_fname(ctx,
+                               fname,
+                               NULL,
+                               NULL,
+                               SMB_FILENAME_POSIX_PATH);
        }
 
        ok = split_stream_filename(ctx,
@@ -94,7 +100,7 @@ struct smb_filename *synthetic_smb_fname_split(TALLOC_CTX 
*ctx,
                return NULL;
        }
 
-       ret = synthetic_smb_fname(ctx, base_name, stream_name, NULL);
+       ret = synthetic_smb_fname(ctx, base_name, stream_name, NULL, 0);
        TALLOC_FREE(base_name);
        TALLOC_FREE(stream_name);
        return ret;
@@ -212,6 +218,7 @@ struct smb_filename *cp_smb_filename(TALLOC_CTX *mem_ctx,
                talloc_set_name_const(out->original_lcomp,
                                      out->original_lcomp);
        }
+       out->flags = in->flags;
        out->st = in->st;
        return out;
 }
@@ -226,7 +233,7 @@ bool is_ntfs_stream_smb_fname(const struct smb_filename 
*smb_fname)
                SMB_ASSERT(smb_fname->stream_name[0] != '\0');
        }
 
-       if (lp_posix_pathnames()) {
+       if (smb_fname->flags & SMB_FILENAME_POSIX_PATH) {
                return false;
        }
 
@@ -267,10 +274,6 @@ bool is_invalid_windows_ea_name(const char *name)
 
 bool ea_list_has_invalid_name(struct ea_list *ea_list)
 {
-       if (lp_posix_pathnames()) {
-               return false;
-       }
-
        for (;ea_list; ea_list = ea_list->next) {
                if (is_invalid_windows_ea_name(ea_list->ea.name)) {
                        return true;
diff --git a/source3/modules/nfs4_acls.c b/source3/modules/nfs4_acls.c
index 349b26b..8756285 100644
--- a/source3/modules/nfs4_acls.c
+++ b/source3/modules/nfs4_acls.c
@@ -274,7 +274,7 @@ static int smbacl4_GetFileOwner(struct connection_struct 
*conn,
        ZERO_STRUCTP(psbuf);
 
        /* Get the stat struct for the owner info. */
-       if (vfs_stat_smb_basename(conn, smb_fname->base_name, psbuf) != 0)
+       if (vfs_stat_smb_basename(conn, smb_fname, psbuf) != 0)
        {
                DEBUG(8, ("vfs_stat_smb_basename failed with error %s\n",
                        strerror(errno)));
diff --git a/source3/modules/non_posix_acls.c b/source3/modules/non_posix_acls.c
index fca9979..8d3be72 100644
--- a/source3/modules/non_posix_acls.c
+++ b/source3/modules/non_posix_acls.c
@@ -32,7 +32,7 @@ int non_posix_sys_acl_blob_get_file_helper(vfs_handle_struct 
*handle,
        struct xattr_sys_acl_hash_wrapper acl_wrapper = {};
        struct smb_filename *smb_fname;
 
-       smb_fname = synthetic_smb_fname(frame, path_p, NULL, NULL);
+       smb_fname = synthetic_smb_fname(frame, path_p, NULL, NULL, 0);
        if (smb_fname == NULL) {
                TALLOC_FREE(frame);
                errno = ENOMEM;
diff --git a/source3/modules/vfs_acl_common.c b/source3/modules/vfs_acl_common.c
index d21c167..98e1b8e 100644
--- a/source3/modules/vfs_acl_common.c
+++ b/source3/modules/vfs_acl_common.c
@@ -641,7 +641,7 @@ static NTSTATUS get_nt_acl_internal(vfs_handle_struct 
*handle,
                         * is fully plumbed through the VFS.
                         */
                        int ret = vfs_stat_smb_basename(handle->conn,
-                                               smb_fname->base_name,
+                                               smb_fname,
                                                &sbuf);
                        if (ret == -1) {
                                TALLOC_FREE(frame);
@@ -1138,7 +1138,7 @@ static int chmod_acl_module_common(struct 
vfs_handle_struct *handle,
                        const struct smb_filename *smb_fname,
                        mode_t mode)
 {
-       if (lp_posix_pathnames()) {
+       if (smb_fname->flags & SMB_FILENAME_POSIX_PATH) {
                /* Only allow this on POSIX pathnames. */
                return SMB_VFS_NEXT_CHMOD(handle, smb_fname, mode);
        }
@@ -1159,7 +1159,7 @@ static int chmod_acl_acl_module_common(struct 
vfs_handle_struct *handle,
                        const struct smb_filename *smb_fname,
                        mode_t mode)
 {
-       if (lp_posix_pathnames()) {
+       if (smb_fname->flags & SMB_FILENAME_POSIX_PATH) {
                /* Only allow this on POSIX pathnames. */
                return SMB_VFS_NEXT_CHMOD_ACL(handle, smb_fname, mode);
        }
diff --git a/source3/modules/vfs_acl_tdb.c b/source3/modules/vfs_acl_tdb.c
index 1bc5973..e4c8462 100644
--- a/source3/modules/vfs_acl_tdb.c
+++ b/source3/modules/vfs_acl_tdb.c
@@ -160,7 +160,7 @@ static NTSTATUS get_acl_blob(TALLOC_CTX *ctx,
                sbuf = fsp->fsp_name->st;
        } else {
                int ret = vfs_stat_smb_basename(handle->conn,
-                               smb_fname->base_name,
+                               smb_fname,
                                &sbuf);
                if (ret == -1) {
                        status = map_nt_error_from_unix(errno);
@@ -252,7 +252,7 @@ static int unlink_acl_tdb(vfs_handle_struct *handle,
                goto out;
        }
 
-       if (lp_posix_pathnames()) {
+       if (smb_fname_tmp->flags & SMB_FILENAME_POSIX_PATH) {
                ret = SMB_VFS_LSTAT(handle->conn, smb_fname_tmp);
        } else {
                ret = SMB_VFS_STAT(handle->conn, smb_fname_tmp);
@@ -285,7 +285,7 @@ static int rmdir_acl_tdb(vfs_handle_struct *handle,
        struct db_context *db = acl_db;
        int ret = -1;
 
-       ret = vfs_stat_smb_basename(handle->conn, smb_fname->base_name, &sbuf);
+       ret = vfs_stat_smb_basename(handle->conn, smb_fname, &sbuf);
        if (ret == -1) {
                return -1;
        }
@@ -341,11 +341,13 @@ static int sys_acl_set_file_tdb(vfs_handle_struct *handle,
                               SMB_ACL_TYPE_T type,
                               SMB_ACL_T theacl)
 {
-       SMB_STRUCT_STAT sbuf;
        struct db_context *db = acl_db;
        int ret = -1;
+       struct smb_filename smb_fname = {
+               .base_name = discard_const_p(char, path)
+       };
 
-       ret = vfs_stat_smb_basename(handle->conn, path, &sbuf);
+       ret = SMB_VFS_STAT(handle->conn, &smb_fname);
        if (ret == -1) {
                return -1;
        }
@@ -358,7 +360,7 @@ static int sys_acl_set_file_tdb(vfs_handle_struct *handle,
                return -1;
        }
 
-       acl_tdb_delete(handle, db, &sbuf);
+       acl_tdb_delete(handle, db, &smb_fname.st);
        return 0;
 }
 
diff --git a/source3/modules/vfs_afsacl.c b/source3/modules/vfs_afsacl.c
index aa8de9a..5838fd0 100644
--- a/source3/modules/vfs_afsacl.c
+++ b/source3/modules/vfs_afsacl.c
@@ -666,12 +666,14 @@ static size_t afs_to_nt_acl(struct afs_acl *afs_acl,
 {
        int ret;
 
+       /*
+        * We can directly use SMB_VFS_STAT here, as if this was a
+        * POSIX call on a symlink, we've already refused it.
+        * For a Windows acl mapped call on a symlink, we want to follow
+        * it.
+        */
        /* Get the stat struct for the owner info. */
-       if (lp_posix_pathnames()) {
-               ret = SMB_VFS_LSTAT(conn, smb_fname);
-       } else {
-               ret = SMB_VFS_STAT(conn, smb_fname);
-       }
+       ret = SMB_VFS_STAT(conn, smb_fname);
        if (ret == -1) {
                return 0;
        }
@@ -1031,31 +1033,24 @@ static NTSTATUS afsacl_fget_nt_acl(struct 
vfs_handle_struct *handle,
 }
 
 static NTSTATUS afsacl_get_nt_acl(struct vfs_handle_struct *handle,
-                                 const char *name, uint32_t security_info,
-                                 TALLOC_CTX *mem_ctx,
-                                 struct security_descriptor **ppdesc)
+                               const struct smb_filename *smb_fname,
+                               uint32_t security_info,
+                               TALLOC_CTX *mem_ctx,
+                               struct security_descriptor **ppdesc)
 {
        struct afs_acl acl;
        size_t sd_size;
-       struct smb_filename *smb_fname = NULL;
 
-       DEBUG(5, ("afsacl_get_nt_acl: %s\n", name));
+       DEBUG(5, ("afsacl_get_nt_acl: %s\n", smb_fname->base_name));
 
        sidpts = lp_parm_bool(SNUM(handle->conn), "afsacl", "sidpts", false);
 
-       if (!afs_get_afs_acl(name, &acl)) {
+       if (!afs_get_afs_acl(smb_fname->base_name, &acl)) {
                return NT_STATUS_ACCESS_DENIED;
        }
 
-       smb_fname = synthetic_smb_fname(talloc_tos(), name, NULL, NULL);
-       if (smb_fname == NULL) {
-               free_afs_acl(&acl);
-               return NT_STATUS_NO_MEMORY;
-       }
-
        sd_size = afs_to_nt_acl(&acl, handle->conn, smb_fname, security_info,
                                mem_ctx, ppdesc);
-       TALLOC_FREE(smb_fname);
 
        free_afs_acl(&acl);
 
diff --git a/source3/modules/vfs_cap.c b/source3/modules/vfs_cap.c
index 42b4b8d..eece198 100644
--- a/source3/modules/vfs_cap.c
+++ b/source3/modules/vfs_cap.c
@@ -69,7 +69,8 @@ static DIR *cap_opendir(vfs_handle_struct *handle,
        cap_smb_fname = synthetic_smb_fname(talloc_tos(),
                                        capname,
                                        NULL,
-                                       NULL);
+                                       NULL,
+                                       smb_fname->flags);
        if (cap_smb_fname == NULL) {
                TALLOC_FREE(capname);
                errno = ENOMEM;
@@ -125,7 +126,8 @@ static int cap_mkdir(vfs_handle_struct *handle,
        cap_smb_fname = synthetic_smb_fname(talloc_tos(),
                                        cappath,
                                        NULL,
-                                       NULL);
+                                       NULL,
+                                       smb_fname->flags);
        if (cap_smb_fname == NULL) {
                TALLOC_FREE(cappath);
                errno = ENOMEM;
@@ -149,7 +151,8 @@ static int cap_rmdir(vfs_handle_struct *handle,
        cap_smb_fname = synthetic_smb_fname(talloc_tos(),
                                        cappath,
                                        NULL,
-                                       NULL);
+                                       NULL,
+                                       smb_fname->flags);
        if (cap_smb_fname == NULL) {
                TALLOC_FREE(cappath);
                errno = ENOMEM;
@@ -321,7 +324,8 @@ static int cap_chmod(vfs_handle_struct *handle,
        cap_smb_fname = synthetic_smb_fname(talloc_tos(),
                                        cappath,
                                        NULL,
-                                       NULL);
+                                       NULL,
+                                       smb_fname->flags);
        if (cap_smb_fname == NULL) {
                TALLOC_FREE(cappath);
                errno = ENOMEM;
@@ -354,7 +358,8 @@ static int cap_chown(vfs_handle_struct *handle,
        cap_smb_fname = synthetic_smb_fname(talloc_tos(),
                                        cappath,
                                        NULL,
-                                       NULL);
+                                       NULL,
+                                       smb_fname->flags);
        if (cap_smb_fname == NULL) {
                TALLOC_FREE(cappath);
                errno = ENOMEM;
@@ -387,7 +392,8 @@ static int cap_lchown(vfs_handle_struct *handle,
        cap_smb_fname = synthetic_smb_fname(talloc_tos(),
                                        cappath,
                                        NULL,
-                                       NULL);
+                                       NULL,
+                                       smb_fname->flags);
        if (cap_smb_fname == NULL) {
                TALLOC_FREE(cappath);
                errno = ENOMEM;
@@ -522,7 +528,8 @@ static int cap_chmod_acl(vfs_handle_struct *handle,
        cap_smb_fname = synthetic_smb_fname(talloc_tos(),
                                        cappath,
                                        NULL,
-                                       NULL);
+                                       NULL,
+                                       smb_fname->flags);
        if (cap_smb_fname == NULL) {
                TALLOC_FREE(cappath);
                errno = ENOMEM;
diff --git a/source3/modules/vfs_catia.c b/source3/modules/vfs_catia.c
index e2b4eb5..c5d2b6a 100644
--- a/source3/modules/vfs_catia.c
+++ b/source3/modules/vfs_catia.c
@@ -290,7 +290,8 @@ static DIR *catia_opendir(vfs_handle_struct *handle,
        mapped_smb_fname = synthetic_smb_fname(talloc_tos(),
                                name_mapped,
                                NULL,
-                               NULL);
+                               NULL,
+                               smb_fname->flags);
        if (mapped_smb_fname == NULL) {
                TALLOC_FREE(mapped_smb_fname);
                errno = ENOMEM;
@@ -543,7 +544,8 @@ static int catia_chown(vfs_handle_struct *handle,
        catia_smb_fname = synthetic_smb_fname(talloc_tos(),
                                        name,
                                        NULL,
-                                       NULL);
+                                       NULL,
+                                       smb_fname->flags);
        if (catia_smb_fname == NULL) {
                TALLOC_FREE(name);
                errno = ENOMEM;
@@ -580,7 +582,8 @@ static int catia_lchown(vfs_handle_struct *handle,
        catia_smb_fname = synthetic_smb_fname(talloc_tos(),
                                        name,
                                        NULL,
-                                       NULL);
+                                       NULL,
+                                       smb_fname->flags);
        if (catia_smb_fname == NULL) {
                TALLOC_FREE(name);
                errno = ENOMEM;
@@ -616,7 +619,8 @@ static int catia_chmod(vfs_handle_struct *handle,
        catia_smb_fname = synthetic_smb_fname(talloc_tos(),
                                        name,
                                        NULL,
-                                       NULL);
+                                       NULL,
+                                       smb_fname->flags);
        if (catia_smb_fname == NULL) {
                TALLOC_FREE(name);
                errno = ENOMEM;
@@ -650,7 +654,8 @@ static int catia_rmdir(vfs_handle_struct *handle,
        catia_smb_fname = synthetic_smb_fname(talloc_tos(),
                                        name,
                                        NULL,
-                                       NULL);
+                                       NULL,
+                                       smb_fname->flags);
        if (catia_smb_fname == NULL) {
                TALLOC_FREE(name);
                errno = ENOMEM;
@@ -684,7 +689,8 @@ static int catia_mkdir(vfs_handle_struct *handle,
        catia_smb_fname = synthetic_smb_fname(talloc_tos(),
                                        name,
                                        NULL,
-                                       NULL);
+                                       NULL,
+                                       smb_fname->flags);
        if (catia_smb_fname == NULL) {
                TALLOC_FREE(name);
                errno = ENOMEM;
@@ -819,7 +825,8 @@ catia_streaminfo(struct vfs_handle_struct *handle,
        catia_smb_fname = synthetic_smb_fname(talloc_tos(),
                                        mapped_name,
                                        NULL,
-                                       NULL);
+                                       NULL,
+                                       smb_fname->flags);
        if (catia_smb_fname == NULL) {
                TALLOC_FREE(mapped_name);
                return NT_STATUS_NO_MEMORY;
@@ -898,7 +905,8 @@ catia_get_nt_acl(struct vfs_handle_struct *handle,
        mapped_smb_fname = synthetic_smb_fname(talloc_tos(),
                                        mapped_name,
                                        NULL,
-                                       NULL);
+                                       NULL,
+                                       smb_fname->flags);
        if (mapped_smb_fname == NULL) {
                TALLOC_FREE(mapped_name);
                return NT_STATUS_NO_MEMORY;
@@ -935,7 +943,8 @@ catia_chmod_acl(vfs_handle_struct *handle,
        mapped_smb_fname = synthetic_smb_fname(talloc_tos(),
                                        mapped_name,
                                        NULL,
-                                       NULL);
+                                       NULL,
+                                       smb_fname->flags);
        if (mapped_smb_fname == NULL) {
                TALLOC_FREE(mapped_name);
                errno = ENOMEM;
diff --git a/source3/modules/vfs_default.c b/source3/modules/vfs_default.c
index ea7dc2c..41e443e 100644
--- a/source3/modules/vfs_default.c
+++ b/source3/modules/vfs_default.c
@@ -133,7 +133,7 @@ static uint32_t vfswrap_fs_capabilities(struct 
vfs_handle_struct *handle,
         * use when setting a timestamp. */
 
        smb_fname_cpath = synthetic_smb_fname(talloc_tos(), conn->connectpath,
-                                             NULL, NULL);
+                                             NULL, NULL, 0);
        if (smb_fname_cpath == NULL) {
                return caps;
        }
@@ -419,13 +419,20 @@ static struct dirent *vfswrap_readdir(vfs_handle_struct 
*handle,
                if (result != NULL) {
                        /* See if we can efficiently return this. */
                        struct stat st;
-                       int flags = (lp_posix_pathnames() ?
-                               AT_SYMLINK_NOFOLLOW : 0);
+                       int flags = AT_SYMLINK_NOFOLLOW;
                        int ret = fstatat(dirfd(dirp),
                                        result->d_name,
                                        &st,
                                        flags);
-                       if (ret == 0) {
+                       /*
+                        * As this is an optimization,
+                        * ignore it if we stat'ed a
+                        * symlink. Make the caller
+                        * do it again as we don't
+                        * know if they wanted the link
+                        * info, or its target info.
+                        */
+                       if ((ret == 0) && (!S_ISLNK(st.st_mode))) {
                                init_stat_ex_from_stat(sbuf,
                                        &st,
                                        lp_fake_directory_create_times(
@@ -2211,8 +2218,9 @@ static NTSTATUS vfswrap_streaminfo(vfs_handle_struct 
*handle,
                ZERO_STRUCT(smb_fname_cp);
                smb_fname_cp.base_name = discard_const_p(char,
                                        smb_fname->base_name);
+               smb_fname_cp.flags = smb_fname->flags;


-- 
Samba Shared Repository

Reply via email to