From: Jeremy Allison Date: Fri, 3 Dec 2021 20:37:15 +0000 (-0800) Subject: s3: smbd: We no longer need determine_path_error(). X-Git-Tag: tdb-1.4.6~321 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6f15f8b68a56fca559604a83d30b659b301d2a43;p=thirdparty%2Fsamba.git s3: smbd: We no longer need determine_path_error(). 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 Reviewed-by: Ralph Boehme --- diff --git a/source3/smbd/filename.c b/source3/smbd/filename.c index fe3db77c862..601832fdb49 100644 --- a/source3/smbd/filename.c +++ b/source3/smbd/filename.c @@ -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; }