vpnengine/ikev1lib/src/ikev1crack.cpp
changeset 29 000337104c92
parent 0 33413c0669b9
child 38 9f4e37332ce5
equal deleted inserted replaced
21:5aacbb121f34 29:000337104c92
     1 /*
     1 /*
     2 * Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
     2 * Copyright (c) 2005-2010 Nokia Corporation and/or its subsidiary(-ies).
     3 * All rights reserved.
     3 * All rights reserved.
     4 * This component and the accompanying materials are made available
     4 * This component and the accompanying materials are made available
     5 * under the terms of "Eclipse Public License v1.0"
     5 * under the terms of "Eclipse Public License v1.0"
     6 * which accompanies this distribution, and is available
     6 * which accompanies this distribution, and is available
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
   221          iNegotiation->iHostData->iCRACKLAMUserName &&
   221          iNegotiation->iHostData->iCRACKLAMUserName &&
   222          iNegotiation->iHostData->iCRACKLAMPassword)
   222          iNegotiation->iHostData->iCRACKLAMPassword)
   223         {
   223         {
   224         return GetUNPWDFromPolicyL();
   224         return GetUNPWDFromPolicyL();
   225         }
   225         }
       
   226     
       
   227     else if ( iLAMType == CRACK_PASSWORD &&
       
   228               iNegotiation->iCRACKLAMUserName &&
       
   229               iNegotiation->iCRACKLAMPassword)
       
   230         {
       
   231         return GetUNPWDFromNegotiationL();
       
   232         }
       
   233     
   226     else
   234     else
   227         {
   235         {
   228         return GetDatafromUserL(aChallenge); 
   236         return GetDatafromUserL(aChallenge); 
   229         }
   237         }
   230 }
   238 }
   292 
   300 
   293     SendCredentialsL(attr1, attr2, attr3, bfr1, bfr2, bfr3);
   301     SendCredentialsL(attr1, attr2, attr3, bfr1, bfr2, bfr3);
   294     
   302     
   295 	CleanupStack::PopAndDestroy(2); // bfr1, bfr2
   303 	CleanupStack::PopAndDestroy(2); // bfr1, bfr2
   296 	
   304 	
       
   305     return CRACK_CONTINUE;
       
   306 }
       
   307 
       
   308 
       
   309 TInt CIKECRACKNegotiation::GetUNPWDFromNegotiationL()
       
   310 {
       
   311     ASSERT(iLAMType == CRACK_PASSWORD);
       
   312     
       
   313     iNegotiation->iTimer->Cancel();   //Cancel previous timer because reply received & processed
       
   314     DEBUG_LOG(_L("Timer Cancelled!"));
       
   315     iNegotiation->iRetryNum = 0;
       
   316 
       
   317     /*--------------------------------------------------------
       
   318     *
       
   319     *  Store attributes: User name, Secret, Domain
       
   320     *
       
   321     *--------------------------------------------------------*/
       
   322 
       
   323     TUint16 attr1 = CRACK_T_USERNAME;
       
   324     HBufC8* bfr1  = iNegotiation->iCRACKLAMUserName;
       
   325     TUint16 attr2 = CRACK_T_SECRET;
       
   326     HBufC8* bfr2  = iNegotiation->iCRACKLAMPassword;
       
   327     HBufC8* bfr3  = iDomain;
       
   328     TUint16 attr3 = 0;
       
   329     if ( bfr3 )
       
   330         {
       
   331         attr3 = CRACK_T_DOMAIN;                  
       
   332         }
       
   333 
       
   334     SendCredentialsL(attr1, attr2, attr3, bfr1, bfr2, bfr3);
       
   335 
       
   336     delete iNegotiation->iCRACKLAMUserName;
       
   337     iNegotiation->iCRACKLAMUserName = NULL;
       
   338     delete iNegotiation->iCRACKLAMPassword;
       
   339     iNegotiation->iCRACKLAMPassword = NULL;
       
   340     
   297     return CRACK_CONTINUE;
   341     return CRACK_CONTINUE;
   298 }
   342 }
   299 
   343 
   300 void CIKECRACKNegotiation::SendCredentialsL(TUint16 aAttr1, TUint16 aAttr2, TUint16 aAttr3,
   344 void CIKECRACKNegotiation::SendCredentialsL(TUint16 aAttr1, TUint16 aAttr2, TUint16 aAttr3,
   301                                             HBufC8* aBfr1, HBufC8* aBfr2, HBufC8* aBfr3)
   345                                             HBufC8* aBfr1, HBufC8* aBfr2, HBufC8* aBfr3)