s3: smbd: Moving lp_posix_pathnames() out of the lower-level code.
authorJeremy Allison <jra@samba.org>
Fri, 11 Dec 2015 22:36:33 +0000 (14:36 -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().

Fix determine_path_error().

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

index 4b40df36ce519bfd292a216aa49d7cb12c76a5ad..826162beb04f42a1590bca4244c7dbe82a309997 100644 (file)
@@ -55,9 +55,11 @@ static bool mangled_equal(const char *name1,
 ****************************************************************************/
 
 static NTSTATUS determine_path_error(const char *name,
-                       bool allow_wcard_last_component)
+                       bool allow_wcard_last_component,
+                       bool posix_pathnames)
 {
        const char *p;
+       bool name_has_wild = false;
 
        if (!allow_wcard_last_component) {
                /* Error code within a pathname. */
@@ -74,7 +76,11 @@ static NTSTATUS determine_path_error(const char *name,
 
        p = strchr(name, '/');
 
-       if (!p && (ms_has_wild(name) || ISDOT(name))) {
+       if (!posix_pathnames) {
+               name_has_wild = ms_has_wild(name);
+       }
+
+       if (!p && (name_has_wild || ISDOT(name))) {
                /* Error code at the end of a pathname. */
                return NT_STATUS_OBJECT_NAME_INVALID;
        } else {
@@ -300,7 +306,8 @@ NTSTATUS unix_convert(TALLOC_CTX *ctx,
                        status = NT_STATUS_OBJECT_NAME_INVALID;
                } else {
                        status =determine_path_error(&orig_path[2],
-                           allow_wcard_last_component);
+                           allow_wcard_last_component,
+                           posix_pathnames);
                }
                goto err;
        }
@@ -626,7 +633,8 @@ NTSTATUS unix_convert(TALLOC_CTX *ctx,
                                status = NT_STATUS_OBJECT_NAME_INVALID;
                        } else {
                                status = determine_path_error(end+1,
-                                               allow_wcard_last_component);
+                                               allow_wcard_last_component,
+                                               posix_pathnames);
                        }
                        goto fail;
                }