Skip to content

Commit

Permalink
ldap: add get_ldap_conn_from_sdom_pvt
Browse files Browse the repository at this point in the history
Related:
https://pagure.io/SSSD/sssd/issue/2474

Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
  • Loading branch information
sumit-bose authored and jhrozek committed Feb 26, 2019
1 parent c013643 commit eaece8b
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/providers/ldap/sdap_async.h
Expand Up @@ -395,4 +395,6 @@ sdap_handle_id_collision_for_incomplete_groups(struct data_provider *dp,
bool posix,
time_t now);

struct sdap_id_conn_ctx *get_ldap_conn_from_sdom_pvt(struct sdap_options *opts,
struct sdap_domain *sdom);
#endif /* _SDAP_ASYNC_H_ */
18 changes: 18 additions & 0 deletions src/providers/ldap/sdap_async_initgroups_ad.c
Expand Up @@ -1721,3 +1721,21 @@ static errno_t handle_missing_pvt(TALLOC_CTX *mem_ctx,
done:
return ret;
}

struct sdap_id_conn_ctx *get_ldap_conn_from_sdom_pvt(struct sdap_options *opts,
struct sdap_domain *sdom)
{
struct ad_id_ctx *ad_id_ctx;
struct sdap_id_conn_ctx *user_conn = NULL;

if (opts->schema_type == SDAP_SCHEMA_AD && sdom->pvt != NULL) {
ad_id_ctx = talloc_get_type(sdom->pvt, struct ad_id_ctx);
if (ad_id_ctx != NULL && ad_id_ctx->ldap_ctx != NULL) {
DEBUG(SSSDBG_TRACE_ALL,
"Returning LDAP connection for user lookup.\n");
user_conn = ad_id_ctx->ldap_ctx;
}
}

return user_conn;
}

0 comments on commit eaece8b

Please sign in to comment.