[network-manager-applet] applet: migrate nm-openswan connections too (bgo #648876)
- From: Dan Williams <dcbw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [network-manager-applet] applet: migrate nm-openswan connections too (bgo #648876)
- Date: Thu, 28 Apr 2011 18:51:11 +0000 (UTC)
commit 3f7ead7951a0c93160039610ffe0a7af4b7be289
Author: Dan Williams <dcbw redhat com>
Date: Thu Apr 28 13:52:27 2011 -0500
applet: migrate nm-openswan connections too (bgo #648876)
src/gconf-helpers/gconf-upgrade.c | 42 +++++++++++++++++++++++++++++++++++++
1 files changed, 42 insertions(+), 0 deletions(-)
---
diff --git a/src/gconf-helpers/gconf-upgrade.c b/src/gconf-helpers/gconf-upgrade.c
index c9f39ee..eeebab3 100644
--- a/src/gconf-helpers/gconf-upgrade.c
+++ b/src/gconf-helpers/gconf-upgrade.c
@@ -2141,6 +2141,45 @@ migrate_openvpn (NMConnection *connection, NMSettingVPN *s_vpn)
}
}
+#define NM_OPENSWAN_PW_TYPE_SAVE "save"
+#define NM_OPENSWAN_PW_TYPE_ASK "ask"
+#define NM_OPENSWAN_PW_TYPE_UNUSED "unused"
+
+static NMSettingSecretFlags
+openswan_type_to_flag (NMSettingVPN *s_vpn, const char *flags_key)
+{
+ const char *tmp;
+
+ tmp = nm_setting_vpn_get_data_item (s_vpn, flags_key);
+ if (g_strcmp0 (tmp, NM_OPENSWAN_PW_TYPE_SAVE) == 0)
+ return NM_SETTING_SECRET_FLAG_NONE;
+ if (g_strcmp0 (tmp, NM_OPENSWAN_PW_TYPE_ASK) == 0)
+ return NM_SETTING_SECRET_FLAG_NOT_SAVED;
+ if (g_strcmp0 (tmp, NM_OPENSWAN_PW_TYPE_UNUSED) == 0)
+ return NM_SETTING_SECRET_FLAG_NOT_REQUIRED;
+ return NM_SETTING_SECRET_FLAG_NONE;
+}
+
+#define NM_DBUS_SERVICE_OPENSWAN "org.freedesktop.NetworkManager.openswan"
+#define NM_OPENSWAN_PSK_VALUE "pskvalue"
+#define NM_OPENSWAN_PSK_INPUT_MODES "pskinputmodes"
+#define NM_OPENSWAN_XAUTH_PASSWORD "xauthpassword"
+#define NM_OPENSWAN_XAUTH_PASSWORD_INPUT_MODES "xauthpasswordinputmodes"
+
+static void
+migrate_openswan (NMConnection *connection, NMSettingVPN *s_vpn)
+{
+ NMSettingSecretFlags flags;
+
+ flags = NM_SETTING_SECRET_FLAG_AGENT_OWNED;
+ flags |= openswan_type_to_flag (s_vpn, NM_OPENSWAN_PSK_INPUT_MODES);
+ nm_setting_set_secret_flags (NM_SETTING (s_vpn), NM_OPENSWAN_PSK_VALUE, flags, NULL);
+
+ flags = NM_SETTING_SECRET_FLAG_AGENT_OWNED;
+ flags |= openswan_type_to_flag (s_vpn, NM_OPENSWAN_XAUTH_PASSWORD_INPUT_MODES);
+ nm_setting_set_secret_flags (NM_SETTING (s_vpn), NM_OPENSWAN_XAUTH_PASSWORD, flags, NULL);
+}
+
#define NM_DBUS_SERVICE_PPTP "org.freedesktop.NetworkManager.pptp"
#define NM_PPTP_KEY_PASSWORD "password"
@@ -2177,6 +2216,9 @@ nm_gconf_migrate_09_secret_flags (GConfClient *client,
} else if (g_strcmp0 (service, NM_DBUS_SERVICE_OPENVPN) == 0) {
migrate_openvpn (connection, s_vpn);
return;
+ } else if (g_strcmp0 (service, NM_DBUS_SERVICE_OPENSWAN) == 0) {
+ migrate_openswan (connection, s_vpn);
+ return;
}
/* Other VPNs not handled specially here just go through the
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]