aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJouni Malinen <jouni.malinen@atheros.com>2010-07-27 01:12:08 (GMT)
committerJouni Malinen <j@w1.fi>2010-09-05 14:26:42 (GMT)
commitae934b1b4eb8ab2109e0c67baffd7b9fa96a3bc6 (patch)
tree23740989314e1df5e50644d7bda030a6f052100f
parent362f51391a859357bb45d3d9d9b0b26bde636205 (diff)
downloadhostap-07-ae934b1b4eb8ab2109e0c67baffd7b9fa96a3bc6.zip
hostap-07-ae934b1b4eb8ab2109e0c67baffd7b9fa96a3bc6.tar.gz
hostap-07-ae934b1b4eb8ab2109e0c67baffd7b9fa96a3bc6.tar.bz2
WPS: Allow AP to start in Enrollee mode without AP PIN for probing
In theory, this should not really be needed, but Windows 7 uses Registrar mode to probe AP's WPS capabilities before trying to use Enrollee and fails if the AP does not allow that probing to happen. This allows the AP to start as an Enrollee and send M1, but refuse to continue beyond that (M3 will not be sent if AP PIN is not known). (cherry picked from commit 6195adda9b4306cda2b06b930c59c95832d026a9)
-rw-r--r--src/ap/ap_config.c6
-rw-r--r--src/ap/wps_hostapd.c2
-rw-r--r--src/eap_server/eap_server_wsc.c13
-rw-r--r--src/wps/wps_upnp_web.c3
4 files changed, 16 insertions, 8 deletions
diff --git a/src/ap/ap_config.c b/src/ap/ap_config.c
index 20be2d4..fbedb62 100644
--- a/src/ap/ap_config.c
+++ b/src/ap/ap_config.c
@@ -566,15 +566,15 @@ hostapd_get_eap_user(const struct hostapd_bss_config *conf, const u8 *identity,
return &wsc_enrollee;
}
- if (conf->wps_state && conf->ap_pin &&
- identity_len == WSC_ID_REGISTRAR_LEN &&
+ if (conf->wps_state && identity_len == WSC_ID_REGISTRAR_LEN &&
os_memcmp(identity, WSC_ID_REGISTRAR, WSC_ID_REGISTRAR_LEN) == 0) {
static struct hostapd_eap_user wsc_registrar;
os_memset(&wsc_registrar, 0, sizeof(wsc_registrar));
wsc_registrar.methods[0].method = eap_server_get_type(
"WSC", &wsc_registrar.methods[0].vendor);
wsc_registrar.password = (u8 *) conf->ap_pin;
- wsc_registrar.password_len = os_strlen(conf->ap_pin);
+ wsc_registrar.password_len = conf->ap_pin ?
+ os_strlen(conf->ap_pin) : 0;
return &wsc_registrar;
}
#endif /* CONFIG_WPS */
diff --git a/src/ap/wps_hostapd.c b/src/ap/wps_hostapd.c
index 902a65a..c63b7fc 100644
--- a/src/ap/wps_hostapd.c
+++ b/src/ap/wps_hostapd.c
@@ -426,7 +426,7 @@ static void hostapd_pwd_auth_fail(struct hostapd_data *hapd,
{
FILE *f;
- if (!data->enrollee)
+ if (!data->enrollee || hapd->conf->ap_pin == NULL)
return;
/*
diff --git a/src/eap_server/eap_server_wsc.c b/src/eap_server/eap_server_wsc.c
index b6c0df4..846c382 100644
--- a/src/eap_server/eap_server_wsc.c
+++ b/src/eap_server/eap_server_wsc.c
@@ -119,10 +119,15 @@ static void * eap_wsc_init(struct eap_sm *sm)
}
} else {
if (sm->user == NULL || sm->user->password == NULL) {
- wpa_printf(MSG_INFO, "EAP-WSC: No AP PIN (password) "
- "configured for Enrollee functionality");
- os_free(data);
- return NULL;
+ /*
+ * In theory, this should not really be needed, but
+ * Windows 7 uses Registrar mode to probe AP's WPS
+ * capabilities before trying to use Enrollee and fails
+ * if the AP does not allow that probing to happen..
+ */
+ wpa_printf(MSG_DEBUG, "EAP-WSC: No AP PIN (password) "
+ "configured for Enrollee functionality - "
+ "allow for probing capabilities (M1)");
}
cfg.pin = sm->user->password;
cfg.pin_len = sm->user->password_len;
diff --git a/src/wps/wps_upnp_web.c b/src/wps/wps_upnp_web.c
index 2e60607..9a6b36e 100644
--- a/src/wps/wps_upnp_web.c
+++ b/src/wps/wps_upnp_web.c
@@ -412,6 +412,9 @@ web_process_get_device_info(struct upnp_wps_device_sm *sm,
wpa_printf(MSG_DEBUG, "WPS UPnP: GetDeviceInfo");
+ if (sm->ctx->ap_pin == NULL)
+ return HTTP_INTERNAL_SERVER_ERROR;
+
/*
* Request for DeviceInfo, i.e., M1 TLVs. This is a start of WPS
* registration over UPnP with the AP acting as an Enrollee. It should