]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
Revert "dosmode: prefer capabilities over become_root"
authorBjörn Jacke <bjacke@samba.org>
Mon, 25 Mar 2024 16:03:14 +0000 (17:03 +0100)
committerRalph Boehme <slow@samba.org>
Wed, 27 Mar 2024 09:40:34 +0000 (09:40 +0000)
This reverts commit 5e925f9755fad180863861157aa7548d83dd3fde.

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>
source3/smbd/dosmode.c

index 4ae08f38dcfabed2e8052a756c112d957c11f5a1..a574de9b0dac65c34c1ed6b56f827e92f75bbb42 100644 (file)
@@ -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;