VFS: Modify chmod_acl to take a const struct smb_filename * instead of const char *
authorJeremy Allison <jra@samba.org>
Wed, 2 Mar 2016 01:25:25 +0000 (17:25 -0800)
committerRalph Boehme <slow@samba.org>
Thu, 3 Mar 2016 08:04:14 +0000 (09:04 +0100)
Preparing to reduce use of lp_posix_pathnames().

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
20 files changed:
examples/VFS/skel_opaque.c
examples/VFS/skel_transparent.c
source3/include/vfs.h
source3/include/vfs_macros.h
source3/modules/vfs_acl_common.c
source3/modules/vfs_audit.c
source3/modules/vfs_cap.c
source3/modules/vfs_catia.c
source3/modules/vfs_ceph.c
source3/modules/vfs_default.c
source3/modules/vfs_extd_audit.c
source3/modules/vfs_full_audit.c
source3/modules/vfs_linux_xfs_sgid.c
source3/modules/vfs_media_harmony.c
source3/modules/vfs_shadow_copy2.c
source3/modules/vfs_snapper.c
source3/modules/vfs_time_audit.c
source3/modules/vfs_unityed_media.c
source3/smbd/vfs.c
source3/torture/cmd_vfs.c

index f772a9f93160221a4e4c05567bb5b6d743af4de9..e7bb645f1654f3d2284c8c5cdadd5f19de6f605d 100644 (file)
@@ -692,8 +692,9 @@ static NTSTATUS skel_fset_nt_acl(vfs_handle_struct *handle, files_struct *fsp,
        return NT_STATUS_NOT_IMPLEMENTED;
 }
 
