s3: VFS: Change SMB_VFS_SYS_ACL_DELETE_DEF_FILE to use const struct smb_filename...
authorJeremy Allison <jra@samba.org>
Tue, 23 May 2017 22:33:31 +0000 (15:33 -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.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
34 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_zfsacl.c
source3/smbd/posix_acls.c
source3/smbd/proto.h
source3/smbd/trans2.c
source3/smbd/vfs.c
source3/torture/cmd_vfs.c

index af119f3..801012a 100644 (file)
@@ -787,7 +787,7 @@ static int skel_sys_acl_set_fd(vfs_handle_struct *handle, files_struct *fsp,
 }
 
 static int skel_sys_acl_delete_def_file(vfs_handle_struct *handle,
-                                       const char *path)
+                                       const struct smb_filename *smb_fname)
 {
        errno = ENOSYS;
        return -1;
index e974529..0404a2e 100644 (file)
@@ -923,9 +923,9 @@ static int skel_sys_acl_set_fd(vfs_handle_struct *handle, files_struct *fsp,
 }
 
 static int skel_sys_acl_delete_def_file(vfs_handle_struct *handle,
-                                       const char *path)
+                                       const struct smb_filename *smb_fname)
 {
-       return SMB_VFS_NEXT_SYS_ACL_DELETE_DEF_FILE(handle, path);
+       return SMB_VFS_NEXT_SYS_ACL_DELETE_DEF_FILE(handle, smb_fname);
 }
 
 static ssize_t skel_getxattr(vfs_handle_struct *handle, const char *path,
index 3ac23db..6a41e19 100644 (file)
@@ -24,6 +24,7 @@
 
 struct vfs_handle_struct;
 struct files_struct;
+struct smb_filename;
 
 typedef int                    SMB_ACL_TYPE_T;
 typedef mode_t                 *SMB_ACL_PERMSET_T;
@@ -61,7 +62,7 @@ int sys_acl_set_file(struct vfs_handle_struct *handle,
 int sys_acl_set_fd(struct vfs_handle_struct *handle, struct files_struct *fsp,
                   SMB_ACL_T acl_d);
 int sys_acl_delete_def_file(struct vfs_handle_struct *handle,
-                           const char *path);
+                       const struct smb_filename *smb_fname);
 int no_acl_syscall_error(int err);
 
 #endif /* _SMB_ACLS_H */
index 7908980..8fe5536 100644 (file)
 /* Version 36 - Remove is_offline and set_offline */
 /* Version 37 - Module init functions now take a TALLOC_CTX * parameter. */
 /* 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 * */
 
 #define SMB_VFS_INTERFACE_VERSION 37
 
@@ -872,7 +874,8 @@ struct vfs_fn_pointers {
                                      DATA_BLOB *blob);
        int (*sys_acl_set_file_fn)(struct vfs_handle_struct *handle, const char *name, SMB_ACL_TYPE_T acltype, SMB_ACL_T theacl);
        int (*sys_acl_set_fd_fn)(struct vfs_handle_struct *handle, struct files_struct *fsp, SMB_ACL_T theacl);
-       int (*sys_acl_delete_def_file_fn)(struct vfs_handle_struct *handle, const char *path);
+       int (*sys_acl_delete_def_file_fn)(struct vfs_handle_struct *handle,
+                                       const struct smb_filename *smb_fname);
 
        /* EA operations. */
        ssize_t (*getxattr_fn)(struct vfs_handle_struct *handle,const char *path, const char *name, void *value, size_t size);
@@ -1333,7 +1336,7 @@ int smb_vfs_call_sys_acl_set_file(struct vfs_handle_struct *handle,
 int smb_vfs_call_sys_acl_set_fd(struct vfs_handle_struct *handle,
                                struct files_struct *fsp, SMB_ACL_T theacl);
 int smb_vfs_call_sys_acl_delete_def_file(struct vfs_handle_struct *handle,
-                                        const char *path);
+                               const struct smb_filename *smb_fname);
 ssize_t smb_vfs_call_getxattr(struct vfs_handle_struct *handle,
                              const char *path, const char *name, void *value,
                              size_t size);
index 0cbcf89..43dfe92 100644 (file)
 #define SMB_VFS_NEXT_SYS_ACL_SET_FD(handle, fsp, theacl) \
        smb_vfs_call_sys_acl_set_fd((handle)->next, (fsp), (theacl))
 
-#define SMB_VFS_SYS_ACL_DELETE_DEF_FILE(conn, path) \
-       smb_vfs_call_sys_acl_delete_def_file((conn)->vfs_handles, (path))
-#define SMB_VFS_NEXT_SYS_ACL_DELETE_DEF_FILE(handle, path) \
-       smb_vfs_call_sys_acl_delete_def_file((handle)->next, (path))
+#define SMB_VFS_SYS_ACL_DELETE_DEF_FILE(conn, smb_fname) \
+       smb_vfs_call_sys_acl_delete_def_file((conn)->vfs_handles, (smb_fname))
+#define SMB_VFS_NEXT_SYS_ACL_DELETE_DEF_FILE(handle, smb_fname) \
+       smb_vfs_call_sys_acl_delete_def_file((handle)->next, (smb_fname))
 
 #define SMB_VFS_GETXATTR(conn,path,name,value,size) \
        smb_vfs_call_getxattr((conn)->vfs_handles,(path),(name),(value),(size))
index 7cff488..b75c981 100644 (file)
@@ -385,9 +385,9 @@ int sys_acl_set_fd(vfs_handle_struct *handle, files_struct *fsp,
 }
 
 int sys_acl_delete_def_file(vfs_handle_struct *handle,
-                           const char *path)
+                       const struct smb_filename *smb_fname)
 {
-       return posixacl_sys_acl_delete_def_file(handle, path);
+       return posixacl_sys_acl_delete_def_file(handle, smb_fname);
 }
 
 #elif defined(HAVE_AIX_ACLS)
