1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-22 13:34:15 +03:00

Revert "dosmode.c: prefer use of capabilities at two places over become_root"

This reverts commit c1e2fbb1b9.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=15583
Signed-off-by: Bjoern Jacke <bjacke@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
(cherry picked from commit 32aa11e9b5)
This commit is contained in:
Björn Jacke 2024-03-25 17:04:45 +01:00 committed by Jule Anger
parent 6ca9461a1d
commit f7491b2994

View File

@ -387,12 +387,12 @@ NTSTATUS fget_ea_dos_attribute(struct files_struct *fsp,
run because in cases like NFS, root might have even less
rights than the real user
*/
set_effective_capability(DAC_OVERRIDE_CAPABILITY);
become_root();
sizeret = SMB_VFS_FGETXATTR(fsp,
SAMBA_XATTR_DOS_ATTRIB,
attrstr,
sizeof(attrstr));
drop_effective_capability(DAC_OVERRIDE_CAPABILITY);
unbecome_root();
}
if (sizeret == -1) {
DBG_INFO("Cannot get attribute "
@ -507,14 +507,14 @@ NTSTATUS set_ea_dos_attribute(connection_struct *conn,
return NT_STATUS_ACCESS_DENIED;
}
set_effective_capability(DAC_OVERRIDE_CAPABILITY);
become_root();
ret = SMB_VFS_FSETXATTR(smb_fname->fsp,
SAMBA_XATTR_DOS_ATTRIB,
blob.data, blob.length, 0);
drop_effective_capability(DAC_OVERRIDE_CAPABILITY);
if (ret == 0) {
status = NT_STATUS_OK;
}
unbecome_root();
if (!NT_STATUS_IS_OK(status)) {
return status;
}