syncmlfw/dm/provisioningadapter/src/NSmlDmProvisioningAdapter.cpp
changeset 51 2e64dc50f295
parent 24 bf47f3b79154
child 60 eb6690d0d439
equal deleted inserted replaced
50:a36219ae6585 51:2e64dc50f295
    38 #include <NSmlPrivateAPI.h>
    38 #include <NSmlPrivateAPI.h>
    39 #include "NSmlDmProvisioningAdapter.h"
    39 #include "NSmlDmProvisioningAdapter.h"
    40 #include "NSmlTransportHandler.h"
    40 #include "NSmlTransportHandler.h"
    41 
    41 
    42 #include <data_caging_path_literals.hrh>
    42 #include <data_caging_path_literals.hrh>
       
    43 #define KMINPORT 0
       
    44 #define KMAXPORT 65536
    43 
    45 
    44 // ============================ MEMBER FUNCTIONS ===============================
    46 // ============================ MEMBER FUNCTIONS ===============================
    45 
    47 
    46 // -----------------------------------------------------------------------------
    48 // -----------------------------------------------------------------------------
    47 // CNSmlDmProvisioningAdapter::CNSmlDmProvisioningAdapter
    49 // CNSmlDmProvisioningAdapter::CNSmlDmProvisioningAdapter
   182 	if (iAuthSecretLimitIndicator)
   184 	if (iAuthSecretLimitIndicator)
   183 	{
   185 	{
   184 		iAuthSecretLimitIndicator = 0;
   186 		iAuthSecretLimitIndicator = 0;
   185 		User::Leave(KErrOverflow);
   187 		User::Leave(KErrOverflow);
   186 	}
   188 	}
   187 
   189 	
       
   190 	//check for incorrect port
       
   191 	//Only port address between 1 to 65536 is allowed. 
       
   192 	if( iProfiles[aItem]->iPort )
       
   193 		{
       
   194 			const TDesC& port = iProfiles[aItem]->iPort->Des();
       
   195 			TInt len = port.Length();
       
   196 			if(len > 0)
       
   197 			{
       
   198         HBufC* bufPort = port.AllocL();
       
   199         TLex aLex(*bufPort);
       
   200         TInt portNum ;
       
   201         TInt err = aLex.Val(portNum);
       
   202         if(bufPort)
       
   203         {
       
   204           delete bufPort;
       
   205           bufPort = NULL;
       
   206         }
       
   207 	    if(err != KErrNone)
       
   208 	    {
       
   209           User::Leave(KErrGeneral);
       
   210 	    }
       
   211 	    if(!((portNum > KMINPORT) && (portNum < KMAXPORT)))
       
   212 	    {
       
   213 	      User::Leave(KErrGeneral);       
       
   214 	    }
       
   215 		}
       
   216 	}
       
   217 	
   188 	TPckgBuf<TUint32> uid;
   218 	TPckgBuf<TUint32> uid;
   189 	
   219 	
   190 	RSyncMLDevManProfile profile,ProfileToSearch;
   220 	RSyncMLDevManProfile profile,ProfileToSearch;
   191 	RArray<TSmlProfileId> arr;
   221 	RArray<TSmlProfileId> arr;
   192   iSession.ListProfilesL( arr, ESmlDevMan );
   222   iSession.ListProfilesL( arr, ESmlDevMan );
   287 		TPtr8 ptrBuf = iapBuf->Des();
   317 		TPtr8 ptrBuf = iapBuf->Des();
   288 		ptrBuf.Num( apId );
   318 		ptrBuf.Num( apId );
   289 
   319 
   290 		connection.SetPropertyL( KNSmlIAPId, *iapBuf );
   320 		connection.SetPropertyL( KNSmlIAPId, *iapBuf );
   291 		
   321 		
   292 		CleanupStack::PopAndDestroy( 2 ); //cmmanager,cm	
   322 		CleanupStack::PopAndDestroy( 3 ); //cmmanager,cm, iapBuf
   293 		}
   323 		}
   294 		
   324 		
   295 	if( iProfiles[aItem]->iHostAddress )
   325 	if( iProfiles[aItem]->iHostAddress )
   296 		{
   326 		{
   297 		// see if address contains also port
   327 		// see if address contains also port