---
 src/agent.c |   45 +++++++++++++++++++++++++++------------------
 1 files changed, 27 insertions(+), 18 deletions(-)

diff --git a/src/agent.c b/src/agent.c
index 5ce7ca9..b597a4f 100644
--- a/src/agent.c
+++ b/src/agent.c
@@ -360,24 +360,33 @@ static void previous_passphrase_handler(DBusMessageIter 
*iter,
 {
        enum connman_service_security security;
        struct previous_passphrase_data data;
-
-       data.passphrase = __connman_service_get_passphrase(service);
-       if (data.passphrase == NULL)
-               return;
-
-       security = __connman_service_get_security(service);
-       switch (security) {
-       case CONNMAN_SERVICE_SECURITY_WEP:
-               data.type = "wep";
-               break;
-       case CONNMAN_SERVICE_SECURITY_PSK:
-               data.type  = "psk";
-               break;
-       /*
-        * This should never happen: no passphrase is set if security is not
-        * one of the above. */
-       default:
-               break;
+       struct connman_network *network;
+
+       network = __connman_service_get_network(service);
+       data.passphrase = connman_network_get_string(network, "WiFi.PinWPS");
+
+       if (connman_network_get_bool(network, "WiFi.UseWPS") == TRUE &&
+                                               data.passphrase != NULL) {
+               data.type = "wpspin";
+       } else {
+               data.passphrase = __connman_service_get_passphrase(service);
+               if (data.passphrase == NULL)
+                       return;
+
+               security = __connman_service_get_security(service);
+               switch (security) {
+               case CONNMAN_SERVICE_SECURITY_WEP:
+                       data.type = "wep";
+                       break;
+               case CONNMAN_SERVICE_SECURITY_PSK:
+                       data.type  = "psk";
+                       break;
+               /*
+                * This should never happen: no passphrase is set if security
+                * is not one of the above. */
+               default:
+                       break;
+               }
        }
 
        connman_dbus_dict_append_dict(iter, "PreviousPassphrase",
-- 
1.7.8.6

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

Reply via email to