diff options
-rw-r--r-- | src/libcharon/sa/authenticators/eap_authenticator.c | 16 | ||||
-rw-r--r-- | src/libcharon/sa/tasks/ike_auth.c | 15 |
2 files changed, 5 insertions, 26 deletions
diff --git a/src/libcharon/sa/authenticators/eap_authenticator.c b/src/libcharon/sa/authenticators/eap_authenticator.c index c85a45fb3..7284dfc8a 100644 --- a/src/libcharon/sa/authenticators/eap_authenticator.c +++ b/src/libcharon/sa/authenticators/eap_authenticator.c @@ -218,23 +218,15 @@ static eap_payload_t* server_initiate_eap(private_eap_authenticator_t *this, */ static void replace_eap_identity(private_eap_authenticator_t *this) { - enumerator_t *enumerator; - auth_rule_t rule; + identification_t *eap_identity; auth_cfg_t *cfg; - void *ptr; + eap_identity = this->eap_identity->clone(this->eap_identity); cfg = this->ike_sa->get_auth_cfg(this->ike_sa, FALSE); - enumerator = cfg->create_enumerator(cfg); - while (enumerator->enumerate(enumerator, &rule, &ptr)) + if (!cfg->replace_value(cfg, AUTH_RULE_EAP_IDENTITY, eap_identity)) { - if (rule == AUTH_RULE_EAP_IDENTITY) - { - cfg->replace(cfg, enumerator, AUTH_RULE_EAP_IDENTITY, - this->eap_identity->clone(this->eap_identity)); - break; - } + eap_identity->destroy(eap_identity); } - enumerator->destroy(enumerator); } /** diff --git a/src/libcharon/sa/tasks/ike_auth.c b/src/libcharon/sa/tasks/ike_auth.c index 1ef216272..ae8ef0a14 100644 --- a/src/libcharon/sa/tasks/ike_auth.c +++ b/src/libcharon/sa/tasks/ike_auth.c @@ -424,24 +424,11 @@ METHOD(task_t, build_i, status_t, } else if (idi->get_type(idi) == ID_ANY) { /* ID_ANY is invalid as IDi, use local IP address instead */ - enumerator_t *enumerator; - auth_rule_t rule; host_t *me; - void *data; me = this->ike_sa->get_my_host(this->ike_sa); idi = identification_create_from_sockaddr(me->get_sockaddr(me)); - enumerator = cfg->create_enumerator(cfg); - while (enumerator->enumerate(enumerator, &rule, &data)) - { - if (rule == AUTH_RULE_IDENTITY) - { - cfg->replace(cfg, enumerator, AUTH_RULE_IDENTITY, - idi); - break; - } - } - enumerator->destroy(enumerator); + cfg->replace_value(cfg, AUTH_RULE_IDENTITY, idi); } this->ike_sa->set_my_id(this->ike_sa, idi->clone(idi)); id_payload = id_payload_create_from_identification(ID_INITIATOR, idi); |