fixed double free bug
This commit is contained in:
@@ -193,7 +193,9 @@ static status_t select_and_install(private_child_create_t *this)
|
||||
my_vip = this->ike_sa->get_virtual_ip(this->ike_sa, TRUE);
|
||||
other_vip = this->ike_sa->get_virtual_ip(this->ike_sa, FALSE);
|
||||
|
||||
DBG1(DBG_IKE, "received %d proposals, selecting:", this->proposals->get_count(this->proposals));
|
||||
this->proposal = this->policy->select_proposal(this->policy, this->proposals);
|
||||
DBG1(DBG_IKE, "proposal is %p", this->proposal);
|
||||
|
||||
if (this->initiator && my_vip)
|
||||
{ /* if we have a virtual IP, shorten our TS to the minimum */
|
||||
@@ -230,14 +232,19 @@ static status_t select_and_install(private_child_create_t *this)
|
||||
this->tsi = other_ts;
|
||||
}
|
||||
|
||||
if (this->proposal == NULL ||
|
||||
this->tsi->get_count(this->tsi) == 0 ||
|
||||
this->tsr->get_count(this->tsr) == 0)
|
||||
if (this->proposal == NULL)
|
||||
{
|
||||
SIG(CHILD_UP_FAILED, "no acceptable proposal found");
|
||||
return FAILED;
|
||||
}
|
||||
|
||||
if (this->tsi->get_count(this->tsi) == 0 ||
|
||||
this->tsr->get_count(this->tsr) == 0)
|
||||
{
|
||||
SIG(CHILD_UP_FAILED, "no acceptable traffic selectors found");
|
||||
return FAILED;
|
||||
}
|
||||
|
||||
if (!this->initiator)
|
||||
{
|
||||
/* check if requested mode is acceptable, downgrade if required */
|
||||
|
||||
@@ -108,7 +108,6 @@ static status_t build_payloads(private_ike_auth_t *this, message_t *message)
|
||||
me = this->ike_sa->get_my_id(this->ike_sa);
|
||||
other = this->ike_sa->get_other_id(this->ike_sa);
|
||||
|
||||
|
||||
/* create own authenticator and add auth payload */
|
||||
policy = this->ike_sa->get_policy(this->ike_sa);
|
||||
if (!policy)
|
||||
@@ -126,7 +125,7 @@ static status_t build_payloads(private_ike_auth_t *this, message_t *message)
|
||||
SIG(IKE_UP_FAILED, "negotiation of own ID failed");
|
||||
return FAILED;
|
||||
}
|
||||
this->ike_sa->set_my_id(this->ike_sa, me);
|
||||
this->ike_sa->set_my_id(this->ike_sa, me->clone(me));
|
||||
}
|
||||
|
||||
id_payload = id_payload_create_from_identification(this->initiator, me);
|
||||
@@ -214,6 +213,7 @@ static void process_payloads(private_ike_auth_t *this, message_t *message)
|
||||
if (this->initiator)
|
||||
{
|
||||
this->ike_sa->set_other_id(this->ike_sa, idr);
|
||||
DESTROY_IF(idi);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -300,12 +300,12 @@ static status_t build_r(private_ike_config_t *this, message_t *message)
|
||||
|
||||
DBG1(DBG_IKE, "peer requested virtual IP %H", this->virtual_ip);
|
||||
ip = this->policy->get_virtual_ip(this->policy, this->virtual_ip);
|
||||
if (ip == NULL)
|
||||
if (ip == NULL || ip->is_anyaddr(ip))
|
||||
{
|
||||
DBG1(DBG_IKE, "not assigning a virtual IP to peer");
|
||||
return SUCCESS;
|
||||
}
|
||||
DBG1(DBG_IKE, "assigning virtual IP %H to peer", ip);
|
||||
DBG1(DBG_IKE, "assigning virtual IP %H to peer", ip);
|
||||
this->ike_sa->set_virtual_ip(this->ike_sa, FALSE, ip);
|
||||
|
||||
this->virtual_ip->destroy(this->virtual_ip);
|
||||
|
||||
@@ -135,13 +135,12 @@ static void build_payloads(private_ike_init_t *this, message_t *message)
|
||||
}
|
||||
message->add_payload(message, (payload_t*)sa_payload);
|
||||
|
||||
ke_payload = ke_payload_create_from_diffie_hellman(this->diffie_hellman);
|
||||
message->add_payload(message, (payload_t*)ke_payload);
|
||||
|
||||
nonce_payload = nonce_payload_create();
|
||||
nonce_payload->set_nonce(nonce_payload, this->my_nonce);
|
||||
|
||||
message->add_payload(message, (payload_t*)nonce_payload);
|
||||
|
||||
ke_payload = ke_payload_create_from_diffie_hellman(this->diffie_hellman);
|
||||
message->add_payload(message, (payload_t*)ke_payload);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user