]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s3: smbd: In can_delete_file_in_directory(), move a fast-path exit to before any...
authorJeremy Allison <jra@samba.org>
Tue, 8 Jun 2021 18:03:24 +0000 (11:03 -0700)
committerRalph Boehme <slow@samba.org>
Wed, 9 Jun 2021 13:14:31 +0000 (13:14 +0000)
If we're root we always return true on a writable share.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
source3/smbd/file_access.c

index 59401896d36d912b2b1c670eec4bcac30de78072..ac72460732a5e7d6820ce1a68b6369d17a9fc9d5 100644 (file)
@@ -52,6 +52,11 @@ bool can_delete_file_in_directory(connection_struct *conn,
                return true;
        }
 
+       if (get_current_uid(conn) == (uid_t)0) {
+               /* I'm sorry sir, I didn't know you were root... */
+               return true;
+       }
+
        /* Get the parent directory permission mask and owners. */
        status = SMB_VFS_PARENT_PATHNAME(conn,
                                         ctx,
@@ -73,11 +78,6 @@ bool can_delete_file_in_directory(connection_struct *conn,
                ret = false;
                goto out;
        }
-       if (get_current_uid(conn) == (uid_t)0) {
-               /* I'm sorry sir, I didn't know you were root... */
-               ret = true;
-               goto out;
-       }
 
 #ifdef S_ISVTX
        /* sticky bit means delete only by owner of file or by root or