aboutsummaryrefslogtreecommitdiffstats
path: root/wpa_supplicant/eapol_test.c
diff options
context:
space:
mode:
authorTomasz Wolniewicz <twoln@umk.pl>2008-03-30 14:39:19 (GMT)
committerJouni Malinen <j@w1.fi>2008-03-30 14:39:19 (GMT)
commit1e4b9da10ccbb21fd7981f1eb0dd5ffa36ac4f05 (patch)
treefc0d82eb3589bc5fcaf07474c064bc711c7c1072 /wpa_supplicant/eapol_test.c
parent1c2ff04f3afb8e05db7dbab9d1e0d292a1b10c32 (diff)
downloadhostap-1e4b9da10ccbb21fd7981f1eb0dd5ffa36ac4f05.zip
hostap-1e4b9da10ccbb21fd7981f1eb0dd5ffa36ac4f05.tar.gz
hostap-1e4b9da10ccbb21fd7981f1eb0dd5ffa36ac4f05.tar.bz2
Chargeable-User-Identity (RFC 4372) in eapol_test
Implements the Chargable-User-Identity (CUI), as defined in RFC 4372. Option "-i" causes the eapol_test to send a NUL CUI - which is a request to send a CUI back. Capital "-I" allows to specify the value of the CUI. This has been defined for cases where the client wants to reauthenticate.
Diffstat (limited to 'wpa_supplicant/eapol_test.c')
-rw-r--r--wpa_supplicant/eapol_test.c36
1 files changed, 33 insertions, 3 deletions
diff --git a/wpa_supplicant/eapol_test.c b/wpa_supplicant/eapol_test.c
index e907a0f..7502a20 100644
--- a/wpa_supplicant/eapol_test.c
+++ b/wpa_supplicant/eapol_test.c
@@ -66,6 +66,8 @@ struct eapol_test_data {
char *connect_info;
u8 own_addr[ETH_ALEN];
+ int cui_flag;
+ char *cui_str;
};
static struct eapol_test_data eapol_test;
@@ -164,6 +166,23 @@ static void ieee802_1x_encapsulate_radius(struct eapol_test_data *e,
goto fail;
}
+ if (e->cui_flag) {
+ int l = 0;
+ if (e->cui_flag == 1) {
+ l = 1;
+ buf[0] = '\0';
+ } else if (e->cui_flag == 2) {
+ os_snprintf(buf, sizeof(buf), "%s", e->cui_str);
+ l = os_strlen(buf);
+ }
+ if (!radius_msg_add_attr(msg,
+ RADIUS_ATTR_CHARGEABLE_USER_IDENTITY,
+ (u8 *) buf, l)) {
+ printf("Could not add Chargeable-User-Identity\n");
+ goto fail;
+ }
+ }
+
if (eap && !radius_msg_add_eap(msg, eap, len)) {
printf("Could not add EAP-Message\n");
goto fail;
@@ -848,7 +867,8 @@ static void usage(void)
"eapol_test [-nWS] -c<conf> [-a<AS IP>] [-p<AS port>] "
"[-s<AS secret>] \\\n"
" [-r<count>] [-t<timeout>] [-C<Connect-Info>] \\\n"
- " [-M<client MAC address>]\n"
+ " [-M<client MAC address>] \\\n"
+ " [-I<CUI>] [-i]\n"
"eapol_test scard\n"
"eapol_test sim <PIN> <num triplets> [debug]\n"
"\n");
@@ -869,7 +889,10 @@ static void usage(void)
"CONNECT 11Mbps 802.11b)\n"
" -M<client MAC address> = Set own MAC address "
"(Calling-Station-Id,\n"
- " default: 02:00:00:00:00:01)\n");
+ " default: 02:00:00:00:00:01)\n"
+ " -I<CUI> = send Chargeable-User-Identity containing the "
+ "value of CUI\n"
+ " -i = send NUL value in Chargeable-User-Identity\n");
}
@@ -896,7 +919,7 @@ int main(int argc, char *argv[])
wpa_debug_show_keys = 1;
for (;;) {
- c = getopt(argc, argv, "a:c:C:M:np:r:s:St:W");
+ c = getopt(argc, argv, "a:c:C:iI:M:np:r:s:St:W");
if (c < 0)
break;
switch (c) {
@@ -909,6 +932,13 @@ int main(int argc, char *argv[])
case 'C':
eapol_test.connect_info = optarg;
break;
+ case 'i':
+ eapol_test.cui_flag = 1;
+ break;
+ case 'I':
+ eapol_test.cui_flag = 2;
+ eapol_test.cui_str = optarg;
+ break;
case 'M':
if (hwaddr_aton(optarg, eapol_test.own_addr)) {
usage();