1
0
mirror of https://github.com/gryf/wicd.git synced 2026-01-02 20:04:16 +01:00

Pass lists instead of strings in GeneratePSK and Authenticate methods.

This commit is contained in:
Dan O'Reilly
2008-12-13 17:07:31 -05:00
parent 6e4d70c4ea
commit 20d5fd285b

View File

@@ -752,7 +752,7 @@ class BaseWirelessInterface(BaseInterface):
"""
if not self.iface: return False
cmd = ['iwconfig', self.iface, 'essid', essid]
if channel:
if channel and str(channel).isdigit():
cmd.extend(['channel', str(channel)])
if bssid:
cmd.extend(['ap', bssid])
@@ -770,7 +770,8 @@ class BaseWirelessInterface(BaseInterface):
if not wpa_pass_path: return None
key_pattern = re.compile('network={.*?\spsk=(.*?)\n}.*',
re.I | re.M | re.S)
cmd = ' '.join([wpa_pass_path, network['essid'], network['key']])
cmd = [wpa_pass_path, network['essid'], network['key']]
if self.verbose: print cmd
return misc.RunRegex(key_pattern, misc.Run(cmd))
def Authenticate(self, network):
@@ -784,9 +785,10 @@ class BaseWirelessInterface(BaseInterface):
if self.wpa_driver == RALINK_DRIVER:
self._AuthenticateRalinkLegacy(network)
else:
cmd = ''.join(['wpa_supplicant -B -i ', self.iface, ' -c ',
wpath.networks, network['bssid'].replace(':','').lower(),
' -D ', self.wpa_driver])
cmd = ['wpa_supplicant', '-B', '-i', self.iface, '-c',
os.path.join(wpath.networks,
network['bssid'].replace(':', '').lower()),
'-D', self.wpa_driver]
if self.verbose: print cmd
misc.Run(cmd)