@@ -418,9 +418,9 @@ int sys_acl_set_fd(vfs_handle_struct *handle, files_struct *fsp,
 }
 
 int sys_acl_delete_def_file(vfs_handle_struct *handle,
-                           const char *path)
+                               const struct smb_filename *smb_fname)
 {
-       return aixacl_sys_acl_delete_def_file(handle, path);
+       return aixacl_sys_acl_delete_def_file(handle, smb_fname);
 }
 
 #elif defined(HAVE_TRU64_ACLS)
@@ -452,9 +452,9 @@ int sys_acl_set_fd(vfs_handle_struct *handle, files_struct *fsp,
 }
 
 int sys_acl_delete_def_file(vfs_handle_struct *handle,
-                           const char *path)
+                               const struct smb_filename *smb_fname)
 {
-       return tru64acl_sys_acl_delete_def_file(handle, path);
+       return tru64acl_sys_acl_delete_def_file(handle, smb_fname);
 }
 
 #elif defined(HAVE_SOLARIS_UNIXWARE_ACLS)
@@ -487,9 +487,9 @@ int sys_acl_set_fd(vfs_handle_struct *handle, files_struct *fsp,
 }
 
 int sys_acl_delete_def_file(vfs_handle_struct *handle,
-                           const char *path)
+                               const struct smb_filename *smb_fname)
 {
-       return solarisacl_sys_acl_delete_def_file(handle, path);
+       return solarisacl_sys_acl_delete_def_file(handle, smb_fname);
 }
 
 #elif defined(HAVE_HPUX_ACLS)
@@ -520,9 +520,9 @@ int sys_acl_set_fd(vfs_handle_struct *handle, files_struct *fsp,
 }
 
 int sys_acl_delete_def_file(vfs_handle_struct *handle,
-                           const char *path)
+                               const struct smb_filename *smb_fname)
 {
-       return hpuxacl_sys_acl_delete_def_file(handle, path);
+       return hpuxacl_sys_acl_delete_def_file(handle, smb_fname);
 }
 
 #else /* No ACLs. */
