diff options
author | Simo Sorce <ssorce@redhat.com> | 2009-08-11 12:03:01 -0400 |
---|---|---|
committer | Stephen Gallagher <sgallagh@redhat.com> | 2009-08-11 13:27:30 -0400 |
commit | 2de7dab64517fcaee5198342e9b7890cdf1c7776 (patch) | |
tree | c9cd5373ccdccb3211dba7bdfe88324e2efd76e6 /server/providers/data_provider_be.c | |
parent | ab9cfe72d18531ca0fc93c772582329a3b0c5dc9 (diff) | |
download | sssd-2de7dab64517fcaee5198342e9b7890cdf1c7776.tar.gz sssd-2de7dab64517fcaee5198342e9b7890cdf1c7776.tar.xz sssd-2de7dab64517fcaee5198342e9b7890cdf1c7776.zip |
Change the why DP clients identify
Mirrors what we have done with the monitor.
Diffstat (limited to 'server/providers/data_provider_be.c')
-rw-r--r-- | server/providers/data_provider_be.c | 65 |
1 files changed, 22 insertions, 43 deletions
diff --git a/server/providers/data_provider_be.c b/server/providers/data_provider_be.c index 46f8db51d..c92289b6d 100644 --- a/server/providers/data_provider_be.c +++ b/server/providers/data_provider_be.c @@ -62,13 +62,11 @@ struct sbus_interface monitor_be_interface = { NULL }; -static int be_identity(DBusMessage *message, struct sbus_connection *conn); static int be_check_online(DBusMessage *message, struct sbus_connection *conn); static int be_get_account_info(DBusMessage *message, struct sbus_connection *conn); static int be_pam_handler(DBusMessage *message, struct sbus_connection *conn); struct sbus_method be_methods[] = { - { DP_CLI_METHOD_IDENTITY, be_identity }, { DP_CLI_METHOD_ONLINE, be_check_online }, { DP_CLI_METHOD_GETACCTINFO, be_get_account_info }, { DP_CLI_METHOD_PAMHANDLER, be_pam_handler }, @@ -76,8 +74,8 @@ struct sbus_method be_methods[] = { }; struct sbus_interface be_interface = { - DATA_PROVIDER_INTERFACE, - DATA_PROVIDER_PATH, + DP_CLI_INTERFACE, + DP_CLI_PATH, SBUS_DEFAULT_VTABLE, be_methods, NULL @@ -92,44 +90,6 @@ static struct bet_data bet_data[] = { {BET_MAX, NULL, NULL} }; -static int be_identity(DBusMessage *message, struct sbus_connection *conn) -{ - dbus_uint16_t version = DATA_PROVIDER_VERSION; - dbus_uint16_t clitype = DP_CLI_BACKEND; - struct be_ctx *ctx; - DBusMessage *reply; - dbus_bool_t ret; - void *user_data; - - user_data = sbus_conn_get_private_data(conn); - if (!user_data) return EINVAL; - 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->name)); - - reply = dbus_message_new_method_return(message); - if (!reply) return ENOMEM; - - ret = dbus_message_append_args(reply, - DBUS_TYPE_UINT16, &clitype, - DBUS_TYPE_UINT16, &version, - DBUS_TYPE_STRING, &ctx->name, - DBUS_TYPE_STRING, &ctx->domain->name, - DBUS_TYPE_INVALID); - if (!ret) { - dbus_message_unref(reply); - return EIO; - } - - /* send reply back */ - sbus_conn_send_reply(conn, reply); - dbus_message_unref(reply); - - return EOK; -} - struct be_async_req { be_req_fn_t fn; struct be_req *req; @@ -661,6 +621,15 @@ static int be_cli_init(struct be_ctx *ctx) return ret; } + /* Identify ourselves to the data provider */ + ret = dp_common_send_id(ctx->dp_conn, + DP_CLI_BACKEND, DATA_PROVIDER_VERSION, + ctx->name, ctx->domain->name); + if (ret != EOK) { + DEBUG(0, ("Failed to identify to the data provider!\n")); + return ret; + } + /* Enable automatic reconnection to the Data Provider */ ret = confdb_get_int(ctx->cdb, ctx, SERVICE_CONF_ENTRY, "reconnection_retries", 3, &max_retries); @@ -686,11 +655,21 @@ static void be_cli_reconnect_init(struct sbus_connection *conn, int status, void /* Did we reconnect successfully? */ if (status == SBUS_RECONNECT_SUCCESS) { DEBUG(1, ("Reconnected to the Data Provider.\n")); - return; + + /* Identify ourselves to the data provider */ + ret = dp_common_send_id(be_ctx->dp_conn, + DP_CLI_BACKEND, DATA_PROVIDER_VERSION, + be_ctx->name, be_ctx->domain->name); + if (ret != EOK) { + DEBUG(0, ("Failed to send id to the data provider!\n")); + } else { + return; + } } /* Handle failure */ DEBUG(0, ("Could not reconnect to data provider.\n")); + /* Kill the backend and let the monitor restart it */ ret = be_finalize(be_ctx); if (ret != EOK) { |