eap: Print vendor (PEN) names for vendor-specific EAP methods

This commit is contained in:
Tobias Brunner
2022-09-21 13:53:44 +02:00
parent f6e6fcd2f6
commit 9efd7d7e90
11 changed files with 79 additions and 37 deletions
+2 -1
View File
@@ -1344,7 +1344,8 @@ static char* get_string(private_message_t *this, char *buf, int len)
{ {
if (vendor) if (vendor)
{ {
snprintf(method, sizeof(method), "/%d-%d", type, vendor); snprintf(method, sizeof(method), "/%d-%N", type,
pen_short_names, vendor);
} }
else else
{ {
@@ -93,8 +93,8 @@ static eap_method_t *load_method(private_eap_dynamic_t *this,
{ {
if (vendor) if (vendor)
{ {
DBG1(DBG_IKE, "loading vendor specific EAP method %d-%d failed", DBG1(DBG_IKE, "loading vendor specific EAP method %d-%N failed",
type, vendor); type, pen_names, vendor);
} }
else else
{ {
@@ -135,9 +135,9 @@ static void select_method(private_eap_dynamic_t *this)
{ {
if (entry->vendor) if (entry->vendor)
{ {
DBG2(DBG_IKE, "proposed vendor specific EAP method %d-%d " DBG2(DBG_IKE, "proposed vendor specific EAP method %d-%N "
"not supported by %s, skipped", entry->type, "not supported by %s, skipped", entry->type,
entry->vendor, who); pen_names, entry->vendor, who);
} }
else else
{ {
@@ -157,8 +157,8 @@ static void select_method(private_eap_dynamic_t *this)
} }
if (entry->vendor) if (entry->vendor)
{ {
DBG1(DBG_IKE, "vendor specific EAP method %d-%d selected", DBG1(DBG_IKE, "vendor specific EAP method %d-%N selected",
entry->type, entry->vendor); entry->type, pen_names, entry->vendor);
} }
else else
{ {
@@ -137,8 +137,8 @@ METHOD(tls_application_t, process, status_t,
{ {
if (received_vendor) if (received_vendor)
{ {
DBG1(DBG_IKE, "server requested vendor specific EAP method %d-%d " DBG1(DBG_IKE, "server requested vendor specific EAP method %d-%N "
"(id 0x%02X)", received_type, received_vendor, "(id 0x%02X)", received_type, pen_names, received_vendor,
in->get_identifier(in)); in->get_identifier(in));
} }
else else
@@ -175,8 +175,8 @@ METHOD(tls_application_t, process, status_t,
default: default:
if (vendor) if (vendor)
{ {
DBG1(DBG_IKE, "vendor specific EAP method %d-%d failed", DBG1(DBG_IKE, "vendor specific EAP method %d-%N failed",
type, vendor); type, pen_names, vendor);
} }
else else
{ {
@@ -317,8 +317,8 @@ METHOD(tls_application_t, process, status_t,
default: default:
if (vendor) if (vendor)
{ {
DBG1(DBG_IKE, "vendor specific EAP method %d-%d failed", DBG1(DBG_IKE, "vendor specific EAP method %d-%N failed",
type, vendor); type, pen_names, vendor);
} }
else else
{ {
@@ -185,8 +185,8 @@ METHOD(tls_application_t, process, status_t,
{ {
if (received_vendor) if (received_vendor)
{ {
DBG1(DBG_IKE, "server requested vendor specific EAP method %d-%d " DBG1(DBG_IKE, "server requested vendor specific EAP method %d-%N "
"(id 0x%02X)", received_type, received_vendor, "(id 0x%02X)", received_type, pen_names, received_vendor,
in->get_identifier(in)); in->get_identifier(in));
} }
else else
@@ -224,8 +224,8 @@ METHOD(tls_application_t, process, status_t,
default: default:
if (vendor) if (vendor)
{ {
DBG1(DBG_IKE, "vendor specific EAP method %d-%d failed", DBG1(DBG_IKE, "vendor specific EAP method %d-%N failed",
type, vendor); type, pen_names, vendor);
} }
else else
{ {
@@ -292,8 +292,8 @@ METHOD(tls_application_t, process, status_t,
default: default:
if (vendor) if (vendor)
{ {
DBG1(DBG_IKE, "vendor specific EAP method %d-%d failed", DBG1(DBG_IKE, "vendor specific EAP method %d-%N failed",
type, vendor); type, pen_names, vendor);
} }
else else
{ {
+1 -1
View File
@@ -370,7 +370,7 @@ static void log_auth(auth_cfg_t *auth)
DBG2(DBG_CFG, " eap-type = %N", eap_type_names, v.u); DBG2(DBG_CFG, " eap-type = %N", eap_type_names, v.u);
break; break;
case AUTH_RULE_EAP_VENDOR: case AUTH_RULE_EAP_VENDOR:
DBG2(DBG_CFG, " eap-vendor = %u", v.u); DBG2(DBG_CFG, " eap-vendor = %N", pen_names, v.u);
break; break;
case AUTH_RULE_XAUTH_BACKEND: case AUTH_RULE_XAUTH_BACKEND:
DBG2(DBG_CFG, " xauth = %s", v.str); DBG2(DBG_CFG, " xauth = %s", v.str);
@@ -203,8 +203,8 @@ static eap_payload_t* server_initiate_eap(private_eap_authenticator_t *this,
type = this->method->get_type(this->method, &vendor); type = this->method->get_type(this->method, &vendor);
if (vendor) if (vendor)
{ {
DBG1(DBG_IKE, "initiating EAP vendor type %d-%d method (id 0x%02X)", DBG1(DBG_IKE, "initiating EAP vendor type %d-%N method (id 0x%02X)",
type, vendor, out->get_identifier(out)); type, pen_names, vendor, out->get_identifier(out));
} }
else else
{ {
@@ -218,8 +218,8 @@ static eap_payload_t* server_initiate_eap(private_eap_authenticator_t *this,
} }
if (vendor) if (vendor)
{ {
DBG1(DBG_IKE, "%s EAP vendor type %d-%d method failed", DBG1(DBG_IKE, "%s EAP vendor type %d-%N method failed",
action, type, vendor); action, type, pen_names, vendor);
} }
else else
{ {
@@ -320,8 +320,8 @@ static eap_payload_t* server_process_eap(private_eap_authenticator_t *this,
} }
if (vendor) if (vendor)
{ {
DBG1(DBG_IKE, "EAP vendor specific method %d-%d succeeded, " DBG1(DBG_IKE, "EAP vendor specific method %d-%N succeeded, "
"%sMSK established", type, vendor, "%sMSK established", type, pen_names, vendor,
this->msk.ptr ? "" : "no "); this->msk.ptr ? "" : "no ");
} }
else else
@@ -340,8 +340,8 @@ failure:
type = this->method->get_type(this->method, &vendor); type = this->method->get_type(this->method, &vendor);
if (vendor) if (vendor)
{ {
DBG1(DBG_IKE, "EAP vendor specific method %d-%d failed for " DBG1(DBG_IKE, "EAP vendor specific method %d-%N failed for "
"peer %Y", type, vendor, "peer %Y", type, pen_names, vendor,
this->ike_sa->get_other_id(this->ike_sa)); this->ike_sa->get_other_id(this->ike_sa));
} }
else else
@@ -403,8 +403,8 @@ static eap_payload_t* client_process_eap(private_eap_authenticator_t *this,
{ {
if (vendor) if (vendor)
{ {
DBG1(DBG_IKE, "server requested vendor specific EAP method %d-%d ", DBG1(DBG_IKE, "server requested vendor specific EAP method %d-%N ",
"(id 0x%02X)", type, vendor, in->get_identifier(in)); "(id 0x%02X)", type, pen_names, vendor, in->get_identifier(in));
} }
else else
{ {
@@ -419,8 +419,8 @@ static eap_payload_t* client_process_eap(private_eap_authenticator_t *this,
{ {
if (conf_vendor) if (conf_vendor)
{ {
DBG1(DBG_IKE, "requesting EAP method %d-%d, sending EAP_NAK", DBG1(DBG_IKE, "requesting EAP method %d-%N, sending EAP_NAK",
conf_type, conf_vendor); conf_type, pen_names, conf_vendor);
} }
else else
{ {
@@ -448,7 +448,8 @@ static eap_payload_t* client_process_eap(private_eap_authenticator_t *this,
if (vendor) if (vendor)
{ {
DBG1(DBG_IKE, "vendor specific EAP method %d-%d failed", type, vendor); DBG1(DBG_IKE, "vendor specific EAP method %d-%N failed", type,
pen_names, vendor);
} }
else else
{ {
@@ -693,8 +694,8 @@ METHOD(authenticator_t, process_client, status_t,
type = this->method->get_type(this->method, &vendor); type = this->method->get_type(this->method, &vendor);
if (vendor) if (vendor)
{ {
DBG1(DBG_IKE, "EAP vendor specific method %d-%d succeeded, " DBG1(DBG_IKE, "EAP vendor specific method %d-%N succeeded, "
"%sMSK established", type, vendor, "%sMSK established", type, pen_names, vendor,
this->msk.ptr ? "" : "no "); this->msk.ptr ? "" : "no ");
} }
else else
+35
View File
@@ -50,3 +50,38 @@ ENUM_NEXT(pen_names, PEN_UNASSIGNED, PEN_RESERVED, PEN_OPENPTS,
"Unassigned", "Unassigned",
"Reserved"); "Reserved");
ENUM_END(pen_names, PEN_RESERVED); ENUM_END(pen_names, PEN_RESERVED);
ENUM_BEGIN(pen_short_names, PEN_IETF, PEN_IETF,
"IETF");
ENUM_NEXT(pen_short_names, PEN_IBM, PEN_IBM, PEN_IETF,
"IBM");
ENUM_NEXT(pen_short_names, PEN_MICROSOFT, PEN_MICROSOFT, PEN_IBM,
"MS");
ENUM_NEXT(pen_short_names, PEN_REDHAT, PEN_REDHAT, PEN_MICROSOFT,
"RH");
ENUM_NEXT(pen_short_names, PEN_PWG, PEN_PWG, PEN_REDHAT,
"PWG");
ENUM_NEXT(pen_short_names, PEN_ALTIGA, PEN_ALTIGA, PEN_PWG,
"ALT");
ENUM_NEXT(pen_short_names, PEN_OSC, PEN_OSC, PEN_ALTIGA,
"OSC");
ENUM_NEXT(pen_short_names, PEN_DEBIAN, PEN_DEBIAN, PEN_OSC,
"DEB");
ENUM_NEXT(pen_short_names, PEN_GOOGLE, PEN_GOOGLE, PEN_DEBIAN,
"GOO");
ENUM_NEXT(pen_short_names, PEN_TCG, PEN_TCG, PEN_GOOGLE,
"TCG");
ENUM_NEXT(pen_short_names, PEN_CANONICAL, PEN_CANONICAL, PEN_TCG,
"CAN");
ENUM_NEXT(pen_short_names, PEN_FEDORA, PEN_FEDORA, PEN_CANONICAL,
"FED");
ENUM_NEXT(pen_short_names, PEN_FHH, PEN_FHH, PEN_FEDORA,
"FHH");
ENUM_NEXT(pen_short_names, PEN_ITA, PEN_ITA, PEN_FHH,
"ITA");
ENUM_NEXT(pen_short_names, PEN_OPENPTS, PEN_OPENPTS, PEN_ITA,
"PTS");
ENUM_NEXT(pen_short_names, PEN_UNASSIGNED, PEN_RESERVED, PEN_OPENPTS,
"UNAS",
"RES");
ENUM_END(pen_short_names, PEN_RESERVED);
+5
View File
@@ -107,4 +107,9 @@ static inline bool pen_type_is(pen_type_t pen_type,
*/ */
extern enum_name_t *pen_names; extern enum_name_t *pen_names;
/**
* short enum names for pen_t.
*/
extern enum_name_t *pen_short_names;
#endif /** PEN_H_ @}*/ #endif /** PEN_H_ @}*/
+2 -2
View File
@@ -412,8 +412,8 @@ char* plugin_feature_get_string(plugin_feature_t *feature)
case FEATURE_EAP_SERVER: case FEATURE_EAP_SERVER:
case FEATURE_EAP_PEER: case FEATURE_EAP_PEER:
if (feature->arg.eap.vendor && if (feature->arg.eap.vendor &&
asprintf(&str, "%N:%d-%d", plugin_feature_names, feature->type, asprintf(&str, "%N:%d-%N", plugin_feature_names, feature->type,
feature->arg.eap.type, feature->arg.eap.vendor) > 0) feature->arg.eap.type, pen_names, feature->arg.eap.vendor) > 0)
{ {
return str; return str;
} }