@@ -573,7 +573,7 @@ int sys_acl_set_fd(vfs_handle_struct *handle, files_struct *fsp,
 }
 
 int sys_acl_delete_def_file(vfs_handle_struct *handle,
-                           const char *path)
+                               const struct smb_filename *smb_fname)
 {
 #ifdef ENOTSUP
        errno = ENOTSUP;
index 652a2ee..871aa66 100644 (file)
@@ -498,7 +498,9 @@ int posixacl_xattr_acl_set_fd(vfs_handle_struct *handle,
 }
 
 int posixacl_xattr_acl_delete_def_file(vfs_handle_struct *handle,
-                                      const char *path_p)
+                               const struct smb_filename *smb_fname)
 {
-       return SMB_VFS_REMOVEXATTR(handle->conn, path_p, ACL_EA_DEFAULT);
+       return SMB_VFS_REMOVEXATTR(handle->conn,
+                       smb_fname->base_name,
+                       ACL_EA_DEFAULT);
 }
index 9e0aa58..6f6316a 100644 (file)
@@ -40,5 +40,5 @@ int posixacl_xattr_acl_set_fd(vfs_handle_struct *handle,
                              SMB_ACL_T theacl);
 
 int posixacl_xattr_acl_delete_def_file(vfs_handle_struct *handle,
-                                      const char *path);
+                               const struct smb_filename *smb_fname);
 #endif
index 169058f..c25c249 100644 (file)
@@ -174,7 +174,7 @@ int aixacl_sys_acl_set_fd(vfs_handle_struct *handle,
 }
 
 int aixacl_sys_acl_delete_def_file(vfs_handle_struct *handle,
-                                    const char *path)
+                               const struct smb_filename *smb_fname)
 {
        return 0; /* otherwise you can't set acl at upper level */
 }
index aaf6e29..e46e502 100644 (file)
@@ -538,7 +538,7 @@ int aixjfs2_sys_acl_set_fd(vfs_handle_struct *handle,
 }
 
 int aixjfs2_sys_acl_delete_def_file(vfs_handle_struct *handle,
-                                    const char *path)
+                               const struct smb_filename *smb_fname)
 {
        /* Not available under AIXC ACL */
        /* Don't report here any error otherwise */
index 0360830..4179926 100644 (file)
@@ -568,15 +568,38 @@ static int cap_sys_acl_set_file(vfs_handle_struct *handle, const char *path, SMB
        return SMB_VFS_NEXT_SYS_ACL_SET_FILE(handle, cappath, acltype, theacl);
 }
 
-static int cap_sys_acl_delete_def_file(vfs_handle_struct *handle, const char *path)
+static int cap_sys_acl_delete_def_file(vfs_handle_struct *handle,
+                       const struct smb_filename *smb_fname)
 {
-       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 = 0;
 
        if (!cappath) {
                errno = ENOMEM;
                return -1;
        }
-       return SMB_VFS_NEXT_SYS_ACL_DELETE_DEF_FILE(handle, cappath);
+       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 -1;
+       }
+       ret = SMB_VFS_NEXT_SYS_ACL_DELETE_DEF_FILE(handle, cap_smb_fname);
+       if (ret == -1) {
+               saved_errno = errno;
+       }
+       TALLOC_FREE(cappath);
+       TALLOC_FREE(cap_smb_fname);
+       if (saved_errno) {
+               errno = saved_errno;
+       }
+       return ret;
 }
 
 static ssize_t cap_getxattr(vfs_handle_struct *handle, const char *path, const char *name, void *value, size_t size)
index 972f51a..7ed531a 100644 (file)
@@ -1292,22 +1292,42 @@ catia_sys_acl_set_file(vfs_handle_struct *handle,
 
 static int
 catia_sys_acl_delete_def_file(vfs_handle_struct *handle,
-                             const char *path)
+                               const struct smb_filename *smb_fname)
 {
+       struct smb_filename *mapped_smb_fname = NULL;
+       int saved_errno = 0;
        char *mapped_name = NULL;
        NTSTATUS status;
        int ret;
 
        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_SYS_ACL_DELETE_DEF_FILE(handle, 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 -1;
+       }
+       ret = SMB_VFS_NEXT_SYS_ACL_DELETE_DEF_FILE(handle, mapped_smb_fname);
+       if (ret == -1) {
+               saved_errno = errno;
+       }
+       TALLOC_FREE(mapped_smb_fname);
        TALLOC_FREE(mapped_name);
-
+       if (saved_errno != 0) {
+               errno = saved_errno;
+       }
        return ret;
 }
 