-static int skel_chmod_acl(vfs_handle_struct *handle, const char *name,
-                         mode_t mode)
+static int skel_chmod_acl(vfs_handle_struct *handle,
+                       const struct smb_filename *smb_fname,
+                       mode_t mode)
 {
        errno = ENOSYS;
        return -1;
index bea2cd4272ff3c8d07995e5b95d5b10cb085d2a7..fe2356a6e69b4ac797e29f68d47fcf0ec5134943 100644 (file)
@@ -823,10 +823,11 @@ static NTSTATUS skel_fset_nt_acl(vfs_handle_struct *handle, files_struct *fsp,
        return SMB_VFS_NEXT_FSET_NT_ACL(handle, fsp, security_info_sent, psd);
 }
 
-static int skel_chmod_acl(vfs_handle_struct *handle, const char *name,
-                         mode_t mode)
+static int skel_chmod_acl(vfs_handle_struct *handle,
+                       const struct smb_filename *smb_fname,
+                       mode_t mode)
 {
-       return SMB_VFS_NEXT_CHMOD_ACL(handle, name, mode);
+       return SMB_VFS_NEXT_CHMOD_ACL(handle, smb_fname, mode);
 }
 
 static int skel_fchmod_acl(vfs_handle_struct *handle, files_struct *fsp,
index 6a6c8656f36b16c476b4e7465c73810c6c3fa91f..9aa45fa11d1ab559a83e44bfbd466b80d0b47232 100644 (file)
 /* Version 35 - Wrap aio async funtions args in a struct vfs_aio_state */
 /* Version 35 - Change chmod from const char *, to
                const struct smb_filename * */
+/* Version 35 - Change chmod_acl from const char *, to
+               const struct smb_filename * */
 
 #define SMB_VFS_INTERFACE_VERSION 35
 
@@ -787,7 +789,9 @@ struct vfs_fn_pointers {
 
        /* POSIX ACL operations. */
 
-       int (*chmod_acl_fn)(struct vfs_handle_struct *handle, const char *name, mode_t mode);
+       int (*chmod_acl_fn)(struct vfs_handle_struct *handle,
+                                       const struct smb_filename *smb_fname,
+                                       mode_t mode);
        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,
@@ -1230,8 +1234,9 @@ NTSTATUS smb_vfs_call_audit_file(struct vfs_handle_struct *handle,
                                 struct security_acl *sacl,
                                 uint32_t access_requested,
                                 uint32_t access_denied);
-int smb_vfs_call_chmod_acl(struct vfs_handle_struct *handle, const char *name,
-                          mode_t mode);
+int smb_vfs_call_chmod_acl(struct vfs_handle_struct *handle,
+                               const struct smb_filename *file,
+                               mode_t mode);
 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,
index 6dc257b331aa72da96ebd556f260483b84b1e920..e5e3c99866d5a6bb0d7418767a8cec72dd5e68b2 100644 (file)
 #define SMB_VFS_NEXT_FSET_NT_ACL(handle, fsp, security_info_sent, psd) \
        smb_vfs_call_fset_nt_acl((handle)->next, (fsp), (security_info_sent), (psd))
 
-#define SMB_VFS_CHMOD_ACL(conn, name, mode) \
-       smb_vfs_call_chmod_acl((conn)->vfs_handles, (name), (mode))
-#define SMB_VFS_NEXT_CHMOD_ACL(handle, name, mode) \
-       smb_vfs_call_chmod_acl((handle)->next, (name), (mode))
+#define SMB_VFS_CHMOD_ACL(conn, smb_fname, mode) \
+       smb_vfs_call_chmod_acl((conn)->vfs_handles, (smb_fname), (mode))
+#define SMB_VFS_NEXT_CHMOD_ACL(handle, smb_fname, mode) \
+       smb_vfs_call_chmod_acl((handle)->next, (smb_fname), (mode))
 
 #define SMB_VFS_FCHMOD_ACL(fsp, mode) \
        smb_vfs_call_fchmod_acl((fsp)->conn->vfs_handles, (fsp), (mode))
index 26841062fb5f20c6d77d235c2eb07f8082af5f28..ba93e7b0b5c5e44da58865a11c67b433cf07d153 100644 (file)
@@ -1105,11 +1105,12 @@ static int fchmod_acl_module_common(struct vfs_handle_struct *handle,
 }
 
 static int chmod_acl_acl_module_common(struct vfs_handle_struct *handle,
-                       const char *name, mode_t mode)
+                       const struct smb_filename *smb_fname,
+                       mode_t mode)
 {
        if (lp_posix_pathnames()) {
                /* Only allow this on POSIX pathnames. */
-               return SMB_VFS_NEXT_CHMOD_ACL(handle, name, mode);
+               return SMB_VFS_NEXT_CHMOD_ACL(handle, smb_fname, mode);
        }
        return 0;
 }
index 92b69b17dd0efa0cd634b95432d7e22afd0c418f..cef3bb5ab4f1c5a3ace33b13a258131ece87bbef 100644 (file)
@@ -233,14 +233,16 @@ static int audit_chmod(vfs_handle_struct *handle,
        return result;
 }
 
-static int audit_chmod_acl(vfs_handle_struct *handle, const char *path, mode_t mode)
+static int audit_chmod_acl(vfs_handle_struct *handle,
+                       const struct smb_filename *smb_fname,
+                       mode_t mode)
 {
        int result;
 
-       result = SMB_VFS_NEXT_CHMOD_ACL(handle, path, mode);
+       result = SMB_VFS_NEXT_CHMOD_ACL(handle, smb_fname, mode);
 
        syslog(audit_syslog_priority(handle), "chmod_acl %s mode 0x%x %s%s\n",
-              path, mode,
+              smb_fname->base_name, mode,
               (result < 0) ? "failed: " : "",
               (result < 0) ? strerror(errno) : "");
 
index 479c2c213ae1bb7bd22383eda5150d34ecbb6d73..0bb943da9a2982363cda213dd3ea56e283cd9061 100644 (file)
@@ -461,16 +461,36 @@ static char *cap_realpath(vfs_handle_struct *handle, const char *path)
        return SMB_VFS_NEXT_REALPATH(handle, cappath);
 }
 
-static int cap_chmod_acl(vfs_handle_struct *handle, const char *path, mode_t mode)
+static int cap_chmod_acl(vfs_handle_struct *handle,
+                       const struct smb_filename *smb_fname,
+                       mode_t mode)
 {
-       char *cappath = capencode(talloc_tos(), path);
+       struct smb_filename *cap_smb_fname = NULL;
+       char *cappath = capencode(talloc_tos(), smb_fname->base_name);
+       int ret;
+       int saved_errno;
 
        /* If the underlying VFS doesn't have ACL support... */
        if (!cappath) {
                errno = ENOMEM;
                return -1;
        }
-       return SMB_VFS_NEXT_CHMOD_ACL(handle, cappath, mode);
+       cap_smb_fname = synthetic_smb_fname(talloc_tos(),
+                                       cappath,
+                                       NULL,
+                                       NULL);
+       if (cap_smb_fname == NULL) {
+               TALLOC_FREE(cappath);
+               errno = ENOMEM;
+               return -1;
+       }
+
+       ret = SMB_VFS_NEXT_CHMOD_ACL(handle, cap_smb_fname, mode);
+       saved_errno = errno;
+       TALLOC_FREE(cappath);
+       TALLOC_FREE(cap_smb_fname);
+       errno = saved_errno;
+       return ret;
 }
 
 static SMB_ACL_T cap_sys_acl_get_file(vfs_handle_struct *handle,
index 7f06fb737e8b6106868122abb982fb396e90917b..e142ccef8ef09218e56f3a5b93757babc96c3c4c 100644 (file)
@@ -871,22 +871,38 @@ catia_get_nt_acl(struct vfs_handle_struct *handle,
 
 static int
 catia_chmod_acl(vfs_handle_struct *handle,
-               const char *path,
+               const struct smb_filename *smb_fname,
                mode_t mode)
 {
        char *mapped_name = NULL;
+       struct smb_filename *mapped_smb_fname = NULL;
        NTSTATUS status;
        int ret;
+       int saved_errno;
 
        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 -1;
        }
 
-       ret = SMB_VFS_NEXT_CHMOD_ACL(handle, mapped_name, mode);
+       mapped_smb_fname = synthetic_smb_fname(talloc_tos(),
+                                       mapped_name,
+                                       NULL,
+                                       NULL);
+       if (mapped_smb_fname == NULL) {
+               TALLOC_FREE(mapped_name);
+               errno = ENOMEM;
+               return -1;
+       }
+       ret = SMB_VFS_NEXT_CHMOD_ACL(handle, mapped_smb_fname, mode);
+       saved_errno = errno;
        TALLOC_FREE(mapped_name);
+       TALLOC_FREE(mapped_smb_fname);
+       errno = saved_errno;
        return ret;
 }
 
index e61c39dd8015979c5a1c7cb46101f620e193c132..82e15c8dfccca7eb1f4e905127ad1fb60a32e747 100644 (file)
@@ -362,8 +362,10 @@ static int cephwrap_mkdir(struct vfs_handle_struct *handle,
                 * mess up any inherited ACL bits that were set. JRA.
                 */
                int saved_errno = errno; /* We may get ENOSYS */
-               if ((SMB_VFS_CHMOD_ACL(handle->conn, path, mode) == -1) && (errno == ENOSYS))
+               if ((SMB_VFS_CHMOD_ACL(handle->conn, smb_fname, mode) == -1) &&
+                               (errno == ENOSYS)) {
                        errno = saved_errno;
+               }
        }
 
        return result;
@@ -650,7 +652,7 @@ static int cephwrap_chmod(struct vfs_handle_struct *handle,
        {
                int saved_errno = errno; /* We might get ENOSYS */
                result = SMB_VFS_CHMOD_ACL(handle->conn,
-                                       smb_fname->base_name,
+                                       smb_fname,
                                        mode);
                if (result == 0) {
                        return result;
index fbb0bcb806f4c637b98e6f177caea73967351a49..bb55facbb08a08e71255907ff78183d1dd343c12 100644 (file)
@@ -498,8 +498,10 @@ static int vfswrap_mkdir(vfs_handle_struct *handle,
                 * mess up any inherited ACL bits that were set. JRA.
                 */
                int saved_errno = errno; /* We may get ENOSYS */
-               if ((SMB_VFS_CHMOD_ACL(handle->conn, path, mode) == -1) && (errno == ENOSYS))
+               if ((SMB_VFS_CHMOD_ACL(handle->conn, smb_fname, mode) == -1) &&
+                               (errno == ENOSYS)) {
                        errno = saved_errno;
+               }
        }
 
        END_PROFILE(syscall_mkdir);
@@ -1694,7 +1696,7 @@ static int vfswrap_chmod(vfs_handle_struct *handle,
        {
                int saved_errno = errno; /* We might get ENOSYS */
                result = SMB_VFS_CHMOD_ACL(handle->conn,
-                               smb_fname->base_name,
+                               smb_fname,
                                mode);
                if (result == 0) {
                        END_PROFILE(syscall_chmod);
@@ -2362,7 +2364,9 @@ static NTSTATUS vfswrap_audit_file(struct vfs_handle_struct *handle,
        return NT_STATUS_OK; /* Nothing to do here ... */
 }
 
-static int vfswrap_chmod_acl(vfs_handle_struct *handle, const char *name, mode_t mode)
+static int vfswrap_chmod_acl(vfs_handle_struct *handle,
+                               const struct smb_filename *smb_fname,
+                               mode_t mode)
 {
 #ifdef HAVE_NO_ACL
        errno = ENOSYS;
@@ -2371,7 +2375,7 @@ static int vfswrap_chmod_acl(vfs_handle_struct *handle, const char *name, mode_t
        int result;
 
        START_PROFILE(chmod_acl);
-       result = chmod_acl(handle->conn, name, mode);
+       result = chmod_acl(handle->conn, smb_fname->base_name, mode);
        END_PROFILE(chmod_acl);
        return result;
 #endif
index 5aa6a30ed8f934688bd7f25218599de90ace28c6..0d8ca59732da3c41cf257892ab996476ee685664 100644 (file)
@@ -292,20 +292,22 @@ static int audit_chmod(vfs_handle_struct *handle,
        return result;
 }
 
-static int audit_chmod_acl(vfs_handle_struct *handle, const char *path, mode_t mode)
+static int audit_chmod_acl(vfs_handle_struct *handle,
+                       const struct smb_filename *smb_fname,
+                       mode_t mode)
 {
        int result;
 
-       result = SMB_VFS_NEXT_CHMOD_ACL(handle, path, mode);
+       result = SMB_VFS_NEXT_CHMOD_ACL(handle, smb_fname, mode);
 
        if (lp_syslog() > 0) {
                syslog(audit_syslog_priority(handle), "chmod_acl %s mode 0x%x %s%s\n",
-                      path, mode,
+                      smb_fname->base_name, mode,
                       (result < 0) ? "failed: " : "",
                       (result < 0) ? strerror(errno) : "");
        }
        DEBUG(1, ("vfs_extd_audit: chmod_acl %s mode 0x%x %s %s\n",
-               path, (unsigned int)mode,
+              smb_fname->base_name, (unsigned int)mode,
               (result < 0) ? "failed: " : "",
               (result < 0) ? strerror(errno) : ""));
 
index 43a88082e38e64707bed6ab4e9713f615ec7a104..4a7b358894197a8b3369758dc47dff335d8cb1b6 100644 (file)
@@ -1951,14 +1951,15 @@ static NTSTATUS smb_full_audit_fset_nt_acl(vfs_handle_struct *handle, files_stru
 }
 
 static int smb_full_audit_chmod_acl(vfs_handle_struct *handle,
-                          const char *path, mode_t mode)
+                               const struct smb_filename *smb_fname,
+                               mode_t mode)
 {
        int result;
        
-       result = SMB_VFS_NEXT_CHMOD_ACL(handle, path, mode);
+       result = SMB_VFS_NEXT_CHMOD_ACL(handle, smb_fname, mode);
 
        do_log(SMB_VFS_OP_CHMOD_ACL, (result >= 0), handle,
-              "%s|%o", path, mode);
+              "%s|%o", smb_fname->base_name, mode);
 
        return result;
 }
index fca0d130f524ff24f30c0c6f1f2a3161c45790c0..0c0507b0c5a24eb8432b45507ef35246028d1211 100644 (file)
@@ -96,7 +96,8 @@ static int linux_xfs_sgid_mkdir(vfs_handle_struct *handle,
 }
 
 static int linux_xfs_sgid_chmod_acl(vfs_handle_struct *handle,
-                                   const char *name, mode_t mode)
+                       const struct smb_filename *smb_fname,
+                       mode_t mode)
 {
        errno = ENOSYS;
        return -1;
index 6a54862bf2a744adc323c4a11720b7cacf22288f..e1f05ccdbeec0f15a87da1afe837eaea36c32764 100644 (file)
@@ -2073,33 +2073,30 @@ out:
  * Failure: set errno, return -1
  */
 static int mh_chmod_acl(vfs_handle_struct *handle,
-               const char *path,
+               const struct smb_filename *smb_fname,
                mode_t mode)
 {
        int status;
-       char *clientPath;
-       TALLOC_CTX *ctx;
+       struct smb_filename *clientFname = NULL;
 
        DEBUG(MH_INFO_DEBUG, ("Entering mh_chmod_acl\n"));
-       if (!is_in_media_files(path))
+       if (!is_in_media_files(smb_fname->base_name))
        {
-               status = SMB_VFS_NEXT_CHMOD_ACL(handle, path, mode);
+               status = SMB_VFS_NEXT_CHMOD_ACL(handle, smb_fname, mode);
                goto out;
        }
 
-       clientPath = NULL;
-       ctx = talloc_tos();
-
-       if ((status = alloc_get_client_path(handle, ctx,
-                               path,
-                               &clientPath)))
-       {
+       status = alloc_get_client_smb_fname(handle,
+                               talloc_tos(),
+                               smb_fname,
+                               &clientFname);
+       if (status != 0) {
                goto err;
        }
 
-       status = SMB_VFS_NEXT_CHMOD_ACL(handle, clientPath, mode);
+       status = SMB_VFS_NEXT_CHMOD_ACL(handle, clientFname, mode);
 err:
-       TALLOC_FREE(clientPath);
+       TALLOC_FREE(clientFname);
 out:
        return status;
 }
index 1aaf44eb34c375c1a0293af16dead4224183d46b..c83ce1e529f7b895838b99e0b49d147322948fa9 100644 (file)
@@ -1809,29 +1809,44 @@ static int shadow_copy2_setxattr(struct vfs_handle_struct *handle,
 }
 
 static int shadow_copy2_chmod_acl(vfs_handle_struct *handle,
-                                 const char *fname, mode_t mode)
+                       const struct smb_filename *smb_fname,
+                       mode_t mode)
 {
        time_t timestamp;
        char *stripped;
        ssize_t ret;
        int saved_errno;
-       char *conv;
+       char *conv = NULL;
+       struct smb_filename *conv_smb_fname = NULL;
 
-       if (!shadow_copy2_strip_snapshot(talloc_tos(), handle, fname,
-                                        &timestamp, &stripped)) {
+       if (!shadow_copy2_strip_snapshot(talloc_tos(),
+                               handle,
+                               smb_fname->base_name,
+                               &timestamp,
+                               &stripped)) {
                return -1;
        }
        if (timestamp == 0) {
-               return SMB_VFS_NEXT_CHMOD_ACL(handle, fname, mode);
+               return SMB_VFS_NEXT_CHMOD_ACL(handle, smb_fname, mode);
        }
        conv = shadow_copy2_convert(talloc_tos(), handle, stripped, timestamp);
        TALLOC_FREE(stripped);
        if (conv == NULL) {
                return -1;
        }
-       ret = SMB_VFS_NEXT_CHMOD_ACL(handle, conv, mode);
+       conv_smb_fname = synthetic_smb_fname(talloc_tos(),
+                                       conv,
+                                       NULL,
+                                       NULL);
+       if (conv_smb_fname == NULL) {
+               TALLOC_FREE(conv);
+               errno = ENOMEM;
+               return -1;
+       }
+       ret = SMB_VFS_NEXT_CHMOD_ACL(handle, conv_smb_fname, mode);
        saved_errno = errno;
        TALLOC_FREE(conv);
+       TALLOC_FREE(conv_smb_fname);
        errno = saved_errno;
        return ret;
 }
index 0a0f5eb1cca1941e6eec60d3c6a92077ec8cb7f5..fb9936931c0399ad93c9937f5cfd6f4006f2b63f 100644 (file)
@@ -2741,29 +2741,44 @@ static int snapper_gmt_setxattr(struct vfs_handle_struct *handle,
 }
 
 static int snapper_gmt_chmod_acl(vfs_handle_struct *handle,
-                                const char *fname, mode_t mode)
+                       const struct smb_filename *smb_fname,
+                       mode_t mode)
 {
        time_t timestamp;
        char *stripped;
        ssize_t ret;
        int saved_errno;
        char *conv;
+       struct smb_filename *conv_smb_fname = NULL;
 
-       if (!snapper_gmt_strip_snapshot(talloc_tos(), handle, fname,
-                                       &timestamp, &stripped)) {
+       if (!snapper_gmt_strip_snapshot(talloc_tos(),
+                               handle,
+                               smb_fname->base_name,
+                               &timestamp,
+                               &stripped)) {
                return -1;
        }
        if (timestamp == 0) {
-               return SMB_VFS_NEXT_CHMOD_ACL(handle, fname, mode);
+               return SMB_VFS_NEXT_CHMOD_ACL(handle, smb_fname, mode);
        }
        conv = snapper_gmt_convert(talloc_tos(), handle, stripped, timestamp);
        TALLOC_FREE(stripped);
        if (conv == NULL) {
                return -1;
        }
-       ret = SMB_VFS_NEXT_CHMOD_ACL(handle, conv, mode);
+       conv_smb_fname = synthetic_smb_fname(talloc_tos(),
+                                       conv,
+                                       NULL,
+                                       NULL);
+       if (conv_smb_fname == NULL) {
+               TALLOC_FREE(conv);
+               errno = ENOMEM;
+               return -1;
+       }
+       ret = SMB_VFS_NEXT_CHMOD_ACL(handle, conv_smb_fname, mode);
        saved_errno = errno;
        TALLOC_FREE(conv);
+       TALLOC_FREE(conv_smb_fname);
        errno = saved_errno;
        return ret;
 }
index 948f154acd77fd7f837cdc6a90622ee234df830e..944251d934dbeabab607152a78d1304f52f504e0 100644 (file)
@@ -1941,19 +1941,22 @@ static NTSTATUS smb_time_audit_fset_nt_acl(vfs_handle_struct *handle,
 }
 
 static int smb_time_audit_chmod_acl(vfs_handle_struct *handle,
-                                   const char *path, mode_t mode)
+                       const struct smb_filename *smb_fname,
+                       mode_t mode)
 {
        int result;
        struct timespec ts1,ts2;
        double timediff;
 
        clock_gettime_mono(&ts1);
-       result = SMB_VFS_NEXT_CHMOD_ACL(handle, path, mode);
+       result = SMB_VFS_NEXT_CHMOD_ACL(handle, smb_fname, mode);
        clock_gettime_mono(&ts2);
        timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
 
        if (timediff > audit_timeout) {
-               smb_time_audit_log_fname("chmod_acl", timediff, path);
+               smb_time_audit_log_fname("chmod_acl",
+                       timediff,
+                       smb_fname->base_name);
        }
 
        return result;
index 65e4d4cbbcd0f64cc44f1c218e92fa0bf078cc9f..dd6dc335dd8fc9875c1a415cb3353bc15cad8a56 100644 (file)
@@ -1571,28 +1571,32 @@ err:
 }
 
 static int um_chmod_acl(vfs_handle_struct *handle,
-                       const char *path,
+                       const struct smb_filename *smb_fname,
                        mode_t mode)
 {
        int status;
-       char *client_path = NULL;
+       int saved_errno;
+       struct smb_filename *client_fname = NULL;
 
        DEBUG(10, ("Entering um_chmod_acl\n"));
 
-       if (!is_in_media_files(path)) {
-               return SMB_VFS_NEXT_CHMOD_ACL(handle, path, mode);
+       if (!is_in_media_files(smb_fname->base_name)) {
+               return SMB_VFS_NEXT_CHMOD_ACL(handle, smb_fname, mode);
        }
 
-       status = alloc_get_client_path(handle, talloc_tos(),
-                                      path, &client_path);
+       status = alloc_get_client_smb_fname(handle,
+                               talloc_tos(),
+                               smb_fname,
+                               &client_fname);
        if (status != 0) {
                goto err;
        }
-
-       status = SMB_VFS_NEXT_CHMOD_ACL(handle, client_path, mode);
+       status = SMB_VFS_NEXT_CHMOD_ACL(handle, client_fname, mode);
 
 err:
-       TALLOC_FREE(client_path);
+       saved_errno = errno;
+       TALLOC_FREE(client_fname);
+       errno = saved_errno;
        return status;
 }
 
index 9221107f9fc5a00b5dff641f66db61377f986696..02a94e86f532a8848ed62e6e303de05894670b39 100644 (file)
@@ -2301,11 +2301,12 @@ NTSTATUS smb_vfs_call_audit_file(struct vfs_handle_struct *handle,
                                          access_denied);
 }
 
-int smb_vfs_call_chmod_acl(struct vfs_handle_struct *handle, const char *name,
-                          mode_t mode)
+int smb_vfs_call_chmod_acl(struct vfs_handle_struct *handle,
+               const struct smb_filename *smb_fname,
+               mode_t mode)
 {
        VFS_FIND(chmod_acl);
-       return handle->fns->chmod_acl_fn(handle, name, mode);
+       return handle->fns->chmod_acl_fn(handle, smb_fname, mode);
 }
 
 int smb_vfs_call_fchmod_acl(struct vfs_handle_struct *handle,
index 3e6371407f549a40c97acbf3dd9530bbfad63f98..a7e70b3c3a139c7f688cddb50d0cfdcaa2cbe387 100644 (file)
@@ -896,6 +896,7 @@ static NTSTATUS cmd_fchmod(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int argc,
 
 static NTSTATUS cmd_chmod_acl(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int argc, const char **argv)
 {
+       struct smb_filename *smb_fname = NULL;
        mode_t mode;
        if (argc != 3) {
                printf("Usage: chmod_acl <path> <mode>\n");
@@ -903,7 +904,16 @@ static NTSTATUS cmd_chmod_acl(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int ar
        }
 
        mode = atoi(argv[2]);
-       if (SMB_VFS_CHMOD_ACL(vfs->conn, argv[1], mode) == -1) {
+
+       smb_fname = synthetic_smb_fname(talloc_tos(),
+                                       argv[1],
+                                       NULL,
+                                       NULL);
+       if (smb_fname == NULL) {
+               return NT_STATUS_NO_MEMORY;
+       }
+
+       if (SMB_VFS_CHMOD_ACL(vfs->conn, smb_fname, mode) == -1) {
                printf("chmod_acl: error=%d (%s)\n", errno, strerror(errno));
                return NT_STATUS_UNSUCCESSFUL;
        }