voipplugins/voipadapters/voipxmlprovisioning/voipxmlprocessor/src/voipxmliaphandler.cpp
branchRCL_3
changeset 8 7117cbf1600a
parent 2 7b872347d83b
child 9 bddb6d4447db
equal deleted inserted replaced
6:fc8c25e5a2e8 8:7117cbf1600a
    23 #include <cmconnectionmethodext.h>
    23 #include <cmconnectionmethodext.h>
    24 #include <cmconnectionmethoddef.h>
    24 #include <cmconnectionmethoddef.h>
    25 #include <cmpluginwlandef.h>
    25 #include <cmpluginwlandef.h>
    26 #include <WPASecuritySettingsUI.h>
    26 #include <WPASecuritySettingsUI.h>
    27 #include <WEPSecuritySettingsUI.h>
    27 #include <WEPSecuritySettingsUI.h>
       
    28 #include <EapSettings.h>
       
    29 #include <EapType.h>
    28 
    30 
    29 #include "voipxmlutils.h"
    31 #include "voipxmlutils.h"
    30 #include "voipxmliaphandler.h"
    32 #include "voipxmliaphandler.h"
    31 #include "voipxmlprocessorlogger.h"
    33 #include "voipxmlprocessorlogger.h"
    32 
    34 
    63     iCurrentIap.iName         = NULL;
    65     iCurrentIap.iName         = NULL;
    64     iCurrentIap.iPreSharedKey = NULL;
    66     iCurrentIap.iPreSharedKey = NULL;
    65     iCurrentIap.iSecurityType = CMManager::EWlanSecModeOpen;
    67     iCurrentIap.iSecurityType = CMManager::EWlanSecModeOpen;
    66     iCurrentIap.iNetworkMode  = CMManager::EInfra;
    68     iCurrentIap.iNetworkMode  = CMManager::EInfra;
    67     iCurrentIap.iWepAuthMode  = CWEPSecuritySettings::EAuthOpen;
    69     iCurrentIap.iWepAuthMode  = CWEPSecuritySettings::EAuthOpen;
       
    70     iCurrentIap.iEapType      = EAPSettings::EEapNone;
       
    71     iCurrentIap.iEapUsername  = NULL;
       
    72     iCurrentIap.iEapPassword  = NULL;
    68     }
    73     }
    69 
    74 
    70 // ---------------------------------------------------------------------------
    75 // ---------------------------------------------------------------------------
    71 // CVoipXmlIapHandler::~CVoipXmlIapHandler
    76 // CVoipXmlIapHandler::~CVoipXmlIapHandler
    72 // ---------------------------------------------------------------------------
    77 // ---------------------------------------------------------------------------
    98     switch ( aParam )
   103     switch ( aParam )
    99         {
   104         {
   100         case EName:
   105         case EName:
   101             {
   106             {
   102             TInt err( KErrNotFound );
   107             TInt err( KErrNotFound );
       
   108             //lint -e{960} No need for else statement here
   103             if ( EDestination == aType )
   109             if ( EDestination == aType )
   104                 {
   110                 {
   105                 delete iDestinationName;
   111                 delete iDestinationName;
   106                 iDestinationName = NULL;
   112                 iDestinationName = NULL;
   107                 TRAP( err, iDestinationName = aValue.AllocL() );
   113                 TRAP( err, iDestinationName = aValue.AllocL() );
   116                 }
   122                 }
   117             break;
   123             break;
   118             }
   124             }
   119         case EType:
   125         case EType:
   120             {
   126             {
   121             if ( EWlan != aType )
       
   122                 {
       
   123                 break;
       
   124                 }
       
   125             TBuf<KMaxNodeValueLength> value;
   127             TBuf<KMaxNodeValueLength> value;
   126             value.Copy( aValue );
   128             value.Copy( aValue );
   127             value.UpperCase();
   129             value.UpperCase();
       
   130 
       
   131             if ( EEap == aType )
       
   132                 {
       
   133                 if ( 0 == value.Compare( KEapTypeLeap ) )
       
   134                     {
       
   135                     iCurrentIap.iEapType = EAPSettings::EEapLeap;
       
   136                     }
       
   137                 }
       
   138 
       
   139             if ( EWlan != aType )
       
   140                 {
       
   141                 break;
       
   142                 }
       
   143             //lint -e{960} No need for else statement here
   128             if ( 0 == value.Compare( KSecurityTypeWep ) )
   144             if ( 0 == value.Compare( KSecurityTypeWep ) )
   129                 {
   145                 {
   130                 iCurrentIap.iSecurityType = CMManager::EWlanSecModeWep;
   146                 iCurrentIap.iSecurityType = CMManager::EWlanSecModeWep;
   131                 iSettingsSet = ETrue;
       
   132                 }
   147                 }
   133             else if ( 0 == value.Compare( KSecurityTypeWpa ) )
   148             else if ( 0 == value.Compare( KSecurityTypeWpa ) )
   134                 {
   149                 {
   135                 iCurrentIap.iSecurityType = CMManager::EWlanSecModeWpa;
   150                 iCurrentIap.iSecurityType = CMManager::EWlanSecModeWpa;
   136                 iSettingsSet = ETrue;
       
   137                 }
   151                 }
   138             else if ( 0 == value.Compare( KSecurityTypeWpa2 ) )
   152             else if ( 0 == value.Compare( KSecurityTypeWpa2 ) )
   139                 {
   153                 {
   140                 iCurrentIap.iSecurityType = CMManager::EWlanSecModeWpa2;
   154                 iCurrentIap.iSecurityType = CMManager::EWlanSecModeWpa2;
   141                 iSettingsSet = ETrue;
       
   142                 }
   155                 }
   143             else if ( 0 == value.Compare( KSecurityType8021x ) )
   156             else if ( 0 == value.Compare( KSecurityType8021x ) )
   144                 {
   157                 {
   145                 iCurrentIap.iSecurityType = CMManager::EWlanSecMode802_1x;
   158                 iCurrentIap.iSecurityType = CMManager::EWlanSecMode802_1x;
   146                 iSettingsSet = ETrue;
       
   147                 }
   159                 }
   148             break;
   160             break;
   149             }
   161             }
   150         case ESsid:
   162         case ESsid:
   151             {
   163             {
   152             if ( EWlan == aType && !iCurrentIap.iSsid )
   164             if ( EWlan == aType && !iCurrentIap.iSsid )
   153                 {
   165                 {
   154                 TRAPD( err, iCurrentIap.iSsid = aValue.AllocL() );
   166                 iCurrentIap.iSsid = aValue.Alloc();
   155                 if ( KErrNone == err )
   167                 if ( iCurrentIap.iSsid )
   156                     {
   168                     {
   157                     iSettingsSet = ETrue;
   169                     iSettingsSet = ETrue;
   158                     }
   170                     }
   159                 }
   171                 }
   160             break;
   172             break;
   163             {
   175             {
   164             if ( EWlan == aType &&
   176             if ( EWlan == aType &&
   165                 KErrNone == VoipXmlUtils::DesToInt( aValue, intValue ) )
   177                 KErrNone == VoipXmlUtils::DesToInt( aValue, intValue ) )
   166                 {
   178                 {
   167                 iCurrentIap.iHidden = intValue;
   179                 iCurrentIap.iHidden = intValue;
   168                 iSettingsSet = ETrue;
       
   169                 }
   180                 }
   170             break;
   181             break;
   171             }
   182             }
   172         case ENetworkMode:
   183         case ENetworkMode:
   173             {
   184             {
   176                 break;
   187                 break;
   177                 }
   188                 }
   178             TBuf<KMaxNodeValueLength> value;
   189             TBuf<KMaxNodeValueLength> value;
   179             value.Copy( aValue );
   190             value.Copy( aValue );
   180             value.LowerCase();
   191             value.LowerCase();
       
   192             //lint -e{960} No need for else statement here
   181             if ( 0 == value.Compare( KNetworkModeInfra ) )
   193             if ( 0 == value.Compare( KNetworkModeInfra ) )
   182                 {
   194                 {
   183                 iCurrentIap.iNetworkMode = CMManager::EInfra;
   195                 iCurrentIap.iNetworkMode = CMManager::EInfra;
   184                 iSettingsSet = ETrue;
       
   185                 }
   196                 }
   186             else if ( 0 == value.Compare( KNetworkModeAdhoc ) )
   197             else if ( 0 == value.Compare( KNetworkModeAdhoc ) )
   187                 {
   198                 {
   188                 iCurrentIap.iNetworkMode = CMManager::EAdhoc;
   199                 iCurrentIap.iNetworkMode = CMManager::EAdhoc;
   189                 iSettingsSet = ETrue;
       
   190                 }
   200                 }
   191             break;
   201             break;
   192             }
   202             }
   193         case EPreSharedKey:
   203         case EPreSharedKey:
   194             {
   204             {
   195             if ( EWlan == aType && !iCurrentIap.iPreSharedKey )
   205             if ( EWlan == aType && !iCurrentIap.iPreSharedKey )
   196                 {
   206                 {
   197                 TRAPD( err, iCurrentIap.iPreSharedKey = aValue.AllocL() );
   207                 iCurrentIap.iPreSharedKey = aValue.Alloc();
   198                 if ( KErrNone == err )
       
   199                     {
       
   200                     iSettingsSet = ETrue;
       
   201                     }
       
   202                 }
   208                 }
   203             break;
   209             break;
   204             }
   210             }
   205         case EWepAuthMode:
   211         case EWepAuthMode:
   206             {
   212             {
   209                 break;
   215                 break;
   210                 }
   216                 }
   211             TBuf<KMaxNodeValueLength> value;
   217             TBuf<KMaxNodeValueLength> value;
   212             value.Copy( aValue );
   218             value.Copy( aValue );
   213             value.LowerCase();
   219             value.LowerCase();
       
   220             //lint -e{960} No need for else statement here
   214             if ( 0 == value.Compare( KWepAuthModeOpen ) )
   221             if ( 0 == value.Compare( KWepAuthModeOpen ) )
   215                 {
   222                 {
   216                 iCurrentIap.iWepAuthMode = CWEPSecuritySettings::EAuthOpen;
   223                 iCurrentIap.iWepAuthMode = CWEPSecuritySettings::EAuthOpen;
   217                 iSettingsSet = ETrue;
       
   218                 }
   224                 }
   219             else if ( 0 == value.Compare( KWepAuthModeShared ) )
   225             else if ( 0 == value.Compare( KWepAuthModeShared ) )
   220                 {
   226                 {
   221                 iCurrentIap.iWepAuthMode = CWEPSecuritySettings::EAuthShared;
   227                 iCurrentIap.iWepAuthMode = CWEPSecuritySettings::EAuthShared;
   222                 iSettingsSet = ETrue;
       
   223                 }
   228                 }
   224             break;
   229             break;
   225             }
   230             }
   226         case ELength:
   231         case ELength:
   227             {
   232             {
   228             if ( EWepKey == aType && 
   233             if ( EWepKey == aType && 
   229                 KErrNone == VoipXmlUtils::DesToInt( aValue, intValue ))
   234                 KErrNone == VoipXmlUtils::DesToInt( aValue, intValue ))
   230                 {
   235                 {
   231                 iCurrentIap.iCurrentWepKey.iLength = intValue;
   236                 iCurrentIap.iCurrentWepKey.iLength = intValue;
   232                 iSettingsSet = ETrue;
       
   233                 }
   237                 }
   234             break;
   238             break;
   235             }
   239             }
   236         case EData:
   240         case EData:
   237             {
   241             {
   238             if ( EWepKey == aType && KMaxWepKeyDataLength >= aValue.Length() )
   242             if ( EWepKey == aType && KMaxWepKeyDataLength >= aValue.Length() )
   239                 {
   243                 {
   240                 iCurrentIap.iCurrentWepKey.iData.Copy( aValue );
   244                 iCurrentIap.iCurrentWepKey.iData.Copy( aValue );
   241                 iSettingsSet = ETrue;
   245                 }
       
   246             break;
       
   247             }
       
   248         case EUsername:
       
   249             {
       
   250             if ( EEap == aType )
       
   251                 {
       
   252                 iCurrentIap.iEapUsername = aValue.Alloc();
       
   253                 }
       
   254             break;
       
   255             }
       
   256         case EPassword:
       
   257             {
       
   258             if ( EEap == aType )
       
   259                 {
       
   260                 iCurrentIap.iEapPassword = aValue.Alloc();
   242                 }
   261                 }
   243             break;
   262             break;
   244             }
   263             }
   245         default:
   264         default:
   246             break;
   265             break;
   279 // Informs that currently deployed settings have ended.
   298 // Informs that currently deployed settings have ended.
   280 // ---------------------------------------------------------------------------
   299 // ---------------------------------------------------------------------------
   281 //
   300 //
   282 void CVoipXmlIapHandler::SettingsEnd( TInt aType )
   301 void CVoipXmlIapHandler::SettingsEnd( TInt aType )
   283     {
   302     {
       
   303     //lint -e{960} No need for else statement here
   284     if ( EWepKey == aType && iCurrentIap.iWepKeys.Count() < KMaxWepKeyCount )
   304     if ( EWepKey == aType && iCurrentIap.iWepKeys.Count() < KMaxWepKeyCount )
   285         {
   305         {
   286         TInt keyDataLength = iCurrentIap.iCurrentWepKey.iData.Length();
   306         TInt keyDataLength = iCurrentIap.iCurrentWepKey.iData.Length();
   287         TBool okToAdd( EFalse );
   307         TBool okToAdd( EFalse );
   288         switch ( keyDataLength )
   308         switch ( keyDataLength )
   356         }
   376         }
   357     iCurrentIap.iHidden = EFalse;
   377     iCurrentIap.iHidden = EFalse;
   358     iCurrentIap.iSecurityType = CMManager::EWlanSecModeOpen;
   378     iCurrentIap.iSecurityType = CMManager::EWlanSecModeOpen;
   359     iCurrentIap.iNetworkMode = CMManager::EInfra;
   379     iCurrentIap.iNetworkMode = CMManager::EInfra;
   360     iCurrentIap.iWepAuthMode = CWEPSecuritySettings::EAuthOpen;
   380     iCurrentIap.iWepAuthMode = CWEPSecuritySettings::EAuthOpen;
       
   381 
       
   382     iCurrentIap.iEapType = EAPSettings::EEapNone;
       
   383     if ( iCurrentIap.iEapUsername )
       
   384         {
       
   385         delete iCurrentIap.iEapUsername;
       
   386         iCurrentIap.iEapUsername = NULL;
       
   387         }
       
   388     if ( iCurrentIap.iEapPassword )
       
   389         {
       
   390         delete iCurrentIap.iEapPassword;
       
   391         iCurrentIap.iEapPassword = NULL;
       
   392         }
   361     }
   393     }
   362 
   394 
   363 // ---------------------------------------------------------------------------
   395 // ---------------------------------------------------------------------------
   364 // Resets iIaps members.
   396 // Resets iIaps members.
   365 // ---------------------------------------------------------------------------
   397 // ---------------------------------------------------------------------------
   386             }
   418             }
   387         iIaps[counter]->iWepKeys.Reset();
   419         iIaps[counter]->iWepKeys.Reset();
   388         if ( aCloseArray )
   420         if ( aCloseArray )
   389             {
   421             {
   390             iIaps[counter]->iWepKeys.Close();
   422             iIaps[counter]->iWepKeys.Close();
       
   423             }
       
   424         if ( iIaps[counter]->iEapUsername )
       
   425             {
       
   426             delete iIaps[counter]->iEapUsername;
       
   427             iIaps[counter]->iEapUsername = NULL;
       
   428             }
       
   429         if ( iIaps[counter]->iEapPassword )
       
   430             {
       
   431             delete iIaps[counter]->iEapPassword;
       
   432             iIaps[counter]->iEapPassword = NULL;
   391             }
   433             }
   392         }
   434         }
   393     iIaps.ResetAndDestroy();
   435     iIaps.ResetAndDestroy();
   394     if ( aCloseArray )
   436     if ( aCloseArray )
   395         {
   437         {
   411         }
   453         }
   412     TTemporaryIap* iap = new TTemporaryIap;
   454     TTemporaryIap* iap = new TTemporaryIap;
   413     iap->iSsid = HBufC::NewLC( KMaxNodeValueLength ); // CS:1
   455     iap->iSsid = HBufC::NewLC( KMaxNodeValueLength ); // CS:1
   414     iap->iName = HBufC::NewLC( KMaxNodeValueLength ); // CS:2
   456     iap->iName = HBufC::NewLC( KMaxNodeValueLength ); // CS:2
   415     iap->iPreSharedKey = HBufC::NewLC( KMaxNodeValueLength ); // CS:3
   457     iap->iPreSharedKey = HBufC::NewLC( KMaxNodeValueLength ); // CS:3
       
   458     iap->iEapUsername = HBufC::NewLC( KMaxNodeValueLength ); // CS:4
       
   459     iap->iEapPassword = HBufC::NewLC( KMaxNodeValueLength ); // CS:5
   416 
   460 
   417     iap->iSsid->Des().Copy( iCurrentIap.iSsid->Des() );
   461     iap->iSsid->Des().Copy( iCurrentIap.iSsid->Des() );
   418     if ( iCurrentIap.iName )
   462     if ( iCurrentIap.iName )
   419         {
   463         {
   420         iap->iName->Des().Copy( iCurrentIap.iName->Des() );
   464         iap->iName->Des().Copy( iCurrentIap.iName->Des() );
   421         }
   465         }
   422     else
   466     else
   423         {
   467         {
   424         iap->iName->Des().Copy( iCurrentIap.iSsid->Des() );
   468         iap->iName->Des().Copy( iCurrentIap.iSsid->Des() );
   425         }
   469         }
       
   470 
   426     if ( iCurrentIap.iPreSharedKey )
   471     if ( iCurrentIap.iPreSharedKey )
   427         {
   472         {
   428         iap->iPreSharedKey->Des().Copy( iCurrentIap.iPreSharedKey->Des() );
   473         iap->iPreSharedKey->Des().Copy( iCurrentIap.iPreSharedKey->Des() );
   429         }
   474         }
       
   475 
       
   476     iap->iEapType = iCurrentIap.iEapType;
       
   477     if ( iCurrentIap.iEapUsername )
       
   478         {
       
   479         iap->iEapUsername->Des().Copy( iCurrentIap.iEapUsername->Des() );
       
   480         }
       
   481     if ( iCurrentIap.iEapPassword )
       
   482         {
       
   483         iap->iEapPassword->Des().Copy( iCurrentIap.iEapPassword->Des() );
       
   484         }
       
   485 
   430     iap->iHidden = iCurrentIap.iHidden;
   486     iap->iHidden = iCurrentIap.iHidden;
   431     iap->iNetworkMode = iCurrentIap.iNetworkMode;
   487     iap->iNetworkMode = iCurrentIap.iNetworkMode;
   432     iap->iSecurityType = iCurrentIap.iSecurityType;
   488     iap->iSecurityType = iCurrentIap.iSecurityType;
   433     iap->iWepAuthMode = iCurrentIap.iWepAuthMode;
   489     iap->iWepAuthMode = iCurrentIap.iWepAuthMode;
   434     const TInt count = iCurrentIap.iWepKeys.Count();
   490     const TInt count = iCurrentIap.iWepKeys.Count();
   435     for ( TInt counter = 0; counter < count; counter++ )
   491     for ( TInt counter = 0; counter < count; counter++ )
   436         {
   492         {
   437         iap->iWepKeys.Append( iCurrentIap.iWepKeys[counter] );
   493         iap->iWepKeys.Append( iCurrentIap.iWepKeys[counter] );
   438         }
   494         }
   439     iIaps.AppendL( iap );
   495     iIaps.AppendL( iap );
   440     CleanupStack::Pop( 3, iap->iSsid );
   496     CleanupStack::Pop( 5, iap->iSsid );
   441     }
   497     }
   442 
   498 
   443 // ---------------------------------------------------------------------------
   499 // ---------------------------------------------------------------------------
   444 // Stores settings.
   500 // Stores settings.
   445 // ---------------------------------------------------------------------------
   501 // ---------------------------------------------------------------------------
   524 // ---------------------------------------------------------------------------
   580 // ---------------------------------------------------------------------------
   525 //
   581 //
   526 TUint32 CVoipXmlIapHandler::CreateIapL( RCmManagerExt& aCmManager, 
   582 TUint32 CVoipXmlIapHandler::CreateIapL( RCmManagerExt& aCmManager, 
   527     TTemporaryIap aTempIap )
   583     TTemporaryIap aTempIap )
   528     {
   584     {
       
   585     DBG_PRINT( "CVoipXmlIapHandler::CreateIapL - begin" );
   529     RCmConnectionMethodExt newConnMethod = 
   586     RCmConnectionMethodExt newConnMethod = 
   530         aCmManager.CreateConnectionMethodL( KUidWlanBearerType );
   587         aCmManager.CreateConnectionMethodL( KUidWlanBearerType );
   531     CleanupClosePushL( newConnMethod ); // CS:1
   588     CleanupClosePushL( newConnMethod ); // CS:1
   532     newConnMethod.SetStringAttributeL( CMManager::ECmName, 
   589     newConnMethod.SetStringAttributeL( CMManager::ECmName, 
   533         aTempIap.iName->Des() );
   590         aTempIap.iName->Des() );
   543         aTempIap.iSecurityType );
   600         aTempIap.iSecurityType );
   544     newConnMethod.UpdateL();
   601     newConnMethod.UpdateL();
   545     TUint32 wlanId = newConnMethod.GetIntAttributeL( 
   602     TUint32 wlanId = newConnMethod.GetIntAttributeL( 
   546         CMManager::EWlanServiceId );
   603         CMManager::EWlanServiceId );
   547     TUint32 iapId = newConnMethod.GetIntAttributeL( CMManager::ECmIapId );
   604     TUint32 iapId = newConnMethod.GetIntAttributeL( CMManager::ECmIapId );
   548 
   605     TUint32 iapServiceId = newConnMethod.GetIntAttributeL( 
       
   606         CMManager::ECmIapServiceId );
   549     CleanupStack::PopAndDestroy( &newConnMethod ); // CS:0
   607     CleanupStack::PopAndDestroy( &newConnMethod ); // CS:0
   550 
   608 
   551     if ( aTempIap.iSecurityType == CMManager::EWlanSecModeWep )
   609     if ( aTempIap.iSecurityType == CMManager::EWlanSecModeWep )
   552         {
   610         {
       
   611         DBG_PRINT( "   secMode WEP" );
   553         CMDBSession* db = CMDBSession::NewLC( CMDBSession::LatestVersion() );
   612         CMDBSession* db = CMDBSession::NewLC( CMDBSession::LatestVersion() );
   554         // CS:1
   613         // CS:1
   555         CWEPSecuritySettings* wepSecSettings = 
   614         CWEPSecuritySettings* wepSecSettings = 
   556             CWEPSecuritySettings::NewL();
   615             CWEPSecuritySettings::NewL();
   557         CleanupStack::PushL( wepSecSettings ); // CS:2
   616         CleanupStack::PushL( wepSecSettings ); // CS:2
   560             {
   619             {
   561             User::LeaveIfError( wepSecSettings->SetKeyDataL( 
   620             User::LeaveIfError( wepSecSettings->SetKeyDataL( 
   562                 counter, aTempIap.iWepKeys[counter].iData, 
   621                 counter, aTempIap.iWepKeys[counter].iData, 
   563                 aTempIap.iWepKeys[counter].iHex ) );
   622                 aTempIap.iWepKeys[counter].iHex ) );
   564             }
   623             }
   565         wepSecSettings->SaveL( wlanId, *db );             
   624         wepSecSettings->SaveL( wlanId, *db );
   566         // wepSecSettings, db 
   625         // wepSecSettings, db
   567         CleanupStack::PopAndDestroy( 2, db ); // CS:0
   626         CleanupStack::PopAndDestroy( 2, db ); // CS:0
   568         }
   627         }
   569     else if ( aTempIap.iSecurityType == CMManager::EWlanSecMode802_1x ||
   628     else if ( CMManager::EWlanSecModeWpa == aTempIap.iSecurityType ||
   570         aTempIap.iSecurityType == CMManager::EWlanSecModeWpa ||
   629         CMManager::EWlanSecModeWpa2 == aTempIap.iSecurityType )
   571         aTempIap.iSecurityType == CMManager::EWlanSecModeWpa2 )
   630         {
   572         {
   631         DBG_PRINT( "   secMode WPA/WPA2" );
   573         CMDBSession* db = CMDBSession::NewLC( CMDBSession::LatestVersion() );
   632         CMDBSession* db = CMDBSession::NewLC( 
   574         // CS:1
   633             CMDBSession::LatestVersion() ); // CS:1
   575         CWPASecuritySettings* wpaSecSettings = 
   634         CWPASecuritySettings* wpaSecSettings = 
   576             CWPASecuritySettings::NewL( ESecurityModeWpa );
   635             CWPASecuritySettings::NewL( ESecurityModeWpa );
       
   636         CleanupStack::PushL( wpaSecSettings ); // CS:2
       
   637 
       
   638         if ( EAPSettings::EEapNone == aTempIap.iEapType )
       
   639             {
       
   640             DBG_PRINT( "   EapType none" );
       
   641             User::LeaveIfError( wpaSecSettings->SetWPAPreSharedKey( 
       
   642                 aTempIap.iPreSharedKey->Des() ));
       
   643             }
       
   644         else if ( EAPSettings::EEapLeap == aTempIap.iEapType )
       
   645             {
       
   646             DBG_PRINT( "   eapType Leap" );
       
   647             TBuf8<KMaxNodeValueLength> eapId;
       
   648             eapId.Copy( KEapLeapId, KEapChars );
       
   649             CEapType* eapType = CEapType::NewL( eapId, ELan, iapServiceId );
       
   650             CleanupStack::PushL( eapType ); // CS:3
       
   651             EAPSettings* eapSettings = new (ELeave) EAPSettings();
       
   652             CleanupStack::PushL( eapSettings ); // CS:4
       
   653             eapSettings->iEAPType = EAPSettings::EEapLeap;
       
   654             eapSettings->iUsername.Copy( aTempIap.iEapUsername->Des() );
       
   655             eapSettings->iUsernamePresent = ETrue;
       
   656             eapSettings->iPassword.Copy( aTempIap.iEapPassword->Des() );
       
   657             eapSettings->iPasswordPresent = ETrue;
       
   658             eapType->SetConfigurationL( *eapSettings );
       
   659             CleanupStack::PopAndDestroy( 2, eapType );
       
   660             wpaSecSettings->SetWPAEnabledEAPPlugin( eapId );
       
   661             }
       
   662         wpaSecSettings->SaveL( wlanId, *db, ESavingBrandNewAP, 0 );
       
   663         // wpaSecSettings, db
       
   664         CleanupStack::PopAndDestroy( 2, db ); // CS:0
       
   665         }
       
   666     else if ( CMManager::EWlanSecMode802_1x == aTempIap.iSecurityType )
       
   667         {
       
   668         DBG_PRINT( "   secMode 802.1X" );
       
   669         CMDBSession* db = CMDBSession::NewLC( 
       
   670             CMDBSession::LatestVersion() ); // CS:1
       
   671         CWPASecuritySettings* wpaSecSettings = 
       
   672             CWPASecuritySettings::NewL( ESecurityMode8021x );
   577         CleanupStack::PushL( wpaSecSettings ); // CS:2
   673         CleanupStack::PushL( wpaSecSettings ); // CS:2
   578         User::LeaveIfError( wpaSecSettings->SetWPAPreSharedKey( 
   674         User::LeaveIfError( wpaSecSettings->SetWPAPreSharedKey( 
   579             aTempIap.iPreSharedKey->Des() ));
   675             aTempIap.iPreSharedKey->Des() ));
   580         wpaSecSettings->SaveL( wlanId, *db, ESavingBrandNewAP, 0 );
   676         wpaSecSettings->SaveL( wlanId, *db, ESavingBrandNewAP, 0 );
   581         // wpaSecSettings, db
   677         // wpaSecSettings, db
   582         CleanupStack::PopAndDestroy( 2, db ); // CS:0
   678         CleanupStack::PopAndDestroy( 2, db ); // CS:0
   583         }
   679         }
       
   680     DBG_PRINT( "CVoipXmlIapHandler::CreateIapL - end" );
   584     return iapId;
   681     return iapId;
   585     }
   682     }
   586 
   683 
   587 // End of file.
   684 // End of file.