]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s3: smbd: Remove many common uses of lp_posix_pathnames().
authorJeremy Allison <jra@samba.org>
Sat, 19 Mar 2016 04:58:20 +0000 (21:58 -0700)
committerJeremy Allison <jra@samba.org>
Thu, 24 Mar 2016 21:57:16 +0000 (22:57 +0100)
Check the smb_filename->flags field, or req->posix_pathnames
instead, depending on what is available.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Uri Simchoni <uri@samba.org>
source3/lib/filename_util.c
source3/modules/vfs_acl_common.c
source3/modules/vfs_acl_tdb.c
source3/modules/vfs_default.c
source3/modules/vfs_posix_eadb.c
source3/modules/vfs_streams_depot.c
source3/modules/vfs_streams_xattr.c
source3/modules/vfs_xattr_tdb.c
source3/smbd/nttrans.c
source3/smbd/trans2.c

index 78bfc7040d8ad8b237045acc9d52c7bae71a4b12..3983aaa0eca857e928d452e4e10b6c0be5873e26 100644 (file)
@@ -233,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;
        }
 
index d21c16707c849747d39e2ec0b6dc88cf8afb6047..c907b0fdc953edb76fa20d1057bf924c21576eac 100644 (file)
@@ -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);
        }
index 1bc5973622ce9fd5ea7008d474a874fb4c521195..eee4d896931790df2a78bac36044639baa6f7189 100644 (file)
@@ -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);
index a7004a0d753c720b96c3aff314a6d97f3cd4e46c..41e443e6ca67553beb80be5b737678d25ad0028b 100644 (file)
@@ -2220,7 +2220,7 @@ static NTSTATUS vfswrap_streaminfo(vfs_handle_struct *handle,
                                        smb_fname->base_name);
                smb_fname_cp.flags = smb_fname->flags;
 
