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 af119f32db1f10f10d689179076ba5741876763c..801012a89657c4fc825092787bfaf7c754cf25ea 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 e97452927303da9cc8508fbd8d66f20bc4f74183..0404a2e11c9a5a72bd8b4b7ff177d90261482610 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 3ac23dbbfd35f8a84d824070f7eeb32b0365f479..6a41e196e195be9ad28b7d1d3b70e5a2c850f1bd 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 79089806e24d6f9f8987c163e79bc132999526f4..8fe5536ffcce341a68f88aa1c584e70e4f5bcc29 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 0cbcf89cce56bd7ce6ac1cc63dfded77d9c1d54c..43dfe929fff93461266a140d3e74f360f858d5e1 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 7cff488ba2c6f3457b7795721ece01b4df0432e2..b75c98149acae6c50f000d5f9b5c594a9ce5a836 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 652a2eee2c27c0aad19c879844135f7c3651b3f9..871aa669f1a5c50f4f3f2f37f0e8b1aad7d58d89 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 9e0aa5879f1341a0210e764f6a0cdbf253803350..6f6316ae4533786dac566185d66382c24343130c 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 169058f2afcabedebdc87b45dc1a425533a37741..c25c249a6f5b1a3fcad5c040b065a9853f5126c2 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 aaf6e293ec39b39dbe6225808eeaa96d1ca1fb40..e46e5026215946886039c7b250171a726ff0d575 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 03608301bf5deb0f38b4b8671029a79a5b77d353..4179926267581750d54f92ee8450dac010c6ff6f 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 972f51a5ba693c0b29e51017fdcc6249784ea1f8..7ed531ac0a35bb118e7c22f10685f6efa4af579a 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 e1b2712d793acc8996e2ceee77bd93bb16525c10..19b6925a3a4090975c0c5496644d0507dcfa50e8 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 62b53b6dd61ecda594226934d10df3136ae85fb8..fae8014f78e25cf221479d6fe503ad7b274f3aea 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 4c2eb87ddb1c98c04aefc841a6185a5842a3e347..e6ee5770afe70f71b7e7c299537d1bbf6f82a074 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 d1d59ce63219c984e2275696df88cc65dc470745..fa2664e8d072d3191690384f3c6ef4a51efa17e4 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 d91657a00a684ce0d08b51bbec9678f54dd8dd1c..f666a5eceb50b2f63781b1337075fe460ed90d0a 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 07b32d628cad3641f82e4dae8c857171100ca074..df30e17f51b47770966357bdb2e5086dc2913d49 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 794644ed493ee306cc2f76299fb7d75026b2023d..9a5b99db8e3bdcd7b99193e71ef752e4d138e19d 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 a22ae7fc2848e8a7fecaa73b7cfc22dba7566fe3..cae3e7bea65d096df2bab6cbccd95d8010c46a1f 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 85d84a578f5977cf0716825c70e93bb16a7ef0c5..ed8f1bae8f0305f3ec57d85c8241703ad27bebbc 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 59d3dc964bd555c4310133eedb904a97c0c0fc40..b64bdb280abe231b8f7ab2dcb150ccb82f9b443c 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 e5a581c05f815cb6e677af6ce4efb2590c38b530..48305c5018060276c01a09a277914f09c2fde36d 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 20f1051bb523bd319f2a78aef4527b314bcfed52..941f7669155b9c7f8b3a93f90170bda6a3b8bc1f 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 52bd00edb13d67b47b236896793928fc421368a1..c86f0dfc18163b0d33882a3d7625a9f1f104d99e 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 83edc15205edef8681254d0a5fd177be4ca55833..83f3289deb02eb71f23faeae35fb8da78fc2c2b2 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 af79e2f9b651dbab5c3c9f38fbcb967864832b53..3825be08a2658f05a6fc2f56f7f21290e90cae0e 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 ccafb882df70b572059917cbefe4d189f7a255d8..bbccb66c5cc3017272bf7cae93b7c5700c4d52da 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 6eadf42e600e4e468e0483ea79f336f9bf1ba395..c59a910626046803e5f977e8e9edd0b1f9ad9cc3 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 72bb9fe086ee91e5c5cb7b51f195908d486f9bbc..c02331d12308f92c2ceeb0df5f22f3ed97cac244 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 e2d5a6a9fbeba4899f26dcbd57ff5950d9e29175..88ba6f9d3e48bfc8b5a73e48257d4ce2c820fd67 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 5155abb00955e4d85465012a57c9550b1f5f0e73..f11dcd116dd1c2e9c40ec56c3401bd407f3277d2 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 560c4b217a4a02f006473d959f40e3e64bff520c..a4aeffe47a8787229b4d79e95fc5514801036e1d 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 b57a061ee4c8165049c7e46e4eab8ca3cdabe90e..c22b5d24c3a3272e19bea68dd5a2da2163df5c82 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;
 }