From: Jeremy Allison Date: Wed, 24 May 2017 00:35:59 +0000 (-0700) Subject: s3: VFS: Change SMB_VFS_SYS_ACL_BLOB_GET_FILE to use const struct smb_filename *... X-Git-Tag: ldb-1.1.31~180 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f5dd864606d5e587b85695ea11520df31b353fb8;p=thirdparty%2Fsamba.git s3: VFS: Change SMB_VFS_SYS_ACL_BLOB_GET_FILE to use const struct smb_filename * instead of const char *. 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 Reviewed-by: Ralph Boehme --- diff --git a/examples/VFS/skel_opaque.c b/examples/VFS/skel_opaque.c index b0be73c9c06..8ecd0bef473 100644 --- a/examples/VFS/skel_opaque.c +++ b/examples/VFS/skel_opaque.c @@ -757,8 +757,10 @@ static SMB_ACL_T skel_sys_acl_get_fd(vfs_handle_struct *handle, } static int skel_sys_acl_blob_get_file(vfs_handle_struct *handle, - const char *path_p, TALLOC_CTX *mem_ctx, - char **blob_description, DATA_BLOB *blob) + const struct smb_filename *smb_fname, + TALLOC_CTX *mem_ctx, + char **blob_description, + DATA_BLOB *blob) { errno = ENOSYS; return -1; diff --git a/examples/VFS/skel_transparent.c b/examples/VFS/skel_transparent.c index d103695eebf..82d3c37408c 100644 --- a/examples/VFS/skel_transparent.c +++ b/examples/VFS/skel_transparent.c @@ -895,10 +895,12 @@ static SMB_ACL_T skel_sys_acl_get_fd(vfs_handle_struct *handle, } static int skel_sys_acl_blob_get_file(vfs_handle_struct *handle, - const char *path_p, TALLOC_CTX *mem_ctx, - char **blob_description, DATA_BLOB *blob) + const struct smb_filename *smb_fname, + TALLOC_CTX *mem_ctx, + char **blob_description, + DATA_BLOB *blob) { - return SMB_VFS_NEXT_SYS_ACL_BLOB_GET_FILE(handle, path_p, mem_ctx, + return SMB_VFS_NEXT_SYS_ACL_BLOB_GET_FILE(handle, smb_fname, mem_ctx, blob_description, blob); } diff --git a/source3/include/vfs.h b/source3/include/vfs.h index 330a819a98a..e32952a582a 100644 --- a/source3/include/vfs.h +++ b/source3/include/vfs.h @@ -201,6 +201,8 @@ to const struct smb_filename * */ /* Version 37 - Change sys_acl_get_file from const char * to const struct smb_filename * */ +/* Version 37 - Change sys_acl_blob_get_file from const char * + to const struct smb_filename * */ #define SMB_VFS_INTERFACE_VERSION 37 @@ -867,7 +869,7 @@ struct vfs_fn_pointers { struct files_struct *fsp, TALLOC_CTX *mem_ctx); int (*sys_acl_blob_get_file_fn)(struct vfs_handle_struct *handle, - const char *path_p, + const struct smb_filename *smb_fname, TALLOC_CTX *mem_ctx, char **blob_description, DATA_BLOB *blob); @@ -1323,7 +1325,7 @@ SMB_ACL_T smb_vfs_call_sys_acl_get_fd(struct vfs_handle_struct *handle, struct files_struct *fsp, TALLOC_CTX *mem_ctx); int smb_vfs_call_sys_acl_blob_get_file(struct vfs_handle_struct *handle, - const char *path_p, + const struct smb_filename *smb_fname, TALLOC_CTX *mem_ctx, char **blob_description, DATA_BLOB *blob); diff --git a/source3/include/vfs_macros.h b/source3/include/vfs_macros.h index 68581818d7b..0ca601a89ab 100644 --- a/source3/include/vfs_macros.h +++ b/source3/include/vfs_macros.h @@ -490,10 +490,10 @@ #define SMB_VFS_NEXT_SYS_ACL_GET_FD(handle, fsp, mem_ctx) \ smb_vfs_call_sys_acl_get_fd((handle)->next, (fsp), (mem_ctx)) -#define SMB_VFS_SYS_ACL_BLOB_GET_FILE(conn, path_p, mem_ctx, blob_description, blob) \ - smb_vfs_call_sys_acl_blob_get_file((conn)->vfs_handles, (path_p), (mem_ctx), (blob_description), (blob)) -#define SMB_VFS_NEXT_SYS_ACL_BLOB_GET_FILE(handle, path_p, mem_ctx, blob_description, blob) \ - smb_vfs_call_sys_acl_blob_get_file((handle)->next, (path_p), (mem_ctx), (blob_description), (blob)) +#define SMB_VFS_SYS_ACL_BLOB_GET_FILE(conn, smb_fname, mem_ctx, blob_description, blob) \ + smb_vfs_call_sys_acl_blob_get_file((conn)->vfs_handles, (smb_fname), (mem_ctx), (blob_description), (blob)) +#define SMB_VFS_NEXT_SYS_ACL_BLOB_GET_FILE(handle, smb_fname, mem_ctx, blob_description, blob) \ + smb_vfs_call_sys_acl_blob_get_file((handle)->next, (smb_fname), (mem_ctx), (blob_description), (blob)) #define SMB_VFS_SYS_ACL_BLOB_GET_FD(fsp, mem_ctx, blob_description, blob) \ smb_vfs_call_sys_acl_blob_get_fd((fsp)->conn->vfs_handles, (fsp), (mem_ctx), (blob_description), (blob)) diff --git a/source3/modules/non_posix_acls.c b/source3/modules/non_posix_acls.c index 8d3be72223d..45378796caf 100644 --- a/source3/modules/non_posix_acls.c +++ b/source3/modules/non_posix_acls.c @@ -22,20 +22,19 @@ #include "modules/non_posix_acls.h" int non_posix_sys_acl_blob_get_file_helper(vfs_handle_struct *handle, - const char *path_p, - DATA_BLOB acl_as_blob, - TALLOC_CTX *mem_ctx, - DATA_BLOB *blob) + const struct smb_filename *smb_fname_in, + DATA_BLOB acl_as_blob, + TALLOC_CTX *mem_ctx, + DATA_BLOB *blob) { int ret; TALLOC_CTX *frame = talloc_stackframe(); struct xattr_sys_acl_hash_wrapper acl_wrapper = {}; - struct smb_filename *smb_fname; + struct smb_filename *smb_fname = cp_smb_filename_nostream(frame, + smb_fname_in); - smb_fname = synthetic_smb_fname(frame, path_p, NULL, NULL, 0); if (smb_fname == NULL) { TALLOC_FREE(frame); - errno = ENOMEM; return -1; } diff --git a/source3/modules/non_posix_acls.h b/source3/modules/non_posix_acls.h index 6567a317ff7..8924810c04d 100644 --- a/source3/modules/non_posix_acls.h +++ b/source3/modules/non_posix_acls.h @@ -18,7 +18,7 @@ */ int non_posix_sys_acl_blob_get_file_helper(vfs_handle_struct *handle, - const char *path_p, + const struct smb_filename *smb_fname, DATA_BLOB acl_as_blob, TALLOC_CTX *mem_ctx, DATA_BLOB *blob); diff --git a/source3/modules/vfs_acl_common.c b/source3/modules/vfs_acl_common.c index fa65fd19cfd..bd1d755c91f 100644 --- a/source3/modules/vfs_acl_common.c +++ b/source3/modules/vfs_acl_common.c @@ -711,7 +711,7 @@ static NTSTATUS validate_nt_acl_blob(TALLOC_CTX *mem_ctx, } else { /* Get the full underlying sd, then hash. */ ret = SMB_VFS_NEXT_SYS_ACL_BLOB_GET_FILE(handle, - smb_fname->base_name, + smb_fname, mem_ctx, &sys_acl_blob_description, &sys_acl_blob); diff --git a/source3/modules/vfs_afsacl.c b/source3/modules/vfs_afsacl.c index f34495b87bc..ce789f01375 100644 --- a/source3/modules/vfs_afsacl.c +++ b/source3/modules/vfs_afsacl.c @@ -1085,7 +1085,11 @@ static int afsacl_connect(vfs_handle_struct *handle, } /* We don't have a linear form of the AFS ACL yet */ -static int afsacl_sys_acl_blob_get_file(vfs_handle_struct *handle, const char *path_p, TALLOC_CTX *mem_ctx, char **blob_description, DATA_BLOB *blob) +static int afsacl_sys_acl_blob_get_file(vfs_handle_struct *handle, + const struct smb_filename *smb_fname, + TALLOC_CTX *mem_ctx, + char **blob_description, + DATA_BLOB *blob) { errno = ENOSYS; return -1; diff --git a/source3/modules/vfs_aixacl2.c b/source3/modules/vfs_aixacl2.c index de5b333423b..8613b59ccc6 100644 --- a/source3/modules/vfs_aixacl2.c +++ b/source3/modules/vfs_aixacl2.c @@ -221,16 +221,21 @@ static NTSTATUS aixjfs2_get_nt_acl(vfs_handle_struct *handle, pacl); } -static int aixjfs2_sys_acl_blob_get_file(vfs_handle_struct *handle, const char *path_p, TALLOC_CTX *mem_ctx, char **blob_description, DATA_BLOB *blob) +static int aixjfs2_sys_acl_blob_get_file(vfs_handle_struct *handle, + const struct smb_filename *smb_fname, + TALLOC_CTX *mem_ctx, + char **blob_description, + DATA_BLOB *blob) { struct SMB4ACL_T *pacl = NULL; + const char *path_p = smb_fname->base_name; bool result; bool retryPosix = False; result = aixjfs2_get_nfs4_acl(mem_ctx, path_p, &pacl, &retryPosix); if (retryPosix) { - return posix_sys_acl_blob_get_file(handle, path_p, mem_ctx, + return posix_sys_acl_blob_get_file(handle, smb_fname, mem_ctx, blob_description, blob); } /* Now way to linarlise NFS4 ACLs at the moment, but the NT ACL is pretty close in this case */ diff --git a/source3/modules/vfs_full_audit.c b/source3/modules/vfs_full_audit.c index 932dbf803a6..6d281d88c90 100644 --- a/source3/modules/vfs_full_audit.c +++ b/source3/modules/vfs_full_audit.c @@ -2181,17 +2181,18 @@ static SMB_ACL_T smb_full_audit_sys_acl_get_fd(vfs_handle_struct *handle, } static int smb_full_audit_sys_acl_blob_get_file(vfs_handle_struct *handle, - const char *path_p, - TALLOC_CTX *mem_ctx, - char **blob_description, - DATA_BLOB *blob) + const struct smb_filename *smb_fname, + TALLOC_CTX *mem_ctx, + char **blob_description, + DATA_BLOB *blob) { int result; - result = SMB_VFS_NEXT_SYS_ACL_BLOB_GET_FILE(handle, path_p, mem_ctx, blob_description, blob); + result = SMB_VFS_NEXT_SYS_ACL_BLOB_GET_FILE(handle, smb_fname, + mem_ctx, blob_description, blob); do_log(SMB_VFS_OP_SYS_ACL_BLOB_GET_FILE, (result >= 0), handle, - "%s", path_p); + "%s", smb_fname->base_name); return result; } diff --git a/source3/modules/vfs_gpfs.c b/source3/modules/vfs_gpfs.c index 37568ab6efe..87ddf5de413 100644 --- a/source3/modules/vfs_gpfs.c +++ b/source3/modules/vfs_gpfs.c @@ -1011,7 +1011,7 @@ static SMB_ACL_T gpfsacl_sys_acl_get_fd(vfs_handle_struct *handle, } static int gpfsacl_sys_acl_blob_get_file(vfs_handle_struct *handle, - const char *path_p, + const struct smb_filename *smb_fname, TALLOC_CTX *mem_ctx, char **blob_description, DATA_BLOB *blob) @@ -1020,13 +1020,14 @@ static int gpfsacl_sys_acl_blob_get_file(vfs_handle_struct *handle, struct gpfs_opaque_acl *acl = NULL; DATA_BLOB aclblob; int result; + const char *path_p = smb_fname->base_name; SMB_VFS_HANDLE_GET_DATA(handle, config, struct gpfs_config_data, return -1); if (!config->acl) { - return SMB_VFS_NEXT_SYS_ACL_BLOB_GET_FILE(handle, path_p, + return SMB_VFS_NEXT_SYS_ACL_BLOB_GET_FILE(handle, smb_fname, mem_ctx, blob_description, blob); @@ -1068,7 +1069,7 @@ static int gpfsacl_sys_acl_blob_get_file(vfs_handle_struct *handle, return -1; } - result = non_posix_sys_acl_blob_get_file_helper(handle, path_p, + result = non_posix_sys_acl_blob_get_file_helper(handle, smb_fname, aclblob, mem_ctx, blob); @@ -1077,7 +1078,7 @@ static int gpfsacl_sys_acl_blob_get_file(vfs_handle_struct *handle, } /* fall back to POSIX ACL */ - return posix_sys_acl_blob_get_file(handle, path_p, mem_ctx, + return posix_sys_acl_blob_get_file(handle, smb_fname, mem_ctx, blob_description, blob); } diff --git a/source3/modules/vfs_nfs4acl_xattr.c b/source3/modules/vfs_nfs4acl_xattr.c index 3975f80a941..a0c4af7ec6b 100644 --- a/source3/modules/vfs_nfs4acl_xattr.c +++ b/source3/modules/vfs_nfs4acl_xattr.c @@ -620,7 +620,11 @@ static int nfs4acl_xattr_fail__sys_acl_delete_def_file(vfs_handle_struct *handle return -1; } -static int nfs4acl_xattr_fail__sys_acl_blob_get_file(vfs_handle_struct *handle, const char *path_p, TALLOC_CTX *mem_ctx, char **blob_description, DATA_BLOB *blob) +static int nfs4acl_xattr_fail__sys_acl_blob_get_file(vfs_handle_struct *handle, + const struct smb_filename *smb_fname, + TALLOC_CTX *mem_ctx, + char **blob_description, + DATA_BLOB *blob) { return -1; } diff --git a/source3/modules/vfs_time_audit.c b/source3/modules/vfs_time_audit.c index 033dabe4671..d62df373269 100644 --- a/source3/modules/vfs_time_audit.c +++ b/source3/modules/vfs_time_audit.c @@ -2213,17 +2213,18 @@ static SMB_ACL_T smb_time_audit_sys_acl_get_fd(vfs_handle_struct *handle, static int smb_time_audit_sys_acl_blob_get_file(vfs_handle_struct *handle, - const char *path_p, - TALLOC_CTX *mem_ctx, - char **blob_description, - DATA_BLOB *blob) + const struct smb_filename *smb_fname, + TALLOC_CTX *mem_ctx, + char **blob_description, + DATA_BLOB *blob) { int result; struct timespec ts1,ts2; double timediff; clock_gettime_mono(&ts1); - result = SMB_VFS_NEXT_SYS_ACL_BLOB_GET_FILE(handle, path_p, mem_ctx, blob_description, blob); + result = SMB_VFS_NEXT_SYS_ACL_BLOB_GET_FILE(handle, smb_fname, + mem_ctx, blob_description, blob); clock_gettime_mono(&ts2); timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9; diff --git a/source3/modules/vfs_zfsacl.c b/source3/modules/vfs_zfsacl.c index 57e4182aff7..cf341da371e 100644 --- a/source3/modules/vfs_zfsacl.c +++ b/source3/modules/vfs_zfsacl.c @@ -319,7 +319,11 @@ static int zfsacl_fail__sys_acl_delete_def_file(vfs_handle_struct *handle, return -1; } -static int zfsacl_fail__sys_acl_blob_get_file(vfs_handle_struct *handle, const char *path_p, TALLOC_CTX *mem_ctx, char **blob_description, DATA_BLOB *blob) +static int zfsacl_fail__sys_acl_blob_get_file(vfs_handle_struct *handle, + const struct smb_filename *smb_fname, + TALLOC_CTX *mem_ctx, + char **blob_description, + DATA_BLOB *blob) { return -1; } diff --git a/source3/smbd/posix_acls.c b/source3/smbd/posix_acls.c index 4f0540b90a5..07e0584003c 100644 --- a/source3/smbd/posix_acls.c +++ b/source3/smbd/posix_acls.c @@ -4734,7 +4734,7 @@ NTSTATUS get_nt_acl_no_snum(TALLOC_CTX *ctx, const char *fname, } int posix_sys_acl_blob_get_file(vfs_handle_struct *handle, - const char *path_p, + const struct smb_filename *smb_fname_in, TALLOC_CTX *mem_ctx, char **blob_description, DATA_BLOB *blob) @@ -4745,9 +4745,8 @@ int posix_sys_acl_blob_get_file(vfs_handle_struct *handle, struct smb_acl_wrapper acl_wrapper = { NULL }; - struct smb_filename *smb_fname; - - smb_fname = synthetic_smb_fname(frame, path_p, NULL, NULL, 0); + struct smb_filename *smb_fname = cp_smb_filename_nostream(frame, + smb_fname_in); if (smb_fname == NULL) { TALLOC_FREE(frame); errno = ENOMEM; @@ -4810,8 +4809,11 @@ int posix_sys_acl_blob_get_fd(vfs_handle_struct *handle, /* This ensures that we also consider the default ACL */ if (fsp->is_directory || fsp->fh->fd == -1) { - return posix_sys_acl_blob_get_file(handle, fsp->fsp_name->base_name, - mem_ctx, blob_description, blob); + return posix_sys_acl_blob_get_file(handle, + fsp->fsp_name, + mem_ctx, + blob_description, + blob); } frame = talloc_stackframe(); diff --git a/source3/smbd/proto.h b/source3/smbd/proto.h index 556fb6b2f5b..06d2461839b 100644 --- a/source3/smbd/proto.h +++ b/source3/smbd/proto.h @@ -800,7 +800,7 @@ NTSTATUS get_nt_acl_no_snum( TALLOC_CTX *ctx, const char *fname, uint32_t security_info_wanted, struct security_descriptor **sd); int posix_sys_acl_blob_get_file(vfs_handle_struct *handle, - const char *path_p, + const struct smb_filename *smb_fname, TALLOC_CTX *mem_ctx, char **blob_description, DATA_BLOB *blob); diff --git a/source3/smbd/vfs.c b/source3/smbd/vfs.c index 82d0485416e..8dd84a21eda 100644 --- a/source3/smbd/vfs.c +++ b/source3/smbd/vfs.c @@ -2458,13 +2458,14 @@ SMB_ACL_T smb_vfs_call_sys_acl_get_fd(struct vfs_handle_struct *handle, } int smb_vfs_call_sys_acl_blob_get_file(struct vfs_handle_struct *handle, - const char *path_p, - TALLOC_CTX *mem_ctx, - char **blob_description, - DATA_BLOB *blob) + const struct smb_filename *smb_fname, + TALLOC_CTX *mem_ctx, + char **blob_description, + DATA_BLOB *blob) { VFS_FIND(sys_acl_blob_get_file); - return handle->fns->sys_acl_blob_get_file_fn(handle, path_p, mem_ctx, blob_description, blob); + return handle->fns->sys_acl_blob_get_file_fn(handle, smb_fname, + mem_ctx, blob_description, blob); } int smb_vfs_call_sys_acl_blob_get_fd(struct vfs_handle_struct *handle, diff --git a/source3/torture/cmd_vfs.c b/source3/torture/cmd_vfs.c index 390cffa34e4..0bb29035972 100644 --- a/source3/torture/cmd_vfs.c +++ b/source3/torture/cmd_vfs.c @@ -1718,13 +1718,20 @@ static NTSTATUS cmd_sys_acl_blob_get_file(struct vfs_state *vfs, DATA_BLOB blob; int ret; size_t i; + struct smb_filename *smb_fname = NULL; if (argc != 2) { printf("Usage: sys_acl_get_file \n"); return NT_STATUS_OK; } - ret = SMB_VFS_SYS_ACL_BLOB_GET_FILE(vfs->conn, argv[1], talloc_tos(), + smb_fname = synthetic_smb_fname_split(talloc_tos(), + argv[1], + lp_posix_pathnames()); + if (smb_fname == NULL) { + return NT_STATUS_NO_MEMORY; + } + ret = SMB_VFS_SYS_ACL_BLOB_GET_FILE(vfs->conn, smb_fname, talloc_tos(), &description, &blob); if (ret != 0) { printf("sys_acl_blob_get_file failed (%s)\n", strerror(errno));