2007-11-15 Dan Williams <dcbw@redhat.com>

* libnm-util/nm-setting.c
		- (nm_setting_to_hash, one_property_cb): revert previous commit, it's
			unecessary to serialize 'name'

	* src/nm-activation-request.c
		- (get_secrets_cb): fix cases where a full NMSetting is returned from
			the GetSecrets call



git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@3085 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
This commit is contained in:
Dan Williams
2007-11-15 16:57:33 +00:00
parent dcc6b2a9c0
commit 53f271805f
3 changed files with 40 additions and 29 deletions

View File

@@ -1,3 +1,13 @@
2007-11-15 Dan Williams <dcbw@redhat.com>
* libnm-util/nm-setting.c
- (nm_setting_to_hash, one_property_cb): revert previous commit, it's
unecessary to serialize 'name'
* src/nm-activation-request.c
- (get_secrets_cb): fix cases where a full NMSetting is returned from
the GetSecrets call
2007-11-15 Dan Williams <dcbw@redhat.com>
* libnm-util/nm-setting-connection.h

View File

@@ -42,8 +42,7 @@ nm_setting_to_hash (NMSetting *setting)
for (i = 0; i < n_property_specs; i++) {
GParamSpec *prop_spec = property_specs[i];
if ( (prop_spec->flags & NM_SETTING_PARAM_SERIALIZE)
|| !strcmp (prop_spec->name, NM_SETTING_NAME)) {
if (prop_spec->flags & NM_SETTING_PARAM_SERIALIZE) {
GValue *value;
value = g_slice_new0 (GValue);
@@ -78,12 +77,6 @@ one_property_cb (gpointer key, gpointer val, gpointer user_data)
GValue *dst_value = &info->params[info->n_params].value;
GParamSpec *param_spec;
/* 'name' is special; since the caller already has to know the type of
* the setting, 'name' gets ignored here.
*/
if (!strcmp (prop_name, NM_SETTING_NAME))
return;
param_spec = g_object_class_find_property (info->class, prop_name);
if (!param_spec || !(param_spec->flags & NM_SETTING_PARAM_SERIALIZE)) {
/* Oh, we're so nice and only warn, maybe it should be a fatal error? */

View File

@@ -168,6 +168,7 @@ get_secrets_cb (DBusGProxy *proxy, DBusGProxyCall *call, gpointer user_data)
GError *err = NULL;
GHashTable *secrets = NULL;
NMActRequestPrivate *priv = NULL;
NMSetting *setting = NULL;
g_return_if_fail (info != NULL);
g_return_if_fail (info->req);
@@ -189,31 +190,38 @@ get_secrets_cb (DBusGProxy *proxy, DBusGProxyCall *call, gpointer user_data)
return;
}
if (g_hash_table_size (secrets) > 0) {
NMSetting *setting;
if (g_hash_table_size (secrets) == 0) {
// FIXME: some better way to handle invalid message?
nm_warning ("GetSecrets call returned but no secrets were found.");
goto out;
}
/* Check whether a complete & valid NMSetting object was returned. If
* yes, replace the setting object in the connection. If not, just try
* updating the secrets.
*/
setting = nm_setting_from_hash (NM_TYPE_SETTING_WIRELESS, secrets);
if (nm_setting_verify (setting, NULL))
nm_connection_add_setting (priv->connection, setting);
else {
nm_connection_update_secrets (priv->connection, info->setting_name, secrets);
if (!strcmp (info->setting_name, NM_SETTING_WIRELESS_SECURITY_SETTING_NAME))
setting = nm_setting_from_hash (NM_TYPE_SETTING_WIRELESS_SECURITY, secrets);
if (setting) {
if (!nm_setting_verify (setting, NULL)) {
g_object_unref (setting);
setting = NULL;
}
}
if (setting)
nm_connection_add_setting (priv->connection, setting);
else
nm_connection_update_secrets (priv->connection, info->setting_name, secrets);
g_signal_emit (info->req,
signals[CONNECTION_SECRETS_UPDATED],
0,
priv->connection,
info->setting_name);
} else {
// FIXME: some better way to handle invalid message?
nm_warning ("GetSecrets call returned but no secrets were found.");
}
out:
g_hash_table_destroy (secrets);
}