mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-01-02 14:40:13 +01:00
2005-12-23 Dan Williams <dcbw@redhat.com>
* gnome/applet/applet-dbus-info.c - (nmi_dbus_get_key_for_network): if there's no entry in GConf for a network, assume we want a new key - (nmi_save_network_info): serialize wireless security info into GConf so its saved * src/nm-dbus-nm.c - Fix warning as we may not be passed security info when connecting to a wireless network git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@1231 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
This commit is contained in:
parent
5c35a1372c
commit
020309a6eb
3 changed files with 60 additions and 24 deletions
12
ChangeLog
12
ChangeLog
|
|
@ -1,3 +1,15 @@
|
|||
2005-12-23 Dan Williams <dcbw@redhat.com>
|
||||
|
||||
* gnome/applet/applet-dbus-info.c
|
||||
- (nmi_dbus_get_key_for_network): if there's no entry in
|
||||
GConf for a network, assume we want a new key
|
||||
- (nmi_save_network_info): serialize wireless security info
|
||||
into GConf so its saved
|
||||
|
||||
* src/nm-dbus-nm.c
|
||||
- Fix warning as we may not be passed security info when
|
||||
connecting to a wireless network
|
||||
|
||||
2005-12-23 Dan Williams <dcbw@redhat.com>
|
||||
|
||||
* gnome/applet/applet-compat.c
|
||||
|
|
|
|||
|
|
@ -151,6 +151,8 @@ nmi_dbus_get_key_for_network (DBusConnection *connection,
|
|||
gboolean new_key = FALSE;
|
||||
NetworkDevice * dev = NULL;
|
||||
WirelessNetwork * net = NULL;
|
||||
char * temp = NULL;
|
||||
char * escaped_network;
|
||||
|
||||
g_return_val_if_fail (applet != NULL, NULL);
|
||||
g_return_val_if_fail (message != NULL, NULL);
|
||||
|
|
@ -167,6 +169,18 @@ nmi_dbus_get_key_for_network (DBusConnection *connection,
|
|||
if (!(dev = nmwa_get_device_for_nm_path (applet->device_list, dev_path)))
|
||||
return NULL;
|
||||
|
||||
/* If we don't have a record of the network yet in GConf, ask for
|
||||
* a new key no matter what NM says.
|
||||
*/
|
||||
escaped_network = gconf_escape_key (essid, strlen (essid));
|
||||
if (!nm_gconf_get_string_helper (applet->gconf_client,
|
||||
GCONF_PATH_WIRELESS_NETWORKS,
|
||||
"essid",
|
||||
escaped_network, &temp)
|
||||
|| !temp)
|
||||
new_key = TRUE;
|
||||
g_free (escaped_network);
|
||||
|
||||
/* It's not a new key, so try to get the key from the keyring. */
|
||||
if (!new_key)
|
||||
{
|
||||
|
|
@ -840,29 +854,6 @@ nmi_save_network_info (NMWirelessApplet *applet,
|
|||
}
|
||||
gconf_entry_unref (gconf_entry);
|
||||
|
||||
if (nm_gconf_wso_get_we_cipher (gconf_wso) != IW_AUTH_CIPHER_NONE)
|
||||
{
|
||||
/* Setup a request to the keyring to save the network passphrase */
|
||||
name = g_strdup_printf (_("Passphrase for wireless network %s"), essid);
|
||||
attributes = gnome_keyring_attribute_list_new ();
|
||||
attr.name = g_strdup ("essid"); /* FIXME: Do we need to free this ? */
|
||||
attr.type = GNOME_KEYRING_ATTRIBUTE_TYPE_STRING;
|
||||
attr.value.string = g_strdup (essid);
|
||||
g_array_append_val (attributes, attr);
|
||||
|
||||
ret = gnome_keyring_item_create_sync (NULL,
|
||||
GNOME_KEYRING_ITEM_GENERIC_SECRET,
|
||||
name,
|
||||
attributes,
|
||||
nm_gconf_wso_get_key (gconf_wso),
|
||||
TRUE,
|
||||
&item_id);
|
||||
if (ret != GNOME_KEYRING_RESULT_OK)
|
||||
g_warning ("Error saving passphrase in keyring. Ret=%d", ret);
|
||||
|
||||
gnome_keyring_attribute_list_free (attributes);
|
||||
}
|
||||
|
||||
key = g_strdup_printf ("%s/%s/essid", GCONF_PATH_WIRELESS_NETWORKS, escaped_network);
|
||||
gconf_client_set_string (applet->gconf_client, key, essid, NULL);
|
||||
g_free (key);
|
||||
|
|
@ -919,6 +910,37 @@ nmi_save_network_info (NMWirelessApplet *applet,
|
|||
g_slist_free (new_bssid_list);
|
||||
}
|
||||
|
||||
/* Stuff the security information into GConf */
|
||||
if (!nm_gconf_wso_serialize_gconf (gconf_wso, applet->gconf_client, escaped_network))
|
||||
{
|
||||
nm_warning ("%s:%d (%s): Couldn't serialize security info for '%s'.",
|
||||
__FILE__, __LINE__, __func__, essid);
|
||||
}
|
||||
|
||||
/* Stuff the encryption key into the keyring */
|
||||
if (nm_gconf_wso_get_we_cipher (gconf_wso) != IW_AUTH_CIPHER_NONE)
|
||||
{
|
||||
/* Setup a request to the keyring to save the network passphrase */
|
||||
name = g_strdup_printf (_("Passphrase for wireless network %s"), essid);
|
||||
attributes = gnome_keyring_attribute_list_new ();
|
||||
attr.name = g_strdup ("essid"); /* FIXME: Do we need to free this ? */
|
||||
attr.type = GNOME_KEYRING_ATTRIBUTE_TYPE_STRING;
|
||||
attr.value.string = g_strdup (essid);
|
||||
g_array_append_val (attributes, attr);
|
||||
|
||||
ret = gnome_keyring_item_create_sync (NULL,
|
||||
GNOME_KEYRING_ITEM_GENERIC_SECRET,
|
||||
name,
|
||||
attributes,
|
||||
nm_gconf_wso_get_key (gconf_wso),
|
||||
TRUE,
|
||||
&item_id);
|
||||
if (ret != GNOME_KEYRING_RESULT_OK)
|
||||
g_warning ("Error saving passphrase in keyring. Ret=%d", ret);
|
||||
|
||||
gnome_keyring_attribute_list_free (attributes);
|
||||
}
|
||||
|
||||
out:
|
||||
g_free (escaped_network);
|
||||
}
|
||||
|
|
@ -989,6 +1011,7 @@ nmi_dbus_update_network_info (DBusConnection *connection,
|
|||
}
|
||||
|
||||
nmi_save_network_info (applet, essid, automatic, bssid, gconf_wso);
|
||||
g_object_unref (G_OBJECT (gconf_wso));
|
||||
|
||||
out:
|
||||
return NULL;
|
||||
|
|
|
|||
|
|
@ -256,7 +256,8 @@ static DBusMessage *nm_dbus_nm_set_active_device (DBusConnection *connection, DB
|
|||
|
||||
/* Set up the wireless-specific activation request properties */
|
||||
ap = nm_device_wireless_get_activation_ap (dev, essid, security);
|
||||
g_object_unref (G_OBJECT (security));
|
||||
if (security)
|
||||
g_object_unref (G_OBJECT (security));
|
||||
|
||||
nm_info ("User Switch: %s / %s", dev_path, essid);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue