[network-manager-applet] applet: set password flags for old connections too
- From: Dan Williams <dcbw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [network-manager-applet] applet: set password flags for old connections too
- Date: Thu, 28 Apr 2011 19:00:41 +0000 (UTC)
commit c48ca9cc7cf9f80f3905b436780cde55656d4c72
Author: Dan Williams <dcbw redhat com>
Date: Thu Apr 28 13:56:31 2011 -0500
applet: set password flags for old connections too
If the connection hasn't been edited in a long time (since before
password "types" came about in vpn) then we wouldn't have set the
password flags accordingly, because the code doesn't actually
check the keyring for the password at all (as that might trigger
a keyring unlock just for running the applet which sucks). Make
sure we set the right password flags even if there isn't an old
"type" field in the data.
src/gconf-helpers/gconf-upgrade.c | 28 +++++++++++++---------------
1 files changed, 13 insertions(+), 15 deletions(-)
---
diff --git a/src/gconf-helpers/gconf-upgrade.c b/src/gconf-helpers/gconf-upgrade.c
index eeebab3..86abe35 100644
--- a/src/gconf-helpers/gconf-upgrade.c
+++ b/src/gconf-helpers/gconf-upgrade.c
@@ -2026,13 +2026,16 @@ nm_gconf_migrate_0_7_certs (GConfClient *client)
#define NM_VPNC_PW_TYPE_UNUSED "unused"
static NMSettingSecretFlags
-vpnc_type_to_flag (const char *vpnc_type)
+vpnc_type_to_flag (NMSettingVPN *s_vpn, const char *type_key)
{
- if (g_strcmp0 (vpnc_type, NM_VPNC_PW_TYPE_SAVE) == 0)
+ const char *tmp;
+
+ tmp = nm_setting_vpn_get_data_item (s_vpn, type_key);
+ if (g_strcmp0 (tmp, NM_VPNC_PW_TYPE_SAVE) == 0)
return NM_SETTING_SECRET_FLAG_NONE;
- if (g_strcmp0 (vpnc_type, NM_VPNC_PW_TYPE_ASK) == 0)
+ if (g_strcmp0 (tmp, NM_VPNC_PW_TYPE_ASK) == 0)
return NM_SETTING_SECRET_FLAG_NOT_SAVED;
- if (g_strcmp0 (vpnc_type, NM_VPNC_PW_TYPE_UNUSED) == 0)
+ if (g_strcmp0 (tmp, NM_VPNC_PW_TYPE_UNUSED) == 0)
return NM_SETTING_SECRET_FLAG_NOT_REQUIRED;
return NM_SETTING_SECRET_FLAG_NONE;
}
@@ -2047,19 +2050,14 @@ 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);
- }
+ flags = NM_SETTING_SECRET_FLAG_AGENT_OWNED;
+ flags |= vpnc_type_to_flag (s_vpn, NM_VPNC_KEY_SECRET_TYPE);
+ 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);
- }
+ flags = NM_SETTING_SECRET_FLAG_AGENT_OWNED;
+ flags |= vpnc_type_to_flag (s_vpn, NM_VPNC_KEY_XAUTH_PASSWORD_TYPE);
+ nm_setting_set_secret_flags (NM_SETTING (s_vpn), NM_VPNC_KEY_XAUTH_PASSWORD, flags, NULL);
}
#define NM_DBUS_SERVICE_OPENVPN "org.freedesktop.NetworkManager.openvpn"
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]