]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s3: smbd: Move the fsp check up one level from check_access().
authorJeremy Allison <jra@samba.org>
Wed, 29 Apr 2020 22:22:31 +0000 (15:22 -0700)
committerRalph Boehme <slow@samba.org>
Thu, 30 Apr 2020 07:33:41 +0000 (07:33 +0000)
This allows us to call check_access_fsp() directly when
we have an fsp, and to add in the dirfsp for relative
name access to check_access() in the next commit, making
it clear what it's for (and not confusing it with the
file fsp).

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

index 21e77b5c3b8d8606292173bb9d8646eeaca784c8..da6fea4b564051ed98ab9670fde45956ccee4727 100644 (file)
@@ -820,7 +820,11 @@ NTSTATUS set_ea(connection_struct *conn, files_struct *fsp,
                return status;
        }
 
-       status = check_access(conn, fsp, smb_fname, FILE_WRITE_EA);
+       if (fsp != NULL) {
+               status = check_access_fsp(fsp, FILE_WRITE_EA);
+       } else {
+               status = check_access(conn, fsp, smb_fname, FILE_WRITE_EA);
+       }
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
@@ -7833,7 +7837,11 @@ static NTSTATUS smb_set_file_basic_info(connection_struct *conn,
                return NT_STATUS_INVALID_PARAMETER;
        }
 
-       status = check_access(conn, fsp, smb_fname, FILE_WRITE_ATTRIBUTES);
+       if (fsp != NULL) {
+               status = check_access_fsp(fsp, FILE_WRITE_ATTRIBUTES);
+       } else {
+               status = check_access(conn, fsp, smb_fname, FILE_WRITE_ATTRIBUTES);
+       }
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
@@ -7900,7 +7908,11 @@ static NTSTATUS smb_set_info_standard(connection_struct *conn,
        DEBUG(10,("smb_set_info_standard: file %s\n",
                smb_fname_str_dbg(smb_fname)));
 
-       status = check_access(conn, fsp, smb_fname, FILE_WRITE_ATTRIBUTES);
+       if (fsp != NULL) {
+               status = check_access_fsp(fsp, FILE_WRITE_ATTRIBUTES);
+       } else {
+               status = check_access(conn, fsp, smb_fname, FILE_WRITE_ATTRIBUTES);
+       }
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }