From a7acd3b5358456df9725dca8563ba26df1538b33 Mon Sep 17 00:00:00 2001 From: Dan Williams Date: Tue, 3 May 2011 13:31:45 -0500 Subject: [PATCH] network: fix initial connections to WPA[2] Enterprise APs Call out to nm-applet to do the dirty work since the dialog of doom is pretty complicated and we don't have a JS equivalent of it for now. Fixes https://bugzilla.gnome.org/show_bug.cgi?id=648171 --- js/ui/status/network.js | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/js/ui/status/network.js b/js/ui/status/network.js index 6854ed924..f740dfcfd 100644 --- a/js/ui/status/network.js +++ b/js/ui/status/network.js @@ -44,6 +44,16 @@ const NM80211Mode = NetworkManager['80211Mode']; const NM80211ApFlags = NetworkManager['80211ApFlags']; const NM80211ApSecurityFlags = NetworkManager['80211ApSecurityFlags']; +const NMAppletHelperInterface = { + name: 'org.gnome.network_manager_applet', + methods: [ + { name: 'ConnectToHiddenNetwork', inSignature: '', outSignature: '' }, + { name: 'CreateWifiNetwork', inSignature: '', outSignature: '' }, + { name: 'ConnectTo8021xNetwork', inSignature: 'oo', outSignature: '' } + ], +}; +const NMAppletProxy = DBus.makeProxyClass(NMAppletHelperInterface); + function macToArray(string) { return string.split(':').map(function(el) { return parseInt(el, 16); @@ -987,6 +997,10 @@ NMDeviceWireless.prototype = { this._overflowItem = null; this._networks = [ ]; + this._applet_proxy = new NMAppletProxy(DBus.session, + 'org.gnome.network_manager_applet', + '/org/gnome/network_manager_applet'); + // breaking the layers with this, but cannot call // this.connectionValid until I have a device this.device = device; @@ -1420,9 +1434,20 @@ NMDeviceWireless.prototype = { apObj.item = new NMNetworkMenuItem(apObj.accessPoints); apObj.item._apObj = apObj; apObj.item.connect('activate', Lang.bind(this, function() { - let connection = this._createAutomaticConnection(apObj); let accessPoints = sortAccessPoints(apObj.accessPoints); - this._client.add_and_activate_connection(connection, this.device, accessPoints[0].dbus_path, null) + if ( (accessPoints[0]._secType == NMAccessPointSecurity.WPA2_ENT) + || (accessPoints[0]._secType == NMAccessPointSecurity.WPA_ENT)) { + // 802.1x-enabled APs get handled by nm-applet for now... + this._applet_proxy.ConnectTo8021xNetworkRemote(this.device.get_path(), + accessPoints[0].dbus_path, + Lang.bind(this, function(results, err) { + if (err) + log(err); + })); + } else { + let connection = this._createAutomaticConnection(apObj); + this._client.add_and_activate_connection(connection, this.device, accessPoints[0].dbus_path, null) + } })); }