From 5640d7ab6c9ba3928a7ee79503977ffcb263c3da Mon Sep 17 00:00:00 2001 From: Noel Power Date: Mon, 23 Oct 2023 15:09:25 +0100 Subject: [PATCH] s3/winbindd: use parse_domain_user instead of parse_domain_user_fstr In canonicalize_username replace use of parse_domain_user_fstr with parse_domain_user Signed-off-by: Noel Power Reviewed-by: Andrew Bartlett Reviewed-by: Andreas Schneider --- source3/winbindd/winbindd_util.c | 33 +++++++-------------------------- 1 file changed, 7 insertions(+), 26 deletions(-) diff --git a/source3/winbindd/winbindd_util.c b/source3/winbindd/winbindd_util.c index 1f3786376f2..443f7c1a108 100644 --- a/source3/winbindd/winbindd_util.c +++ b/source3/winbindd/winbindd_util.c @@ -1686,42 +1686,23 @@ bool canonicalize_username(TALLOC_CTX *mem_ctx, char *domain = NULL; char *user = NULL; char *username_inout = NULL; - fstring f_username_inout; - fstring f_namespace; - fstring f_domain; - fstring f_user; - - fstrcpy(f_username_inout, *pusername_inout); - fstrcpy(f_namespace, *pnamespace); - fstrcpy(f_domain, *pdomain); - fstrcpy(f_user, *puser); - - ok = parse_domain_user_fstr(f_username_inout, - f_namespace, f_domain, f_user); + + ok = parse_domain_user(mem_ctx, + *pusername_inout, + &namespace, &domain, &user); + if (!ok) { return False; } username_inout = talloc_asprintf(mem_ctx, "%s%c%s", - f_domain, *lp_winbind_separator(), - f_user); + domain, *lp_winbind_separator(), + user); if (username_inout == NULL) { goto fail; } - user = talloc_strdup(mem_ctx, f_user); - if (user == NULL) { - goto fail; - } - domain = talloc_strdup(mem_ctx, f_domain); - if (domain == NULL) { - goto fail; - } - namespace = talloc_strdup(mem_ctx, f_namespace); - if (namespace == NULL) { - goto fail; - } *pnamespace = namespace; *puser = user; *pdomain = domain; -- 2.11.4.GIT