From 68d71096a37780d0f8947066dc799aa7139b8fb8 Mon Sep 17 00:00:00 2001 From: Simo Sorce Date: Mon, 5 Jan 2009 12:18:43 -0500 Subject: Fix dp client to connect to the right dbus pipe --- server/providers/data_provider.c | 16 ++++++++-------- server/providers/data_provider_be.c | 27 ++++++++++++++++----------- 2 files changed, 24 insertions(+), 19 deletions(-) (limited to 'server/providers') diff --git a/server/providers/data_provider.c b/server/providers/data_provider.c index cc63b045b..823054ab7 100644 --- a/server/providers/data_provider.c +++ b/server/providers/data_provider.c @@ -191,8 +191,8 @@ static int dp_db_init(struct dp_ctx *dpctx) return EOK; } -static void identity_check(DBusPendingCall *pending, void *data); -static void online_check(DBusPendingCall *pending, void *data); +static void be_identity_check(DBusPendingCall *pending, void *data); +static void be_online_check(DBusPendingCall *pending, void *data); static int dbus_dp_init(struct sbus_conn_ctx *conn_ctx, void *data) { @@ -249,13 +249,13 @@ static int dbus_dp_init(struct sbus_conn_ctx *conn_ctx, void *data) } /* Set up the reply handler */ - dbus_pending_call_set_notify(pending_reply, identity_check, dpcli, NULL); + dbus_pending_call_set_notify(pending_reply, be_identity_check, dpcli, NULL); dbus_message_unref(msg); return EOK; } -static void identity_check(DBusPendingCall *pending, void *data) +static void be_identity_check(DBusPendingCall *pending, void *data) { struct dp_backend *dpbe; struct dp_frontend *dpfe; @@ -297,7 +297,7 @@ static void identity_check(DBusPendingCall *pending, void *data) DBUS_TYPE_STRING, &cli_domain, DBUS_TYPE_INVALID); if (!ret) { - DEBUG(1,("Failed, to parse message, killing connection\n")); + DEBUG(1,("be_identity_check failed, to parse message, killing connection\n")); sbus_disconnect(dpcli->conn_ctx); goto done; } @@ -377,7 +377,7 @@ done: dbus_message_unref(reply); } -static void online_check(DBusPendingCall *pending, void *data) +static void be_online_check(DBusPendingCall *pending, void *data) { return; } @@ -438,12 +438,12 @@ static int dp_srv_init(struct dp_ctx *dpctx) } /* Set up globally-available D-BUS methods */ - sd_ctx->interface = talloc_strdup(sd_ctx, DATA_PROVIDER_DBUS_INTERFACE); + sd_ctx->interface = talloc_strdup(sd_ctx, DATA_PROVIDER_INTERFACE); if (!sd_ctx->interface) { ret = ENOMEM; goto done; } - sd_ctx->path = talloc_strdup(sd_ctx, DATA_PROVIDER_DBUS_PATH); + sd_ctx->path = talloc_strdup(sd_ctx, DATA_PROVIDER_PATH); if (!sd_ctx->path) { ret = ENOMEM; goto done; diff --git a/server/providers/data_provider_be.c b/server/providers/data_provider_be.c index 982978aac..060b4e7a4 100644 --- a/server/providers/data_provider_be.c +++ b/server/providers/data_provider_be.c @@ -66,11 +66,11 @@ struct sbus_method mon_sbus_methods[] = { }; static int be_identity(DBusMessage *message, void *data, DBusMessage **r); -static int check_online(DBusMessage *message, void *data, DBusMessage **r); +static int be_check_online(DBusMessage *message, void *data, DBusMessage **r); struct sbus_method be_methods[] = { { DP_CLI_METHOD_IDENTITY, be_identity }, - { DP_CLI_METHOD_ONLINE, check_online }, + { DP_CLI_METHOD_ONLINE, be_check_online }, { NULL, NULL } }; @@ -91,6 +91,8 @@ static int service_identity(DBusMessage *message, void *data, DBusMessage **r) ctx = talloc_get_type(user_data, struct be_ctx); if (!ctx) return EINVAL; + DEBUG(4,("Sending ID reply: (%s,%d)\n", ctx->identity, version)); + reply = dbus_message_new_method_return(message); ret = dbus_message_append_args(reply, DBUS_TYPE_STRING, &ctx->identity, @@ -137,6 +139,9 @@ static int be_identity(DBusMessage *message, void *data, DBusMessage **r) ctx = talloc_get_type(user_data, struct be_ctx); if (!ctx) return EINVAL; + DEBUG(4,("Sending ID reply: (%d,%d,%s,%s)\n", + clitype, version, ctx->name, ctx->domain)); + reply = dbus_message_new_method_return(message); ret = dbus_message_append_args(reply, DBUS_TYPE_UINT16, &clitype, @@ -152,7 +157,7 @@ static int be_identity(DBusMessage *message, void *data, DBusMessage **r) return EOK; } -static int check_online(DBusMessage *message, void *data, DBusMessage **r) +static int be_check_online(DBusMessage *message, void *data, DBusMessage **r) { struct sbus_message_handler_ctx *smh_ctx; struct be_ctx *ctx; @@ -215,7 +220,7 @@ static int be_dp_sbus_init(TALLOC_CTX *mem_ctx, struct service_sbus_ctx *ss_ctx; struct sbus_method_ctx *sm_ctx; TALLOC_CTX *tmp_ctx; - char *default_monitor_address; + char *default_dp_address; char *sbus_address; DBusConnection *conn; int ret; @@ -233,16 +238,16 @@ static int be_dp_sbus_init(TALLOC_CTX *mem_ctx, } ss_ctx->ev = ev; - default_monitor_address = talloc_asprintf(tmp_ctx, "unix:path=%s/%s", - PIPE_PATH, SSSD_SERVICE_PIPE); - if (default_monitor_address == NULL) { + default_dp_address = talloc_asprintf(tmp_ctx, "unix:path=%s/%s", + PIPE_PATH, DATA_PROVIDER_PIPE); + if (default_dp_address == NULL) { ret = ENOMEM; goto done; } ret = confdb_get_string(cdb, tmp_ctx, - "config/services/monitor", "sbusAddress", - default_monitor_address, &sbus_address); + "config/services/dp", "sbusAddress", + default_dp_address, &sbus_address); if (ret != EOK) goto done; ret = sbus_new_connection(ss_ctx, ss_ctx->ev, @@ -259,8 +264,8 @@ static int be_dp_sbus_init(TALLOC_CTX *mem_ctx, goto done; } - sm_ctx->interface = talloc_strdup(sm_ctx, SERVICE_INTERFACE); - sm_ctx->path = talloc_strdup(sm_ctx, SERVICE_PATH); + sm_ctx->interface = talloc_strdup(sm_ctx, DATA_PROVIDER_INTERFACE); + sm_ctx->path = talloc_strdup(sm_ctx, DATA_PROVIDER_PATH); if (!sm_ctx->interface || !sm_ctx->path) { ret = ENOMEM; goto done; -- cgit