diff options
author | Jakub Hrozek <jhrozek@redhat.com> | 2015-05-12 14:27:35 +0200 |
---|---|---|
committer | Jakub Hrozek <jhrozek@redhat.com> | 2015-06-14 21:44:39 +0200 |
commit | 9b7762729da24a901388ea53da29448f23e0f77b (patch) | |
tree | f4c565371830951fa99cacc66c19c8042bdcea0d /src/providers | |
parent | 5a5f1e1053415efaa99bb4d5bc7ce7ac0a95b757 (diff) | |
download | sssd-9b7762729da24a901388ea53da29448f23e0f77b.tar.gz sssd-9b7762729da24a901388ea53da29448f23e0f77b.tar.xz sssd-9b7762729da24a901388ea53da29448f23e0f77b.zip |
IPA: Fold ipa_subdom_enumerates into ipa_subdom_store
Reduced code duplication
Reviewed-by: Sumit Bose <sbose@redhat.com>
Diffstat (limited to 'src/providers')
-rw-r--r-- | src/providers/ipa/ipa_subdomains.c | 25 |
1 files changed, 10 insertions, 15 deletions
diff --git a/src/providers/ipa/ipa_subdomains.c b/src/providers/ipa/ipa_subdomains.c index 872f212c9..022848c23 100644 --- a/src/providers/ipa/ipa_subdomains.c +++ b/src/providers/ipa/ipa_subdomains.c @@ -647,8 +647,7 @@ done: static errno_t ipa_subdom_store(struct sss_domain_info *parent, struct sdap_idmap_ctx *sdap_idmap_ctx, - struct sysdb_attrs *attrs, - bool enumerate) + struct sysdb_attrs *attrs) { TALLOC_CTX *tmp_ctx; const char *name; @@ -658,6 +657,7 @@ static errno_t ipa_subdom_store(struct sss_domain_info *parent, char *forest = NULL; int ret; bool mpg; + bool enumerate; tmp_ctx = talloc_new(parent); if (tmp_ctx == NULL) { @@ -696,6 +696,11 @@ static errno_t ipa_subdom_store(struct sss_domain_info *parent, goto done; } + ret = ipa_subdom_enumerates(parent, attrs, &enumerate); + if (ret != EOK) { + goto done; + } + ret = sysdb_subdomain_store(parent->sysdb, name, realm, flat, id, mpg, enumerate, forest, 0); if (ret) { @@ -718,7 +723,6 @@ static errno_t ipa_subdomains_refresh(struct ipa_subdomains_ctx *ctx, const char *value; int c, h; int ret; - bool enumerate; parent = ctx->be_ctx->domain; memset(handled, 0, sizeof(bool) * count); @@ -754,13 +758,8 @@ static errno_t ipa_subdomains_refresh(struct ipa_subdomains_ctx *ctx, ipa_ad_subdom_remove(ctx, dom); } else { /* ok let's try to update it */ - ret = ipa_subdom_enumerates(parent, reply[c], &enumerate); - if (ret != EOK) { - goto done; - } - ret = ipa_subdom_store(parent, ctx->sdap_id_ctx->opts->idmap_ctx, - reply[c], enumerate); + reply[c]); if (ret) { /* Nothing we can do about the errorr. Let's at least try * to reuse the existing domain @@ -786,16 +785,12 @@ static errno_t ipa_subdomains_refresh(struct ipa_subdomains_ctx *ctx, if (handled[c]) { continue; } + /* Nothing we can do about the errorr. Let's at least try * to reuse the existing domain. */ - ret = ipa_subdom_enumerates(parent, reply[c], &enumerate); - if (ret != EOK) { - goto done; - } - ret = ipa_subdom_store(parent, ctx->sdap_id_ctx->opts->idmap_ctx, - reply[c], enumerate); + reply[c]); if (ret) { DEBUG(SSSDBG_MINOR_FAILURE, "Failed to parse subdom data, " "will try to use cached subdomain\n"); |