]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
smbd: Simplify smbd_do_qfsinfo()
authorVolker Lendecke <vl@samba.org>
Thu, 29 Jan 2026 15:18:06 +0000 (16:18 +0100)
committerAnoop C S <anoopcs@samba.org>
Sun, 15 Feb 2026 10:42:34 +0000 (10:42 +0000)
We can rely on fsp now, avoid passing and using fname

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
source3/smbd/globals.h
source3/smbd/smb1_trans2.c
source3/smbd/smb2_getinfo.c
source3/smbd/smb2_trans2.c

index 2017310ec3a252c3c62a2b62b95e130122607ea6..c1bad920dc191ce06623e25542e018fc20a1d10f 100644 (file)
@@ -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);
 
index 1e946ef19bc46ed07090e927189fbc106fe69d83..81358dfcaae5a894b80a4e2ad1546706ac1ff0a1 100644 (file)
@@ -1681,7 +1681,6 @@ static void call_trans2qfsinfo(connection_struct *conn,
                                 max_data_bytes,
                                 &fixed_portion,
                                 dot->fsp,
-                                NULL,
                                 ppdata,
                                 &data_len);
 
index cb8d8073d4ebabc545f91bfc89fdb15866e5c130..e644075d140ab49f407e2de842186926ca0b393c 100644 (file)
@@ -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
index 6e6bf8fc87b11a4f1d8b1d2e8d405cf7e21a5c4b..bbf03fb62d73895ed4ffc1a2362e876501c4abb9 100644 (file)
@@ -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) {