[PATCH 0.7] Fix WPA-PSK with certain passphrases



Passphrases are first hashed into hex, and then encoded with hexstr2bin
before being marshalled over to wpa_supplicant. Since they are a hex
hash, it's entirely possible that '00' will occur in the hash... which
means you can't depend on strlen to give the right length for the binary
encoding, and therefore must pass the length in explicitly.

Bill

diff -up NetworkManager-0.7.0/src/supplicant-manager/nm-supplicant-config.c.foo NetworkManager-0.7.0/src/supplicant-manager/nm-supplicant-config.c
--- NetworkManager-0.7.0/src/supplicant-manager/nm-supplicant-config.c.foo	2007-09-28 22:24:17.000000000 -0400
+++ NetworkManager-0.7.0/src/supplicant-manager/nm-supplicant-config.c	2007-09-28 22:24:33.000000000 -0400
@@ -310,7 +310,7 @@ nm_supplicant_config_add_setting_wireles
 			value = nm_utils_hexstr2bin (field, strlen (field)); \
 		} else \
 			value = g_strdup (field); \
-		success = nm_supplicant_config_add_option (self, name, value, -1, secret); \
+		success = nm_supplicant_config_add_option (self, name, value, unhexify ? (strlen(field)/2) : -1, secret); \
 		g_free (value); \
 		if (!success) { \
 			nm_warning ("Error adding %s to supplicant config.", name); \


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