changeset 32 | 5c4486441ae6 |
parent 30 | 8dde790cab74 |
31:c16e04725da3 | 32:5c4486441ae6 |
---|---|
31 #include <datamobilitycommsdattypes.h> |
31 #include <datamobilitycommsdattypes.h> |
32 #include <commsdattypesv1_1.h> |
32 #include <commsdattypesv1_1.h> |
33 #include <WlanCdbCols.h> |
33 #include <WlanCdbCols.h> |
34 #include <commsdattypesv1_1.h> |
34 #include <commsdattypesv1_1.h> |
35 #include <wlancontainer.h> |
35 #include <wlancontainer.h> |
36 #include <EapType.h> |
|
37 |
36 |
38 using namespace CMManager; |
37 using namespace CMManager; |
39 |
38 |
40 // CONSTANTS |
39 // CONSTANTS |
41 |
40 |
57 // default port number |
56 // default port number |
58 const TUint32 KDefaultPortNum = 0; |
57 const TUint32 KDefaultPortNum = 0; |
59 |
58 |
60 // ratio between sizes of ascii and unicode characters |
59 // ratio between sizes of ascii and unicode characters |
61 const TUint KAsciiUnicodeRatio = 2; |
60 const TUint KAsciiUnicodeRatio = 2; |
62 |
|
63 // Length of expanded EAP type identifier |
|
64 const TUint KExpandedEAPIdLength = 8; |
|
65 |
|
66 // Plain MSCHAPv2 EAP identifier. Needed because of special handling |
|
67 const TUint8 KMschapv2TypeId[] = {0xfe, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x63}; |
|
68 |
61 |
69 // ================= MEMBER FUNCTIONS ======================= |
62 // ================= MEMBER FUNCTIONS ======================= |
70 |
63 |
71 CEapTypeElement::~CEapTypeElement() |
64 CEapTypeElement::~CEapTypeElement() |
72 { |
65 { |
142 // --------------------------------------------------------- |
135 // --------------------------------------------------------- |
143 // |
136 // |
144 CProcessorWlan::~CProcessorWlan() |
137 CProcessorWlan::~CProcessorWlan() |
145 { |
138 { |
146 delete iEmptyTag; |
139 delete iEmptyTag; |
140 REComSession::FinalClose(); |
|
147 } |
141 } |
148 |
142 |
149 // --------------------------------------------------------- |
143 // --------------------------------------------------------- |
150 // CProcessorWlan::ProcessSpecialFieldsL |
144 // CProcessorWlan::ProcessSpecialFieldsL |
151 // --------------------------------------------------------- |
145 // --------------------------------------------------------- |
599 |
593 |
600 TInt serviceId = iapRecord->iService; |
594 TInt serviceId = iapRecord->iService; |
601 |
595 |
602 CleanupStack::PopAndDestroy( iapRecord ); |
596 CleanupStack::PopAndDestroy( iapRecord ); |
603 |
597 |
604 TInt err = KErrNone; |
598 CEapType* eapType ( NULL ); |
605 TUint8 expandedEapId[] = {0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; |
599 TRAPD( leave, |
606 |
600 eapType = CEapType::NewL( ELan, |
607 TBuf8<KExpandedEAPIdLength> cue; |
601 serviceId, |
608 |
602 eap->iEapSettings->iEAPExpandedType ) ); |
609 // Set-up 64-bit expanded EAP id |
603 if ( leave == KErrNone ) |
610 if ( eap->iEapSettings->iEAPType == KMschapv2TypeId[7] ) |
604 { |
611 { |
605 CleanupStack::PushL( eapType ); |
612 // This is plain MSCHAPv2. Set vendor ID correctly |
606 |
613 expandedEapId[1] = KMschapv2TypeId[1]; |
607 // Inner EAP |
614 expandedEapId[2] = KMschapv2TypeId[2]; |
608 if ( eap->iEncapsulatingEapId != *EapExpandedTypeNone.GetType() ) |
615 expandedEapId[3] = KMschapv2TypeId[3]; |
609 { |
616 } |
610 eapType->SetTunnelingType( eap->iEncapsulatingEapId ); |
617 |
611 } |
618 expandedEapId[KExpandedEAPIdLength - 1] = static_cast<TUint8> ( eap->iEapSettings->iEAPType ); |
612 |
619 cue.Copy( expandedEapId, KExpandedEAPIdLength ); |
613 // write EAP setting |
620 |
614 eapType->SetConfigurationL(*eap->iEapSettings); |
621 // Try loading EAP ECOM module |
615 CleanupStack::PopAndDestroy( eapType ); |
622 CLOG_WRITE_FORMAT( "Try to load EAP module: %d", expandedEapId[7]); |
616 } |
623 CEapType* eapType = 0; |
617 } |
624 TRAP( err, eapType = CEapType::NewL( cue, ELan, serviceId ) ); |
618 |
625 // The error is caused by probably missing EAP method from the device. Ignore the error |
|
626 // because same scripts can be used for devices with and without certain methods. |
|
627 if( err == KErrNone ) |
|
628 { |
|
629 CleanupStack::PushL( eapType ); |
|
630 |
|
631 // Check if this type is tunneled |
|
632 if ( eap->iEncapsulatingEapId != EAPSettings::EEapNone ) |
|
633 { |
|
634 // It is tunneled. Take the last byte of the expanded id. |
|
635 eapType->SetTunnelingType( eap->iEncapsulatingEapId ); |
|
636 } |
|
637 CLOG_WRITE( "Calling eapType->SetConfiguration" ); |
|
638 eapType->SetConfigurationL( *eap->iEapSettings ); |
|
639 CLOG_WRITE( "eapType->SetConfiguration success!" ); |
|
640 CleanupStack::PopAndDestroy( eapType ); |
|
641 REComSession::FinalClose(); |
|
642 } |
|
643 } |
|
644 |
|
645 session->Close(); |
619 session->Close(); |
646 CleanupStack::PopAndDestroy( session ); |
620 CleanupStack::PopAndDestroy( session ); |
647 CLOG_WRITE( "Finished EAP settings saving" ); |
621 CLOG_WRITE( "Finished EAP settings saving" ); |
648 //iEapSettings.ResetAndDestroy(); |
|
649 |
622 |
650 CLOG_WRITE_FORMAT( "SaveSecurityInfoL end %d", iSecurityInfo->Count() ); |
623 CLOG_WRITE_FORMAT( "SaveSecurityInfoL end %d", iSecurityInfo->Count() ); |
651 } |
624 } |
652 |
625 |
653 // --------------------------------------------------------- |
626 // --------------------------------------------------------- |
1205 // --------------------------------------------------------- |
1178 // --------------------------------------------------------- |
1206 // |
1179 // |
1207 void CProcessorWlan::SaveWPAL( TUint32 aIapId ) |
1180 void CProcessorWlan::SaveWPAL( TUint32 aIapId ) |
1208 { |
1181 { |
1209 CLOG_WRITE( "CProcessorWlan::SaveWPAL enter" ); |
1182 CLOG_WRITE( "CProcessorWlan::SaveWPAL enter" ); |
1183 |
|
1210 CMDBSession* session = CMDBSession::NewL( CMDBSession::LatestVersion() ); |
1184 CMDBSession* session = CMDBSession::NewL( CMDBSession::LatestVersion() ); |
1211 CleanupStack::PushL( session ); |
1185 CleanupStack::PushL( session ); |
1212 |
1186 |
1213 // Load IAP record |
1187 // Load IAP record |
1214 CCDIAPRecord* iapRecord = static_cast<CCDIAPRecord *> |
1188 CCDIAPRecord* iapRecord = static_cast<CCDIAPRecord *> |
1249 secModeField->SetL( iSecurityMode ); |
1223 secModeField->SetL( iSecurityMode ); |
1250 |
1224 |
1251 CLOG_WRITE( "Wrote securityMode" ); |
1225 CLOG_WRITE( "Wrote securityMode" ); |
1252 |
1226 |
1253 // Save EAP list |
1227 // Save EAP list |
1254 SetExpandedEapListL( generic ); |
1228 SetExpandedEapListL( service ); |
1255 CLOG_WRITE( "Wrote expandedEapList" ); |
1229 CLOG_WRITE( "Wrote Expanded EAPList" ); |
1256 |
1230 |
1257 // Save PreShared Key |
1231 // Save PreShared Key |
1258 TBuf8<KMaxLengthOfKeyData> keyWPA; |
1232 TBuf8<KMaxLengthOfKeyData> keyWPA; |
1259 //convert to 8 bit |
1233 //convert to 8 bit |
1260 keyWPA.Copy( WPAFieldData( EWPAPresharedKey )->Des() ); |
1234 keyWPA.Copy( WPAFieldData( EWPAPresharedKey )->Des() ); |
1261 CMDBField<TDesC8>* wpaPskField = static_cast<CMDBField<TDesC8>*> |
1235 CMDBField<TDesC8>* wpaPskField = static_cast<CMDBField<TDesC8>*> |
1289 |
1263 |
1290 // --------------------------------------------------------- |
1264 // --------------------------------------------------------- |
1291 // CProcessorWlan::SetExpandedEapListL |
1265 // CProcessorWlan::SetExpandedEapListL |
1292 // --------------------------------------------------------- |
1266 // --------------------------------------------------------- |
1293 // |
1267 // |
1294 void CProcessorWlan::SetExpandedEapListL( CMDBGenericRecord* generic ) |
1268 void CProcessorWlan::SetExpandedEapListL( const TUint aServiceId ) |
1295 { |
1269 { |
1296 CLOG_WRITE( "CProcessorWlan::SetExpandedEapListL" ) |
1270 CLOG_WRITE( "CProcessorWlan::SetExpandedEapListL" ) |
1297 // Gets the text format eap list |
1271 // Gets the text format eap list |
1298 HBufC16* eapList = WPAFieldData( EWPAEapMethod ); |
1272 HBufC16* eapList = WPAFieldData( EWPAEapMethod ); |
1299 |
1273 |
1300 if ( eapList != NULL && 0 < eapList->Length() ) |
1274 if ( eapList != NULL && 0 < eapList->Length() ) |
1301 { |
1275 { |
1302 |
1276 // load general EAP settings If |
1303 // Read EAP method and save it as enabled eap list. |
1277 CEapGeneralSettings* eapGs; |
1304 // Fills expandedForm with 8 bytes: 0xFE, 6 zeros and EAP ID. |
1278 eapGs = CEapGeneralSettings::NewL( ELan, aServiceId ); |
1305 // That's the format expected by EAPOL. |
1279 CleanupStack::PushL( eapGs ); |
1306 TBuf8<8> expandedForm; |
1280 |
1307 expandedForm.AppendFill( 0xFE, 1 ); |
1281 // get lists of enabled/disabled EAPs for the IAP |
1308 expandedForm.AppendFill( 0x00, 6 ); |
1282 RArray< TEapExpandedType > enabledEapMethods; |
1309 |
1283 RArray< TEapExpandedType > disabledEapMethods; |
1310 TUint8 resultByte; |
1284 |
1311 TLex16 lex( eapList->Ptr() ); |
1285 enabledEapMethods.Append( GetExpandedEapTypeIdL( *eapList ) ); |
1312 User::LeaveIfError( lex.Val( resultByte, EDecimal ) ); |
1286 |
1313 expandedForm.AppendFill( resultByte, 1 ); |
1287 // disabledEapMethods can be empty, SetEapMethods takes care of it, |
1314 CLOG_WRITE_FORMAT( "CProcessorWlan::SetExpandedEapListL: EAP %d", |
1288 // only enabledEapMethods is a must with correct contents |
1315 (int)resultByte) |
1289 User::LeaveIfError( eapGs->SetEapMethods( enabledEapMethods, |
1316 |
1290 disabledEapMethods ) ); |
1317 CMDBField<TDesC8>* wlanEnabledEapsField = static_cast<CMDBField<TDesC8>*> |
1291 |
1318 ( generic->GetFieldByIdL( KCDTIdWlanEnabledEaps ) ); |
1292 CleanupStack::PopAndDestroy( eapGs ); |
1319 wlanEnabledEapsField->SetL( expandedForm ); |
1293 } |
1320 |
1294 } |
1321 // Save empty disabled EAP list |
1295 |
1322 HBufC8* disabledEapList = HBufC8::NewLC(0); |
1296 // --------------------------------------------------------- |
1323 CMDBField<TDesC8>* wlanDisabledEapsField = static_cast<CMDBField<TDesC8>*> |
1297 // CProcessorWlan::GetExpandedEapTypeId |
1324 ( generic->GetFieldByIdL( KCDTIdWlanDisabledEaps ) ); |
1298 // --------------------------------------------------------- |
1325 wlanDisabledEapsField->SetL( disabledEapList->Des() ); |
1299 // |
1326 CleanupStack::PopAndDestroy( disabledEapList ); |
1300 TEapExpandedType CProcessorWlan::GetExpandedEapTypeIdL( TDesC& aField ) |
1327 } |
1301 { |
1328 } |
1302 TUint8 resultByte; |
1329 |
1303 TLex16 lex( aField.Ptr() ); |
1304 User::LeaveIfError( lex.Val( resultByte, EDecimal ) ); |
|
1305 |
|
1306 CLOG_WRITE_FORMAT( "CProcessorWlan::GetExpandedEapTypeIdL: EAP %d", |
|
1307 (int)resultByte ) |
|
1308 |
|
1309 switch ( resultByte ) |
|
1310 { |
|
1311 case 0x06: |
|
1312 { |
|
1313 return *EapExpandedTypeGtc.GetType(); |
|
1314 } |
|
1315 case 0x0d: |
|
1316 { |
|
1317 return *EapExpandedTypeTls.GetType(); |
|
1318 } |
|
1319 case 0x11: |
|
1320 { |
|
1321 return *EapExpandedTypeLeap.GetType(); |
|
1322 } |
|
1323 case 0x12: |
|
1324 { |
|
1325 return *EapExpandedTypeSim.GetType(); |
|
1326 } |
|
1327 case 0x15: |
|
1328 { |
|
1329 return *EapExpandedTypeTtls.GetType(); |
|
1330 } |
|
1331 case 0x17: |
|
1332 { |
|
1333 return *EapExpandedTypeAka.GetType(); |
|
1334 } |
|
1335 case 0x19: |
|
1336 { |
|
1337 return *EapExpandedTypePeap.GetType(); |
|
1338 } |
|
1339 case 0x1a: |
|
1340 { |
|
1341 return *EapExpandedTypeMsChapv2.GetType(); |
|
1342 } |
|
1343 case 0x2b: |
|
1344 { |
|
1345 return *EapExpandedTypeFast.GetType(); |
|
1346 } |
|
1347 case 0x01: |
|
1348 { |
|
1349 return *EapExpandedTypeProtectedSetup.GetType(); |
|
1350 } |
|
1351 case 0x62: |
|
1352 { |
|
1353 return *EapExpandedTypeTtlsPap.GetType(); |
|
1354 } |
|
1355 case 0x63: |
|
1356 { |
|
1357 return *EapExpandedPlainMsChapv2.GetType(); |
|
1358 } |
|
1359 default: |
|
1360 { |
|
1361 return *EapExpandedTypeNone.GetType(); |
|
1362 } |
|
1363 } |
|
1364 } |
|
1330 |
1365 |
1331 // --------------------------------------------------------- |
1366 // --------------------------------------------------------- |
1332 // CProcessorWlan::WPAIndex |
1367 // CProcessorWlan::WPAIndex |
1333 // --------------------------------------------------------- |
1368 // --------------------------------------------------------- |
1334 // |
1369 // |
1337 __ASSERT_ALWAYS( aFieldId >= EWPAPresharedKey && aFieldId <= EWPAUseOfPresharedKey, |
1372 __ASSERT_ALWAYS( aFieldId >= EWPAPresharedKey && aFieldId <= EWPAUseOfPresharedKey, |
1338 User::Panic ( KPanicOutOfRange, KErrOutOfRange ) ); |
1373 User::Panic ( KPanicOutOfRange, KErrOutOfRange ) ); |
1339 |
1374 |
1340 return aFieldId - 0x2000 + iDataStart; |
1375 return aFieldId - 0x2000 + iDataStart; |
1341 } |
1376 } |
1342 |
|
1343 |
1377 |
1344 // --------------------------------------------------------- |
1378 // --------------------------------------------------------- |
1345 // CProcessorWlan::WPAFieldData |
1379 // CProcessorWlan::WPAFieldData |
1346 // --------------------------------------------------------- |
1380 // --------------------------------------------------------- |
1347 // |
1381 // |
1497 else |
1531 else |
1498 { |
1532 { |
1499 return EFalse; |
1533 return EFalse; |
1500 } |
1534 } |
1501 } |
1535 } |
1536 |
|
1502 // --------------------------------------------------------- |
1537 // --------------------------------------------------------- |
1503 // CProcessorWlan::GetEapTypeIdFromSettingId |
1538 // CProcessorWlan::GetEapTypeIdFromSettingId |
1504 // --------------------------------------------------------- |
1539 // --------------------------------------------------------- |
1505 // |
1540 // |
1506 EAPSettings::TEapType CProcessorWlan::GetEapTypeIdFromSettingId( const TInt aField ) |
1541 TEapExpandedType CProcessorWlan::GetEapTypeIdFromSettingId( const TInt aField ) |
1507 { |
1542 { |
1508 switch ( aField ) |
1543 switch ( aField ) |
1509 { |
1544 { |
1510 case EEapGtcUsername: |
1545 case EEapGtcUsername: |
1511 case EEapGtcSessionValidityTime: |
1546 case EEapGtcSessionValidityTime: |
1512 case EEapGtcEncapsulation: |
1547 case EEapGtcEncapsulation: |
1513 { |
1548 { |
1514 return EAPSettings::EEapGtc; |
1549 return *EapExpandedTypeGtc.GetType(); |
1515 } |
1550 } |
1516 case EEapTlsUsername: |
1551 case EEapTlsUsername: |
1517 case EEapTlsRealm: |
1552 case EEapTlsRealm: |
1518 case EEapTlsVerifyServerRealm: |
1553 case EEapTlsVerifyServerRealm: |
1519 case EEapTlsRequireClientAuth: |
1554 case EEapTlsRequireClientAuth: |
1525 case EEapTlsCaCertSubjectKeyId: |
1560 case EEapTlsCaCertSubjectKeyId: |
1526 case EEapTlsCaCertIssuerName: |
1561 case EEapTlsCaCertIssuerName: |
1527 case EEapTlsCaCertSerialNumber: |
1562 case EEapTlsCaCertSerialNumber: |
1528 case EEapTlsEncapsulation: |
1563 case EEapTlsEncapsulation: |
1529 { |
1564 { |
1530 return EAPSettings::EEapTls; |
1565 return *EapExpandedTypeTls.GetType(); |
1531 } |
1566 } |
1532 case EEapLeapUsername: |
1567 case EEapLeapUsername: |
1533 case EEapLeapPassword: |
1568 case EEapLeapPassword: |
1534 case EEapLeapSessionValidityTime: |
1569 case EEapLeapSessionValidityTime: |
1535 { |
1570 { |
1536 return EAPSettings::EEapLeap; |
1571 return *EapExpandedTypeLeap.GetType(); |
1537 } |
1572 } |
1538 case EEapSimUsername: |
1573 case EEapSimUsername: |
1539 case EEapSimRealm: |
1574 case EEapSimRealm: |
1540 case EEapSimUsePseudonyms: |
1575 case EEapSimUsePseudonyms: |
1541 case EEapSimSessionValidityTime: |
1576 case EEapSimSessionValidityTime: |
1542 case EEapSimEncapsulation: |
1577 case EEapSimEncapsulation: |
1543 { |
1578 { |
1544 return EAPSettings::EEapSim; |
1579 return *EapExpandedTypeSim.GetType(); |
1545 } |
1580 } |
1546 case EEapTtlsUsername: |
1581 case EEapTtlsUsername: |
1547 case EEapTtlsRealm: |
1582 case EEapTtlsRealm: |
1548 case EEapTtlsVerifyServerRealm: |
1583 case EEapTtlsVerifyServerRealm: |
1549 case EEapTtlsRequireClientAuth: |
1584 case EEapTtlsRequireClientAuth: |
1555 case EEapTtlsUserCertSerialNumber: |
1590 case EEapTtlsUserCertSerialNumber: |
1556 case EEapTtlsCaCertSubjectKeyId: |
1591 case EEapTtlsCaCertSubjectKeyId: |
1557 case EEapTtlsCaCertIssuerName: |
1592 case EEapTtlsCaCertIssuerName: |
1558 case EEapTtlsCaCertSerialNumber: |
1593 case EEapTtlsCaCertSerialNumber: |
1559 { |
1594 { |
1560 return EAPSettings::EEapTtls; |
1595 return *EapExpandedTypeTtls.GetType(); |
1561 } |
1596 } |
1562 case EEapAkaUsername: |
1597 case EEapAkaUsername: |
1563 case EEapAkaRealm: |
1598 case EEapAkaRealm: |
1564 case EEapAkaUsePseudonyms: |
1599 case EEapAkaUsePseudonyms: |
1565 case EEapAkaSessionValidityTime: |
1600 case EEapAkaSessionValidityTime: |
1566 case EEapAkaEncapsulation: |
1601 case EEapAkaEncapsulation: |
1567 { |
1602 { |
1568 return EAPSettings::EEapAka; |
1603 return *EapExpandedTypeAka.GetType(); |
1569 } |
1604 } |
1570 case EEapPeapUsername: |
1605 case EEapPeapUsername: |
1571 case EEapPeapRealm: |
1606 case EEapPeapRealm: |
1572 case EEapPeapVerifyServerRealm: |
1607 case EEapPeapVerifyServerRealm: |
1573 case EEapPeapRequireClientAuth: |
1608 case EEapPeapRequireClientAuth: |
1582 case EEapPeapUserCertSerialNumber: |
1617 case EEapPeapUserCertSerialNumber: |
1583 case EEapPeapCaCertSubjectKeyId: |
1618 case EEapPeapCaCertSubjectKeyId: |
1584 case EEapPeapCaCertIssuerName: |
1619 case EEapPeapCaCertIssuerName: |
1585 case EEapPeapCaCertSerialNumber: |
1620 case EEapPeapCaCertSerialNumber: |
1586 { |
1621 { |
1587 return EAPSettings::EEapPeap; |
1622 return *EapExpandedTypePeap.GetType(); |
1588 } |
1623 } |
1589 case EEapMschapv2Username: |
1624 case EEapMschapv2Username: |
1590 case EEapMschapv2Password: |
1625 case EEapMschapv2Password: |
1591 case EEapMschapv2SessionValidityTime: |
1626 case EEapMschapv2SessionValidityTime: |
1592 case EEapMschapv2Encapsulation: |
1627 case EEapMschapv2Encapsulation: |
1593 { |
1628 { |
1594 return EAPSettings::EEapMschapv2; |
1629 return *EapExpandedTypeMsChapv2.GetType(); |
1595 } |
1630 } |
1596 case EEapFastUsername: |
1631 case EEapFastUsername: |
1597 case EEapFastRealm: |
1632 case EEapFastRealm: |
1598 case EEapFastVerifyServerRealm: |
1633 case EEapFastVerifyServerRealm: |
1599 case EEapFastRequireClientAuth: |
1634 case EEapFastRequireClientAuth: |
1610 case EEapFastUserCertSerialNumber: |
1645 case EEapFastUserCertSerialNumber: |
1611 case EEapFastCaCertSubjectKeyId: |
1646 case EEapFastCaCertSubjectKeyId: |
1612 case EEapFastCaCertIssuerName: |
1647 case EEapFastCaCertIssuerName: |
1613 case EEapFastCaCertSerialNumber: |
1648 case EEapFastCaCertSerialNumber: |
1614 { |
1649 { |
1615 return EAPSettings::EEapFast; |
1650 return *EapExpandedTypeFast.GetType(); |
1616 } |
1651 } |
1617 |
1652 |
1618 case EMschapv2Username: |
1653 case EMschapv2Username: |
1619 case EMschapv2Password: |
1654 case EMschapv2Password: |
1620 case EMschapv2SessionValidityTime: |
1655 case EMschapv2SessionValidityTime: |
1621 case EMschapv2Encapsulation: |
1656 case EMschapv2Encapsulation: |
1622 { |
1657 { |
1623 return EAPSettings::EPlainMschapv2; |
1658 return *EapExpandedPlainMsChapv2.GetType(); |
1624 } |
1659 } |
1625 default: |
1660 default: |
1626 { |
1661 { |
1627 return EAPSettings::EEapNone; |
1662 return *EapExpandedTypeNone.GetType(); |
1628 } |
1663 } |
1629 |
1664 |
1630 } |
1665 } |
1631 } |
1666 } |
1667 |
|
1632 // --------------------------------------------------------- |
1668 // --------------------------------------------------------- |
1633 // CProcessorWlan::AddEAPSetting |
1669 // CProcessorWlan::AddEAPSetting |
1634 // --------------------------------------------------------- |
1670 // --------------------------------------------------------- |
1635 // |
1671 // |
1636 void CProcessorWlan::AddEAPSettingL( const TInt aField, const HBufC16* const aValue ) |
1672 void CProcessorWlan::AddEAPSettingL( const TInt aField, HBufC16* aValue ) |
1637 { |
1673 { |
1638 EAPSettings::TEapType eapId = GetEapTypeIdFromSettingId( aField ); |
1674 TEapExpandedType eapId = GetEapTypeIdFromSettingId( aField ); |
1639 if ( eapId == EAPSettings::EEapNone ) |
1675 if ( eapId == *EapExpandedTypeNone.GetType() ) |
1640 { |
1676 { |
1641 CLOG_WRITE( "! Error : Unknown EAP method" ); |
1677 CLOG_WRITE( "! Error : Unknown EAP method" ); |
1642 User::Leave( KErrArgument ); |
1678 User::Leave( KErrArgument ); |
1643 } |
1679 } |
1644 |
1680 |
1645 TInt eapIndex(0); |
1681 TInt eapIndex(0); |
1646 // Search if the EAP instance already exists in the array for this |
1682 // Search if the EAP instance already exists in the array for this |
1647 for ( eapIndex = 0 ; eapIndex < iEapSettings.Count() ; eapIndex++ ) |
1683 for ( eapIndex = 0 ; eapIndex < iEapSettings.Count() ; eapIndex++ ) |
1648 { |
1684 { |
1649 if ( ( iEapSettings[eapIndex]->iEapSettings->iEAPType == eapId ) |
1685 if ( ( iEapSettings[eapIndex]->iEapSettings->iEAPExpandedType == eapId ) |
1650 && ( iEapSettings[eapIndex]->iName != NULL ) |
1686 && ( iEapSettings[eapIndex]->iName != NULL ) |
1651 && ( iEapSettings[eapIndex]->iName->Compare( *iName ) == 0 )) |
1687 && ( iEapSettings[eapIndex]->iName->Compare( *iName ) == 0 )) |
1652 { |
1688 { |
1653 // Found it |
1689 // Found it |
1654 break; |
1690 break; |
1661 CEapTypeElement* newEap = new (ELeave) CEapTypeElement; |
1697 CEapTypeElement* newEap = new (ELeave) CEapTypeElement; |
1662 CleanupStack::PushL( newEap ); |
1698 CleanupStack::PushL( newEap ); |
1663 |
1699 |
1664 newEap->iEapSettings = new (ELeave) EAPSettings; |
1700 newEap->iEapSettings = new (ELeave) EAPSettings; |
1665 |
1701 |
1666 newEap->iEapSettings->iEAPType = eapId; |
1702 newEap->iEapSettings->iEAPExpandedType = eapId; |
1667 |
1703 |
1668 newEap->iName = iName->AllocL(); |
1704 newEap->iName = iName->AllocL(); |
1669 |
1705 |
1670 iEapSettings.AppendL(newEap); |
1706 iEapSettings.AppendL(newEap); |
1671 |
1707 |
1688 case EEapFastUsername: |
1724 case EEapFastUsername: |
1689 case EMschapv2Username: |
1725 case EMschapv2Username: |
1690 { |
1726 { |
1691 iEapSettings[eapIndex]->iEapSettings->iUsernamePresent = ETrue; |
1727 iEapSettings[eapIndex]->iEapSettings->iUsernamePresent = ETrue; |
1692 iEapSettings[eapIndex]->iEapSettings->iUsername.Copy( *aValue ); |
1728 iEapSettings[eapIndex]->iEapSettings->iUsername.Copy( *aValue ); |
1729 iEapSettings[eapIndex]->iEapSettings->iUseAutomaticUsernamePresent = ETrue; |
|
1730 iEapSettings[eapIndex]->iEapSettings->iUseAutomaticUsername = EFalse; |
|
1693 break; |
1731 break; |
1694 } |
1732 } |
1695 |
1733 |
1696 case EEapLeapPassword: |
1734 case EEapLeapPassword: |
1697 case EEapMschapv2Password: |
1735 case EEapMschapv2Password: |
1698 case EMschapv2Password: |
1736 case EMschapv2Password: |
1699 { |
1737 { |
1700 iEapSettings[eapIndex]->iEapSettings->iPasswordPresent = ETrue; |
1738 iEapSettings[eapIndex]->iEapSettings->iPasswordPresent = ETrue; |
1701 iEapSettings[eapIndex]->iEapSettings->iPassword.Copy( *aValue ); |
1739 iEapSettings[eapIndex]->iEapSettings->iPassword.Copy( *aValue ); |
1740 iEapSettings[eapIndex]->iEapSettings->iShowPassWordPromptPresent = ETrue; |
|
1741 iEapSettings[eapIndex]->iEapSettings->iUseAutomaticUsername = EFalse; |
|
1702 break; |
1742 break; |
1703 } |
1743 } |
1704 |
1744 |
1705 case EEapTlsRealm: |
1745 case EEapTlsRealm: |
1706 case EEapSimRealm: |
1746 case EEapSimRealm: |
1708 case EEapAkaRealm: |
1748 case EEapAkaRealm: |
1709 case EEapPeapRealm: |
1749 case EEapPeapRealm: |
1710 case EEapFastRealm: |
1750 case EEapFastRealm: |
1711 { |
1751 { |
1712 iEapSettings[eapIndex]->iEapSettings->iRealmPresent = ETrue; |
1752 iEapSettings[eapIndex]->iEapSettings->iRealmPresent = ETrue; |
1713 iEapSettings[eapIndex]->iEapSettings->iRealm.Copy( *aValue ); |
1753 iEapSettings[eapIndex]->iEapSettings->iRealm.Copy( *aValue ); |
1754 iEapSettings[eapIndex]->iEapSettings->iUseAutomaticRealmPresent = ETrue; |
|
1755 iEapSettings[eapIndex]->iEapSettings->iUseAutomaticRealm = EFalse; |
|
1714 break; |
1756 break; |
1715 } |
1757 } |
1716 |
1758 |
1717 case EEapGtcSessionValidityTime: |
1759 case EEapGtcSessionValidityTime: |
1718 case EEapTtlsSessionValidityTime: |
1760 case EEapTtlsSessionValidityTime: |
1728 // Convert the input parameter to integer |
1770 // Convert the input parameter to integer |
1729 TLex lex( *aValue ); |
1771 TLex lex( *aValue ); |
1730 TUint value( 0 ); |
1772 TUint value( 0 ); |
1731 if( lex.Val( value, EDecimal) != KErrNone ) |
1773 if( lex.Val( value, EDecimal) != KErrNone ) |
1732 { |
1774 { |
1733 CLOG_WRITE_FORMAT( "! Error : Invalid session validity time value. EapId: %d", eapId ); |
1775 CLOG_WRITE_FORMAT( "! Error : Invalid session validity time value. EapId: %d", eapId.GetVendorType() ); |
1734 User::Leave( KErrArgument ); |
1776 User::Leave( KErrArgument ); |
1735 } |
1777 } |
1736 |
1778 |
1737 iEapSettings[eapIndex]->iEapSettings->iSessionValidityTimePresent = ETrue; |
1779 iEapSettings[eapIndex]->iEapSettings->iSessionValidityTimePresent = ETrue; |
1738 iEapSettings[eapIndex]->iEapSettings->iSessionValidityTime = value; |
1780 iEapSettings[eapIndex]->iEapSettings->iSessionValidityTime = value; |
1748 { |
1790 { |
1749 TLex lex( *aValue ); |
1791 TLex lex( *aValue ); |
1750 TUint eapTypeId( 0 ); |
1792 TUint eapTypeId( 0 ); |
1751 if( lex.Val( eapTypeId, EDecimal) != KErrNone ) |
1793 if( lex.Val( eapTypeId, EDecimal) != KErrNone ) |
1752 { |
1794 { |
1753 CLOG_WRITE_FORMAT( "! Error : Invalid encapsulation value. EapId: %d", eapId ); |
1795 CLOG_WRITE_FORMAT( "! Error : Invalid encapsulation value. EapId: %d", eapId.GetVendorType() ); |
1754 User::Leave( KErrArgument ); |
1796 User::Leave( KErrArgument ); |
1755 } |
1797 } |
1756 |
1798 iEapSettings[eapIndex]->iEncapsulatingEapId.SetValue( eapId.GetVendorId(), eapTypeId ); |
1757 iEapSettings[eapIndex]->iEncapsulatingEapId = static_cast< EAPSettings::TEapType >( eapTypeId ); |
|
1758 break; |
1799 break; |
1759 } |
1800 } |
1760 |
1801 |
1761 case EEapTlsVerifyServerRealm: |
1802 case EEapTlsVerifyServerRealm: |
1762 case EEapTtlsVerifyServerRealm: |
1803 case EEapTtlsVerifyServerRealm: |
1773 iEapSettings[eapIndex]->iEapSettings->iVerifyServerRealmPresent = ETrue; |
1814 iEapSettings[eapIndex]->iEapSettings->iVerifyServerRealmPresent = ETrue; |
1774 iEapSettings[eapIndex]->iEapSettings->iVerifyServerRealm = EFalse; |
1815 iEapSettings[eapIndex]->iEapSettings->iVerifyServerRealm = EFalse; |
1775 } |
1816 } |
1776 else |
1817 else |
1777 { |
1818 { |
1778 CLOG_WRITE_FORMAT( "! Error : Invalid VerifyServerRealm. EapId: %d", eapId ); |
1819 CLOG_WRITE_FORMAT( "! Error : Invalid VerifyServerRealm. EapId: %d", eapId.GetVendorType() ); |
1779 User::Leave( KErrArgument ); |
1820 User::Leave( KErrArgument ); |
1780 } |
1821 } |
1781 |
1822 |
1782 break; |
1823 break; |
1783 } |
1824 } |
1797 iEapSettings[eapIndex]->iEapSettings->iRequireClientAuthenticationPresent = ETrue; |
1838 iEapSettings[eapIndex]->iEapSettings->iRequireClientAuthenticationPresent = ETrue; |
1798 iEapSettings[eapIndex]->iEapSettings->iRequireClientAuthentication = EFalse; |
1839 iEapSettings[eapIndex]->iEapSettings->iRequireClientAuthentication = EFalse; |
1799 } |
1840 } |
1800 else |
1841 else |
1801 { |
1842 { |
1802 CLOG_WRITE_FORMAT( "! Error : Invalid RequireClientAuth. EapId: %d", eapId ); |
1843 CLOG_WRITE_FORMAT( "! Error : Invalid RequireClientAuth. EapId: %d", eapId.GetVendorType() ); |
1803 User::Leave( KErrArgument ); |
1844 User::Leave( KErrArgument ); |
1804 } |
1845 } |
1805 |
1846 |
1806 break; |
1847 break; |
1807 } |
1848 } |
1812 case EEapFastCipherSuites: |
1853 case EEapFastCipherSuites: |
1813 { |
1854 { |
1814 TRAPD( err, FillCipherSuitesL( aValue, eapIndex ) ); |
1855 TRAPD( err, FillCipherSuitesL( aValue, eapIndex ) ); |
1815 if( err != KErrNone ) |
1856 if( err != KErrNone ) |
1816 { |
1857 { |
1817 CLOG_WRITE_FORMAT( "! Error : Invalid CipherSuites. EapId: %d", eapId ); |
1858 CLOG_WRITE_FORMAT( "! Error : Invalid CipherSuites. EapId: %d", eapId.GetVendorType() ); |
1818 User::Leave( KErrArgument ); |
1859 User::Leave( KErrArgument ); |
1819 } |
1860 } |
1820 break; |
1861 break; |
1821 } |
1862 } |
1822 |
1863 |
1823 case EEapTlsUserCertSubjectKeyId: |
1864 case EEapTlsUserCertSubjectKeyId: |
1824 case EEapTtlsUserCertSubjectKeyId: |
1865 case EEapTtlsUserCertSubjectKeyId: |
1825 case EEapPeapUserCertSubjectKeyId: |
1866 case EEapPeapUserCertSubjectKeyId: |
1826 case EEapFastUserCertSubjectKeyId: |
1867 case EEapFastUserCertSubjectKeyId: |
1827 { |
1868 { |
1828 TInt certIndex = FindCertificateEntryL( CertificateEntry::EUser, eapIndex ); |
1869 TInt certIndex = FindCertificateEntryL( EapCertificateEntry::EUser, eapIndex ); |
1829 |
1870 |
1830 TBuf<KKeyIdentifierLength> key; |
1871 TKeyIdentifier key; |
1831 |
1872 |
1832 TRAPD( err, ConvertSubjectKeyIdToBinaryL( aValue, key) ); |
1873 TRAPD( err, ConvertSubjectKeyIdToBinaryL( aValue, key) ); |
1833 if( err != KErrNone ) |
1874 if( err != KErrNone ) |
1834 { |
1875 { |
1835 CLOG_WRITE_FORMAT( "! Error : Invalid UserCertSubjectKeyId. EapId: %d", eapId ); |
1876 CLOG_WRITE_FORMAT( "! Error : Invalid UserCertSubjectKeyId. EapId: %d", eapId.GetVendorType() ); |
1836 User::Leave( KErrArgument ); |
1877 User::Leave( KErrArgument ); |
1837 } |
1878 } |
1838 |
1879 |
1839 iEapSettings[eapIndex]->iEapSettings->iCertificatesPresent = ETrue; |
1880 iEapSettings[eapIndex]->iEapSettings->iCertificatesPresent = ETrue; |
1840 iEapSettings[eapIndex]->iEapSettings->iCertificates[certIndex].iSubjectKeyID.Copy(key); |
1881 iEapSettings[eapIndex]->iEapSettings->iCertificates[certIndex]->SetIsEnabled( ETrue ); |
1841 iEapSettings[eapIndex]->iEapSettings->iCertificates[certIndex].iSubjectKeyIDPresent = ETrue; |
1882 iEapSettings[eapIndex]->iEapSettings->iCertificates[certIndex]->SetSubjectKeyId( key ); |
1883 iEapSettings[eapIndex]->iEapSettings->iCertificates[certIndex]->SetSubjectKeyIdPresent(); |
|
1842 break; |
1884 break; |
1843 } |
1885 } |
1844 |
1886 |
1845 case EEapTlsUserCertIssuerName: |
1887 case EEapTlsUserCertIssuerName: |
1846 case EEapTtlsUserCertIssuerName: |
1888 case EEapTtlsUserCertIssuerName: |
1847 case EEapPeapUserCertIssuerName: |
1889 case EEapPeapUserCertIssuerName: |
1848 case EEapFastUserCertIssuerName: |
1890 case EEapFastUserCertIssuerName: |
1849 { |
1891 { |
1850 TUint certIndex = FindCertificateEntryL( CertificateEntry::EUser, eapIndex ); |
1892 TUint certIndex = FindCertificateEntryL( EapCertificateEntry::EUser, eapIndex ); |
1851 |
1893 |
1852 iEapSettings[eapIndex]->iEapSettings->iCertificatesPresent = ETrue; |
1894 iEapSettings[eapIndex]->iEapSettings->iCertificatesPresent = ETrue; |
1853 iEapSettings[eapIndex]->iEapSettings->iCertificates[certIndex].iIssuerNamePresent= ETrue; |
1895 iEapSettings[eapIndex]->iEapSettings->iCertificates[certIndex]->SetIsEnabled( ETrue ); |
1854 iEapSettings[eapIndex]->iEapSettings->iCertificates[certIndex].iIssuerName.Copy( *aValue ); |
1896 iEapSettings[eapIndex]->iEapSettings->iCertificates[certIndex]->SetSubjectKeyIdPresent(); |
1897 iEapSettings[eapIndex]->iEapSettings->iCertificates[certIndex]->SetIssuerName( *aValue ); |
|
1855 break; |
1898 break; |
1856 } |
1899 } |
1857 |
1900 |
1858 case EEapTlsUserCertSerialNumber: |
1901 case EEapTlsUserCertSerialNumber: |
1859 case EEapTtlsUserCertSerialNumber: |
1902 case EEapTtlsUserCertSerialNumber: |
1860 case EEapPeapUserCertSerialNumber: |
1903 case EEapPeapUserCertSerialNumber: |
1861 case EEapFastUserCertSerialNumber: |
1904 case EEapFastUserCertSerialNumber: |
1862 { |
1905 { |
1863 TUint certIndex = FindCertificateEntryL( CertificateEntry::EUser, eapIndex ); |
1906 TUint certIndex = FindCertificateEntryL( EapCertificateEntry::EUser, eapIndex ); |
1864 |
1907 |
1865 iEapSettings[eapIndex]->iEapSettings->iCertificatesPresent = ETrue; |
1908 iEapSettings[eapIndex]->iEapSettings->iCertificatesPresent = ETrue; |
1866 iEapSettings[eapIndex]->iEapSettings->iCertificates[certIndex].iSerialNumberPresent= ETrue; |
1909 iEapSettings[eapIndex]->iEapSettings->iCertificates[certIndex]->SetIsEnabled( ETrue ); |
1867 iEapSettings[eapIndex]->iEapSettings->iCertificates[certIndex].iSerialNumber.Copy( *aValue ); |
1910 iEapSettings[eapIndex]->iEapSettings->iCertificates[certIndex]->SetSerialNumberPresent(); |
1911 iEapSettings[eapIndex]->iEapSettings->iCertificates[certIndex]->SetSerialNumber( *aValue ); |
|
1868 break; |
1912 break; |
1869 } |
1913 } |
1870 |
1914 |
1871 case EEapTlsCaCertSubjectKeyId: |
1915 case EEapTlsCaCertSubjectKeyId: |
1872 case EEapTtlsCaCertSubjectKeyId: |
1916 case EEapTtlsCaCertSubjectKeyId: |
1873 case EEapPeapCaCertSubjectKeyId: |
1917 case EEapPeapCaCertSubjectKeyId: |
1874 case EEapFastCaCertSubjectKeyId: |
1918 case EEapFastCaCertSubjectKeyId: |
1875 { |
1919 { |
1876 TInt certIndex = FindCertificateEntryL( CertificateEntry::ECA, eapIndex ); |
1920 TInt certIndex = FindCertificateEntryL( EapCertificateEntry::ECA, eapIndex ); |
1877 |
1921 |
1878 TBuf<KKeyIdentifierLength> key; |
1922 TKeyIdentifier key; |
1879 |
1923 |
1880 TRAPD( err, ConvertSubjectKeyIdToBinaryL( aValue, key) ); |
1924 TRAPD( err, ConvertSubjectKeyIdToBinaryL( aValue, key) ); |
1881 if( err != KErrNone ) |
1925 if( err != KErrNone ) |
1882 { |
1926 { |
1883 CLOG_WRITE_FORMAT( "! Error : Invalid UserCertSubjectKeyId. EapId: %d", eapId ); |
1927 CLOG_WRITE_FORMAT( "! Error : Invalid UserCertSubjectKeyId. EapId: %d", eapId.GetVendorType() ); |
1884 User::Leave( KErrArgument ); |
1928 User::Leave( KErrArgument ); |
1885 } |
1929 } |
1886 |
1930 |
1887 iEapSettings[eapIndex]->iEapSettings->iCertificatesPresent = ETrue; |
1931 iEapSettings[eapIndex]->iEapSettings->iCertificatesPresent = ETrue; |
1888 iEapSettings[eapIndex]->iEapSettings->iCertificates[certIndex].iSubjectKeyID.Copy(key); |
1932 iEapSettings[eapIndex]->iEapSettings->iCertificates[certIndex]->SetIsEnabled( ETrue ); |
1889 iEapSettings[eapIndex]->iEapSettings->iCertificates[certIndex].iSubjectKeyIDPresent = ETrue; |
1933 iEapSettings[eapIndex]->iEapSettings->iCertificates[certIndex]->SetSubjectKeyId( key ); |
1934 iEapSettings[eapIndex]->iEapSettings->iCertificates[certIndex]->SetSubjectKeyIdPresent(); |
|
1935 iEapSettings[eapIndex]->iEapSettings->iUseAutomaticCACertificatePresent = ETrue; |
|
1936 iEapSettings[eapIndex]->iEapSettings->iUseAutomaticCACertificate = EFalse; |
|
1890 break; |
1937 break; |
1891 } |
1938 } |
1892 |
1939 |
1893 case EEapTlsCaCertIssuerName: |
1940 case EEapTlsCaCertIssuerName: |
1894 case EEapTtlsCaCertIssuerName: |
1941 case EEapTtlsCaCertIssuerName: |
1895 case EEapPeapCaCertIssuerName: |
1942 case EEapPeapCaCertIssuerName: |
1896 case EEapFastCaCertIssuerName: |
1943 case EEapFastCaCertIssuerName: |
1897 { |
1944 { |
1898 TUint certIndex = FindCertificateEntryL( CertificateEntry::ECA, eapIndex ); |
1945 TUint certIndex = FindCertificateEntryL( EapCertificateEntry::ECA, eapIndex ); |
1899 iEapSettings[eapIndex]->iEapSettings->iCertificatesPresent = ETrue; |
1946 iEapSettings[eapIndex]->iEapSettings->iCertificatesPresent = ETrue; |
1900 iEapSettings[eapIndex]->iEapSettings->iCertificates[certIndex].iIssuerNamePresent= ETrue; |
1947 iEapSettings[eapIndex]->iEapSettings->iCertificates[certIndex]->SetIsEnabled( ETrue ); |
1901 iEapSettings[eapIndex]->iEapSettings->iCertificates[certIndex].iIssuerName.Copy( *aValue ); |
1948 iEapSettings[eapIndex]->iEapSettings->iCertificates[certIndex]->SetIssuerNamePresent(); |
1949 iEapSettings[eapIndex]->iEapSettings->iCertificates[certIndex]->SetIssuerName( *aValue ); |
|
1950 iEapSettings[eapIndex]->iEapSettings->iUseAutomaticCACertificatePresent = ETrue; |
|
1951 iEapSettings[eapIndex]->iEapSettings->iUseAutomaticCACertificate = EFalse; |
|
1902 |
1952 |
1903 break; |
1953 break; |
1904 } |
1954 } |
1905 |
1955 |
1906 case EEapTlsCaCertSerialNumber: |
1956 case EEapTlsCaCertSerialNumber: |
1907 case EEapTtlsCaCertSerialNumber: |
1957 case EEapTtlsCaCertSerialNumber: |
1908 case EEapPeapCaCertSerialNumber: |
1958 case EEapPeapCaCertSerialNumber: |
1909 case EEapFastCaCertSerialNumber: |
1959 case EEapFastCaCertSerialNumber: |
1910 { |
1960 { |
1911 TUint certIndex = FindCertificateEntryL( CertificateEntry::ECA, eapIndex ); |
1961 TUint certIndex = FindCertificateEntryL( EapCertificateEntry::ECA, eapIndex ); |
1912 iEapSettings[eapIndex]->iEapSettings->iCertificatesPresent = ETrue; |
1962 iEapSettings[eapIndex]->iEapSettings->iCertificatesPresent = ETrue; |
1913 iEapSettings[eapIndex]->iEapSettings->iCertificates[certIndex].iSerialNumberPresent= ETrue; |
1963 iEapSettings[eapIndex]->iEapSettings->iCertificates[certIndex]->SetIsEnabled( ETrue ); |
1914 iEapSettings[eapIndex]->iEapSettings->iCertificates[certIndex].iSerialNumber.Copy( *aValue ); |
1964 iEapSettings[eapIndex]->iEapSettings->iCertificates[certIndex]->SetSerialNumberPresent(); |
1965 iEapSettings[eapIndex]->iEapSettings->iCertificates[certIndex]->SetSerialNumber( *aValue ); |
|
1966 iEapSettings[eapIndex]->iEapSettings->iUseAutomaticCACertificatePresent = ETrue; |
|
1967 iEapSettings[eapIndex]->iEapSettings->iUseAutomaticCACertificate = EFalse; |
|
1915 break; |
1968 break; |
1916 } |
1969 } |
1917 |
1970 |
1918 case EEapSimUsePseudonyms: |
1971 case EEapSimUsePseudonyms: |
1919 case EEapAkaUsePseudonyms: |
1972 case EEapAkaUsePseudonyms: |
1928 iEapSettings[eapIndex]->iEapSettings->iUsePseudonymsPresent = ETrue; |
1981 iEapSettings[eapIndex]->iEapSettings->iUsePseudonymsPresent = ETrue; |
1929 iEapSettings[eapIndex]->iEapSettings->iUsePseudonyms = EFalse; |
1982 iEapSettings[eapIndex]->iEapSettings->iUsePseudonyms = EFalse; |
1930 } |
1983 } |
1931 else |
1984 else |
1932 { |
1985 { |
1933 CLOG_WRITE_FORMAT( "! Error : Invalid UsePseudonyms. EapId: %d", eapId ); |
1986 CLOG_WRITE_FORMAT( "! Error : Invalid UsePseudonyms. EapId: %d", eapId.GetVendorType() ); |
1934 User::Leave( KErrArgument ); |
1987 User::Leave( KErrArgument ); |
1935 } |
1988 } |
1936 break; |
1989 break; |
1937 } |
1990 } |
1938 |
1991 |
1939 case EEapTtlsEncapsulatedTypes: |
1992 case EEapTtlsEncapsulatedTypes: |
1940 case EEapPeapEncapsulatedTypes: |
1993 case EEapPeapEncapsulatedTypes: |
1941 case EEapFastEncapsulatedTypes: |
1994 case EEapFastEncapsulatedTypes: |
1942 { |
1995 { |
1943 // Lenght of a 3 digit long signed number |
1996 iEapSettings[eapIndex]->iEapSettings->iEnabledEncapsulatedEAPExpandedTypes.Append( GetExpandedEapTypeIdL( *aValue ) ); |
1944 const TInt sliceLength = 4; |
1997 iEapSettings[eapIndex]->iEapSettings->iEnabledEncapsulatedEAPExpandedTypesPresent = ETrue; |
1945 |
|
1946 TInt pos = 0; |
|
1947 while ( pos + sliceLength <= aValue->Length() ) |
|
1948 { |
|
1949 // Getting a slice |
|
1950 TPtrC16 slice = aValue->Mid( pos, sliceLength ); |
|
1951 |
|
1952 // Checks the sign |
|
1953 if( slice[0] == '+' ) |
|
1954 { |
|
1955 TLex lex( slice.Ptr() + 1 ); |
|
1956 TUint encapsEapId( 0 ); |
|
1957 |
|
1958 if( lex.Val( encapsEapId, EDecimal) != KErrNone ) |
|
1959 { |
|
1960 CLOG_WRITE_FORMAT( "! Error : Invalid EncapsulatedTypes. EapId: %d", eapId ); |
|
1961 User::Leave( KErrArgument ); |
|
1962 } |
|
1963 |
|
1964 iEapSettings[eapIndex]->iEapSettings->iEncapsulatedEAPTypes.Append( encapsEapId ); |
|
1965 iEapSettings[eapIndex]->iEapSettings->iEncapsulatedEAPTypesPresent = ETrue; |
|
1966 } |
|
1967 |
|
1968 // Step over one slice and "," e.g. "+023," |
|
1969 pos+=5; |
|
1970 } |
|
1971 |
|
1972 break; |
1998 break; |
1973 } |
1999 } |
1974 |
2000 |
1975 case EEapPeapV0Allowed: |
2001 case EEapPeapV0Allowed: |
1976 { |
2002 { |
1984 iEapSettings[eapIndex]->iEapSettings->iPEAPVersionsPresent = ETrue; |
2010 iEapSettings[eapIndex]->iEapSettings->iPEAPVersionsPresent = ETrue; |
1985 iEapSettings[eapIndex]->iEapSettings->iPEAPv0Allowed = EFalse; |
2011 iEapSettings[eapIndex]->iEapSettings->iPEAPv0Allowed = EFalse; |
1986 } |
2012 } |
1987 else |
2013 else |
1988 { |
2014 { |
1989 CLOG_WRITE_FORMAT( "! Error : Invalid EapPeapV0Allowed. EapId: %d", eapId ); |
2015 CLOG_WRITE_FORMAT( "! Error : Invalid EapPeapV0Allowed. EapId: %d", eapId.GetVendorType() ); |
1990 User::Leave( KErrArgument ); |
2016 User::Leave( KErrArgument ); |
1991 } |
2017 } |
1992 |
2018 |
1993 break; |
2019 break; |
1994 } |
2020 } |
2005 iEapSettings[eapIndex]->iEapSettings->iPEAPVersionsPresent = ETrue; |
2031 iEapSettings[eapIndex]->iEapSettings->iPEAPVersionsPresent = ETrue; |
2006 iEapSettings[eapIndex]->iEapSettings->iPEAPv1Allowed = EFalse; |
2032 iEapSettings[eapIndex]->iEapSettings->iPEAPv1Allowed = EFalse; |
2007 } |
2033 } |
2008 else |
2034 else |
2009 { |
2035 { |
2010 CLOG_WRITE_FORMAT( "! Error : Invalid EapPeapV1Allowed. EapId: %d", eapId ); |
2036 CLOG_WRITE_FORMAT( "! Error : Invalid EapPeapV1Allowed. EapId: %d", eapId.GetVendorType() ); |
2011 User::Leave( KErrArgument ); |
2037 User::Leave( KErrArgument ); |
2012 } |
2038 } |
2013 |
2039 |
2014 break; |
2040 break; |
2015 } |
2041 } |
2026 iEapSettings[eapIndex]->iEapSettings->iPEAPVersionsPresent = ETrue; |
2052 iEapSettings[eapIndex]->iEapSettings->iPEAPVersionsPresent = ETrue; |
2027 iEapSettings[eapIndex]->iEapSettings->iPEAPv2Allowed = EFalse; |
2053 iEapSettings[eapIndex]->iEapSettings->iPEAPv2Allowed = EFalse; |
2028 } |
2054 } |
2029 else |
2055 else |
2030 { |
2056 { |
2031 CLOG_WRITE_FORMAT( "! Error : Invalid EapPeapV2Allowed. EapId: %d", eapId ); |
2057 CLOG_WRITE_FORMAT( "! Error : Invalid EapPeapV2Allowed. EapId: %d", eapId.GetVendorType() ); |
2032 User::Leave( KErrArgument ); |
2058 User::Leave( KErrArgument ); |
2033 } |
2059 } |
2034 |
2060 |
2035 break; |
2061 break; |
2036 } |
2062 } |
2047 iEapSettings[eapIndex]->iEapSettings->iAuthProvModeAllowedPresent = ETrue; |
2073 iEapSettings[eapIndex]->iEapSettings->iAuthProvModeAllowedPresent = ETrue; |
2048 iEapSettings[eapIndex]->iEapSettings->iAuthProvModeAllowed = EFalse; |
2074 iEapSettings[eapIndex]->iEapSettings->iAuthProvModeAllowed = EFalse; |
2049 } |
2075 } |
2050 else |
2076 else |
2051 { |
2077 { |
2052 CLOG_WRITE_FORMAT( "! Error : Invalid EEapFastAuthProvModeAllowed. EapId: %d", eapId ); |
2078 CLOG_WRITE_FORMAT( "! Error : Invalid EEapFastAuthProvModeAllowed. EapId: %d", eapId.GetVendorType() ); |
2053 User::Leave( KErrArgument ); |
2079 User::Leave( KErrArgument ); |
2054 } |
2080 } |
2055 |
2081 |
2056 break; |
2082 break; |
2057 } |
2083 } |
2069 iEapSettings[eapIndex]->iEapSettings->iUnauthProvModeAllowed = EFalse; |
2095 iEapSettings[eapIndex]->iEapSettings->iUnauthProvModeAllowed = EFalse; |
2070 } |
2096 } |
2071 else |
2097 else |
2072 { |
2098 { |
2073 |
2099 |
2074 CLOG_WRITE_FORMAT( "! Error : Invalid EapFastUnauthProvModeAllowed. EapId: %d", eapId ); |
2100 CLOG_WRITE_FORMAT( "! Error : Invalid EapFastUnauthProvModeAllowed. EapId: %d", eapId.GetVendorType() ); |
2075 User::Leave( KErrArgument ); |
2101 User::Leave( KErrArgument ); |
2076 } |
2102 } |
2077 |
2103 |
2078 break; |
2104 break; |
2079 } |
2105 } |
2090 iEapSettings[eapIndex]->iEapSettings->iWarnADHPNoPACPresent = ETrue; |
2116 iEapSettings[eapIndex]->iEapSettings->iWarnADHPNoPACPresent = ETrue; |
2091 iEapSettings[eapIndex]->iEapSettings->iWarnADHPNoPAC = EFalse; |
2117 iEapSettings[eapIndex]->iEapSettings->iWarnADHPNoPAC = EFalse; |
2092 } |
2118 } |
2093 else |
2119 else |
2094 { |
2120 { |
2095 CLOG_WRITE_FORMAT( "! Error : Invalid EapFastWarnADHPNoPAC. EapId: %d", eapId ); |
2121 CLOG_WRITE_FORMAT( "! Error : Invalid EapFastWarnADHPNoPAC. EapId: %d", eapId.GetVendorType() ); |
2096 User::Leave( KErrArgument ); |
2122 User::Leave( KErrArgument ); |
2097 } |
2123 } |
2098 |
2124 |
2099 break; |
2125 break; |
2100 } |
2126 } |
2111 iEapSettings[eapIndex]->iEapSettings->iWarnADHPNoMatchingPACPresent = ETrue; |
2137 iEapSettings[eapIndex]->iEapSettings->iWarnADHPNoMatchingPACPresent = ETrue; |
2112 iEapSettings[eapIndex]->iEapSettings->iWarnADHPNoMatchingPAC = EFalse; |
2138 iEapSettings[eapIndex]->iEapSettings->iWarnADHPNoMatchingPAC = EFalse; |
2113 } |
2139 } |
2114 else |
2140 else |
2115 { |
2141 { |
2116 CLOG_WRITE_FORMAT( "! Error : Invalid EapFastWarnADHPNoMatchingPAC. EapId: %d", eapId ); |
2142 CLOG_WRITE_FORMAT( "! Error : Invalid EapFastWarnADHPNoMatchingPAC. EapId: %d", eapId.GetVendorType() ); |
2117 User::Leave( KErrArgument ); |
2143 User::Leave( KErrArgument ); |
2118 } |
2144 } |
2119 |
2145 |
2120 break; |
2146 break; |
2121 } |
2147 } |
2132 iEapSettings[eapIndex]->iEapSettings->iWarnNotDefaultServerPresent = ETrue; |
2158 iEapSettings[eapIndex]->iEapSettings->iWarnNotDefaultServerPresent = ETrue; |
2133 iEapSettings[eapIndex]->iEapSettings->iWarnNotDefaultServer = EFalse; |
2159 iEapSettings[eapIndex]->iEapSettings->iWarnNotDefaultServer = EFalse; |
2134 } |
2160 } |
2135 else |
2161 else |
2136 { |
2162 { |
2137 CLOG_WRITE_FORMAT( "! Error : Invalid EapFastWarnNotDefaultServer. EapId: %d", eapId ); |
2163 CLOG_WRITE_FORMAT( "! Error : Invalid EapFastWarnNotDefaultServer. EapId: %d", eapId.GetVendorType() ); |
2138 User::Leave( KErrArgument ); |
2164 User::Leave( KErrArgument ); |
2139 } |
2165 } |
2140 |
2166 |
2141 break; |
2167 break; |
2142 } |
2168 } |
2183 |
2209 |
2184 // --------------------------------------------------------- |
2210 // --------------------------------------------------------- |
2185 // CProcessorWlan::FindCertificateEntry |
2211 // CProcessorWlan::FindCertificateEntry |
2186 // --------------------------------------------------------- |
2212 // --------------------------------------------------------- |
2187 // |
2213 // |
2188 TUint CProcessorWlan::FindCertificateEntryL( const CertificateEntry::TCertType aCertType, const TInt aEapIndex ) |
2214 TUint CProcessorWlan::FindCertificateEntryL( const EapCertificateEntry::TCertType aCertType, const TInt aEapIndex ) |
2189 { |
2215 { |
2190 TUint certIndex( 0 ); |
2216 TUint certIndex( 0 ); |
2191 for( certIndex = 0; certIndex < iEapSettings[aEapIndex]->iEapSettings->iCertificates.Count() ; certIndex++ ) |
2217 for( certIndex = 0; certIndex < iEapSettings[aEapIndex]->iEapSettings->iCertificates.Count() ; certIndex++ ) |
2192 { |
2218 { |
2193 if( iEapSettings[aEapIndex]->iEapSettings->iCertificates[certIndex].iCertType == aCertType ) |
2219 if( iEapSettings[aEapIndex]->iEapSettings->iCertificates[certIndex]->GetCertType() == aCertType ) |
2194 { |
2220 { |
2195 // Found |
2221 // Found |
2196 break; |
2222 break; |
2197 } |
2223 } |
2198 } |
2224 } |
2199 if( certIndex == iEapSettings[aEapIndex]->iEapSettings->iCertificates.Count() ) |
2225 if( certIndex == iEapSettings[aEapIndex]->iEapSettings->iCertificates.Count() ) |
2200 { |
2226 { |
2201 // Not found. Create |
2227 // Not found. Create |
2202 CertificateEntry entry; |
2228 EapCertificateEntry* entry; |
2203 |
2229 entry = new (ELeave) EapCertificateEntry; |
2204 entry.iCertType = aCertType; |
2230 entry->SetCertType( aCertType ); |
2205 |
2231 |
2206 iEapSettings[aEapIndex]->iEapSettings->iCertificates.AppendL( entry ); |
2232 iEapSettings[aEapIndex]->iEapSettings->iCertificates.AppendL( entry ); |
2207 |
2233 |
2208 certIndex = iEapSettings[aEapIndex]->iEapSettings->iCertificates.Count() - 1; |
2234 certIndex = iEapSettings[aEapIndex]->iEapSettings->iCertificates.Count() - 1; |
2209 } |
2235 } |
2212 |
2238 |
2213 // --------------------------------------------------------- |
2239 // --------------------------------------------------------- |
2214 // CProcessorWlan::ConvertSubjectKeyIdToBinary |
2240 // CProcessorWlan::ConvertSubjectKeyIdToBinary |
2215 // --------------------------------------------------------- |
2241 // --------------------------------------------------------- |
2216 // |
2242 // |
2217 void CProcessorWlan::ConvertSubjectKeyIdToBinaryL( const HBufC16* const aSubjectKeyIdString, TDes& aBinaryKey) |
2243 void CProcessorWlan::ConvertSubjectKeyIdToBinaryL( const HBufC16* const aSubjectKeyIdString, TKeyIdentifier& aBinaryKey) |
2218 { |
2244 { |
2219 TInt err( KErrNone ); |
2245 TInt err( KErrNone ); |
2220 |
2246 |
2221 // Define literals to search the subject key for possible 0X/0x beginning |
2247 // Define literals to search the subject key for possible 0X/0x beginning |
2222 _LIT(KHexIdLC, "0x"); |
2248 _LIT(KHexIdLC, "0x"); |