From: Tomasz Bursztyka Date: Tue, 10 Jul 2012 14:45:12 +0000 (+0300) Subject: agent: Handle wpspin type as a PreviousPassphrase X-Git-Tag: 1.4~49 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=4ef05c2ae439652addee08460d9fb0c848315c46;p=platform%2Fupstream%2Fconnman.git agent: Handle wpspin type as a PreviousPassphrase --- 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",