From 07e941c1bbdc752142bbd3b838c540bc7ecd0ed7 Mon Sep 17 00:00:00 2001 From: Stef Walter Date: Tue, 18 Feb 2014 14:32:54 +0100 Subject: sbus: Refactor how we export DBus interfaces MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Most importantly, stop using per connection private data. This doesn't scale when you have more than one thing exporting or exported on a connection. Remove struct sbus_interface and expand sbus_conn_add_interface() function. Remove various struct sbus_interface args to connection initialization functions and make callers use sbus_conn_add_interface() directly. The old method was optimized for exporting one interface on a connection. We'll have connections that export zero, one or more interfaces. To export an interface on a DBus server, call sbus_conn_add_interface() from within the sbus_server_conn_init_fn. To export an interface on a DBus client, call sbus_conn_add_interface() after sbus_new_connection() returns. As before struct sbus_interface represents an object exported via DBus. However it is now talloc allocated. One can set instance data on the struct sbus_interface. This instance data is passed to the various handlers and used in their implementation. However, we now have type safe interface exporting in the various high level sss_process_init() sss_monitor_init() and so on. Introspection support was not in use, and is now gone until we implement it using the metadata (future patch). Reviewed-by: Jakub Hrozek Reviewed-by: Pavel Březina Reviewed-by: Lukáš Slebodník --- src/responder/pam/pamsrv.c | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) (limited to 'src/responder/pam/pamsrv.c') diff --git a/src/responder/pam/pamsrv.c b/src/responder/pam/pamsrv.c index 1fc9f6282..2823f01a0 100644 --- a/src/responder/pam/pamsrv.c +++ b/src/responder/pam/pamsrv.c @@ -59,12 +59,6 @@ struct mon_cli_iface monitor_pam_methods = { .clearEnumCache = NULL, }; -struct sbus_interface monitor_pam_interface = { - MONITOR_PATH, - &monitor_pam_methods.vtable, - NULL -}; - static struct data_provider_iface pam_dp_methods = { { &data_provider_iface_meta, 0 }, .RegisterService = NULL, @@ -76,13 +70,6 @@ static struct data_provider_iface pam_dp_methods = { .getAccountInfo = NULL, }; -struct sbus_interface pam_dp_interface = { - DP_PATH, - &pam_dp_methods.vtable, - NULL -}; - - static void pam_dp_reconnect_init(struct sbus_connection *conn, int status, void *pvt) { struct be_conn *be_conn = talloc_get_type(pvt, struct be_conn); @@ -131,8 +118,8 @@ static int pam_process_init(TALLOC_CTX *mem_ctx, CONFDB_PAM_CONF_ENTRY, SSS_PAM_SBUS_SERVICE_NAME, SSS_PAM_SBUS_SERVICE_VERSION, - &monitor_pam_interface, - "PAM", &pam_dp_interface, + &monitor_pam_methods, + "PAM", &pam_dp_methods.vtable, &rctx); if (ret != EOK) { DEBUG(SSSDBG_FATAL_FAILURE, "sss_process_init() failed\n"); -- cgit