Call become_root() before SMB_VFS_NEXT_NTIMES() to touch a removed file that is owned by another user. Backport from SVN SAMBA_3_2_0 r23691 (GPLv2). diff -rup samba-3.0.28a/source/modules/vfs_recycle.c samba-3.0.28a.osstech/source/modules/vfs_recycle.c --- samba-3.0.28a/source/modules/vfs_recycle.c 2008-03-09 00:33:35.000000000 +0900 +++ samba-3.0.28a.osstech/source/modules/vfs_recycle.c 2008-04-18 02:41:26.000000000 +0900 @@ -390,6 +390,7 @@ static void recycle_do_touch(vfs_handle_ { SMB_STRUCT_STAT st; struct timespec ts[2]; + int ret, err; if (SMB_VFS_NEXT_STAT(handle, fname, &st) != 0) { DEBUG(0,("recycle: stat for %s returned %s\n", fname, strerror(errno))); @@ -398,8 +399,13 @@ static void recycle_do_touch(vfs_handle_ ts[0] = timespec_current(); /* atime */ ts[1] = touch_mtime ? ts[0] : get_mtimespec(&st); /* mtime */ - if (SMB_VFS_NEXT_NTIMES(handle, fname, ts) == -1 ) { - DEBUG(0, ("recycle: touching %s failed, reason = %s\n", fname, strerror(errno))); + become_root(); + ret = SMB_VFS_NEXT_NTIMES(handle, fname, ts); + err = errno; + unbecome_root(); + if (ret == -1 ) { + DEBUG(0, ("recycle: touching %s failed, reason = %s\n", + fname, strerror(err))); } }