]> git.ipfire.org Git - thirdparty/strongswan.git/commitdiff
vici: Remove external enumeration to uninstall shunt policies
authorTobias Brunner <tobias@strongswan.org>
Fri, 3 Nov 2017 09:55:05 +0000 (10:55 +0100)
committerTobias Brunner <tobias@strongswan.org>
Thu, 22 Feb 2018 10:31:05 +0000 (11:31 +0100)
src/libcharon/plugins/vici/vici_control.c

index afee649f7feaa1d9b7f6a92326e8c686ce323a75..ef33a61905d2f096cebb1baf2293208dffd422c1 100644 (file)
@@ -680,11 +680,10 @@ CALLBACK(uninstall, vici_message_t*,
        private_vici_control_t *this, char *name, u_int id, vici_message_t *request)
 {
        peer_cfg_t *peer_cfg;
-       child_cfg_t *child_cfg;
        child_sa_t *child_sa;
        enumerator_t *enumerator;
        uint32_t reqid = 0;
-       char *child, *ike, *ns;
+       char *child, *ike;
 
        child = request->get_str(request, NULL, "child");
        ike = request->get_str(request, NULL, "ike");
@@ -695,30 +694,7 @@ CALLBACK(uninstall, vici_message_t*,
 
        DBG1(DBG_CFG, "vici uninstall '%s'", child);
 
-       if (!ike)
-       {
-               enumerator = charon->shunts->create_enumerator(charon->shunts);
-               while (enumerator->enumerate(enumerator, &ns, &child_cfg))
-               {
-                       if (ns && streq(child, child_cfg->get_name(child_cfg)))
-                       {
-                               ike = strdup(ns);
-                               break;
-                       }
-               }
-               enumerator->destroy(enumerator);
-               if (ike)
-               {
-                       if (charon->shunts->uninstall(charon->shunts, ike, child))
-                       {
-                               free(ike);
-                               return send_reply(this, NULL);
-                       }
-                       free(ike);
-                       return send_reply(this, "uninstalling policy '%s' failed", child);
-               }
-       }
-       else if (charon->shunts->uninstall(charon->shunts, ike, child))
+       if (charon->shunts->uninstall(charon->shunts, ike, child))
        {
                return send_reply(this, NULL);
        }