summaryrefslogtreecommitdiffstats
path: root/src/responder/common/responder.h
diff options
context:
space:
mode:
authorSimo Sorce <simo@redhat.com>2016-01-08 17:51:06 -0500
committerJakub Hrozek <jhrozek@redhat.com>2016-06-29 21:46:03 +0200
commit4f3a9d837a55b49448eca3c713c85a406207e523 (patch)
treecf983b0fac5ddbc39ca259306342a0c05245168c /src/responder/common/responder.h
parent9a6d162cacfaf6946a1bf974b80b643d2a052d7a (diff)
downloadsssd-4f3a9d837a55b49448eca3c713c85a406207e523.tar.gz
sssd-4f3a9d837a55b49448eca3c713c85a406207e523.tar.xz
sssd-4f3a9d837a55b49448eca3c713c85a406207e523.zip
Responders: Make the client context more generic
This is useufl to allow reusing the responder code with other protocols. Store protocol data and responder state data behind opaque pointers and use tallog_get_type to check they are of the right type. This also allows to store per responder state_ctx so that, for example, the autofs responder does not have to carry useless variables used only by the nss responder. Resolves: https://fedorahosted.org/sssd/ticket/2918 Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
Diffstat (limited to 'src/responder/common/responder.h')
-rw-r--r--src/responder/common/responder.h30
1 files changed, 15 insertions, 15 deletions
diff --git a/src/responder/common/responder.h b/src/responder/common/responder.h
index 2b5b05412..adf7b3d19 100644
--- a/src/responder/common/responder.h
+++ b/src/responder/common/responder.h
@@ -68,6 +68,11 @@ struct cli_protocol_version {
const char *description;
};
+struct cli_protocol {
+ struct cli_request *creq;
+ struct cli_protocol_version *cli_protocol_version;
+};
+
struct resp_ctx;
struct be_conn {
@@ -130,26 +135,14 @@ struct cli_ctx {
struct resp_ctx *rctx;
int cfd;
struct tevent_fd *cfde;
+ tevent_fd_handler_t cfd_handler;
struct sockaddr_un addr;
- struct cli_request *creq;
- struct cli_protocol_version *cli_protocol_version;
int priv;
struct cli_creds *creds;
- int pwent_dom_idx;
- int pwent_cur;
-
- int grent_dom_idx;
- int grent_cur;
-
- int svc_dom_idx;
- int svcent_cur;
-
- char *netgr_name;
- int netgrent_cur;
-
- char *automntmap_name;
+ void *protocol_ctx;
+ void *state_ctx;
struct tevent_timer *idle;
};
@@ -165,6 +158,12 @@ struct mon_cli_iface;
/*
* responder_common.c
*
+ */
+
+typedef int (*connection_setup_t)(struct cli_ctx *cctx);
+
+int sss_connection_setup(struct cli_ctx *cctx);
+/*
* NOTE: We would like to use more strong typing for the @dp_vtable argument
* but can't since it accepts either a struct data_provider_iface
* or struct data_provider_rev_iface. So pass the base struct: sbus_vtable
@@ -183,6 +182,7 @@ int sss_process_init(TALLOC_CTX *mem_ctx,
struct mon_cli_iface *monitor_intf,
const char *cli_name,
struct sbus_vtable *dp_intf,
+ connection_setup_t conn_setup,
struct resp_ctx **responder_ctx);
int sss_dp_get_domain_conn(struct resp_ctx *rctx, const char *domain,