[network-manager-applet] applet: split out VPN migration code
- From: Dan Williams <dcbw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [network-manager-applet] applet: split out VPN migration code
- Date: Mon, 4 Apr 2011 21:53:41 +0000 (UTC)
commit d987d1e1215a9a97893f9a248a88e946994b20c3
Author: Dan Williams <dcbw redhat com>
Date: Mon Apr 4 16:06:53 2011 -0500
applet: split out VPN migration code
src/gconf-helpers/gconf-upgrade.c | 35 +++++++++++++++++++++--------------
1 files changed, 21 insertions(+), 14 deletions(-)
---
diff --git a/src/gconf-helpers/gconf-upgrade.c b/src/gconf-helpers/gconf-upgrade.c
index 44633f1..d168e58 100644
--- a/src/gconf-helpers/gconf-upgrade.c
+++ b/src/gconf-helpers/gconf-upgrade.c
@@ -2043,6 +2043,25 @@ vpnc_type_to_flag (const char *vpnc_type)
#define NM_VPNC_KEY_XAUTH_PASSWORD "Xauth password"
#define NM_VPNC_KEY_XAUTH_PASSWORD_TYPE "xauth-password-type"
+static void
+migrate_vpnc (NMConnection *connection, NMSettingVPN *s_vpn)
+{
+ NMSettingSecretFlags flags;
+ const char *tmp;
+
+ tmp = nm_setting_vpn_get_data_item (s_vpn, NM_VPNC_KEY_SECRET_TYPE);
+ if (tmp) {
+ flags = vpnc_type_to_flag (tmp) | NM_SETTING_SECRET_FLAG_AGENT_OWNED;
+ nm_setting_set_secret_flags (NM_SETTING (s_vpn), NM_VPNC_KEY_SECRET, flags, NULL);
+ }
+
+ tmp = nm_setting_vpn_get_data_item (s_vpn, NM_VPNC_KEY_XAUTH_PASSWORD_TYPE);
+ if (tmp) {
+ flags = vpnc_type_to_flag (tmp) | NM_SETTING_SECRET_FLAG_AGENT_OWNED;
+ nm_setting_set_secret_flags (NM_SETTING (s_vpn), NM_VPNC_KEY_XAUTH_PASSWORD, flags, NULL);
+ }
+}
+
#define NM_DBUS_SERVICE_PPTP "org.freedesktop.NetworkManager.pptp"
#define NM_PPTP_KEY_PASSWORD "password"
@@ -2065,24 +2084,12 @@ nm_gconf_migrate_09_secret_flags (GConfClient *client,
/* Migrate various VPN secret flags */
if (NM_IS_SETTING_VPN (setting)) {
- NMSettingSecretFlags flags;
NMSettingVPN *s_vpn = NM_SETTING_VPN (setting);
- const char *tmp, *service;
+ const char *service;
service = nm_setting_vpn_get_service_type (s_vpn);
if (g_strcmp0 (service, NM_DBUS_SERVICE_VPNC) == 0) {
- /* vpnc stuff */
- tmp = nm_setting_vpn_get_data_item (s_vpn, NM_VPNC_KEY_SECRET_TYPE);
- if (tmp) {
- flags = vpnc_type_to_flag (tmp) | NM_SETTING_SECRET_FLAG_AGENT_OWNED;
- nm_setting_set_secret_flags (setting, NM_VPNC_KEY_SECRET, flags, NULL);
- }
-
- tmp = nm_setting_vpn_get_data_item (s_vpn, NM_VPNC_KEY_XAUTH_PASSWORD_TYPE);
- if (tmp) {
- flags = vpnc_type_to_flag (tmp) | NM_SETTING_SECRET_FLAG_AGENT_OWNED;
- nm_setting_set_secret_flags (setting, NM_VPNC_KEY_XAUTH_PASSWORD, flags, NULL);
- }
+ migrate_vpnc (connection, s_vpn);
return;
} else if (g_strcmp0 (service, NM_DBUS_SERVICE_PPTP) == 0) {
/* Mark the password as agent-owned */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]