s3: smbd: Moving lp_posix_pathnames() out of the lower-level code.
authorJeremy Allison <jra@samba.org>
Fri, 11 Dec 2015 22:38:49 +0000 (14:38 -0800)
committerJeremy Allison <jra@samba.org>
Sun, 13 Dec 2015 21:59:26 +0000 (22:59 +0100)
Prepare to remove lp_posix_pathnames() out of ms_has_wild().
Check before calls to ms_has_wild().

Fixup check_parent_exists().

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
source3/smbd/filename.c

index 826162beb04f42a1590bca4244c7dbe82a309997..39b351be993ad0ec41c28fa77c034cbd90b94ce0 100644 (file)
@@ -128,6 +128,7 @@ static NTSTATUS check_parent_exists(TALLOC_CTX *ctx,
        const char *last_component = NULL;
        NTSTATUS status;
        int ret;
+       bool parent_fname_has_wild = false;
 
        ZERO_STRUCT(parent_fname);
        if (!parent_dirname(ctx, smb_fname->base_name,
@@ -136,6 +137,10 @@ static NTSTATUS check_parent_exists(TALLOC_CTX *ctx,
                return NT_STATUS_NO_MEMORY;
        }
 
+       if (!posix_pathnames) {
+               parent_fname_has_wild = ms_has_wild(parent_fname.base_name);
+       }
+
        /*
         * If there was no parent component in
         * smb_fname->base_name of the parent name
@@ -143,7 +148,7 @@ static NTSTATUS check_parent_exists(TALLOC_CTX *ctx,
         * optimization.
         */
        if ((smb_fname->base_name == last_component) ||
-                       ms_has_wild(parent_fname.base_name)) {
+                       parent_fname_has_wild) {
                return NT_STATUS_OK;
        }