1
0
mirror of https://github.com/gryf/wicd.git synced 2025-12-20 12:58:07 +01:00

Fixed problems with passphrases using non-alphanumeric characters.

This commit is contained in:
imdano
2008-04-23 18:10:23 +00:00
parent a176c84373
commit d139c8f8e5

View File

@@ -674,6 +674,10 @@ class WirelessConnectThread(ConnectThread):
process if encryption is on. process if encryption is on.
""" """
def _sanitize(key):
""" Escapes characters wpa_supplicant doesn't handle properly. """
return key.replace("$", "\$").replace("`", "\`").replace("\"",
"\\\"")
# Check to see if we need to generate a PSK (only for non-ralink # Check to see if we need to generate a PSK (only for non-ralink
# cards). # cards).
if self.network.get('key'): if self.network.get('key'):
@@ -685,7 +689,7 @@ class WirelessConnectThread(ConnectThread):
self.network['psk'] = misc.RunRegex(key_pattern, self.network['psk'] = misc.RunRegex(key_pattern,
misc.Run(''.join(['wpa_passphrase "', misc.Run(''.join(['wpa_passphrase "',
self.network['essid'], '" "', self.network['essid'], '" "',
re.escape(self.network['key']), '"']))) _sanitize(self.network['key']), '"'])))
# Generate the wpa_supplicant file... # Generate the wpa_supplicant file...
if self.network.get('enctype'): if self.network.get('enctype'):
self.SetStatus('generating_wpa_config') self.SetStatus('generating_wpa_config')