s3: VFS: Change SMB_VFS_SYS_ACL_GET_FILE to use const struct smb_filename * instead...
authorJeremy Allison <jra@samba.org>
Wed, 24 May 2017 00:11:18 +0000 (17:11 -0700)
committerJeremy Allison <jra@samba.org>
Wed, 31 May 2017 20:50:22 +0000 (22:50 +0200)
We need to migrate all pathname based VFS calls to use a struct
to finish modernising the VFS with extra timestamp and flags parameters.

Requires a few extra cleanups in calling code.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
38 files changed:
examples/VFS/skel_opaque.c
examples/VFS/skel_transparent.c
source3/include/smb_acls.h
source3/include/vfs.h
source3/include/vfs_macros.h
source3/lib/sysacls.c
source3/modules/posixacl_xattr.c
source3/modules/posixacl_xattr.h
source3/modules/vfs_aixacl.c
source3/modules/vfs_aixacl2.c
source3/modules/vfs_cap.c
source3/modules/vfs_catia.c
source3/modules/vfs_default.c
source3/modules/vfs_fake_acls.c
source3/modules/vfs_full_audit.c
source3/modules/vfs_gpfs.c
source3/modules/vfs_hpuxacl.c
source3/modules/vfs_hpuxacl.h
source3/modules/vfs_media_harmony.c
source3/modules/vfs_nfs4acl_xattr.c
source3/modules/vfs_posixacl.c
source3/modules/vfs_posixacl.h
source3/modules/vfs_solarisacl.c
source3/modules/vfs_solarisacl.h
source3/modules/vfs_time_audit.c
source3/modules/vfs_tru64acl.c
source3/modules/vfs_tru64acl.h
source3/modules/vfs_unityed_media.c
source3/modules/vfs_vxfs.c
source3/modules/vfs_zfsacl.c
source3/smbd/dosmode.c
source3/smbd/open.c
source3/smbd/posix_acls.c
source3/smbd/proto.h
source3/smbd/pysmbd.c
source3/smbd/trans2.c
source3/smbd/vfs.c
source3/torture/cmd_vfs.c

