1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-27 03:21:53 +03:00

s3: smbd: Use helper function msdfs_servicename_matches_connection() in dfs_redirect().

Replaces ugly complex logic.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=15144

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
This commit is contained in:
Jeremy Allison 2022-08-09 10:58:24 -07:00
parent c0a1d7c7a8
commit a3c9eb7931

View File

@ -925,11 +925,10 @@ NTSTATUS dfs_redirect(TALLOC_CTX *ctx,
NTTIME *_twrp,
char **pp_path_out)
{
const struct loadparm_substitution *lp_sub =
loadparm_s3_global_substitution();
char *hostname = NULL;
char *servicename = NULL;
char *reqpath = NULL;
bool servicename_matches = false;
NTSTATUS status;
status = parse_dfs_path(ctx,
@ -974,11 +973,11 @@ NTSTATUS dfs_redirect(TALLOC_CTX *ctx,
return NT_STATUS_OK;
}
if (!( strequal(servicename, lp_servicename(talloc_tos(), lp_sub, SNUM(conn)))
|| (strequal(servicename, HOMES_NAME)
&& strequal(lp_servicename(talloc_tos(), lp_sub, SNUM(conn)),
conn->session_info->unix_info->sanitized_username) )) ) {
servicename_matches = msdfs_servicename_matches_connection(
conn,
servicename,
conn->session_info->unix_info->sanitized_username);
if (!servicename_matches) {
/* The given sharename doesn't match this connection. */
return NT_STATUS_OBJECT_PATH_NOT_FOUND;
}