aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJouni Malinen <jouni.malinen@atheros.com>2009-03-30 15:48:41 (GMT)
committerJouni Malinen <j@w1.fi>2009-04-20 09:05:09 (GMT)
commit6f825a2e4a96df3e8a6d08e839ff872244ddfae2 (patch)
tree33094ebf242eee0393042514172942518da8052c
parent8b42c3c4a37af2c0abe5a93299288658d812007d (diff)
downloadhostap-06-6f825a2e4a96df3e8a6d08e839ff872244ddfae2.zip
hostap-06-6f825a2e4a96df3e8a6d08e839ff872244ddfae2.tar.gz
hostap-06-6f825a2e4a96df3e8a6d08e839ff872244ddfae2.tar.bz2
WPS: Fix hostapd runtime WPS configuration after Enrollee run
If the AP is configured with WPS, we need to update the local WPS data in order to provide correct credentials for Enrollees. (cherry picked from commit 6ce4b59342e6454e3c9a81cb54966fac18c8ea94)
-rw-r--r--hostapd/wps_hostapd.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/hostapd/wps_hostapd.c b/hostapd/wps_hostapd.c
index 8c39210..eaa7a33 100644
--- a/hostapd/wps_hostapd.c
+++ b/hostapd/wps_hostapd.c
@@ -233,6 +233,28 @@ static int hostapd_wps_cred_cb(void *ctx, const struct wps_credential *cred)
if (hapd->conf->wps_cred_processing == 1)
return 0;
+ os_memcpy(hapd->wps->ssid, cred->ssid, cred->ssid_len);
+ hapd->wps->ssid_len = cred->ssid_len;
+ hapd->wps->encr_types = cred->encr_type;
+ hapd->wps->auth_types = cred->auth_type;
+ if (cred->key == NULL) {
+ os_free(hapd->wps->network_key);
+ hapd->wps->network_key = NULL;
+ hapd->wps->network_key_len = 0;
+ } else {
+ if (hapd->wps->network_key == NULL ||
+ hapd->wps->network_key_len < cred->key_len) {
+ hapd->wps->network_key_len = 0;
+ os_free(hapd->wps->network_key);
+ hapd->wps->network_key = os_malloc(cred->key_len);
+ if (hapd->wps->network_key == NULL)
+ return -1;
+ }
+ hapd->wps->network_key_len = cred->key_len;
+ os_memcpy(hapd->wps->network_key, cred->key, cred->key_len);
+ }
+ hapd->wps->wps_state = WPS_STATE_CONFIGURED;
+
len = os_strlen(hapd->iface->config_fname) + 5;
tmp_fname = os_malloc(len);
if (tmp_fname == NULL)