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:
@@ -167,6 +167,7 @@ create_connection (NMDevice *device, NMAccessPoint *ap)
|
|||||||
setting = nm_setting_wired_new ();
|
setting = nm_setting_wired_new ();
|
||||||
} else if (NM_IS_DEVICE_802_11_WIRELESS (device) && ap) {
|
} else if (NM_IS_DEVICE_802_11_WIRELESS (device) && ap) {
|
||||||
NMSettingWireless *wireless;
|
NMSettingWireless *wireless;
|
||||||
|
const char *ssid;
|
||||||
|
|
||||||
nm_info ("Will activate connection '%s/%s'.",
|
nm_info ("Will activate connection '%s/%s'.",
|
||||||
nm_device_get_iface (device),
|
nm_device_get_iface (device),
|
||||||
@@ -175,8 +176,11 @@ create_connection (NMDevice *device, NMAccessPoint *ap)
|
|||||||
setting = nm_setting_wireless_new ();
|
setting = nm_setting_wireless_new ();
|
||||||
wireless = (NMSettingWireless *) setting;
|
wireless = (NMSettingWireless *) setting;
|
||||||
|
|
||||||
wireless->ssid = g_strdup (nm_ap_get_essid (ap));
|
ssid = nm_ap_get_essid (ap);
|
||||||
wireless->mode = 1;
|
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
|
} else
|
||||||
nm_warning ("Unhandled device type '%s'", G_OBJECT_CLASS_NAME (device));
|
nm_warning ("Unhandled device type '%s'", G_OBJECT_CLASS_NAME (device));
|
||||||
|
|
||||||
|
@@ -203,7 +203,7 @@ nm_dbus_get_user_key_for_network (NMDevice *dev,
|
|||||||
pcall = nm_dbus_send_with_callback (dbus_connection,
|
pcall = nm_dbus_send_with_callback (dbus_connection,
|
||||||
message,
|
message,
|
||||||
(DBusPendingCallNotifyFunction) nm_dbus_get_user_key_for_network_cb,
|
(DBusPendingCallNotifyFunction) nm_dbus_get_user_key_for_network_cb,
|
||||||
req,
|
info,
|
||||||
user_key_info_destroy,
|
user_key_info_destroy,
|
||||||
__func__);
|
__func__);
|
||||||
if (pcall)
|
if (pcall)
|
||||||
|
@@ -951,7 +951,11 @@ nm_device_802_11_wireless_set_activation_ap (NMDevice80211Wireless *self,
|
|||||||
g_assert (app_data);
|
g_assert (app_data);
|
||||||
|
|
||||||
/* FIXME: handle essid everywhere as GByteArray */
|
/* 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);
|
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),
|
security = nm_ap_security_new (nm_ap_get_capabilities (ap),
|
||||||
nm_ap_get_encrypted (ap));
|
nm_ap_get_encrypted (ap));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
g_free (essid);
|
||||||
|
|
||||||
g_assert (security);
|
g_assert (security);
|
||||||
nm_ap_set_security (ap, security);
|
nm_ap_set_security (ap, security);
|
||||||
nm_ap_add_capabilities_from_security (ap, security);
|
nm_ap_add_capabilities_from_security (ap, security);
|
||||||
|
Reference in New Issue
Block a user