39
|
1 |
/*
|
|
2 |
* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
|
|
3 |
* All rights reserved.
|
|
4 |
* This component and the accompanying materials are made available
|
|
5 |
* under the terms of "Eclipse Public License v1.0"
|
|
6 |
* which accompanies this distribution, and is available
|
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
|
8 |
*
|
|
9 |
* Initial Contributors:
|
|
10 |
* Nokia Corporation - initial contribution.
|
|
11 |
*
|
|
12 |
* Contributors:
|
|
13 |
*
|
|
14 |
* Description:
|
|
15 |
* EAP Wizard: Private implementation.
|
|
16 |
*/
|
|
17 |
|
|
18 |
// System includes
|
|
19 |
#include <QDebug>
|
|
20 |
#include <QDataStream>
|
|
21 |
#include <HbTranslator>
|
|
22 |
#include <HbParameterLengthLimiter>
|
|
23 |
#include <eapqtconfiginterface.h>
|
|
24 |
#include <eapqtplugininfo.h>
|
|
25 |
#include <eapqtpluginhandle.h>
|
|
26 |
#include <eapqtconfig.h>
|
|
27 |
#include <eapqtpacstoreconfig.h>
|
|
28 |
#include <eapqtcertificateinfo.h>
|
|
29 |
#include <wlanerrorcodes.h>
|
|
30 |
|
|
31 |
// User includes
|
|
32 |
#include "wlanwizardhelper.h"
|
|
33 |
#include "wlanwizardplugin.h"
|
|
34 |
#include "eapwizard.h"
|
|
35 |
#include "eapwizard_p.h"
|
|
36 |
#include "eapwizarduistrings.h"
|
|
37 |
#include "eapwizardpageoutertype.h"
|
|
38 |
#include "eapwizardpagecertca.h"
|
|
39 |
#include "eapwizardpagecertuser.h"
|
|
40 |
#include "eapwizardpageidentity.h"
|
|
41 |
#include "eapwizardpageinnertype.h"
|
|
42 |
#include "eapwizardpageusernamepassword.h"
|
|
43 |
#include "eapwizardpagenewpacstore.h"
|
|
44 |
#include "eapwizardpagepacstorepasswordconfirm.h"
|
|
45 |
#include "OstTraceDefinitions.h"
|
|
46 |
#ifdef OST_TRACE_COMPILER_IN_USE
|
|
47 |
#include "eapwizard_pTraces.h"
|
|
48 |
#endif
|
|
49 |
|
|
50 |
/*!
|
|
51 |
\class EapWizardPrivate
|
|
52 |
\brief Implements the EAP wizard plugin for WLAN wizard.
|
|
53 |
*/
|
|
54 |
|
|
55 |
// External function prototypes
|
|
56 |
|
|
57 |
// Local constants
|
|
58 |
|
|
59 |
|
|
60 |
// ======== LOCAL FUNCTIONS ========
|
|
61 |
|
|
62 |
// ======== MEMBER FUNCTIONS ========
|
|
63 |
|
|
64 |
/*!
|
|
65 |
Constructor of EAP Wizard.
|
43
|
66 |
|
39
|
67 |
@param [in] wizardHelper pointer to the helper instance.
|
|
68 |
*/
|
|
69 |
EapWizardPrivate::EapWizardPrivate(
|
|
70 |
WlanWizardHelper *wizardHelper) :
|
|
71 |
mWizardHelper(wizardHelper),
|
|
72 |
mTranslator(new HbTranslator("eapwizard")),
|
|
73 |
mEapConfIf(new EapQtConfigInterface(
|
|
74 |
EapQtConfigInterface::EapBearerTypeWlan,
|
|
75 |
EapQtConfigInterface::IapIdUndefined))
|
|
76 |
{
|
43
|
77 |
OstTraceFunctionEntry0( EAPWIZARDPRIVATE_EAPWIZARDPRIVATE_ENTRY );
|
39
|
78 |
Q_ASSERT(wizardHelper);
|
|
79 |
createPages();
|
43
|
80 |
OstTraceFunctionExit0( EAPWIZARDPRIVATE_EAPWIZARDPRIVATE_EXIT );
|
39
|
81 |
}
|
|
82 |
|
|
83 |
/*!
|
|
84 |
Destructor.
|
|
85 |
*/
|
|
86 |
EapWizardPrivate::~EapWizardPrivate()
|
|
87 |
{
|
43
|
88 |
OstTraceFunctionEntry0( DUP1_EAPWIZARDPRIVATE_EAPWIZARDPRIVATE_ENTRY );
|
|
89 |
OstTraceFunctionExit0( DUP1_EAPWIZARDPRIVATE_EAPWIZARDPRIVATE_EXIT );
|
39
|
90 |
}
|
|
91 |
|
|
92 |
/*!
|
|
93 |
See EapWizard::summary().
|
|
94 |
*/
|
|
95 |
bool EapWizardPrivate::summary(
|
|
96 |
WlanWizardPlugin::Summary sum,
|
|
97 |
QString &item,
|
|
98 |
QString &value)
|
|
99 |
{
|
43
|
100 |
OstTraceFunctionEntry0( EAPWIZARDPRIVATE_SUMMARY_ENTRY );
|
39
|
101 |
bool ret = false;
|
|
102 |
int outerType = configurations(EapWizardPrivate::OuterType).toInt();
|
|
103 |
|
|
104 |
switch (sum) {
|
|
105 |
case WlanWizardPlugin::SummaryEapInnerType:
|
|
106 |
if (hasInnerMethod()) {
|
|
107 |
item = hbTrId("txt_occ_dblist_inner_eap");
|
|
108 |
value = eapTypeToString(configurations(EapWizardPrivate::InnerType).toInt());
|
|
109 |
ret = true;
|
|
110 |
}
|
|
111 |
break;
|
|
112 |
|
|
113 |
case WlanWizardPlugin::SummaryEapFastProvisioningMode:
|
|
114 |
if (outerType == EapQtPluginHandle::PluginEapFast) {
|
|
115 |
item = hbTrId("txt_occ_dblist_provisioning_mode_for_eapfast");
|
|
116 |
value = hbTrId("txt_occ_dblist_provisioning_mode_for_val_unauthent");
|
|
117 |
ret = true;
|
|
118 |
}
|
|
119 |
break;
|
|
120 |
|
|
121 |
default:
|
|
122 |
Q_ASSERT(sum == WlanWizardPlugin::SummaryEapOuterType);
|
|
123 |
item = hbTrId("txt_occ_dblist_outer_eap");
|
|
124 |
value = eapTypeToString(outerType);
|
|
125 |
ret = true;
|
|
126 |
break;
|
|
127 |
|
|
128 |
}
|
43
|
129 |
OstTraceFunctionExit0( EAPWIZARDPRIVATE_SUMMARY_EXIT );
|
39
|
130 |
return ret;
|
|
131 |
}
|
|
132 |
|
|
133 |
/*!
|
|
134 |
See EapWizard::storeSettings().
|
43
|
135 |
|
39
|
136 |
@return true - ok, false - failed
|
|
137 |
*/
|
|
138 |
bool EapWizardPrivate::storeSettings()
|
|
139 |
{
|
43
|
140 |
OstTraceFunctionEntry0( EAPWIZARDPRIVATE_STORESETTINGS_ENTRY );
|
39
|
141 |
bool ret = false;
|
|
142 |
EapQtPluginHandle outerType(static_cast<EapQtPluginHandle::Plugin>(
|
|
143 |
configurations(OuterType).toInt()));
|
43
|
144 |
|
39
|
145 |
int iapId = mWizardHelper->configuration(WlanWizardHelper::ConfIapId).toInt();
|
43
|
146 |
|
39
|
147 |
if (mEapConfIf->setConfigurationReference(iapId)
|
|
148 |
&& storeOuterTypeSettings(outerType)
|
|
149 |
&& storeInnerTypeSettings(outerType)) {
|
|
150 |
ret = true;
|
|
151 |
}
|
|
152 |
|
43
|
153 |
OstTraceFunctionExit0( EAPWIZARDPRIVATE_STORESETTINGS_EXIT );
|
39
|
154 |
return ret;
|
|
155 |
}
|
|
156 |
|
|
157 |
/*!
|
|
158 |
See WlanWizardPlugin::errorString().
|
43
|
159 |
|
39
|
160 |
Returns EAP spesific error string.
|
|
161 |
*/
|
|
162 |
QString EapWizardPrivate::errorString(int errorCode)
|
|
163 |
{
|
43
|
164 |
OstTraceFunctionEntry0( EAPWIZARDPRIVATE_ERRORSTRING_ENTRY );
|
39
|
165 |
char* textId = NULL;
|
|
166 |
int eapType = EapQtPluginHandle::PluginUndefined;
|
43
|
167 |
|
39
|
168 |
switch (errorCode){
|
|
169 |
case KErrWlanUserRejected:
|
|
170 |
textId = "txt_occ_dialog_1_auth_failed_user_cert_rej";
|
|
171 |
eapType = configurations(OuterType).toInt();
|
|
172 |
break;
|
43
|
173 |
|
39
|
174 |
case KErrWlanUserCertificateExpired:
|
|
175 |
textId = "txt_occ_dialog_1_auth_failed_user_cert_exp";
|
|
176 |
eapType = configurations(OuterType).toInt();
|
|
177 |
break;
|
43
|
178 |
|
39
|
179 |
case KErrWlanServerCertificateExpired:
|
|
180 |
textId = "txt_occ_dialog_1_authentication_failed_server_ce";
|
|
181 |
eapType = configurations(OuterType).toInt();
|
|
182 |
break;
|
43
|
183 |
|
39
|
184 |
case KErrWlanCerficateVerifyFailed:
|
|
185 |
textId = "txt_occ_dialog_1_authentication_failed_could_not";
|
|
186 |
eapType = configurations(OuterType).toInt();
|
|
187 |
break;
|
43
|
188 |
|
39
|
189 |
case KErrWlanNoCipherSuite:
|
|
190 |
textId = "txt_occ_dialog_1_authentication_failed_cipher_su";
|
|
191 |
eapType = configurations(OuterType).toInt();
|
|
192 |
break;
|
43
|
193 |
|
39
|
194 |
case KErrWlanSimNotInstalled:
|
|
195 |
textId = "txt_occ_dialog_1_authentication_failed_check_sim";
|
|
196 |
eapType = configurations(OuterType).toInt();
|
|
197 |
break;
|
43
|
198 |
|
39
|
199 |
case KErrWlanEapFastPacStoreCorrupted:
|
|
200 |
textId = "txt_occ_dialog_1_authentication_failed_reset_pac";
|
|
201 |
eapType = EapQtPluginHandle::PluginEapFast;
|
|
202 |
break;
|
43
|
203 |
|
39
|
204 |
case KErrWlanEapSimFailed:
|
|
205 |
case KErrWlanEapTlsFailed:
|
|
206 |
case KErrWlanEapPeapFailed:
|
|
207 |
case KErrWlanEapAkaFailed:
|
|
208 |
case KErrWlanEapTtlsFailed:
|
|
209 |
case KErrWlanLeapFailed:
|
|
210 |
case KErrWlanNoUserCertificate:
|
|
211 |
case KErrWlanEapFastTunnelCompromiseError:
|
|
212 |
case KErrWlanEapFastUnexpextedTlvExhanged:
|
|
213 |
case KErrWlanEapFastNoPacNorCertsToAuthenticateWithProvDisabled:
|
|
214 |
case KErrWlanEapFastNoMatchingPacForAid:
|
|
215 |
case KErrWlanEapFastAuthFailed:
|
|
216 |
textId = "txt_occ_dialog_1_authentication_failed";
|
|
217 |
eapType = configurations(OuterType).toInt();
|
|
218 |
break;
|
43
|
219 |
|
39
|
220 |
case KErrWlanEapMsChapv2:
|
|
221 |
case KErrWlanEapGtcFailed:
|
|
222 |
textId = "txt_occ_dialog_1_authentication_failed";
|
|
223 |
eapType = configurations(InnerType).toInt();
|
|
224 |
break;
|
43
|
225 |
|
39
|
226 |
case KErrWlanNotSubscribed:
|
|
227 |
case KErrWlanAccessBarred:
|
|
228 |
case KErrWlanPasswordExpired:
|
|
229 |
case KErrWlanNoDialinPermissions:
|
|
230 |
case KErrWlanAccountDisabled:
|
|
231 |
case KErrWlanRestrictedLogonHours:
|
|
232 |
textId = "txt_occ_dialog_1_authentication_failed";
|
|
233 |
if (hasInnerMethod()){
|
|
234 |
eapType = configurations(InnerType).toInt();
|
|
235 |
} else {
|
|
236 |
eapType = configurations(OuterType).toInt();
|
|
237 |
}
|
|
238 |
break;
|
43
|
239 |
|
39
|
240 |
default:
|
|
241 |
// Return empty string
|
|
242 |
break;
|
|
243 |
}
|
43
|
244 |
|
39
|
245 |
QString string;
|
|
246 |
if (textId) {
|
49
|
247 |
string = HbParameterLengthLimiter(textId).arg(eapTypeToString(eapType));
|
39
|
248 |
}
|
43
|
249 |
|
|
250 |
OstTraceFunctionExit0( EAPWIZARDPRIVATE_ERRORSTRING_EXIT );
|
39
|
251 |
return string;
|
|
252 |
}
|
|
253 |
|
|
254 |
/*!
|
|
255 |
Reader method for eap configurations.
|
43
|
256 |
|
39
|
257 |
See ConfigurationId for further details about the data types in QVariant.
|
43
|
258 |
|
39
|
259 |
@param [in] confId Defines what configuration is read.
|
43
|
260 |
|
39
|
261 |
@return configuration value.
|
|
262 |
*/
|
|
263 |
QVariant EapWizardPrivate::configurations(ConfigurationId confId) const
|
|
264 |
{
|
43
|
265 |
OstTraceFunctionEntry0( EAPWIZARDPRIVATE_CONFIGURATIONS_ENTRY );
|
39
|
266 |
Q_ASSERT(mConfigurations.contains(confId));
|
43
|
267 |
|
39
|
268 |
#ifdef OST_TRACE_COMPILER_IN_USE
|
|
269 |
QString tmp;
|
|
270 |
QDebug tmpStream(&tmp );
|
|
271 |
tmpStream << mConfigurations[confId];
|
|
272 |
TPtrC16 string(tmp.utf16(), tmp.length() );
|
43
|
273 |
|
39
|
274 |
OstTraceExt2(
|
|
275 |
TRACE_NORMAL,
|
|
276 |
EAPWIZARDPRIVATE_CONFIGURATIONS,
|
|
277 |
"EapWizardPrivate::configurations;confId=%{ConfigurationId};string=%S",
|
|
278 |
(TUint)confId, string );
|
|
279 |
#endif
|
43
|
280 |
|
|
281 |
OstTraceFunctionExit0( EAPWIZARDPRIVATE_CONFIGURATIONS_EXIT );
|
39
|
282 |
return mConfigurations[confId];
|
|
283 |
}
|
|
284 |
|
|
285 |
/*!
|
|
286 |
Sets EAP configuration value for given configuration identifier.
|
|
287 |
See ConfigurationId for further details about the data types in QVariant.
|
43
|
288 |
|
39
|
289 |
@param [in] confId Configuration Identifier do to be set
|
|
290 |
@param [in] value Value for configuration.
|
|
291 |
*/
|
|
292 |
void EapWizardPrivate::setConfigurations(
|
|
293 |
ConfigurationId confId, const QVariant &value)
|
|
294 |
{
|
43
|
295 |
OstTraceFunctionEntry0( EAPWIZARDPRIVATE_SETCONFIGURATIONS_ENTRY );
|
39
|
296 |
#ifdef OST_TRACE_COMPILER_IN_USE
|
|
297 |
QString tmp;
|
|
298 |
QDebug tmpStream(&tmp );
|
|
299 |
tmpStream << value;
|
|
300 |
TPtrC16 string( tmp.utf16(), tmp.length() );
|
43
|
301 |
|
39
|
302 |
OstTraceExt2(
|
|
303 |
TRACE_NORMAL,
|
|
304 |
EAPWIZARDPRIVATE_SETCONFIGURATIONS,
|
|
305 |
"EapWizardPrivate::setConfigurations;confId=%{ConfigurationId};string=%S",
|
|
306 |
(TUint)confId, string );
|
|
307 |
#endif
|
|
308 |
|
|
309 |
mConfigurations[confId] = value;
|
43
|
310 |
OstTraceFunctionExit0( EAPWIZARDPRIVATE_SETCONFIGURATIONS_EXIT );
|
39
|
311 |
}
|
|
312 |
|
|
313 |
/*!
|
|
314 |
@return pointer to EapQtConfigInterface.
|
|
315 |
*/
|
|
316 |
EapQtConfigInterface* EapWizardPrivate::eapConfigurationInterface() const
|
|
317 |
{
|
43
|
318 |
OstTraceFunctionEntry0( EAPWIZARDPRIVATE_EAPCONFIGURATIONINTERFACE_ENTRY );
|
39
|
319 |
Q_ASSERT(mEapConfIf.data());
|
43
|
320 |
OstTraceFunctionExit0( EAPWIZARDPRIVATE_EAPCONFIGURATIONINTERFACE_EXIT );
|
39
|
321 |
return mEapConfIf.data();
|
|
322 |
}
|
|
323 |
|
|
324 |
/*!
|
|
325 |
Maps given EAP Qt Plugin handle into string.
|
43
|
326 |
|
39
|
327 |
@param [in] id EapQtPluginHandle::Handle, id to be mapped to string.
|
43
|
328 |
|
39
|
329 |
@return EAP String.
|
|
330 |
*/
|
|
331 |
QString EapWizardPrivate::eapTypeToString(int id) const
|
|
332 |
{
|
43
|
333 |
OstTraceFunctionEntry0( EAPWIZARDPRIVATE_EAPTYPETOSTRING_ENTRY );
|
39
|
334 |
QString locId;
|
|
335 |
switch (id) {
|
|
336 |
case EapQtPluginHandle::PluginEapAka:
|
|
337 |
locId = EapWizardUiStrings::EapAka;
|
|
338 |
break;
|
43
|
339 |
|
39
|
340 |
case EapQtPluginHandle::PluginEapFast:
|
|
341 |
locId = EapWizardUiStrings::EapFast;
|
|
342 |
break;
|
43
|
343 |
|
39
|
344 |
case EapQtPluginHandle::PluginLeap:
|
|
345 |
locId = EapWizardUiStrings::Leap;
|
|
346 |
break;
|
43
|
347 |
|
39
|
348 |
case EapQtPluginHandle::PluginPeap:
|
|
349 |
locId = EapWizardUiStrings::Peap;
|
|
350 |
break;
|
43
|
351 |
|
39
|
352 |
case EapQtPluginHandle::PluginEapSim:
|
|
353 |
locId = EapWizardUiStrings::EapSim;
|
|
354 |
break;
|
43
|
355 |
|
39
|
356 |
case EapQtPluginHandle::PluginEapTls:
|
|
357 |
locId = EapWizardUiStrings::EapTls;
|
|
358 |
break;
|
43
|
359 |
|
39
|
360 |
case EapQtPluginHandle::PluginEapTtls:
|
|
361 |
locId = EapWizardUiStrings::EapTtls;
|
|
362 |
break;
|
43
|
363 |
|
39
|
364 |
case EapQtPluginHandle::PluginEapMschapv2:
|
|
365 |
locId = EapWizardUiStrings::EapMschapv2;
|
|
366 |
break;
|
43
|
367 |
|
39
|
368 |
case EapQtPluginHandle::PluginEapGtc:
|
|
369 |
locId = EapWizardUiStrings::EapGtc;
|
|
370 |
break;
|
43
|
371 |
|
39
|
372 |
case EapQtPluginHandle::PluginPap:
|
|
373 |
locId = EapWizardUiStrings::Pap;
|
|
374 |
break;
|
43
|
375 |
|
39
|
376 |
default:
|
|
377 |
// Invalid enum
|
|
378 |
Q_ASSERT(EapQtPluginHandle::PluginPlainMschapv2 == id);
|
|
379 |
locId = EapWizardUiStrings::Mschapv2;
|
|
380 |
break;
|
|
381 |
}
|
43
|
382 |
|
|
383 |
OstTraceFunctionExit0( EAPWIZARDPRIVATE_EAPTYPETOSTRING_EXIT );
|
39
|
384 |
return locId;
|
|
385 |
}
|
|
386 |
|
|
387 |
/*!
|
|
388 |
Accessor to WLAN Wizard Helper objects.
|
43
|
389 |
|
39
|
390 |
@return a pointer to helper object.
|
|
391 |
*/
|
|
392 |
WlanWizardHelper *EapWizardPrivate::wizardHelper() const
|
|
393 |
{
|
43
|
394 |
OstTraceFunctionEntry0( EAPWIZARDPRIVATE_WIZARDHELPER_ENTRY );
|
39
|
395 |
Q_ASSERT(mWizardHelper);
|
43
|
396 |
OstTraceFunctionExit0( EAPWIZARDPRIVATE_WIZARDHELPER_EXIT );
|
39
|
397 |
return mWizardHelper;
|
|
398 |
}
|
|
399 |
|
|
400 |
/*!
|
|
401 |
Creates EAP Wizard pages and add those to the wizard framework.
|
|
402 |
*/
|
|
403 |
void EapWizardPrivate::createPages()
|
|
404 |
{
|
43
|
405 |
OstTraceFunctionEntry0( EAPWIZARDPRIVATE_CREATEPAGES_ENTRY );
|
39
|
406 |
mWizardHelper->addPage(
|
|
407 |
EapWizardPage::PageOuterType,
|
|
408 |
new EapWizardPageOuterType(this));
|
43
|
409 |
|
39
|
410 |
mWizardHelper->addPage(
|
|
411 |
EapWizardPage::PageCertificateCa,
|
|
412 |
new EapWizardPageCertCa(this));
|
43
|
413 |
|
39
|
414 |
mWizardHelper->addPage(
|
|
415 |
EapWizardPage::PageCertificateUser,
|
|
416 |
new EapWizardPageCertUser(this));
|
43
|
417 |
|
39
|
418 |
mWizardHelper->addPage(
|
|
419 |
EapWizardPage::PageIdentity,
|
|
420 |
new EapWizardPageIdentity(this));
|
43
|
421 |
|
39
|
422 |
mWizardHelper->addPage(
|
|
423 |
EapWizardPage::PageInnerTypeEapTtls,
|
|
424 |
new EapWizardPageInnerType(
|
|
425 |
this,
|
|
426 |
EapQtPluginHandle::PluginEapTtls));
|
43
|
427 |
|
39
|
428 |
mWizardHelper->addPage(
|
|
429 |
EapWizardPage::PageInnerTypePeap,
|
|
430 |
new EapWizardPageInnerType(
|
|
431 |
this,
|
|
432 |
EapQtPluginHandle::PluginPeap));
|
43
|
433 |
|
39
|
434 |
mWizardHelper->addPage(
|
|
435 |
EapWizardPage::PageUsernamePassword,
|
|
436 |
new EapWizardPageUsernamePassword(this));
|
43
|
437 |
|
39
|
438 |
mWizardHelper->addPage(
|
|
439 |
EapWizardPage::PageNewPacStorePassword,
|
|
440 |
new EapWizardPageNewPacStore(this));
|
43
|
441 |
|
39
|
442 |
mWizardHelper->addPage(
|
|
443 |
EapWizardPage::PagePromptPacStorePassword,
|
|
444 |
new EapWizardPagePacStorePasswordConfirm(this));
|
43
|
445 |
OstTraceFunctionExit0( EAPWIZARDPRIVATE_CREATEPAGES_EXIT );
|
39
|
446 |
}
|
|
447 |
|
|
448 |
/*!
|
|
449 |
Check whether selected outer type has inner method.
|
43
|
450 |
|
39
|
451 |
@return true if inner method exists, false otherwise.
|
|
452 |
*/
|
|
453 |
bool EapWizardPrivate::hasInnerMethod() const
|
|
454 |
{
|
43
|
455 |
OstTraceFunctionEntry0( EAPWIZARDPRIVATE_HASINNERMETHOD_ENTRY );
|
39
|
456 |
int outerType = configurations(EapWizardPrivate::OuterType).toInt();
|
|
457 |
bool ret = false;
|
43
|
458 |
|
|
459 |
switch (outerType) {
|
39
|
460 |
case EapQtPluginHandle::PluginEapTtls:
|
|
461 |
case EapQtPluginHandle::PluginPeap:
|
|
462 |
case EapQtPluginHandle::PluginEapFast:
|
|
463 |
ret = true;
|
|
464 |
break;
|
|
465 |
}
|
43
|
466 |
|
|
467 |
OstTraceFunctionExit0( EAPWIZARDPRIVATE_HASINNERMETHOD_EXIT );
|
39
|
468 |
return ret;
|
|
469 |
}
|
|
470 |
|
|
471 |
|
|
472 |
/*
|
|
473 |
Handles TLS methods (PEAP, EAP-TLS and EAP-TTLS) settings.
|
43
|
474 |
|
39
|
475 |
Stores configurations to eapConf
|
43
|
476 |
|
39
|
477 |
@param [in,out] eapConf configuration is written to this object.
|
|
478 |
@param [in] outerType Outer EAP method
|
|
479 |
*/
|
|
480 |
void EapWizardPrivate::handleTlsMethodsSettings(
|
|
481 |
EapQtConfig &eapConf,
|
|
482 |
EapQtPluginHandle &outerType)
|
|
483 |
{
|
43
|
484 |
OstTraceFunctionEntry0( EAPWIZARDPRIVATE_HANDLETLSMETHODSSETTINGS_ENTRY );
|
39
|
485 |
// Common stuff for all tls methods
|
|
486 |
eapConf.setValue(EapQtConfig::UseIdentityPrivacy, false);
|
|
487 |
eapConf.setValue(EapQtConfig::VerifyServerRealm, false);
|
|
488 |
eapConf.setValue(EapQtConfig::ClientAuthenticationRequired, false);
|
|
489 |
eapConf.setValue(EapQtConfig::UsernameAutomatic, configurations(TunnelUsernameAutomatic));
|
|
490 |
eapConf.setValue(EapQtConfig::Username, configurations(TunnelUsername));
|
|
491 |
eapConf.setValue(EapQtConfig::RealmAutomatic, configurations(TunnelRealmAutomatic));
|
|
492 |
eapConf.setValue(EapQtConfig::Realm, configurations(TunnelRealm));
|
43
|
493 |
|
39
|
494 |
QVariant certVariant = configurations(CertificateCa);
|
43
|
495 |
|
39
|
496 |
if (certVariant.canConvert<EapQtCertificateInfo> ()) {
|
|
497 |
QList<QVariant> caCerts;
|
|
498 |
caCerts.append(certVariant);
|
|
499 |
eapConf.setValue(EapQtConfig::AuthorityCertificate, caCerts);
|
|
500 |
eapConf.setValue(EapQtConfig::AuthorityCertificateAutomatic, false);
|
|
501 |
} else {
|
|
502 |
eapConf.setValue(EapQtConfig::AuthorityCertificateAutomatic, true);
|
|
503 |
}
|
43
|
504 |
|
39
|
505 |
// type specific configurations
|
|
506 |
if (outerType == EapQtPluginHandle::PluginEapTls) {
|
|
507 |
QList<QVariant> userCerts;
|
|
508 |
userCerts.append(configurations(CertificateUser));
|
|
509 |
eapConf.setValue(EapQtConfig::ClientAuthenticationRequired, true);
|
|
510 |
eapConf.setValue(EapQtConfig::UserCertificate, userCerts);
|
43
|
511 |
|
39
|
512 |
} else if (outerType == EapQtPluginHandle::PluginPeap) {
|
43
|
513 |
|
39
|
514 |
switch (configurations(InnerType).toInt()) {
|
|
515 |
case EapQtPluginHandle::PluginEapMschapv2:
|
|
516 |
// EAP-MSCHAPv2: enable v0 only
|
|
517 |
eapConf.setValue(EapQtConfig::PeapVersion0Allowed, true);
|
|
518 |
eapConf.setValue(EapQtConfig::PeapVersion1Allowed, false);
|
|
519 |
break;
|
43
|
520 |
|
39
|
521 |
case EapQtPluginHandle::PluginEapGtc:
|
|
522 |
// EAP-GTC: enable v1 only
|
|
523 |
eapConf.setValue(EapQtConfig::PeapVersion0Allowed, false);
|
|
524 |
eapConf.setValue(EapQtConfig::PeapVersion1Allowed, true);
|
|
525 |
break;
|
|
526 |
}
|
|
527 |
eapConf.setValue(EapQtConfig::PeapVersion2Allowed, false);
|
|
528 |
}
|
43
|
529 |
OstTraceFunctionExit0( EAPWIZARDPRIVATE_HANDLETLSMETHODSSETTINGS_EXIT );
|
39
|
530 |
}
|
|
531 |
|
|
532 |
/*!
|
|
533 |
Handles configurations for EAP-FAST.
|
43
|
534 |
|
39
|
535 |
@param [in,out] eapConf EAP Configuration
|
43
|
536 |
|
39
|
537 |
@param false in case of failure.
|
|
538 |
*/
|
|
539 |
bool EapWizardPrivate::handleEapFastSettings(EapQtConfig &eapConf)
|
|
540 |
{
|
43
|
541 |
OstTraceFunctionEntry0( EAPWIZARDPRIVATE_HANDLEEAPFASTSETTINGS_ENTRY );
|
39
|
542 |
bool ret = true;
|
|
543 |
EapQtPacStoreConfig pacStoreConf;
|
43
|
544 |
|
39
|
545 |
eapConf.setValue(EapQtConfig::ProvisioningModeAuthenticated, false);
|
|
546 |
eapConf.setValue(EapQtConfig::ProvisioningModeUnauthenticated, true);
|
|
547 |
eapConf.setValue(EapQtConfig::VerifyServerRealm, false);
|
|
548 |
eapConf.setValue(EapQtConfig::UseIdentityPrivacy, false);
|
|
549 |
|
|
550 |
switch (configurations(PacStoreState).toInt()) {
|
|
551 |
case EapQtPacStoreConfig::PacStoreStateStoreNotExists:
|
|
552 |
case EapQtPacStoreConfig::PacStoreStatePasswordRequired:
|
|
553 |
pacStoreConf.setValue(
|
|
554 |
EapQtPacStoreConfig::PacStorePassword,
|
|
555 |
configurations(PacStorePassword));
|
43
|
556 |
|
39
|
557 |
pacStoreConf.setValue(
|
|
558 |
EapQtPacStoreConfig::PacStoreSavePassword,
|
|
559 |
true);
|
43
|
560 |
|
39
|
561 |
if (!mEapConfIf->savePacStoreConfiguration(pacStoreConf)) {
|
|
562 |
// no cleaning required
|
|
563 |
ret = false;
|
|
564 |
}
|
|
565 |
break;
|
43
|
566 |
|
39
|
567 |
default:
|
|
568 |
// Do nothing
|
|
569 |
break;
|
|
570 |
}
|
43
|
571 |
|
|
572 |
OstTraceFunctionExit0( EAPWIZARDPRIVATE_HANDLEEAPFASTSETTINGS_EXIT );
|
39
|
573 |
return ret;
|
|
574 |
}
|
|
575 |
|
|
576 |
/*!
|
|
577 |
Handles configurations for EAP-AKA and EAP-SIM.
|
43
|
578 |
|
39
|
579 |
@param [in,out] eapConf EAP Configuration
|
|
580 |
*/
|
|
581 |
void EapWizardPrivate::handleEapAkaSimSettings(EapQtConfig &eapConf)
|
|
582 |
{
|
43
|
583 |
OstTraceFunctionEntry0( EAPWIZARDPRIVATE_HANDLEEAPAKASIMSETTINGS_ENTRY );
|
39
|
584 |
eapConf.setValue(EapQtConfig::UsernameAutomatic, true);
|
|
585 |
eapConf.setValue(EapQtConfig::RealmAutomatic, true);
|
43
|
586 |
OstTraceFunctionExit0( EAPWIZARDPRIVATE_HANDLEEAPAKASIMSETTINGS_EXIT );
|
39
|
587 |
}
|
|
588 |
|
|
589 |
/*!
|
|
590 |
Handles configurations for LEAP.
|
43
|
591 |
|
39
|
592 |
@param [in,out] eapConf EAP Configuration
|
|
593 |
*/
|
|
594 |
void EapWizardPrivate::handleLeapSettings(EapQtConfig &eapConf)
|
|
595 |
{
|
43
|
596 |
OstTraceFunctionEntry0( EAPWIZARDPRIVATE_HANDLELEAPSETTINGS_ENTRY );
|
39
|
597 |
eapConf.setValue(EapQtConfig::UsernameAutomatic, false);
|
|
598 |
eapConf.setValue(EapQtConfig::Username, configurations(Username));
|
|
599 |
eapConf.setValue(EapQtConfig::PasswordPrompt, false);
|
|
600 |
eapConf.setValue(EapQtConfig::Password, configurations(Password));
|
43
|
601 |
OstTraceFunctionExit0( EAPWIZARDPRIVATE_HANDLELEAPSETTINGS_EXIT );
|
39
|
602 |
}
|
|
603 |
|
|
604 |
/*!
|
|
605 |
Store outer type settings.
|
43
|
606 |
|
39
|
607 |
@param outerType reference to outertype
|
43
|
608 |
|
39
|
609 |
@return false in case of failure.
|
|
610 |
*/
|
|
611 |
bool EapWizardPrivate::storeOuterTypeSettings(EapQtPluginHandle &outerType)
|
|
612 |
{
|
43
|
613 |
OstTraceFunctionEntry0( EAPWIZARDPRIVATE_STOREOUTERTYPESETTINGS_ENTRY );
|
39
|
614 |
EapQtConfig eapConf;
|
43
|
615 |
|
39
|
616 |
// 1. Store outer type settings
|
|
617 |
switch (outerType.pluginId()) {
|
|
618 |
case EapQtPluginHandle::PluginEapTtls:
|
|
619 |
case EapQtPluginHandle::PluginPeap:
|
|
620 |
case EapQtPluginHandle::PluginEapTls:
|
|
621 |
handleTlsMethodsSettings(eapConf, outerType);
|
|
622 |
break;
|
43
|
623 |
|
39
|
624 |
case EapQtPluginHandle::PluginEapFast:
|
|
625 |
if (!handleEapFastSettings(eapConf)) {
|
43
|
626 |
OstTraceFunctionExit0( EAPWIZARDPRIVATE_STOREOUTERTYPESETTINGS_EXIT );
|
39
|
627 |
return false;
|
|
628 |
}
|
|
629 |
break;
|
43
|
630 |
|
39
|
631 |
case EapQtPluginHandle::PluginEapAka:
|
|
632 |
case EapQtPluginHandle::PluginEapSim:
|
|
633 |
handleEapAkaSimSettings(eapConf);
|
|
634 |
break;
|
43
|
635 |
|
39
|
636 |
default:
|
|
637 |
Q_ASSERT(outerType == EapQtPluginHandle::PluginLeap);
|
|
638 |
handleLeapSettings(eapConf);
|
|
639 |
break;
|
|
640 |
}
|
43
|
641 |
|
39
|
642 |
if (hasInnerMethod()) {
|
|
643 |
EapQtPluginHandle inner = static_cast<EapQtPluginHandle::Plugin>(
|
|
644 |
configurations(InnerType).toInt());
|
43
|
645 |
|
39
|
646 |
QList<QVariant> innerType;
|
|
647 |
innerType.append(qVariantFromValue(inner));
|
|
648 |
eapConf.setValue(EapQtConfig::InnerType, innerType);
|
|
649 |
}
|
43
|
650 |
|
39
|
651 |
// store outer type configurations
|
|
652 |
if (!mEapConfIf->saveConfiguration(outerType, eapConf)){
|
|
653 |
mEapConfIf->deleteConfiguration();
|
43
|
654 |
OstTraceFunctionExit0( DUP1_EAPWIZARDPRIVATE_STOREOUTERTYPESETTINGS_EXIT );
|
39
|
655 |
return false;
|
|
656 |
}
|
43
|
657 |
|
39
|
658 |
QList<EapQtPluginHandle> selectedOuterTypes;
|
|
659 |
selectedOuterTypes.append(outerType);
|
|
660 |
if (!mEapConfIf->setSelectedOuterTypes(selectedOuterTypes)){
|
|
661 |
mEapConfIf->deleteConfiguration();
|
43
|
662 |
OstTraceFunctionExit0( DUP2_EAPWIZARDPRIVATE_STOREOUTERTYPESETTINGS_EXIT );
|
39
|
663 |
return false;
|
|
664 |
}
|
43
|
665 |
|
|
666 |
OstTraceFunctionExit0( DUP3_EAPWIZARDPRIVATE_STOREOUTERTYPESETTINGS_EXIT );
|
39
|
667 |
return true;
|
|
668 |
}
|
|
669 |
|
|
670 |
|
|
671 |
/*!
|
|
672 |
Store inner type settings if exists.
|
43
|
673 |
|
39
|
674 |
@param outerType reference to outertype
|
43
|
675 |
|
39
|
676 |
@return false in case of failure.
|
|
677 |
*/
|
|
678 |
bool EapWizardPrivate::storeInnerTypeSettings(EapQtPluginHandle &outerType)
|
|
679 |
{
|
43
|
680 |
OstTraceFunctionEntry0( EAPWIZARDPRIVATE_STOREINNERTYPESETTINGS_ENTRY );
|
39
|
681 |
bool ret = true;
|
43
|
682 |
|
39
|
683 |
if (hasInnerMethod()) {
|
|
684 |
EapQtPluginHandle inner = static_cast<EapQtPluginHandle::Plugin>(
|
|
685 |
configurations(InnerType).toInt());
|
43
|
686 |
|
39
|
687 |
// All inner methods supported by wizard use password / username.
|
|
688 |
EapQtConfig eapConfInner;
|
|
689 |
eapConfInner.setValue(EapQtConfig::OuterType, qVariantFromValue(outerType));
|
|
690 |
eapConfInner.setValue(EapQtConfig::UsernameAutomatic, false);
|
|
691 |
eapConfInner.setValue(EapQtConfig::Username, configurations(Username));
|
|
692 |
eapConfInner.setValue(EapQtConfig::PasswordPrompt, false);
|
|
693 |
eapConfInner.setValue(EapQtConfig::Password, configurations(Password));
|
43
|
694 |
|
39
|
695 |
if (!mEapConfIf->saveConfiguration(inner, eapConfInner)){
|
|
696 |
mEapConfIf->deleteConfiguration();
|
|
697 |
ret = false;
|
|
698 |
}
|
|
699 |
}
|
43
|
700 |
OstTraceFunctionExit0( EAPWIZARDPRIVATE_STOREINNERTYPESETTINGS_EXIT );
|
39
|
701 |
return ret;
|
|
702 |
}
|