index e1b2712..19b6925 100644 (file)
@@ -2734,9 +2734,10 @@ static int vfswrap_sys_acl_set_fd(vfs_handle_struct *handle, files_struct *fsp,
        return sys_acl_set_fd(handle, fsp, theacl);
 }
 
-static int vfswrap_sys_acl_delete_def_file(vfs_handle_struct *handle, const char *path)
+static int vfswrap_sys_acl_delete_def_file(vfs_handle_struct *handle,
+                       const struct smb_filename *smb_fname)
 {
-       return sys_acl_delete_def_file(handle, path);
+       return sys_acl_delete_def_file(handle, smb_fname);
 }
 
 /****************************************************************
index 62b53b6..fae8014 100644 (file)
@@ -357,14 +357,15 @@ static int fake_acls_sys_acl_set_fd(vfs_handle_struct *handle, files_struct *fsp
        return ret;
 }
 
-static int fake_acls_sys_acl_delete_def_file(vfs_handle_struct *handle, const char *path)
+static int fake_acls_sys_acl_delete_def_file(vfs_handle_struct *handle,
+                       const struct smb_filename *smb_fname_in)
 {
        int ret;
        const char *name = FAKE_ACL_DEFAULT_XATTR;
        TALLOC_CTX *frame = talloc_stackframe();
-       struct smb_filename *smb_fname;
+       struct smb_filename *smb_fname = cp_smb_filename_nostream(talloc_tos(),
+                                               smb_fname_in);
 
-       smb_fname = synthetic_smb_fname(frame, path, NULL, NULL, 0);
        if (smb_fname == NULL) {
                TALLOC_FREE(frame);
                errno = ENOMEM;
@@ -383,7 +384,7 @@ static int fake_acls_sys_acl_delete_def_file(vfs_handle_struct *handle, const ch
                return -1;
        }
 
-       ret = SMB_VFS_NEXT_REMOVEXATTR(handle, path, name);
+       ret = SMB_VFS_NEXT_REMOVEXATTR(handle, smb_fname->base_name, name);
        if (ret == -1 && errno == ENOATTR) {
                ret = 0;
                errno = 0;
index 4c2eb87..e6ee577 100644 (file)
@@ -2241,15 +2241,14 @@ static int smb_full_audit_sys_acl_set_fd(vfs_handle_struct *handle, files_struct
 }
 
 static int smb_full_audit_sys_acl_delete_def_file(vfs_handle_struct *handle,
-
-                                        const char *path)
+                               const struct smb_filename *smb_fname)
 {
        int result;
 
-       result = SMB_VFS_NEXT_SYS_ACL_DELETE_DEF_FILE(handle, path);
+       result = SMB_VFS_NEXT_SYS_ACL_DELETE_DEF_FILE(handle, smb_fname);
 
        do_log(SMB_VFS_OP_SYS_ACL_DELETE_DEF_FILE, (result >= 0), handle,
-              "%s", path);
+              "%s", smb_fname->base_name);
 
        return result;
 }
index d1d59ce..fa2664e 100644 (file)
@@ -1279,7 +1279,7 @@ static int gpfsacl_sys_acl_set_fd(vfs_handle_struct *handle,
 }
 
 static int gpfsacl_sys_acl_delete_def_file(vfs_handle_struct *handle,
-                                          const char *path)
+                               const struct smb_filename *smb_fname)
 {
        struct gpfs_config_data *config;
 
@@ -1288,7 +1288,7 @@ static int gpfsacl_sys_acl_delete_def_file(vfs_handle_struct *handle,
                                return -1);
 
        if (!config->acl) {
-               return SMB_VFS_NEXT_SYS_ACL_DELETE_DEF_FILE(handle, path);
+               return SMB_VFS_NEXT_SYS_ACL_DELETE_DEF_FILE(handle, smb_fname);
        }
 
        errno = ENOTSUP;
index d91657a..f666a5e 100644 (file)
@@ -358,7 +358,7 @@ int hpuxacl_sys_acl_set_fd(vfs_handle_struct *handle,
  * check is considered unnecessary. --- Agreed? XXX
  */
 int hpuxacl_sys_acl_delete_def_file(vfs_handle_struct *handle,
-                                   const char *path)
+                               const struct smb_filename *smb_fname)
 {
        SMB_ACL_T smb_acl;
        int ret = -1;
@@ -367,7 +367,7 @@ int hpuxacl_sys_acl_delete_def_file(vfs_handle_struct *handle,
 
        DEBUG(10, ("entering hpuxacl_sys_acl_delete_def_file.\n"));
 
-       smb_acl = hpuxacl_sys_acl_get_file(handle, path, 
+       smb_acl = hpuxacl_sys_acl_get_file(handle, smb_fname->base_name,
                                           SMB_ACL_TYPE_ACCESS);
        if (smb_acl == NULL) {
                DEBUG(10, ("getting file acl failed!\n"));
@@ -383,7 +383,8 @@ int hpuxacl_sys_acl_delete_def_file(vfs_handle_struct *handle,
                DEBUG(10, ("resulting acl is not valid!\n"));
                goto done;
        }
-       ret = acl(discard_const_p(char, path), ACL_SET, count, hpux_acl);
+       ret = acl(discard_const_p(char, smb_fname->base_name),
+                               ACL_SET, count, hpux_acl);
        if (ret != 0) {
                DEBUG(10, ("settinge file acl failed!\n"));
        }
index 07b32d6..df30e17 100644 (file)
@@ -50,7 +50,7 @@ int hpuxacl_sys_acl_set_fd(vfs_handle_struct *handle,
                           SMB_ACL_T theacl);
 
 int hpuxacl_sys_acl_delete_def_file(vfs_handle_struct *handle,
-                                   const char *path);
+                       const struct smb_filename *smb_fname);
 
 NTSTATUS vfs_hpuxacl_init(void);
 
index 794644e..9a5b99d 100644 (file)
@@ -2179,33 +2179,28 @@ out:
  * Failure: set errno, return -1
  */
 static int mh_sys_acl_delete_def_file(vfs_handle_struct *handle,
-               const char *path)
+                       const struct smb_filename *smb_fname)
 {
        int status;
-       char *clientPath;
-       TALLOC_CTX *ctx;
+       struct smb_filename *clientFname = NULL;
 
        DEBUG(MH_INFO_DEBUG, ("Entering mh_sys_acl_delete_def_file\n"));
-       if (!is_in_media_files(path))
-       {
+       if (!is_in_media_files(smb_fname->base_name)) {
                status = SMB_VFS_NEXT_SYS_ACL_DELETE_DEF_FILE(handle,
-                               path);
+                               smb_fname);
                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_SYS_ACL_DELETE_DEF_FILE(handle, clientPath);
+       status = SMB_VFS_NEXT_SYS_ACL_DELETE_DEF_FILE(handle, clientFname);
 err:
-       TALLOC_FREE(clientPath);
+       TALLOC_FREE(clientFname);
 out:
        return status;
 }
index a22ae7f..cae3e7b 100644 (file)
@@ -615,7 +615,7 @@ static int nfs4acl_xattr_fail__sys_acl_set_fd(vfs_handle_struct *handle,
 }
 
 static int nfs4acl_xattr_fail__sys_acl_delete_def_file(vfs_handle_struct *handle,
-                                               const char *path)
+                       const struct smb_filename *smb_fname)
 {
        return -1;
 }
index 85d84a5..ed8f1ba 100644 (file)
@@ -129,9 +129,9 @@ int posixacl_sys_acl_set_fd(vfs_handle_struct *handle,
 }
 
 int posixacl_sys_acl_delete_def_file(vfs_handle_struct *handle,
-                                    const char *path)
+                               const struct smb_filename *smb_fname)
 {
-       return acl_delete_def_file(path);
+       return acl_delete_def_file(smb_fname->base_name);
 }
 
 
index 59d3dc9..b64bdb2 100644 (file)
@@ -40,7 +40,7 @@ int posixacl_sys_acl_set_fd(vfs_handle_struct *handle,
                            SMB_ACL_T theacl);
 
 int posixacl_sys_acl_delete_def_file(vfs_handle_struct *handle,
-                                    const char *path);
+                               const struct smb_filename *smb_fname);
 
 NTSTATUS vfs_posixacl_init(TALLOC_CTX *);
 
