network: Fix hotspot silently failing with long hostname

By truncating the SSID to 32 bytes.

network-cc-panel-WARNING **: Failed to add new connection: (32) 802-11-wireless.ssid: SSID length is out of range <1-32> bytes

See https://bugzilla.redhat.com/show_bug.cgi?id=1309331
This commit is contained in:
Bastien Nocera 2016-06-10 16:19:46 +02:00
parent 1ce4af4267
commit e66941753b

View file

@ -30,6 +30,7 @@
#include <polkit/polkit.h>
#include "shell/list-box-helper.h"
#include "shell/hostname-helper.h"
#include "network-dialogs.h"
#include "panel-common.h"
@ -878,14 +879,6 @@ get_hostname (void)
g_variant_unref (res);
}
if (str == NULL || *str == '\0') {
str = g_strdup (g_get_host_name ());
}
if (str == NULL || *str == '\0') {
str = g_strdup ("GNOME");
}
return str;
}
@ -893,9 +886,12 @@ static GByteArray *
generate_ssid_for_hotspot (NetDeviceWifi *device_wifi)
{
GByteArray *ssid_array;
gchar *ssid;
gchar *hostname, *ssid;
hostname = get_hostname ();
ssid = pretty_hostname_to_ssid (hostname);
g_free (hostname);
ssid = get_hostname ();
ssid_array = ssid_to_byte_array (ssid);
g_free (ssid);