|
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 method configuration QT interface |
|
16 * |
|
17 */ |
|
18 |
|
19 /* |
|
20 * %version: 49 % |
|
21 */ |
|
22 |
|
23 // System includes |
|
24 #include <QDir> |
|
25 #include <QList> |
|
26 #include <QVariant> |
|
27 #include <QPluginLoader> |
|
28 #include <HbTranslator> |
|
29 #include <QLocale> |
|
30 #include <QCoreApplication> |
|
31 #include <QDebug> |
|
32 #include <cmmanager.h> |
|
33 #include <cmpluginwlandef.h> |
|
34 #include <EapGeneralSettings.h> |
|
35 #include <eapqtplugininfo.h> |
|
36 #include <eapqtcertificateinfo.h> |
|
37 |
|
38 // User includes |
|
39 #include "cpeapplugininterface.h" |
|
40 #include "eapqtconfiginterface_p.h" |
|
41 #include "eapqtvalidatorpassword.h" |
|
42 #include "eapqtvalidatorusername.h" |
|
43 #include "eapqtvalidatorrealm.h" |
|
44 #include "eapqtvalidatorpacstorepassword.h" |
|
45 #include "eapqtvalidatorpacstorepasswordconfirm.h" |
|
46 |
|
47 /*! |
|
48 * \class EapQtConfigInterfacePrivate |
|
49 * \brief Private implementation of EAP QT configuration interface |
|
50 */ |
|
51 |
|
52 // External function prototypes |
|
53 |
|
54 // Local constants |
|
55 static const QString eapTranslationFile("cpeapuiplugins"); |
|
56 |
|
57 // ======== LOCAL FUNCTIONS ======== |
|
58 |
|
59 // ======== MEMBER FUNCTIONS ======== |
|
60 |
|
61 EapQtConfigInterfacePrivate::EapQtConfigInterfacePrivate() : |
|
62 mValidatorInstance(true), |
|
63 mLastOuterHandle(EapQtPluginHandle::PluginUndefined), |
|
64 mTranslator(NULL), |
|
65 mEapGsIf(NULL), |
|
66 mEapTypeIf(NULL), |
|
67 mIapId(0), |
|
68 mEapBearer(ELan), |
|
69 mEapDbIndex(EapQtConfigInterface::IapIdUndefined), |
|
70 mEapDbIndexValid(false) |
|
71 { |
|
72 qDebug("EapQtConfigInterfacePrivate() - created validator instance, this = 0x%08x", this); |
|
73 } |
|
74 |
|
75 EapQtConfigInterfacePrivate::EapQtConfigInterfacePrivate( |
|
76 const EapQtConfigInterface::EapBearerType bearerType, const int iapId) : |
|
77 mValidatorInstance(false), |
|
78 mLastOuterHandle(EapQtPluginHandle::PluginUndefined), |
|
79 mTranslator(NULL), |
|
80 mEapGsIf(NULL), |
|
81 mEapTypeIf(NULL), |
|
82 mIapId(iapId), |
|
83 mEapBearer(ELan), |
|
84 mEapDbIndex(EapQtConfigInterface::IapIdUndefined), |
|
85 mEapDbIndexValid(false) |
|
86 { |
|
87 qDebug("EapQtConfigInterfacePrivate() - creating non-validator instance, this = 0x%08x", this); |
|
88 |
|
89 switch (bearerType) { |
|
90 case EapQtConfigInterface::EapBearerTypeVpn: |
|
91 mEapBearer = EVpn; |
|
92 break; |
|
93 default: |
|
94 // All others default to EapQtConfigInterface::EapBearerTypeWlan i.e. ELan |
|
95 mEapBearer = ELan; |
|
96 } |
|
97 |
|
98 if (!setEapDbIndex(iapId)) { |
|
99 qDebug("ERROR: EapQtConfigInterfacePrivate() - setIapId failed, bearer = %d, index = %d", |
|
100 mEapBearer, iapId); |
|
101 shutdown(); |
|
102 // throw an exception |
|
103 qt_symbian_throwIfError(KErrNotFound); |
|
104 } |
|
105 |
|
106 // load plugins after everything else is ok |
|
107 qDebug("EapQtConfigInterfacePrivate() - load plugins"); |
|
108 loadPlugins(); |
|
109 |
|
110 qDebug("EapQtConfigInterfacePrivate() - ends"); |
|
111 } |
|
112 |
|
113 EapQtConfigInterfacePrivate::~EapQtConfigInterfacePrivate() |
|
114 { |
|
115 qDebug("EapQtConfigInterfacePrivate::~EapQtConfigInterfacePrivate(), this = 0x%08x", this); |
|
116 |
|
117 shutdown(); |
|
118 } |
|
119 |
|
120 void EapQtConfigInterfacePrivate::shutdown() |
|
121 { |
|
122 qDebug("EapQtConfigInterfacePrivate::shutdown(), this = 0x%08x", this); |
|
123 |
|
124 mOuterEapsOn.Close(); |
|
125 mOuterEapsOff.Close(); |
|
126 |
|
127 // cleanup Ecom |
|
128 REComSession::FinalClose(); |
|
129 |
|
130 // mTranslator gets deleted automatically (QScopedPointer) |
|
131 // mEapTypeIf gets deleted automatically (QScopedPointer) |
|
132 // mEapGsIf gets deleted automatically (QScopedPointer) |
|
133 } |
|
134 |
|
135 bool EapQtConfigInterfacePrivate::setConfigurationReference(const int iapId) |
|
136 { |
|
137 qDebug("EapQtConfigInterfacePrivate::setConfigurationReference - requested id: %d, this = 0x%08x", iapId, this); |
|
138 |
|
139 checkInstanceThrowing(); |
|
140 return setEapDbIndex(iapId); |
|
141 } |
|
142 |
|
143 bool EapQtConfigInterfacePrivate::setEapDbIndex(const int iapId) |
|
144 { |
|
145 |
|
146 qDebug("EapQtConfigInterfacePrivate::setIapId - requested id: %d, this = 0x%08x", iapId, this); |
|
147 |
|
148 |
|
149 // optimization: do not re-create the interface if the reference does |
|
150 // not change and mEapGsIf exists already |
|
151 |
|
152 // WLAN reference is checked after setEapWlanDbIndex below since iapId may be |
|
153 // different than WLAN service ID |
|
154 |
|
155 // case for EapQtConfigInterface::IapIdUndefined i.e. setIapId was called |
|
156 // with a negative id last time and now again |
|
157 if (!mEapDbIndexValid && !mEapGsIf.isNull() && iapId < 0) { |
|
158 qDebug( |
|
159 "EapQtConfigInterfacePrivate::setIapId - interface created for IapIdUndefined already"); |
|
160 return true; |
|
161 } |
|
162 |
|
163 // case for VPN (or any other bearer) in which iap id equals EAP db index |
|
164 if (mEapBearer != ELan && mEapDbIndexValid && !mEapGsIf.isNull() && iapId == mEapDbIndex) { |
|
165 qDebug( |
|
166 "EapQtConfigInterfacePrivate::setIapId - interface created for requested IAP ID for VPN already"); |
|
167 return true; |
|
168 } |
|
169 |
|
170 // save the current id for checking if WLAN reference changes or not |
|
171 TInt previousEapDbIndex = mEapDbIndex; |
|
172 bool wlanIndexOk = true; |
|
173 |
|
174 // allow accessing certain methods with negative iapId |
|
175 if (iapId < 0) { |
|
176 // set to zero to be able to create EAP server instances |
|
177 mEapDbIndex = 0; |
|
178 mEapDbIndexValid = false; |
|
179 } |
|
180 // for real usage iapId must not be negative |
|
181 else { |
|
182 // for VPN |
|
183 mIapId = iapId; |
|
184 mEapDbIndex = iapId; |
|
185 mEapDbIndexValid = true; |
|
186 |
|
187 // for WLAN |
|
188 if (mEapBearer == ELan) { |
|
189 // get WLAN service ID as the reference |
|
190 mEapDbIndexValid = setEapWlanDbIndex(iapId); |
|
191 wlanIndexOk = mEapDbIndexValid; |
|
192 // do not re-create if the interface is ok for the new (i.e. same) index already |
|
193 if (!mEapGsIf.isNull() && mEapDbIndex == previousEapDbIndex) { |
|
194 qDebug() << "EapQtConfigInterfacePrivate::setIapId - interface" |
|
195 << "created for requested IAP ID for WLAN already"; |
|
196 return true; |
|
197 } |
|
198 |
|
199 } |
|
200 } |
|
201 |
|
202 // delete possibly existing instances |
|
203 mEapGsIf.reset(NULL); |
|
204 mEapTypeIf.reset(NULL); |
|
205 |
|
206 mCurrentServerEapType = *EapExpandedTypeNone.GetType(); |
|
207 mLastOuterHandle = EapQtPluginHandle::PluginUndefined; |
|
208 |
|
209 if (!wlanIndexOk && mEapBearer == ELan) { |
|
210 // setEapWlanDbIndex was called and failed |
|
211 qDebug("ERROR: EapQtConfigInterfacePrivate::setIapId() - setEapWlanDbIndex failed"); |
|
212 return false; |
|
213 } |
|
214 |
|
215 qDebug( |
|
216 "EapQtConfigInterfacePrivate::setIapId() - calls CEapGeneralSettings::NewL(), bearer = %d, index = %d", |
|
217 mEapBearer, mEapDbIndex); |
|
218 |
|
219 // load EAP general settings interface |
|
220 CEapGeneralSettings* tmp = NULL; |
|
221 TRAPD(err, tmp = CEapGeneralSettings::NewL(mEapBearer, mEapDbIndex)); |
|
222 if (err != KErrNone) { |
|
223 qDebug("ERROR: EapQtConfigInterfacePrivate::setIapId - CEapGeneralSettings::NewL() failed"); |
|
224 mEapDbIndexValid = false; |
|
225 return false; |
|
226 } |
|
227 |
|
228 // set to the created instance |
|
229 mEapGsIf.reset(tmp); |
|
230 |
|
231 return true; |
|
232 } |
|
233 |
|
234 bool EapQtConfigInterfacePrivate::setEapWlanDbIndex(const int iapId) |
|
235 { |
|
236 qDebug("EapQtConfigInterfacePrivate::setEapWlanDbIndex - requested id: %d, this = 0x%08x", iapId, this); |
|
237 |
|
238 RCmManager cmm; |
|
239 TRAPD(err, cmm.OpenL()); |
|
240 if (err != KErrNone) { |
|
241 qDebug("ERROR: EapQtConfigInterfacePrivate::setEapWlanDbIndex - cmm.OpenL() failed", |
|
242 mEapBearer, iapId); |
|
243 mEapDbIndex = EapQtConfigInterface::IapIdUndefined; |
|
244 mIapId = 0; |
|
245 return false; |
|
246 } |
|
247 |
|
248 TRAP(err, mEapDbIndex = cmm.GetConnectionMethodInfoIntL(iapId, CMManager::EWlanServiceId)); |
|
249 if (err != KErrNone) { |
|
250 qDebug( |
|
251 "ERROR: EapQtConfigInterfacePrivate::setEapWlanDbIndex - cmm.GetConnectionMethodInfoIntL() failed", |
|
252 mEapBearer, iapId); |
|
253 cmm.Close(); |
|
254 mEapDbIndex = EapQtConfigInterface::IapIdUndefined; |
|
255 mIapId = 0; |
|
256 return false; |
|
257 } |
|
258 |
|
259 cmm.Close(); |
|
260 |
|
261 qDebug("EapQtConfigInterfacePrivate::setEapWlanDbIndex - obtained WLAN service id: %d", |
|
262 mEapDbIndex); |
|
263 |
|
264 return true; |
|
265 } |
|
266 |
|
267 void EapQtConfigInterfacePrivate::checkInstanceThrowing() const |
|
268 { |
|
269 qDebug() << "EapQtConfigInterfacePrivate::checkInstanceThrowing() - mValidatorInstance:" |
|
270 << mValidatorInstance; |
|
271 |
|
272 if (mValidatorInstance) { |
|
273 qDebug( |
|
274 "ERROR: EapQtConfigInterfacePrivate::checkInstanceThrowing - method not supported by this instance"); |
|
275 qt_symbian_throwIfError(KErrNotSupported); |
|
276 } |
|
277 } |
|
278 |
|
279 void EapQtConfigInterfacePrivate::appendEapTypes(const RArray<TEapExpandedType>* const eapTypes, |
|
280 QList<QByteArray>* const eapList) |
|
281 { |
|
282 qDebug("EapQtConfigInterfacePrivate::appendEapTypes(), this = 0x%08x", this); |
|
283 |
|
284 Q_ASSERT(eapTypes); |
|
285 Q_ASSERT(eapList); |
|
286 |
|
287 qDebug("EapQtConfigInterfacePrivate - appendEapTypes, EAP count = %d", eapTypes->Count()); |
|
288 |
|
289 QByteArray tmpEap; |
|
290 for (int ind = 0; ind < eapTypes->Count(); ind++) { |
|
291 tmpEap.append(reinterpret_cast<const char*> ((*eapTypes)[ind].GetValue().Ptr()), |
|
292 (*eapTypes)[ind].GetValue().Length()); |
|
293 eapList->append(tmpEap); |
|
294 qDebug() << "EapQtConfigInterfacePrivate - appendEapTypes added EAP: " << tmpEap.toHex(); |
|
295 tmpEap.clear(); |
|
296 } |
|
297 } |
|
298 |
|
299 QList<EapQtPluginInfo> EapQtConfigInterfacePrivate::supportedOuterTypes() |
|
300 { |
|
301 qDebug("EapQtConfigInterfacePrivate::supportedOuterTypes(), this = 0x%08x", this); |
|
302 |
|
303 checkInstanceThrowing(); |
|
304 |
|
305 if (mEapGsIf.isNull()) { |
|
306 qDebug("ERROR: EapQtConfigInterfacePrivate::supportedOuterTypes() - mEapGsIf is NULL"); |
|
307 mOuterEapsOn.Reset(); |
|
308 mOuterEapsOff.Reset(); |
|
309 // return empty list |
|
310 mSupportedOuterTypes.clear(); |
|
311 return mSupportedOuterTypes; |
|
312 } |
|
313 |
|
314 // get outer EAPs from EAP server, |
|
315 // returned in two lists: enabled and disabled outer EAPs |
|
316 // do this always as the list might have changed and mOuterEapsOn/Off are needed in |
|
317 // other methods |
|
318 |
|
319 mOuterEapsOn.Reset(); |
|
320 mOuterEapsOff.Reset(); |
|
321 |
|
322 qDebug("EapQtConfigInterfacePrivate::supportedOuterTypes() - calls GetEapMethods()"); |
|
323 |
|
324 TUint err = mEapGsIf->GetEapMethods(mOuterEapsOn, mOuterEapsOff); |
|
325 if (err != KErrNone) { |
|
326 qDebug("ERROR: EapQtConfigInterfacePrivate::supportedOuterTypes() - GetEapMethods failed"); |
|
327 mOuterEapsOn.Reset(); |
|
328 mOuterEapsOff.Reset(); |
|
329 // return empty list |
|
330 mSupportedOuterTypes.clear(); |
|
331 return mSupportedOuterTypes; |
|
332 } |
|
333 |
|
334 // optimization: collect the list only once per instance life time |
|
335 // since no new EAPs will appear to the combination of mOuterEapsOn and mOuterEapsOff |
|
336 if (mSupportedOuterTypes.count() > 0) { |
|
337 qDebug( |
|
338 "EapQtConfigInterfacePrivate - supportedOuterTypes: supported EAPs already listed, return stored list"); |
|
339 return mSupportedOuterTypes; |
|
340 } |
|
341 |
|
342 qDebug("EapQtConfigInterfacePrivate - supportedOuterTypes: copy response to QList"); |
|
343 |
|
344 // copy response to qlist for easier comparison |
|
345 QList<QByteArray> outerEaps; |
|
346 |
|
347 appendEapTypes(&mOuterEapsOn, &outerEaps); |
|
348 appendEapTypes(&mOuterEapsOff, &outerEaps); |
|
349 |
|
350 qDebug("EapQtConfigInterfacePrivate - supportedOuterTypes: EAP server outer type count: %d", |
|
351 outerEaps.count()); |
|
352 |
|
353 qDebug("EapQtConfigInterfacePrivate - supportedOuterTypes: collected UI plugin count: %d", |
|
354 mPluginInfos.count()); |
|
355 |
|
356 // set mSupportedOuterTypes to contain only EAPs that both UI and EAP server support |
|
357 QByteArray tmpEap; |
|
358 for (int ind = 0; ind < mPluginInfos.count(); ind++) { |
|
359 tmpEap = mPluginInfos[ind].pluginHandle().type().eapExpandedData(); |
|
360 if (outerEaps.contains(tmpEap)) { |
|
361 mSupportedOuterTypes.append(mPluginInfos[ind]); |
|
362 qDebug() << "EapQtConfigInterfacePrivate - supportedOuterTypes: appended EAP: " |
|
363 << tmpEap.toHex(); |
|
364 } |
|
365 } |
|
366 |
|
367 // sort the list |
|
368 qSort(mSupportedOuterTypes.begin(), mSupportedOuterTypes.end(), |
|
369 EapQtConfigInterfacePrivate::pluginLessThan); |
|
370 |
|
371 qDebug("EapQtConfigInterfacePrivate - supportedOuterTypes: supported EAP count: %d", |
|
372 mSupportedOuterTypes.count()); |
|
373 |
|
374 return mSupportedOuterTypes; |
|
375 } |
|
376 |
|
377 // checks if UI plugins support supplied eapType and returns the |
|
378 // index (in mPluginInfos) of the supporting plugin |
|
379 bool EapQtConfigInterfacePrivate::isUiSupported(const QByteArray &eapType, int &pluginIndex) const |
|
380 { |
|
381 qDebug("EapQtConfigInterfacePrivate::isUiSupported(), this = 0x%08x", this); |
|
382 |
|
383 bool ret = false; |
|
384 for (int ind = 0; ind < mPluginInfos.count(); ind++) { |
|
385 qDebug("EapQtConfigInterfacePrivate::isUiSupported() - checking index: %d", ind); |
|
386 pluginIndex = ind; |
|
387 if (eapType == mPluginInfos[ind].pluginHandle().type().eapExpandedData()) { |
|
388 qDebug("EapQtConfigInterfacePrivate::isUiSupported() - ui supported!"); |
|
389 ret = true; |
|
390 break; |
|
391 } |
|
392 } |
|
393 return ret; |
|
394 } |
|
395 |
|
396 QList<EapQtPluginInfo> EapQtConfigInterfacePrivate::supportedInnerTypes( |
|
397 const EapQtPluginHandle &outer) |
|
398 { |
|
399 qDebug("EapQtConfigInterfacePrivate::supportedInnerTypes(), this = 0x%08x", this); |
|
400 |
|
401 checkInstanceThrowing(); |
|
402 |
|
403 // check if we already have up-to-date data |
|
404 if (mLastOuterHandle == outer) { |
|
405 return mSupportedInnerTypes; |
|
406 } |
|
407 |
|
408 // clear previous query result |
|
409 mSupportedInnerTypes.clear(); |
|
410 mLastOuterHandle = EapQtPluginHandle::PluginUndefined; |
|
411 |
|
412 qDebug() |
|
413 << "EapQtConfigInterfacePrivate::supportedInnerTypes() - calls isSupportedOuterType for: " |
|
414 << outer.type().eapExpandedData().toHex(); |
|
415 |
|
416 // check if the queried outer EAP is supported |
|
417 if (!isSupportedOuterType(outer)) { |
|
418 qDebug() |
|
419 << "ERROR: EapQtConfigInterfacePrivate::supportedInnerTypes() - queried outer type not supported: " |
|
420 << outer.type().eapExpandedData().toHex(); |
|
421 // return empty list |
|
422 return mSupportedInnerTypes; |
|
423 } |
|
424 |
|
425 qDebug("EapQtConfigInterfacePrivate::supportedInnerTypes() - calls getEapTypeIf"); |
|
426 |
|
427 // get outer EAP settings interface |
|
428 getEapTypeIf(outer); |
|
429 if (mEapTypeIf.isNull()) { |
|
430 qDebug("ERROR: EapQtConfigInterfacePrivate::supportedInnerTypes() - getEapTypeIf failed"); |
|
431 // return empty list |
|
432 return mSupportedInnerTypes; |
|
433 } |
|
434 |
|
435 // get outer EAP settings |
|
436 EAPSettings eapSettings; |
|
437 TRAPD(err, mEapTypeIf->GetConfigurationL(eapSettings)); |
|
438 // getEapTypeIf has set mCurrentServerEapType correctly for comparison |
|
439 if (err != KErrNone || eapSettings.iEAPExpandedType != mCurrentServerEapType) { |
|
440 qDebug("ERROR: EapQtConfigInterfacePrivate::supportedInnerTypes - GetConfigurationL failed"); |
|
441 // clear the instance so that the next attempt starts from scratch |
|
442 mEapTypeIf.reset(NULL); |
|
443 // return empty list |
|
444 return mSupportedInnerTypes; |
|
445 } |
|
446 |
|
447 // store inner EAPs supported by EAP server |
|
448 QList<QByteArray> innerEaps; |
|
449 appendEapTypes(&(eapSettings.iEnabledEncapsulatedEAPExpandedTypes), &innerEaps); |
|
450 appendEapTypes(&(eapSettings.iDisabledEncapsulatedEAPExpandedTypes), &innerEaps); |
|
451 |
|
452 int pluginIndex = 0; |
|
453 for (int ind = 0; ind < innerEaps.count(); ind++) { |
|
454 // report only EAPs which do have an UI plugin |
|
455 if (isUiSupported(innerEaps[ind], pluginIndex)) { |
|
456 mSupportedInnerTypes.append(mPluginInfos[pluginIndex]); |
|
457 qDebug() << "EapQtConfigInterfacePrivate::supportedInnerTypes - added inner EAP: " |
|
458 << innerEaps[ind].toHex(); |
|
459 } |
|
460 } |
|
461 |
|
462 mLastOuterHandle = outer; |
|
463 |
|
464 // sort the list |
|
465 qSort(mSupportedInnerTypes.begin(), mSupportedInnerTypes.end(), |
|
466 EapQtConfigInterfacePrivate::pluginLessThan); |
|
467 |
|
468 qDebug("EapQtConfigInterfacePrivate - supportedInnerTypes: supported EAP count: %d", |
|
469 mSupportedInnerTypes.count()); |
|
470 |
|
471 return mSupportedInnerTypes; |
|
472 } |
|
473 |
|
474 void EapQtConfigInterfacePrivate::copyCertificateInfo( |
|
475 const RPointerArray<EapCertificateEntry>* const certEntries, |
|
476 QList<EapQtCertificateInfo>* const certInfos) |
|
477 { |
|
478 qDebug("EapQtConfigInterfacePrivate::copyCertificateInfo(), this = 0x%08x", this); |
|
479 |
|
480 Q_ASSERT(certEntries); |
|
481 Q_ASSERT(certInfos); |
|
482 |
|
483 certInfos->clear(); |
|
484 |
|
485 EapQtCertificateInfo cert; |
|
486 TKeyIdentifier subjectKeyId; |
|
487 const TDes* text = 0; |
|
488 int ind = 0; |
|
489 |
|
490 for (ind = 0; ind < certEntries->Count(); ind++) { |
|
491 |
|
492 // cleanup cert |
|
493 cert.clear(); |
|
494 |
|
495 EapCertificateEntry* certPtr = (*certEntries)[ind]; |
|
496 |
|
497 qDebug() << "EapQtConfigInterfacePrivate - copyCertificateInfo *** certificate starts *** "; |
|
498 |
|
499 if (certPtr->GetSubjectNamePresent() != EFalse) { |
|
500 |
|
501 text = certPtr->GetSubjectName(); |
|
502 cert.setValue(EapQtCertificateInfo::SubjectName, QString::fromUtf16(text->Ptr(), |
|
503 text->Length())); |
|
504 |
|
505 qDebug() << "EapQtConfigInterfacePrivate - copyCertificateInfo SubjectName: " |
|
506 << QString::fromUtf16(text->Ptr(), text->Length()); |
|
507 } |
|
508 if (certPtr->GetIssuerNamePresent() != EFalse) { |
|
509 |
|
510 text = certPtr->GetIssuerName(); |
|
511 cert.setValue(EapQtCertificateInfo::IssuerName, QString::fromUtf16(text->Ptr(), |
|
512 text->Length())); |
|
513 |
|
514 qDebug() << "EapQtConfigInterfacePrivate - copyCertificateInfo IssuerName: " |
|
515 << QString::fromUtf16(text->Ptr(), text->Length()); |
|
516 } |
|
517 if (certPtr->GetSerialNumberPresent() != EFalse) { |
|
518 |
|
519 text = certPtr->GetSerialNumber(); |
|
520 cert.setValue(EapQtCertificateInfo::SerialNumber, QString::fromUtf16(text->Ptr(), |
|
521 text->Length())); |
|
522 |
|
523 qDebug() << "EapQtConfigInterfacePrivate - copyCertificateInfo SerialNumber: " |
|
524 << QString::fromUtf16(text->Ptr(), text->Length()); |
|
525 } |
|
526 if (certPtr->GetSubjectKeyIdPresent() != EFalse) { |
|
527 |
|
528 subjectKeyId = certPtr->GetSubjectKeyId(); |
|
529 cert.setValue(EapQtCertificateInfo::SubjectKeyId, QByteArray( |
|
530 reinterpret_cast<const char*> (subjectKeyId.Ptr()), subjectKeyId.Length())); |
|
531 |
|
532 qDebug() << "EapQtConfigInterfacePrivate - copyCertificateInfo SubjectKeyId: " |
|
533 << (QByteArray(reinterpret_cast<const char*> (subjectKeyId.Ptr()), |
|
534 subjectKeyId.Length())).toHex(); |
|
535 } |
|
536 if (certPtr->GetThumbprintPresent() != EFalse) { |
|
537 |
|
538 text = certPtr->GetThumbprint(); |
|
539 cert.setValue(EapQtCertificateInfo::ThumbPrint, QString::fromUtf16(text->Ptr(), |
|
540 text->Length())); |
|
541 |
|
542 qDebug() << "EapQtConfigInterfacePrivate - copyCertificateInfo ThumbPrint: " |
|
543 << QString::fromUtf16(text->Ptr(), text->Length()); |
|
544 } |
|
545 if (certPtr->GetLabelPresent() != EFalse) { |
|
546 |
|
547 text = certPtr->GetLabel(); |
|
548 cert.setValue(EapQtCertificateInfo::CertificateLabel, QString::fromUtf16(text->Ptr(), |
|
549 text->Length())); |
|
550 |
|
551 qDebug() << "EapQtConfigInterfacePrivate - copyCertificateInfo CertificateLabel: " |
|
552 << QString::fromUtf16(text->Ptr(), text->Length()); |
|
553 } |
|
554 |
|
555 qDebug() << "EapQtConfigInterfacePrivate - copyCertificateInfo *** certificate ends *** "; |
|
556 |
|
557 certInfos->append(cert); |
|
558 |
|
559 } |
|
560 } |
|
561 |
|
562 bool EapQtConfigInterfacePrivate::fetchCertificates(QList<EapQtCertificateInfo>* const caInfos, |
|
563 QList<EapQtCertificateInfo>* const clientInfos) |
|
564 { |
|
565 qDebug("EapQtConfigInterfacePrivate::fetchCertificates(), this = 0x%08x", this); |
|
566 |
|
567 Q_ASSERT(caInfos != NULL || clientInfos != NULL); |
|
568 Q_ASSERT(!mEapGsIf.isNull()); |
|
569 |
|
570 TInt err(KErrNone); |
|
571 RPointerArray<EapCertificateEntry> clientCerts; |
|
572 RPointerArray<EapCertificateEntry> caCerts; |
|
573 |
|
574 err = mEapGsIf->GetCertificateLists(clientCerts, caCerts); |
|
575 if (err != KErrNone) { |
|
576 qDebug("EapQtConfigInterfacePrivate - fetchCertificates failed: %d", err); |
|
577 caCerts.ResetAndDestroy(); |
|
578 clientCerts.ResetAndDestroy(); |
|
579 return false; |
|
580 } |
|
581 |
|
582 qDebug("user cert count: %d, CA cert count: %d", clientCerts.Count(), caCerts.Count()); |
|
583 |
|
584 if (caInfos != NULL) { |
|
585 copyCertificateInfo(&caCerts, caInfos); |
|
586 } |
|
587 if (clientInfos != NULL) { |
|
588 copyCertificateInfo(&clientCerts, clientInfos); |
|
589 } |
|
590 |
|
591 caCerts.ResetAndDestroy(); |
|
592 clientCerts.ResetAndDestroy(); |
|
593 return true; |
|
594 } |
|
595 |
|
596 bool EapQtConfigInterfacePrivate::updateCertificates() { |
|
597 |
|
598 qDebug("EapQtConfigInterfacePrivate::updateCertificates(), this = 0x%08x", this); |
|
599 |
|
600 checkInstanceThrowing(); |
|
601 |
|
602 // empty current state |
|
603 mCaCertificates.clear(); |
|
604 mUserCertificates.clear(); |
|
605 |
|
606 return fetchCertificates(&mCaCertificates, &mUserCertificates); |
|
607 } |
|
608 |
|
609 QList<EapQtCertificateInfo> EapQtConfigInterfacePrivate::certificateAuthorityCertificates() |
|
610 { |
|
611 qDebug("EapQtConfigInterfacePrivate::certificateAuthorityCertificates(), this = 0x%08x", this); |
|
612 |
|
613 checkInstanceThrowing(); |
|
614 |
|
615 // update only if the list is empty |
|
616 if(mCaCertificates.length() == 0) { |
|
617 qDebug() << "EapQtConfigInterfacePrivate::certificateAuthorityCertificates() - updates certificate lists"; |
|
618 updateCertificates(); |
|
619 } |
|
620 |
|
621 return mCaCertificates; |
|
622 } |
|
623 |
|
624 QList<EapQtCertificateInfo> EapQtConfigInterfacePrivate::userCertificates() |
|
625 { |
|
626 qDebug("EapQtConfigInterfacePrivate::userCertificates(), this = 0x%08x", this); |
|
627 |
|
628 // use the CA certificates method, it will update both the lists |
|
629 // if CA list is empty |
|
630 (void) certificateAuthorityCertificates(); |
|
631 return mUserCertificates; |
|
632 } |
|
633 |
|
634 void EapQtConfigInterfacePrivate::getEapTypeIf(const EapQtPluginHandle &pluginHandle) |
|
635 { |
|
636 qDebug("EapQtConfigInterfacePrivate::getEapTypeIf(), this = 0x%08x", this); |
|
637 |
|
638 // dig up the EAP type in TEapExpandedType format |
|
639 TEapExpandedType eapServerType; |
|
640 QByteArray eapType = pluginHandle.type().eapExpandedData(); |
|
641 TInt err(KErrNone); |
|
642 |
|
643 qDebug() << "EapQtConfigInterfacePrivate - getEapTypeIf: wanted EAP type: " << eapType.toHex(); |
|
644 |
|
645 // no need to check if this is successful, |
|
646 // CEapType::NewL call will handle errors |
|
647 (void) eapServerType.SetValue(eapType.data(), eapType.length()); |
|
648 |
|
649 // slight optimization, load interface only if it does not exist or the EAP type changes |
|
650 if (mEapTypeIf.isNull() || mCurrentServerEapType != eapServerType) { |
|
651 |
|
652 qDebug("EapQtConfigInterfacePrivate - getEapTypeIf deletes previous instance"); |
|
653 |
|
654 // delete previous instance |
|
655 mEapTypeIf.reset(NULL); |
|
656 mCurrentServerEapType = eapServerType; |
|
657 |
|
658 qDebug("EapQtConfigInterfacePrivate - getEapTypeIf calls CEapType::NewL()"); |
|
659 |
|
660 // trap all leaves |
|
661 CEapType* tmp = NULL; |
|
662 TRAP(err, tmp = CEapType::NewL(mEapBearer, mEapDbIndex, mCurrentServerEapType)); |
|
663 if (err != KErrNone) { |
|
664 qDebug( |
|
665 "ERROR: EapQtConfigInterfacePrivate - getEapTypeIf CEapType::NewL failed with error: %d", |
|
666 err); |
|
667 mCurrentServerEapType = *EapExpandedTypeNone.GetType(); |
|
668 } |
|
669 mEapTypeIf.reset(tmp); |
|
670 } |
|
671 |
|
672 // always clear the tunnelling type state just in case some earlier call has set it |
|
673 if (!mEapTypeIf.isNull()) { |
|
674 mEapTypeIf->SetTunnelingType(*EapExpandedTypeNone.GetType()); |
|
675 } |
|
676 |
|
677 } |
|
678 |
|
679 // in config: |
|
680 // if OuterType is defined, the configuration for pluginHandle is set inside this OuterType |
|
681 // if OuterType is not defined, pluginHandle is for an outer type |
|
682 // if InnerType is defined, the defined inner types in config are activated for pluginHandle |
|
683 // if InnerType is not defined, the pluginHandle does not activate any inner type (or they do not exist) |
|
684 bool EapQtConfigInterfacePrivate::saveConfiguration(const EapQtPluginHandle &pluginHandle, |
|
685 const EapQtConfig &config) |
|
686 { |
|
687 qDebug("EapQtConfigInterfacePrivate::saveConfiguration(), this = 0x%08x", this); |
|
688 |
|
689 checkInstanceThrowing(); |
|
690 |
|
691 if (!mEapDbIndexValid) { |
|
692 qDebug() << "ERROR: Database reference not valid, call setConfigurationReference first!"; |
|
693 return false; |
|
694 } |
|
695 |
|
696 // set tunneling type & check if the requested EAP is supported |
|
697 // if we are configuring outer type, OuterType == QVariant::Invalid or |
|
698 // EapQtPluginHandle::PluginUndefined |
|
699 |
|
700 EapQtPluginHandle tmpOuterHandle; |
|
701 QVariant varValue = config.value(EapQtConfig::OuterType); |
|
702 if (varValue != QVariant::Invalid && !(varValue.value<EapQtPluginHandle> () == EapQtPluginHandle::PluginUndefined)) { |
|
703 tmpOuterHandle = varValue.value<EapQtPluginHandle> (); |
|
704 // check if supported |
|
705 if(!isSupportedInnerType(tmpOuterHandle, pluginHandle)) { |
|
706 qDebug("ERROR: EapQtConfigInterfacePrivate::saveConfiguration() - not supported outer/inner type combination"); |
|
707 return false; |
|
708 } |
|
709 } |
|
710 else { |
|
711 tmpOuterHandle = EapQtPluginHandle::PluginUndefined; |
|
712 // check if supported |
|
713 if(!isSupportedOuterType(pluginHandle)) { |
|
714 qDebug("ERROR: EapQtConfigInterfacePrivate::saveConfiguration() - not supported outer type"); |
|
715 return false; |
|
716 } |
|
717 } |
|
718 |
|
719 getEapTypeIf(pluginHandle); |
|
720 if (mEapTypeIf.isNull()) { |
|
721 qDebug("ERROR: EapQtConfigInterfacePrivate::saveConfiguration() - getEapTypeIf failed"); |
|
722 return false; |
|
723 } |
|
724 |
|
725 TEapExpandedType tmpOuterEap; |
|
726 tmpOuterEap.SetValue(tmpOuterHandle.type().eapExpandedData().data(), |
|
727 tmpOuterHandle.type().eapExpandedData().length()); |
|
728 |
|
729 qDebug() << "EapQtConfigInterfacePrivate::saveConfiguration() - sets tunnelling type to: " |
|
730 << tmpOuterHandle.type().eapExpandedData().toHex(); |
|
731 |
|
732 mEapTypeIf->SetTunnelingType(tmpOuterEap); |
|
733 |
|
734 // set EAP type here |
|
735 QByteArray eapType = pluginHandle.type().eapExpandedData(); |
|
736 |
|
737 // copy config to EAP settings, |
|
738 // no need to check if this is successful, |
|
739 // SetConfigurationL call will handle errors |
|
740 EAPSettings eapSettings; |
|
741 (void) eapSettings.iEAPExpandedType.SetValue(eapType.data(), eapType.length()); |
|
742 |
|
743 // copy the rest of the settings in the function |
|
744 copyToEapSettings(config, eapSettings); |
|
745 // store settings |
|
746 TRAPD(err, mEapTypeIf->SetConfigurationL(eapSettings)); |
|
747 if (err != KErrNone) { |
|
748 qDebug("ERROR: EapQtConfigInterfacePrivate - saveConfiguration: SetConfigurationL failed"); |
|
749 // clear the instance so that the next attempt starts from scratch |
|
750 mEapTypeIf.reset(NULL); |
|
751 mCurrentServerEapType = *EapExpandedTypeNone.GetType(); |
|
752 return false; |
|
753 } |
|
754 |
|
755 return true; |
|
756 } |
|
757 |
|
758 // config must be empty when calling |
|
759 bool EapQtConfigInterfacePrivate::readConfiguration(const EapQtPluginHandle &outerHandle, |
|
760 const EapQtPluginHandle &pluginHandle, EapQtConfig &config) |
|
761 { |
|
762 qDebug("EapQtConfigInterfacePrivate::readConfiguration(), this = 0x%08x", this); |
|
763 |
|
764 // clear input |
|
765 config.clear(); |
|
766 |
|
767 checkInstanceThrowing(); |
|
768 |
|
769 if (!mEapDbIndexValid) { |
|
770 qDebug() << "ERROR: Database reference not valid, call setConfigurationReference first!"; |
|
771 return false; |
|
772 } |
|
773 |
|
774 // check EAP type support |
|
775 if(!(outerHandle == EapQtPluginHandle::PluginUndefined)) { |
|
776 if(!isSupportedInnerType(outerHandle, pluginHandle)) { |
|
777 qDebug("ERROR: EapQtConfigInterfacePrivate::readConfiguration() - not supported outer/inner type combination"); |
|
778 return false; |
|
779 } |
|
780 } else { |
|
781 if(!isSupportedOuterType(pluginHandle)) { |
|
782 qDebug("ERROR: EapQtConfigInterfacePrivate::readConfiguration() - not supported outer type"); |
|
783 return false; |
|
784 } |
|
785 } |
|
786 |
|
787 getEapTypeIf(pluginHandle); |
|
788 if (mEapTypeIf.isNull()) { |
|
789 qDebug("ERROR: EapQtConfigInterfacePrivate::readConfiguration - getEapTypeIf failed"); |
|
790 return false; |
|
791 } |
|
792 |
|
793 // set tunneling type |
|
794 // if we are configuring outer type, outerHandle == EapQtPluginHandle::PluginUndefined |
|
795 // and calling SetTunnelingType is also ok |
|
796 TEapExpandedType tmpEap; |
|
797 tmpEap.SetValue(outerHandle.type().eapExpandedData().data(), |
|
798 outerHandle.type().eapExpandedData().length()); |
|
799 |
|
800 qDebug() << "EapQtConfigInterfacePrivate::readConfiguration - sets tunnelling type to: " |
|
801 << outerHandle.type().eapExpandedData().toHex(); |
|
802 |
|
803 mEapTypeIf->SetTunnelingType(tmpEap); |
|
804 |
|
805 // always set OuterType, |
|
806 // set to EapQtPluginHandle::PluginUndefined if no outer type specified |
|
807 config.setValue(EapQtConfig::OuterType, qVariantFromValue(outerHandle)); |
|
808 |
|
809 qDebug("EapQtConfigInterfacePrivate::readConfiguration - calls GetConfigurationL()"); |
|
810 |
|
811 // trap all leaves |
|
812 EAPSettings eapSettings; |
|
813 TRAPD(err, mEapTypeIf->GetConfigurationL(eapSettings)); |
|
814 |
|
815 // check if failed or something strange happened (incorrect EAP type settings received) |
|
816 if (err != KErrNone || eapSettings.iEAPExpandedType != mCurrentServerEapType) { |
|
817 qDebug("ERROR: EapQtConfigInterfacePrivate - readConfiguration: GetConfigurationL failed"); |
|
818 // clear the instance so that the next attempt starts from scratch |
|
819 mEapTypeIf.reset(NULL); |
|
820 mCurrentServerEapType = *EapExpandedTypeNone.GetType(); |
|
821 // nothing to be set to config |
|
822 return false; |
|
823 } |
|
824 copyFromEapSettings(eapSettings, config); |
|
825 return true; |
|
826 } |
|
827 |
|
828 bool EapQtConfigInterfacePrivate::convertToBool(TBool value) |
|
829 { |
|
830 return (value != EFalse ? true : false); |
|
831 } |
|
832 |
|
833 TBool EapQtConfigInterfacePrivate::convertToTbool(bool value) |
|
834 { |
|
835 return (value ? ETrue : EFalse); |
|
836 } |
|
837 |
|
838 void EapQtConfigInterfacePrivate::copyToEapSettings(const EapQtConfig &config, EAPSettings &eapSettings) |
|
839 { |
|
840 qDebug("EapQtConfigInterfacePrivate::copyToEapSettings(), this = 0x%08x", this); |
|
841 |
|
842 int ind = 0; |
|
843 |
|
844 QVariant varValue = config.value(EapQtConfig::UsernameAutomatic); |
|
845 if (varValue.type() == QVariant::Bool) { |
|
846 eapSettings.iUseAutomaticUsernamePresent = ETrue; |
|
847 eapSettings.iUseAutomaticUsername = convertToTbool(varValue.toBool()); |
|
848 qDebug() << "EapQtConfigInterfacePrivate - copyToEapSettings UsernameAutomatic: " |
|
849 << varValue.toBool(); |
|
850 } |
|
851 |
|
852 varValue = config.value(EapQtConfig::AuthorityCertificateAutomatic); |
|
853 if (varValue.type() == QVariant::Bool) { |
|
854 eapSettings.iUseAutomaticCACertificatePresent = ETrue; |
|
855 eapSettings.iUseAutomaticCACertificate = convertToTbool(varValue.toBool()); |
|
856 qDebug() |
|
857 << "EapQtConfigInterfacePrivate - copyToEapSettings AuthorityCertificateAutomatic: " |
|
858 << varValue.toBool(); |
|
859 } |
|
860 |
|
861 varValue = config.value(EapQtConfig::Username); |
|
862 // do not copy if too large string |
|
863 if (varValue.type() == QVariant::String && varValue.toString().count() <= StringMaxLength) { |
|
864 // QString::utf16 returns a null terminated string |
|
865 eapSettings.iUsername.Copy(varValue.toString().utf16()); |
|
866 eapSettings.iUsernamePresent = ETrue; |
|
867 qDebug() << "EapQtConfigInterfacePrivate - copyToEapSettings Username: " |
|
868 << varValue.toString(); |
|
869 } |
|
870 |
|
871 varValue = config.value(EapQtConfig::PasswordPrompt); |
|
872 if (varValue.type() == QVariant::Bool) { |
|
873 eapSettings.iShowPassWordPromptPresent = ETrue; |
|
874 eapSettings.iShowPassWordPrompt = convertToTbool(varValue.toBool()); |
|
875 qDebug() << "EapQtConfigInterfacePrivate - copyToEapSettings PasswordPrompt: " |
|
876 << varValue.toBool(); |
|
877 } |
|
878 |
|
879 varValue = config.value(EapQtConfig::Password); |
|
880 // do not copy if too large string |
|
881 if (varValue.type() == QVariant::String && varValue.toString().count() <= StringMaxLength) { |
|
882 //QString::utf16 returns a null terminated string |
|
883 eapSettings.iPassword.Copy(varValue.toString().utf16()); |
|
884 eapSettings.iPasswordPresent = ETrue; |
|
885 qDebug() << "EapQtConfigInterfacePrivate - copyToEapSettings Password: " |
|
886 << varValue.toString(); |
|
887 } |
|
888 |
|
889 varValue = config.value(EapQtConfig::PasswordClear); |
|
890 if (varValue.type() == QVariant::Bool) { |
|
891 eapSettings.iPasswordExistPresent = ETrue; |
|
892 eapSettings.iPasswordExist = convertToTbool(varValue.toBool()); |
|
893 qDebug() << "EapQtConfigInterfacePrivate - copyToEapSettings PasswordClear: " |
|
894 << varValue.toBool(); |
|
895 } |
|
896 |
|
897 varValue = config.value(EapQtConfig::RealmAutomatic); |
|
898 if (varValue.type() == QVariant::Bool) { |
|
899 eapSettings.iUseAutomaticRealmPresent = ETrue; |
|
900 eapSettings.iUseAutomaticRealm = convertToTbool(varValue.toBool()); |
|
901 qDebug() << "EapQtConfigInterfacePrivate - copyToEapSettings RealmAutomatic: " |
|
902 << varValue.toBool(); |
|
903 } |
|
904 |
|
905 varValue = config.value(EapQtConfig::Realm); |
|
906 // do not copy if too large string |
|
907 if (varValue.type() == QVariant::String && varValue.toString().count() <= StringMaxLength) { |
|
908 // QString::utf16 returns a null terminated string |
|
909 eapSettings.iRealm.Copy(varValue.toString().utf16()); |
|
910 eapSettings.iRealmPresent = ETrue; |
|
911 qDebug() << "EapQtConfigInterfacePrivate - copyToEapSettings Realm: " |
|
912 << varValue.toString(); |
|
913 } |
|
914 |
|
915 varValue = config.value(EapQtConfig::UsePseudonyms); |
|
916 if (varValue.type() == QVariant::Bool) { |
|
917 eapSettings.iUsePseudonymsPresent = ETrue; |
|
918 eapSettings.iUsePseudonyms = convertToTbool(varValue.toBool()); |
|
919 qDebug() << "EapQtConfigInterfacePrivate - copyToEapSettings UsePseudonyms: " |
|
920 << varValue.toBool(); |
|
921 } |
|
922 |
|
923 varValue = config.value(EapQtConfig::VerifyServerRealm); |
|
924 if (varValue.type() == QVariant::Bool) { |
|
925 eapSettings.iVerifyServerRealmPresent = ETrue; |
|
926 eapSettings.iVerifyServerRealm = convertToTbool(varValue.toBool()); |
|
927 qDebug() << "EapQtConfigInterfacePrivate - copyToEapSettings VerifyServerRealm: " |
|
928 << varValue.toBool(); |
|
929 } |
|
930 |
|
931 varValue = config.value(EapQtConfig::ClientAuthenticationRequired); |
|
932 if (varValue.type() == QVariant::Bool) { |
|
933 eapSettings.iRequireClientAuthenticationPresent = ETrue; |
|
934 eapSettings.iRequireClientAuthentication = convertToTbool(varValue.toBool()); |
|
935 qDebug() |
|
936 << "EapQtConfigInterfacePrivate - copyToEapSettings ClientAuthenticationRequired: " |
|
937 << varValue.toBool(); |
|
938 } |
|
939 |
|
940 varValue = config.value(EapQtConfig::SessionValidityTime); |
|
941 if (varValue.type() == QVariant::UInt) { |
|
942 eapSettings.iSessionValidityTimePresent = ETrue; |
|
943 eapSettings.iSessionValidityTime = varValue.toUInt(); |
|
944 qDebug() << "EapQtConfigInterfacePrivate - copyToEapSettings SessionValidityTime: " |
|
945 << varValue.toUInt(); |
|
946 } |
|
947 |
|
948 varValue = config.value(EapQtConfig::PeapVersion0Allowed); |
|
949 if (varValue.type() == QVariant::Bool) { |
|
950 eapSettings.iPEAPVersionsPresent = ETrue; |
|
951 eapSettings.iPEAPv0Allowed = convertToTbool(varValue.toBool()); |
|
952 qDebug() << "EapQtConfigInterfacePrivate - copyToEapSettings PeapVersion0Allowed: " |
|
953 << varValue.toBool(); |
|
954 } else { |
|
955 // in any other case disable PEAP version; |
|
956 // no need to set eapSettings.iPEAPVersionsPresent, |
|
957 // it will be set if one of the other PEAP versions is enabled, |
|
958 // otherwise this setting is redundant and can be ignored |
|
959 eapSettings.iPEAPv0Allowed = EFalse; |
|
960 } |
|
961 |
|
962 varValue = config.value(EapQtConfig::PeapVersion1Allowed); |
|
963 if (varValue.type() == QVariant::Bool) { |
|
964 eapSettings.iPEAPVersionsPresent = ETrue; |
|
965 eapSettings.iPEAPv1Allowed = convertToTbool(varValue.toBool()); |
|
966 qDebug() << "EapQtConfigInterfacePrivate - copyToEapSettings PeapVersion1Allowed: " |
|
967 << varValue.toBool(); |
|
968 } else { |
|
969 // in any other case disable PEAP version; |
|
970 // no need to set eapSettings.iPEAPVersionsPresent, |
|
971 // it will be set if one of the other PEAP versions is enabled, |
|
972 // otherwise this setting is redundant and can be ignored |
|
973 eapSettings.iPEAPv1Allowed = EFalse; |
|
974 } |
|
975 |
|
976 varValue = config.value(EapQtConfig::PeapVersion2Allowed); |
|
977 if (varValue.type() == QVariant::Bool) { |
|
978 eapSettings.iPEAPVersionsPresent = ETrue; |
|
979 eapSettings.iPEAPv2Allowed = convertToTbool(varValue.toBool()); |
|
980 qDebug() << "EapQtConfigInterfacePrivate - copyToEapSettings PeapVersion2Allowed: " |
|
981 << varValue.toBool(); |
|
982 } else { |
|
983 // in any other case disable PEAP version; |
|
984 // no need to set eapSettings.iPEAPVersionsPresent, |
|
985 // it will be set if one of the other PEAP versions is enabled, |
|
986 // otherwise this setting is redundant and can be ignored |
|
987 eapSettings.iPEAPv2Allowed = EFalse; |
|
988 } |
|
989 |
|
990 varValue = config.value(EapQtConfig::ProvisioningModeAuthenticated); |
|
991 if (varValue.type() == QVariant::Bool) { |
|
992 eapSettings.iAuthProvModeAllowedPresent = ETrue; |
|
993 eapSettings.iAuthProvModeAllowed = convertToTbool(varValue.toBool()); |
|
994 qDebug() |
|
995 << "EapQtConfigInterfacePrivate - copyToEapSettings ProvisioningModeAuthenticated: " |
|
996 << varValue.toBool(); |
|
997 } |
|
998 |
|
999 varValue = config.value(EapQtConfig::ProvisioningModeUnauthenticated); |
|
1000 if (varValue.type() == QVariant::Bool) { |
|
1001 eapSettings.iUnauthProvModeAllowedPresent = ETrue; |
|
1002 eapSettings.iUnauthProvModeAllowed = convertToTbool(varValue.toBool()); |
|
1003 qDebug() |
|
1004 << "EapQtConfigInterfacePrivate - copyToEapSettings ProvisioningModeUnauthenticated: " |
|
1005 << varValue.toBool(); |
|
1006 } |
|
1007 |
|
1008 varValue = config.value(EapQtConfig::PACGroupReference); |
|
1009 // do not copy if too large string |
|
1010 if (varValue.type() == QVariant::String && varValue.toString().count() <= StringMaxLength) { |
|
1011 eapSettings.iPACGroupReference.Copy(varValue.toString().utf16()); |
|
1012 eapSettings.iPACGroupReferencePresent = ETrue; |
|
1013 qDebug() << "EapQtConfigInterfacePrivate - copyToEapSettings PACGroupReference: " |
|
1014 << varValue.toString(); |
|
1015 } |
|
1016 |
|
1017 varValue = config.value(EapQtConfig::WarnADHPNoPAC); |
|
1018 if (varValue.type() == QVariant::Bool) { |
|
1019 eapSettings.iWarnADHPNoPACPresent = ETrue; |
|
1020 eapSettings.iWarnADHPNoPAC = convertToTbool(varValue.toBool()); |
|
1021 qDebug() << "EapQtConfigInterfacePrivate - copyToEapSettings WarnADHPNoPAC: " |
|
1022 << varValue.toBool(); |
|
1023 } |
|
1024 |
|
1025 varValue = config.value(EapQtConfig::WarnADHPNoMatchingPAC); |
|
1026 if (varValue.type() == QVariant::Bool) { |
|
1027 eapSettings.iWarnADHPNoMatchingPACPresent = ETrue; |
|
1028 eapSettings.iWarnADHPNoMatchingPAC = convertToTbool(varValue.toBool()); |
|
1029 qDebug() << "EapQtConfigInterfacePrivate - copyToEapSettings WarnADHPNoMatchingPAC: " |
|
1030 << varValue.toBool(); |
|
1031 } |
|
1032 |
|
1033 varValue = config.value(EapQtConfig::WarnNotDefaultServer); |
|
1034 if (varValue.type() == QVariant::Bool) { |
|
1035 eapSettings.iWarnNotDefaultServerPresent = ETrue; |
|
1036 eapSettings.iWarnNotDefaultServer = convertToTbool(varValue.toBool()); |
|
1037 qDebug() << "EapQtConfigInterfacePrivate - copyToEapSettings WarnNotDefaultServer: " |
|
1038 << varValue.toBool(); |
|
1039 } |
|
1040 |
|
1041 varValue = config.value(EapQtConfig::UseIdentityPrivacy); |
|
1042 if (varValue.type() == QVariant::Bool) { |
|
1043 eapSettings.iUseIdentityPrivacyPresent = ETrue; |
|
1044 eapSettings.iUseIdentityPrivacy = convertToTbool(varValue.toBool()); |
|
1045 qDebug() << "EapQtConfigInterfacePrivate - copyToEapSettings UseIdentityPrivacy: " |
|
1046 << varValue.toBool(); |
|
1047 } |
|
1048 |
|
1049 varValue = config.value(EapQtConfig::InnerType); |
|
1050 if (varValue.type() == QVariant::List) { |
|
1051 |
|
1052 // not need to set disable inner types |
|
1053 // EAP server takes care of them internally |
|
1054 |
|
1055 qDebug() << "EapQtConfigInterfacePrivate::copyToEapSettings() - InnerType present"; |
|
1056 |
|
1057 QList<QVariant> varList = varValue.toList(); |
|
1058 TEapExpandedType tmpEap; |
|
1059 EapQtPluginHandle tmpHandle; |
|
1060 |
|
1061 for (ind = 0; ind < varList.count(); ind++) { |
|
1062 if (varList[ind].canConvert<EapQtPluginHandle> ()) { |
|
1063 // set to true only if at least one item is ok |
|
1064 eapSettings.iEnabledEncapsulatedEAPExpandedTypesPresent = ETrue; |
|
1065 |
|
1066 tmpHandle = varList[ind].value<EapQtPluginHandle> (); |
|
1067 tmpEap.SetValue(tmpHandle.type().eapExpandedData().data(), |
|
1068 tmpHandle.type().eapExpandedData().length()); |
|
1069 eapSettings.iEnabledEncapsulatedEAPExpandedTypes.Append(tmpEap); |
|
1070 |
|
1071 qDebug() |
|
1072 << "EapQtConfigInterfacePrivate::copyToEapSettings() - Added to InnerType: " |
|
1073 << tmpHandle.type().eapExpandedData().toHex(); |
|
1074 } |
|
1075 } |
|
1076 } |
|
1077 |
|
1078 varValue = config.value(EapQtConfig::CipherSuites); |
|
1079 if (varValue.type() == QVariant::List) { |
|
1080 |
|
1081 qDebug() << "EapQtConfigInterfacePrivate::copyToEapSettings() - CipherSuites present"; |
|
1082 QList<QVariant> varCiphers = varValue.toList(); |
|
1083 |
|
1084 // clears the ciphersuite configuration if the provided list is empty |
|
1085 eapSettings.iCipherSuitesPresent = ETrue; |
|
1086 |
|
1087 for (ind = 0; ind < varCiphers.count(); ind++) { |
|
1088 // check that the item is of correct type (int also accepted to not be too strict) |
|
1089 if (varCiphers[ind].type() == QVariant::UInt || varCiphers[ind].type() == QVariant::Int) { |
|
1090 eapSettings.iCipherSuites.Append(varCiphers[ind].toUInt()); |
|
1091 qDebug( |
|
1092 "EapQtConfigInterfacePrivate::copyToEapSettings() - CipherSuites at %d: 0x%08x", |
|
1093 ind, varCiphers[ind].toUInt()); |
|
1094 } |
|
1095 } |
|
1096 } |
|
1097 |
|
1098 // set always to true to support clearing previously configured CA/user certificates |
|
1099 // if the EAP method in question does not use certificates, |
|
1100 // EAP server will ignore the setting; |
|
1101 // CA/user certificates get cleared if EapQtConfig::Authority/UserCertificate is QVariant::Invalid or |
|
1102 // the provided lists are empty |
|
1103 eapSettings.iCertificatesPresent = ETrue; |
|
1104 |
|
1105 varValue = config.value(EapQtConfig::AuthorityCertificate); |
|
1106 if (varValue.type() == QVariant::List) { |
|
1107 |
|
1108 qDebug() |
|
1109 << "EapQtConfigInterfacePrivate::copyToEapSettings() - AuthorityCertificate present"; |
|
1110 |
|
1111 QList<QVariant> varCerts = varValue.toList(); |
|
1112 for (ind = 0; ind < varCerts.count(); ind++) { |
|
1113 // check that the item is of correct type |
|
1114 if (varCerts[ind].canConvert<EapQtCertificateInfo> ()) { |
|
1115 appendCertificateInfo(true, varCerts[ind].value<EapQtCertificateInfo> (), |
|
1116 &(eapSettings.iCertificates)); |
|
1117 qDebug() |
|
1118 << "EapQtConfigInterfacePrivate::copyToEapSettings() - AuthorityCertificate appended"; |
|
1119 } |
|
1120 } |
|
1121 } |
|
1122 |
|
1123 varValue = config.value(EapQtConfig::UserCertificate); |
|
1124 if (varValue.type() == QVariant::List) { |
|
1125 |
|
1126 qDebug() << "EapQtConfigInterfacePrivate::copyToEapSettings() - UserCertificate present"; |
|
1127 |
|
1128 QList<QVariant> varCerts = varValue.toList(); |
|
1129 for (ind = 0; ind < varCerts.count(); ind++) { |
|
1130 // check that the item is of correct type |
|
1131 if (varCerts[ind].canConvert<EapQtCertificateInfo> ()) { |
|
1132 appendCertificateInfo(false, varCerts[ind].value<EapQtCertificateInfo> (), |
|
1133 &(eapSettings.iCertificates)); |
|
1134 qDebug() |
|
1135 << "EapQtConfigInterfacePrivate::copyToEapSettings() - AuthorityCertificate appended"; |
|
1136 } |
|
1137 } |
|
1138 } |
|
1139 |
|
1140 } |
|
1141 |
|
1142 // caller takes care of deallocating resulting data in certList |
|
1143 void EapQtConfigInterfacePrivate::appendCertificateInfo(bool isCaCertificate, |
|
1144 const EapQtCertificateInfo& certInfo, RPointerArray<EapCertificateEntry>* const certList) |
|
1145 { |
|
1146 qDebug("EapQtConfigInterfacePrivate::appendCertificateInfo(), this = 0x%08x", this); |
|
1147 |
|
1148 Q_ASSERT(certList); |
|
1149 |
|
1150 // use scoped pointer to make sure memory is not leaked in failures |
|
1151 QScopedPointer<EapCertificateEntry> certEntry(new EapCertificateEntry); |
|
1152 |
|
1153 // set certificate enabled in EAP settings |
|
1154 certEntry->SetIsEnabledPresent(); |
|
1155 certEntry->SetIsEnabled(ETrue); |
|
1156 |
|
1157 if (isCaCertificate) { |
|
1158 qDebug("EapQtConfigInterfacePrivate::appendCertificateInfo() - CA certificate"); |
|
1159 certEntry->SetCertType(EapCertificateEntry::ECA); |
|
1160 } |
|
1161 else { |
|
1162 qDebug("EapQtConfigInterfacePrivate::appendCertificateInfo() - Client certificate"); |
|
1163 certEntry->SetCertType(EapCertificateEntry::EUser); |
|
1164 } |
|
1165 |
|
1166 qDebug("EapQtConfigInterfacePrivate::appendCertificateInfo() - *** Adding cert data"); |
|
1167 |
|
1168 TBuf<KGeneralStringMaxLength> certText; |
|
1169 |
|
1170 QVariant varValue = certInfo.value(EapQtCertificateInfo::SubjectName); |
|
1171 if (varValue.type() == QVariant::String && varValue.toString().count() <= StringMaxLength) { |
|
1172 certEntry->SetSubjectNamePresent(); |
|
1173 certText.Copy(varValue.toString().utf16()); |
|
1174 certEntry->SetSubjectName(certText); |
|
1175 |
|
1176 qDebug() << "EapQtConfigInterfacePrivate::appendCertificateInfo() - SubjectName: " |
|
1177 << varValue.toString(); |
|
1178 } |
|
1179 |
|
1180 varValue = certInfo.value(EapQtCertificateInfo::IssuerName); |
|
1181 if (varValue.type() == QVariant::String && varValue.toString().count() <= StringMaxLength) { |
|
1182 certEntry->SetIssuerNamePresent(); |
|
1183 certText.Copy(varValue.toString().utf16()); |
|
1184 certEntry->SetIssuerName(certText); |
|
1185 |
|
1186 qDebug() << "EapQtConfigInterfacePrivate::appendCertificateInfo() - IssuerName: " |
|
1187 << varValue.toString(); |
|
1188 } |
|
1189 |
|
1190 varValue = certInfo.value(EapQtCertificateInfo::SerialNumber); |
|
1191 if (varValue.type() == QVariant::String && varValue.toString().count() <= StringMaxLength) { |
|
1192 certEntry->SetSerialNumberPresent(); |
|
1193 certText.Copy(varValue.toString().utf16()); |
|
1194 certEntry->SetSerialNumber(certText); |
|
1195 |
|
1196 qDebug() << "EapQtConfigInterfacePrivate::appendCertificateInfo() - SerialNumber: " |
|
1197 << varValue.toString(); |
|
1198 } |
|
1199 |
|
1200 TCertLabel certLabel; |
|
1201 |
|
1202 varValue = certInfo.value(EapQtCertificateInfo::CertificateLabel); |
|
1203 if (varValue.type() == QVariant::String && varValue.toString().count() <= CertLabelMaxLength) { |
|
1204 certEntry->SetLabelPresent(); |
|
1205 certLabel.Copy(varValue.toString().utf16()); |
|
1206 certEntry->SetLabel(certLabel); |
|
1207 |
|
1208 qDebug() << "EapQtConfigInterfacePrivate::appendCertificateInfo() - CertificateLabel: " |
|
1209 << varValue.toString(); |
|
1210 } |
|
1211 |
|
1212 TBuf<KThumbprintMaxLength> thumbPrint; |
|
1213 |
|
1214 varValue = certInfo.value(EapQtCertificateInfo::ThumbPrint); |
|
1215 if (varValue.type() == QVariant::String && varValue.toString().count() |
|
1216 <= CertThumbprintMaxLength) { |
|
1217 certEntry->SetThumbprintPresent(); |
|
1218 thumbPrint.Copy(varValue.toString().utf16()); |
|
1219 certEntry->SetThumbprint(thumbPrint); |
|
1220 |
|
1221 qDebug() << "EapQtConfigInterfacePrivate::appendCertificateInfo() - ThumbPrint: " |
|
1222 << varValue.toString(); |
|
1223 } |
|
1224 |
|
1225 TKeyIdentifier keyId; |
|
1226 |
|
1227 varValue = certInfo.value(EapQtCertificateInfo::SubjectKeyId); |
|
1228 if (varValue.type() == QVariant::ByteArray && varValue.toByteArray().count() |
|
1229 <= CertSubjectKeyIdLength) { |
|
1230 certEntry->SetSubjectKeyIdPresent(); |
|
1231 keyId.Copy(reinterpret_cast<unsigned char*> (varValue.toByteArray().data()), |
|
1232 varValue.toByteArray().size()); |
|
1233 certEntry->SetSubjectKeyId(keyId); |
|
1234 |
|
1235 qDebug() << "EapQtConfigInterfacePrivate::appendCertificateInfo() - SubjectKeyId: " |
|
1236 << varValue.toByteArray().toHex(); |
|
1237 } |
|
1238 |
|
1239 // EapSettings destructor takes care of deallocating the entry |
|
1240 certList->Append(certEntry.data()); |
|
1241 |
|
1242 qDebug() |
|
1243 << "EapQtConfigInterfacePrivate::appendCertificateInfo()" |
|
1244 << "- *** certificate appended to list"; |
|
1245 |
|
1246 // all ok, remove the ownerhsip from scoped pointer |
|
1247 (void) certEntry.take(); |
|
1248 } |
|
1249 |
|
1250 void EapQtConfigInterfacePrivate::copyFromEapSettings(EAPSettings &eapSettings, EapQtConfig &config) |
|
1251 { |
|
1252 qDebug("EapQtConfigInterfacePrivate::copyFromEapSettings(), this = 0x%08x", this); |
|
1253 |
|
1254 int ind = 0; |
|
1255 |
|
1256 // automatic username |
|
1257 if (eapSettings.iUseAutomaticUsernamePresent) { |
|
1258 config.setValue(EapQtConfig::UsernameAutomatic, convertToBool( |
|
1259 eapSettings.iUseAutomaticUsername)); |
|
1260 qDebug() << "EapQtConfigInterfacePrivate - copyFromEapSettings UsernameAutomatic: " |
|
1261 << config.value(EapQtConfig::UsernameAutomatic).toBool(); |
|
1262 } |
|
1263 |
|
1264 // automatic CA certificate |
|
1265 if (eapSettings.iUseAutomaticCACertificatePresent) { |
|
1266 config.setValue(EapQtConfig::AuthorityCertificateAutomatic, convertToBool( |
|
1267 eapSettings.iUseAutomaticCACertificate)); |
|
1268 qDebug() |
|
1269 << "EapQtConfigInterfacePrivate - copyFromEapSettings AuthorityCertificateAutomatic: " |
|
1270 << config.value(EapQtConfig::AuthorityCertificateAutomatic).toBool(); |
|
1271 } |
|
1272 |
|
1273 // username |
|
1274 if (eapSettings.iUsernamePresent) { |
|
1275 config.setValue(EapQtConfig::Username, QString::fromUtf16(eapSettings.iUsername.Ptr(), |
|
1276 eapSettings.iUsername.Length())); |
|
1277 qDebug() << "EapQtConfigInterfacePrivate - copyFromEapSettings Username: " << config.value( |
|
1278 EapQtConfig::Username).toString(); |
|
1279 } |
|
1280 |
|
1281 // password existence check, password itself is write-only, cannot be read |
|
1282 if (eapSettings.iPasswordExistPresent) { |
|
1283 // report to caller if password exists in the database |
|
1284 config.setValue(EapQtConfig::PasswordStored, convertToBool(eapSettings.iPasswordExist)); |
|
1285 |
|
1286 qDebug() << "EapQtConfigInterfacePrivate - copyFromEapSettings PasswordStored: " |
|
1287 << config.value(EapQtConfig::PasswordStored).toBool(); |
|
1288 } |
|
1289 |
|
1290 // password prompt |
|
1291 if (eapSettings.iShowPassWordPromptPresent) { |
|
1292 config.setValue(EapQtConfig::PasswordPrompt, convertToBool(eapSettings.iShowPassWordPrompt)); |
|
1293 |
|
1294 qDebug() << "EapQtConfigInterfacePrivate - copyFromEapSettings PasswordPrompt: " |
|
1295 << config.value(EapQtConfig::PasswordPrompt).toBool(); |
|
1296 } |
|
1297 |
|
1298 // automatic realm |
|
1299 if (eapSettings.iUseAutomaticRealmPresent) { |
|
1300 config.setValue(EapQtConfig::RealmAutomatic, convertToBool(eapSettings.iUseAutomaticRealm)); |
|
1301 qDebug() << "EapQtConfigInterfacePrivate - copyFromEapSettings RealmAutomatic: " |
|
1302 << config.value(EapQtConfig::RealmAutomatic).toBool(); |
|
1303 } |
|
1304 |
|
1305 // realm |
|
1306 if (eapSettings.iRealmPresent) { |
|
1307 config.setValue(EapQtConfig::Realm, QString::fromUtf16(eapSettings.iRealm.Ptr(), |
|
1308 eapSettings.iRealm.Length())); |
|
1309 qDebug() << "EapQtConfigInterfacePrivate - copyFromEapSettings Realm: " << config.value( |
|
1310 EapQtConfig::Realm).toString(); |
|
1311 } |
|
1312 |
|
1313 // server name |
|
1314 if (eapSettings.iVerifyServerRealmPresent) { |
|
1315 config.setValue(EapQtConfig::VerifyServerRealm, convertToBool( |
|
1316 eapSettings.iVerifyServerRealm)); |
|
1317 qDebug() << "EapQtConfigInterfacePrivate - copyFromEapSettings VerifyServerRealm: " |
|
1318 << config.value(EapQtConfig::VerifyServerRealm).toBool(); |
|
1319 } |
|
1320 |
|
1321 // pseudonym |
|
1322 if (eapSettings.iUsePseudonymsPresent) { |
|
1323 config.setValue(EapQtConfig::UsePseudonyms, convertToBool(eapSettings.iUsePseudonyms)); |
|
1324 |
|
1325 qDebug() << "EapQtConfigInterfacePrivate - copyFromEapSettings UsePseudonyms: " |
|
1326 << config.value(EapQtConfig::UsePseudonyms).toBool(); |
|
1327 } |
|
1328 |
|
1329 // policy: server must require client authentication |
|
1330 if (eapSettings.iRequireClientAuthenticationPresent) { |
|
1331 config.setValue(EapQtConfig::ClientAuthenticationRequired, convertToBool( |
|
1332 eapSettings.iRequireClientAuthentication)); |
|
1333 |
|
1334 qDebug() |
|
1335 << "EapQtConfigInterfacePrivate - copyFromEapSettings ClientAuthenticationRequired: " |
|
1336 << config.value(EapQtConfig::ClientAuthenticationRequired).toBool(); |
|
1337 } |
|
1338 |
|
1339 // session validity time |
|
1340 if (eapSettings.iSessionValidityTimePresent) { |
|
1341 config.setValue(EapQtConfig::SessionValidityTime, eapSettings.iSessionValidityTime); |
|
1342 |
|
1343 qDebug() << "EapQtConfigInterfacePrivate - copyFromEapSettings SessionValidityTime: " |
|
1344 << config.value(EapQtConfig::SessionValidityTime).toUInt(); |
|
1345 } |
|
1346 |
|
1347 // TLS ciphersuites |
|
1348 if (eapSettings.iCipherSuitesPresent) { |
|
1349 QList<QVariant> ciphers; // QVariant has a constructor for uint |
|
1350 for (ind = 0; ind < eapSettings.iCipherSuites.Count(); ind++) { |
|
1351 ciphers.append(eapSettings.iCipherSuites[ind]); |
|
1352 qDebug("EapQtConfigInterfacePrivate - copyFromEapSettings CipherSuites at %d: 0x%08x", |
|
1353 ind, ciphers[ind].toUInt()); |
|
1354 } |
|
1355 config.setValue(EapQtConfig::CipherSuites, ciphers); |
|
1356 } |
|
1357 |
|
1358 // certificates |
|
1359 if (eapSettings.iCertificatesPresent) { |
|
1360 |
|
1361 QList<EapQtCertificateInfo> caCerts; |
|
1362 QList<EapQtCertificateInfo> clientCerts; |
|
1363 RPointerArray<EapCertificateEntry> serverCaCerts; |
|
1364 RPointerArray<EapCertificateEntry> serverClientCerts; |
|
1365 |
|
1366 // separate CA and client certs to their own lists |
|
1367 for (ind = 0; ind < eapSettings.iCertificates.Count(); ind++) { |
|
1368 |
|
1369 qDebug() << "EapQtConfigInterfacePrivate - copyFromEapSettings certificates, " |
|
1370 << "cert type: " << eapSettings.iCertificates[ind]->GetCertType() << ", enabled: " |
|
1371 << convertToBool(eapSettings.iCertificates[ind]->GetIsEnabled()); |
|
1372 |
|
1373 // only enabled certificates are reported |
|
1374 if (eapSettings.iCertificates[ind]->GetCertType() == EapCertificateEntry::EUser |
|
1375 && eapSettings.iCertificates[ind]->GetIsEnabled() != EFalse) { |
|
1376 serverClientCerts.Append(eapSettings.iCertificates[ind]); |
|
1377 } |
|
1378 // only enabled certificates are reported |
|
1379 else if (eapSettings.iCertificates[ind]->GetCertType() == EapCertificateEntry::ECA |
|
1380 && eapSettings.iCertificates[ind]->GetIsEnabled() != EFalse) { |
|
1381 serverCaCerts.Append(eapSettings.iCertificates[ind]); |
|
1382 } |
|
1383 else { |
|
1384 qDebug() |
|
1385 << "WARNING: EapQtConfigInterfacePrivate - copyFromEapSettings certificates, " |
|
1386 << "unknown certificate type in the list or certificate not enabled"; |
|
1387 } |
|
1388 } |
|
1389 |
|
1390 // copy to lists of our type |
|
1391 qDebug() << "EapQtConfigInterfacePrivate - copyFromEapSettings AuthorityCertificates"; |
|
1392 copyCertificateInfo(&serverCaCerts, &caCerts); |
|
1393 qDebug() << "EapQtConfigInterfacePrivate - copyFromEapSettings UserCertificates"; |
|
1394 copyCertificateInfo(&serverClientCerts, &clientCerts); |
|
1395 |
|
1396 // reset the arrays, data is owned by EapSettings.h, |
|
1397 // must not be destroyed here |
|
1398 serverCaCerts.Reset(); |
|
1399 serverClientCerts.Reset(); |
|
1400 |
|
1401 // we still need to convert QList<EapQtCertificateInfo> to QList<QVariant> |
|
1402 // to be able to store to config |
|
1403 QVariant tmp; |
|
1404 QList<QVariant> varCaCerts; |
|
1405 QList<QVariant> varClientCerts; |
|
1406 |
|
1407 for (ind = 0; ind < caCerts.count(); ind++) { |
|
1408 tmp.setValue(caCerts[ind]); |
|
1409 varCaCerts.append(tmp); |
|
1410 } |
|
1411 for (ind = 0; ind < clientCerts.count(); ind++) { |
|
1412 tmp.setValue(clientCerts[ind]); |
|
1413 varClientCerts.append(tmp); |
|
1414 } |
|
1415 |
|
1416 // finally copy to config |
|
1417 config.setValue(EapQtConfig::AuthorityCertificate, varCaCerts); |
|
1418 config.setValue(EapQtConfig::UserCertificate, varClientCerts); |
|
1419 } |
|
1420 |
|
1421 // PEAP specific |
|
1422 if (eapSettings.iPEAPVersionsPresent) { |
|
1423 config.setValue(EapQtConfig::PeapVersion0Allowed, convertToBool(eapSettings.iPEAPv0Allowed)); |
|
1424 config.setValue(EapQtConfig::PeapVersion1Allowed, convertToBool(eapSettings.iPEAPv1Allowed)); |
|
1425 config.setValue(EapQtConfig::PeapVersion2Allowed, convertToBool(eapSettings.iPEAPv2Allowed)); |
|
1426 |
|
1427 qDebug() << "EapQtConfigInterfacePrivate - copyFromEapSettings PeapVersion0Allowed: " |
|
1428 << config.value(EapQtConfig::PeapVersion0Allowed).toBool(); |
|
1429 qDebug() << "EapQtConfigInterfacePrivate - copyFromEapSettings PeapVersion1Allowed: " |
|
1430 << config.value(EapQtConfig::PeapVersion1Allowed).toBool(); |
|
1431 qDebug() << "EapQtConfigInterfacePrivate - copyFromEapSettings PeapVersion2Allowed: " |
|
1432 << config.value(EapQtConfig::PeapVersion2Allowed).toBool(); |
|
1433 } |
|
1434 |
|
1435 // TLS privacy |
|
1436 if (eapSettings.iUseIdentityPrivacyPresent) { |
|
1437 config.setValue(EapQtConfig::UseIdentityPrivacy, convertToBool( |
|
1438 eapSettings.iUseIdentityPrivacy)); |
|
1439 |
|
1440 qDebug() << "EapQtConfigInterfacePrivate - copyFromEapSettings UseIdentityPrivacy: " |
|
1441 << config.value(EapQtConfig::UseIdentityPrivacy).toBool(); |
|
1442 } |
|
1443 |
|
1444 // EAP-FAST specific |
|
1445 if (eapSettings.iAuthProvModeAllowedPresent) { |
|
1446 config.setValue(EapQtConfig::ProvisioningModeAuthenticated, convertToBool( |
|
1447 eapSettings.iAuthProvModeAllowed)); |
|
1448 |
|
1449 qDebug() |
|
1450 << "EapQtConfigInterfacePrivate - copyFromEapSettings ProvisioningModeAuthenticated: " |
|
1451 << config.value(EapQtConfig::ProvisioningModeAuthenticated).toBool(); |
|
1452 } |
|
1453 if (eapSettings.iUnauthProvModeAllowedPresent) { |
|
1454 config.setValue(EapQtConfig::ProvisioningModeUnauthenticated, convertToBool( |
|
1455 eapSettings.iUnauthProvModeAllowed)); |
|
1456 |
|
1457 qDebug() |
|
1458 << "EapQtConfigInterfacePrivate - copyFromEapSettings ProvisioningModeUnauthenticated: " |
|
1459 << config.value(EapQtConfig::ProvisioningModeUnauthenticated).toBool(); |
|
1460 } |
|
1461 if (eapSettings.iWarnADHPNoPACPresent) { |
|
1462 config.setValue(EapQtConfig::WarnADHPNoPAC, convertToBool(eapSettings.iWarnADHPNoPAC)); |
|
1463 |
|
1464 qDebug() << "EapQtConfigInterfacePrivate - copyFromEapSettings WarnADHPNoPAC: " |
|
1465 << config.value(EapQtConfig::WarnADHPNoPAC).toBool(); |
|
1466 } |
|
1467 if (eapSettings.iWarnADHPNoMatchingPACPresent) { |
|
1468 config.setValue(EapQtConfig::WarnADHPNoMatchingPAC, convertToBool( |
|
1469 eapSettings.iWarnADHPNoMatchingPAC)); |
|
1470 |
|
1471 qDebug() << "EapQtConfigInterfacePrivate - copyFromEapSettings WarnADHPNoMatchingPAC: " |
|
1472 << config.value(EapQtConfig::WarnADHPNoMatchingPAC).toBool(); |
|
1473 } |
|
1474 if (eapSettings.iWarnNotDefaultServerPresent) { |
|
1475 config.setValue(EapQtConfig::WarnNotDefaultServer, convertToBool( |
|
1476 eapSettings.iWarnNotDefaultServer)); |
|
1477 |
|
1478 qDebug() << "EapQtConfigInterfacePrivate - copyFromEapSettings WarnNotDefaultServer: " |
|
1479 << config.value(EapQtConfig::WarnNotDefaultServer).toBool(); |
|
1480 } |
|
1481 if (eapSettings.iPACGroupReferencePresent) { |
|
1482 config.setValue(EapQtConfig::PACGroupReference, QString::fromUtf16( |
|
1483 eapSettings.iPACGroupReference.Ptr(), eapSettings.iPACGroupReference.Length())); |
|
1484 qDebug() << "EapQtConfigInterfacePrivate - copyFromEapSettings PACGroupReference: " |
|
1485 << config.value(EapQtConfig::PACGroupReference).toString(); |
|
1486 } |
|
1487 |
|
1488 // enabled inner EAPs |
|
1489 if (eapSettings.iEnabledEncapsulatedEAPExpandedTypesPresent) { |
|
1490 |
|
1491 qDebug("EapQtConfigInterfacePrivate - copyFromEapSettings InnerType, enabled count %d", |
|
1492 eapSettings.iEnabledEncapsulatedEAPExpandedTypes.Count()); |
|
1493 |
|
1494 QList<QByteArray> innerEapsOn; |
|
1495 appendEapTypes(&(eapSettings.iEnabledEncapsulatedEAPExpandedTypes), &innerEapsOn); |
|
1496 |
|
1497 // convert to QList<QVariant> to be able to store to config |
|
1498 QVariant varTmp; |
|
1499 QList<QVariant> varInnerEapsOn; |
|
1500 int dummy = 0; |
|
1501 |
|
1502 for (ind = 0; ind < innerEapsOn.count(); ind++) { |
|
1503 // report only EAPs which do have an UI plugin |
|
1504 if (isUiSupported(innerEapsOn[ind], dummy)) { |
|
1505 // create plugin handle from EAP type with constructors |
|
1506 // calls: EapQtExpandedEapType(const QByteArray data) -> EapQtPluginHandle(EapQtExpandedEapType type) |
|
1507 varTmp.setValue(EapQtPluginHandle(EapQtExpandedEapType(innerEapsOn[ind]))); |
|
1508 varInnerEapsOn.append(varTmp); |
|
1509 qDebug() |
|
1510 << "EapQtConfigInterfacePrivate - copyFromEapSettings InnerType: added EAP: " |
|
1511 << innerEapsOn[ind].toHex(); |
|
1512 } |
|
1513 } |
|
1514 |
|
1515 // copy to config |
|
1516 config.setValue(EapQtConfig::InnerType, varInnerEapsOn); |
|
1517 } |
|
1518 |
|
1519 // disabled inner EAPs |
|
1520 if (eapSettings.iDisabledEncapsulatedEAPExpandedTypesPresent) { |
|
1521 // setting is not needed, enabled are enough |
|
1522 qDebug( |
|
1523 "EapQtConfigInterfacePrivate - copyFromEapSettings InnerType: disabled count %d (not needed for anything here)", |
|
1524 eapSettings.iDisabledEncapsulatedEAPExpandedTypes.Count()); |
|
1525 } |
|
1526 |
|
1527 } |
|
1528 |
|
1529 QList<EapQtPluginHandle> EapQtConfigInterfacePrivate::selectedOuterTypes() |
|
1530 { |
|
1531 qDebug("EapQtConfigInterfacePrivate::selectedOuterTypes(), this = 0x%08x", this); |
|
1532 |
|
1533 checkInstanceThrowing(); |
|
1534 |
|
1535 if (!mEapDbIndexValid) { |
|
1536 qDebug() << "ERROR: Database reference not valid, call setConfigurationReference first!"; |
|
1537 return QList<EapQtPluginHandle> (); |
|
1538 } |
|
1539 |
|
1540 // call to make sure the members (mOuterEapsOn and mSupportedOuterTypes) are up-to-date |
|
1541 (void) supportedOuterTypes(); |
|
1542 |
|
1543 QList<EapQtPluginHandle> selectedOuterTypes; |
|
1544 |
|
1545 QList<QByteArray> tmpEaps; |
|
1546 appendEapTypes(&mOuterEapsOn, &tmpEaps); |
|
1547 |
|
1548 // report only the ones that also have an UI, i.e. listed in mSupportedOuterTypes |
|
1549 for (int ind = 0; ind < mSupportedOuterTypes.count(); ind++) { |
|
1550 if (tmpEaps.contains(mSupportedOuterTypes[ind].pluginHandle().type().eapExpandedData())) { |
|
1551 selectedOuterTypes.append(mSupportedOuterTypes[ind].pluginHandle()); |
|
1552 } |
|
1553 } |
|
1554 |
|
1555 qDebug("EapQtConfigInterfacePrivate - selected outer type count: %d", |
|
1556 selectedOuterTypes.count()); |
|
1557 |
|
1558 return selectedOuterTypes; |
|
1559 } |
|
1560 |
|
1561 bool EapQtConfigInterfacePrivate::isSupportedOuterType(const EapQtPluginHandle &handle) |
|
1562 { |
|
1563 qDebug("EapQtConfigInterfacePrivate::isSupportedOuterType(), this = 0x%08x", this); |
|
1564 |
|
1565 checkInstanceThrowing(); |
|
1566 |
|
1567 // check if mSupportedOuterTypes is up-to-date |
|
1568 if (mSupportedOuterTypes.count() <= 0) { |
|
1569 // update mSupportedOuterTypes |
|
1570 (void) supportedOuterTypes(); |
|
1571 } |
|
1572 |
|
1573 bool ret = false; |
|
1574 for (int ind = 0; ind < mSupportedOuterTypes.count(); ind++) { |
|
1575 if (mSupportedOuterTypes[ind].pluginHandle() == handle) { |
|
1576 ret = true; |
|
1577 } |
|
1578 } |
|
1579 return ret; |
|
1580 } |
|
1581 |
|
1582 bool EapQtConfigInterfacePrivate::setSelectedOuterTypes( |
|
1583 const QList<EapQtPluginHandle> &outerHandles) |
|
1584 { |
|
1585 qDebug("EapQtConfigInterfacePrivate::setSelectedOuterTypes()"); |
|
1586 |
|
1587 checkInstanceThrowing(); |
|
1588 |
|
1589 if (!mEapDbIndexValid || mEapGsIf.isNull()) { |
|
1590 qDebug() |
|
1591 << "ERROR: Database reference not valid (or mEapGsIf is NULL), call setConfigurationReference first!"; |
|
1592 return false; |
|
1593 } |
|
1594 |
|
1595 // check if mSupportedOuterTypes is up-to-date |
|
1596 if (mSupportedOuterTypes.count() <= 0) { |
|
1597 // update mSupportedOuterTypes |
|
1598 (void) supportedOuterTypes(); |
|
1599 } |
|
1600 |
|
1601 // clear arrays |
|
1602 mOuterEapsOn.Reset(); |
|
1603 mOuterEapsOff.Reset(); |
|
1604 |
|
1605 // pick only the supported ones from outerHandles |
|
1606 TEapExpandedType tmpEap; |
|
1607 for (int ind = 0; ind < mSupportedOuterTypes.count(); ind++) { |
|
1608 if (outerHandles.contains(mSupportedOuterTypes[ind].pluginHandle())) { |
|
1609 |
|
1610 // convert to TEapExpandedType |
|
1611 tmpEap.SetValue( |
|
1612 mSupportedOuterTypes[ind].pluginHandle().type().eapExpandedData().data(), |
|
1613 mSupportedOuterTypes[ind].pluginHandle().type().eapExpandedData().length()); |
|
1614 |
|
1615 // add to mOuterEapsOn |
|
1616 mOuterEapsOn.Append(tmpEap); |
|
1617 |
|
1618 qDebug() |
|
1619 << "EapQtConfigInterfacePrivate - setSelectedOuterTypes adding to enabledOuterHandles: " |
|
1620 << mSupportedOuterTypes[ind].pluginHandle().type().eapExpandedData().toHex(); |
|
1621 } |
|
1622 } |
|
1623 |
|
1624 bool ret = true; |
|
1625 |
|
1626 // set selection to EAP server, no need to have correct content in mOuterEapsOff, |
|
1627 // EAP server handles it, mOuterEapsOn is only important |
|
1628 TUint err = mEapGsIf->SetEapMethods(mOuterEapsOn, mOuterEapsOff); |
|
1629 if (err != KErrNone) { |
|
1630 qDebug("EapQtConfigInterfacePrivate::setSelectedOuterTypes() - SetEapMethods failed: %d", |
|
1631 err); |
|
1632 // nothing we can do to recover, just exit |
|
1633 ret = false; |
|
1634 } |
|
1635 return ret; |
|
1636 } |
|
1637 |
|
1638 bool EapQtConfigInterfacePrivate::isSupportedInnerType(const EapQtPluginHandle &outerHandle, |
|
1639 const EapQtPluginHandle &innerHandle) |
|
1640 { |
|
1641 qDebug("EapQtConfigInterfacePrivate::isSupportedInnerType(), this = 0x%08x", this); |
|
1642 |
|
1643 checkInstanceThrowing(); |
|
1644 |
|
1645 // update mSupportedInnerTypes |
|
1646 (void) supportedInnerTypes(outerHandle); |
|
1647 |
|
1648 for (int ind = 0; ind < mSupportedInnerTypes.count(); ind++) { |
|
1649 if (mSupportedInnerTypes[ind].pluginHandle() == innerHandle) { |
|
1650 return true; |
|
1651 } |
|
1652 } |
|
1653 return false; |
|
1654 } |
|
1655 |
|
1656 bool EapQtConfigInterfacePrivate::deleteConfiguration() |
|
1657 { |
|
1658 qDebug("EapQtConfigInterfacePrivate::deleteConfiguration(), this = 0x%08x", this); |
|
1659 |
|
1660 checkInstanceThrowing(); |
|
1661 |
|
1662 if (!mEapDbIndexValid || mEapGsIf.isNull()) { |
|
1663 qDebug() |
|
1664 << "ERROR: Database reference not valid (or mEapGsIf is NULL), call setConfigurationReference first!"; |
|
1665 return false; |
|
1666 } |
|
1667 |
|
1668 bool ret = true; |
|
1669 TInt err = mEapGsIf->DeleteAllEapSettings(); |
|
1670 if (err != KErrNone) { |
|
1671 ret = false; |
|
1672 } |
|
1673 return ret; |
|
1674 } |
|
1675 |
|
1676 void EapQtConfigInterfacePrivate::loadPlugins() |
|
1677 { |
|
1678 qDebug("EapQtConfigInterfacePrivate::loadPlugins(), this = 0x%08x", this); |
|
1679 |
|
1680 checkInstanceThrowing(); |
|
1681 |
|
1682 // plugin directory defined in cpeapplugininterface.h |
|
1683 QDir pluginsDir(CpEapPluginInterfacePluginDirectory); |
|
1684 foreach( QString fileName, pluginsDir.entryList(QDir::Files) ) |
|
1685 { |
|
1686 QPluginLoader loader(pluginsDir.absoluteFilePath(fileName)); |
|
1687 QObject *tmp = loader.instance(); |
|
1688 if (tmp) { |
|
1689 CpEapPluginInterface *plugin = qobject_cast<CpEapPluginInterface*> (tmp); |
|
1690 if (plugin) { |
|
1691 mPlugins.append(plugin); |
|
1692 } |
|
1693 } |
|
1694 } |
|
1695 |
|
1696 // collect UI plugin infos |
|
1697 QList<CpEapPluginInterface*>::iterator iter; |
|
1698 for (iter = mPlugins.begin(); iter != mPlugins.end(); ++iter) { |
|
1699 mPluginInfos.append((*iter)->pluginInfo()); |
|
1700 } |
|
1701 |
|
1702 // sort the UI plugins according to their order number |
|
1703 qSort(mPluginInfos.begin(), mPluginInfos.end(), EapQtConfigInterfacePrivate::pluginLessThan); |
|
1704 |
|
1705 qDebug("EapQtConfigInterfacePrivate - loadPlugins: supported EAP plugin count: %d", |
|
1706 mPluginInfos.count()); |
|
1707 } |
|
1708 |
|
1709 bool EapQtConfigInterfacePrivate::pluginLessThan( |
|
1710 const EapQtPluginInfo &plugin1, |
|
1711 const EapQtPluginInfo &plugin2) |
|
1712 { |
|
1713 return plugin1.orderNumber() < plugin2.orderNumber(); |
|
1714 } |
|
1715 |
|
1716 CpBaseSettingView *EapQtConfigInterfacePrivate::uiInstance(const EapQtPluginHandle &outerHandle, |
|
1717 const EapQtPluginHandle &pluginHandle) |
|
1718 { |
|
1719 qDebug("EapQtConfigInterfacePrivate::uiInstance(), this = 0x%08x", this); |
|
1720 |
|
1721 checkInstanceThrowing(); |
|
1722 |
|
1723 // if outer type UI is requested, outerHandle must be undefined and pluginHandle |
|
1724 // must be supported as outer type |
|
1725 if (outerHandle == EapQtPluginHandle::PluginUndefined) { |
|
1726 if (!isSupportedOuterType(pluginHandle)) { |
|
1727 qDebug() << "ERROR: EapQtConfigInterfacePrivate::uiInstance() -" |
|
1728 << "plugin not supported as outer type"; |
|
1729 return NULL; |
|
1730 } |
|
1731 } |
|
1732 else { |
|
1733 // outerHandle defined, pluginHandle must be supported inside outerHandle |
|
1734 if (!isSupportedInnerType(outerHandle, pluginHandle)) { |
|
1735 qDebug() << "ERROR: EapQtConfigInterfacePrivate::uiInstance() -" |
|
1736 << "plugin not supported as the inner type of the specified outer type"; |
|
1737 return NULL; |
|
1738 } |
|
1739 } |
|
1740 |
|
1741 if (mTranslator.isNull()) { |
|
1742 // install translations for EAP UI plugins |
|
1743 mTranslator.reset(new HbTranslator(eapTranslationFile)); |
|
1744 } |
|
1745 |
|
1746 // go through all interfaces (dlls) |
|
1747 QList<CpEapPluginInterface*>::iterator iter; |
|
1748 for (iter = mPlugins.begin(); iter != mPlugins.end(); ++iter) { |
|
1749 QList<EapQtPluginInfo> plugins; |
|
1750 plugins.append((*iter)->pluginInfo()); |
|
1751 |
|
1752 // go through all plugings inside the interface implementation |
|
1753 QList<EapQtPluginInfo>::iterator j; |
|
1754 for (j = plugins.begin(); j != plugins.end(); ++j) { |
|
1755 if ((*j).pluginHandle() == pluginHandle) { |
|
1756 qDebug("EapQtConfigInterfacePrivate::uiInstance() - found plugin"); |
|
1757 // indicate configured IAP to plugin |
|
1758 (*iter)->setSettingsReference(getEapBearer(), mIapId); |
|
1759 return (*iter)->uiInstance(outerHandle, *j); |
|
1760 } |
|
1761 } |
|
1762 |
|
1763 } |
|
1764 qDebug("ERROR: EapQtConfigInterfacePrivate::uiInstance() - plugin not found"); |
|
1765 return NULL; |
|
1766 } |
|
1767 |
|
1768 EapQtConfigInterface::EapBearerType EapQtConfigInterfacePrivate::getEapBearer() |
|
1769 { |
|
1770 EapQtConfigInterface::EapBearerType ret(EapQtConfigInterface::EapBearerTypeWlan); |
|
1771 |
|
1772 switch (mEapBearer) { |
|
1773 case EVpn: |
|
1774 ret = EapQtConfigInterface::EapBearerTypeVpn; |
|
1775 break; |
|
1776 default: |
|
1777 ret = EapQtConfigInterface::EapBearerTypeWlan; |
|
1778 break; |
|
1779 } |
|
1780 return ret; |
|
1781 } |
|
1782 |
|
1783 EapQtValidator *EapQtConfigInterfacePrivate::validatorEap(const EapQtExpandedEapType &type, |
|
1784 const EapQtConfig::SettingsId id) |
|
1785 { |
|
1786 qDebug("EapQtConfigInterfacePrivate::validatorEap(), this = 0x%08x", this); |
|
1787 |
|
1788 qDebug() << "EapQtConfigInterfacePrivate::validatorEap() - requested EAP: " |
|
1789 << type.eapExpandedData().toHex(); |
|
1790 qDebug() << "EapQtConfigInterfacePrivate::validatorEap() - setting: " << id; |
|
1791 |
|
1792 EapQtValidator *ret = NULL; |
|
1793 |
|
1794 switch (id) { |
|
1795 |
|
1796 case EapQtConfig::Username: |
|
1797 switch (type.type()) { |
|
1798 case EapQtExpandedEapType::TypeEapAka: |
|
1799 case EapQtExpandedEapType::TypeEapFast: |
|
1800 case EapQtExpandedEapType::TypeEapGtc: |
|
1801 case EapQtExpandedEapType::TypeLeap: |
|
1802 case EapQtExpandedEapType::TypeEapMschapv2: |
|
1803 case EapQtExpandedEapType::TypePeap: |
|
1804 case EapQtExpandedEapType::TypeEapSim: |
|
1805 case EapQtExpandedEapType::TypeEapTls: |
|
1806 case EapQtExpandedEapType::TypeEapTtls: |
|
1807 case EapQtExpandedEapType::TypePap: |
|
1808 case EapQtExpandedEapType::TypePlainMschapv2: |
|
1809 ret = new EapQtValidatorUsername(type); |
|
1810 break; |
|
1811 default: |
|
1812 ret = NULL; |
|
1813 } |
|
1814 break; |
|
1815 |
|
1816 case EapQtConfig::Password: |
|
1817 switch (type.type()) { |
|
1818 case EapQtExpandedEapType::TypeEapGtc: |
|
1819 case EapQtExpandedEapType::TypeLeap: |
|
1820 case EapQtExpandedEapType::TypeEapMschapv2: |
|
1821 case EapQtExpandedEapType::TypePap: |
|
1822 case EapQtExpandedEapType::TypePlainMschapv2: |
|
1823 ret = new EapQtValidatorPassword(type); |
|
1824 break; |
|
1825 default: |
|
1826 ret = NULL; |
|
1827 } |
|
1828 break; |
|
1829 |
|
1830 case EapQtConfig::Realm: |
|
1831 switch (type.type()) { |
|
1832 case EapQtExpandedEapType::TypeEapAka: |
|
1833 case EapQtExpandedEapType::TypeEapFast: |
|
1834 case EapQtExpandedEapType::TypePeap: |
|
1835 case EapQtExpandedEapType::TypeEapSim: |
|
1836 case EapQtExpandedEapType::TypeEapTls: |
|
1837 case EapQtExpandedEapType::TypeEapTtls: |
|
1838 ret = new EapQtValidatorRealm(type); |
|
1839 break; |
|
1840 default: |
|
1841 ret = NULL; |
|
1842 } |
|
1843 break; |
|
1844 |
|
1845 default: |
|
1846 ret = NULL; |
|
1847 |
|
1848 } |
|
1849 |
|
1850 qDebug() << "EapQtConfigInterfacePrivate::validatorEap() - is returning NULL: " << (ret == NULL); |
|
1851 |
|
1852 return ret; |
|
1853 } |
|
1854 |
|
1855 bool EapQtConfigInterfacePrivate::readPacStoreConfiguration(EapQtPacStoreConfig& /* config */) |
|
1856 { |
|
1857 // not supported |
|
1858 return false; |
|
1859 } |
|
1860 |
|
1861 bool EapQtConfigInterfacePrivate::savePacStoreConfiguration(const EapQtPacStoreConfig& /* config */) |
|
1862 { |
|
1863 // not supported |
|
1864 return false; |
|
1865 } |
|
1866 |
|
1867 EapQtValidator *EapQtConfigInterfacePrivate::validatorPacStore( |
|
1868 const EapQtPacStoreConfig::PacStoreSettings id) |
|
1869 { |
|
1870 qDebug("EapQtConfigInterfacePrivate::validatorPacStore(), this = 0x%08x", this); |
|
1871 |
|
1872 EapQtValidator *ret = NULL; |
|
1873 |
|
1874 switch (id) { |
|
1875 case EapQtPacStoreConfig::PacStorePassword: |
|
1876 ret = new EapQtValidatorPacStorePassword(); |
|
1877 break; |
|
1878 case EapQtPacStoreConfig::PacStorePasswordConfirmation: |
|
1879 ret = new EapQtValidatorPacStorePasswordConfirm(); |
|
1880 break; |
|
1881 default: |
|
1882 ret = NULL; |
|
1883 } |
|
1884 |
|
1885 return ret; |
|
1886 } |