From: Volker Lendecke Date: Tue, 27 Jan 2026 11:45:46 +0000 (+0100) Subject: smbd/smb1: Open a pathref's fsp_name to get_dfree_info() X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=dd0f3943f0ee4755a6a9d2a65f42e6be7573b69c;p=thirdparty%2Fsamba.git smbd/smb1: Open a pathref's fsp_name to get_dfree_info() Preparation for converting get_dfree_info() to directly take a fsp. Signed-off-by: Volker Lendecke Reviewed-by: Anoop C S --- diff --git a/source3/smbd/smb1_reply.c b/source3/smbd/smb1_reply.c index c651a07bd83..d04b2493196 100644 --- a/source3/smbd/smb1_reply.c +++ b/source3/smbd/smb1_reply.c @@ -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);