agent: Adding a parameter to give the error name to authentication callback
authorTomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
Thu, 3 May 2012 12:15:57 +0000 (15:15 +0300)
committerPatrik Flykt <patrik.flykt@linux.intel.com>
Fri, 4 May 2012 08:09:42 +0000 (11:09 +0300)
src/agent.c
src/connman.h
src/service.c
src/wispr.c

index 511049b..96d40ca 100644 (file)
@@ -96,6 +96,7 @@ static void request_input_passphrase_reply(DBusPendingCall *call, void *user_dat
        struct request_input_reply *passphrase_reply = user_data;
        connman_bool_t values_received = FALSE;
        connman_bool_t wps = FALSE;
+       const char *error = NULL;
        char *identity = NULL;
        char *passphrase = NULL;
        char *wpspin = NULL;
@@ -105,8 +106,10 @@ static void request_input_passphrase_reply(DBusPendingCall *call, void *user_dat
        DBusMessageIter iter, dict;
        DBusMessage *reply = dbus_pending_call_steal_reply(call);
 
-       if (dbus_message_get_type(reply) == DBUS_MESSAGE_TYPE_ERROR)
+       if (dbus_message_get_type(reply) == DBUS_MESSAGE_TYPE_ERROR) {
+               error = dbus_message_get_error_name(reply);
                goto done;
+       }
 
        values_received = TRUE;
 
@@ -176,7 +179,7 @@ done:
        passphrase_reply->callback(passphrase_reply->service, values_received,
                                name, name_len,
                                identity, passphrase,
-                               wps, wpspin,
+                               wps, wpspin, error,
                                passphrase_reply->user_data);
        connman_service_unref(passphrase_reply->service);
        dbus_message_unref(reply);
@@ -311,14 +314,17 @@ static void request_input_append_password(DBusMessageIter *iter,
 static void request_input_login_reply(DBusPendingCall *call, void *user_data)
 {
        struct request_input_reply *username_password_reply = user_data;
+       const char *error = NULL;
        char *username = NULL;
        char *password = NULL;
        char *key;
        DBusMessageIter iter, dict;
        DBusMessage *reply = dbus_pending_call_steal_reply(call);
 
-       if (dbus_message_get_type(reply) == DBUS_MESSAGE_TYPE_ERROR)
+       if (dbus_message_get_type(reply) == DBUS_MESSAGE_TYPE_ERROR) {
+               error = dbus_message_get_error_name(reply);
                goto done;
+       }
 
        dbus_message_iter_init(reply, &iter);
        dbus_message_iter_recurse(&iter, &dict);
@@ -355,7 +361,7 @@ done:
        username_password_reply->callback(username_password_reply->service,
                                        TRUE, NULL, 0,
                                        username, password,
-                                       FALSE, NULL,
+                                       FALSE, NULL, error,
                                        username_password_reply->user_data);
        connman_service_unref(username_password_reply->service);
        dbus_message_unref(reply);
index 550107c..2e8cfee 100644 (file)
@@ -91,7 +91,7 @@ typedef void (* authentication_cb_t) (struct connman_service *service,
                                const char *name, int name_len,
                                const char *identifier, const char *secret,
                                gboolean wps, const char *wpspin,
-                               void *user_data);
+                               const char *error, void *user_data);
 typedef void (* browser_authentication_cb_t) (struct connman_service *service,
                                connman_bool_t authentication_done,
                                void *user_data);
index 018f12f..97a4263 100644 (file)
@@ -4402,7 +4402,7 @@ static void request_input_cb (struct connman_service *service,
                        const char *name, int name_len,
                        const char *identity, const char *passphrase,
                        gboolean wps, const char *wpspin,
-                       void *user_data)
+                       const char *error, void *user_data)
 {
        struct connman_device *device;
        int err = 0;
index b56a649..96bdeb1 100644 (file)
@@ -525,7 +525,7 @@ static void wispr_portal_request_wispr_login(struct connman_service *service,
                                const char *ssid, int ssid_len,
                                const char *username, const char *password,
                                gboolean wps, const char *wpspin,
-                               void *user_data)
+                               const char *error, void *user_data)
 {
        struct connman_wispr_portal_context *wp_context = user_data;