summaryrefslogtreecommitdiff
path: root/src/providers/fail_over.c
diff options
context:
space:
mode:
authorPavel Březina <pbrezina@redhat.com>2013-03-19 15:53:44 +0100
committerJakub Hrozek <jhrozek@redhat.com>2013-04-10 15:36:55 +0200
commitf9961e5f82e0ef474d6492371bfdf9e74e208a99 (patch)
tree694e2f0d92c1324fb44c906de911cc4e34685e4a /src/providers/fail_over.c
parent673d4c1932fa4ab1496499207d8627970d0b7561 (diff)
downloadsssd-f9961e5f82e0ef474d6492371bfdf9e74e208a99.tar.gz
sssd-f9961e5f82e0ef474d6492371bfdf9e74e208a99.tar.bz2
sssd-f9961e5f82e0ef474d6492371bfdf9e74e208a99.zip
DNS sites support - SRV lookup plugin interface
https://fedorahosted.org/sssd/ticket/1032 Introduces two new error codes: - ERR_SRV_NOT_FOUND - ERR_SRV_LOOKUP_ERROR Since id_provider is authoritative in case of SRV plugin choise, ability to override the selected pluging during runtime is not desirable. We rely on the fact that id_provider is initialized before all other providers, thus the plugin is set correctly.
Diffstat (limited to 'src/providers/fail_over.c')
-rw-r--r--src/providers/fail_over.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/providers/fail_over.c b/src/providers/fail_over.c
index e7c44174..900e2d6a 100644
--- a/src/providers/fail_over.c
+++ b/src/providers/fail_over.c
@@ -55,6 +55,10 @@ struct fo_ctx {
struct server_common *server_common_list;
struct fo_options *opts;
+
+ fo_srv_lookup_plugin_send_t srv_send_fn;
+ fo_srv_lookup_plugin_recv_t srv_recv_fn;
+ void *srv_pvt;
};
struct fo_service {
@@ -1591,3 +1595,25 @@ bool fo_svc_has_server(struct fo_service *service, struct fo_server *server)
return false;
}
+
+bool fo_set_srv_lookup_plugin(struct fo_ctx *ctx,
+ fo_srv_lookup_plugin_send_t send_fn,
+ fo_srv_lookup_plugin_recv_t recv_fn,
+ void *pvt)
+{
+ if (ctx == NULL || send_fn == NULL || recv_fn == NULL) {
+ DEBUG(SSSDBG_CRIT_FAILURE, ("Invalid parameters\n"));
+ return false;
+ }
+
+ if (ctx->srv_send_fn != NULL || ctx->srv_recv_fn != NULL) {
+ DEBUG(SSSDBG_MINOR_FAILURE, ("SRV lookup plugin is already set\n"));
+ return false;
+ }
+
+ ctx->srv_send_fn = send_fn;
+ ctx->srv_recv_fn = recv_fn;
+ ctx->srv_pvt = talloc_steal(ctx, pvt);
+
+ return true;
+}