summaryrefslogtreecommitdiffstats
path: root/src/responder/ifp/ifpsrv_cmd.c
diff options
context:
space:
mode:
authorJakub Hrozek <jhrozek@redhat.com>2014-01-06 15:15:40 +0100
committerJakub Hrozek <jhrozek@redhat.com>2014-04-04 14:05:50 +0200
commit8214510f125879c3b1d247f2ce981ee20b5375d1 (patch)
tree5e0a7f31fb71bafbd2da0bea6aafb39eb242ec6e /src/responder/ifp/ifpsrv_cmd.c
parentcb4d5b588e704114b7090678752d33512baa718e (diff)
downloadsssd-8214510f125879c3b1d247f2ce981ee20b5375d1.tar.gz
sssd-8214510f125879c3b1d247f2ce981ee20b5375d1.tar.xz
sssd-8214510f125879c3b1d247f2ce981ee20b5375d1.zip
IFP: Connect to the system bus
Related: https://fedorahosted.org/sssd/ticket/2072 Adds the possibility for the InfoPipe responder to connect to the system bus. At the moment, only a dummy method "Ping" is provided. The method only accepts a single string parameter that has to be 'ping'.
Diffstat (limited to 'src/responder/ifp/ifpsrv_cmd.c')
-rw-r--r--src/responder/ifp/ifpsrv_cmd.c36
1 files changed, 36 insertions, 0 deletions
diff --git a/src/responder/ifp/ifpsrv_cmd.c b/src/responder/ifp/ifpsrv_cmd.c
index b9641ff60..4f73342dd 100644
--- a/src/responder/ifp/ifpsrv_cmd.c
+++ b/src/responder/ifp/ifpsrv_cmd.c
@@ -30,3 +30,39 @@ struct cli_protocol_version *register_cli_protocol_version(void)
return ssh_cli_protocol_version;
}
+
+/* This is a throwaway method to ease the review of the patch.
+ * It will be removed later */
+int ifp_ping(struct sbus_request *dbus_req, void *data)
+{
+ struct ifp_ctx *ifp_ctx = talloc_get_type(data, struct ifp_ctx);
+ static const char *pong = "PONG";
+ const char *request;
+ DBusError dberr;
+
+ if (ifp_ctx == NULL) {
+ DEBUG(SSSDBG_CRIT_FAILURE, "Invalid pointer!\n");
+ return sbus_request_return_and_finish(dbus_req, DBUS_TYPE_INVALID);
+ }
+
+
+ if (!sbus_request_parse_or_finish(dbus_req,
+ DBUS_TYPE_STRING, &request,
+ DBUS_TYPE_INVALID)) {
+ return EOK; /* handled */
+ }
+
+ DEBUG(SSSDBG_CONF_SETTINGS, "Got request for [%s]\n", request);
+
+ if (strcasecmp(request, "ping") != 0) {
+ dbus_error_init(&dberr);
+ dbus_set_error_const(&dberr,
+ DBUS_ERROR_INVALID_ARGS,
+ "Ping() only accepts ping as a param\n");
+ return sbus_request_fail_and_finish(dbus_req, &dberr);
+ }
+
+ return sbus_request_return_and_finish(dbus_req,
+ DBUS_TYPE_STRING, &pong,
+ DBUS_TYPE_INVALID);
+}