Bug 790054 - Allow WPA-EAP networks based on a gecko pref. r=fabrice
authorBlake Kaplan <mrbkap@gmail.com>
Fri, 21 Dec 2012 16:57:19 -0500
changeset 125934 911c7371b8b36441a8a0778e97280bea9ca7737b
parent 125933 b256fb454e3cb4d8a6e2514d8921ba48896c4f54
child 125935 03759110bbd79d820c7f06c4e30a1f6c157eebeb
push id2151
push userlsblakk@mozilla.com
push dateTue, 19 Feb 2013 18:06:57 +0000
treeherdermozilla-beta@4952e88741ec [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersfabrice
bugs790054
milestone20.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 790054 - Allow WPA-EAP networks based on a gecko pref. r=fabrice
dom/wifi/WifiWorker.js
--- a/dom/wifi/WifiWorker.js
+++ b/dom/wifi/WifiWorker.js
@@ -1614,16 +1614,17 @@ function WifiWorker() {
   messages.forEach((function(msgName) {
     this._mm.addMessageListener(msgName, this);
   }).bind(this));
 
   Services.obs.addObserver(this, kMozSettingsChangedObserverTopic, false);
 
   this.wantScanResults = [];
 
+  this._allowWpaEap = false;
   this._needToEnableNetworks = false;
   this._highestPriority = -1;
 
   // networks is a map from SSID -> a scan result.
   this.networks = Object.create(null);
 
   // configuredNetworks is a map from SSID -> our view of a network. It only
   // lists networks known to the wpa_supplicant. The SSID field (and other
@@ -1780,16 +1781,22 @@ function WifiWorker() {
       self.waitForScan(function firstScan() {});
       // The select network command we used in associate() disables others networks.
       // Enable them here to make sure wpa_supplicant helps to connect to known
       // network automatically.
       self._enableAllNetworks();
       WifiManager.saveConfig(function() {})
     });
 
+    try {
+      self._allowWpaEap = Services.prefs.getBoolPref("b2g.wifi.allow_unsafe_wpa_eap");
+    } catch (e) {
+      self._allowWpaEap = false;
+    }
+
     // Check if we need to dequeue requests first.
     self._notifyAfterStateChange(true, true);
 
     // Notify everybody, even if they didn't ask us to come up.
     self._fireEvent("wifiUp", {});
     if (WifiManager.state === "SCANNING")
       startScanStuckTimer();
   };
@@ -2058,17 +2065,18 @@ function WifiWorker() {
 
             // Note: we don't hand out passwords here! The * marks that there
             // is a password that we're hiding.
             if (("psk" in known && known.psk) ||
                 ("password" in known && known.password) ||
                 ("wep_key0" in known && known.wep_key0)) {
               network.password = "*";
             }
-          } else if ((eapIndex = network.capabilities.indexOf("WPA-EAP")) >= 0) {
+          } else if (!self._allowWpaEap &&
+                     (eapIndex = network.capabilities.indexOf("WPA-EAP")) >= 0) {
             // Don't offer to connect to WPA-EAP networks unless one has been
             // configured through other means (e.g. it was added directly to
             // wpa_supplicant.conf). Here, we have an unknown WPA-EAP network,
             // so we ignore it entirely if it only supports WPA-EAP, otherwise
             // we take EAP out of the list and offer the rest of the
             // capabilities.
             if (network.capabilities.length === 1)
               continue;