From 665fe76885d192c886a27c498176f2843cd75ea5 Mon Sep 17 00:00:00 2001 From: Dan O'Reilly Date: Sat, 4 Apr 2009 13:43:29 -0400 Subject: [PATCH] Fix crash with hidden essids if it was stored in wireless-settings.conf as None. Only trigger a wpa_supplicant rescan once when connecting. --- wicd/wicd-daemon.py | 11 +++++------ wicd/wnettools.py | 7 +++++-- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/wicd/wicd-daemon.py b/wicd/wicd-daemon.py index 1daa5be..e4e26fc 100644 --- a/wicd/wicd-daemon.py +++ b/wicd/wicd-daemon.py @@ -1170,18 +1170,17 @@ class WirelessDaemon(dbus.service.Object): cur_network["has_profile"] = True - # Read the essid because we need to name those hidden - # wireless networks now - but only read it if it is hidden. - if cur_network["hidden"]: - cur_network["essid"] = self.config.get(section, "essid") - if cur_network["essid"] in ["", "Hidden", ""]: - cur_network["essid"] = "" for x in self.config.options(section): if not cur_network.has_key(x) or x.endswith("script"): cur_network[x] = misc.Noneify(self.config.get(section, x)) for option in ['use_static_dns', 'use_global_dns', 'encryption', 'use_settings_globally']: cur_network[option] = bool(cur_network.get(option)) + # Read the essid because we need to name those hidden + # wireless networks now - but only read it if it is hidden. + if cur_network["hidden"]: + if cur_network.get("essid") in ["", "Hidden", "", None]: + cur_network["essid"] = "" return "100: Loaded Profile" @dbus.service.method('org.wicd.daemon.wireless') diff --git a/wicd/wnettools.py b/wicd/wnettools.py index a0eae85..62cf751 100644 --- a/wicd/wnettools.py +++ b/wicd/wnettools.py @@ -1094,7 +1094,8 @@ class BaseWirelessInterface(BaseInterface): except (UnicodeDecodeError, UnicodeEncodeError): print 'Unicode problem with current network essid, ignoring!!' return None - if ap['essid'] in ['', ""]: + if ap['essid'] in ['', "", None]: + print 'hidden' ap['hidden'] = True ap['essid'] = "" else: @@ -1176,6 +1177,7 @@ class BaseWirelessInterface(BaseInterface): MAX_TIME = 35 MAX_DISCONNECTED_TIME = 3 disconnected_time = 0 + forced_rescan = False while (time.time() - auth_time) < MAX_TIME: cmd = '%s -i %s status' % (self.wpa_cli_cmd, self.iface) output = misc.Run(cmd) @@ -1187,11 +1189,12 @@ class BaseWirelessInterface(BaseInterface): return False if result == "COMPLETED": return True - elif result == "DISCONNECTED": + elif result == "DISCONNECTED" and not forced_rescan: disconnected_time += 1 if disconnected_time > MAX_DISCONNECTED_TIME: disconnected_time = 0 # Force a rescan to get wpa_supplicant moving again. + forced_rescan = True self._ForceSupplicantScan() MAX_TIME += 5 else: