diff -r b183ec05bd8c -r 19bba8228ff0 syncmlfw/dm/provisioningadapter/src/NSmlDmProvisioningAdapter.cpp --- a/syncmlfw/dm/provisioningadapter/src/NSmlDmProvisioningAdapter.cpp Tue Aug 31 16:04:06 2010 +0300 +++ b/syncmlfw/dm/provisioningadapter/src/NSmlDmProvisioningAdapter.cpp Wed Sep 01 12:27:42 2010 +0100 @@ -23,14 +23,14 @@ #include // CommsDB columname defs #include #include -#include +#include #include #include +#include #include #include #include -#include -#include + #include #include #include @@ -40,8 +40,6 @@ #include "NSmlTransportHandler.h" #include -#define KMINPORT 0 -#define KMAXPORT 65536 // ============================ MEMBER FUNCTIONS =============================== @@ -61,6 +59,7 @@ // ----------------------------------------------------------------------------- void CNSmlDmProvisioningAdapter::ConstructL() { + iLock = EFalse; iSession.OpenL(); FeatureManager::InitializeLibL(); } @@ -186,35 +185,7 @@ iAuthSecretLimitIndicator = 0; User::Leave(KErrOverflow); } - - //check for incorrect port - //Only port address between 1 to 65536 is allowed. - if( iProfiles[aItem]->iPort ) - { - const TDesC& port = iProfiles[aItem]->iPort->Des(); - TInt len = port.Length(); - if(len > 0) - { - HBufC* bufPort = port.AllocL(); - TLex aLex(*bufPort); - TInt portNum ; - TInt err = aLex.Val(portNum); - if(bufPort) - { - delete bufPort; - bufPort = NULL; - } - if(err != KErrNone) - { - User::Leave(KErrGeneral); - } - if(!((portNum > KMINPORT) && (portNum < KMAXPORT))) - { - User::Leave(KErrGeneral); - } - } - } - + TPckgBuf uid; RSyncMLDevManProfile profile,ProfileToSearch; @@ -247,9 +218,8 @@ TInt isprofilelocked=profile.ProfileLocked(EFalse, EFalse); if (isprofilelocked == 1) { - - profile.Close(); - User::Leave(KErrAccessDenied); + profile.ProfileLocked(ETrue, EFalse); + iLock = ETrue; } } @@ -289,6 +259,14 @@ } // creates profile -> must be done before opening the connection + + + if(iLock) + { + profile.ProfileLocked(ETrue, ETrue); + iLock = EFalse; + } + profile.UpdateL(); RSyncMLConnection connection; @@ -298,16 +276,13 @@ if( iProfiles[aItem]->iVisitParameter && iProfiles[aItem]->iVisitParameter->Data().Length() == uid.MaxLength() ) { uid.Copy( iProfiles[aItem]->iVisitParameter->Data() ); - - RCmManagerExt cmmanagerExt; - cmmanagerExt.OpenL(); - CleanupClosePushL(cmmanagerExt); - RCmConnectionMethodExt cm; - cm = cmmanagerExt.ConnectionMethodL( uid()); - CleanupClosePushL( cm ); + + CCommsDatabase* commDb = CCommsDatabase::NewL(); + CleanupStack::PushL( commDb ); + CApUtils* aputils = CApUtils::NewLC( *commDb ); TUint apId = 0; - TRAPD( ERROR, apId = cm.GetIntAttributeL(CMManager::ECmIapId) ); + TRAPD( ERROR, apId = aputils->IapIdFromWapIdL( uid() ) ); if( ERROR != KErrNone ) { apId = GetDefaultIAPL(); @@ -319,7 +294,7 @@ connection.SetPropertyL( KNSmlIAPId, *iapBuf ); - CleanupStack::PopAndDestroy( 3 ); //cmmanager,cm, iapBuf + CleanupStack::PopAndDestroy( 3 ); //commdb, aputils, iapBuf } if( iProfiles[aItem]->iHostAddress ) @@ -459,7 +434,7 @@ CleanupStack::PopAndDestroy(alertMessage); } - + CleanupStack::PopAndDestroy( &profile ); _DBG_FILE("CNSmlDmProvisioningAdapter::SaveL(): end");