summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/providers/ipa/ipa_init.c28
-rw-r--r--src/providers/ipa/ipa_subdomains.c35
-rw-r--r--src/providers/ipa/ipa_subdomains.h15
3 files changed, 46 insertions, 32 deletions
diff --git a/src/providers/ipa/ipa_init.c b/src/providers/ipa/ipa_init.c
index d3d865e0..a6c32be2 100644
--- a/src/providers/ipa/ipa_init.c
+++ b/src/providers/ipa/ipa_init.c
@@ -76,11 +76,6 @@ struct bet_ops ipa_hostid_ops = {
};
#endif
-struct bet_ops ipa_subdomains_ops = {
- .handler = ipa_subdomains_handler,
- .finalize = NULL
-};
-
int common_ipa_init(struct be_ctx *bectx)
{
const char *ipa_servers;
@@ -486,30 +481,19 @@ int sssm_ipa_subdomains_init(struct be_ctx *bectx,
void **pvt_data)
{
int ret;
- struct ipa_subdomains_ctx *subdomains_ctx;
struct ipa_id_ctx *id_ctx;
- subdomains_ctx = talloc_zero(bectx, struct ipa_subdomains_ctx);
- if (subdomains_ctx == NULL) {
- DEBUG(SSSDBG_CRIT_FAILURE, ("talloc_zero failed.\n"));
- return ENOMEM;
- }
-
ret = sssm_ipa_id_init(bectx, ops, (void **) &id_ctx);
if (ret != EOK) {
DEBUG(SSSDBG_CRIT_FAILURE, ("sssm_ipa_id_init failed.\n"));
- goto done;
+ return ret;
}
- subdomains_ctx->sdap_id_ctx = id_ctx->sdap_id_ctx;
- subdomains_ctx->search_bases = id_ctx->ipa_options->subdomains_search_bases;
- subdomains_ctx->master_search_bases = id_ctx->ipa_options->master_domain_search_bases;
- subdomains_ctx->ranges_search_bases = id_ctx->ipa_options->ranges_search_bases;
- *ops = &ipa_subdomains_ops;
- *pvt_data = subdomains_ctx;
-done:
+ ret = ipa_subdom_init(bectx, id_ctx, ops, pvt_data);
if (ret != EOK) {
- talloc_free(subdomains_ctx);
+ DEBUG(SSSDBG_CRIT_FAILURE, ("ipa_subdom_init failed.\n"));
+ return ret;
}
- return ret;
+
+ return EOK;
}
diff --git a/src/providers/ipa/ipa_subdomains.c b/src/providers/ipa/ipa_subdomains.c
index 8a49c634..a8c05c2a 100644
--- a/src/providers/ipa/ipa_subdomains.c
+++ b/src/providers/ipa/ipa_subdomains.c
@@ -56,6 +56,13 @@ struct ipa_subdomains_req_params {
const char *attrs[8];
};
+struct ipa_subdomains_ctx {
+ struct sdap_id_ctx *sdap_id_ctx;
+ struct sdap_search_base **search_bases;
+ struct sdap_search_base **master_search_bases;
+ struct sdap_search_base **ranges_search_bases;
+};
+
static void ipa_subdomains_reply(struct be_req *be_req, int dp_err, int result)
{
be_req->fn(be_req, dp_err, result, NULL);
@@ -651,3 +658,31 @@ done:
}
ipa_subdomains_reply(be_req, dp_error, ret);
}
+
+struct bet_ops ipa_subdomains_ops = {
+ .handler = ipa_subdomains_handler,
+ .finalize = NULL
+};
+
+int ipa_subdom_init(struct be_ctx *be_ctx,
+ struct ipa_id_ctx *id_ctx,
+ struct bet_ops **ops,
+ void **pvt_data)
+{
+ struct ipa_subdomains_ctx *ctx;
+
+ ctx = talloc_zero(id_ctx, struct ipa_subdomains_ctx);
+ if (ctx == NULL) {
+ DEBUG(SSSDBG_CRIT_FAILURE, ("talloc_zero failed.\n"));
+ return ENOMEM;
+ }
+
+ ctx->sdap_id_ctx = id_ctx->sdap_id_ctx;
+ ctx->search_bases = id_ctx->ipa_options->subdomains_search_bases;
+ ctx->master_search_bases = id_ctx->ipa_options->master_domain_search_bases;
+ ctx->ranges_search_bases = id_ctx->ipa_options->ranges_search_bases;
+ *ops = &ipa_subdomains_ops;
+ *pvt_data = ctx;
+
+ return EOK;
+}
diff --git a/src/providers/ipa/ipa_subdomains.h b/src/providers/ipa/ipa_subdomains.h
index 895ba29f..9d24bccf 100644
--- a/src/providers/ipa/ipa_subdomains.h
+++ b/src/providers/ipa/ipa_subdomains.h
@@ -26,16 +26,11 @@
#define _IPA_SUBDOMAINS_H_
#include "providers/dp_backend.h"
-#include "providers/ldap/ldap_common.h"
+#include "providers/ipa/ipa_common.h"
-struct ipa_subdomains_ctx {
- struct sdap_id_ctx *sdap_id_ctx;
- struct sdap_search_base **search_bases;
- struct sdap_search_base **master_search_bases;
- struct sdap_search_base **ranges_search_bases;
-};
-
-
-void ipa_subdomains_handler(struct be_req *be_req);
+int ipa_subdom_init(struct be_ctx *be_ctx,
+ struct ipa_id_ctx *id_ctx,
+ struct bet_ops **ops,
+ void **pvt_data);
#endif /* _IPA_SUBDOMAINS_H_ */