From 25ef25528e698976ada97e71ecb021cac201aaf1 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Tue, 29 Sep 2020 17:11:47 -0700 Subject: [PATCH] s3: smbd: Implement the 'allow_wcards' parameter inside parse_dfs_path(). Previously this didn't actually restrict wildcards here, as check_path_syntax_wcard() returns the fact there was a wildcard in the last component, but doesn't return an error. Just use check_path_syntax() instead and check for wildcards separately. Signed-off-by: Jeremy Allison Reviewed-by: Ralph Boehme --- source3/smbd/msdfs.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/source3/smbd/msdfs.c b/source3/smbd/msdfs.c index 239df15aba9..a7571a36cac 100644 --- a/source3/smbd/msdfs.c +++ b/source3/smbd/msdfs.c @@ -216,12 +216,13 @@ static NTSTATUS parse_dfs_path(connection_struct *conn, if (pdp->posix_path) { status = check_path_syntax_posix(pdp->reqpath); } else { - if (allow_wcards) { - status = check_path_syntax_wcard(pdp->reqpath, - ppath_contains_wcard); - } else { - status = check_path_syntax(pdp->reqpath); + if (!allow_wcards) { + bool has_wcard = ms_has_wild(pdp->reqpath); + if (has_wcard) { + return NT_STATUS_INVALID_PARAMETER; + } } + status = check_path_syntax(pdp->reqpath); } if (!NT_STATUS_IS_OK(status)) { -- 2.47.3