From: Zhang zhengguang Date: Tue, 29 Jul 2014 07:54:33 +0000 (+0800) Subject: Fix the issue that wifi tethering security type set error X-Git-Tag: winet_tethering_0.1~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=40cf6d97483348b282af458cce05f80643d7345f;p=platform%2Fcore%2Fapi%2Ftethering.git Fix the issue that wifi tethering security type set error Before set security type to open, it needs to save the previous wpa2 passphrase, so that when set security type back to wpa2, it can recover from the saved passphrase. Change-Id: Ibf839140d328ea7e19a9447c8c0f0a7fa95d9f21 --- diff --git a/src/tethering.c b/src/tethering.c index 1ff3e9d..80546c0 100644 --- a/src/tethering.c +++ b/src/tethering.c @@ -49,7 +49,7 @@ static void __handle_ssid_visibility_changed(DBusGProxy *proxy, const char *valu static void __handle_passphrase_changed(DBusGProxy *proxy, const char *value_name, gpointer user_data);*/ static bool wifi_security_type_changed; -static const char *wifi_security_wpa2_passphrase; +static char *wifi_security_wpa2_passphrase; static void __handle_wifi_tether_changed(struct connman_technology *technology, void *user_data); static void __handle_usb_tether_changed(struct connman_technology *technology, void *user_data); @@ -2206,6 +2206,11 @@ API int tethering_wifi_set_security_type(tethering_h tethering, tethering_wifi_s const char *passphrase = connman_get_wifi_tethering_passphrase(technology); if (passphrase == NULL || g_strcmp0(passphrase, "") == 0) return TETHERING_ERROR_INVALID_OPERATION; + + if (wifi_security_wpa2_passphrase != NULL) + g_free(wifi_security_wpa2_passphrase); + wifi_security_wpa2_passphrase = strdup(passphrase); + if (connman_set_wifi_tethering_passphrase(technology, "") != CONNMAN_LIB_ERR_NONE) return TETHERING_ERROR_OPERATION_FAILED; @@ -2534,9 +2539,6 @@ API int tethering_wifi_set_passphrase(tethering_h tethering, const char *passphr connman_set_wifi_tethering_passphrase(technology, passphrase); - if (passphrase != NULL && g_strcmp0(passphrase, "")) - wifi_security_wpa2_passphrase = strdup(passphrase); - return TETHERING_ERROR_NONE; }