Blame SOURCES/0060-sdap_idamp-Fall-back-to-another-method-if-sid-is-wro.patch

2fc102
From 993aaa15cf4b128951fc9bd4a574e7ac5895d942 Mon Sep 17 00:00:00 2001
2fc102
From: Lukas Slebodnik <lslebodn@redhat.com>
2fc102
Date: Fri, 13 Dec 2013 15:33:23 +0100
2fc102
Subject: [PATCH 60/60] sdap_idamp: Fall back to another method if sid is wrong
2fc102
2fc102
sss_idmap_domain_has_algorithmic_mapping can return also
2fc102
IDMAP_SID_INVALID, but it does not mean that idmaping is
2fc102
unavailable. We should fall back to another method of detection
2fc102
(sss_idmap_domain_by_name_has_algorithmic_mapping)
2fc102
and do not return false immediately.
2fc102
2fc102
Resolves:
2fc102
https://fedorahosted.org/sssd/ticket/2172
2fc102
---
2fc102
 src/providers/ldap/sdap_idmap.c | 10 ++++++++--
2fc102
 1 file changed, 8 insertions(+), 2 deletions(-)
2fc102
2fc102
diff --git a/src/providers/ldap/sdap_idmap.c b/src/providers/ldap/sdap_idmap.c
2fc102
index b6455b81fbdedffc92bbaf8bdfbc12c1615a22f5..57c448fffa1b13699bd8042d33ac729bddb02ca8 100644
2fc102
--- a/src/providers/ldap/sdap_idmap.c
2fc102
+++ b/src/providers/ldap/sdap_idmap.c
2fc102
@@ -529,9 +529,15 @@ bool sdap_idmap_domain_has_algorithmic_mapping(struct sdap_idmap_ctx *ctx,
2fc102
 
2fc102
     err = sss_idmap_domain_has_algorithmic_mapping(ctx->map, dom_sid,
2fc102
                                                    &has_algorithmic_mapping);
2fc102
-    if (err == IDMAP_SUCCESS) {
2fc102
+    switch (err){
2fc102
+    case IDMAP_SUCCESS:
2fc102
         return has_algorithmic_mapping;
2fc102
-    } else if (err != IDMAP_SID_UNKNOWN && err != IDMAP_NO_DOMAIN) {
2fc102
+    case IDMAP_SID_INVALID: /* FALLTHROUGH */
2fc102
+    case IDMAP_SID_UNKNOWN: /* FALLTHROUGH */
2fc102
+    case IDMAP_NO_DOMAIN:   /* FALLTHROUGH */
2fc102
+        /* continue with idmap_domain_by_name */
2fc102
+        break;
2fc102
+    default:
2fc102
         return false;
2fc102
     }
2fc102
 
2fc102
-- 
2fc102
1.8.4.2
2fc102