Use existing ISDOT and ISDOTDOT macros.
[samba.git] / source3 / smbd / filename.c
index ab79dfd9269c48eac05b545fdc3e4bb103cf4e35..84bdd408e9e52940c8a6f5bdc243a02a218d7bfa 100644 (file)
@@ -352,6 +352,9 @@ NTSTATUS unix_convert(TALLOC_CTX *ctx,
                        goto done;
                }
 
+               /* Stat failed - ensure we don't use it. */
+               SET_STAT_INVALID(smb_fname->st);
+
                /*
                 * A special case - if we don't have any wildcards or mangling chars and are case
                 * sensitive or the underlying filesystem is case insentive then searching
@@ -846,8 +849,7 @@ NTSTATUS check_name(connection_struct *conn, const char *name)
 {
        if (IS_VETO_PATH(conn, name))  {
                /* Is it not dot or dot dot. */
-               if (!((name[0] == '.') && (!name[1] ||
-                                       (name[1] == '.' && !name[2])))) {
+               if (!(ISDOT(name) || ISDOTDOT(name))) {
                        DEBUG(5,("check_name: file path name %s vetoed\n",
                                                name));
                        return map_nt_error_from_unix(ENOENT);
@@ -1125,6 +1127,7 @@ NTSTATUS filename_convert(TALLOC_CTX *ctx,
                                struct smb_filename **pp_smb_fname)
 {
        NTSTATUS status;
+       bool allow_wcards = (ucf_flags & (UCF_COND_ALLOW_WCARD_LCOMP|UCF_ALWAYS_ALLOW_WCARD_LCOMP));
        char *fname = NULL;
 
        *pp_smb_fname = NULL;
@@ -1132,6 +1135,7 @@ NTSTATUS filename_convert(TALLOC_CTX *ctx,
        status = resolve_dfspath_wcard(ctx, conn,
                                dfs_path,
                                name_in,
+                               allow_wcards,
                                &fname,
                                ppath_contains_wcard);
        if (!NT_STATUS_IS_OK(status)) {