Revert "dosmode.c: prefer use of capabilities at two places over become_root"
authorBjörn Jacke <bjacke@samba.org>
Mon, 25 Mar 2024 16:04:45 +0000 (17:04 +0100)
committerRalph Boehme <slow@samba.org>
Wed, 27 Mar 2024 09:40:34 +0000 (09:40 +0000)
This reverts commit c1e2fbb1b9a7551becf5caa0f08d434edf9ad862.

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 a574de9b0dac65c34c1ed6b56f827e92f75bbb42..4d897d6d7a13b02fc4d4f8e5f812b4a021f56124 100644 (file)
@@ -388,12 +388,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 "
@@ -508,14 +508,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;
                }