2007-06-13 Tambet Ingo <tambet@ximian.com>

* src/nm-device-802-11-wireless.c (nm_device_802_11_wireless_set_activation_ap):
	Convert the essid byte array to string correctly, including the terminating NULL.

	* src/NetworkManagerPolicy.c (create_connection): Create wireless ssid and
	mode with correct types.

	* src/nm-dbus-nmi.c (nm_dbus_get_user_key_for_network): Fix a typo, pass the
	constructed info to dbus call instead of the activation request.



git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@2592 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
This commit is contained in:
Tambet Ingo
2007-06-13 09:30:44 +00:00
committed by Tambet Ingo
parent b55f1323b7
commit 77cdb55279
3 changed files with 15 additions and 4 deletions

View File

@@ -167,6 +167,7 @@ create_connection (NMDevice *device, NMAccessPoint *ap)
setting = nm_setting_wired_new ();
} else if (NM_IS_DEVICE_802_11_WIRELESS (device) && ap) {
NMSettingWireless *wireless;
const char *ssid;
nm_info ("Will activate connection '%s/%s'.",
nm_device_get_iface (device),
@@ -175,8 +176,11 @@ create_connection (NMDevice *device, NMAccessPoint *ap)
setting = nm_setting_wireless_new ();
wireless = (NMSettingWireless *) setting;
wireless->ssid = g_strdup (nm_ap_get_essid (ap));
wireless->mode = 1;
ssid = nm_ap_get_essid (ap);
wireless->ssid = g_byte_array_sized_new (strlen (ssid));
g_byte_array_append (wireless->ssid, (guint8 *) ssid, strlen (ssid));
wireless->mode = g_strdup ("infrastructure");
} else
nm_warning ("Unhandled device type '%s'", G_OBJECT_CLASS_NAME (device));

View File

@@ -203,7 +203,7 @@ nm_dbus_get_user_key_for_network (NMDevice *dev,
pcall = nm_dbus_send_with_callback (dbus_connection,
message,
(DBusPendingCallNotifyFunction) nm_dbus_get_user_key_for_network_cb,
req,
info,
user_key_info_destroy,
__func__);
if (pcall)

View File

@@ -951,7 +951,11 @@ nm_device_802_11_wireless_set_activation_ap (NMDevice80211Wireless *self,
g_assert (app_data);
/* FIXME: handle essid everywhere as GByteArray */
essid = (char *) ssid->data;
{
essid = g_new (char, ssid->len + 1);
memcpy (essid, ssid->data, ssid->len);
essid[ssid->len] = '\0';
}
nm_debug ("Forcing AP '%s'", essid);
@@ -997,6 +1001,9 @@ nm_device_802_11_wireless_set_activation_ap (NMDevice80211Wireless *self,
security = nm_ap_security_new (nm_ap_get_capabilities (ap),
nm_ap_get_encrypted (ap));
}
g_free (essid);
g_assert (security);
nm_ap_set_security (ap, security);
nm_ap_add_capabilities_from_security (ap, security);