From b8d703cf3aba81800cf1b8ccca64bb00ef0b30f7 Mon Sep 17 00:00:00 2001 From: Sumit Bose Date: Thu, 27 Jun 2013 17:07:36 +0200 Subject: Replace new_subdomain() with find_subdomain_by_name() new_subdomain() will create a new domain object and should not be used anymore in the priovder code directly. Instead a reference to the domain from the common domain object should be used. --- src/providers/ad/ad_access.c | 5 ++--- src/providers/ipa/ipa_hbac_common.c | 4 ++-- src/providers/ipa/ipa_subdomains_id.c | 8 +++----- src/providers/krb5/krb5_utils.c | 5 ++--- src/providers/ldap/sdap_access.c | 5 ++--- 5 files changed, 11 insertions(+), 16 deletions(-) (limited to 'src') diff --git a/src/providers/ad/ad_access.c b/src/providers/ad/ad_access.c index 4e4dc8833..746017dc5 100644 --- a/src/providers/ad/ad_access.c +++ b/src/providers/ad/ad_access.c @@ -44,10 +44,9 @@ ad_access_handler(struct be_req *breq) /* Handle subdomains */ if (strcasecmp(pd->domain, be_ctx->domain->name) != 0) { - domain = new_subdomain(breq, be_ctx->domain, - pd->domain, NULL, NULL, NULL); + domain = find_subdomain_by_name(be_ctx->domain, pd->domain, true); if (domain == NULL) { - DEBUG(SSSDBG_OP_FAILURE, ("new_subdomain failed.\n")); + DEBUG(SSSDBG_OP_FAILURE, ("find_subdomain_by_name failed.\n")); be_req_terminate(breq, DP_ERR_FATAL, PAM_SYSTEM_ERR, NULL); return; } diff --git a/src/providers/ipa/ipa_hbac_common.c b/src/providers/ipa/ipa_hbac_common.c index 2384ba68b..0473a028c 100644 --- a/src/providers/ipa/ipa_hbac_common.c +++ b/src/providers/ipa/ipa_hbac_common.c @@ -448,9 +448,9 @@ hbac_ctx_to_eval_request(TALLOC_CTX *mem_ctx, /* Get user the user name and groups, * take care of subdomain users as well */ if (strcasecmp(pd->domain, domain->name) != 0) { - user_dom = new_subdomain(tmp_ctx, domain, pd->domain, NULL, NULL, NULL); + user_dom = find_subdomain_by_name(domain, pd->domain, true); if (user_dom == NULL) { - DEBUG(SSSDBG_OP_FAILURE, ("new_subdomain failed.\n")); + DEBUG(SSSDBG_OP_FAILURE, ("find_subdomain_by_name failed.\n")); ret = ENOMEM; goto done; } diff --git a/src/providers/ipa/ipa_subdomains_id.c b/src/providers/ipa/ipa_subdomains_id.c index 7fa09bd98..dc822888f 100644 --- a/src/providers/ipa/ipa_subdomains_id.c +++ b/src/providers/ipa/ipa_subdomains_id.c @@ -73,12 +73,10 @@ struct tevent_req *ipa_get_subdom_acct_send(TALLOC_CTX *memctx, goto fail; } - state->domain = new_subdomain(state, state->ctx->be->domain, ar->domain, - NULL, - get_flat_name_from_subdomain_name(ctx->be,ar->domain), - NULL); + state->domain = find_subdomain_by_name(state->ctx->be->domain, + ar->domain, true); if (state->domain == NULL) { - DEBUG(SSSDBG_OP_FAILURE, ("new_subdomain failed.\n")); + DEBUG(SSSDBG_OP_FAILURE, ("find_subdomain_by_name failed.\n")); ret = ENOMEM; goto fail; } diff --git a/src/providers/krb5/krb5_utils.c b/src/providers/krb5/krb5_utils.c index 1f7ed0745..4811a736c 100644 --- a/src/providers/krb5/krb5_utils.c +++ b/src/providers/krb5/krb5_utils.c @@ -1216,10 +1216,9 @@ errno_t get_domain_or_subdomain(TALLOC_CTX *mem_ctx, struct be_ctx *be_ctx, if (domain_name != NULL && strcasecmp(domain_name, be_ctx->domain->name) != 0) { - *dom = new_subdomain(mem_ctx, be_ctx->domain, - domain_name, NULL, NULL, NULL); + *dom = find_subdomain_by_name(be_ctx->domain, domain_name, true); if (*dom == NULL) { - DEBUG(SSSDBG_OP_FAILURE, ("new_subdomain failed.\n")); + DEBUG(SSSDBG_OP_FAILURE, ("find_subdomain_by_name failed.\n")); return ENOMEM; } } else { diff --git a/src/providers/ldap/sdap_access.c b/src/providers/ldap/sdap_access.c index e74542346..53df7b0ee 100644 --- a/src/providers/ldap/sdap_access.c +++ b/src/providers/ldap/sdap_access.c @@ -110,10 +110,9 @@ sdap_access_send(TALLOC_CTX *mem_ctx, /* Get original user DN, take care of subdomain users as well */ if (strcasecmp(pd->domain, be_ctx->domain->name) != 0) { - user_dom = new_subdomain(state, be_ctx->domain, pd->domain, - NULL, NULL, NULL); + user_dom = find_subdomain_by_name(be_ctx->domain, pd->domain, true); if (user_dom == NULL) { - DEBUG(SSSDBG_OP_FAILURE, ("new_subdomain failed.\n")); + DEBUG(SSSDBG_OP_FAILURE, ("find_subdomain_by_name failed.\n")); ret = ENOMEM; goto done; } -- cgit