Revert "dosmode: prefer capabilities over become_root"
authorBjörn Jacke <bjacke@samba.org>
Mon, 25 Mar 2024 16:03:14 +0000 (17:03 +0100)
committerJule Anger <janger@samba.org>
Wed, 27 Mar 2024 15:45:13 +0000 (15:45 +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>
(cherry picked from commit 58ea952fd0c716f94b1b79b8ed1829bb72732ccc)

source3/smbd/dosmode.c

index 1472af7d0591ad891f9e4b4f881061e6a72c39fa..24bd99027b21f50ca079259318c1e2665c579737 100644 (file)
@@ -1035,9 +1035,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) {
@@ -1207,9 +1207,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;