Merge lp:~jonas-drange/ubuntu-system-settings/wapi-support into lp:ubuntu-system-settings

Proposed by Jonas G. Drange on 2016-07-27
Status: Needs review
Proposed branch: lp:~jonas-drange/ubuntu-system-settings/wapi-support
Merge into: lp:ubuntu-system-settings
Prerequisite: lp:~jonas-drange/ubuntu-system-settings/filepicker
Diff against target: 492 lines (+209/-26) (has conflicts)
11 files modified
plugins/wifi/CMakeLists.txt (+8/-0)
plugins/wifi/OtherNetwork.qml (+37/-13)
plugins/wifi/PageComponent.qml (+2/-1)
plugins/wifi/plugin.cpp (+2/-0)
plugins/wifi/wifi.cpp (+37/-0)
plugins/wifi/wifi.h (+34/-0)
plugins/wifi/wifidbushelper.cpp (+26/-8)
tests/autopilot/ubuntu_system_settings/__init__.py (+4/-0)
tests/autopilot/ubuntu_system_settings/tests/__init__.py (+2/-2)
tests/autopilot/ubuntu_system_settings/tests/networkmanager.py (+10/-1)
tests/autopilot/ubuntu_system_settings/tests/test_wifi.py (+47/-1)
Text conflict in debian/changelog
To merge this branch: bzr merge lp:~jonas-drange/ubuntu-system-settings/wapi-support
Reviewer Review Type Date Requested Status
system-apps-ci-bot continuous-integration 2016-07-27 Needs Fixing on 2016-07-27
Ken VanDine 2016-07-27 Pending
PS Jenkins bot continuous-integration 2016-07-27 Pending
Review via email: mp+301249@code.launchpad.net

This proposal supersedes a proposal from 2016-07-12.

Commit message

- Accept key-mgmt option and respond to the value appropriately.
- Allow connection to WAPI Personal and WAPI Certificate APs.

To post a comment you must log in.
Jonas G. Drange (jonas-drange) wrote : Posted in a previous version of this proposal

We need to create a config that works for WAPI, but we're not sure what those values are yet, so WIP.

system-apps-ci-bot (system-apps-ci-bot) wrote : Posted in a previous version of this proposal

FAILED: Continuous integration, rev:1671
https://jenkins.canonical.com/system-apps/job/lp-ubuntu-system-settings-ci/36/
Executed test runs:
    FAILURE: https://jenkins.canonical.com/system-apps/job/build/903/console
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-0-fetch/903
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-1-sourcepkg/release=vivid+overlay/813
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-1-sourcepkg/release=xenial+overlay/813
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-1-sourcepkg/release=yakkety/813
    FAILURE: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=amd64,release=vivid+overlay/818/console
    FAILURE: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=amd64,release=xenial+overlay/818/console
    FAILURE: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=amd64,release=yakkety/818/console
    FAILURE: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=armhf,release=vivid+overlay/818/console
    FAILURE: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=armhf,release=xenial+overlay/818/console
    FAILURE: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=armhf,release=yakkety/818/console
    FAILURE: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=i386,release=vivid+overlay/818/console
    FAILURE: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=i386,release=xenial+overlay/818/console
    FAILURE: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=i386,release=yakkety/818/console

Click here to trigger a rebuild:
https://jenkins.canonical.com/system-apps/job/lp-ubuntu-system-settings-ci/36/rebuild

review: Needs Fixing (continuous-integration)
system-apps-ci-bot (system-apps-ci-bot) wrote : Posted in a previous version of this proposal

FAILED: Continuous integration, rev:1674
https://jenkins.canonical.com/system-apps/job/lp-ubuntu-system-settings-ci/39/
Executed test runs:
    FAILURE: https://jenkins.canonical.com/system-apps/job/build/944/console
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-0-fetch/944
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-1-sourcepkg/release=vivid+overlay/849
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-1-sourcepkg/release=xenial+overlay/849
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-1-sourcepkg/release=yakkety/849
    FAILURE: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=amd64,release=vivid+overlay/846/console
    FAILURE: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=amd64,release=xenial+overlay/846/console
    FAILURE: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=amd64,release=yakkety/846/console
    FAILURE: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=armhf,release=vivid+overlay/846/console
    FAILURE: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=armhf,release=xenial+overlay/846/console
    FAILURE: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=armhf,release=yakkety/846/console
    FAILURE: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=i386,release=vivid+overlay/846/console
    FAILURE: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=i386,release=xenial+overlay/846/console
    FAILURE: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=i386,release=yakkety/846/console

