summary refs log tree commit diff
path: root/clients
diff options
context:
space:
mode:
authorMichael Biebl <biebl@debian.org>2018-09-15 01:04:32 +0200
committerMichael Biebl <biebl@debian.org>2018-09-15 01:04:32 +0200
commitc240974325c552cad177c457d6ff04e381fd77a3 (patch)
tree2fe5561359b767db15292c84447be8075a75388a /clients
parent8f7a3cbbdd0c0a48277c341dd3a8ec8743ae9735 (diff)
New upstream version 1.14.0 upstream/1.14.0
Diffstat (limited to 'clients')
-rw-r--r--clients/cli/common.c6
-rw-r--r--clients/cli/connections.c10
-rw-r--r--clients/common/nm-meta-setting-desc.c13
-rw-r--r--clients/common/nm-secret-agent-simple.c2
-rw-r--r--clients/common/nm-secret-agent-simple.h2
-rw-r--r--clients/tui/nmtui-connect.c6
6 files changed, 28 insertions, 11 deletions
diff --git a/clients/cli/common.c b/clients/cli/common.c
index ede447ba..88e98154 100644
--- a/clients/cli/common.c
+++ b/clients/cli/common.c
@@ -645,13 +645,13 @@ vpn_openconnect_get_secrets (NMConnection *connection, GPtrArray *secrets)
 		if (!nm_streq0 (secret->vpn_type, NM_SECRET_AGENT_VPN_TYPE_OPENCONNECT))
 			continue;
 
-		if (nm_streq0 (secret->entry_id, NM_SECRET_AGENT_ENTRY_ID_PREFX_VPN_SECRET "cookie")) {
+		if (nm_streq0 (secret->entry_id, NM_SECRET_AGENT_ENTRY_ID_PREFX_VPN_SECRETS "cookie")) {
 			g_free (secret->value);
 			secret->value = g_steal_pointer (&cookie);
-		} else if (nm_streq0 (secret->entry_id, NM_SECRET_AGENT_ENTRY_ID_PREFX_VPN_SECRET "gateway")) {
+		} else if (nm_streq0 (secret->entry_id, NM_SECRET_AGENT_ENTRY_ID_PREFX_VPN_SECRETS "gateway")) {
 			g_free (secret->value);
 			secret->value = g_steal_pointer (&gateway);
-		} else if (nm_streq0 (secret->entry_id, NM_SECRET_AGENT_ENTRY_ID_PREFX_VPN_SECRET "gwcert")) {
+		} else if (nm_streq0 (secret->entry_id, NM_SECRET_AGENT_ENTRY_ID_PREFX_VPN_SECRETS "gwcert")) {
 			g_free (secret->value);
 			secret->value = g_steal_pointer (&gwcert);
 		}
diff --git a/clients/cli/connections.c b/clients/cli/connections.c
index ad0b7672..bcd257ac 100644
--- a/clients/cli/connections.c
+++ b/clients/cli/connections.c
@@ -2607,7 +2607,15 @@ parse_passwords (const char *passwd_file, GError **error)
 			return NULL;
 		}
 
-		pwd_spec = g_strdup_printf ("%s.%s", setting, prop);
+		if (   nm_streq (setting, "vpn")
+		    && g_str_has_prefix (prop, "secret.")) {
+			/* in 1.12.0, we wrongly required the VPN secrets to be named
+			 * "vpn.secret". It should be "vpn.secrets". Work around it
+			 * (rh#1628833). */
+			pwd_spec = g_strdup_printf ("vpn.secrets.%s", &prop[NM_STRLEN ("secret.")]);
+		} else
+			pwd_spec = g_strdup_printf ("%s.%s", setting, prop);
+
 		g_hash_table_insert (pwds_hash, pwd_spec, g_strdup (pwd));
 	}
 	return g_steal_pointer (&pwds_hash);
diff --git a/clients/common/nm-meta-setting-desc.c b/clients/common/nm-meta-setting-desc.c
index 8c27779e..f794c67b 100644
--- a/clients/common/nm-meta-setting-desc.c
+++ b/clients/common/nm-meta-setting-desc.c
@@ -192,11 +192,20 @@ _parse_ip_route (int family,
 				return NULL;
 			}
 
