mirror of
https://github.com/vanhoefm/fragattacks.git
synced 2024-11-28 18:28:23 -05:00
HS 2.0: Process Credential/UsernamePassword/EAPMethod nodes in PPS MO
This allows hs20-osu-client to configure wpa_supplicant credential with a specific EAP method so that roaming consortium OI -based matching can be used. Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
This commit is contained in:
parent
db856f47ef
commit
de3885fcc7
@ -1463,10 +1463,92 @@ static void set_pps_cred_able_to_share(struct hs20_osu_client *ctx, int id,
|
||||
}
|
||||
|
||||
|
||||
static void set_pps_cred_eap_method_eap_type(struct hs20_osu_client *ctx,
|
||||
int id, xml_node_t *node)
|
||||
{
|
||||
char *str = xml_node_get_text(ctx->xml, node);
|
||||
int type;
|
||||
const char *eap_method = NULL;
|
||||
|
||||
if (!str)
|
||||
return;
|
||||
wpa_printf(MSG_INFO,
|
||||
"- Credential/UsernamePassword/EAPMethod/EAPType = %s", str);
|
||||
type = atoi(str);
|
||||
switch (type) {
|
||||
case EAP_TYPE_TLS:
|
||||
eap_method = "TLS";
|
||||
break;
|
||||
case EAP_TYPE_TTLS:
|
||||
eap_method = "TTLS";
|
||||
break;
|
||||
case EAP_TYPE_PEAP:
|
||||
eap_method = "PEAP";
|
||||
break;
|
||||
case EAP_TYPE_PWD:
|
||||
eap_method = "PWD";
|
||||
break;
|
||||
}
|
||||
xml_node_get_text_free(ctx->xml, str);
|
||||
if (!eap_method) {
|
||||
wpa_printf(MSG_INFO, "Unknown EAPType value");
|
||||
return;
|
||||
}
|
||||
|
||||
if (set_cred(ctx->ifname, id, "eap", eap_method) < 0)
|
||||
wpa_printf(MSG_INFO, "Failed to set cred eap");
|
||||
}
|
||||
|
||||
|
||||
static void set_pps_cred_eap_method_inner_method(struct hs20_osu_client *ctx,
|
||||
int id, xml_node_t *node)
|
||||
{
|
||||
char *str = xml_node_get_text(ctx->xml, node);
|
||||
const char *phase2 = NULL;
|
||||
|
||||
if (!str)
|
||||
return;
|
||||
wpa_printf(MSG_INFO,
|
||||
"- Credential/UsernamePassword/EAPMethod/InnerMethod = %s",
|
||||
str);
|
||||
if (os_strcmp(str, "PAP") == 0)
|
||||
phase2 = "auth=PAP";
|
||||
else if (os_strcmp(str, "CHAP") == 0)
|
||||
phase2 = "auth=CHAP";
|
||||
else if (os_strcmp(str, "MS-CHAP") == 0)
|
||||
phase2 = "auth=MSCHAP";
|
||||
else if (os_strcmp(str, "MS-CHAP-V2") == 0)
|
||||
phase2 = "auth=MSCHAPV2";
|
||||
xml_node_get_text_free(ctx->xml, str);
|
||||
if (!phase2) {
|
||||
wpa_printf(MSG_INFO, "Unknown InnerMethod value");
|
||||
return;
|
||||
}
|
||||
|
||||
if (set_cred_quoted(ctx->ifname, id, "phase2", phase2) < 0)
|
||||
wpa_printf(MSG_INFO, "Failed to set cred phase2");
|
||||
}
|
||||
|
||||
|
||||
static void set_pps_cred_eap_method(struct hs20_osu_client *ctx, int id,
|
||||
xml_node_t *node)
|
||||
{
|
||||
wpa_printf(MSG_INFO, "- Credential/UsernamePassword/EAPMethod - TODO");
|
||||
xml_node_t *child;
|
||||
const char *name;
|
||||
|
||||
wpa_printf(MSG_INFO, "- Credential/UsernamePassword/EAPMethod");
|
||||
|
||||
xml_node_for_each_child(ctx->xml, child, node) {
|
||||
xml_node_for_each_check(ctx->xml, child);
|
||||
name = xml_node_get_localname(ctx->xml, child);
|
||||
if (os_strcasecmp(name, "EAPType") == 0)
|
||||
set_pps_cred_eap_method_eap_type(ctx, id, child);
|
||||
else if (os_strcasecmp(name, "InnerMethod") == 0)
|
||||
set_pps_cred_eap_method_inner_method(ctx, id, child);
|
||||
else
|
||||
wpa_printf(MSG_INFO, "Unknown Credential/UsernamePassword/EAPMethod node '%s'",
|
||||
name);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user