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:31:15 +0200
commitfdda4b659fa3be3027df91a2b053835186ec2c59 (patch)
treef5f579b9d36f38df405db0f8b3552e2b4d85d21b /src/providers/ldap/sdap_idmap.c
parent3cbbfb4b05d0eb0a0809704e83589d0075e117a0 (diff)
downloadsssd-fdda4b659fa3be3027df91a2b053835186ec2c59.tar.gz
sssd-fdda4b659fa3be3027df91a2b053835186ec2c59.tar.xz
sssd-fdda4b659fa3be3027df91a2b053835186ec2c59.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,