--- a/dbcreator/commsdatcreator/Src/cdcprocessorwlan.cpp Thu Aug 19 10:18:49 2010 +0300
+++ b/dbcreator/commsdatcreator/Src/cdcprocessorwlan.cpp Tue Aug 31 15:35:44 2010 +0300
@@ -33,7 +33,6 @@
#include <WlanCdbCols.h>
#include <commsdattypesv1_1.h>
#include <wlancontainer.h>
-#include <EapType.h>
using namespace CMManager;
@@ -60,12 +59,6 @@
// ratio between sizes of ascii and unicode characters
const TUint KAsciiUnicodeRatio = 2;
-// Length of expanded EAP type identifier
-const TUint KExpandedEAPIdLength = 8;
-
-// Plain MSCHAPv2 EAP identifier. Needed because of special handling
-const TUint8 KMschapv2TypeId[] = {0xfe, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x63};
-
// ================= MEMBER FUNCTIONS =======================
CEapTypeElement::~CEapTypeElement()
@@ -144,6 +137,7 @@
CProcessorWlan::~CProcessorWlan()
{
delete iEmptyTag;
+ REComSession::FinalClose();
}
// ---------------------------------------------------------
@@ -379,7 +373,7 @@
//WPA
case EWPAPresharedKey:
case EWPAKeyLength:
- case EWPAListOfEAPs:
+ case EWPAEapMethod:
case EWPAUseOfPresharedKey:
{
if( iSecurityMode != ESecurityModeWEP && iSecurityMode != ESecurityModeOpen )
@@ -601,50 +595,30 @@
CleanupStack::PopAndDestroy( iapRecord );
- TInt err = KErrNone;
- TUint8 expandedEapId[] = {0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
-
- TBuf8<KExpandedEAPIdLength> cue;
-
- // Set-up 64-bit expanded EAP id
- if ( eap->iEapSettings->iEAPType == KMschapv2TypeId[7] )
- {
- // This is plain MSCHAPv2. Set vendor ID correctly
- expandedEapId[1] = KMschapv2TypeId[1];
- expandedEapId[2] = KMschapv2TypeId[2];
- expandedEapId[3] = KMschapv2TypeId[3];
- }
-
- expandedEapId[KExpandedEAPIdLength - 1] = static_cast<TUint8> ( eap->iEapSettings->iEAPType );
- cue.Copy( expandedEapId, KExpandedEAPIdLength );
-
- // Try loading EAP ECOM module
- CLOG_WRITE_FORMAT( "Try to load EAP module: %d", expandedEapId[7]);
- CEapType* eapType = 0;
- TRAP( err, eapType = CEapType::NewL( cue, ELan, serviceId ) );
- // The error is caused by probably missing EAP method from the device. Ignore the error
- // because same scripts can be used for devices with and without certain methods.
- if( err == KErrNone )
- {
- CleanupStack::PushL( eapType );
-
- // Check if this type is tunneled
- if ( eap->iEncapsulatingEapId != EAPSettings::EEapNone )
- {
- // It is tunneled. Take the last byte of the expanded id.
- eapType->SetTunnelingType( eap->iEncapsulatingEapId );
- }
- CLOG_WRITE( "Calling eapType->SetConfiguration" );
- eapType->SetConfigurationL( *eap->iEapSettings );
- CLOG_WRITE( "eapType->SetConfiguration success!" );
- CleanupStack::PopAndDestroy( eapType );
- }
+ CEapType* eapType ( NULL );
+ TRAPD( leave,
+ eapType = CEapType::NewL( ELan,
+ serviceId,
+ eap->iEapSettings->iEAPExpandedType ) );
+ if ( leave == KErrNone )
+ {
+ CleanupStack::PushL( eapType );
+
+ // Inner EAP
+ if ( eap->iEncapsulatingEapId != *EapExpandedTypeNone.GetType() )
+ {
+ eapType->SetTunnelingType( eap->iEncapsulatingEapId );
+ }
+
+ // write EAP setting
+ eapType->SetConfigurationL(*eap->iEapSettings);
+ CleanupStack::PopAndDestroy( eapType );
+ }
}
-
+
session->Close();
CleanupStack::PopAndDestroy( session );
CLOG_WRITE( "Finished EAP settings saving" );
- //iEapSettings.ResetAndDestroy();
CLOG_WRITE_FORMAT( "SaveSecurityInfoL end %d", iSecurityInfo->Count() );
}
@@ -1206,6 +1180,7 @@
void CProcessorWlan::SaveWPAL( TUint32 aIapId )
{
CLOG_WRITE( "CProcessorWlan::SaveWPAL enter" );
+
CMDBSession* session = CMDBSession::NewL( CMDBSession::LatestVersion() );
CleanupStack::PushL( session );
@@ -1248,17 +1223,11 @@
secModeField->SetL( iSecurityMode );
CLOG_WRITE( "Wrote securityMode" );
+
// Save EAP list
- CMDBField<TDesC>* wlanEapsField = static_cast<CMDBField<TDesC>*>
- ( generic->GetFieldByIdL( KCDTIdWlanEaps ) );
- wlanEapsField->SetL( WPAFieldData( EWPAListOfEAPs )->Des() );
-
- CLOG_WRITE( "Wrote EAPList" );
-
- SetExpandedEapListL( generic );
-
- CLOG_WRITE( "Wrote expandedEapList" );
-
+ SetExpandedEapListL( service );
+ CLOG_WRITE( "Wrote Expanded EAPList" );
+
// Save PreShared Key
TBuf8<KMaxLengthOfKeyData> keyWPA;
//convert to 8 bit
@@ -1296,122 +1265,105 @@
// CProcessorWlan::SetExpandedEapListL
// ---------------------------------------------------------
//
-void CProcessorWlan::SetExpandedEapListL( CMDBGenericRecord* generic )
+void CProcessorWlan::SetExpandedEapListL( const TUint aServiceId )
{
+ CLOG_WRITE( "CProcessorWlan::SetExpandedEapListL" )
// Gets the text format eap list
- HBufC16* eapList = WPAFieldData( EWPAListOfEAPs );
+ HBufC16* eapList = WPAFieldData( EWPAEapMethod );
if ( eapList != NULL && 0 < eapList->Length() )
{
+ // load general EAP settings If
+ CEapGeneralSettings* eapGs;
+ eapGs = CEapGeneralSettings::NewL( ELan, aServiceId );
+ CleanupStack::PushL( eapGs );
- // Creates the expanded eap lists
- HBufC8* enabledEapList = ExpandedEapListLC( eapList, ETrue );
- HBufC8* disabledEapList = ExpandedEapListLC( eapList, EFalse );
+ // get lists of enabled/disabled EAPs for the IAP
+ RArray< TEapExpandedType > enabledEapMethods;
+ RArray< TEapExpandedType > disabledEapMethods;
- // Save enabled EAP list
- CMDBField<TDesC8>* wlanEnabledEapsField = static_cast<CMDBField<TDesC8>*>
- ( generic->GetFieldByIdL( KCDTIdWlanEnabledEaps ) );
- wlanEnabledEapsField->SetL( enabledEapList->Des() );
-
- // Save disabled EAP list
- CMDBField<TDesC8>* wlanDisabledEapsField = static_cast<CMDBField<TDesC8>*>
- ( generic->GetFieldByIdL( KCDTIdWlanDisabledEaps ) );
- wlanDisabledEapsField->SetL( disabledEapList->Des() );
+ enabledEapMethods.Append( GetExpandedEapTypeIdL( *eapList ) );
- CleanupStack::PopAndDestroy( disabledEapList );
- CleanupStack::PopAndDestroy( enabledEapList );
-
+ // disabledEapMethods can be empty, SetEapMethods takes care of it,
+ // only enabledEapMethods is a must with correct contents
+ User::LeaveIfError( eapGs->SetEapMethods( enabledEapMethods,
+ disabledEapMethods ) );
+
+ CleanupStack::PopAndDestroy( eapGs );
}
}
// ---------------------------------------------------------
-// CProcessorWlan::ExpandedEapListLC
+// CProcessorWlan::GetExpandedEapTypeId
// ---------------------------------------------------------
//
-HBufC8* CProcessorWlan::ExpandedEapListLC( HBufC16* aEapList, TBool aEnabledNeed )
+TEapExpandedType CProcessorWlan::GetExpandedEapTypeIdL( TDesC& aField )
{
- // The eap list has a well defined form
- // so this parser supposes this concrete form like this:
- // "+018,-023,+026,-021,-006"
+ TUint8 resultByte;
+ TLex16 lex( aField.Ptr() );
+ User::LeaveIfError( lex.Val( resultByte, EDecimal ) );
- // Lenght of a 3 digit long signed number
- const TInt sliceLength = 4;
-
- // Max lenght of the resulted list.
- // Adding one "," then divide the lenght of a slice+1
- TInt maxLenght = ( ( aEapList->Length()+1 ) / 5 ) * 8;
+ CLOG_WRITE_FORMAT( "CProcessorWlan::GetExpandedEapTypeIdL: EAP %d",
+ (int)resultByte )
- HBufC8* expandedEapList = HBufC8::NewLC( maxLenght );
-
- TInt pos = 0;
- while ( pos + sliceLength <= aEapList->Length() )
+ switch ( resultByte )
{
- // Getting a slice
- TPtrC16 slice = aEapList->Mid( pos, sliceLength );
-
- // Checks the sign
- if( slice[0] == '+' )
+ case 0x06:
{
- if( aEnabledNeed )
- {
- AddToList( expandedEapList, slice );
- }
+ return *EapExpandedTypeGtc.GetType();
+ }
+ case 0x0d:
+ {
+ return *EapExpandedTypeTls.GetType();
}
- else if( slice[0] == '-' )
+ case 0x11:
+ {
+ return *EapExpandedTypeLeap.GetType();
+ }
+ case 0x12:
{
- if( !aEnabledNeed )
- {
- AddToList( expandedEapList, slice );
- }
+ return *EapExpandedTypeSim.GetType();
}
- else
+ case 0x15:
{
- CLOG_WRITE_FORMAT( "! Error : Wrong Eap list format %S", aEapList );
+ return *EapExpandedTypeTtls.GetType();
}
-
- // Step over one slice and "," e.g. "+023,"
- pos+=5;
-
+ case 0x17:
+ {
+ return *EapExpandedTypeAka.GetType();
+ }
+ case 0x19:
+ {
+ return *EapExpandedTypePeap.GetType();
+ }
+ case 0x1a:
+ {
+ return *EapExpandedTypeMsChapv2.GetType();
+ }
+ case 0x2b:
+ {
+ return *EapExpandedTypeFast.GetType();
+ }
+ case 0x01:
+ {
+ return *EapExpandedTypeProtectedSetup.GetType();
+ }
+ case 0x62:
+ {
+ return *EapExpandedTypeTtlsPap.GetType();
+ }
+ case 0x63:
+ {
+ return *EapExpandedPlainMsChapv2.GetType();
+ }
+ default:
+ {
+ return *EapExpandedTypeNone.GetType();
+ }
}
- if( pos != aEapList->Length() + 1)
- {
- CLOG_WRITE_FORMAT( "! Warning : possible wrong Eap list format %S", aEapList );
- }
-
- return expandedEapList;
}
// ---------------------------------------------------------
-// CProcessorWlan::AddToList
-// ---------------------------------------------------------
-//
-void CProcessorWlan::AddToList( HBufC8* aExpandedEapList, TPtrC16 aSlice )
- {
- // Fills the 8 byte form with "0xFE000000000000"
- TBuf8<8> expandedForm;
- expandedForm.AppendFill( 0xFE, 1 );
- expandedForm.AppendFill( 0x00, 6 );
-
- // Leave the "sign"
- TPtrC16 number = aSlice.Mid( 1 );
- TUint8 resultByte;
- TLex16 lex( number );
-
- if( KErrNone == lex.Val( resultByte, EDecimal ) )
- {
- expandedForm.AppendFill( resultByte, 1 );
- }
- else
- {
- expandedForm.AppendFill( 0x00, 1 );
- CLOG_WRITE( "! Error : Unlexed Eap number. 0 is addded" );
- }
-
- aExpandedEapList->Des().Append( expandedForm );
- }
-
-
-// ---------------------------------------------------------
// CProcessorWlan::WPAIndex
// ---------------------------------------------------------
//
@@ -1423,7 +1375,6 @@
return aFieldId - 0x2000 + iDataStart;
}
-
// ---------------------------------------------------------
// CProcessorWlan::WPAFieldData
// ---------------------------------------------------------
@@ -1582,11 +1533,12 @@
return EFalse;
}
}
+
// ---------------------------------------------------------
// CProcessorWlan::GetEapTypeIdFromSettingId
// ---------------------------------------------------------
//
-EAPSettings::TEapType CProcessorWlan::GetEapTypeIdFromSettingId( const TInt aField )
+TEapExpandedType CProcessorWlan::GetEapTypeIdFromSettingId( const TInt aField )
{
switch ( aField )
{
@@ -1594,7 +1546,7 @@
case EEapGtcSessionValidityTime:
case EEapGtcEncapsulation:
{
- return EAPSettings::EEapGtc;
+ return *EapExpandedTypeGtc.GetType();
}
case EEapTlsUsername:
case EEapTlsRealm:
@@ -1610,13 +1562,13 @@
case EEapTlsCaCertSerialNumber:
case EEapTlsEncapsulation:
{
- return EAPSettings::EEapTls;
+ return *EapExpandedTypeTls.GetType();
}
case EEapLeapUsername:
case EEapLeapPassword:
case EEapLeapSessionValidityTime:
{
- return EAPSettings::EEapLeap;
+ return *EapExpandedTypeLeap.GetType();
}
case EEapSimUsername:
case EEapSimRealm:
@@ -1624,7 +1576,7 @@
case EEapSimSessionValidityTime:
case EEapSimEncapsulation:
{
- return EAPSettings::EEapSim;
+ return *EapExpandedTypeSim.GetType();
}
case EEapTtlsUsername:
case EEapTtlsRealm:
@@ -1640,7 +1592,7 @@
case EEapTtlsCaCertIssuerName:
case EEapTtlsCaCertSerialNumber:
{
- return EAPSettings::EEapTtls;
+ return *EapExpandedTypeTtls.GetType();
}
case EEapAkaUsername:
case EEapAkaRealm:
@@ -1648,7 +1600,7 @@
case EEapAkaSessionValidityTime:
case EEapAkaEncapsulation:
{
- return EAPSettings::EEapAka;
+ return *EapExpandedTypeAka.GetType();
}
case EEapPeapUsername:
case EEapPeapRealm:
@@ -1667,14 +1619,14 @@
case EEapPeapCaCertIssuerName:
case EEapPeapCaCertSerialNumber:
{
- return EAPSettings::EEapPeap;
+ return *EapExpandedTypePeap.GetType();
}
case EEapMschapv2Username:
case EEapMschapv2Password:
case EEapMschapv2SessionValidityTime:
case EEapMschapv2Encapsulation:
{
- return EAPSettings::EEapMschapv2;
+ return *EapExpandedTypeMsChapv2.GetType();
}
case EEapFastUsername:
case EEapFastRealm:
@@ -1695,7 +1647,7 @@
case EEapFastCaCertIssuerName:
case EEapFastCaCertSerialNumber:
{
- return EAPSettings::EEapFast;
+ return *EapExpandedTypeFast.GetType();
}
case EMschapv2Username:
@@ -1703,23 +1655,24 @@
case EMschapv2SessionValidityTime:
case EMschapv2Encapsulation:
{
- return EAPSettings::EPlainMschapv2;
+ return *EapExpandedPlainMsChapv2.GetType();
}
default:
{
- return EAPSettings::EEapNone;
+ return *EapExpandedTypeNone.GetType();
}
}
}
+
// ---------------------------------------------------------
// CProcessorWlan::AddEAPSetting
// ---------------------------------------------------------
//
-void CProcessorWlan::AddEAPSettingL( const TInt aField, const HBufC16* const aValue )
+void CProcessorWlan::AddEAPSettingL( const TInt aField, HBufC16* aValue )
{
- EAPSettings::TEapType eapId = GetEapTypeIdFromSettingId( aField );
- if ( eapId == EAPSettings::EEapNone )
+ TEapExpandedType eapId = GetEapTypeIdFromSettingId( aField );
+ if ( eapId == *EapExpandedTypeNone.GetType() )
{
CLOG_WRITE( "! Error : Unknown EAP method" );
User::Leave( KErrArgument );
@@ -1729,7 +1682,7 @@
// Search if the EAP instance already exists in the array for this
for ( eapIndex = 0 ; eapIndex < iEapSettings.Count() ; eapIndex++ )
{
- if ( ( iEapSettings[eapIndex]->iEapSettings->iEAPType == eapId )
+ if ( ( iEapSettings[eapIndex]->iEapSettings->iEAPExpandedType == eapId )
&& ( iEapSettings[eapIndex]->iName != NULL )
&& ( iEapSettings[eapIndex]->iName->Compare( *iName ) == 0 ))
{
@@ -1746,7 +1699,7 @@
newEap->iEapSettings = new (ELeave) EAPSettings;
- newEap->iEapSettings->iEAPType = eapId;
+ newEap->iEapSettings->iEAPExpandedType = eapId;
newEap->iName = iName->AllocL();
@@ -1773,6 +1726,8 @@
{
iEapSettings[eapIndex]->iEapSettings->iUsernamePresent = ETrue;
iEapSettings[eapIndex]->iEapSettings->iUsername.Copy( *aValue );
+ iEapSettings[eapIndex]->iEapSettings->iUseAutomaticUsernamePresent = ETrue;
+ iEapSettings[eapIndex]->iEapSettings->iUseAutomaticUsername = EFalse;
break;
}
@@ -1781,7 +1736,9 @@
case EMschapv2Password:
{
iEapSettings[eapIndex]->iEapSettings->iPasswordPresent = ETrue;
- iEapSettings[eapIndex]->iEapSettings->iPassword.Copy( *aValue );
+ iEapSettings[eapIndex]->iEapSettings->iPassword.Copy( *aValue );
+ iEapSettings[eapIndex]->iEapSettings->iShowPassWordPromptPresent = ETrue;
+ iEapSettings[eapIndex]->iEapSettings->iUseAutomaticUsername = EFalse;
break;
}
@@ -1793,7 +1750,9 @@
case EEapFastRealm:
{
iEapSettings[eapIndex]->iEapSettings->iRealmPresent = ETrue;
- iEapSettings[eapIndex]->iEapSettings->iRealm.Copy( *aValue );
+ iEapSettings[eapIndex]->iEapSettings->iRealm.Copy( *aValue );
+ iEapSettings[eapIndex]->iEapSettings->iUseAutomaticRealmPresent = ETrue;
+ iEapSettings[eapIndex]->iEapSettings->iUseAutomaticRealm = EFalse;
break;
}
@@ -1813,7 +1772,7 @@
TUint value( 0 );
if( lex.Val( value, EDecimal) != KErrNone )
{
- CLOG_WRITE_FORMAT( "! Error : Invalid session validity time value. EapId: %d", eapId );
+ CLOG_WRITE_FORMAT( "! Error : Invalid session validity time value. EapId: %d", eapId.GetVendorType() );
User::Leave( KErrArgument );
}
@@ -1833,11 +1792,10 @@
TUint eapTypeId( 0 );
if( lex.Val( eapTypeId, EDecimal) != KErrNone )
{
- CLOG_WRITE_FORMAT( "! Error : Invalid encapsulation value. EapId: %d", eapId );
+ CLOG_WRITE_FORMAT( "! Error : Invalid encapsulation value. EapId: %d", eapId.GetVendorType() );
User::Leave( KErrArgument );
}
-
- iEapSettings[eapIndex]->iEncapsulatingEapId = static_cast< EAPSettings::TEapType >( eapTypeId );
+ iEapSettings[eapIndex]->iEncapsulatingEapId.SetValue( eapId.GetVendorId(), eapTypeId );
break;
}
@@ -1858,7 +1816,7 @@
}
else
{
- CLOG_WRITE_FORMAT( "! Error : Invalid VerifyServerRealm. EapId: %d", eapId );
+ CLOG_WRITE_FORMAT( "! Error : Invalid VerifyServerRealm. EapId: %d", eapId.GetVendorType() );
User::Leave( KErrArgument );
}
@@ -1882,7 +1840,7 @@
}
else
{
- CLOG_WRITE_FORMAT( "! Error : Invalid RequireClientAuth. EapId: %d", eapId );
+ CLOG_WRITE_FORMAT( "! Error : Invalid RequireClientAuth. EapId: %d", eapId.GetVendorType() );
User::Leave( KErrArgument );
}
@@ -1897,7 +1855,7 @@
TRAPD( err, FillCipherSuitesL( aValue, eapIndex ) );
if( err != KErrNone )
{
- CLOG_WRITE_FORMAT( "! Error : Invalid CipherSuites. EapId: %d", eapId );
+ CLOG_WRITE_FORMAT( "! Error : Invalid CipherSuites. EapId: %d", eapId.GetVendorType() );
User::Leave( KErrArgument );
}
break;
@@ -1908,20 +1866,21 @@
case EEapPeapUserCertSubjectKeyId:
case EEapFastUserCertSubjectKeyId:
{
- TInt certIndex = FindCertificateEntryL( CertificateEntry::EUser, eapIndex );
+ TInt certIndex = FindCertificateEntryL( EapCertificateEntry::EUser, eapIndex );
- TBuf<KKeyIdentifierLength> key;
+ TKeyIdentifier key;
TRAPD( err, ConvertSubjectKeyIdToBinaryL( aValue, key) );
if( err != KErrNone )
{
- CLOG_WRITE_FORMAT( "! Error : Invalid UserCertSubjectKeyId. EapId: %d", eapId );
+ CLOG_WRITE_FORMAT( "! Error : Invalid UserCertSubjectKeyId. EapId: %d", eapId.GetVendorType() );
User::Leave( KErrArgument );
}
iEapSettings[eapIndex]->iEapSettings->iCertificatesPresent = ETrue;
- iEapSettings[eapIndex]->iEapSettings->iCertificates[certIndex].iSubjectKeyID.Copy(key);
- iEapSettings[eapIndex]->iEapSettings->iCertificates[certIndex].iSubjectKeyIDPresent = ETrue;
+ iEapSettings[eapIndex]->iEapSettings->iCertificates[certIndex]->SetIsEnabled( ETrue );
+ iEapSettings[eapIndex]->iEapSettings->iCertificates[certIndex]->SetSubjectKeyId( key );
+ iEapSettings[eapIndex]->iEapSettings->iCertificates[certIndex]->SetSubjectKeyIdPresent();
break;
}
@@ -1930,11 +1889,12 @@
case EEapPeapUserCertIssuerName:
case EEapFastUserCertIssuerName:
{
- TUint certIndex = FindCertificateEntryL( CertificateEntry::EUser, eapIndex );
+ TUint certIndex = FindCertificateEntryL( EapCertificateEntry::EUser, eapIndex );
iEapSettings[eapIndex]->iEapSettings->iCertificatesPresent = ETrue;
- iEapSettings[eapIndex]->iEapSettings->iCertificates[certIndex].iIssuerNamePresent= ETrue;
- iEapSettings[eapIndex]->iEapSettings->iCertificates[certIndex].iIssuerName.Copy( *aValue );
+ iEapSettings[eapIndex]->iEapSettings->iCertificates[certIndex]->SetIsEnabled( ETrue );
+ iEapSettings[eapIndex]->iEapSettings->iCertificates[certIndex]->SetSubjectKeyIdPresent();
+ iEapSettings[eapIndex]->iEapSettings->iCertificates[certIndex]->SetIssuerName( *aValue );
break;
}
@@ -1943,11 +1903,12 @@
case EEapPeapUserCertSerialNumber:
case EEapFastUserCertSerialNumber:
{
- TUint certIndex = FindCertificateEntryL( CertificateEntry::EUser, eapIndex );
+ TUint certIndex = FindCertificateEntryL( EapCertificateEntry::EUser, eapIndex );
iEapSettings[eapIndex]->iEapSettings->iCertificatesPresent = ETrue;
- iEapSettings[eapIndex]->iEapSettings->iCertificates[certIndex].iSerialNumberPresent= ETrue;
- iEapSettings[eapIndex]->iEapSettings->iCertificates[certIndex].iSerialNumber.Copy( *aValue );
+ iEapSettings[eapIndex]->iEapSettings->iCertificates[certIndex]->SetIsEnabled( ETrue );
+ iEapSettings[eapIndex]->iEapSettings->iCertificates[certIndex]->SetSerialNumberPresent();
+ iEapSettings[eapIndex]->iEapSettings->iCertificates[certIndex]->SetSerialNumber( *aValue );
break;
}
@@ -1956,20 +1917,23 @@
case EEapPeapCaCertSubjectKeyId:
case EEapFastCaCertSubjectKeyId:
{
- TInt certIndex = FindCertificateEntryL( CertificateEntry::ECA, eapIndex );
+ TInt certIndex = FindCertificateEntryL( EapCertificateEntry::ECA, eapIndex );
- TBuf<KKeyIdentifierLength> key;
+ TKeyIdentifier key;
TRAPD( err, ConvertSubjectKeyIdToBinaryL( aValue, key) );
if( err != KErrNone )
{
- CLOG_WRITE_FORMAT( "! Error : Invalid UserCertSubjectKeyId. EapId: %d", eapId );
+ CLOG_WRITE_FORMAT( "! Error : Invalid UserCertSubjectKeyId. EapId: %d", eapId.GetVendorType() );
User::Leave( KErrArgument );
}
iEapSettings[eapIndex]->iEapSettings->iCertificatesPresent = ETrue;
- iEapSettings[eapIndex]->iEapSettings->iCertificates[certIndex].iSubjectKeyID.Copy(key);
- iEapSettings[eapIndex]->iEapSettings->iCertificates[certIndex].iSubjectKeyIDPresent = ETrue;
+ iEapSettings[eapIndex]->iEapSettings->iCertificates[certIndex]->SetIsEnabled( ETrue );
+ iEapSettings[eapIndex]->iEapSettings->iCertificates[certIndex]->SetSubjectKeyId( key );
+ iEapSettings[eapIndex]->iEapSettings->iCertificates[certIndex]->SetSubjectKeyIdPresent();
+ iEapSettings[eapIndex]->iEapSettings->iUseAutomaticCACertificatePresent = ETrue;
+ iEapSettings[eapIndex]->iEapSettings->iUseAutomaticCACertificate = EFalse;
break;
}
@@ -1978,10 +1942,13 @@
case EEapPeapCaCertIssuerName:
case EEapFastCaCertIssuerName:
{
- TUint certIndex = FindCertificateEntryL( CertificateEntry::ECA, eapIndex );
+ TUint certIndex = FindCertificateEntryL( EapCertificateEntry::ECA, eapIndex );
iEapSettings[eapIndex]->iEapSettings->iCertificatesPresent = ETrue;
- iEapSettings[eapIndex]->iEapSettings->iCertificates[certIndex].iIssuerNamePresent= ETrue;
- iEapSettings[eapIndex]->iEapSettings->iCertificates[certIndex].iIssuerName.Copy( *aValue );
+ iEapSettings[eapIndex]->iEapSettings->iCertificates[certIndex]->SetIsEnabled( ETrue );
+ iEapSettings[eapIndex]->iEapSettings->iCertificates[certIndex]->SetIssuerNamePresent();
+ iEapSettings[eapIndex]->iEapSettings->iCertificates[certIndex]->SetIssuerName( *aValue );
+ iEapSettings[eapIndex]->iEapSettings->iUseAutomaticCACertificatePresent = ETrue;
+ iEapSettings[eapIndex]->iEapSettings->iUseAutomaticCACertificate = EFalse;
break;
}
@@ -1991,10 +1958,13 @@
case EEapPeapCaCertSerialNumber:
case EEapFastCaCertSerialNumber:
{
- TUint certIndex = FindCertificateEntryL( CertificateEntry::ECA, eapIndex );
+ TUint certIndex = FindCertificateEntryL( EapCertificateEntry::ECA, eapIndex );
iEapSettings[eapIndex]->iEapSettings->iCertificatesPresent = ETrue;
- iEapSettings[eapIndex]->iEapSettings->iCertificates[certIndex].iSerialNumberPresent= ETrue;
- iEapSettings[eapIndex]->iEapSettings->iCertificates[certIndex].iSerialNumber.Copy( *aValue );
+ iEapSettings[eapIndex]->iEapSettings->iCertificates[certIndex]->SetIsEnabled( ETrue );
+ iEapSettings[eapIndex]->iEapSettings->iCertificates[certIndex]->SetSerialNumberPresent();
+ iEapSettings[eapIndex]->iEapSettings->iCertificates[certIndex]->SetSerialNumber( *aValue );
+ iEapSettings[eapIndex]->iEapSettings->iUseAutomaticCACertificatePresent = ETrue;
+ iEapSettings[eapIndex]->iEapSettings->iUseAutomaticCACertificate = EFalse;
break;
}
@@ -2013,7 +1983,7 @@
}
else
{
- CLOG_WRITE_FORMAT( "! Error : Invalid UsePseudonyms. EapId: %d", eapId );
+ CLOG_WRITE_FORMAT( "! Error : Invalid UsePseudonyms. EapId: %d", eapId.GetVendorType() );
User::Leave( KErrArgument );
}
break;
@@ -2023,35 +1993,8 @@
case EEapPeapEncapsulatedTypes:
case EEapFastEncapsulatedTypes:
{
- // Lenght of a 3 digit long signed number
- const TInt sliceLength = 4;
-
- TInt pos = 0;
- while ( pos + sliceLength <= aValue->Length() )
- {
- // Getting a slice
- TPtrC16 slice = aValue->Mid( pos, sliceLength );
-
- // Checks the sign
- if( slice[0] == '+' )
- {
- TLex lex( slice.Ptr() + 1 );
- TUint encapsEapId( 0 );
-
- if( lex.Val( encapsEapId, EDecimal) != KErrNone )
- {
- CLOG_WRITE_FORMAT( "! Error : Invalid EncapsulatedTypes. EapId: %d", eapId );
- User::Leave( KErrArgument );
- }
-
- iEapSettings[eapIndex]->iEapSettings->iEncapsulatedEAPTypes.Append( encapsEapId );
- iEapSettings[eapIndex]->iEapSettings->iEncapsulatedEAPTypesPresent = ETrue;
- }
-
- // Step over one slice and "," e.g. "+023,"
- pos+=5;
- }
-
+ iEapSettings[eapIndex]->iEapSettings->iEnabledEncapsulatedEAPExpandedTypes.Append( GetExpandedEapTypeIdL( *aValue ) );
+ iEapSettings[eapIndex]->iEapSettings->iEnabledEncapsulatedEAPExpandedTypesPresent = ETrue;
break;
}
@@ -2069,7 +2012,7 @@
}
else
{
- CLOG_WRITE_FORMAT( "! Error : Invalid EapPeapV0Allowed. EapId: %d", eapId );
+ CLOG_WRITE_FORMAT( "! Error : Invalid EapPeapV0Allowed. EapId: %d", eapId.GetVendorType() );
User::Leave( KErrArgument );
}
@@ -2090,7 +2033,7 @@
}
else
{
- CLOG_WRITE_FORMAT( "! Error : Invalid EapPeapV1Allowed. EapId: %d", eapId );
+ CLOG_WRITE_FORMAT( "! Error : Invalid EapPeapV1Allowed. EapId: %d", eapId.GetVendorType() );
User::Leave( KErrArgument );
}
@@ -2111,7 +2054,7 @@
}
else
{
- CLOG_WRITE_FORMAT( "! Error : Invalid EapPeapV2Allowed. EapId: %d", eapId );
+ CLOG_WRITE_FORMAT( "! Error : Invalid EapPeapV2Allowed. EapId: %d", eapId.GetVendorType() );
User::Leave( KErrArgument );
}
@@ -2132,7 +2075,7 @@
}
else
{
- CLOG_WRITE_FORMAT( "! Error : Invalid EEapFastAuthProvModeAllowed. EapId: %d", eapId );
+ CLOG_WRITE_FORMAT( "! Error : Invalid EEapFastAuthProvModeAllowed. EapId: %d", eapId.GetVendorType() );
User::Leave( KErrArgument );
}
@@ -2154,7 +2097,7 @@
else
{
- CLOG_WRITE_FORMAT( "! Error : Invalid EapFastUnauthProvModeAllowed. EapId: %d", eapId );
+ CLOG_WRITE_FORMAT( "! Error : Invalid EapFastUnauthProvModeAllowed. EapId: %d", eapId.GetVendorType() );
User::Leave( KErrArgument );
}
@@ -2175,7 +2118,7 @@
}
else
{
- CLOG_WRITE_FORMAT( "! Error : Invalid EapFastWarnADHPNoPAC. EapId: %d", eapId );
+ CLOG_WRITE_FORMAT( "! Error : Invalid EapFastWarnADHPNoPAC. EapId: %d", eapId.GetVendorType() );
User::Leave( KErrArgument );
}
@@ -2196,7 +2139,7 @@
}
else
{
- CLOG_WRITE_FORMAT( "! Error : Invalid EapFastWarnADHPNoMatchingPAC. EapId: %d", eapId );
+ CLOG_WRITE_FORMAT( "! Error : Invalid EapFastWarnADHPNoMatchingPAC. EapId: %d", eapId.GetVendorType() );
User::Leave( KErrArgument );
}
@@ -2217,7 +2160,7 @@
}
else
{
- CLOG_WRITE_FORMAT( "! Error : Invalid EapFastWarnNotDefaultServer. EapId: %d", eapId );
+ CLOG_WRITE_FORMAT( "! Error : Invalid EapFastWarnNotDefaultServer. EapId: %d", eapId.GetVendorType() );
User::Leave( KErrArgument );
}
@@ -2268,12 +2211,12 @@
// CProcessorWlan::FindCertificateEntry
// ---------------------------------------------------------
//
-TUint CProcessorWlan::FindCertificateEntryL( const CertificateEntry::TCertType aCertType, const TInt aEapIndex )
+TUint CProcessorWlan::FindCertificateEntryL( const EapCertificateEntry::TCertType aCertType, const TInt aEapIndex )
{
TUint certIndex( 0 );
for( certIndex = 0; certIndex < iEapSettings[aEapIndex]->iEapSettings->iCertificates.Count() ; certIndex++ )
{
- if( iEapSettings[aEapIndex]->iEapSettings->iCertificates[certIndex].iCertType == aCertType )
+ if( iEapSettings[aEapIndex]->iEapSettings->iCertificates[certIndex]->GetCertType() == aCertType )
{
// Found
break;
@@ -2282,9 +2225,9 @@
if( certIndex == iEapSettings[aEapIndex]->iEapSettings->iCertificates.Count() )
{
// Not found. Create
- CertificateEntry entry;
-
- entry.iCertType = aCertType;
+ EapCertificateEntry* entry;
+ entry = new (ELeave) EapCertificateEntry;
+ entry->SetCertType( aCertType );
iEapSettings[aEapIndex]->iEapSettings->iCertificates.AppendL( entry );
@@ -2297,7 +2240,7 @@
// CProcessorWlan::ConvertSubjectKeyIdToBinary
// ---------------------------------------------------------
//
-void CProcessorWlan::ConvertSubjectKeyIdToBinaryL( const HBufC16* const aSubjectKeyIdString, TDes& aBinaryKey)
+void CProcessorWlan::ConvertSubjectKeyIdToBinaryL( const HBufC16* const aSubjectKeyIdString, TKeyIdentifier& aBinaryKey)
{
TInt err( KErrNone );