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:
10
ChangeLog
10
ChangeLog
@@ -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>
|
2007-11-15 Dan Williams <dcbw@redhat.com>
|
||||||
|
|
||||||
* libnm-util/nm-setting-connection.h
|
* libnm-util/nm-setting-connection.h
|
||||||
|
@@ -42,8 +42,7 @@ nm_setting_to_hash (NMSetting *setting)
|
|||||||
for (i = 0; i < n_property_specs; i++) {
|
for (i = 0; i < n_property_specs; i++) {
|
||||||
GParamSpec *prop_spec = property_specs[i];
|
GParamSpec *prop_spec = property_specs[i];
|
||||||
|
|
||||||
if ( (prop_spec->flags & NM_SETTING_PARAM_SERIALIZE)
|
if (prop_spec->flags & NM_SETTING_PARAM_SERIALIZE) {
|
||||||
|| !strcmp (prop_spec->name, NM_SETTING_NAME)) {
|
|
||||||
GValue *value;
|
GValue *value;
|
||||||
|
|
||||||
value = g_slice_new0 (GValue);
|
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;
|
GValue *dst_value = &info->params[info->n_params].value;
|
||||||
GParamSpec *param_spec;
|
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);
|
param_spec = g_object_class_find_property (info->class, prop_name);
|
||||||
if (!param_spec || !(param_spec->flags & NM_SETTING_PARAM_SERIALIZE)) {
|
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? */
|
/* Oh, we're so nice and only warn, maybe it should be a fatal error? */
|
||||||
|
@@ -168,6 +168,7 @@ get_secrets_cb (DBusGProxy *proxy, DBusGProxyCall *call, gpointer user_data)
|
|||||||
GError *err = NULL;
|
GError *err = NULL;
|
||||||
GHashTable *secrets = NULL;
|
GHashTable *secrets = NULL;
|
||||||
NMActRequestPrivate *priv = NULL;
|
NMActRequestPrivate *priv = NULL;
|
||||||
|
NMSetting *setting = NULL;
|
||||||
|
|
||||||
g_return_if_fail (info != NULL);
|
g_return_if_fail (info != NULL);
|
||||||
g_return_if_fail (info->req);
|
g_return_if_fail (info->req);
|
||||||
@@ -189,31 +190,38 @@ get_secrets_cb (DBusGProxy *proxy, DBusGProxyCall *call, gpointer user_data)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (g_hash_table_size (secrets) > 0) {
|
if (g_hash_table_size (secrets) == 0) {
|
||||||
NMSetting *setting;
|
// 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
|
/* Check whether a complete & valid NMSetting object was returned. If
|
||||||
* yes, replace the setting object in the connection. If not, just try
|
* yes, replace the setting object in the connection. If not, just try
|
||||||
* updating the secrets.
|
* updating the secrets.
|
||||||
*/
|
*/
|
||||||
setting = nm_setting_from_hash (NM_TYPE_SETTING_WIRELESS, secrets);
|
if (!strcmp (info->setting_name, NM_SETTING_WIRELESS_SECURITY_SETTING_NAME))
|
||||||
if (nm_setting_verify (setting, NULL))
|
setting = nm_setting_from_hash (NM_TYPE_SETTING_WIRELESS_SECURITY, secrets);
|
||||||
nm_connection_add_setting (priv->connection, setting);
|
|
||||||
else {
|
if (setting) {
|
||||||
nm_connection_update_secrets (priv->connection, info->setting_name, secrets);
|
if (!nm_setting_verify (setting, NULL)) {
|
||||||
g_object_unref (setting);
|
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,
|
g_signal_emit (info->req,
|
||||||
signals[CONNECTION_SECRETS_UPDATED],
|
signals[CONNECTION_SECRETS_UPDATED],
|
||||||
0,
|
0,
|
||||||
priv->connection,
|
priv->connection,
|
||||||
info->setting_name);
|
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);
|
g_hash_table_destroy (secrets);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user