[PATCH] nm-pptp: Fix password saving/retrieving.



On Mon, 14 Mar 2011 20:43:00 +0300 Mikhail Efremov wrote:
> But now it is not works in any case (using pptp plugin as an example,
> NetworkManager, nm-applet and network-manager-pptp are compiled from latest git):
> Checkbox "Available to all users" is not checked:
> # grep -A2 vpn-secrets /etc/NetworkManager/system-connections/pptp-private
> [vpn-secrets]
> password=(null)
> 
> Checkbox "Available to all users" is checked:
> # grep -A2 vpn-secrets /etc/NetworkManager/system-connections/pptp-system-wide
> # 
> So there is no vpn-secrets section in keyfile in that case.

This patch fixes it.

-- 
WBR, Mikhail Efremov
>From c0d47a62f2bef3c157bd86f6bae2e44df38aed1b Mon Sep 17 00:00:00 2001
From: Mikhail Efremov <sem altlinux org>
Date: Wed, 23 Mar 2011 16:46:33 +0300
Subject: [PATCH] Fix password saving/retrieving.

---
 auth-dialog/main.c   |    3 ++-
 properties/nm-pptp.c |    6 ++++++
 2 files changed, 8 insertions(+), 1 deletions(-)

diff --git a/auth-dialog/main.c b/auth-dialog/main.c
index da7436e..5045201 100644
--- a/auth-dialog/main.c
+++ b/auth-dialog/main.c
@@ -226,7 +226,8 @@ main (int argc, char *argv[])
 		return 1;
 
 	/* dump the passwords to stdout */
-	printf ("%s\n%s\n", NM_PPTP_KEY_PASSWORD, password);
+	if (password)
+		printf ("%s\n%s\n", NM_PPTP_KEY_PASSWORD, password);
 	printf ("\n\n");
 
 	if (password) {
diff --git a/properties/nm-pptp.c b/properties/nm-pptp.c
index 5f609ba..7bd3cfc 100644
--- a/properties/nm-pptp.c
+++ b/properties/nm-pptp.c
@@ -394,6 +394,12 @@ update_connection (NMVpnPluginUiWidgetInterface *iface,
 	if (str && strlen (str))
 		nm_setting_vpn_add_data_item (s_vpn, NM_PPTP_KEY_DOMAIN, str);
 
+	/* User password */
+	widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "user_password_entry"));
+	str = gtk_entry_get_text (GTK_ENTRY (widget));
+	if (str && strlen (str))
+		nm_setting_vpn_add_secret (s_vpn, NM_PPTP_KEY_PASSWORD, str);
+
 	if (priv->advanced)
 		g_hash_table_foreach (priv->advanced, hash_copy_advanced, s_vpn);
 
-- 
1.7.4.1



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