]> git.ipfire.org Git - thirdparty/strongswan.git/commitdiff
Print EAP types with %M identifier, providing a fallback for unknown vendors
authorMartin Willi <martin@revosec.ch>
Fri, 31 Aug 2012 14:55:45 +0000 (16:55 +0200)
committerMartin Willi <martin@revosec.ch>
Mon, 3 Sep 2012 14:13:58 +0000 (16:13 +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_server.c
src/libcharon/plugins/stroke/stroke_list.c
src/libcharon/plugins/tnc_pdp/tnc_pdp.c
src/libcharon/sa/ikev2/authenticators/eap_authenticator.c

index f5e54176f267cd2825cb89065530731f97e50cd0..26f8a5f81b21cadf9852fb99ef038da84e6817cc 100644 (file)
@@ -1229,8 +1229,8 @@ static char* get_string(private_message_t *this, char *buf, int len)
                        type = eap->get_type(eap, &vendor);
                        if (type)
                        {
-                               snprintf(method, sizeof(method), "/%N",
-                                               eap_type_get_names(vendor), type);
+                               snprintf(method, sizeof(method), "/%M",
+                                               eap_type_get_names, vendor, type);
                        }
                        written = snprintf(pos, len, "/%N%s", eap_code_short_names,
                                                           eap->get_code(eap), method);
index 660ce649d544f6dd34ed27511e483c0fb1b411f3..37f1e3d4353dabc9a234a127145dc446a01bed51 100644 (file)
@@ -91,8 +91,8 @@ static eap_method_t *load_method(private_eap_dynamic_t *this,
                                                                                  this->server, this->peer);
        if (!method)
        {
-               DBG1(DBG_IKE, "loading EAP-%N method failed",
-                        eap_type_get_names(vendor), type);
+               DBG1(DBG_IKE, "loading EAP-%M method failed",
+                        eap_type_get_names, vendor, type);
        }
        return method;
 }
