]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
smbd/smb1: Open a pathref's fsp_name to get_dfree_info()
authorVolker Lendecke <vl@samba.org>
Tue, 27 Jan 2026 11:45:46 +0000 (12:45 +0100)
committerAnoop C S <anoopcs@samba.org>
Sun, 15 Feb 2026 10:42:33 +0000 (10:42 +0000)
Preparation for converting get_dfree_info() to directly take a fsp.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
source3/smbd/smb1_reply.c

index c651a07bd83ca2e4b15e2466e0ac332e3635284f..d04b2493196f8b2d3f522d0987b0544e743360b1 100644 (file)
@@ -995,20 +995,23 @@ void reply_dskattr(struct smb_request *req)
        connection_struct *conn = req->conn;
        uint64_t ret;
        uint64_t dfree,dsize,bsize;
-       struct smb_filename smb_fname;
-       START_PROFILE(SMBdskattr);
+       struct smb_filename *dot = NULL;
+       NTSTATUS status;
 
-       ZERO_STRUCT(smb_fname);
-       smb_fname.base_name = discard_const_p(char, ".");
+       START_PROFILE(SMBdskattr);
 
-       if (SMB_VFS_STAT(conn, &smb_fname) != 0) {
-               reply_nterror(req, map_nt_error_from_unix(errno));
-               DBG_WARNING("stat of . failed (%s)\n", strerror(errno));
+       status = openat_pathref_fsp_dot(talloc_tos(), conn->cwd_fsp, 0, &dot);
+       if (!NT_STATUS_IS_OK(status)) {
+               reply_nterror(req, status);
+               DBG_WARNING("openat of . failed (%s)\n", nt_errstr(status));
                END_PROFILE(SMBdskattr);
                return;
        }
 
-       ret = get_dfree_info(conn, &smb_fname, &bsize, &dfree, &dsize);
+       ret = get_dfree_info(conn, dot->fsp->fsp_name, &bsize, &dfree, &dsize);
+
+       TALLOC_FREE(dot);
+
        if (ret == (uint64_t)-1) {
                reply_nterror(req, map_nt_error_from_unix(errno));
                END_PROFILE(SMBdskattr);