Use auth_cfg_t.replace_value where appropriate.
This commit is contained in:
parent
68cca941cf
commit
b447af658c
|
@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue