Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/shell
diff options
context:
space:
mode:
authorDan Williams <dcbw@redhat.com>2007-07-30 18:46:40 (GMT)
committer Dan Williams <dcbw@redhat.com>2007-07-30 18:46:40 (GMT)
commitdbe8a6eeff7e2f42c309ba709038d568246f0853 (patch)
tree3b2491f9cfdcce0f1a3776d07bbf6db381ffc0c1 /shell
parentf06404ca8ecb73ed9e38eddc566f3b78a87301a2 (diff)
Fix traceback when reading in saved WPA2 network configs
Diffstat (limited to 'shell')
-rw-r--r--shell/hardware/nminfo.py30
1 files changed, 14 insertions, 16 deletions
diff --git a/shell/hardware/nminfo.py b/shell/hardware/nminfo.py
index 836a556..09226cf 100644
--- a/shell/hardware/nminfo.py
+++ b/shell/hardware/nminfo.py
@@ -120,19 +120,16 @@ class Security(object):
def new_from_config(cfg, name):
security = None
- try:
- we_cipher = cfg.get_int(name, "we_cipher")
- if we_cipher == IW_AUTH_CIPHER_NONE:
- security = Security(we_cipher)
- elif we_cipher == IW_AUTH_CIPHER_WEP40 or we_cipher == IW_AUTH_CIPHER_WEP104:
- security = WEPSecurity(we_cipher)
- elif we_cipher == NM_AUTH_TYPE_WPA_PSK_AUTO or we_cipher == IW_AUTH_CIPHER_CCMP or we_cipher == IW_AUTH_CIPHER_TKIP:
- security = WPASecurity(we_cipher)
- else:
- raise ValueError("Unsupported security combo")
- security.read_from_config(cfg, name)
- except (ConfigParser.NoOptionError, ValueError), e:
- return None
+ we_cipher = cfg.get_int(name, "we_cipher")
+ if we_cipher == IW_AUTH_CIPHER_NONE:
+ security = Security(we_cipher)
+ elif we_cipher == IW_AUTH_CIPHER_WEP40 or we_cipher == IW_AUTH_CIPHER_WEP104:
+ security = WEPSecurity(we_cipher)
+ elif we_cipher == NM_AUTH_TYPE_WPA_PSK_AUTO or we_cipher == IW_AUTH_CIPHER_CCMP or we_cipher == IW_AUTH_CIPHER_TKIP:
+ security = WPASecurity(we_cipher)
+ else:
+ raise ValueError("Unsupported security combo")
+ security.read_from_config(cfg, name)
return security
new_from_config = staticmethod(new_from_config)
@@ -241,7 +238,7 @@ class WPASecurity(Security):
raise ValueError("Key was not a hexadecimal string.")
self._wpa_ver = cfg.get_int(name, "wpa_ver")
- if self._wpa_ver != IW_AUTH_WPA_VERSION_WPA and self._wpa_ver != IW_AUTH_WPA_VERSION_WPA:
+ if self._wpa_ver != IW_AUTH_WPA_VERSION_WPA and self._wpa_ver != IW_AUTH_WPA_VERSION_WPA2:
raise ValueError("Invalid WPA version %d" % self._wpa_ver)
self._key_mgmt = cfg.get_int(name, "key_mgmt")
@@ -300,8 +297,9 @@ class Network:
except (ConfigParser.NoOptionError, ValueError), e:
raise NetworkInvalidError(e)
- self._security = Security.new_from_config(config, self.ssid)
- if not self._security:
+ try:
+ self._security = Security.new_from_config(config, self.ssid)
+ except Exception, e:
raise NetworkInvalidError(e)
# The following don't need to be present