From: Björn Jacke Date: Mon, 25 Mar 2024 16:03:14 +0000 (+0100) Subject: Revert "dosmode: prefer capabilities over become_root" X-Git-Tag: tdb-1.4.11~1366 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=58ea952fd0c716f94b1b79b8ed1829bb72732ccc;p=thirdparty%2Fsamba.git Revert "dosmode: prefer capabilities over become_root" This reverts commit 5e925f9755fad180863861157aa7548d83dd3fde. BUG: https://bugzilla.samba.org/show_bug.cgi?id=15583 Signed-off-by: Bjoern Jacke Reviewed-by: Ralph Boehme --- diff --git a/source3/smbd/dosmode.c b/source3/smbd/dosmode.c index 4ae08f38dcf..a574de9b0da 100644 --- a/source3/smbd/dosmode.c +++ b/source3/smbd/dosmode.c @@ -1037,9 +1037,9 @@ int file_set_dosmode(connection_struct *conn, return -1; } - set_effective_capability(DAC_OVERRIDE_CAPABILITY); + become_root(); ret = SMB_VFS_FCHMOD(smb_fname->fsp, unixmode); - drop_effective_capability(DAC_OVERRIDE_CAPABILITY); + unbecome_root(); done: if (!newfile) { @@ -1209,9 +1209,9 @@ int file_ntimes(connection_struct *conn, /* Check if we have write access. */ if (can_write_to_fsp(fsp)) { /* We are allowed to become root and change the filetime. */ - set_effective_capability(DAC_OVERRIDE_CAPABILITY); + become_root(); ret = SMB_VFS_FNTIMES(fsp, ft); - drop_effective_capability(DAC_OVERRIDE_CAPABILITY); + unbecome_root(); } return ret;