Poor RF environments can cause connect-failed regardless
of password correctness.  When performing a manual connection,
the correctness of the password has not been proved. Clear the
credentials in this case so they have an opportunity to be
corrected if necessary.
---
 src/service.c | 40 ++++++++++++++++++++++++++--------------
 1 file changed, 26 insertions(+), 14 deletions(-)

diff --git a/src/service.c b/src/service.c
index 196f6b5..568300c 100644
--- a/src/service.c
+++ b/src/service.c
@@ -4048,6 +4048,24 @@ static DBusMessage *disconnect_service(DBusConnection 
*conn,
        return g_dbus_create_reply(msg, DBUS_TYPE_INVALID);
 }

+static void clear_credentials(struct connman_service *service)
+{
+       g_free(service->passphrase);
+       service->passphrase = NULL;
+
+       g_free(service->identity);
+       service->identity = NULL;
+
+       g_free(service->anonymous_identity);
+       service->anonymous_identity = NULL;
+
+       g_free(service->agent_identity);
+       service->agent_identity = NULL;
+
+       g_free(service->eap);
+       service->eap = NULL;
+}
+
 bool __connman_service_remove(struct connman_service *service)
 {
        if (service->type == CONNMAN_SERVICE_TYPE_ETHERNET ||
@@ -4064,20 +4082,7 @@ bool __connman_service_remove(struct connman_service 
*service)

        __connman_service_disconnect(service);

-       g_free(service->passphrase);
-       service->passphrase = NULL;
-
-       g_free(service->identity);
-       service->identity = NULL;
-
-       g_free(service->anonymous_identity);
-       service->anonymous_identity = NULL;
-
-       g_free(service->agent_identity);
-       service->agent_identity = NULL;
-
-       g_free(service->eap);
-       service->eap = NULL;
+       clear_credentials(service);

        service->error = CONNMAN_SERVICE_ERROR_UNKNOWN;

@@ -5500,6 +5505,13 @@ int __connman_service_indicate_error(struct 
connman_service *service,
        __connman_service_ipconfig_indicate_state(service,
                                                CONNMAN_SERVICE_STATE_FAILURE,
                                                CONNMAN_IPCONFIG_TYPE_IPV6);
+
+       if (!service->favorite) {
+               if (error == CONNMAN_SERVICE_ERROR_CONNECT_FAILED) {
+                       clear_credentials(service);
+               }
+       }
+
        return 0;
 }

--
2.4.6


Statement of Confidentiality

The contents of this e-mail message and any attachments are confidential and 
are intended solely for the addressee. The information may also be legally 
privileged. This transmission is sent in trust, and the sole purpose of 
delivery to the intended recipient. If you have received this transmission in 
error, any use, reproduction or dissemination of this transmission is strictly 
prohibited. If you are not the intended recipient, please immediately notify 
the sender by reply e-mail or at 508.683.2500 and delete this message and its 
attachments, if any.

_______________________________________________
connman mailing list
connman@connman.net
https://lists.connman.net/mailman/listinfo/connman

Reply via email to