tests: Pending EAP peer processing with VENDOR-TEST
This extends the VENDOR-TEST EAP method peer implementation to allow pending processing case to be selected at run time. The ap_wpa2_eap_vendor_test test case is similarly extended to include this option as the second case for full coverage. Signed-off-by: Jouni Malinen <j@w1.fi>
This commit is contained in:
parent
ba4226130e
commit
467775c5ac
2 changed files with 13 additions and 10 deletions
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* EAP peer method: Test method for vendor specific (expanded) EAP type
|
* EAP peer method: Test method for vendor specific (expanded) EAP type
|
||||||
* Copyright (c) 2005-2006, Jouni Malinen <j@w1.fi>
|
* Copyright (c) 2005-2015, Jouni Malinen <j@w1.fi>
|
||||||
*
|
*
|
||||||
* This software may be distributed under the terms of the BSD license.
|
* This software may be distributed under the terms of the BSD license.
|
||||||
* See README for more details.
|
* See README for more details.
|
||||||
|
@ -14,31 +14,36 @@
|
||||||
|
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
#include "eap_i.h"
|
#include "eap_i.h"
|
||||||
#ifdef TEST_PENDING_REQUEST
|
|
||||||
#include "eloop.h"
|
#include "eloop.h"
|
||||||
#endif /* TEST_PENDING_REQUEST */
|
|
||||||
|
|
||||||
|
|
||||||
#define EAP_VENDOR_ID EAP_VENDOR_HOSTAP
|
#define EAP_VENDOR_ID EAP_VENDOR_HOSTAP
|
||||||
#define EAP_VENDOR_TYPE 0xfcfbfaf9
|
#define EAP_VENDOR_TYPE 0xfcfbfaf9
|
||||||
|
|
||||||
|
|
||||||
/* #define TEST_PENDING_REQUEST */
|
|
||||||
|
|
||||||
struct eap_vendor_test_data {
|
struct eap_vendor_test_data {
|
||||||
enum { INIT, CONFIRM, SUCCESS } state;
|
enum { INIT, CONFIRM, SUCCESS } state;
|
||||||
int first_try;
|
int first_try;
|
||||||
|
int test_pending_req;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
static void * eap_vendor_test_init(struct eap_sm *sm)
|
static void * eap_vendor_test_init(struct eap_sm *sm)
|
||||||
{
|
{
|
||||||
struct eap_vendor_test_data *data;
|
struct eap_vendor_test_data *data;
|
||||||
|
const u8 *password;
|
||||||
|
size_t password_len;
|
||||||
|
|
||||||
data = os_zalloc(sizeof(*data));
|
data = os_zalloc(sizeof(*data));
|
||||||
if (data == NULL)
|
if (data == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
data->state = INIT;
|
data->state = INIT;
|
||||||
data->first_try = 1;
|
data->first_try = 1;
|
||||||
|
|
||||||
|
password = eap_get_config_password(sm, &password_len);
|
||||||
|
data->test_pending_req = password && password_len == 7 &&
|
||||||
|
os_memcmp(password, "pending", 7) == 0;
|
||||||
|
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -50,7 +55,6 @@ static void eap_vendor_test_deinit(struct eap_sm *sm, void *priv)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifdef TEST_PENDING_REQUEST
|
|
||||||
static void eap_vendor_ready(void *eloop_ctx, void *timeout_ctx)
|
static void eap_vendor_ready(void *eloop_ctx, void *timeout_ctx)
|
||||||
{
|
{
|
||||||
struct eap_sm *sm = eloop_ctx;
|
struct eap_sm *sm = eloop_ctx;
|
||||||
|
@ -58,7 +62,6 @@ static void eap_vendor_ready(void *eloop_ctx, void *timeout_ctx)
|
||||||
"request");
|
"request");
|
||||||
eap_notify_pending(sm);
|
eap_notify_pending(sm);
|
||||||
}
|
}
|
||||||
#endif /* TEST_PENDING_REQUEST */
|
|
||||||
|
|
||||||
|
|
||||||
static struct wpabuf * eap_vendor_test_process(struct eap_sm *sm, void *priv,
|
static struct wpabuf * eap_vendor_test_process(struct eap_sm *sm, void *priv,
|
||||||
|
@ -98,8 +101,7 @@ static struct wpabuf * eap_vendor_test_process(struct eap_sm *sm, void *priv,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (data->state == CONFIRM) {
|
if (data->state == CONFIRM) {
|
||||||
#ifdef TEST_PENDING_REQUEST
|
if (data->test_pending_req && data->first_try) {
|
||||||
if (data->first_try) {
|
|
||||||
data->first_try = 0;
|
data->first_try = 0;
|
||||||
wpa_printf(MSG_DEBUG, "EAP-VENDOR-TEST: Testing "
|
wpa_printf(MSG_DEBUG, "EAP-VENDOR-TEST: Testing "
|
||||||
"pending request");
|
"pending request");
|
||||||
|
@ -108,7 +110,6 @@ static struct wpabuf * eap_vendor_test_process(struct eap_sm *sm, void *priv,
|
||||||
NULL);
|
NULL);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
#endif /* TEST_PENDING_REQUEST */
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ret->ignore = FALSE;
|
ret->ignore = FALSE;
|
||||||
|
|
|
@ -1870,6 +1870,8 @@ def test_ap_wpa2_eap_vendor_test(dev, apdev):
|
||||||
hostapd.add_ap(apdev[0]['ifname'], params)
|
hostapd.add_ap(apdev[0]['ifname'], params)
|
||||||
eap_connect(dev[0], apdev[0], "VENDOR-TEST", "vendor-test")
|
eap_connect(dev[0], apdev[0], "VENDOR-TEST", "vendor-test")
|
||||||
eap_reauth(dev[0], "VENDOR-TEST")
|
eap_reauth(dev[0], "VENDOR-TEST")
|
||||||
|
eap_connect(dev[1], apdev[0], "VENDOR-TEST", "vendor-test",
|
||||||
|
password="pending")
|
||||||
|
|
||||||
def test_ap_wpa2_eap_fast_mschapv2_unauth_prov(dev, apdev):
|
def test_ap_wpa2_eap_fast_mschapv2_unauth_prov(dev, apdev):
|
||||||
"""WPA2-Enterprise connection using EAP-FAST/MSCHAPv2 and unauthenticated provisioning"""
|
"""WPA2-Enterprise connection using EAP-FAST/MSCHAPv2 and unauthenticated provisioning"""
|
||||||
|
|
Loading…
Reference in a new issue