diff options
author | Jeremy Allison <jra@samba.org> | 2016-02-12 10:30:10 -0800 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2016-02-16 19:59:24 +0100 |
commit | 616d068f0cebb8e50a855b6e30f36fccb7f5a3c8 (patch) | |
tree | 3c64bcb9015da0fd40aa0d981d51104a945c370a /source3/modules | |
parent | 3330c79324fe8316a2d122d3f2bf47c4e2c75c0c (diff) | |
download | samba-616d068f0cebb8e50a855b6e30f36fccb7f5a3c8.tar.gz |
s3: VFS: Modify SMB_VFS_GET_NT_ACL to take a const struct smb_filename * instead of const char *
Bumps VFS version to 35.
Preparing to reduce use of lp_posix_pathnames().
Most of this is boilerplate, the only subtleties are in
the modules:
vfs_catia.c
vfs_media_harmony.c
vfs_shadow_copy2.c
vfs_unityed_media.c
Where the path is modified then passed to SMB_VFS_NEXT_GET_NT_ACL().
In these cases the change uses synthetic_smb_fname() to
create a new struct smb_filename from the modified path.
Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <rb@sernet.de>
Diffstat (limited to 'source3/modules')
-rw-r--r-- | source3/modules/vfs_acl_common.c | 21 | ||||
-rw-r--r-- | source3/modules/vfs_catia.c | 16 | ||||
-rw-r--r-- | source3/modules/vfs_default.c | 9 | ||||
-rw-r--r-- | source3/modules/vfs_full_audit.c | 6 | ||||
-rw-r--r-- | source3/modules/vfs_media_harmony.c | 21 | ||||
-rw-r--r-- | source3/modules/vfs_nfs4acl_xattr.c | 4 | ||||
-rw-r--r-- | source3/modules/vfs_shadow_copy2.c | 36 | ||||
-rw-r--r-- | source3/modules/vfs_time_audit.c | 8 | ||||
-rw-r--r-- | source3/modules/vfs_unityed_media.c | 21 |
9 files changed, 107 insertions, 35 deletions
diff --git a/source3/modules/vfs_acl_common.c b/source3/modules/vfs_acl_common.c index f73e80c5ada..30574e0e06f 100644 --- a/source3/modules/vfs_acl_common.c +++ b/source3/modules/vfs_acl_common.c @@ -366,7 +366,7 @@ static NTSTATUS add_directory_inheritable_components(vfs_handle_struct *handle, static NTSTATUS get_nt_acl_internal(vfs_handle_struct *handle, files_struct *fsp, - const char *name, + const struct smb_filename *smb_fname, uint32_t security_info, TALLOC_CTX *mem_ctx, struct security_descriptor **ppdesc) @@ -381,14 +381,17 @@ static NTSTATUS get_nt_acl_internal(vfs_handle_struct *handle, uint8_t sys_acl_hash_tmp[XATTR_SD_HASH_SIZE]; struct security_descriptor *psd = NULL; struct security_descriptor *pdesc_next = NULL; + const char *name = NULL; bool ignore_file_system_acl = lp_parm_bool(SNUM(handle->conn), ACL_MODULE_NAME, "ignore system acls", false); TALLOC_CTX *frame = talloc_stackframe(); - if (fsp && name == NULL) { + if (fsp && smb_fname == NULL) { name = fsp->fsp_name->base_name; + } else { + name = smb_fname->base_name; } DEBUG(10, ("get_nt_acl_internal: name=%s\n", name)); @@ -509,7 +512,7 @@ static NTSTATUS get_nt_acl_internal(vfs_handle_struct *handle, &pdesc_next); } else { status = SMB_VFS_NEXT_GET_NT_ACL(handle, - name, + smb_fname, HASH_SECURITY_INFO, mem_ctx, &pdesc_next); @@ -575,7 +578,7 @@ static NTSTATUS get_nt_acl_internal(vfs_handle_struct *handle, &pdesc_next); } else { status = SMB_VFS_NEXT_GET_NT_ACL(handle, - name, + smb_fname, security_info, mem_ctx, &pdesc_next); @@ -728,13 +731,17 @@ static NTSTATUS fget_nt_acl_common(vfs_handle_struct *handle, *********************************************************************/ static NTSTATUS get_nt_acl_common(vfs_handle_struct *handle, - const char *name, + const struct smb_filename *smb_fname, uint32_t security_info, TALLOC_CTX *mem_ctx, struct security_descriptor **ppdesc) { - return get_nt_acl_internal(handle, NULL, - name, security_info, mem_ctx, ppdesc); + return get_nt_acl_internal(handle, + NULL, + smb_fname, + security_info, + mem_ctx, + ppdesc); } /********************************************************************* diff --git a/source3/modules/vfs_catia.c b/source3/modules/vfs_catia.c index c17ffa8f13c..48e2e3ff9f3 100644 --- a/source3/modules/vfs_catia.c +++ b/source3/modules/vfs_catia.c @@ -778,12 +778,14 @@ catia_streaminfo(struct vfs_handle_struct *handle, static NTSTATUS catia_get_nt_acl(struct vfs_handle_struct *handle, - const char *path, + const struct smb_filename *smb_fname, uint32_t security_info, TALLOC_CTX *mem_ctx, struct security_descriptor **ppdesc) { char *mapped_name = NULL; + const char *path = smb_fname->base_name; + struct smb_filename *mapped_smb_fname = NULL; NTSTATUS status; status = catia_string_replace_allocate(handle->conn, @@ -792,9 +794,19 @@ catia_get_nt_acl(struct vfs_handle_struct *handle, errno = map_errno_from_nt_status(status); return status; } - status = SMB_VFS_NEXT_GET_NT_ACL(handle, mapped_name, + mapped_smb_fname = synthetic_smb_fname(talloc_tos(), + mapped_name, + NULL, + NULL); + if (mapped_smb_fname == NULL) { + TALLOC_FREE(mapped_name); + return NT_STATUS_NO_MEMORY; + } + + status = SMB_VFS_NEXT_GET_NT_ACL(handle, mapped_smb_fname, security_info, mem_ctx, ppdesc); TALLOC_FREE(mapped_name); + TALLOC_FREE(mapped_smb_fname); return status; } diff --git a/source3/modules/vfs_default.c b/source3/modules/vfs_default.c index 762624bec66..43e65acc110 100644 --- a/source3/modules/vfs_default.c +++ b/source3/modules/vfs_default.c @@ -2327,7 +2327,7 @@ static NTSTATUS vfswrap_fget_nt_acl(vfs_handle_struct *handle, } static NTSTATUS vfswrap_get_nt_acl(vfs_handle_struct *handle, - const char *name, + const struct smb_filename *smb_fname, uint32_t security_info, TALLOC_CTX *mem_ctx, struct security_descriptor **ppdesc) @@ -2335,8 +2335,11 @@ static NTSTATUS vfswrap_get_nt_acl(vfs_handle_struct *handle, NTSTATUS result; START_PROFILE(get_nt_acl); - result = posix_get_nt_acl(handle->conn, name, security_info, - mem_ctx, ppdesc); + result = posix_get_nt_acl(handle->conn, + smb_fname->base_name, + security_info, + mem_ctx, + ppdesc); END_PROFILE(get_nt_acl); return result; } diff --git a/source3/modules/vfs_full_audit.c b/source3/modules/vfs_full_audit.c index 904b56905ee..9c771852488 100644 --- a/source3/modules/vfs_full_audit.c +++ b/source3/modules/vfs_full_audit.c @@ -1897,18 +1897,18 @@ static NTSTATUS smb_full_audit_fget_nt_acl(vfs_handle_struct *handle, files_stru } static NTSTATUS smb_full_audit_get_nt_acl(vfs_handle_struct *handle, - const char *name, + const struct smb_filename *smb_fname, uint32_t security_info, TALLOC_CTX *mem_ctx, struct security_descriptor **ppdesc) { NTSTATUS result; - result = SMB_VFS_NEXT_GET_NT_ACL(handle, name, security_info, + result = SMB_VFS_NEXT_GET_NT_ACL(handle, smb_fname, security_info, mem_ctx, ppdesc); do_log(SMB_VFS_OP_GET_NT_ACL, NT_STATUS_IS_OK(result), handle, - "%s", name); + "%s", smb_fname_str_do_log(smb_fname)); return result; } diff --git a/source3/modules/vfs_media_harmony.c b/source3/modules/vfs_media_harmony.c index d960fae9fc5..65673e17fa4 100644 --- a/source3/modules/vfs_media_harmony.c +++ b/source3/modules/vfs_media_harmony.c @@ -2016,19 +2016,20 @@ out: * In this case, "name" is a path. */ static NTSTATUS mh_get_nt_acl(vfs_handle_struct *handle, - const char *name, + const struct smb_filename *smb_fname, uint32_t security_info, TALLOC_CTX *mem_ctx, struct security_descriptor **ppdesc) { NTSTATUS status; char *clientPath; + struct smb_filename *client_smb_fname = NULL; TALLOC_CTX *ctx; DEBUG(MH_INFO_DEBUG, ("Entering mh_get_nt_acl\n")); - if (!is_in_media_files(name)) + if (!is_in_media_files(smb_fname->base_name)) { - status = SMB_VFS_NEXT_GET_NT_ACL(handle, name, + status = SMB_VFS_NEXT_GET_NT_ACL(handle, smb_fname, security_info, mem_ctx, ppdesc); goto out; @@ -2038,18 +2039,28 @@ static NTSTATUS mh_get_nt_acl(vfs_handle_struct *handle, ctx = talloc_tos(); if (alloc_get_client_path(handle, ctx, - name, + smb_fname->base_name, &clientPath)) { status = map_nt_error_from_unix(errno); goto err; } - status = SMB_VFS_NEXT_GET_NT_ACL(handle, clientPath, + client_smb_fname = synthetic_smb_fname(talloc_tos(), + clientPath, + NULL, + NULL); + if (client_smb_fname == NULL) { + TALLOC_FREE(clientPath); + return NT_STATUS_NO_MEMORY; + } + + status = SMB_VFS_NEXT_GET_NT_ACL(handle, client_smb_fname, security_info, mem_ctx, ppdesc); err: TALLOC_FREE(clientPath); + TALLOC_FREE(client_smb_fname); out: return status; } diff --git a/source3/modules/vfs_nfs4acl_xattr.c b/source3/modules/vfs_nfs4acl_xattr.c index b0416998e34..c02fd6a829c 100644 --- a/source3/modules/vfs_nfs4acl_xattr.c +++ b/source3/modules/vfs_nfs4acl_xattr.c @@ -541,12 +541,14 @@ static NTSTATUS nfs4acl_xattr_fget_nt_acl(struct vfs_handle_struct *handle, } static NTSTATUS nfs4acl_xattr_get_nt_acl(struct vfs_handle_struct *handle, - const char *name, uint32_t security_info, + const struct smb_filename *smb_fname, + uint32_t security_info, TALLOC_CTX *mem_ctx, struct security_descriptor **ppdesc) { struct SMB4ACL_T *pacl; NTSTATUS status; + const char *name = smb_fname->base_name; TALLOC_CTX *frame = talloc_stackframe(); status = nfs4_get_nfs4_acl(handle, frame, name, &pacl); diff --git a/source3/modules/vfs_shadow_copy2.c b/source3/modules/vfs_shadow_copy2.c index 61ef5d49fb0..87b4cd2a791 100644 --- a/source3/modules/vfs_shadow_copy2.c +++ b/source3/modules/vfs_shadow_copy2.c @@ -1466,6 +1466,7 @@ static NTSTATUS shadow_copy2_fget_nt_acl(vfs_handle_struct *handle, char *stripped; NTSTATUS status; char *conv; + struct smb_filename *smb_fname = NULL; if (!shadow_copy2_strip_snapshot(talloc_tos(), handle, fsp->fsp_name->base_name, @@ -1482,14 +1483,24 @@ static NTSTATUS shadow_copy2_fget_nt_acl(vfs_handle_struct *handle, if (conv == NULL) { return map_nt_error_from_unix(errno); } - status = SMB_VFS_NEXT_GET_NT_ACL(handle, conv, security_info, + smb_fname = synthetic_smb_fname(talloc_tos(), + conv, + NULL, + NULL); + if (smb_fname == NULL) { + TALLOC_FREE(conv); + return NT_STATUS_NO_MEMORY; + } + + status = SMB_VFS_NEXT_GET_NT_ACL(handle, smb_fname, security_info, mem_ctx, ppdesc); TALLOC_FREE(conv); + TALLOC_FREE(smb_fname); return status; } static NTSTATUS shadow_copy2_get_nt_acl(vfs_handle_struct *handle, - const char *fname, + const struct smb_filename *smb_fname, uint32_t security_info, TALLOC_CTX *mem_ctx, struct security_descriptor **ppdesc) @@ -1498,13 +1509,17 @@ static NTSTATUS shadow_copy2_get_nt_acl(vfs_handle_struct *handle, char *stripped; NTSTATUS status; char *conv; + struct smb_filename *conv_smb_fname = NULL; - if (!shadow_copy2_strip_snapshot(talloc_tos(), handle, fname, - ×tamp, &stripped)) { + if (!shadow_copy2_strip_snapshot(talloc_tos(), + handle, + smb_fname->base_name, + ×tamp, + &stripped)) { return map_nt_error_from_unix(errno); } if (timestamp == 0) { - return SMB_VFS_NEXT_GET_NT_ACL(handle, fname, security_info, + return SMB_VFS_NEXT_GET_NT_ACL(handle, smb_fname, security_info, mem_ctx, ppdesc); } conv = shadow_copy2_convert(talloc_tos(), handle, stripped, timestamp); @@ -1512,9 +1527,18 @@ static NTSTATUS shadow_copy2_get_nt_acl(vfs_handle_struct *handle, if (conv == NULL) { return map_nt_error_from_unix(errno); } - status = SMB_VFS_NEXT_GET_NT_ACL(handle, conv, security_info, + conv_smb_fname = synthetic_smb_fname(talloc_tos(), + conv, + NULL, + NULL); + if (conv_smb_fname == NULL) { + TALLOC_FREE(conv); + return NT_STATUS_NO_MEMORY; + } + status = SMB_VFS_NEXT_GET_NT_ACL(handle, conv_smb_fname, security_info, mem_ctx, ppdesc); TALLOC_FREE(conv); + TALLOC_FREE(conv_smb_fname); return status; } diff --git a/source3/modules/vfs_time_audit.c b/source3/modules/vfs_time_audit.c index 2fc6afdfef6..6e0c8a4c2a8 100644 --- a/source3/modules/vfs_time_audit.c +++ b/source3/modules/vfs_time_audit.c @@ -1895,7 +1895,7 @@ static NTSTATUS smb_time_audit_fget_nt_acl(vfs_handle_struct *handle, } static NTSTATUS smb_time_audit_get_nt_acl(vfs_handle_struct *handle, - const char *name, + const struct smb_filename *smb_fname, uint32_t security_info, TALLOC_CTX *mem_ctx, struct security_descriptor **ppdesc) @@ -1905,13 +1905,15 @@ static NTSTATUS smb_time_audit_get_nt_acl(vfs_handle_struct *handle, double timediff; clock_gettime_mono(&ts1); - result = SMB_VFS_NEXT_GET_NT_ACL(handle, name, security_info, + result = SMB_VFS_NEXT_GET_NT_ACL(handle, smb_fname, security_info, mem_ctx, ppdesc); clock_gettime_mono(&ts2); timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9; if (timediff > audit_timeout) { - smb_time_audit_log_fname("get_nt_acl", timediff, name); + smb_time_audit_log_fname("get_nt_acl", + timediff, + smb_fname->base_name); } return result; diff --git a/source3/modules/vfs_unityed_media.c b/source3/modules/vfs_unityed_media.c index b4d7dc09b49..f53a13b60b4 100644 --- a/source3/modules/vfs_unityed_media.c +++ b/source3/modules/vfs_unityed_media.c @@ -1518,34 +1518,45 @@ err: */ static NTSTATUS um_get_nt_acl(vfs_handle_struct *handle, - const char *name, + const struct smb_filename *smb_fname, uint32_t security_info, TALLOC_CTX *mem_ctx, struct security_descriptor **ppdesc) { NTSTATUS status; char *client_path = NULL; + struct smb_filename *client_smb_fname = NULL; int ret; DEBUG(10, ("Entering um_get_nt_acl\n")); - if (!is_in_media_files(name)) { - return SMB_VFS_NEXT_GET_NT_ACL(handle, name, + if (!is_in_media_files(smb_fname->base_name)) { + return SMB_VFS_NEXT_GET_NT_ACL(handle, smb_fname, security_info, mem_ctx, ppdesc); } ret = alloc_get_client_path(handle, talloc_tos(), - name, &client_path); + smb_fname->base_name, &client_path); if (ret != 0) { status = map_nt_error_from_unix(errno); goto err; } - status = SMB_VFS_NEXT_GET_NT_ACL(handle, client_path, + client_smb_fname = synthetic_smb_fname(talloc_tos(), + client_path, + NULL, + NULL); + if (client_smb_fname == NULL) { + TALLOC_FREE(client_path); + return NT_STATUS_NO_MEMORY; + } + + status = SMB_VFS_NEXT_GET_NT_ACL(handle, client_smb_fname, security_info, mem_ctx, ppdesc); err: + TALLOC_FREE(client_smb_fname); TALLOC_FREE(client_path); return status; } |