summary refs log tree commit diff
path: root/src/settings
diff options
context:
space:
mode:
Diffstat (limited to 'src/settings')
-rw-r--r--src/settings/nm-settings-connection.c14
-rw-r--r--src/settings/nm-settings.c25
-rw-r--r--src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-reader.c2
-rw-r--r--src/settings/plugins/keyfile/nms-keyfile-plugin.c2
4 files changed, 26 insertions, 17 deletions
diff --git a/src/settings/nm-settings-connection.c b/src/settings/nm-settings-connection.c
index 37a0b3a6..58626372 100644
--- a/src/settings/nm-settings-connection.c
+++ b/src/settings/nm-settings-connection.c
@@ -608,6 +608,7 @@ nm_settings_connection_update (NMSettingsConnection *self,
 	gboolean replaced = FALSE;
 	gs_free char *logmsg_change = NULL;
 	GError *local = NULL;
+	gs_unref_variant GVariant *con_agent_secrets = NULL;
 
 	g_return_val_if_fail (NM_IS_SETTINGS_CONNECTION (self), FALSE);
 
@@ -658,9 +659,20 @@ nm_settings_connection_update (NMSettingsConnection *self,
 	    && !nm_connection_compare (NM_CONNECTION (self),
 	                               replace_connection,
 	                               NM_SETTING_COMPARE_FLAG_EXACT)) {
+		gs_unref_object NMConnection *simple = NULL;
+
 		if (log_diff_name)
 			nm_utils_log_connection_diff (replace_connection, NM_CONNECTION (self), LOGL_DEBUG, LOGD_CORE, log_diff_name, "++ ");
 
+		/* Make a copy of agent-owned secrets because they won't be present in
+		 * the connection returned by plugins, as plugins return only what was
+		 * reread from the file. */
+		simple = nm_simple_connection_new_clone (NM_CONNECTION (self));
+		nm_connection_clear_secrets_with_flags (simple,
+		                                        secrets_filter_cb,
+		                                        GUINT_TO_POINTER (NM_SETTING_SECRET_FLAG_AGENT_OWNED));
+		con_agent_secrets = nm_connection_to_dbus (simple, NM_CONNECTION_SERIALIZE_ONLY_SECRETS);
+
 		nm_connection_replace_settings_from_connection (NM_CONNECTION (self), replace_connection);
 
 		replaced = TRUE;
@@ -688,6 +700,8 @@ nm_settings_connection_update (NMSettingsConnection *self,
 				g_variant_unref (dict);
 			}
 		}
+		if (con_agent_secrets)
+			(void) nm_connection_update_secrets (NM_CONNECTION (self), NULL, con_agent_secrets, NULL);
 	}
 
 	nm_settings_connection_recheck_visibility (self);
diff --git a/src/settings/nm-settings.c b/src/settings/nm-settings.c
index 51b7bea7..8e3fc582 100644
--- a/src/settings/nm-settings.c
+++ b/src/settings/nm-settings.c
@@ -1337,7 +1337,7 @@ impl_settings_add_connection_helper (NMSettings *self,
                                      GVariant *settings,
                                      gboolean save_to_disk)
 {
-	NMConnection *connection;
+	gs_unref_object NMConnection *connection = NULL;
 	GError *error = NULL;
 
 	connection = _nm_simple_connection_new_from_dbus (settings,
@@ -1345,23 +1345,18 @@ impl_settings_add_connection_helper (NMSettings *self,
 	                                                  | NM_SETTING_PARSE_FLAGS_NORMALIZE,
 	                                                  &error);
 
-	if (connection) {
-		if (!nm_connection_verify_secrets (connection, &error))
-			goto failure;
-
-		nm_settings_add_connection_dbus (self,
-		                                 connection,
-		                                 save_to_disk,
-		                                 context,
-		                                 impl_settings_add_connection_add_cb,
-		                                 NULL);
-		g_object_unref (connection);
+	if (   !connection
+	    || !nm_connection_verify_secrets (connection, &error)) {
+		g_dbus_method_invocation_take_error (context, error);
 		return;
 	}
 
-failure:
-	g_assert (error);
-	g_dbus_method_invocation_take_error (context, error);
+	nm_settings_add_connection_dbus (self,
+	                                 connection,
+	                                 save_to_disk,
+	                                 context,
+	                                 impl_settings_add_connection_add_cb,
+	                                 NULL);
 }
 
 static void
diff --git a/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-reader.c b/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-reader.c
index bdd3ee0a..c91cd253 100644
--- a/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-reader.c
+++ b/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-reader.c
@@ -558,7 +558,7 @@ enum {
 	PARSE_LINE_ATTR_ROUTE_VIA,
 	PARSE_LINE_ATTR_ROUTE_METRIC,
 
-	/* iproute2 paramters that are well known and that we silently ignore. */
+	/* iproute2 parameters that are well known and that we silently ignore. */
 	PARSE_LINE_ATTR_ROUTE_DEV,
 };
 
diff --git a/src/settings/plugins/keyfile/nms-keyfile-plugin.c b/src/settings/plugins/keyfile/nms-keyfile-plugin.c
index cb5f2c9f..e6299d1e 100644
--- a/src/settings/plugins/keyfile/nms-keyfile-plugin.c
+++ b/src/settings/plugins/keyfile/nms-keyfile-plugin.c
@@ -143,7 +143,7 @@ find_by_path (NMSKeyfilePlugin *self, const char *path)
  *   an existing connection with the same UUID.
  *   If %TRUE and @connection, allow updating only if the reload would modify
  *   @connection (without changing its UUID) or if we would create a new connection.
- *   In other words, if this paramter is %TRUE, we only allow creating a
+ *   In other words, if this parameter is %TRUE, we only allow creating a
  *   new connection (with an unseen UUID) or updating the passed in @connection
  *   (whereas the UUID cannot change).
  *   Note, that this allows for @connection to be replaced by a new connection.