File wpa_supplicant-hide_secrets-2.patch of Package wpa_supplicant

iff -ur BUILD/wpa_supplicant-0.6.4/wpa_supplicant/ctrl_iface.c BUILD2/wpa_supplicant-0.6.4/wpa_supplicant/ctrl_iface.c
--- BUILD/wpa_supplicant-0.6.4/wpa_supplicant/ctrl_iface.c	2008-08-10 19:33:12.000000000 +0200
+++ BUILD2/wpa_supplicant-0.6.4/wpa_supplicant/ctrl_iface.c	2008-12-08 15:36:59.000000000 +0100
@@ -798,6 +798,8 @@
 	int id;
 	struct wpa_ssid *ssid;
 	char *name, *value;
+	int show_value = 1;
+	const char *nokey = "[REMOVED]";
 
 	/* cmd: "<network id> <variable name> <value>" */
 	name = os_strchr(cmd, ' ');
@@ -805,6 +807,15 @@
 		return -1;
 	*name++ = '\0';
 
+	/* Only show passwords and keys if requested */
+	if (!strncmp (name, "wep_key", 7)
+			|| !strncmp (name, "psk", 3)
+			|| !strncmp (name, "password", 8)
+			|| !strncmp (name, "pin", 3)
+			|| !strncmp (name, "private_key_passwd", 18)) {
+		show_value = wpa_s->global->params.wpa_debug_show_keys;
+	}
+
 	value = os_strchr(name, ' ');
 	if (value == NULL)
 		return -1;
@@ -1346,6 +1358,19 @@
 	    os_strncmp(buf, "SET_NETWORK ", 12) == 0) {
 		wpa_hexdump_ascii_key(MSG_DEBUG, "RX ctrl_iface",
 				      (const u8 *) buf, os_strlen(buf));
+	} else if (strncmp(buf, "SET_NETWORK ", 12) == 0) {
+		/* Check for forbidden material here too */
+		if (strstr (buf, " wep_key")
+				|| strstr (buf, " psk ")
+				|| strstr (buf, " password ")
+				|| strstr (buf, " pin ")
+				|| strstr (buf, " private_key_passwd ")) {
+			wpa_hexdump_ascii_key(MSG_DEBUG, "RX ctrl_iface",
+				      (const u8 *) buf, os_strlen(buf));
+		} else {
+			wpa_hexdump_ascii(MSG_DEBUG, "RX ctrl_iface",
+					  (const u8 *) buf, os_strlen(buf));
+		}
 	} else {
 		wpa_hexdump_ascii(MSG_DEBUG, "RX ctrl_iface",
 				  (const u8 *) buf, os_strlen(buf));
diff -ur BUILD/wpa_supplicant-0.6.4/wpa_supplicant/config.c BUILD2//wpa_supplicant-0.6.4/wpa_supplicant/config.c
--- BUILD/wpa_supplicant-0.6.4/wpa_supplicant/config.c	2008-12-08 16:35:13.000000000 +0100
+++ BUILD2//wpa_supplicant-0.6.4/wpa_supplicant/config.c	2008-12-08 16:34:25.000000000 +0100
@@ -1001,7 +1001,7 @@
 				   "password.", line);
 			return -1;
 		}
-		wpa_hexdump_ascii(MSG_MSGDUMP, data->name,
+		wpa_hexdump_ascii_key(MSG_MSGDUMP, data->name,
 				  (u8 *) tmp, res_len);
 
 		os_free(ssid->eap.password);