index 801012a89657c4fc825092787bfaf7c754cf25ea..b0be73c9c06c68eaa363698d57a416f51a7265f8 100644 (file)
@@ -741,7 +741,7 @@ static int skel_fchmod_acl(vfs_handle_struct *handle, files_struct *fsp,
 }
 
 static SMB_ACL_T skel_sys_acl_get_file(vfs_handle_struct *handle,
-                                      const char *path_p,
+                                      const struct smb_filename *smb_fname,
                                       SMB_ACL_TYPE_T type,
                                       TALLOC_CTX *mem_ctx)
 {
index 0404a2e11c9a5a72bd8b4b7ff177d90261482610..d103695eebf98e4bbd96c8ba98695ab6adddfe90 100644 (file)
@@ -881,11 +881,11 @@ static int skel_fchmod_acl(vfs_handle_struct *handle, files_struct *fsp,
 }
 
 static SMB_ACL_T skel_sys_acl_get_file(vfs_handle_struct *handle,
-                                      const char *path_p,
+                                      const struct smb_filename *smb_fname,
                                       SMB_ACL_TYPE_T type,
                                       TALLOC_CTX *mem_ctx)
 {
-       return SMB_VFS_NEXT_SYS_ACL_GET_FILE(handle, path_p, type, mem_ctx);
+       return SMB_VFS_NEXT_SYS_ACL_GET_FILE(handle, smb_fname, type, mem_ctx);
 }
 
 static SMB_ACL_T skel_sys_acl_get_fd(vfs_handle_struct *handle,
index 6a41e196e195be9ad28b7d1d3b70e5a2c850f1bd..f5603f3f38bb10c32489db2216e521555adc8747 100644 (file)
@@ -53,8 +53,9 @@ int sys_acl_set_permset(SMB_ACL_ENTRY_T entry_d, SMB_ACL_PERMSET_T permset_d);
 int sys_acl_free_text(char *text);
 int sys_acl_valid(SMB_ACL_T acl_d);
 SMB_ACL_T sys_acl_get_file(struct vfs_handle_struct *handle,
-                          const char *path_p, SMB_ACL_TYPE_T type,
-                          TALLOC_CTX *mem_ctx);
+                       const struct smb_filename *smb_fname,
+                       SMB_ACL_TYPE_T type,
+                       TALLOC_CTX *mem_ctx);
 SMB_ACL_T sys_acl_get_fd(struct vfs_handle_struct *handle, struct files_struct *fsp,
                         TALLOC_CTX *mem_ctx);
 int sys_acl_set_file(struct vfs_handle_struct *handle,
index 8fe5536ffcce341a68f88aa1c584e70e4f5bcc29..330a819a98ae011eb7e65bec4a73cb5def0a3a1e 100644 (file)
 /* Version 37 - Add vfs_copy_chunk_flags for DUP_EXTENTS_TO_FILE */
 /* Version 37 - Change sys_acl_delete_def_file from const char *
                to const struct smb_filename * */
+/* Version 37 - Change sys_acl_get_file from const char *
+               to const struct smb_filename * */
 
 #define SMB_VFS_INTERFACE_VERSION 37
 
@@ -858,7 +860,7 @@ struct vfs_fn_pointers {
        int (*fchmod_acl_fn)(struct vfs_handle_struct *handle, struct files_struct *fsp, mode_t mode);
 
        SMB_ACL_T (*sys_acl_get_file_fn)(struct vfs_handle_struct *handle,
-                                        const char *path_p,
+                                        const struct smb_filename *smb_fname,
                                         SMB_ACL_TYPE_T type,
                                         TALLOC_CTX *mem_ctx);
        SMB_ACL_T (*sys_acl_get_fd_fn)(struct vfs_handle_struct *handle,
@@ -1314,7 +1316,7 @@ int smb_vfs_call_chmod_acl(struct vfs_handle_struct *handle,
 int smb_vfs_call_fchmod_acl(struct vfs_handle_struct *handle,
                            struct files_struct *fsp, mode_t mode);
 SMB_ACL_T smb_vfs_call_sys_acl_get_file(struct vfs_handle_struct *handle,
-                                       const char *path_p,
+                                       const struct smb_filename *smb_fname,
                                        SMB_ACL_TYPE_T type,
                                        TALLOC_CTX *mem_ctx);
 SMB_ACL_T smb_vfs_call_sys_acl_get_fd(struct vfs_handle_struct *handle,
index 43dfe929fff93461266a140d3e74f360f858d5e1..68581818d7b8c02f46fb9dcc05d01662c6a63446 100644 (file)
 #define SMB_VFS_NEXT_FCHMOD_ACL(handle, fsp, mode) \
        smb_vfs_call_fchmod_acl((handle)->next, (fsp), (mode))
 
-#define SMB_VFS_SYS_ACL_GET_FILE(conn, path_p, type, mem_ctx)          \
-       smb_vfs_call_sys_acl_get_file((conn)->vfs_handles, (path_p), (type), (mem_ctx))
-#define SMB_VFS_NEXT_SYS_ACL_GET_FILE(handle, path_p, type, mem_ctx)           \
-       smb_vfs_call_sys_acl_get_file((handle)->next, (path_p), (type), (mem_ctx))
+#define SMB_VFS_SYS_ACL_GET_FILE(conn, smb_fname, type, mem_ctx)               \
+       smb_vfs_call_sys_acl_get_file((conn)->vfs_handles, (smb_fname), (type), (mem_ctx))
+#define SMB_VFS_NEXT_SYS_ACL_GET_FILE(handle, smb_fname, type, mem_ctx)                \
+       smb_vfs_call_sys_acl_get_file((handle)->next, (smb_fname), (type), (mem_ctx))
 
 #define SMB_VFS_SYS_ACL_GET_FD(fsp, mem_ctx) \
        smb_vfs_call_sys_acl_get_fd((fsp)->conn->vfs_handles, (fsp), (mem_ctx))
index b75c98149acae6c50f000d5f9b5c594a9ce5a836..8016773110a62067eed62ec32fe7cc2c29fab23a 100644 (file)
@@ -362,9 +362,11 @@ int sys_acl_valid(SMB_ACL_T acl_d)
 #if defined(HAVE_POSIX_ACLS)
 
 SMB_ACL_T sys_acl_get_file(vfs_handle_struct *handle,
-                          const char *path_p, SMB_ACL_TYPE_T type, TALLOC_CTX *mem_ctx)
+                       const struct smb_filename *smb_fname,
+                       SMB_ACL_TYPE_T type,
+                       TALLOC_CTX *mem_ctx)
 {
-       return posixacl_sys_acl_get_file(handle, path_p, type, mem_ctx);
+       return posixacl_sys_acl_get_file(handle, smb_fname, type, mem_ctx);
 }
 
 SMB_ACL_T sys_acl_get_fd(vfs_handle_struct *handle, files_struct *fsp, TALLOC_CTX *mem_ctx)
@@ -393,10 +395,11 @@ int sys_acl_delete_def_file(vfs_handle_struct *handle,
 #elif defined(HAVE_AIX_ACLS)
 
 SMB_ACL_T sys_acl_get_file(vfs_handle_struct *handle,
-                          const char *path_p, SMB_ACL_TYPE_T type,
-                          TALLOC_CTX *mem_ctx)
+                       const struct smb_filename *smb_fname,
+                       SMB_ACL_TYPE_T type,
+                       TALLOC_CTX *mem_ctx)
 {
-       return aixacl_sys_acl_get_file(handle, path_p, type, mem_ctx);
+       return aixacl_sys_acl_get_file(handle, smb_fname, type, mem_ctx);
 }
 
 SMB_ACL_T sys_acl_get_fd(vfs_handle_struct *handle, files_struct *fsp,
@@ -426,10 +429,11 @@ int sys_acl_delete_def_file(vfs_handle_struct *handle,
 #elif defined(HAVE_TRU64_ACLS)
 
 SMB_ACL_T sys_acl_get_file(vfs_handle_struct *handle,
-                          const char *path_p, SMB_ACL_TYPE_T type,
-                          TALLOC_CTX *mem_ctx)
+                       const struct smb_filename *smb_fname,
+                       SMB_ACL_TYPE_T type,
+                       TALLOC_CTX *mem_ctx)
 {
-       return tru64acl_sys_acl_get_file(handle, path_p, type,
+       return tru64acl_sys_acl_get_file(handle, smb_fname, type,
                                         mem_ctx);
 }
 
@@ -460,10 +464,11 @@ int sys_acl_delete_def_file(vfs_handle_struct *handle,
 #elif defined(HAVE_SOLARIS_UNIXWARE_ACLS)
 
 SMB_ACL_T sys_acl_get_file(vfs_handle_struct *handle,
-                          const char *path_p, SMB_ACL_TYPE_T type,
-                          TALLOC_CTX *mem_ctx)
+                       const struct smb_filename *smb_fname,
+                       SMB_ACL_TYPE_T type,
+                       TALLOC_CTX *mem_ctx)
 {
-       return solarisacl_sys_acl_get_file(handle, path_p, type,
+       return solarisacl_sys_acl_get_file(handle, smb_fname, type,
                                           mem_ctx);
 }
 
@@ -495,10 +500,11 @@ int sys_acl_delete_def_file(vfs_handle_struct *handle,
 #elif defined(HAVE_HPUX_ACLS)
 
 SMB_ACL_T sys_acl_get_file(vfs_handle_struct *handle,
-                          const char *path_p, SMB_ACL_TYPE_T type,
-                          TALLOC_CTX *mem_ctx)
+                       const struct smb_filename *smb_fname,
+                       SMB_ACL_TYPE_T type,
+                       TALLOC_CTX *mem_ctx)
 {
-       return hpuxacl_sys_acl_get_file(handle, path_p, type, mem_ctx);
+       return hpuxacl_sys_acl_get_file(handle, smb_fname, type, mem_ctx);
 }
 
 SMB_ACL_T sys_acl_get_fd(vfs_handle_struct *handle, files_struct *fsp,
@@ -528,8 +534,9 @@ int sys_acl_delete_def_file(vfs_handle_struct *handle,
 #else /* No ACLs. */
 
 SMB_ACL_T sys_acl_get_file(vfs_handle_struct *handle,
-                          const char *path_p, SMB_ACL_TYPE_T type,
-                          TALLOC_CTX *mem_ctx)
+                       const struct smb_filename *smb_fname,
+                       SMB_ACL_TYPE_T type,
+                       TALLOC_CTX *mem_ctx)
 {
 #ifdef ENOTSUP
        errno = ENOTSUP;
index 871aa669f1a5c50f4f3f2f37f0e8b1aad7d58d89..ded16a0bfba968e6e66b9808a26472721b0973d6 100644 (file)
@@ -336,7 +336,7 @@ static int smb_acl_to_posixacl_xattr(SMB_ACL_T theacl, char *buf, size_t len)
 }
 
 SMB_ACL_T posixacl_xattr_acl_get_file(vfs_handle_struct *handle,
-                                     const char *path_p,
+                                     const struct smb_filename *smb_fname,
                                      SMB_ACL_TYPE_T type,
                                      TALLOC_CTX *mem_ctx)
 {
@@ -360,16 +360,18 @@ SMB_ACL_T posixacl_xattr_acl_get_file(vfs_handle_struct *handle,
                return NULL;
        }
 
-       ret = SMB_VFS_GETXATTR(handle->conn, path_p, name, buf, size);
+       ret = SMB_VFS_GETXATTR(handle->conn, smb_fname->base_name,
+                               name, buf, size);
        if (ret < 0 && errno == ERANGE) {
-               size = SMB_VFS_GETXATTR(handle->conn, path_p, name,
-                                       NULL, 0);
+               size = SMB_VFS_GETXATTR(handle->conn, smb_fname->base_name,
+                                       name, NULL, 0);
                if (size > 0) {
                        buf = alloca(size);
                        if (!buf) {
                                return NULL;
                        }
-                       ret = SMB_VFS_GETXATTR(handle->conn, path_p, name,
+                       ret = SMB_VFS_GETXATTR(handle->conn,
+                                               smb_fname->base_name, name,
                                                buf, size);
                }
        }
@@ -380,15 +382,15 @@ SMB_ACL_T posixacl_xattr_acl_get_file(vfs_handle_struct *handle,
        if (ret == 0 || errno == ENOATTR || errno == ENODATA) {
                mode_t mode = 0;
                TALLOC_CTX *frame = talloc_stackframe();
-               struct smb_filename *smb_fname =
-                       synthetic_smb_fname(frame, path_p, NULL, NULL, 0);
+               struct smb_filename *smb_fname_tmp =
+                       cp_smb_filename_nostream(frame, smb_fname);
                if (smb_fname == NULL) {
                        errno = ENOMEM;
                        ret = -1;
                } else {
-                       ret = SMB_VFS_STAT(handle->conn, smb_fname);
+                       ret = SMB_VFS_STAT(handle->conn, smb_fname_tmp);
                        if (ret == 0) {
-                               mode = smb_fname->st.st_ex_mode;
+                               mode = smb_fname_tmp->st.st_ex_mode;
                        }
                }
                TALLOC_FREE(frame);
index 6f6316ae4533786dac566185d66382c24343130c..8751692f5715a3ccadbc7df2320ffd2bae18ec51 100644 (file)
@@ -22,7 +22,7 @@
 #define __POSIXACL_XATTR_H__
 
 SMB_ACL_T posixacl_xattr_acl_get_file(vfs_handle_struct *handle,
-                                     const char *path_p,
+                                     const struct smb_filename *smb_fname,
                                      SMB_ACL_TYPE_T type,
                                      TALLOC_CTX *mem_ctx);
 
index c25c249a6f5b1a3fcad5c040b065a9853f5126c2..024c9aa2691081d878990ef0278d04102e0c6838 100644 (file)
 #include "vfs_aixacl_util.h"
 
 SMB_ACL_T aixacl_sys_acl_get_file(vfs_handle_struct *handle,
-                                 const char *path_p,
+                                 const struct smb_filename *smb_fname,
                                  SMB_ACL_TYPE_T type,
                                  TALLOC_CTX *mem_ctx)
 {
+       const char *path_p = smb_fname->base_name;
        struct acl *file_acl = (struct acl *)NULL;
        struct smb_acl_t *result = (struct smb_acl_t *)NULL;
        
index e46e5026215946886039c7b250171a726ff0d575..de5b333423b0f88c36aaff5bf20bb109409f96b7 100644 (file)
@@ -291,9 +291,9 @@ static SMB_ACL_T aixjfs2_get_posix_acl(const char *path, acl_type_t type, TALLOC
 }
 
 SMB_ACL_T aixjfs2_sys_acl_get_file(vfs_handle_struct *handle,
-                                    const char *path_p,
-                                  SMB_ACL_TYPE_T type,
-                                  TALLOC_CTX *mem_ctx)
+                               const struct smb_filename *smb_fname,
+                               SMB_ACL_TYPE_T type,
+                               TALLOC_CTX *mem_ctx)
 {
         acl_type_t aixjfs2_type;
 
@@ -309,7 +309,8 @@ SMB_ACL_T aixjfs2_sys_acl_get_file(vfs_handle_struct *handle,
                 smb_panic("exiting");
         }
 
-        return aixjfs2_get_posix_acl(path_p, aixjfs2_type, mem_ctx);
+        return aixjfs2_get_posix_acl(smb_fname->base_name,
+                       aixjfs2_type, mem_ctx);
 }
 
 SMB_ACL_T aixjfs2_sys_acl_get_fd(vfs_handle_struct *handle,
index 4179926267581750d54f92ee8450dac010c6ff6f..8aba4314fcb32b20ef0e3c479666a6b57a7510b6 100644 (file)
@@ -545,16 +545,40 @@ static int cap_chmod_acl(vfs_handle_struct *handle,
 }
 
 static SMB_ACL_T cap_sys_acl_get_file(vfs_handle_struct *handle,
-                                     const char *path, SMB_ACL_TYPE_T type,
-                                     TALLOC_CTX *mem_ctx)
+                               const struct smb_filename *smb_fname,
+                               SMB_ACL_TYPE_T type,
+                               TALLOC_CTX *mem_ctx)
 {
-       char *cappath = capencode(talloc_tos(), path);
+       struct smb_filename *cap_smb_fname = NULL;
+       char *cappath = capencode(talloc_tos(), smb_fname->base_name);
+       SMB_ACL_T ret;
+       int saved_errno = 0;
 
        if (!cappath) {
                errno = ENOMEM;
                return (SMB_ACL_T)NULL;
        }
-       return SMB_VFS_NEXT_SYS_ACL_GET_FILE(handle, cappath, type, mem_ctx);
+       cap_smb_fname = synthetic_smb_fname(talloc_tos(),
+                                       cappath,
+                                       NULL,
+                                       NULL,
+                                       smb_fname->flags);
+       if (cap_smb_fname == NULL) {
+               TALLOC_FREE(cappath);
+               errno = ENOMEM;
+               return (SMB_ACL_T)NULL;
+       }
+       ret = SMB_VFS_NEXT_SYS_ACL_GET_FILE(handle, cap_smb_fname,
+                               type, mem_ctx);
+       if (ret == NULL) {
+               saved_errno = errno;
+       }
+       TALLOC_FREE(cappath);
+       TALLOC_FREE(cap_smb_fname);
+       if (saved_errno != 0) {
+               errno = saved_errno;
+       }
+       return ret;
 }
 
 static int cap_sys_acl_set_file(vfs_handle_struct *handle, const char *path, SMB_ACL_TYPE_T acltype, SMB_ACL_T theacl)
index 7ed531ac0a35bb118e7c22f10685f6efa4af579a..18dbc80cd8790c3193551af94d31d2660b5888e3 100644 (file)
@@ -1246,24 +1246,46 @@ catia_chmod_acl(vfs_handle_struct *handle,
 
 static SMB_ACL_T
 catia_sys_acl_get_file(vfs_handle_struct *handle,
-                      const char *path,
-                      SMB_ACL_TYPE_T type,
-                      TALLOC_CTX *mem_ctx)
+                       const struct smb_filename *smb_fname,
+                       SMB_ACL_TYPE_T type,
+                       TALLOC_CTX *mem_ctx)
 {
        char *mapped_name = NULL;
+       struct smb_filename *mapped_smb_fname = NULL;
        NTSTATUS status;
        SMB_ACL_T ret;
+       int saved_errno = 0;
 
        status = catia_string_replace_allocate(handle->conn,
-                               path, &mapped_name, vfs_translate_to_unix);
+                               smb_fname->base_name,
+                               &mapped_name,
+                               vfs_translate_to_unix);
        if (!NT_STATUS_IS_OK(status)) {
                errno = map_errno_from_nt_status(status);
-               return NULL;
+               return (SMB_ACL_T)NULL;
        }
 
-       ret = SMB_VFS_NEXT_SYS_ACL_GET_FILE(handle, mapped_name, type, mem_ctx);
-       TALLOC_FREE(mapped_name);
+       mapped_smb_fname = synthetic_smb_fname(talloc_tos(),
+                                       mapped_name,
+                                       NULL,
+                                       NULL,
+                                       smb_fname->flags);
+       if (mapped_smb_fname == NULL) {
+               TALLOC_FREE(mapped_name);
+               errno = ENOMEM;
+               return (SMB_ACL_T)NULL;
+       }
 
+       ret = SMB_VFS_NEXT_SYS_ACL_GET_FILE(handle, mapped_smb_fname,
+                       type, mem_ctx);
+       if (ret == (SMB_ACL_T)NULL) {
+               saved_errno = errno;
+       }
+       TALLOC_FREE(mapped_smb_fname);
+       TALLOC_FREE(mapped_name);
+       if (saved_errno != 0) {
+               errno = saved_errno;
+       }
        return ret;
 }
 
index 19b6925a3a4090975c0c5496644d0507dcfa50e8..c3de3d7572d2f05510bfc283f776d70c78c655ad 100644 (file)
@@ -2688,7 +2688,7 @@ static int vfswrap_chmod_acl(vfs_handle_struct *handle,
        int result;
 
        START_PROFILE(chmod_acl);
-       result = chmod_acl(handle->conn, smb_fname->base_name, mode);
+       result = chmod_acl(handle->conn, smb_fname, mode);
        END_PROFILE(chmod_acl);
        return result;
 #endif
@@ -2710,11 +2710,11 @@ static int vfswrap_fchmod_acl(vfs_handle_struct *handle, files_struct *fsp, mode
 }
 
 static SMB_ACL_T vfswrap_sys_acl_get_file(vfs_handle_struct *handle,
-                                         const char *path_p,
+                                         const struct smb_filename *smb_fname,
                                          SMB_ACL_TYPE_T type,
                                          TALLOC_CTX *mem_ctx)
 {
-       return sys_acl_get_file(handle, path_p, type, mem_ctx);
+       return sys_acl_get_file(handle, smb_fname, type, mem_ctx);
 }
 
 static SMB_ACL_T vfswrap_sys_acl_get_fd(vfs_handle_struct *handle,
index fae8014f78e25cf221479d6fe503ad7b274f3aea..cb8d12395cc50cd21b68a7a3b4991791d8fd2c90 100644 (file)
@@ -242,14 +242,15 @@ static DATA_BLOB fake_acls_acl2blob(TALLOC_CTX *mem_ctx, SMB_ACL_T acl)
 }
 
 static SMB_ACL_T fake_acls_sys_acl_get_file(struct vfs_handle_struct *handle,
-                                           const char *path,
-                                           SMB_ACL_TYPE_T type,
-                                           TALLOC_CTX *mem_ctx)
+                               const struct smb_filename *smb_fname,
+                               SMB_ACL_TYPE_T type,
+                               TALLOC_CTX *mem_ctx)
 {
        DATA_BLOB blob = data_blob_null;
        ssize_t length;
        const char *name = NULL;
        struct smb_acl_t *acl = NULL;
+       const char *path = smb_fname->base_name;
        TALLOC_CTX *frame = talloc_stackframe();
        switch (type) {
        case SMB_ACL_TYPE_ACCESS:
index e6ee5770afe70f71b7e7c299537d1bbf6f82a074..932dbf803a622ede1502ff0383278529fd56751d 100644 (file)
@@ -2152,16 +2152,17 @@ static int smb_full_audit_fchmod_acl(vfs_handle_struct *handle, files_struct *fs
 }
 
 static SMB_ACL_T smb_full_audit_sys_acl_get_file(vfs_handle_struct *handle,
-                                       const char *path_p,
-                                                SMB_ACL_TYPE_T type,
-                                                TALLOC_CTX *mem_ctx)
+                               const struct smb_filename *smb_fname,
+                               SMB_ACL_TYPE_T type,
+                               TALLOC_CTX *mem_ctx)
 {
        SMB_ACL_T result;
 
-       result = SMB_VFS_NEXT_SYS_ACL_GET_FILE(handle, path_p, type, mem_ctx);
+       result = SMB_VFS_NEXT_SYS_ACL_GET_FILE(handle, smb_fname,
+                               type, mem_ctx);
 
        do_log(SMB_VFS_OP_SYS_ACL_GET_FILE, (result != NULL), handle,
-              "%s", path_p);
+              "%s", smb_fname->base_name);
 
        return result;
 }
index fa2664e8d072d3191690384f3c6ef4a51efa17e4..37568ab6efeecc75621a89c5f035cad48d884c60 100644 (file)
@@ -961,7 +961,7 @@ static SMB_ACL_T gpfsacl_get_posix_acl(const char *path, gpfs_aclType_t type,
 }
 
 static SMB_ACL_T gpfsacl_sys_acl_get_file(vfs_handle_struct *handle,
-                                         const char *path_p,
+                                         const struct smb_filename *smb_fname,
                                          SMB_ACL_TYPE_T type,
                                          TALLOC_CTX *mem_ctx)
 {
@@ -973,7 +973,7 @@ static SMB_ACL_T gpfsacl_sys_acl_get_file(vfs_handle_struct *handle,
                                return NULL);
 
        if (!config->acl) {
-               return SMB_VFS_NEXT_SYS_ACL_GET_FILE(handle, path_p,
+               return SMB_VFS_NEXT_SYS_ACL_GET_FILE(handle, smb_fname,
                                                     type, mem_ctx);
        }
 
@@ -989,7 +989,7 @@ static SMB_ACL_T gpfsacl_sys_acl_get_file(vfs_handle_struct *handle,
                smb_panic("exiting");
        }
 
-       return gpfsacl_get_posix_acl(path_p, gpfs_type, mem_ctx);
+       return gpfsacl_get_posix_acl(smb_fname->base_name, gpfs_type, mem_ctx);
 }
 
 static SMB_ACL_T gpfsacl_sys_acl_get_fd(vfs_handle_struct *handle,
index f666a5eceb50b2f63781b1337075fe460ed90d0a..c344cb95fde619717001f4876717adcb7e360905 100644 (file)
@@ -139,13 +139,14 @@ static bool hpux_aclsort_call_present(void);
 /* public functions - the api */
 
 SMB_ACL_T hpuxacl_sys_acl_get_file(vfs_handle_struct *handle,
-                                     const char *path_p,
-                                  SMB_ACL_TYPE_T type,
-                                  TALLOC_CTX *mem_ctx)
+                               const struct smb_filename *smb_fname,
+                               SMB_ACL_TYPE_T type,
+                               TALLOC_CTX *mem_ctx)
 {
        SMB_ACL_T result = NULL;
        int count;
        HPUX_ACL_T hpux_acl = NULL;
+       const char *path_p = smb_fname->base_name;
 
        DEBUG(10, ("hpuxacl_sys_acl_get_file called for file '%s'.\n", 
                   path_p));
index df30e17f51b47770966357bdb2e5086dc2913d49..b629c7d0b7fc9b2caaebfec25d55d7a2ff65829f 100644 (file)
@@ -34,7 +34,7 @@
 #define __VFS_HPUXACL_H__
 
 SMB_ACL_T hpuxacl_sys_acl_get_file(vfs_handle_struct *handle,
-                                  const char *path_p,
+                                  const struct smb_filename *smb_fname,
                                   SMB_ACL_TYPE_T type);
 
 SMB_ACL_T hpuxacl_sys_acl_get_fd(vfs_handle_struct *handle,
index 9a5b99db8e3bdcd7b99193e71ef752e4d138e19d..cad3d9fcfe820ae26d017be8713521aa83fdbeb1 100644 (file)
@@ -2101,35 +2101,33 @@ out:
  * Failure: set errno, return NULL
  */
 static SMB_ACL_T mh_sys_acl_get_file(vfs_handle_struct *handle,
-                                    const char *path_p,
-                                    SMB_ACL_TYPE_T type,
-                                    TALLOC_CTX *mem_ctx)
+                               const struct smb_filename *smb_fname,
+                               SMB_ACL_TYPE_T type,
+                               TALLOC_CTX *mem_ctx)
 {
        SMB_ACL_T ret;
-       char *clientPath;
-       TALLOC_CTX *ctx;
+       int status;
+       struct smb_filename *clientFname = NULL;
 
        DEBUG(MH_INFO_DEBUG, ("Entering mh_sys_acl_get_file\n"));
-       if (!is_in_media_files(path_p))
-       {
-               ret = SMB_VFS_NEXT_SYS_ACL_GET_FILE(handle, path_p, type, mem_ctx);
+       if (!is_in_media_files(smb_fname->base_name)) {
+               ret = SMB_VFS_NEXT_SYS_ACL_GET_FILE(handle, smb_fname,
+                               type, mem_ctx);
                goto out;
        }
 
-       clientPath = NULL;
-       ctx = talloc_tos();
-
-       if (alloc_get_client_path(handle, ctx,
-                               path_p,
-                               &clientPath))
-       {
-               ret = NULL;
+       status = alloc_get_client_smb_fname(handle,
+                               talloc_tos(),
+                               smb_fname,
+                               &clientFname);
+       if (status != 0) {
+               ret = (SMB_ACL_T)NULL;
                goto err;
        }
 
-       ret = SMB_VFS_NEXT_SYS_ACL_GET_FILE(handle, clientPath, type, mem_ctx);
+       ret = SMB_VFS_NEXT_SYS_ACL_GET_FILE(handle, clientFname, type, mem_ctx);
 err:
-       TALLOC_FREE(clientPath);
+       TALLOC_FREE(clientFname);
 out:
        return ret;
 }
index cae3e7bea65d096df2bab6cbccd95d8010c46a1f..3975f80a9416ad6e0a906f92648ef9834ea685c4 100644 (file)
@@ -585,9 +585,9 @@ static NTSTATUS nfs4acl_xattr_fset_nt_acl(vfs_handle_struct *handle,
 */
 
 static SMB_ACL_T nfs4acl_xattr_fail__sys_acl_get_file(vfs_handle_struct *handle,
-                                                     const char *path_p,
-                                                     SMB_ACL_TYPE_T type,
-                                                     TALLOC_CTX *mem_ctx)
+                                       const struct smb_filename *smb_fname,
+                                       SMB_ACL_TYPE_T type,
+                                       TALLOC_CTX *mem_ctx)
 {
        return (SMB_ACL_T)NULL;
 }
index ed8f1bae8f0305f3ec57d85c8241703ad27bebbc..d99f538524c054d8ca0d055a76eabcca59bf1a38 100644 (file)
@@ -34,9 +34,9 @@ static acl_t smb_acl_to_posix(const struct smb_acl_t *acl);
 /* public functions - the api */
 
 SMB_ACL_T posixacl_sys_acl_get_file(vfs_handle_struct *handle,
-                                   const char *path_p,
-                                   SMB_ACL_TYPE_T type,
-                                   TALLOC_CTX *mem_ctx)
+                               const struct smb_filename *smb_fname,
+                               SMB_ACL_TYPE_T type,
+                               TALLOC_CTX *mem_ctx)
 {
        struct smb_acl_t *result;
        acl_type_t acl_type;
@@ -54,7 +54,7 @@ SMB_ACL_T posixacl_sys_acl_get_file(vfs_handle_struct *handle,
                return NULL;
        }
 
-       acl = acl_get_file(path_p, acl_type);
+       acl = acl_get_file(smb_fname->base_name, acl_type);
 
        if (acl == NULL) {
                return NULL;
index b64bdb280abe231b8f7ab2dcb150ccb82f9b443c..8dd138e632de8eacdc9f9781b972bb2979e717ab 100644 (file)
@@ -22,7 +22,7 @@
 #define __VFS_POSIXACL_H__
 
 SMB_ACL_T posixacl_sys_acl_get_file(vfs_handle_struct *handle,
-                                   const char *path_p,
+                                   const struct smb_filename *smb_fname,
                                    SMB_ACL_TYPE_T type,
                                    TALLOC_CTX *mem_ctx);
 
index 48305c5018060276c01a09a277914f09c2fde36d..4506274a99c8b5fe7af01d80796bc116d86dbced 100644 (file)
@@ -63,12 +63,14 @@ static bool solaris_acl_check(SOLARIS_ACL_T solaris_acl, int count);
 /* public functions - the api */
 
 SMB_ACL_T solarisacl_sys_acl_get_file(vfs_handle_struct *handle,
-                                     const char *path_p,
-                                     SMB_ACL_TYPE_T type, TALLOC_CTX *mem_ctx)
+                               const struct smb_filename *smb_fname,
+                               SMB_ACL_TYPE_T type,
+                               TALLOC_CTX *mem_ctx)
 {
        SMB_ACL_T result = NULL;
        int count;
        SOLARIS_ACL_T solaris_acl = NULL;
+       const char *path_p = smb_fname->base_name;
        
        DEBUG(10, ("solarisacl_sys_acl_get_file called for file '%s'.\n", 
                   path_p));
index 941f7669155b9c7f8b3a93f90170bda6a3b8bc1f..0ee4fa3131c66fa1d1fdc75f6a2246694fc27b6d 100644 (file)
@@ -21,9 +21,9 @@
 #define __VFS_SOLARISACL_H__
 
 SMB_ACL_T solarisacl_sys_acl_get_file(vfs_handle_struct *handle,
-                                     const char *path_p,
-                                     SMB_ACL_TYPE_T type, 
-                                     TALLOC_CTX *mem_ctx);
+                               const struct smb_filename *smb_fname,
+                               SMB_ACL_TYPE_T type,
+                               TALLOC_CTX *mem_ctx);
 
 SMB_ACL_T solarisacl_sys_acl_get_fd(vfs_handle_struct *handle,
                                    files_struct *fsp, 
index c86f0dfc18163b0d33882a3d7625a9f1f104d99e..033dabe46712e15f9402fa603d50a0a37dcaaedb 100644 (file)
@@ -2169,21 +2169,23 @@ static int smb_time_audit_fchmod_acl(vfs_handle_struct *handle,
 }
 
 static SMB_ACL_T smb_time_audit_sys_acl_get_file(vfs_handle_struct *handle,
-                                                const char *path_p,
-                                                SMB_ACL_TYPE_T type,
-                                                TALLOC_CTX *mem_ctx)
+                                       const struct smb_filename *smb_fname,
+                                       SMB_ACL_TYPE_T type,
+                                       TALLOC_CTX *mem_ctx)
 {
        SMB_ACL_T result;
        struct timespec ts1,ts2;
        double timediff;
 
        clock_gettime_mono(&ts1);
-       result = SMB_VFS_NEXT_SYS_ACL_GET_FILE(handle, path_p, type, mem_ctx);
+       result = SMB_VFS_NEXT_SYS_ACL_GET_FILE(handle, smb_fname,
+                               type, mem_ctx);
        clock_gettime_mono(&ts2);
        timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
 
        if (timediff > audit_timeout) {
-               smb_time_audit_log_fname("sys_acl_get_file", timediff, path_p);
+               smb_time_audit_log_fname("sys_acl_get_file", timediff,
+                       smb_fname->base_name);
        }
 
        return result;
index 83f3289deb02eb71f23faeae35fb8da78fc2c2b2..69e5dfcaec4a55d595478e21ded226b167314d3f 100644 (file)
@@ -38,9 +38,9 @@ static SMB_ACL_PERM_T tru64_permset_to_smb(const acl_perm_t tru64_permset);
 /* public functions - the api */
 
 SMB_ACL_T tru64acl_sys_acl_get_file(vfs_handle_struct *handle,
-                                   const char *path_p,
-                                   SMB_ACL_TYPE_T type,
-                                   TALLOC_CTX *mem_ctx)
+                               const struct smb_filename *smb_fname,
+                               SMB_ACL_TYPE_T type,
+                               TALLOC_CTX *mem_ctx)
 {
         struct smb_acl_t *result;
         acl_type_t the_acl_type;
@@ -60,7 +60,7 @@ SMB_ACL_T tru64acl_sys_acl_get_file(vfs_handle_struct *handle,
                 return NULL;
         }
 
-        tru64_acl = acl_get_file((char *)path_p, the_acl_type);
+        tru64_acl = acl_get_file((char *)smb_fname->base_name, the_acl_type);
 
         if (tru64_acl == NULL) {
                 return NULL;
index 3825be08a2658f05a6fc2f56f7f21290e90cae0e..0af0930b004049ea9b4281a0b060c43a4c22599d 100644 (file)
@@ -21,8 +21,8 @@
 #define __VFS_TRU64ACL_H__
 
 SMB_ACL_T tru64acl_sys_acl_get_file(vfs_handle_struct *handle,
-                                   const char *path_p,
-                                   SMB_ACL_TYPE_T type);
+                               const struct smb_filename *smb_fname,
+                               SMB_ACL_TYPE_T type);
 
 SMB_ACL_T tru64acl_sys_acl_get_fd(vfs_handle_struct *handle,
                                  files_struct *fsp);
index bbccb66c5cc3017272bf7cae93b7c5700c4d52da..93d9ce68755d770f4c4554881ee8c50d8f452c75 100644 (file)
@@ -1609,32 +1609,42 @@ err:
 }
 
 static SMB_ACL_T um_sys_acl_get_file(vfs_handle_struct *handle,
-                                    const char *path_p,
-                                    SMB_ACL_TYPE_T type,
-                                    TALLOC_CTX *mem_ctx)
+                               const struct smb_filename *smb_fname,
+                               SMB_ACL_TYPE_T type,
+                               TALLOC_CTX *mem_ctx)
 {
        SMB_ACL_T ret;
-       char *client_path = NULL;
+       int saved_errno = 0;
+       struct smb_filename *client_fname = NULL;
        int status;
 
        DEBUG(10, ("Entering um_sys_acl_get_file\n"));
 
-       if (!is_in_media_files(path_p)) {
-               return SMB_VFS_NEXT_SYS_ACL_GET_FILE(handle, path_p,
+       if (!is_in_media_files(smb_fname->base_name)) {
+               return SMB_VFS_NEXT_SYS_ACL_GET_FILE(handle, smb_fname,
                                                     type, mem_ctx);
        }
 
-       status = alloc_get_client_path(handle, talloc_tos(),
-                                      path_p, &client_path);
+       status = alloc_get_client_smb_fname(handle,
+                               talloc_tos(),
+                               smb_fname,
+                               &client_fname);
        if (status != 0) {
-               ret = NULL;
+               ret = (SMB_ACL_T)NULL;
                goto err;
        }
 
-       ret = SMB_VFS_NEXT_SYS_ACL_GET_FILE(handle, client_path, type, mem_ctx);
+       ret = SMB_VFS_NEXT_SYS_ACL_GET_FILE(handle, client_fname,
+                               type, mem_ctx);
 
 err:
-       TALLOC_FREE(client_path);
+       if (ret == (SMB_ACL_T)NULL) {
+               saved_errno = errno;
+       }
+       TALLOC_FREE(client_fname);
+       if (saved_errno != 0) {
+               errno = saved_errno;
+       }
        return ret;
 }
 
index f8b0dfa82c5f6f325d0d5bd454a65a59cd649818..658649406e36b82426cd2435eab4ac5550c42e78 100644 (file)
@@ -408,7 +408,14 @@ static bool vxfs_compare(connection_struct *conn, char *name, SMB_ACL_T the_acl,
        int status;
 
        DEBUG(10, ("vfs_vxfs: Getting existing ACL for %s\n", name));
-       existing_acl = SMB_VFS_SYS_ACL_GET_FILE(conn, name, the_acl_type,
+
+       smb_fname = synthetic_smb_fname(mem_ctx, name, NULL, NULL, 0);
+       if (smb_fname == NULL) {
+               DEBUG(10, ("vfs_vxfs: Failed to create smb_fname\n"));
+               goto out;
+       }
+
+       existing_acl = SMB_VFS_SYS_ACL_GET_FILE(conn, smb_fname, the_acl_type,
                                                mem_ctx);
        if (existing_acl == NULL) {
                DEBUG(10, ("vfs_vxfs: Failed to get ACL\n"));
@@ -423,12 +430,6 @@ static bool vxfs_compare(connection_struct *conn, char *name, SMB_ACL_T the_acl,
                goto out;
        }
 
-       smb_fname = synthetic_smb_fname(mem_ctx, name, NULL, NULL, 0);
-       if (smb_fname == NULL) {
-               DEBUG(10, ("vfs_vxfs: Failed to create smb_fname\n"));
-               goto out;
-       }
-
        status = SMB_VFS_STAT(conn, smb_fname);
        if (status == -1) {
                DEBUG(10, ("vfs_vxfs: stat failed!\n"));
index c59a910626046803e5f977e8e9edd0b1f9ad9cc3..57e4182aff7e8094091b0901c1c04850f4e32615 100644 (file)
@@ -284,9 +284,9 @@ static NTSTATUS zfsacl_fset_nt_acl(vfs_handle_struct *handle,
 */
 
 static SMB_ACL_T zfsacl_fail__sys_acl_get_file(vfs_handle_struct *handle,
-                                              const char *path_p,
-                                              SMB_ACL_TYPE_T type,
-                                              TALLOC_CTX *mem_ctx)
+                                       const struct smb_filename *smb_fname,
+                                       SMB_ACL_TYPE_T type,
+                                       TALLOC_CTX *mem_ctx)
 {
        return (SMB_ACL_T)NULL;
 }
index 1789b55dfd7451cf507a2e30cf5654ac34b54292..3c6d47bb6dc820d565372bc2077384f9c9f4df39 100644 (file)
@@ -679,8 +679,8 @@ int file_set_dosmode(connection_struct *conn, struct smb_filename *smb_fname,
 
        unixmode = smb_fname->st.st_ex_mode;
 
-       get_acl_group_bits(conn, smb_fname->base_name,
-                          &smb_fname->st.st_ex_mode);
+       get_acl_group_bits(conn, smb_fname,
+                       &smb_fname->st.st_ex_mode);
 
        if (S_ISDIR(smb_fname->st.st_ex_mode))
                dosmode |= FILE_ATTRIBUTE_DIRECTORY;
index 49932e985045cf64f1c8af8d349ebd8ddaf8b3d1..8fdc96376d87d3da45ad33423fee09929a15282a 100644 (file)
@@ -1224,7 +1224,7 @@ static NTSTATUS open_file(files_struct *fsp,
                        /* Inherit the ACL if required */
                        if (lp_inherit_permissions(SNUM(conn))) {
                                inherit_access_posix_acl(conn, parent_dir,
-                                                        smb_fname->base_name,
+                                                        smb_fname,
                                                         unx_mode);
                                need_re_stat = true;
                        }
@@ -3832,7 +3832,7 @@ static NTSTATUS mkdir_internal(connection_struct *conn,
 
        if (lp_inherit_permissions(SNUM(conn))) {
                inherit_access_posix_acl(conn, parent_dir,
-                                        smb_dname->base_name, mode);
+                                        smb_dname, mode);
                need_re_stat = true;
        }
 
index c02331d12308f92c2ceeb0df5f22f3ed97cac244..4f0540b90a54e0468f842ed89e3662d0fcba68c6 100644 (file)
@@ -3583,12 +3583,12 @@ NTSTATUS posix_get_nt_acl(struct connection_struct *conn,
        }
 
        /* Get the ACL from the path. */
-       posix_acl = SMB_VFS_SYS_ACL_GET_FILE(conn, smb_fname->base_name,
+       posix_acl = SMB_VFS_SYS_ACL_GET_FILE(conn, smb_fname,
                                             SMB_ACL_TYPE_ACCESS, frame);
 
        /* If it's a directory get the default POSIX ACL. */
        if(S_ISDIR(smb_fname->st.st_ex_mode)) {
-               def_acl = SMB_VFS_SYS_ACL_GET_FILE(conn, smb_fname->base_name,
+               def_acl = SMB_VFS_SYS_ACL_GET_FILE(conn, smb_fname,
                                                   SMB_ACL_TYPE_DEFAULT, frame);
                def_acl = free_empty_sys_acl(conn, def_acl);
        }
@@ -4044,14 +4044,16 @@ NTSTATUS set_nt_acl(files_struct *fsp, uint32_t security_info_sent, const struct
  the mask bits, not the real group bits, for a file with an ACL.
 ****************************************************************************/
 
-int get_acl_group_bits( connection_struct *conn, const char *fname, mode_t *mode )
+int get_acl_group_bits( connection_struct *conn,
+                       const struct smb_filename *smb_fname,
+                       mode_t *mode )
 {
        int entry_id = SMB_ACL_FIRST_ENTRY;
        SMB_ACL_ENTRY_T entry;
        SMB_ACL_T posix_acl;
        int result = -1;
 
-       posix_acl = SMB_VFS_SYS_ACL_GET_FILE(conn, fname,
+       posix_acl = SMB_VFS_SYS_ACL_GET_FILE(conn, smb_fname,
                                             SMB_ACL_TYPE_ACCESS, talloc_tos());
        if (posix_acl == (SMB_ACL_T)NULL)
                return -1;
@@ -4155,12 +4157,15 @@ static int chmod_acl_internals( connection_struct *conn, SMB_ACL_T posix_acl, mo
  resulting ACL on TO.  Note that name is in UNIX character set.
 ****************************************************************************/
 
-static int copy_access_posix_acl(connection_struct *conn, const char *from, const char *to, mode_t mode)
+static int copy_access_posix_acl(connection_struct *conn,
+                               const struct smb_filename *smb_fname_from,
+                               const struct smb_filename *smb_fname_to,
+                               mode_t mode)
 {
        SMB_ACL_T posix_acl = NULL;
        int ret = -1;
 
-       if ((posix_acl = SMB_VFS_SYS_ACL_GET_FILE(conn, from,
+       if ((posix_acl = SMB_VFS_SYS_ACL_GET_FILE(conn, smb_fname_from,
                                                  SMB_ACL_TYPE_ACCESS,
                                                  talloc_tos())) == NULL)
                return -1;
@@ -4168,7 +4173,8 @@ static int copy_access_posix_acl(connection_struct *conn, const char *from, cons
        if ((ret = chmod_acl_internals(conn, posix_acl, mode)) == -1)
                goto done;
 
-       ret = SMB_VFS_SYS_ACL_SET_FILE(conn, to, SMB_ACL_TYPE_ACCESS, posix_acl);
+       ret = SMB_VFS_SYS_ACL_SET_FILE(conn, smb_fname_to->base_name,
+                       SMB_ACL_TYPE_ACCESS, posix_acl);
 
  done:
 
@@ -4182,18 +4188,21 @@ static int copy_access_posix_acl(connection_struct *conn, const char *from, cons
  Note that name is in UNIX character set.
 ****************************************************************************/
 
-int chmod_acl(connection_struct *conn, const char *name, mode_t mode)
+int chmod_acl(connection_struct *conn,
+                       const struct smb_filename *smb_fname,
+                       mode_t mode)
 {
-       return copy_access_posix_acl(conn, name, name, mode);
+       return copy_access_posix_acl(conn, smb_fname, smb_fname, mode);
 }
 
 /****************************************************************************
  Check for an existing default POSIX ACL on a directory.
 ****************************************************************************/
 
-static bool directory_has_default_posix_acl(connection_struct *conn, const char *fname)
+static bool directory_has_default_posix_acl(connection_struct *conn,
+                       const struct smb_filename *smb_fname)
 {
-       SMB_ACL_T def_acl = SMB_VFS_SYS_ACL_GET_FILE(conn, fname,
+       SMB_ACL_T def_acl = SMB_VFS_SYS_ACL_GET_FILE(conn, smb_fname,
                                                     SMB_ACL_TYPE_DEFAULT,
                                                     talloc_tos());
        bool has_acl = False;
@@ -4214,13 +4223,25 @@ static bool directory_has_default_posix_acl(connection_struct *conn, const char
  inherit this Access ACL to file name.
 ****************************************************************************/
 
-int inherit_access_posix_acl(connection_struct *conn, const char *inherit_from_dir,
-                      const char *name, mode_t mode)
+int inherit_access_posix_acl(connection_struct *conn,
+                       const char *inherit_from_dir,
+                       const struct smb_filename *smb_fname,
+                       mode_t mode)
 {
-       if (directory_has_default_posix_acl(conn, inherit_from_dir))
+       struct smb_filename *inherit_from_fname =
+                       synthetic_smb_fname(talloc_tos(),
+                               smb_fname->base_name,
+                               NULL,
+                               NULL,
+                               smb_fname->flags);
+       if (inherit_from_fname == NULL) {
+               return-1;
+       }
+
+       if (directory_has_default_posix_acl(conn, inherit_from_fname))
                return 0;
 
-       return copy_access_posix_acl(conn, inherit_from_dir, name, mode);
+       return copy_access_posix_acl(conn, inherit_from_fname, smb_fname, mode);
 }
 
 /****************************************************************************
@@ -4467,12 +4488,15 @@ bool set_unix_posix_default_acl(connection_struct *conn,
  FIXME ! How does the share mask/mode fit into this.... ?
 ****************************************************************************/
 
-static bool remove_posix_acl(connection_struct *conn, files_struct *fsp, const char *fname)
+static bool remove_posix_acl(connection_struct *conn,
+                       files_struct *fsp,
+                       const struct smb_filename *smb_fname)
 {
        SMB_ACL_T file_acl = NULL;
        int entry_id = SMB_ACL_FIRST_ENTRY;
        SMB_ACL_ENTRY_T entry;
        bool ret = False;
+       const char *fname = smb_fname->base_name;
        /* Create a new ACL with only 3 entries, u/g/w. */
        SMB_ACL_T new_file_acl = sys_acl_init(talloc_tos());
        SMB_ACL_ENTRY_T user_ent = NULL;
@@ -4522,7 +4546,7 @@ static bool remove_posix_acl(connection_struct *conn, files_struct *fsp, const c
        if (fsp && fsp->fh->fd != -1) {
                file_acl = SMB_VFS_SYS_ACL_GET_FD(fsp, talloc_tos());
        } else {
-               file_acl = SMB_VFS_SYS_ACL_GET_FILE(conn, fname,
+               file_acl = SMB_VFS_SYS_ACL_GET_FILE(conn, smb_fname,
                                                    SMB_ACL_TYPE_ACCESS,
                                                    talloc_tos());
        }
@@ -4605,13 +4629,17 @@ static bool remove_posix_acl(connection_struct *conn, files_struct *fsp, const c
  except SMB_ACL_USER_OBJ, SMB_ACL_GROUP_OBJ, SMB_ACL_OTHER.
 ****************************************************************************/
 
-bool set_unix_posix_acl(connection_struct *conn, files_struct *fsp, const char *fname, uint16_t num_acls, const char *pdata)
+bool set_unix_posix_acl(connection_struct *conn, files_struct *fsp,
+                       const struct smb_filename *smb_fname,
+                       uint16_t num_acls,
+                       const char *pdata)
 {
        SMB_ACL_T file_acl = NULL;
+       const char *fname = smb_fname->base_name;
 
        if (!num_acls) {
                /* Remove the ACL from the file. */
-               return remove_posix_acl(conn, fsp, fname);
+               return remove_posix_acl(conn, fsp, smb_fname);
        }
 
        if ((file_acl = create_posix_acl_from_wire(conn, num_acls,
@@ -4728,7 +4756,7 @@ int posix_sys_acl_blob_get_file(vfs_handle_struct *handle,
 
        acl_wrapper.access_acl
                = smb_vfs_call_sys_acl_get_file(handle,
-                                               path_p,
+                                               smb_fname,
                                                SMB_ACL_TYPE_ACCESS,
                                                frame);
 
@@ -4741,7 +4769,7 @@ int posix_sys_acl_blob_get_file(vfs_handle_struct *handle,
        if (S_ISDIR(smb_fname->st.st_ex_mode)) {
                acl_wrapper.default_acl
                        = smb_vfs_call_sys_acl_get_file(handle,
-                                                       path_p,
+                                                       smb_fname,
                                                        SMB_ACL_TYPE_DEFAULT,
                                                        frame);
        }
@@ -4789,8 +4817,10 @@ int posix_sys_acl_blob_get_fd(vfs_handle_struct *handle,
 
        acl_wrapper.default_acl = NULL;
 
-       acl_wrapper.access_acl = smb_vfs_call_sys_acl_get_file(handle, fsp->fsp_name->base_name,
-                                                              SMB_ACL_TYPE_ACCESS, frame);
+       acl_wrapper.access_acl = smb_vfs_call_sys_acl_get_file(handle,
+                                       fsp->fsp_name,
+                                       SMB_ACL_TYPE_ACCESS,
+                                       frame);
 
        ret = smb_vfs_call_fstat(handle, fsp, &sbuf);
        if (ret == -1) {
index 88ba6f9d3e48bfc8b5a73e48257d4ce2c820fd67..556fb6b2f5bb30a237abf1ab9114cdce94705475 100644 (file)
@@ -778,15 +778,24 @@ NTSTATUS posix_get_nt_acl(struct connection_struct *conn,
                        struct security_descriptor **ppdesc);
 NTSTATUS try_chown(files_struct *fsp, uid_t uid, gid_t gid);
 NTSTATUS set_nt_acl(files_struct *fsp, uint32_t security_info_sent, const struct security_descriptor *psd);
-int get_acl_group_bits( connection_struct *conn, const char *fname, mode_t *mode );
-int chmod_acl(connection_struct *conn, const char *name, mode_t mode);
-int inherit_access_posix_acl(connection_struct *conn, const char *inherit_from_dir,
-                      const char *name, mode_t mode);
+int get_acl_group_bits( connection_struct *conn,
+                       const struct smb_filename *smb_fname,
+                       mode_t *mode);
+int chmod_acl(connection_struct *conn,
+                       const struct smb_filename *smb_fname,
+                       mode_t mode);
+int inherit_access_posix_acl(connection_struct *conn,
+                       const char *inherit_from_dir,
+                       const struct smb_filename *smb_fname,
+                       mode_t mode);
 int fchmod_acl(files_struct *fsp, mode_t mode);
 bool set_unix_posix_default_acl(connection_struct *conn,
                                const struct smb_filename *smb_fname,
                                uint16_t num_def_acls, const char *pdata);
-bool set_unix_posix_acl(connection_struct *conn, files_struct *fsp, const char *fname, uint16_t num_acls, const char *pdata);
+bool set_unix_posix_acl(connection_struct *conn, files_struct *fsp,
+                               const struct smb_filename *smb_fname,
+                               uint16_t num_acls,
+                               const char *pdata);
 NTSTATUS get_nt_acl_no_snum( TALLOC_CTX *ctx, const char *fname,
                             uint32_t security_info_wanted,
                             struct security_descriptor **sd);
index fca8f108b57deb1f14993d1939c50c8a7e9ba857..df6ab188e6b6c2dc3aaede3fc63eec6de1e145da 100644 (file)
@@ -622,6 +622,8 @@ static PyObject *py_smbd_get_sys_acl(PyObject *self, PyObject *args, PyObject *k
        TALLOC_CTX *tmp_ctx = talloc_new(NULL);
        connection_struct *conn;
        char *service = NULL;
+       struct smb_filename *smb_fname = NULL;
+
        if (!tmp_ctx) {
                PyErr_NoMemory();
                return NULL;
@@ -642,7 +644,15 @@ static PyObject *py_smbd_get_sys_acl(PyObject *self, PyObject *args, PyObject *k
                return NULL;
        }
 
-       acl = SMB_VFS_SYS_ACL_GET_FILE( conn, fname, acl_type, tmp_ctx);
+       smb_fname = synthetic_smb_fname_split(frame,
+                                       fname,
+                                       lp_posix_pathnames());
+       if (smb_fname == NULL) {
+               TALLOC_FREE(frame);
+               TALLOC_FREE(tmp_ctx);
+               return NULL;
+       }
+       acl = SMB_VFS_SYS_ACL_GET_FILE( conn, smb_fname, acl_type, tmp_ctx);
        if (!acl) {
                TALLOC_FREE(frame);
                TALLOC_FREE(tmp_ctx);
index f11dcd116dd1c2e9c40ec56c3401bd407f3277d2..a44de7e7b3a33c9573e7c14dc80a06b5883b269b 100644 (file)
@@ -5519,7 +5519,7 @@ NTSTATUS smbd_do_qfilepathinfo(connection_struct *conn,
                                } else {
                                        file_acl =
                                            SMB_VFS_SYS_ACL_GET_FILE(conn,
-                                               smb_fname->base_name,
+                                               smb_fname,
                                                SMB_ACL_TYPE_ACCESS,
                                                talloc_tos());
                                }
@@ -5537,14 +5537,14 @@ NTSTATUS smbd_do_qfilepathinfo(connection_struct *conn,
                                                def_acl =
                                                    SMB_VFS_SYS_ACL_GET_FILE(
                                                            conn,
-                                                           fsp->fsp_name->base_name,
+                                                           fsp->fsp_name,
                                                            SMB_ACL_TYPE_DEFAULT,
                                                            talloc_tos());
                                        } else {
                                                def_acl =
                                                    SMB_VFS_SYS_ACL_GET_FILE(
                                                            conn,
-                                                           smb_fname->base_name,
+                                                           smb_fname,
                                                            SMB_ACL_TYPE_DEFAULT,
                                                            talloc_tos());
                                        }
@@ -7151,7 +7151,7 @@ static NTSTATUS smb_set_posix_acl(connection_struct *conn,
                (unsigned int)num_def_acls));
 
        if (valid_file_acls && !set_unix_posix_acl(conn, fsp,
-               smb_fname->base_name, num_file_acls,
+               smb_fname, num_file_acls,
                pdata + SMB_POSIX_ACL_HEADER_SIZE)) {
                return map_nt_error_from_unix(errno);
        }
@@ -7590,7 +7590,7 @@ static NTSTATUS smb_unix_mknod(connection_struct *conn,
                                    &parent, NULL)) {
                        return NT_STATUS_NO_MEMORY;
                }
-               inherit_access_posix_acl(conn, parent, smb_fname->base_name,
+               inherit_access_posix_acl(conn, parent, smb_fname,
                                         unixmode);
                TALLOC_FREE(parent);
        }
index a4aeffe47a8787229b4d79e95fc5514801036e1d..82d0485416ebd070c5017be2bea48e03f083a035 100644 (file)
@@ -2441,12 +2441,12 @@ int smb_vfs_call_fchmod_acl(struct vfs_handle_struct *handle,
 }
 
 SMB_ACL_T smb_vfs_call_sys_acl_get_file(struct vfs_handle_struct *handle,
-                                       const char *path_p,
+                                       const struct smb_filename *smb_fname,
                                        SMB_ACL_TYPE_T type,
                                        TALLOC_CTX *mem_ctx)
 {
        VFS_FIND(sys_acl_get_file);
-       return handle->fns->sys_acl_get_file_fn(handle, path_p, type, mem_ctx);
+       return handle->fns->sys_acl_get_file_fn(handle, smb_fname, type, mem_ctx);
 }
 
 SMB_ACL_T smb_vfs_call_sys_acl_get_fd(struct vfs_handle_struct *handle,
index c22b5d24c3a3272e19bea68dd5a2da2163df5c82..390cffa34e4077e5029f73ac4f9eca29fc0ba951 100644 (file)
@@ -1683,13 +1683,22 @@ static NTSTATUS cmd_sys_acl_get_file(struct vfs_state *vfs, TALLOC_CTX *mem_ctx,
        SMB_ACL_T acl;
        char *acl_text;
        int type;
+       struct smb_filename *smb_fname = NULL;
+
        if (argc != 3) {
                printf("Usage: sys_acl_get_file <path> <type>\n");
                return NT_STATUS_OK;
        }
 
+       smb_fname = synthetic_smb_fname_split(talloc_tos(),
+                                       argv[1],
+                                       lp_posix_pathnames());
+       if (smb_fname == NULL) {
+               return NT_STATUS_NO_MEMORY;
+       }
        type = atoi(argv[2]);
-       acl = SMB_VFS_SYS_ACL_GET_FILE(vfs->conn, argv[1], type, talloc_tos());
+       acl = SMB_VFS_SYS_ACL_GET_FILE(vfs->conn, smb_fname,
+                               type, talloc_tos());
        if (!acl) {
                printf("sys_acl_get_file failed (%s)\n", strerror(errno));
                return NT_STATUS_UNSUCCESSFUL;