dpward / rpms / sssd

Forked from rpms/sssd 3 years ago
Clone
Blob Blame History Raw
From 751447267c61d70016fd9f2231096188ede8eabe Mon Sep 17 00:00:00 2001
From: Michal Zidek <mzidek@redhat.com>
Date: Fri, 21 Nov 2014 20:06:32 +0100
Subject: [PATCH 112/112] util: sss_get_domain_name regex mismatch not fatal
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Assume name is not FQDN if sss_parse_name fails to
match domain with regular expression.

Fixes:
https://fedorahosted.org/sssd/ticket/2487

Reviewed-by: Lukáš Slebodník <lslebodn@redhat.com>
---
 src/util/usertools.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/src/util/usertools.c b/src/util/usertools.c
index 09cfd6b35505b8496413258fd05808ac0d2c095b..ebe139e6cd3c9eb270033629dab362fefb3e2682 100644
--- a/src/util/usertools.c
+++ b/src/util/usertools.c
@@ -646,7 +646,13 @@ sss_get_domain_name(TALLOC_CTX *mem_ctx,
     /* check if the name already contains domain part */
     if (dom->names != NULL) {
         ret = sss_parse_name(mem_ctx, dom->names, orig_name, &domain, NULL);
-        if (ret != EOK) {
+        if (ret == ERR_REGEX_NOMATCH) {
+            DEBUG(SSSDBG_TRACE_FUNC,
+                  "sss_parse_name could not parse domain from [%s]. "
+                  "Assuming it is not FQDN.\n", orig_name);
+        } else if (ret != EOK) {
+            DEBUG(SSSDBG_TRACE_FUNC,
+                  "sss_parse_name failed [%d]: %s\n", ret, sss_strerror(ret));
             return NULL;
         }
     }
-- 
1.9.3