From: Jeremy Allison Date: Wed, 29 Apr 2020 22:22:31 +0000 (-0700) Subject: s3: smbd: Move the fsp check up one level from check_access(). X-Git-Tag: ldb-2.2.0~796 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=dc0ea4a1957966b66512fc1d1340c0bc37d75531;p=thirdparty%2Fsamba.git s3: smbd: Move the fsp check up one level from check_access(). 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 Reviewed-by: Ralph Boehme --- diff --git a/source3/smbd/trans2.c b/source3/smbd/trans2.c index 21e77b5c3b8..da6fea4b564 100644 --- a/source3/smbd/trans2.c +++ b/source3/smbd/trans2.c @@ -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; }