[network-manager-vpnc] auth-dialog: look for old password names in the keyring too



commit 51fec9ac3a1911b85076ad4fbdc4b9b25c7fa85e
Author: Dan Williams <dcbw redhat com>
Date:   Fri Jul 15 12:02:24 2011 -0500

    auth-dialog: look for old password names in the keyring too
    
    The vpnc plugin was odd in that long ago we chose more human-readable
    names for the secrets in the keyring ("password" and "group-password")
    but then used different names for these in the VPN setting secrets
    hash ("Xauth password" and "IPSec secret").  Now that nm-applet saves
    secrets, it's saving to the keyring using the new names from the VPN
    setting secrets hash.  So we need to look for both the new and old
    names in the auth-dialog when returning secrets to nm-applet.

 auth-dialog/main.c |   15 ++++++++++-----
 1 files changed, 10 insertions(+), 5 deletions(-)
---
diff --git a/auth-dialog/main.c b/auth-dialog/main.c
index 522a887..b04a96e 100644
--- a/auth-dialog/main.c
+++ b/auth-dialog/main.c
@@ -39,9 +39,6 @@
 #include "src/nm-vpnc-service.h"
 #include "vpn-password-dialog.h"
 
-#define VPNC_USER_PASSWORD "password"
-#define VPNC_GROUP_PASSWORD "group-password"
-
 #define KEYRING_UUID_TAG "connection-uuid"
 #define KEYRING_SN_TAG "setting-name"
 #define KEYRING_SK_TAG "setting-key"
@@ -104,7 +101,11 @@ get_secrets (const char *vpn_uuid,
 		if (in_upw)
 			upw = gnome_keyring_memory_strdup (in_upw);
 		else
-			upw = keyring_lookup_secret (vpn_uuid, VPNC_USER_PASSWORD);
+			upw = keyring_lookup_secret (vpn_uuid, NM_VPNC_KEY_XAUTH_PASSWORD);
+
+		/* Try the old name */
+		if (upw == NULL)
+			upw = keyring_lookup_secret (vpn_uuid, "password");
 	}
 
 	if (   !(gpw_flags & NM_SETTING_SECRET_FLAG_NOT_SAVED)
@@ -112,7 +113,11 @@ get_secrets (const char *vpn_uuid,
 		if (in_gpw)
 			gpw = gnome_keyring_memory_strdup (in_gpw);
 		else
-			gpw = keyring_lookup_secret (vpn_uuid, VPNC_GROUP_PASSWORD);
+			gpw = keyring_lookup_secret (vpn_uuid, NM_VPNC_KEY_SECRET);
+
+		/* Try the old name */
+		if (gpw == NULL)
+			gpw = keyring_lookup_secret (vpn_uuid, "group-password");
 	}
 
 	if (!retry) {



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