[network-manager-applet] applet: update PPTP VPN plugin password flags as well



commit 52f16a34ae72b5bfa3941bbdc9bace8ff2b9d90d
Author: Dan Williams <dcbw redhat com>
Date:   Mon Mar 14 00:00:26 2011 -0500

    applet: update PPTP VPN plugin password flags as well

 src/gconf-helpers/gconf-upgrade.c |   34 ++++++++++++++++++++++------------
 1 files changed, 22 insertions(+), 12 deletions(-)
---
diff --git a/src/gconf-helpers/gconf-upgrade.c b/src/gconf-helpers/gconf-upgrade.c
index 2098865..a352085 100644
--- a/src/gconf-helpers/gconf-upgrade.c
+++ b/src/gconf-helpers/gconf-upgrade.c
@@ -2035,11 +2035,15 @@ vpnc_type_to_flag (const char *vpnc_type)
 	return NM_SETTING_SECRET_FLAG_NONE;
 }
 
+#define NM_DBUS_SERVICE_VPNC "org.freedesktop.NetworkManager.vpnc"
 #define NM_VPNC_KEY_SECRET "IPSec secret"
 #define NM_VPNC_KEY_SECRET_TYPE "ipsec-secret-type"
 #define NM_VPNC_KEY_XAUTH_PASSWORD "Xauth password"
 #define NM_VPNC_KEY_XAUTH_PASSWORD_TYPE "xauth-password-type"
 
+#define NM_DBUS_SERVICE_PPTP "org.freedesktop.NetworkManager.pptp"
+#define NM_PPTP_KEY_PASSWORD "password"
+
 void
 nm_gconf_migrate_09_secret_flags (GConfClient *client,
                                   NMConnection *connection,
@@ -2061,19 +2065,25 @@ nm_gconf_migrate_09_secret_flags (GConfClient *client,
 	if (NM_IS_SETTING_VPN (setting)) {
 		NMSettingSecretFlags flags;
 		NMSettingVPN *s_vpn = NM_SETTING_VPN (setting);
-		const char *tmp;
-
-		/* 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);
-		}
+		const char *tmp, *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);
+			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);
+			}
+		} else if (g_strcmp0 (service, NM_DBUS_SERVICE_PPTP) == 0) {
+			/* Mark the password as agent-owned */
+			nm_setting_set_secret_flags (setting, NM_PPTP_KEY_PASSWORD, NM_SETTING_SECRET_FLAG_AGENT_OWNED, NULL);
 		}
 	}
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]