Re: Problems with Plasma NetworkManagement



Em Saturday 02 July 2011, Dan Williams escreveu:

> Yeah, the applet and editor are two separate processes. We can send an

> Update() along anyway if you wish though, I simply had to make a

> behavior call at the time it was implemented, and we can change that

> behavior. Obviously agents should be smart enough to know when the

> incoming secrets are different than what they already have and possibly

> ignore the Update() if nothing has actually changed.

>

> If NM is passing the old secrets, that's clearly not cool, and we need

> to fix that.


Well, a new Update() call is not necessary, I just need NM to call Update() with the new secrets instead of the old ones. The attached patch does exactly that and fix the problem for me. But NM's API does not allow me to list all settings from a connection, I have to name them one by one, so I created the patch only for NMSettingWirelessSecurity. I think you can improve it to work with all other secret settings, right?

--

Lamarque V. Souza

http://www.geographicguide.com/brazil.htm

Linux User #57137 - http://counter.li.org/

http://planetkde.org/pt-br

diff --git a/src/settings/nm-settings-connection.c b/src/settings/nm-settings-connection.c
index a14b159..ce185a6 100644
--- a/src/settings/nm-settings-connection.c
+++ b/src/settings/nm-settings-connection.c
@@ -1164,6 +1164,16 @@ update_auth_cb (NMSettingsConnection *self,
 		 * agents of the same UID as the Update() request sender.
 		 */
 		for_agent = nm_connection_duplicate (NM_CONNECTION (self));
+
+		/* Lamarque */
+		NMSettingWirelessSecurity * ws = nm_connection_get_setting_wireless_security(new_settings);
+		GHashTable *hash = nm_connection_to_hash (new_settings, NM_SETTING_HASH_FLAG_ONLY_SECRETS);
+		if (ws && hash) {
+			GError *local = NULL;
+			const char *setting_name = nm_setting_get_name (ws);
+			nm_connection_update_secrets(for_agent, setting_name, hash, &local);
+		}
+
 		nm_connection_for_each_setting_value (for_agent, only_agent_secrets_cb, NULL);
 		nm_agent_manager_save_secrets (priv->agent_mgr, for_agent, TRUE, sender_uid);
 		g_object_unref (for_agent);


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