summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Schneider <asn@cryptomilk.org>2022-04-26 07:24:10 +0200
committerJule Anger <janger@samba.org>2022-04-28 08:00:14 +0000
commit944ee14c512832d1ffc3aa342d7de4592adfa52d (patch)
tree5f6ba2cb7bca5496aac1b52a0d16b9ffe6a7fc15
parent0b9a9c3a9847a201dd9c50082b3c66380d2cc55f (diff)
downloadsamba-944ee14c512832d1ffc3aa342d7de4592adfa52d.tar.gz
s3:passdb: Refactor lookup_name_smbconf()
This will be changed to support UPNs too in the next patch. BUG: https://bugzilla.samba.org/show_bug.cgi?id=15054 Signed-off-by: Andreas Schneider <asn@cryptomilk.org> Reviewed-by: Jeremy Allison <jra@samba.org> (cherry picked from commit 2690310743920dfe20ac235c1e3617e0f421eddc)
-rw-r--r--source3/passdb/lookup_sid.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/source3/passdb/lookup_sid.c b/source3/passdb/lookup_sid.c
index dbea5578f92..de9dd123239 100644
--- a/source3/passdb/lookup_sid.c
+++ b/source3/passdb/lookup_sid.c
@@ -465,13 +465,14 @@ bool lookup_name_smbconf(TALLOC_CTX *mem_ctx,
struct dom_sid *ret_sid, enum lsa_SidType *ret_type)
{
char *qualified_name = NULL;
- const char *p;
+ const char *p = strchr_m(full_name, *lp_winbind_separator());
+ bool is_qualified = p != NULL;
- if ((p = strchr_m(full_name, *lp_winbind_separator())) != NULL) {
+ if (is_qualified) {
/* The name is already qualified with a domain. */
- if (*lp_winbind_separator() != '\\') {
+ if (p != NULL && *lp_winbind_separator() != '\\') {
/* lookup_name() needs '\\' as a separator */
qualified_name = talloc_strdup(mem_ctx, full_name);