From: Jeremy Allison Date: Tue, 14 Dec 2021 17:46:51 +0000 (-0800) Subject: s3: smbd: In call_trans2qfilepathinfo(), we must have an existing object in the QPATH... X-Git-Tag: tdb-1.4.6~269 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6000d3408e303936eaccdc06d4e7f3087834ce13;p=thirdparty%2Fsamba.git s3: smbd: In call_trans2qfilepathinfo(), we must have an existing object in the QPATHINFO case. qpathinfo must operate on an existing file, so we can exit early if filename_convert() returned the "new file" NT_STATUS_OK, !VALID_STAT case. Signed-off-by: Jeremy Allison Reviewed-by: Noel Power --- diff --git a/source3/smbd/trans2.c b/source3/smbd/trans2.c index d778e88f1bb..b12f70d43eb 100644 --- a/source3/smbd/trans2.c +++ b/source3/smbd/trans2.c @@ -6110,6 +6110,17 @@ static void call_trans2qfilepathinfo(connection_struct *conn, return; } + /* + * qpathinfo must operate on an existing file, so we + * can exit early if filename_convert() returned the "new file" + * NT_STATUS_OK, !VALID_STAT case. + */ + + if (!VALID_STAT(smb_fname->st)) { + reply_nterror(req, NT_STATUS_OBJECT_NAME_NOT_FOUND); + return; + } + /* * smb_fname->fsp may be NULL if smb_fname points at a symlink * and we're in POSIX context, so be careful when using fsp