index e5a581c..48305c5 100644 (file)
@@ -298,7 +298,7 @@ int solarisacl_sys_acl_set_fd(vfs_handle_struct *handle,
  * check is considered unnecessary. --- Agreed? XXX
  */
 int solarisacl_sys_acl_delete_def_file(vfs_handle_struct *handle,
-                                      const char *path)
+                               struct smb_filename *smb_fname)
 {
        SMB_ACL_T smb_acl;
        int ret = -1;
@@ -307,7 +307,7 @@ int solarisacl_sys_acl_delete_def_file(vfs_handle_struct *handle,
 
        DEBUG(10, ("entering solarisacl_sys_acl_delete_def_file.\n"));
        
-       smb_acl = solarisacl_sys_acl_get_file(handle, path, 
+       smb_acl = solarisacl_sys_acl_get_file(handle, smb_fname->base_name,
                                              SMB_ACL_TYPE_ACCESS, talloc_tos());
        if (smb_acl == NULL) {
                DEBUG(10, ("getting file acl failed!\n"));
@@ -323,7 +323,7 @@ int solarisacl_sys_acl_delete_def_file(vfs_handle_struct *handle,
                DEBUG(10, ("resulting acl is not valid!\n"));
                goto done;
        }
-       ret = acl(path, SETACL, count, solaris_acl);
+       ret = acl(smb_fname->base_name, SETACL, count, solaris_acl);
        if (ret != 0) {
                DEBUG(10, ("settinge file acl failed!\n"));
        }
index 20f1051..941f766 100644 (file)
@@ -39,7 +39,7 @@ int solarisacl_sys_acl_set_fd(vfs_handle_struct *handle,
                              SMB_ACL_T theacl);
 
 int solarisacl_sys_acl_delete_def_file(vfs_handle_struct *handle,
-                                      const char *path);
+                               const struct smb_filename *smb_fname);
 
 NTSTATUS vfs_solarisacl_init(void);
 
index 52bd00e..c86f0df 100644 (file)
@@ -2297,19 +2297,20 @@ static int smb_time_audit_sys_acl_set_fd(vfs_handle_struct *handle,
 }
 
 static int smb_time_audit_sys_acl_delete_def_file(vfs_handle_struct *handle,
-                                                 const char *path)
+                               const struct smb_filename *smb_fname)
 {
        int result;
        struct timespec ts1,ts2;
        double timediff;
 
        clock_gettime_mono(&ts1);
-       result = SMB_VFS_NEXT_SYS_ACL_DELETE_DEF_FILE(handle, path);
+       result = SMB_VFS_NEXT_SYS_ACL_DELETE_DEF_FILE(handle, smb_fname);
        clock_gettime_mono(&ts2);
        timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
 
        if (timediff > audit_timeout) {
-               smb_time_audit_log_fname("sys_acl_delete_def_file", timediff, path);
+               smb_time_audit_log_fname("sys_acl_delete_def_file", timediff,
+                       smb_fname->base_name);
        }
 
        return result;
index 83edc15..83f3289 100644 (file)
@@ -148,9 +148,9 @@ int tru64acl_sys_acl_set_fd(vfs_handle_struct *handle,
 }
 
 int tru64acl_sys_acl_delete_def_file(vfs_handle_struct *handle,
-                                    const char *path)
+                               const struct smb_filename *smb_fname)
 {
-       return acl_delete_def_file((char *)path);
+       return acl_delete_def_file((char *)smb_fname->base_name);
 }
 
 
index af79e2f..3825be0 100644 (file)
@@ -37,7 +37,7 @@ int tru64acl_sys_acl_set_fd(vfs_handle_struct *handle,
                            SMB_ACL_T theacl);
 
 int tru64acl_sys_acl_delete_def_file(vfs_handle_struct *handle,
-                                    const char *path);
+                               const struct smb_filename *smb_fname);
 
 NTSTATUS vfs_tru64acl_init(void);
 
index ccafb88..bbccb66 100644 (file)
@@ -1668,27 +1668,37 @@ err:
 }
 
 static int um_sys_acl_delete_def_file(vfs_handle_struct *handle,
-                                     const char *path)
+                               const struct smb_filename *smb_fname)
 {
        int status;
-       char *client_path = NULL;
+       int saved_errno = 0;
+       struct smb_filename *client_fname = NULL;
 
        DEBUG(10, ("Entering um_sys_acl_delete_def_file\n"));
 
-       if (!is_in_media_files(path)) {
-               return SMB_VFS_NEXT_SYS_ACL_DELETE_DEF_FILE(handle, path);
+       if (!is_in_media_files(smb_fname->base_name)) {
+               return SMB_VFS_NEXT_SYS_ACL_DELETE_DEF_FILE(handle,
+                               smb_fname);
        }
 
-       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_SYS_ACL_DELETE_DEF_FILE(handle, client_path);
+       status = SMB_VFS_NEXT_SYS_ACL_DELETE_DEF_FILE(handle, client_fname);
 
 err:
-       TALLOC_FREE(client_path);
+       if (status == -1) {
+               saved_errno = errno;
+       }
+       TALLOC_FREE(client_fname);
+       if (saved_errno != 0) {
+               errno = saved_errno;
+       }
        return status;
 }
 
index 6eadf42..c59a910 100644 (file)
@@ -314,7 +314,7 @@ static int zfsacl_fail__sys_acl_set_fd(vfs_handle_struct *handle,
 }
 
 static int zfsacl_fail__sys_acl_delete_def_file(vfs_handle_struct *handle,
-                                               const char *path)
+                       const struct smb_filename *smb_fname)
 {
        return -1;
 }
