summaryrefslogtreecommitdiff
path: root/server/infopipe/infopipe.c
diff options
context:
space:
mode:
authorStephen Gallagher <sgallagh@redhat.com>2009-02-23 08:46:46 -0500
committerSimo Sorce <idra@samba.org>2009-02-23 10:26:22 -0500
commitf8469b71247b5a41cfdf0f54c25ceda1552e0ee9 (patch)
treee61b1ab3b30174ea76c05120acfbe02640377b0e /server/infopipe/infopipe.c
parent70901a109f546b0d5adcbb01430649cddf607e35 (diff)
downloadsssd-f8469b71247b5a41cfdf0f54c25ceda1552e0ee9.tar.gz
sssd-f8469b71247b5a41cfdf0f54c25ceda1552e0ee9.tar.bz2
sssd-f8469b71247b5a41cfdf0f54c25ceda1552e0ee9.zip
Attach the InfoPipe to the D-BUS system bus. InfoPipe is now capable of listening for requests to org.freeipa.sssd.infopipe
I made the sbus_add_connection function public so that I could use it for system bus connections. Adding initial framework for the InfoPipe Updating sysdb tests for the refactored sysdb methods.
Diffstat (limited to 'server/infopipe/infopipe.c')
-rw-r--r--server/infopipe/infopipe.c46
1 files changed, 38 insertions, 8 deletions
diff --git a/server/infopipe/infopipe.c b/server/infopipe/infopipe.c
index 81541d82..8fe7ee72 100644
--- a/server/infopipe/infopipe.c
+++ b/server/infopipe/infopipe.c
@@ -22,13 +22,14 @@
#include <stdlib.h>
#include <stdio.h>
#include "popt.h"
-#include "infopipe.h"
#include "util/util.h"
+#include "util/btreemap.h"
#include "sbus/sssd_dbus.h"
#include "sbus/sbus_client.h"
#include "monitor/monitor_sbus.h"
#include "monitor/monitor_interfaces.h"
#include "infopipe/sysbus.h"
+#include "infopipe.h"
struct infp_ctx {
struct event_context *ev;
@@ -37,11 +38,6 @@ struct infp_ctx {
struct sysbus_ctx *sysbus;
};
-struct sbus_method infp_methods[] = {
- { SYSBUS_GET_PARAM, sysbus_get_param },
- { NULL, NULL }
-};
-
static int service_identity(DBusMessage *message, void *data, DBusMessage **r)
{
dbus_uint16_t version = INFOPIPE_VERSION;
@@ -134,6 +130,21 @@ static int infp_monitor_init(struct infp_ctx *infp_ctx)
return EOK;
}
+struct sbus_method infp_methods[] = {
+ INFP_USER_METHODS
+ INFP_GROUP_METHODS
+ { NULL, NULL }
+};
+
+int infp_introspect(DBusMessage *message, void *data, DBusMessage **r)
+{
+ /* Return the Introspection XML */
+
+ /* TODO: actually return the file */
+ *r = dbus_message_new_error(message, DBUS_ERROR_NOT_SUPPORTED, "Not yet implemented");
+ return EOK;
+}
+
static int infp_process_init(TALLOC_CTX *mem_ctx,
struct event_context *ev,
struct confdb_ctx *cdb)
@@ -153,14 +164,33 @@ static int infp_process_init(TALLOC_CTX *mem_ctx,
ret = infp_monitor_init(infp_ctx);
if (ret != EOK) {
DEBUG(0, ("Fatal error setting up monitor bus\n"));
+ return EIO;
+ }
+
+ /* Connect to the D-BUS system bus and set up methods */
+ ret = sysbus_init(infp_ctx, &infp_ctx->sysbus,
+ infp_ctx->ev, INFOPIPE_DBUS_NAME,
+ INFOPIPE_INTERFACE, INFOPIPE_PATH,
+ infp_methods, infp_introspect);
+ if (ret != EOK) {
+ DEBUG(0, ("Failed to connect to the system message bus\n"));
+ return EIO;
}
- /* Connect to the D-BUS system bus */
- ret = sysbus_init(infp_ctx, &infp_ctx->sysbus, infp_methods);
+ /* Add the infp_ctx to the sbus_conn_ctx private data
+ * so we can pass it into message handler functions
+ */
+ sbus_conn_set_private_data(sysbus_get_sbus_conn(infp_ctx->sysbus), infp_ctx);
return ret;
}
+int infp_check_permissions(DBusMessage *message, void *data, DBusMessage **r)
+{
+ *r = dbus_message_new_error(message, DBUS_ERROR_NOT_SUPPORTED, "Not yet implemented");
+ return EOK;
+}
+
int main(int argc, const char *argv[])
{
int opt;