proposal: Add selection flags to clone() method
This avoids having to call strip_dh() in child_cfg_t::get_proposals(). It also inverts the ALLOW_PRIVATE flag (i.e. makes it SKIP_PRIVATE) so nothing has to be supplied to clone complete proposals.
This commit is contained in:
@@ -209,16 +209,18 @@ METHOD(child_cfg_t, get_proposals, linked_list_t*,
|
||||
{
|
||||
enumerator_t *enumerator;
|
||||
proposal_t *current;
|
||||
proposal_selection_flag_t flags = 0;
|
||||
linked_list_t *proposals = linked_list_create();
|
||||
|
||||
if (strip_dh)
|
||||
{
|
||||
flags |= PROPOSAL_SKIP_DH;
|
||||
}
|
||||
|
||||
enumerator = this->proposals->create_enumerator(this->proposals);
|
||||
while (enumerator->enumerate(enumerator, ¤t))
|
||||
{
|
||||
current = current->clone(current);
|
||||
if (strip_dh)
|
||||
{
|
||||
current->strip_dh(current, MODP_NONE);
|
||||
}
|
||||
current = current->clone(current, flags);
|
||||
if (proposals->find_first(proposals, match_proposal, NULL, current))
|
||||
{
|
||||
current->destroy(current);
|
||||
|
||||
@@ -310,7 +310,7 @@ METHOD(ike_cfg_t, get_proposals, linked_list_t*,
|
||||
enumerator = this->proposals->create_enumerator(this->proposals);
|
||||
while (enumerator->enumerate(enumerator, ¤t))
|
||||
{
|
||||
current = current->clone(current);
|
||||
current = current->clone(current, 0);
|
||||
proposals->insert_last(proposals, current);
|
||||
}
|
||||
enumerator->destroy(enumerator);
|
||||
@@ -330,7 +330,7 @@ METHOD(ike_cfg_t, has_proposal, bool,
|
||||
while (enumerator->enumerate(enumerator, &proposal))
|
||||
{
|
||||
if (proposal->matches(proposal, match,
|
||||
private ? PROPOSAL_ALLOW_PRIVATE : 0))
|
||||
private ? 0 : PROPOSAL_SKIP_PRIVATE))
|
||||
{
|
||||
enumerator->destroy(enumerator);
|
||||
return TRUE;
|
||||
|
||||
Reference in New Issue
Block a user