index 72bb9fe..c02331d 100644 (file)
@@ -3927,7 +3927,7 @@ NTSTATUS set_nt_acl(files_struct *fsp, uint32_t security_info_sent, const struct
                                become_root();
                        }
                        sret = SMB_VFS_SYS_ACL_DELETE_DEF_FILE(conn,
-                           fsp->fsp_name->base_name);
+                           fsp->fsp_name);
                        if (set_acl_as_root) {
                                unbecome_root();
                        }
@@ -3943,7 +3943,7 @@ NTSTATUS set_nt_acl(files_struct *fsp, uint32_t security_info_sent, const struct
                                        sret =
                                            SMB_VFS_SYS_ACL_DELETE_DEF_FILE(
                                                    conn,
-                                                   fsp->fsp_name->base_name);
+                                                   fsp->fsp_name);
                                        unbecome_root();
                                }
 
@@ -4410,14 +4410,18 @@ static SMB_ACL_T create_posix_acl_from_wire(connection_struct *conn,
  on the directory.
 ****************************************************************************/
 
-bool set_unix_posix_default_acl(connection_struct *conn, const char *fname, const SMB_STRUCT_STAT *psbuf,
-                               uint16_t num_def_acls, const char *pdata)
+bool set_unix_posix_default_acl(connection_struct *conn,
+                               const struct smb_filename *smb_fname,
+                               uint16_t num_def_acls,
+                               const char *pdata)
 {
        SMB_ACL_T def_acl = NULL;
 
-       if (!S_ISDIR(psbuf->st_ex_mode)) {
+       if (!S_ISDIR(smb_fname->st.st_ex_mode)) {
                if (num_def_acls) {
-                       DEBUG(5,("set_unix_posix_default_acl: Can't set default ACL on non-directory file %s\n", fname ));
+                       DEBUG(5,("set_unix_posix_default_acl: Can't "
+                               "set default ACL on non-directory file %s\n",
+                               smb_fname->base_name ));
                        errno = EISDIR;
                        return False;
                } else {
@@ -4427,9 +4431,9 @@ bool set_unix_posix_default_acl(connection_struct *conn, const char *fname, cons
 
        if (!num_def_acls) {
                /* Remove the default ACL. */
-               if (SMB_VFS_SYS_ACL_DELETE_DEF_FILE(conn, fname) == -1) {
+               if (SMB_VFS_SYS_ACL_DELETE_DEF_FILE(conn, smb_fname) == -1) {
                        DEBUG(5,("set_unix_posix_default_acl: acl_delete_def_file failed on directory %s (%s)\n",
-                               fname, strerror(errno) ));
+                               smb_fname->base_name, strerror(errno) ));
                        return False;
                }
                return True;
@@ -4441,14 +4445,16 @@ bool set_unix_posix_default_acl(connection_struct *conn, const char *fname, cons
                return False;
        }
 
-       if (SMB_VFS_SYS_ACL_SET_FILE(conn, fname, SMB_ACL_TYPE_DEFAULT, def_acl) == -1) {
+       if (SMB_VFS_SYS_ACL_SET_FILE(conn, smb_fname->base_name,
+                               SMB_ACL_TYPE_DEFAULT, def_acl) == -1) {
                DEBUG(5,("set_unix_posix_default_acl: acl_set_file failed on directory %s (%s)\n",
-                       fname, strerror(errno) ));
+                       smb_fname->base_name, strerror(errno) ));
                TALLOC_FREE(def_acl);
                return False;
        }
 
-       DEBUG(10,("set_unix_posix_default_acl: set default acl for file %s\n", fname ));
+       DEBUG(10,("set_unix_posix_default_acl: set default acl for file %s\n",
+               smb_fname->base_name ));
        TALLOC_FREE(def_acl);
        return True;
 }
index e2d5a6a..88ba6f9 100644 (file)
@@ -783,8 +783,8 @@ 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 fchmod_acl(files_struct *fsp, mode_t mode);
-bool set_unix_posix_default_acl(connection_struct *conn, const char *fname,
-                               const SMB_STRUCT_STAT *psbuf,
+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);
 NTSTATUS get_nt_acl_no_snum( TALLOC_CTX *ctx, const char *fname,
index 5155abb..f11dcd1 100644 (file)
@@ -7157,7 +7157,7 @@ static NTSTATUS smb_set_posix_acl(connection_struct *conn,
        }
 
        if (valid_def_acls && !set_unix_posix_default_acl(conn,
-               smb_fname->base_name, &smb_fname->st, num_def_acls,
+               smb_fname, num_def_acls,
                pdata + SMB_POSIX_ACL_HEADER_SIZE +
                (num_file_acls*SMB_POSIX_ACL_ENTRY_SIZE))) {
                return map_nt_error_from_unix(errno);
index 560c4b2..a4aeffe 100644 (file)
@@ -2493,10 +2493,10 @@ int smb_vfs_call_sys_acl_set_fd(struct vfs_handle_struct *handle,
 }
 
 int smb_vfs_call_sys_acl_delete_def_file(struct vfs_handle_struct *handle,
-                                        const char *path)
+                               const struct smb_filename *smb_fname)
 {
        VFS_FIND(sys_acl_delete_def_file);
-       return handle->fns->sys_acl_delete_def_file_fn(handle, path);
+       return handle->fns->sys_acl_delete_def_file_fn(handle, smb_fname);
 }
 
 ssize_t smb_vfs_call_getxattr(struct vfs_handle_struct *handle,
index b57a061..c22b5d2 100644 (file)
@@ -1778,17 +1778,29 @@ static NTSTATUS cmd_sys_acl_delete_def_file(struct vfs_state *vfs, TALLOC_CTX *m
                                            int argc, const char **argv)
 {
        int ret;
+       struct smb_filename *smb_fname = NULL;
 
        if (argc != 2) {
                printf("Usage: sys_acl_delete_def_file <path>\n");
                return NT_STATUS_OK;
        }
 
-       ret = SMB_VFS_SYS_ACL_DELETE_DEF_FILE(vfs->conn, argv[1]);
+       smb_fname = synthetic_smb_fname(talloc_tos(),
+                                       argv[1],
+                                       NULL,
+                                       NULL,
+                                       ssf_flags());
+
+       if (smb_fname == NULL) {
+               return NT_STATUS_NO_MEMORY;
+       }
+       ret = SMB_VFS_SYS_ACL_DELETE_DEF_FILE(vfs->conn, smb_fname);
        if (ret == -1) {
                printf("sys_acl_delete_def_file failed (%s)\n", strerror(errno));
+               TALLOC_FREE(smb_fname);
                return NT_STATUS_UNSUCCESSFUL;
        }
+       TALLOC_FREE(smb_fname);
        return NT_STATUS_OK;
 }