Some access points incorrectly advertise WPS even when they are
configured as open (i.e. no security), so filter adding WPS to the
security array appropriately.

---
 src/service.c |   22 ++++++++++++++++++----
 1 files changed, 18 insertions(+), 4 deletions(-)

diff --git a/src/service.c b/src/service.c
index 6a68346..e71eb79 100644
--- a/src/service.c
+++ b/src/service.c
@@ -1391,10 +1391,24 @@ static void append_security(DBusMessageIter *iter, void 
*user_data)
                dbus_message_iter_append_basic(iter,
                                DBUS_TYPE_STRING, &str);
 
-       str = "wps";
-       if (service->wps == TRUE)
-               dbus_message_iter_append_basic(iter,
-                               DBUS_TYPE_STRING, &str);
+       /*
+        * Some access points incorrectly advertise WPS even when they
+        * are configured as open or no security, so filter
+        * appropriately.
+        */
+       if (service->wps == TRUE) {
+               switch (service->security) {
+               case CONNMAN_SERVICE_SECURITY_PSK:
+               case CONNMAN_SERVICE_SECURITY_WPA:
+               case CONNMAN_SERVICE_SECURITY_RSN:
+                       str = "wps";
+                       dbus_message_iter_append_basic(iter,
+                               DBUS_TYPE_STRING, &str);
+                       break;
+               default:
+                       break;
+               }
+       }
 }
 
 static void append_ethernet(DBusMessageIter *iter, void *user_data)
-- 
1.7.6

_______________________________________________
connman mailing list
[email protected]
http://lists.connman.net/listinfo/connman

Reply via email to