@@ -120,8 +120,8 @@ static void select_method(private_eap_dynamic_t *this)
                        if (inner->find_first(inner, (void*)entry_matches,
                                                                  NULL, entry) != SUCCESS)
                        {
-                               DBG2(DBG_IKE, "proposed EAP-%N method not supported "
-                                        "by %s, skipped", eap_type_get_names(entry->vendor),
+                               DBG2(DBG_IKE, "proposed EAP-%M method not supported "
+                                        "by %s, skipped", eap_type_get_names, entry->vendor,
                                         entry->type, who);
                                free(entry);
                                continue;
@@ -130,8 +130,8 @@ static void select_method(private_eap_dynamic_t *this)
                this->method = load_method(this, entry->type, entry->vendor);
                if (this->method)
                {
-                       DBG1(DBG_IKE, "EAP-%N method selected",
-                                eap_type_get_names(entry->vendor), entry->type);
+                       DBG1(DBG_IKE, "EAP-%M method selected",
+                                eap_type_get_names, entry->vendor, entry->type);
                        free(entry);
                        break;
                }
index 84a877f11eb71d0b3046d72301f27267a1948c4d..3fd83fb37f7d4a462b33ced9c61857f23ea60abb 100644 (file)
@@ -95,9 +95,9 @@ static status_t process_phase2(private_eap_peap_peer_t *this, eap_payload_t *in)
 
        code = in->get_code(in);
        received_type = in->get_type(in, &received_vendor);
-       DBG1(DBG_IKE, "received tunneled EAP-PEAP AVP [ EAP/%N/%N ]",
+       DBG1(DBG_IKE, "received tunneled EAP-PEAP AVP [ EAP/%N/%M ]",
                 eap_code_short_names, code,
-                eap_type_get_names(received_vendor), received_type);
+                eap_type_get_names, received_vendor, received_type);
 
        /* yet another phase2 authentication? */
        if (this->ph2)
@@ -113,8 +113,8 @@ static status_t process_phase2(private_eap_peap_peer_t *this, eap_payload_t *in)
 
        if (this->ph2 == NULL)
        {
-               DBG1(DBG_IKE, "server requested EAP method %N (id 0x%02X)",
-                        eap_type_get_names(received_vendor), received_type,
+               DBG1(DBG_IKE, "server requested EAP method %M (id 0x%02X)",
+                        eap_type_get_names, received_vendor, received_type,
                         in->get_identifier(in));
                this->ph2 = charon->eap->create_instance(charon->eap,
                                                                        received_type, received_vendor,
@@ -143,7 +143,7 @@ static status_t process_phase2(private_eap_peap_peer_t *this, eap_payload_t *in)
                        return NEED_MORE;
                case FAILED:
                default:
-                       DBG1(DBG_IKE, "EAP-%N failed", eap_type_get_names(vendor), type);
+                       DBG1(DBG_IKE, "EAP-%M failed", eap_type_get_names, vendor, type);
                        return FAILED;
        }
 }
@@ -278,9 +278,9 @@ static status_t process_eap_with_header(private_eap_peap_peer_t *this,
                                DBG1(DBG_IKE, "parsing PEAP inner expanded EAP header failed");
                                return FAILED;
                        }
-                       DBG1(DBG_IKE, "received tunneled EAP-PEAP AVP [ EAP/%N/%N ]",
+                       DBG1(DBG_IKE, "received tunneled EAP-PEAP AVP [ EAP/%N/%M ]",
                                 eap_code_short_names, code,
-                                eap_type_get_names(vendor), type);
+                                eap_type_get_names, vendor, type);
                        if (vendor == PEN_MICROSOFT && type == EAP_MS_CAPABILITES)
                        {
                                return process_capabilities(this, reader);
@@ -338,9 +338,9 @@ METHOD(tls_application_t, build, status_t,
        {
                code = this->out->get_code(this->out);
                type = this->out->get_type(this->out, &vendor);
-               DBG1(DBG_IKE, "sending tunneled EAP-PEAP AVP [ EAP/%N/%N ]",
+               DBG1(DBG_IKE, "sending tunneled EAP-PEAP AVP [ EAP/%N/%M ]",
                         eap_code_short_names, code,
-                        eap_type_get_names(vendor), type);
+                        eap_type_get_names, vendor, type);
 
                data = this->out->get_data(this->out);
 
index 73c9c4fd2a556b6a532da1e5f0103fb469a87edb..ed0559345e3a02c22af4c10b542235cf1f74d997 100644 (file)
@@ -100,13 +100,13 @@ static status_t start_phase2_auth(private_eap_peap_server_t *this)
                DBG1(DBG_IKE, "unrecognized phase2 method \"%s\"", eap_type_str);
                return FAILED;
        }
-       DBG1(DBG_IKE, "phase2 method %N selected", eap_type_get_names(vendor), type);
+       DBG1(DBG_IKE, "phase2 method %M selected", eap_type_get_names, vendor, type);
                this->ph2_method = charon->eap->create_instance(charon->eap, type,
                                                                vendor, EAP_SERVER, this->server, this->peer);
        if (this->ph2_method == NULL)
        {
-               DBG1(DBG_IKE, "%N method not available",
-                        eap_type_get_names(vendor), type);
+               DBG1(DBG_IKE, "%M method not available",
+                        eap_type_get_names, vendor, type);
                return FAILED;
        }
 
@@ -120,7 +120,7 @@ static status_t start_phase2_auth(private_eap_peap_server_t *this)
        }
        else
        {
-               DBG1(DBG_IKE, "%N method failed", eap_type_get_names(vendor), type);
+               DBG1(DBG_IKE, "%M method failed", eap_type_get_names, vendor, type);
                return FAILED;
        }
 }
index 21718cef65248537692a4650baea173daf37dc0a..35aee1067e00a816cd4bed24f5ebe3f2b41e92bf 100644 (file)
@@ -87,13 +87,13 @@ static status_t start_phase2_auth(private_eap_ttls_server_t *this)
                DBG1(DBG_IKE, "unrecognized phase2 method \"%s\"", eap_type_str);
                return FAILED;
        }
-       DBG1(DBG_IKE, "phase2 method %N selected", eap_type_get_names(vendor), type);
+       DBG1(DBG_IKE, "phase2 method %M selected", eap_type_get_names, vendor, type);
                this->method = charon->eap->create_instance(charon->eap, type, vendor,
                                                                EAP_SERVER, this->server, this->peer);
        if (this->method == NULL)
        {
-               DBG1(DBG_IKE, "%N method not available",
-                        eap_type_get_names(vendor), type);
+               DBG1(DBG_IKE, "%M method not available",
+                        eap_type_get_names, vendor, type);
                return FAILED;
        }
        if (this->method->initiate(this->method, &this->out) == NEED_MORE)
@@ -102,7 +102,7 @@ static status_t start_phase2_auth(private_eap_ttls_server_t *this)
        }
        else
        {
-               DBG1(DBG_IKE, "%N method failed", eap_type_get_names(vendor), type);
+               DBG1(DBG_IKE, "%M method failed", eap_type_get_names, vendor, type);
                return FAILED;
        }
 }
