Blame SOURCES/0058-LDAP-Don-t-fail-if-subdomain-cannot-be-found-by-sid.patch

2fc102
From 8509e1fe368b62225b7cf39eb1eec6cac7bf38b3 Mon Sep 17 00:00:00 2001
2fc102
From: Lukas Slebodnik <lslebodn@redhat.com>
2fc102
Date: Fri, 13 Dec 2013 18:20:08 +0100
2fc102
Subject: [PATCH 58/60] LDAP: Don't fail if subdomain cannot be found by sid
2fc102
2fc102
Domain needn't contain sid if id_provider is ldap.
2fc102
With enabled id mapping, user couldn't be stored, because domain
2fc102
couldn't be found by sid.
2fc102
2fc102
Resolves:
2fc102
https://fedorahosted.org/sssd/ticket/2172
2fc102
---
2fc102
 src/providers/ldap/sdap_async_users.c | 10 ++++++----
2fc102
 1 file changed, 6 insertions(+), 4 deletions(-)
2fc102
2fc102
diff --git a/src/providers/ldap/sdap_async_users.c b/src/providers/ldap/sdap_async_users.c
2fc102
index 7f0b2eea0b5ee909bcf148236c7fc43863fe8c13..65c456c8fffb57cbf9e977a49388dbe250d1412a 100644
2fc102
--- a/src/providers/ldap/sdap_async_users.c
2fc102
+++ b/src/providers/ldap/sdap_async_users.c
2fc102
@@ -124,6 +124,7 @@ int sdap_save_user(TALLOC_CTX *memctx,
2fc102
     bool use_id_mapping;
2fc102
     char *sid_str;
2fc102
     char *dom_sid_str = NULL;
2fc102
+    struct sss_domain_info *subdomain;
2fc102
 
2fc102
     DEBUG(SSSDBG_TRACE_FUNC, ("Save user\n"));
2fc102
 
2fc102
@@ -163,11 +164,12 @@ int sdap_save_user(TALLOC_CTX *memctx,
2fc102
     /* If this object has a SID available, we will determine the correct
2fc102
      * domain by its SID. */
2fc102
     if (sid_str != NULL) {
2fc102
-        dom = find_subdomain_by_sid(get_domains_head(dom), sid_str);
2fc102
-        if (dom == NULL) {
2fc102
-            DEBUG(SSSDBG_OP_FAILURE, ("SID %s does not belong to any known "
2fc102
+        subdomain = find_subdomain_by_sid(get_domains_head(dom), sid_str);
2fc102
+        if (subdomain) {
2fc102
+            dom = subdomain;
2fc102
+        } else {
2fc102
+            DEBUG(SSSDBG_TRACE_FUNC, ("SID %s does not belong to any known "
2fc102
                                       "domain\n", sid_str));
2fc102
-            return ERR_DOMAIN_NOT_FOUND;
2fc102
         }
2fc102
     }
2fc102
 
2fc102
-- 
2fc102
1.8.4.2
2fc102