]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s3: smbd: We no longer need determine_path_error().
authorJeremy Allison <jra@samba.org>
Fri, 3 Dec 2021 20:37:15 +0000 (12:37 -0800)
committerRalph Boehme <slow@samba.org>
Sat, 11 Dec 2021 07:17:29 +0000 (07:17 +0000)
Now we don't have to consider wildcards just
return NT_STATUS_OBJECT_PATH_NOT_FOUND for
the cases we used to call it.

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

index fe3db77c862a20537032bea5f103311097b66979..601832fdb499ae0660a7e47a826e1d667f04d531 100644 (file)
@@ -96,45 +96,6 @@ static bool mangled_equal(const char *name1,
        return strequal(name1, mname);
 }
 
-/****************************************************************************
- Cope with the differing wildcard and non-wildcard error cases.
-****************************************************************************/
-
-static NTSTATUS determine_path_error(const char *name,
-                       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. */
-               return NT_STATUS_OBJECT_PATH_NOT_FOUND;
-       }
-
-       /* We're terminating here so we
-        * can be a little slower and get
-        * the error code right. Windows
-        * treats the last part of the pathname
-        * separately I think, so if the last
-        * component is a wildcard then we treat
-        * this ./ as "end of component" */
-
-       p = strchr(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 {
-               /* Error code within a pathname. */
-               return NT_STATUS_OBJECT_PATH_NOT_FOUND;
-       }
-}
-
 static NTSTATUS check_for_dot_component(const struct smb_filename *smb_fname)
 {
        /* Ensure we catch all names with in "/."
@@ -894,9 +855,7 @@ static NTSTATUS unix_convert_step(struct uc_state *state)
                        /* Error code at the end of a pathname. */
                        return NT_STATUS_OBJECT_NAME_INVALID;
                }
-               return determine_path_error(state->end+1,
-                                           false,
-                                           state->posix_pathnames);
+               return NT_STATUS_OBJECT_PATH_NOT_FOUND;
        }
 
        /* The name cannot have a wildcard if it's not
@@ -1071,9 +1030,7 @@ NTSTATUS unix_convert(TALLOC_CTX *mem_ctx,
                if (state->orig_path[1] == '\0' || state->orig_path[2] == '\0') {
                        status = NT_STATUS_OBJECT_NAME_INVALID;
                } else {
-                       status =determine_path_error(&state->orig_path[2],
-                           false,
-                           state->posix_pathnames);
+                       status = NT_STATUS_OBJECT_PATH_NOT_FOUND;
                }
                goto err;
        }