# HG changeset patch # User Dremov Kirill (Nokia-D-MSW/Tampere) # Date 1272881986 -10800 # Node ID bf47f3b7915499a3d9455a113eade866cc7431c6 # Parent 19fb38abab1de421a533f33b2e2ddb828a3f66c6 Revision: 201015 Kit: 201018 diff -r 19fb38abab1d -r bf47f3b79154 fotaapplication/fotaserver/FotaServer/group/fotaserver.mmp --- a/fotaapplication/fotaserver/FotaServer/group/fotaserver.mmp Fri Apr 16 15:52:47 2010 +0300 +++ b/fotaapplication/fotaserver/FotaServer/group/fotaserver.mmp Mon May 03 13:19:46 2010 +0300 @@ -78,9 +78,7 @@ LIBRARY aknskins.lib LIBRARY apgrfx.lib -LIBRARY apengine.lib LIBRARY apparc.lib -LIBRARY apsettingshandlerui.lib LIBRARY avkon.lib LIBRARY bafl.lib LIBRARY cone.lib diff -r 19fb38abab1d -r bf47f3b79154 fotaapplication/fotaserver/FotaServer/inc/fotadownload.h --- a/fotaapplication/fotaserver/FotaServer/inc/fotadownload.h Fri Apr 16 15:52:47 2010 +0300 +++ b/fotaapplication/fotaserver/FotaServer/inc/fotadownload.h Mon May 03 13:19:46 2010 +0300 @@ -20,7 +20,7 @@ #ifndef ___DOWNLOADER_H_ #define ___DOWNLOADER_H_ -#include +#include #include //To read GSM Error codes from symbian #include //To read GSM Error codes from symbian #include //To read WLAN Error codes from s60 diff -r 19fb38abab1d -r bf47f3b79154 fotaapplication/fotaserver/FotaServer/src/FotaServer.cpp --- a/fotaapplication/fotaserver/FotaServer/src/FotaServer.cpp Fri Apr 16 15:52:47 2010 +0300 +++ b/fotaapplication/fotaserver/FotaServer/src/FotaServer.cpp Mon May 03 13:19:46 2010 +0300 @@ -24,8 +24,9 @@ #include #include #include -#include -#include +#include +#include +#include #include #include #include @@ -2278,12 +2279,15 @@ TBool CFotaServer::CheckIapExistsL(TUint32 aIapId) { FLOG(_L("CFotaServer::CheckIapExistsL >>")); - CCommsDatabase* commDb = CCommsDatabase::NewL( EDatabaseTypeIAP ); - CleanupStack::PushL( commDb ); - CApUtils* aputils = CApUtils::NewLC(*commDb); - TBool exists = aputils->IAPExistsL( aIapId); - CleanupStack::PopAndDestroy( aputils ); - CleanupStack::PopAndDestroy( commDb ); + TBool exists = EFalse; + RCmManager cmManager; + cmManager.OpenLC(); + RCmConnectionMethod conn; + TRAPD(err, conn = cmManager.ConnectionMethodL( aIapId )); + if(err == KErrNone)//connection method exists + exists = ETrue; + conn.Close(); + CleanupStack::PopAndDestroy();//cmManager FLOG(_L("CFotaServer::CheckIapExistsL <<")); return exists; } diff -r 19fb38abab1d -r bf47f3b79154 fotaapplication/fotaserver/FotaServer/src/FotaSrvDocument.cpp --- a/fotaapplication/fotaserver/FotaServer/src/FotaSrvDocument.cpp Fri Apr 16 15:52:47 2010 +0300 +++ b/fotaapplication/fotaserver/FotaServer/src/FotaSrvDocument.cpp Mon May 03 13:19:46 2010 +0300 @@ -19,8 +19,6 @@ // INCLUDE FILES #include -#include -#include #include #include #include diff -r 19fb38abab1d -r bf47f3b79154 omaprovisioning/provisioning/IMAdapter/Group/IMAdapter.mmp --- a/omaprovisioning/provisioning/IMAdapter/Group/IMAdapter.mmp Fri Apr 16 15:52:47 2010 +0300 +++ b/omaprovisioning/provisioning/IMAdapter/Group/IMAdapter.mmp Mon May 03 13:19:46 2010 +0300 @@ -57,9 +57,9 @@ LIBRARY provisioningengine.lib LIBRARY wvsapsettingsstore.lib LIBRARY msgeditorutils.lib -LIBRARY apengine.lib LIBRARY commdb.lib -LIBRARY inetprotutil.lib +LIBRARY inetprotutil.lib +LIBRARY cmmanager.lib DEBUGLIBRARY flogger.lib diff -r 19fb38abab1d -r bf47f3b79154 omaprovisioning/provisioning/IMAdapter/Inc/CWPIMAdapter.h --- a/omaprovisioning/provisioning/IMAdapter/Inc/CWPIMAdapter.h Fri Apr 16 15:52:47 2010 +0300 +++ b/omaprovisioning/provisioning/IMAdapter/Inc/CWPIMAdapter.h Mon May 03 13:19:46 2010 +0300 @@ -29,7 +29,7 @@ // FORWARD DECLARATIONS class CWPCharacteristic; class CWPIMSAPItem; -class CApAccessPointItem; + // CLASS DECLARATION diff -r 19fb38abab1d -r bf47f3b79154 omaprovisioning/provisioning/IMAdapter/Inc/CWPPecAdapter.h --- a/omaprovisioning/provisioning/IMAdapter/Inc/CWPPecAdapter.h Fri Apr 16 15:52:47 2010 +0300 +++ b/omaprovisioning/provisioning/IMAdapter/Inc/CWPPecAdapter.h Mon May 03 13:19:46 2010 +0300 @@ -28,7 +28,7 @@ // FORWARD DECLARATIONS class CWPCharacteristic; class CWPIMSAPItem; -class CApAccessPointItem; + // CLASS DECLARATION diff -r 19fb38abab1d -r bf47f3b79154 omaprovisioning/provisioning/IMAdapter/Inc/WPIMUtil.h --- a/omaprovisioning/provisioning/IMAdapter/Inc/WPIMUtil.h Fri Apr 16 15:52:47 2010 +0300 +++ b/omaprovisioning/provisioning/IMAdapter/Inc/WPIMUtil.h Mon May 03 13:19:46 2010 +0300 @@ -40,7 +40,6 @@ // FORWARD DECLARATIONS class RResourceFile; -class CApAccessPointItem; class CWPCharacteristic; // CLASS DECLARATION @@ -89,7 +88,7 @@ */ static TBool HasIllegalChars( const TDesC& aDes ); - static CApAccessPointItem* FindGPRSL( RPointerArray& aLinks ); + static TUint32 FindGPRSL( RPointerArray& aLinks ); /** * Checks the validity of current data diff -r 19fb38abab1d -r bf47f3b79154 omaprovisioning/provisioning/IMAdapter/Src/CWPIMAdapter.cpp --- a/omaprovisioning/provisioning/IMAdapter/Src/CWPIMAdapter.cpp Fri Apr 16 15:52:47 2010 +0300 +++ b/omaprovisioning/provisioning/IMAdapter/Src/CWPIMAdapter.cpp Mon May 03 13:19:46 2010 +0300 @@ -25,9 +25,6 @@ #include #include -#include -#include -#include #include #include "WPAdapterUtil.h" #include "CWPIMSAPItem.h" @@ -174,19 +171,8 @@ TUint32 iapId(KMaxTUint32); if(data->iLinks.Count()) { - CApAccessPointItem* item = WPIMUtil::FindGPRSL( data->iLinks ); - CleanupStack::PushL( item ); - - // get the WAP id - CCommsDatabase* commDb = CCommsDatabase::NewL(); - CleanupStack::PushL(commDb); - TUint32 uid( item->WapUid() ); - - // Convert WAP uid to IAP uid - CApUtils* apUtils = CApUtils::NewLC( *commDb ); - iapId = apUtils->IapIdFromWapIdL( uid ); - CleanupStack::PopAndDestroy( 3 ); // apUtils, commDb, item - } + iapId = WPIMUtil::FindGPRSL( data->iLinks ); + } // set the IAP id as part of save item. sapItem->SetIAPIdL( iapId ); diff -r 19fb38abab1d -r bf47f3b79154 omaprovisioning/provisioning/IMAdapter/Src/CWPPecAdapter.cpp --- a/omaprovisioning/provisioning/IMAdapter/Src/CWPPecAdapter.cpp Fri Apr 16 15:52:47 2010 +0300 +++ b/omaprovisioning/provisioning/IMAdapter/Src/CWPPecAdapter.cpp Mon May 03 13:19:46 2010 +0300 @@ -24,9 +24,6 @@ #include #include -#include -#include -#include #include #include "WPAdapterUtil.h" #include "CWPIMSAPItem.h" @@ -173,22 +170,12 @@ sapItem->SetSettingsNameL( data->iName ); // Find a proper GPRS access point - CApAccessPointItem* item = WPIMUtil::FindGPRSL( data->iLinks ); - CleanupStack::PushL( item ); - - // get the WAP id - CCommsDatabase* commDb = CCommsDatabase::NewL(); - CleanupStack::PushL(commDb); - TUint32 uid( item->WapUid() ); - - // Convert WAP uid to IAP uid - CApUtils* apUtils = CApUtils::NewLC( *commDb ); - TUint32 iapId = apUtils->IapIdFromWapIdL( uid ); + TUint32 iapId = WPIMUtil::FindGPRSL( data->iLinks ); + // set the IAP id as part of save item. sapItem->SetIAPIdL( iapId ); - CleanupStack::PopAndDestroy( 3 ); // apUtils, commDb, item // store SAP item TUint32 SAPuid = sapItem->StoreL(); data->iSAPId = SAPuid; diff -r 19fb38abab1d -r bf47f3b79154 omaprovisioning/provisioning/IMAdapter/Src/WPIMUtil.cpp --- a/omaprovisioning/provisioning/IMAdapter/Src/WPIMUtil.cpp Fri Apr 16 15:52:47 2010 +0300 +++ b/omaprovisioning/provisioning/IMAdapter/Src/WPIMUtil.cpp Mon May 03 13:19:46 2010 +0300 @@ -26,9 +26,9 @@ #include #include -#include -#include -#include +#include +#include +#include #include #include "WPAdapterUtil.h" #include @@ -47,40 +47,43 @@ // CWPPecAdapter::FindGPRSL // ----------------------------------------------------------------------------- // -CApAccessPointItem* WPIMUtil::FindGPRSL( +TUint32 WPIMUtil::FindGPRSL( RPointerArray& aLinks ) { - CCommsDatabase* commDb = CCommsDatabase::NewL(); - CleanupStack::PushL( commDb ); - CApDataHandler* apHandler = CApDataHandler::NewLC( *commDb ); + TUint32 iapID=NULL; + RCmManagerExt cmmanagerExt; + cmmanagerExt.OpenL(); + CleanupClosePushL(cmmanagerExt); + TUint32 bearer = 0; + - for( TInt i( 0 ); i < aLinks.Count(); i++ ) - { - CWPCharacteristic* curr = aLinks[i]; - - TPckgBuf uidPckg; - for( TInt dataNum( 0 ); curr->Data( dataNum ).Length() == uidPckg.MaxLength(); dataNum++ ) - { - uidPckg.Copy( curr->Data( dataNum ) ); + for( TInt i( 0 ); i < aLinks.Count(); i++ ) + { + CWPCharacteristic* curr = aLinks[i]; - CApAccessPointItem* item = CApAccessPointItem::NewLC(); - // Read the access point pointed to by TO-NAPID or TO-PROXY - apHandler->AccessPointDataL( uidPckg(), *item ); - - if( item->BearerTypeL() == EApBearerTypeGPRS ) - { - CleanupStack::Pop(); // item - CleanupStack::PopAndDestroy( 2 ); // apHandler, commDb - return item; - } - CleanupStack::PopAndDestroy( item ); - } - } - + TPckgBuf uidPckg; + for( TInt dataNum( 0 ); curr->Data( dataNum ).Length() == uidPckg.MaxLength(); dataNum++ ) + { + uidPckg.Copy( curr->Data( dataNum ) ); + RCmConnectionMethodExt cm; + cm = cmmanagerExt.ConnectionMethodL( uidPckg() ); + CleanupClosePushL( cm ); + bearer = cm.GetIntAttributeL( CMManager::ECmBearerType ); + if(bearer == KUidPacketDataBearerType) + { + iapID = cm.GetIntAttributeL(CMManager::ECmIapId); + CleanupStack::PopAndDestroy(2); + return iapID; + } + CleanupStack::PopAndDestroy(); // cm + } + } + CleanupStack::PopAndDestroy(); //cmmanagerExt + // This leave is absolutely needed as it pops & destroys // data in CleanupStack - User::Leave( KErrNotFound ); - return NULL; + // User::Leave( KErrNotFound ); + return iapID; } // ----------------------------------------------------------------------------- diff -r 19fb38abab1d -r bf47f3b79154 omaprovisioning/provisioning/ProvisioningParser/Src/CWPWbxmlParser.cpp --- a/omaprovisioning/provisioning/ProvisioningParser/Src/CWPWbxmlParser.cpp Fri Apr 16 15:52:47 2010 +0300 +++ b/omaprovisioning/provisioning/ProvisioningParser/Src/CWPWbxmlParser.cpp Mon May 03 13:19:46 2010 +0300 @@ -22,7 +22,7 @@ #include "CWPWbxmlParser.h" #include "OMAProvisioningDictionary.h" #include "ProvisioningDebug.h" -#include +#include // EXTERNAL DATA STRUCTURES extern "C" NW_WBXML_Dictionary_t NW_omawapprovisioning_WBXMLDictionary; diff -r 19fb38abab1d -r bf47f3b79154 omaprovisioning/provisioning/Rom/Provisioning.iby --- a/omaprovisioning/provisioning/Rom/Provisioning.iby Fri Apr 16 15:52:47 2010 +0300 +++ b/omaprovisioning/provisioning/Rom/Provisioning.iby Mon May 03 13:19:46 2010 +0300 @@ -25,7 +25,7 @@ // Parser file=ABI_DIR\BUILD_DIR\ProvisioningParser.dll SHARED_LIB_DIR\ProvisioningParser.dll // BIO control -file=ABI_DIR\BUILD_DIR\ProvisioningBC.dll SHARED_LIB_DIR\ProvisioningBC.dll +//file=ABI_DIR\BUILD_DIR\ProvisioningBC.dll SHARED_LIB_DIR\ProvisioningBC.dll // Handler ECOM_PLUGIN(ProvisioningHandler.dll,101F84D2.rsc) // Access point adapter diff -r 19fb38abab1d -r bf47f3b79154 omaprovisioning/provisioning/StreamingAdapter/Group/StreamingAdapter.mmp --- a/omaprovisioning/provisioning/StreamingAdapter/Group/StreamingAdapter.mmp Fri Apr 16 15:52:47 2010 +0300 +++ b/omaprovisioning/provisioning/StreamingAdapter/Group/StreamingAdapter.mmp Mon May 03 13:19:46 2010 +0300 @@ -56,7 +56,7 @@ LIBRARY euser.lib LIBRARY provisioningengine.lib LIBRARY mpsettengine.lib -LIBRARY apengine.lib +LIBRARY cmmanager.lib LIBRARY commdb.lib DEBUGLIBRARY flogger.lib diff -r 19fb38abab1d -r bf47f3b79154 omaprovisioning/provisioning/StreamingAdapter/Src/Streamingadapter.cpp --- a/omaprovisioning/provisioning/StreamingAdapter/Src/Streamingadapter.cpp Fri Apr 16 15:52:47 2010 +0300 +++ b/omaprovisioning/provisioning/StreamingAdapter/Src/Streamingadapter.cpp Mon May 03 13:19:46 2010 +0300 @@ -21,11 +21,9 @@ #include #include #include -#include -#include -#include #include - +#include +#include #include "WPAdapterUtil.h" #include "StreamingAdapter.h" #include "ProvisioningDebug.h" @@ -194,12 +192,11 @@ } // Get the IAP id + + RCmManagerExt cmmanagerExt; + cmmanagerExt.OpenL(); + CleanupClosePushL(cmmanagerExt); - CCommsDatabase* commDb = CCommsDatabase::NewL(EDatabaseTypeIAP); - CleanupStack::PushL(commDb); - CApDataHandler* apDataHandler = CApDataHandler::NewLC(*commDb); - CApAccessPointItem* apItem = CApAccessPointItem::NewLC(); - TPckgBuf uid; TBool proxyDefined(EFalse); TBool apDefined(EFalse); @@ -209,12 +206,12 @@ && !(proxyDefined && apWithoutProxyDefined); i++) { uid.Copy(iCurrentData->iNapDef->Data(i)); + RCmConnectionMethodExt cm; + cm = cmmanagerExt.ConnectionMethodL( uid() ); + CleanupClosePushL( cm ); - apDataHandler->AccessPointDataL(uid(), *apItem); - - TBool useProxy(EFalse); - apItem->ReadBool(EApProxyUseProxy, useProxy); - + TBool useProxy = cm.GetBoolAttributeL( CMManager::ECmProxyUsageEnabled ); + if (!apDefined || (!useProxy && !apWithoutProxyDefined)) { iModel->SetDefaultAp(uid()); @@ -231,12 +228,11 @@ if (!proxyDefined && useProxy) { // Get proxy port - TUint32 proxyPort(0); - apItem->ReadUint(EApProxyPortNumber, proxyPort); + TUint32 proxyPort = cm.GetIntAttributeL( CMManager::ECmProxyPortNumber ); + // Get proxy host name - const HBufC* proxyHost = apItem->ReadConstLongTextL( - EApProxyServerAddress); + const HBufC* proxyHost = cm.GetStringAttributeL( CMManager::ECmProxyServerName ); if(*proxyHost != KNullDesC && proxyPort <= 65535) { @@ -246,10 +242,12 @@ proxyDefined = ETrue; } + delete proxyHost; } + CleanupStack::PopAndDestroy();//cm } - CleanupStack::PopAndDestroy(3); // apItem & apDataHandler & commDb + CleanupStack::PopAndDestroy(); // cmmanagerext iModel->StoreSettingsL(); diff -r 19fb38abab1d -r bf47f3b79154 omaprovisioning/provisioning/WAPAdapter/Group/WPWAPAdapter.mmp --- a/omaprovisioning/provisioning/WAPAdapter/Group/WPWAPAdapter.mmp Fri Apr 16 15:52:47 2010 +0300 +++ b/omaprovisioning/provisioning/WAPAdapter/Group/WPWAPAdapter.mmp Mon May 03 13:19:46 2010 +0300 @@ -62,7 +62,7 @@ LIBRARY euser.lib LIBRARY provisioningengine.lib LIBRARY msgs.lib -LIBRARY apengine.lib +LIBRARY cmmanager.lib LIBRARY commdb.lib LIBRARY commonengine.lib LIBRARY favouritesengine.lib diff -r 19fb38abab1d -r bf47f3b79154 omaprovisioning/provisioning/WAPAdapter/Inc/CWPWAPAdapterBase.h --- a/omaprovisioning/provisioning/WAPAdapter/Inc/CWPWAPAdapterBase.h Fri Apr 16 15:52:47 2010 +0300 +++ b/omaprovisioning/provisioning/WAPAdapter/Inc/CWPWAPAdapterBase.h Mon May 03 13:19:46 2010 +0300 @@ -28,7 +28,8 @@ class CWPCharacteristic; class MWPWAPItemBase; class CCommsDatabase; -class CApDataHandler; +class RCmConnectionMethodExt; +class RCmManagerExt; // CLASS DECLARATION @@ -103,7 +104,7 @@ CCommsDatabase* iCommsDb; // APEngine for saving. Owns. - CApDataHandler* iAPHandler; + RCmManagerExt* iCmManager; }; #endif // CWPWAPADAPTERBASE_H diff -r 19fb38abab1d -r bf47f3b79154 omaprovisioning/provisioning/WAPAdapter/Inc/CWPWAPBrowserItem.h --- a/omaprovisioning/provisioning/WAPAdapter/Inc/CWPWAPBrowserItem.h Fri Apr 16 15:52:47 2010 +0300 +++ b/omaprovisioning/provisioning/WAPAdapter/Inc/CWPWAPBrowserItem.h Mon May 03 13:19:46 2010 +0300 @@ -28,7 +28,7 @@ // FORWARD DECLARATIONS class MWPWAPItemBase; class CBookmarkDb; - +class RCmManagerExt; // CLASS DECLARATION /** @@ -63,8 +63,9 @@ const TDesC& aDefaultBookmarkName, CWPCharacteristic& aCharacteristic, CCommsDatabase*& aCommsDb, - CApDataHandler*& aAPHandler, - RFavouritesDb aBookmarkDb ); + RCmManagerExt*& aCmManager, + RFavouritesDb aBookmarkDb + ); /** * Destructor. @@ -93,8 +94,9 @@ const TDesC& aDefaultBookmarkName, CWPCharacteristic& aCharacteristic, CCommsDatabase*& aCommsDb, - CApDataHandler*& aAPHandler, - RFavouritesDb aBookmarkDb ); + RCmManagerExt*& aCmManager, + RFavouritesDb aBookmarkDb + ); /** * By default Symbian 2nd phase constructor is private. diff -r 19fb38abab1d -r bf47f3b79154 omaprovisioning/provisioning/WAPAdapter/Inc/CWPWAPItemBAse.h --- a/omaprovisioning/provisioning/WAPAdapter/Inc/CWPWAPItemBAse.h Fri Apr 16 15:52:47 2010 +0300 +++ b/omaprovisioning/provisioning/WAPAdapter/Inc/CWPWAPItemBAse.h Mon May 03 13:19:46 2010 +0300 @@ -24,11 +24,12 @@ #include #include #include "MWPWAPItemBase.h" +#include +#include // FORWARD DECLARATIONS class CCommsDatabase; -class CApDataHandler; -class CApAccessPointItem; + // CLASS DECLARATION @@ -73,7 +74,7 @@ const TDesC& aDefaultName, CWPCharacteristic& aCharacteristic, CCommsDatabase*& aCommsDb, - CApDataHandler*& aAPHandler ); + RCmManagerExt*& aCmManager); /** * 2nd phase base constructor. Derived classes must call this. @@ -96,7 +97,7 @@ * has a home page, create a new one. * @param aItem Access point to access */ - void WriteHomePageL( CApAccessPointItem& aItem ); + void WriteHomePageL( RCmConnectionMethodExt& aCmItem ); /** * Create a valid name for the access point. @@ -133,8 +134,9 @@ // Comms db. Refs. CCommsDatabase*& iCommsDb; - // APEngine. Refs. - CApDataHandler*& iAPHandler; + // @var Pointer to Connection Method Manager that is required to access + // Access Point data + RCmManagerExt*& iCmManager; }; #endif // CWPWAPITEMBASE_H diff -r 19fb38abab1d -r bf47f3b79154 omaprovisioning/provisioning/WAPAdapter/Inc/CWPWAPMMSItem.h --- a/omaprovisioning/provisioning/WAPAdapter/Inc/CWPWAPMMSItem.h Fri Apr 16 15:52:47 2010 +0300 +++ b/omaprovisioning/provisioning/WAPAdapter/Inc/CWPWAPMMSItem.h Mon May 03 13:19:46 2010 +0300 @@ -27,7 +27,7 @@ // FORWARD DECLARATIONS class CBookmarkDb; -class CApAccessPointItem; +class RCmManagerExt; // CLASS DECLARATION @@ -53,7 +53,7 @@ const TDesC& aDefaultName, CWPCharacteristic& aCharacteristic, CCommsDatabase*& aCommsDb, - CApDataHandler*& aAPHandler ); + RCmManagerExt*& aCmManager); /** * Destructor. @@ -84,19 +84,14 @@ const TDesC& aDefaultName, CWPCharacteristic& aCharacteristic, CCommsDatabase*& aCommsDb, - CApDataHandler*& aAPHandler ); + RCmManagerExt*& aCmManager); /** * By default Symbian 2nd phase constructor is private. */ void ConstructL(); - /** - * Check if a NAPDEF characteristic is GPRS. - * @param aCharacteristic The NAPDEF characteristic - * @return GPRS access point if found - */ - CApAccessPointItem* FindGPRSLC() const; + private: // Data // The bookmarks database. Refs. diff -r 19fb38abab1d -r bf47f3b79154 omaprovisioning/provisioning/WAPAdapter/Inc/WPWAPItemFactory.h --- a/omaprovisioning/provisioning/WAPAdapter/Inc/WPWAPItemFactory.h Fri Apr 16 15:52:47 2010 +0300 +++ b/omaprovisioning/provisioning/WAPAdapter/Inc/WPWAPItemFactory.h Mon May 03 13:19:46 2010 +0300 @@ -26,11 +26,12 @@ class MWPWAPItemBase; class CWPCharacteristic; class CCommsDatabase; -class CApDataHandler; +class RCmConnectionMethodExt; +class RCmDestinationExt; class CBookmarkDb; class RFavouritesDb; // CLASS DECLARATION - +class RCmManagerExt; /** * WPWAPItemFactory is a factory for all WAP items. * @@ -53,7 +54,7 @@ const TDesC& aDefaultName, CWPCharacteristic& aCharacteristic, CCommsDatabase*& aCommsDb, - CApDataHandler*& aAPHandler ); + RCmManagerExt*& aCmManager ); /** @@ -75,7 +76,7 @@ const TDesC& aDefaultBookmarkName, CWPCharacteristic& aCharacteristic, CCommsDatabase*& aCommsDb, - CApDataHandler*& aAPHandler, + RCmManagerExt*& aCmManager, RFavouritesDb aBookmarkDb ); /** diff -r 19fb38abab1d -r bf47f3b79154 omaprovisioning/provisioning/WAPAdapter/Src/CWPWAPAdapterBase.cpp --- a/omaprovisioning/provisioning/WAPAdapter/Src/CWPWAPAdapterBase.cpp Fri Apr 16 15:52:47 2010 +0300 +++ b/omaprovisioning/provisioning/WAPAdapter/Src/CWPWAPAdapterBase.cpp Mon May 03 13:19:46 2010 +0300 @@ -20,7 +20,8 @@ // INCLUDE FILES #include #include -#include +#include +#include #include #include #include @@ -57,7 +58,12 @@ iItems.ResetAndDestroy(); iHiddenItems.ResetAndDestroy(); delete iCommsDb; - delete iAPHandler; + + if ( iCmManager != NULL ) + { + iCmManager->Close(); + delete iCmManager; + } } // ----------------------------------------------------------------------------- @@ -200,7 +206,7 @@ if( pckg().iSaveItemType == KWPWAPItemTypeAccesspoint ) { DVA( "DeleteL: Deleting access point %08x", pckg().iUID ); - TRAPD( err, iAPHandler->RemoveAPL( pckg().iUID ) ); + TRAPD( err, iCmManager->ConnectionMethodL( pckg().iUID).DeleteL()); DVA( "DeleteL: Deleted, %d", err ); switch( err ) @@ -246,12 +252,10 @@ { iCommsDb = CCommsDatabase::NewL(); } + iCmManager = new RCmManagerExt; + iCmManager->OpenL(); - if( !iAPHandler ) - { - iAPHandler = CApDataHandler::NewLC( *iCommsDb ); - CleanupStack::Pop(); // iAPEngine - } + } // End of File diff -r 19fb38abab1d -r bf47f3b79154 omaprovisioning/provisioning/WAPAdapter/Src/CWPWAPBrowserAdapter.cpp --- a/omaprovisioning/provisioning/WAPAdapter/Src/CWPWAPBrowserAdapter.cpp Fri Apr 16 15:52:47 2010 +0300 +++ b/omaprovisioning/provisioning/WAPAdapter/Src/CWPWAPBrowserAdapter.cpp Mon May 03 13:19:46 2010 +0300 @@ -24,7 +24,6 @@ #include #include #include -#include #include "CWPWAPBrowserAdapter.h" #include "MWPWAPItemBase.h" #include "WPWAPItemFactory.h" @@ -97,7 +96,7 @@ { MWPWAPItemBase* item = WPWAPItemFactory::CreateBrowserLC( !iProcessed, *iTitle, *iBookmarkTitle, *iDefaultName, *iDefaultBookmarkName, - aCharacteristic, iCommsDb, iAPHandler, iFavouritesDb ); + aCharacteristic, iCommsDb, iCmManager, iFavouritesDb ); if( item->ValidateL() ) { diff -r 19fb38abab1d -r bf47f3b79154 omaprovisioning/provisioning/WAPAdapter/Src/CWPWAPBrowserItem.cpp --- a/omaprovisioning/provisioning/WAPAdapter/Src/CWPWAPBrowserItem.cpp Fri Apr 16 15:52:47 2010 +0300 +++ b/omaprovisioning/provisioning/WAPAdapter/Src/CWPWAPBrowserItem.cpp Mon May 03 13:19:46 2010 +0300 @@ -20,8 +20,6 @@ // INCLUDE FILES #include #include -#include -#include #include #include #include @@ -50,14 +48,14 @@ const TDesC& aDefaultBookmarkName, CWPCharacteristic& aCharacteristic, CCommsDatabase*& aCommsDb, - CApDataHandler*& aAPHandler, + RCmManagerExt*& aCmManager, RFavouritesDb aBookmarkDb ) : CWPWAPItemBase( aTitle, aDefaultName, aCharacteristic, aCommsDb, - aAPHandler ), + aCmManager ), iDefaultBookmarkName( aDefaultBookmarkName ), iBookmarkTitle( aBookmarkTitle ), iDb( aBookmarkDb ), @@ -87,7 +85,7 @@ const TDesC& aDefaultBookmarkName, CWPCharacteristic& aCharacteristic, CCommsDatabase*& aCommsDb, - CApDataHandler*& aAPHandler, + RCmManagerExt*& aCmManager, RFavouritesDb aBookmarkDb ) { @@ -98,7 +96,7 @@ aDefaultBookmarkName, aCharacteristic, aCommsDb, - aAPHandler, + aCmManager, aBookmarkDb ); CleanupStack::PushL(self); self->ConstructL(); @@ -130,16 +128,15 @@ { uid.Copy( iLink->Data() ); } - - CApAccessPointItem* apItem = CApAccessPointItem::NewLC(); - // will leave if AP does not exists - iAPHandler->AccessPointDataL( iUID, *apItem ); + RCmConnectionMethodExt cm; + cm = iCmManager->ConnectionMethodL( iUID ); + CleanupClosePushL( cm ); if( iAddr ) { // Update the access point startpage - WriteHomePageL( *apItem ); + WriteHomePageL( cm ); } - CleanupStack::PopAndDestroy(); // apItem + CleanupStack::PopAndDestroy(); // cm } // ----------------------------------------------------------------------------- @@ -159,7 +156,7 @@ { FLOG( _L( "[Provisioning] CWPWAPBrowserItem::SetAsDefaultL:" ) ); - CreateDbL(); + /* CreateDbL(); TRAPD( err, iAPHandler->SetAsDefaultL( (TInt)iUID, EIspTypeWAPOnly) ); if( err == KErrLocked ) { @@ -196,7 +193,7 @@ CleanupStack::PopAndDestroy(); // repository FLOG( _L( "[Provisioning] CWPWAPBrowserItem::SetAsDefaultL: Set Done" ) ); - User::LeaveIfError( err ); + User::LeaveIfError( err );*/ } // ----------------------------------------------------------------------------- diff -r 19fb38abab1d -r bf47f3b79154 omaprovisioning/provisioning/WAPAdapter/Src/CWPWAPItemBAse.cpp --- a/omaprovisioning/provisioning/WAPAdapter/Src/CWPWAPItemBAse.cpp Fri Apr 16 15:52:47 2010 +0300 +++ b/omaprovisioning/provisioning/WAPAdapter/Src/CWPWAPItemBAse.cpp Mon May 03 13:19:46 2010 +0300 @@ -22,18 +22,17 @@ #include #include #include -#include -#include -#include #include #include #include #include #include #include +#include #include #include "CWPWAPItemBAse.h" #include "ProvisioningDebug.h" +#include // CONSTANTS const TInt KNamesGranularity = 1; @@ -51,13 +50,14 @@ const TDesC& aDefaultName, CWPCharacteristic& aCharacteristic, CCommsDatabase*& aCommsDb, - CApDataHandler*& aAPHandler ) + RCmManagerExt*& aCmManager) : iCharacteristic( aCharacteristic ), iTitle( aTitle ), iDefaultName( aDefaultName ), iCommsDb( aCommsDb ), - iAPHandler( aAPHandler ) + iCmManager( aCmManager ) { + } // ----------------------------------------------------------------------------- @@ -211,10 +211,10 @@ iCommsDb = CCommsDatabase::NewL(); } - if( !iAPHandler ) + if( !iCmManager ) { - iAPHandler = CApDataHandler::NewLC( *iCommsDb ); - CleanupStack::Pop(); // iAPEngine + iCmManager = new RCmManagerExt; + iCmManager->OpenL(); } } @@ -222,33 +222,33 @@ // CWPWAPItemBase::WriteHomePageL // ----------------------------------------------------------------------------- // -void CWPWAPItemBase::WriteHomePageL( CApAccessPointItem& aItem ) +void CWPWAPItemBase::WriteHomePageL( RCmConnectionMethodExt& aCmItem ) { FLOG( _L( "[Provisioning] CWPWAPItemBase::WriteHomePageL:" ) ); if( iAddr ) { - if( aItem.ReadTextLengthL( EApWapStartPage ) > 0 ) + if( aCmItem.GetStringAttributeL(CMManager::ECmStartPage) > 0 ) { FLOG( _L( "[Provisioning] CWPWAPItemBase::WriteHomePageL: EApWapStartPage " ) ); // Make a copy of the AP - CApAccessPointItem* newItem = CApAccessPointItem::NewLC(); - newItem->CopyFromL( aItem ); + RCmConnectionMethodExt cm = aCmItem.CreateCopyL(); + CleanupClosePushL( cm ); // Create a proper name for the copy TBuf name( iName.Left( KNameMaxLength ) ); - MakeValidNameL( name, *iCommsDb ); + // MakeValidNameL( name, *iCommsDb ); + // Write name - User::LeaveIfError( newItem->WriteTextL( EApWapAccessPointName, name ) ); + cm.SetStringAttributeL(CMManager::ECmName,name); + cm.SetStringAttributeL(CMManager::ENamingUnique,name); - //Write IAP name - User::LeaveIfError( newItem->WriteTextL( EApIapName, name ) ); // Write MMSC address - User::LeaveIfError( newItem->WriteLongTextL( EApWapStartPage, *iAddr ) ); + cm.SetStringAttributeL(CMManager::ECmStartPage,*iAddr); // Create the new access point - TRAPD( err, iUID = iAPHandler->CreateFromDataL( *newItem ) ); + TRAPD( err, cm.UpdateL() ); FTRACE(RDebug::Print(_L("[Provisioning] CWPWAPItemBase::WriteHomePageL: CreateFromDataL err (%d)"), err)); FTRACE(RDebug::Print(_L("[Provisioning] CWPWAPItemBase::WriteHomePageL: CreateFromDataL iUID (%d)"), iUID)); @@ -267,18 +267,18 @@ else { FLOG( _L( "[Provisioning] CWPWAPItemBase::WriteHomePageL: EApWapStartPage 0 " ) ); - User::LeaveIfError( aItem.WriteLongTextL( EApWapStartPage, *iAddr ) ); + aCmItem.SetStringAttributeL(CMManager::ECmStartPage,*iAddr); // Update the access point TBool nameChanged( EFalse ); - TRAPD( err, iAPHandler->UpdateAccessPointDataL( aItem, nameChanged ) ); + TRAPD( err, aCmItem.UpdateL() ); FTRACE(RDebug::Print(_L("[Provisioning] CWPWAPItemBase::WriteHomePageL: CreateFromDataL err (%d)"), err)); if( err == KErrLocked ) { err = EWPCommsDBLocked; } User::LeaveIfError( err ); - iUID = aItem.WapUid(); + iUID = aCmItem.GetIntAttributeL(CMManager::ECmIapId); FTRACE(RDebug::Print(_L("[Provisioning] CWPWAPItemBase::WriteHomePageL: CreateFromDataL iUID (%d)"), iUID)); } } @@ -290,9 +290,9 @@ // void CWPWAPItemBase::MakeValidNameL( TDes& aName, CCommsDatabase& aDb ) const { - CApUtils* utils = CApUtils::NewLC( aDb ); + /* CApUtils* utils = CApUtils::NewLC( aDb ); utils->MakeValidNameL( aName ); - CleanupStack::PopAndDestroy(); // utils + CleanupStack::PopAndDestroy(); // utils*/ } // End of File diff -r 19fb38abab1d -r bf47f3b79154 omaprovisioning/provisioning/WAPAdapter/Src/CWPWAPMMSAdapter.cpp --- a/omaprovisioning/provisioning/WAPAdapter/Src/CWPWAPMMSAdapter.cpp Fri Apr 16 15:52:47 2010 +0300 +++ b/omaprovisioning/provisioning/WAPAdapter/Src/CWPWAPMMSAdapter.cpp Mon May 03 13:19:46 2010 +0300 @@ -24,7 +24,6 @@ #include #include #include -#include #include "MWPWAPItemBase.h" #include "WPWAPUtil.h" #include "WPWAPItemFactory.h" @@ -87,7 +86,7 @@ if( iItems.Count() == 0 && iAppID == KMMSAppID ) { MWPWAPItemBase* item = WPWAPItemFactory::CreateMMSLC( *iTitle, *iDefaultName, - aCharacteristic, iCommsDb, iAPHandler ); + aCharacteristic, iCommsDb, iCmManager ); if( item->ValidateL() ) { item->AddL( iItems, iHiddenItems ); diff -r 19fb38abab1d -r bf47f3b79154 omaprovisioning/provisioning/WAPAdapter/Src/CWPWAPMMSItem.cpp --- a/omaprovisioning/provisioning/WAPAdapter/Src/CWPWAPMMSItem.cpp Fri Apr 16 15:52:47 2010 +0300 +++ b/omaprovisioning/provisioning/WAPAdapter/Src/CWPWAPMMSItem.cpp Mon May 03 13:19:46 2010 +0300 @@ -22,8 +22,9 @@ #include #include #include -#include -#include +#include +#include +#include #include #include #include @@ -49,8 +50,8 @@ const TDesC& aDefaultName, CWPCharacteristic& aCharacteristic, CCommsDatabase*& aDb, - CApDataHandler*& aAPHandler ) -: CWPWAPItemBase( aTitle, aDefaultName, aCharacteristic, aDb, aAPHandler ) + RCmManagerExt*& aCmManager ) +: CWPWAPItemBase( aTitle, aDefaultName, aCharacteristic, aDb, aCmManager ) { } @@ -73,10 +74,10 @@ const TDesC& aDefaultName, CWPCharacteristic& aCharacteristic, CCommsDatabase*& aDb, - CApDataHandler*& aAPHandler ) + RCmManagerExt*& aCmManager ) { CWPWAPMMSItem* self = new(ELeave) CWPWAPMMSItem( aTitle, aDefaultName, - aCharacteristic, aDb, aAPHandler ); + aCharacteristic, aDb, aCmManager ); CleanupStack::PushL(self); self->ConstructL(); CleanupStack::Pop(self); @@ -96,11 +97,35 @@ void CWPWAPMMSItem::SaveL() { CreateDbL(); - - // Find a proper GPRS access point - CApAccessPointItem* item = FindGPRSLC(); - WriteHomePageL( *item ); - CleanupStack::PopAndDestroy(); // item + TBool check = EFalse; + RCmConnectionMethodExt cm; + TUint32 bearer = 0; + for( TInt i( 0 ); i < iLinks.Count() && check == EFalse ; i++ ) + { + CWPCharacteristic* curr = iLinks[i]; + TPckgBuf uidPckg; + const TInt pkgLength( uidPckg.MaxLength() ); + for( TInt dataNum( 0 ); check == EFalse && curr->Data( dataNum ).Length() == pkgLength;dataNum++ ) + { + uidPckg.Copy( curr->Data( dataNum ) ); + // Read the access point pointed to by TO-NAPID or TO-PROXY + cm = iCmManager->ConnectionMethodL( uidPckg() ); + CleanupClosePushL( cm ); + bearer = cm.GetIntAttributeL( CMManager::ECmBearerType ); + if( bearer == KUidPacketDataBearerType ) + { + // Item left on cleanup stack + check = ETrue; + } + else + { + CleanupStack::PopAndDestroy(); // cm + } + } + } + + WriteHomePageL( cm ); + CleanupStack::PopAndDestroy(); // cm } // ----------------------------------------------------------------------------- @@ -223,48 +248,6 @@ { } -// ----------------------------------------------------------------------------- -// CWPWAPMMSItem::FindGPRSL -// ----------------------------------------------------------------------------- -// -CApAccessPointItem* CWPWAPMMSItem::FindGPRSLC() const - { - CApAccessPointItem* result = NULL; - for( TInt i( 0 ); i < iLinks.Count() && result == NULL; i++ ) - { - CWPCharacteristic* curr = iLinks[i]; - TPckgBuf uidPckg; - const TInt pkgLength( uidPckg.MaxLength() ); - for( TInt dataNum( 0 ); - result == NULL && curr->Data( dataNum ).Length() == pkgLength; - dataNum++ ) - { - uidPckg.Copy( curr->Data( dataNum ) ); - - // Read the access point pointed to by TO-NAPID or TO-PROXY - CApAccessPointItem* item = CApAccessPointItem::NewLC(); - iAPHandler->AccessPointDataL( uidPckg(), *item ); - - if( item->BearerTypeL() == EApBearerTypeGPRS ) - { - // Item left on cleanup stack - result = item; - } - else - { - CleanupStack::PopAndDestroy(); // item - } - } - } - - if( !result ) - { - // Nothing left on cleanup stack. That doesn't matter as we leave. - User::Leave( KErrNotFound ); - } - - return result; - } // End of File diff -r 19fb38abab1d -r bf47f3b79154 omaprovisioning/provisioning/WAPAdapter/Src/WPWAPItemFactory.cpp --- a/omaprovisioning/provisioning/WAPAdapter/Src/WPWAPItemFactory.cpp Fri Apr 16 15:52:47 2010 +0300 +++ b/omaprovisioning/provisioning/WAPAdapter/Src/WPWAPItemFactory.cpp Mon May 03 13:19:46 2010 +0300 @@ -33,10 +33,10 @@ const TDesC& aDefaultName, CWPCharacteristic& aCharacteristic, CCommsDatabase*& aCommsDb, - CApDataHandler*& aAPHandler ) + RCmManagerExt*& aCmManager ) { CWPWAPMMSItem* item = CWPWAPMMSItem::NewL( aTitle, aDefaultName, - aCharacteristic, aCommsDb, aAPHandler ); + aCharacteristic, aCommsDb, aCmManager ); CleanupStack::PushL( item ); return item; } @@ -52,11 +52,11 @@ const TDesC& aDefaultBookmarkName, CWPCharacteristic& aCharacteristic, CCommsDatabase*& aCommsDb, - CApDataHandler*& aAPHandler, + RCmManagerExt*& aCmManager, RFavouritesDb aBookmarkDb ) { CWPWAPBrowserItem* item = CWPWAPBrowserItem::NewL( aFirst, aTitle, aBookmarkTitle, - aDefaultName, aDefaultBookmarkName, aCharacteristic, aCommsDb, aAPHandler, aBookmarkDb ); + aDefaultName, aDefaultBookmarkName, aCharacteristic, aCommsDb, aCmManager, aBookmarkDb ); CleanupStack::PushL( item ); return item; } diff -r 19fb38abab1d -r bf47f3b79154 omaprovisioning/provisioning/accesspointadapter/Inc/CWPAPItemBase.h --- a/omaprovisioning/provisioning/accesspointadapter/Inc/CWPAPItemBase.h Fri Apr 16 15:52:47 2010 +0300 +++ b/omaprovisioning/provisioning/accesspointadapter/Inc/CWPAPItemBase.h Mon May 03 13:19:46 2010 +0300 @@ -48,7 +48,6 @@ // FORWARD DECLARATIONS -class CApAccessPointItem; class CWPAPAccesspointItem; class CCommsDatabase; diff -r 19fb38abab1d -r bf47f3b79154 omaprovisioning/provisioning/accesspointadapter/Inc/CWPAPNapdef.h --- a/omaprovisioning/provisioning/accesspointadapter/Inc/CWPAPNapdef.h Fri Apr 16 15:52:47 2010 +0300 +++ b/omaprovisioning/provisioning/accesspointadapter/Inc/CWPAPNapdef.h Mon May 03 13:19:46 2010 +0300 @@ -35,7 +35,7 @@ // FORWARD DECLARATIONS class CWPAPPhysicalProxy; -class CApAccessPointItem; + class CWPParameter; class CCommsDatabase; class EAPSettings; diff -r 19fb38abab1d -r bf47f3b79154 omaprovisioning/provisioning/accesspointadapter/Inc/CWPAPPort.h --- a/omaprovisioning/provisioning/accesspointadapter/Inc/CWPAPPort.h Fri Apr 16 15:52:47 2010 +0300 +++ b/omaprovisioning/provisioning/accesspointadapter/Inc/CWPAPPort.h Mon May 03 13:19:46 2010 +0300 @@ -29,7 +29,7 @@ // FORWARD DECLARATIONS -class CApAccessPointItem; + // CLASS DECLARATION diff -r 19fb38abab1d -r bf47f3b79154 omaprovisioning/provisioning/accesspointadapter/group/WPAPAdapter.mmp --- a/omaprovisioning/provisioning/accesspointadapter/group/WPAPAdapter.mmp Fri Apr 16 15:52:47 2010 +0300 +++ b/omaprovisioning/provisioning/accesspointadapter/group/WPAPAdapter.mmp Mon May 03 13:19:46 2010 +0300 @@ -62,7 +62,6 @@ LIBRARY euser.lib LIBRARY ProvisioningEngine.lib -LIBRARY apengine.lib LIBRARY commdb.lib LIBRARY FeatMgr.lib LIBRARY ecom.lib diff -r 19fb38abab1d -r bf47f3b79154 omaprovisioning/provisioning/cpdestinationnwadapter/group/wpdestinationnwadapter.mmp --- a/omaprovisioning/provisioning/cpdestinationnwadapter/group/wpdestinationnwadapter.mmp Fri Apr 16 15:52:47 2010 +0300 +++ b/omaprovisioning/provisioning/cpdestinationnwadapter/group/wpdestinationnwadapter.mmp Mon May 03 13:19:46 2010 +0300 @@ -56,6 +56,5 @@ LIBRARY euser.lib LIBRARY provisioningengine.lib LIBRARY charconv.lib -LIBRARY apengine.lib LIBRARY commdb.lib LIBRARY cmmanager.lib diff -r 19fb38abab1d -r bf47f3b79154 policymanagement/pmdmadapter/group/pmadapter.mmp --- a/policymanagement/pmdmadapter/group/pmadapter.mmp Fri Apr 16 15:52:47 2010 +0300 +++ b/policymanagement/pmdmadapter/group/pmadapter.mmp Mon May 03 13:19:46 2010 +0300 @@ -53,8 +53,8 @@ LIBRARY ecom.lib LIBRARY efsrv.lib LIBRARY policyengine.lib -LIBRARY imut.lib LIBRARY centralrepository.lib +LIBRARY inetprotutil.lib LIBRARY flogger.lib #ifdef __TARM_SYMBIAN_CONVERGENCY diff -r 19fb38abab1d -r bf47f3b79154 policymanagement/pmdmadapter/src/pmadapter.cpp --- a/policymanagement/pmdmadapter/src/pmadapter.cpp Fri Apr 16 15:52:47 2010 +0300 +++ b/policymanagement/pmdmadapter/src/pmadapter.cpp Mon May 03 13:19:46 2010 +0300 @@ -61,7 +61,7 @@ #include #include -#include +#include #include "nsmldmuri.h" #include "pmadapter.h" #include // For TImplementationProxy definition @@ -768,7 +768,7 @@ TPtr8 ptr( data->Des() ); User::LeaveIfError( file.Read( ptr ) ); - TImCodecB64 B64Coder; + TBase64 B64Coder; HBufC8 *target = HBufC8::NewLC( ( size * 6 ) / 3 ); TPtr8 targetPtr( target->Des() ); B64Coder.Encode( *data, targetPtr ); diff -r 19fb38abab1d -r bf47f3b79154 policymanagement/policyengine/group/PolicyEngineServer.mmp --- a/policymanagement/policyengine/group/PolicyEngineServer.mmp Fri Apr 16 15:52:47 2010 +0300 +++ b/policymanagement/policyengine/group/PolicyEngineServer.mmp Mon May 03 13:19:46 2010 +0300 @@ -69,12 +69,12 @@ LIBRARY x509.lib LIBRARY crypto.lib LIBRARY x500.lib -LIBRARY imut.lib LIBRARY dmutil.lib LIBRARY estor.lib LIBRARY commdb.lib LIBRARY commsdat.lib LIBRARY flogger.lib LIBRARY featmgr.lib +LIBRARY inetprotutil.lib SMPSAFE diff -r 19fb38abab1d -r bf47f3b79154 policymanagement/policyengine/policyengineserver/src/TrustedSession.cpp --- a/policymanagement/policyengine/policyengineserver/src/TrustedSession.cpp Fri Apr 16 15:52:47 2010 +0300 +++ b/policymanagement/policyengine/policyengineserver/src/TrustedSession.cpp Mon May 03 13:19:46 2010 +0300 @@ -28,7 +28,7 @@ #include "ErrorCodes.h" #include -#include +#include @@ -244,7 +244,7 @@ TCertInfo certInfo; TPckg pck( certInfo ); - TImCodecB64 base64; + TBase64 base64; User::LeaveIfError( base64.Decode( value, pck ) ); //create suject info for it @@ -472,7 +472,7 @@ //serialize TCertInfo and decode it to base64 format TPckg pck( iSessionCertInfo); - TImCodecB64 base64; + TBase64 base64; HBufC8 * base64coded = HBufC8::NewLC( pck.Length() * 3); TPtr8 base64Ptr = base64coded->Des(); User::LeaveIfError( base64.Encode( pck, base64Ptr)); @@ -999,7 +999,7 @@ TCertInfo certInfo; TPckg pck( certInfo); - TImCodecB64 base64; + TBase64 base64; User::LeaveIfError( base64.Decode( binaryCert, pck)); //create suject info for it @@ -1457,7 +1457,7 @@ } #endif //#ifdef __DEBUG //convert base64 coding to binary format - TImCodecB64 base64; + TBase64 base64; HBufC8 * base64Cert = HBufC8::NewLC( certPtr.Length()); TPtr8 base64Ptr = base64Cert->Des(); diff -r 19fb38abab1d -r bf47f3b79154 remotemgmt_plat/common_agent_util_and_definitions_api/inc/nsmlconstants.h --- a/remotemgmt_plat/common_agent_util_and_definitions_api/inc/nsmlconstants.h Fri Apr 16 15:52:47 2010 +0300 +++ b/remotemgmt_plat/common_agent_util_and_definitions_api/inc/nsmlconstants.h Mon May 03 13:19:46 2010 +0300 @@ -216,8 +216,10 @@ { public: inline static void PushL(T* aPtr); + inline static void PushL(T& aRef); private: static void RPtrArrayDelete(TAny *aPtr); + static void LocalRPtrArrayDelete(TAny *aPtr); }; template @@ -227,6 +229,12 @@ } template +inline void CleanupRPtrArrayDelete::PushL(T& aRef) + { + CleanupStack::PushL(TCleanupItem(&LocalRPtrArrayDelete,&aRef)); + } + +template void CleanupRPtrArrayDelete::RPtrArrayDelete(TAny *aPtr) { T* ptr = STATIC_CAST(T*,aPtr); @@ -235,11 +243,24 @@ } template +void CleanupRPtrArrayDelete::LocalRPtrArrayDelete(TAny *aPtr) + { + T* ptr = STATIC_CAST(T*,aPtr); + ptr->ResetAndDestroy(); + } + +template inline void CleanupRPtrArrayPushL(T* aPtr) { CleanupRPtrArrayDelete::PushL(aPtr); } +template +inline void CleanupRPtrArrayPushL(T& aRef) + { + CleanupRPtrArrayDelete::PushL(aRef); + } + // Table names _LIT( KNSmlTableVersion, "Version" ); diff -r 19fb38abab1d -r bf47f3b79154 remotemgmt_plat/scp_server_api/inc/SCPClient.h --- a/remotemgmt_plat/scp_server_api/inc/SCPClient.h Fri Apr 16 15:52:47 2010 +0300 +++ b/remotemgmt_plat/scp_server_api/inc/SCPClient.h Mon May 03 13:19:46 2010 +0300 @@ -175,28 +175,6 @@ *
Contents of return value: The status code of the operation. */ IMPORT_C TInt GetParamValue( TInt aParamID, TDes& aValue ); - - enum TSCPButtonConfig - { - SCP_OK, - SCP_OK_CANCEL, - SCP_OK_ETEL, - SCP_OK_CANCEL_ETEL - }; - - /** - * Request the security code from the user. - * - */ - IMPORT_C TInt SecCodeQuery( RMobilePhone::TMobilePassword& aPassword, - TSCPButtonConfig aButtonsShown, - TBool aECSSupport, - TInt aFlags ); - - /** - * Prompt the user to change the security code. - */ - IMPORT_C TInt ChangeCodeRequest(); /** * Checks the server configuration and reports the status. @@ -239,36 +217,130 @@ IMPORT_C TInt SetAutoLockPeriod( TInt aValue ); - private: // Methods + + /** + * This function would return if the Lock Code of the device is allowed to be changed at the given moment. + * + * The outcome of this function would depend on two of the policies enforced at TARM, EPasscodeMinChangeTolerance and + * EPasscodeMinChangeInterval. These two policies would determine how often the user is allowed to change the Lock Code + * of the device between a specified time interval. If the user has exceeded the maximum number of times he is allowed + * to change the Lock Code of the device then this function would return a non-KErrNone status + * + * @param aFailedPolicies: On completion of the call, If the Lock Code is not allowed to be changed at this point in time + then this array would contain the two policies (mentioned earlier) that failed. + + The policy ID's are available in SCPServerInterface.h under TDevicelockPolicies + * + * + * @return The status, see below + *
Name of return value: Operation status + *
Type of return value: TInt + *
Range of return value: A system wide error code + *
Contents of return value: The status code of the operation. + * + */ + IMPORT_C TBool IsLockcodeChangeAllowedNow(RArray &aDevicelockPolicies); - /** - * Request the security code from the user (encapsulates functionalities of SecCodeQuery()). - * - */ - TInt SetSecurityCodeL(RMobilePhone::TMobilePassword& aPassword, TSCPButtonConfig aButtonsShown, - TBool aECSSupport, TInt aFlags, TInt& aResFileSCP, TInt& aResFileSecUi); + /** + * Get values for all the policies that are maintained at the server + * + * @param aDevicelockPolicies: Upon completion of the call, this array would contain the values + for each of the parameter that is maintained at the server. The values can be + accessed using the policy ID's as index to the aDevicelockPolicies array + + Ex: aDevicelockPolicies[TDevicelockPolicies :: EDeviceLockMaxlength]; + + The policy ID's are available in SCPServerInterface.h + * + * + * @return The status, see below + *
Name of return value: Operation status + *
Type of return value: TInt + *
Range of return value: A system wide error code + *
Contents of return value: The status code of the operation. + * + */ + IMPORT_C TInt GetPolicies(RArray& aDevicelockPolicies); + + /** + * Verifies if a new Lock Code is in compliance with the policies enforced at TARM. Ideally this should be invoked + * before a call to StoreLockCode. + * + * @param aNewLockcode: The new Lock Code that is to be verified against TARM policies + + aFailedPolicies: On completion of the call, if the return value is other than KErrNone, this array + would contain the policies that were not satisfied by Lock Code provided in aLockCode - /** - * Request the new code from the user and try to change the code - */ - TInt GetNewCodeAndChange( TDes& aOldCode, TInt aMode, TSCPSecCode* aNewDOSCode = NULL, HBufC** aNewCodePptr = NULL ); - - /** - * Process the server's response-commands - */ - void ProcessServerCommandsL( TDes8& aInParams, - CSCPParamObject** aOutParams = NULL, - TBool isNotifierEvent = EFalse ); - - /** - * Show UI controls based on server commands - */ - void ShowUIL( CSCPParamObject& aContext ); - - /** + The policy ID's are available in SCPServerInterface.h under TDevicelockPolicies + * + * + * @return The status, see below + *
Name of return value: Operation status + *
Type of return value: TInt + *
Range of return value: A system wide error code + *
Contents of return value: The status code of the operation. + * + */ + IMPORT_C TInt VerifyNewLockcodeAgainstPolicies(TDesC& aNewLockcode, RArray& aFailedPolicies); + + /** + * Sets a new device Lock Code + * + * @param aNewLockCode: The new Lock Code that is to be set on the device + + aFailedPolicies: On completion of the call, if the New Lock Code is not compliant with the TARM policies + (if the return value is other than KErrNone) this array + would contain the policies that were not satisfied by Lock Code provided in aNewLockCode + + The policy ID's are available in SCPServerInterface.h under TDevicelockPolicies + * + * + * @return The status, see below + *
Name of return value: Operation status + *
Type of return value: TInt + *
Range of return value: A system wide error code + *
Contents of return value: The status code of the operation. + * + */ + IMPORT_C TInt StoreLockcode(TDesC& aNewLockcode, TDesC& aOldLockcode, RArray& aFailedPolicies); + + /** + * Verifies if the Lock Code enforced on the device is the same as the one mentioned in the argument. + * + * @param aLockCode: The Lock Code that is to be verified against the current device LockCode + + aISACode: The Lock Code enforced through a call to StoreLockCode would hash the New Lock Code before storing + at the ISA (RMobilePhone) side. + + On successful completion of a call to VerifyCurrentLockCode, aISACode would return + the Hashed code value equivalent to the current Lock Code enforced on the device + + aFailedPolicies: On completion of the call, this array may contain EDeviceLockPasscodeExpiration depending on + if the Lock Code is marked as expired due to the current value of the policy at TARM + + The policy ID's are available in SCPServerInterface.h under TDevicelockPolicies + * + * + * @return The status, see below + *
Name of return value: Operation status + *
Type of return value: TInt + *
Range of return value: A system wide error code + *
Contents of return value: The status code of the operation. + * + */ + IMPORT_C TInt VerifyCurrentLockcode(TDesC& aLockcode, RMobilePhone :: TMobilePassword& aISACode, + RArray& aFailedPolicies, TInt aFlags); + + private: // Methods + + + /** * Fetch the limit-values for code length */ void FetchLimits( TInt& aMin, TInt& aMax ); + + void ReadFailedPoliciesL(TDes8& aFailedPolicyBuf, RArray< TDevicelockPolicies > &aFailedPolicies); + TBool isFlagEnabled; }; diff -r 19fb38abab1d -r bf47f3b79154 remotemgmt_plat/scp_server_api/inc/SCPParamObject.h --- a/remotemgmt_plat/scp_server_api/inc/SCPParamObject.h Fri Apr 16 15:52:47 2010 +0300 +++ b/remotemgmt_plat/scp_server_api/inc/SCPParamObject.h Mon May 03 13:19:46 2010 +0300 @@ -183,8 +183,22 @@ * pointer is not supplied a new RFs will be connected. */ IMPORT_C void ReadFromFileL( TDesC& aFilename, RFs* aRfs = NULL ); - - + + /* + * Would store details of the policy for which the current context is incompatible + * + * NOTE: The context could be Lock Code verification, Storing a New Lock Code etc... + */ + IMPORT_C TInt AddtoFailedPolices( TInt aFailedpolicyID ); + + /* + * Returns a reference to the array that contains the policies for which the current + * context is incompatible + * + * NOTE: The context could be Lock Code verification, Storing a New Lock Code etc... + */ + IMPORT_C const RArray& GetFailedPolices( ); + protected: // Methods // Methods from base classes @@ -210,6 +224,7 @@ RArray iParamIDs; /** An array containing the pointers to the parameter values */ RPointerArray iParamValues; + RArray iFailedPolicyIDs; }; #endif // SCPPARAMOBJECT_H diff -r 19fb38abab1d -r bf47f3b79154 remotemgmt_plat/scp_server_api/inc/SCPServerInterface.h --- a/remotemgmt_plat/scp_server_api/inc/SCPServerInterface.h Fri Apr 16 15:52:47 2010 +0300 +++ b/remotemgmt_plat/scp_server_api/inc/SCPServerInterface.h Mon May 03 13:19:46 2010 +0300 @@ -27,6 +27,8 @@ typedef TBuf<8> TSCPSecCode; const TInt KSCPMaxEnhCodeLen = 256; +// New DataType to store encrypted information of maximum size 128. +typedef TBuf<128> TSCPCryptoCode; // LOCAL CONSTANTS _LIT( KSCPServerName, "!SCPServer" ); @@ -47,6 +49,7 @@ ESCPServAuthenticateS60 = 40, ESCPServChangeEnhCode, ESCPServCodeChangeQuery, + ESCPServValidateLockcode, ESCPServCheckConfig = 50, ESCPApplicationUninstalled = 60, ESCPServUISetAutoLock = 70 @@ -67,6 +70,56 @@ ESCPCodeChangePolicy }; +enum TDevicelockPolicies { + //Autolock timeout. Values in minutes + EDeviceLockAutolockperiod = 0, + // Maximum autolock timeout value, Values in minutes + EDeviceLockMaxAutolockPeriod, + //specifies the minimum lock code length + EDeviceLockMinlength, + //Allowed maxim lock code length + EDeviceLockMaxlength, + // 0 = No restriction, + //1 = Both upper and lower case letters are required in the password + EDeviceLockRequireUpperAndLower, + // 0 = No restriction, + // 1 = Both characters and numbers are required in the password + EDeviceLockRequireCharsAndNumbers, + // 0 = No restriction, + // 1-4 = A single character cannot be used more than X times in the password + EDeviceLockAllowedMaxRepeatedChars, + // 0 = No restriction, + // 1-X = The new password cannot match the previous X passwords + EDeviceLockHistoryBuffer, + // 0 = No restriction, + // 1-365 = The password expires after X days and must be changed by the user + // -1 = password expires immediately + EDeviceLockPasscodeExpiration, + // The user can change the password only X times before EPasscodeMinChangeInterval //hours have passed (default 0). + EDeviceLockMinChangeTolerance, + // 0 = No restriction, + // 1-1000 = The user cannot change the password more than EPasscodeMinChangeTolerance // times before X hours have passed since the previous change + EDeviceLockMinChangeInterval, + // disallow the specific string or strings given. + EDeviceLockDisallowSpecificStrings, + // 0 = No restriction, + // 3-100 = The device is "hard" reset after the user has consecutively failed X times // to answer the password query + EDeviceLockAllowedMaxAtempts, + // 0 = No restriction, 1 = The password cannot contain two consecutive numbers. + EDeviceLockConsecutiveNumbers, + // 0 = No restriction, + // 1-255 = The password should contain at least X number of special characters. + EDeviceLockMinSpecialCharacters, + // 0 = No restriction, + // 1 = Single character repeat not allowed (ex: 222222, aaaaaa etc) are not allowed + EDeviceLockSingleCharRepeatNotAllowed, + // 0 = No restriction, + // 1 = lock code shouldn’t consist of consecutive characters (ex: 12345, abcde etc) are notallowed + EDevicelockConsecutiveCharsNotAllowed, + + EDevicelockTotalPolicies +}; + // The version number of this client-server package const TUint KSCPServMajorVersionNumber=0; const TUint KSCPServMinorVersionNumber=9; diff -r 19fb38abab1d -r bf47f3b79154 remotemgmt_plat/terminal_security_device_lock_api/group/bld.inf --- a/remotemgmt_plat/terminal_security_device_lock_api/group/bld.inf Fri Apr 16 15:52:47 2010 +0300 +++ b/remotemgmt_plat/terminal_security_device_lock_api/group/bld.inf Mon May 03 13:19:46 2010 +0300 @@ -29,3 +29,6 @@ ../inc/TerminalControl3rdPartyParamsPlugin.h MW_LAYER_PLATFORM_EXPORT_PATH(TerminalControl3rdPartyParamsPlugin.h) ../inc/TerminalControl3rdPartyParamsPluginDef.h MW_LAYER_PLATFORM_EXPORT_PATH(TerminalControl3rdPartyParamsPluginDef.h) ../inc/TerminalControl3rdPartyParamsPlugin.inl MW_LAYER_PLATFORM_EXPORT_PATH(TerminalControl3rdPartyParamsPlugin.inl) +../inc/dmencryptionutilinterface.h MW_LAYER_PLATFORM_EXPORT_PATH(dmencryptionutilinterface.h) +../inc/dmencryptionutil.h MW_LAYER_PLATFORM_EXPORT_PATH(dmencryptionutil.h) +../inc/dmencryptionutil.inl MW_LAYER_PLATFORM_EXPORT_PATH(dmencryptionutil.inl) diff -r 19fb38abab1d -r bf47f3b79154 remotemgmt_plat/terminal_security_device_lock_api/inc/dmencryptionutil.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/remotemgmt_plat/terminal_security_device_lock_api/inc/dmencryptionutil.h Mon May 03 13:19:46 2010 +0300 @@ -0,0 +1,55 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: implementation of MDMEncryptionUtilInterface. +* +*/ + +#ifndef DMENCRYPTIONUTIL_H_ +#define DMENCRYPTIONUTIL_H_ + +#include + +class CDMEncryptionUtil : public CBase, public MDMEncryptionUtilInterface + { +public: + // Instantiates an object of this type + /** + * Create instance of CDMEncryptionUtil, this NewL always loads only the secenv hardware encryption plugin. + * @param Nil + * @return Instance of CDMEncryptionUtil + */ + static CDMEncryptionUtil* NewL(); + /** + * Create instance of CDMEncryptionUtil, this NewL always loads the plugin which matches with the default_data. + * @param aData is the value of default_data. + * @return Instance of CDMEncryptionUtil + * Leaves with KErrBadName: if the default_data exists more than 1. + */ + static CDMEncryptionUtil* CDMEncryptionUtil::NewL(const TDesC8& aData); + + /** + * C++ Destructor + */ + virtual ~CDMEncryptionUtil(); + +private: + // Unique instance identifier key + TUid iDtor_ID_Key; + + }; + +#include "dmencryptionutil.inl" + + +#endif /* DMENCRYPTIONUTIL_H_ */ diff -r 19fb38abab1d -r bf47f3b79154 remotemgmt_plat/terminal_security_device_lock_api/inc/dmencryptionutil.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/remotemgmt_plat/terminal_security_device_lock_api/inc/dmencryptionutil.inl Mon May 03 13:19:46 2010 +0300 @@ -0,0 +1,119 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: dmencryptionutil Encryption/Decryption Interface +* +*/ + + +#include +#include +#include + +/** + * C++ Destructor + */ +// Inline functions +CDMEncryptionUtil::~CDMEncryptionUtil() + { + // Destroy any instance variables and then + // inform the framework that this specific + // instance of the interface has been destroyed. + REComSession::DestroyedImplementation(iDtor_ID_Key); + } + +/** + * Cleans up the ECOM plugin array + * @param aUid , implementation Uid + * @return Instance of CDMEncryptionUtil + */ +void CleanupEComArray(TAny* aArray) + { + (static_cast (aArray))->ResetAndDestroy(); + (static_cast (aArray))->Close(); + } + +/** +* Create instance of CDMEncryptionUtil, this NewL always loads only the secenv hardware encryption plugin. +* @param Nil +* @return Instance of CDMEncryptionUtil +*/ +inline CDMEncryptionUtil* CDMEncryptionUtil::NewL() + { + RImplInfoPtrArray infoArray; + // Note that a special cleanup function is required to reset and destroy + // all items in the array, and then close it. + TCleanupItem cleanup(CleanupEComArray, &infoArray); + CleanupStack::PushL(cleanup); + + //Only ROM plugins are filtered & listed. + TEComResolverParams resolverParams; + _LIT8(KOperationName,"extdmencryptionutil"); + + resolverParams.SetDataType(KOperationName()); + resolverParams.SetWildcardMatch(ETrue); // Allow wildcard matching + TRAPD(terr, REComSession::ListImplementationsL(KDMEncryptionUtilInterfaceUid, resolverParams,KRomOnlyResolverUid, infoArray)); + REComSession::FinalClose(); + if(terr) + { + User::Leave(terr); + } + if(infoArray.Count() > 1 || (0 == infoArray.Count())) + { + User::Leave(KErrBadName); + } + TUid retUid = infoArray[0]->ImplementationUid(); + CleanupStack::PopAndDestroy(); //cleanup + + TAny* ptr = REComSession::CreateImplementationL( retUid, _FOFF(CDMEncryptionUtil, iDtor_ID_Key)); + CDMEncryptionUtil* self = reinterpret_cast( ptr ); + + return self; + } + +/** +* Create instance of CDMEncryptionUtil, this NewL always loads the plugin which matches with the default_data. +* @param aData default_data +* @return Instance of CDMEncryptionUtil +* Leaves with KErrBadName: if the default_data exists more than 1. +*/ +inline CDMEncryptionUtil* CDMEncryptionUtil::NewL(const TDesC8& aData) + { + RImplInfoPtrArray infoArray; + // Note that a special cleanup function is required to reset and destroy + // all items in the array, and then close it. + TCleanupItem cleanup(CleanupEComArray, &infoArray); + CleanupStack::PushL(cleanup); + + //Only ROM plugins are filtered & listed. + TEComResolverParams resolverParams; + resolverParams.SetDataType(aData); + resolverParams.SetWildcardMatch(ETrue); // Allow wildcard matching + TRAPD(terr, REComSession::ListImplementationsL(KDMEncryptionUtilInterfaceUid, resolverParams,KRomOnlyResolverUid, infoArray)); + REComSession::FinalClose(); + if(terr) + { + User::Leave(terr); + } + if(infoArray.Count() > 1) + { + User::Leave(KErrBadName); + } + TUid retUid = infoArray[0]->ImplementationUid(); + CleanupStack::PopAndDestroy(); //cleanup + + TAny* ptr = REComSession::CreateImplementationL( retUid, _FOFF(CDMEncryptionUtil, iDtor_ID_Key)); + CDMEncryptionUtil* self = reinterpret_cast( ptr ); + + return self; + } \ No newline at end of file diff -r 19fb38abab1d -r bf47f3b79154 remotemgmt_plat/terminal_security_device_lock_api/inc/dmencryptionutilinterface.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/remotemgmt_plat/terminal_security_device_lock_api/inc/dmencryptionutilinterface.h Mon May 03 13:19:46 2010 +0300 @@ -0,0 +1,66 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: E/D Interface definition +* +*/ + +#ifndef _MDMEncryptionUtilInterface_H__ +#define _MDMEncryptionUtilInterface_H__ + +#include +#include + +// UID of this interface +const TUid KDMEncryptionUtilInterfaceUid = {0x2002C2F4}; + +/** + An CDMEncryptionUtil abstract class being representative of the + concrete class which the client wishes to use. + + It acts as a base, for a real class to provide all the + functionality that a client requires. + It supplies instantiation & destruction by using + the ECom framework, and functional services + by using the methods of the actual class. + */ + + +class MDMEncryptionUtilInterface + { +public: + + // Pure interface methods + // Representative of a method provided on the interface by + // the interface definer. + + /** + * Encrypts the data. + * @param aInput - is the input string which has to be encrypted. + * @param aOutput - the encrypted information is stored parameter. + * @return Return is KErrNone if successful or any System wide error code. + * + */ + virtual TInt EncryptL( TDes& aInput, TDes& aOutput) = 0; + /** + * Decrypts the data. + * @param Input - is the input string which has to be decrypted. + * @param aOutput - the decrypted information is stored in this parameter. + * @return Return is KErrNone if successful or any System wide error code. + */ + virtual TInt DecryptL( TDes& aInput, TDes& aOutput) = 0; + + }; + +#endif // _MDMEncryptionUtilInterface_H_ + diff -r 19fb38abab1d -r bf47f3b79154 syncmlfw/common/http/src/nsmldialiap.cpp --- a/syncmlfw/common/http/src/nsmldialiap.cpp Fri Apr 16 15:52:47 2010 +0300 +++ b/syncmlfw/common/http/src/nsmldialiap.cpp Mon May 03 13:19:46 2010 +0300 @@ -20,7 +20,7 @@ #include // FeatureManager #include #include -#include +#include #include #include "nsmldialiap.h" #include @@ -383,18 +383,18 @@ if(iOffline) { iPref.SetDialogPreference( ECommDbDialogPrefPrompt ); - iPref.SetBearerSet(EApBearerTypeWLAN); + iPref.SetBearerSet(KUidWlanBearerType); } else { iPref.SetDialogPreference( ECommDbDialogPrefPrompt ); - iPref.SetBearerSet(EApBearerTypeAllBearers); + //iPref.SetBearerSet(EApBearerTypeAllBearers); } } else if( iOffline && ( static_cast(iIAPid) == -2 ) ) // default connection { iPref.SetDialogPreference( ECommDbDialogPrefPrompt ); - iPref.SetBearerSet(EApBearerTypeWLAN); + iPref.SetBearerSet(KUidWlanBearerType); } else { diff -r 19fb38abab1d -r bf47f3b79154 syncmlfw/common/syncagent/bld/NSmlAgentCommon.mmp --- a/syncmlfw/common/syncagent/bld/NSmlAgentCommon.mmp Fri Apr 16 15:52:47 2010 +0300 +++ b/syncmlfw/common/syncagent/bld/NSmlAgentCommon.mmp Mon May 03 13:19:46 2010 +0300 @@ -64,7 +64,6 @@ LIBRARY charconv.lib LIBRARY efsrv.lib LIBRARY estor.lib -LIBRARY imut.lib LIBRARY hash.lib LIBRARY etel.lib LIBRARY etelmm.lib @@ -75,6 +74,7 @@ LIBRARY nsmlwbxml.lib LIBRARY nsmlxml.lib LIBRARY centralrepository.lib +LIBRARY inetprotutil.lib #ifdef ARMCC LIBRARY ECOM.LIB diff -r 19fb38abab1d -r bf47f3b79154 syncmlfw/common/syncagent/src/NSmlAgentBase.cpp --- a/syncmlfw/common/syncagent/src/NSmlAgentBase.cpp Fri Apr 16 15:52:47 2010 +0300 +++ b/syncmlfw/common/syncagent/src/NSmlAgentBase.cpp Mon May 03 13:19:46 2010 +0300 @@ -20,7 +20,7 @@ #ifdef SYMBIAN_ENABLE_SPLIT_HEADERS #include #endif -#include +#include #include #include #include @@ -120,7 +120,7 @@ // --------------------------------------------------------- HBufC8* CNSmlAgentBase::BasicCredentialL() const { - TImCodecB64 B64Coder; + TBase64 B64Coder; HBufC8* userName; NSmlUnicodeConverter::HBufC8InUTF8LC( *iSyncMLUserName, userName ); HBufC8* password; @@ -148,7 +148,7 @@ CMD5* md5 = CMD5::NewL(); CleanupStack::PushL( md5 ); - TImCodecB64 B64Coder; + TBase64 B64Coder; HBufC8* userName; if ( aServerAuth ) { @@ -1110,7 +1110,7 @@ if ( chalFormat == KNSmlAgentBase64Format ) { //decode before saving - TImCodecB64 B64Coder; + TBase64 B64Coder; B64Coder.Decode( chalNextNonce, nextNonceDecodedPtr ); } else diff -r 19fb38abab1d -r bf47f3b79154 syncmlfw/common/syncagent/src/nsmlauth.cpp --- a/syncmlfw/common/syncagent/src/nsmlauth.cpp Fri Apr 16 15:52:47 2010 +0300 +++ b/syncmlfw/common/syncagent/src/nsmlauth.cpp Mon May 03 13:19:46 2010 +0300 @@ -17,7 +17,7 @@ -#include +#include #include #include "NSmlAuth.h" #include "nsmlcliagconstants.h" @@ -172,7 +172,7 @@ { CreateAndSaveNewNonceL(); } - TImCodecB64 B64Coder; + TBase64 B64Coder; delete iB64Nonce; iB64Nonce = NULL; iB64Nonce = HBufC8::NewL( iNonce->Length() * 2 + 1 ); @@ -269,7 +269,7 @@ HBufC8* B64Cred; if ( iFormat->Des() != KNSmlAgentBase64Format ) { - TImCodecB64 B64Coder; + TBase64 B64Coder; B64Cred = HBufC8::NewLC( iCredential->Length() * 2 + 1 ); TPtr8 B64CredPtr( B64Cred->Des() ); User::LeaveIfError( B64Coder.Encode( *iCredential, B64CredPtr ) ); diff -r 19fb38abab1d -r bf47f3b79154 syncmlfw/common/transport/bld/nsmltransport.mmp --- a/syncmlfw/common/transport/bld/nsmltransport.mmp Fri Apr 16 15:52:47 2010 +0300 +++ b/syncmlfw/common/transport/bld/nsmltransport.mmp Mon May 03 13:19:46 2010 +0300 @@ -52,7 +52,7 @@ LIBRARY nsmldebug.lib LIBRARY commonengine.lib // 1.2 CHANGES: Offline mode LIBRARY commdb.lib -LIBRARY apengine.lib +LIBRARY cmmanager.lib LIBRARY CENTRALREPOSITORY.LIB LIBRARY FeatMgr.lib diff -r 19fb38abab1d -r bf47f3b79154 syncmlfw/common/transport/src/nsmltransport.cpp --- a/syncmlfw/common/transport/src/nsmltransport.cpp Fri Apr 16 15:52:47 2010 +0300 +++ b/syncmlfw/common/transport/src/nsmltransport.cpp Mon May 03 13:19:46 2010 +0300 @@ -21,13 +21,16 @@ #include #include #include -#include #include "nsmltransport.h" #include "nsmlhttp.h" #include "NSmlObexClient.h" #include "nsmlobexserverbinding.h" #include "nsmlerror.h" #include +#include +#include +#include + //============================================================ // CNSmlTransport definition @@ -248,14 +251,19 @@ // 0xffffffff is same as -1 (KErrNotFound) and -2 for Default connection { TUint32 accesspointId = aIAPIdArray->At(0); - CCommsDatabase* commDb = CCommsDatabase::NewL(); - CleanupStack::PushL(commDb); - CApUtils* aputils = CApUtils::NewLC( *commDb ); - TRAP_IGNORE( accesspointId = aputils->WapIdFromIapIdL( accesspointId ) ); - TApBearerType bearerType = aputils->BearerTypeL( accesspointId ); - CleanupStack::PopAndDestroy( 2 ); //commdb,aputils + RCmManagerExt cmmanagerExt; + cmmanagerExt.OpenL(); + CleanupClosePushL(cmmanagerExt); + RCmConnectionMethodExt cm; + cm = cmmanagerExt.ConnectionMethodL( accesspointId ); + CleanupClosePushL( cm ); + TUint32 bearer = 0; + + TRAP_IGNORE( accesspointId = cm.GetIntAttributeL(CMManager::ECmIapId) ); + bearer = cm.GetIntAttributeL( CMManager::ECmBearerType ); + CleanupStack::PopAndDestroy( 2 ); //cmmanagerext,cm - if ( bearerType != EApBearerTypeWLAN ) + if ( bearer != KUidWlanBearerType ) { errormsg = ETrue; } diff -r 19fb38abab1d -r bf47f3b79154 syncmlfw/dm/provisioningadapter/bld/NSmlDmProvisioningAdapter.mmp --- a/syncmlfw/dm/provisioningadapter/bld/NSmlDmProvisioningAdapter.mmp Fri Apr 16 15:52:47 2010 +0300 +++ b/syncmlfw/dm/provisioningadapter/bld/NSmlDmProvisioningAdapter.mmp Mon May 03 13:19:46 2010 +0300 @@ -49,7 +49,7 @@ USERINCLUDE ../../../common/sosserver_transporthandler/inc -LIBRARY euser.lib commdb.lib charconv.lib bafl.lib efsrv.lib apengine.lib +LIBRARY euser.lib commdb.lib charconv.lib bafl.lib efsrv.lib cmmanager.lib LIBRARY nsmldebug.lib syncmlclientapi.lib nsmlprivateapi.lib LIBRARY provisioningengine.lib featmgr.lib centralrepository.lib diff -r 19fb38abab1d -r bf47f3b79154 syncmlfw/dm/provisioningadapter/src/NSmlDmProvisioningAdapter.cpp --- a/syncmlfw/dm/provisioningadapter/src/NSmlDmProvisioningAdapter.cpp Fri Apr 16 15:52:47 2010 +0300 +++ b/syncmlfw/dm/provisioningadapter/src/NSmlDmProvisioningAdapter.cpp Mon May 03 13:19:46 2010 +0300 @@ -26,11 +26,11 @@ #include #include #include -#include #include #include #include - +#include +#include #include #include #include @@ -268,13 +268,16 @@ if( iProfiles[aItem]->iVisitParameter && iProfiles[aItem]->iVisitParameter->Data().Length() == uid.MaxLength() ) { uid.Copy( iProfiles[aItem]->iVisitParameter->Data() ); - - CCommsDatabase* commDb = CCommsDatabase::NewL(); - CleanupStack::PushL( commDb ); - CApUtils* aputils = CApUtils::NewLC( *commDb ); + + RCmManagerExt cmmanagerExt; + cmmanagerExt.OpenL(); + CleanupClosePushL(cmmanagerExt); + RCmConnectionMethodExt cm; + cm = cmmanagerExt.ConnectionMethodL( uid()); + CleanupClosePushL( cm ); TUint apId = 0; - TRAPD( ERROR, apId = aputils->IapIdFromWapIdL( uid() ) ); + TRAPD( ERROR, apId = cm.GetIntAttributeL(CMManager::ECmIapId) ); if( ERROR != KErrNone ) { apId = GetDefaultIAPL(); @@ -286,7 +289,7 @@ connection.SetPropertyL( KNSmlIAPId, *iapBuf ); - CleanupStack::PopAndDestroy( 3 ); //commdb, aputils, iapBuf + CleanupStack::PopAndDestroy( 2 ); //cmmanager,cm } if( iProfiles[aItem]->iHostAddress ) diff -r 19fb38abab1d -r bf47f3b79154 syncmlfw/dm/settings/conf/factorydmprofiles.confml Binary file syncmlfw/dm/settings/conf/factorydmprofiles.confml has changed diff -r 19fb38abab1d -r bf47f3b79154 syncmlfw/dm/settings/inc/DMprofileContentHandler.h --- a/syncmlfw/dm/settings/inc/DMprofileContentHandler.h Fri Apr 16 15:52:47 2010 +0300 +++ b/syncmlfw/dm/settings/inc/DMprofileContentHandler.h Mon May 03 13:19:46 2010 +0300 @@ -22,7 +22,7 @@ // INCLUDES #include #include -#include "mxmlattributes.h" +#include "MXMLAttributes.h" #include "MXMLContentHandler.h" #include "NSmlDMResourceProfile.h" diff -r 19fb38abab1d -r bf47f3b79154 syncmlfw/ds/provisioningadapter/bld/NSmlDsProvisioningAdapter.mmp --- a/syncmlfw/ds/provisioningadapter/bld/NSmlDsProvisioningAdapter.mmp Fri Apr 16 15:52:47 2010 +0300 +++ b/syncmlfw/ds/provisioningadapter/bld/NSmlDsProvisioningAdapter.mmp Mon May 03 13:19:46 2010 +0300 @@ -49,7 +49,7 @@ MW_LAYER_SYSTEMINCLUDE SYSTEMINCLUDE /epoc32/include/ecom -LIBRARY euser.lib ECom.lib commdb.lib charconv.lib apengine.lib +LIBRARY euser.lib ECom.lib commdb.lib charconv.lib cmmanager.lib LIBRARY nsmldbcaps.lib bafl.lib efsrv.lib nsmldebug.lib syncmlclientapi.lib LIBRARY ProvisioningEngine.lib diff -r 19fb38abab1d -r bf47f3b79154 syncmlfw/ds/provisioningadapter/src/NSmlDsProvisioningAdapter.cpp --- a/syncmlfw/ds/provisioningadapter/src/NSmlDsProvisioningAdapter.cpp Fri Apr 16 15:52:47 2010 +0300 +++ b/syncmlfw/ds/provisioningadapter/src/NSmlDsProvisioningAdapter.cpp Mon May 03 13:19:46 2010 +0300 @@ -26,9 +26,9 @@ #include #include #include -#include #include - +#include +#include #include #include #include @@ -262,12 +262,15 @@ { uid.Copy(iProfiles[aItem]->iVisitParameter->Data() ); - CCommsDatabase* commDb = CCommsDatabase::NewL(); - CleanupStack::PushL(commDb); - CApUtils* aputils = CApUtils::NewLC( *commDb); + RCmManagerExt cmmanagerExt; + cmmanagerExt.OpenL(); + CleanupClosePushL(cmmanagerExt); + RCmConnectionMethodExt cm; + cm = cmmanagerExt.ConnectionMethodL( uid()); + CleanupClosePushL( cm ); - TRAP( ERROR, apId = aputils->IapIdFromWapIdL( uid() ) ); - CleanupStack::PopAndDestroy(2); //commdb, aputils + TRAP( ERROR, apId = cm.GetIntAttributeL(CMManager::ECmIapId) ); + CleanupStack::PopAndDestroy(2); //cmmanager,cm } //Get default access point in failure of getting AP diff -r 19fb38abab1d -r bf47f3b79154 syncmlfw/ds/settings/src/pcsuite/NSmlDSProfileRes.rss --- a/syncmlfw/ds/settings/src/pcsuite/NSmlDSProfileRes.rss Fri Apr 16 15:52:47 2010 +0300 +++ b/syncmlfw/ds/settings/src/pcsuite/NSmlDSProfileRes.rss Mon May 03 13:19:46 2010 +0300 @@ -117,11 +117,11 @@ }, PROFILE { - profiledisplayname="O3sis"; + profiledisplayname="OVISERVER"; //username=""; //password=""; - serverurl="http://wdev.o3sis.com:80/syncml.osp"; - serverid="O3SIS SyncML Server"; + serverurl="https://sync.ovi.com:443/services/syncml"; + serverid="Ovi.com"; profilehidden=0; transportid=0x101F99F0; deleteallowed=1; @@ -136,8 +136,8 @@ CONTENTTYPE { adapter_implementation_uid = 0x101F6DDD; // Contacts - clientdatasource = "C:Contacts.cdb"; - serverdatasource = "contacts"; + clientdatasource = "symbian"; + serverdatasource = "./Contact/Unfiled"; synctype = ESmlTwoWay; filtervisibility = "h"; synctypevisibility = "r"; @@ -148,7 +148,18 @@ { adapter_implementation_uid = 0x101F6DDE; // Calendar clientdatasource = "Calendar"; - serverdatasource = "calendar"; + serverdatasource = "./EventTask/Tasks"; + synctype = ESmlTwoWay; + filtervisibility = "h"; + synctypevisibility = "r"; + creatorid = 0x101FF968; + + }, + CONTENTTYPE + { + adapter_implementation_uid = 0x101F8612; // Notes + clientdatasource = "c:Calendar"; + serverdatasource = "./Note/Unfiled"; synctype = ESmlTwoWay; filtervisibility = "h"; synctypevisibility = "r"; diff -r 19fb38abab1d -r bf47f3b79154 terminalsecurity/SCP/SCPClient/BWINS/SCPClientu.def --- a/terminalsecurity/SCP/SCPClient/BWINS/SCPClientu.def Fri Apr 16 15:52:47 2010 +0300 +++ b/terminalsecurity/SCP/SCPClient/BWINS/SCPClientu.def Mon May 03 13:19:46 2010 +0300 @@ -1,33 +1,38 @@ EXPORTS - ??0RSCPClient@@QAE@XZ @ 1 NONAME ; RSCPClient::RSCPClient(void) - ??1CSCPParamObject@@UAE@XZ @ 2 NONAME ; CSCPParamObject::~CSCPParamObject(void) - ?ChangeCode@RSCPClient@@QAEHAAVTDes16@@@Z @ 3 NONAME ; int RSCPClient::ChangeCode(class TDes16 &) - ?ChangeCodeRequest@RSCPClient@@QAEHXZ @ 4 NONAME ; int RSCPClient::ChangeCodeRequest(void) - ?Connect@RSCPClient@@QAEHXZ @ 5 NONAME ; int RSCPClient::Connect(void) - ?Get@CSCPParamObject@@QAEHHAAH@Z @ 6 NONAME ; int CSCPParamObject::Get(int, int &) - ?Get@CSCPParamObject@@QAEHHAAVTDes16@@@Z @ 7 NONAME ; int CSCPParamObject::Get(int, class TDes16 &) - ?GetBuffer@CSCPParamObject@@QAEHAAPAVHBufC8@@@Z @ 8 NONAME ; int CSCPParamObject::GetBuffer(class HBufC8 * &) - ?GetCode@RSCPClient@@QAEHAAV?$TBuf@$07@@@Z @ 9 NONAME ; int RSCPClient::GetCode(class TBuf<8> &) - ?GetLockState@RSCPClient@@QAEHAAH@Z @ 10 NONAME ; int RSCPClient::GetLockState(int &) - ?GetParamLength@CSCPParamObject@@QAEHH@Z @ 11 NONAME ; int CSCPParamObject::GetParamLength(int) - ?GetParamValue@RSCPClient@@QAEHHAAVTDes16@@@Z @ 12 NONAME ; int RSCPClient::GetParamValue(int, class TDes16 &) - ?NewL@CSCPParamObject@@SAPAV1@XZ @ 13 NONAME ; class CSCPParamObject * CSCPParamObject::NewL(void) - ?NewLC@CSCPParamObject@@SAPAV1@XZ @ 14 NONAME ; class CSCPParamObject * CSCPParamObject::NewLC(void) - ?Parse@CSCPParamObject@@QAEHAAVTDes8@@@Z @ 15 NONAME ; int CSCPParamObject::Parse(class TDes8 &) - ?QueryAdminCmd@RSCPClient@@QAEHW4TSCPAdminCommand@@@Z @ 16 NONAME ; int RSCPClient::QueryAdminCmd(enum TSCPAdminCommand) - ?ReadFromFileL@CSCPParamObject@@QAEXAAVTDesC16@@PAVRFs@@@Z @ 17 NONAME ; void CSCPParamObject::ReadFromFileL(class TDesC16 &, class RFs *) - ?Reset@CSCPParamObject@@QAEHXZ @ 18 NONAME ; int CSCPParamObject::Reset(void) - ?SecCodeQuery@RSCPClient@@QAEHAAV?$TBuf@$09@@W4TSCPButtonConfig@1@HH@Z @ 19 NONAME ; int RSCPClient::SecCodeQuery(class TBuf<10> &, enum RSCPClient::TSCPButtonConfig, int, int) - ?Set@CSCPParamObject@@QAEHHAAVTDes16@@@Z @ 20 NONAME ; int CSCPParamObject::Set(int, class TDes16 &) - ?Set@CSCPParamObject@@QAEHHH@Z @ 21 NONAME ; int CSCPParamObject::Set(int, int) - ?SetParamValue@RSCPClient@@QAEHHAAVTDes16@@@Z @ 22 NONAME ; int RSCPClient::SetParamValue(int, class TDes16 &) - ?SetPhoneLock@RSCPClient@@QAEHH@Z @ 23 NONAME ; int RSCPClient::SetPhoneLock(int) - ?StoreCode@RSCPClient@@QAEHAAV?$TBuf@$07@@@Z @ 24 NONAME ; int RSCPClient::StoreCode(class TBuf<8> &) - ?Unset@CSCPParamObject@@QAEHH@Z @ 25 NONAME ; int CSCPParamObject::Unset(int) - ?Version@RSCPClient@@QBE?AVTVersion@@XZ @ 26 NONAME ; class TVersion RSCPClient::Version(void) const - ?WriteToFileL@CSCPParamObject@@QAEXAAVTDesC16@@PAVRFs@@@Z @ 27 NONAME ; void CSCPParamObject::WriteToFileL(class TDesC16 &, class RFs *) - ?CheckConfiguration@RSCPClient@@QAEHH@Z @ 28 NONAME ; int RSCPClient::CheckConfiguration(int) - ?PerformCleanupL@RSCPClient@@QAEHAAV?$RArray@VTUid@@@@@Z @ 29 NONAME ; int RSCPClient::PerformCleanupL(class RArray &) - ?SetParamValue@RSCPClient@@QAEHHAAVTDes16@@K@Z @ 30 NONAME ; int RSCPClient::SetParamValue(int, class TDes16 &, unsigned long) - ?SetAutoLockPeriod@RSCPClient@@QAEHH@Z @ 31 NONAME ; int RSCPClient::SetAutoLockPeriod(int) + ?SetParamValue@RSCPClient@@QAEHHAAVTDes16@@K@Z @ 1 NONAME ; int RSCPClient::SetParamValue(int, class TDes16 &, unsigned long) + ?GetParamValue@RSCPClient@@QAEHHAAVTDes16@@@Z @ 2 NONAME ; int RSCPClient::GetParamValue(int, class TDes16 &) + ?StoreLockcode@RSCPClient@@QAEHAAVTDesC16@@0AAV?$RArray@W4TDevicelockPolicies@@@@@Z @ 3 NONAME ; int RSCPClient::StoreLockcode(class TDesC16 &, class TDesC16 &, class RArray &) + ?StoreCode@RSCPClient@@QAEHAAV?$TBuf@$07@@@Z @ 4 NONAME ; int RSCPClient::StoreCode(class TBuf<8> &) + ?SetPhoneLock@RSCPClient@@QAEHH@Z @ 5 NONAME ; int RSCPClient::SetPhoneLock(int) + ?NewLC@CSCPParamObject@@SAPAV1@XZ @ 6 NONAME ; class CSCPParamObject * CSCPParamObject::NewLC(void) + ?GetLockState@RSCPClient@@QAEHAAH@Z @ 7 NONAME ; int RSCPClient::GetLockState(int &) + ?WriteToFileL@CSCPParamObject@@QAEXAAVTDesC16@@PAVRFs@@@Z @ 8 NONAME ; void CSCPParamObject::WriteToFileL(class TDesC16 &, class RFs *) + ?SetParamValue@RSCPClient@@QAEHHAAVTDes16@@@Z @ 9 NONAME ; int RSCPClient::SetParamValue(int, class TDes16 &) + ?Set@CSCPParamObject@@QAEHHH@Z @ 10 NONAME ; int CSCPParamObject::Set(int, int) + ?PerformCleanupL@RSCPClient@@QAEHAAV?$RArray@VTUid@@@@@Z @ 11 NONAME ; int RSCPClient::PerformCleanupL(class RArray &) + ?Unset@CSCPParamObject@@QAEHH@Z @ 12 NONAME ; int CSCPParamObject::Unset(int) + ?Connect@RSCPClient@@QAEHXZ @ 13 NONAME ; int RSCPClient::Connect(void) + ?AddtoFailedPolices@CSCPParamObject@@QAEHH@Z @ 14 NONAME ; int CSCPParamObject::AddtoFailedPolices(int) + ?Reset@CSCPParamObject@@QAEHXZ @ 15 NONAME ; int CSCPParamObject::Reset(void) + ?Parse@CSCPParamObject@@QAEHAAVTDes8@@@Z @ 16 NONAME ; int CSCPParamObject::Parse(class TDes8 &) + ?IsLockcodeChangeAllowedNow@RSCPClient@@QAEHAAV?$RArray@W4TDevicelockPolicies@@@@@Z @ 17 NONAME ; int RSCPClient::IsLockcodeChangeAllowedNow(class RArray &) + ?QueryAdminCmd@RSCPClient@@QAEHW4TSCPAdminCommand@@@Z @ 18 NONAME ; int RSCPClient::QueryAdminCmd(enum TSCPAdminCommand) + ?CheckConfiguration@RSCPClient@@QAEHH@Z @ 19 NONAME ; int RSCPClient::CheckConfiguration(int) + ?VerifyNewLockcodeAgainstPolicies@RSCPClient@@QAEHAAVTDesC16@@AAV?$RArray@W4TDevicelockPolicies@@@@@Z @ 20 NONAME ; int RSCPClient::VerifyNewLockcodeAgainstPolicies(class TDesC16 &, class RArray &) + ?GetCode@RSCPClient@@QAEHAAV?$TBuf@$07@@@Z @ 21 NONAME ; int RSCPClient::GetCode(class TBuf<8> &) + ??0RSCPClient@@QAE@XZ @ 22 NONAME ; RSCPClient::RSCPClient(void) + ??1CSCPParamObject@@UAE@XZ @ 23 NONAME ; CSCPParamObject::~CSCPParamObject(void) + ?Get@CSCPParamObject@@QAEHHAAVTDes16@@@Z @ 24 NONAME ; int CSCPParamObject::Get(int, class TDes16 &) + ?NewL@CSCPParamObject@@SAPAV1@XZ @ 25 NONAME ; class CSCPParamObject * CSCPParamObject::NewL(void) + ?GetBuffer@CSCPParamObject@@QAEHAAPAVHBufC8@@@Z @ 26 NONAME ; int CSCPParamObject::GetBuffer(class HBufC8 * &) + ?GetPolicies@RSCPClient@@QAEHAAV?$RArray@H@@@Z @ 27 NONAME ; int RSCPClient::GetPolicies(class RArray &) + ?Set@CSCPParamObject@@QAEHHAAVTDes16@@@Z @ 28 NONAME ; int CSCPParamObject::Set(int, class TDes16 &) + ?GetParamLength@CSCPParamObject@@QAEHH@Z @ 29 NONAME ; int CSCPParamObject::GetParamLength(int) + ?VerifyCurrentLockcode@RSCPClient@@QAEHAAVTDesC16@@AAV?$TBuf@$09@@AAV?$RArray@W4TDevicelockPolicies@@@@H@Z @ 30 NONAME ; int RSCPClient::VerifyCurrentLockcode(class TDesC16 &, class TBuf<10> &, class RArray &, int) + ?Version@RSCPClient@@QBE?AVTVersion@@XZ @ 31 NONAME ; class TVersion RSCPClient::Version(void) const + ?Get@CSCPParamObject@@QAEHHAAH@Z @ 32 NONAME ; int CSCPParamObject::Get(int, int &) + ?ReadFromFileL@CSCPParamObject@@QAEXAAVTDesC16@@PAVRFs@@@Z @ 33 NONAME ; void CSCPParamObject::ReadFromFileL(class TDesC16 &, class RFs *) + ?GetFailedPolices@CSCPParamObject@@QAEABV?$RArray@H@@XZ @ 34 NONAME ; class RArray const & CSCPParamObject::GetFailedPolices(void) + ?SetAutoLockPeriod@RSCPClient@@QAEHH@Z @ 35 NONAME ; int RSCPClient::SetAutoLockPeriod(int) + ?ChangeCode@RSCPClient@@QAEHAAVTDes16@@@Z @ 36 NONAME ; int RSCPClient::ChangeCode(class TDes16 &) diff -r 19fb38abab1d -r bf47f3b79154 terminalsecurity/SCP/SCPClient/eabi/SCPClientu.def --- a/terminalsecurity/SCP/SCPClient/eabi/SCPClientu.def Fri Apr 16 15:52:47 2010 +0300 +++ b/terminalsecurity/SCP/SCPClient/eabi/SCPClientu.def Mon May 03 13:19:46 2010 +0300 @@ -1,40 +1,43 @@ EXPORTS _ZN10RSCPClient10ChangeCodeER6TDes16 @ 1 NONAME - _ZN10RSCPClient12GetLockStateERi @ 2 NONAME - _ZN10RSCPClient12SecCodeQueryER4TBufILi10EENS_16TSCPButtonConfigEii @ 3 NONAME + _ZN10RSCPClient11GetPoliciesER6RArrayIiE @ 2 NONAME + _ZN10RSCPClient12GetLockStateERi @ 3 NONAME _ZN10RSCPClient12SetPhoneLockEi @ 4 NONAME _ZN10RSCPClient13GetParamValueEiR6TDes16 @ 5 NONAME _ZN10RSCPClient13QueryAdminCmdE16TSCPAdminCommand @ 6 NONAME _ZN10RSCPClient13SetParamValueEiR6TDes16 @ 7 NONAME - _ZN10RSCPClient17ChangeCodeRequestEv @ 8 NONAME - _ZN10RSCPClient7ConnectEv @ 9 NONAME - _ZN10RSCPClient7GetCodeER4TBufILi8EE @ 10 NONAME - _ZN10RSCPClient9StoreCodeER4TBufILi8EE @ 11 NONAME - _ZN10RSCPClientC1Ev @ 12 NONAME - _ZN10RSCPClientC2Ev @ 13 NONAME - _ZN15CSCPParamObject12WriteToFileLER7TDesC16P3RFs @ 14 NONAME - _ZN15CSCPParamObject13ReadFromFileLER7TDesC16P3RFs @ 15 NONAME - _ZN15CSCPParamObject14GetParamLengthEi @ 16 NONAME - _ZN15CSCPParamObject3GetEiR6TDes16 @ 17 NONAME - _ZN15CSCPParamObject3GetEiRi @ 18 NONAME - _ZN15CSCPParamObject3SetEiR6TDes16 @ 19 NONAME - _ZN15CSCPParamObject3SetEii @ 20 NONAME - _ZN15CSCPParamObject4NewLEv @ 21 NONAME - _ZN15CSCPParamObject5NewLCEv @ 22 NONAME - _ZN15CSCPParamObject5ParseER5TDes8 @ 23 NONAME - _ZN15CSCPParamObject5ResetEv @ 24 NONAME - _ZN15CSCPParamObject5UnsetEi @ 25 NONAME - _ZN15CSCPParamObject9GetBufferERP6HBufC8 @ 26 NONAME - _ZN15CSCPParamObjectD0Ev @ 27 NONAME - _ZN15CSCPParamObjectD1Ev @ 28 NONAME - _ZN15CSCPParamObjectD2Ev @ 29 NONAME - _ZNK10RSCPClient7VersionEv @ 30 NONAME - _ZTI15CSCPParamObject @ 31 NONAME ; ## - _ZTI15CSCPQueryDialog @ 32 NONAME ; ## - _ZTV15CSCPParamObject @ 33 NONAME ; ## - _ZTV15CSCPQueryDialog @ 34 NONAME ; ## - _ZN10RSCPClient18CheckConfigurationEi @ 35 NONAME - _ZN10RSCPClient15PerformCleanupLER6RArrayI4TUidE @ 36 NONAME - _ZN10RSCPClient13SetParamValueEiR6TDes16m @ 37 NONAME - _ZN10RSCPClient17SetAutoLockPeriodEi @ 38 NONAME + _ZN10RSCPClient13SetParamValueEiR6TDes16m @ 8 NONAME + _ZN10RSCPClient13StoreLockcodeER7TDesC16S1_R6RArrayI19TDevicelockPoliciesE @ 9 NONAME + _ZN10RSCPClient15PerformCleanupLER6RArrayI4TUidE @ 10 NONAME + _ZN10RSCPClient17SetAutoLockPeriodEi @ 11 NONAME + _ZN10RSCPClient18CheckConfigurationEi @ 12 NONAME + _ZN10RSCPClient21VerifyCurrentLockcodeER7TDesC16R4TBufILi10EER6RArrayI19TDevicelockPoliciesEi @ 13 NONAME + _ZN10RSCPClient26IsLockcodeChangeAllowedNowER6RArrayI19TDevicelockPoliciesE @ 14 NONAME + _ZN10RSCPClient32VerifyNewLockcodeAgainstPoliciesER7TDesC16R6RArrayI19TDevicelockPoliciesE @ 15 NONAME + _ZN10RSCPClient7ConnectEv @ 16 NONAME + _ZN10RSCPClient7GetCodeER4TBufILi8EE @ 17 NONAME + _ZN10RSCPClient9StoreCodeER4TBufILi8EE @ 18 NONAME + _ZN10RSCPClientC1Ev @ 19 NONAME + _ZN10RSCPClientC2Ev @ 20 NONAME + _ZN15CSCPParamObject12WriteToFileLER7TDesC16P3RFs @ 21 NONAME + _ZN15CSCPParamObject13ReadFromFileLER7TDesC16P3RFs @ 22 NONAME + _ZN15CSCPParamObject14GetParamLengthEi @ 23 NONAME + _ZN15CSCPParamObject16GetFailedPolicesEv @ 24 NONAME + _ZN15CSCPParamObject18AddtoFailedPolicesEi @ 25 NONAME + _ZN15CSCPParamObject3GetEiR6TDes16 @ 26 NONAME + _ZN15CSCPParamObject3GetEiRi @ 27 NONAME + _ZN15CSCPParamObject3SetEiR6TDes16 @ 28 NONAME + _ZN15CSCPParamObject3SetEii @ 29 NONAME + _ZN15CSCPParamObject4NewLEv @ 30 NONAME + _ZN15CSCPParamObject5NewLCEv @ 31 NONAME + _ZN15CSCPParamObject5ParseER5TDes8 @ 32 NONAME + _ZN15CSCPParamObject5ResetEv @ 33 NONAME + _ZN15CSCPParamObject5UnsetEi @ 34 NONAME + _ZN15CSCPParamObject9GetBufferERP6HBufC8 @ 35 NONAME + _ZN15CSCPParamObjectD0Ev @ 36 NONAME + _ZN15CSCPParamObjectD1Ev @ 37 NONAME + _ZN15CSCPParamObjectD2Ev @ 38 NONAME + _ZNK10RSCPClient7VersionEv @ 39 NONAME + _ZTI15CSCPParamObject @ 40 NONAME + _ZTV15CSCPParamObject @ 41 NONAME diff -r 19fb38abab1d -r bf47f3b79154 terminalsecurity/SCP/SCPClient/group/SCPClient.mmp --- a/terminalsecurity/SCP/SCPClient/group/SCPClient.mmp Fri Apr 16 15:52:47 2010 +0300 +++ b/terminalsecurity/SCP/SCPClient/group/SCPClient.mmp Mon May 03 13:19:46 2010 +0300 @@ -32,8 +32,7 @@ SOURCEPATH ../src SOURCE SCPClient.cpp -SOURCE SCPQueryDialog.cpp -SOURCE SCPParamObject.cpp SCPLockObserver.cpp +SOURCE SCPParamObject.cpp USERINCLUDE ../inc USERINCLUDE ../../inc diff -r 19fb38abab1d -r bf47f3b79154 terminalsecurity/SCP/SCPClient/src/SCPClient.cpp --- a/terminalsecurity/SCP/SCPClient/src/SCPClient.cpp Fri Apr 16 15:52:47 2010 +0300 +++ b/terminalsecurity/SCP/SCPClient/src/SCPClient.cpp Mon May 03 13:19:46 2010 +0300 @@ -27,7 +27,6 @@ #include #include "SCPClient.h" -#include "SCPQueryDialog.h" #include "SCPParamObject.h" #include @@ -38,8 +37,7 @@ //#ifdef __SAP_DEVICE_LOCK_ENHANCEMENTS #include #include -#include -#include +#include #include #include //#endif // DEVICE_LOCK_ENHANCEMENTS @@ -171,70 +169,6 @@ //#ifdef __SAP_DEVICE_LOCK_ENHANCEMENTS -// --------------------------------------------------------- -// RunDialog() Dialog execution wrapper -// Initialize and run the query dialog -// Returns: TInt: The return code from the dialog. -// Can leave with a generic error code. -// -// Status : Approved -// --------------------------------------------------------- -// -TInt RunDialogL( TDes& aReplyBuf, - RSCPClient::TSCPButtonConfig aButtonsShown, - TInt aMinLen, - TInt aMaxLen, - TUint aResId = 0, - TDesC* aPrompt = NULL, - TBool aECSSupport = EFalse - ) - { - Dprint(_L("[RSCPClient]-> RunDialogL() >>> ")); - FeatureManager::InitializeLibL(); - if(!FeatureManager::FeatureSupported(KFeatureIdSapDeviceLockEnhancements)) - { - FeatureManager::UnInitializeLib(); - return KErrNotSupported; - } - FeatureManager::UnInitializeLib(); - if ( ( aPrompt == NULL ) && ( aResId == 0 ) ) - { - return KErrArgument; - } - Dprint((_L("--> SCPClient::RunDialogL() start the dialog"))); - CSCPQueryDialog* dialog = new (ELeave) CSCPQueryDialog( - aReplyBuf, - aButtonsShown, - aMinLen, - aMaxLen, - aECSSupport - ); - - CleanupStack::PushL( dialog ); - - if ( aResId != 0 ) - { - // Load and set the prompt from a resource ID - HBufC* prompt; - - prompt = StringLoader::LoadLC( aResId ); - dialog->SetPromptL( *prompt ); - - CleanupStack::PopAndDestroy( prompt ); - } - else - { - // Set the given prompt - dialog->SetPromptL( *aPrompt ); - } - Dprint((_L("-- SCPClient::RunDialogL() dialog->ExecuteLD"))); - TInt ret = dialog->ExecuteLD( R_SCP_CODE_QUERY ); - - CleanupStack::Pop( dialog ); - Dprint( (_L("-- SCPClient::RunDialogL(): ret val %d"), ret)); - return ret; - } - // --------------------------------------------------------- // LoadResources() Resource loader @@ -550,167 +484,6 @@ // *********** Device lock new features ************* -->> -// --------------------------------------------------------- -// RSCPClient::SecCodeQuery() -// Request the security code from the user and authenticate -// through the server. -// -// Status : Approved -// --------------------------------------------------------- -// -EXPORT_C TInt RSCPClient::SecCodeQuery( RMobilePhone::TMobilePassword& aPassword, - TSCPButtonConfig aButtonsShown, - TBool aECSSupport, - TInt aFlags ) - { - TInt lErr = KErrNone; - TInt lStatus = KErrNone; - TInt lResFileSCP = NULL; - TInt lResFileSecUi = NULL; - Dprint( (_L("--> RSCPClient::SecCodeQuery(%d, %d"), aButtonsShown, aECSSupport )); - TRAP(lErr, lStatus = SetSecurityCodeL(aPassword, aButtonsShown, aECSSupport, aFlags, lResFileSCP, lResFileSecUi)); - - - if(lResFileSCP) { - CCoeEnv :: Static()->DeleteResourceFile(lResFileSCP); - } - - if(lResFileSecUi) { - - - CCoeEnv :: Static()->DeleteResourceFile(lResFileSecUi); - } - - Dprint((_L("<-- RSCPClient::SecCodeQuery(): lStatus= %d, lErr= %d"), lStatus, lErr)); - return (lErr != KErrNone) ? lErr : lStatus; -} - -// --------------------------------------------------------- -// RSCPClient::ChangeCodeRequest() -// Show the current code query dialog and continue in GetNew -// CodeAndChange. -// -// Status : Approved -// --------------------------------------------------------- -// -EXPORT_C TInt RSCPClient::ChangeCodeRequest() - { - Dprint((_L("[RSCPClient] ChangeCodeRequest() >>>"))); - - if(EFalse == isFlagEnabled) { - Dprint((_L("[RSCPClient]-> ChangeCodeRequest(): ERROR: Function not supported in this variant"))); - User :: Invariant(); - return KErrNotSupported; - } - - TInt lRet(KErrNone); - TInt lErr(KErrNone); - - TInt resourceFileSCP(NULL); - TInt resourceFileSecUi(NULL); - - // Check if the code change is allowed - { - HBufC8* addParamsHBuf = NULL; - TRAP(lErr, addParamsHBuf = HBufC8 :: NewL(KSCPMaxTARMNotifParamLen)); - - if(lErr != KErrNone) { - return lErr; - } - - TPtr8 addParams = addParamsHBuf->Des(); - addParams.Zero(); - - TInt status(KErrNone); - TPckg retPackage(status); - - TInt ret = SendReceive(ESCPServCodeChangeQuery, TIpcArgs(&retPackage, &addParams)); - - if((ret == KErrNone) && (addParams.Length() > 0)) { - // The server has sent additional parameters, ignore errors in processing - TRAP_IGNORE(ProcessServerCommandsL(addParams)); - } - - delete addParamsHBuf; - - if((ret != KErrNone) || (status != KErrNone)) { - // Password cannot be changed now - return KErrAbort; - } - } - - // Load the required resource files into this process - lRet = LoadResources(resourceFileSCP, resourceFileSecUi); - - if(lRet != KErrNone) { - return lRet; - } - - HBufC* codeHBuf = NULL; - - TRAP(lErr, codeHBuf = HBufC :: NewL(KSCPPasscodeMaxLength + 1)); - - if(lErr != KErrNone) { - // Remove the resource files - CCoeEnv :: Static()->DeleteResourceFile(resourceFileSCP); - CCoeEnv :: Static()->DeleteResourceFile(resourceFileSecUi); - return lErr; - } - - TPtr codeBuffer = codeHBuf->Des(); - codeBuffer.Zero(); - - TInt def_code = -1; - CRepository* lRepository = NULL; - - TRAP(lErr, lRepository = CRepository :: NewL(KCRUidSCPLockCode)); - - if(KErrNone == lErr) { - lErr = lRepository->Get(KSCPLockCodeDefaultLockCode, def_code); - - if(def_code == 0) { - TRAP(lErr, lRet = RunDialogL(codeBuffer, SCP_OK_CANCEL, KSCPPasscodeMinLength, - KSCPPasscodeMaxLength, R_SECUI_TEXT_ENTER_SEC_CODE)); - - if((lRet) && (lErr == KErrNone) && (lRet != ESecUiEmergencyCall)) { - lErr = GetNewCodeAndChange(codeBuffer, KSCPNormalChange); - } - - if(lErr != KErrNone) { - Dprint((_L("RSCPClient::ChangeCodeRequest(): Code change FAILED: %d"), lErr)); - } - - if(((!lRet) && (lErr == KErrNone)) || (lRet == ESecUiEmergencyCall)) { - // Cancelled by user - lErr = KErrAbort; - } - } - else if(def_code != -1) { - _LIT(KText, "12345"); - TBufC<10> NBuf (KText); - TPtr codeBuf = NBuf.Des(); - - lErr = GetNewCodeAndChange(codeBuf, KSCPNormalChange); - - if(lErr == KErrNone) { - lRepository->Set(KSCPLockCodeDefaultLockCode, 0); - } - else { - Dprint((_L("RSCPClient::ChangeCodeRequest(): Code change FAILED automatic: %d"), lErr)); - } - } - - delete lRepository; - } - - Dprint((_L("<-- RSCPClient::ChangeCodeRequest(): %d"), lErr )); - - // Remove the resource files - CCoeEnv :: Static()->DeleteResourceFile(resourceFileSCP); - CCoeEnv :: Static()->DeleteResourceFile(resourceFileSecUi); - delete codeHBuf; - return lErr; -} // --------------------------------------------------------- // RSCPClient::CheckConfiguration() @@ -791,6 +564,48 @@ return ret; } +EXPORT_C TInt RSCPClient::GetPolicies(RArray& aDeviceLockPolicies) { + Dprint(_L("[RSCPClient]-> GetPolicies >>>")); + HBufC8* lBuff = NULL; + TInt lStatus = KErrNone; + + TRAP(lStatus, lBuff = HBufC8 :: NewL((EDevicelockTotalPolicies - 1) * sizeof(TInt))); + + if (lStatus == KErrNone) { + + lStatus = SendReceive(ESCPServGetParam, TIpcArgs(-1, &lBuff->Des())); + + if (lStatus == KErrNone) { + // Copy data from lBuff to aDeviceLockPolicies + TPtr8 bufPtr = lBuff->Des(); + + if (bufPtr.Length() > 0) { + RDesReadStream lBufReadStream(bufPtr); + Dprint(_L("[RSCPClient]-> Get from server complete, returning service request...")); + + for (TInt i = 0; i < 17; i++) { + TInt32 lParamValue = 0; + TRAP(lStatus, lParamValue = lBufReadStream.ReadInt32L()); + + if (lStatus != KErrNone) { + break; + } + + aDeviceLockPolicies.Append(lParamValue); + } + + lBufReadStream.Close(); + } + else { + lStatus = KErrGeneral; + } + } + } + delete lBuff; + Dprint(_L("[RSCPClient]-> GetPolicies <<<")); + return lStatus; +} + /* --------------------------------------------------------- * Alternative function that can be used to set the Auto Lock period * Caller should have AllFiles access level @@ -804,350 +619,101 @@ Dprint((_L("[RSCPClient]-> SetAutoLockPeriod(): %d <<<"), ret)); return ret; } + +EXPORT_C TBool RSCPClient :: IsLockcodeChangeAllowedNow(RArray& aFailedPolicies) { + Dprint((_L("[RSCPClient]-> IsLockcodeChangeAllowedNow() >>>"))); + TInt lStatus = KErrNone; + TInt lErr = KErrNone; + + // extra one for failed policies count + //koys: if leave happens what errorcode we should return?? + HBufC8* failedPoliciesBuff = NULL; + TRAP(lStatus, failedPoliciesBuff = HBufC8 :: NewL((EDevicelockTotalPolicies + 1)* sizeof(TInt32))); + + if (lStatus == KErrNone) { + lStatus = SendReceive(ESCPServCodeChangeQuery, TIpcArgs(&failedPoliciesBuff->Des())); + //koya: if leave happens what errorcode we should return?? + TPtr8 failedPoliciesBufPtr = failedPoliciesBuff->Des(); + TRAP(lErr, ReadFailedPoliciesL(failedPoliciesBufPtr, aFailedPolicies)); + delete failedPoliciesBuff; + } + + Dprint((_L("[RSCPClient]-> IsLockcodeChangeAllowedNow() <<<"))); + return (lStatus != KErrNone) ? lStatus : ((lErr != KErrNone) ? lErr : KErrNone); +} + +EXPORT_C TInt RSCPClient :: VerifyNewLockcodeAgainstPolicies(TDesC& aLockcode, RArray& aFailedPolicies) { + Dprint((_L("[RSCPClient]-> VerifyNewLockcodeAgainstPolicies() >>>"))); + TInt lRet = KErrNone; + TInt lErr = KErrNone; + // extra one for failed policies count + HBufC8* failedPoliciesBuff = NULL; + + TRAP(lRet, failedPoliciesBuff = HBufC8 :: NewL((EDevicelockTotalPolicies + 1) * sizeof(TInt32))); + + if(lRet == KErrNone) { + lRet = SendReceive(ESCPServValidateLockcode, TIpcArgs(&aLockcode, &failedPoliciesBuff->Des())); + + TPtr8 failedPoliciesBufPtr = failedPoliciesBuff->Des(); + TRAP(lErr, ReadFailedPoliciesL(failedPoliciesBufPtr, aFailedPolicies)); + + delete failedPoliciesBuff; + } + + Dprint((_L("[RSCPClient]-> VerifyNewLockcodeAgainstPolicies() <<<"))); + return (lRet != KErrNone) ? lRet : ((lErr != KErrNone) ? lErr : KErrNone); +} + +EXPORT_C TInt RSCPClient :: StoreLockcode (TDesC& aNewLockcode, TDesC& aOldLockcode, RArray& aFailedPolicies) { + Dprint((_L("[RSCPClient]-> StoreLockcode() >>>"))); + TInt lErr = KErrNone; + TInt lRet = KErrNone; + + if (!IsLockcodeChangeAllowedNow(aFailedPolicies)) { + return KErrAccessDenied; + } + + HBufC8* failedPoliciesBuff = NULL; + + TRAP(lRet, failedPoliciesBuff = HBufC8 :: NewL((EDevicelockTotalPolicies + 1)* sizeof(TInt32))); + + if(lRet == KErrNone) { + lRet = SendReceive(ESCPServChangeEnhCode, TIpcArgs(&aOldLockcode, &aNewLockcode, &failedPoliciesBuff->Des())); + + TPtr8 failedPoliciesBufPtr = failedPoliciesBuff->Des(); + TRAP(lErr, ReadFailedPoliciesL(failedPoliciesBufPtr, aFailedPolicies)); + + delete failedPoliciesBuff; + } + + Dprint((_L("[RSCPClient]-> StoreLockcode() <<<"))); + return (lRet != KErrNone) ? lRet : ((lErr != KErrNone) ? lErr : KErrNone); +} + +EXPORT_C TInt RSCPClient :: VerifyCurrentLockcode (TDesC& aLockcode,RMobilePhone::TMobilePassword& aISACode,RArray< TDevicelockPolicies > &aFailedPolicies, TInt aFlags) { + Dprint((_L("[RSCPClient]-> VerifyCurrentLockcode() >>>"))); + TInt lErr = KErrNone; + TInt lRet = KErrNone; + + // extra one for failed policies count + HBufC8* failedPoliciesBuff = NULL; + + TRAP(lRet, failedPoliciesBuff = HBufC8 :: NewL((EDevicelockTotalPolicies + 1)* sizeof(TInt32))); + + if(lRet == KErrNone) { + lRet = SendReceive(ESCPServAuthenticateS60, TIpcArgs(&aLockcode, &aISACode, &failedPoliciesBuff->Des(), aFlags)); + + TPtr8 failedPoliciesBufPtr = failedPoliciesBuff->Des(); + TRAP(lRet, ReadFailedPoliciesL(failedPoliciesBufPtr, aFailedPolicies)); + + delete failedPoliciesBuff; + } + + return (lRet != KErrNone) ? lRet : ((lErr != KErrNone) ? lErr : KErrNone); +} + //#ifdef __SAP_DEVICE_LOCK_ENHANCEMENTS -// --------------------------------------------------------- -// RSCPClient::GetNewCodeAndChange() -// Show the new code request and verification dialogs and -// send the change request to the server. -// -// Status : Approved -// --------------------------------------------------------- -// -TInt RSCPClient::GetNewCodeAndChange( TDes& aOldCode, - TInt aMode, - TSCPSecCode* aNewDOSCode /*=NULL*/, - HBufC** aNewCodePptr/* = NULL*/) - { - - - if(!isFlagEnabled) - { - return KErrNotSupported; - } - TInt err = KErrNone; - TInt ret = KErrNone; - - - TInt maxLen = KSCPPasscodeMaxLength; - TInt minLen = 1; - - // Fetch the minimum and maximum lengths for the code, if available. - // This feature is commented out for correction to BU error ID: BNIN-6LC3AP. - // Left in the code for possible inclusion in the future. - //FetchLimits( minLen, maxLen ); - - // Request the new code and verify it. Repeat this until the codes match. - - // Create the buffers on the heap - HBufC* newCodeHBuf = NULL; - HBufC* verifyCodeHBuf = NULL; - - TRAP( err, newCodeHBuf = HBufC::NewL( KSCPPasscodeMaxLength + 1 ) ); - if ( err == KErrNone ) - { - TRAP( err, verifyCodeHBuf = HBufC::NewL( KSCPPasscodeMaxLength + 1 ) ); - } - - if ( err != KErrNone ) - { - if ( newCodeHBuf != NULL ) - { - delete newCodeHBuf; - } - return err; - } - - TPtr newCodeBuffer = newCodeHBuf->Des(); - TPtr verifyCodeBuffer = verifyCodeHBuf->Des(); - - // Configure the buttons according to the mode - TSCPButtonConfig bConfig; - TBool ecSupport; - if ( aMode == KSCPForcedChange ) - { - bConfig = SCP_OK_ETEL; - ecSupport = ETrue; - } - else - { - bConfig = SCP_OK_CANCEL; - ecSupport = EFalse; - } - - TBool isMismatch = EFalse; - do // Repeat loop BEGIN - { - isMismatch = EFalse; - - if ( err == KErrSCPInvalidCode ) - { - err = KErrNone; // "reset" - } - - newCodeBuffer.Zero(); - - TRAP( err, ret = RunDialogL( newCodeBuffer, - bConfig, - minLen, - maxLen, - R_SECUI_TEXT_ENTER_NEW_SEC_CODE, - NULL, - ecSupport ) ); - - if ( ( ret ) && ( ret != ESecUiEmergencyCall ) && ( err == KErrNone ) ) - { - verifyCodeBuffer.Zero(); - - TRAP( err, ret = RunDialogL( verifyCodeBuffer, - bConfig, - minLen, - maxLen, - R_SECUI_TEXT_VERIFY_NEW_SEC_CODE, - NULL, - ecSupport ) ); - } - - if ( ( !ret ) || ( err != KErrNone ) || ( ret == ESecUiEmergencyCall ) ) - { - break; - } - - if ( verifyCodeBuffer.Compare( newCodeBuffer ) != 0 ) - { - // Ignore the errors from showing the note, it's better to continue if it fails - - TRAP_IGNORE( - // Show an error note, the entered codes don't match - CAknNoteDialog* noteDlg = - new (ELeave) CAknNoteDialog(reinterpret_cast( ¬eDlg ) ); - noteDlg->SetTimeout( CAknNoteDialog::ELongTimeout ); - noteDlg->SetTone( CAknNoteDialog::EErrorTone ); - noteDlg->ExecuteLD( R_CODES_DONT_MATCH ); - ); - - isMismatch = ETrue; // Repeat code query - } - - if ( !isMismatch ) - { - HBufC8* addParamsHBuf = NULL; - - TRAP( err, addParamsHBuf = HBufC8::NewL( KSCPMaxTARMNotifParamLen ) ); - if ( err != KErrNone ) - { - delete verifyCodeHBuf; - delete newCodeHBuf; - return err; - } - - TPtr8 addParams = addParamsHBuf->Des(); - addParams.Zero(); - - if ( !isMismatch ) - { - // Try to change the code - TSCPSecCode newDOSCode; - newDOSCode.Zero(); - - err = SendReceive( ESCPServChangeEnhCode, - TIpcArgs( &aOldCode, &verifyCodeBuffer, &addParams, &newDOSCode ) - ); - - if ( addParams.Length() > 0 ) - { - // The server has sent additional parameters - TRAPD( err, ProcessServerCommandsL( addParams ) ); - if ( err != KErrNone ) - { - Dprint( (_L("RSCPClient::GetNewCodeAndChange():\ - Process cmds FAILED: %d"), err )); - } - } - - if ( aNewDOSCode != NULL ) - { - (*aNewDOSCode).Copy( newDOSCode ); - } - } - - delete addParamsHBuf; - } - - } while ( ( isMismatch ) || ( err == KErrSCPInvalidCode ) ); // Loop END - - if ( ( ( !ret ) && ( err == KErrNone ) ) || ( ret == ESecUiEmergencyCall ) ) - { - // Cancelled by user - err = KErrAbort; - } - - if((KErrNone == err) && (aNewCodePptr != 0)) { - Dprint(_L("[RSCPClient]-> INFO: Updating new lock code to aNewCodePptr")); - TRAP(err, *aNewCodePptr = HBufC :: NewL(verifyCodeHBuf->Des().Length())); - - if(*aNewCodePptr != NULL) { - (*aNewCodePptr)->Des().Copy(verifyCodeHBuf->Des()); - Dprint(_L("[RSCPClient]-> INFO: Updated new lock code to aNewCodePptr")); - } - } - - delete verifyCodeHBuf; - delete newCodeHBuf; - - return err; - } - - - -// --------------------------------------------------------- -// RSCPClient::ProcessServerCommandsL() -// Handle the commands in the server's param-buffer -// -// Status : Approved -// --------------------------------------------------------- -// -void RSCPClient::ProcessServerCommandsL( TDes8& aInParams, - CSCPParamObject** aOutParams, - TBool isNotifierEvent ) - { - - if(!isFlagEnabled) - { - User::Leave(KErrNotSupported); - } - Dprint( (_L("--> RSCPClient::ProcessServerCommandsL()") )); - (void)aOutParams; - - CSCPParamObject* theParams = CSCPParamObject::NewL(); - CleanupStack::PushL( theParams ); - - theParams->Parse( aInParams ); - TInt actionID; - TInt ret = theParams->Get( KSCPParamAction, actionID ); - - Dprint( (_L("RSCPClient::ProcessServerCommandsL():Params parsed") )); - - if ( ret != KErrNone ) - { - Dprint( (_L("RSCPClient::ProcessServerCommands(): Can't get action ID: %d"), ret )); - } - else - { - switch ( actionID ) - { - case ( KSCPActionShowUI ): - { - TRAP( ret, ShowUIL( *theParams ) ); - break; - } - - case ( KSCPActionForceChange ): - { - if ( isNotifierEvent ) - { - break; // Calling this through the notifier would jam the system - // since the server is busy. - } - - HBufC* codeHBuf = NULL; - codeHBuf = HBufC::NewL( KSCPPasscodeMaxLength + 1 ); - CleanupStack::PushL( codeHBuf ); - - TPtr codeBuf = codeHBuf->Des(); - codeBuf.Zero(); - - ret = theParams->Get( KSCPParamPassword, codeBuf ); - if ( ret == KErrNone ) - { - TSCPSecCode newDOSCode; - ret = GetNewCodeAndChange( codeBuf, KSCPForcedChange, &newDOSCode ); - - // If aOutParams is defined, return the new code - if ( aOutParams != NULL ) - { - (*aOutParams) = CSCPParamObject::NewL(); - (*aOutParams)->Set( KSCPParamPassword, newDOSCode ); - } - } - - CleanupStack::PopAndDestroy( codeHBuf ); - - break; - } - } - } - - CleanupStack::PopAndDestroy( theParams ); - - Dprint( (_L("<-- RSCPClient::ProcessServerCommandsL()") )); - User::LeaveIfError( ret ); - } - -// --------------------------------------------------------- -// RSCPClient::ShowUI() -// Show the requested UI through AVKON -// -// Status : Approved -// --------------------------------------------------------- -// -void RSCPClient::ShowUIL( CSCPParamObject& aContext ) - { - - if(!isFlagEnabled) - { - User::Leave(KErrNotSupported); - } - Dprint( (_L("--> RSCPClient::ShowUIL()") )); - TInt mode; - User::LeaveIfError( aContext.Get( KSCPParamUIMode, mode ) ); - - switch ( mode ) - { - case ( KSCPUINote ): - { - // Get prompt - TBuf promptText; - aContext.Get( KSCPParamPromptText, promptText ); - - // Try to get note icon, default is to use "error" - TInt noteType = KSCPUINoteError; - Dprint( (_L("RSCPClient::ShowUIL(): Creating note object") )); - - CAknResourceNoteDialog* note = NULL; - - if ( aContext.Get( KSCPParamNoteIcon, noteType ) != KErrNone ) - { - noteType = KSCPUINoteError; - } - - switch ( noteType ) - { - case ( KSCPUINoteWarning ): - { - note = new (ELeave) CAknWarningNote( ETrue ); - break; - } - - case ( KSCPUINoteError ): - default: // default to error - { - note = new (ELeave) CAknErrorNote( ETrue ); - break; - } - } - - if ( note != NULL ) - { - Dprint( (_L("RSCPClient::ShowUIL(): Showing note") )); - note->ExecuteLD( promptText ); - } - } - } - - Dprint( (_L("<-- RSCPClient::ShowUIL()") )); - } - // --------------------------------------------------------- // RSCPClient::FetchLimits() @@ -1193,160 +759,30 @@ aMax = KSCPPasscodeMaxLength; } } - } -TInt RSCPClient :: SetSecurityCodeL(RMobilePhone :: TMobilePassword& aPassword, - TSCPButtonConfig aButtonsShown, TBool aECSSupport, TInt aFlags, TInt& aResFileSCP, TInt& aResFileSecUi) { - Dprint((_L("[RSCPClient]-> SetSecurityCodeL() >>>"))); - Dprint((_L("[RSCPClient]-> input params - aButtonsShown=%d, aECSSupport=%d"), aButtonsShown, aECSSupport)); - - if(EFalse == isFlagEnabled) { - (void)aPassword; - Dprint((_L("[RSCPClient]-> ERROR: Function not supported in this variant"))); - User :: Invariant(); - return KErrNotSupported; } - TInt lRet = LoadResources(aResFileSCP, aResFileSecUi); - if(lRet != KErrNone) { - return lRet; - } - TInt lDefCode = 0; - CRepository* lRepository = CRepository :: NewLC(KCRUidSCPLockCode); - lRet = lRepository->Get(KSCPLockCodeDefaultLockCode, lDefCode); - if(lRet != KErrNone) { - Dprint(_L("[RSCPClient]-> ERROR: Unable to perform get on CenRep, lErr=%d"), lRet); - CleanupStack :: PopAndDestroy(lRepository); - return lRet; - } - HBufC* codeHBuf = HBufC :: NewLC(KSCPPasscodeMaxLength + 1); - HBufC8* addParamsHBuf = HBufC8 :: NewLC(KSCPMaxTARMNotifParamLen); - TPtr codeBuffer = codeHBuf->Des(); - TPtr8 addParams = addParamsHBuf->Des(); - if(lDefCode == 0) { - Dprint(_L("[RSCPClient]-> INFO: Default lock code has been set already by the user...")); - lRet = RunDialogL(codeBuffer, aButtonsShown, KSCPPasscodeMinLength, KSCPPasscodeMaxLength, - R_SECUI_TEXT_ENTER_SEC_CODE, NULL, aECSSupport); - if((lRet) && (lRet != ESecUiEmergencyCall) && (lRet != EAknSoftkeyEmergencyCall)) { - Dprint(_L("[RSCPClient]-> INFO: User has updated the lock code...")); - lRet = SendReceive( ESCPServAuthenticateS60, TIpcArgs( &codeBuffer, &aPassword, &addParams, aFlags)); - Dprint((_L("[RSCPClient]-> INFO: addParams.Length()=%d")), addParams.Length()); - Dprint((_L("[RSCPClient]-> INFO: lRet=%d")), lRet); - } - else { - switch(lRet) { - case 0: - lRet = KErrCancel; - break; - case EAknSoftkeyEmergencyCall: - //lRet = KErrCancel; - break; - case ESecUiEmergencyCall: - lRet = ESecUiEmergencyCall; - break; - /*default: - break;*/ - } - } - } - else { - TRequestStatus statusSave; - Dprint(_L("[RSCPClient]-> INFO: Default lock code not set by the user, requesting for the same")); - HBufC* msgConfirmSave = NULL; - CAknGlobalConfirmationQuery* query = CAknGlobalConfirmationQuery :: NewLC(); - - if(aButtonsShown == SCP_OK || aButtonsShown == SCP_OK_ETEL) { - //msgConfirmSave = CEikonEnv :: Static()->AllocReadResourceLC(R_SET_SEC_CODE); - msgConfirmSave = CEikonEnv :: Static()->AllocReadResourceLC(R_SET_SEC_CODE_SETTING_QUERY_SERVER); - query->ShowConfirmationQueryL(statusSave, *msgConfirmSave, R_AVKON_SOFTKEYS_OK_EMPTY__OK, R_QGN_NOTE_INFO_ANIM); - } - else { - msgConfirmSave = CEikonEnv :: Static()->AllocReadResourceLC(R_SET_SEC_CODE); - query->ShowConfirmationQueryL(statusSave, *msgConfirmSave, R_AVKON_SOFTKEYS_YES_NO__YES, R_QGN_NOTE_QUERY_ANIM); - } - - User :: WaitForRequest(statusSave); - CleanupStack :: PopAndDestroy(2); // msgConfirmSave query - - if((statusSave == EAknSoftkeyYes) || (statusSave == EAknSoftkeyOk)) { - Dprint(_L("[RSCPClient]-> INFO: calling GetNewCodeAndChange() ...")); - - TBufC<10> NBuf(KSCPDefaultEnchSecCode); - TPtr codeBuf = NBuf.Des(); - - TSCPSecCode lNewSecCode; - TInt lButtonCfg = (aButtonsShown == SCP_OK || aButtonsShown == SCP_OK_ETEL) ? KSCPForcedChange : KSCPNormalChange; - HBufC* lNewLkCodeBuf = NULL; - lRet = GetNewCodeAndChange(codeBuf, lButtonCfg, &lNewSecCode, &lNewLkCodeBuf); - - Dprint(_L("[RSCPClient]-> INFO: GetNewCodeAndChange() complete, err=%d"), lRet); - - if(KErrNone == lRet) { - /* This is being called as a workaround for a freezing issue with SecUI. This is in place - * as a temporary measure until the source is identified. - */ - TInt lTmpRet = SendReceive(ESCPServAuthenticateS60, TIpcArgs(&lNewLkCodeBuf->Des(), &aPassword, &addParams, aFlags)); - - Dprint(_L("[RSCPClient]-> INFO: lTmpRet from SendReceive()=%d"), lTmpRet); - if(KErrNone == lRet) { - Dprint(_L("[RSCPClient]-> INFO: updating CenRep ...")); - lRepository->Set(KSCPLockCodeDefaultLockCode, 0); - Dprint(_L("[RSCPClient]-> INFO: User updated lock code for the first time...err= %d"), lRet); - } - } - - if(lNewLkCodeBuf) { - delete lNewLkCodeBuf; - } - } - else { - Dprint(_L("[RSCPClient]-> INFO: Returning KErrCancel")); - lRet = KErrCancel; - } - - if(KErrAbort == lRet) { - Dprint(_L("[RSCPClient]-> INFO: Returning KErrCancel")); - lRet = KErrCancel; - } - +void RSCPClient :: ReadFailedPoliciesL(TDes8& aFailedPolicyBuf, RArray< TDevicelockPolicies>& aFailedPolicies) { + Dprint((_L("[RSCPClient]-> ReadFailedPoliciesL() >>>"))); + + if(aFailedPolicyBuf.Length() < 1) { + return; } - if(addParams.Length() > 0) { - CSCPParamObject* tmp = CSCPParamObject :: NewLC(); - TInt lTempRet = tmp->Parse(addParams); - - if(lTempRet == KErrNone) { - lTempRet = tmp->Set(KSCPParamPassword, codeBuffer); - } - - if(lTempRet == KErrNone) { - addParams.Zero(); - HBufC8* tmpBuf; - lTempRet = tmp->GetBuffer(tmpBuf); - - if(lTempRet == KErrNone) { - addParams.Copy(tmpBuf->Des()); - delete tmpBuf; - } - } - - if(lTempRet == KErrNone) { - CSCPParamObject* outParams = NULL; - ProcessServerCommandsL(addParams, &outParams); - - if(outParams != NULL) { - TSCPSecCode newSecCode; - if(outParams->Get(KSCPParamPassword, newSecCode) == KErrNone) { - Dprint((_L("[RSCPClient]-> INFO: Updating encoded password received from the server into aPassword..."))); - aPassword.Copy(newSecCode); - } - delete outParams; - } - } - CleanupStack :: PopAndDestroy(tmp); + RDesReadStream readStream(aFailedPolicyBuf); + CleanupClosePushL(readStream); + + TInt failedPoliciesCount = readStream.ReadInt32L(); + aFailedPolicies.Reset(); + Dprint((_L("[RSCPClient]-> ReadFailedPoliciesL failedPoliciesCount =%d"), failedPoliciesCount)); + for(int i=0; i < failedPoliciesCount; i++) { + TInt32 temp = readStream.ReadInt32L(); + //aFailedPolicies.Append((TDevicelockPolicies) readStream.ReadInt32L()); + aFailedPolicies.AppendL((TDevicelockPolicies)temp); + Dprint((_L("[RSCPClient]-> ReadFailedPoliciesL failed policy =%d"), temp)); } - CleanupStack :: PopAndDestroy(3); // repository, addParamsHBuf, codeHBuf - Dprint(_L("[RSCPClient]-> SetSecurityCodeL() <<< lRet=%d"), lRet); - return lRet; + + CleanupStack :: PopAndDestroy(&readStream); + Dprint((_L("[RSCPClient]-> ReadFailedPoliciesL() <<<"))); } //#endif // __SAP_DEVICE_LOCK_ENHANCEMENTS // <<-- *********** Device lock new features ************* diff -r 19fb38abab1d -r bf47f3b79154 terminalsecurity/SCP/SCPClient/src/SCPLockObserver.cpp --- a/terminalsecurity/SCP/SCPClient/src/SCPLockObserver.cpp Fri Apr 16 15:52:47 2010 +0300 +++ b/terminalsecurity/SCP/SCPClient/src/SCPLockObserver.cpp Mon May 03 13:19:46 2010 +0300 @@ -88,14 +88,6 @@ iProperty.Attach(KPSUidCoreApplicationUIs, KCoreAppUIsAutolockStatus); break; -#if 0 - case ESecUiRequestStateObserver: - - Dprint(_L("CSCPLockObserver::Start() Request State Observer")); - - iProperty.Attach(KPSUidSecurityUIs, KSecurityUIsQueryRequestCancel); - break; -#endif case ESecUiCallStateObserver: Dprint(_L("CSCPLockObserver::Start() Call State Observer")); @@ -169,20 +161,6 @@ iSubscribedToEvent = EFalse; } break; -#if 0 - case ESecUiRequestStateObserver: - TInt requestState; - iProperty.Get( requestState ); - if(requestState == ESecurityUIsQueryRequestCanceled) - { - - Dprint(_L("CSCPLockObserver::RunL() TryCancelQueryL Req Canceled")); - - iDialog->TryCancelQueryL(EEikBidCancel); - iSubscribedToEvent = EFalse; - } - break; -#endif case ESecUiCallStateObserver: TInt callState; iProperty.Get( callState ); diff -r 19fb38abab1d -r bf47f3b79154 terminalsecurity/SCP/SCPClient/src/SCPParamObject.cpp --- a/terminalsecurity/SCP/SCPClient/src/SCPParamObject.cpp Fri Apr 16 15:52:47 2010 +0300 +++ b/terminalsecurity/SCP/SCPClient/src/SCPParamObject.cpp Mon May 03 13:19:46 2010 +0300 @@ -285,7 +285,7 @@ { iParamIDs.Reset(); iParamValues.ResetAndDestroy(); - + iFailedPolicyIDs.Reset(); return KErrNone; } @@ -612,7 +612,15 @@ } } +EXPORT_C TInt CSCPParamObject::AddtoFailedPolices( TInt aFailedpolicyID ) + { + return iFailedPolicyIDs.Append(aFailedpolicyID); + } +EXPORT_C const RArray& CSCPParamObject::GetFailedPolices( ) + { + return iFailedPolicyIDs; + } // ---------------------------------------------------------- // CSCPParamObject::~CSCPParamObject() // Destructor diff -r 19fb38abab1d -r bf47f3b79154 terminalsecurity/SCP/SCPDatabase/src/SCPParamDBController.cpp --- a/terminalsecurity/SCP/SCPDatabase/src/SCPParamDBController.cpp Fri Apr 16 15:52:47 2010 +0300 +++ b/terminalsecurity/SCP/SCPDatabase/src/SCPParamDBController.cpp Mon May 03 13:19:46 2010 +0300 @@ -45,6 +45,7 @@ TInt lVal = KErrNone; TInt err_val = centrep->Get(KDmEventNotifierEnabled, lVal); +#ifndef __WINS__ _SCPDB_LOG(_L("[CSCPParamDBController]-> ConstructL(): cenrep KDmEventNotifierEnabled value: %d "), lVal); if(err_val == KErrNone && 0 == lVal) { _SCPDB_LOG(_L("[CSCPParamDBController]-> ConstructL(): RApaLsSession connection >>> ")); @@ -56,7 +57,7 @@ _SCPDB_LOG(_L("[CSCPParamDBController]-> ConstructL(): run dmeventnotifier.exe ")); //apaLsSession.GetAppInfo(appInfo, aUid); Required only if handle is registered through _reg file. #if defined (__WINS__) // ifdef (__WINSCW__) - _LIT(KExampleTaskHandlerExe, "C:\\sys\\bin\\dmeventnotifier.exe"); + _LIT(KExampleTaskHandlerExe, "dmeventnotifier.exe"); #else _LIT(KExampleTaskHandlerExe, "Z:\\Sys\\Bin\\dmeventnotifier.exe"); #endif @@ -73,6 +74,7 @@ apaLsSession.Close(); _SCPDB_LOG(_L("[CSCPParamDBController]-> ConstructL(): started dmeventnotifier.exe successfully")); } +#endif } _SCPDB_LOG(_L("[CSCPParamDBController]-> ConstructL(): Checking KAppUidDmEventNotifier cenrep completed ")); diff -r 19fb38abab1d -r bf47f3b79154 terminalsecurity/SCP/SCPHistoryPlugin/inc/SCPHistoryPlugin.h --- a/terminalsecurity/SCP/SCPHistoryPlugin/inc/SCPHistoryPlugin.h Fri Apr 16 15:52:47 2010 +0300 +++ b/terminalsecurity/SCP/SCPHistoryPlugin/inc/SCPHistoryPlugin.h Mon May 03 13:19:46 2010 +0300 @@ -70,7 +70,7 @@ /** * Event handler... */ - CSCPParamObject* HandleEvent( TInt aID, CSCPParamObject& aParam ); + void HandleEventL( TInt aID, CSCPParamObject& aInParam , CSCPParamObject& aOutParam); void SetEventHandler( MSCPPluginEventHandler* aHandler ); diff -r 19fb38abab1d -r bf47f3b79154 terminalsecurity/SCP/SCPHistoryPlugin/inc/SCPSpecificStringsPlugin.h --- a/terminalsecurity/SCP/SCPHistoryPlugin/inc/SCPSpecificStringsPlugin.h Fri Apr 16 15:52:47 2010 +0300 +++ b/terminalsecurity/SCP/SCPHistoryPlugin/inc/SCPSpecificStringsPlugin.h Mon May 03 13:19:46 2010 +0300 @@ -67,7 +67,7 @@ /** * Event handler... */ - CSCPParamObject* HandleEvent( TInt aID, CSCPParamObject& aParam ); + void HandleEventL( TInt aID, CSCPParamObject& aParam,CSCPParamObject& aOutParam ); void SetEventHandler( MSCPPluginEventHandler* aHandler ); diff -r 19fb38abab1d -r bf47f3b79154 terminalsecurity/SCP/SCPHistoryPlugin/src/SCPHistoryPlugin.cpp --- a/terminalsecurity/SCP/SCPHistoryPlugin/src/SCPHistoryPlugin.cpp Fri Apr 16 15:52:47 2010 +0300 +++ b/terminalsecurity/SCP/SCPHistoryPlugin/src/SCPHistoryPlugin.cpp Mon May 03 13:19:46 2010 +0300 @@ -25,7 +25,7 @@ #include "SCPHistoryPlugin.h" #include #include "SCP_IDs.h" - +#include // ============================= LOCAL FUNCTIONS ============================= @@ -84,24 +84,17 @@ // Status : Approved // ---------------------------------------------------------------------------- // -CSCPParamObject* CSCPHistoryPlugin::HandleEvent( TInt aID, CSCPParamObject& aParam ) +void CSCPHistoryPlugin :: HandleEventL( TInt aID, CSCPParamObject& aParam, CSCPParamObject& aOutParam) { Dprint ( ( _L( "CSCPHistoryPlugin::HandleEvent()" ) ) ); - // Make the ParamObject for success ack, Delete later - CSCPParamObject* retParams = NULL; - - TBool errRaised; - errRaised = EFalse; - - TBool isInvalid = EFalse; if ( iFs == NULL ) { - return NULL; // Eventhandler not available + return ; // Eventhandler not available } - - // check for Case - switch ( aID ) + // check for Case + + switch ( aID ) { case ( KSCPEventValidate ) : @@ -119,7 +112,6 @@ TInt errSCF = SetConfigFile (); if (errSCF != KErrNone) { - errRaised = ETrue; break; // Break out from Case } @@ -131,7 +123,6 @@ Dprint ( ( _L( "CSCPHistoryPlugin::HandleEvent historyItemCounter = %d" ), historyItemCounter ) ); if (errHC != KErrNone) { - errRaised = ETrue; break; // Break out from Case } @@ -144,7 +135,6 @@ // Nothing to do anymore Dprint( (_L("CSCPHistoryPlugin::HandleEvent()\ ERROR: KSCPEventValidate/KSCPParamPassword is != KErrNone") )); - errRaised = ETrue; break; // Break out from Case } @@ -174,7 +164,6 @@ // If the Historyonfig file get deleted on the fly ex if (errGH != KErrNone) { - errRaised = ETrue; array->Reset(); delete array; break; // Break out from Case @@ -183,9 +172,9 @@ correction = 0; if ( array->Count() >= passhistoryParamValue ) - { - correction = array->Count() - passhistoryParamValue; - } + { + correction = array->Count() - passhistoryParamValue; + } // check for match TBuf arrayItem; @@ -195,74 +184,20 @@ arrayItem = array->MdcaPoint(i); if (arrayItem.Compare(securityhash) == KErrNone) { - // Get the filesystem for Resource - // If fail, bail out - TInt errgGR = GetResource(); - if (errgGR != KErrNone) - { - errRaised = ETrue; - break; // Break out from the For - } - - // Prompt buf, iNote can show only 97 chars, - // without ... markings. - HBufC* hbuf = NULL; - - if ( passhistoryParamValue == 1 ) - { - isInvalid = ETrue; - TRAP_IGNORE( - hbuf = LoadAndFormatResL( R_SET_SEC_CODE_INFO_PREVIOUS ); - ); - } - else - { - isInvalid = ETrue; - TRAP_IGNORE( - hbuf = LoadAndFormatResL( - R_SET_SEC_CODE_INFO_CHECK, - &passhistoryParamValue ); - ); - } + aOutParam.Set( KSCPParamStatus, KErrSCPInvalidCode ); + Dprint ( ( _L( "EDeviceLockHistoryBuffer Failed" ) ) ); + aOutParam.AddtoFailedPolices(EDeviceLockHistoryBuffer); + break; + } // End of compare IF + } // End of For + + // kill the local + array->Reset(); + delete array; - if ( isInvalid ) - { - // Create the result-object to return - TRAPD( err, retParams = CSCPParamObject::NewL() ); - - if ( err == KErrNone ) - { - retParams->Set( KSCPParamStatus, KErrSCPInvalidCode ); - retParams->Set( KSCPParamAction, KSCPActionShowUI ); - retParams->Set( KSCPParamUIMode, KSCPUINote ); - - if ( hbuf != NULL ) - { - TPtr ptr = hbuf->Des(); - retParams->Set( KSCPParamPromptText, ptr ); - delete hbuf; - } - } - - break; - } - - } // End of compare IF - } // End of For - - // kill the local - array->Reset(); - delete array; - - } // passhistoryParamValue - else - { - retParams = NULL; - } - - break; - } // end of KSCPEventValidate - + } // passhistoryParamValue + break; + } // end of KSCPEventValidate // Someone has changed the Seccode and I need to include it to history case ( KSCPEventPasswordChanged ) : { @@ -271,7 +206,6 @@ TInt errSCF = SetConfigFile (); if (errSCF != KErrNone) { - errRaised = ETrue; break; // Break out from the case } @@ -282,7 +216,6 @@ // Nothing to do anymore Dprint( (_L("CSCPHistoryPlugin::HandleEvent()\ ERROR: KSCPEventPasswordChanged/KSCPParamPassword is != KErrNone") )); - errRaised = ETrue; break; // Break out from the Case } @@ -310,7 +243,6 @@ { Dprint( (_L("CSCPHistoryPlugin::HandleEvent(): WARNING:\ failed to write plugin configuration: %d"), errWC )); - errRaised = ETrue; break; // Break out from the Case } delete historyObject; @@ -324,7 +256,6 @@ TRAPD( err2, err = AppendAndWriteSecurityCodeL( securityhash ) ); if ( ( err != KErrNone ) || ( err2 != KErrNone ) ) { - errRaised = ETrue; break; // Break out from the Case } } @@ -345,18 +276,11 @@ // 1011 if ( paramID == (RTerminalControl3rdPartySession::EPasscodeHistoryBuffer)) { - // OK, we're interested, check that the value is valid - TRAPD( err, retParams = CSCPParamObject::NewL() ); - if ( err != KErrNone ) - { - break; // Nothing we can do - } - // All of our params are TInts TInt paramValue; if ( aParam.Get( KSCPParamValue, paramValue ) != KErrNone ) { - retParams->Set( KSCPParamStatus, KErrGeneral ); + aOutParam.Set( KSCPParamStatus, KErrGeneral ); break; } @@ -378,13 +302,8 @@ } // end of case EPasscodeHistoryBuffer } // end of switch ( paramID ) - retParams->Set( KSCPParamStatus, retStatus ); + aOutParam.Set( KSCPParamStatus, retStatus ); } - else - { - retParams = NULL; - } - break; } //End of KSCPEventConfigurationQuery Case @@ -399,18 +318,6 @@ } } // End of switch ( aID ) - - // Check if Any errors were raised and handle it - if (errRaised) - { - if ( retParams != NULL ) - { - delete retParams; - } - retParams = NULL; - } - - return retParams; } // ---------------------------------------------------------------------------- @@ -654,57 +561,6 @@ } // ---------------------------------------------------------------------------- -// CSCPHistoryPlugin::GetResource -// GetResource -// Status : Approved -// ---------------------------------------------------------------------------- -// - -TInt CSCPHistoryPlugin::GetResource() - { - Dprint( (_L("CSCPSpecificStringsPlugin::GetResource()") )); - // The resource has to be loaded manually since it is not an application. - - TFileName resourceFile; - resourceFile.Append( KDriveZ ); - resourceFile.Append( SCPHistoryPluginSrcFile ); - BaflUtils::NearestLanguageFile( *iFs, resourceFile ); - TRAPD( err, iRf.OpenL( *iFs, resourceFile ) ); - - if ( err == KErrNone ) - { - TRAP( err, iRf.ConfirmSignatureL() ); - } - - return err; - } - - -// ---------------------------------------------------------------------------- -// CSCPHistoryPlugin::LoadResourceLC -// GetResource -// Status : Approved -// ---------------------------------------------------------------------------- -// -HBufC16* CSCPHistoryPlugin::LoadResourceLC ( TInt aResId ) - { - Dprint( (_L("CSCPHistoryPlugin::LoadResourceLC()") )); - - // load the actual resource - HBufC8* readBuffer = iRf.AllocReadLC( aResId ); - // as we are expecting HBufC16... - const TPtrC16 ptrReadBuffer( (TText16*) readBuffer->Ptr(), - ( readBuffer->Length() + 1 ) >> 1 ); - - HBufC16* textBuffer=HBufC16::NewL( ptrReadBuffer.Length() ); - *textBuffer=ptrReadBuffer; - CleanupStack::PopAndDestroy( readBuffer ); // readBuffer - CleanupStack::PushL( textBuffer ); - return textBuffer; - } - - -// ---------------------------------------------------------------------------- // CSCPHistoryPlugin::FlushConfigFile // Remove all the other passwords from the file, except the last one (current) // @@ -753,97 +609,5 @@ CleanupStack::PopAndDestroy( historyObject ); return err; - } - - -// ---------------------------------------------------------------------------- -// CSCPHistoryPlugin::LoadAndFormatResL -// Load the given resouce, and format the string according to the TInt parameters -// if given. -// -// Status : Approved -// ---------------------------------------------------------------------------- -// -HBufC* CSCPHistoryPlugin::LoadAndFormatResL( TInt aResId, TInt* aParam1, TInt* aParam2 ) - { - Dprint ( ( _L( "CSCPHistoryPlugin::LoadAndFormatResL()" ) ) ); - HBufC16* resource = NULL; - HBufC* hbuf = NULL; - - resource = LoadResourceLC( aResId ); - FormatResourceString (*resource); - TInt allocLen = 0; - if ( aParam1 != NULL ) - { - allocLen += KSCPMaxIntLength; - } - if ( aParam2 != NULL ) - { - allocLen += KSCPMaxIntLength; - } - - hbuf = HBufC::NewL( resource->Length() + allocLen ); - - if ( ( aParam1 == NULL ) && ( aParam2 == NULL ) ) - { - hbuf->Des().Copy( resource->Des() ); - } - else - { - if ( aParam1 == NULL ) - { - hbuf->Des().Format( resource->Des(), *aParam2 ); - } - else if ( aParam2 == NULL ) - { - hbuf->Des().Format(resource->Des(), *aParam1 ); - } - else - { - hbuf->Des().Format(resource->Des(), *aParam1, *aParam2 ); - } - } - - CleanupStack::PopAndDestroy( resource ); - return hbuf; - } - -// ---------------------------------------------------------------------------- -// CSCPHistoryPlugin::FormatResourceString -// The buffer that is passed is formatted to have only %i as a format specifier instead of %N or %0N etc. -// -// Status : Approved -// ---------------------------------------------------------------------------- -// -void CSCPHistoryPlugin::FormatResourceString(HBufC16 &aResStr) -{ - TInt pos = 0; - TInt flag = 0; - TPtr16 bufPtr = aResStr.Des(); - _LIT (mess1, "%N"); - _LIT (mess2, "%i"); - _LIT (mess3, "%0N"); - _LIT (mess4, "%1N"); - - while ((pos = bufPtr.Find(mess1)) !=KErrNotFound) - { - bufPtr.Replace(pos,2,mess2); - flag = 1; - break; - } - - if(flag == 0) - { - while ((pos = bufPtr.Find(mess3)) != KErrNotFound) - { - bufPtr.Replace(pos,3,mess2); - } - - while ((pos = bufPtr.Find(mess4)) != KErrNotFound) - { - bufPtr.Replace(pos,3,mess2); - } - } -} - + } // End of File diff -r 19fb38abab1d -r bf47f3b79154 terminalsecurity/SCP/SCPHistoryPlugin/src/SCPSpecificStringsPlugin.cpp --- a/terminalsecurity/SCP/SCPHistoryPlugin/src/SCPSpecificStringsPlugin.cpp Fri Apr 16 15:52:47 2010 +0300 +++ b/terminalsecurity/SCP/SCPHistoryPlugin/src/SCPSpecificStringsPlugin.cpp Mon May 03 13:19:46 2010 +0300 @@ -26,7 +26,7 @@ #include #include "SCP_IDs.h" #include - +#include // ============================= LOCAL FUNCTIONS ============================= // ============================= MEMBER FUNCTIONS ============================= @@ -90,18 +90,12 @@ // Status : Approved // ---------------------------------------------------------------------------- // -CSCPParamObject* CSCPSpecificStringsPlugin::HandleEvent( TInt aID, CSCPParamObject& aParam ) +void CSCPSpecificStringsPlugin :: HandleEventL( TInt aID, CSCPParamObject& aParam,CSCPParamObject& aOutParam ) { - - // Make the ParamObject for success ack, Delete later - CSCPParamObject* retParams = NULL; - - TBool errRaised; - errRaised = EFalse; if ( iFs == NULL ) { - return NULL; // Eventhandler not available + User::Leave(KErrGeneral); } // check for Case @@ -128,7 +122,6 @@ TInt errSCF = SetConfigFile (); if (errSCF != KErrNone) { - errRaised = ETrue; break; // Break out from Case! } @@ -139,7 +132,6 @@ // Nothing to do anymore Dprint( (_L("CSCPSpecificStringsPlugin::HandleEvent()\ ERROR: KSCPEventPasswordChanged/KSCPParamPassword is != KErrNone") )); - errRaised = ETrue; break; // Break out from the Case!; } @@ -148,47 +140,16 @@ TInt errCSS = CheckSpecificStrings ( securitycode, forbiddensecuritycode ); if (errCSS != KErrNone) { - errRaised = ETrue; break; // Break out from Case! } if ( forbiddensecuritycode ) { - // Word was blacklisted! - // Get the filesystem for Resource - // If fail, bail out! - TInt errgGR = GetResource(); - if (errgGR != KErrNone) - { - errRaised = ETrue; - break; // Break out from the For! - } - - // Prompt buf, iNote can show only 97 chars, - // without ... markings. - HBufC* hbuf = NULL; + aOutParam.Set( KSCPParamStatus, KErrSCPInvalidCode ); + Dprint ( ( _L( "EDeviceLockDisallowSpecificStrings Failed" ) ) ); + aOutParam.AddtoFailedPolices(EDeviceLockDisallowSpecificStrings); + } - TRAP_IGNORE( - hbuf = LoadAndFormatResL( R_SET_SEC_CODE_PERSONAL ); - ); - - // Create the result-object to return - TRAPD( err, retParams = CSCPParamObject::NewL() ); - - if ( err == KErrNone ) - { - retParams->Set( KSCPParamStatus, KErrSCPInvalidCode ); - retParams->Set( KSCPParamAction, KSCPActionShowUI ); - retParams->Set( KSCPParamUIMode, KSCPUINote ); - - if ( hbuf != NULL ) - { - TPtr ptr = hbuf->Des(); - retParams->Set( KSCPParamPromptText, ptr ); - delete hbuf; - } - } - } } // end of specificstringscheck break; @@ -212,18 +173,9 @@ || ( paramID == RTerminalControl3rdPartySession::EPasscodeAllowSpecific) || ( paramID == RTerminalControl3rdPartySession::EPasscodeClearSpecificStrings) ) { - TRAPD( err, retParams = CSCPParamObject::NewL() ); - if ( err == KErrNone ) - { Dprint ( ( _L( "CSCPSpecificStringsPlugin::HandleEvent():\ Get not supported for %d" ), paramID ) ); - retParams->Set( KSCPParamStatus, KErrNotSupported ); - } - else - { - Dprint ( ( _L( "CSCPSpecificStringsPlugin::HandleEvent():\ - ERROR: Cannot create paramObject" ) ) ); - } + aOutParam.Set( KSCPParamStatus, KErrNotSupported ); } break; } @@ -244,21 +196,14 @@ || paramID == (RTerminalControl3rdPartySession::EPasscodeDisallowSpecific) || paramID == (RTerminalControl3rdPartySession::EPasscodeAllowSpecific) || paramID == (RTerminalControl3rdPartySession::EPasscodeClearSpecificStrings) ) - { - // OK, we're interested - TRAPD( err, retParams = CSCPParamObject::NewL() ); - if ( err != KErrNone ) - { - break; // Nothing we can do now - } - + { TInt retStatus = KErrNone; if ( paramID != RTerminalControl3rdPartySession::EPasscodeCheckSpecificStrings ) { // Set the storage attribute, so the server won't save the value, // we'll do it ourselves. - retParams->Set( KSCPParamStorage, KSCPStoragePrivate ); + aOutParam.Set( KSCPParamStorage, KSCPStoragePrivate ); } switch ( paramID ) @@ -322,9 +267,7 @@ { retStatus = KErrArgument; break; // from case! - } - - errRaised = ETrue; + } break; // Break out. } break; @@ -382,7 +325,6 @@ break; // from case! } - errRaised = ETrue; break; // Break out. } @@ -392,29 +334,14 @@ case ( RTerminalControl3rdPartySession::EPasscodeClearSpecificStrings ): { // 1018, Flush the config file - TInt paramValue; - if ( (aParam.Get( KSCPParamValue, paramValue ) != KErrNone) || - ( paramValue < 0 ) || ( paramValue > 1 ) ) - { - retStatus = KErrArgument; - } - - if (paramValue == 1 && retStatus == KErrNone) - { - TRAP_IGNORE( FlushConfigFileL() ); - } - + + TRAP_IGNORE( FlushConfigFileL() ); break; } } // End of switch - retParams->Set( KSCPParamStatus, retStatus ); + aOutParam.Set( KSCPParamStatus, retStatus ); } - else - { - retParams = NULL; - } - break; } //End of KSCPEventConfigurationQuery Case @@ -427,18 +354,6 @@ } } // End of switch ( aID ) - - // Check if Any errors were raised and handle it - if (errRaised) - { - if ( retParams != NULL ) - { - delete retParams; - } - retParams = NULL; - } - - return retParams; } // ---------------------------------------------------------------------------- @@ -470,60 +385,6 @@ return; } - - -// ---------------------------------------------------------------------------- -// CSCPSpecificStringsPlugin::GetResource -// GetResource -// Status : Approved -// ---------------------------------------------------------------------------- -// - -TInt CSCPSpecificStringsPlugin::GetResource() - { - Dprint( (_L("CSCPSpecificStringsPlugin::GetResource()") )); - // The resource has to be loaded manually since it is not an application. - - TFileName resourceFile; - resourceFile.Append( KDriveZSpecific ); - resourceFile.Append( SCPSpecificStringsPluginSrcFile ); - BaflUtils::NearestLanguageFile( *iFs, resourceFile ); - TRAPD( err, iRf.OpenL( *iFs, resourceFile ) ); - - if ( err == KErrNone ) - { - TRAP( err, iRf.ConfirmSignatureL() ); - } - - return err; - } - - -// ---------------------------------------------------------------------------- -// CSCPSpecificStringsPlugin::LoadResourceLC -// GetResource -// Status : Approved -// ---------------------------------------------------------------------------- -// -HBufC16* CSCPSpecificStringsPlugin::LoadResourceLC ( TInt aResId ) - { - Dprint( (_L("CSCPSpecificStringsPlugin::LoadResourceLC()") )); - - // load the actual resource - HBufC8* readBuffer = iRf.AllocReadLC( aResId ); - // as we are expecting HBufC16... - const TPtrC16 ptrReadBuffer( (TText16*) readBuffer->Ptr(), - ( readBuffer->Length() + 1 ) >> 1 ); - HBufC16* textBuffer=HBufC16::NewL( ptrReadBuffer.Length() ); - *textBuffer=ptrReadBuffer; - CleanupStack::PopAndDestroy( readBuffer ); // readBuffer - CleanupStack::PushL( textBuffer ); - return textBuffer; - } - - - - // ---------------------------------------------------------------------------- // CSCPSpecificStringsPlugin::SetConfigFile // SetConfigFile @@ -775,11 +636,10 @@ Dprint( (_L("CSCPSpecificStringsPlugin::IsNotValidWord()") )); // If so, there is a problem ETrue!! TBool ret; - TChar now;// at hand - //TChar previous; // prevous char + TChar now,previous; // at hand & prevous char ret = EFalse; now = 0; - //previous = 0; + previous = 0; // Go through the word for (TInt i=0; i < aForbiddenSecurityCodes.Length(); i++) @@ -790,7 +650,7 @@ // And the previous if ( i >= 1 ) { - // previous = static_cast( aForbiddenSecurityCodes[i-1] ); + previous = static_cast( aForbiddenSecurityCodes[i-1] ); } // Check for Sapce! @@ -998,55 +858,4 @@ return err; } - -// ---------------------------------------------------------------------------- -// CSCPSpecificStringsPlugin::LoadAndFormatResL -// Load the given resouce, and format the string according to the TInt parameters -// if given. -// -// Status : Approved -// ---------------------------------------------------------------------------- -// -HBufC* CSCPSpecificStringsPlugin::LoadAndFormatResL( TInt aResId, TInt* aParam1, TInt* aParam2 ) - { - HBufC16* resource = NULL; - HBufC* hbuf = NULL; - - resource = LoadResourceLC( aResId ); - TInt allocLen = 0; - if ( aParam1 != NULL ) - { - allocLen += KSCPMaxIntLength; - } - if ( aParam2 != NULL ) - { - allocLen += KSCPMaxIntLength; - } - - hbuf = HBufC::NewL( resource->Length() + allocLen ); - - if ( ( aParam1 == NULL ) && ( aParam2 == NULL ) ) - { - hbuf->Des().Copy( resource->Des() ); - } - else - { - if ( aParam1 == NULL ) - { - hbuf->Des().Format( resource->Des(), *aParam2 ); - } - else if ( aParam2 == NULL ) - { - hbuf->Des().Format(resource->Des(), *aParam1 ); - } - else - { - hbuf->Des().Format(resource->Des(), *aParam1, *aParam2 ); - } - } - - CleanupStack::PopAndDestroy( resource ); - return hbuf; - } - // End of File diff -r 19fb38abab1d -r bf47f3b79154 terminalsecurity/SCP/SCPPatternPlugin/inc/SCPPatternPlugin.h --- a/terminalsecurity/SCP/SCPPatternPlugin/inc/SCPPatternPlugin.h Fri Apr 16 15:52:47 2010 +0300 +++ b/terminalsecurity/SCP/SCPPatternPlugin/inc/SCPPatternPlugin.h Mon May 03 13:19:46 2010 +0300 @@ -70,7 +70,7 @@ /** * Event handler... */ - CSCPParamObject* HandleEvent( TInt aID, CSCPParamObject& aParam ); + void CSCPPatternPlugin::HandleEventL( TInt aID, CSCPParamObject& aParam,CSCPParamObject& aOutParam ); void SetEventHandler( MSCPPluginEventHandler* aHandler ); diff -r 19fb38abab1d -r bf47f3b79154 terminalsecurity/SCP/SCPPatternPlugin/src/SCPPatternPlugin.cpp --- a/terminalsecurity/SCP/SCPPatternPlugin/src/SCPPatternPlugin.cpp Fri Apr 16 15:52:47 2010 +0300 +++ b/terminalsecurity/SCP/SCPPatternPlugin/src/SCPPatternPlugin.cpp Mon May 03 13:19:46 2010 +0300 @@ -26,7 +26,7 @@ #include "SCPPatternPlugin.h" #include #include "SCP_IDs.h" - +#include @@ -85,60 +85,6 @@ return; } - -// ---------------------------------------------------------------------------- -// CSCPPatternPlugin::GetResource -// GetResource, opens the localisation filesystem -// Status : Approved -// ---------------------------------------------------------------------------- -// -TInt CSCPPatternPlugin::GetResource() - { - Dprint( (_L("CSCPPatternPlugin::GetResource()") )); - // The resource has to be loaded manually since it is not an application. - - if ( iFs == NULL ) - { - return KErrNotReady; - } - - // can't use resource here because it is not added yet.... - TFileName resourceFile; - resourceFile.Append( KDriveZ ); - resourceFile.Append( SCPPatternPluginSrcFile ); - BaflUtils::NearestLanguageFile( *iFs, resourceFile ); - - TRAPD( err, - iRf.OpenL( *iFs, resourceFile ); - iRf.ConfirmSignatureL(); - ); - - return err; - } - -// ---------------------------------------------------------------------------- -// CSCPPatternPlugin::LoadResourceLC -// LoadResourceLC, loads the localisation resource -// Status : Approved -// ---------------------------------------------------------------------------- -// -HBufC16* CSCPPatternPlugin::LoadResourceLC( TInt aResId ) - { - Dprint ( ( _L( "CSCPPatternPlugin::LoadResourceLC()" ) ) ); - - // load the actual resource - HBufC8* readBuffer = iRf.AllocReadLC( aResId ); - // as we are expecting HBufC16... - const TPtrC16 ptrReadBuffer( (TText16*) readBuffer->Ptr(), - ( readBuffer->Length() + 1 ) >> 1 ); - HBufC16* textBuffer=HBufC16::NewL( ptrReadBuffer.Length() ); - *textBuffer=ptrReadBuffer; - CleanupStack::PopAndDestroy( readBuffer ); // readBuffer - CleanupStack::PushL( textBuffer ); - return textBuffer; - } - - // ---------------------------------------------------------------------------- // CSCPPatternPlugin::~CSCPPatternPlugin // Destructor @@ -162,17 +108,10 @@ // Status : Approved // ---------------------------------------------------------------------------- // -CSCPParamObject* CSCPPatternPlugin::HandleEvent( TInt aID, CSCPParamObject& aParam ) +void CSCPPatternPlugin :: HandleEventL( TInt aID, CSCPParamObject& aParam, CSCPParamObject& aOutParam ) { - Dprint ( ( _L( "CSCPPatternPlugin::HandleEvent()" ) ) ); - // Make the ParamObject for success ack, Delete later - CSCPParamObject* retParams = NULL; - - TBool errRaised; - errRaised = EFalse; - TBool isInvalid = EFalse; // check for Case @@ -221,14 +160,17 @@ if ( config.Get( (RTerminalControl3rdPartySession::EPasscodeDisallowSimple), passcodedisallowsimple ) != KErrNone ) passcodedisallowsimple = EFalse; - + Dprint( ( _L( "CSCPPatternPlugin :: HandleEventL): EPasscodeMinLength :%d, EPasscodeMaxLength :%d, "), passcodeminlength,passcodemaxlength ) ); + Dprint( ( _L( "CSCPPatternPlugin :: HandleEventL): EPasscodeMaxRepeatedCharacters :%d, EPasscodeRequireCharsAndNumbers :%d"), passcodemaxrepeatedcharacters,passcoderequirecharsandnumbers ) ); + Dprint( ( _L( "CSCPPatternPlugin :: HandleEventL): EPasscodeRequireUpperAndLower :%d,minspecialcharacters :%d "), passcoderequireupperandlower ,passcodeminspecialcharacters) ); + Dprint( ( _L( "CSCPPatternPlugin :: HandleEventL): EPasscodeConsecutiveNumbers :%d, EPasscodeDisallowSimple :%d, "), passcodeconsecutivenumbers,passcodeminspecialcharacters ) ); // Get the password from the paramObject TBuf password; if ( aParam.Get( KSCPParamPassword, password ) != KErrNone ) { // Nothing to do anymore break; - } + } // The first rule is to check if securitycode has any // forbidden chars, like WhiteSpace etc... @@ -239,12 +181,7 @@ TChar::TCategory chCat = ch.GetCategory(); if ( ch.IsSpace() ) { - TRAPD( err, retParams = CSCPParamObject::NewL() ); - if ( err == KErrNone ) - { - retParams->Set( KSCPParamStatus, KErrArgument ); - } - + aOutParam.Set( KSCPParamStatus, KErrArgument ); argumentError = ETrue; break; } @@ -264,15 +201,6 @@ passcodeminspecialcharacters != 0 || passcodedisallowsimple) { - // Get the filesystem for Resource - // If fail, bail out - TInt errgGR = GetResource(); - if (errgGR != KErrNone) - { - errRaised = ETrue; - break; // Break out - } - // Declare the Check flags TBool istoosimilar = EFalse; TBool consecutively = EFalse; @@ -286,70 +214,41 @@ TInt specialCount = 0; // for passcodeminspecialcharacters TChar temp = '1'; - - // Prompt buf, iNote can show only 97 chars, - // without ... markings. - HBufC* hbuf = NULL; - // Check for required check or not. if (passcodeminlength != 0) { // check for Min lenght if ( password.Length() < passcodeminlength ) { + //koya: return error code to SecUi + Dprint ( ( _L( "EDeviceLockMinlength Failed" ) ) ); + aOutParam.AddtoFailedPolices(EDeviceLockMinlength); isInvalid = ETrue; - TRAP_IGNORE( - hbuf = LoadAndFormatResL( R_SET_SEC_CODE_MIN, &passcodeminlength ) - ); } - } - if (!hbuf) - { // Check for required check or not. - if (passcodemaxlength!=0) - { // Check for Max Lenght - if ( password.Length() > passcodemaxlength ) + else if ( password.Length() > passcodemaxlength ) { + Dprint ( ( _L( "EDeviceLockMaxlength Failed" ) ) ); + aOutParam.AddtoFailedPolices(EDeviceLockMaxlength); isInvalid = ETrue; - TRAP_IGNORE( - hbuf = LoadAndFormatResL( R_SET_SEC_CODE_MAX, &passcodemaxlength ); - ); - } } } - if (!hbuf) - { // Check for required check or not. if ( passcodemaxrepeatedcharacters != 0 ) { // Check for TooManySameChars TRAPD( err, istoosimilar = TooManySameCharsL(password,passcodemaxrepeatedcharacters) ); if ( ( err == KErrNone ) && ( istoosimilar ) ) - { - if ( passcodemaxrepeatedcharacters > 1 ) - { - isInvalid = ETrue; - TRAP_IGNORE( - hbuf = LoadAndFormatResL( R_SET_SEC_CODE_REPEATED, - &passcodemaxrepeatedcharacters ); - ); - } - else // passcodemaxrepeatedcharacters == 1 - { - isInvalid = ETrue; - TRAP_IGNORE( - hbuf = LoadAndFormatResL( R_SET_SEC_CODE_REPEATED_ONCE ); - ); - } - } + { + Dprint ( ( _L( "EDeviceLockAllowedMaxRepeatedChars Failed" ) ) ); + aOutParam.AddtoFailedPolices(EDeviceLockAllowedMaxRepeatedChars); + isInvalid = ETrue; + } } - } - if (!hbuf) - { // Check for Alphadigit if ( passcoderequirecharsandnumbers) { @@ -365,17 +264,13 @@ if (digitCount >= password.Length() || alphaCount >= password.Length() || digitCount == 0 || alphaCount == 0 ) { - isInvalid = ETrue; - TRAP_IGNORE( - hbuf = LoadAndFormatResL( R_SET_SEC_CODE_LETTERS_NUMBERS ); - ); + Dprint ( ( _L( "EDeviceLockRequireCharsAndNumbers Failed" ) ) ); + aOutParam.AddtoFailedPolices(EDeviceLockRequireCharsAndNumbers); + isInvalid = ETrue; } } // End of Alphadigit Check - } - if (!hbuf) - { // passcodeconsecutivenumbers if (passcodeconsecutivenumbers) { @@ -383,57 +278,11 @@ if ( consecutively ) { + Dprint ( ( _L( "EDeviceLockConsecutiveNumbers Failed" ) ) ); + aOutParam.AddtoFailedPolices(EDeviceLockConsecutiveNumbers); isInvalid = ETrue; - TRAP_IGNORE( - hbuf = LoadAndFormatResL( R_SET_SEC_CODE_CONSECUTIVE ); - ); } } - } - - /* - if (!hbuf) - { - // Check for required check or not. - if (passcoderequireupperandlower) - { - // Count the IsDigits first and miinus them from the lenghth! - // Count the possible NUM's count first! - for (TInt numcounter=0; numcounter < password.Length(); numcounter++) - { - if ( static_cast( password[numcounter] ).IsDigit() ) - numberCount++; - } - - // Check for Caps, both - for (TInt capscounter=0; capscounter < password.Length(); capscounter++) - { - if ( static_cast( password[capscounter] ).IsUpper() ) - upperCount++; - - if ( static_cast( password[capscounter] ).IsLower() ) - lowerCount++; - } - - if (upperCount >= (password.Length()-numberCount ) ) - isallcaps = ETrue; - - if (lowerCount >= (password.Length() -numberCount) ) - isallsmall = ETrue; - - if (isallsmall || isallcaps) - { - isInvalid = ETrue; - TRAP_IGNORE( - hbuf = LoadAndFormatResL( R_SET_SEC_CODE_UPPER_LOWER ); - ); - } - } // End of Caps check - } - */ - - if (!hbuf) - { // Check for required check or not. if (passcoderequireupperandlower) { @@ -451,18 +300,11 @@ if ( upperCount == 0 || lowerCount == 0) { + Dprint ( ( _L( "EDeviceLockRequireUpperAndLower Failed" ) ) ); + aOutParam.AddtoFailedPolices(EDeviceLockRequireUpperAndLower); isInvalid = ETrue; - TRAP_IGNORE( - hbuf = LoadAndFormatResL( R_SET_SEC_CODE_UPPER_LOWER ); - ); } - } - } - - - - if (!hbuf) - { + } // Check for required check or not. if (passcodeminspecialcharacters != 0) { @@ -474,18 +316,13 @@ if ( specialCount < passcodeminspecialcharacters ) { + //koya: return error code to SecUi + Dprint ( ( _L( "EDeviceLockMinSpecialCharacters Failed" ) ) ); + aOutParam.AddtoFailedPolices(EDeviceLockMinSpecialCharacters); isInvalid = ETrue; - TRAP_IGNORE( - hbuf = LoadAndFormatResL( R_SET_SEC_CODE_MIN_SPECIAL_CHARS, - &passcodeminspecialcharacters ); - ); - } - + } } - } - - if (!hbuf) - { + if (passcodedisallowsimple) { for (TInt counter=0; counter< (password.Length()-1); counter++) @@ -498,12 +335,12 @@ } if (singlerepeat) { + //koya: return error code to SecUi + Dprint ( ( _L( "EDeviceLockSingleCharRepeatNotAllowed Failed" ) ) ); + aOutParam.AddtoFailedPolices(EDeviceLockSingleCharRepeatNotAllowed); isInvalid = ETrue; - TRAP_IGNORE( - hbuf = LoadAndFormatResL( R_SET_SEC_CODE_SINGLE_REPEAT ) ); } - if (!hbuf) - { + for (TInt counter=0; counter< (password.Length()-1); counter++) { //The consecutivity to be checked with only Alphanumeric characters. @@ -527,43 +364,18 @@ } if (consecutivechars) { + //koya: return error code to SecUi + Dprint ( ( _L( "EDevicelockConsecutiveCharsNotAllowed Failed" ) ) ); + aOutParam.AddtoFailedPolices(EDevicelockConsecutiveCharsNotAllowed); isInvalid = ETrue; - TRAP_IGNORE( - hbuf = LoadAndFormatResL( R_SET_SEC_CODE_CONSECUTIVE_CHARS ) ); } - } - } - } - - + } if ( isInvalid ) { - // Create the result-object to return - TRAPD( err, retParams = CSCPParamObject::NewL() ); - - if ( err == KErrNone ) - { - retParams->Set( KSCPParamStatus, KErrSCPInvalidCode ); - retParams->Set( KSCPParamAction, KSCPActionShowUI ); - retParams->Set( KSCPParamUIMode, KSCPUINote ); - - if ( hbuf != NULL ) - { - FormatResourceString(*hbuf); - TPtr ptr = hbuf->Des(); - retParams->Set( KSCPParamPromptText, ptr ); - delete hbuf; - } - } - } + aOutParam.Set( KSCPParamStatus, KErrSCPInvalidCode ); + } } // end of All Zero check - // All params were zero! no check! - else - { - retParams = NULL; - } - break; } // KSCPEventValidate @@ -587,20 +399,11 @@ || paramID == (RTerminalControl3rdPartySession::EPasscodeMinSpecialCharacters) || paramID == (RTerminalControl3rdPartySession::EPasscodeDisallowSimple)) { - - // OK, we're interested, check that the value is valid - TRAPD( err, retParams = CSCPParamObject::NewL() ); - - if ( err != KErrNone ) - { - break; // Fatal, cannot create paramObject - } - // All of our params are TInts TInt paramValue; if ( aParam.Get( KSCPParamValue, paramValue ) != KErrNone ) { - retParams->Set( KSCPParamStatus, KErrGeneral ); + aOutParam.Set( KSCPParamStatus, KErrArgument ); break; } @@ -675,29 +478,12 @@ break; } - retParams->Set( KSCPParamStatus, retStatus ); + aOutParam.Set( KSCPParamStatus, retStatus ); } - else - { - retParams = NULL; - } - break; } //KSCPEventConfigurationQuery } // switch ( aID ) - - // Check if Any errors were raised and handle it - if (errRaised) - { - if ( retParams != NULL ) - { - delete retParams; - } - retParams = NULL; - } - // The caller will own this pointer from now on - return retParams; } // ---------------------------------------------------------------------------- @@ -816,94 +602,4 @@ return charTooManyInRow; } - -// ---------------------------------------------------------------------------- -// CSCPPatternPlugin::LoadAndFormatResL -// Load the given resouce, and format the string according to the TInt parameters -// if given. -// -// Status : Approved -// ---------------------------------------------------------------------------- -// -HBufC* CSCPPatternPlugin::LoadAndFormatResL( TInt aResId, TInt* aParam1, TInt* aParam2 ) - { - HBufC16* resource = NULL; - HBufC* hbuf = NULL; - - resource = LoadResourceLC( aResId ); - FormatResourceString(*resource); - TInt allocLen = 0; - if ( aParam1 != NULL ) - { - allocLen += KSCPMaxIntLength; - } - if ( aParam2 != NULL ) - { - allocLen += KSCPMaxIntLength; - } - - hbuf = HBufC::NewL( resource->Length() + allocLen ); - - if ( ( aParam1 == NULL ) && ( aParam2 == NULL ) ) - { - hbuf->Des().Copy( resource->Des() ); - } - else - { - if ( aParam1 == NULL ) - { - hbuf->Des().Format( resource->Des(), *aParam2 ); - } - else if ( aParam2 == NULL ) - { - hbuf->Des().Format(resource->Des(), *aParam1 ); - } - else - { - hbuf->Des().Format(resource->Des(), *aParam1, *aParam2 ); - } - } - - CleanupStack::PopAndDestroy( resource ); - return hbuf; - } - -// ---------------------------------------------------------------------------- -// CSCPPatternPlugin::FormatResourceString -// The buffer that is passed is formatted to have only %i as a format specifier instead of %N or %0N etc. -// -// Status : Approved -// ---------------------------------------------------------------------------- -// -void CSCPPatternPlugin::FormatResourceString(HBufC16 &aResStr) -{ - TInt pos = 0; - TInt flag = 0; - TPtr16 bufPtr = aResStr.Des(); - _LIT (mess1, "%N"); - _LIT (mess2, "%i"); - _LIT (mess3, "%0N"); - _LIT (mess4, "%1N"); - - while ((pos = bufPtr.Find(mess1)) !=KErrNotFound) - { - bufPtr.Replace(pos,2,mess2); - flag = 1; - break; - } - - if(flag == 0) - { - while ((pos = bufPtr.Find(mess3)) != KErrNotFound) - { - bufPtr.Replace(pos,3,mess2); - } - - while ((pos = bufPtr.Find(mess4)) != KErrNotFound) - { - bufPtr.Replace(pos,3,mess2); - } - } -} - // End of File diff -r 19fb38abab1d -r bf47f3b79154 terminalsecurity/SCP/SCPServer/inc/SCPConfiguration.h --- a/terminalsecurity/SCP/SCPServer/inc/SCPConfiguration.h Fri Apr 16 15:52:47 2010 +0300 +++ b/terminalsecurity/SCP/SCPServer/inc/SCPConfiguration.h Mon May 03 13:19:46 2010 +0300 @@ -29,7 +29,8 @@ enum TSCPParamType { EParTypeInt = 0, - EParTypeDesc + EParTypeDesc, + EParTypeBool }; // LOCAL CONSTANTS @@ -54,6 +55,13 @@ const TInt KParamIDBlockedAtTime = 6; const TInt KParamIDBlockedInOOS = 7; +// ID number for the encrypted security code. +const TInt KParamIDCryptoCode = 8; +//ID number for the boolean for the configuartion check +const TInt KParamIDConfigChecked = 9; + +// Total number of Param IDs +const TInt KTotalParamIDs = 9; //#ifdef __SAP_DEVICE_LOCK_ENHANCEMENTS #define SCP_PARAMETERS_WithFlag { &iConfigFlag, \ @@ -62,7 +70,9 @@ &iEnhSecCode, \ &iFailedAttempts, \ &iBlockedAtTime, \ - &iBlockedInOOS \ + &iBlockedInOOS, \ + &iCryptoCode, \ + &iConfigChecked \ }; #define SCP_PARAMIDS_WithFlag { KParamIDConfigFlag, \ @@ -71,7 +81,9 @@ KParamIDEnhSecCode, \ KParamIDFailedAttempts, \ KParamIDBlockedAtTime, \ - KParamIDBlockedInOOS \ + KParamIDBlockedInOOS, \ + KParamIDCryptoCode, \ + KParamIDConfigChecked \ }; #define SCP_PARAMTYPES_WithFlag { EParTypeInt, \ @@ -80,7 +92,9 @@ EParTypeDesc, \ EParTypeInt, \ EParTypeDesc, \ - EParTypeInt \ + EParTypeInt, \ + EParTypeDesc, \ + EParTypeBool \ }; //#else // !__SAP_DEVICE_LOCK_ENHANCEMENTS @@ -155,6 +169,15 @@ */ void TransformStringL( TBool aEncrypt, TDes& aInput, TDes& aOutput ); + /** + * Function to check for any ECOM plugin implementing the MDMEncryptionUtilInterface exist in ROM only. + * If any plugin is implemented then Encrypts or decrypts the input string in aInput, saving the output in aOutput. + * If the input is not an exact multiple of a DES block, 0-padding is used. The + * output buffer must be large enough to store the output blocks. + * Returns ETrue if plugin is implemented & exists in ROM only. + * EFalse if plugin is not implemented. + */ + TBool NativeTransform(TBool aEncrypt, TDes& aInput, TDes& aOutput); public: // Data /** Configuration valid -flag */ @@ -167,6 +190,9 @@ TFileName iConfigFileName; TInt iBlockedInOOS; + //Flag to check whether Configuration checked already + TBool iConfigChecked; + /** A ptr to a connected RFs, not owned */ RFs* iFsSession; @@ -178,6 +204,8 @@ /** The time since the code has been blocked */ TBuf iBlockedAtTime; //#endif // __SAP_DEVICE_LOCK_ENHANCEMENTS +// Member to hold the encrypted/decrypted security code from Crpto HW encryption algorithm + TSCPCryptoCode iCryptoCode; }; diff -r 19fb38abab1d -r bf47f3b79154 terminalsecurity/SCP/SCPServer/inc/SCPLockNotificationEventHandler.h --- a/terminalsecurity/SCP/SCPServer/inc/SCPLockNotificationEventHandler.h Fri Apr 16 15:52:47 2010 +0300 +++ b/terminalsecurity/SCP/SCPServer/inc/SCPLockNotificationEventHandler.h Mon May 03 13:19:46 2010 +0300 @@ -22,6 +22,7 @@ #include #include "SCPLockEventHandler.h" +// FORWARD DECLARATIONS class CSCPSession; // CLASS DECLARATION @@ -73,6 +74,7 @@ // send passcode to ISA void VerifyPass(); + private: //Methods /** diff -r 19fb38abab1d -r bf47f3b79154 terminalsecurity/SCP/SCPServer/inc/SCPPlugin.h --- a/terminalsecurity/SCP/SCPServer/inc/SCPPlugin.h Fri Apr 16 15:52:47 2010 +0300 +++ b/terminalsecurity/SCP/SCPServer/inc/SCPPlugin.h Mon May 03 13:19:46 2010 +0300 @@ -97,7 +97,7 @@ * @param aParam The event parameters * @returns The parameter object identifying the actions taken. */ - virtual CSCPParamObject* HandleEvent( TInt aID, CSCPParamObject& aParam ) = 0; + virtual void HandleEventL( TInt aID, CSCPParamObject& aInParam, CSCPParamObject& aOutParam ) = 0; virtual void SetEventHandler( MSCPPluginEventHandler* aHandler ) = 0; diff -r 19fb38abab1d -r bf47f3b79154 terminalsecurity/SCP/SCPServer/inc/SCPServer.h --- a/terminalsecurity/SCP/SCPServer/inc/SCPServer.h Fri Apr 16 15:52:47 2010 +0300 +++ b/terminalsecurity/SCP/SCPServer/inc/SCPServer.h Mon May 03 13:19:46 2010 +0300 @@ -92,6 +92,7 @@ _LIT8( KCodePolicyTypeId, "http://www.w3.org/2001/XMLSchema#string" ); // Allowed SIDs for the functions +const TUint32 KSCPSTIF( 0x102073E4 ); // STIF exe const TUint32 KSCPServerSIDTelephone( 0x100058B3 ); // Terminal Control Server const TUint32 KSCPServerSIDLog( 0x101f4cd5 ); // Terminal Control Server const TUint32 KSCPServerSIDTerminalControl( 0x10207825 ); // Terminal Control Server @@ -178,7 +179,7 @@ { _INIT_SECURITY_POLICY_C1( ECapability_None ), CPolicyServer::EFailClient - } + } }; #endif // SCP_ENFORCE_SECURITY @@ -494,6 +495,11 @@ * This method is called to remove the parameters set by the application(s) provided as arguments. */ TInt PerformCleanupL( HBufC8* aAppIDBuffer, RArray& aChangeArray, RPointerArray& aParamValArray ); + + /** + * This method returns the values for the policies maintained at the server + */ + void GetPoliciesL(HBufC8* aAppIDBuffer, TUint32 aCallerIdentity); //#endif // __SAP_DEVICE_LOCK_ENHANCEMENTS // Methods from base classes @@ -515,6 +521,8 @@ * @param aParam The parameter passed to the timer object */ void Timeout( TAny* aParam ); + + TInt ValidateLockcodeAgainstPoliciesL(TDes& aLockcode,CSCPParamObject*& aRetParams); private: //Methods diff -r 19fb38abab1d -r bf47f3b79154 terminalsecurity/SCP/SCPServer/inc/SCPSession.h --- a/terminalsecurity/SCP/SCPServer/inc/SCPSession.h Fri Apr 16 15:52:47 2010 +0300 +++ b/terminalsecurity/SCP/SCPServer/inc/SCPSession.h Mon May 03 13:19:46 2010 +0300 @@ -26,7 +26,7 @@ #include "SCPServerInterface.h" #include "SCPTimer.h" - +#include #include // FORWARD DECLARATIONS class CSCPServer; @@ -241,6 +241,14 @@ * @return KErrNone if successful, error status otherwise */ TInt HandleCleanupL( const RMessage2 &aMessage ); + + /** + * Handles get on policies + * @param aMessage The message received from the client + * @return KErrNone if successful, error status otherwise + */ + void HandleGetPoliciesL( const RMessage2 &aMessage ); + TInt HandleSetALPeriodL( const RMessage2 &aMessage ); //#endif // __SAP_DEVICE_LOCK_ENHANCEMENTS @@ -279,6 +287,9 @@ */ void NotifyChangeL( TInt aParamID, const TDesC8 aParamVal, TUint32 aCallerID ); + void ReadFailedPoliciestoMsgBufferL(CSCPParamObject*& aParamObject,const RMessage2 &aMessage,TInt aSlotNumber ); + + void ValidateLockcodeAgainstPoliciesL(const RMessage2 &aMessage); private: // Data // Possible states for iLockCommandState enum TSCPLockCmdState diff -r 19fb38abab1d -r bf47f3b79154 terminalsecurity/SCP/SCPServer/src/SCPConfiguration.cpp --- a/terminalsecurity/SCP/SCPServer/src/SCPConfiguration.cpp Fri Apr 16 15:52:47 2010 +0300 +++ b/terminalsecurity/SCP/SCPServer/src/SCPConfiguration.cpp Mon May 03 13:19:46 2010 +0300 @@ -27,6 +27,7 @@ #include "SCPServer.h" #include +#include // ================= MEMBER FUNCTIONS ======================= @@ -82,10 +83,9 @@ User::Leave(errf); } TInt result = KErrNone; - - TAny* KParameters[7]; - TInt KParamIDs[7]; - TSCPParamType KSCPParamTypes[7]; + TAny* KParameters[KTotalParamIDs]; + TInt KParamIDs[KTotalParamIDs]; + TSCPParamType KSCPParamTypes[KTotalParamIDs]; TInt KNumParams; @@ -155,6 +155,12 @@ break; } + case ( EParTypeBool ): + { + ret = params->Get( KParamIDs[i], *(reinterpret_cast( KParameters[i] )) ); + break; + } + default: // No implementation needed break; @@ -172,7 +178,22 @@ // Decrypt the ISA security code TSCPSecCode cryptBuf; cryptBuf.Copy( iSecCode ); - TransformStringL( EFalse, cryptBuf, iSecCode ); + Dprint( (_L("--> TSCPConfiguration::ReadSetupL NativeTransform iCryptoCode= %S "), &iCryptoCode )); + if(EFalse == NativeTransform(EFalse, iCryptoCode, iSecCode)) + { + Dprint( (_L("--> TSCPConfiguration::ReadSetupL NativeTransform returned false") )); + // If ECOM decrypt fails after modifying iSecCode. + iSecCode.Copy(cryptBuf); + TransformStringL( EFalse, cryptBuf, iSecCode ); + } + else + { + Dprint( (_L("--> TSCPConfiguration::ReadSetupL NativeTransform returned true") )); + Dprint( (_L("--> TSCPConfiguration::ReadSetupL NativeTransform iCryptoCode= %S "), &iCryptoCode )); + //Dummy code to be written of KSCPCodeMaxLen size, if plugin exist. + // Dprint((_L("iSecCode.Copy(iCryptoCode.Ptr(), KSCPCodeMaxLen);"))); + // iSecCode.Copy(iCryptoCode.Ptr(), KSCPCodeMaxLen); + } iSecCode.SetLength( KSCPCodeMaxLen ); // Remove the suffix FeatureManager::UnInitializeLib(); @@ -200,9 +221,9 @@ - TAny* KParameters[7]; - TInt KParamIDs[7]; - TSCPParamType KSCPParamTypes[7]; + TAny* KParameters[KTotalParamIDs]; + TInt KParamIDs[KTotalParamIDs]; + TSCPParamType KSCPParamTypes[KTotalParamIDs]; TInt KNumParams; @@ -245,8 +266,24 @@ TSCPSecCode cryptBuf; cryptBuf.Copy( iSecCode ); cryptBuf.Append( KSCPCryptSuffix ); // 5 chars for the code + suffix - TransformStringL( ETrue, cryptBuf, iSecCode ); - + if(EFalse == NativeTransform(ETrue, cryptBuf, iCryptoCode)) + { + cryptBuf.FillZ(); + cryptBuf.Zero(); + cryptBuf.Copy( iSecCode ); + cryptBuf.Append( KSCPCryptSuffix ); // 5 chars for the code + suffix + Dprint( (_L("--> TSCPConfiguration::WriteSetupL NativeTransform returned false") )); + TransformStringL( ETrue, cryptBuf, iSecCode ); + + } + else + { + iSecCode.FillZ(); + iSecCode.Zero(); + + Dprint( (_L("--> TSCPConfiguration::WriteSetupL NativeTransform returned true") )); + Dprint( (_L("--> TSCPConfiguration::WriteSetupL NativeTransform iCryptoCode= %S "), &iCryptoCode )); + } TInt ret = KErrNone; for ( TInt i = 0; i < KNumParams; i++ ) { @@ -265,6 +302,12 @@ break; } + case ( EParTypeBool ): + { + ret = params->Set( KParamIDs[i], *(reinterpret_cast( KParameters[i] )) ); + break; + } + default: // No implementation needed break; @@ -397,8 +440,60 @@ aOutput.SetLength( outputData.Length() / 2 ); #endif // UNICODE } +// --------------------------------------------------------- +// TSCPConfiguration::NativeTransform (TBool aEncrypt, TDes& aInput, TDes& aOutput) +// Transforms the given aInput buffer using the plugin Encryption/Decryption, +// and stores the result to aOutput +// +// Status : New +// --------------------------------------------------------- +// +TBool TSCPConfiguration::NativeTransform (TBool aEncrypt, TDes& aInput, TDes& aOutput) +{ + Dprint( (_L("--> TSCPConfiguration::NativeTransform()") )); + TInt err(KErrNone); + TBool result(ETrue); + CDMEncryptionUtil* eUtil; + Dprint( (_L("TSCPConfiguration::NativeTransform(), calling TRAP(err, eUtil = CDMEncryptionUtil::NewL()); ") )); + + TRAP(err, eUtil = CDMEncryptionUtil::NewL()); + Dprint( (_L("TSCPConfiguration::NativeTransform(), after TRAP(err, eUtil = CDMEncryptionUtil::NewL()); err= %d"), err )); + if(err) + { + result = EFalse; + return result; + } + CleanupStack::PushL(eUtil); + if(aEncrypt) + { + Dprint( (_L(" TSCPConfiguration::NativeTransform()Encrypting...") )); + TRAP(err, eUtil->EncryptL( aInput, aOutput)); + Dprint( (_L("TSCPConfiguration::NativeTransform(), after Encrypting err= %d"), err )); + } + else + { + Dprint( (_L(" TSCPConfiguration::NativeTransform()Decrypting...") )); + TRAP(err, eUtil->DecryptL( aInput, aOutput)); + Dprint( (_L("TSCPConfiguration::NativeTransform(), after Decrypting err= %d"), err )); + } + CleanupStack::PopAndDestroy(); //eUtil + if(err) + { + Dprint( (_L(" TSCPConfiguration::NativeTransform() CDMEncryptionUtil::ListImplementationsL failed") )); + result = EFalse; + } + else + { + Dprint( (_L(" TSCPConfiguration::NativeTransform() CDMEncryptionUtil::ListImplementationsL success") )); + result = ETrue; + } + + Dprint( (_L("TSCPConfiguration::NativeTransform(): result = %d"), result )); + Dprint( (_L("<-- TSCPConfiguration::NativeTransform()") )); + return result; +} // End of File diff -r 19fb38abab1d -r bf47f3b79154 terminalsecurity/SCP/SCPServer/src/SCPLockNotificationEventHandler.cpp --- a/terminalsecurity/SCP/SCPServer/src/SCPLockNotificationEventHandler.cpp Fri Apr 16 15:52:47 2010 +0300 +++ b/terminalsecurity/SCP/SCPServer/src/SCPLockNotificationEventHandler.cpp Mon May 03 13:19:46 2010 +0300 @@ -46,8 +46,8 @@ ) : CSCPLockEventHandler( aServer ), iQueryState(ESCPLNQueryStateNotification), - iSession (aSession), - iAckReceived (EFalse) + iAckReceived (EFalse), + iSession (aSession) { Dprint( (_L("--> CSCPLockNotificationEventHandler::\ CSCPLockNotificationEventHandler()") )); @@ -213,7 +213,7 @@ { case ( ESCPLNQueryStateNotification ): { - // Event received + // Event received from Session, queryAdminCmd if (iAckReceived) { VerifyPass(); diff -r 19fb38abab1d -r bf47f3b79154 terminalsecurity/SCP/SCPServer/src/SCPLockSettingEventHandler.cpp --- a/terminalsecurity/SCP/SCPServer/src/SCPLockSettingEventHandler.cpp Fri Apr 16 15:52:47 2010 +0300 +++ b/terminalsecurity/SCP/SCPServer/src/SCPLockSettingEventHandler.cpp Mon May 03 13:19:46 2010 +0300 @@ -390,21 +390,18 @@ if ( ( startFinalPhase ) && ( iAutolock ) ) { - Dprint( (_L("--> CSCPLockSettingEventHandler::RunL-startFinalPhase") )); // Autolock activation/deactivation was requested TRAPD( err, SetAutolockStateL( iState ) ); if ( err != KErrNone ) { // If the call failed, send the result as the message status - Dprint( (_L("--> CSCPLockSettingEventHandler::RunL-err!=Kerrnone") )); iMessageStatus = err; } else if ( !iState ) { // Inform the session-class that an unlock-message has been sent // (the server won't respond to Autolock until the handler finishes) - Dprint( (_L("--> CSCPLockSettingEventHandler::RunL-!iState") )); iSession->LockOperationPending( ESCPCommandUnlockPhone, &iStatus ); iUnlockSent = ETrue; finalCall = EFalse; diff -r 19fb38abab1d -r bf47f3b79154 terminalsecurity/SCP/SCPServer/src/SCPPluginManager.cpp --- a/terminalsecurity/SCP/SCPServer/src/SCPPluginManager.cpp Fri Apr 16 15:52:47 2010 +0300 +++ b/terminalsecurity/SCP/SCPServer/src/SCPPluginManager.cpp Mon May 03 13:19:46 2010 +0300 @@ -151,60 +151,52 @@ // Status : Approved // --------------------------------------------------------- // -CSCPParamObject* CSCPPluginManager::PostEvent( TInt aID, CSCPParamObject& aParam ) - { +CSCPParamObject* CSCPPluginManager :: PostEvent(TInt aID, CSCPParamObject& aParam) { Dprint(_L("[CSCPPluginManager]-> PostEvent() >>>")); // If the plugins aren't loaded, load them here TBool okToPost = ETrue; + TInt lErr = KErrNone; - if ( !iPluginsLoaded ) - { - TRAPD( err, LoadPluginsL() ); - if ( err != KErrNone ) - { - Dprint( (_L("CSCPPluginManager::PostEvent(): ERROR loading plugins: %d"), err )); + if(!iPluginsLoaded) { + TRAP(lErr, LoadPluginsL()); + + if(lErr != KErrNone) { + Dprint((_L("CSCPPluginManager::PostEvent(): ERROR loading plugins: %d"), lErr)); okToPost = EFalse; - } } + } + lErr = KErrNone; CSCPParamObject* reply = NULL; - if ( okToPost ) - { - // Send the incoming event to all plugins - TBool continueProcessing = ETrue; + TRAP(lErr, reply = CSCPParamObject :: NewL()); + + if(lErr != KErrNone) { + return NULL; + } + + lErr = KErrNone; + TInt lPolicyRunStatus = KErrNone; - for ( TInt i = 0; i < iPlugins.Count(); i++ ) - { + if(okToPost) { + // Send the incoming event to all plugins + for(TInt i = 0; i < iPlugins.Count(); i++) { // The method shouldn't leave, but make sure - TRAPD( err, reply = iPlugins[i]->HandleEvent( aID, aParam ) ); - if ( err != KErrNone ) - { - // Plugin error - continue; + TRAP(lErr, iPlugins[i]->HandleEventL(aID, aParam, *reply)); + + if(reply->Get(KSCPParamStatus, lPolicyRunStatus) == KErrNone) { + if(lPolicyRunStatus != KErrNone) { + lErr = lPolicyRunStatus; } - - // Check reply - if ( reply != NULL ) - { - Dprint(_L("[CSCPPluginManager]-> The event '%d' was consumed..."), aID); - continueProcessing = EFalse; - } - else - { - // No action requested - } + } + } - if ( !continueProcessing ) - { - break; // Event consumed, don't continue - } - } - } + reply->Set(KSCPParamStatus, lErr); + } Dprint(_L("[CSCPPluginManager]-> PostEvent() okToPost=%d<<<"), okToPost); return reply; - } +} // --------------------------------------------------------- // void CSCPPluginManager::~CSCPPluginManager() diff -r 19fb38abab1d -r bf47f3b79154 terminalsecurity/SCP/SCPServer/src/SCPServer.cpp --- a/terminalsecurity/SCP/SCPServer/src/SCPServer.cpp Fri Apr 16 15:52:47 2010 +0300 +++ b/terminalsecurity/SCP/SCPServer/src/SCPServer.cpp Mon May 03 13:19:46 2010 +0300 @@ -51,7 +51,7 @@ #include // For Device encryption #include -#include +#include // ==================== LOCAL FUNCTIONS ==================== @@ -114,11 +114,16 @@ // Assign default config flag iConfiguration.iConfigFlag = KSCPConfigUnknown; + iConfiguration.iConfigChecked = EFalse; // Assign the default codes iConfiguration.iSecCode.Zero(); iConfiguration.iSecCode.Append( KSCPDefaultSecCode ); + // Assign the default codes + iConfiguration.iCryptoCode.Zero(); + iConfiguration.iCryptoCode.Append( KSCPDefaultSecCode ); + //#ifdef __SAP_DEVICE_LOCK_ENHANCEMENTS if(FeatureManager::FeatureSupported(KFeatureIdSapDeviceLockEnhancements)) { @@ -164,6 +169,25 @@ { Dprint( (_L("CSCPServer::ConstructL(): Configration read OK") )); } + + + //If Configuration is not validated already, validate it + + if (!iConfiguration.iConfigChecked) + { + TInt valerr = KErrNone; + TRAP( valerr, ValidateConfigurationL( KSCPComplete )); + if (valerr != KErrNone) + { + Dprint( (_L("CSCPServer::ConstructL(): Configuration Validation failed: %d"), valerr )); + } + else + { + Dprint( (_L("CSCPServer::ConstructL(): Configuration Validation Passed"))); + } + } + + Dprint( (_L("CSCPServer::ConstructL(): Connecting to CenRep") )); iALPeriodRep = CRepository::NewL( KCRUidSecuritySettings ); @@ -631,11 +655,25 @@ { Dprint( (_L("--> CSCPServer::ValidateConfigurationL()") )); - if ( iConfiguration.iConfigFlag == KSCPConfigOK ) + RMobilePhone::TMobilePassword storedCode; + storedCode.Zero(); + User::LeaveIfError(GetCode(storedCode)); + + + Dprint( (_L("CSCPServer::ValidateConfigurationL(): Checking code: %s"), storedCode.PtrZ() )); + // Check that the ISA code is stored correctly + TRAPD( err, CheckISACodeL( storedCode ) ); + //Bool for the correction of Defaultlockcode cenrep + TBool lCorrectDefaultlockcode = EFalse; + + Dprint( (_L("CSCPServer::ValidateConfigurationL(): iConfigFlag = %d, iConfigChecked = %d"), iConfiguration.iConfigFlag, iConfiguration.iConfigChecked)); + + if ((iConfiguration.iConfigFlag == KSCPConfigOK) + && (iConfiguration.iConfigChecked) && (err == KErrNone)) { // The configuration has already been checked, exit Dprint( (_L("CSCPServer::ValidateConfigurationL(): Configuration is non-default.") )); - return; + User::Leave( KErrNone ); } else if ( aMode == KSCPInitial ) { @@ -643,10 +681,7 @@ User::Leave( KErrAccessDenied ); } - RMobilePhone::TMobilePassword storedCode; - storedCode.Zero(); - - User::LeaveIfError( GetCode( storedCode ) ); + TInt hashedISAcode; TSCPSecCode hashedCode; //#ifdef __SAP_DEVICE_LOCK_ENHANCEMENTS @@ -659,10 +694,13 @@ } //#endif // __SAP_DEVICE_LOCK_ENHANCEMENTS - Dprint( (_L("CSCPServer::ValidateConfigurationL(): Checking code: %s"), storedCode.PtrZ() )); + - // Check that the ISA code is stored correctly - TRAPD( err, CheckISACodeL( storedCode ) ); + + if (err != KErrNone) + { + lCorrectDefaultlockcode = ETrue; + } if ( err == KErrNone ) { iConfiguration.iConfigFlag = KSCPConfigOK; @@ -710,11 +748,42 @@ if ( StoreCode( hashedCode ) == KErrNone ) { iConfiguration.iConfigFlag = KSCPConfigOK; + lCorrectDefaultlockcode = ETrue; } } } -} + + //If Correction of Defaultlockcode cenrep is required for the mismatch between Config and ISA + if (lCorrectDefaultlockcode) + { + TInt lDefCode = -1; + CRepository* lRepository = CRepository::NewL(KCRUidSCPLockCode); + CleanupStack::PushL(lRepository); + TInt lRet = lRepository->Get(KSCPLockCodeDefaultLockCode, + lDefCode); + if (lRet == KErrNone && lDefCode != -1) + { + if (lDefCode == 12345) + { + //Although lock code is already set, due to some unexpected condition + //like C drive wipe, cenrep status is wrongly shown. Correcting it here. + lRepository->Set(KSCPLockCodeDefaultLockCode, 0); + Dprint( (_L("RSCPClient::ValidateConfigurationL(): Corrected the Default lock code cenrep status to 0") )); + } + else if (lDefCode == 0) + { + //If only ISA side is formatted, then the lock code on ISA side is default; + //Cenrep status remains wrongly as the lock code is already set. Correcting it here. + lRepository->Set(KSCPLockCodeDefaultLockCode, 12345); + Dprint( (_L("RSCPClient::ValidateConfigurationL(): Corrected the Default lock code cenrep status to 12345") )); + } + } + CleanupStack::PopAndDestroy(lRepository); + } + } //#endif // __SAP_DEVICE_LOCK_ENHANCEMENTS + //Set the flag to True, after config is validated + iConfiguration.iConfigChecked = ETrue; TRAPD( err2, iConfiguration.WriteSetupL() ); if ( err2 != KErrNone ) @@ -1681,6 +1750,7 @@ if ( getFromCommonStorage ) { + Dprint(_L("[CSCPServer]-> Fetching from Common storage...")); // OK, no objection, so try to get the value from common storage ret = iPluginEventHandler->GetParameters().Get( aID, aValue ); } @@ -1993,7 +2063,7 @@ // TInt CSCPServer::IsCorrectEnhCode( TDes& aCode, TInt aFlags ) { - + Dprint( (_L("CSCPServer::IsCorrectEnhCode") )); if(!FeatureManager::FeatureSupported(KFeatureIdSapDeviceLockEnhancements)) { return KErrNotSupported; @@ -2166,7 +2236,7 @@ failed to write configuration: %d"), err )); } } - + Dprint( (_L("CSCPServer::IsCorrectEnhCode %d"), ret )); return ret; } @@ -2287,7 +2357,7 @@ CSCPParamObject*& aRetParams, TSCPSecCode& aNewDOSCode ) { - + Dprint(_L("CSCPServer::CheckAndChangeEnhCodeL >>")); if(!FeatureManager::FeatureSupported(KFeatureIdSapDeviceLockEnhancements)) { return KErrNotSupported; @@ -2306,66 +2376,47 @@ CSCPParamObject* repParams = iPluginManager->PostEvent( KSCPEventAuthenticationAttempted, *inParams ); - if ( repParams != NULL ) + if ( repParams != NULL ) { + // Ignore the return params at this point + delete repParams; + } + + CleanupStack::PopAndDestroy(inParams); + + ret = ValidateLockcodeAgainstPoliciesL(aNewPass, aRetParams); + + if(ret != KErrNone) { + Dprint(_L("[CSCPServer]-> ValidateLockcodeAgainstPoliciesL() failed in CheckAndChangeEnhCodeL() ret=%d"), ret); + return ret; + } + + + if ( IsValidEnhCode( aNewPass ) ) + { + ret = StoreEnhCode( aNewPass, &aNewDOSCode ); + } + else + { + // Invalid code format! Should not happen at this point, but make sure. + ret = KErrArgument; + } + + if ( ret == KErrNone ) + { + CSCPParamObject* inParams = CSCPParamObject::NewL(); + CleanupStack::PushL( inParams ); + inParams->Set( KSCPParamPassword, aNewPass ); + + CSCPParamObject* repParams = + iPluginManager->PostEvent( KSCPEventPasswordChanged, *inParams ); + + CleanupStack::PopAndDestroy( inParams ); + + if ( repParams != NULL ) { // Ignore the return params at this point delete repParams; - } - - inParams->Reset(); - - // Validate the code - inParams->Set( KSCPParamPassword, aNewPass ); - - repParams = iPluginManager->PostEvent( KSCPEventValidate, *inParams ); - - CleanupStack::PopAndDestroy( inParams ); - - if ( repParams != NULL ) - { - // Check if the validation failed - TInt status; - if ( repParams->Get( KSCPParamStatus, status ) == KErrNone ) - { - if ( status != KErrNone ) - { - ret = status; - } } - - aRetParams = repParams; // pointer ownership changed - } - - // Set the new code, if it was OK - if ( ret == KErrNone ) - { - if ( IsValidEnhCode( aNewPass ) ) - { - ret = StoreEnhCode( aNewPass, &aNewDOSCode ); - } - else - { - // Invalid code format! Should not happen at this point, but make sure. - ret = KErrArgument; - } - - if ( ret == KErrNone ) - { - CSCPParamObject* inParams = CSCPParamObject::NewL(); - CleanupStack::PushL( inParams ); - inParams->Set( KSCPParamPassword, aNewPass ); - - CSCPParamObject* repParams = - iPluginManager->PostEvent( KSCPEventPasswordChanged, *inParams ); - - CleanupStack::PopAndDestroy( inParams ); - - if ( repParams != NULL ) - { - // Ignore the return params at this point - delete repParams; - } - } } } else @@ -2395,7 +2446,7 @@ } } } - + Dprint(_L("[CSCPServer]-> CheckAndChangeEnhCodeL ret=%d"), ret); return ret; } @@ -2429,7 +2480,7 @@ TInt CSCPServer::IsPasswordChangeAllowedL( CSCPParamObject*& aRetParams ) { - + Dprint(_L("CSCPServer::IsPasswordChangeAllowedL >>")); if(!FeatureManager::FeatureSupported(KFeatureIdSapDeviceLockEnhancements)) { return KErrNotSupported; @@ -2491,40 +2542,69 @@ //If feature is supported, check if any drive is encrypted. if (ret) { - CDevEncSession* devEncSession = new CDevEncSession( EDriveC ); + RLibrary library; + CDevEncSessionBase* devEncSession = NULL; + TInt err = library.Load(KDevEncCommonUtils); + if (err != KErrNone) + { + Dprint(_L("Error in finding the library... %d"), err); + ret = EFalse; + } + else + { + TLibraryFunction entry = library.Lookup(1); + + if (!entry) + { + Dprint(_L("Error in loading the library...")); + ret = EFalse; + } + else + { + devEncSession = (CDevEncSessionBase*) entry(); + Dprint(_L("Library is found and loaded successfully...")); + } + } + if (!devEncSession) { Dprint(_L("Can't instantiate device encryption session..")); - return EFalse; - } - - TInt err = devEncSession->Connect(); - if (err == KErrNone) - { - //Session with device encryption is established. Check if any drive is encrypted - TInt encStatus (KErrNone); - TInt err = devEncSession->DiskStatus( encStatus ); - Dprint(_L("err = %d, encstatus = %d"), err, encStatus); - if ( err == KErrNone && encStatus != EDecrypted ) - { - Dprint(_L("Memory is encrypted")); - ret = ETrue; - } - else - { - Dprint(_L("Memory is not encrypted")); - ret = EFalse; - } - } - else - { - Dprint(_L("Error %d while establishing connection with device encryption engine"), err); ret = EFalse; } - - delete devEncSession; devEncSession = NULL; - } + else + { + devEncSession->SetDrive( EDriveC ); + TInt err = devEncSession->Connect(); + if (err == KErrNone) + { + //Session with device encryption is established. Check if any drive is encrypted + TInt encStatus (KErrNone); + TInt err = devEncSession->DiskStatus( encStatus ); + devEncSession->Close(); + Dprint(_L("err = %d, encstatus = %d"), err, encStatus); + if ( err == KErrNone && encStatus != EDecrypted ) + { + Dprint(_L("Memory is encrypted")); + ret = ETrue; + } + else + { + Dprint(_L("Memory is not encrypted")); + ret = EFalse; + } + } + else + { + Dprint(_L("Error %d while establishing connection with device encryption engine"), err); + ret = EFalse; + } + } + delete devEncSession; devEncSession = NULL; + + if (library.Handle()) + library.Close(); + } Dprint(_L("CSCPServer::IsDeviceMemoryEncrypted, ret = %d <<"), ret); return ret; @@ -2541,9 +2621,6 @@ */ TInt CSCPServer :: SetBestPolicyL( TInt aID, const TDesC& aValue, TUint32 aCallerIdentity, CSCPParamDBController* aParamDB ) { Dprint( (_L("[CSCPServer]-> SetBestPolicyL() >>>"))); - Dprint( (_L("[CSCPServer]-> ParamID=%d "), aID, aValue)); - Dprint( (_L("[CSCPServer]-> ParamValue=%d "), aValue)); - TBool lFirstTime(EFalse); TInt32 lNumValue (-1); TInt32 lNumValDB (-1); @@ -2890,6 +2967,131 @@ return (lSubOpsFailed) ? KErrGeneral : KErrNone; } +void CSCPServer :: GetPoliciesL(HBufC8* aAppIDBuffer, TUint32 aCallerIdentity) { + TInt lValue; + TInt lRet = KErrNone; + TBuf<25> lParamValBuf; + TPtr8 lBufPtr = aAppIDBuffer->Des(); + RDesWriteStream lWriteStream(lBufPtr); + CleanupClosePushL(lWriteStream); + + lRet = GetAutolockPeriodL(lValue); + + if(lRet != KErrNone) { + User :: Leave(lRet); + } + + Dprint((_L("[CSCPServer]-> appending AutoLockPeriod value=%d"), lValue)); + lWriteStream.WriteInt32L(lValue); + + Dprint((_L("[CSCPServer]-> appending MaxAutoLockPeriod value=%d"), iConfiguration.iMaxTimeout)); + lWriteStream.WriteInt32L(iConfiguration.iMaxTimeout); + + if(FeatureManager :: FeatureSupported(KFeatureIdSapDeviceLockEnhancements)) { + Dprint(_L("[CSCPServer]-> (FeatureManager :: FeatureSupported() complete. Fetching values now...")); + /* Fetch parameters starting from RTerminalControl3rdPartySession :: EPasscodeMinLength to + * RTerminalControl3rdPartySession :: EPasscodeMinChangeInterval + */ + TInt lPID = RTerminalControl3rdPartySession :: EPasscodeMinLength; + + for(; lPID <= RTerminalControl3rdPartySession :: EPasscodeDisallowSimple; lPID++) { + switch(lPID) { + default: + break; + case RTerminalControl3rdPartySession :: EPasscodeCheckSpecificStrings: + case RTerminalControl3rdPartySession :: EPasscodeAllowSpecific: + case RTerminalControl3rdPartySession :: EPasscodeClearSpecificStrings: + // No need to fetch these three parameters + continue; + case RTerminalControl3rdPartySession :: EPasscodeDisallowSpecific: + Dprint(_L("[CSCPServer]-> appending EPasscodeDisallowSpecific value...")); + // Get on EPasscodeDisallowSpecific returning -1 instead + lWriteStream.WriteInt32L(-1); + continue; + case RTerminalControl3rdPartySession :: EPasscodeDisallowSimple: + Dprint(_L("[CSCPServer]-> appending EPasscodeDisallowSimple value...")); + lWriteStream.WriteInt32L(1); + lWriteStream.WriteInt32L(1); + continue; + } + + //lRet = GetParameterValueL(lPID, lParamValBuf, aCallerIdentity); + lRet = iPluginEventHandler->GetParameters().Get(lPID, lValue); + + switch(lRet) { + + + case KErrNotFound: { + switch(lPID) { + case RTerminalControl3rdPartySession :: EPasscodeMinLength: + lValue = KSCPPasscodeMinLength; + break; + case RTerminalControl3rdPartySession :: EPasscodeMaxLength: + lValue = KSCPPasscodeMaxLength; + break; + default: + lValue = 0; + break; + } + } + break; + case KErrNone: { +// TLex lLex(lParamValBuf); +// lRet = lLex.Val(lValue); +// User :: LeaveIfError(lRet); + } + break; + default: + User :: Leave(lRet); + } + + Dprint((_L("[CSCPServer]-> appending value for lPID=%d"), lPID)); + Dprint((_L("[CSCPServer]-> lValue=%d"), lValue)); + + switch(lPID) { + default: + lWriteStream.WriteInt32L(lValue); + break; + case RTerminalControl3rdPartySession :: EPasscodeDisallowSimple: + lWriteStream.WriteInt32L(1); + lWriteStream.WriteInt32L(1); + break; + } + } + } + else { + Dprint(_L("[CSCPServer]-> (FeatureManager :: FeatureSupported() failed!!...")); + } + + CleanupStack :: PopAndDestroy(1); // lWriteStream +} + +TInt CSCPServer :: ValidateLockcodeAgainstPoliciesL(TDes& aLockcode, CSCPParamObject*& aRetParams) { + Dprint( (_L("[CSCPServer]-> ValidateLockcodeAgainstPoliciesL() >>>"))); + + TInt ret = KErrNone; + CSCPParamObject* inParams = CSCPParamObject :: NewL(); + inParams->Set(KSCPParamPassword, aLockcode); + CSCPParamObject* repParams = iPluginManager->PostEvent(KSCPEventValidate, *inParams); + delete inParams; + + if (repParams != NULL) { + // Check if the validation failed + TInt status; + + if (repParams->Get(KSCPParamStatus, status) == KErrNone) { + if (status != KErrNone) { + ret = status; + } + } + + aRetParams = repParams; // pointer ownership changed + } + + Dprint( (_L("[CSCPServer]-> ValidateLockcodeAgainstPoliciesL() <<<"))); + return ret; +} + //#endif // __SAP_DEVICE_LOCK_ENHANCEMENTS // <<<< ********************** NEW FEATURES ******************** diff -r 19fb38abab1d -r bf47f3b79154 terminalsecurity/SCP/SCPServer/src/SCPSession.cpp --- a/terminalsecurity/SCP/SCPServer/src/SCPSession.cpp Fri Apr 16 15:52:47 2010 +0300 +++ b/terminalsecurity/SCP/SCPServer/src/SCPSession.cpp Mon May 03 13:19:46 2010 +0300 @@ -110,6 +110,7 @@ iPendingCallStatus = NULL; iServer.SessionClosed(); + if(iALParamValue) { delete iALParamValue; } @@ -423,6 +424,7 @@ User::Leave( KErrGeneral ); } + // Create a timer object for this call iLockOperationTimer = CSCPTimer::NewL( KSCPLockOperationTimeout, NULL, this ); @@ -572,8 +574,29 @@ Dprint( (_L("<-- CSCPSession::HandleGetLockStateMessageL()") )); } - - +void CSCPSession :: HandleGetPoliciesL(const RMessage2 &aMessage) { + #ifdef SCP_ENFORCE_SECURITY + // Check the access for this parameter + if((aMessage.SecureId() != KSCPServerSIDTerminalControl) && + (aMessage.SecureId() != KSCPServerSIDGeneralSettings) && + (aMessage.SecureId() != KDevEncUiUid)) { + + Dprint((_L("CSCPSession::HandleSetParamMessageL(): ERROR: Permission denied"))); + User :: Leave( KErrPermissionDenied); + } + #endif // SCP_ENFORCE_SECURITY + + // Init a local buffer to store the return value + HBufC8* lBuffer = HBufC8 :: NewLC(aMessage.GetDesMaxLength(1)); + + iServer.GetPoliciesL(lBuffer, aMessage.SecureId().iId); + Dprint((_L("[CSCPSession]-> iServer.GetPoliciesL complete..."))); + + TPtr8 bufPtr = lBuffer->Des(); + // OK, send the data to the client side + aMessage.WriteL(1, bufPtr); + CleanupStack :: PopAndDestroy(1); // lBuffer +} // --------------------------------------------------------- // void CSCPSession::HandleSetParamMessageL( const RMessage2 &aMessage ) @@ -853,6 +876,7 @@ TSecureId id = aMessage.SecureId(); switch(id.iId) { + case KSCPSTIF: case KSCPServerSIDAutolock: case KAknNfySrvUid: case KSCPServerSIDGeneralSettings: @@ -863,7 +887,7 @@ break; default: { Dprint( (_L("[CSCPSession]-> ERROR: Permission denied") )); - User::Leave( KErrPermissionDenied ); + User::Leave( KErrPermissionDenied ); } }; @@ -912,37 +936,12 @@ returning %d"), ret )); User::Leave( ret ); } - - // If additional parameters are passed to client side, add them to slot 2 - if ( addParams != NULL ) + // read failed polices to msg buffer + if (addParams != NULL) { - HBufC8* paramBuf; - TInt pRet = addParams->GetBuffer( paramBuf ); - - if ( pRet != KErrNone ) - { - Dprint( (_L("WARNING: CSCPSession::HandleAuthenticationMessage():\ - failed to get additional parameter buffer: %d"), pRet )); - } - else - { - TPtr8 paramPtr = paramBuf->Des(); - if ( aMessage.GetDesMaxLength( 2 ) >= paramPtr.Length() ) - { - aMessage.Write( 2, paramPtr ); - } - else - { - Dprint( (_L("WARNING: CSCPSession::HandleAuthenticationMessage():\ - WARNING: not enough space for additional parameters") )); - } - - delete paramBuf; - } - - delete addParams; + ReadFailedPoliciestoMsgBufferL(addParams,aMessage,2); } - + delete addParams; // OK, we either have the correct ISA code or don't, return it to the client in slot 1 User::LeaveIfError( aMessage.Write( 1, isaCodeToReturn ) ); @@ -959,133 +958,72 @@ // Status : Approved // --------------------------------------------------------- // -void CSCPSession::HandleChangeEnhCodeMessageL( const RMessage2 &aMessage ) - { +void CSCPSession :: HandleChangeEnhCodeMessageL(const RMessage2 &aMessage) { + + Dprint(_L("[CSCPSession]-> HandleChangeEnhCodeMessage() >>>")); - if(!FeatureManager::FeatureSupported(KFeatureIdSapDeviceLockEnhancements)) - { - FeatureManager::UnInitializeLib(); - User::Leave(KErrNotSupported); + if(!FeatureManager :: FeatureSupported(KFeatureIdSapDeviceLockEnhancements)) { + FeatureManager :: UnInitializeLib(); + User :: Leave(KErrNotSupported); } - Dprint( (_L("--> CSCPSession::HandleChangeEnhCodeMessage()") )); - - HBufC* oldPassBuf = NULL; - HBufC* newPassBuf = NULL; TInt oldPasswordLen = aMessage.GetDesLength(0); TInt newPasswordLen = aMessage.GetDesLength(1); - if ( ( newPasswordLen == 0 ) || ( oldPasswordLen == 0 ) ) - { + if ((newPasswordLen == 0) || (oldPasswordLen == 0)) { // We cannot accept an empty code - Dprint( (_L("<-- ERROR: CSCPSession::HandleChangeEnhCodeMessage():\ - returning KErrArgument, buffer empty") )); - User::Leave( KErrArgument ); - } - else - { - oldPassBuf = HBufC::NewLC( oldPasswordLen ); - newPassBuf = HBufC::NewLC( newPasswordLen ); - } + Dprint(_L("[CSCPSession]-> ERROR: Input buffers are empty!!")); + User :: Leave(KErrArgument); + } + + TInt lErr = KErrNone; + HBufC* oldPassBuf = HBufC :: NewLC(oldPasswordLen); + HBufC* newPassBuf = HBufC :: NewLC(newPasswordLen); TPtr oldPassPtr = oldPassBuf->Des(); TPtr newPassPtr = newPassBuf->Des(); // Read the strings, slot 0 = old password, slot 1 = new password - TRAPD( err, aMessage.ReadL( 0, oldPassPtr ) ); - TRAP( err, aMessage.ReadL( 1, newPassPtr ) ); + aMessage.ReadL(0, oldPassPtr); + aMessage.ReadL(1, newPassPtr); // A buffer for the updated DOS password TSCPSecCode newDosCode; - newDosCode.Zero(); - - CSCPParamObject* addParams = NULL; - if ( err != KErrNone ) - { - Dprint( (_L("<-- ERROR: CSCPSession::HandleChangeEnhCodeMessage():\ - failed to read the strings to server side: %d"), err )); - } - else - { - err = iServer.CheckAndChangeEnhCodeL( oldPassPtr, newPassPtr, addParams, newDosCode ); - } + newDosCode.Zero(); - // If additional parameters are passed to client side, add them to slot 2 - if ( addParams != NULL ) - { - HBufC8* paramBuf; - TInt pRet = addParams->GetBuffer( paramBuf ); - - if ( pRet != KErrNone ) - { - Dprint( (_L("WARNING: CSCPSession::HandleAuthenticationMessage():\ - failed to get additional parameter buffer: %d"), pRet )); - } - else - { - TPtr8 paramPtr = paramBuf->Des(); - if ( aMessage.GetDesMaxLength( 2 ) >= paramPtr.Length() ) - { - aMessage.Write( 2, paramPtr ); - } - else - { - Dprint( (_L("WARNING: CSCPSession::HandleAuthenticationMessage():\ - WARNING: not enough space for additional parameters") )); - } - - delete paramBuf; - } - - delete addParams; - } - - if ( err == KErrNone ) - { - // Copy the new DOS code to slot 3 - TInt ret = aMessage.Write( 3, newDosCode ); - if ( ret != KErrNone ) - { - Dprint( (_L("WARNING: CSCPSession::HandleAuthenticationMessage():\ - WARNING: failed to write the new DOS code to client-side") )); - } - else - { - /* Get the very first character of the new lock code and set the default input mode of the - lock code query on the basis of the first character. */ - ch = newPassPtr[0]; - def_mode = ch.IsDigit() ? 0 : 1; - - CRepository* repository = CRepository :: NewL(KCRUidSCPParameters); - CleanupStack::PushL( repository ); - - User::LeaveIfError(repository->Set( KSCPLockCodeDefaultInputMode , def_mode) ); - CleanupStack :: PopAndDestroy(repository); - - /* Set the value in the cenrep that the default lock code has been changed if it is not - * already set - * */ - repository = CRepository :: NewL(KCRUidSCPLockCode); - CleanupStack :: PushL(repository); - User :: LeaveIfError(repository->Set(KSCPLockCodeDefaultLockCode, 0)); - CleanupStack::PopAndDestroy( repository ); - repository = NULL; - } - } - - oldPassPtr.Zero(); - newPassPtr.Zero(); - CleanupStack::PopAndDestroy( newPassBuf ); - CleanupStack::PopAndDestroy( oldPassBuf ); + CSCPParamObject* addParams = NULL; + lErr = iServer.CheckAndChangeEnhCodeL(oldPassPtr, newPassPtr, addParams, newDosCode); + CleanupStack :: PushL(addParams); - Dprint( (_L("<-- CSCPSession::HandleChangeEnhCodeMessage(): %d"), err )); - - if ( err != KErrNone ) - { - User::Leave( err ); - } + if (addParams != NULL) { + ReadFailedPoliciestoMsgBufferL(addParams, aMessage, 2); } + CleanupStack :: PopAndDestroy(1); //addParams + + if(lErr == KErrNone) { + /* Get the very first character of the new lock code and set the default input mode of the + lock code query on the basis of the first character. */ + ch = newPassPtr[0]; + def_mode = ch.IsDigit() ? 0 : 1; + + CRepository* repository = CRepository :: NewLC(KCRUidSCPParameters); + User :: LeaveIfError(repository->Set(KSCPLockCodeDefaultInputMode, def_mode)); + CleanupStack :: PopAndDestroy(repository); + + /* Set the value in the cenrep that the default lock code has been changed if it is not + * already set + * */ + repository = CRepository :: NewLC(KCRUidSCPLockCode); + User :: LeaveIfError(repository->Set(KSCPLockCodeDefaultLockCode, 0)); + CleanupStack :: PopAndDestroy(repository); + } + + CleanupStack :: PopAndDestroy(2); //newPassBuf, oldPassBuf + + Dprint(_L("[CSCPSession]-> HandleChangeEnhCodeMessage() lErr=%d <<<"), lErr); + User :: LeaveIfError(lErr); +} // --------------------------------------------------------- // void CSCPSession::HandleQueryChangeMessageL() @@ -1097,52 +1035,24 @@ void CSCPSession::HandleQueryChangeMessageL( const RMessage2 &aMessage ) { + Dprint( (_L("--> CSCPSession::HandleQueryChangeMessage()") )); if(!FeatureManager::FeatureSupported(KFeatureIdSapDeviceLockEnhancements)) { + Dprint( (_L("--> CSCPSession::HandleQueryChangeMessage() .. Feature not Supported !!") )); FeatureManager::UnInitializeLib(); User::Leave(KErrNotSupported); } - Dprint( (_L("--> CSCPSession::HandleQueryChangeMessage()") )); CSCPParamObject* addParams = NULL; TInt ret = iServer.IsPasswordChangeAllowedL( addParams ); - - // Return the reply in slot 0 - - TPckg retPackage(ret); - aMessage.WriteL(0, retPackage ); - - // If additional parameters are passed to client side, add them to slot 1 - if ( addParams != NULL ) + if (ret != KErrNone) { - HBufC8* paramBuf; - TInt pRet = addParams->GetBuffer( paramBuf ); - - if ( pRet != KErrNone ) - { - Dprint( (_L("WARNING: CSCPSession::HandleAuthenticationMessage():\ - failed to get additional parameter buffer: %d"), pRet )); - } - else - { - TPtr8 paramPtr = paramBuf->Des(); - if ( aMessage.GetDesMaxLength( 1 ) >= paramPtr.Length() ) - { - aMessage.Write( 1, paramPtr ); - } - else - { - Dprint( (_L("WARNING: CSCPSession::HandleAuthenticationMessage():\ - WARNING: not enough space for additional parameters") )); - } - - delete paramBuf; - } - - delete addParams; - } - + ReadFailedPoliciestoMsgBufferL(addParams,aMessage,0); + } + if (addParams != NULL) + delete addParams; + Dprint( (_L("<-- CSCPSession::HandleQueryChangeMessage()") )); } @@ -1446,7 +1356,13 @@ case ( ESCPServGetParam ): { - HandleGetParamMessageL( aMessage ); + if(aMessage.Int0() == -1) { + HandleGetPoliciesL(aMessage); + } + else { + HandleGetParamMessageL(aMessage); + } + break; } @@ -1497,6 +1413,11 @@ } break; } + case ESCPServValidateLockcode: + { + ValidateLockcodeAgainstPoliciesL(aMessage); + break; + } //#endif // __SAP_DEVICE_LOCK_ENHANCEMENTS @@ -1541,12 +1462,7 @@ if(TUint32(id.iUid) != aCallerID) { CTC3rdPartyParamsEcomIF* plugin = CTC3rdPartyParamsEcomIF :: NewL(implementation); CleanupStack :: PushL(plugin); - TRAPD(leaveCode, plugin->DeviceLockParamChangedL(aChange)); - if (!leaveCode) - { - Dprint(_L("[CSCPSession]-> leaveCode=%d"), leaveCode); - } - + TRAP_IGNORE( plugin->DeviceLockParamChangedL(aChange)); CleanupStack :: PopAndDestroy(); // plugin } @@ -1558,6 +1474,7 @@ Dprint(_L("[CSCPSession]-> NotifyAllStakeHoldersL() <<<")); return KErrNone; } + TInt CSCPSession :: HandleCleanupL(const RMessage2& aMessage) { // Copy the client data into a local buffer TInt32 lCount = aMessage.GetDesLength(1); @@ -1608,6 +1525,7 @@ CleanupStack :: PopAndDestroy(3); // lParamIDArray lParamValArray lBuffer return lStatus; } + TInt CSCPSession :: HandleSetALPeriodL( const RMessage2& aMessage ) { Dprint((_L("[CSCPSession]-> HandleSetParamMessageL() >>>"))); TBool oldALState = EFalse; @@ -1675,11 +1593,68 @@ } Dprint(_L("[CSCPSession]->INFO: Initiating notification to all the StakeHolders...")); - TRAPD(lErr, NotifyAllStakeHoldersL(lChangeArray, aCallerID)); - if (!lErr) - { - Dprint(_L("[CSCPSession]-> lErr=%d"), lErr); - } + TRAP_IGNORE( NotifyAllStakeHoldersL(lChangeArray, aCallerID)); Dprint(_L("[CSCPSession]->INFO: Notification to all the StakeHolders complete...")); CleanupStack :: PopAndDestroy(); //lChangeArray } + +void CSCPSession :: ReadFailedPoliciestoMsgBufferL(CSCPParamObject*& aParamObject, const RMessage2& aMessage, TInt aSlotNumber) { + Dprint((_L("[CSCPSession]-> ReadFailedPoliciestoMsgBufferL() >>>"))); + //get failed polices array from param object + const RArray& failedPolicesArray = aParamObject->GetFailedPolices(); + + // extra one for failed policies count + HBufC8* failedPoliciesBuf = HBufC8 :: NewLC((EDevicelockTotalPolicies+1) * sizeof(TInt32)); + TPtr8 failedpoliciesBufPtr = failedPoliciesBuf->Des(); + + RDesWriteStream writeStream(failedpoliciesBufPtr); + CleanupClosePushL(writeStream); + + writeStream.WriteInt32L(failedPolicesArray.Count()); + + for(int count =0; count < failedPolicesArray.Count(); count++) { + writeStream.WriteInt32L(failedPolicesArray[count]); + } + + writeStream.CommitL(); + aMessage.WriteL(aSlotNumber, failedPoliciesBuf->Des()); + CleanupStack :: PopAndDestroy(2); //writeStream, failedPoliciesBuf + Dprint((_L("[CSCPSession]-> ReadFailedPoliciestoMsgBufferL() <<<"))); +} + +void CSCPSession :: ValidateLockcodeAgainstPoliciesL(const RMessage2& aMessage) { + Dprint((_L("[CSCPSession]-> ValidateLockcodeAgainstPolicies() <<<"))); + TInt lRet = KErrNone; + HBufC* lockcodeBuf = NULL; + CSCPParamObject* addParams = NULL; + TInt lockcodeLen = aMessage.GetDesLength(0); + Dprint( (_L("CSCPSession :: ValidateLockcodeAgainstPoliciesL: lockcodeLen ->%d"), lockcodeLen )); + if (lockcodeLen == 0) { + User :: Leave(KErrArgument); + } + else { + lockcodeBuf = HBufC :: NewLC(lockcodeLen); + } + + TPtr lockcodeptr = lockcodeBuf->Des(); + TRAP( lRet, aMessage.ReadL( 0, lockcodeptr ) ); + User :: LeaveIfError(lRet); + + lRet = iServer.ValidateLockcodeAgainstPoliciesL(lockcodeptr, addParams); + + if(addParams) { + CleanupStack :: PushL(addParams); + } + + if (lRet != KErrNone) { + ReadFailedPoliciestoMsgBufferL(addParams, aMessage, 1); + } + + if(addParams) { + CleanupStack :: PopAndDestroy(addParams); + } + + CleanupStack :: PopAndDestroy(1); // lockcodeBuf + Dprint((_L("[CSCPSession]-> ValidateLockcodeAgainstPolicies() <<<"))); + User :: LeaveIfError(lRet); +} diff -r 19fb38abab1d -r bf47f3b79154 terminalsecurity/SCP/SCPTimestampPlugin/inc/SCPTimestampPlugin.h --- a/terminalsecurity/SCP/SCPTimestampPlugin/inc/SCPTimestampPlugin.h Fri Apr 16 15:52:47 2010 +0300 +++ b/terminalsecurity/SCP/SCPTimestampPlugin/inc/SCPTimestampPlugin.h Mon May 03 13:19:46 2010 +0300 @@ -86,7 +86,7 @@ /** * Event handler */ - CSCPParamObject* HandleEvent( TInt aID, CSCPParamObject& aParam ); + void HandleEventL( TInt aID, CSCPParamObject& aParam, CSCPParamObject& aOutParam ); void SetEventHandler( MSCPPluginEventHandler* aHandler ); @@ -107,25 +107,25 @@ /** * Checks if the minimum timeout has expired since the last change */ - void IsChangeAllowedL( CSCPParamObject& aParam, CSCPParamObject*& aRetParams ); + void IsChangeAllowedL( CSCPParamObject& aParam, CSCPParamObject& aRetParams ); /** * Updates the status when the password is changed */ - void PasswordChanged( CSCPParamObject& aParam, CSCPParamObject*& aRetParams ); + void PasswordChanged( CSCPParamObject& aParam, CSCPParamObject& aRetParams ); /** * Updates the status when after an authentication attempt */ void AuthenticationAttempt( TBool aIsSuccessful, CSCPParamObject& aParam, - CSCPParamObject*& aRetParams ); + CSCPParamObject& aRetParams ); /** * Updates the status after successful authentication */ void SuccessfulAuthenticationL( CSCPParamObject& aParam, - CSCPParamObject*& aRetParams ); + CSCPParamObject& aRetParams ); /** @@ -139,12 +139,12 @@ */ void ConfigurationQuery( TInt aParamID, CSCPParamObject& aParam, - CSCPParamObject*& aRetParams ); + CSCPParamObject& aRetParams ); /** * Initiates RFS Deep (device wipe) */ - void WipeDeviceL( CSCPParamObject*& aRetParams ); + void WipeDeviceL( CSCPParamObject& aRetParams ); /** * Read the configuration from flash. diff -r 19fb38abab1d -r bf47f3b79154 terminalsecurity/SCP/SCPTimestampPlugin/src/SCPTimestampPlugin.cpp --- a/terminalsecurity/SCP/SCPTimestampPlugin/src/SCPTimestampPlugin.cpp Fri Apr 16 15:52:47 2010 +0300 +++ b/terminalsecurity/SCP/SCPTimestampPlugin/src/SCPTimestampPlugin.cpp Mon May 03 13:19:46 2010 +0300 @@ -21,6 +21,7 @@ #include #include #include +#include #include #include "SCP_IDs.h" #include @@ -138,11 +139,9 @@ // Status : Approved // ---------------------------------------------------------------------------- // -CSCPParamObject* CSCPTimestampPlugin::HandleEvent( TInt aID, CSCPParamObject& aParam ) - { +void CSCPTimestampPlugin :: HandleEventL( TInt aID, CSCPParamObject& aParam, CSCPParamObject& aOutParam ) + { Dprint ( ( _L( "CSCPTimestampPlugin::HandleEvent()" ) ) ); - - CSCPParamObject* retParams = NULL; // Get our current functional configuration if ( iEventHandler->GetParameters().Get( @@ -165,18 +164,8 @@ { iMaxAttempts = 0; } - - if ( !iResOpen ) - { - // Load the resource file containing the localized texts - TInt ret = GetResource(); - if ( ret == KErrNone ) - { - iResOpen = ETrue; - } - // We'll continue without the resource if required - } - + Dprint( ( _L( "CSCPPatternPlugin::IsChangeAllowedL(): iExpiration :%d, iExpiration :%d, iMinTolerance :%d, iMaxAttempts :%d"), iExpiration,iMinInterval,iMinTolerance,iMaxAttempts ) ); + Dprint( ( _L( "CSCPPatternPlugin::IsChangeAllowedL(): aID is :%d"), aID) ); switch ( aID ) { case ( KSCPEventPasswordChangeQuery ): @@ -184,7 +173,7 @@ if ( iMinInterval > 0 ) { // Ignore errors, the plugin will stay silent on error - TRAP_IGNORE( IsChangeAllowedL( aParam, retParams ) ); + TRAP_IGNORE( IsChangeAllowedL( aParam, aOutParam ) ); } break; } @@ -196,7 +185,7 @@ if ( aParam.Get( KSCPParamID, paramID ) == KErrNone ) { - ConfigurationQuery( paramID, aParam, retParams ); + ConfigurationQuery( paramID, aParam, aOutParam ); } break; @@ -204,7 +193,7 @@ case ( KSCPEventPasswordChanged ): { - PasswordChanged( aParam, retParams ); + PasswordChanged( aParam, aOutParam ); break; } @@ -215,7 +204,7 @@ { TBool isSuccess = ( authStatus == KErrNone ); // No return value required in any case - AuthenticationAttempt( isSuccess, aParam, retParams ); + AuthenticationAttempt( isSuccess, aParam, aOutParam ); } break; @@ -239,7 +228,6 @@ } // The caller will own this pointer from now on - return retParams; } // ---------------------------------------------------------------------------- @@ -265,7 +253,7 @@ // Status : Approved // ---------------------------------------------------------------------------- // -void CSCPTimestampPlugin::IsChangeAllowedL( CSCPParamObject& aParam, CSCPParamObject*& aRetParams ) +void CSCPTimestampPlugin::IsChangeAllowedL( CSCPParamObject& aParam, CSCPParamObject& aRetParams ) { (void)aParam; @@ -311,79 +299,10 @@ if ( ret == KErrSCPCodeChangeNotAllowed ) { - // Code change is not allowed, send the info back to the user - aRetParams = CSCPParamObject::NewL(); - - aRetParams->Set( KSCPParamStatus, KErrSCPCodeChangeNotAllowed ); - aRetParams->Set( KSCPParamAction, KSCPActionShowUI ); - aRetParams->Set( KSCPParamUIMode, KSCPUINote ); - aRetParams->Set( KSCPParamNoteIcon, KSCPUINoteError ); - - HBufC16* resText = NULL; - HBufC16* formatBuf = NULL; - - Dprint( ( _L( "CSCPPatternPlugin::IsChangeAllowedL(): iMinInterval : %d"), iMinInterval ) ); - Dprint( ( _L( "CSCPPatternPlugin::IsChangeAllowedL(): iMinTolerance : %d"), iMinTolerance ) ); - if ( iMinInterval > 1 ) - { - if ( iMinTolerance >1 ) - { - Dprint( (_L("CSCPTimestampPlugin::IsChangeAllowedL(): iMinInterval > 1,iMinTolerance >= 1") )); - resText = LoadResourceL( R_SET_SEC_CODE_CHANGE_DAY ); - } - else - { - Dprint( (_L("CSCPTimestampPlugin::IsChangeAllowedL(): iMinInterval > 1,iMinTolerance !>= 1") )); - resText = LoadResourceL( R_SET_SEC_CODE_CHANGE_HOURS ); - } - } - else - if ( iMinTolerance > 1 ) - { - Dprint( (_L("CSCPTimestampPlugin::IsChangeAllowedL(): iMinInterval !> 1,iMinTolerance >= 1") )); - resText = LoadResourceL( R_SET_SEC_CODE_CHANGE_TIMES ); - } - else - { - Dprint( (_L("CSCPTimestampPlugin::IsChangeAllowedL(): iMinInterval !> 1,iMinTolerance !>= 1") )); - resText = LoadResourceL( R_SET_SEC_CODE_CHANGE_ONES ); - } - - CleanupStack::PushL( resText ); - - formatBuf = HBufC::NewL( resText->Length() + KSCPMaxMinChangeValueLen ); - - TPtr16 bufDes = formatBuf->Des(); - - if ( iMinInterval > 1 ) - { - if ( iMinTolerance > 1 ) - { - bufDes.Format( resText->Des(), iMinTolerance , iMinInterval ); - } - else - { - bufDes.Format( resText->Des(), iMinInterval ); - } - } - else - if ( iMinTolerance > 1 ) - { - bufDes.Format( resText->Des(), iMinTolerance ); - } - else - { - bufDes.Format( resText->Des() ); - } - - aRetParams->Set( KSCPParamPromptText, bufDes ); - - delete formatBuf; - - CleanupStack::PopAndDestroy( resText ); + Dprint ( ( _L( "EDeviceLockMinChangeTolerance Failed" ) ) ); + aRetParams.AddtoFailedPolices(EDeviceLockMinChangeTolerance); + aRetParams.Set( KSCPParamStatus, KErrSCPCodeChangeNotAllowed ); } - - // No need to write configuration changes } @@ -394,10 +313,10 @@ // Status : Approved // ---------------------------------------------------------------------------- // -void CSCPTimestampPlugin::PasswordChanged( CSCPParamObject& aParam, CSCPParamObject*& aRetParams ) +void CSCPTimestampPlugin::PasswordChanged( CSCPParamObject& aParam, CSCPParamObject& aRetParams ) { (void)aParam; - (void)aRetParams; + Dprint( (_L("CSCPTimestampPlugin::PasswordChanged()") )); TInt err = ReadConfiguration(); if ( err == KErrNone ) @@ -477,10 +396,11 @@ // Status : Approved // ---------------------------------------------------------------------------- // -void CSCPTimestampPlugin::AuthenticationAttempt( TBool aIsSuccessful, +void CSCPTimestampPlugin :: AuthenticationAttempt( TBool aIsSuccessful, CSCPParamObject& aParam, - CSCPParamObject*& aRetParams ) + CSCPParamObject& aRetParams ) { + Dprint( (_L("CSCPTimestampPlugin::AuthenticationAttempt") )); if ( ReadConfiguration() != KErrNone ) { return; @@ -489,7 +409,7 @@ // Check if immediate expiration is set TInt expireNow = 0; iConfiguration->Get( KSCPExpireOnNextCall, expireNow ); // ignore errors - + Dprint( ( _L( "CSCPPatternPlugin::AuthenticationAttempt(): expireNow = %d"), expireNow ) ); if ( ( iExpiration == 0 ) && ( iMaxAttempts == 0) && ( expireNow == 0 ) ) { return; // We have no interest in this call @@ -510,34 +430,14 @@ if ( failedCount == iMaxAttempts - 1 ) { - // Warn the user. Only one attempt left. There's no use handling the error - // so we'll just stay silent at this point on failure. - TRAP_IGNORE( - HBufC16* resText = NULL; - resText = LoadResourceL( R_SET_SEC_CODE_WARNING_ATTEMPTS_LEFT ); - FormatResourceString(*resText); - CleanupStack::PushL( resText ); - - TPtr16 bufDes = resText->Des(); - - CAknGlobalConfirmationQuery* note = CAknGlobalConfirmationQuery::NewLC(); - - TRequestStatus status; - note->ShowConfirmationQueryL(status, - bufDes, - R_AVKON_SOFTKEYS_OK_EMPTY, - R_QGN_NOTE_WARNING_ANIM ); - User::WaitForRequest( status ); - - CleanupStack::PopAndDestroy( note ); - - CleanupStack::PopAndDestroy( resText ); - ); + Dprint ( ( _L( "EDeviceLockAllowedMaxAtempts Failed" ) ) ); + aRetParams.AddtoFailedPolices(EDeviceLockAllowedMaxAtempts); } else if ( failedCount >= iMaxAttempts ) { // Try to wipe the device TRAPD( err, WipeDeviceL( aRetParams ) ); + if ( err != KErrNone ) { Dprint( ( _L( "CSCPPatternPlugin::\ @@ -561,8 +461,9 @@ // ---------------------------------------------------------------------------- // void CSCPTimestampPlugin::SuccessfulAuthenticationL( CSCPParamObject& aParam, - CSCPParamObject*& aRetParams ) + CSCPParamObject& aRetParams ) { + Dprint( (_L("CSCPTimestampPlugin::IsAfter()..enter") )); // Reset the failed attempts -counter if ( iMaxAttempts > 0 ) { @@ -576,7 +477,7 @@ // Check if immediate expiration is set TInt expireNow = 0; iConfiguration->Get( KSCPExpireOnNextCall, expireNow ); // ignore errors - + Dprint( ( _L( "CSCPPatternPlugin::SuccessfulAuthenticationL(): expireNow = %d, iExpiration =%d"), expireNow,iExpiration ) ); // Check if the code should be changed now if ( ( context != KSCPContextChangePsw ) && ( ( iExpiration > 0 ) || ( expireNow ) ) ) @@ -584,39 +485,14 @@ if ( ( IsAfter( KSCPLastChangeTime, iExpiration, KSCPTypeDays ) == KSCPIsAfter ) || ( expireNow ) ) { - // Force password change - - HBufC16* resText = NULL; - TRAPD( err, resText = LoadResourceL( R_SET_SEC_CODE_AGING ) ); - FormatResourceString(*resText); - if (err == KErrNone) // If this fails, go on anyway to signal the psw change - { - TPtr16 bufDes = resText->Des(); - TRequestStatus userResponse; - - CAknGlobalNote* note = CAknGlobalNote::NewLC(); - TRAP_IGNORE( - note->SetSoftkeys(R_AVKON_SOFTKEYS_OK_EMPTY); - note->ShowNoteL(userResponse, EAknGlobalWarningNote, - bufDes); - ); - - // Wait for the User Response - User::WaitForRequest(userResponse); - CleanupStack::PopAndDestroy(note); - - delete resText; - } - - // Refill the parameters to inform the client that the password - // should be changed. - aRetParams = CSCPParamObject::NewL(); - aRetParams->Set( KSCPParamAction, KSCPActionForceChange ); + Dprint ( ( _L( "EDeviceLockPasscodeExpiration Failed" ) ) ); + aRetParams.AddtoFailedPolices(EDeviceLockPasscodeExpiration); + aRetParams.Set( KSCPParamStatus, KErrSCPInvalidCode ); } } + Dprint( (_L("CSCPTimestampPlugin::IsAfter()..exit") )); } - - + // ---------------------------------------------------------------------------- // CSCPTimestampPlugin::IsAfter() // @@ -633,6 +509,7 @@ TBuf savedTimeBuf; TInt64 savedTime; + Dprint( ( _L( "CSCPPatternPlugin::IsAfter: aConfID value is :%d"), aConfID ) ); ret = iConfiguration->Get( aConfID, savedTimeBuf ); if ( ret == KErrNone ) { @@ -682,7 +559,7 @@ } } } - + Dprint( ( _L( "CSCPPatternPlugin::IsAfter: Retutn value is :%d"), ret ) ); return ret; } @@ -695,7 +572,7 @@ // void CSCPTimestampPlugin::ConfigurationQuery( TInt aParamID, CSCPParamObject& aParam, - CSCPParamObject*& aRetParams ) + CSCPParamObject& aRetParams ) { // First check if this is our ID if ( ( aParamID == RTerminalControl3rdPartySession::EPasscodeExpiration ) || @@ -810,21 +687,16 @@ // Something wrong, and this is our parameter. Signal an error ret = KErrArgument; } + + aRetParams.Set( KSCPParamStatus, ret ); - TRAPD( err, aRetParams = CSCPParamObject::NewL() ); - if ( err == KErrNone ) // If we can't create a paramObject, there's nothing we can do + if ( setPrivateStorage ) { - aRetParams->Set( KSCPParamStatus, ret ); - if ( setPrivateStorage ) - { - aRetParams->Set( KSCPParamStorage, KSCPStoragePrivate ); - } - } - } + aRetParams.Set( KSCPParamStorage, KSCPStoragePrivate ); + } + } } - - // ---------------------------------------------------------------------------- // CSCPTimestampPlugin::WipeDeviceL() // @@ -832,10 +704,8 @@ // Status : Approved // ---------------------------------------------------------------------------- // -void CSCPTimestampPlugin::WipeDeviceL( CSCPParamObject*& aRetParams ) +void CSCPTimestampPlugin::WipeDeviceL( CSCPParamObject& aRetParams ) { - (void)aRetParams; - // First try to format other local drives than C: RRfsClient rfsClient; @@ -890,23 +760,15 @@ { if (driveList[i]) { - driveNumber = TDriveNumber(i); - if (phoneMemoryDrive != driveNumber) - { - TBuf formatScript; - TChar driveLetter; - RFs::DriveToChar(i,driveLetter); - formatScript.Format(KSCPFormatScript, (TUint)driveLetter ); - Dprint( ( _L( "CSCPPatternPlugin::WipeDeviceL(): Formatting %c:"), driveLetter ) ); - - ret = rfsClient.RunScriptInDescriptor(formatScript); - - if ( ret != KErrNone ) - { - Dprint( ( _L( "CSCPPatternPlugin::WipeDeviceL():\ - FAILED to format %c: %d"), driveLetter, ret ) ); - } - } + driveNumber = TDriveNumber(i); + if (phoneMemoryDrive != driveNumber) + { + TBuf formatScript; + TChar driveLetter; + RFs::DriveToChar(i,driveLetter); + formatScript.Format(KSCPFormatScript, (TUint)driveLetter ); + ret = rfsClient.RunScriptInDescriptor(formatScript); + } } } @@ -1031,107 +893,4 @@ return ret; } - - -// ---------------------------------------------------------------------------- -// CSCPTimestampPlugin::GetResource -// GetResource -// -// Status : Approved -// ---------------------------------------------------------------------------- -// - -TInt CSCPTimestampPlugin::GetResource() - { - Dprint( (_L("CSCPTimestampPlugin::GetResource()") )); - // The resource has to be loaded manually since this is not an application. - - // Build the resource file name and localize it - TFileName resourceFile; - resourceFile.Append( KDriveZ ); - resourceFile.Append( KSCPTimestampPluginResFilename ); - BaflUtils::NearestLanguageFile( *iFsSession, resourceFile ); - - TRAPD( err, iResFile.OpenL( *iFsSession, resourceFile ) ); - - if ( err == KErrNone ) - { - TRAP( err, iResFile.ConfirmSignatureL() ); - } - - return err; - } - - -// ---------------------------------------------------------------------------- -// CSCPTimestampPlugin::LoadResourceLC -// -// -// Status : Approved -// ---------------------------------------------------------------------------- -// -HBufC16* CSCPTimestampPlugin::LoadResourceL( TInt aResId ) - { - if ( !iResOpen ) - { - User::Leave( KErrNotReady ); - } - - Dprint( (_L("CSCPTimestampPlugin::LoadResourceL()") )); - - // Load the actual resource - HBufC8* readBuffer = iResFile.AllocReadLC( aResId ); - - // As we are expecting HBufC16 - const TPtrC16 ptrReadBuffer( (TText16*) readBuffer->Ptr(), - ( readBuffer->Length() + 1 ) >> 1 ); - - HBufC16* textBuffer = HBufC16::NewL( ptrReadBuffer.Length() ); - - *textBuffer = ptrReadBuffer; - - FormatResourceString(*textBuffer); - CleanupStack::PopAndDestroy( readBuffer ); - - return textBuffer; - } - -// ---------------------------------------------------------------------------- -// CSCPTimestampPlugin::FormatResourceString -// The buffer that is passed is formatted to have only %i as a format specifier instead of %N or %0N etc. -// -// Status : Approved -// ---------------------------------------------------------------------------- -// -void CSCPTimestampPlugin::FormatResourceString(HBufC16 &aResStr) -{ - TInt pos = 0; - TInt flag = 0; - TPtr16 bufPtr = aResStr.Des(); - _LIT (mess1, "%N"); - _LIT (mess2, "%i"); - _LIT (mess3, "%0N"); - _LIT (mess4, "%1N"); - - while ((pos = bufPtr.Find(mess1)) !=KErrNotFound) - { - bufPtr.Replace(pos,2,mess2); - flag = 1; - break; - } - - if(flag == 0) - { - while ((pos = bufPtr.Find(mess3)) != KErrNotFound) - { - bufPtr.Replace(pos,3,mess2); - } - - while ((pos = bufPtr.Find(mess4)) != KErrNotFound) - { - bufPtr.Replace(pos,3,mess2); - } - } -} - // End of File diff -r 19fb38abab1d -r bf47f3b79154 terminalsecurity/server/group/TerminalControlServer.mmp --- a/terminalsecurity/server/group/TerminalControlServer.mmp Fri Apr 16 15:52:47 2010 +0300 +++ b/terminalsecurity/server/group/TerminalControlServer.mmp Mon May 03 13:19:46 2010 +0300 @@ -56,4 +56,4 @@ LIBRARY charconv.lib LIBRARY flogger.lib LIBRARY featmgr.lib -LIBRARY devenccommonutils.lib // Device encryption utility + diff -r 19fb38abab1d -r bf47f3b79154 terminalsecurity/server/src/TerminalControlSession.cpp --- a/terminalsecurity/server/src/TerminalControlSession.cpp Fri Apr 16 15:52:47 2010 +0300 +++ b/terminalsecurity/server/src/TerminalControlSession.cpp Mon May 03 13:19:46 2010 +0300 @@ -30,7 +30,7 @@ #include "TcTrustedSession.h" //Device encryption utility #include -#include +#include //Feature manager #include //For debugging purpose @@ -1411,9 +1411,7 @@ TBool CTerminalControlSession::IsDeviceMemoryEncrypted() { RDEBUG("CTerminalControlSession::IsDeviceMemoryEncrypted >>"); - TBool ret(EFalse); - //First check if the feature is supported on device TRAPD(ferr, FeatureManager::InitializeLibL()); if (ferr != KErrNone) @@ -1425,43 +1423,73 @@ FeatureManager::UnInitializeLib(); //If feature is supported, check if any drive is encrypted. + if (ret) { - CDevEncSession* devEncSession = new CDevEncSession( EDriveC ); + RLibrary library; + CDevEncSessionBase* devEncSession = NULL; + TInt err = library.Load(KDevEncCommonUtils); + if (err != KErrNone) + { + RDEBUG_2("Error in finding the library... %d", err); + ret = EFalse; + } + else + { + TLibraryFunction entry = library.Lookup(1); + + if (!entry) + { + RDEBUG("Error in loading the library..."); + ret = EFalse; + } + else + { + devEncSession = (CDevEncSessionBase*) entry(); + RDEBUG("Library is found and loaded successfully..."); + } + } + if (!devEncSession) { RDEBUG("Can't instantiate device encryption session.."); - return EFalse; - } - - TInt err = devEncSession->Connect(); - if (KErrNone == err) - { - //Session with device encryption is established. Check if any drive is encrypted - TInt encStatus (KErrNone); - TInt err = devEncSession->DiskStatus( encStatus ); - RDEBUG_3("err = %d, encstatus = %d", err, encStatus); - if ( KErrNone == err && encStatus != EDecrypted ) - { - RDEBUG("Memory is encrypted"); - ret = ETrue; - } - else - { - RDEBUG("Memory is not encrypted"); - ret = EFalse; - } - } - else - { - RDEBUG_2("Error %d while establishing connection with device encryption engine", err); ret = EFalse; } - - delete devEncSession; devEncSession = NULL; - } - + else + { + devEncSession->SetDrive( EDriveC ); + TInt err = devEncSession->Connect(); + if (err == KErrNone) + { + //Session with device encryption is established. Check if any drive is encrypted + TInt encStatus (KErrNone); + TInt err = devEncSession->DiskStatus( encStatus ); + devEncSession->Close(); + RDEBUG_2("encstatus = %d", encStatus); + if ( err == KErrNone && encStatus != EDecrypted ) + { + RDEBUG("Memory is encrypted"); + ret = ETrue; + } + else + { + RDEBUG("Memory is not encrypted"); + ret = EFalse; + } + } + else + { + RDEBUG_2("Error %d while establishing connection with device encryption engine", err); + ret = EFalse; + } + } + delete devEncSession; devEncSession = NULL; + + if (library.Handle()) + library.Close(); + + } RDEBUG_2("CTerminalControlSession::IsDeviceMemoryEncrypted, ret = %d <<", ret); return ret; } diff -r 19fb38abab1d -r bf47f3b79154 terminalsecurity/tcadapter/src/tcadapter.cpp --- a/terminalsecurity/tcadapter/src/tcadapter.cpp Fri Apr 16 15:52:47 2010 +0300 +++ b/terminalsecurity/tcadapter/src/tcadapter.cpp Mon May 03 13:19:46 2010 +0300 @@ -111,7 +111,6 @@ #endif #include #include -#include // s60 // tarm #include