Click here to trigger a rebuild:
https://jenkins.canonical.com/system-apps/job/lp-ubuntu-system-settings-ci/39/rebuild

review: Needs Fixing (continuous-integration)
system-apps-ci-bot (system-apps-ci-bot) wrote : Posted in a previous version of this proposal

FAILED: Continuous integration, rev:1675
https://jenkins.canonical.com/system-apps/job/lp-ubuntu-system-settings-ci/40/
Executed test runs:
    FAILURE: https://jenkins.canonical.com/system-apps/job/build/946/console
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-0-fetch/946
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-1-sourcepkg/release=vivid+overlay/851
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-1-sourcepkg/release=xenial+overlay/851
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-1-sourcepkg/release=yakkety/851
    FAILURE: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=amd64,release=vivid+overlay/848/console
    FAILURE: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=amd64,release=xenial+overlay/848/console
    FAILURE: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=amd64,release=yakkety/848/console
    FAILURE: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=armhf,release=vivid+overlay/848/console
    FAILURE: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=armhf,release=xenial+overlay/848/console
    FAILURE: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=armhf,release=yakkety/848/console
    FAILURE: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=i386,release=vivid+overlay/848/console
    FAILURE: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=i386,release=xenial+overlay/848/console
    FAILURE: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=i386,release=yakkety/848/console

Click here to trigger a rebuild:
https://jenkins.canonical.com/system-apps/job/lp-ubuntu-system-settings-ci/40/rebuild

review: Needs Fixing (continuous-integration)
system-apps-ci-bot (system-apps-ci-bot) wrote : Posted in a previous version of this proposal

FAILED: Continuous integration, rev:1676
https://jenkins.canonical.com/system-apps/job/lp-ubuntu-system-settings-ci/51/
Executed test runs:
    FAILURE: https://jenkins.canonical.com/system-apps/job/build/984/console
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-0-fetch/984
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-1-sourcepkg/release=vivid+overlay/886
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-1-sourcepkg/release=xenial+overlay/886
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-1-sourcepkg/release=yakkety/886
    FAILURE: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=amd64,release=vivid+overlay/883/console
    FAILURE: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=amd64,release=xenial+overlay/883/console
    FAILURE: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=amd64,release=yakkety/883/console
    FAILURE: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=armhf,release=vivid+overlay/883/console
    FAILURE: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=armhf,release=xenial+overlay/883/console
    FAILURE: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=armhf,release=yakkety/883/console
    FAILURE: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=i386,release=vivid+overlay/883/console
    FAILURE: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=i386,release=xenial+overlay/883/console
    FAILURE: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=i386,release=yakkety/883/console

Click here to trigger a rebuild:
https://jenkins.canonical.com/system-apps/job/lp-ubuntu-system-settings-ci/51/rebuild

review: Needs Fixing (continuous-integration)
Ken VanDine (ken-vandine) wrote : Posted in a previous version of this proposal

Found an autopilot failure when running the vpn tests:

autopilot.exceptions.StateNotFoundError: Object not found with name '*' and properties {'objectName': 'vpnDialogFile'}.

review: Needs Fixing
Ken VanDine (ken-vandine) wrote : Posted in a previous version of this proposal

looks good now

review: Approve
system-apps-ci-bot (system-apps-ci-bot) wrote : Posted in a previous version of this proposal

