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.
This commit is contained in:
parent
1c2ff04f3a
commit
1e4b9da10c
3 changed files with 36 additions and 3 deletions
|
@ -181,6 +181,8 @@ static struct radius_attr_type radius_attrs[] =
|
||||||
RADIUS_ATTR_HEXDUMP },
|
RADIUS_ATTR_HEXDUMP },
|
||||||
{ RADIUS_ATTR_ACCT_INTERIM_INTERVAL, "Acct-Interim-Interval",
|
{ RADIUS_ATTR_ACCT_INTERIM_INTERVAL, "Acct-Interim-Interval",
|
||||||
RADIUS_ATTR_INT32 },
|
RADIUS_ATTR_INT32 },
|
||||||
|
{ RADIUS_ATTR_CHARGEABLE_USER_IDENTITY, "Chargable-User-Identity",
|
||||||
|
RADIUS_ATTR_TEXT },
|
||||||
{ RADIUS_ATTR_NAS_IPV6_ADDRESS, "NAS-IPv6-Address", RADIUS_ATTR_IPV6 },
|
{ RADIUS_ATTR_NAS_IPV6_ADDRESS, "NAS-IPv6-Address", RADIUS_ATTR_IPV6 },
|
||||||
};
|
};
|
||||||
#define RADIUS_ATTRS (sizeof(radius_attrs) / sizeof(radius_attrs[0]))
|
#define RADIUS_ATTRS (sizeof(radius_attrs) / sizeof(radius_attrs[0]))
|
||||||
|
|
|
@ -87,6 +87,7 @@ enum { RADIUS_ATTR_USER_NAME = 1,
|
||||||
RADIUS_ATTR_MESSAGE_AUTHENTICATOR = 80,
|
RADIUS_ATTR_MESSAGE_AUTHENTICATOR = 80,
|
||||||
RADIUS_ATTR_TUNNEL_PRIVATE_GROUP_ID = 81,
|
RADIUS_ATTR_TUNNEL_PRIVATE_GROUP_ID = 81,
|
||||||
RADIUS_ATTR_ACCT_INTERIM_INTERVAL = 85,
|
RADIUS_ATTR_ACCT_INTERIM_INTERVAL = 85,
|
||||||
|
RADIUS_ATTR_CHARGEABLE_USER_IDENTITY = 89,
|
||||||
RADIUS_ATTR_NAS_IPV6_ADDRESS = 95
|
RADIUS_ATTR_NAS_IPV6_ADDRESS = 95
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -66,6 +66,8 @@ struct eapol_test_data {
|
||||||
|
|
||||||
char *connect_info;
|
char *connect_info;
|
||||||
u8 own_addr[ETH_ALEN];
|
u8 own_addr[ETH_ALEN];
|
||||||
|
int cui_flag;
|
||||||
|
char *cui_str;
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct eapol_test_data eapol_test;
|
static struct eapol_test_data eapol_test;
|
||||||
|
@ -164,6 +166,23 @@ static void ieee802_1x_encapsulate_radius(struct eapol_test_data *e,
|
||||||
goto fail;
|
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)) {
|
if (eap && !radius_msg_add_eap(msg, eap, len)) {
|
||||||
printf("Could not add EAP-Message\n");
|
printf("Could not add EAP-Message\n");
|
||||||
goto fail;
|
goto fail;
|
||||||
|
@ -848,7 +867,8 @@ static void usage(void)
|
||||||
"eapol_test [-nWS] -c<conf> [-a<AS IP>] [-p<AS port>] "
|
"eapol_test [-nWS] -c<conf> [-a<AS IP>] [-p<AS port>] "
|
||||||
"[-s<AS secret>] \\\n"
|
"[-s<AS secret>] \\\n"
|
||||||
" [-r<count>] [-t<timeout>] [-C<Connect-Info>] \\\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 scard\n"
|
||||||
"eapol_test sim <PIN> <num triplets> [debug]\n"
|
"eapol_test sim <PIN> <num triplets> [debug]\n"
|
||||||
"\n");
|
"\n");
|
||||||
|
@ -869,7 +889,10 @@ static void usage(void)
|
||||||
"CONNECT 11Mbps 802.11b)\n"
|
"CONNECT 11Mbps 802.11b)\n"
|
||||||
" -M<client MAC address> = Set own MAC address "
|
" -M<client MAC address> = Set own MAC address "
|
||||||
"(Calling-Station-Id,\n"
|
"(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;
|
wpa_debug_show_keys = 1;
|
||||||
|
|
||||||
for (;;) {
|
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)
|
if (c < 0)
|
||||||
break;
|
break;
|
||||||
switch (c) {
|
switch (c) {
|
||||||
|
@ -909,6 +932,13 @@ int main(int argc, char *argv[])
|
||||||
case 'C':
|
case 'C':
|
||||||
eapol_test.connect_info = optarg;
|
eapol_test.connect_info = optarg;
|
||||||
break;
|
break;
|
||||||
|
case 'i':
|
||||||
|
eapol_test.cui_flag = 1;
|
||||||
|
break;
|
||||||
|
case 'I':
|
||||||
|
eapol_test.cui_flag = 2;
|
||||||
|
eapol_test.cui_str = optarg;
|
||||||
|
break;
|
||||||
case 'M':
|
case 'M':
|
||||||
if (hwaddr_aton(optarg, eapol_test.own_addr)) {
|
if (hwaddr_aton(optarg, eapol_test.own_addr)) {
|
||||||
usage();
|
usage();
|
||||||
|
|
Loading…
Reference in a new issue