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