]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
vfs_recycle.c: prefer capabilities over become_root
authorBjörn Jacke <bj@sernet.de>
Fri, 17 Jun 2022 05:26:53 +0000 (07:26 +0200)
committerBjoern Jacke <bjacke@samba.org>
Thu, 16 Nov 2023 21:38:38 +0000 (21:38 +0000)
Signed-off-by: Bjoern Jacke <bjacke@samba.org>
Reviewed-by: Christof Schmitt <cs@samba.org>
source3/modules/vfs_recycle.c

index b794ebc2d8c17ea0387211cf1f34d30d3d27e614..b03db6a3b7f635e9acff49d7e1a0bd4f7a1573de 100644 (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)));