From 4ef05c2ae439652addee08460d9fb0c848315c46 Mon Sep 17 00:00:00 2001 From: Tomasz Bursztyka Date: Tue, 10 Jul 2012 17:45:12 +0300 Subject: [PATCH] agent: Handle wpspin type as a PreviousPassphrase --- src/agent.c | 45 +++++++++++++++++++++++++++------------------ 1 file 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", -- 2.7.4