smbd: pass fsp to smbd_do_qfsinfo()
authorRalph Boehme <slow@samba.org>
Mon, 13 Nov 2023 06:43:11 +0000 (07:43 +0100)
committerJeremy Allison <jra@samba.org>
Mon, 27 Nov 2023 18:31:35 +0000 (18:31 +0000)
We need the fsp down in fsinfo_unix_valid_level(), start passing it down.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
source3/smbd/globals.h
source3/smbd/smb1_trans2.c
source3/smbd/smb2_getinfo.c
source3/smbd/smb2_trans2.c

index 0c7e791711feda56178da5fea7935bd5973188f2..119483377c0e4fb05be1d2a9f76b3f590ccd0bae 100644 (file)
@@ -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);
index b2a6cf88b24bb30541faabc4ea4099429011cec0..18caa41dce3f6346aa57023452b3715c4d19ea4d 100644 (file)
@@ -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);
index 51283eb174e79f31ff86f7de256c881ad5ba4d73..55dca5e8031858269fc34298d95530392b69234f 100644 (file)
@@ -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);
index 0dc3fa62b3fed93a77bb10e01585250ee7432088..d4fdcadc442cbd8f9e14f45bc334c39928f4b5b6 100644 (file)
@@ -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, &quotas);
                        if (!NT_STATUS_IS_OK(status)) {
                                DEBUG(0,("vfs_get_ntquota() failed for service [%s]\n",lp_servicename(talloc_tos(), lp_sub, SNUM(conn))));