all: fix client handling of hidden SSIDs (bgo #736802)

This commit is contained in:
Dan Winship 2014-09-19 09:08:10 -04:00
commit f49f57591b
3 changed files with 22 additions and 9 deletions

View file

@ -294,8 +294,9 @@ add_connections_for_aps (NmtConnectDevice *nmtdev,
nmtconn->device = nmtdev->device;
nmtconn->ap = g_object_ref (ap);
ssid = nm_access_point_get_ssid (ap);
nmtconn->ssid = nm_utils_ssid_to_utf8 (g_bytes_get_data (ssid, NULL),
g_bytes_get_size (ssid));
if (ssid)
nmtconn->ssid = nm_utils_ssid_to_utf8 (g_bytes_get_data (ssid, NULL),
g_bytes_get_size (ssid));
for (iter = connections; iter; iter = iter->next) {
conn = iter->data;
@ -308,7 +309,7 @@ add_connections_for_aps (NmtConnectDevice *nmtdev,
}
if (!iter)
nmtconn->name = nmtconn->ssid;
nmtconn->name = nmtconn->ssid ? nmtconn->ssid : "<unknown>";
nmtdev->conns = g_slist_prepend (nmtdev->conns, nmtconn);
}

View file

@ -97,7 +97,10 @@ show_access_point_info (NMAccessPoint *ap)
strength = nm_access_point_get_strength (ap);
/* Convert to strings */
ssid_str = nm_utils_ssid_to_utf8 (g_bytes_get_data (ssid, NULL), g_bytes_get_size (ssid));
if (ssid)
ssid_str = nm_utils_ssid_to_utf8 (g_bytes_get_data (ssid, NULL), g_bytes_get_size (ssid));
else
ssid_str = g_strdup ("--");
freq_str = g_strdup_printf ("%u MHz", freq);
bitrate_str = g_strdup_printf ("%u Mbit/s", bitrate/1000);
strength_str = g_strdup_printf ("%u", strength);
@ -163,8 +166,11 @@ show_wifi_device_info (NMDevice *device)
if (nm_device_get_state (device) == NM_DEVICE_STATE_ACTIVATED) {
if ((active_ap = nm_device_wifi_get_active_access_point (NM_DEVICE_WIFI (device)))) {
active_ssid = nm_access_point_get_ssid (active_ap);
active_ssid_str = nm_utils_ssid_to_utf8 (g_bytes_get_data (active_ssid, NULL),
g_bytes_get_size (active_ssid));
if (active_ssid)
active_ssid_str = nm_utils_ssid_to_utf8 (g_bytes_get_data (active_ssid, NULL),
g_bytes_get_size (active_ssid));
else
active_ssid_str = g_strdup ("--");
}
}

View file

@ -121,14 +121,20 @@ nm_access_point_get_rsn_flags (NMAccessPoint *ap)
*
* Gets the SSID of the access point.
*
* Returns: the #GBytes containing the SSID.
* Returns: the #GBytes containing the SSID, or %NULL if the SSID is unknown.
**/
GBytes *
nm_access_point_get_ssid (NMAccessPoint *ap)
{
NMAccessPointPrivate *priv;
g_return_val_if_fail (NM_IS_ACCESS_POINT (ap), NULL);
return NM_ACCESS_POINT_GET_PRIVATE (ap)->ssid;
priv = NM_ACCESS_POINT_GET_PRIVATE (ap);
if (!priv->ssid || g_bytes_get_size (priv->ssid) == 0)
return NULL;
return priv->ssid;
}
/**
@ -502,7 +508,7 @@ nm_access_point_class_init (NMAccessPointClass *ap_class)
/**
* NMAccessPoint:ssid:
*
* The SSID of the access point.
* The SSID of the access point, or %NULL if it is not known.
**/
g_object_class_install_property
(object_class, PROP_SSID,