summaryrefslogtreecommitdiffstats
path: root/src/providers/ipa/ipa_init.c
diff options
context:
space:
mode:
authorJan Cholasta <jcholast@redhat.com>2012-02-03 22:41:30 +0100
committerJakub Hrozek <jhrozek@redhat.com>2012-02-07 00:26:57 +0100
commit1a7d1977037864e52858058777af8ff8401547dd (patch)
tree414005d5758301a810cd8240ab533eb09a81851e /src/providers/ipa/ipa_init.c
parent74505b09d056883741e90cac45838c844365cae5 (diff)
downloadsssd-1a7d1977037864e52858058777af8ff8401547dd.tar.gz
sssd-1a7d1977037864e52858058777af8ff8401547dd.tar.xz
sssd-1a7d1977037864e52858058777af8ff8401547dd.zip
IPA: Add host info handler
Diffstat (limited to 'src/providers/ipa/ipa_init.c')
-rw-r--r--src/providers/ipa/ipa_init.c49
1 files changed, 49 insertions, 0 deletions
diff --git a/src/providers/ipa/ipa_init.c b/src/providers/ipa/ipa_init.c
index 0484200cd..1165048b2 100644
--- a/src/providers/ipa/ipa_init.c
+++ b/src/providers/ipa/ipa_init.c
@@ -33,6 +33,7 @@
#include "providers/ipa/ipa_id.h"
#include "providers/ipa/ipa_auth.h"
#include "providers/ipa/ipa_access.h"
+#include "providers/ipa/ipa_hostid.h"
#include "providers/ipa/ipa_dyndns.h"
#include "providers/ipa/ipa_session.h"
@@ -65,6 +66,13 @@ struct bet_ops ipa_session_ops = {
.finalize = NULL
};
+#ifdef BUILD_SSH
+struct bet_ops ipa_hostid_ops = {
+ .handler = ipa_host_info_handler,
+ .finalize = NULL
+};
+#endif
+
int common_ipa_init(struct be_ctx *bectx)
{
const char *ipa_servers;
@@ -435,3 +443,44 @@ done:
}
return ret;
}
+
+#ifdef BUILD_SSH
+int sssm_ipa_hostid_init(struct be_ctx *bectx,
+ struct bet_ops **ops,
+ void **pvt_data)
+{
+ int ret;
+ struct ipa_hostid_ctx *hostid_ctx;
+ struct ipa_id_ctx *id_ctx;
+
+ hostid_ctx = talloc_zero(bectx, struct ipa_hostid_ctx);
+ if (hostid_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;
+ }
+ hostid_ctx->sdap_id_ctx = id_ctx->sdap_id_ctx;
+ hostid_ctx->host_search_bases = id_ctx->ipa_options->host_search_bases;
+
+ ret = dp_copy_options(hostid_ctx, ipa_options->basic,
+ IPA_OPTS_BASIC, &hostid_ctx->ipa_options);
+ if (ret != EOK) {
+ DEBUG(SSSDBG_CRIT_FAILURE, ("dp_copy_options failed.\n"));
+ goto done;
+ }
+
+ *ops = &ipa_hostid_ops;
+ *pvt_data = hostid_ctx;
+
+done:
+ if (ret != EOK) {
+ talloc_free(hostid_ctx);
+ }
+ return ret;
+}
+#endif