mirror of
https://github.com/samba-team/samba.git
synced 2025-02-02 09:47:23 +03:00
dosmode: prefer capabilities over become_root
Signed-off-by: Bjoern Jacke <bjacke@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
This commit is contained in:
parent
1dd81928a2
commit
5e925f9755
@ -1035,9 +1035,9 @@ int file_set_dosmode(connection_struct *conn,
|
||||
return -1;
|
||||
}
|
||||
|
||||
become_root();
|
||||
set_effective_capability(DAC_OVERRIDE_CAPABILITY);
|
||||
ret = SMB_VFS_FCHMOD(smb_fname->fsp, unixmode);
|
||||
unbecome_root();
|
||||
drop_effective_capability(DAC_OVERRIDE_CAPABILITY);
|
||||
|
||||
done:
|
||||
if (!newfile) {
|
||||
@ -1205,9 +1205,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. */
|
||||
become_root();
|
||||
set_effective_capability(DAC_OVERRIDE_CAPABILITY);
|
||||
ret = SMB_VFS_FNTIMES(fsp, ft);
|
||||
unbecome_root();
|
||||
drop_effective_capability(DAC_OVERRIDE_CAPABILITY);
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
Loading…
x
Reference in New Issue
Block a user