cfg80211: check if WEP is available for shared key auth
authorJohannes Berg <johannes.berg@intel.com>
Tue, 10 Aug 2010 07:46:42 +0000 (09:46 +0200)
committerJohn W. Linville <linville@tuxdriver.com>
Mon, 16 Aug 2010 20:45:22 +0000 (16:45 -0400)
When shared key auth is requested, cfg80211
should verify that the device is capable of
WEP crypto which is required.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
net/wireless/nl80211.c

index 37902a54e9c154fb8dbed3e1d996d8a198bdc17b..bb5b78eebeb21d29f6116cfc252bd1fbe098e055 100644 (file)
@@ -3572,6 +3572,21 @@ static int nl80211_authenticate(struct sk_buff *skb, struct genl_info *info)
        if (err)
                goto unlock_rtnl;
 
+       if (key.idx >= 0) {
+               int i;
+               bool ok = false;
+               for (i = 0; i < rdev->wiphy.n_cipher_suites; i++) {
+                       if (key.p.cipher == rdev->wiphy.cipher_suites[i]) {
+                               ok = true;
+                               break;
+                       }
+               }
+               if (!ok) {
+                       err = -EINVAL;
+                       goto out;
+               }
+       }
+
        if (!rdev->ops->auth) {
                err = -EOPNOTSUPP;
                goto out;