diff -r c74b3d9f6b9e -r 9c2aa05919d9 wlansecuritysettings/wpasecuritysettingsui/src/WPASecuritySettingsImpl.cpp --- a/wlansecuritysettings/wpasecuritysettingsui/src/WPASecuritySettingsImpl.cpp Wed Sep 01 12:23:57 2010 +0100 +++ b/wlansecuritysettings/wpasecuritysettingsui/src/WPASecuritySettingsImpl.cpp Wed Oct 13 14:35:46 2010 +0300 @@ -16,7 +16,7 @@ */ /* -* %version: tr1cfwln#29 % +* %version: tr1cfwln#27 % */ // INCLUDE FILES @@ -69,8 +69,7 @@ TSecurityMode aSecurityMode ) : iSecurityMode( aSecurityMode ), iWPAMode( EFalse ), - iWpa2Only( EFalse ), - iWPAUnencryptedConn( EFalse ) + iWpa2Only( EFalse ) { iWPAEAPPlugin.Zero(); iWPAPreSharedKey.Zero(); @@ -124,26 +123,18 @@ TInt errorCode = wLanServiceTable->GotoFirstRecord(); if ( errorCode == KErrNone ) { - if ( iSecurityMode == ESecurityMode8021x ) - { - // in 802.1x PSK mode is not supported - iWPAMode = EFalse; + // Get WPA Mode + TRAPD( err, wLanServiceTable->ReadUintL( TPtrC( WLAN_ENABLE_WPA_PSK ), + ( TUint32& ) iWPAMode ) ); + if ( err != KErrNone ) + { // do not leave if value is not present in table... + if ( err != KErrUnknown ) + User::Leave( err ); } - else - { - // Get WPA Mode - TRAPD( err, wLanServiceTable->ReadUintL( TPtrC( WLAN_ENABLE_WPA_PSK ), - ( TUint32& ) iWPAMode ) ); - if ( err != KErrNone ) - { // do not leave if value is not present in table... - if ( err != KErrUnknown ) - User::Leave( err ); - } - } - + TUint32 secMode = 0; // Get WPA2 Only Mode - TRAPD( err, wLanServiceTable->ReadUintL( TPtrC( WLAN_SECURITY_MODE ), + TRAP( err, wLanServiceTable->ReadUintL( TPtrC( WLAN_SECURITY_MODE ), secMode ) ); if ( err != KErrNone ) { // do not leave if value is not present in table... @@ -153,19 +144,6 @@ iWpa2Only = secMode == EWpa2; - // Get Unencrypted Connection mode for 802.1x - if ( iSecurityMode == ESecurityMode8021x ) - { - // WLAN_WPA_KEY_LENGTH is used also for Unencrypted Connection mode - TRAPD( err2, wLanServiceTable->ReadUintL( TPtrC( WLAN_WPA_KEY_LENGTH ), - ( TUint32& ) iWPAUnencryptedConn ) ); - if ( err2 != KErrNone ) - { // do not leave if value is not present in table... - if ( err2 != KErrUnknown ) - User::Leave( err2 ); - } - } - // Get EAP list iWPAEAPPlugin.Copy( *wLanServiceTable->ReadLongTextLC( TPtrC( WLAN_EAPS ) ) ); @@ -270,11 +248,8 @@ } // Get PreShared Key - if ( iSecurityMode != ESecurityMode8021x ) - { - wLanServiceTable->ReadTextL( TPtrC( WLAN_WPA_PRE_SHARED_KEY ), + wLanServiceTable->ReadTextL( TPtrC( WLAN_WPA_PRE_SHARED_KEY ), iWPAPreSharedKey ); - } if ( !IsValidPsk( iWPAPreSharedKey ) ) { @@ -318,11 +293,8 @@ } // Save WPA Mode - if ( iSecurityMode != ESecurityMode8021x ) - { - wLanServiceTable->WriteUintL( TPtrC( WLAN_ENABLE_WPA_PSK ), + wLanServiceTable->WriteUintL( TPtrC( WLAN_ENABLE_WPA_PSK ), ( TUint32& ) iWPAMode ); - } TUint32 secMode; @@ -359,26 +331,13 @@ iWPADisabledEAPPlugin? (const TDesC8&)*iWPADisabledEAPPlugin: (const TDesC8&)KNullDesC8 ); - - + // Save PreShared Key + wLanServiceTable->WriteTextL( TPtrC( WLAN_WPA_PRE_SHARED_KEY ), + iWPAPreSharedKey ); - if ( iSecurityMode == ESecurityMode8021x ) - { - // In 802.1x WpaKeyLength is not used - // and the field is reused to save UnencryptedConn mode - wLanServiceTable->WriteUintL( TPtrC( WLAN_WPA_KEY_LENGTH ), - ( TUint32& ) iWPAUnencryptedConn ); - } - else - { - // Save PreShared Key - wLanServiceTable->WriteTextL( TPtrC( WLAN_WPA_PRE_SHARED_KEY ), - iWPAPreSharedKey ); - - // Save PreShared Key Length - wLanServiceTable->WriteUintL( TPtrC( WLAN_WPA_KEY_LENGTH ), - iWPAPreSharedKey.Length() ); - } + // Save PreShared Key Length + wLanServiceTable->WriteUintL( TPtrC( WLAN_WPA_KEY_LENGTH ), + iWPAPreSharedKey.Length() ); wLanServiceTable->PutRecordChanges(); @@ -583,32 +542,16 @@ if( generic->FindL( aSession) ) { - if ( iSecurityMode == ESecurityMode8021x ) - { - // in 802.1x PSK mode is not supported - iWPAMode = EFalse; - } - else - { - // Get WPA mode - CMDBField* enableWpaPskField = static_cast*> + // Get WPA mode + CMDBField* enableWpaPskField = static_cast*> ( generic->GetFieldByIdL( KCDTIdWlanEnableWpaPsk ) ); - iWPAMode = *enableWpaPskField; - } + iWPAMode = *enableWpaPskField; // Get WPA2 Only Mode CMDBField* secModeField = static_cast*> ( generic->GetFieldByIdL( KCDTIdWlanSecMode ) ); TUint32 secMode = *secModeField; iWpa2Only = secMode == EWpa2; - - // Get 802.1x Unencrypted Connection saved in reused WpaKeyLengthField - if ( iSecurityMode == ESecurityMode8021x ) - { - CMDBField* WpaKeyLengthField = static_cast*> - ( generic->GetFieldByIdL( KCDTIdWlanWpaKeyLength ) ); - iWPAUnencryptedConn = *WpaKeyLengthField; - } // Get EAP plugins CMDBField* wlanEapsField = static_cast*> @@ -709,13 +652,10 @@ } // GetWPA preshared key - if ( iSecurityMode != ESecurityMode8021x ) - { - CMDBField* wpaPskField = static_cast*> + CMDBField* wpaPskField = static_cast*> ( generic->GetFieldByIdL( KCDTIdWlanWpaPreSharedKey ) ); - iWPAPreSharedKey = *wpaPskField; - } - + iWPAPreSharedKey = *wpaPskField; + if ( !IsValidPsk( iWPAPreSharedKey ) ) { // invalid key format @@ -758,14 +698,11 @@ // If loading failed, WLAN service record will be // created and StoreL()-d, otherwise, ModifyL() - - if ( iSecurityMode != ESecurityMode8021x ) - { - // Set WPA mode - CMDBField* enableWpaPskField = static_cast*> - ( generic->GetFieldByIdL( KCDTIdWlanEnableWpaPsk ) ); - enableWpaPskField->SetL( iWPAMode ); - } + + // Set WPA mode + CMDBField* enableWpaPskField = static_cast*> + ( generic->GetFieldByIdL( KCDTIdWlanEnableWpaPsk ) ); + enableWpaPskField->SetL( iWPAMode ); // Set security mode TUint32 secMode; @@ -808,23 +745,15 @@ (const TDesC8&)*iWPADisabledEAPPlugin: (const TDesC8&)KNullDesC8 ); + // Save PreShared Key + CMDBField* wpaPskField = static_cast*> + ( generic->GetFieldByIdL( KCDTIdWlanWpaPreSharedKey ) ); + wpaPskField->SetL( iWPAPreSharedKey ); + // Save PreShared Key length CMDBField* keyLengthField = static_cast*> ( generic->GetFieldByIdL( KCDTIdWlanWpaKeyLength ) ); - if ( iSecurityMode == ESecurityMode8021x ) - { - // In 802.1x keyLengthField is reused to contain Unencrypted Connection info - keyLengthField->SetL( iWPAUnencryptedConn ); - } - else - { - keyLengthField->SetL( iWPAPreSharedKey.Length() ); - - // Save PreShared Key - CMDBField* wpaPskField = static_cast*> - ( generic->GetFieldByIdL( KCDTIdWlanWpaPreSharedKey ) ); - wpaPskField->SetL( iWPAPreSharedKey ); - } + keyLengthField->SetL( iWPAPreSharedKey.Length() ); TInt error( KErrNone );