1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-08 21:18:16 +03:00

vfs_recycle.c: prefer capabilities over become_root

Signed-off-by: Bjoern Jacke <bjacke@samba.org>
Reviewed-by: Christof Schmitt <cs@samba.org>
This commit is contained in:
Björn Jacke 2022-06-17 07:26:53 +02:00 committed by Bjoern Jacke
parent 92278418dc
commit 4227b011f6

View File

@ -441,10 +441,10 @@ static void recycle_do_touch(vfs_handle_struct *handle,
/* mtime */
ft.mtime = touch_mtime ? ft.atime : smb_fname_tmp->st.st_ex_mtime;
become_root();
set_effective_capability(DAC_OVERRIDE_CAPABILITY);
ret = SMB_VFS_NEXT_FNTIMES(handle, smb_fname_tmp->fsp, &ft);
err = errno;
unbecome_root();
drop_effective_capability(DAC_OVERRIDE_CAPABILITY);
if (ret == -1 ) {
DEBUG(0, ("recycle: touching %s failed, reason = %s\n",
smb_fname_str_dbg(smb_fname_tmp), strerror(err)));