index bcaa19a6f53af838a86e39df2c31d513c357ff79..7c856d07e85cdfe9902c97e2327172d810348b92 100644 (file)
@@ -355,9 +355,9 @@ static void log_auth_cfgs(FILE *out, peer_cfg_t *peer_cfg, bool local)
                        }
                        else
                        {
-                               fprintf(out, "EAP-%N authentication",
-                                               eap_type_get_names(
-                                                       (uintptr_t)auth->get(auth, AUTH_RULE_EAP_VENDOR)),
+                               fprintf(out, "EAP-%M authentication",
+                                               eap_type_get_names,
+                                               (uintptr_t)auth->get(auth, AUTH_RULE_EAP_VENDOR),
                                                (uintptr_t)auth->get(auth, AUTH_RULE_EAP_TYPE));
                        }
                        id = auth->get(auth, AUTH_RULE_EAP_IDENTITY);
index 5b596b65eb6356f23159f598be6c3bfbf1c3b137..952d2ad49d50a166364337a50ab711e60757af3b 100644 (file)
@@ -274,8 +274,8 @@ static void send_response(private_tnc_pdp_t *this, radius_message_t *request,
        if (eap)
        {
                data = eap->get_data(eap);
-               DBG3(DBG_CFG, "%N payload %B",
-                        eap_type_get_names(this->vendor), this->type, &data);
+               DBG3(DBG_CFG, "%M payload %B",
+                        eap_type_get_names, this->vendor, this->type, &data);
 
                /* fragment data suitable for RADIUS */
                while (data.len > MAX_RADIUS_ATTRIBUTE_SIZE)
@@ -364,8 +364,8 @@ static void process_eap(private_tnc_pdp_t *this, radius_message_t *request,
                /* apply EAP method selected by RADIUS server */
                eap_type = in->get_type(in, &eap_vendor);
 
-               DBG3(DBG_CFG, "EAP-%N payload %B",
-                        eap_type_get_names(eap_vendor), eap_type, &message);
+               DBG3(DBG_CFG, "EAP-%M payload %B",
+                        eap_type_get_names, eap_vendor, eap_type, &message);
 
                if (eap_type == EAP_IDENTITY)
                {
@@ -650,8 +650,8 @@ tnc_pdp_t *tnc_pdp_create(u_int16_t port)
                destroy(this);
                return NULL;
        }
-       DBG1(DBG_IKE, "eap method %N selected",
-                eap_type_get_names(this->vendor), this->type);
+       DBG1(DBG_IKE, "eap method %M selected",
+                eap_type_get_names, this->vendor, this->type);
 
        lib->processor->queue_job(lib->processor,
                (job_t*)callback_job_create_with_prio((callback_job_cb_t)receive, this,
index c7d3fb6569163a81ec0a4b59e7ff2c0c8323e561..84b2f02c58096d51ed4e1442d2786a205847d516 100644 (file)
@@ -190,15 +190,15 @@ static eap_payload_t* server_initiate_eap(private_eap_authenticator_t *this,
                if (this->method->initiate(this->method, &out) == NEED_MORE)
                {
                        type = this->method->get_type(this->method, &vendor);
-                       DBG1(DBG_IKE, "%s EAP-%N method (id 0x%02X)", action,
-                                eap_type_get_names(vendor), type, out->get_identifier(out));
+                       DBG1(DBG_IKE, "%s EAP-%M method (id 0x%02X)", action,
+                                eap_type_get_names, vendor, type, out->get_identifier(out));
                        return out;
                }
                /* type might have changed for virtual methods */
                type = this->method->get_type(this->method, &vendor);
        }
-       DBG1(DBG_IKE, "%s EAP-%N method failed", action,
-                eap_type_get_names(vendor), type);
+       DBG1(DBG_IKE, "%s EAP-%M method failed", action,
+                eap_type_get_names, vendor, type);
        return eap_payload_create_code(EAP_FAILURE, 0);
 }
 
@@ -284,8 +284,8 @@ static eap_payload_t* server_process_eap(private_eap_authenticator_t *this,
                        {
                                this->msk = chunk_clone(this->msk);
                        }
-                       DBG1(DBG_IKE, "EAP method %N succeeded, %sMSK established",
-                                eap_type_get_names(vendor), type, this->msk.ptr ? "" : "no ");
+                       DBG1(DBG_IKE, "EAP method %M succeeded, %sMSK established",
+                                eap_type_get_names, vendor, type, this->msk.ptr ? "" : "no ");
                        this->ike_sa->set_condition(this->ike_sa, COND_EAP_AUTHENTICATED,
                                                                                TRUE);
                        this->eap_complete = TRUE;
@@ -293,8 +293,8 @@ static eap_payload_t* server_process_eap(private_eap_authenticator_t *this,
                case FAILED:
                default:
                        /* type might have changed for virtual methods */
-                       DBG1(DBG_IKE, "EAP method %N failed for peer %Y",
-                                eap_type_get_names(vendor), type,
+                       DBG1(DBG_IKE, "EAP method %M failed for peer %Y",
+                                eap_type_get_names, vendor, type,
                                 this->ike_sa->get_other_id(this->ike_sa));
                        return eap_payload_create_code(EAP_FAILURE, in->get_identifier(in));
        }
@@ -347,8 +347,8 @@ static eap_payload_t* client_process_eap(private_eap_authenticator_t *this,
        }
        if (this->method == NULL)
        {
-               DBG1(DBG_IKE, "server requested %N authentication (id 0x%02X)",
-                        eap_type_get_names(vendor), type, in->get_identifier(in));
+               DBG1(DBG_IKE, "server requested %M authentication (id 0x%02X)",
+                        eap_type_get_names, vendor, type, in->get_identifier(in));
 
                auth = this->ike_sa->get_auth_cfg(this->ike_sa, TRUE);
                conf_type = (uintptr_t)auth->get(auth, AUTH_RULE_EAP_TYPE);
@@ -356,8 +356,8 @@ static eap_payload_t* client_process_eap(private_eap_authenticator_t *this,
                if (conf_type != EAP_NAK &&
                   (conf_type != type || conf_vendor != vendor))
                {
-                       DBG1(DBG_IKE, "requesting EAP-%N authentication, sending EAP_NAK",
-                                eap_type_get_names(conf_vendor), conf_type);
+                       DBG1(DBG_IKE, "requesting EAP-%M authentication, sending EAP_NAK",
+                                eap_type_get_names, conf_vendor, conf_type);
                        return eap_payload_create_nak(in->get_identifier(in), conf_type,
                                                                                  conf_vendor, in->is_expanded(in));
                }
@@ -377,7 +377,7 @@ static eap_payload_t* client_process_eap(private_eap_authenticator_t *this,
                return out;
        }
 
-       DBG1(DBG_IKE, "EAP-%N method failed", eap_type_get_names(vendor), type);
+       DBG1(DBG_IKE, "EAP-%M method failed", eap_type_get_names, vendor, type);
        return NULL;
 }
 
@@ -527,8 +527,8 @@ METHOD(authenticator_t, process_client, status_t,
 
                        type = this->method->get_type(this->method, &vendor);
                        DBG1(DBG_IKE, "EAP-only authentication requires a mutual and "
-                                "MSK deriving EAP method, but %N is not",
-                                eap_type_get_names(vendor), type);
+                                "MSK deriving EAP method, but %M is not",
+                                eap_type_get_names, vendor, type);
                        return FAILED;
                }
                return SUCCESS;
@@ -560,8 +560,8 @@ METHOD(authenticator_t, process_client, status_t,
                                        this->msk = chunk_clone(this->msk);
                                }
                                type = this->method->get_type(this->method, &vendor);
-                               DBG1(DBG_IKE, "EAP method %N succeeded, %sMSK established",
-                                        eap_type_get_names(vendor), type,
+                               DBG1(DBG_IKE, "EAP method %M succeeded, %sMSK established",
+                                        eap_type_get_names, vendor, type,
                                         this->msk.ptr ? "" : "no ");
                                cfg = this->ike_sa->get_auth_cfg(this->ike_sa, TRUE);
                                cfg->add(cfg, AUTH_RULE_EAP_TYPE, type);