From: Ralph Boehme Date: Mon, 13 Nov 2023 06:43:11 +0000 (+0100) Subject: smbd: pass fsp to smbd_do_qfsinfo() X-Git-Tag: talloc-2.4.2~537 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=bca6f0298fe7230bbf54950dab4329dee6cc9a51;p=thirdparty%2Fsamba.git smbd: pass fsp to smbd_do_qfsinfo() We need the fsp down in fsinfo_unix_valid_level(), start passing it down. Signed-off-by: Ralph Boehme Reviewed-by: Jeremy Allison --- diff --git a/source3/smbd/globals.h b/source3/smbd/globals.h index 0c7e791711f..119483377c0 100644 --- a/source3/smbd/globals.h +++ b/source3/smbd/globals.h @@ -155,6 +155,7 @@ NTSTATUS smbd_do_qfsinfo(struct smbXsrv_connection *xconn, uint16_t flags2, unsigned int max_data_bytes, size_t *fixed_portion, + struct files_struct *fsp, struct smb_filename *smb_fname, char **ppdata, int *ret_data_len); diff --git a/source3/smbd/smb1_trans2.c b/source3/smbd/smb1_trans2.c index b2a6cf88b24..18caa41dce3 100644 --- a/source3/smbd/smb1_trans2.c +++ b/source3/smbd/smb1_trans2.c @@ -1681,6 +1681,7 @@ static void call_trans2qfsinfo(connection_struct *conn, max_data_bytes, &fixed_portion, NULL, + NULL, ppdata, &data_len); if (!NT_STATUS_IS_OK(status)) { reply_nterror(req, status); diff --git a/source3/smbd/smb2_getinfo.c b/source3/smbd/smb2_getinfo.c index 51283eb174e..55dca5e8031 100644 --- a/source3/smbd/smb2_getinfo.c +++ b/source3/smbd/smb2_getinfo.c @@ -473,6 +473,7 @@ static struct tevent_req *smbd_smb2_getinfo_send(TALLOC_CTX *mem_ctx, STR_UNICODE, in_output_buffer_length, &fixed_portion, + fsp, fsp->fsp_name, &data, &data_size); diff --git a/source3/smbd/smb2_trans2.c b/source3/smbd/smb2_trans2.c index 0dc3fa62b3f..d4fdcadc442 100644 --- a/source3/smbd/smb2_trans2.c +++ b/source3/smbd/smb2_trans2.c @@ -1963,6 +1963,9 @@ static bool fsinfo_unix_valid_level(connection_struct *conn, return false; } +/* + * fsp is only valid for SMB2. + */ NTSTATUS smbd_do_qfsinfo(struct smbXsrv_connection *xconn, connection_struct *conn, TALLOC_CTX *mem_ctx, @@ -1970,6 +1973,7 @@ NTSTATUS smbd_do_qfsinfo(struct smbXsrv_connection *xconn, uint16_t flags2, unsigned int max_data_bytes, size_t *fixed_portion, + struct files_struct *fsp, struct smb_filename *fname, char **ppdata, int *ret_data_len) @@ -2311,14 +2315,14 @@ cBytesSector=%u, cUnitTotal=%u, cUnitAvail=%d\n", (unsigned int)bsize, (unsigned /* we need to fake up a fsp here, * because its not send in this call */ - files_struct fsp; + files_struct tmpfsp; SMB_NTQUOTA_STRUCT quotas; - ZERO_STRUCT(fsp); + ZERO_STRUCT(tmpfsp); ZERO_STRUCT(quotas); - fsp.conn = conn; - fsp.fnum = FNUM_FIELD_INVALID; + tmpfsp.conn = conn; + tmpfsp.fnum = FNUM_FIELD_INVALID; /* access check */ if (get_current_uid(conn) != 0) { @@ -2329,7 +2333,7 @@ cBytesSector=%u, cUnitTotal=%u, cUnitAvail=%d\n", (unsigned int)bsize, (unsigned return NT_STATUS_ACCESS_DENIED; } - status = vfs_get_ntquota(&fsp, SMB_USER_FS_QUOTA_TYPE, + status = vfs_get_ntquota(&tmpfsp, SMB_USER_FS_QUOTA_TYPE, NULL, "as); if (!NT_STATUS_IS_OK(status)) { DEBUG(0,("vfs_get_ntquota() failed for service [%s]\n",lp_servicename(talloc_tos(), lp_sub, SNUM(conn))));