From: Volker Lendecke Date: Thu, 29 Jan 2026 15:18:06 +0000 (+0100) Subject: smbd: Simplify smbd_do_qfsinfo() X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=48a2c9acb7ed41d7916daca7112b4ee7d03339d4;p=thirdparty%2Fsamba.git smbd: Simplify smbd_do_qfsinfo() We can rely on fsp now, avoid passing and using fname Signed-off-by: Volker Lendecke Reviewed-by: Anoop C S --- diff --git a/source3/smbd/globals.h b/source3/smbd/globals.h index 2017310ec3a..c1bad920dc1 100644 --- a/source3/smbd/globals.h +++ b/source3/smbd/globals.h @@ -157,7 +157,6 @@ NTSTATUS smbd_do_qfsinfo(struct smbXsrv_connection *xconn, 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 1e946ef19bc..81358dfcaae 100644 --- a/source3/smbd/smb1_trans2.c +++ b/source3/smbd/smb1_trans2.c @@ -1681,7 +1681,6 @@ static void call_trans2qfsinfo(connection_struct *conn, max_data_bytes, &fixed_portion, dot->fsp, - NULL, ppdata, &data_len); diff --git a/source3/smbd/smb2_getinfo.c b/source3/smbd/smb2_getinfo.c index cb8d8073d4e..e644075d140 100644 --- a/source3/smbd/smb2_getinfo.c +++ b/source3/smbd/smb2_getinfo.c @@ -470,13 +470,14 @@ static struct tevent_req *smbd_smb2_getinfo_send(TALLOC_CTX *mem_ctx, break; } - status = smbd_do_qfsinfo(smb2req->xconn, conn, state, + status = smbd_do_qfsinfo(smb2req->xconn, + conn, + state, file_info_level, STR_UNICODE, in_output_buffer_length, &fixed_portion, fsp, - fsp->fsp_name, &data, &data_size); /* some responses set STATUS_BUFFER_OVERFLOW and return diff --git a/source3/smbd/smb2_trans2.c b/source3/smbd/smb2_trans2.c index 6e6bf8fc87b..bbf03fb62d7 100644 --- a/source3/smbd/smb2_trans2.c +++ b/source3/smbd/smb2_trans2.c @@ -1972,7 +1972,6 @@ NTSTATUS smbd_do_qfsinfo(struct smbXsrv_connection *xconn, unsigned int max_data_bytes, size_t *fixed_portion, struct files_struct *fsp, - struct smb_filename *fname, char **ppdata, int *ret_data_len) { @@ -1984,20 +1983,12 @@ NTSTATUS smbd_do_qfsinfo(struct smbXsrv_connection *xconn, const char *vname = volume_label(talloc_tos(), SNUM(conn)); int snum = SNUM(conn); const char *fstype = lp_fstype(SNUM(conn)); - const char *filename = NULL; uint64_t bytes_per_sector = 512; - struct smb_filename smb_fname; SMB_STRUCT_STAT st; NTSTATUS status = NT_STATUS_OK; uint64_t df_ret; uint32_t serial; - if (fname == NULL || fname->base_name == NULL) { - filename = "."; - } else { - filename = fname->base_name; - } - if (IS_IPC(conn)) { if (info_level != SMB_QUERY_CIFS_UNIX_INFO) { DBG_ERR("not an allowed info level (0x%x) on IPC$.\n", @@ -2008,18 +1999,6 @@ NTSTATUS smbd_do_qfsinfo(struct smbXsrv_connection *xconn, DBG_NOTICE("level = %d\n", info_level); - smb_fname = (struct smb_filename) { - .base_name = discard_const_p(char, filename), - .flags = fname ? fname->flags : 0, - .twrp = fname ? fname->twrp : 0, - }; - - if(info_level != SMB_FS_QUOTA_INFORMATION - && SMB_VFS_STAT(conn, &smb_fname) != 0) { - DEBUG(2,("stat of . failed (%s)\n", strerror(errno))); - return map_nt_error_from_unix(errno); - } - st = fsp->fsp_name->st; if (max_data_bytes + DIR_ENTRY_SAFETY_MARGIN < max_data_bytes) {