mirror of
https://github.com/samba-team/samba.git
synced 2025-03-24 10:50:22 +03:00
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 <jra@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
This commit is contained in:
parent
e1cc3e3a67
commit
6f15f8b68a
@ -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;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user