voipplugins/voipadapters/voipxmlprovisioning/voipxmlprocessor/src/voipxmliaphandler.cpp
branchRCL_3
changeset 18 8c9c07ad8b6b
parent 9 bddb6d4447db
child 20 65a3ef1d5bd0
equal deleted inserted replaced
16:df4dfb214df5 18:8c9c07ad8b6b
   602     TUint32 wlanId = newConnMethod.GetIntAttributeL( 
   602     TUint32 wlanId = newConnMethod.GetIntAttributeL( 
   603         CMManager::EWlanServiceId );
   603         CMManager::EWlanServiceId );
   604     TUint32 iapId = newConnMethod.GetIntAttributeL( CMManager::ECmIapId );
   604     TUint32 iapId = newConnMethod.GetIntAttributeL( CMManager::ECmIapId );
   605     TUint32 iapServiceId = newConnMethod.GetIntAttributeL( 
   605     TUint32 iapServiceId = newConnMethod.GetIntAttributeL( 
   606         CMManager::ECmIapServiceId );
   606         CMManager::ECmIapServiceId );
   607     CleanupStack::PopAndDestroy( &newConnMethod ); // CS:0
   607     
   608 
       
   609     if ( aTempIap.iSecurityType == CMManager::EWlanSecModeWep )
   608     if ( aTempIap.iSecurityType == CMManager::EWlanSecModeWep )
   610         {
   609         {
   611         DBG_PRINT( "   secMode WEP" );
   610         DBG_PRINT( "   secMode WEP" );
   612         CMDBSession* db = CMDBSession::NewLC( CMDBSession::LatestVersion() );
   611         CMDBSession* db = CMDBSession::NewLC( CMDBSession::LatestVersion() );
   613         // CS:1
   612         // CS:1
   614         CWEPSecuritySettings* wepSecSettings = 
   613         CWEPSecuritySettings* wepSecSettings = 
   615             CWEPSecuritySettings::NewL();
   614             CWEPSecuritySettings::NewL();
   616         CleanupStack::PushL( wepSecSettings ); // CS:2
   615         CleanupStack::PushL( wepSecSettings ); // CS:3
   617         const TInt wepKeyCount = aTempIap.iWepKeys.Count();
   616         const TInt wepKeyCount = aTempIap.iWepKeys.Count();
   618         for ( TInt counter = 0; counter < wepKeyCount; counter++ )
   617         for ( TInt counter = 0; counter < wepKeyCount; counter++ )
   619             {
   618             {
   620             User::LeaveIfError( wepSecSettings->SetKeyDataL( 
   619             User::LeaveIfError( wepSecSettings->SetKeyDataL( 
   621                 counter, aTempIap.iWepKeys[counter].iData, 
   620                 counter, aTempIap.iWepKeys[counter].iData, 
   622                 aTempIap.iWepKeys[counter].iHex ) );
   621                 aTempIap.iWepKeys[counter].iHex ) );
   623             }
   622             }
   624         wepSecSettings->SaveL( wlanId, *db );
   623         wepSecSettings->SaveL( wlanId, *db );
   625         // wepSecSettings, db
   624         // wepSecSettings, db
   626         CleanupStack::PopAndDestroy( 2, db ); // CS:0
   625         CleanupStack::PopAndDestroy( 2, db ); // CS:1
   627         }
   626         }
   628     else if ( CMManager::EWlanSecModeWpa == aTempIap.iSecurityType ||
   627     else if ( CMManager::EWlanSecModeWpa == aTempIap.iSecurityType ||
   629         CMManager::EWlanSecModeWpa2 == aTempIap.iSecurityType )
   628         CMManager::EWlanSecModeWpa2 == aTempIap.iSecurityType )
   630         {
   629         {
   631         DBG_PRINT( "   secMode WPA/WPA2" );
   630         DBG_PRINT( "   secMode WPA/WPA2" );
   632         CMDBSession* db = CMDBSession::NewLC( 
   631         CMDBSession* db = CMDBSession::NewLC( 
   633             CMDBSession::LatestVersion() ); // CS:1
   632             CMDBSession::LatestVersion() ); // CS:2
   634         CWPASecuritySettings* wpaSecSettings = 
   633         CWPASecuritySettings* wpaSecSettings = 
   635             CWPASecuritySettings::NewL( ESecurityModeWpa );
   634             CWPASecuritySettings::NewL( ESecurityModeWpa );
   636         CleanupStack::PushL( wpaSecSettings ); // CS:2
   635         CleanupStack::PushL( wpaSecSettings ); // CS:3
   637 
   636 
   638         if ( EAPSettings::EEapNone == aTempIap.iEapType )
   637         if ( EAPSettings::EEapNone == aTempIap.iEapType )
   639             {
   638             {
   640             DBG_PRINT( "   EapType none" );
   639             DBG_PRINT( "   EapType none" );
   641             User::LeaveIfError( wpaSecSettings->SetWPAPreSharedKey( 
   640             //If error happens then delete newConnMethod and leave
   642                 aTempIap.iPreSharedKey->Des() ));
   641             TInt error = wpaSecSettings->SetWPAPreSharedKey( 
       
   642                 aTempIap.iPreSharedKey->Des() );
       
   643             if ( error )
       
   644                 {
       
   645                 newConnMethod.DeleteL();
       
   646                 User::Leave( error );
       
   647                 }
   643             wpaSecSettings->SaveL( wlanId, *db, ESavingBrandNewAP, 0 );
   648             wpaSecSettings->SaveL( wlanId, *db, ESavingBrandNewAP, 0 );
   644             }
   649             }
   645         else if ( EAPSettings::EEapLeap == aTempIap.iEapType )
   650         else if ( EAPSettings::EEapLeap == aTempIap.iEapType )
   646             {
   651             {
   647             DBG_PRINT( "   eapType Leap" );
   652             DBG_PRINT( "   eapType Leap" );
   648 
   653 
   649             TBuf8<KMaxNodeValueLength> eapId;
   654             TBuf8<KMaxNodeValueLength> eapId;
   650             eapId.Copy( KEapLeapId, KEapChars );
   655             eapId.Copy( KEapLeapId, KEapChars );
   651             User::LeaveIfError( 
   656             
   652                 wpaSecSettings->SetWPAEnabledEAPPlugin( eapId ) );
   657             TInt error = wpaSecSettings->SetWPAEnabledEAPPlugin( eapId );
       
   658             if ( error )
       
   659                 {
       
   660                 newConnMethod.DeleteL();
       
   661                 User::Leave( error );
       
   662                 }
   653             wpaSecSettings->SaveL( wlanId, *db, ESavingBrandNewAP, 0 );
   663             wpaSecSettings->SaveL( wlanId, *db, ESavingBrandNewAP, 0 );
   654 
   664 
   655             CEapType* eapType = CEapType::NewL( eapId, ELan, wlanId );
   665             CEapType* eapType = CEapType::NewL( eapId, ELan, wlanId );
   656             CleanupStack::PushL( eapType ); // CS:3
   666             CleanupStack::PushL( eapType ); // CS:4
   657             EAPSettings* eapSettings = new (ELeave) EAPSettings();
   667             EAPSettings* eapSettings = new (ELeave) EAPSettings();
   658             CleanupStack::PushL( eapSettings ); // CS:4
   668             CleanupStack::PushL( eapSettings ); // CS:5
   659             eapSettings->iEAPType = EAPSettings::EEapLeap;
   669             eapSettings->iEAPType = EAPSettings::EEapLeap;
   660             eapSettings->iUsername.Copy( aTempIap.iEapUsername->Des() );
   670             eapSettings->iUsername.Copy( aTempIap.iEapUsername->Des() );
   661             eapSettings->iUsernamePresent = ETrue;
   671             eapSettings->iUsernamePresent = ETrue;
   662             eapSettings->iPassword.Copy( aTempIap.iEapPassword->Des() );
   672             eapSettings->iPassword.Copy( aTempIap.iEapPassword->Des() );
   663             eapSettings->iPasswordPresent = ETrue;
   673             eapSettings->iPasswordPresent = ETrue;
   664             eapType->SetConfigurationL( *eapSettings );
   674             eapType->SetConfigurationL( *eapSettings );
   665             CleanupStack::PopAndDestroy( 2, eapType ); // CS:2
   675             CleanupStack::PopAndDestroy( 2, eapType ); // CS:3
   666             }
   676             }
   667         // wpaSecSettings, db
   677         // wpaSecSettings, db
   668         CleanupStack::PopAndDestroy( 2, db ); // CS:0
   678         CleanupStack::PopAndDestroy( 2, db ); // CS:1
   669         }
   679         }
   670     else if ( CMManager::EWlanSecMode802_1x == aTempIap.iSecurityType )
   680     else if ( CMManager::EWlanSecMode802_1x == aTempIap.iSecurityType )
   671         {
   681         {
   672         DBG_PRINT( "   secMode 802.1X" );
   682         DBG_PRINT( "   secMode 802.1X" );
   673         CMDBSession* db = CMDBSession::NewLC( 
   683         CMDBSession* db = CMDBSession::NewLC( 
   674             CMDBSession::LatestVersion() ); // CS:1
   684             CMDBSession::LatestVersion() ); // CS:1
   675         CWPASecuritySettings* wpaSecSettings = 
   685         CWPASecuritySettings* wpaSecSettings = 
   676             CWPASecuritySettings::NewL( ESecurityMode8021x );
   686             CWPASecuritySettings::NewL( ESecurityMode8021x );
   677         CleanupStack::PushL( wpaSecSettings ); // CS:2
   687         CleanupStack::PushL( wpaSecSettings ); // CS:2
   678         User::LeaveIfError( wpaSecSettings->SetWPAPreSharedKey( 
   688         TInt error = wpaSecSettings->SetWPAPreSharedKey( 
   679             aTempIap.iPreSharedKey->Des() ));
   689             aTempIap.iPreSharedKey->Des() );
       
   690         if ( error )
       
   691             {
       
   692             newConnMethod.DeleteL();
       
   693             User::Leave( error );
       
   694             }
   680         wpaSecSettings->SaveL( wlanId, *db, ESavingBrandNewAP, 0 );
   695         wpaSecSettings->SaveL( wlanId, *db, ESavingBrandNewAP, 0 );
   681         // wpaSecSettings, db
   696         // wpaSecSettings, db
   682         CleanupStack::PopAndDestroy( 2, db ); // CS:0
   697         CleanupStack::PopAndDestroy( 2, db ); // CS:1
   683         }
   698         }
       
   699     CleanupStack::PopAndDestroy( &newConnMethod ); // CS:0
       
   700     
   684     DBG_PRINT( "CVoipXmlIapHandler::CreateIapL - end" );
   701     DBG_PRINT( "CVoipXmlIapHandler::CreateIapL - end" );
   685     return iapId;
   702     return iapId;
   686     }
   703     }
   687 
   704 
   688 // End of file.
   705 // End of file.