From 5bc1f27efd0ebe70b5bddfab5543a8f48f33eae6 Mon Sep 17 00:00:00 2001 From: Patrik Flykt Date: Fri, 2 Dec 2011 16:18:23 +0200 Subject: [PATCH] agent: Be explicit when RequestInput method return provides values Add a boolean variable to authentication_cb_t callback to explicitely state when values are returned from RequestInput. --- src/agent.c | 9 +++++++-- src/connman.h | 1 + 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/agent.c b/src/agent.c index 1c982ed..0bbb266 100644 --- a/src/agent.c +++ b/src/agent.c @@ -94,6 +94,7 @@ struct request_input_reply { static void request_input_passphrase_reply(DBusPendingCall *call, void *user_data) { struct request_input_reply *passphrase_reply = user_data; + connman_bool_t values_received = FALSE; connman_bool_t wps = FALSE; char *identity = NULL; char *passphrase = NULL; @@ -105,6 +106,8 @@ static void request_input_passphrase_reply(DBusPendingCall *call, void *user_dat if (dbus_message_get_type(reply) == DBUS_MESSAGE_TYPE_ERROR) goto done; + values_received = TRUE; + dbus_message_iter_init(reply, &iter); dbus_message_iter_recurse(&iter, &dict); while (dbus_message_iter_get_arg_type(&dict) == DBUS_TYPE_DICT_ENTRY) { @@ -164,8 +167,9 @@ static void request_input_passphrase_reply(DBusPendingCall *call, void *user_dat } done: - passphrase_reply->callback(passphrase_reply->service, identity, - passphrase, passphrase_reply->user_data); + passphrase_reply->callback(passphrase_reply->service, values_received, + identity, passphrase, + passphrase_reply->user_data); connman_service_unref(passphrase_reply->service); dbus_message_unref(reply); g_free(passphrase_reply); @@ -314,6 +318,7 @@ static void request_input_login_reply(DBusPendingCall *call, void *user_data) done: username_password_reply->callback(username_password_reply->service, + TRUE, username, password, username_password_reply->user_data); connman_service_unref(username_password_reply->service); diff --git a/src/connman.h b/src/connman.h index 5711d54..d7d7d6c 100644 --- a/src/connman.h +++ b/src/connman.h @@ -83,6 +83,7 @@ void __connman_counter_cleanup(void); struct connman_service; typedef void (* authentication_cb_t) (struct connman_service *service, + connman_bool_t values_received, const char *identifier, const char *secret, void *user_data); typedef void (* report_error_cb_t) (struct connman_service *service, -- 2.7.4