-			if (!attrs)
-				attrs = g_hash_table_new (nm_str_hash, g_str_equal);
+			if (!attrs) {
+				attrs = g_hash_table_new_full (nm_str_hash,
+				                               g_str_equal,
+				                               g_free,
+				                               (GDestroyNotify) g_variant_unref);
+			}
 
 			g_hash_table_iter_init (&iter, tmp_attrs);
 			while (g_hash_table_iter_next (&iter, (gpointer *) &iter_key, (gpointer *) &iter_value)) {
+
+				/* need to sink the reference, because nm_utils_parse_variant_attributes() returns
+				 * floating refs. */
+				g_variant_ref_sink (iter_value);
+
 				if (!nm_ip_route_attribute_validate (iter_key, iter_value, family, NULL, error)) {
 					g_prefix_error (error, "%s: ", iter_key);
 					g_hash_table_unref (tmp_attrs);
diff --git a/clients/common/nm-secret-agent-simple.c b/clients/common/nm-secret-agent-simple.c
index 7048e0ef..cab0c15a 100644
--- a/clients/common/nm-secret-agent-simple.c
+++ b/clients/common/nm-secret-agent-simple.c
@@ -195,7 +195,7 @@ nm_secret_agent_simple_secret_new (NMSecretAgentSecretType secret_type,
 		real->base.is_secret = (secret_type != NM_SECRET_AGENT_SECRET_TYPE_PROPERTY);
 		break;
 	case NM_SECRET_AGENT_SECRET_TYPE_VPN_SECRET:
-		vpn_prefix = NM_SECRET_AGENT_ENTRY_ID_PREFX_VPN_SECRET;
+		vpn_prefix = NM_SECRET_AGENT_ENTRY_ID_PREFX_VPN_SECRETS;
 		value = nm_setting_vpn_get_secret (NM_SETTING_VPN (setting), property);
 		real->base.entry_id = g_strdup_printf ("%s%s", vpn_prefix, property);
 		nm_assert (vpn_type);
diff --git a/clients/common/nm-secret-agent-simple.h b/clients/common/nm-secret-agent-simple.h
index 505987df..529aaeac 100644
--- a/clients/common/nm-secret-agent-simple.h
+++ b/clients/common/nm-secret-agent-simple.h
@@ -56,7 +56,7 @@ typedef struct {
 	gboolean is_secret;
 } NMSecretAgentSimpleSecret;
 
-#define NM_SECRET_AGENT_ENTRY_ID_PREFX_VPN_SECRET "vpn.secret."
+#define NM_SECRET_AGENT_ENTRY_ID_PREFX_VPN_SECRETS "vpn.secrets."
 
 #define NM_SECRET_AGENT_VPN_TYPE_OPENCONNECT  NM_DBUS_INTERFACE".openconnect"
 
diff --git a/clients/tui/nmtui-connect.c b/clients/tui/nmtui-connect.c
index 2a954fb8..6f29e13e 100644
--- a/clients/tui/nmtui-connect.c
+++ b/clients/tui/nmtui-connect.c
@@ -121,13 +121,13 @@ secrets_requested (NMSecretAgentSimple *agent,
 					continue;
 				if (!nm_streq0 (secret->vpn_type, NM_SECRET_AGENT_VPN_TYPE_OPENCONNECT))
 					continue;
-				if (nm_streq0 (secret->entry_id, NM_SECRET_AGENT_ENTRY_ID_PREFX_VPN_SECRET "cookie")) {
+				if (nm_streq0 (secret->entry_id, NM_SECRET_AGENT_ENTRY_ID_PREFX_VPN_SECRETS "cookie")) {
 					g_free (secret->value);
 					secret->value = g_steal_pointer (&cookie);
-				} else if (nm_streq0 (secret->entry_id, NM_SECRET_AGENT_ENTRY_ID_PREFX_VPN_SECRET "gateway")) {
+				} else if (nm_streq0 (secret->entry_id, NM_SECRET_AGENT_ENTRY_ID_PREFX_VPN_SECRETS "gateway")) {
 					g_free (secret->value);
 					secret->value = g_steal_pointer (&gateway);
-				} else if (nm_streq0 (secret->entry_id, NM_SECRET_AGENT_ENTRY_ID_PREFX_VPN_SECRET "gwcert")) {
+				} else if (nm_streq0 (secret->entry_id, NM_SECRET_AGENT_ENTRY_ID_PREFX_VPN_SECRETS "gwcert")) {
 					g_free (secret->value);
 					secret->value = g_steal_pointer (&gwcert);
 				}