summaryrefslogtreecommitdiffstats
path: root/src/responder
diff options
context:
space:
mode:
authorStef Walter <stefw@redhat.com>2014-01-10 08:58:12 +0100
committerJakub Hrozek <jhrozek@redhat.com>2014-02-24 11:14:59 +0100
commit769347ad4d35d43488eb98f980143495b0db415d (patch)
tree1613fff70e57d363ceda4f5d2d3d48efd87073a0 /src/responder
parent3e7d7af1953410f3f009bf3b2e481a46fb80de83 (diff)
downloadsssd-769347ad4d35d43488eb98f980143495b0db415d.tar.gz
sssd-769347ad4d35d43488eb98f980143495b0db415d.tar.xz
sssd-769347ad4d35d43488eb98f980143495b0db415d.zip
sbus: Rework sbus to use interface metadata and vtables
Previous commits added support for interface metadata and handler vtables. This commit ports sbus_dbus_connection to use them. Port the internal uses of dbus to use the new scheme in a very minimal way. Further cleanup is possible here. This commit provides basic definitions of the internal dbus interfaces. The interfaces aren't fully defined, as the handlers will continue to unpack manually, and often overload DBus methods with different arguments (which is rather unorthodox, but not the end of the world). Reviewed-by: Jakub Hrozek <jhrozek@redhat.com> Reviewed-by: Sumit Bose <sbose@redhat.com> Reviewed-by: Lukáš Slebodník <lslebodn@redhat.com> Reviewed-by: Simo Sorce <simo@redhat.com>
Diffstat (limited to 'src/responder')
-rw-r--r--src/responder/autofs/autofssrv.c35
-rw-r--r--src/responder/nss/nsssrv.c33
-rw-r--r--src/responder/pac/pacsrv.c34
-rw-r--r--src/responder/pam/pamsrv.c34
-rw-r--r--src/responder/ssh/sshsrv.c34
-rw-r--r--src/responder/sudo/sudosrv.c34
6 files changed, 121 insertions, 83 deletions
diff --git a/src/responder/autofs/autofssrv.c b/src/responder/autofs/autofssrv.c
index 12f318ee..5ce9ae02 100644
--- a/src/responder/autofs/autofssrv.c
+++ b/src/responder/autofs/autofssrv.c
@@ -32,31 +32,38 @@
static int autofs_clean_hash_table(DBusMessage *message,
struct sbus_connection *conn);
-struct sbus_method monitor_autofs_methods[] = {
- { MON_CLI_METHOD_PING, monitor_common_pong },
- { MON_CLI_METHOD_RES_INIT, monitor_common_res_init },
- { MON_CLI_METHOD_ROTATE, responder_logrotate },
- { MON_CLI_METHOD_CLEAR_ENUM_CACHE, autofs_clean_hash_table },
- { NULL, NULL }
+struct mon_cli_iface monitor_autofs_methods = {
+ { &mon_cli_iface_meta, 0 },
+ .ping = monitor_common_pong,
+ .resInit = monitor_common_res_init,
+ .shutDown = NULL,
+ .goOffline = NULL,
+ .resetOffline = NULL,
+ .rotateLogs = responder_logrotate,
+ .clearMemcache = NULL,
+ .clearEnumCache = autofs_clean_hash_table,
};
struct sbus_interface monitor_autofs_interface = {
- MONITOR_INTERFACE,
MONITOR_PATH,
- SBUS_DEFAULT_VTABLE,
- monitor_autofs_methods,
+ &monitor_autofs_methods.vtable,
NULL
};
-static struct sbus_method autofs_dp_methods[] = {
- { NULL, NULL }
+static struct data_provider_iface autofs_dp_methods = {
+ { &data_provider_iface_meta, 0 },
+ .RegisterService = NULL,
+ .pamHandler = NULL,
+ .sudoHandler = NULL,
+ .autofsHandler = NULL,
+ .hostHandler = NULL,
+ .getDomains = NULL,
+ .getAccountInfo = NULL,
};
struct sbus_interface autofs_dp_interface = {
- DP_INTERFACE,
DP_PATH,
- SBUS_DEFAULT_VTABLE,
- autofs_dp_methods,
+ &autofs_dp_methods.vtable,
NULL
};
diff --git a/src/responder/nss/nsssrv.c b/src/responder/nss/nsssrv.c
index d258dfc7..a385f294 100644
--- a/src/responder/nss/nsssrv.c
+++ b/src/responder/nss/nsssrv.c
@@ -60,20 +60,21 @@ static int nss_clear_memcache(DBusMessage *message,
static int nss_clear_netgroup_hash_table(DBusMessage *message,
struct sbus_connection *conn);
-struct sbus_method monitor_nss_methods[] = {
- { MON_CLI_METHOD_PING, monitor_common_pong },
- { MON_CLI_METHOD_RES_INIT, monitor_common_res_init },
- { MON_CLI_METHOD_ROTATE, responder_logrotate },
- { MON_CLI_METHOD_CLEAR_MEMCACHE, nss_clear_memcache},
- { MON_CLI_METHOD_CLEAR_ENUM_CACHE, nss_clear_netgroup_hash_table},
- { NULL, NULL }
+struct mon_cli_iface monitor_nss_methods = {
+ { &mon_cli_iface_meta, 0 },
+ .ping = monitor_common_pong,
+ .resInit = monitor_common_res_init,
+ .shutDown = NULL,
+ .goOffline = NULL,
+ .resetOffline = NULL,
+ .rotateLogs = responder_logrotate,
+ .clearMemcache = nss_clear_memcache,
+ .clearEnumCache = nss_clear_netgroup_hash_table
};
struct sbus_interface monitor_nss_interface = {
- MONITOR_INTERFACE,
MONITOR_PATH,
- SBUS_DEFAULT_VTABLE,
- monitor_nss_methods,
+ &monitor_nss_methods.vtable,
NULL
};
@@ -372,17 +373,15 @@ static int nss_memcache_initgr_check(DBusMessage *message,
return EOK;
}
-static struct sbus_method nss_dp_methods[] = {
- { DP_REV_METHOD_UPDATE_CACHE, nss_update_memcache },
- { DP_REV_METHOD_INITGR_CHECK, nss_memcache_initgr_check },
- { NULL, NULL }
+static struct data_provider_rev_iface nss_dp_methods = {
+ { &data_provider_rev_iface_meta, 0 },
+ .updateCache = nss_update_memcache,
+ .initgrCheck = nss_memcache_initgr_check
};
struct sbus_interface nss_dp_interface = {
- DP_REV_INTERFACE,
DP_PATH,
- SBUS_DEFAULT_VTABLE,
- nss_dp_methods,
+ &nss_dp_methods.vtable,
NULL
};
diff --git a/src/responder/pac/pacsrv.c b/src/responder/pac/pacsrv.c
index 2fb94293..04a6200e 100644
--- a/src/responder/pac/pacsrv.c
+++ b/src/responder/pac/pacsrv.c
@@ -48,30 +48,38 @@
#define DEFAULT_PAC_FD_LIMIT 8192
#define DEFAULT_ALLOWED_UIDS "0"
-struct sbus_method monitor_pac_methods[] = {
- { MON_CLI_METHOD_PING, monitor_common_pong },
- { MON_CLI_METHOD_RES_INIT, monitor_common_res_init },
- { MON_CLI_METHOD_ROTATE, responder_logrotate },
- { NULL, NULL }
+struct mon_cli_iface monitor_pac_methods = {
+ { &mon_cli_iface_meta, 0 },
+ .ping = monitor_common_pong,
+ .resInit = monitor_common_res_init,
+ .shutDown = NULL,
+ .goOffline = NULL,
+ .resetOffline = NULL,
+ .rotateLogs = responder_logrotate,
+ .clearMemcache = NULL,
+ .clearEnumCache = NULL,
};
struct sbus_interface monitor_pac_interface = {
- MONITOR_INTERFACE,
MONITOR_PATH,
- SBUS_DEFAULT_VTABLE,
- monitor_pac_methods,
+ &monitor_pac_methods.vtable,
NULL
};
-static struct sbus_method pac_dp_methods[] = {
- { NULL, NULL }
+static struct data_provider_iface pac_dp_methods = {
+ { &data_provider_iface_meta, 0 },
+ .RegisterService = NULL,
+ .pamHandler = NULL,
+ .sudoHandler = NULL,
+ .autofsHandler = NULL,
+ .hostHandler = NULL,
+ .getDomains = NULL,
+ .getAccountInfo = NULL,
};
struct sbus_interface pac_dp_interface = {
- DP_INTERFACE,
DP_PATH,
- SBUS_DEFAULT_VTABLE,
- pac_dp_methods,
+ &pac_dp_methods.vtable,
NULL
};
diff --git a/src/responder/pam/pamsrv.c b/src/responder/pam/pamsrv.c
index 5f9844eb..1fc9f628 100644
--- a/src/responder/pam/pamsrv.c
+++ b/src/responder/pam/pamsrv.c
@@ -47,30 +47,38 @@
#define DEFAULT_PAM_FD_LIMIT 8192
-struct sbus_method monitor_pam_methods[] = {
- { MON_CLI_METHOD_PING, monitor_common_pong },
- { MON_CLI_METHOD_RES_INIT, monitor_common_res_init },
- { MON_CLI_METHOD_ROTATE, responder_logrotate },
- { NULL, NULL }
+struct mon_cli_iface monitor_pam_methods = {
+ { &mon_cli_iface_meta, 0 },
+ .ping = monitor_common_pong,
+ .resInit = monitor_common_res_init,
+ .shutDown = NULL,
+ .goOffline = NULL,
+ .resetOffline = NULL,
+ .rotateLogs = responder_logrotate,
+ .clearMemcache = NULL,
+ .clearEnumCache = NULL,
};
struct sbus_interface monitor_pam_interface = {
- MONITOR_INTERFACE,
MONITOR_PATH,
- SBUS_DEFAULT_VTABLE,
- monitor_pam_methods,
+ &monitor_pam_methods.vtable,
NULL
};
-static struct sbus_method pam_dp_methods[] = {
- { NULL, NULL }
+static struct data_provider_iface pam_dp_methods = {
+ { &data_provider_iface_meta, 0 },
+ .RegisterService = NULL,
+ .pamHandler = NULL,
+ .sudoHandler = NULL,
+ .autofsHandler = NULL,
+ .hostHandler = NULL,
+ .getDomains = NULL,
+ .getAccountInfo = NULL,
};
struct sbus_interface pam_dp_interface = {
- DP_INTERFACE,
DP_PATH,
- SBUS_DEFAULT_VTABLE,
- pam_dp_methods,
+ &pam_dp_methods.vtable,
NULL
};
diff --git a/src/responder/ssh/sshsrv.c b/src/responder/ssh/sshsrv.c
index ea943afd..fb0738f6 100644
--- a/src/responder/ssh/sshsrv.c
+++ b/src/responder/ssh/sshsrv.c
@@ -28,30 +28,38 @@
#include "responder/ssh/sshsrv_private.h"
#include "providers/data_provider.h"
-struct sbus_method monitor_ssh_methods[] = {
- { MON_CLI_METHOD_PING, monitor_common_pong },
- { MON_CLI_METHOD_RES_INIT, monitor_common_res_init },
- { MON_CLI_METHOD_ROTATE, responder_logrotate },
- { NULL, NULL }
+struct mon_cli_iface monitor_ssh_methods = {
+ { &mon_cli_iface_meta, 0 },
+ .ping = monitor_common_pong,
+ .resInit = monitor_common_res_init,
+ .shutDown = NULL,
+ .goOffline = NULL,
+ .resetOffline = NULL,
+ .rotateLogs = responder_logrotate,
+ .clearMemcache = NULL,
+ .clearEnumCache = NULL,
};
struct sbus_interface monitor_ssh_interface = {
- MONITOR_INTERFACE,
MONITOR_PATH,
- SBUS_DEFAULT_VTABLE,
- monitor_ssh_methods,
+ &monitor_ssh_methods.vtable,
NULL
};
-static struct sbus_method ssh_dp_methods[] = {
- { NULL, NULL }
+static struct data_provider_iface ssh_dp_methods = {
+ { &data_provider_iface_meta, 0 },
+ .RegisterService = NULL,
+ .pamHandler = NULL,
+ .sudoHandler = NULL,
+ .autofsHandler = NULL,
+ .hostHandler = NULL,
+ .getDomains = NULL,
+ .getAccountInfo = NULL,
};
struct sbus_interface ssh_dp_interface = {
- DP_INTERFACE,
DP_PATH,
- SBUS_DEFAULT_VTABLE,
- ssh_dp_methods,
+ &ssh_dp_methods.vtable,
NULL
};
diff --git a/src/responder/sudo/sudosrv.c b/src/responder/sudo/sudosrv.c
index b821c96c..1ad260b3 100644
--- a/src/responder/sudo/sudosrv.c
+++ b/src/responder/sudo/sudosrv.c
@@ -28,30 +28,38 @@
#include "responder/sudo/sudosrv_private.h"
#include "providers/data_provider.h"
-struct sbus_method monitor_sudo_methods[] = {
- { MON_CLI_METHOD_PING, monitor_common_pong },
- { MON_CLI_METHOD_RES_INIT, monitor_common_res_init },
- { MON_CLI_METHOD_ROTATE, responder_logrotate },
- { NULL, NULL }
+struct mon_cli_iface monitor_sudo_methods = {
+ { &mon_cli_iface_meta, 0 },
+ .ping = monitor_common_pong,
+ .resInit = monitor_common_res_init,
+ .shutDown = NULL,
+ .goOffline = NULL,
+ .resetOffline = NULL,
+ .rotateLogs = responder_logrotate,
+ .clearMemcache = NULL,
+ .clearEnumCache = NULL,
};
struct sbus_interface monitor_sudo_interface = {
- MONITOR_INTERFACE,
MONITOR_PATH,
- SBUS_DEFAULT_VTABLE,
- monitor_sudo_methods,
+ &monitor_sudo_methods.vtable,
NULL
};
-static struct sbus_method sudo_dp_methods[] = {
- { NULL, NULL }
+static struct data_provider_iface sudo_dp_methods = {
+ { &data_provider_iface_meta, 0 },
+ .RegisterService = NULL,
+ .pamHandler = NULL,
+ .sudoHandler = NULL,
+ .autofsHandler = NULL,
+ .hostHandler = NULL,
+ .getDomains = NULL,
+ .getAccountInfo = NULL,
};
struct sbus_interface sudo_dp_interface = {
- DP_INTERFACE,
DP_PATH,
- SBUS_DEFAULT_VTABLE,
- sudo_dp_methods,
+ &sudo_dp_methods.vtable,
NULL
};