s3: smbd: Implement the 'allow_wcards' parameter inside parse_dfs_path().
authorJeremy Allison <jra@samba.org>
Wed, 30 Sep 2020 00:11:47 +0000 (17:11 -0700)
committerRalph Boehme <slow@samba.org>
Wed, 30 Sep 2020 20:46:42 +0000 (20:46 +0000)
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 <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
source3/smbd/msdfs.c

index 239df15aba980107b1e6b30df137e30902566732..a7571a36cac4e4f7c1a4cc423c98096a006de4c8 100644 (file)
@@ -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)) {