From 02bb3d36c01d61fd7f4246b968f966dfe4b75e4c Mon Sep 17 00:00:00 2001 From: Jakub Hrozek Date: Wed, 16 Apr 2014 14:52:01 +0200 Subject: Minor fixes for sss_parse_name_for_domains MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - use brackets after an if - use the right variable name (candidate_domain instead of candidate_name). - fix a typo in a debug message - only print a debug message about using a default domain when using a default domain - add a comment explaning when is a codepath executed Reviewed-by: Pavel Březina --- src/util/usertools.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to 'src/util/usertools.c') diff --git a/src/util/usertools.c b/src/util/usertools.c index 51927393d..ea2123061 100644 --- a/src/util/usertools.c +++ b/src/util/usertools.c @@ -393,8 +393,9 @@ int sss_parse_name_for_domains(TALLOC_CTX *memctx, int ret; tmp_ctx = talloc_new(NULL); - if (tmp_ctx == NULL) + if (tmp_ctx == NULL) { return ENOMEM; + } rname = NULL; rdomain = NULL; @@ -433,7 +434,7 @@ int sss_parse_name_for_domains(TALLOC_CTX *memctx, } rname = nmatch; break; - } else if (candidate_name == NULL) { + } else if (candidate_domain == NULL) { candidate_domain = dmatch; } } @@ -465,18 +466,22 @@ int sss_parse_name_for_domains(TALLOC_CTX *memctx, } if (match == NULL) { DEBUG(SSSDBG_FUNC_DATA, "default domain [%s] is currently " \ - "not know, trying to look it up.\n", - rdomain); + "not known, trying to look it up.\n", + rdomain); *domain = talloc_steal(memctx, rdomain); ret = EAGAIN; goto done; } + DEBUG(SSSDBG_FUNC_DATA, "using default domain [%s]\n", rdomain); } - DEBUG(SSSDBG_FUNC_DATA, "using default domain [%s]\n", rdomain); - rname = candidate_name; } else if (candidate_domain) { + /* This branch is taken when the input matches the configured + * regular expression, but the domain is now known. Normally, this + * is the case with a FQDN of a user from subdomain that was not + * yet discovered + */ *domain = talloc_steal(memctx, candidate_domain); ret = EAGAIN; goto done; -- cgit