summaryrefslogtreecommitdiff
path: root/gsupplicant
diff options
context:
space:
mode:
authorJulien Massot <jmassot@aldebaran-robotics.com>2012-04-13 15:16:30 +0000
committerPatrik Flykt <patrik.flykt@linux.intel.com>2012-04-17 13:37:04 +0300
commit03ebc040bfae59d85f4e7acdc3117881f6067262 (patch)
tree68f6e3fc42f55ef29f75f0ff282041602b63e0c9 /gsupplicant
parent593e3e4c8a46ce05aaf64cc06e387575894bf166 (diff)
downloadconnman-03ebc040bfae59d85f4e7acdc3117881f6067262.tar.gz
connman-03ebc040bfae59d85f4e7acdc3117881f6067262.tar.bz2
connman-03ebc040bfae59d85f4e7acdc3117881f6067262.zip
gsupplicant: Interpret "invalid message format" as invalid-key error
If gsupplicant sends a malformed passphrase, wpa_supplicant return an error "invalid message format", parsing this error avoids future usage of this passphrase.
Diffstat (limited to 'gsupplicant')
-rw-r--r--gsupplicant/supplicant.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/gsupplicant/supplicant.c b/gsupplicant/supplicant.c
index 5db1fcdf..c8f33892 100644
--- a/gsupplicant/supplicant.c
+++ b/gsupplicant/supplicant.c
@@ -2684,10 +2684,15 @@ static int parse_supplicant_error(DBusMessageIter *iter)
int err = -ECANCELED;
char *key;
+ /* If the given passphrase is malformed wpa_s returns
+ * "invalid message format" but this error should be interpreted as
+ * invalid-key.
+ */
while (dbus_message_iter_get_arg_type(iter) == DBUS_TYPE_STRING) {
dbus_message_iter_get_basic(iter, &key);
- if (strncmp(key, "psk", 4) == 0 ||
- strncmp(key, "wep_key", 7) == 0) {
+ if (strncmp(key, "psk", 3) == 0 ||
+ strncmp(key, "wep_key", 7) == 0 ||
+ strcmp(key, "invalid message format") == 0) {
err = -ENOKEY;
break;
}