diff options
author | Jeremy Allison <jra@samba.org> | 2017-05-24 10:47:46 -0700 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2017-05-31 22:50:22 +0200 |
commit | aada94885dce29334e34c9aae32c22e7acfc1174 (patch) | |
tree | 9d8537532716da3435d583081182361d01588eae /source3/modules | |
parent | f5dd864606d5e587b85695ea11520df31b353fb8 (diff) | |
download | samba-aada94885dce29334e34c9aae32c22e7acfc1174.tar.gz |
s3: VFS: Change SMB_VFS_SYS_ACL_SET_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 <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Diffstat (limited to 'source3/modules')
26 files changed, 195 insertions, 104 deletions
diff --git a/source3/modules/posixacl_xattr.c b/source3/modules/posixacl_xattr.c index ded16a0bfba..416295fc6a8 100644 --- a/source3/modules/posixacl_xattr.c +++ b/source3/modules/posixacl_xattr.c @@ -444,7 +444,7 @@ SMB_ACL_T posixacl_xattr_acl_get_fd(vfs_handle_struct *handle, } int posixacl_xattr_acl_set_file(vfs_handle_struct *handle, - const char *path_p, + const struct smb_filename *smb_fname, SMB_ACL_TYPE_T type, SMB_ACL_T theacl) { @@ -474,7 +474,8 @@ int posixacl_xattr_acl_set_file(vfs_handle_struct *handle, return -1; } - return SMB_VFS_SETXATTR(handle->conn, path_p, name, buf, size, 0); + return SMB_VFS_SETXATTR(handle->conn, smb_fname->base_name, + name, buf, size, 0); } int posixacl_xattr_acl_set_fd(vfs_handle_struct *handle, diff --git a/source3/modules/posixacl_xattr.h b/source3/modules/posixacl_xattr.h index 8751692f571..70962dd3115 100644 --- a/source3/modules/posixacl_xattr.h +++ b/source3/modules/posixacl_xattr.h @@ -31,7 +31,7 @@ SMB_ACL_T posixacl_xattr_acl_get_fd(vfs_handle_struct *handle, TALLOC_CTX *mem_ctx); int posixacl_xattr_acl_set_file(vfs_handle_struct *handle, - const char *name, + const struct smb_filename *smb_fname, SMB_ACL_TYPE_T type, SMB_ACL_T theacl); diff --git a/source3/modules/vfs_acl_tdb.c b/source3/modules/vfs_acl_tdb.c index 68abc33012c..817add71fb9 100644 --- a/source3/modules/vfs_acl_tdb.c +++ b/source3/modules/vfs_acl_tdb.c @@ -246,7 +246,7 @@ static int unlink_acl_tdb(vfs_handle_struct *handle, struct db_context *db = acl_db; int ret = -1; - smb_fname_tmp = cp_smb_filename(talloc_tos(), smb_fname); + smb_fname_tmp = cp_smb_filename_nostream(talloc_tos(), smb_fname); if (smb_fname_tmp == NULL) { errno = ENOMEM; goto out; @@ -383,31 +383,44 @@ static int connect_acl_tdb(struct vfs_handle_struct *handle, *********************************************************************/ static int sys_acl_set_file_tdb(vfs_handle_struct *handle, - const char *path, - SMB_ACL_TYPE_T type, - SMB_ACL_T theacl) + const struct smb_filename *smb_fname_in, + SMB_ACL_TYPE_T type, + SMB_ACL_T theacl) { struct db_context *db = acl_db; int ret = -1; - struct smb_filename smb_fname = { - .base_name = discard_const_p(char, path) + int saved_errno = 0; + struct smb_filename *smb_fname = NULL; + + smb_fname = cp_smb_filename_nostream(talloc_tos(), smb_fname_in); + if (smb_fname == NULL) { + return -1; }; - ret = SMB_VFS_STAT(handle->conn, &smb_fname); + ret = SMB_VFS_STAT(handle->conn, smb_fname); if (ret == -1) { - return -1; + saved_errno = errno; + goto fail; } ret = SMB_VFS_NEXT_SYS_ACL_SET_FILE(handle, - path, + smb_fname, type, theacl); if (ret == -1) { - return -1; + saved_errno = errno; + goto fail; } - acl_tdb_delete(handle, db, &smb_fname.st); - return 0; + acl_tdb_delete(handle, db, &smb_fname->st); + +fail: + TALLOC_FREE(smb_fname); + + if (saved_errno != 0) { + errno = saved_errno; + } + return ret; } /********************************************************************* diff --git a/source3/modules/vfs_acl_xattr.c b/source3/modules/vfs_acl_xattr.c index 96bd0166655..1dc70824bf5 100644 --- a/source3/modules/vfs_acl_xattr.c +++ b/source3/modules/vfs_acl_xattr.c @@ -168,12 +168,12 @@ static NTSTATUS store_acl_blob_fsp(vfs_handle_struct *handle, *********************************************************************/ static int sys_acl_set_file_xattr(vfs_handle_struct *handle, - const char *name, - SMB_ACL_TYPE_T type, - SMB_ACL_T theacl) + const struct smb_filename *smb_fname, + SMB_ACL_TYPE_T type, + SMB_ACL_T theacl) { int ret = SMB_VFS_NEXT_SYS_ACL_SET_FILE(handle, - name, + smb_fname, type, theacl); if (ret == -1) { @@ -181,7 +181,8 @@ static int sys_acl_set_file_xattr(vfs_handle_struct *handle, } become_root(); - SMB_VFS_REMOVEXATTR(handle->conn, name, XATTR_NTACL_NAME); + SMB_VFS_REMOVEXATTR(handle->conn, smb_fname->base_name, + XATTR_NTACL_NAME); unbecome_root(); return ret; diff --git a/source3/modules/vfs_aixacl.c b/source3/modules/vfs_aixacl.c index 024c9aa2691..f6c42cb40b5 100644 --- a/source3/modules/vfs_aixacl.c +++ b/source3/modules/vfs_aixacl.c @@ -134,9 +134,9 @@ SMB_ACL_T aixacl_sys_acl_get_fd(vfs_handle_struct *handle, } int aixacl_sys_acl_set_file(vfs_handle_struct *handle, - const char *name, - SMB_ACL_TYPE_T type, - SMB_ACL_T theacl) + const struct smb_filename *smb_fname, + SMB_ACL_TYPE_T type, + SMB_ACL_T theacl) { struct acl *file_acl = NULL; unsigned int rc; @@ -145,7 +145,7 @@ int aixacl_sys_acl_set_file(vfs_handle_struct *handle, if (!file_acl) return -1; - rc = chacl((char *)name,file_acl,file_acl->acl_len); + rc = chacl((char *)smb_fname->base_name,file_acl,file_acl->acl_len); DEBUG(10,("errno is %d\n",errno)); DEBUG(10,("return code is %d\n",rc)); SAFE_FREE(file_acl); diff --git a/source3/modules/vfs_aixacl2.c b/source3/modules/vfs_aixacl2.c index 8613b59ccc6..2e4b61e369d 100644 --- a/source3/modules/vfs_aixacl2.c +++ b/source3/modules/vfs_aixacl2.c @@ -468,9 +468,9 @@ NTSTATUS aixjfs2_fset_nt_acl(vfs_handle_struct *handle, files_struct *fsp, uint3 } int aixjfs2_sys_acl_set_file(vfs_handle_struct *handle, - const char *name, - SMB_ACL_TYPE_T type, - SMB_ACL_T theacl) + const struct smb_filename *smb_fname, + SMB_ACL_TYPE_T type, + SMB_ACL_T theacl) { struct acl *acl_aixc; acl_type_t acl_type_info; @@ -478,7 +478,8 @@ int aixjfs2_sys_acl_set_file(vfs_handle_struct *handle, DEBUG(10, ("aixjfs2_sys_acl_set_file invoked for %s", name)); - rc = aixjfs2_query_acl_support((char *)name, ACL_AIXC, &acl_type_info); + rc = aixjfs2_query_acl_support((char *)smb_fname->base_name, + ACL_AIXC, &acl_type_info); if (rc) { DEBUG(8, ("jfs2_set_nt_acl: AIXC support not found\n")); return -1; @@ -498,7 +499,7 @@ int aixjfs2_sys_acl_set_file(vfs_handle_struct *handle, ); if (rc) { DEBUG(2, ("aclx_put failed with %s for %s\n", - strerror(errno), name)); + strerror(errno), smb_fname->base_name)); return -1; } diff --git a/source3/modules/vfs_cap.c b/source3/modules/vfs_cap.c index 8aba4314fcb..8d621ccec5e 100644 --- a/source3/modules/vfs_cap.c +++ b/source3/modules/vfs_cap.c @@ -581,15 +581,41 @@ static SMB_ACL_T cap_sys_acl_get_file(vfs_handle_struct *handle, return ret; } -static int cap_sys_acl_set_file(vfs_handle_struct *handle, const char *path, SMB_ACL_TYPE_T acltype, SMB_ACL_T theacl) +static int cap_sys_acl_set_file(vfs_handle_struct *handle, + const struct smb_filename *smb_fname, + SMB_ACL_TYPE_T acltype, + SMB_ACL_T theacl) { - 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_SET_FILE(handle, cappath, acltype, theacl); + 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_SET_FILE(handle, cap_smb_fname, + acltype, theacl); + if (ret == -1) { + saved_errno = errno; + } + TALLOC_FREE(cappath); + TALLOC_FREE(cap_smb_fname); + if (saved_errno != 0) { + errno = saved_errno; + } + return ret; } static int cap_sys_acl_delete_def_file(vfs_handle_struct *handle, diff --git a/source3/modules/vfs_catia.c b/source3/modules/vfs_catia.c index 18dbc80cd87..24fc26d122f 100644 --- a/source3/modules/vfs_catia.c +++ b/source3/modules/vfs_catia.c @@ -1291,24 +1291,46 @@ catia_sys_acl_get_file(vfs_handle_struct *handle, static int catia_sys_acl_set_file(vfs_handle_struct *handle, - const char *path, - SMB_ACL_TYPE_T type, - SMB_ACL_T theacl) + const struct smb_filename *smb_fname, + SMB_ACL_TYPE_T type, + SMB_ACL_T theacl) { + 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_SET_FILE(handle, mapped_name, type, theacl); - TALLOC_FREE(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_SET_FILE(handle, mapped_smb_fname, + type, theacl); + if (ret == -1) { + saved_errno = errno; + } + TALLOC_FREE(mapped_smb_fname); + TALLOC_FREE(mapped_name); + if (saved_errno != 0) { + errno = saved_errno; + } return ret; } diff --git a/source3/modules/vfs_default.c b/source3/modules/vfs_default.c index c3de3d7572d..ad47f38105f 100644 --- a/source3/modules/vfs_default.c +++ b/source3/modules/vfs_default.c @@ -2724,9 +2724,12 @@ static SMB_ACL_T vfswrap_sys_acl_get_fd(vfs_handle_struct *handle, return sys_acl_get_fd(handle, fsp, mem_ctx); } -static int vfswrap_sys_acl_set_file(vfs_handle_struct *handle, const char *name, SMB_ACL_TYPE_T acltype, SMB_ACL_T theacl) +static int vfswrap_sys_acl_set_file(vfs_handle_struct *handle, + const struct smb_filename *smb_fname, + SMB_ACL_TYPE_T acltype, + SMB_ACL_T theacl) { - return sys_acl_set_file(handle, name, acltype, theacl); + return sys_acl_set_file(handle, smb_fname, acltype, theacl); } static int vfswrap_sys_acl_set_fd(vfs_handle_struct *handle, files_struct *fsp, SMB_ACL_T theacl) diff --git a/source3/modules/vfs_fake_acls.c b/source3/modules/vfs_fake_acls.c index cb8d12395cc..fc655c874eb 100644 --- a/source3/modules/vfs_fake_acls.c +++ b/source3/modules/vfs_fake_acls.c @@ -316,7 +316,10 @@ static SMB_ACL_T fake_acls_sys_acl_get_fd(struct vfs_handle_struct *handle, } -static int fake_acls_sys_acl_set_file(vfs_handle_struct *handle, const char *path, SMB_ACL_TYPE_T acltype, SMB_ACL_T theacl) +static int fake_acls_sys_acl_set_file(vfs_handle_struct *handle, + const struct smb_filename *smb_fname, + SMB_ACL_TYPE_T acltype, + SMB_ACL_T theacl) { int ret; const char *name = NULL; @@ -336,7 +339,8 @@ static int fake_acls_sys_acl_set_file(vfs_handle_struct *handle, const char *pat name = FAKE_ACL_DEFAULT_XATTR; break; } - ret = SMB_VFS_NEXT_SETXATTR(handle, path, name, blob.data, blob.length, 0); + ret = SMB_VFS_NEXT_SETXATTR(handle, smb_fname->base_name, + name, blob.data, blob.length, 0); TALLOC_FREE(frame); return ret; } diff --git a/source3/modules/vfs_full_audit.c b/source3/modules/vfs_full_audit.c index 6d281d88c90..07f01c27e99 100644 --- a/source3/modules/vfs_full_audit.c +++ b/source3/modules/vfs_full_audit.c @@ -2214,17 +2214,17 @@ static int smb_full_audit_sys_acl_blob_get_fd(vfs_handle_struct *handle, } static int smb_full_audit_sys_acl_set_file(vfs_handle_struct *handle, - - const char *name, SMB_ACL_TYPE_T acltype, - SMB_ACL_T theacl) + const struct smb_filename *smb_fname, + SMB_ACL_TYPE_T acltype, + SMB_ACL_T theacl) { int result; - result = SMB_VFS_NEXT_SYS_ACL_SET_FILE(handle, name, acltype, + result = SMB_VFS_NEXT_SYS_ACL_SET_FILE(handle, smb_fname, acltype, theacl); do_log(SMB_VFS_OP_SYS_ACL_SET_FILE, (result >= 0), handle, - "%s", name); + "%s", smb_fname->base_name); return result; } diff --git a/source3/modules/vfs_gpfs.c b/source3/modules/vfs_gpfs.c index 87ddf5de413..4dc9f76a42d 100644 --- a/source3/modules/vfs_gpfs.c +++ b/source3/modules/vfs_gpfs.c @@ -1233,7 +1233,7 @@ static struct gpfs_acl *smb2gpfs_acl(const SMB_ACL_T pacl, } static int gpfsacl_sys_acl_set_file(vfs_handle_struct *handle, - const char *name, + const struct smb_filename *smb_fname, SMB_ACL_TYPE_T type, SMB_ACL_T theacl) { @@ -1246,7 +1246,8 @@ static int gpfsacl_sys_acl_set_file(vfs_handle_struct *handle, return -1); if (!config->acl) { - return SMB_VFS_NEXT_SYS_ACL_SET_FILE(handle, name, type, theacl); + return SMB_VFS_NEXT_SYS_ACL_SET_FILE(handle, smb_fname, + type, theacl); } gpfs_acl = smb2gpfs_acl(theacl, type); @@ -1254,7 +1255,7 @@ static int gpfsacl_sys_acl_set_file(vfs_handle_struct *handle, return -1; } - result = gpfswrap_putacl(discard_const_p(char, name), + result = gpfswrap_putacl(discard_const_p(char, smb_fname->base_name), GPFS_PUTACL_STRUCT|GPFS_ACL_SAMBA, gpfs_acl); SAFE_FREE(gpfs_acl); diff --git a/source3/modules/vfs_hpuxacl.c b/source3/modules/vfs_hpuxacl.c index c344cb95fde..53e0ad6fe80 100644 --- a/source3/modules/vfs_hpuxacl.c +++ b/source3/modules/vfs_hpuxacl.c @@ -209,7 +209,7 @@ SMB_ACL_T hpuxacl_sys_acl_get_fd(vfs_handle_struct *handle, int hpuxacl_sys_acl_set_file(vfs_handle_struct *handle, - const char *name, + const struct smb_filename *smb_fname_in, SMB_ACL_TYPE_T type, SMB_ACL_T theacl) { @@ -222,7 +222,7 @@ int hpuxacl_sys_acl_set_file(vfs_handle_struct *handle, DEBUG(10, ("hpuxacl_sys_acl_set_file called for file '%s'\n", name)); - smb_fname = synthetic_smb_fname(talloc_tos(), name, NULL, NULL, 0); + smb_fname = cp_smb_filename(talloc_tos(), smb_fname_in); if (smb_fname == NULL) { status = NT_STATUS_NO_MEMORY; goto done; diff --git a/source3/modules/vfs_hpuxacl.h b/source3/modules/vfs_hpuxacl.h index b629c7d0b7f..b1b9ec3eccb 100644 --- a/source3/modules/vfs_hpuxacl.h +++ b/source3/modules/vfs_hpuxacl.h @@ -41,7 +41,7 @@ SMB_ACL_T hpuxacl_sys_acl_get_fd(vfs_handle_struct *handle, files_struct *fsp); int hpuxacl_sys_acl_set_file(vfs_handle_struct *handle, - const char *name, + const struct smb_filename *smb_fname, SMB_ACL_TYPE_T type, SMB_ACL_T theacl); diff --git a/source3/modules/vfs_media_harmony.c b/source3/modules/vfs_media_harmony.c index cad3d9fcfe8..6915fb0e21e 100644 --- a/source3/modules/vfs_media_harmony.c +++ b/source3/modules/vfs_media_harmony.c @@ -2138,36 +2138,32 @@ out: * In this case, "name" is a path. */ static int mh_sys_acl_set_file(vfs_handle_struct *handle, - const char *name, + const struct smb_filename *smb_fname, SMB_ACL_TYPE_T acltype, SMB_ACL_T theacl) { int status; - char *clientPath; - TALLOC_CTX *ctx; + struct smb_filename *clientFname = NULL; DEBUG(MH_INFO_DEBUG, ("Entering mh_sys_acl_set_file\n")); - if (!is_in_media_files(name)) - { - status = SMB_VFS_NEXT_SYS_ACL_SET_FILE(handle, name, + if (!is_in_media_files(smb_fname->base_name)) { + status = SMB_VFS_NEXT_SYS_ACL_SET_FILE(handle, smb_fname, acltype, theacl); goto out; } - clientPath = NULL; - ctx = talloc_tos(); - - if ((status = alloc_get_client_path(handle, ctx, - name, - &clientPath))) - { + status = alloc_get_client_smb_fname(handle, + talloc_tos(), + smb_fname, + &clientFname); + if (status != 0) { goto err; } - status = SMB_VFS_NEXT_SYS_ACL_SET_FILE(handle, clientPath, + status = SMB_VFS_NEXT_SYS_ACL_SET_FILE(handle, clientFname, acltype, theacl); err: - TALLOC_FREE(clientPath); + TALLOC_FREE(clientFname); out: return status; } diff --git a/source3/modules/vfs_nfs4acl_xattr.c b/source3/modules/vfs_nfs4acl_xattr.c index a0c4af7ec6b..faf9f9b0597 100644 --- a/source3/modules/vfs_nfs4acl_xattr.c +++ b/source3/modules/vfs_nfs4acl_xattr.c @@ -600,7 +600,7 @@ static SMB_ACL_T nfs4acl_xattr_fail__sys_acl_get_fd(vfs_handle_struct *handle, } static int nfs4acl_xattr_fail__sys_acl_set_file(vfs_handle_struct *handle, - const char *name, + const struct smb_filename *smb_fname, SMB_ACL_TYPE_T type, SMB_ACL_T theacl) { diff --git a/source3/modules/vfs_posixacl.c b/source3/modules/vfs_posixacl.c index d99f538524c..0cad9b6ec68 100644 --- a/source3/modules/vfs_posixacl.c +++ b/source3/modules/vfs_posixacl.c @@ -81,7 +81,7 @@ SMB_ACL_T posixacl_sys_acl_get_fd(vfs_handle_struct *handle, } int posixacl_sys_acl_set_file(vfs_handle_struct *handle, - const char *name, + const struct smb_filename *smb_fname, SMB_ACL_TYPE_T type, SMB_ACL_T theacl) { @@ -89,7 +89,9 @@ int posixacl_sys_acl_set_file(vfs_handle_struct *handle, acl_type_t acl_type; acl_t acl; - DEBUG(10, ("Calling acl_set_file: %s, %d\n", name, type)); + DEBUG(10, ("Calling acl_set_file: %s, %d\n", + smb_fname->base_name, + type)); switch(type) { case SMB_ACL_TYPE_ACCESS: @@ -106,7 +108,7 @@ int posixacl_sys_acl_set_file(vfs_handle_struct *handle, if ((acl = smb_acl_to_posix(theacl)) == NULL) { return -1; } - res = acl_set_file(name, acl_type, acl); + res = acl_set_file(smb_fname->base_name, acl_type, acl); if (res != 0) { DEBUG(10, ("acl_set_file failed: %s\n", strerror(errno))); } diff --git a/source3/modules/vfs_posixacl.h b/source3/modules/vfs_posixacl.h index 8dd138e632d..9cd3160f345 100644 --- a/source3/modules/vfs_posixacl.h +++ b/source3/modules/vfs_posixacl.h @@ -31,7 +31,7 @@ SMB_ACL_T posixacl_sys_acl_get_fd(vfs_handle_struct *handle, TALLOC_CTX *mem_ctx); int posixacl_sys_acl_set_file(vfs_handle_struct *handle, - const char *name, + const struct smb_filename *smb_fname, SMB_ACL_TYPE_T type, SMB_ACL_T theacl); diff --git a/source3/modules/vfs_solarisacl.c b/source3/modules/vfs_solarisacl.c index 4506274a99c..74086bd9fa7 100644 --- a/source3/modules/vfs_solarisacl.c +++ b/source3/modules/vfs_solarisacl.c @@ -136,19 +136,23 @@ SMB_ACL_T solarisacl_sys_acl_get_fd(vfs_handle_struct *handle, } int solarisacl_sys_acl_set_file(vfs_handle_struct *handle, - const char *name, + const struct smb_filename *smb_fname_in, SMB_ACL_TYPE_T type, SMB_ACL_T theacl) { int ret = -1; SOLARIS_ACL_T solaris_acl = NULL; int count; - struct smb_filename smb_fname = { - .base_name = discard_const_p(char, name) - }; + struct smb_filename *smb_fname = NULL; + + smb_fname = cp_smb_filename_nostream(talloc_tos(), smb_fname_in); + if (smb_fname == NULL) { + errno = ENOMEM; + goto done; + } DEBUG(10, ("solarisacl_sys_acl_set_file called for file '%s'\n", - name)); + smb_fname->base_name)); if ((type != SMB_ACL_TYPE_ACCESS) && (type != SMB_ACL_TYPE_DEFAULT)) { errno = EINVAL; @@ -176,12 +180,12 @@ int solarisacl_sys_acl_set_file(vfs_handle_struct *handle, * For a Windows acl mapped call on a symlink, we want to follow * it. */ - ret = SMB_VFS_STAT(handle->conn, &smb_fname); + ret = SMB_VFS_STAT(handle->conn, smb_fname); if (ret != 0) { DEBUG(10, ("Error in stat call: %s\n", strerror(errno))); goto done; } - if (S_ISDIR(smb_fname.st.st_ex_mode)) { + if (S_ISDIR(smb_fname->st.st_ex_mode)) { SOLARIS_ACL_T other_acl = NULL; int other_count; SMB_ACL_TYPE_T other_type; @@ -190,7 +194,8 @@ int solarisacl_sys_acl_set_file(vfs_handle_struct *handle, ? SMB_ACL_TYPE_DEFAULT : SMB_ACL_TYPE_ACCESS; DEBUGADD(10, ("getting acl from filesystem\n")); - if (!solaris_acl_get_file(name, &other_acl, &other_count)) { + if (!solaris_acl_get_file(smb_fname->base_name, + &other_acl, &other_count)) { DEBUG(10, ("error getting acl from directory\n")); goto done; } @@ -217,12 +222,13 @@ int solarisacl_sys_acl_set_file(vfs_handle_struct *handle, goto done; } - ret = acl(name, SETACL, count, solaris_acl); - + ret = acl(smb_fname->base_name, SETACL, count, solaris_acl); + done: DEBUG(10, ("solarisacl_sys_acl_set_file %s.\n", ((ret != 0) ? "failed" : "succeeded"))); SAFE_FREE(solaris_acl); + TALLOC_FREE(smb_fname); return ret; } diff --git a/source3/modules/vfs_solarisacl.h b/source3/modules/vfs_solarisacl.h index 0ee4fa3131c..02bd3711da8 100644 --- a/source3/modules/vfs_solarisacl.h +++ b/source3/modules/vfs_solarisacl.h @@ -30,7 +30,7 @@ SMB_ACL_T solarisacl_sys_acl_get_fd(vfs_handle_struct *handle, TALLOC_CTX *mem_ctx); int solarisacl_sys_acl_set_file(vfs_handle_struct *handle, - const char *name, + const struct smb_filename *smb_fname, SMB_ACL_TYPE_T type, SMB_ACL_T theacl); diff --git a/source3/modules/vfs_time_audit.c b/source3/modules/vfs_time_audit.c index d62df373269..2a2f084cdd8 100644 --- a/source3/modules/vfs_time_audit.c +++ b/source3/modules/vfs_time_audit.c @@ -2258,7 +2258,7 @@ static int smb_time_audit_sys_acl_blob_get_fd(vfs_handle_struct *handle, } static int smb_time_audit_sys_acl_set_file(vfs_handle_struct *handle, - const char *name, + const struct smb_filename *smb_fname, SMB_ACL_TYPE_T acltype, SMB_ACL_T theacl) { @@ -2267,13 +2267,14 @@ static int smb_time_audit_sys_acl_set_file(vfs_handle_struct *handle, double timediff; clock_gettime_mono(&ts1); - result = SMB_VFS_NEXT_SYS_ACL_SET_FILE(handle, name, acltype, + result = SMB_VFS_NEXT_SYS_ACL_SET_FILE(handle, smb_fname, acltype, theacl); clock_gettime_mono(&ts2); timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9; if (timediff > audit_timeout) { - smb_time_audit_log_fname("sys_acl_set_file", timediff, name); + smb_time_audit_log_fname("sys_acl_set_file", timediff, + smb_fname->base_name); } return result; diff --git a/source3/modules/vfs_tru64acl.c b/source3/modules/vfs_tru64acl.c index 69e5dfcaec4..d44e56a0df9 100644 --- a/source3/modules/vfs_tru64acl.c +++ b/source3/modules/vfs_tru64acl.c @@ -88,7 +88,7 @@ SMB_ACL_T tru64acl_sys_acl_get_fd(vfs_handle_struct *handle, } int tru64acl_sys_acl_set_file(vfs_handle_struct *handle, - const char *name, + const struct smb_filename *smb_fname, SMB_ACL_TYPE_T type, SMB_ACL_T theacl) { @@ -97,7 +97,7 @@ int tru64acl_sys_acl_set_file(vfs_handle_struct *handle, acl_t tru64_acl; DEBUG(10, ("tru64acl_sys_acl_set_file called with name %s, type %d\n", - name, type)); + smb_fname->base_name, type)); switch(type) { case SMB_ACL_TYPE_ACCESS: @@ -120,7 +120,8 @@ int tru64acl_sys_acl_set_file(vfs_handle_struct *handle, goto fail; } DEBUG(10, ("got tru64 acl...\n")); - res = acl_set_file((char *)name, the_acl_type, tru64_acl); + res = acl_set_file((char *)smb_fname->base_name, + the_acl_type, tru64_acl); acl_free(tru64_acl); if (res != 0) { DEBUG(10, ("acl_set_file failed: %s\n", strerror(errno))); diff --git a/source3/modules/vfs_tru64acl.h b/source3/modules/vfs_tru64acl.h index 0af0930b004..8dab1f0ec71 100644 --- a/source3/modules/vfs_tru64acl.h +++ b/source3/modules/vfs_tru64acl.h @@ -28,7 +28,7 @@ SMB_ACL_T tru64acl_sys_acl_get_fd(vfs_handle_struct *handle, files_struct *fsp); int tru64acl_sys_acl_set_file(vfs_handle_struct *handle, - const char *name, + const struct smb_filename *smb_fname, SMB_ACL_TYPE_T type, SMB_ACL_T theacl); diff --git a/source3/modules/vfs_unityed_media.c b/source3/modules/vfs_unityed_media.c index 93d9ce68755..21d5416568e 100644 --- a/source3/modules/vfs_unityed_media.c +++ b/source3/modules/vfs_unityed_media.c @@ -1649,31 +1649,40 @@ err: } static int um_sys_acl_set_file(vfs_handle_struct *handle, - const char *name, + const struct smb_filename *smb_fname, SMB_ACL_TYPE_T acltype, SMB_ACL_T theacl) { int status; - char *client_path = NULL; + int saved_errno = 0; + struct smb_filename *client_fname = NULL; DEBUG(10, ("Entering um_sys_acl_set_file\n")); - if (!is_in_media_files(name)) { - return SMB_VFS_NEXT_SYS_ACL_SET_FILE(handle, name, + if (!is_in_media_files(smb_fname->base_name)) { + return SMB_VFS_NEXT_SYS_ACL_SET_FILE(handle, smb_fname, acltype, theacl); } - status = alloc_get_client_path(handle, talloc_tos(), - name, &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_SET_FILE(handle, client_path, + status = SMB_VFS_NEXT_SYS_ACL_SET_FILE(handle, client_fname, acltype, theacl); err: - TALLOC_FREE(client_path); + if (status == -1) { + saved_errno = errno; + } + TALLOC_FREE(client_fname); + if (saved_errno != 0) { + errno = saved_errno; + } return status; } diff --git a/source3/modules/vfs_vxfs.c b/source3/modules/vfs_vxfs.c index 658649406e3..5dc9ba2cfe3 100644 --- a/source3/modules/vfs_vxfs.c +++ b/source3/modules/vfs_vxfs.c @@ -499,14 +499,18 @@ static int vxfs_sys_acl_set_fd(vfs_handle_struct *handle, files_struct *fsp, return SMB_VFS_NEXT_SYS_ACL_SET_FD(handle, fsp, theacl); } -static int vxfs_sys_acl_set_file(vfs_handle_struct *handle, const char *name, - SMB_ACL_TYPE_T acltype, SMB_ACL_T theacl) +static int vxfs_sys_acl_set_file(vfs_handle_struct *handle, + const struct smb_filename *smb_fname, + SMB_ACL_TYPE_T acltype, + SMB_ACL_T theacl) { - if (vxfs_compare(handle->conn, (char *)name, theacl, acltype)) { + if (vxfs_compare(handle->conn, (char *)smb_fname->base_name, + theacl, acltype)) { return 0; } - return SMB_VFS_NEXT_SYS_ACL_SET_FILE(handle, name, acltype, theacl); + return SMB_VFS_NEXT_SYS_ACL_SET_FILE(handle, smb_fname, + acltype, theacl); } static int vxfs_set_xattr(struct vfs_handle_struct *handle, const char *path, diff --git a/source3/modules/vfs_zfsacl.c b/source3/modules/vfs_zfsacl.c index cf341da371e..76cf5281af7 100644 --- a/source3/modules/vfs_zfsacl.c +++ b/source3/modules/vfs_zfsacl.c @@ -299,7 +299,7 @@ static SMB_ACL_T zfsacl_fail__sys_acl_get_fd(vfs_handle_struct *handle, } static int zfsacl_fail__sys_acl_set_file(vfs_handle_struct *handle, - const char *name, + const struct smb_filename *smb_fname, SMB_ACL_TYPE_T type, SMB_ACL_T theacl) { |