summaryrefslogtreecommitdiffstats
path: root/src/providers/ldap/sdap_idmap.c
diff options
context:
space:
mode:
authorSumit Bose <sbose@redhat.com>2013-10-24 11:45:57 +0200
committerJakub Hrozek <jhrozek@redhat.com>2013-10-25 15:33:56 +0200
commit14b2def9b1bceb84ea20a49ba2f66815aac844c2 (patch)
tree11f993c1f1b00f9a380b64d605dbe1012bfb24c3 /src/providers/ldap/sdap_idmap.c
parenta5c75692c17498a61babb7045db2dc3f25b0d1af (diff)
downloadsssd-14b2def9b1bceb84ea20a49ba2f66815aac844c2.tar.gz
sssd-14b2def9b1bceb84ea20a49ba2f66815aac844c2.tar.xz
sssd-14b2def9b1bceb84ea20a49ba2f66815aac844c2.zip
sdap_idmap_domain_has_algorithmic_mapping: add domain name argument
When libss_idmap was only used to algorithmically map a SID to a POSIX ID a domain SID was strictly necessary and the only information needed to find a domain. With the introduction of external mappings there are cases where a domain SID is not available. Currently we relied on the fact that external mapping was always used as a default if not specific information about the domain was found. The lead to extra CPU cycles and potentially confusing debug messages. Adding the domain name as a search parameter will avoid this.
Diffstat (limited to 'src/providers/ldap/sdap_idmap.c')
-rw-r--r--src/providers/ldap/sdap_idmap.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/providers/ldap/sdap_idmap.c b/src/providers/ldap/sdap_idmap.c
index af69ee12c..249201def 100644
--- a/src/providers/ldap/sdap_idmap.c
+++ b/src/providers/ldap/sdap_idmap.c
@@ -513,6 +513,7 @@ done:
}
bool sdap_idmap_domain_has_algorithmic_mapping(struct sdap_idmap_ctx *ctx,
+ const char *dom_name,
const char *dom_sid)
{
enum idmap_error_code err;
@@ -529,6 +530,15 @@ bool sdap_idmap_domain_has_algorithmic_mapping(struct sdap_idmap_ctx *ctx,
return false;
}
+ err = sss_idmap_domain_by_name_has_algorithmic_mapping(ctx->map,
+ dom_name,
+ &has_algorithmic_mapping);
+ if (err == IDMAP_SUCCESS) {
+ return has_algorithmic_mapping;
+ } else if (err != IDMAP_NAME_UNKNOWN && err != IDMAP_NO_DOMAIN) {
+ return false;
+ }
+
/* This is the first time we've seen this domain
* Create a new domain for it. We'll use the dom-sid
* as the domain name for now, since we don't have
@@ -554,7 +564,7 @@ bool sdap_idmap_domain_has_algorithmic_mapping(struct sdap_idmap_ctx *ctx,
}
}
- ret = ctx->find_new_domain(ctx, new_dom_sid, new_dom_sid);
+ ret = ctx->find_new_domain(ctx, dom_name, new_dom_sid);
talloc_free(tmp_ctx);
if (ret != EOK) {
DEBUG(SSSDBG_MINOR_FAILURE,