The branch, v4-15-test has been updated via a9e40509704 lib/util/gpfswrap: remove unused gpfswrap_get_winattrs_path() via 948e6556979 vfs_gpfs: use handle based gpfswrap_get_winattrs() via e387fb3202f lib/util/gpfswrap: remove unused gpfswrap_getacl() via 3b2cdf5dcdf vfs_gpfs: finally: use gpfswrap_fgetacl() instead of gpfswrap_getacl() via 4d21f10b32d lib/util/gpfswrap: add gpfswrap_fgetacl() via 6510b35db19 vfs_gpfs: pass fsp to gpfs_getacl_with_capability() via 85ea14d57e5 vfs_gpfs: pass fsp to vfs_gpfs_getacl() via 06e554b22e2 vfs_gpfs: use fsp in gpfsacl_get_posix_acl() via 59154a47398 vfs_gpfs: pass fsp to gpfsacl_get_posix_acl() via 7ae1fdcbb2f vfs_gpfs: pass fsp to gpfs_get_nfs4_acl() via ae7e33885d7 vfs_gpfs: pass fsp to gpfsacl_emu_chmod() via d8ad3e216e8 vfs_gpfs: indentation and README.Coding fixes from c53efe8b481 s3:libads: Clear previous CLDAP ping flags when reusing the ADS_STRUCT
https://git.samba.org/?p=samba.git;a=shortlog;h=v4-15-test - Log ----------------------------------------------------------------- commit a9e405097041e962ceecaacf2f4dd0340fbc7ca0 Author: Ralph Boehme <s...@samba.org> Date: Tue May 17 16:52:21 2022 +0200 lib/util/gpfswrap: remove unused gpfswrap_get_winattrs_path() BUG: https://bugzilla.samba.org/show_bug.cgi?id=15069 Signed-off-by: Ralph Boehme <s...@samba.org> Reviewed-by: Christof Schmitt <c...@samba.org> Autobuild-User(master): Jeremy Allison <j...@samba.org> Autobuild-Date(master): Fri Jun 3 21:53:31 UTC 2022 on sn-devel-184 (cherry picked from commit 3bd753983c8dac33b483affa859984b7e3350d65) Autobuild-User(v4-15-test): Jule Anger <jan...@samba.org> Autobuild-Date(v4-15-test): Thu Jun 9 09:53:47 UTC 2022 on sn-devel-184 commit 948e6556979d033bab07652d1511a3a40fdb5824 Author: Ralph Boehme <s...@samba.org> Date: Tue May 17 16:32:23 2022 +0200 vfs_gpfs: use handle based gpfswrap_get_winattrs() Fixes detecting offline flag for files in snapshot – no idea if this is actually expected. Replaces path based gpfswrap_get_winattrs_path() with handle based version gpfswrap_get_winattrs(). When dealing with files in snapshots fsp->fsp_name points to the active dataset, which will cause ENOENT failures if files are deleted there any only present in the snapshot. BUG: https://bugzilla.samba.org/show_bug.cgi?id=15069 Signed-off-by: Ralph Boehme <s...@samba.org> Reviewed-by: Christof Schmitt <c...@samba.org> (cherry picked from commit 8ae672f955bf07bb97f38b7d2f965f14e8315e9e) commit e387fb3202f55db86209fe4d53c71497256f83ea Author: Ralph Boehme <s...@samba.org> Date: Tue May 17 16:27:58 2022 +0200 lib/util/gpfswrap: remove unused gpfswrap_getacl() BUG: https://bugzilla.samba.org/show_bug.cgi?id=15069 Signed-off-by: Ralph Boehme <s...@samba.org> Reviewed-by: Christof Schmitt <c...@samba.org> (cherry picked from commit 9172c5ff6a419e4daef451564650d4a3ce96bfae) commit 3b2cdf5dcdf26f3c64bbb4814ab19442da78d352 Author: Ralph Boehme <s...@samba.org> Date: Tue May 17 16:02:10 2022 +0200 vfs_gpfs: finally: use gpfswrap_fgetacl() instead of gpfswrap_getacl() Replaces path based gpfswrap_getacl() with handle based version gpfswrap_fgetacl(). When dealing with files in snapshots fsp->fsp_name points to the active dataset, which will cause ENOENT failures if files are deleted there any only present in the snapshot: [2022/05/06 11:32:55.233435, 4, pid=12962, effective(1460548, 273710), real(1460548, 0)] calling open_file with flags=0x0 flags2=0x800 mode=0644, access_mask = 0x80, open_access_mask = 0x80 [2022/05/06 11:32:55.233460, 10, pid=12962, effective(1460548, 273710), real(1460548, 0), class=vfs] gpfs_get_nfs4_acl invoked for dir/subdir/file.txt [2022/05/06 11:32:55.233495, 5, pid=12962, effective(1460548, 273710), real(1460548, 0), class=vfs] smbd_gpfs_getacl failed with No such file or directory [2022/05/06 11:32:55.233521, 9, pid=12962, effective(1460548, 273710), real(1460548, 0), class=vfs] gpfs_getacl failed for dir/subdir/file.txt with No such file or directory [2022/05/06 11:32:55.233546, 10, pid=12962, effective(1460548, 273710), real(1460548, 0)] smbd_check_access_rights_fsp: Could not get acl on dir/subdir/file.txt {@GMT-2022.05.04-11.58.53}: NT_STATUS_OBJECT_NAME_NOT_FOUND BUG: https://bugzilla.samba.org/show_bug.cgi?id=15069 Signed-off-by: Ralph Boehme <s...@samba.org> Reviewed-by: Christof Schmitt <c...@samba.org> (cherry picked from commit a0dc4c9026519c949070dc001e7addad7c7d35ce) commit 4d21f10b32d009e66e318837ebf47294dc324681 Author: Ralph Boehme <s...@samba.org> Date: Tue May 17 15:43:39 2022 +0200 lib/util/gpfswrap: add gpfswrap_fgetacl() Adds handle based version of gpfswrap_getacl(). BUG: https://bugzilla.samba.org/show_bug.cgi?id=15069 Signed-off-by: Ralph Boehme <s...@samba.org> Reviewed-by: Christof Schmitt <c...@samba.org> (cherry picked from commit d373ff3c01c2c50cd539b78494c0673974a0f046) commit 6510b35db19bc17891191c6984e35ec5c4d59c1d Author: Ralph Boehme <s...@samba.org> Date: Tue May 17 16:01:48 2022 +0200 vfs_gpfs: pass fsp to gpfs_getacl_with_capability() BUG: https://bugzilla.samba.org/show_bug.cgi?id=15069 Signed-off-by: Ralph Boehme <s...@samba.org> Reviewed-by: Christof Schmitt <c...@samba.org> (cherry picked from commit 1b2c70f4d16e48998c9c8bc9e22ee8eb3c0ad53e) commit 85ea14d57e51c513009142d2c597f278fa2b8c73 Author: Ralph Boehme <s...@samba.org> Date: Tue May 17 15:35:26 2022 +0200 vfs_gpfs: pass fsp to vfs_gpfs_getacl() BUG: https://bugzilla.samba.org/show_bug.cgi?id=15069 Signed-off-by: Ralph Boehme <s...@samba.org> Reviewed-by: Christof Schmitt <c...@samba.org> (cherry picked from commit ac458648aa3f557b7f137f7efa88806f7cb0da71) commit 06e554b22e2abfb533a8c51c4315553d4b63f5cc Author: Ralph Boehme <s...@samba.org> Date: Tue May 17 15:34:35 2022 +0200 vfs_gpfs: use fsp in gpfsacl_get_posix_acl() BUG: https://bugzilla.samba.org/show_bug.cgi?id=15069 Signed-off-by: Ralph Boehme <s...@samba.org> Reviewed-by: Christof Schmitt <c...@samba.org> (cherry picked from commit 3764be70319d8e953a6205649fecaed06c93dbc8) commit 59154a47398d5620071853aefc1cc425ac124715 Author: Ralph Boehme <s...@samba.org> Date: Tue May 17 15:32:24 2022 +0200 vfs_gpfs: pass fsp to gpfsacl_get_posix_acl() BUG: https://bugzilla.samba.org/show_bug.cgi?id=15069 Signed-off-by: Ralph Boehme <s...@samba.org> Reviewed-by: Christof Schmitt <c...@samba.org> (cherry picked from commit c26efe0c23b426c4a1e7073b040da85df6f1ea61) commit 7ae1fdcbb2f44210f1be3dabd7afc07b9b989b64 Author: Ralph Boehme <s...@samba.org> Date: Tue May 17 15:25:35 2022 +0200 vfs_gpfs: pass fsp to gpfs_get_nfs4_acl() BUG: https://bugzilla.samba.org/show_bug.cgi?id=15069 Signed-off-by: Ralph Boehme <s...@samba.org> Reviewed-by: Christof Schmitt <c...@samba.org> (cherry picked from commit 5f4625a2859bf622ea2034e5bbf63f9959e58b78) commit ae7e33885d79f862b9e29ee3cae0ef6e921d5db3 Author: Ralph Boehme <s...@samba.org> Date: Tue May 17 15:17:34 2022 +0200 vfs_gpfs: pass fsp to gpfsacl_emu_chmod() BUG: https://bugzilla.samba.org/show_bug.cgi?id=15069 Signed-off-by: Ralph Boehme <s...@samba.org> Reviewed-by: Christof Schmitt <c...@samba.org> (cherry picked from commit ad06d806831c80a1169468d18b3e59b239a5ba77) commit d8ad3e216e8e87a74081b89c5579d8d9d8ffdf6c Author: Ralph Boehme <s...@samba.org> Date: Tue May 17 14:47:03 2022 +0200 vfs_gpfs: indentation and README.Coding fixes Best viewed with git show -w. BUG: https://bugzilla.samba.org/show_bug.cgi?id=15069 Signed-off-by: Ralph Boehme <s...@samba.org> Reviewed-by: Christof Schmitt <c...@samba.org> (cherry picked from commit a0f7ced610013cad145ff14cedcfbb5388d1ea4f) ----------------------------------------------------------------------- Summary of changes: lib/util/gpfswrap.c | 24 +++---------- lib/util/gpfswrap.h | 4 +-- source3/modules/vfs_gpfs.c | 89 +++++++++++++++++++++++++--------------------- 3 files changed, 54 insertions(+), 63 deletions(-) Changeset truncated at 500 lines: diff --git a/lib/util/gpfswrap.c b/lib/util/gpfswrap.c index 5cf6d2148e7..d05358e141e 100644 --- a/lib/util/gpfswrap.c +++ b/lib/util/gpfswrap.c @@ -23,7 +23,7 @@ static int (*gpfs_set_share_fn)(int fd, unsigned int allow, unsigned int deny); static int (*gpfs_set_lease_fn)(int fd, unsigned int type); -static int (*gpfs_getacl_fn)(const char *pathname, int flags, void *acl); +static int (*gpfs_fgetacl_fn)(int fd, int flags, void *acl); static int (*gpfs_putacl_fn)(const char *pathname, int flags, void *acl); static int (*gpfs_get_realfilename_path_fn)(const char *pathname, char *filenamep, @@ -33,8 +33,6 @@ static int (*gpfs_set_winattrs_path_fn)(const char *pathname, struct gpfs_winattr *attrs); static int (*gpfs_set_winattrs_fn)(int fd, int flags, struct gpfs_winattr *attrs); -static int (*gpfs_get_winattrs_path_fn)(const char *pathname, - struct gpfs_winattr *attrs); static int (*gpfs_get_winattrs_fn)(int fd, struct gpfs_winattr *attrs); static int (*gpfs_ftruncate_fn)(int fd, gpfs_off64_t length); static int (*gpfs_lib_init_fn)(int flags); @@ -70,12 +68,11 @@ int gpfswrap_init(void) gpfs_set_share_fn = dlsym(l, "gpfs_set_share"); gpfs_set_lease_fn = dlsym(l, "gpfs_set_lease"); - gpfs_getacl_fn = dlsym(l, "gpfs_getacl"); + gpfs_fgetacl_fn = dlsym(l, "gpfs_getacl_fd"); gpfs_putacl_fn = dlsym(l, "gpfs_putacl"); gpfs_get_realfilename_path_fn = dlsym(l, "gpfs_get_realfilename_path"); gpfs_set_winattrs_path_fn = dlsym(l, "gpfs_set_winattrs_path"); gpfs_set_winattrs_fn = dlsym(l, "gpfs_set_winattrs"); - gpfs_get_winattrs_path_fn = dlsym(l, "gpfs_get_winattrs_path"); gpfs_get_winattrs_fn = dlsym(l, "gpfs_get_winattrs"); gpfs_ftruncate_fn = dlsym(l, "gpfs_ftruncate"); gpfs_lib_init_fn = dlsym(l, "gpfs_lib_init"); @@ -112,14 +109,14 @@ int gpfswrap_set_lease(int fd, unsigned int type) return gpfs_set_lease_fn(fd, type); } -int gpfswrap_getacl(const char *pathname, int flags, void *acl) +int gpfswrap_fgetacl(int fd, int flags, void *acl) { - if (gpfs_getacl_fn == NULL) { + if (gpfs_fgetacl_fn == NULL) { errno = ENOSYS; return -1; } - return gpfs_getacl_fn(pathname, flags, acl); + return gpfs_fgetacl_fn(fd, flags, acl); } int gpfswrap_putacl(const char *pathname, int flags, void *acl) @@ -166,17 +163,6 @@ int gpfswrap_set_winattrs(int fd, int flags, struct gpfs_winattr *attrs) return gpfs_set_winattrs_fn(fd, flags, attrs); } -int gpfswrap_get_winattrs_path(const char *pathname, - struct gpfs_winattr *attrs) -{ - if (gpfs_get_winattrs_path_fn == NULL) { - errno = ENOSYS; - return -1; - } - - return gpfs_get_winattrs_path_fn(pathname, attrs); -} - int gpfswrap_get_winattrs(int fd, struct gpfs_winattr *attrs) { if (gpfs_get_winattrs_fn == NULL) { diff --git a/lib/util/gpfswrap.h b/lib/util/gpfswrap.h index 764cf686d2e..1e74496c060 100644 --- a/lib/util/gpfswrap.h +++ b/lib/util/gpfswrap.h @@ -29,7 +29,7 @@ int gpfswrap_init(void); int gpfswrap_set_share(int fd, unsigned int allow, unsigned int deny); int gpfswrap_set_lease(int fd, unsigned int type); -int gpfswrap_getacl(const char *pathname, int flags, void *acl); +int gpfswrap_fgetacl(int fd, int flags, void *acl); int gpfswrap_putacl(const char *pathname, int flags, void *acl); int gpfswrap_get_realfilename_path(const char *pathname, char *filenamep, @@ -38,8 +38,6 @@ int gpfswrap_set_winattrs_path(const char *pathname, int flags, struct gpfs_winattr *attrs); int gpfswrap_set_winattrs(int fd, int flags, struct gpfs_winattr *attrs); -int gpfswrap_get_winattrs_path(const char *pathname, - struct gpfs_winattr *attrs); int gpfswrap_get_winattrs(int fd, struct gpfs_winattr *attrs); int gpfswrap_ftruncate(int fd, gpfs_off64_t length); int gpfswrap_lib_init(int flags); diff --git a/source3/modules/vfs_gpfs.c b/source3/modules/vfs_gpfs.c index eb7a1d3e39a..459a366ad22 100644 --- a/source3/modules/vfs_gpfs.c +++ b/source3/modules/vfs_gpfs.c @@ -417,13 +417,15 @@ static void gpfs_dumpacl(int level, struct gpfs_acl *gacl) } } -static int gpfs_getacl_with_capability(const char *fname, int flags, void *buf) +static int gpfs_getacl_with_capability(struct files_struct *fsp, + int flags, + void *buf) { int ret, saved_errno; set_effective_capability(DAC_OVERRIDE_CAPABILITY); - ret = gpfswrap_getacl(fname, flags, buf); + ret = gpfswrap_fgetacl(fsp_get_pathref_fd(fsp), flags, buf); saved_errno = errno; drop_effective_capability(DAC_OVERRIDE_CAPABILITY); @@ -442,11 +444,11 @@ static int gpfs_getacl_with_capability(const char *fname, int flags, void *buf) * */ static void *vfs_gpfs_getacl(TALLOC_CTX *mem_ctx, - const char *fname, + struct files_struct *fsp, const bool raw, const gpfs_aclType_t type) { - + const char *fname = fsp->fsp_name->base_name; void *aclbuf; size_t size = 512; int ret, flags; @@ -482,13 +484,13 @@ again: *len = size; if (use_capability) { - ret = gpfs_getacl_with_capability(fname, flags, aclbuf); + ret = gpfs_getacl_with_capability(fsp, flags, aclbuf); } else { - ret = gpfswrap_getacl(fname, flags, aclbuf); + ret = gpfswrap_fgetacl(fsp_get_pathref_fd(fsp), flags, aclbuf); if ((ret != 0) && (errno == EACCES)) { DBG_DEBUG("Retry with DAC capability for %s\n", fname); use_capability = true; - ret = gpfs_getacl_with_capability(fname, flags, aclbuf); + ret = gpfs_getacl_with_capability(fsp, flags, aclbuf); } } @@ -523,15 +525,17 @@ again: * On failure returns -1 if there is system (GPFS) error, check errno. * Returns 0 on success */ -static int gpfs_get_nfs4_acl(TALLOC_CTX *mem_ctx, const char *fname, +static int gpfs_get_nfs4_acl(TALLOC_CTX *mem_ctx, + struct files_struct *fsp, struct SMB4ACL_T **ppacl) { + const char *fname = fsp->fsp_name->base_name; gpfs_aclCount_t i; struct gpfs_acl *gacl = NULL; DEBUG(10, ("gpfs_get_nfs4_acl invoked for %s\n", fname)); /* Get the ACL */ - gacl = (struct gpfs_acl*) vfs_gpfs_getacl(talloc_tos(), fname, + gacl = (struct gpfs_acl*) vfs_gpfs_getacl(talloc_tos(), fsp, false, 0); if (gacl == NULL) { DEBUG(9, ("gpfs_getacl failed for %s with %s\n", @@ -644,7 +648,7 @@ static NTSTATUS gpfsacl_fget_nt_acl(vfs_handle_struct *handle, return status; } - result = gpfs_get_nfs4_acl(frame, fsp->fsp_name->base_name, &pacl); + result = gpfs_get_nfs4_acl(frame, fsp, &pacl); if (result == 0) { status = smb_fget_nt_acl_nfs4(fsp, &config->nfs4_params, @@ -823,7 +827,7 @@ static NTSTATUS gpfsacl_set_nt_acl_internal(vfs_handle_struct *handle, files_str NTSTATUS result = NT_STATUS_ACCESS_DENIED; acl = (struct gpfs_acl*) vfs_gpfs_getacl(talloc_tos(), - fsp->fsp_name->base_name, + fsp, false, 0); if (acl == NULL) { return map_nt_error_from_unix(errno); @@ -942,17 +946,18 @@ static SMB_ACL_T gpfs2smb_acl(const struct gpfs_acl *pacl, TALLOC_CTX *mem_ctx) return result; } -static SMB_ACL_T gpfsacl_get_posix_acl(const char *path, gpfs_aclType_t type, +static SMB_ACL_T gpfsacl_get_posix_acl(struct files_struct *fsp, + gpfs_aclType_t type, TALLOC_CTX *mem_ctx) { struct gpfs_acl *pacl; SMB_ACL_T result = NULL; - pacl = vfs_gpfs_getacl(talloc_tos(), path, false, type); + pacl = vfs_gpfs_getacl(talloc_tos(), fsp, false, type); if (pacl == NULL) { - DEBUG(10, ("vfs_gpfs_getacl failed for %s with %s\n", - path, strerror(errno))); + DBG_DEBUG("vfs_gpfs_getacl failed for %s with %s\n", + fsp_str_dbg(fsp), strerror(errno)); if (errno == 0) { errno = EINVAL; } @@ -1013,8 +1018,7 @@ static SMB_ACL_T gpfsacl_sys_acl_get_fd(vfs_handle_struct *handle, DEBUG(0, ("Got invalid type: %d\n", type)); smb_panic("exiting"); } - return gpfsacl_get_posix_acl(fsp->fsp_name->base_name, - gpfs_type, mem_ctx); + return gpfsacl_get_posix_acl(fsp, gpfs_type, mem_ctx); } static int gpfsacl_sys_acl_blob_get_fd(vfs_handle_struct *handle, @@ -1039,7 +1043,7 @@ static int gpfsacl_sys_acl_blob_get_fd(vfs_handle_struct *handle, errno = 0; acl = (struct gpfs_opaque_acl *) vfs_gpfs_getacl(mem_ctx, - fsp->fsp_name->base_name, + fsp, true, GPFS_ACL_TYPE_NFS4); @@ -1257,9 +1261,11 @@ static uint32_t gpfsacl_mask_filter(uint32_t aceType, uint32_t aceMask, uint32_t } static int gpfsacl_emu_chmod(vfs_handle_struct *handle, - const struct smb_filename *fname, mode_t mode) + struct files_struct *fsp, + mode_t mode) { - char *path = fname->base_name; + struct smb_filename *fname = fsp->fsp_name; + char *path = fsp->fsp_name->base_name; struct SMB4ACL_T *pacl = NULL; int result; bool haveAllowEntry[SMB_ACE4_WHO_EVERYONE + 1] = {False, False, False, False}; @@ -1270,7 +1276,7 @@ static int gpfsacl_emu_chmod(vfs_handle_struct *handle, DEBUG(10, ("gpfsacl_emu_chmod invoked for %s mode %o\n", path, mode)); - result = gpfs_get_nfs4_acl(frame, path, &pacl); + result = gpfs_get_nfs4_acl(frame, fsp, &pacl); if (result) { TALLOC_FREE(frame); return result; @@ -1359,23 +1365,24 @@ static int gpfsacl_emu_chmod(vfs_handle_struct *handle, static int vfs_gpfs_fchmod(vfs_handle_struct *handle, files_struct *fsp, mode_t mode) { - SMB_STRUCT_STAT st; - int rc; + SMB_STRUCT_STAT st; + int rc; - if (SMB_VFS_NEXT_FSTAT(handle, fsp, &st) != 0) { - return -1; - } + rc = SMB_VFS_NEXT_FSTAT(handle, fsp, &st); + if (rc != 0) { + return -1; + } - /* avoid chmod() if possible, to preserve acls */ - if ((st.st_ex_mode & ~S_IFMT) == mode) { - return 0; - } + /* avoid chmod() if possible, to preserve acls */ + if ((st.st_ex_mode & ~S_IFMT) == mode) { + return 0; + } - rc = gpfsacl_emu_chmod(handle, fsp->fsp_name, - mode); - if (rc == 1) - return SMB_VFS_NEXT_FCHMOD(handle, fsp, mode); - return rc; + rc = gpfsacl_emu_chmod(handle, fsp, mode); + if (rc == 1) { + return SMB_VFS_NEXT_FCHMOD(handle, fsp, mode); + } + return rc; } static uint32_t vfs_gpfs_winattrs_to_dosmode(unsigned int winattrs) @@ -1908,7 +1915,7 @@ static int vfs_gpfs_ftruncate(vfs_handle_struct *handle, files_struct *fsp, } static bool vfs_gpfs_is_offline(struct vfs_handle_struct *handle, - const struct smb_filename *fname, + struct files_struct *fsp, SMB_STRUCT_STAT *sbuf) { struct gpfs_winattr attrs; @@ -1923,17 +1930,17 @@ static bool vfs_gpfs_is_offline(struct vfs_handle_struct *handle, return false; } - ret = gpfswrap_get_winattrs_path(fname->base_name, &attrs); + ret = gpfswrap_get_winattrs(fsp_get_pathref_fd(fsp), &attrs); if (ret == -1) { return false; } if ((attrs.winAttrs & GPFS_WINATTR_OFFLINE) != 0) { - DBG_DEBUG("%s is offline\n", fname->base_name); + DBG_DEBUG("%s is offline\n", fsp_str_dbg(fsp)); return true; } - DBG_DEBUG("%s is online\n", fname->base_name); + DBG_DEBUG("%s is online\n", fsp_str_dbg(fsp)); return false; } @@ -1947,7 +1954,7 @@ static bool vfs_gpfs_fsp_is_offline(struct vfs_handle_struct *handle, /* * Something bad happened, always ask. */ - return vfs_gpfs_is_offline(handle, fsp->fsp_name, + return vfs_gpfs_is_offline(handle, fsp, &fsp->fsp_name->st); } @@ -1955,7 +1962,7 @@ static bool vfs_gpfs_fsp_is_offline(struct vfs_handle_struct *handle, /* * As long as it's offline, ask. */ - ext->offline = vfs_gpfs_is_offline(handle, fsp->fsp_name, + ext->offline = vfs_gpfs_is_offline(handle, fsp, &fsp->fsp_name->st); } -- Samba Shared Repository