agent: Be explicit when RequestInput method return provides values
authorPatrik Flykt <patrik.flykt@linux.intel.com>
Fri, 2 Dec 2011 14:18:23 +0000 (16:18 +0200)
committerSamuel Ortiz <sameo@linux.intel.com>
Mon, 12 Dec 2011 09:44:40 +0000 (10:44 +0100)
Add a boolean variable to authentication_cb_t callback to explicitely
state when values are returned from RequestInput.

src/agent.c
src/connman.h

index 1c982ed..0bbb266 100644 (file)
@@ -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);
index 5711d54..d7d7d6c 100644 (file)
@@ -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,