FAILED: Continuous integration, rev:1677
https://jenkins.canonical.com/system-apps/job/lp-ubuntu-system-settings-ci/52/
Executed test runs:
    FAILURE: https://jenkins.canonical.com/system-apps/job/build/1003/console
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-0-fetch/1003
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-1-sourcepkg/release=vivid+overlay/901
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-1-sourcepkg/release=xenial+overlay/901
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-1-sourcepkg/release=yakkety/901
    FAILURE: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=amd64,release=vivid+overlay/895/console
    FAILURE: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=amd64,release=xenial+overlay/895/console
    FAILURE: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=amd64,release=yakkety/895/console
    FAILURE: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=armhf,release=vivid+overlay/895/console
    FAILURE: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=armhf,release=xenial+overlay/895/console
    FAILURE: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=armhf,release=yakkety/895/console
    FAILURE: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=i386,release=vivid+overlay/895/console
    FAILURE: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=i386,release=xenial+overlay/895/console
    FAILURE: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=i386,release=yakkety/895/console

Click here to trigger a rebuild:
https://jenkins.canonical.com/system-apps/job/lp-ubuntu-system-settings-ci/52/rebuild

review: Needs Fixing (continuous-integration)
1674. By Jonas G. Drange on 2016-07-27

merge prereq

1675. By Jonas G. Drange on 2016-07-27

add wapi patch

1676. By Jonas G. Drange on 2016-07-27

fix typo

FAILED: Continuous integration, rev:1676
https://jenkins.canonical.com/system-apps/job/lp-ubuntu-system-settings-ci/55/
Executed test runs:
    FAILURE: https://jenkins.canonical.com/system-apps/job/build/1045/console
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-0-fetch/1045
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-1-sourcepkg/release=vivid+overlay/942
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-1-sourcepkg/release=xenial+overlay/942
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-1-sourcepkg/release=yakkety/942
    FAILURE: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=amd64,release=vivid+overlay/933/console
    FAILURE: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=amd64,release=xenial+overlay/933/console
    FAILURE: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=amd64,release=yakkety/933/console
    FAILURE: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=armhf,release=vivid+overlay/933/console
    FAILURE: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=armhf,release=xenial+overlay/933/console
    FAILURE: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=armhf,release=yakkety/933/console
    FAILURE: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=i386,release=vivid+overlay/933/console
    FAILURE: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=i386,release=xenial+overlay/933/console
    FAILURE: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=i386,release=yakkety/933/console

Click here to trigger a rebuild:
https://jenkins.canonical.com/system-apps/job/lp-ubuntu-system-settings-ci/55/rebuild

review: Needs Fixing (continuous-integration)

Unmerged revisions

1676. By Jonas G. Drange on 2016-07-27

fix typo

1675. By Jonas G. Drange on 2016-07-27

add wapi patch

1674. By Jonas G. Drange on 2016-07-27

