[gnome-control-center] network: Fix hotspot silently failing with long hostname



commit e66941753b3e1586cfe9bad4df11da68ee34ca21
Author: Bastien Nocera <hadess hadess net>
Date:   Fri Jun 10 16:19:46 2016 +0200

    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

 panels/network/net-device-wifi.c |   16 ++++++----------
 1 files changed, 6 insertions(+), 10 deletions(-)
---
diff --git a/panels/network/net-device-wifi.c b/panels/network/net-device-wifi.c
index f162de7..afa3fd5 100644
--- a/panels/network/net-device-wifi.c
+++ b/panels/network/net-device-wifi.c
@@ -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);
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]