dnsproxy: Only one copy of the relevant buffers will be made to a TCP request
[framework/connectivity/connman.git] / src / agent.c
index ebee19c..e1d7332 100644 (file)
@@ -334,6 +334,18 @@ static void request_input_append_password(DBusMessageIter *iter,
                                DBUS_TYPE_STRING, &str);
 }
 
+static void request_input_append_previouspassphrase(DBusMessageIter *iter,
+                                                       void *user_data)
+{
+       const char *passphrase = user_data;
+       const char *str = "informational";
+
+       connman_dbus_dict_append_basic(iter, "Type",
+                               DBUS_TYPE_STRING, &str);
+       connman_dbus_dict_append_basic(iter, "Value",
+                               DBUS_TYPE_STRING, &passphrase);
+}
+
 static void request_input_login_reply(DBusPendingCall *call, void *user_data)
 {
        struct request_input_reply *username_password_reply = user_data;
@@ -401,7 +413,7 @@ int __connman_agent_request_passphrase_input(struct connman_service *service,
                                authentication_cb_t callback, void *user_data)
 {
        DBusMessage *message;
-       const char *path;
+       const char *path, *passphrase;
        DBusMessageIter iter;
        DBusMessageIter dict;
        DBusPendingCall *call;
@@ -441,6 +453,11 @@ int __connman_agent_request_passphrase_input(struct connman_service *service,
                        CONNMAN_SERVICE_SECURITY_NONE) {
                connman_dbus_dict_append_dict(&dict, "Passphrase",
                                        request_input_append_passphrase, service);
+               passphrase = __connman_service_get_passphrase(service);
+               if (passphrase != NULL)
+                       connman_dbus_dict_append_dict(&dict, "PreviousPassphrase",
+                                       request_input_append_previouspassphrase,
+                                       (void *) passphrase);
        }
 
        if (__connman_service_wps_enabled(service) == TRUE) {
@@ -456,8 +473,9 @@ int __connman_agent_request_passphrase_input(struct connman_service *service,
                return -ENOMEM;
        }
 
-       if (dbus_connection_send_with_reply(connection, message,
-                                               &call, -1) == FALSE) {
+       if (dbus_connection_send_with_reply(connection, message, &call,
+                                       connman_timeout_input_request())
+                       == FALSE) {
                dbus_message_unref(message);
                g_free(passphrase_reply);
                return -ESRCH;
@@ -478,7 +496,7 @@ int __connman_agent_request_passphrase_input(struct connman_service *service,
 
        dbus_message_unref(message);
 
-       return -EIO;
+       return -EINPROGRESS;
 }
 
 int __connman_agent_request_login_input(struct connman_service *service,
@@ -522,8 +540,9 @@ int __connman_agent_request_login_input(struct connman_service *service,
                return -ENOMEM;
        }
 
-       if (dbus_connection_send_with_reply(connection, message,
-                                                       &call, -1) == FALSE) {
+       if (dbus_connection_send_with_reply(connection, message, &call,
+                                       connman_timeout_input_request())
+                       == FALSE) {
                dbus_message_unref(message);
                g_free(username_password_reply);
                return -ESRCH;
@@ -544,7 +563,7 @@ int __connman_agent_request_login_input(struct connman_service *service,
 
        dbus_message_unref(message);
 
-       return -EIO;
+       return -EINPROGRESS;
 }
 
 struct request_browser_reply_data {
@@ -610,8 +629,9 @@ int __connman_agent_request_browser(struct connman_service *service,
                return -ENOMEM;
        }
 
-       if (dbus_connection_send_with_reply(connection, message,
-                                                       &call, -1) == FALSE) {
+       if (dbus_connection_send_with_reply(connection, message, &call,
+                                       connman_timeout_browser_launch())
+                       == FALSE) {
                dbus_message_unref(message);
                g_free(browser_reply_data);
                return -ESRCH;
@@ -632,7 +652,7 @@ int __connman_agent_request_browser(struct connman_service *service,
 
        dbus_message_unref(message);
 
-       return -EIO;
+       return -EINPROGRESS;
 }
 
 struct report_error_data {
@@ -698,8 +718,9 @@ int __connman_agent_report_error(struct connman_service *service,
                return -ENOMEM;
        }
 
-       if (dbus_connection_send_with_reply(connection, message,
-                                               &call, -1) == FALSE) {
+       if (dbus_connection_send_with_reply(connection, message, &call,
+                                       connman_timeout_input_request())
+                       == FALSE) {
                dbus_message_unref(message);
                g_free(report_error);
                return -ESRCH;
@@ -718,7 +739,7 @@ int __connman_agent_report_error(struct connman_service *service,
                                report_error, NULL);
        dbus_message_unref(message);
 
-       return -EIO;
+       return -EINPROGRESS;
 }
 
 int __connman_agent_init(void)