diff options
author | Pavel Březina <pbrezina@redhat.com> | 2013-09-10 14:58:20 +0200 |
---|---|---|
committer | Jakub Hrozek <jhrozek@redhat.com> | 2013-10-30 22:45:26 +0100 |
commit | d81ce5550ba1fdebd958483d7322052c8b39c33b (patch) | |
tree | 3b12819fafea0ceb7d927e1a143af9b9a9820bd4 /src/providers/ldap/ldap_common.c | |
parent | c704c35ae7ab3861c78371437e3a9ed06ba93d8b (diff) | |
download | sssd-d81ce5550ba1fdebd958483d7322052c8b39c33b.tar.gz sssd-d81ce5550ba1fdebd958483d7322052c8b39c33b.tar.xz sssd-d81ce5550ba1fdebd958483d7322052c8b39c33b.zip |
sdap: add sdap_domain_get_by_dn()
This function will find sdap domain by comparing object dn
with domain base dn.
Resolves:
https://fedorahosted.org/sssd/ticket/2064
Diffstat (limited to 'src/providers/ldap/ldap_common.c')
-rw-r--r-- | src/providers/ldap/ldap_common.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/providers/ldap/ldap_common.c b/src/providers/ldap/ldap_common.c index e632efccc..83f901c74 100644 --- a/src/providers/ldap/ldap_common.c +++ b/src/providers/ldap/ldap_common.c @@ -63,6 +63,30 @@ sdap_domain_get(struct sdap_options *opts, return sditer; } +struct sdap_domain * +sdap_domain_get_by_dn(struct sdap_options *opts, + const char *dn) +{ + struct sdap_domain *sditer = NULL; + char *dc = NULL; + + dc = strstr(dn, "dc="); + if (dc == NULL) { + dc = strstr(dn, "DC="); + if (dc == NULL) { + return NULL; + } + } + + DLIST_FOR_EACH(sditer, opts->sdom) { + if (strcasecmp(sditer->basedn, dc) == 0) { + return sditer; + } + } + + return NULL; +} + errno_t sdap_domain_add(struct sdap_options *opts, struct sss_domain_info *dom, |