diff options
author | Stef Walter <stefw@redhat.com> | 2014-01-10 11:23:33 +0100 |
---|---|---|
committer | Jakub Hrozek <jhrozek@redhat.com> | 2014-02-24 11:15:06 +0100 |
commit | b668c77874c6fed325471bdcf5954979a0d734e2 (patch) | |
tree | f2aa1495fd35dabd42b96dec8d190478cb5d7f26 /src | |
parent | c2cc119de8eac712c040b3993f41c967ff2278de (diff) | |
download | sssd-b668c77874c6fed325471bdcf5954979a0d734e2.tar.gz sssd-b668c77874c6fed325471bdcf5954979a0d734e2.tar.xz sssd-b668c77874c6fed325471bdcf5954979a0d734e2.zip |
sbus: Use constants to make dbus calls
This allows us to remove duplicated information, and have the
compiler check that when an method name is changed or removed
the callers are updated.
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')
-rw-r--r-- | src/monitor/monitor.c | 18 | ||||
-rw-r--r-- | src/monitor/monitor_interfaces.h | 17 | ||||
-rw-r--r-- | src/monitor/monitor_sbus.c | 4 | ||||
-rw-r--r-- | src/providers/data_provider.h | 17 | ||||
-rw-r--r-- | src/providers/data_provider_be.c | 4 | ||||
-rw-r--r-- | src/providers/data_provider_iface.xml | 6 | ||||
-rw-r--r-- | src/providers/dp_auth_util.c | 4 | ||||
-rw-r--r-- | src/providers/proxy/proxy_auth.c | 4 | ||||
-rw-r--r-- | src/providers/proxy/proxy_child.c | 4 | ||||
-rw-r--r-- | src/responder/autofs/autofssrv_dp.c | 4 | ||||
-rw-r--r-- | src/responder/common/responder_dp.c | 4 | ||||
-rw-r--r-- | src/responder/common/responder_get_domains.c | 4 | ||||
-rw-r--r-- | src/responder/pam/pamsrv_dp.c | 4 | ||||
-rw-r--r-- | src/responder/ssh/sshsrv_dp.c | 4 | ||||
-rw-r--r-- | src/responder/sudo/sudosrv_dp.c | 4 |
15 files changed, 37 insertions, 65 deletions
diff --git a/src/monitor/monitor.c b/src/monitor/monitor.c index c2e5a5af6..ecfa95cfd 100644 --- a/src/monitor/monitor.c +++ b/src/monitor/monitor.c @@ -752,7 +752,7 @@ static int service_signal(struct mt_svc *svc, const char *svc_signal) msg = dbus_message_new_method_call(NULL, MONITOR_PATH, - MONITOR_INTERFACE, + MON_CLI_IFACE, svc_signal); if (msg == NULL) { DEBUG(SSSDBG_FATAL_FAILURE, @@ -772,27 +772,27 @@ static int service_signal(struct mt_svc *svc, const char *svc_signal) static int service_signal_dns_reload(struct mt_svc *svc) { - return service_signal(svc, MON_CLI_METHOD_RES_INIT); + return service_signal(svc, MON_CLI_IFACE_RESINIT); } static int service_signal_offline(struct mt_svc *svc) { - return service_signal(svc, MON_CLI_METHOD_OFFLINE); + return service_signal(svc, MON_CLI_IFACE_GOOFFLINE); } static int service_signal_reset_offline(struct mt_svc *svc) { - return service_signal(svc, MON_CLI_METHOD_RESET_OFFLINE); + return service_signal(svc, MON_CLI_IFACE_RESETOFFLINE); } static int service_signal_rotate(struct mt_svc *svc) { - return service_signal(svc, MON_CLI_METHOD_ROTATE); + return service_signal(svc, MON_CLI_IFACE_ROTATELOGS); } static int service_signal_clear_memcache(struct mt_svc *svc) { - return service_signal(svc, MON_CLI_METHOD_CLEAR_MEMCACHE); + return service_signal(svc, MON_CLI_IFACE_CLEARMEMCACHE); } static int service_signal_clear_enum_cache(struct mt_svc *svc) { - return service_signal(svc, MON_CLI_METHOD_CLEAR_ENUM_CACHE); + return service_signal(svc, MON_CLI_IFACE_CLEARENUMCACHE); } static int check_domain_ranges(struct sss_domain_info *domains) @@ -2392,8 +2392,8 @@ static int service_send_ping(struct mt_svc *svc) */ msg = dbus_message_new_method_call(NULL, MONITOR_PATH, - MONITOR_INTERFACE, - MON_CLI_METHOD_PING); + MON_CLI_IFACE, + MON_CLI_IFACE_PING); if (!msg) { DEBUG(SSSDBG_FATAL_FAILURE,"Out of memory?!\n"); talloc_zfree(svc->conn); diff --git a/src/monitor/monitor_interfaces.h b/src/monitor/monitor_interfaces.h index 308642f78..ef4254a5f 100644 --- a/src/monitor/monitor_interfaces.h +++ b/src/monitor/monitor_interfaces.h @@ -29,26 +29,9 @@ /*** Monitor SRV Interface ***/ #define MON_SRV_PATH "/org/freedesktop/sssd/monitor" -#define MON_SRV_INTERFACE "org.freedesktop.sssd.monitor" - -/* Monitor SRV Methods */ -#define MON_SRV_METHOD_VERSION "getVersion" -#define MON_SRV_METHOD_REGISTER "RegisterService" /*** Monitor CLI Interface ***/ #define MONITOR_PATH "/org/freedesktop/sssd/service" -#define MONITOR_INTERFACE "org.freedesktop.sssd.service" - -/* Monitor CLI Methods */ -#define MON_CLI_METHOD_IDENTITY "getIdentity" -#define MON_CLI_METHOD_PING "ping" -#define MON_CLI_METHOD_SHUTDOWN "shutDown" -#define MON_CLI_METHOD_RES_INIT "resInit" -#define MON_CLI_METHOD_OFFLINE "goOffline" /* Applicable only to providers */ -#define MON_CLI_METHOD_RESET_OFFLINE "resetOffline" /* Applicable only to providers */ -#define MON_CLI_METHOD_ROTATE "rotateLogs" -#define MON_CLI_METHOD_CLEAR_MEMCACHE "clearMemcache" -#define MON_CLI_METHOD_CLEAR_ENUM_CACHE "clearEnumCache" #define SSSD_SERVICE_PIPE "private/sbus-monitor" diff --git a/src/monitor/monitor_sbus.c b/src/monitor/monitor_sbus.c index 4b0e221e8..b1550bcdd 100644 --- a/src/monitor/monitor_sbus.c +++ b/src/monitor/monitor_sbus.c @@ -119,8 +119,8 @@ int monitor_common_send_id(struct sbus_connection *conn, /* create the message */ msg = dbus_message_new_method_call(NULL, MON_SRV_PATH, - MON_SRV_INTERFACE, - MON_SRV_METHOD_REGISTER); + MON_SRV_IFACE, + MON_SRV_IFACE_REGISTERSERVICE); if (msg == NULL) { DEBUG(SSSDBG_FATAL_FAILURE, "Out of memory?!\n"); return ENOMEM; diff --git a/src/providers/data_provider.h b/src/providers/data_provider.h index 714983032..5622cc1fa 100644 --- a/src/providers/data_provider.h +++ b/src/providers/data_provider.h @@ -48,23 +48,8 @@ #define DATA_PROVIDER_VERSION 0x0001 #define DATA_PROVIDER_PIPE "private/sbus-dp" -#define DP_INTERFACE "org.freedesktop.sssd.dataprovider" #define DP_PATH "/org/freedesktop/sssd/dataprovider" -#define DP_METHOD_REGISTER "RegisterService" -#define DP_METHOD_GETACCTINFO "getAccountInfo" -#define DP_METHOD_SUDOHANDLER "sudoHandler" -#define DP_METHOD_AUTOFSHANDLER "autofsHandler" -#define DP_METHOD_HOSTHANDLER "hostHandler" -#define DP_METHOD_GETDOMAINS "getDomains" - -/* this is a reverse method sent from providers to - * the nss responder to tell it to update the mmap - * cache */ -#define DP_REV_INTERFACE "org.freedesktop.sssd.dataprovider_rev" -#define DP_REV_METHOD_UPDATE_CACHE "updateCache" -#define DP_REV_METHOD_INITGR_CHECK "initgrCheck" - /** * @defgroup pamHandler PAM DBUS request * @ingroup sss_pam @@ -125,8 +110,6 @@ */ -#define DP_METHOD_PAMHANDLER "pamHandler" - /** * @} */ /* end of group pamHandler */ diff --git a/src/providers/data_provider_be.c b/src/providers/data_provider_be.c index 67d521032..5519237e8 100644 --- a/src/providers/data_provider_be.c +++ b/src/providers/data_provider_be.c @@ -856,8 +856,8 @@ static void acctinfo_initgroups_callback(struct be_req *be_req, /* Set up null request */ msg = dbus_message_new_method_call(NULL, DP_PATH, - DP_REV_INTERFACE, - DP_REV_METHOD_INITGR_CHECK); + DATA_PROVIDER_REV_IFACE, + DATA_PROVIDER_REV_IFACE_INITGRCHECK); if (!msg) { DEBUG(SSSDBG_CRIT_FAILURE, "Out of memory?!\n"); ret = ENOMEM; diff --git a/src/providers/data_provider_iface.xml b/src/providers/data_provider_iface.xml index 1f3496493..90397f1b2 100644 --- a/src/providers/data_provider_iface.xml +++ b/src/providers/data_provider_iface.xml @@ -26,6 +26,12 @@ </method> </interface> + <!-- + this is a reverse method sent from providers to + the nss responder to tell it to update the mmap + cache + --> + <interface name="org.freedesktop.sssd.dataprovider_rev"> <annotation value="data_provider_rev_iface" name="org.freedesktop.DBus.GLib.CSymbol"/> <method name="updateCache"> diff --git a/src/providers/dp_auth_util.c b/src/providers/dp_auth_util.c index 196a0520c..391d55c1e 100644 --- a/src/providers/dp_auth_util.c +++ b/src/providers/dp_auth_util.c @@ -364,8 +364,8 @@ int dp_common_send_id(struct sbus_connection *conn, uint16_t version, /* create the message */ msg = dbus_message_new_method_call(NULL, DP_PATH, - DP_INTERFACE, - DP_METHOD_REGISTER); + DATA_PROVIDER_IFACE, + DATA_PROVIDER_IFACE_REGISTERSERVICE); if (msg == NULL) { DEBUG(SSSDBG_FATAL_FAILURE, "Out of memory?!\n"); return ENOMEM; diff --git a/src/providers/proxy/proxy_auth.c b/src/providers/proxy/proxy_auth.c index c2b792bd8..a901f0f17 100644 --- a/src/providers/proxy/proxy_auth.c +++ b/src/providers/proxy/proxy_auth.c @@ -602,8 +602,8 @@ static struct tevent_req *proxy_pam_conv_send(TALLOC_CTX *mem_ctx, msg = dbus_message_new_method_call(NULL, DP_PATH, - DP_INTERFACE, - DP_METHOD_PAMHANDLER); + DATA_PROVIDER_IFACE, + DATA_PROVIDER_IFACE_PAMHANDLER); if (msg == NULL) { DEBUG(SSSDBG_CRIT_FAILURE, "dbus_message_new_method_call failed.\n"); talloc_zfree(req); diff --git a/src/providers/proxy/proxy_child.c b/src/providers/proxy/proxy_child.c index 737b0cfd6..b99c35317 100644 --- a/src/providers/proxy/proxy_child.c +++ b/src/providers/proxy/proxy_child.c @@ -432,8 +432,8 @@ int proxy_child_send_id(struct sbus_connection *conn, /* create the message */ msg = dbus_message_new_method_call(NULL, DP_PATH, - DP_INTERFACE, - DP_METHOD_REGISTER); + DATA_PROVIDER_IFACE, + DATA_PROVIDER_IFACE_REGISTERSERVICE); if (msg == NULL) { DEBUG(SSSDBG_FATAL_FAILURE, "Out of memory?!\n"); return ENOMEM; diff --git a/src/responder/autofs/autofssrv_dp.c b/src/responder/autofs/autofssrv_dp.c index 975692aad..041f0629e 100644 --- a/src/responder/autofs/autofssrv_dp.c +++ b/src/responder/autofs/autofssrv_dp.c @@ -118,8 +118,8 @@ sss_dp_get_autofs_msg(void *pvt) msg = dbus_message_new_method_call(NULL, DP_PATH, - DP_INTERFACE, - DP_METHOD_AUTOFSHANDLER); + DATA_PROVIDER_IFACE, + DATA_PROVIDER_IFACE_AUTOFSHANDLER); if (msg == NULL) { DEBUG(SSSDBG_CRIT_FAILURE, "Out of memory?!\n"); return NULL; diff --git a/src/responder/common/responder_dp.c b/src/responder/common/responder_dp.c index a9b4ae23a..df7455ce3 100644 --- a/src/responder/common/responder_dp.c +++ b/src/responder/common/responder_dp.c @@ -588,8 +588,8 @@ sss_dp_get_account_msg(void *pvt) msg = dbus_message_new_method_call(NULL, DP_PATH, - DP_INTERFACE, - DP_METHOD_GETACCTINFO); + DATA_PROVIDER_IFACE, + DATA_PROVIDER_IFACE_GETACCOUNTINFO); if (msg == NULL) { talloc_free(filter); DEBUG(SSSDBG_CRIT_FAILURE, "Out of memory?!\n"); diff --git a/src/responder/common/responder_get_domains.c b/src/responder/common/responder_get_domains.c index ba9a0905f..23b274b52 100644 --- a/src/responder/common/responder_get_domains.c +++ b/src/responder/common/responder_get_domains.c @@ -94,8 +94,8 @@ sss_dp_get_domains_msg(void *pvt) msg = dbus_message_new_method_call(NULL, DP_PATH, - DP_INTERFACE, - DP_METHOD_GETDOMAINS); + DATA_PROVIDER_IFACE, + DATA_PROVIDER_IFACE_GETDOMAINS); if (msg == NULL) { DEBUG(SSSDBG_CRIT_FAILURE, "Out of memory?!\n"); return NULL; diff --git a/src/responder/pam/pamsrv_dp.c b/src/responder/pam/pamsrv_dp.c index 4e79eee87..8871f198b 100644 --- a/src/responder/pam/pamsrv_dp.c +++ b/src/responder/pam/pamsrv_dp.c @@ -128,8 +128,8 @@ int pam_dp_send_req(struct pam_auth_req *preq, int timeout) msg = dbus_message_new_method_call(NULL, DP_PATH, - DP_INTERFACE, - DP_METHOD_PAMHANDLER); + DATA_PROVIDER_IFACE, + DATA_PROVIDER_IFACE_PAMHANDLER); if (msg == NULL) { DEBUG(SSSDBG_FATAL_FAILURE,"Out of memory?!\n"); return ENOMEM; diff --git a/src/responder/ssh/sshsrv_dp.c b/src/responder/ssh/sshsrv_dp.c index 7ba65b12c..90b0b5754 100644 --- a/src/responder/ssh/sshsrv_dp.c +++ b/src/responder/ssh/sshsrv_dp.c @@ -126,8 +126,8 @@ sss_dp_get_ssh_host_msg(void *pvt) msg = dbus_message_new_method_call(NULL, DP_PATH, - DP_INTERFACE, - DP_METHOD_HOSTHANDLER); + DATA_PROVIDER_IFACE, + DATA_PROVIDER_IFACE_HOSTHANDLER); if (msg == NULL) { DEBUG(SSSDBG_CRIT_FAILURE, "Out of memory?!\n"); talloc_free(filter); diff --git a/src/responder/sudo/sudosrv_dp.c b/src/responder/sudo/sudosrv_dp.c index 483533ccc..18e51a927 100644 --- a/src/responder/sudo/sudosrv_dp.c +++ b/src/responder/sudo/sudosrv_dp.c @@ -141,8 +141,8 @@ sss_dp_get_sudoers_msg(void *pvt) msg = dbus_message_new_method_call(NULL, DP_PATH, - DP_INTERFACE, - DP_METHOD_SUDOHANDLER); + DATA_PROVIDER_IFACE, + DATA_PROVIDER_IFACE_SUDOHANDLER); if (msg == NULL) { DEBUG(SSSDBG_CRIT_FAILURE, "Out of memory?!\n"); return NULL; |