diff -r 30e048a7b597 -r bad0cc58d154 eapol/eapol_framework/eapol_symbian/am/type/tls_peap/symbian/plugin/src/EapTlsPeapUiConnection.cpp --- a/eapol/eapol_framework/eapol_symbian/am/type/tls_peap/symbian/plugin/src/EapTlsPeapUiConnection.cpp Thu Aug 19 09:58:27 2010 +0300 +++ b/eapol/eapol_framework/eapol_symbian/am/type/tls_peap/symbian/plugin/src/EapTlsPeapUiConnection.cpp Tue Aug 31 15:16:37 2010 +0300 @@ -16,7 +16,7 @@ */ /* -* %version: 24.1.2 % +* %version: 35 % */ // This is enumeration of EAPOL source code. @@ -27,137 +27,136 @@ #define EAP_FILE_NUMBER_DATE 1127594498 #endif //#if defined(USE_EAP_MINIMUM_RELEASE_TRACES) -#include "EapTlsPeapUtils.h" +//#include "EapTlsPeapUtils.h" #include #include #include #include #include #include -#include "eap_am_trace_symbian.h" +#include "EapTraceSymbian.h" #ifdef USE_PAC_STORE -#include "pac_store_db_symbian.h" +#include "EapFastPacStore.h" #endif +// ---------------------------------------------------------- + CEapTlsPeapUiConnection::CEapTlsPeapUiConnection( const TIndexType aIndexType, const TInt aIndex, - const TInt aTunnelingType, - const TInt aEapType) + const TEapExpandedType aTunnelingType, + const TEapExpandedType aEapType) : iIndexType(aIndexType) , iIndex(aIndex) , iTunnelingType(aTunnelingType) , iEapType(aEapType) - , iIsConnected(EFalse) , iDataConn(NULL) , iCipherSuites(NULL) , iEapTypes(NULL) , iCertificates(NULL) , iPacStoreDb(NULL) { + EAP_TRACE_DEBUG_SYMBIAN((_L("CEapTlsPeapUiConnection::CEapTlsPeapUiConnection()\n"))); + EAP_TRACE_RETURN_STRING_SYMBIAN(_L("returns: CEapTlsPeapUiConnection::CEapTlsPeapUiConnection()\n")); + } +// ---------------------------------------------------------- CEapTlsPeapUiConnection::~CEapTlsPeapUiConnection() { + EAP_TRACE_DEBUG_SYMBIAN((_L("CEapTlsPeapUiConnection::~CEapTlsPeapUiConnection()\n"))); + EAP_TRACE_RETURN_STRING_SYMBIAN(_L("returns: CEapTlsPeapUiConnection::~CEapTlsPeapUiConnection()\n")); + #ifdef USE_PAC_STORE delete iPacStoreDb; #endif } +// ---------------------------------------------------------- + TInt CEapTlsPeapUiConnection::Connect() { - if(iIsConnected) - { - // Already connected. - return KErrNone; - } - + EAP_TRACE_DEBUG_SYMBIAN((_L("CEapTlsPeapUiConnection::Connect()\n"))); + EAP_TRACE_RETURN_STRING_SYMBIAN(_L("returns: CEapTlsPeapUiConnection::Connect()\n")); + TRAPD(err, ConnectL()); if(err == KErrNone) { - iIsConnected = ETrue; } return err; } +// ---------------------------------------------------------- + void CEapTlsPeapUiConnection::ConnectL() { -#ifdef USE_EAP_EXPANDED_TYPES - - eap_type_value_e tunnelingType(static_cast(iTunnelingType)); - eap_type_value_e eapType(static_cast(iEapType)); - -#else - - eap_type_value_e tunnelingType = static_cast(iTunnelingType); - eap_type_value_e eapType = static_cast(iEapType); - -#endif //#ifdef USE_EAP_EXPANDED_TYPES + EAP_TRACE_DEBUG_SYMBIAN((_L("CEapTlsPeapUiConnection::ConnectL()\n"))); + EAP_TRACE_RETURN_STRING_SYMBIAN(_L("returns: CEapTlsPeapUiConnection::ConnectL()\n")); #ifdef USE_PAC_STORE #ifdef USE_FAST_EAP_TYPE - if(iEapType == eap_type_fast && iPacStoreDb == NULL) + if(iEapType == *EapExpandedTypeFast.GetType() && iPacStoreDb == NULL) { - iPacStoreDb = CPacStoreDatabase::NewL(); + EAP_TRACE_DEBUG_SYMBIAN( + (_L("CEapTlsPeapUiConnection::ConnectL() CEapFastPacStore::NewL()"))); + iPacStoreDb = CEapFastPacStore::NewL(); User::LeaveIfNull(iPacStoreDb); EAP_TRACE_DEBUG_SYMBIAN( (_L("CEapTlsPeapUiConnection::Connect Created PAC store"))); iPacStoreDb->OpenPacStoreL(); - iPacStoreDb->CreateDeviceSeed( NULL ); + EAP_TRACE_DEBUG_SYMBIAN( (_L("CEapTlsPeapUiConnection::Connect Opened PAC store"))); + + iPacStoreDb->CreateDeviceSeedL(); + + EAP_TRACE_DEBUG_SYMBIAN( + (_L("CEapTlsPeapUiConnection::Connect Created device seed"))); } #endif // End: #ifdef USE_FAST_EAP_TYPE #endif // End: #ifdef USE_PAC_STORE - // Open or create the databse where all the settings are stored. - EapTlsPeapUtils::OpenDatabaseL( - iDbNamedDatabase, - iDbs, - iIndexType, - iIndex, - tunnelingType, - eapType); } +// ---------------------------------------------------------- TInt CEapTlsPeapUiConnection::Close() { - if (iIsConnected) - { + EAP_TRACE_DEBUG_SYMBIAN((_L("CEapTlsPeapUiConnection::Close()\n"))); + EAP_TRACE_RETURN_STRING_SYMBIAN(_L("returns: CEapTlsPeapUiConnection::Close()\n")); #ifdef USE_PAC_STORE #ifdef USE_FAST_EAP_TYPE - if(iEapType == eap_type_fast && iPacStoreDb != NULL) - { - iPacStoreDb->Close(); - } + if(iEapType == *EapExpandedTypeFast.GetType() + && iPacStoreDb != NULL) + { + delete iPacStoreDb; + iPacStoreDb = NULL; + } + #endif // End: #ifdef USE_FAST_EAP_TYPE #endif // End: #ifdef USE_PAC_STORE - - iDbNamedDatabase.Close(); - - iDbs.Close(); // Both the Dbs are closed and server can be closed now. - } - iIsConnected = EFalse; - return KErrNone; } +// ---------------------------------------------------------- CEapTlsPeapUiDataConnection * CEapTlsPeapUiConnection::GetDataConnection() { + EAP_TRACE_DEBUG_SYMBIAN((_L("CEapTlsPeapUiConnection::GetDataConnection()\n"))); + EAP_TRACE_RETURN_STRING_SYMBIAN(_L("returns: CEapTlsPeapUiConnection::GetDataConnection()\n")); + if (!iDataConn) { iDataConn = new CEapTlsPeapUiDataConnection(this); @@ -166,9 +165,13 @@ return iDataConn; } +// ---------------------------------------------------------- CEapTlsPeapUiCipherSuites * CEapTlsPeapUiConnection::GetCipherSuiteConnection() { + EAP_TRACE_DEBUG_SYMBIAN((_L("CEapTlsPeapUiConnection::GetCipherSuiteConnection()\n"))); + EAP_TRACE_RETURN_STRING_SYMBIAN(_L("returns: CEapTlsPeapUiConnection::GetCipherSuiteConnection()\n")); + if (!iCipherSuites) { iCipherSuites = new CEapTlsPeapUiCipherSuites(this); @@ -177,9 +180,13 @@ return iCipherSuites; } - +// ---------------------------------------------------------- + CEapTlsPeapUiCertificates * CEapTlsPeapUiConnection::GetCertificateConnection(MEapTlsPeapUiCertificates * const aParent) { + EAP_TRACE_DEBUG_SYMBIAN((_L("CEapTlsPeapUiConnection::GetCertificateConnection()\n"))); + EAP_TRACE_RETURN_STRING_SYMBIAN(_L("returns: CEapTlsPeapUiConnection::GetCertificateConnection()\n")); + if (!iCertificates) { iCertificates = new CEapTlsPeapUiCertificates(this, aParent); @@ -188,9 +195,14 @@ return iCertificates; } - +// ---------------------------------------------------------- + + CEapTlsPeapUiEapTypes * CEapTlsPeapUiConnection::GetEapTypeConnection() { + EAP_TRACE_DEBUG_SYMBIAN((_L("CEapTlsPeapUiConnection::GetEapTypeConnection()\n"))); + EAP_TRACE_RETURN_STRING_SYMBIAN(_L("returns: CEapTlsPeapUiConnection::GetEapTypeConnection()\n")); + if (!iEapTypes) { iEapTypes = new CEapTlsPeapUiEapTypes(this); @@ -199,50 +211,60 @@ return iEapTypes; } - -TInt CEapTlsPeapUiConnection::GetDatabase(RDbNamedDatabase & aDatabase) -{ - if (iIsConnected == EFalse) - { - return KErrSessionClosed; - } - - aDatabase = iDbNamedDatabase; - return KErrNone; -} - +// ---------------------------------------------------------- TIndexType CEapTlsPeapUiConnection::GetIndexType() { + EAP_TRACE_DEBUG_SYMBIAN((_L("CEapTlsPeapUiConnection::GetIndexType()\n"))); + EAP_TRACE_RETURN_STRING_SYMBIAN(_L("returns: CEapTlsPeapUiConnection::GetIndexType()\n")); + return iIndexType; } +// ---------------------------------------------------------- TInt CEapTlsPeapUiConnection::GetIndex() { + EAP_TRACE_DEBUG_SYMBIAN((_L("CEapTlsPeapUiConnection::GetIndex()\n"))); + EAP_TRACE_RETURN_STRING_SYMBIAN(_L("returns: CEapTlsPeapUiConnection::GetIndex()\n")); + return iIndex; } -TInt CEapTlsPeapUiConnection::GetTunnelingType() +// ---------------------------------------------------------- + +TEapExpandedType CEapTlsPeapUiConnection::GetTunnelingType() { + EAP_TRACE_DEBUG_SYMBIAN((_L("CEapTlsPeapUiConnection::GetTunnelingType()\n"))); + EAP_TRACE_RETURN_STRING_SYMBIAN(_L("returns: CEapTlsPeapUiConnection::GetTunnelingType()\n")); + return iTunnelingType; } -TInt CEapTlsPeapUiConnection::GetEapType() +// ---------------------------------------------------------- + +TEapExpandedType CEapTlsPeapUiConnection::GetEapType() { + EAP_TRACE_DEBUG_SYMBIAN((_L("CEapTlsPeapUiConnection::GetEapType()\n"))); + EAP_TRACE_RETURN_STRING_SYMBIAN(_L("returns: CEapTlsPeapUiConnection::GetEapType()\n")); + return iEapType; } +// ---------------------------------------------------------- TBool CEapTlsPeapUiConnection::IsPacStoreMasterKeyPresentL() { + EAP_TRACE_DEBUG_SYMBIAN((_L("CEapTlsPeapUiConnection::IsPacStoreMasterKeyPresentL()\n"))); + EAP_TRACE_RETURN_STRING_SYMBIAN(_L("returns: CEapTlsPeapUiConnection::IsPacStoreMasterKeyPresentL()\n")); + TBool status(EFalse); #ifdef USE_FAST_EAP_TYPE - if(iEapType == eap_type_fast) + if(iEapType == *EapExpandedTypeFast.GetType()) { - if (iIsConnected == EFalse) + if (iPacStoreDb == 0) { User::Leave(KErrSessionClosed); } @@ -266,13 +288,18 @@ return status; } +// ---------------------------------------------------------- + TInt CEapTlsPeapUiConnection::DestroyPacStore() { + EAP_TRACE_DEBUG_SYMBIAN((_L("CEapTlsPeapUiConnection::DestroyPacStore()\n"))); + EAP_TRACE_RETURN_STRING_SYMBIAN(_L("returns: CEapTlsPeapUiConnection::DestroyPacStore()\n")); + #ifdef USE_FAST_EAP_TYPE - if(iEapType == eap_type_fast) + if(iEapType == *EapExpandedTypeFast.GetType()) { - if (iIsConnected == EFalse) + if (iPacStoreDb == 0) { return KErrSessionClosed; } @@ -288,13 +315,18 @@ } } +// ---------------------------------------------------------- + TBool CEapTlsPeapUiConnection::VerifyPacStorePasswordL( const TDesC& aPacStorePw) { - if(aPacStorePw.Size() <= 0) + EAP_TRACE_DEBUG_SYMBIAN((_L("CEapTlsPeapUiConnection::VerifyPacStorePasswordL()\n"))); + EAP_TRACE_RETURN_STRING_SYMBIAN(_L("returns: CEapTlsPeapUiConnection::VerifyPacStorePasswordL()\n")); + + if(aPacStorePw.Length() <= 0) { EAP_TRACE_DEBUG_SYMBIAN( - (_L("CEapTlsPeapUiConnection::VerifyPacStorePasswordL: PAC store PW can not be EMPTY!"))); + (_L("ERROR: CEapTlsPeapUiConnection::VerifyPacStorePasswordL(): PAC store PW can not be EMPTY!"))); User::Leave(KErrArgument); } @@ -303,15 +335,15 @@ #ifdef USE_FAST_EAP_TYPE - if(iEapType == eap_type_fast) + if(iEapType == *EapExpandedTypeFast.GetType()) { - if (iIsConnected == EFalse) + if (iPacStoreDb == 0) { User::Leave(KErrSessionClosed); } EAP_TRACE_DATA_DEBUG_SYMBIAN( - ("CEapTlsPeapUiConnection::VerifyPacStorePasswordL:PW from caller (16bits)", + ("CEapTlsPeapUiConnection::VerifyPacStorePasswordL(): PW from caller (16bits)", aPacStorePw.Ptr(), aPacStorePw.Size())); @@ -320,7 +352,7 @@ pacStorePWPtr8.Copy(aPacStorePw); EAP_TRACE_DATA_DEBUG_SYMBIAN( - ("CEapTlsPeapUiConnection::VerifyPacStorePasswordL:PW used for masterkey verification (8bits)", + ("CEapTlsPeapUiConnection::VerifyPacStorePasswordL(): PW used for masterkey verification (8bits)", pacStorePWPtr8.Ptr(), pacStorePWPtr8.Size())); @@ -333,7 +365,7 @@ // Password and master key are matching. // Means, This is the password used to create the master key. EAP_TRACE_DEBUG_SYMBIAN( - (_L("CEapTlsPeapUiConnection::VerifyPacStorePasswordL PAC store PW verified OK (true) \n"))); + (_L("CEapTlsPeapUiConnection::VerifyPacStorePasswordL(): PAC store PW verified OK (true) \n"))); } } else @@ -345,39 +377,44 @@ return status; } +// ---------------------------------------------------------- + TInt CEapTlsPeapUiConnection::CreatePacStoreMasterKey( const TDesC& aPacStorePw) { - if(aPacStorePw.Size() <= 0) + EAP_TRACE_DEBUG_SYMBIAN((_L("CEapTlsPeapUiConnection::CreatePacStoreMasterKey()\n"))); + EAP_TRACE_RETURN_STRING_SYMBIAN(_L("returns: CEapTlsPeapUiConnection::CreatePacStoreMasterKey()\n")); + + if(aPacStorePw.Length() <= 0) { EAP_TRACE_DEBUG_SYMBIAN( - (_L("CEapTlsPeapUiConnection::CreatePacStoreMasterKey PAC store PW can not be EMPTY!"))); + (_L("ERROR: CEapTlsPeapUiConnection::CreatePacStoreMasterKey(): PAC store PW can not be EMPTY!"))); return KErrArgument; } #ifdef USE_FAST_EAP_TYPE - if(iEapType == eap_type_fast) + if(iEapType == *EapExpandedTypeFast.GetType()) { - if (iIsConnected == EFalse) + if (iPacStoreDb == 0) { return KErrSessionClosed; } - TInt creationStatus(KErrNone); + TInt creationStatus(KErrNone); EAP_TRACE_DATA_DEBUG_SYMBIAN( - ("CEapTlsPeapUiConnection::CreatePacStoreMasterKey:PW from caller (16bits)", - aPacStorePw.Ptr(), - aPacStorePw.Size())); + ("CEapTlsPeapUiConnection::CreatePacStoreMasterKey(): PW from caller (16bits)", + aPacStorePw.Ptr(), + aPacStorePw.Size())); HBufC8* pacStorePWBuf8 = NULL; TRAPD(err, pacStorePWBuf8 = HBufC8::NewL(aPacStorePw.Size())); if (err != KErrNone) { EAP_TRACE_DEBUG_SYMBIAN( - (_L("CEapTlsPeapUiConnection::CreatePacStoreMasterKey:Allocation failed\n"))); + (_L("CEapTlsPeapUiConnection::CreatePacStoreMasterKey(): Allocation failed\n"))); return KErrNoMemory; } @@ -385,24 +422,24 @@ pacStorePWPtr8.Copy(aPacStorePw); EAP_TRACE_DATA_DEBUG_SYMBIAN( - ("CEapTlsPeapUiConnection::CreatePacStoreMasterKey:PW used for masterkey creation (8bits)", - pacStorePWPtr8.Ptr(), - pacStorePWPtr8.Size())); + ("CEapTlsPeapUiConnection::CreatePacStoreMasterKey(): PW used for masterkey creation (8bits)", + pacStorePWPtr8.Ptr(), + pacStorePWPtr8.Size())); - TRAPD(err1, creationStatus = iPacStoreDb->CreateAndSaveMasterKeyL(pacStorePWPtr8)); + TRAPD(error, creationStatus = iPacStoreDb->CreateAndSaveMasterKeyL(pacStorePWPtr8)); delete pacStorePWBuf8; - if(err1 != KErrNone) + if(error != KErrNone) { EAP_TRACE_DEBUG_SYMBIAN( - (_L("CEapTlsPeapUiConnection::CreatePacStoreMasterKey:Creation failed %d\n"), err1)); + (_L("CEapTlsPeapUiConnection::CreatePacStoreMasterKey(): Creation failed %d\n"), error)); } if (creationStatus == KErrNone) { EAP_TRACE_DEBUG_SYMBIAN( - (_L("CEapTlsPeapUiConnection::CreatePacStoreMasterKey Master key created OK\n"))); + (_L("CEapTlsPeapUiConnection::CreatePacStoreMasterKey(): Master key created OK\n"))); } return creationStatus; } @@ -413,19 +450,54 @@ } } -CPacStoreDatabase * CEapTlsPeapUiConnection::GetPacStoreDb() +// ---------------------------------------------------------- + +void CEapTlsPeapUiConnection::GetPacStorePasswordL( + TDes8 & /* aPassword8 */) { -#ifdef USE_FAST_EAP_TYPE - - if(iEapType == eap_type_fast) + EAP_TRACE_DEBUG_SYMBIAN((_L("CEapTlsPeapUiConnection::GetPacStorePasswordL()\n"))); + EAP_TRACE_RETURN_STRING_SYMBIAN(_L("returns: CEapTlsPeapUiConnection::GetPacStorePasswordL()\n")); + +#ifdef USE_FAST_EAP_TYPE + if(iEapType == *EapExpandedTypeFast.GetType()) { - return iPacStoreDb; + //iPacStoreDb->GetPacStorePasswordL(aPassword8); } else #endif // End: #ifdef USE_FAST_EAP_TYPE { - return NULL; - } + User::Leave(KErrNotSupported); + } } +// ---------------------------------------------------------- + +void CEapTlsPeapUiConnection::SetPacStorePasswordL( + const TDesC8 & aPassword8) +{ + EAP_TRACE_DEBUG_SYMBIAN((_L("CEapTlsPeapUiConnection::SetPacStorePasswordL()\n"))); + EAP_TRACE_RETURN_STRING_SYMBIAN(_L("returns: CEapTlsPeapUiConnection::SetPacStorePasswordL()\n")); + + if(aPassword8.Length() <= 0) + { + EAP_TRACE_DEBUG_SYMBIAN( + (_L("ERROR: CEapTlsPeapUiConnection::SetPacStorePasswordL(): PAC store PW can not be EMPTY!"))); + return; + //User::Leave(KErrArgument); + } + +#ifdef USE_FAST_EAP_TYPE + if(iEapType == *EapExpandedTypeFast.GetType()) + { + iPacStoreDb->SetPacStorePasswordL(aPassword8); + } + else +#endif // End: #ifdef USE_FAST_EAP_TYPE + { + User::Leave(KErrNotSupported); + } +} + + +// ---------------------------------------------------------- // End of file