[network-manager-openswan/dcbw/libreswan: 4/11] core: update for non-deprecated libreswan shutdown
- From: Dan Williams <dcbw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [network-manager-openswan/dcbw/libreswan: 4/11] core: update for non-deprecated libreswan shutdown
- Date: Fri, 12 Dec 2014 19:18:53 +0000 (UTC)
commit 04fa9fb5e38161d235d4f9fcf2095a0e1dfd1cb8
Author: Dan Williams <dcbw redhat com>
Date: Mon Oct 20 14:41:38 2014 -0500
core: update for non-deprecated libreswan shutdown
Based on the systmed service file:
ExecStop=/usr/libexec/ipsec/whack --shutdown
src/nm-openswan-service.c | 41 +++++++++++++++++++++++++++++------------
1 files changed, 29 insertions(+), 12 deletions(-)
---
diff --git a/src/nm-openswan-service.c b/src/nm-openswan-service.c
index 65b8861..9491733 100644
--- a/src/nm-openswan-service.c
+++ b/src/nm-openswan-service.c
@@ -78,6 +78,7 @@ typedef struct {
typedef struct {
const char *ipsec_path;
const char *pluto_path;
+ const char *whack_path;
char *secrets_path;
gboolean libreswan;
@@ -403,9 +404,22 @@ static gboolean
ipsec_stop (NMOpenSwanPlugin *self, GError **error)
{
NMOpenSwanPluginPrivate *priv = NM_OPENSWAN_PLUGIN_GET_PRIVATE (self);
- const char *argv[4] = { priv->ipsec_path, "setup", "stop", NULL };
+ const char *argv[4];
+ guint i = 0;
delete_secrets_file (self);
+
+ if (priv->libreswan) {
+ argv[i++] = priv->whack_path;
+ argv[i++] = "--shutdown";
+ argv[i++] = NULL;
+ } else {
+ argv[i++] = priv->ipsec_path;
+ argv[i++] = "setup";
+ argv[i++] = "stop";
+ argv[i++] = NULL;
+ }
+
return g_spawn_sync (NULL, (char **) argv, NULL, 0, NULL, NULL, NULL, NULL, NULL, error);
}
@@ -1036,6 +1050,20 @@ _connect_common (NMVPNPlugin *plugin,
if (debug)
nm_connection_dump (connection);
+ priv->ipsec_path = find_helper_bin ("ipsec", error);
+ if (!priv->ipsec_path)
+ return FALSE;
+
+ priv->libreswan = is_libreswan (priv->ipsec_path);
+ if (priv->libreswan) {
+ priv->pluto_path = find_helper_libexec ("pluto", error);
+ if (!priv->pluto_path)
+ return FALSE;
+ priv->whack_path = find_helper_libexec ("whack", error);
+ if (!priv->whack_path)
+ return FALSE;
+ }
+
ipsec_stop (self, NULL);
s_vpn = nm_connection_get_setting_vpn (connection);
@@ -1055,17 +1083,6 @@ _connect_common (NMVPNPlugin *plugin,
return FALSE;
}
- priv->ipsec_path = find_helper_bin ("ipsec", error);
- if (!priv->ipsec_path)
- return FALSE;
-
- priv->libreswan = is_libreswan (priv->ipsec_path);
- if (priv->libreswan) {
- priv->pluto_path = find_helper_libexec ("pluto", error);
- if (!priv->pluto_path)
- return FALSE;
- }
-
priv->password = g_strdup (nm_setting_vpn_get_secret (s_vpn, NM_OPENSWAN_XAUTH_PASSWORD));
/* Write the IPSec secret (group password); *SWAN always requires this and
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]