WPS: Add more helpful debug for invalid WPS_REG command parsing
Signed-hostap: Jouni Malinen <j@w1.fi>
This commit is contained in:
parent
a679c0f284
commit
ab547b5857
1 changed files with 21 additions and 6 deletions
|
@ -77,25 +77,33 @@ static int eap_wsc_new_ap_settings(struct wps_credential *cred,
|
||||||
else
|
else
|
||||||
len = end - pos;
|
len = end - pos;
|
||||||
if ((len & 1) || len > 2 * sizeof(cred->ssid) ||
|
if ((len & 1) || len > 2 * sizeof(cred->ssid) ||
|
||||||
hexstr2bin(pos, cred->ssid, len / 2))
|
hexstr2bin(pos, cred->ssid, len / 2)) {
|
||||||
|
wpa_printf(MSG_DEBUG, "EAP-WSC: Invalid new_ssid");
|
||||||
return -1;
|
return -1;
|
||||||
|
}
|
||||||
cred->ssid_len = len / 2;
|
cred->ssid_len = len / 2;
|
||||||
|
|
||||||
pos = os_strstr(params, "new_auth=");
|
pos = os_strstr(params, "new_auth=");
|
||||||
if (pos == NULL)
|
if (pos == NULL) {
|
||||||
|
wpa_printf(MSG_DEBUG, "EAP-WSC: Missing new_auth");
|
||||||
return -1;
|
return -1;
|
||||||
|
}
|
||||||
if (os_strncmp(pos + 9, "OPEN", 4) == 0)
|
if (os_strncmp(pos + 9, "OPEN", 4) == 0)
|
||||||
cred->auth_type = WPS_AUTH_OPEN;
|
cred->auth_type = WPS_AUTH_OPEN;
|
||||||
else if (os_strncmp(pos + 9, "WPAPSK", 6) == 0)
|
else if (os_strncmp(pos + 9, "WPAPSK", 6) == 0)
|
||||||
cred->auth_type = WPS_AUTH_WPAPSK;
|
cred->auth_type = WPS_AUTH_WPAPSK;
|
||||||
else if (os_strncmp(pos + 9, "WPA2PSK", 7) == 0)
|
else if (os_strncmp(pos + 9, "WPA2PSK", 7) == 0)
|
||||||
cred->auth_type = WPS_AUTH_WPA2PSK;
|
cred->auth_type = WPS_AUTH_WPA2PSK;
|
||||||
else
|
else {
|
||||||
|
wpa_printf(MSG_DEBUG, "EAP-WSC: Unknown new_auth");
|
||||||
return -1;
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
pos = os_strstr(params, "new_encr=");
|
pos = os_strstr(params, "new_encr=");
|
||||||
if (pos == NULL)
|
if (pos == NULL) {
|
||||||
|
wpa_printf(MSG_DEBUG, "EAP-WSC: Missing new_encr");
|
||||||
return -1;
|
return -1;
|
||||||
|
}
|
||||||
if (os_strncmp(pos + 9, "NONE", 4) == 0)
|
if (os_strncmp(pos + 9, "NONE", 4) == 0)
|
||||||
cred->encr_type = WPS_ENCR_NONE;
|
cred->encr_type = WPS_ENCR_NONE;
|
||||||
else if (os_strncmp(pos + 9, "WEP", 3) == 0)
|
else if (os_strncmp(pos + 9, "WEP", 3) == 0)
|
||||||
|
@ -104,8 +112,10 @@ static int eap_wsc_new_ap_settings(struct wps_credential *cred,
|
||||||
cred->encr_type = WPS_ENCR_TKIP;
|
cred->encr_type = WPS_ENCR_TKIP;
|
||||||
else if (os_strncmp(pos + 9, "CCMP", 4) == 0)
|
else if (os_strncmp(pos + 9, "CCMP", 4) == 0)
|
||||||
cred->encr_type = WPS_ENCR_AES;
|
cred->encr_type = WPS_ENCR_AES;
|
||||||
else
|
else {
|
||||||
|
wpa_printf(MSG_DEBUG, "EAP-WSC: Unknown new_encr");
|
||||||
return -1;
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
pos = os_strstr(params, "new_key=");
|
pos = os_strstr(params, "new_key=");
|
||||||
if (pos == NULL)
|
if (pos == NULL)
|
||||||
|
@ -117,8 +127,10 @@ static int eap_wsc_new_ap_settings(struct wps_credential *cred,
|
||||||
else
|
else
|
||||||
len = end - pos;
|
len = end - pos;
|
||||||
if ((len & 1) || len > 2 * sizeof(cred->key) ||
|
if ((len & 1) || len > 2 * sizeof(cred->key) ||
|
||||||
hexstr2bin(pos, cred->key, len / 2))
|
hexstr2bin(pos, cred->key, len / 2)) {
|
||||||
|
wpa_printf(MSG_DEBUG, "EAP-WSC: Invalid new_key");
|
||||||
return -1;
|
return -1;
|
||||||
|
}
|
||||||
cred->key_len = len / 2;
|
cred->key_len = len / 2;
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -211,6 +223,8 @@ static void * eap_wsc_init(struct eap_sm *sm)
|
||||||
res = eap_wsc_new_ap_settings(&new_ap_settings, phase1);
|
res = eap_wsc_new_ap_settings(&new_ap_settings, phase1);
|
||||||
if (res < 0) {
|
if (res < 0) {
|
||||||
os_free(data);
|
os_free(data);
|
||||||
|
wpa_printf(MSG_DEBUG, "EAP-WSC: Failed to parse new AP "
|
||||||
|
"settings");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
if (res == 1) {
|
if (res == 1) {
|
||||||
|
@ -222,6 +236,7 @@ static void * eap_wsc_init(struct eap_sm *sm)
|
||||||
data->wps = wps_init(&cfg);
|
data->wps = wps_init(&cfg);
|
||||||
if (data->wps == NULL) {
|
if (data->wps == NULL) {
|
||||||
os_free(data);
|
os_free(data);
|
||||||
|
wpa_printf(MSG_DEBUG, "EAP-WSC: wps_init failed");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
res = eap_get_config_fragment_size(sm);
|
res = eap_get_config_fragment_size(sm);
|
||||||
|
|
Loading…
Reference in a new issue