stroke: don't remove a matching peer config if used by other child configs
authorMartin Willi <martin@revosec.ch>
Mon, 9 Sep 2013 08:43:44 +0000 (10:43 +0200)
committerMartin Willi <martin@revosec.ch>
Fri, 13 Sep 2013 11:56:31 +0000 (13:56 +0200)
When configurations get merged during add, we should not remove peer configs
if other connection entries use the same peer config.

src/libcharon/plugins/stroke/stroke_config.c

index c069d50..edfa8a9 100644 (file)
@@ -1235,7 +1235,7 @@ METHOD(stroke_config_t, del, void,
 
        this->mutex->lock(this->mutex);
        enumerator = this->list->create_enumerator(this->list);
-       while (enumerator->enumerate(enumerator, (void**)&peer))
+       while (enumerator->enumerate(enumerator, &peer))
        {
                bool keep = FALSE;
 
@@ -1256,12 +1256,11 @@ METHOD(stroke_config_t, del, void,
                }
                children->destroy(children);
 
-               /* if peer config matches, or has no children anymore, remove it */
-               if (!keep || streq(peer->get_name(peer), msg->del_conn.name))
+               /* if peer config has no children anymore, remove it */
+               if (!keep)
                {
                        this->list->remove_at(this->list, enumerator);
                        peer->destroy(peer);
-                       deleted = TRUE;
                }
        }
        enumerator->destroy(enumerator);