Bug 786438 - Handle WEP authentication fail. r=mrbkap

This commit is contained in:
Chuck Lee 2012-11-06 14:08:46 +08:00
Родитель 2ec85750e6
Коммит 296bd6ee68
1 изменённых файлов: 20 добавлений и 0 удалений

Просмотреть файл

@ -814,6 +814,17 @@ var WifiManager = (function() {
function handleEvent(event) {
debug("Event coming in: " + event);
if (event.indexOf("CTRL-EVENT-") !== 0 && event.indexOf("WPS") !== 0) {
// Handle connection fail exception on WEP-128, while password length
// is not 5 nor 13 bytes.
if (event.indexOf("Association request to the driver failed") !== -1) {
notify("passwordmaybeincorrect");
if (manager.authenticationFailuresCount > MAX_RETRIES_ON_AUTHENTICATION_FAILURE) {
notify("disconnected");
manager.authenticationFailuresCount = 0;
}
return true;
}
if (event.indexOf("WPA:") == 0 &&
event.indexOf("pre-shared key may be incorrect") != -1) {
notify("passwordmaybeincorrect");
@ -891,6 +902,15 @@ var WifiManager = (function() {
}
return true;
}
// Association reject is triggered mostly on incorrect WEP key.
if (eventData.indexOf("CTRL-EVENT-ASSOC-REJECT") === 0) {
notify("passwordmaybeincorrect");
if (manager.authenticationFailuresCount > MAX_RETRIES_ON_AUTHENTICATION_FAILURE) {
notify("disconnected");
manager.authenticationFailuresCount = 0;
}
return true;
}
if (eventData.indexOf("CTRL-EVENT-CONNECTED") === 0) {
// Format: CTRL-EVENT-CONNECTED - Connection to 00:1e:58:ec:d5:6d completed (reauth) [id=1 id_str=]
var bssid = eventData.split(" ")[4];