diff options
author | Martin Willi <martin@strongswan.org> | 2008-06-20 07:14:35 +0000 |
---|---|---|
committer | Martin Willi <martin@strongswan.org> | 2008-06-20 07:14:35 +0000 |
commit | bb1383183cf48d48559b7f2250cc8c1dc3b08237 (patch) | |
tree | 652ad954195e2e7b3787e6516b658adaf364b698 /src/charon/plugins/smp | |
parent | 364fca2cee19f6e0579f22ba67ae68ca4c821be7 (diff) | |
download | strongswan-bb1383183cf48d48559b7f2250cc8c1dc3b08237.tar.bz2 strongswan-bb1383183cf48d48559b7f2250cc8c1dc3b08237.tar.xz |
support in smp for terminate-by-name
Diffstat (limited to 'src/charon/plugins/smp')
-rw-r--r-- | src/charon/plugins/smp/smp.c | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/src/charon/plugins/smp/smp.c b/src/charon/plugins/smp/smp.c index 1d93d1df8..063eee48c 100644 --- a/src/charon/plugins/smp/smp.c +++ b/src/charon/plugins/smp/smp.c @@ -390,11 +390,35 @@ static void request_control_terminate(xmlTextReaderPtr reader, status_t status; str = xmlTextReaderConstValue(reader); - if (str == NULL || !(id = atoi(str))) + if (str == NULL) { DBG1(DBG_CFG, "error parsing XML id string"); return; } + id = atoi(str); + if (!id) + { + enumerator_t *enumerator; + ike_sa_t *ike_sa; + + enumerator = charon->controller->create_ike_sa_enumerator(charon->controller); + while (enumerator->enumerate(enumerator, &ike_sa)) + { + if (streq(str, ike_sa->get_name(ike_sa))) + { + ike = TRUE; + id = ike_sa->get_unique_id(ike_sa); + break; + } + } + enumerator->destroy(enumerator); + } + if (!id) + { + DBG1(DBG_CFG, "error parsing XML id string"); + return; + } + DBG1(DBG_CFG, "terminating %s_SA %d", ike ? "IKE" : "CHILD", id); /* <log> */ |