s3:smbd: check for allow_wcard_last_component early in unix_convert()
authorStefan Metzmacher <metze@samba.org>
Tue, 7 Sep 2010 15:29:02 +0000 (17:29 +0200)
committerStefan Metzmacher <metze@samba.org>
Mon, 18 Apr 2011 15:59:21 +0000 (17:59 +0200)
Inspired by:

commit c96d487ae3c65c17b377bb316adac4b5775448f3
Author: Jeremy Allison <jra@samba.org>
Date:   Wed Nov 25 13:17:56 2009 -0800

    Make us pass RAW-CHKPATH with a case sensitive share.

metze

source3/smbd/filename.c

index d8137989f66dc430a0e785d9dbda2db2640dd89b..81532a06dac8c819e66f168886ac71dc04763d29 100644 (file)
@@ -268,6 +268,14 @@ NTSTATUS unix_convert(TALLOC_CTX *ctx,
                return NT_STATUS_NO_MEMORY;
        }
 
+       name_has_wildcard = ms_has_wild(name);
+
+       /* Wildcard not valid anywhere. */
+       if (name_has_wildcard && !allow_wcard_last_component) {
+               result = NT_STATUS_OBJECT_NAME_INVALID;
+               goto fail;
+       }
+
        /*
         * stat the name - if it exists then we are all done!
         */
@@ -374,12 +382,6 @@ NTSTATUS unix_convert(TALLOC_CTX *ctx,
 
                name_has_wildcard = ms_has_wild(start);
 
-               /* Wildcard not valid anywhere. */
-               if (name_has_wildcard && !allow_wcard_last_component) {
-                       result = NT_STATUS_OBJECT_NAME_INVALID;
-                       goto fail;
-               }
-
                /* Wildcards never valid within a pathname. */
                if (name_has_wildcard && end) {
                        result = NT_STATUS_OBJECT_NAME_INVALID;