merge prereq

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'plugins/wifi/CMakeLists.txt'
2--- plugins/wifi/CMakeLists.txt 2016-07-27 09:33:37 +0000
3+++ plugins/wifi/CMakeLists.txt 2016-07-27 09:33:37 +0000
4@@ -1,3 +1,7 @@
5+if(ANDR_PROP_FOUND)
6+ add_definitions(-DANDROID_PROPERTIES)
7+endif()
8+
9 set(QML_SOURCES
10 AccessPoint.qml
11 BaseMenuItem.qml
12@@ -19,11 +23,14 @@
13 SwitchMenuItem.qml
14 )
15
16+include_directories(${ANDR_PROP_INCLUDE_DIRS})
17+
18 add_library(UbuntuWifiPanel MODULE
19 certhandler.cpp
20 plugin.cpp
21 previousnetworkmodel.cpp
22 unitymenumodelstack.cpp
23+ wifi.cpp
24 wifidbushelper.cpp
25 certhandler.h
26 nm_manager_proxy.h
27@@ -35,6 +42,7 @@
28 wifidbushelper.h
29 ${QML_SOURCES}
30 )
31+target_link_libraries(UbuntuWifiPanel ${ANDR_PROP_LDFLAGS})
32 qt5_use_modules(UbuntuWifiPanel Qml Quick DBus)
33
34 set(PLUG_DIR ${PLUGIN_PRIVATE_MODULE_DIR}/Ubuntu/SystemSettings/Wifi)
35
36=== modified file 'plugins/wifi/OtherNetwork.qml'
37--- plugins/wifi/OtherNetwork.qml 2016-07-27 09:33:37 +0000
38+++ plugins/wifi/OtherNetwork.qml 2016-07-27 09:33:37 +0000
39@@ -33,6 +33,10 @@
40 FilePicker {}
41 }
42
43+ UbuntuWifiPanel {
44+ id: panel
45+ }
46+
47 id: otherNetworkDialog
48 objectName: "otherNetworkDialog"
49 anchorToKeyboard: true
50@@ -57,6 +61,8 @@
51 password.length === 10 ||
52 password.length === 13 ||
53 password.length === 26;
54+ case 6: // WAPI Personal
55+ return password.length < 127
56 case 0: // None
57 default:
58 return true;
59@@ -323,13 +329,22 @@
60 ListItems.ItemSelector {
61 id: securityList
62 objectName: "securityList"
63- model: [i18n.tr("None"), // index: 0
64- i18n.tr("WPA & WPA2 Personal"), // index: 1
65- i18n.tr("WPA & WPA2 Enterprise"),// index: 2
66- i18n.tr("WEP"), // index: 3
67- i18n.tr("Dynamic WEP (802.1x)"), // index: 4
68- i18n.tr("LEAP"), // index: 5
69- ]
70+ model: {
71+ var m = [
72+ i18n.tr("None"), // index: 0
73+ i18n.tr("WPA & WPA2 Personal"), // index: 1
74+ i18n.tr("WPA & WPA2 Enterprise"), // index: 2
75+ i18n.tr("WEP"), // index: 3
76+ i18n.tr("Dynamic WEP (802.1x)"), // index: 4
77+ i18n.tr("LEAP") // index: 5
78+ ];
79+ if (panel.wapiSupported || showAllUI) {
80+ m.push(i18n.tr("WAPI Personal")); // index: 6
81+ m.push(i18n.tr("WAPI Certificate")); // index: 7
82+ }
83+ return m;
84+ }
85+
86 selectedIndex: {
87 switch(keyMgmt) {
88 case 'none': // WEP
89@@ -340,6 +355,10 @@
90 return 3;
91 case 'ieee8021x': // Dynamic WEP
92 return 4;
93+ case 'wapi-psk': // WAPI Personal
94+ return 6;
95+ case 'wapi-cert': // WAPI Certificate
96+ return 7;
97 case 'wpa-none': // Ad-Hoc WPA-PSK
98 case 'wpa-psk': // infrastructure WPA-PSK
99 default: // Default is WPA
100@@ -421,7 +440,8 @@
101 font.bold: false
102 color: Theme.palette.normal.baseText
103 visible: (securityList.selectedIndex === 2 ||
104- securityList.selectedIndex === 4 /* WPA or D-WEP */) &&
105+ securityList.selectedIndex === 4 /* WPA or D-WEP */ ||
106+ securityList.selectedIndex === 7 /* WAPI Cert */ ) &&
107 (authList.selectedIndex === 0 ||
108 authList.selectedIndex === 1 ||
109 authList.selectedIndex === 3 ||
110@@ -435,7 +455,8 @@
111 right: parent.right
112 }
113 visible: (securityList.selectedIndex === 2 ||
114- securityList.selectedIndex === 4 /* WPA or D-WEP */) &&
115+ securityList.selectedIndex === 4 /* WPA or D-WEP */ ||
116+ securityList.selectedIndex === 7 /* WAPI Cert */ ) &&
117 (authList.selectedIndex === 0 ||
118 authList.selectedIndex === 1 ||
119 authList.selectedIndex === 3 ||
120@@ -537,7 +558,8 @@
121 font.bold: false
122 color: Theme.palette.normal.baseText
123 visible: (securityList.selectedIndex === 2 ||
124- securityList.selectedIndex === 4) &&
125+ securityList.selectedIndex === 4 ||
126+ securityList.selectedIndex === 7) &&
127 authList.selectedIndex === 0 // only for TLS
128
129 }
130@@ -549,7 +571,8 @@
131 right: parent.right
132 }
133 visible: (securityList.selectedIndex === 2 ||
134- securityList.selectedIndex === 4) &&
135+ securityList.selectedIndex === 4 ||
136+ securityList.selectedIndex === 7) &&
137 authList.selectedIndex === 0 // only for TLS
138 model: cacertListModel
139 expanded: false
140@@ -820,8 +843,9 @@
141 id : password
142 objectName: "password"
143 width: parent.width
144- visible: securityList.selectedIndex !== 0
145-
146+ // Shown if not No Authentication or WAPI Cert.
147+ visible: securityList.selectedIndex !== 0 &&
148+ securityList.selectedIndex !== 7 // WAPI Cert
149 echoMode: passwordVisibleSwitch.checked ?
150 TextInput.Normal : TextInput.Password
151 inputMethodHints: Qt.ImhNoPredictiveText
152
153=== modified file 'plugins/wifi/PageComponent.qml'
154--- plugins/wifi/PageComponent.qml 2016-07-14 13:51:56 +0000
155+++ plugins/wifi/PageComponent.qml 2016-07-27 09:33:37 +0000
156@@ -159,7 +159,8 @@
157 otherNetworLoader.source = "OtherNetwork.qml";
158 PopupUtils.open(otherNetworLoader.item, wifibase, {
159 'ssid': pluginOptions['ssid'],
160- 'bssid': pluginOptions['bssid']
161+ 'bssid': pluginOptions['bssid'],
162+ 'keyMgmt': pluginOptions['key-mgmt']
163 });
164 }
165 }
166
167=== modified file 'plugins/wifi/plugin.cpp'
168--- plugins/wifi/plugin.cpp 2016-04-13 18:49:49 +0000
169+++ plugins/wifi/plugin.cpp 2016-07-27 09:33:37 +0000
170@@ -23,6 +23,7 @@
171 #include "wifidbushelper.h"
172 #include "previousnetworkmodel.h"
173 #include "certhandler.h"
174+#include "wifi.h"
175
176 namespace {
177
178@@ -43,6 +44,7 @@
179 void BackendPlugin::registerTypes(const char *uri)
180 {
181 Q_ASSERT(uri == QLatin1String("Ubuntu.SystemSettings.Wifi"));
182+ qmlRegisterType<Wifi>(uri, 1, 0, "UbuntuWifiPanel");
183 qmlRegisterType<UnityMenuModelStack>(uri, 1, 0, "UnityMenuModelStack");
184 qmlRegisterSingletonType<WifiDbusHelper>(uri, 1, 0, "DbusHelper", dbusProvider);
185 qmlRegisterType<PreviousNetworkModel>(uri, 1, 0, "PreviousNetworkModel");
186
187=== added file 'plugins/wifi/wifi.cpp'
188--- plugins/wifi/wifi.cpp 1970-01-01 00:00:00 +0000
189+++ plugins/wifi/wifi.cpp 2016-07-27 09:33:37 +0000
190@@ -0,0 +1,37 @@
191+/*
192+ * Copyright (C) 2016 Canonical Ltd
193+ *
194+ * This program is free software: you can redistribute it and/or modify
195+ * it under the terms of the GNU General Public License version 3 as
196+ * published by the Free Software Foundation.
197+ *
198+ * This program is distributed in the hope that it will be useful,
199+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
200+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
201+ * GNU General Public License for more details.
202+ *
203+ * You should have received a copy of the GNU General Public License
204+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
205+ *
206+ */
207+
208+#include "wifi.h"
209+
210+#ifdef ANDROID_PROPERTIES
211+#include <hybris/properties/properties.h>
212+#endif
213+
214+Wifi::Wifi(QObject *parent)
215+ : QObject(parent)
216+{}
217+
218+bool Wifi::wapiSupported() const
219+{
220+#ifdef ANDROID_PROPERTIES
221+ char wapi[PROP_VALUE_MAX];
222+ property_get("ubuntu.wapi.supported", wapi, "0");
223+ return (strcmp(wapi, "0") > 0);
224+#else
225+ return false;
226+#endif
227+}
228
229=== added file 'plugins/wifi/wifi.h'
230--- plugins/wifi/wifi.h 1970-01-01 00:00:00 +0000
231+++ plugins/wifi/wifi.h 2016-07-27 09:33:37 +0000
232@@ -0,0 +1,34 @@
233+/*
234+ * Copyright (C) 2016 Canonical Ltd
235+ *
236+ * This program is free software: you can redistribute it and/or modify
237+ * it under the terms of the GNU General Public License version 3 as
238+ * published by the Free Software Foundation.
239+ *
240+ * This program is distributed in the hope that it will be useful,
241+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
242+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
243+ * GNU General Public License for more details.
244+ *
245+ * You should have received a copy of the GNU General Public License
246+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
247+ *
248+ */
249+
250+#ifndef WIFI_H
251+#define WIFI_H
252+
253+#include <QObject>
254+
255+class Wifi : public QObject
256+{
257+ Q_OBJECT
258+ Q_PROPERTY (bool wapiSupported
259+ READ wapiSupported
260+ CONSTANT)
261+public:
262+ explicit Wifi(QObject *parent = 0);
263+ bool wapiSupported() const;
264+};
265+
266+#endif // WIFI_H
267
268=== modified file 'plugins/wifi/wifidbushelper.cpp'
269--- plugins/wifi/wifidbushelper.cpp 2016-07-13 19:43:56 +0000
270+++ plugins/wifi/wifidbushelper.cpp 2016-07-27 09:33:37 +0000
271@@ -48,7 +48,7 @@
272
273 void WifiDbusHelper::connect(QString ssid, int security, int auth, QStringList usernames, QStringList password, QStringList certs, int p2auth)
274 {
275- if((security<0 || security>5) || (auth<0 || auth>4) || (p2auth<0 || p2auth>5)) {
276+ if((security<0 || security>7) || (auth<0 || auth>4) || (p2auth<0 || p2auth>5)) {
277 qWarning() << "Qml and C++ have gotten out of sync. Can't connect.\n";
278 return;
279 }
280@@ -66,6 +66,7 @@
281 QVariantMap wireless;
282 wireless["ssid"] = ssid.toLatin1();
283
284+ // TODO: ENUMS!
285 // security:
286 // 0: None
287 // 1: WPA & WPA2 Personal
288@@ -73,7 +74,9 @@
289 // 3: WEP
290 // 4: Dynamic WEP
291 // 5: LEAP
292- if (security != 0) { // WPA Enterprise or Dynamic WEP
293+ // 6: WAPI Personal
294+ // 7: Wapi Certificate
295+ if (security != 0) { // WPA Enterprise, Dynamic WEP or WAPI
296 wireless["security"] = QStringLiteral("802-11-wireless-security");
297
298 QVariantMap wireless_security;
299@@ -101,14 +104,18 @@
300 wireless_security["auth-alg"] = QStringLiteral("leap");
301 wireless_security["leap-username"] = usernames[0];
302 wireless_security["leap-password"] = password[0];
303+ } else if (security == 6) { // WAPI Personal
304+ wireless_security["key-mgmt"] = QStringLiteral("wapi-psk");
305+ wireless_security["psk"] = password[0];
306+ } else if (security == 7) { // WAPI Cert
307+ wireless_security["key-mgmt"] = QStringLiteral("wapi-cert");
308 }
309 configuration["802-11-wireless-security"] = wireless_security;
310 }
311
312 configuration["802-11-wireless"] = wireless;
313
314- if (security == 2 || security == 4){
315-
316+ if (security == 2 || security == 4 || security == 7){
317 QVariantMap wireless_802_1x;
318 // [802-1x]
319 /*TLS // index: 0
320@@ -116,16 +123,26 @@
321 LEAP // index: 2
322 FAST // index: 3
323 PEAP // index: 4 */
324- wireless_802_1x["identity"] = usernames[0];
325- if (auth != 0) {
326- wireless_802_1x["password"] = password[0];
327- }
328
329 QByteArray cacert( "file://" + certs[0].toUtf8() + '\0');
330 QByteArray clientcert("file://" + certs[1].toUtf8() + '\0');
331 QByteArray privatekey("file://" + certs[2].toUtf8() + '\0');
332 QString pacFile( certs[3] );
333
334+ if (security == 7) { // WAPI Cert
335+ wireless_802_1x["eap"] = QStringList("wapi");
336+ if (certs[0] != "") {wireless_802_1x["ca-cert"] = cacert;}
337+ if (certs[1] != "") {wireless_802_1x["client-cert"] = clientcert;}
338+
339+ // We want auth for WAPI Cert to be N/A.
340+ auth = -1;
341+ }
342+
343+ wireless_802_1x["identity"] = usernames[0];
344+ if (auth > 0) {
345+ wireless_802_1x["password"] = password[0];
346+ }
347+
348 if (auth == 0) { // TLS
349 wireless_802_1x["eap"] = QStringList("tls");
350 if (certs[0] != "") {wireless_802_1x["ca-cert"] = cacert;}
351@@ -176,6 +193,7 @@
352 wireless_802_1x["phase2-auth"] = QStringLiteral("md5");
353 }
354 }
355+
356 configuration["802-1x"] = wireless_802_1x;
357 }
358
359
360=== modified file 'tests/autopilot/ubuntu_system_settings/__init__.py'
361--- tests/autopilot/ubuntu_system_settings/__init__.py 2016-07-27 09:33:37 +0000
362+++ tests/autopilot/ubuntu_system_settings/__init__.py 2016-07-27 09:33:37 +0000
363@@ -1709,6 +1709,10 @@
364 text=_('Dynamic WEP (802.1x)'))
365 elif security == 'leap':
366 item = s_list.wait_select_single('*', text=_('LEAP'))
367+ elif security == 'wapi-psk':
368+ item = s_list.wait_select_single('*', text=_('WAPI Personal'))
369+ elif security == 'wapi-cert':
370+ item = s_list.wait_select_single('*', text=_('WAPI Certificate'))
371 elif security is not None:
372 raise ValueError('security type %s is not valid' % security)
373
374
375=== modified file 'tests/autopilot/ubuntu_system_settings/tests/__init__.py'
376--- tests/autopilot/ubuntu_system_settings/tests/__init__.py 2016-06-20 09:17:54 +0000
377+++ tests/autopilot/ubuntu_system_settings/tests/__init__.py 2016-07-27 09:33:37 +0000
378@@ -29,8 +29,8 @@
379
380 from autopilot import platform
381 from autopilot.matchers import Eventually
382-from dbusmock.templates.networkmanager import (InfrastructureMode,
383- NM80211ApSecurityFlags)
384+from .networkmanager import (InfrastructureMode,
385+ NM80211ApSecurityFlags)
386 from fixtures import EnvironmentVariable
387 from gi.repository import UPowerGlib
388 from testtools.matchers import Equals, NotEquals, GreaterThan
389
390=== modified file 'tests/autopilot/ubuntu_system_settings/tests/networkmanager.py'
391--- tests/autopilot/ubuntu_system_settings/tests/networkmanager.py 2015-08-10 11:01:34 +0000
392+++ tests/autopilot/ubuntu_system_settings/tests/networkmanager.py 2016-07-27 09:33:37 +0000
393@@ -136,6 +136,8 @@
394 NM_802_11_AP_SEC_GROUP_CCMP = 0x00000080
395 NM_802_11_AP_SEC_KEY_MGMT_PSK = 0x00000100
396 NM_802_11_AP_SEC_KEY_MGMT_802_1X = 0x00000200
397+ NM_802_11_AP_SEC_KEY_MGMT_WAPI = 0x00000400
398+ NM_802_11_AP_SEC_KEY_MGMT_WAPI_PSK = 0x00000800
399
400 NAME_MAP = {
401 NM_802_11_AP_SEC_KEY_MGMT_PSK: {
402@@ -145,6 +147,12 @@
403 NM_802_11_AP_SEC_KEY_MGMT_802_1X: {
404 'key-mgmt': 'wpa-eap'
405 },
406+ NM_802_11_AP_SEC_KEY_MGMT_WAPI: {
407+ 'key-mgmt': 'wpa-cert'
408+ },
409+ NM_802_11_AP_SEC_KEY_MGMT_WAPI_PSK: {
410+ 'key-mgmt': 'wapi-psk'
411+ }
412 }
413
414
415@@ -580,7 +588,8 @@
416 settings['802-11-wireless-security'] = (
417 NM80211ApSecurityFlags.NAME_MAP[security])
418
419- if security == NM80211ApSecurityFlags.NM_802_11_AP_SEC_KEY_MGMT_802_1X:
420+ if (security == NM80211ApSecurityFlags.NM_802_11_AP_SEC_KEY_MGMT_802_1X or
421+ security == NM80211ApSecurityFlags.NM_802_11_AP_SEC_KEY_MGMT_WAPI):
422 settings['802-1x'] = config['802-1x']
423
424 self.AddObject(
425
426=== modified file 'tests/autopilot/ubuntu_system_settings/tests/test_wifi.py'
427--- tests/autopilot/ubuntu_system_settings/tests/test_wifi.py 2015-09-04 14:32:16 +0000
428+++ tests/autopilot/ubuntu_system_settings/tests/test_wifi.py 2016-07-27 09:33:37 +0000
429@@ -10,9 +10,10 @@
430 import dbus
431
432 from autopilot.matchers import Eventually
433-from dbusmock.templates.networkmanager import (
434+from .networkmanager import (
435 DEVICE_IFACE, NM80211ApSecurityFlags
436 )
437+from fixtures import EnvironmentVariable
438 from testtools.matchers import Equals
439 from time import sleep
440 from ubuntu_system_settings.tests import (WifiBaseTestCase,
441@@ -179,6 +180,51 @@
442 # is currently not supported.
443
444
445+class WapiEnabledTestCase(WifiBaseTestCase):
446+ """Tests for Wifi (WAPI) Page"""
447+
448+ def setUp(self):
449+ self.useFixture(EnvironmentVariable('USS_SHOW_ALL_UI', '1'))
450+ super(WapiEnabledTestCase, self).setUp()
451+
452+ def test_connect_to_wapi(self):
453+ self.create_access_point(
454+ 'wapi', 'wapi',
455+ security=NM80211ApSecurityFlags.NM_802_11_AP_SEC_KEY_MGMT_WAPI
456+ )
457+
458+ dialog = self.wifi_page.connect_to_hidden_network(
459+ 'wapi', security='wapi-cert',
460+ )
461+
462+ # allow backend to set up listeners
463+ sleep(0.3)
464+
465+ if dialog:
466+ dialog.wait_until_destroyed()
467+
468+ dev = dbus.Interface(self.dbus_con.get_object(
469+ 'org.freedesktop.NetworkManager', self.device_path),
470+ 'org.freedesktop.DBus.Properties')
471+
472+ conn_obj = dev.Get(
473+ 'org.freedesktop.NetworkManager.Device', 'AvailableConnections'
474+ )[0]
475+ conn = dbus.Interface(self.dbus_con.get_object(
476+ 'org.freedesktop.NetworkManager', conn_obj),
477+ 'org.freedesktop.NetworkManager.Settings.Connection')
478+
479+ conn_settings = conn.GetSettings()
480+ wconn = conn_settings['connection']
481+ w802_11_sec = conn_settings['802-11-wireless-security']
482+
483+ w802_1x = conn_settings['802-1x']
484+
485+ self.assertEquals(wconn['type'], '802-11-wireless')
486+ self.assertEquals(w802_11_sec['key-mgmt'], 'wpa-cert')
487+ self.assertIn('wapi', w802_1x['eap'])
488+
489+
490 class WifiDisabledTestCase(WifiBaseTestCase):
491
492 indicatornetwork_parameters = {'actions': {

Subscribers

People subscribed via source and target branches