]> git.ipfire.org Git - thirdparty/strongswan.git/commitdiff
eap: Print vendor (PEN) names for vendor-specific EAP methods
authorTobias Brunner <tobias@strongswan.org>
Thu, 21 Jul 2022 11:19:56 +0000 (13:19 +0200)
committerTobias Brunner <tobias@strongswan.org>
Wed, 21 Sep 2022 11:53:44 +0000 (13:53 +0200)
src/libcharon/encoding/message.c
src/libcharon/plugins/eap_dynamic/eap_dynamic.c
src/libcharon/plugins/eap_peap/eap_peap_peer.c
src/libcharon/plugins/eap_peap/eap_peap_server.c
src/libcharon/plugins/eap_ttls/eap_ttls_peer.c
src/libcharon/plugins/eap_ttls/eap_ttls_server.c
src/libcharon/plugins/vici/vici_config.c
src/libcharon/sa/ikev2/authenticators/eap_authenticator.c
src/libstrongswan/pen/pen.c
src/libstrongswan/pen/pen.h
src/libstrongswan/plugins/plugin_feature.c

index 89882ac6856f24ffa696433e15729dafd51e76b6..4494f23fd359792ba35be73597c1a130883843ed 100644 (file)
@@ -1344,7 +1344,8 @@ static char* get_string(private_message_t *this, char *buf, int len)
                        {
                                if (vendor)
                                {
-                                       snprintf(method, sizeof(method), "/%d-%d", type, vendor);
+                                       snprintf(method, sizeof(method), "/%d-%N", type,
+                                                        pen_short_names, vendor);
                                }
                                else
                                {
index 2654e18f382d999d42f57e540bbfccab7b4000f7..5ecb187f70bf6d329ecf76e32b47b4f8d178daae 100644 (file)
@@ -93,8 +93,8 @@ static eap_method_t *load_method(private_eap_dynamic_t *this,
        {
                if (vendor)
                {
-                       DBG1(DBG_IKE, "loading vendor specific EAP method %d-%d failed",
-                                type, vendor);
+                       DBG1(DBG_IKE, "loading vendor specific EAP method %d-%N failed",
+                                type, pen_names, vendor);
                }
                else
                {
@@ -135,9 +135,9 @@ static void select_method(private_eap_dynamic_t *this)
                        {
                                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,
-                                                 entry->vendor, who);
+                                                 pen_names, entry->vendor, who);
                                }
                                else
                                {
@@ -157,8 +157,8 @@ static void select_method(private_eap_dynamic_t *this)
                        }
                        if (entry->vendor)
                        {
-                               DBG1(DBG_IKE, "vendor specific EAP method %d-%d selected",
-                                        entry->type, entry->vendor);
+                               DBG1(DBG_IKE, "vendor specific EAP method %d-%N selected",
+                                        entry->type, pen_names, entry->vendor);
                        }
                        else
                        {
index 1350b7876a4c5d88dcb03b572843c111bd02ff19..eed40c0a7aca42cfdd9666d5ae7f0d808efb3211 100644 (file)
@@ -137,8 +137,8 @@ METHOD(tls_application_t, process, status_t,
        {
                if (received_vendor)
                {
-                       DBG1(DBG_IKE, "server requested vendor specific EAP method %d-%d "
-                                                 "(id 0x%02X)", received_type, received_vendor,
+                       DBG1(DBG_IKE, "server requested vendor specific EAP method %d-%N "
+                                                 "(id 0x%02X)", received_type, pen_names, received_vendor,
                                                   in->get_identifier(in));
                }
                else
@@ -175,8 +175,8 @@ METHOD(tls_application_t, process, status_t,
                default:
                        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
                        {
index f27325df2016187adeed035075d8df8d97900187..c5d97a16a17024c90584d24ca88b3bfd855f8f32 100644 (file)
@@ -317,8 +317,8 @@ METHOD(tls_application_t, process, status_t,
                default:
                        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
                        {
index 33e53556cd08b0e65cafe91f3a0b62889244ce88..4c8d3380441381f9a64e4178f9f44efffabe40fe 100644 (file)
@@ -185,8 +185,8 @@ METHOD(tls_application_t, process, status_t,
        {
                if (received_vendor)
                {
-                       DBG1(DBG_IKE, "server requested vendor specific EAP method %d-%d "
-                                                 "(id 0x%02X)", received_type, received_vendor,
+                       DBG1(DBG_IKE, "server requested vendor specific EAP method %d-%N "
+                                                 "(id 0x%02X)", received_type, pen_names, received_vendor,
                                                   in->get_identifier(in));
                }
                else
@@ -224,8 +224,8 @@ METHOD(tls_application_t, process, status_t,
                default:
                        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
                        {
index dce59a55394449ecffab03ae8c1bc0599e167963..d7279ce8c9b66cd5fdc8d006be1d837480d1f402 100644 (file)
@@ -292,8 +292,8 @@ METHOD(tls_application_t, process, status_t,
                default:
                        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
                        {
index ab382eca5b3243115ca98ed18b335865213e9ba3..0c061d4b2d75797479e5f8c4c53ccb06631181aa 100644 (file)
@@ -370,7 +370,7 @@ static void log_auth(auth_cfg_t *auth)
                                DBG2(DBG_CFG, "   eap-type = %N", eap_type_names, v.u);
                                break;
                        case AUTH_RULE_EAP_VENDOR:
-                               DBG2(DBG_CFG, "   eap-vendor = %u", v.u);
+                               DBG2(DBG_CFG, "   eap-vendor = %N", pen_names, v.u);
                                break;
                        case AUTH_RULE_XAUTH_BACKEND:
                                DBG2(DBG_CFG, "   xauth = %s", v.str);
index ffc41ef3d6fe10fc0feb055abf9422a57210de50..976ed623d3dceff0becb99d88352632186acbfc2 100644 (file)
@@ -203,8 +203,8 @@ static eap_payload_t* server_initiate_eap(private_eap_authenticator_t *this,
                        type = this->method->get_type(this->method, &vendor);
                        if (vendor)
                        {
-                               DBG1(DBG_IKE, "initiating EAP vendor type %d-%d method (id 0x%02X)",
-                                        type, vendor, out->get_identifier(out));
+                               DBG1(DBG_IKE, "initiating EAP vendor type %d-%N method (id 0x%02X)",
+                                        type, pen_names, vendor, out->get_identifier(out));
                        }
                        else
                        {
@@ -218,8 +218,8 @@ static eap_payload_t* server_initiate_eap(private_eap_authenticator_t *this,
        }
        if (vendor)
        {
-               DBG1(DBG_IKE, "%s EAP vendor type %d-%d method failed",
-                                         action, type, vendor);
+               DBG1(DBG_IKE, "%s EAP vendor type %d-%N method failed",
+                                         action, type, pen_names, vendor);
        }
        else
        {
@@ -320,8 +320,8 @@ static eap_payload_t* server_process_eap(private_eap_authenticator_t *this,
                        }
                        if (vendor)
                        {
-                               DBG1(DBG_IKE, "EAP vendor specific method %d-%d succeeded, "
-                                        "%sMSK established", type, vendor,
+                               DBG1(DBG_IKE, "EAP vendor specific method %d-%N succeeded, "
+                                        "%sMSK established", type, pen_names, vendor,
                                         this->msk.ptr ? "" : "no ");
                        }
                        else
@@ -340,8 +340,8 @@ failure:
                        type = this->method->get_type(this->method, &vendor);
                        if (vendor)
                        {
-                               DBG1(DBG_IKE, "EAP vendor specific method %d-%d failed for "
-                                        "peer %Y", type, vendor,
+                               DBG1(DBG_IKE, "EAP vendor specific method %d-%N failed for "
+                                        "peer %Y", type, pen_names, vendor,
                                         this->ike_sa->get_other_id(this->ike_sa));
                        }
                        else
@@ -403,8 +403,8 @@ static eap_payload_t* client_process_eap(private_eap_authenticator_t *this,
        {
                if (vendor)
                {
-                       DBG1(DBG_IKE, "server requested vendor specific EAP method %d-%d ",
-                                                 "(id 0x%02X)", type, vendor, in->get_identifier(in));
+                       DBG1(DBG_IKE, "server requested vendor specific EAP method %d-%N ",
+                                "(id 0x%02X)", type, pen_names, vendor, in->get_identifier(in));
                }
                else
                {
@@ -419,8 +419,8 @@ static eap_payload_t* client_process_eap(private_eap_authenticator_t *this,
                {
                        if (conf_vendor)
                        {
-                               DBG1(DBG_IKE, "requesting EAP method %d-%d, sending EAP_NAK",
-                                        conf_type, conf_vendor);
+                               DBG1(DBG_IKE, "requesting EAP method %d-%N, sending EAP_NAK",
+                                        conf_type, pen_names, conf_vendor);
                        }
                        else
                        {
@@ -448,7 +448,8 @@ static eap_payload_t* client_process_eap(private_eap_authenticator_t *this,
 
        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
        {
@@ -693,8 +694,8 @@ METHOD(authenticator_t, process_client, status_t,
                                type = this->method->get_type(this->method, &vendor);
                                if (vendor)
                                {
-                                       DBG1(DBG_IKE, "EAP vendor specific method %d-%d succeeded, "
-                                                "%sMSK established", type, vendor,
+                                       DBG1(DBG_IKE, "EAP vendor specific method %d-%N succeeded, "
+                                                "%sMSK established", type, pen_names, vendor,
                                                 this->msk.ptr ? "" : "no ");
                                }
                                else
index d6f12ddd9a5998bd112f8703be3c3f9a8b61bab1..f9c524103efdf1d714d0aeab99cac027849fabc7 100644 (file)
@@ -50,3 +50,38 @@ ENUM_NEXT(pen_names, PEN_UNASSIGNED, PEN_RESERVED, PEN_OPENPTS,
        "Unassigned",
        "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);
index 6b409669a0854d7b6790df2c4c64c4ea199c65f8..23b3212aff4fef3a5dc1a59685154646f806ae72 100644 (file)
@@ -107,4 +107,9 @@ static inline bool pen_type_is(pen_type_t pen_type,
  */
 extern enum_name_t *pen_names;
 
+/**
+ * short enum names for pen_t.
+ */
+extern enum_name_t *pen_short_names;
+
 #endif /** PEN_H_ @}*/
index 075230ab00caf9cdeb325830e02f19bcbda38b5a..96bbb9a89004236eb1808e225678e19902d70516 100644 (file)
@@ -412,8 +412,8 @@ char* plugin_feature_get_string(plugin_feature_t *feature)
                case FEATURE_EAP_SERVER:
                case FEATURE_EAP_PEER:
                        if (feature->arg.eap.vendor &&
-                               asprintf(&str, "%N:%d-%d", plugin_feature_names, feature->type,
-                                       feature->arg.eap.type, feature->arg.eap.vendor) > 0)
+                               asprintf(&str, "%N:%d-%N", plugin_feature_names, feature->type,
+                                       feature->arg.eap.type, pen_names, feature->arg.eap.vendor) > 0)
                        {
                                return str;
                        }