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 f772a9f..e7bb645 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 bea2cd4..fe2356a 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 6a6c865..9aa45fa 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 6dc257b..e5e3c99 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 2684106..ba93e7b 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 92b69b1..cef3bb5 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 479c2c2..0bb943d 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 7f06fb7..e142cce 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 e61c39d..82e15c8 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 fbb0bcb..bb55fac 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 5aa6a30..0d8ca59 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 43a8808..4a7b358 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 fca0d13..0c0507b 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 6a54862..e1f05cc 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 1aaf44e..c83ce1e 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 0a0f5eb..fb99369 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 948f154..944251d 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 65e4d4c..dd6dc33 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 9221107..02a94e8 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 3e63714..a7e70b3 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;
        }