-               if (lp_posix_pathnames()) {
+               if (smb_fname_cp.flags & SMB_FILENAME_POSIX_PATH) {
                        ret = SMB_VFS_LSTAT(handle->conn, &smb_fname_cp);
                } else {
                        ret = SMB_VFS_STAT(handle->conn, &smb_fname_cp);
index 1d165298a2e853a74f793abe37db5ef69c1733f0..2c7717a508b5f93003ed78465430725816e9e1a3 100644 (file)
@@ -296,7 +296,7 @@ static int posix_eadb_unlink(vfs_handle_struct *handle,
                return -1;
        }
 
-       if (lp_posix_pathnames()) {
+       if (smb_fname->flags & SMB_FILENAME_POSIX_PATH) {
                ret = SMB_VFS_NEXT_LSTAT(handle, smb_fname_tmp);
        } else {
                ret = SMB_VFS_NEXT_STAT(handle, smb_fname_tmp);
index 2b80b9dcf7b8fe214475eaa794b5eb922752b78f..83c9d9743ae8262c6f0be4792f1f3ce4e35f68e4 100644 (file)
@@ -714,7 +714,7 @@ static int streams_depot_unlink(vfs_handle_struct *handle,
                return -1;
        }
 
-       if (lp_posix_pathnames()) {
+       if (smb_fname_base->flags & SMB_FILENAME_POSIX_PATH) {
                ret = SMB_VFS_NEXT_LSTAT(handle, smb_fname_base);
        } else {
                ret = SMB_VFS_NEXT_STAT(handle, smb_fname_base);
@@ -776,7 +776,7 @@ static int streams_depot_rmdir(vfs_handle_struct *handle,
                return -1;
        }
 
-       if (lp_posix_pathnames()) {
+       if (smb_fname_base->flags & SMB_FILENAME_POSIX_PATH) {
                ret = SMB_VFS_NEXT_LSTAT(handle, smb_fname_base);
        } else {
                ret = SMB_VFS_NEXT_STAT(handle, smb_fname_base);
@@ -974,7 +974,7 @@ static NTSTATUS streams_depot_streaminfo(vfs_handle_struct *handle,
                ret = SMB_VFS_NEXT_FSTAT(handle, fsp, &smb_fname_base->st);
        }
        else {
-               if (lp_posix_pathnames()) {
+               if (smb_fname_base->flags & SMB_FILENAME_POSIX_PATH) {
                        ret = SMB_VFS_NEXT_LSTAT(handle, smb_fname_base);
                } else {
                        ret = SMB_VFS_NEXT_STAT(handle, smb_fname_base);
index b3b800264fbcc27b194403aa9932c08e20c72075..831346485225d303406ba9cae8785a52ce0fce70 100644 (file)
@@ -252,7 +252,7 @@ static int streams_xattr_fstat(vfs_handle_struct *handle, files_struct *fsp,
                return -1;
        }
 
-       if (lp_posix_pathnames()) {
+       if (smb_fname_base->flags & SMB_FILENAME_POSIX_PATH) {
                ret = SMB_VFS_LSTAT(handle->conn, smb_fname_base);
        } else {
                ret = SMB_VFS_STAT(handle->conn, smb_fname_base);
index aac824523b901718fbc1a616f96c7ff694928b81..aa3bd8279b521f2cfcc842f247a6126b53b0381b 100644 (file)
@@ -364,7 +364,7 @@ static int xattr_tdb_unlink(vfs_handle_struct *handle,
                return -1;
        }
 
-       if (lp_posix_pathnames()) {
+       if (smb_fname_tmp->flags & SMB_FILENAME_POSIX_PATH) {
                ret = SMB_VFS_NEXT_LSTAT(handle, smb_fname_tmp);
        } else {
                ret = SMB_VFS_NEXT_STAT(handle, smb_fname_tmp);
index be5994a2f89e20b13ee4e3db36e53f95eb5acb52..3a2c35fe7b1b073a06959df77cec34671ed1a1e0 100644 (file)
@@ -1178,7 +1178,7 @@ static void call_nt_transact_create(connection_struct *conn,
                        goto out;
                }
 
-               if (!lp_posix_pathnames() &&
+               if (!req->posix_pathnames &&
                                ea_list_has_invalid_name(ea_list)) {
                        /* Realloc the size of parameters and data we will return */
                        if (flags & EXTENDED_RESPONSE_REQUIRED) {
index a76b2df70d8434e33c6ac5bae40ec300c7e0741b..65c2cb079aa39cd29fe98778de5113c702dc92f5 100644 (file)
@@ -371,11 +371,19 @@ static NTSTATUS get_ea_list_from_file_path(TALLOC_CTX *mem_ctx,
        size_t i, num_names;
        char **names;
        struct ea_list *ea_list_head = NULL;
+       bool posix_pathnames = false;
        NTSTATUS status;
 
        *pea_total_len = 0;
        *ea_list = NULL;
 
+       if (fsp) {
+               posix_pathnames =
+                       (fsp->fsp_name->flags & SMB_FILENAME_POSIX_PATH);
+       } else {
+               posix_pathnames = (smb_fname->flags & SMB_FILENAME_POSIX_PATH);
+       }
+
        status = get_ea_names_from_file(talloc_tos(),
                                conn,
                                fsp,
@@ -404,7 +412,7 @@ static NTSTATUS get_ea_list_from_file_path(TALLOC_CTX *mem_ctx,
                 * Filter out any underlying POSIX EA names
                 * that a Windows client can't handle.
                 */
-               if (!lp_posix_pathnames() &&
+               if (!posix_pathnames &&
                                is_invalid_windows_ea_name(names[i])) {
                        continue;
                }
@@ -692,11 +700,19 @@ NTSTATUS set_ea(connection_struct *conn, files_struct *fsp,
                const struct smb_filename *smb_fname, struct ea_list *ea_list)
 {
        NTSTATUS status;
+       bool posix_pathnames = false;
 
        if (!lp_ea_support(SNUM(conn))) {
                return NT_STATUS_EAS_NOT_SUPPORTED;
        }
 
+       if (fsp) {
+               posix_pathnames =
+                       (fsp->fsp_name->flags & SMB_FILENAME_POSIX_PATH);
+       } else {
+               posix_pathnames = (smb_fname->flags & SMB_FILENAME_POSIX_PATH);
+       }
+
        status = refuse_symlink(conn, fsp, smb_fname);
        if (!NT_STATUS_IS_OK(status)) {
                return status;
@@ -717,7 +733,7 @@ NTSTATUS set_ea(connection_struct *conn, files_struct *fsp,
         * we set *any* of them.
         */
 
-       if (!lp_posix_pathnames() && ea_list_has_invalid_name(ea_list)) {
+       if (!posix_pathnames && ea_list_has_invalid_name(ea_list)) {
                return STATUS_INVALID_EA_NAME;
        }
 
@@ -1297,7 +1313,7 @@ static void call_trans2open(connection_struct *conn,
                        goto out;
                }
 
-               if (!lp_posix_pathnames() &&
+               if (!req->posix_pathnames &&
                                ea_list_has_invalid_name(ea_list)) {
                        int param_len = 30;
                        *pparams = (char *)SMB_REALLOC(*pparams, param_len);