fixed CHILD_SA proposal selection when not using DH exchange
authorMartin Willi <martin@strongswan.org>
Mon, 23 Apr 2007 12:59:10 +0000 (12:59 -0000)
committerMartin Willi <martin@strongswan.org>
Mon, 23 Apr 2007 12:59:10 +0000 (12:59 -0000)
src/charon/config/child_cfg.c

index 440f771..e9f0e52 100644 (file)
@@ -175,26 +175,21 @@ static proposal_t* select_proposal(private_child_cfg_t*this,
        /* compare all stored proposals with all supplied. Stored ones are preferred. */
        while (stored_iter->iterate(stored_iter, (void**)&stored))
        {
        /* compare all stored proposals with all supplied. Stored ones are preferred. */
        while (stored_iter->iterate(stored_iter, (void**)&stored))
        {
+               stored = stored->clone(stored);
                supplied_iter->reset(supplied_iter);
                while (supplied_iter->iterate(supplied_iter, (void**)&supplied))
                {
                        if (strip_dh)
                        {
                supplied_iter->reset(supplied_iter);
                while (supplied_iter->iterate(supplied_iter, (void**)&supplied))
                {
                        if (strip_dh)
                        {
-                               /* remove DH groups on a copy */
-                               stored = stored->clone(stored);
                                strip_dh_from_proposal(stored);
                                strip_dh_from_proposal(stored);
-                               selected = stored->select(stored, supplied);
-                               stored->destroy(stored);
-                       }
-                       else
-                       {
-                               selected = stored->select(stored, supplied);
                        }
                        }
+                       selected = stored->select(stored, supplied);
                        if (selected)
                        {
                                break;
                        }
                }
                        if (selected)
                        {
                                break;
                        }
                }
+               stored->destroy(stored);
                if (selected)
                {
                        break;
                if (selected)
                {
                        break;