eapol/eapol_framework/eapol_symbian/am/type/tls_peap/symbian/plugin/src/EapTlsPeapUtils.cpp
author Pat Downey <patd@symbian.org>
Wed, 01 Sep 2010 12:23:57 +0100
branchRCL_3
changeset 46 c74b3d9f6b9e
parent 45 bad0cc58d154
permissions -rw-r--r--
Revert incorrect RCL_3 drop: Revision: 201029 Kit: 201035
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     1
/*
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     2
* Copyright (c) 2001-2006 Nokia Corporation and/or its subsidiary(-ies).
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     3
* All rights reserved.
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     4
* This component and the accompanying materials are made available
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     5
* under the terms of the License "Eclipse Public License v1.0"
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     6
* which accompanies this distribution, and is available
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     8
*
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     9
* Initial Contributors:
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    10
* Nokia Corporation - initial contribution.
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    11
*
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    12
* Contributors:
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    13
*
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    14
* Description:  EAP and WLAN authentication protocols.
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    15
*
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    16
*/
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    17
2
1c7bc153c08e Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
    18
/*
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
    19
* %version: 76.1.1.1.6 %
2
1c7bc153c08e Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
    20
*/
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    21
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    22
// This is enumeration of EAPOL source code.
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    23
#if defined(USE_EAP_MINIMUM_RELEASE_TRACES)
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    24
	#undef EAP_FILE_NUMBER_ENUM
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    25
	#define EAP_FILE_NUMBER_ENUM 438 
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    26
	#undef EAP_FILE_NUMBER_DATE 
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    27
	#define EAP_FILE_NUMBER_DATE 1127594498 
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    28
#endif //#if defined(USE_EAP_MINIMUM_RELEASE_TRACES)
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    29
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    30
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    31
// INCLUDE FILES
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    32
#include "EapTlsPeapUtils.h"
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    33
#include "EapTlsPeapDbDefaults.h"
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    34
#include "EapTlsPeapDbParameterNames.h"
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    35
#include <x500dn.h>
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    36
#include <x509cert.h>
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    37
#include <x509certext.h>
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    38
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    39
#ifdef USE_FAST_EAP_TYPE
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    40
#include "pac_store_db_parameters.h"
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    41
#endif //#ifdef USE_FAST_EAP_TYPE
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    42
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
    43
#include "eap_am_trace_symbian.h"
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    44
#include "EapTlsPeapCertFetcher.h"
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    45
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    46
const TUint KMaxSqlQueryLength = 2048;
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    47
const TInt	KMicroSecsInAMinute = 60000000; // 60000000 micro seconds is 1 minute.
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    48
const TInt	KDefaultColumnInView_One = 1; // For DB view.
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    49
const TInt 	KMaxEapDbTableNameLength = 64;
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    50
// ================= MEMBER FUNCTIONS =======================
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    51
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    52
void EapTlsPeapUtils::OpenDatabaseL(
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
    53
	RDbNamedDatabase& aDatabase, 
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
    54
	RDbs& aSession, 
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    55
	const TIndexType aIndexType,
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
    56
	const TInt aIndex, 
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    57
	const eap_type_value_e aTunnelingType,
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    58
	eap_type_value_e aEapType)
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    59
{
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
    60
#ifdef USE_EAP_EXPANDED_TYPES
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
    61
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    62
	EAP_TRACE_DEBUG_SYMBIAN(
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
    63
		(_L("EapTlsPeapUtils::OpenDatabaseL -Start- aIndexType=%d, aIndex=%d, Tunneling vendor type=%d, Eap vendor type=%d \n"),
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
    64
		aIndexType,aIndex, aTunnelingType.get_vendor_type(), aEapType.get_vendor_type()));
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
    65
#else
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
    66
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
    67
	EAP_TRACE_DEBUG_SYMBIAN(
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
    68
		(_L("EapTlsPeapUtils::OpenDatabaseL -Start- aIndexType=%d, aIndex=%d, aTunnelingType=%d, aEapType=%d \n"),
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
    69
		aIndexType,aIndex, aTunnelingType, aEapType));
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
    70
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
    71
#endif //#ifdef USE_EAP_EXPANDED_TYPES
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    72
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    73
	if (aEapType == eap_type_tls)
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    74
	{
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
    75
		OpenTlsDatabaseL(aDatabase, aSession, aIndexType, aIndex, aTunnelingType);
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    76
	} 
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    77
	else if (aEapType == eap_type_peap)
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    78
	{
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
    79
		OpenPeapDatabaseL(aDatabase, aSession, aIndexType, aIndex, aTunnelingType);
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    80
	} 
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    81
#if defined(USE_TTLS_EAP_TYPE)
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    82
	else if (aEapType == eap_type_ttls)
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    83
	{
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
    84
		OpenTtlsDatabaseL(aDatabase, aSession, aIndexType, aIndex, aTunnelingType);
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    85
	} 
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    86
#endif // #if defined(USE_TTLS_EAP_TYPE)
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    87
#if defined(USE_FAST_EAP_TYPE)
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    88
	else if (aEapType == eap_type_fast)
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    89
	{
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
    90
		OpenFastDatabaseL(aDatabase, aSession, aIndexType, aIndex, aTunnelingType);
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    91
	} 
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    92
#endif // #if defined(USE_FAST_EAP_TYPE)
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
    93
	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
    94
	else if ( aEapType == eap_type_ttls_plain_pap )
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
    95
		{
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
    96
		OpenTtlsDatabaseL( aDatabase, aSession, aIndexType, aIndex, aTunnelingType);
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
    97
		}
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
    98
	
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    99
	else
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   100
	{
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   101
		// Unsupported EAP type
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   102
		User::Leave(KErrNotSupported);
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   103
	}	
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   104
} // EapTlsPeapUtils::OpenDatabaseL()
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   105
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   106
void EapTlsPeapUtils::OpenTlsDatabaseL(
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   107
		RDbNamedDatabase& aDatabase, 
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   108
		RDbs& aSession, 
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   109
		const TIndexType aIndexType, 
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   110
		const TInt aIndex,
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   111
		const eap_type_value_e aTunnelingType)
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   112
{
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   113
#ifdef USE_EAP_EXPANDED_TYPES
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   114
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   115
	TUint aTunnelingVendorType = aTunnelingType.get_vendor_type();
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   116
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   117
#else
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   118
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   119
	TUint aTunnelingVendorType = static_cast<TUint>(aTunnelingType);
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   120
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   121
#endif //#ifdef USE_EAP_EXPANDED_TYPES
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   122
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   123
	EAP_TRACE_DEBUG_SYMBIAN(
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   124
		(_L("EapTlsPeapUtils::OpenTlsDatabaseL -Start- aIndexType=%d, aIndex=%d, Tunneling vendor type=%d \n"),
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   125
		aIndexType,aIndex, aTunnelingVendorType));
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   126
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   127
	// 1. Open/create a database	
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   128
	
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   129
	// Connect to the DBMS server.
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   130
	User::LeaveIfError(aSession.Connect());		
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   131
	CleanupClosePushL(aSession);	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   132
	// aSession and aDatabase are pushed to the cleanup stack even though they may be member
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   133
	// variables of the calling class and would be closed in the destructor anyway. This ensures
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   134
	// that if they are not member variables they will be closed. Closing the handle twice
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   135
	// does no harm.	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   136
	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   137
#ifdef SYMBIAN_SECURE_DBMS
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   138
	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   139
	// Create the secure shared database with the specified secure policy.
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   140
	// Database will be created in the data caging path for DBMS (C:\private\100012a5).
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   141
	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   142
	TInt err = aDatabase.Create(aSession, KTlsDatabaseName, KSecureUIDFormat);
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   143
	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   144
	EAP_TRACE_DEBUG_SYMBIAN((_L("EapTlsPeapUtils::OpenTlsDatabaseL - Created Secure DB for eaptls.dat. err=%d\n"), err) );
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   145
	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   146
	if(err == KErrNone)
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   147
	{
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   148
		aDatabase.Close();
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   149
		
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   150
	} else if (err != KErrAlreadyExists) 
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   151
	{
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   152
		User::LeaveIfError(err);
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   153
	}
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   154
	
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   155
	User::LeaveIfError(aDatabase.Open(aSession, KTlsDatabaseName, KSecureUIDFormat));
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   156
	CleanupClosePushL(aDatabase);		
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   157
		
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   158
#else
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   159
	// For non-secured database. The database will be created in the old location (c:\system\data).
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   160
	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   161
	RFs fsSession;		
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   162
	User::LeaveIfError(fsSession.Connect());
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   163
	CleanupClosePushL(fsSession);	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   164
	TInt err = aDatabase.Create(fsSession, KTlsDatabaseName);
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   165
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   166
	EAP_TRACE_DEBUG_SYMBIAN((_L("EapTlsPeapUtils::OpenTlsDatabaseL - Created Non-Secure DB for eaptls.dat. err=%d\n"), err) );
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   167
	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   168
	if(err == KErrNone)
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   169
	{
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   170
		aDatabase.Close();
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   171
		
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   172
	} else if (err != KErrAlreadyExists) 
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   173
	{
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   174
		User::LeaveIfError(err);
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   175
	}
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   176
	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   177
	User::LeaveIfError(aDatabase.Open(fsSession, KTlsDatabaseName));
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   178
	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   179
	CleanupStack::PopAndDestroy(); // close fsSession
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   180
	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   181
	CleanupClosePushL(aDatabase);		
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   182
	    
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   183
#endif // #ifdef SYMBIAN_SECURE_DBMS
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   184
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   185
	// 2. Create the eaptls table to database (ignore error if exists)
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   186
	
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   187
// Table columns:
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   188
//// NAME ////////////////////////////////////////// TYPE //////////// Constant ////////////////////
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   189
//| ServiceType									| UNSIGNED INTEGER | KServiceType         |//
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   190
//| ServiceIndex								| UNSIGNED INTEGER | KServiceIndex        |//
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   191
//| TunnelingType								| UNSIGNED INTEGER | KTunnelingType		|//
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   192
//| EAP_TLS_PEAP_use_manual_realm				| UNSIGNED INTEGER | cf_str_EAP_TLS_PEAP_use_manual_realm_literal      |//
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   193
//| EAP_TLS_PEAP_manual_realm					| VARCHAR(255)     | cf_str_EAP_TLS_PEAP_manual_realm_literal				|//
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   194
//| EAP_TLS_PEAP_use_manual_username			| UNSIGNED INTEGER | cf_str_EAP_TLS_PEAP_use_manual_username_literal   |//
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   195
//| EAP_TLS_PEAP_manual_username				| VARCHAR(255)     | cf_str_EAP_TLS_PEAP_manual_username_literal			|//
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   196
//| EAP_TLS_PEAP_cipher_suite					| UNSIGNED INTEGER | cf_str_EAP_TLS_PEAP_cipher_suite_literal	    |//
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   197
//| EAP_TLS_server_authenticates_client			| UNSIGNED INTEGER | cf_str_TLS_server_authenticates_client_policy_in_client_literal |//
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   198
//| CA_cert_label								| VARCHAR(255)     | KCACertLabelOld	    |//
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   199
//| client_cert_label							| VARCHAR(255)     | KClientCertLabel	    |//
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   200
//| EAP_TLS_PEAP_saved_session_id				| BINARY(32)       | cf_str_EAP_TLS_PEAP_saved_session_id_literal		    |//
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   201
//| EAP_TLS_PEAP_saved_master_secret			| BINARY(48)       | cf_str_EAP_TLS_PEAP_saved_master_secret_literal	    |//
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   202
//| EAP_TLS_PEAP_saved_cipher_suite				| UNSIGNED INTEGER | cf_str_EAP_TLS_PEAP_saved_cipher_suite_literal    |//
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   203
//| EAP_TLS_PEAP_verify_certificate_realm		| UNSIGNED INTEGER | cf_str_EAP_TLS_PEAP_verify_certificate_realm_literal		    |//
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   204
//| EAP_TLS_max_session_validity_time			| BIGINT	   	 	| cf_str_EAP_TLS_max_session_validity_time_literal   |//
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   205
//| EAP_TLS_last_full_authentication_time		| BIGINT	   		| KTLSLastFullAuthTime	   	|//	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   206
//| EAP_TLS_PEAP_use_identity_privacy	    	| UNSIGNED INTEGER 	| cf_str_EAP_TLS_PEAP_use_identity_privacy_literal|//
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   207
///////////////////////////////////////////////////////////////////////////////////////////////////////////////	
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   208
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   209
	HBufC* buf = HBufC::NewLC(KMaxSqlQueryLength);
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   210
	TPtr sqlStatement = buf->Des();
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   211
	
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   212
	// Table creation is divided into two parts because otherwise the SQL string would get too long
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   213
	_LIT(KSQLCreateTable1, "CREATE TABLE %S (%S UNSIGNED INTEGER, \
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   214
											 %S UNSIGNED INTEGER, \
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   215
											 %S UNSIGNED INTEGER, \
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   216
											 %S UNSIGNED INTEGER, \
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   217
											 %S VARCHAR(%d),     \
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   218
											 %S UNSIGNED INTEGER, \
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   219
											 %S VARCHAR(%d),     \
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   220
											 %S UNSIGNED INTEGER, \
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   221
											 %S UNSIGNED INTEGER, \
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   222
											 %S VARCHAR(%d),	  \
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   223
											 %S VARCHAR(%d),     \
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   224
											 %S BINARY(%d),		  \
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   225
											 %S BINARY(%d),		  \
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   226
											 %S UNSIGNED INTEGER, \
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   227
											 %S UNSIGNED INTEGER, \
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   228
											 %S BIGINT, \
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   229
											 %S BIGINT, \
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   230
											 %S UNSIGNED INTEGER)");
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   231
											 
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   232
	sqlStatement.Format(KSQLCreateTable1,
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   233
		&KTlsDatabaseTableName,
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   234
		&KServiceType,
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   235
		&KServiceIndex,
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   236
		&KTunnelingType,
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   237
		&cf_str_EAP_TLS_PEAP_use_manual_realm_literal,
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   238
		&cf_str_EAP_TLS_PEAP_manual_realm_literal, KMaxManualRealmLengthInDB,
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   239
		&cf_str_EAP_TLS_PEAP_use_manual_username_literal,
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   240
		&cf_str_EAP_TLS_PEAP_manual_username_literal, KMaxManualUsernameLengthInDB,
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   241
		&cf_str_EAP_TLS_PEAP_cipher_suite_literal, 
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   242
		&cf_str_TLS_server_authenticates_client_policy_in_client_literal,
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   243
		&KCACertLabelOld, KMaxCertLabelLengthInDB,
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   244
		&KClientCertLabel, KMaxCertLabelLengthInDB,
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   245
		&cf_str_EAP_TLS_PEAP_saved_session_id_literal, KMaxSessionIdLengthInDB,
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   246
		&cf_str_EAP_TLS_PEAP_saved_master_secret_literal, KMaxMasterSecretLengthInDB,
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   247
		&cf_str_EAP_TLS_PEAP_saved_cipher_suite_literal,
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   248
		&cf_str_EAP_TLS_PEAP_verify_certificate_realm_literal,		
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   249
		&cf_str_EAP_TLS_max_session_validity_time_literal,
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   250
		&KTLSLastFullAuthTime,
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   251
		&cf_str_EAP_TLS_PEAP_use_identity_privacy_literal);	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   252
	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   253
	err = aDatabase.Execute(sqlStatement);
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   254
	if (err == KErrAlreadyExists)
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   255
	{
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   256
	EAP_TRACE_DEBUG_SYMBIAN((_L("EapTlsPeapUtils::OpenTlsDatabaseL - Alter Table err=%d\n"), err) );
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   257
	_LIT( KColumnDef, "UNSIGNED INTEGER" );
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   258
	AlterTableL( aDatabase, EAddColumn , KTlsDatabaseTableName,
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   259
			cf_str_EAP_TLS_PEAP_use_identity_privacy_literal, KColumnDef);
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   260
	}
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   261
	else if (err != KErrNone)
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   262
		{
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   263
		User::Leave(err);
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   264
		}
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   265
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   266
	// Create table for _allowed_ user certificates
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   267
	
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   268
//// NAME ////////////////// TYPE ////////////// Constant ///////////
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   269
//| ServiceType			| UNSIGNED INTEGER | KServiceType        |//
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   270
//| ServiceIndex		| UNSIGNED INTEGER | KServiceIndex       |//
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   271
//| TunnelingType		| UNSIGNED INTEGER | KTunnelingType		|//
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   272
//| CertLabel			| VARCHAR(255)     | KCertLabel        |//	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   273
//| SubjectKeyId		| BINARY(20)	   | KSubjectKeyIdentifier |// This is Symbian subjectkey id
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   274
//| ActualSubjectKeyId  | BINARY(20)	   | KActualSubjectKeyIdentifier |// This is the actual subjectkeyid present in the certificate.
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   275
//| SubjectName			| VARCHAR(255)     | KSubjectName        |//	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   276
//| IssuerName			| VARCHAR(255)     | KIssuerName        |//	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   277
//| SerialNumber		| VARCHAR(255)     | KSerialNumber        |//	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   278
//| Thumbprint			| BINARY(64)	   | KThumbprint        |//	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   279
//////////////////////////////////////////////////////////////////////////////////////////////////////	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   280
	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   281
	_LIT(KSQLCreateTable2, "CREATE TABLE %S (%S UNSIGNED INTEGER, \
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   282
											 %S UNSIGNED INTEGER, \
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   283
											 %S UNSIGNED INTEGER, \
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   284
											 %S VARCHAR(%d), \
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   285
											 %S BINARY(%d), \
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   286
											 %S BINARY(%d), \
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   287
											 %S VARCHAR(%d), \
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   288
											 %S VARCHAR(%d), \
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   289
											 %S VARCHAR(%d), \
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   290
											 %S BINARY(%d))");											 
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   291
											 
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   292
	sqlStatement.Format(KSQLCreateTable2, &KTlsAllowedUserCertsDatabaseTableName, 
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   293
		&KServiceType, 
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   294
		&KServiceIndex, 
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   295
		&KTunnelingType, 
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   296
		&KCertLabel, KMaxCertLabelLengthInDB,
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   297
		&KSubjectKeyIdentifier, KMaxSubjectKeyIdLengthInDB,
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   298
		&KActualSubjectKeyIdentifier, KKeyIdentifierLength,
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   299
		&KSubjectName, KGeneralStringMaxLength,
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   300
		&KIssuerName, KGeneralStringMaxLength,
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   301
		&KSerialNumber, KGeneralStringMaxLength,
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   302
		&KThumbprint, KThumbprintMaxLength);
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   303
				
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   304
	err = aDatabase.Execute(sqlStatement);
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   305
	if (err != KErrNone && err != KErrAlreadyExists)
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   306
	{
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   307
		User::Leave(err);
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   308
	}
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   309
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   310
	// Create table for _allowed_ CA certs
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   311
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   312
//// NAME ////////////////// TYPE ////////////// Constant ///////////
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   313
//| ServiceType		    | UNSIGNED INTEGER | KServiceType        |//
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   314
//| ServiceIndex		| UNSIGNED INTEGER | KServiceIndex       |//
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   315
//| TunnelingType		| UNSIGNED INTEGER | KTunnelingType		|//
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   316
//| CertLabel			| VARCHAR(255)     | KCACertLabel        |//	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   317
//| SubjectKeyId		| BINARY(255)	   | KSubjectKeyIdentifier |// This is Symbian subjectkey id
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   318
//| ActualSubjectKeyId  | BINARY(20)	   | KActualSubjectKeyIdentifier |// This is the actual subjectkeyid present in the certificate.
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   319
//| SubjectName			| VARCHAR(255)     | KSubjectName        |//	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   320
//| IssuerName			| VARCHAR(255)     | KIssuerName        |//	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   321
//| SerialNumber		| VARCHAR(255)     | KSerialNumber        |//	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   322
//| Thumbprint			| BINARY(64)	   | KThumbprint        |//	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   323
//////////////////////////////////////////////////////////////////////////////////////////////////////	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   324
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   325
	_LIT(KSQLCreateTable3, "CREATE TABLE %S (%S UNSIGNED INTEGER, \
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   326
											 %S UNSIGNED INTEGER, \
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   327
											 %S UNSIGNED INTEGER, \
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   328
											 %S VARCHAR(%d), \
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   329
											 %S BINARY(%d), \
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   330
											 %S BINARY(%d), \
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   331
											 %S VARCHAR(%d), \
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   332
											 %S VARCHAR(%d), \
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   333
											 %S VARCHAR(%d), \
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   334
											 %S BINARY(%d))");											 
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   335
											 
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   336
	sqlStatement.Format(KSQLCreateTable3, &KTlsAllowedCACertsDatabaseTableName, 
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   337
		&KServiceType, 
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   338
		&KServiceIndex, 
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   339
		&KTunnelingType, 
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   340
		&KCertLabel, KMaxCertLabelLengthInDB,
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   341
		&KSubjectKeyIdentifier, KMaxSubjectKeyIdLengthInDB,
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   342
		&KActualSubjectKeyIdentifier, KKeyIdentifierLength,
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   343
		&KSubjectName, KGeneralStringMaxLength,
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   344
		&KIssuerName, KGeneralStringMaxLength,
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   345
		&KSerialNumber, KGeneralStringMaxLength,
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   346
		&KThumbprint, KThumbprintMaxLength);
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   347
		
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   348
	err = aDatabase.Execute(sqlStatement);
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   349
	if (err != KErrNone && err != KErrAlreadyExists)
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   350
	{
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   351
		User::Leave(err);
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   352
	}
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   353
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   354
	// Create table for allowed cipher suites
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   355
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   356
//// NAME ///////////////// TYPE ////////////// Constant ///////////
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   357
//| ServiceType			| UNSIGNED INTEGER | KServiceType        |//
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   358
//| ServiceIndex		| UNSIGNED INTEGER | KServiceIndex       |//
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   359
//| TunnelingType		| UNSIGNED INTEGER | KTunnelingType		|//
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   360
//| CipherSuite			| UNSIGNED INTEGER | KCipherSuite        |//	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   361
//////////////////////////////////////////////////////////////////////////////////////////////////////	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   362
	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   363
	_LIT(KSQLCreateTable4, "CREATE TABLE %S (%S UNSIGNED INTEGER, \
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   364
											 %S UNSIGNED INTEGER, \
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   365
											 %S UNSIGNED INTEGER, \
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   366
											 %S UNSIGNED INTEGER)");
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   367
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   368
	sqlStatement.Format(KSQLCreateTable4, &KTlsAllowedCipherSuitesDatabaseTableName, 
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   369
		&KServiceType, 
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   370
		&KServiceIndex, 
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   371
		&KTunnelingType, 
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   372
		&KCipherSuite);
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   373
		
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   374
	err = aDatabase.Execute(sqlStatement);
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   375
	if (err != KErrNone && err != KErrAlreadyExists)
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   376
	{
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   377
		User::Leave(err);
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   378
	}
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   379
	
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   380
	// 4. Check if database table contains a row for this service type and id 
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   381
		
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   382
	_LIT(KSQLQueryRow, "SELECT %S FROM %S WHERE %S=%d AND %S=%d AND %S=%d");
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   383
	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   384
	sqlStatement.Format(KSQLQueryRow, &cf_str_EAP_TLS_PEAP_cipher_suite_literal, &KTlsDatabaseTableName, 
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   385
		&KServiceType, aIndexType, &KServiceIndex, aIndex, &KTunnelingType, aTunnelingVendorType);	
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   386
	
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   387
	RDbView view;
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   388
	User::LeaveIfError(view.Prepare(aDatabase, TDbQuery(sqlStatement), TDbWindow::EUnlimited));
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   389
	// View must be closed when no longer needed
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   390
	CleanupClosePushL(view);
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   391
	User::LeaveIfError(view.EvaluateAll());
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   392
	
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   393
	// 5. If row is not found then add it
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   394
	
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   395
	TInt rows = view.CountL();
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   396
	CleanupStack::PopAndDestroy(); // view
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   397
	if (rows == 0)
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   398
	{
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   399
		_LIT(KSQLInsert, "SELECT * FROM %S");
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   400
		sqlStatement.Format(KSQLInsert, &KTlsDatabaseTableName);	
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   401
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   402
		User::LeaveIfError(view.Prepare(aDatabase, TDbQuery(sqlStatement), TDbWindow::EUnlimited, RDbView::EInsertOnly));
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   403
		CleanupClosePushL(view);
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   404
		view.InsertL();
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   405
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   406
		// Get column set so we get the correct column numbers
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   407
		CDbColSet* colSet = view.ColSetL();
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   408
		CleanupStack::PushL(colSet);
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   409
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   410
		// Set the default values. The other three tables (certs, ca certs & cipher suites) are empty by default.
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   411
		view.SetColL(colSet->ColNo(KServiceType), static_cast<TInt>(aIndexType));
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   412
		view.SetColL(colSet->ColNo(KServiceIndex), aIndex);
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   413
		view.SetColL(colSet->ColNo(KTunnelingType), aTunnelingVendorType);
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   414
		
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   415
		view.SetColL(colSet->ColNo(cf_str_EAP_TLS_PEAP_use_manual_realm_literal), default_EAP_TLS_PEAP_use_manual_realm);
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   416
		view.SetColL(colSet->ColNo(cf_str_EAP_TLS_PEAP_manual_realm_literal), default_EAP_TLS_PEAP_manual_realm);
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   417
		
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   418
		view.SetColL(colSet->ColNo(cf_str_EAP_TLS_PEAP_use_manual_username_literal), default_EAP_TLS_PEAP_use_manual_username);
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   419
		view.SetColL(colSet->ColNo(cf_str_EAP_TLS_PEAP_manual_username_literal), default_EAP_TLS_PEAP_manual_username);
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   420
		
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   421
		view.SetColL(colSet->ColNo(cf_str_EAP_TLS_PEAP_cipher_suite_literal), default_EAP_TLS_PEAP_cipher_suite);
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   422
		
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   423
		view.SetColL(colSet->ColNo(cf_str_TLS_server_authenticates_client_policy_in_client_literal), default_EAP_TLS_server_authenticates_client);
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   424
		
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   425
		view.SetColL(colSet->ColNo(KCACertLabelOld), default_CA_cert_label);
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   426
		view.SetColL(colSet->ColNo(KClientCertLabel), default_client_cert_label);
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   427
		
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   428
		view.SetColL(colSet->ColNo(cf_str_EAP_TLS_PEAP_verify_certificate_realm_literal), default_EAP_TLS_PEAP_verify_certificate_realm);
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   429
		
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   430
		view.SetColL(colSet->ColNo(cf_str_EAP_TLS_max_session_validity_time_literal), default_MaxSessionTime);		
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   431
		
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   432
		view.SetColL(colSet->ColNo(KTLSLastFullAuthTime), default_FullAuthTime);		
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   433
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   434
		view.SetColL(colSet->ColNo(cf_str_EAP_TLS_PEAP_use_identity_privacy_literal), default_EAP_TLS_PEAP_TLS_Privacy);		
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   435
		view.PutL();
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   436
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   437
		CleanupStack::PopAndDestroy( colSet ); // Delete colSet.		
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   438
		CleanupStack::PopAndDestroy( &view ); // Close view.
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   439
		
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   440
		// Add default disabled cipher suites
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   441
		_LIT(KSQLInsert2, "SELECT * FROM %S");
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   442
		sqlStatement.Format(KSQLInsert2, &KTlsAllowedCipherSuitesDatabaseTableName);
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   443
		User::LeaveIfError(view.Prepare(aDatabase, TDbQuery(sqlStatement), TDbWindow::EUnlimited, RDbView::EInsertOnly));
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   444
		CleanupClosePushL(view);
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   445
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   446
		// Get column set so we get the correct column numbers
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   447
		colSet = view.ColSetL();
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   448
		CleanupStack::PushL(colSet);
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   449
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   450
		TInt i(0);
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   451
		while (default_allowed_cipher_suites[i] != 0)
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   452
		{
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   453
			view.InsertL();
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   454
			view.SetColL(colSet->ColNo(KServiceType), static_cast<TInt>(aIndexType));
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   455
			view.SetColL(colSet->ColNo(KServiceIndex), aIndex);			
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   456
			view.SetColL(colSet->ColNo(KTunnelingType), aTunnelingVendorType);
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   457
			view.SetColL(colSet->ColNo(KCipherSuite), default_allowed_cipher_suites[i]);
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   458
			view.PutL();
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   459
			i++;
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   460
		}
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   461
		
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   462
		CleanupStack::PopAndDestroy( colSet ); // Delete colSet.		
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   463
		CleanupStack::PopAndDestroy( &view ); // Close view.
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   464
	}
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   465
	
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   466
	// 6. Do the altering of tables here. 
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   467
	//    Add columns to existing certificate DB tables for Serial number, Issuer name etc. 
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   468
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   469
	TBufC<KDbMaxColName> tableName;
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   470
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   471
	// For the table _allowed_ USER certificates
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   472
	tableName = KTlsAllowedUserCertsDatabaseTableName;	
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   473
	AddExtraCertColumnsL(aDatabase,tableName);
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   474
	
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   475
	// For the table _allowed_ CA certificates	
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   476
	tableName = KTlsAllowedCACertsDatabaseTableName;	
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   477
	AddExtraCertColumnsL(aDatabase,tableName);
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   478
	
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   479
	CleanupStack::PopAndDestroy( buf ); // Delete buf or sqlStatement	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   480
	CleanupStack::Pop( &aDatabase );	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   481
	CleanupStack::Pop( &aSession );	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   482
	
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   483
	aDatabase.Compact();
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   484
}
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   485
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   486
void EapTlsPeapUtils::OpenPeapDatabaseL(
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   487
		RDbNamedDatabase& aDatabase, 
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   488
		RDbs& aSession, 
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   489
		const TIndexType aIndexType, 
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   490
		const TInt aIndex,
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   491
		const eap_type_value_e aTunnelingType)
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   492
{
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   493
#ifdef USE_EAP_EXPANDED_TYPES
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   494
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   495
	TUint aTunnelingVendorType = aTunnelingType.get_vendor_type();
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   496
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   497
#else
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   498
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   499
	TUint aTunnelingVendorType = static_cast<TUint>(aTunnelingType);
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   500
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   501
#endif //#ifdef USE_EAP_EXPANDED_TYPES
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   502
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   503
	EAP_TRACE_DEBUG_SYMBIAN(
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   504
		(_L("EapTlsPeapUtils::OpenPeapDatabaseL -Start- aIndexType=%d, aIndex=%d, Tunneling vendor type=%d \n"),
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   505
		aIndexType,aIndex, aTunnelingVendorType));
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   506
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   507
	// 1. Open/create a database	
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   508
	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   509
	// Connect to the DBMS server.
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   510
	User::LeaveIfError(aSession.Connect());		
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   511
	CleanupClosePushL(aSession);	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   512
	// aSession and aDatabase are pushed to the cleanup stack even though they may be member
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   513
	// variables of the calling class and would be closed in the destructor anyway. This ensures
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   514
	// that if they are not member variables they will be closed. Closing the handle twice
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   515
	// does no harm.	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   516
	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   517
#ifdef SYMBIAN_SECURE_DBMS
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   518
	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   519
	// Create the secure shared database with the specified secure policy.
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   520
	// Database will be created in the data caging path for DBMS (C:\private\100012a5).
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   521
	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   522
	TInt err = aDatabase.Create(aSession, KPeapDatabaseName, KSecureUIDFormat);
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   523
	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   524
	EAP_TRACE_DEBUG_SYMBIAN((_L("EapTlsPeapUtils::OpenPeapDatabaseL - Created Secure DB for eappeap.dat. err=%d\n"), err) );
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   525
	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   526
	if(err == KErrNone)
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   527
	{
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   528
		aDatabase.Close();
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   529
		
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   530
	} else if (err != KErrAlreadyExists) 
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   531
	{
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   532
		User::LeaveIfError(err);
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   533
	}
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   534
	
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   535
	User::LeaveIfError(aDatabase.Open(aSession, KPeapDatabaseName, KSecureUIDFormat));
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   536
	CleanupClosePushL(aDatabase);		
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   537
		
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   538
#else
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   539
	// For non-secured database. The database will be created in the old location (c:\system\data).
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   540
	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   541
	RFs fsSession;		
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   542
	User::LeaveIfError(fsSession.Connect());
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   543
	CleanupClosePushL(fsSession);	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   544
	TInt err = aDatabase.Create(fsSession, KPeapDatabaseName);
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   545
	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   546
	EAP_TRACE_DEBUG_SYMBIAN((_L("EapTlsPeapUtils::OpenPeapDatabaseL - Created Non-Secure DB for eappeap.dat. err=%d\n"), err) );
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   547
	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   548
	if(err == KErrNone)
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   549
	{
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   550
		aDatabase.Close();
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   551
		
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   552
	} else if (err != KErrAlreadyExists) 
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   553
	{
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   554
		User::LeaveIfError(err);
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   555
	}
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   556
	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   557
	User::LeaveIfError(aDatabase.Open(fsSession, KPeapDatabaseName));
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   558
	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   559
	CleanupStack::PopAndDestroy(); // close fsSession
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   560
	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   561
	CleanupClosePushL(aDatabase);		
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   562
	    
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   563
#endif // #ifdef SYMBIAN_SECURE_DBMS
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   564
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   565
	// 2. Create the eappeap table to database (ignore error if exists)
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   566
	
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   567
// Table columns:
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   568
//// NAME /////////////////////////////////////////////// TYPE ////////////// Constant ///////////////////
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   569
//| ServiceType										| UNSIGNED INTEGER 	| KServiceType        |//
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   570
//| ServiceIndex									| UNSIGNED INTEGER 	| KServiceIndex       |//
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   571
//| TunnelingType									| UNSIGNED INTEGER 	| KTunnelingType		|//
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   572
//| EAP_TLS_PEAP_use_manual_realm					| UNSIGNED INTEGER 	| cf_str_EAP_TLS_PEAP_use_manual_realm_literal      |//
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   573
//| EAP_TLS_PEAP_manual_realm						| VARCHAR(255)     	| cf_str_EAP_TLS_PEAP_manual_realm_literal				|//
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   574
//| EAP_TLS_PEAP_use_manual_username				| UNSIGNED INTEGER 	| cf_str_EAP_TLS_PEAP_use_manual_username_literal   |//
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   575
//| EAP_TLS_PEAP_manual_username					| VARCHAR(255)     	| cf_str_EAP_TLS_PEAP_manual_username_literal			|//
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   576
//| EAP_TLS_PEAP_max_count_of_session_resumes		| UNSIGNED INTEGER 	| cf_str_EAP_TLS_PEAP_max_count_of_session_resumes_literal    |//
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   577
//| EAP_TLS_PEAP_cipher_suite						| UNSIGNED INTEGER 	| cf_str_EAP_TLS_PEAP_cipher_suite_literal	   |//
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   578
//| EAP_TLS_PEAP_used_PEAP_version					| UNSIGNED INTEGER 	| cf_str_EAP_TLS_PEAP_used_PEAP_version_literal		    |//
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   579
//| EAP_TLS_PEAP_accepted_PEAP_versions				| BINARY(12)	    | cf_str_EAP_TLS_PEAP_accepted_PEAP_versions_literal|//
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   580
//| PEAP_accepted_tunneled_client_types			   	| VARBINARY(240) 	| cf_str_PEAP_accepted_tunneled_client_types_hex_data_literal      |//
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   581
//| PEAP_unaccepted_tunneled_client_types		   	| VARBINARY(240) 	| cf_str_PEAP_unaccepted_tunneled_client_types_hex_data_literal      |//
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   582
//| EAP_TLS_server_authenticates_client		        | UNSIGNED INTEGER 	| cf_str_TLS_server_authenticates_client_policy_in_client_literal|//
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   583
//| CA_cert_label								    | VARCHAR(255)     	| KCACertLabelOld	   |//
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   584
//| client_cert_label							    | VARCHAR(255)     	| KClientCertLabel	   |//
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   585
//| EAP_TLS_PEAP_saved_session_id				    | BINARY(32)       	| cf_str_EAP_TLS_PEAP_saved_session_id_literal		   |//
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   586
//| EAP_TLS_PEAP_saved_master_secret			    | BINARY(48)       	| cf_str_EAP_TLS_PEAP_saved_master_secret_literal	   |//
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   587
//| EAP_TLS_PEAP_saved_cipher_suite				    | UNSIGNED INTEGER 	| cf_str_EAP_TLS_PEAP_saved_cipher_suite_literal   |//
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   588
//| EAP_TLS_PEAP_verify_certificate_realm			| UNSIGNED INTEGER 	| cf_str_EAP_TLS_PEAP_verify_certificate_realm_literal		   |//
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   589
//| EAP_PEAP_max_session_validity_time				| BIGINT	   		| cf_str_EAP_PEAP_max_session_validity_time_literal   |//
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   590
//| EAP_PEAP_last_full_authentication_time			| BIGINT	   		| KPEAPLastFullAuthTime	   	|//	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   591
//| EAP_TLS_PEAP_use_identity_privacy	    	    | UNSIGNED INTEGER 	| cf_str_EAP_TLS_PEAP_use_identity_privacy_literal|//
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   592
//////////////////////////////////////////////////////////////////////////////////////////////////////////////	
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   593
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   594
	HBufC* buf = HBufC::NewLC(KMaxSqlQueryLength);
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   595
	TPtr sqlStatement = buf->Des();
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   596
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   597
	// Table creation is divided into two parts because otherwise the SQL string would get too long
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   598
	_LIT(KSQLCreateTable1, "CREATE TABLE %S (%S UNSIGNED INTEGER, \
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   599
											 %S UNSIGNED INTEGER, \
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   600
											 %S UNSIGNED INTEGER, \
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   601
											 %S UNSIGNED INTEGER, \
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   602
											 %S VARCHAR(%d),     \
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   603
											 %S UNSIGNED INTEGER, \
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   604
											 %S VARCHAR(%d),     \
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   605
											 %S UNSIGNED INTEGER, \
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   606
											 %S UNSIGNED INTEGER, \
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   607
											 %S BINARY(%d),		  \
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   608
											 %S VARBINARY(%d),	  \
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   609
											 %S VARBINARY(%d),	  \
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   610
											 %S UNSIGNED INTEGER, \
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   611
											 %S VARCHAR(%d),	  \
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   612
											 %S VARCHAR(%d),     \
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   613
											 %S BINARY(%d),		  \
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   614
											 %S BINARY(%d),		  \
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   615
											 %S UNSIGNED INTEGER, \
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   616
											 %S UNSIGNED INTEGER, \
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   617
											 %S BIGINT, \
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   618
											 %S BIGINT, \
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   619
											 %S UNSIGNED INTEGER)");
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   620
	sqlStatement.Format(KSQLCreateTable1,
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   621
		&KPeapDatabaseTableName,
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   622
		&KServiceType,
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   623
		&KServiceIndex,
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   624
		&KTunnelingType,
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   625
		&cf_str_EAP_TLS_PEAP_use_manual_realm_literal,
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   626
		&cf_str_EAP_TLS_PEAP_manual_realm_literal, KMaxManualRealmLengthInDB,
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   627
		&cf_str_EAP_TLS_PEAP_use_manual_username_literal,
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   628
		&cf_str_EAP_TLS_PEAP_manual_username_literal, KMaxManualUsernameLengthInDB,
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   629
		&cf_str_EAP_TLS_PEAP_cipher_suite_literal,
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   630
		&cf_str_EAP_TLS_PEAP_used_PEAP_version_literal,
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   631
		&cf_str_EAP_TLS_PEAP_accepted_PEAP_versions_literal, KMaxPEAPVersionsStringLengthInDB,
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   632
		&cf_str_PEAP_accepted_tunneled_client_types_hex_data_literal, KMaxTunneledTypeStringLengthInDB,
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   633
		&cf_str_PEAP_unaccepted_tunneled_client_types_hex_data_literal, KMaxTunneledTypeStringLengthInDB,
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   634
		&cf_str_TLS_server_authenticates_client_policy_in_client_literal,
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   635
		&KCACertLabelOld, KMaxCertLabelLengthInDB,
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   636
		&KClientCertLabel, KMaxCertLabelLengthInDB,
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   637
		&cf_str_EAP_TLS_PEAP_saved_session_id_literal, KMaxSessionIdLengthInDB,
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   638
		&cf_str_EAP_TLS_PEAP_saved_master_secret_literal,  KMaxMasterSecretLengthInDB,
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   639
		&cf_str_EAP_TLS_PEAP_saved_cipher_suite_literal,
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   640
		&cf_str_EAP_TLS_PEAP_verify_certificate_realm_literal,
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   641
		&cf_str_EAP_PEAP_max_session_validity_time_literal,
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   642
		&KPEAPLastFullAuthTime,	
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   643
		&cf_str_EAP_TLS_PEAP_use_identity_privacy_literal);		
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   644
					
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   645
	err = aDatabase.Execute(sqlStatement);
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   646
	if (err == KErrAlreadyExists)
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   647
		{
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   648
		EAP_TRACE_DEBUG_SYMBIAN((_L("EapTlsPeapUtils::OpenPeapDatabaseL - Alter Table err=%d\n"), err) );
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   649
		_LIT( KColumnDef, "UNSIGNED INTEGER" );
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   650
		AlterTableL( aDatabase, EAddColumn , KPeapDatabaseTableName,
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   651
				cf_str_EAP_TLS_PEAP_use_identity_privacy_literal, KColumnDef);
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   652
		}
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   653
		else if (err != KErrNone)
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   654
			{
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   655
			User::Leave(err);
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   656
			}
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   657
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   658
	// Create table for _allowed_ user certificates
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   659
	
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   660
//// NAME ////////////////// TYPE ////////////// Constant ///////////
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   661
//| ServiceType			| UNSIGNED INTEGER | KServiceType        |//
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   662
//| ServiceIndex		| UNSIGNED INTEGER | KServiceIndex       |//
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   663
//| TunnelingType		| UNSIGNED INTEGER | KTunnelingType		|//
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   664
//| CertLabel			| VARCHAR(255)     | KCACertLabel        |//	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   665
//| SubjectKeyId		| BINARY(20)	   | KSubjectKeyIdentifier |// This is Symbian subjectkey id
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   666
//| ActualSubjectKeyId  | BINARY(20)	   | KActualSubjectKeyIdentifier |// This is the actual subjectkeyid present in the certificate.
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   667
//| SubjectName			| VARCHAR(255)     | KSubjectName        |//	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   668
//| IssuerName			| VARCHAR(255)     | KIssuerName        |//	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   669
//| SerialNumber		| VARCHAR(255)     | KSerialNumber        |//	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   670
//| Thumbprint			| BINARY(64)	   | KThumbprint        |//	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   671
//////////////////////////////////////////////////////////////////////////////////////////////////////	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   672
	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   673
	_LIT(KSQLCreateTable2, "CREATE TABLE %S (%S UNSIGNED INTEGER, \
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   674
											 %S UNSIGNED INTEGER, \
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   675
											 %S UNSIGNED INTEGER, \
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   676
											 %S VARCHAR(%d), \
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   677
											 %S BINARY(%d), \
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   678
											 %S BINARY(%d), \
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   679
											 %S VARCHAR(%d), \
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   680
											 %S VARCHAR(%d), \
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   681
											 %S VARCHAR(%d), \
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   682
											 %S BINARY(%d))");											 
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   683
											 
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   684
	sqlStatement.Format(KSQLCreateTable2, &KPeapAllowedUserCertsDatabaseTableName, 
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   685
		&KServiceType, 
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   686
		&KServiceIndex, 
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   687
		&KTunnelingType, 
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   688
		&KCertLabel, KMaxCertLabelLengthInDB,
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   689
		&KSubjectKeyIdentifier, KMaxSubjectKeyIdLengthInDB,
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   690
		&KActualSubjectKeyIdentifier, KKeyIdentifierLength,
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   691
		&KSubjectName, KGeneralStringMaxLength,
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   692
		&KIssuerName, KGeneralStringMaxLength,
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   693
		&KSerialNumber, KGeneralStringMaxLength,
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   694
		&KThumbprint, KThumbprintMaxLength);
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   695
		
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   696
	err = aDatabase.Execute(sqlStatement);
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   697
	if (err != KErrNone && err != KErrAlreadyExists)
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   698
	{
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   699
		User::Leave(err);
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   700
	}	
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   701
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   702
	// Create table for _allowed_ CA certs
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   703
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   704
//// NAME ////////////////// TYPE ////////////// Constant ///////////
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   705
//| ServiceType			| UNSIGNED INTEGER | KServiceType        |//
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   706
//| ServiceIndex		| UNSIGNED INTEGER | KServiceIndex       |//
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   707
//| TunnelingType		| UNSIGNED INTEGER | KTunnelingType		|//
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   708
//| CACertLabel			| VARCHAR(255)     | KCACertLabel        |//	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   709
//| SubjectKeyId		| BINARY(20)	   | KSubjectKeyIdentifier |// This is Symbian subjectkey id
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   710
//| ActualSubjectKeyId  | BINARY(20)	   | KActualSubjectKeyIdentifier |// This is the actual subjectkeyid present in the certificate.
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   711
//| SubjectName			| VARCHAR(255)     | KSubjectName        |//	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   712
//| IssuerName			| VARCHAR(255)     | KIssuerName        |//	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   713
//| SerialNumber		| VARCHAR(255)     | KSerialNumber        |//	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   714
//| Thumbprint			| BINARY(64)	   | KThumbprint        |//	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   715
//////////////////////////////////////////////////////////////////////////////////////////////////////	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   716
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   717
	_LIT(KSQLCreateTable3, "CREATE TABLE %S (%S UNSIGNED INTEGER, \
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   718
											 %S UNSIGNED INTEGER, \
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   719
											 %S UNSIGNED INTEGER, \
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   720
											 %S VARCHAR(%d), \
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   721
											 %S BINARY(%d), \
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   722
											 %S BINARY(%d), \
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   723
											 %S VARCHAR(%d), \
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   724
											 %S VARCHAR(%d), \
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   725
											 %S VARCHAR(%d), \
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   726
											 %S BINARY(%d))");
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   727
											 											 
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   728
	sqlStatement.Format(KSQLCreateTable3, &KPeapAllowedCACertsDatabaseTableName, 
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   729
		&KServiceType, 
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   730
		&KServiceIndex, 
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   731
		&KTunnelingType, 
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   732
		&KCertLabel, KMaxCertLabelLengthInDB,
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   733
		&KSubjectKeyIdentifier, KMaxSubjectKeyIdLengthInDB,
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   734
		&KActualSubjectKeyIdentifier, KKeyIdentifierLength,
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   735
		&KSubjectName, KGeneralStringMaxLength,
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   736
		&KIssuerName, KGeneralStringMaxLength,
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   737
		&KSerialNumber, KGeneralStringMaxLength,
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   738
		&KThumbprint, KThumbprintMaxLength);
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   739
		
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   740
	err = aDatabase.Execute(sqlStatement);
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   741
	if (err != KErrNone && err != KErrAlreadyExists)
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   742
	{
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   743
		User::Leave(err);
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   744
	}
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   745
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   746
	// Create table for _allowed_ cipher suites
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   747
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   748
//// NAME ///////////////// TYPE ////////////// Constant ///////////
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   749
//| ServiceType			| UNSIGNED INTEGER | KServiceType        |//
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   750
//| ServiceIndex		| UNSIGNED INTEGER | KServiceIndex       |//
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   751
//| TunnelingType		| UNSIGNED INTEGER | KTunnelingType		|//
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   752
//| CipherSuite			| UNSIGNED INTEGER | KCipherSuite        |//	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   753
//////////////////////////////////////////////////////////////////////////////////////////////////////	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   754
	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   755
	_LIT(KSQLCreateTable4, "CREATE TABLE %S (%S UNSIGNED INTEGER, \
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   756
											 %S UNSIGNED INTEGER, \
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   757
											 %S UNSIGNED INTEGER, \
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   758
											 %S UNSIGNED INTEGER)");
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   759
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   760
	sqlStatement.Format(KSQLCreateTable4, &KPeapAllowedCipherSuitesDatabaseTableName, 
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   761
		&KServiceType, &KServiceIndex, &KTunnelingType, &KCipherSuite);
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   762
	err = aDatabase.Execute(sqlStatement);
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   763
	if (err != KErrNone && err != KErrAlreadyExists)
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   764
	{
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   765
		User::Leave(err);
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   766
	}
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   767
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   768
	// 4. Check if database table contains a row for this service type and id 
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   769
	 	
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   770
	_LIT(KSQLQueryRow, "SELECT * FROM %S WHERE %S=%d AND %S=%d AND %S=%d");
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   771
	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   772
	sqlStatement.Format(KSQLQueryRow, &KPeapDatabaseTableName, 
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   773
		&KServiceType, aIndexType, &KServiceIndex, aIndex, &KTunnelingType, aTunnelingVendorType);
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   774
			
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   775
	RDbView view;
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   776
	User::LeaveIfError(view.Prepare(aDatabase, TDbQuery(sqlStatement), TDbWindow::EUnlimited));
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   777
	// View must be closed when no longer needed
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   778
	CleanupClosePushL(view);
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   779
	User::LeaveIfError(view.EvaluateAll());
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   780
	
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   781
	// 5. If row is not found then add it
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   782
	
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   783
	TInt rows = view.CountL();
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   784
	CleanupStack::PopAndDestroy(); // view
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   785
	if (rows == 0)
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   786
	{
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   787
		_LIT(KSQLInsert, "SELECT * FROM %S");
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   788
		sqlStatement.Format(KSQLInsert, &KPeapDatabaseTableName);	
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   789
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   790
		User::LeaveIfError(view.Prepare(aDatabase, TDbQuery(sqlStatement), TDbWindow::EUnlimited, RDbView::EInsertOnly));
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   791
		CleanupClosePushL(view);
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   792
		view.InsertL();
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   793
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   794
		// Get column set so we get the correct column numbers
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   795
		CDbColSet* colSet = view.ColSetL();
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   796
		CleanupStack::PushL(colSet);
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   797
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   798
		// Set the default values. The other three tables (certs, ca certs & cipher suites) are empty by default.
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   799
		view.SetColL(colSet->ColNo(KServiceType), static_cast<TInt>(aIndexType));
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   800
		view.SetColL(colSet->ColNo(KServiceIndex), aIndex);
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   801
		view.SetColL(colSet->ColNo(KTunnelingType), aTunnelingVendorType);
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   802
		
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   803
		view.SetColL(colSet->ColNo(cf_str_EAP_TLS_PEAP_use_manual_realm_literal), default_EAP_TLS_PEAP_use_manual_realm);
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   804
		view.SetColL(colSet->ColNo(cf_str_EAP_TLS_PEAP_manual_realm_literal), default_EAP_TLS_PEAP_manual_realm);
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   805
		
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   806
		view.SetColL(colSet->ColNo(cf_str_EAP_TLS_PEAP_use_manual_username_literal), default_EAP_TLS_PEAP_use_manual_username);
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   807
		view.SetColL(colSet->ColNo(cf_str_EAP_TLS_PEAP_manual_username_literal), default_EAP_TLS_PEAP_manual_username);
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   808
		
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   809
		view.SetColL(colSet->ColNo(cf_str_EAP_TLS_PEAP_cipher_suite_literal), default_EAP_TLS_PEAP_cipher_suite);
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   810
		
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   811
		view.SetColL(colSet->ColNo(cf_str_EAP_TLS_PEAP_used_PEAP_version_literal), default_EAP_TLS_PEAP_used_PEAP_version);
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   812
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   813
		TInt i(0);
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   814
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   815
		while (default_EAP_TLS_PEAP_accepted_PEAP_versions[i] != -1)
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   816
		{
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   817
			i++;
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   818
		}
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   819
		
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   820
		TBuf8<KMaxPEAPVersionsStringLengthInDB> tmp;
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   821
		
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   822
		tmp.Copy(reinterpret_cast<const TUint8 *> (default_EAP_TLS_PEAP_accepted_PEAP_versions), i * sizeof(TInt));
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   823
		
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   824
		view.SetColL(colSet->ColNo(cf_str_EAP_TLS_PEAP_accepted_PEAP_versions_literal), tmp);
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   825
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   826
		view.SetColL(colSet->ColNo(cf_str_PEAP_accepted_tunneled_client_types_hex_data_literal), default_PEAP_tunneled_types);
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   827
		view.SetColL(colSet->ColNo(cf_str_PEAP_unaccepted_tunneled_client_types_hex_data_literal), default_PEAP_tunneled_types);
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   828
		
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   829
		view.SetColL(colSet->ColNo(cf_str_TLS_server_authenticates_client_policy_in_client_literal), default_EAP_PEAP_TTLS_server_authenticates_client);
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   830
		view.SetColL(colSet->ColNo(KCACertLabelOld), default_CA_cert_label);
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   831
		view.SetColL(colSet->ColNo(KClientCertLabel), default_client_cert_label);	
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   832
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   833
		view.SetColL(colSet->ColNo(cf_str_EAP_TLS_PEAP_verify_certificate_realm_literal), default_EAP_TLS_PEAP_verify_certificate_realm);
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   834
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   835
		view.SetColL(colSet->ColNo(cf_str_EAP_PEAP_max_session_validity_time_literal), default_MaxSessionTime);
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   836
		
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   837
		view.SetColL(colSet->ColNo(KPEAPLastFullAuthTime), default_FullAuthTime);
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   838
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   839
		view.SetColL(colSet->ColNo(cf_str_EAP_TLS_PEAP_use_identity_privacy_literal), default_EAP_TLS_PEAP_TLS_Privacy);						
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   840
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   841
		view.PutL();
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   842
		
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   843
		CleanupStack::PopAndDestroy(colSet); 
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   844
		CleanupStack::PopAndDestroy( &view ); // Close view.
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   845
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   846
		// Add default disabled cipher suites
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   847
		_LIT(KSQLInsert2, "SELECT * FROM %S");
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   848
		sqlStatement.Format(KSQLInsert2, &KPeapAllowedCipherSuitesDatabaseTableName);
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   849
		User::LeaveIfError(view.Prepare(aDatabase, TDbQuery(sqlStatement), TDbWindow::EUnlimited, RDbView::EInsertOnly));
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   850
		CleanupClosePushL(view);
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   851
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   852
		// Get column set so we get the correct column numbers
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   853
		colSet = view.ColSetL();
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   854
		CleanupStack::PushL(colSet);
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   855
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   856
		i = 0;
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   857
		while (default_allowed_cipher_suites[i] != 0)
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   858
		{
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   859
			view.InsertL();
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   860
			view.SetColL(colSet->ColNo(KServiceType), static_cast<TInt>(aIndexType));
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   861
			view.SetColL(colSet->ColNo(KServiceIndex), aIndex);
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   862
			view.SetColL(colSet->ColNo(KTunnelingType), aTunnelingVendorType);
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   863
			view.SetColL(colSet->ColNo(KCipherSuite), default_allowed_cipher_suites[i]);
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   864
			view.PutL();
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   865
			i++;
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   866
		}
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   867
		
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   868
		CleanupStack::PopAndDestroy( colSet ); // Delete colSet.		
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   869
		CleanupStack::PopAndDestroy( &view ); // Close view.
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   870
	} 
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   871
	
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   872
	// 6. Do the altering of tables here. 
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   873
	//    Add columns to existing certificate DB tables for Serial number, Issuer name etc. 
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   874
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   875
	TBufC<KDbMaxColName> tableName;
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   876
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   877
	// For the table _allowed_ USER certificates
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   878
	tableName = KPeapAllowedUserCertsDatabaseTableName;	
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   879
	AddExtraCertColumnsL(aDatabase,tableName);
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   880
	
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   881
	// For the table _allowed_ CA certificates	
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   882
	tableName = KPeapAllowedCACertsDatabaseTableName;	
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   883
	AddExtraCertColumnsL(aDatabase,tableName);
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   884
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   885
	CleanupStack::PopAndDestroy( buf ); // Delete buf or sqlStatement
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   886
	CleanupStack::Pop( &aDatabase );	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   887
	CleanupStack::Pop( &aSession );	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   888
	
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   889
	aDatabase.Compact();
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   890
}
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   891
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   892
#if defined(USE_TTLS_EAP_TYPE)
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   893
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   894
// ---------------------------------------------------------
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   895
// EapTlsPeapUtils::OpenTtlsDatabaseL()
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   896
// ---------------------------------------------------------
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   897
//
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   898
void EapTlsPeapUtils::OpenTtlsDatabaseL(
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   899
		RDbNamedDatabase& aDatabase, 
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   900
		RDbs& aSession, 
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   901
		const TIndexType aIndexType, 
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   902
		const TInt aIndex,
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   903
		const eap_type_value_e aTunnelingType)
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   904
{
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   905
#ifdef USE_EAP_EXPANDED_TYPES
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   906
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   907
	TUint aTunnelingVendorType = aTunnelingType.get_vendor_type();
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   908
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   909
#else
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   910
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   911
	TUint aTunnelingVendorType = static_cast<TUint>(aTunnelingType);
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   912
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   913
#endif //#ifdef USE_EAP_EXPANDED_TYPES
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   914
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   915
	EAP_TRACE_DEBUG_SYMBIAN(
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   916
		(_L("EapTlsPeapUtils::OpenTtlsDatabaseL -Start- aIndexType=%d, aIndex=%d, Tunneling vendor type=%d \n"),
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   917
		aIndexType,aIndex, aTunnelingVendorType));
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   918
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   919
	// 1. Open/create a database	
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   920
	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   921
	// Connect to the DBMS server.
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   922
	User::LeaveIfError(aSession.Connect());		
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   923
	CleanupClosePushL(aSession);	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   924
	// aSession and aDatabase are pushed to the cleanup stack even though they may be member
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   925
	// variables of the calling class and would be closed in the destructor anyway. This ensures
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   926
	// that if they are not member variables they will be closed. Closing the handle twice
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   927
	// does no harm.	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   928
	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   929
#ifdef SYMBIAN_SECURE_DBMS
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   930
	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   931
	// Create the secure shared database with the specified secure policy.
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   932
	// Database will be created in the data caging path for DBMS (C:\private\100012a5).
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   933
	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   934
	TInt err = aDatabase.Create(aSession, KTtlsDatabaseName, KSecureUIDFormat);
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   935
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   936
	EAP_TRACE_DEBUG_SYMBIAN((_L("EapTlsPeapUtils::OpenTtlsDatabaseL - Created Secure DB for eapttls.dat. err=%d\n"), err) );
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   937
	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   938
	if(err == KErrNone)
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   939
	{
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   940
		aDatabase.Close();
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   941
		
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   942
	} else if (err != KErrAlreadyExists) 
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   943
	{
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   944
		User::LeaveIfError(err);
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   945
	}
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   946
	
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   947
	User::LeaveIfError(aDatabase.Open(aSession, KTtlsDatabaseName, KSecureUIDFormat));
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   948
	CleanupClosePushL(aDatabase);		
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   949
		
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   950
#else
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   951
	// For non-secured database. The database will be created in the old location (c:\system\data).
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   952
	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   953
	RFs fsSession;		
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   954
	User::LeaveIfError(fsSession.Connect());
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   955
	CleanupClosePushL(fsSession);	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   956
	TInt err = aDatabase.Create(fsSession, KTtlsDatabaseName);
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   957
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   958
	EAP_TRACE_DEBUG_SYMBIAN((_L("EapTlsPeapUtils::OpenTtlsDatabaseL - Created Non-Secure DB for eapttls.dat. err=%d\n"), err) );
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   959
	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   960
	if(err == KErrNone)
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   961
	{
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   962
		aDatabase.Close();
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   963
		
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   964
	} else if (err != KErrAlreadyExists) 
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   965
	{
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   966
		User::LeaveIfError(err);
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   967
	}
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   968
	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   969
	User::LeaveIfError(aDatabase.Open(fsSession, KTtlsDatabaseName));
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   970
	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   971
	CleanupStack::PopAndDestroy(); // close fsSession
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   972
	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   973
	CleanupClosePushL(aDatabase);		
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   974
	    
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   975
#endif // #ifdef SYMBIAN_SECURE_DBMS
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   976
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   977
	// 2. Create the eapttls table to database (ignore error if exists)
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   978
	
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   979
// Table columns:
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   980
//// NAME //////////////////////////////////////////// TYPE ////////////// Constant ///////////////////
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   981
//| ServiceType									| UNSIGNED INTEGER 	| KServiceType        |//
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   982
//| ServiceIndex								| UNSIGNED INTEGER 	| KServiceIndex       |//
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   983
//| TunnelingType								| UNSIGNED INTEGER 	| KTunnelingType		|//
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   984
//| EAP_TLS_PEAP_use_manual_realm				| UNSIGNED INTEGER 	| cf_str_EAP_TLS_PEAP_use_manual_realm_literal      |//
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   985
//| EAP_TLS_PEAP_manual_realm					| VARCHAR(255)     	| cf_str_EAP_TLS_PEAP_manual_realm_literal				|//
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   986
//| EAP_TLS_PEAP_use_manual_username			| UNSIGNED INTEGER 	| cf_str_EAP_TLS_PEAP_use_manual_username_literal   |//
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   987
//| EAP_TLS_PEAP_manual_username				| VARCHAR(255)     	| cf_str_EAP_TLS_PEAP_manual_username_literal			|//
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   988
//| EAP_TLS_PEAP_cipher_suite					| UNSIGNED INTEGER 	| cf_str_EAP_TLS_PEAP_cipher_suite_literal	   |//
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   989
//| EAP_TLS_PEAP_used_PEAP_version				| UNSIGNED INTEGER 	| cf_str_EAP_TLS_PEAP_used_PEAP_version_literal		    |//
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   990
//| EAP_TLS_PEAP_accepted_PEAP_versions			| BINARY(12)	    | cf_str_EAP_TLS_PEAP_accepted_PEAP_versions_literal|//
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   991
//| PEAP_accepted_tunneled_client_types			| VARBINARY(240) 	| cf_str_PEAP_accepted_tunneled_client_types_hex_data_literal      |//
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   992
//| PEAP_unaccepted_tunneled_client_types		| VARBINARY(240) 	| cf_str_PEAP_unaccepted_tunneled_client_types_hex_data_literal      |//
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   993
//| EAP_TLS_server_authenticates_client		    | UNSIGNED INTEGER 	| cf_str_TLS_server_authenticates_client_policy_in_client_literal|//
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   994
//| CA_cert_label								| VARCHAR(255)     	| KCACertLabelOld	   |//
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   995
//| client_cert_label							| VARCHAR(255)     	| KClientCertLabel	   |//
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   996
//| EAP_TLS_PEAP_saved_session_id				| BINARY(32)       	| cf_str_EAP_TLS_PEAP_saved_session_id_literal		   |//
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   997
//| EAP_TLS_PEAP_saved_master_secret			| BINARY(48)       	| cf_str_EAP_TLS_PEAP_saved_master_secret_literal	   |//
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   998
//| EAP_TLS_PEAP_saved_cipher_suite				| UNSIGNED INTEGER 	| cf_str_EAP_TLS_PEAP_saved_cipher_suite_literal   |//
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
   999
//| EAP_TLS_PEAP_verify_certificate_realm		| UNSIGNED INTEGER 	| cf_str_EAP_TLS_PEAP_verify_certificate_realm_literal		   |//
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1000
//| EAP_TTLS_max_session_validity_time			| BIGINT	   		| cf_str_EAP_TTLS_max_session_validity_time_literal   |//
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1001
//| EAP_TTLS_last_full_authentication_time		| BIGINT	   		| KTTLSLastFullAuthTime	   	|//	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1002
//| EAP_TLS_PEAP_use_identity_privacy			| UNSIGNED INTEGER 	| cf_str_EAP_TLS_PEAP_use_identity_privacy_literal		   |//
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1003
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1004
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1005
//| EAP_TLS_PEAP_ttls_pap_password_prompt               | UNSIGNED INTEGER  | cf_str_EAP_TLS_PEAP_ttls_pap_password_prompt_literal           |//
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1006
//| EAP_TLS_PEAP_ttls_pap_username                      | VARCHAR(253)      | cf_str_EAP_TLS_PEAP_ttls_pap_username_literal                  |//
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1007
//| EAP_TLS_PEAP_ttls_pap_password                      | VARCHAR(128)      | cf_str_EAP_TLS_PEAP_ttls_pap_password_literal                  |//
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1008
//| EAP_TLS_PEAP_ttls_pap_max_session_validity_time		| BIGINT		   	| cf_str_EAP_TLS_PEAP_ttls_pap_max_session_validity_time_literal |//
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1009
//| EAP_TLS_PEAP_ttls_pap_last_full_authentication_time	| BIGINT		   	| KTTLSPAPLastFullAuthTime	                             |//
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1010
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1011
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1012
//////////////////////////////////////////////////////////////////////////////////////////////////////////////	
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1013
	
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1014
	HBufC* buf = HBufC::NewLC(KMaxSqlQueryLength);
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1015
	TPtr sqlStatement = buf->Des();
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1016
	
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1017
// Table creation is divided into two parts because otherwise the SQL string would get too long
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1018
	_LIT(KSQLCreateTable1,
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1019
		"CREATE TABLE %S (%S UNSIGNED INTEGER, \
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1020
			              %S UNSIGNED INTEGER, \
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1021
			              %S UNSIGNED INTEGER, \
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1022
			              %S UNSIGNED INTEGER, \
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1023
			              %S VARCHAR(%d),     \
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1024
			              %S UNSIGNED INTEGER, \
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1025
			              %S VARCHAR(%d),     \
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1026
			              %S UNSIGNED INTEGER, \
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1027
			              %S UNSIGNED INTEGER, \
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1028
			              %S BINARY(%d),		  \
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1029
			              %S VARBINARY(%d),	  \
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1030
			              %S VARBINARY(%d),	  \
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1031
			              %S UNSIGNED INTEGER, \
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1032
			              %S VARCHAR(%d),	  \
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1033
			              %S VARCHAR(%d),     \
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1034
			              %S BINARY(%d),		  \
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1035
			              %S BINARY(%d),		  \
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1036
			              %S UNSIGNED INTEGER, \
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1037
			              %S UNSIGNED INTEGER, \
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1038
			              %S BIGINT, \
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1039
			              %S BIGINT, \
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1040
				      			%S UNSIGNED INTEGER, \
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1041
			              %S UNSIGNED INTEGER, \
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1042
			              %S VARCHAR(%d), \
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1043
			              %S VARCHAR(%d), \
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1044
                    %S BIGINT, \
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1045
                    %S BIGINT)");
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1046
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1047
    sqlStatement.Format( KSQLCreateTable1,
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1048
        &KTtlsDatabaseTableName,
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1049
        &KServiceType,
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1050
        &KServiceIndex,
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1051
        &KTunnelingType,
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1052
        &cf_str_EAP_TLS_PEAP_use_manual_realm_literal,
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1053
        &cf_str_EAP_TLS_PEAP_manual_realm_literal, KMaxManualRealmLengthInDB,
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1054
        &cf_str_EAP_TLS_PEAP_use_manual_username_literal,
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1055
        &cf_str_EAP_TLS_PEAP_manual_username_literal, KMaxManualUsernameLengthInDB,
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1056
        &cf_str_EAP_TLS_PEAP_cipher_suite_literal,
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1057
        &cf_str_EAP_TLS_PEAP_used_PEAP_version_literal,
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1058
        &cf_str_EAP_TLS_PEAP_accepted_PEAP_versions_literal, KMaxPEAPVersionsStringLengthInDB,
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1059
        &cf_str_PEAP_accepted_tunneled_client_types_hex_data_literal, KMaxTunneledTypeStringLengthInDB,
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1060
        &cf_str_PEAP_unaccepted_tunneled_client_types_hex_data_literal,	KMaxTunneledTypeStringLengthInDB,	
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1061
        &cf_str_TLS_server_authenticates_client_policy_in_client_literal,
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1062
        &KCACertLabelOld, KMaxCertLabelLengthInDB,
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1063
        &KClientCertLabel, KMaxCertLabelLengthInDB,
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1064
        &cf_str_EAP_TLS_PEAP_saved_session_id_literal, KMaxSessionIdLengthInDB,
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1065
        &cf_str_EAP_TLS_PEAP_saved_master_secret_literal, KMaxMasterSecretLengthInDB,
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1066
        &cf_str_EAP_TLS_PEAP_saved_cipher_suite_literal,
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1067
        &cf_str_EAP_TLS_PEAP_verify_certificate_realm_literal,
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1068
        &cf_str_EAP_TTLS_max_session_validity_time_literal,
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1069
        &KTTLSLastFullAuthTime,
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1070
		&cf_str_EAP_TLS_PEAP_use_identity_privacy_literal,		
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1071
        &cf_str_EAP_TLS_PEAP_ttls_pap_password_prompt_literal,
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1072
        &cf_str_EAP_TLS_PEAP_ttls_pap_username_literal, KMaxPapUserNameLengthInDb,
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1073
        &cf_str_EAP_TLS_PEAP_ttls_pap_password_literal, KMaxPapPasswordLengthInDb,
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1074
        &cf_str_EAP_TLS_PEAP_ttls_pap_max_session_validity_time_literal,
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1075
        &KTTLSPAPLastFullAuthTime );	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1076
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1077
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1078
	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1079
	err = aDatabase.Execute(sqlStatement);
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1080
	if (err == KErrAlreadyExists)
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1081
		{
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1082
		EAP_TRACE_DEBUG_SYMBIAN((_L("EapTlsPeapUtils::OpenTtlsDatabaseL - Alter Table err=%d\n"), err) );
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1083
		
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1084
		_LIT( KColumnDef, "UNSIGNED INTEGER" );
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1085
		AlterTableL( aDatabase, EAddColumn , KTtlsDatabaseTableName,
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1086
				cf_str_EAP_TLS_PEAP_use_identity_privacy_literal, KColumnDef);
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1087
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1088
		_LIT( KColumnDef1, "UNSIGNED INTEGER" );
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1089
		AlterTableL( aDatabase, EAddColumn , KTtlsDatabaseTableName,
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1090
				cf_str_EAP_TLS_PEAP_ttls_pap_password_prompt_literal, KColumnDef1);
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1091
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1092
        HBufC* buf1 = HBufC::NewLC(KMaxSqlQueryLength);
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1093
        TPtr sqlStatement = buf1->Des();
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1094
       
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1095
        _LIT(KSQLAlterTableForVar, "VARCHAR (%d)");                                          
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1096
    
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1097
        sqlStatement.Format(KSQLAlterTableForVar, KMaxPapUserNameLengthInDb);
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1098
 
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1099
		AlterTableL( aDatabase, EAddColumn , KTtlsDatabaseTableName,
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1100
				cf_str_EAP_TLS_PEAP_ttls_pap_username_literal, sqlStatement);
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1101
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1102
        sqlStatement.Format(KSQLAlterTableForVar, KMaxPapPasswordLengthInDb);
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1103
        
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1104
		AlterTableL( aDatabase, EAddColumn , KTtlsDatabaseTableName,
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1105
				cf_str_EAP_TLS_PEAP_ttls_pap_password_literal, sqlStatement);
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1106
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1107
		CleanupStack::PopAndDestroy(buf1);
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1108
		
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1109
		_LIT( KColumnDef4, "BIGINT" );
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1110
		AlterTableL( aDatabase, EAddColumn , KTtlsDatabaseTableName,
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1111
				cf_str_EAP_TLS_PEAP_ttls_pap_max_session_validity_time_literal, KColumnDef4);
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1112
				
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1113
		_LIT( KColumnDef5, "BIGINT" );
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1114
		AlterTableL( aDatabase, EAddColumn , KTtlsDatabaseTableName,
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1115
				KTTLSPAPLastFullAuthTime, KColumnDef5);
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1116
				
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1117
		}
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1118
	else if (err != KErrNone)
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1119
		{
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1120
		User::Leave(err);
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1121
		}
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1122
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1123
	// Create table for _allowed_ user certificates
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1124
	
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1125
//// NAME ////////////////// TYPE ////////////// Constant ///////////
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1126
//| ServiceType		  	| UNSIGNED INTEGER | KServiceType        |//
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1127
//| ServiceIndex		| UNSIGNED INTEGER | KServiceIndex       |//
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1128
//| TunnelingType		| UNSIGNED INTEGER | KTunnelingType		|//
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1129
//| CertLabel			| VARCHAR(255)     | KCACertLabel        |//	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1130
//| SubjectKeyId		| BINARY(20)	   | KSubjectKeyIdentifier |// This is Symbian subjectkey id
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1131
//| ActualSubjectKeyId  | BINARY(20)	   | KActualSubjectKeyIdentifier |// This is the actual subjectkeyid present in the certificate.
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1132
//| SubjectName			| VARCHAR(255)     | KSubjectName        |//	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1133
//| IssuerName			| VARCHAR(255)     | KIssuerName        |//	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1134
//| SerialNumber		| VARCHAR(255)     | KSerialNumber        |//	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1135
//| Thumbprint			| BINARY(64)	   | KThumbprint        |//	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1136
//////////////////////////////////////////////////////////////////////////////////////////////////////	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1137
	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1138
	_LIT(KSQLCreateTable2, "CREATE TABLE %S (%S UNSIGNED INTEGER, \
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1139
											 %S UNSIGNED INTEGER, \
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1140
											 %S UNSIGNED INTEGER, \
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1141
											 %S VARCHAR(%d), \
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1142
											 %S BINARY(%d), \
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1143
											 %S BINARY(%d), \
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1144
											 %S VARCHAR(%d), \
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1145
											 %S VARCHAR(%d), \
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1146
											 %S VARCHAR(%d), \
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1147
											 %S BINARY(%d))");											 
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1148
											 
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1149
	sqlStatement.Format(KSQLCreateTable2, &KTtlsAllowedUserCertsDatabaseTableName, 
45
bad0cc58d154 Revision: 201029
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
  1150
		&KServiceType, 
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1151
		&KServiceIndex, 
45
bad0cc58d154 Revision: 201029
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
  1152
		&KTunnelingType, 
bad0cc58d154 Revision: 201029
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
  1153
		&KCertLabel, KMaxCertLabelLengthInDB,
bad0cc58d154 Revision: 201029
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
  1154
		&KSubjectKeyIdentifier, KMaxSubjectKeyIdLengthInDB,
bad0cc58d154 Revision: 201029
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
  1155
		&KActualSubjectKeyIdentifier, KKeyIdentifierLength,
bad0cc58d154 Revision: 201029
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
  1156
		&KSubjectName, KGeneralStringMaxLength,
bad0cc58d154 Revision: 201029
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
  1157
		&KIssuerName, KGeneralStringMaxLength,
bad0cc58d154 Revision: 201029
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
  1158
		&KSerialNumber, KGeneralStringMaxLength,
bad0cc58d154 Revision: 201029
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
  1159
		&KThumbprint, KThumbprintMaxLength);
bad0cc58d154 Revision: 201029
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
  1160
		
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1161
	err = aDatabase.Execute(sqlStatement);
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1162
	if (err != KErrNone && err != KErrAlreadyExists)
45
bad0cc58d154 Revision: 201029
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
  1163
	{
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1164
		User::Leave(err);
45
bad0cc58d154 Revision: 201029
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
  1165
	}	
bad0cc58d154 Revision: 201029
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
  1166
bad0cc58d154 Revision: 201029
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
  1167
	// Create table for _allowed_ CA certs
bad0cc58d154 Revision: 201029
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
  1168
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1169
//// NAME ////////////////// TYPE ////////////// Constant ///////////
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1170
//| ServiceType			| UNSIGNED INTEGER | KServiceType        |//
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1171
//| ServiceIndex		| UNSIGNED INTEGER | KServiceIndex       |//
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1172
//| TunnelingType		| UNSIGNED INTEGER | KTunnelingType		|//
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1173
//| CACertLabel			| VARCHAR(255)     | KCACertLabel        |//	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1174
//| SubjectKeyId		| BINARY(20)	   | KSubjectKeyIdentifier |// This is Symbian subjectkey id
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1175
//| ActualSubjectKeyId  | BINARY(20)	   | KActualSubjectKeyIdentifier |// This is the actual subjectkeyid present in the certificate.
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1176
//| SubjectName			| VARCHAR(255)     | KSubjectName        |//	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1177
//| IssuerName			| VARCHAR(255)     | KIssuerName        |//	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1178
//| SerialNumber		| VARCHAR(255)     | KSerialNumber        |//	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1179
//| Thumbprint			| BINARY(64)	   | KThumbprint        |//	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1180
//////////////////////////////////////////////////////////////////////////////////////////////////////	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1181
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1182
	_LIT(KSQLCreateTable3, "CREATE TABLE %S (%S UNSIGNED INTEGER, \
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1183
											 %S UNSIGNED INTEGER, \
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1184
											 %S UNSIGNED INTEGER, \
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1185
											 %S VARCHAR(%d), \
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1186
											 %S BINARY(%d), \
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1187
											 %S BINARY(%d), \
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1188
											 %S VARCHAR(%d), \
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1189
											 %S VARCHAR(%d), \
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1190
											 %S VARCHAR(%d), \
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1191
											 %S BINARY(%d))");
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1192
											 
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1193
	sqlStatement.Format(KSQLCreateTable3, &KTtlsAllowedCACertsDatabaseTableName, 
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1194
		&KServiceType, 
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1195
		&KServiceIndex, 
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1196
		&KTunnelingType, 
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1197
		&KCertLabel, KMaxCertLabelLengthInDB,
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1198
		&KSubjectKeyIdentifier, KMaxSubjectKeyIdLengthInDB,
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1199
		&KActualSubjectKeyIdentifier, KKeyIdentifierLength,
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1200
		&KSubjectName, KGeneralStringMaxLength,
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1201
		&KIssuerName, KGeneralStringMaxLength,
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1202
		&KSerialNumber, KGeneralStringMaxLength,
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1203
		&KThumbprint, KThumbprintMaxLength);
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1204
		
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1205
	err = aDatabase.Execute(sqlStatement);
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1206
	if (err != KErrNone && err != KErrAlreadyExists)
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1207
	{
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1208
		User::Leave(err);
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1209
	}
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1210
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1211
	// Create table for _allowed_ cipher suites
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1212
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1213
//// NAME ///////////////// TYPE ////////////// Constant ///////////
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1214
//| ServiceType			| UNSIGNED INTEGER | KServiceType        |//
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1215
//| ServiceIndex		| UNSIGNED INTEGER | KServiceIndex       |//
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1216
//| TunnelingType		| UNSIGNED INTEGER | KTunnelingType		|//
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1217
//| CipherSuite			| UNSIGNED INTEGER | KCipherSuite        |//	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1218
//////////////////////////////////////////////////////////////////////////////////////////////////////	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1219
	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1220
	_LIT(KSQLCreateTable4, "CREATE TABLE %S (%S UNSIGNED INTEGER, \
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1221
											 %S UNSIGNED INTEGER, \
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1222
											 %S UNSIGNED INTEGER, \
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1223
											 %S UNSIGNED INTEGER)");
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1224
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1225
	sqlStatement.Format(KSQLCreateTable4, &KTtlsAllowedCipherSuitesDatabaseTableName, 
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1226
		&KServiceType, &KServiceIndex, &KTunnelingType, &KCipherSuite);
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1227
	err = aDatabase.Execute(sqlStatement);
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1228
	if (err != KErrNone && err != KErrAlreadyExists)
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1229
	{
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1230
		User::Leave(err);
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1231
	}
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1232
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1233
	// 4. Check if database table contains a row for this service type and id  	
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1234
	
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1235
	_LIT(KSQLQueryRow, "SELECT * FROM %S WHERE %S=%d AND %S=%d AND %S=%d");
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1236
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1237
	sqlStatement.Format(KSQLQueryRow, &KTtlsDatabaseTableName, 
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1238
		&KServiceType, aIndexType, &KServiceIndex, aIndex, &KTunnelingType, aTunnelingVendorType);	
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1239
			
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1240
	RDbView view;
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1241
	User::LeaveIfError(view.Prepare(aDatabase, TDbQuery(sqlStatement), TDbWindow::EUnlimited));
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1242
	// View must be closed when no longer needed
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1243
	CleanupClosePushL(view);
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1244
	User::LeaveIfError(view.EvaluateAll());
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1245
	
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1246
	// 5. If row is not found then add it
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1247
	
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1248
	TInt rows = view.CountL();
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1249
	CleanupStack::PopAndDestroy(); // view
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1250
	if (rows == 0)
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1251
	{
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1252
		_LIT(KSQLInsert, "SELECT * FROM %S");
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1253
		sqlStatement.Format(KSQLInsert, &KTtlsDatabaseTableName);	
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1254
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1255
		User::LeaveIfError(view.Prepare(aDatabase, TDbQuery(sqlStatement), TDbWindow::EUnlimited, RDbView::EInsertOnly));
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1256
		CleanupClosePushL(view);
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1257
		view.InsertL();
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1258
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1259
		// Get column set so we get the correct column numbers
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1260
		CDbColSet* colSet = view.ColSetL();
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1261
		CleanupStack::PushL(colSet);
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1262
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1263
		// Set the default values. The other three tables (certs, ca certs & cipher suites) are empty by default.
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1264
		view.SetColL(colSet->ColNo(KServiceType), static_cast<TInt>(aIndexType));
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1265
		view.SetColL(colSet->ColNo(KServiceIndex), aIndex);		
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1266
		view.SetColL(colSet->ColNo(KTunnelingType), aTunnelingVendorType);
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1267
		
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1268
		view.SetColL(colSet->ColNo(cf_str_EAP_TLS_PEAP_use_manual_realm_literal), default_EAP_TLS_PEAP_use_manual_realm);
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1269
		view.SetColL(colSet->ColNo(cf_str_EAP_TLS_PEAP_manual_realm_literal), default_EAP_TLS_PEAP_manual_realm);
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1270
		
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1271
		view.SetColL(colSet->ColNo(cf_str_EAP_TLS_PEAP_use_manual_username_literal), default_EAP_TLS_PEAP_use_manual_username);
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1272
		view.SetColL(colSet->ColNo(cf_str_EAP_TLS_PEAP_manual_username_literal), default_EAP_TLS_PEAP_manual_username);
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1273
		
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1274
		view.SetColL(colSet->ColNo(cf_str_EAP_TLS_PEAP_cipher_suite_literal), default_EAP_TLS_PEAP_cipher_suite);
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1275
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1276
		view.SetColL(colSet->ColNo(cf_str_EAP_TLS_PEAP_used_PEAP_version_literal), default_EAP_TLS_PEAP_used_PEAP_version);
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1277
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1278
		TInt i(0);
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1279
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1280
		while (default_EAP_TLS_PEAP_accepted_PEAP_versions[i] != -1)
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1281
		{
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1282
			i++;
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1283
		}
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1284
		
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1285
		TBuf8<KMaxPEAPVersionsStringLengthInDB> tmp;
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1286
		
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1287
		tmp.Copy(reinterpret_cast<const TUint8 *> (default_EAP_TLS_PEAP_accepted_PEAP_versions), i * sizeof(TInt));
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1288
		
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1289
		view.SetColL(colSet->ColNo(cf_str_EAP_TLS_PEAP_accepted_PEAP_versions_literal), tmp);
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1290
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1291
		view.SetColL(colSet->ColNo(cf_str_PEAP_accepted_tunneled_client_types_hex_data_literal), default_PEAP_tunneled_types);
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1292
		view.SetColL(colSet->ColNo(cf_str_PEAP_unaccepted_tunneled_client_types_hex_data_literal), default_PEAP_tunneled_types);		
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1293
		
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1294
		view.SetColL(colSet->ColNo(cf_str_TLS_server_authenticates_client_policy_in_client_literal), default_EAP_PEAP_TTLS_server_authenticates_client);
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1295
		view.SetColL(colSet->ColNo(KCACertLabelOld), default_CA_cert_label);
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1296
		
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1297
		view.SetColL(colSet->ColNo(KClientCertLabel), default_client_cert_label);	
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1298
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1299
		view.SetColL(colSet->ColNo(cf_str_EAP_TLS_PEAP_verify_certificate_realm_literal), default_EAP_TLS_PEAP_verify_certificate_realm);
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1300
		
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1301
		view.SetColL(colSet->ColNo(cf_str_EAP_TTLS_max_session_validity_time_literal), default_MaxSessionTime);
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1302
		
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1303
		view.SetColL(colSet->ColNo(KTTLSLastFullAuthTime), default_FullAuthTime);				
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1304
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1305
		view.SetColL(colSet->ColNo(cf_str_EAP_TLS_PEAP_use_identity_privacy_literal), default_EAP_TLS_PEAP_TLS_Privacy);
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1306
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1307
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1308
		view.SetColL( colSet->ColNo(
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1309
			cf_str_EAP_TLS_PEAP_ttls_pap_password_prompt_literal ),
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1310
			KDefaultPapPasswordPrompt );
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1311
		
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1312
		view.SetColL( colSet->ColNo(
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1313
			cf_str_EAP_TLS_PEAP_ttls_pap_username_literal ),
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1314
			KDefaultPapUserName );
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1315
		
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1316
		view.SetColL( colSet->ColNo(
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1317
			cf_str_EAP_TLS_PEAP_ttls_pap_password_literal ),
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1318
			KDefaultPapPassword );
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1319
		
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1320
		view.SetColL( colSet->ColNo(
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1321
			cf_str_EAP_TLS_PEAP_ttls_pap_max_session_validity_time_literal ),
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1322
			KDefaultMaxPapSessionTime );
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1323
		
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1324
		view.SetColL(
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1325
			colSet->ColNo( KTTLSPAPLastFullAuthTime ),
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1326
			KDefaultFullPapAuthTime );		
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1327
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1328
		
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1329
		view.PutL();
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1330
		
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1331
		CleanupStack::PopAndDestroy(colSet); 
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1332
		CleanupStack::PopAndDestroy( &view ); // Close view.
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1333
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1334
		// Add default disabled cipher suites
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1335
		_LIT(KSQLInsert2, "SELECT * FROM %S");
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1336
		sqlStatement.Format(KSQLInsert2, &KTtlsAllowedCipherSuitesDatabaseTableName);
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1337
		User::LeaveIfError(view.Prepare(aDatabase, TDbQuery(sqlStatement), TDbWindow::EUnlimited, RDbView::EInsertOnly));
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1338
		CleanupClosePushL(view);
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1339
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1340
		// Get column set so we get the correct column numbers
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1341
		colSet = view.ColSetL();
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1342
		CleanupStack::PushL(colSet);
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1343
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1344
		i = 0;
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1345
		while (default_allowed_cipher_suites[i] != 0)
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1346
		{
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1347
			view.InsertL();
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1348
			view.SetColL(colSet->ColNo(KServiceType), static_cast<TInt>(aIndexType));
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1349
			view.SetColL(colSet->ColNo(KServiceIndex), aIndex);		
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1350
			view.SetColL(colSet->ColNo(KTunnelingType), aTunnelingVendorType);			
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1351
			view.SetColL(colSet->ColNo(KCipherSuite), default_allowed_cipher_suites[i]);
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1352
			view.PutL();
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1353
			i++;
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1354
		}
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1355
		
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1356
		CleanupStack::PopAndDestroy( colSet ); // Delete colSet.		
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1357
		CleanupStack::PopAndDestroy( &view ); // Close view.
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1358
	}
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1359
	 
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1360
	// 6. Do the altering of tables here. 
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1361
	//    Add columns to existing certificate DB tables for Serial number, Issuer name etc. 
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1362
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1363
	TBufC<KDbMaxColName> tableName;
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1364
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1365
	// For the table _allowed_ USER certificates
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1366
	tableName = KTtlsAllowedUserCertsDatabaseTableName;	
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1367
	AddExtraCertColumnsL(aDatabase,tableName);
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1368
	
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1369
	// For the table _allowed_ CA certificates	
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1370
	tableName = KTtlsAllowedCACertsDatabaseTableName;	
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1371
	AddExtraCertColumnsL(aDatabase,tableName);
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1372
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1373
	CleanupStack::PopAndDestroy( buf ); // Delete buf or sqlStatement
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1374
	CleanupStack::Pop( &aDatabase );	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1375
	CleanupStack::Pop( &aSession );
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1376
	
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1377
	aDatabase.Compact();
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1378
	
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1379
} // EapTlsPeapUtils::OpenTtlsDatabaseL()
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1380
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1381
#endif // #if defined(USE_TTLS_EAP_TYPE)
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1382
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1383
#if defined(USE_FAST_EAP_TYPE)
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1384
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1385
// ---------------------------------------------------------
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1386
// EapTlsPeapUtils::OpenFastDatabaseL()
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1387
// ---------------------------------------------------------
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1388
//
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1389
void EapTlsPeapUtils::OpenFastDatabaseL(
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1390
	RDbNamedDatabase& aDatabase, 
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1391
	RDbs& aSession, 
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1392
	const TIndexType aIndexType, 
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1393
	const TInt aIndex,
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1394
	const eap_type_value_e aTunnelingType)
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1395
    {
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1396
#ifdef USE_EAP_EXPANDED_TYPES
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1397
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1398
	TUint aTunnelingVendorType = aTunnelingType.get_vendor_type();
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1399
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1400
#else
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1401
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1402
	TUint aTunnelingVendorType = static_cast<TUint>(aTunnelingType);
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1403
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1404
#endif //#ifdef USE_EAP_EXPANDED_TYPES
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1405
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1406
	EAP_TRACE_DEBUG_SYMBIAN(
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1407
		(_L("EapTlsPeapUtils::OpenFastDatabaseL -Start- aIndexType=%d, aIndex=%d, Tunneling vendor type=%d \n"),
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1408
		aIndexType,aIndex, aTunnelingVendorType));
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1409
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1410
	// 1. Open/create a database	
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1411
	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1412
	// Connect to the DBMS server.
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1413
	User::LeaveIfError(aSession.Connect());		
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1414
	CleanupClosePushL(aSession);	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1415
	// aSession and aDatabase are pushed to the cleanup stack even though they may be member
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1416
	// variables of the calling class and would be closed in the destructor anyway. This ensures
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1417
	// that if they are not member variables they will be closed. Closing the handle twice
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1418
	// does no harm.	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1419
	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1420
#ifdef SYMBIAN_SECURE_DBMS
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1421
	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1422
	// Create the secure shared database with the specified secure policy.
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1423
	// Database will be created in the data caging path for DBMS (C:\private\100012a5).
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1424
	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1425
	TInt err = aDatabase.Create(aSession, KFastDatabaseName, KSecureUIDFormat);
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1426
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1427
	EAP_TRACE_DEBUG_SYMBIAN(
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1428
		(_L("EapTlsPeapUtils::OpenFastDatabaseL - Created Secure DB for eapfast.dat. err=%d (-11=DB created before)\n"),
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1429
		err) );
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1430
	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1431
	if(err == KErrNone)
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1432
	{
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1433
		aDatabase.Close();
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1434
		
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1435
	} else if (err != KErrAlreadyExists) 
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1436
	{
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1437
		User::LeaveIfError(err);
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1438
	}
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1439
	
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1440
	User::LeaveIfError(aDatabase.Open(aSession, KFastDatabaseName, KSecureUIDFormat));
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1441
	CleanupClosePushL(aDatabase);		
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1442
		
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1443
#else
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1444
	// For non-secured database. The database will be created in the old location (c:\system\data).
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1445
	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1446
	RFs fsSession;		
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1447
	User::LeaveIfError(fsSession.Connect());
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1448
	CleanupClosePushL(fsSession);	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1449
	TInt err = aDatabase.Create(fsSession, KFastDatabaseName);
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1450
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1451
	EAP_TRACE_DEBUG_SYMBIAN((_L("EapTlsPeapUtils::OpenFastDatabaseL - Created Non-Secure DB for eapfast.dat. err=%d\n"), err) );
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1452
	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1453
	if(err == KErrNone)
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1454
	{
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1455
		aDatabase.Close();
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1456
		
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1457
	} else if (err != KErrAlreadyExists) 
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1458
	{
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1459
		User::LeaveIfError(err);
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1460
	}
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1461
	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1462
	User::LeaveIfError(aDatabase.Open(fsSession, KFastDatabaseName));
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1463
	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1464
	CleanupStack::PopAndDestroy(); // close fsSession
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1465
	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1466
	CleanupClosePushL(aDatabase);		
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1467
	    
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1468
#endif // #ifdef SYMBIAN_SECURE_DBMS
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1469
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1470
	// 2. Create the eapfast tables to database (ignore error if exists)
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1471
	
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1472
	// Table 1: Create table for general settings of EAP-FAST.
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1473
	
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1474
// Table columns:
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1475
//// NAME //////////////////////////////////////////// TYPE ////////////// Constant ///////////////////
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1476
//| ServiceType									| UNSIGNED INTEGER 	| KServiceType        |//
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1477
//| ServiceIndex								| UNSIGNED INTEGER 	| KServiceIndex       |//
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1478
//| TunnelingType								| UNSIGNED INTEGER 	| KTunnelingType		|//
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1479
//| EAP_TLS_PEAP_use_manual_realm				| UNSIGNED INTEGER 	| cf_str_EAP_TLS_PEAP_use_manual_realm_literal      |//
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1480
//| EAP_TLS_PEAP_manual_realm					| VARCHAR(255)     	| cf_str_EAP_TLS_PEAP_manual_realm_literal				|//
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1481
//| EAP_TLS_PEAP_use_manual_username			| UNSIGNED INTEGER 	| cf_str_EAP_TLS_PEAP_use_manual_username_literal   |//
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1482
//| EAP_TLS_PEAP_manual_username				| VARCHAR(255)     	| cf_str_EAP_TLS_PEAP_manual_username_literal			|//
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1483
//| EAP_TLS_PEAP_cipher_suite					| UNSIGNED INTEGER 	| cf_str_EAP_TLS_PEAP_cipher_suite_literal	   |//
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1484
//| EAP_TLS_PEAP_used_PEAP_version				| UNSIGNED INTEGER 	| cf_str_EAP_TLS_PEAP_used_PEAP_version_literal		    |//
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1485
//| EAP_TLS_PEAP_accepted_PEAP_versions			| BINARY(12)	    | cf_str_EAP_TLS_PEAP_accepted_PEAP_versions_literal|//
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1486
//| PEAP_accepted_tunneled_client_types			| VARBINARY(240) 	| cf_str_PEAP_accepted_tunneled_client_types_hex_data_literal      |//
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1487
//| PEAP_unaccepted_tunneled_client_types		| VARBINARY(240) 	| cf_str_PEAP_unaccepted_tunneled_client_types_hex_data_literal      |//
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1488
//| EAP_TLS_server_authenticates_client		    | UNSIGNED INTEGER 	| cf_str_TLS_server_authenticates_client_policy_in_client_literal|//
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1489
//| EAP_TLS_PEAP_saved_session_id				| BINARY(32)       	| cf_str_EAP_TLS_PEAP_saved_session_id_literal		   |//
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1490
//| EAP_TLS_PEAP_saved_master_secret			| BINARY(48)       	| cf_str_EAP_TLS_PEAP_saved_master_secret_literal	   |//
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1491
//| EAP_TLS_PEAP_saved_cipher_suite				| UNSIGNED INTEGER 	| cf_str_EAP_TLS_PEAP_saved_cipher_suite_literal   |//
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1492
//| EAP_TLS_PEAP_verify_certificate_realm		| UNSIGNED INTEGER 	| cf_str_EAP_TLS_PEAP_verify_certificate_realm_literal		   |//
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1493
//| EAP_FAST_max_session_validity_time			| BIGINT	   		| cf_str_EAP_FAST_max_session_validity_time_literal   |//
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1494
//| EAP_FAST_last_full_authentication_time		| BIGINT	   		| KFASTLastFullAuthTime	   	|//	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1495
//| EAP_TLS_PEAP_use_identity_privacy			| UNSIGNED INTEGER 	| cf_str_EAP_TLS_PEAP_use_identity_privacy_literal		   |//
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1496
//////////////////////////////////////////////////////////////////////////////////////////////////////////////	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1497
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1498
/** moved to PAC store db, because time is the same for all IAPs **/	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1499
//| EAP_FAST_last_password_identity_time	| BIGINT	   		| KFASTLastPasswordIdentityTime	   	|//	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1500
//////////////////////////////////////////////////////////////////////////////////////////////////////////////		
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1501
	
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1502
	
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1503
	HBufC* buf = HBufC::NewLC(KMaxSqlQueryLength);
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1504
	TPtr sqlStatement = buf->Des();
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1505
	
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1506
	EAP_TRACE_DEBUG_SYMBIAN(
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1507
		(_L("EapTlsPeapUtils::OpenFastDatabaseL - Creating the tables for EAP-FAST\n")));
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1508
	
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1509
	_LIT(KSQLCreateTable1, "CREATE TABLE %S (%S UNSIGNED INTEGER, \
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1510
											 %S UNSIGNED INTEGER, \
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1511
											 %S UNSIGNED INTEGER, \
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1512
											 %S UNSIGNED INTEGER, \
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1513
											 %S VARCHAR(%d),     \
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1514
											 %S UNSIGNED INTEGER, \
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1515
											 %S VARCHAR(%d),     \
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1516
											 %S UNSIGNED INTEGER, \
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1517
											 %S UNSIGNED INTEGER, \
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1518
											 %S BINARY(%d),		  \
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1519
											 %S VARBINARY(%d),	  \
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1520
											 %S VARBINARY(%d),	  \
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1521
											 %S UNSIGNED INTEGER, \
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1522
											 %S BINARY(%d),		  \
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1523
											 %S BINARY(%d),		  \
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1524
											 %S UNSIGNED INTEGER, \
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1525
											 %S UNSIGNED INTEGER, \
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1526
											 %S BIGINT, \
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1527
											 %S BIGINT, \
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1528
											 %S UNSIGNED INTEGER)");
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1529
	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1530
	sqlStatement.Format(KSQLCreateTable1, &KFastGeneralSettingsDBTableName,
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1531
		&KServiceType,
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1532
		&KServiceIndex,
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1533
		&KTunnelingType,
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1534
		&cf_str_EAP_TLS_PEAP_use_manual_realm_literal,
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1535
		&cf_str_EAP_TLS_PEAP_manual_realm_literal, KMaxManualRealmLengthInDB,
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1536
		&cf_str_EAP_TLS_PEAP_use_manual_username_literal,
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1537
		&cf_str_EAP_TLS_PEAP_manual_username_literal, KMaxManualUsernameLengthInDB,
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1538
		&cf_str_EAP_TLS_PEAP_cipher_suite_literal,
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1539
		&cf_str_EAP_TLS_PEAP_used_PEAP_version_literal,
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1540
		&cf_str_EAP_TLS_PEAP_accepted_PEAP_versions_literal, KMaxPEAPVersionsStringLengthInDB,
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1541
		&cf_str_PEAP_accepted_tunneled_client_types_hex_data_literal, KMaxTunneledTypeStringLengthInDB,
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1542
		&cf_str_PEAP_unaccepted_tunneled_client_types_hex_data_literal,	KMaxTunneledTypeStringLengthInDB,	
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1543
		&cf_str_TLS_server_authenticates_client_policy_in_client_literal,
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1544
		&cf_str_EAP_TLS_PEAP_saved_session_id_literal, KMaxSessionIdLengthInDB,
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1545
		&cf_str_EAP_TLS_PEAP_saved_master_secret_literal, KMaxMasterSecretLengthInDB,
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1546
		&cf_str_EAP_TLS_PEAP_saved_cipher_suite_literal,
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1547
		&cf_str_EAP_TLS_PEAP_verify_certificate_realm_literal,
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1548
		&cf_str_EAP_FAST_max_session_validity_time_literal,
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1549
		&KFASTLastFullAuthTime,
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1550
		&cf_str_EAP_TLS_PEAP_use_identity_privacy_literal);		
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1551
	
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1552
	EAP_TRACE_DEBUG_SYMBIAN(
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1553
		(_L("EapTlsPeapUtils::OpenFastDatabaseL - SQL query formated OK\n")));
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1554
	
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1555
	err = aDatabase.Execute(sqlStatement);
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1556
	if (err != KErrNone && err != KErrAlreadyExists)
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1557
	{
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1558
		User::Leave(err);
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1559
	}
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1560
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1561
	EAP_TRACE_DEBUG_SYMBIAN(
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1562
		(_L("EapTlsPeapUtils::OpenFastDatabaseL Created General settings table\n")));
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1563
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1564
	// Table 2: Create table for Special settings of EAP-FAST.
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1565
	
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1566
// Table columns:
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1567
//// NAME //////////////////////////////////////////// TYPE ////////////// Constant ///////////////////
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1568
//| ServiceType									| UNSIGNED INTEGER 	| KServiceType        |//
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1569
//| ServiceIndex								| UNSIGNED INTEGER 	| KServiceIndex       |//
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1570
//| TunnelingType								| UNSIGNED INTEGER 	| KTunnelingType		|//
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1571
//| EAP_FAST_allow_server_authenticated_provisioning_mode| UNSIGNED INTEGER	| cf_str_EAP_FAST_allow_server_authenticated_provisioning_mode_literal	   	|//	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1572
//| EAP_FAST_allow_server_unauthenticated_provisioning_mode_ADHP| UNSIGNED INTEGER	| cf_str_EAP_FAST_allow_server_unauthenticated_provisioning_mode_ADHP_literal	   	|//	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1573
//| EAP_FAST_Warn_ADHP_No_PAC					| UNSIGNED INTEGER	| KFASTWarnADHPNoPACP|//	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1574
//| EAP_FAST_Warn_ADHP_No_Matching_PAC			| UNSIGNED INTEGER	| KFASTWarnADHPNoMatchingPAC|//	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1575
//| EAP_FAST_Warn_Not_Default_Server			| UNSIGNED INTEGER	| KFASTWarnNotDefaultServer|//	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1576
//| EAP_FAST_PAC_Group_Import_Reference_Collection| VARCHAR(255)	| KFASTPACGroupImportReferenceCollection	   	|//	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1577
//| EAP_FAST_PAC_Group_DB_Reference_Collection	| BINARY(255)		| KFASTPACGroupDBReferenceCollection	   	|//		
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1578
//////////////////////////////////////////////////////////////////////////////////////////////////////////////	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1579
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1580
	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1581
	_LIT(KSQLCreateTable2, "CREATE TABLE %S (%S UNSIGNED INTEGER, \
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1582
											 %S UNSIGNED INTEGER, \
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1583
											 %S UNSIGNED INTEGER, \
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1584
											 %S UNSIGNED INTEGER, \
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1585
											 %S UNSIGNED INTEGER, \
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1586
											 %S UNSIGNED INTEGER, \
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1587
											 %S UNSIGNED INTEGER, \
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1588
											 %S UNSIGNED INTEGER, \
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1589
											 %S VARCHAR(%d),     \
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1590
											 %S BINARY(%d)		  )");
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1591
											 
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1592
	sqlStatement.Format(KSQLCreateTable2, &KFastSpecialSettingsDBTableName,
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1593
		&KServiceType,
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1594
		&KServiceIndex,
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1595
		&KTunnelingType,
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1596
		&cf_str_EAP_FAST_allow_server_authenticated_provisioning_mode_literal,
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1597
		&cf_str_EAP_FAST_allow_server_unauthenticated_provisioning_mode_ADHP_literal,
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1598
		&KFASTWarnADHPNoPAC,
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1599
		&KFASTWarnADHPNoMatchingPAC,
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1600
		&KFASTWarnNotDefaultServer,
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1601
		&KFASTPACGroupImportReferenceCollection, KMaxPACGroupRefCollectionLengthInDB,
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1602
		&KFASTPACGroupDBReferenceCollection, KMaxPACGroupRefCollectionLengthInDB);
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1603
	
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1604
	EAP_TRACE_DEBUG_SYMBIAN(
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1605
		(_L("EapTlsPeapUtils::OpenFastDatabaseL - SQL query formated OK\n")));
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1606
	
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1607
	err = aDatabase.Execute(sqlStatement);
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1608
	if (err != KErrNone && err != KErrAlreadyExists)
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1609
	{
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1610
		User::Leave(err);
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1611
	}
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1612
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1613
	EAP_TRACE_DEBUG_SYMBIAN(
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1614
		(_L("EapTlsPeapUtils::OpenFastDatabaseL Created Specific settings table\n")));
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1615
	
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1616
	// Table 3: Create table for _allowed_ user certificates
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1617
	
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1618
//// NAME ////////////////// TYPE ////////////// Constant ///////////
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1619
//| ServiceType		  	| UNSIGNED INTEGER | KServiceType        |//
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1620
//| ServiceIndex		| UNSIGNED INTEGER | KServiceIndex       |//
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1621
//| TunnelingType		| UNSIGNED INTEGER | KTunnelingType		|//
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1622
//| CertLabel			| VARCHAR(255)     | KCACertLabel        |//	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1623
//| SubjectKeyId		| BINARY(20)	   | KSubjectKeyIdentifier |// This is Symbian subjectkey id
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1624
//| ActualSubjectKeyId  | BINARY(20)	   | KActualSubjectKeyIdentifier |// This is the actual subjectkeyid present in the certificate.
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1625
//| SubjectName			| VARCHAR(255)     | KSubjectName        |//	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1626
//| IssuerName			| VARCHAR(255)     | KIssuerName        |//	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1627
//| SerialNumber		| VARCHAR(255)     | KSerialNumber        |//	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1628
//| Thumbprint			| BINARY(64)	   | KThumbprint        |//	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1629
//////////////////////////////////////////////////////////////////////////////////////////////////////	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1630
	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1631
	_LIT(KSQLCreateTable3, "CREATE TABLE %S (%S UNSIGNED INTEGER, \
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1632
											 %S UNSIGNED INTEGER, \
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1633
											 %S UNSIGNED INTEGER, \
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1634
											 %S VARCHAR(%d), \
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1635
											 %S BINARY(%d), \
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1636
											 %S BINARY(%d), \
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1637
											 %S VARCHAR(%d), \
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1638
											 %S VARCHAR(%d), \
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1639
											 %S VARCHAR(%d), \
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1640
											 %S BINARY(%d))");											 
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1641
											 
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1642
	sqlStatement.Format(KSQLCreateTable3, &KFastAllowedUserCertsDatabaseTableName, 
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1643
		&KServiceType, 
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1644
		&KServiceIndex, 
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1645
		&KTunnelingType, 
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1646
		&KCertLabel, KMaxCertLabelLengthInDB,
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1647
		&KSubjectKeyIdentifier, KMaxSubjectKeyIdLengthInDB,
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1648
		&KActualSubjectKeyIdentifier, KKeyIdentifierLength,
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1649
		&KSubjectName, KGeneralStringMaxLength,
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1650
		&KIssuerName, KGeneralStringMaxLength,
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1651
		&KSerialNumber, KGeneralStringMaxLength,
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1652
		&KThumbprint, KThumbprintMaxLength);
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1653
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1654
	EAP_TRACE_DEBUG_SYMBIAN(
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1655
		(_L("EapTlsPeapUtils::OpenFastDatabaseL - SQL query formated OK\n")));
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1656
	
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1657
	err = aDatabase.Execute(sqlStatement);
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1658
	if (err != KErrNone && err != KErrAlreadyExists)
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1659
	{
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1660
		User::Leave(err);
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1661
	}	
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1662
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1663
	EAP_TRACE_DEBUG_SYMBIAN(
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1664
		(_L("EapTlsPeapUtils::OpenFastDatabaseL Created User certificates table\n")));
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1665
	
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1666
	// Table 4: Create table for _allowed_ CA certs
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1667
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1668
//// NAME ////////////////// TYPE ////////////// Constant ///////////
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1669
//| ServiceType			| UNSIGNED INTEGER | KServiceType        |//
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1670
//| ServiceIndex		| UNSIGNED INTEGER | KServiceIndex       |//
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1671
//| TunnelingType		| UNSIGNED INTEGER | KTunnelingType		|//
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1672
//| CACertLabel			| VARCHAR(255)     | KCACertLabel        |//	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1673
//| SubjectKeyId		| BINARY(20)	   | KSubjectKeyIdentifier |// This is Symbian subjectkey id
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1674
//| ActualSubjectKeyId  | BINARY(20)	   | KActualSubjectKeyIdentifier |// This is the actual subjectkeyid present in the certificate.
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1675
//| SubjectName			| VARCHAR(255)     | KSubjectName        |//	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1676
//| IssuerName			| VARCHAR(255)     | KIssuerName        |//	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1677
//| SerialNumber		| VARCHAR(255)     | KSerialNumber        |//	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1678
//| Thumbprint			| BINARY(64)	   | KThumbprint        |//	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1679
//////////////////////////////////////////////////////////////////////////////////////////////////////	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1680
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1681
	_LIT(KSQLCreateTable4, "CREATE TABLE %S (%S UNSIGNED INTEGER, \
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1682
											 %S UNSIGNED INTEGER, \
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1683
											 %S UNSIGNED INTEGER, \
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1684
											 %S VARCHAR(%d), \
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1685
											 %S BINARY(%d), \
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1686
											 %S BINARY(%d), \
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1687
											 %S VARCHAR(%d), \
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1688
											 %S VARCHAR(%d), \
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1689
											 %S VARCHAR(%d), \
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1690
											 %S BINARY(%d))");
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1691
											 
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1692
	sqlStatement.Format(KSQLCreateTable4, &KFastAllowedCACertsDatabaseTableName, 
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1693
		&KServiceType, 
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1694
		&KServiceIndex, 
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1695
		&KTunnelingType, 
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1696
		&KCertLabel, KMaxCertLabelLengthInDB,
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1697
		&KSubjectKeyIdentifier, KMaxSubjectKeyIdLengthInDB,
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1698
		&KActualSubjectKeyIdentifier, KKeyIdentifierLength,
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1699
		&KSubjectName, KGeneralStringMaxLength,
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1700
		&KIssuerName, KGeneralStringMaxLength,
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1701
		&KSerialNumber, KGeneralStringMaxLength,
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1702
		&KThumbprint, KThumbprintMaxLength);
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1703
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1704
	EAP_TRACE_DEBUG_SYMBIAN(
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1705
		(_L("EapTlsPeapUtils::OpenFastDatabaseL - SQL query formated OK\n")));
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1706
		
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1707
	err = aDatabase.Execute(sqlStatement);
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1708
	if (err != KErrNone && err != KErrAlreadyExists)
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1709
	{
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1710
		User::Leave(err);
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1711
	}
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1712
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1713
	EAP_TRACE_DEBUG_SYMBIAN(
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1714
		(_L("EapTlsPeapUtils::OpenFastDatabaseL Created CA certificates table\n")));
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1715
	
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1716
	// Table 5: Create table for _allowed_ cipher suites
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1717
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1718
//// NAME ///////////////// TYPE ////////////// Constant ///////////
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1719
//| ServiceType			| UNSIGNED INTEGER | KServiceType        |//
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1720
//| ServiceIndex		| UNSIGNED INTEGER | KServiceIndex       |//
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1721
//| TunnelingType		| UNSIGNED INTEGER | KTunnelingType		|//
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1722
//| CipherSuite			| UNSIGNED INTEGER | KCipherSuite        |//	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1723
//////////////////////////////////////////////////////////////////////////////////////////////////////	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1724
	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1725
	_LIT(KSQLCreateTable5, "CREATE TABLE %S (%S UNSIGNED INTEGER, \
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1726
											 %S UNSIGNED INTEGER, \
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1727
											 %S UNSIGNED INTEGER, \
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1728
											 %S UNSIGNED INTEGER)");
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1729
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1730
	sqlStatement.Format(KSQLCreateTable5, &KFastAllowedCipherSuitesDatabaseTableName, 
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1731
		&KServiceType, &KServiceIndex, &KTunnelingType, &KCipherSuite);
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1732
	err = aDatabase.Execute(sqlStatement);
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1733
	if (err != KErrNone && err != KErrAlreadyExists)
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1734
	{
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1735
		User::Leave(err);
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1736
	}
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1737
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1738
	EAP_TRACE_DEBUG_SYMBIAN(
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1739
		(_L("EapTlsPeapUtils::OpenFastDatabaseL Created Cipher suites table\n")));
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1740
	
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1741
	// 4. Check if database table contains a row for this service type and id  	
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1742
	
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1743
	_LIT(KSQLQueryRow, "SELECT * FROM %S WHERE %S=%d AND %S=%d AND %S=%d");
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1744
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1745
	sqlStatement.Format(KSQLQueryRow, &KFastGeneralSettingsDBTableName, 
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1746
		&KServiceType, aIndexType, &KServiceIndex, aIndex, &KTunnelingType, aTunnelingVendorType);	
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1747
			
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1748
	RDbView view;
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1749
	User::LeaveIfError(view.Prepare(aDatabase, TDbQuery(sqlStatement), TDbWindow::EUnlimited));
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1750
	// View must be closed when no longer needed
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1751
	CleanupClosePushL(view);
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1752
	User::LeaveIfError(view.EvaluateAll());
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1753
	
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1754
	// 5. If a row is not found then add it
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1755
	
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1756
	TInt rows = view.CountL();
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1757
	CleanupStack::PopAndDestroy(); // view
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1758
	if (rows == 0)
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1759
	{
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1760
		// This is to add default values to the General settings table.
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1761
		_LIT(KSQLInsert, "SELECT * FROM %S");
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1762
		sqlStatement.Format(KSQLInsert, &KFastGeneralSettingsDBTableName);	
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1763
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1764
		User::LeaveIfError(view.Prepare(aDatabase, TDbQuery(sqlStatement), TDbWindow::EUnlimited, RDbView::EInsertOnly));
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1765
		CleanupClosePushL(view);
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1766
		view.InsertL();
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1767
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1768
		// Get column set so we get the correct column numbers
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1769
		CDbColSet* colSet = view.ColSetL();
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1770
		CleanupStack::PushL(colSet);
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1771
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1772
		// Set the default values. The other three tables (certs, ca certs & cipher suites) are empty by default.
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1773
		view.SetColL(colSet->ColNo(KServiceType), static_cast<TInt>(aIndexType));
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1774
		view.SetColL(colSet->ColNo(KServiceIndex), aIndex);		
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1775
		view.SetColL(colSet->ColNo(KTunnelingType), aTunnelingVendorType);
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1776
		
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1777
		view.SetColL(colSet->ColNo(cf_str_EAP_TLS_PEAP_use_manual_realm_literal), default_EAP_TLS_PEAP_use_manual_realm);
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1778
		view.SetColL(colSet->ColNo(cf_str_EAP_TLS_PEAP_manual_realm_literal), default_EAP_TLS_PEAP_manual_realm);
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1779
		
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1780
		view.SetColL(colSet->ColNo(cf_str_EAP_TLS_PEAP_use_manual_username_literal), default_EAP_TLS_PEAP_use_manual_username);
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1781
		view.SetColL(colSet->ColNo(cf_str_EAP_TLS_PEAP_manual_username_literal), default_EAP_TLS_PEAP_manual_username);
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1782
		
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1783
		view.SetColL(colSet->ColNo(cf_str_EAP_TLS_PEAP_cipher_suite_literal), default_EAP_TLS_PEAP_cipher_suite);
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1784
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1785
		view.SetColL(colSet->ColNo(cf_str_EAP_TLS_PEAP_used_PEAP_version_literal), default_EAP_TLS_PEAP_used_PEAP_version);
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1786
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1787
		TInt i(0);
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1788
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1789
		while (default_EAP_TLS_PEAP_accepted_PEAP_versions[i] != -1)
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1790
		{
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1791
			i++;
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1792
		}
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1793
		
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1794
		TBuf8<KMaxPEAPVersionsStringLengthInDB> tmp;
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1795
		
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1796
		tmp.Copy(reinterpret_cast<const TUint8 *> (default_EAP_TLS_PEAP_accepted_PEAP_versions), i * sizeof(TInt));
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1797
		
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1798
		view.SetColL(colSet->ColNo(cf_str_EAP_TLS_PEAP_accepted_PEAP_versions_literal), tmp);
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1799
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1800
		view.SetColL(colSet->ColNo(cf_str_PEAP_accepted_tunneled_client_types_hex_data_literal), default_PEAP_tunneled_types);
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1801
		view.SetColL(colSet->ColNo(cf_str_PEAP_unaccepted_tunneled_client_types_hex_data_literal), default_PEAP_tunneled_types);		
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1802
		
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1803
		view.SetColL(colSet->ColNo(cf_str_TLS_server_authenticates_client_policy_in_client_literal), default_EAP_PEAP_TTLS_server_authenticates_client);
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1804
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1805
		view.SetColL(colSet->ColNo(cf_str_EAP_TLS_PEAP_verify_certificate_realm_literal), default_EAP_TLS_PEAP_verify_certificate_realm);
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1806
		
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1807
		view.SetColL(colSet->ColNo(cf_str_EAP_FAST_max_session_validity_time_literal), default_MaxSessionTime);
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1808
		
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1809
		view.SetColL(colSet->ColNo(KFASTLastFullAuthTime), default_FullAuthTime);
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1810
		
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1811
		view.SetColL(colSet->ColNo(cf_str_EAP_TLS_PEAP_use_identity_privacy_literal), default_EAP_TLS_PEAP_TLS_Privacy);		
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1812
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1813
		view.PutL();
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1814
		
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1815
		CleanupStack::PopAndDestroy(colSet); 
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1816
		CleanupStack::PopAndDestroy( &view ); // Close view.
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1817
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1818
		//--------------------------------------------------------//
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1819
		
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1820
		// This is to add default values to the Specific settings table.
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1821
		// KSQLInsert is "SELECT * FROM %S"
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1822
		sqlStatement.Format(KSQLInsert, &KFastSpecialSettingsDBTableName);	
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1823
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1824
		User::LeaveIfError(view.Prepare(aDatabase, TDbQuery(sqlStatement), TDbWindow::EUnlimited, RDbView::EInsertOnly));
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1825
		CleanupClosePushL(view);
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1826
		view.InsertL();
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1827
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1828
		// Get column set so we get the correct column numbers
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1829
		colSet = view.ColSetL();
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1830
		CleanupStack::PushL(colSet);
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1831
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1832
		// Set the default values.
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1833
		view.SetColL(colSet->ColNo(KServiceType), static_cast<TInt>(aIndexType));
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1834
		view.SetColL(colSet->ColNo(KServiceIndex), aIndex);		
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1835
		view.SetColL(colSet->ColNo(KTunnelingType), aTunnelingVendorType);
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1836
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1837
		view.SetColL(colSet->ColNo(cf_str_EAP_FAST_allow_server_authenticated_provisioning_mode_literal),
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1838
				default_EAP_FAST_Auth_Prov_Mode_Allowed);		
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1839
	 	view.SetColL(colSet->ColNo(cf_str_EAP_FAST_allow_server_unauthenticated_provisioning_mode_ADHP_literal),
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1840
	 			default_EAP_FAST_Unauth_Prov_Mode_Allowed);
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1841
	 	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1842
        view.SetColL(colSet->ColNo(KFASTWarnADHPNoPAC),
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1843
                default_EAP_FAST_Warn_ADHP_No_PAC);
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1844
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1845
        view.SetColL(colSet->ColNo(KFASTWarnADHPNoMatchingPAC),
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1846
                default_EAP_FAST_Warn_ADHP_No_Matching_PAC);
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1847
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1848
        view.SetColL(colSet->ColNo(KFASTWarnNotDefaultServer),
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1849
                default_EAP_FAST_Warn_Not_Default_Server);
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1850
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1851
	 	
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1852
							
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1853
		view.PutL();
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1854
		
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1855
		CleanupStack::PopAndDestroy(colSet); 
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1856
		CleanupStack::PopAndDestroy( &view ); // Close view.		
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1857
		
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1858
		//--------------------------------------------------------//
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1859
		
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1860
		// Add default disabled cipher suites to cipher suites table.
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1861
		_LIT(KSQLInsert2, "SELECT * FROM %S");
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1862
		sqlStatement.Format(KSQLInsert2, &KFastAllowedCipherSuitesDatabaseTableName);
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1863
		User::LeaveIfError(view.Prepare(aDatabase, TDbQuery(sqlStatement), TDbWindow::EUnlimited, RDbView::EInsertOnly));
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1864
		CleanupClosePushL(view);
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1865
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1866
		// Get column set so we get the correct column numbers
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1867
		colSet = view.ColSetL();
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1868
		CleanupStack::PushL(colSet);
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1869
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1870
		i = 0;
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1871
		while (default_allowed_cipher_suites[i] != 0)
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1872
		{
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1873
			view.InsertL();
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1874
			view.SetColL(colSet->ColNo(KServiceType), static_cast<TInt>(aIndexType));
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1875
			view.SetColL(colSet->ColNo(KServiceIndex), aIndex);		
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1876
			view.SetColL(colSet->ColNo(KTunnelingType), aTunnelingVendorType);			
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1877
			view.SetColL(colSet->ColNo(KCipherSuite), default_allowed_cipher_suites[i]);
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1878
			view.PutL();
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1879
			i++;
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1880
		}
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1881
		
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1882
		CleanupStack::PopAndDestroy( colSet ); // Delete colSet.		
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1883
		CleanupStack::PopAndDestroy( &view ); // Close view.
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1884
	}
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1885
	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1886
	CleanupStack::PopAndDestroy( buf ); // Delete buf or sqlStatement
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1887
	CleanupStack::Pop( &aDatabase );	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1888
	CleanupStack::Pop( &aSession );
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1889
	
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1890
	aDatabase.Compact();
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1891
	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1892
    } // EapTlsPeapUtils::OpenFastDatabaseL()
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1893
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1894
#endif // #if defined(USE_FAST_EAP_TYPE)
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1895
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1896
void EapTlsPeapUtils::SetIndexL(
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1897
	RDbNamedDatabase& aDatabase,
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1898
	const TDesC& aTableName,
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1899
	const TIndexType aIndexType,
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1900
	const TInt aIndex,
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1901
	const eap_type_value_e aTunnelingType,
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1902
	const TIndexType aNewIndexType,
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1903
	const TInt aNewIndex,
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1904
	const eap_type_value_e aNewTunnelingType)
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1905
{
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1906
#ifdef USE_EAP_EXPANDED_TYPES
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1907
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1908
	TUint aTunnelingVendorType = aTunnelingType.get_vendor_type();
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1909
	TUint aNewTunnelingVendorType = aNewTunnelingType.get_vendor_type();
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1910
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1911
#else
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1912
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1913
	TUint aTunnelingVendorType = static_cast<TUint>(aTunnelingType);
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1914
	TUint aNewTunnelingVendorType = static_cast<TUint>(aNewTunnelingType);
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1915
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1916
#endif //#ifdef USE_EAP_EXPANDED_TYPES
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1917
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1918
	EAP_TRACE_DEBUG_SYMBIAN(
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1919
		(_L("EapTlsPeapUtils::SetIndexL -Start- aIndexType=%d, aIndex=%d, Tunneling vendor type=%d \n"),
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1920
		aIndexType, aIndex, aTunnelingVendorType));
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1921
	
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1922
	EAP_TRACE_DEBUG_SYMBIAN(
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1923
		(_L("EapTlsPeapUtils::SetIndexL -Start- aNewIndexType=%d, aNewIndex=%d, New Tunneling vendor type=%d \n"),
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1924
		aNewIndexType, aNewIndex, aNewTunnelingVendorType));
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1925
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1926
	HBufC* buf = HBufC::NewLC(KMaxSqlQueryLength);
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1927
	TPtr sqlStatement = buf->Des();
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1928
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1929
	// First delete the target
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1930
	_LIT(KSQL, "SELECT * FROM %S WHERE %S=%d AND %S=%d AND %S=%d");
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1931
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1932
	sqlStatement.Format(KSQL, &aTableName, 
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1933
		&KServiceType, aIndexType, &KServiceIndex, aIndex, &KTunnelingType, aTunnelingVendorType);		
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1934
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1935
	RDbView view;
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1936
	
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1937
	User::LeaveIfError(view.Prepare(aDatabase, TDbQuery(sqlStatement), TDbWindow::EUnlimited));
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1938
	
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1939
	// View must be closed when no longer needed
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1940
	CleanupClosePushL(view);
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1941
	
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1942
	User::LeaveIfError(view.EvaluateAll());
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1943
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1944
	// Get column set so we get the correct column numbers
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1945
	CDbColSet* colSet = view.ColSetL();
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1946
	CleanupStack::PushL(colSet);
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1947
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1948
	if (view.FirstL())
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1949
	{		
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1950
		do {
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1951
			view.GetL();
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1952
			{
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1953
				view.UpdateL();
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1954
				
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1955
			    view.SetColL(colSet->ColNo(KServiceType), static_cast<TUint>(aNewIndexType));
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1956
    
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1957
    			view.SetColL(colSet->ColNo(KServiceIndex), static_cast<TUint>(aNewIndex));
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1958
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1959
    			view.SetColL(colSet->ColNo(KTunnelingType), aNewTunnelingVendorType);
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1960
				
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1961
				view.PutL();
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1962
			}
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1963
		} while (view.NextL() != EFalse);
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1964
	}
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1965
			
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1966
    CleanupStack::PopAndDestroy(3); // view, colset
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1967
}
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1968
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1969
void EapTlsPeapUtils::ReadCertRowsToArrayL(
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1970
	RDbNamedDatabase& aDatabase,
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1971
	eap_am_tools_symbian_c * const /*aTools*/,
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1972
	const TDesC& aTableName, 
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1973
	const TIndexType aIndexType,
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1974
	const TInt aIndex,
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1975
	const eap_type_value_e aTunnelingType,
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1976
	RArray<SCertEntry>& aArray)
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1977
{
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1978
#ifdef USE_EAP_EXPANDED_TYPES
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1979
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1980
	TUint aTunnelingVendorType = aTunnelingType.get_vendor_type();
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1981
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1982
#else
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1983
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1984
	TUint aTunnelingVendorType = static_cast<TUint>(aTunnelingType);
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1985
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1986
#endif //#ifdef USE_EAP_EXPANDED_TYPES
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1987
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1988
	EAP_TRACE_DEBUG_SYMBIAN((_L("EapTlsPeapUtils::ReadCertRowsToArrayL -Start")) );
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1989
	
23
3634639e6dc7 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 2
diff changeset
  1990
	CleanupClosePushL( aArray );
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1991
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1992
	HBufC* buf = HBufC::NewLC(512);
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1993
	TPtr sqlStatement = buf->Des();
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1994
	
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1995
	_LIT(KSQLQueryRow, "SELECT * FROM %S WHERE %S=%d AND %S=%d AND %S=%d");
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1996
	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1997
	sqlStatement.Format(KSQLQueryRow, &aTableName, &KServiceType, 
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  1998
		aIndexType, &KServiceIndex, aIndex, &KTunnelingType, aTunnelingVendorType);
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1999
	
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2000
	RDbView view;
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2001
	User::LeaveIfError(view.Prepare(aDatabase, TDbQuery(sqlStatement), TDbWindow::EUnlimited));
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2002
	CleanupClosePushL(view);
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2003
	User::LeaveIfError(view.EvaluateAll());	
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2004
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2005
	// Get column set so we get the correct column numbers
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2006
	CDbColSet* colSet = view.ColSetL();
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2007
	CleanupStack::PushL(colSet);
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2008
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2009
	if (view.FirstL())
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2010
	{
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2011
		do {
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2012
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2013
			view.GetL();
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2014
			
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2015
			{
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2016
				SCertEntry certInfo;
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2017
				// Store the line
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2018
				TPtrC ptr = view.ColDes(colSet->ColNo(KCertLabel));
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2019
	
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2020
				certInfo.iLabel.Copy(ptr);
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2021
				
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2022
				TPtrC8 ptr2 = view.ColDes8(colSet->ColNo(KSubjectKeyIdentifier)); // This is for authentication and uses Symbian subjectkey id.
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2023
				certInfo.iSubjectKeyId.Copy(ptr2);
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2024
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2025
				aArray.Append(certInfo);
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2026
				
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2027
				EAP_TRACE_DEBUG_SYMBIAN((_L("ReadCertRowsToArrayL - Appended Cert with label=%S\n"),
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2028
				&(certInfo.iLabel)));
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2029
				
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2030
				EAP_TRACE_DATA_DEBUG_SYMBIAN(("ReadCertRowsToArrayL - Appended Cert's SubjectKeyID:",
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2031
					certInfo.iSubjectKeyId.Ptr(), certInfo.iSubjectKeyId.Size()));
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2032
			}	
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2033
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2034
		} while (view.NextL() != EFalse);		
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2035
	}
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2036
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2037
	// Close database
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2038
	CleanupStack::PopAndDestroy(colSet); 
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2039
	CleanupStack::PopAndDestroy(2); // view, buf
23
3634639e6dc7 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 2
diff changeset
  2040
	CleanupStack::Pop( &aArray );
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2041
}
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2042
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2043
void EapTlsPeapUtils::ReadUintRowsToArrayL(
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2044
	RDbNamedDatabase& aDatabase,
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2045
	eap_am_tools_symbian_c * const /*aTools*/,
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2046
	const TDesC& aTableName, 
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2047
	const TDesC& aColumnName,	
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2048
	const TIndexType aIndexType,
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2049
	const TInt aIndex,
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2050
	const eap_type_value_e aTunnelingType,
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2051
	RArray<TUint>& aArray)
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2052
{
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2053
#ifdef USE_EAP_EXPANDED_TYPES
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2054
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2055
	TUint aTunnelingVendorType = aTunnelingType.get_vendor_type();
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2056
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2057
#else
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2058
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2059
	TUint aTunnelingVendorType = static_cast<TUint>(aTunnelingType);
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2060
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2061
#endif //#ifdef USE_EAP_EXPANDED_TYPES
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2062
	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2063
	EAP_TRACE_DEBUG_SYMBIAN((_L("EapTlsPeapUtils::ReadUintRowsToArrayL -Start")) );
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2064
23
3634639e6dc7 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 2
diff changeset
  2065
	CleanupClosePushL( aArray );
3634639e6dc7 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 2
diff changeset
  2066
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2067
	HBufC* buf = HBufC::NewLC(512);
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2068
	TPtr sqlStatement = buf->Des();
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2069
	
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2070
	_LIT(KSQLQueryRow, "SELECT %S FROM %S WHERE %S=%d AND %S=%d AND %S=%d");
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2071
	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2072
	sqlStatement.Format(KSQLQueryRow, &aColumnName, &aTableName, 
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2073
		&KServiceType, aIndexType, &KServiceIndex, aIndex, &KTunnelingType, aTunnelingVendorType);
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2074
	
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2075
	RDbView view;
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2076
	User::LeaveIfError(view.Prepare(aDatabase, TDbQuery(sqlStatement), TDbWindow::EUnlimited));
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2077
	CleanupClosePushL(view);
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2078
	User::LeaveIfError(view.EvaluateAll());	
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2079
	
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2080
	if (view.FirstL())
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2081
	{		
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2082
		do {
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2083
			view.GetL();
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2084
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2085
			switch (view.ColType(KDefaultColumnInView_One))
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2086
			{
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2087
			case EDbColUint32:
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2088
				{
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2089
					// Store the line
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2090
					TUint tmp = view.ColUint(KDefaultColumnInView_One);				
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2091
					aArray.Append(tmp);
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2092
				}
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2093
				break;
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2094
			default:
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2095
				User::Leave(KErrArgument);
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2096
			}		
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2097
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2098
		} while (view.NextL() != EFalse);
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2099
	}
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2100
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2101
	// Close database
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2102
	CleanupStack::PopAndDestroy(2); // view, buf
23
3634639e6dc7 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 2
diff changeset
  2103
	CleanupStack::Pop( &aArray );
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2104
}
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2105
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2106
// Don't use this finction as Label is not saved for certificates saved by SetConfigurationL().
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2107
// Provisioning (OMA DM etc) use SetConfigurationL() to save certificate details.
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2108
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2109
TBool EapTlsPeapUtils::CompareTCertLabels(const TCertLabel& item1, const TCertLabel& item2)
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2110
{
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2111
	EAP_TRACE_DEBUG_SYMBIAN((_L("EapTlsPeapUtils::CompareTCertLabels-Start")) );
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2112
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2113
	if (item1 == item2)
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2114
	{
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2115
		return ETrue;
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2116
	} 
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2117
	else
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2118
	{
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2119
		return EFalse;
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2120
	}
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2121
}
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2122
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2123
TBool EapTlsPeapUtils::CompareSCertEntries(const SCertEntry& item1, const SCertEntry& item2)
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2124
{
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2125
	EAP_TRACE_DEBUG_SYMBIAN((_L("\nEapTlsPeapUtils::CompareSCertEntries, Label_1=%S, Label_2=%S"),
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2126
	&(item1.iLabel), &(item2.iLabel)));
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2127
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2128
	EAP_TRACE_DATA_DEBUG_SYMBIAN(("EapTlsPeapUtils::CompareSCertEntries, SubjectKeyID_1:",
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2129
		item1.iSubjectKeyId.Ptr(), item1.iSubjectKeyId.Size()));
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2130
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2131
	EAP_TRACE_DATA_DEBUG_SYMBIAN(("EapTlsPeapUtils::CompareSCertEntries, SubjectKeyID_2:",
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2132
		item2.iSubjectKeyId.Ptr(), item2.iSubjectKeyId.Size()));
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2133
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2134
	if (item1.iLabel == item2.iLabel ||
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2135
		item1.iLabel.Length() == 0 ||
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2136
		item2.iLabel.Length() == 0 ) // Label is not saved when certs are saved using OMA DM.
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2137
	{
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2138
		if (item1.iSubjectKeyId == item2.iSubjectKeyId)
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2139
		{
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2140
			EAP_TRACE_DEBUG_SYMBIAN((_L("EapTlsPeapUtils::CompareSCertEntries, Certs matched\n")));
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2141
		
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2142
			return ETrue;
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2143
		}
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2144
	}
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2145
	
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2146
	return EFalse;
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2147
}
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2148
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2149
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2150
#ifndef USE_EAP_EXPANDED_TYPES 
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2151
// There are separate functions (SetTunnelingExpandedEapDataL and GetTunnelingExpandedEapDataL) if USE_EAP_EXPANDED_TYPES is defined.
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2152
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2153
/**
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2154
* Sets EAP data to a binary string record in commsdat.
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2155
* The old format (NOT USED NOW) is "+123,- 34", + means enabled, - disabled, then id, id is always 3 characters for easy parsing.
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2156
* In the new format each EAP type is saved as an unsigned integer of 32 bits ( TUint).
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2157
* There is separate binary strings for accepted (enabled) and unaccepted (disabled) tunneled EAP types.
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2158
*/
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2159
 
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2160
void EapTlsPeapUtils::SetEapDataL(
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2161
	RDbNamedDatabase& aDatabase,
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2162
	eap_am_tools_symbian_c * const /*aTools*/,
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2163
	TEapArray &aEaps,
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2164
	const TIndexType aIndexType,
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2165
	const TInt aIndex,
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2166
	const eap_type_value_e aTunnelingType,
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2167
	const eap_type_value_e aEapType)
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2168
{
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2169
#ifdef USE_EAP_EXPANDED_TYPES
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2170
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2171
	TUint aTunnelingVendorType = aTunnelingType.get_vendor_type();
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2172
	TUint aEapVendorType = aEapType.get_vendor_type();
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2173
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2174
#else
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2175
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2176
	TUint aTunnelingVendorType = static_cast<TUint>(aTunnelingType);
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2177
	TUint aEapVendorType = static_cast<TUint>(aEapType);
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2178
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2179
#endif //#ifdef USE_EAP_EXPANDED_TYPES
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2180
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2181
	EAP_TRACE_DEBUG_SYMBIAN(
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2182
		(_L("EapTlsPeapUtils::SetEapDataL aIndexType=%d, aIndex=%d, Tunneling vendor type=%d, Eap vendor type=%d, No: of tunneled EAP types=%d \n"),
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2183
		aIndexType,aIndex, aTunnelingVendorType, aEapVendorType, aEaps.Count()) );
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2184
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2185
	HBufC* buf = HBufC::NewLC(KMaxSqlQueryLength);
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2186
	TPtr sqlStatement = buf->Des();
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2187
	
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2188
	_LIT(KSQLQueryRow, "SELECT %S, %S FROM %S WHERE %S=%d AND %S=%d AND %S=%d");
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2189
	
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2190
	if (aEapType == eap_type_peap)
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2191
	{
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2192
		sqlStatement.Format(KSQLQueryRow, &cf_str_PEAP_accepted_tunneled_client_types_hex_data_literal,
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2193
			&cf_str_PEAP_unaccepted_tunneled_client_types_hex_data_literal,
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2194
			&KPeapDatabaseTableName, &KServiceType, aIndexType, &KServiceIndex, aIndex, 
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2195
			&KTunnelingType, aTunnelingVendorType);		
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2196
	} 
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2197
#if defined(USE_TTLS_EAP_TYPE)
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2198
	else if (aEapType == eap_type_ttls)
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2199
	{
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2200
		sqlStatement.Format(KSQLQueryRow, &cf_str_PEAP_accepted_tunneled_client_types_hex_data_literal, 
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2201
			&cf_str_PEAP_unaccepted_tunneled_client_types_hex_data_literal,
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2202
			&KTtlsDatabaseTableName, &KServiceType, aIndexType, &KServiceIndex, aIndex, 
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2203
			&KTunnelingType, aTunnelingVendorType);		
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2204
	} 
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2205
#endif
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2206
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2207
	else if (aEapType == eap_type_ttls_plain_pap)
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2208
	{
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2209
		sqlStatement.Format(KSQLQueryRow, &cf_str_PEAP_accepted_tunneled_client_types_hex_data_literal, 
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2210
			&cf_str_PEAP_unaccepted_tunneled_client_types_hex_data_literal,
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2211
			&KTtlsDatabaseTableName, &KServiceType, aIndexType, &KServiceIndex, aIndex, 
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2212
			&KTunnelingType, aTunnelingVendorType);		
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2213
	} 
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2214
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2215
#if defined(USE_FAST_EAP_TYPE)
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2216
	else if (aEapType == eap_type_fast)
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2217
	{
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2218
		sqlStatement.Format(KSQLQueryRow, &cf_str_PEAP_accepted_tunneled_client_types_hex_data_literal, 
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2219
			&cf_str_PEAP_unaccepted_tunneled_client_types_hex_data_literal,
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2220
			&KFastGeneralSettingsDBTableName, &KServiceType, aIndexType, &KServiceIndex, aIndex, 
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2221
			&KTunnelingType, aTunnelingVendorType);		
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2222
	} 
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2223
#endif
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2224
	else
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2225
	{
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2226
		EAP_TRACE_DEBUG_SYMBIAN(
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2227
			(_L("EapTlsPeapUtils::SetEapDataL - Unsupported EAP type =%d \n"),
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2228
			 aEapVendorType));
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2229
			 
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2230
		// Unsupported EAP type
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2231
		User::Leave(KErrNotSupported);
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2232
	}	
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2233
			
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2234
	RDbView view;
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2235
	User::LeaveIfError(view.Prepare(aDatabase, TDbQuery(sqlStatement), TDbWindow::EUnlimited));
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2236
	CleanupClosePushL(view);
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2237
	User::LeaveIfError(view.EvaluateAll());	
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2238
	User::LeaveIfError(view.FirstL());	
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2239
	view.UpdateL();
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2240
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2241
	TInt eapCount = aEaps.Count();
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2242
	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2243
	HBufC8 *acceptedDbText = HBufC8::NewLC( (sizeof(TUint)) * eapCount ); // 4 bytes (32 bits) for an EAP type, Need to save as TUInt (4 bytes).
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2244
	HBufC8 *unacceptedDbText = HBufC8::NewLC( (sizeof(TUint)) * eapCount ); // 4 bytes (32 bits) for an EAP type, Need to save as TUInt (4 bytes).
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2245
	
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2246
	TPtr8 acceptedPtr(acceptedDbText->Des());
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2247
	TPtr8 unacceptedPtr(unacceptedDbText->Des());
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2248
	
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2249
	TBuf8<3> UidTmp;
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2250
		
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2251
	for(TInt i = 0 ; i< eapCount; i++)
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2252
	{
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2253
		UidTmp.Copy(aEaps[i]->UID);
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2254
		
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2255
		TLex8 eapUidLex( UidTmp.Right(2) ); // Only last two characters determines the EAP type.
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2256
		TUint eapTypeUint = 0;
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2257
		
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2258
		User::LeaveIfError( eapUidLex.Val(eapTypeUint, EDecimal) );	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2259
		
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2260
		TPtrC8 tempEAPtype( reinterpret_cast<TUint8*>(&eapTypeUint), sizeof(TUint) );
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2261
		
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2262
		if( aEaps[i]->Enabled )
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2263
		{
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2264
			// Fill in accepted tunneled type.
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2265
			acceptedPtr.Append( tempEAPtype );			
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2266
		}
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2267
		else
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2268
		{
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2269
			// Fill in unaccepted tunneled type.
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2270
			unacceptedPtr.Append( tempEAPtype);			
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2271
		}			
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2272
	}
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2273
	
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2274
	// Save the strings in the DB.
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2275
	
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2276
	// Get column set so we get the correct column numbers
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2277
	CDbColSet* colSet = view.ColSetL();
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2278
	CleanupStack::PushL(colSet);			
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2279
	
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2280
	// Validate length of strings
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2281
	if(acceptedPtr.Length() > KMaxTunneledTypeStringLengthInDB 
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2282
		|| unacceptedPtr.Length() > KMaxTunneledTypeStringLengthInDB)
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2283
	{
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2284
		EAP_TRACE_DEBUG_SYMBIAN((_L("EapTlsPeapUtils::SetEapDataL - Too long Tunneled EAP type string \n") ) );
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2285
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2286
		User::Leave(KErrArgument);		
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2287
	}
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2288
	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2289
	view.SetColL(colSet->ColNo(cf_str_PEAP_accepted_tunneled_client_types_hex_data_literal), acceptedPtr);
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2290
	view.SetColL(colSet->ColNo(cf_str_PEAP_unaccepted_tunneled_client_types_hex_data_literal), unacceptedPtr);	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2291
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2292
	CleanupStack::PopAndDestroy( colSet ); // Delete colSet.	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2293
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2294
	view.PutL();
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2295
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2296
	EAP_TRACE_DATA_DEBUG_SYMBIAN(("EapTlsPeapUtils::SetEapDataL- Enabled extended EAP type data added to DB:",
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2297
		acceptedPtr.Ptr(), 
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2298
		acceptedPtr.Size() ) );
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2299
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2300
	EAP_TRACE_DATA_DEBUG_SYMBIAN(("EapTlsPeapUtils::SetEapDataL- Disabled extended EAP type data added to DB:",
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2301
		unacceptedPtr.Ptr(), 
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2302
		unacceptedPtr.Size() ) );
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2303
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2304
	CleanupStack::PopAndDestroy(unacceptedDbText); // Delete unacceptedDbText
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2305
	CleanupStack::PopAndDestroy(acceptedDbText); // Delete acceptedDbText	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2306
	CleanupStack::PopAndDestroy(&view); // Close view
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2307
	CleanupStack::PopAndDestroy(buf); // Delete buf
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2308
}
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2309
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2310
/**
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2311
* Gets Eapdata from corresponding table in commdb
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2312
* see format in SetEapDAtaL
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2313
*/
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2314
void EapTlsPeapUtils::GetEapDataL(
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2315
	RDbNamedDatabase& aDatabase,
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2316
	eap_am_tools_symbian_c * const /*aTools*/,
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2317
	TEapArray &aEaps, 
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2318
	const TIndexType aIndexType,
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2319
	const TInt aIndex,
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2320
	const eap_type_value_e aTunnelingType,
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2321
	const eap_type_value_e aEapType)
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2322
{
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2323
#ifdef USE_EAP_EXPANDED_TYPES
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2324
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2325
	TUint aTunnelingVendorType = aTunnelingType.get_vendor_type();
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2326
	TUint aEapVendorType = aEapType.get_vendor_type();
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2327
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2328
#else
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2329
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2330
	TUint aTunnelingVendorType = static_cast<TUint>(aTunnelingType);
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2331
	TUint aEapVendorType = static_cast<TUint>(aEapType);
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2332
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2333
#endif //#ifdef USE_EAP_EXPANDED_TYPES
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2334
	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2335
	EAP_TRACE_DEBUG_SYMBIAN(
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2336
		(_L("EapTlsPeapUtils::GetEapDataL aIndexType=%d, aIndex=%d, Tunneling vendor type=%d, Eap vendor type=%d \n"),
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2337
		aIndexType,aIndex, aTunnelingVendorType, aEapVendorType));
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2338
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2339
	HBufC* buf = HBufC::NewLC(KMaxSqlQueryLength);
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2340
	TPtr sqlStatement = buf->Des();
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2341
	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2342
	_LIT(KSQLQueryRow, "SELECT %S, %S FROM %S WHERE %S=%d AND %S=%d AND %S=%d");
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2343
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2344
	if (aEapType == eap_type_peap)
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2345
	{
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2346
		sqlStatement.Format(KSQLQueryRow, &cf_str_PEAP_accepted_tunneled_client_types_hex_data_literal, 
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2347
			&cf_str_PEAP_unaccepted_tunneled_client_types_hex_data_literal,
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2348
			&KPeapDatabaseTableName, &KServiceType, aIndexType, &KServiceIndex, aIndex, 
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2349
			&KTunnelingType, aTunnelingVendorType);		
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2350
	} 
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2351
#if defined(USE_TTLS_EAP_TYPE)
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2352
	else if (aEapType == eap_type_ttls)
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2353
	{
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2354
		sqlStatement.Format(KSQLQueryRow, &cf_str_PEAP_accepted_tunneled_client_types_hex_data_literal, 
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2355
			&cf_str_PEAP_unaccepted_tunneled_client_types_hex_data_literal,
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2356
			&KTtlsDatabaseTableName, &KServiceType, aIndexType, &KServiceIndex, aIndex, 
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2357
			&KTunnelingType, aTunnelingVendorType);		
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2358
	} 
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2359
#endif
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2360
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2361
	else if (aEapType == eap_type_ttls_plain_pap)
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2362
	{
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2363
		sqlStatement.Format(KSQLQueryRow, &cf_str_PEAP_accepted_tunneled_client_types_hex_data_literal, 
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2364
			&cf_str_PEAP_unaccepted_tunneled_client_types_hex_data_literal,
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2365
			&KTtlsDatabaseTableName, &KServiceType, aIndexType, &KServiceIndex, aIndex, 
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2366
			&KTunnelingType, aTunnelingVendorType);		
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2367
	} 
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2368
	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2369
#if defined(USE_FAST_EAP_TYPE)
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2370
	else if (aEapType == eap_type_fast)
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2371
	{
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2372
		sqlStatement.Format(KSQLQueryRow, &cf_str_PEAP_accepted_tunneled_client_types_hex_data_literal, 
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2373
			&cf_str_PEAP_unaccepted_tunneled_client_types_hex_data_literal,
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2374
			&KFastGeneralSettingsDBTableName, &KServiceType, aIndexType, &KServiceIndex, aIndex, 
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2375
			&KTunnelingType, aTunnelingVendorType);		
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2376
	} 
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2377
#endif
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2378
	else
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2379
	{
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2380
		EAP_TRACE_DEBUG_SYMBIAN(
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2381
			(_L("EapTlsPeapUtils::GetEapDataL - Unsupported EAP type=%d \n"),
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2382
			 aEapVendorType));
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2383
			 
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2384
		// Unsupported EAP type
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2385
		User::Leave(KErrNotSupported);
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2386
	}	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2387
	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2388
	RDbView view;
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2389
	User::LeaveIfError(view.Prepare(aDatabase, TDbQuery(sqlStatement), TDbWindow::EUnlimited));
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2390
	CleanupClosePushL(view);
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2391
	User::LeaveIfError(view.EvaluateAll());	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2392
	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2393
	User::LeaveIfError(view.FirstL());
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2394
	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2395
	view.GetL();
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2396
	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2397
	// Get column set so we get the correct column numbers
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2398
	CDbColSet* colSet = view.ColSetL();
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2399
	CleanupStack::PushL(colSet);			
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2400
	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2401
	TPtrC8 acceptedEAPData = view.ColDes8(colSet->ColNo(cf_str_PEAP_accepted_tunneled_client_types_hex_data_literal));
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2402
	TPtrC8 unacceptedEAPData = view.ColDes8(colSet->ColNo(cf_str_PEAP_unaccepted_tunneled_client_types_hex_data_literal));
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2403
	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2404
	CleanupStack::PopAndDestroy( colSet ); // Delete colSet.	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2405
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2406
	EAP_TRACE_DATA_DEBUG_SYMBIAN(("EapTlsPeapUtils::GetEapDataL- Enabled extended EAP type data from DB:",
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2407
		acceptedEAPData.Ptr(), 
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2408
		acceptedEAPData.Size() ) );
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2409
	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2410
	EAP_TRACE_DATA_DEBUG_SYMBIAN(("EapTlsPeapUtils::GetEapDataL- Disabled extended EAP type data from DB:",
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2411
		unacceptedEAPData.Ptr(), 
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2412
		unacceptedEAPData.Size() ) );
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2413
	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2414
	aEaps.ResetAndDestroy();
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2415
		
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2416
	TUint acceptedLength = acceptedEAPData.Length();
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2417
	TUint unacceptedLength = unacceptedEAPData.Length();
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2418
	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2419
	TEap *eapTmp;
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2420
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2421
	TUint index = 0;
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2422
	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2423
	_LIT8(KUIDFormat,"%u");
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2424
	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2425
	// For accepted or enabled tunneled EAP types. 	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2426
	while(index < acceptedLength)
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2427
	{		
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2428
		eapTmp = new (ELeave)TEap;
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2429
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2430
		eapTmp->Enabled=ETrue; // All EAP types in here are enabled.
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2431
		
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2432
		eapTmp->UID.Zero();
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2433
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2434
		// Get the UID from data from the DB.				
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2435
		TPtrC8 tempEAPtype( acceptedEAPData.Mid(index, sizeof(TUint)) );
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2436
		
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2437
		EAP_TRACE_DATA_DEBUG_SYMBIAN(("EapTlsPeapUtils::GetEapDataL- extracted EAP type:",
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2438
			tempEAPtype.Ptr(), 
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2439
			tempEAPtype.Size() ) );
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2440
						
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2441
		TUint eapTypeUint = *(tempEAPtype.Ptr()); // All EAP types are saved as TUInt. 
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2442
		
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2443
		eapTmp->UID.Format(KUIDFormat,eapTypeUint);
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2444
				
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2445
		aEaps.Append(eapTmp);
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2446
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2447
		index = index + sizeof(TUint);
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2448
		
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2449
		EAP_TRACE_DEBUG_SYMBIAN((_L("EapTlsPeapUtils::GetEapDataL - Appended enabled-EAP type=%s \n"),eapTmp->UID.Ptr()) );
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2450
	}
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2451
	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2452
	index = 0;
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2453
	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2454
	// For unaccepted or disabled tunneled EAP types. 	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2455
	while(index < unacceptedLength)
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2456
	{		
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2457
		eapTmp = new (ELeave)TEap;
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2458
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2459
		eapTmp->Enabled=EFalse; // All EAP types in here are disabled.
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2460
		
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2461
		eapTmp->UID.Zero();
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2462
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2463
		// Get the UID from data from the DB.				
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2464
		TPtrC8 tempEAPtype( unacceptedEAPData.Mid(index, sizeof(TUint)) );
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2465
		
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2466
		EAP_TRACE_DATA_DEBUG_SYMBIAN(("EapTlsPeapUtils::GetEapDataL- extracted EAP type:",
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2467
			tempEAPtype.Ptr(), 
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2468
			tempEAPtype.Size() ) );
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2469
						
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2470
		TUint eapTypeUint = *(tempEAPtype.Ptr()); // All EAP types are saved as TUint. 
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2471
		
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2472
		eapTmp->UID.Format(KUIDFormat,eapTypeUint);
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2473
				
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2474
		aEaps.Append(eapTmp);
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2475
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2476
		index = index + sizeof(TUint);
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2477
		
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2478
		EAP_TRACE_DEBUG_SYMBIAN((_L("EapTlsPeapUtils::GetEapDataL - Appended disabled-EAP type=%s \n"),eapTmp->UID.Ptr()) );
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2479
	}
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2480
	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2481
	CleanupStack::PopAndDestroy(&view); // Close view
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2482
	CleanupStack::PopAndDestroy(buf); // Delete buf	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2483
}
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2484
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2485
#endif // #ifndef USE_EAP_EXPANDED_TYPES
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2486
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2487
//--------------------------------------------------
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2488
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2489
#ifdef USE_EAP_EXPANDED_TYPES
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2490
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2491
// Stores the tunneled EAP type (expanded) to the database.
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2492
void EapTlsPeapUtils::SetTunnelingExpandedEapDataL(
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2493
	RDbNamedDatabase& aDatabase,
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2494
	eap_am_tools_symbian_c * const /*aTools*/,
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2495
	RExpandedEapTypePtrArray &aEnabledEAPArrary,
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2496
	RExpandedEapTypePtrArray &aDisabledEAPArrary,
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2497
	const TIndexType aIndexType,
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2498
	const TInt aIndex,
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2499
	const eap_type_value_e aTunnelingType,
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2500
	const eap_type_value_e aEapType)
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2501
{
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2502
	TUint aTunnelingVendorType = aTunnelingType.get_vendor_type();
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2503
	TUint aEapVendorType = aEapType.get_vendor_type();
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2504
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2505
	EAP_TRACE_DEBUG_SYMBIAN(
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2506
		(_L("EapTlsPeapUtils::SetTunnelingExpandedEapDataL:aIndexType=%d, aIndex=%d, Tunneling vendor type=%d, Eap vendor type=%d\n"),
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2507
		aIndexType,aIndex, aTunnelingVendorType, aEapVendorType));
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2508
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2509
	EAP_TRACE_DEBUG_SYMBIAN(
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2510
		(_L("Number of Tunneled EAP types: Enabled=%d, Disabled=%d\n"),
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2511
		aEnabledEAPArrary.Count(), aDisabledEAPArrary.Count()));
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2512
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2513
	HBufC* buf = HBufC::NewLC(KMaxSqlQueryLength);
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2514
	TPtr sqlStatement = buf->Des();
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2515
	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2516
	_LIT(KSQLQueryRow, "SELECT %S, %S FROM %S WHERE %S=%d AND %S=%d AND %S=%d");
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2517
	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2518
	if (aEapType == eap_type_peap)
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2519
	{
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2520
		sqlStatement.Format(KSQLQueryRow, &cf_str_PEAP_accepted_tunneled_client_types_hex_data_literal,
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2521
			&cf_str_PEAP_unaccepted_tunneled_client_types_hex_data_literal,
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2522
			&KPeapDatabaseTableName, &KServiceType, aIndexType, &KServiceIndex, aIndex, 
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2523
			&KTunnelingType, aTunnelingVendorType);		
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2524
	} 
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2525
#if defined(USE_TTLS_EAP_TYPE)
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2526
	else if (aEapType == eap_type_ttls)
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2527
	{
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2528
		sqlStatement.Format(KSQLQueryRow, &cf_str_PEAP_accepted_tunneled_client_types_hex_data_literal, 
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2529
			&cf_str_PEAP_unaccepted_tunneled_client_types_hex_data_literal,
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2530
			&KTtlsDatabaseTableName, &KServiceType, aIndexType, &KServiceIndex, aIndex, 
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2531
			&KTunnelingType, aTunnelingVendorType);		
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2532
	} 
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2533
#endif
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2534
#if defined(USE_FAST_EAP_TYPE)
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2535
	else if (aEapType == eap_type_fast)
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2536
	{
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2537
		sqlStatement.Format(KSQLQueryRow, &cf_str_PEAP_accepted_tunneled_client_types_hex_data_literal, 
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2538
			&cf_str_PEAP_unaccepted_tunneled_client_types_hex_data_literal,
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2539
			&KFastGeneralSettingsDBTableName, &KServiceType, aIndexType, &KServiceIndex, aIndex, 
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2540
			&KTunnelingType, aTunnelingVendorType);		
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2541
	} 
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2542
#endif
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2543
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2544
	else if ( aEapType == eap_type_ttls_plain_pap )
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2545
	{
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2546
		sqlStatement.Format(KSQLQueryRow, &cf_str_PEAP_accepted_tunneled_client_types_hex_data_literal, 
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2547
			&cf_str_PEAP_unaccepted_tunneled_client_types_hex_data_literal,
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2548
			&KTtlsDatabaseTableName, &KServiceType, aIndexType, &KServiceIndex, aIndex, 
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2549
			&KTunnelingType, aTunnelingVendorType);		
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2550
	} 
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2551
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2552
	else
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2553
	{
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2554
		EAP_TRACE_DEBUG_SYMBIAN(
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2555
			(_L("EapTlsPeapUtils::SetTunnelingExpandedEapDataL - Unsupported EAP type =%d \n"),
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2556
			 aEapVendorType));
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2557
			 
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2558
		// Unsupported EAP type
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2559
		User::Leave(KErrNotSupported);
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2560
	}	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2561
			
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2562
	RDbView view;
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2563
	User::LeaveIfError(view.Prepare(aDatabase, TDbQuery(sqlStatement), TDbWindow::EUnlimited));
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2564
	CleanupClosePushL(view);
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2565
	User::LeaveIfError(view.EvaluateAll());	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2566
	User::LeaveIfError(view.FirstL());	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2567
	view.UpdateL();
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2568
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2569
	TInt enabledEAPCount = aEnabledEAPArrary.Count();
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2570
	TInt disabledEAPCount = aDisabledEAPArrary.Count();
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2571
	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2572
	HBufC8 *acceptedDbText = HBufC8::NewLC( KExpandedEAPTypeSize * enabledEAPCount ); // 8 bytes (64 bits) for an EAP type.
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2573
	HBufC8 *unacceptedDbText = HBufC8::NewLC( KExpandedEAPTypeSize * disabledEAPCount ); // 8 bytes (64 bits) for an EAP type.
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2574
	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2575
	TPtr8 acceptedPtr(acceptedDbText->Des());
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2576
	TPtr8 unacceptedPtr(unacceptedDbText->Des());
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2577
	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2578
	// Fill in accepted tunneled type.		
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2579
	for(TInt i = 0 ; i< enabledEAPCount; i++)
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2580
	{
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2581
		acceptedPtr.Append(aEnabledEAPArrary[i]->iExpandedEAPType);					
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2582
	}
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2583
	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2584
	// Fill in unaccepted tunneled type.		
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2585
	for(TInt i = 0 ; i< disabledEAPCount; i++)
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2586
	{
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2587
		unacceptedPtr.Append(aDisabledEAPArrary[i]->iExpandedEAPType);					
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2588
	}
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2589
	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2590
	// Save the strings in the DB.
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2591
	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2592
	// Get column set so we get the correct column numbers
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2593
	CDbColSet* colSet = view.ColSetL();
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2594
	CleanupStack::PushL(colSet);			
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2595
	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2596
	// Validate length of strings
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2597
	if(acceptedPtr.Length() > KMaxTunneledTypeStringLengthInDB 
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2598
		|| unacceptedPtr.Length() > KMaxTunneledTypeStringLengthInDB)
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2599
	{
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2600
		EAP_TRACE_DEBUG_SYMBIAN((_L("EapTlsPeapUtils::SetTunnelingExpandedEapDataL - Too long Tunneled EAP type string \n") ) );
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2601
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2602
		User::Leave(KErrArgument);		
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2603
	}
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2604
	
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2605
	view.SetColL(colSet->ColNo(cf_str_PEAP_accepted_tunneled_client_types_hex_data_literal), acceptedPtr);
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2606
	view.SetColL(colSet->ColNo(cf_str_PEAP_unaccepted_tunneled_client_types_hex_data_literal), unacceptedPtr);	
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2607
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2608
	CleanupStack::PopAndDestroy( colSet ); // Delete colSet.	
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2609
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2610
	view.PutL();
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2611
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2612
	EAP_TRACE_DATA_DEBUG_SYMBIAN(("EapTlsPeapUtils::SetTunnelingExpandedEapDataL- Enabled extended EAP type data added to DB:",
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2613
		acceptedPtr.Ptr(), 
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2614
		acceptedPtr.Size() ) );
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2615
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2616
	EAP_TRACE_DATA_DEBUG_SYMBIAN(("EapTlsPeapUtils::SetTunnelingExpandedEapDataL- Disabled extended EAP type data added to DB:",
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2617
		unacceptedPtr.Ptr(), 
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2618
		unacceptedPtr.Size() ) );
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2619
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2620
	CleanupStack::PopAndDestroy(unacceptedDbText); // Delete unacceptedDbText
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2621
	CleanupStack::PopAndDestroy(acceptedDbText); // Delete acceptedDbText	
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2622
	CleanupStack::PopAndDestroy(&view); // Close view
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2623
	CleanupStack::PopAndDestroy(buf); // Delete buf	
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2624
}
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2625
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2626
// Retrieves the tunneled EAP type (expanded) from the database	.
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2627
void EapTlsPeapUtils::GetTunnelingExpandedEapDataL(
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2628
	RDbNamedDatabase& aDatabase,
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2629
	eap_am_tools_symbian_c * const /*aTools*/,
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2630
	RExpandedEapTypePtrArray &aEnabledEAPArrary,
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2631
	RExpandedEapTypePtrArray &aDisabledEAPArrary,
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2632
	const TIndexType aIndexType,
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2633
	const TInt aIndex,
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2634
	const eap_type_value_e aTunnelingType,
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2635
	const eap_type_value_e aEapType)
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2636
{
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2637
	TUint aTunnelingVendorType = aTunnelingType.get_vendor_type();
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2638
	TUint aEapVendorType = aEapType.get_vendor_type();
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2639
	
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2640
	EAP_TRACE_DEBUG_SYMBIAN(
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2641
		(_L("EapTlsPeapUtils::GetTunnelingExpandedEapDataL aIndexType=%d, aIndex=%d, Tunneling vendor type=%d, Eap vendor type=%d \n"),
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2642
		aIndexType,aIndex, aTunnelingVendorType, aEapVendorType));
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2643
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2644
	HBufC* buf = HBufC::NewLC(KMaxSqlQueryLength);
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2645
	TPtr sqlStatement = buf->Des();
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2646
	
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2647
	_LIT(KSQLQueryRow, "SELECT %S, %S FROM %S WHERE %S=%d AND %S=%d AND %S=%d");
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2648
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2649
	if (aEapType == eap_type_peap)
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2650
	{
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2651
		sqlStatement.Format(KSQLQueryRow, &cf_str_PEAP_accepted_tunneled_client_types_hex_data_literal, 
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2652
			&cf_str_PEAP_unaccepted_tunneled_client_types_hex_data_literal,
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2653
			&KPeapDatabaseTableName, &KServiceType, aIndexType, &KServiceIndex, aIndex, 
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2654
			&KTunnelingType, aTunnelingVendorType);		
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2655
	} 
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2656
#if defined(USE_TTLS_EAP_TYPE)
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2657
	else if (aEapType == eap_type_ttls)
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2658
	{
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2659
		sqlStatement.Format(KSQLQueryRow, &cf_str_PEAP_accepted_tunneled_client_types_hex_data_literal, 
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2660
			&cf_str_PEAP_unaccepted_tunneled_client_types_hex_data_literal,
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2661
			&KTtlsDatabaseTableName, &KServiceType, aIndexType, &KServiceIndex, aIndex, 
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2662
			&KTunnelingType, aTunnelingVendorType);		
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2663
	} 
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2664
#endif
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2665
#if defined(USE_FAST_EAP_TYPE)
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2666
	else if (aEapType == eap_type_fast)
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2667
	{
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2668
		sqlStatement.Format(KSQLQueryRow, &cf_str_PEAP_accepted_tunneled_client_types_hex_data_literal, 
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2669
			&cf_str_PEAP_unaccepted_tunneled_client_types_hex_data_literal,
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2670
			&KFastGeneralSettingsDBTableName, &KServiceType, aIndexType, &KServiceIndex, aIndex, 
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2671
			&KTunnelingType, aTunnelingVendorType);		
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2672
	} 
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2673
#endif
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2674
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2675
	else if (aEapType == eap_type_ttls_plain_pap )
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2676
	{
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2677
		sqlStatement.Format(KSQLQueryRow, &cf_str_PEAP_accepted_tunneled_client_types_hex_data_literal, 
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2678
			&cf_str_PEAP_unaccepted_tunneled_client_types_hex_data_literal,
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2679
			&KTtlsDatabaseTableName, &KServiceType, aIndexType, &KServiceIndex, aIndex, 
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2680
			&KTunnelingType, aTunnelingVendorType);		
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2681
	} 
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2682
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2683
	else
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2684
	{
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2685
		EAP_TRACE_DEBUG_SYMBIAN(
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2686
			(_L("EapTlsPeapUtils::GetTunnelingExpandedEapDataL - Unsupported EAP type=%d \n"),
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2687
			 aEapVendorType));
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2688
			 
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2689
		// Unsupported EAP type
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2690
		User::Leave(KErrNotSupported);
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2691
	}	
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2692
	
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2693
	RDbView view;
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2694
	User::LeaveIfError(view.Prepare(aDatabase, TDbQuery(sqlStatement), TDbWindow::EUnlimited));
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2695
	CleanupClosePushL(view);
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2696
	User::LeaveIfError(view.EvaluateAll());	
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2697
	
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2698
	User::LeaveIfError(view.FirstL());
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2699
	
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2700
	view.GetL();
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2701
	
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2702
	// Get column set so we get the correct column numbers
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2703
	CDbColSet* colSet = view.ColSetL();
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2704
	CleanupStack::PushL(colSet);			
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2705
	
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2706
	TPtrC8 acceptedEAPData = view.ColDes8(colSet->ColNo(cf_str_PEAP_accepted_tunneled_client_types_hex_data_literal));
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2707
	TPtrC8 unacceptedEAPData = view.ColDes8(colSet->ColNo(cf_str_PEAP_unaccepted_tunneled_client_types_hex_data_literal));
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2708
	
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2709
	CleanupStack::PopAndDestroy( colSet ); // Delete colSet.	
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2710
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2711
	EAP_TRACE_DATA_DEBUG_SYMBIAN(("EapTlsPeapUtils::GetTunnelingExpandedEapDataL- Enabled extended EAP type data from DB:",
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2712
		acceptedEAPData.Ptr(), 
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2713
		acceptedEAPData.Size() ) );
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2714
	
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2715
	EAP_TRACE_DATA_DEBUG_SYMBIAN(("EapTlsPeapUtils::GetTunnelingExpandedEapDataL- Disabled extended EAP type data from DB:",
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2716
		unacceptedEAPData.Ptr(), 
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2717
		unacceptedEAPData.Size() ) );
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2718
	
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2719
	aEnabledEAPArrary.ResetAndDestroy();
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2720
	aDisabledEAPArrary.ResetAndDestroy();
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2721
		
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2722
	TUint acceptedLength = acceptedEAPData.Length();
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2723
	TUint unacceptedLength = unacceptedEAPData.Length();
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2724
	
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2725
	SExpandedEAPType *expandedEAPTmp = 0;
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2726
	TUint index = 0;
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2727
	
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2728
	// For accepted or enabled tunneled EAP types. 	
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2729
	while(index < acceptedLength)
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2730
	{		
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2731
		expandedEAPTmp = new SExpandedEAPType;
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2732
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2733
		if (expandedEAPTmp == 0)
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2734
		{
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2735
			aEnabledEAPArrary.ResetAndDestroy();
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2736
			aDisabledEAPArrary.ResetAndDestroy();
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2737
			User::LeaveIfError(KErrNoMemory);
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2738
		}
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2739
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2740
		expandedEAPTmp->iExpandedEAPType = acceptedEAPData.Mid(index, KExpandedEAPTypeSize);
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2741
						
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2742
		EAP_TRACE_DATA_DEBUG_SYMBIAN(("Extracted EAP type:",
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2743
			expandedEAPTmp->iExpandedEAPType.Ptr(), 
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2744
			expandedEAPTmp->iExpandedEAPType.Size() ) );
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2745
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2746
		aEnabledEAPArrary.Append(expandedEAPTmp);
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2747
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2748
		index = index + KExpandedEAPTypeSize;
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2749
	}
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2750
	
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2751
	index = 0;
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2752
	
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2753
	// For unaccepted or disabled tunneled EAP types.
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2754
	while(index < unacceptedLength)
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2755
	{		
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2756
		expandedEAPTmp = new SExpandedEAPType;
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2757
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2758
		if (expandedEAPTmp == 0)
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2759
		{
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2760
			aEnabledEAPArrary.ResetAndDestroy();
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2761
			aDisabledEAPArrary.ResetAndDestroy();
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2762
			User::LeaveIfError(KErrNoMemory);
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2763
		}
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2764
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2765
		expandedEAPTmp->iExpandedEAPType = unacceptedEAPData.Mid(index, KExpandedEAPTypeSize);
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2766
						
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2767
		EAP_TRACE_DATA_DEBUG_SYMBIAN(("Extracted EAP type:",
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2768
			expandedEAPTmp->iExpandedEAPType.Ptr(), 
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2769
			expandedEAPTmp->iExpandedEAPType.Size() ) );
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2770
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2771
		aDisabledEAPArrary.Append(expandedEAPTmp);
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2772
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2773
		index = index + KExpandedEAPTypeSize;
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2774
	}
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2775
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2776
	CleanupStack::PopAndDestroy(&view); // Close view
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2777
	CleanupStack::PopAndDestroy(buf); // Delete buf
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2778
}
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2779
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2780
#endif //#ifdef USE_EAP_EXPANDED_TYPES
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2781
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2782
//--------------------------------------------------
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2783
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2784
TBool EapTlsPeapUtils::CipherSuiteUseRSAKeys(tls_cipher_suites_e aCipherSuite)
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2785
{
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2786
	if (aCipherSuite == tls_cipher_suites_TLS_RSA_WITH_3DES_EDE_CBC_SHA
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2787
		|| aCipherSuite == tls_cipher_suites_TLS_RSA_WITH_AES_128_CBC_SHA
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2788
		|| aCipherSuite == tls_cipher_suites_TLS_DHE_RSA_WITH_3DES_EDE_CBC_SHA
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2789
		|| aCipherSuite == tls_cipher_suites_TLS_DHE_RSA_WITH_AES_128_CBC_SHA
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2790
		|| aCipherSuite == tls_cipher_suites_TLS_RSA_WITH_RC4_128_MD5
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2791
		|| aCipherSuite == tls_cipher_suites_TLS_RSA_WITH_RC4_128_SHA)
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2792
	{
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2793
		return ETrue;
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2794
	}
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2795
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2796
	return EFalse;
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2797
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2798
}
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2799
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2800
//--------------------------------------------------
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2801
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2802
TBool EapTlsPeapUtils::CipherSuiteUseDSAKeys(tls_cipher_suites_e aCipherSuite)
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2803
{
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2804
	if (aCipherSuite == tls_cipher_suites_TLS_DHE_DSS_WITH_3DES_EDE_CBC_SHA
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2805
		|| aCipherSuite == tls_cipher_suites_TLS_DHE_DSS_WITH_AES_128_CBC_SHA)
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2806
	{
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2807
		return ETrue;
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2808
	}
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2809
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2810
	return EFalse;
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2811
}
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2812
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2813
//--------------------------------------------------
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2814
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2815
TBool EapTlsPeapUtils::CipherSuiteIsEphemeralDHKeyExchange(tls_cipher_suites_e aCipherSuite)
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2816
{
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2817
	if (aCipherSuite == tls_cipher_suites_TLS_DHE_DSS_WITH_3DES_EDE_CBC_SHA
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2818
		|| aCipherSuite == tls_cipher_suites_TLS_DHE_DSS_WITH_AES_128_CBC_SHA
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2819
		|| aCipherSuite == tls_cipher_suites_TLS_DHE_RSA_WITH_3DES_EDE_CBC_SHA
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2820
		|| aCipherSuite == tls_cipher_suites_TLS_DHE_RSA_WITH_AES_128_CBC_SHA)
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2821
	{
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2822
		return ETrue;
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2823
	}
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2824
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2825
	return EFalse;
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2826
}
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2827
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2828
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2829
// ---------------------------------------------------------
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2830
// EapTlsPeapUtils::SetConfigurationL()
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2831
// ---------------------------------------------------------
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2832
//
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2833
void EapTlsPeapUtils::SetConfigurationL(
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2834
	RDbNamedDatabase& aDatabase,
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2835
	const EAPSettings& aSettings, 
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2836
	const TIndexType aIndexType,
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2837
	const TInt aIndex,
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2838
	const eap_type_value_e aTunnelingType,
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2839
	const eap_type_value_e aEapType)
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2840
{
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2841
#ifdef USE_EAP_EXPANDED_TYPES
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2842
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2843
	TUint aTunnelingVendorType = aTunnelingType.get_vendor_type();
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2844
	TUint aEapVendorType = aEapType.get_vendor_type();
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2845
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2846
#else
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2847
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2848
	TUint aTunnelingVendorType = static_cast<TUint>(aTunnelingType);
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2849
	TUint aEapVendorType = static_cast<TUint>(aEapType);
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2850
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2851
#endif //#ifdef USE_EAP_EXPANDED_TYPES
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2852
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2853
// The current values for TTLS-PAP:
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2854
// TTLS: aEapVendorType = TTLS, aTunnelingVendorType = None
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2855
// TTLS/plain-PAP: aEapVendorType = ttls_plain_pap, aTunnelingVendorType = TTLS
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2856
	
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2857
	EAP_TRACE_DEBUG_SYMBIAN(
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2858
		(_L("EapTlsPeapUtils::SetConfigurationL -Start- aIndexType=%d, aIndex=%d, Tunneling vendor type=%d, Eap vendor type=%d \n"),
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2859
		aIndexType,aIndex, aTunnelingVendorType, aEapVendorType));
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2860
	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2861
	EAP_TRACE_DEBUG_SYMBIAN((_L("*************************** SetConfigurationL - Set the below values: ***************************\n")) );
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2862
	EAP_TRACE_DEBUG_SYMBIAN((_L("SetConfigurationL - Set these values for EAPType=%d"),aSettings.iEAPType) );
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2863
	EAP_TRACE_DEBUG_SYMBIAN((_L("SetConfigurationL - present=%d, Username=%S"),aSettings.iUsernamePresent, &(aSettings.iUsername)) );
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2864
	EAP_TRACE_DEBUG_SYMBIAN((_L("SetConfigurationL - present=%d, Password=%S"),aSettings.iPasswordPresent, &(aSettings.iPassword)) );
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2865
	EAP_TRACE_DEBUG_SYMBIAN((_L("SetConfigurationL - present=%d, Realm=%S"),aSettings.iRealmPresent, &(aSettings.iRealm)) );
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2866
	EAP_TRACE_DEBUG_SYMBIAN((_L("SetConfigurationL - present=%d, UsePseudonyms=%d"),aSettings.iUsePseudonymsPresent, aSettings.iUsePseudonyms) );
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2867
	EAP_TRACE_DEBUG_SYMBIAN((_L("SetConfigurationL - present=%d, VerifyServerRealm=%d"),
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2868
						aSettings.iVerifyServerRealmPresent, aSettings.iVerifyServerRealm) );
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2869
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2870
	EAP_TRACE_DEBUG_SYMBIAN((_L("SetConfigurationL - present=%d, RequireClientAuthentication=%d"),
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2871
						aSettings.iRequireClientAuthenticationPresent, aSettings.iRequireClientAuthentication) );
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2872
						
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2873
	EAP_TRACE_DEBUG_SYMBIAN((_L("SetConfigurationL - present=%d, SessionValidityTime=%d minutes"),
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2874
						aSettings.iSessionValidityTimePresent, aSettings.iSessionValidityTime) );
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2875
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2876
	EAP_TRACE_DEBUG_SYMBIAN((_L("SetConfigurationL - present=%d, CipherSuites Count=%d"),
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2877
						aSettings.iCipherSuitesPresent, aSettings.iCipherSuites.Count()) );
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2878
	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2879
	EAP_TRACE_DEBUG_SYMBIAN((_L("SetConfigurationL - present=%d, PEAPv0Allowed=%d, PEAPv1Allowed=%d, PEAPv2Allowed=%d"),
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2880
						aSettings.iPEAPVersionsPresent, aSettings.iPEAPv0Allowed,aSettings.iPEAPv1Allowed, aSettings.iPEAPv2Allowed ) );
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2881
	
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2882
	// Validate length of inputs.
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2883
	if(aSettings.iUsername.Length() > KMaxManualUsernameLengthInDB
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2884
		|| aSettings.iRealm.Length() > KMaxManualRealmLengthInDB )
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2885
	{
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2886
		// Some inputs are too long. Can not be stored in DB.
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2887
		
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2888
		EAP_TRACE_DEBUG_SYMBIAN((_L("EapTlsPeapUtils::SetConfigurationL: Too long arguments\n")));
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2889
		
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2890
		User::Leave(KErrArgument);
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2891
	}
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2892
	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2893
	EAP_TRACE_DEBUG_SYMBIAN((_L("SetConfigurationL - present=%d, Certificates Count=%d"),
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2894
						aSettings.iCertificatesPresent, aSettings.iCertificates.Count()) );
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2895
						
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2896
	EAP_TRACE_DEBUG_SYMBIAN((_L("SetConfigurationL - Certificate details below: \n")) );
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2897
	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2898
	for( TInt n=0; n < aSettings.iCertificates.Count(); n++ )
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2899
	{
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2900
		EAP_TRACE_DEBUG_SYMBIAN((_L("SetConfigurationL - Certificate type:%d \n"), aSettings.iCertificates[n].iCertType) );
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2901
		
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2902
		EAP_TRACE_DEBUG_SYMBIAN((_L("SetConfigurationL - certificates - present=%d, SubjectName=%S"),
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2903
						aSettings.iCertificates[n].iSubjectNamePresent, &(aSettings.iCertificates[n].iSubjectName) ) );
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2904
						
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2905
		EAP_TRACE_DEBUG_SYMBIAN((_L("SetConfigurationL - certificates - present=%d, IssuerName=%S"),
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2906
						aSettings.iCertificates[n].iIssuerNamePresent, &(aSettings.iCertificates[n].iIssuerName) ) );
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2907
						
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2908
		EAP_TRACE_DEBUG_SYMBIAN((_L("SetConfigurationL - certificates - present=%d, SerialNumber=%S"),
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2909
						aSettings.iCertificates[n].iSerialNumberPresent, &(aSettings.iCertificates[n].iSerialNumber) ) );
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2910
						
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2911
		EAP_TRACE_DEBUG_SYMBIAN((_L("SetConfigurationL - certificates - SubjectKeyID present=%d"),
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2912
						aSettings.iCertificates[n].iSubjectKeyIDPresent ) );						
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2913
						
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2914
		EAP_TRACE_DATA_DEBUG_SYMBIAN( ( "SubjectKeyID:", aSettings.iCertificates[n].iSubjectKeyID.Ptr(), 
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2915
													aSettings.iCertificates[n].iSubjectKeyID.Size() ) );
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2916
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2917
		EAP_TRACE_DEBUG_SYMBIAN((_L("SetConfigurationL - certificates - Thumbprint present=%d"),
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2918
						aSettings.iCertificates[n].iThumbprintPresent ) );						
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2919
						
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2920
		EAP_TRACE_DATA_DEBUG_SYMBIAN( ( "Thumbprint:", aSettings.iCertificates[n].iThumbprint.Ptr(), 
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2921
													aSettings.iCertificates[n].iThumbprint.Size() ) );
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2922
	}						
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2923
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2924
	EAP_TRACE_DEBUG_SYMBIAN((_L("SetConfigurationL - present=%d, EncapsulatedEAPTypes Count=%d"),
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2925
						aSettings.iEncapsulatedEAPTypesPresent, aSettings.iEncapsulatedEAPTypes.Count()) );
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2926
	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2927
	for( TInt m=0; m < aSettings.iEncapsulatedEAPTypes.Count(); m++ )
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2928
	{	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2929
		EAP_TRACE_DEBUG_SYMBIAN((_L("SetConfigurationL - EncapsulatedEAPTypes=%d"),
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2930
						aSettings.iEncapsulatedEAPTypes[m]) );
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2931
	}						
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2932
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2933
#ifdef USE_FAST_EAP_TYPE		
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2934
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2935
	EAP_TRACE_DEBUG_SYMBIAN((_L("SetConfigurationL - present=%d, AuthProvModeAllowed=%d"),
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2936
						aSettings.iAuthProvModeAllowedPresent, aSettings.iAuthProvModeAllowed) );
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2937
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2938
	EAP_TRACE_DEBUG_SYMBIAN((_L("SetConfigurationL - present=%d, UnauthProvModeAllowed=%d"),
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2939
						aSettings.iUnauthProvModeAllowedPresent, aSettings.iUnauthProvModeAllowed) );
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2940
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2941
	EAP_TRACE_DEBUG_SYMBIAN((_L("SetConfigurationL - present=%d, WarnADHPNoPAC=%d"),
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2942
			aSettings.iWarnADHPNoPACPresent, aSettings.iWarnADHPNoPAC) );
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2943
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2944
	EAP_TRACE_DEBUG_SYMBIAN((_L("SetConfigurationL - present=%d, WarnADHPNoMatchingPAC=%d"),
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2945
			aSettings.iWarnADHPNoMatchingPACPresent, aSettings.iWarnADHPNoMatchingPAC) );
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2946
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2947
	EAP_TRACE_DEBUG_SYMBIAN((_L("SetConfigurationL - present=%d, WarnNotDefaultServer=%d"),
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2948
			aSettings.iWarnNotDefaultServerPresent, aSettings.iWarnNotDefaultServer) );
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2949
	
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2950
	// Validate length of PAC Group Ref.
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2951
	if(aSettings.iPACGroupReference.Length() > KMaxPACGroupRefCollectionLengthInDB)
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2952
	{
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2953
		// Too long PAC Group Reference. Can not be stored in DB.
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2954
		
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2955
		EAP_TRACE_DEBUG_SYMBIAN((_L("EapTlsPeapUtils::SetConfigurationL: Too long PAC Group Ref!\n")));
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2956
		
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2957
		User::Leave(KErrArgument);
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2958
	}
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2959
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2960
	EAP_TRACE_DEBUG_SYMBIAN((_L("SetConfigurationL - present=%d, PAC Group Ref=%S"),
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2961
						aSettings.iPACGroupReferencePresent, &(aSettings.iPACGroupReference)) );
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2962
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2963
#endif //#ifdef USE_FAST_EAP_TYPE		
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2964
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2965
	EAP_TRACE_DEBUG_SYMBIAN((_L("*************************** SetConfigurationL - Set the above values: ***************************\n")) );
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2966
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2967
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2968
	// Check if the settings are for the correct type
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2969
	if ((aSettings.iEAPType != EAPSettings::EEapTls
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2970
		&& aSettings.iEAPType != EAPSettings::EEapPeap
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2971
		&& aSettings.iEAPType != EAPSettings::EEapTtls
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2972
#ifdef USE_FAST_EAP_TYPE		
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2973
		&& aSettings.iEAPType != EAPSettings::EEapFast
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2974
#endif	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2975
		&& aSettings.iEAPType != EAPSettings::ETtlsPlainPap
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2976
		)
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2977
		|| static_cast<TUint>(aSettings.iEAPType) != aEapVendorType)
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2978
	{
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2979
		EAP_TRACE_DEBUG_SYMBIAN((_L("SetConfigurationL - LEAVE - Unsupported EAP type\n")) );
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2980
		
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2981
		User::Leave(KErrNotSupported);
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2982
	}
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2983
		
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2984
	HBufC* buf = HBufC::NewLC(KMaxSqlQueryLength);
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2985
	TPtr sqlStatement = buf->Des();	
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2986
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2987
	TPtrC settings;
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2988
	TPtrC usercerts;
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2989
	TPtrC cacerts;
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2990
	TPtrC ciphersuites;
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2991
	TPtrC maxSessionTime;
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2992
	TPtrC lastFullAuthTime;
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2993
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2994
#ifdef USE_FAST_EAP_TYPE
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2995
	TPtrC fastSpecialSettings;		
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2996
#endif
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2997
	
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  2998
	switch (aEapVendorType)
45
bad0cc58d154 Revision: 201029
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
  2999
	{
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3000
	case eap_type_tls:
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3001
		{
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3002
			settings.Set(KTlsDatabaseTableName);
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3003
			usercerts.Set(KTlsAllowedUserCertsDatabaseTableName);
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3004
			cacerts.Set(KTlsAllowedCACertsDatabaseTableName);
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3005
			ciphersuites.Set(KTlsAllowedCipherSuitesDatabaseTableName);
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3006
			maxSessionTime.Set(cf_str_EAP_TLS_max_session_validity_time_literal);
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3007
			lastFullAuthTime.Set(KTLSLastFullAuthTime);
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3008
		}
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3009
		break;
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3010
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3011
	case eap_type_peap:
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3012
		{
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3013
			settings.Set(KPeapDatabaseTableName);
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3014
			usercerts.Set(KPeapAllowedUserCertsDatabaseTableName);
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3015
			cacerts.Set(KPeapAllowedCACertsDatabaseTableName);
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3016
			ciphersuites.Set(KPeapAllowedCipherSuitesDatabaseTableName);
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3017
			maxSessionTime.Set(cf_str_EAP_PEAP_max_session_validity_time_literal);
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3018
			lastFullAuthTime.Set(KPEAPLastFullAuthTime);
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3019
		}
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3020
		break;
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3021
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3022
	case eap_type_ttls:
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3023
		{
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3024
			settings.Set(KTtlsDatabaseTableName);
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3025
			usercerts.Set(KTtlsAllowedUserCertsDatabaseTableName);
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3026
			cacerts.Set(KTtlsAllowedCACertsDatabaseTableName);
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3027
			ciphersuites.Set(KTtlsAllowedCipherSuitesDatabaseTableName);
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3028
			maxSessionTime.Set(cf_str_EAP_TTLS_max_session_validity_time_literal);
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3029
			lastFullAuthTime.Set(KTTLSLastFullAuthTime);
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3030
		}
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3031
		break;
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3032
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3033
#ifdef USE_FAST_EAP_TYPE		
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3034
	case eap_type_fast:
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3035
		{
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3036
			settings.Set(KFastGeneralSettingsDBTableName); // This is general settings for FAST.
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3037
			fastSpecialSettings.Set(KFastSpecialSettingsDBTableName);
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3038
			
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3039
			usercerts.Set(KFastAllowedUserCertsDatabaseTableName);
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3040
			cacerts.Set(KFastAllowedCACertsDatabaseTableName);
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3041
			ciphersuites.Set(KFastAllowedCipherSuitesDatabaseTableName);
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3042
			maxSessionTime.Set(cf_str_EAP_FAST_max_session_validity_time_literal);
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3043
			lastFullAuthTime.Set(KFASTLastFullAuthTime);
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3044
		}
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3045
		break;
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3046
#endif
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3047
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3048
	case eap_type_ttls_plain_pap:
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3049
		{
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3050
			settings.Set( KTtlsDatabaseTableName );
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3051
			maxSessionTime.Set( cf_str_EAP_TLS_PEAP_ttls_pap_max_session_validity_time_literal );
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3052
			lastFullAuthTime.Set( KTTLSPAPLastFullAuthTime );
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3053
		}
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3054
		break;
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3055
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3056
	default:
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3057
		{
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3058
			EAP_TRACE_DEBUG_SYMBIAN((_L("SetConfigurationL - LEAVE - Unsupported EAP type =%d\n"),
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3059
				aEapVendorType) );
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3060
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3061
			// Should never happen
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3062
			User::Leave(KErrArgument);
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3063
		}
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3064
	}	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3065
	
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3066
	RDbView view;
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3067
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3068
	_LIT(KSQL, "SELECT * FROM %S WHERE %S=%d AND %S=%d AND %S=%d");
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3069
	
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3070
	//////////////////////////////////////////
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3071
	// This is for settings for all EAP types.
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3072
	// For EAP-FAST it is General settings.
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3073
	//////////////////////////////////////////
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3074
	
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3075
	sqlStatement.Format( KSQL, &settings, 
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3076
		&KServiceType, aIndexType, &KServiceIndex, aIndex,
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3077
		&KTunnelingType, aTunnelingVendorType );		
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3078
		
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3079
	// Evaluate view
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3080
	User::LeaveIfError(view.Prepare(aDatabase, TDbQuery(sqlStatement)));
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3081
	
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3082
	CleanupClosePushL(view);
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3083
	
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3084
	User::LeaveIfError(view.EvaluateAll());	
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3085
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3086
	view.FirstL();
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3087
	
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3088
	view.UpdateL();
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3089
	
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3090
	// Get column set so we get the correct column numbers
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3091
	CDbColSet* colSet = view.ColSetL();
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3092
	CleanupStack::PushL(colSet);
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3093
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3094
	// Database view is ready for setting now. Set items one by one, if needed.
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3095
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3096
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3097
	//////////////////////////////////////////
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3098
	// This is only for plain PAP settings. //
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3099
	//////////////////////////////////////////
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3100
	if ( aEapVendorType == eap_type_ttls_plain_pap )
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3101
		{
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3102
		// Username
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3103
		if ( aSettings.iUsernamePresent )
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3104
		    {
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3105
			// Validate length.
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3106
			if( aSettings.iUsername.Length() > KMaxPapUserNameLengthInDb )
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3107
			    {
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3108
				// Username too long. Can not be stored in DB.				
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3109
				EAP_TRACE_DEBUG_SYMBIAN( ( _L( 
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3110
					"EapTlsPeapUtils::SetConfigurationL: Too long Username. Length=%d \n" ),
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3111
				aSettings.iUsername.Length() ) );
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3112
				CleanupStack::PopAndDestroy( 3 ); // colset, view, buf
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3113
				User::Leave( KErrArgument );
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3114
			    }
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3115
			
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3116
			// Length is ok. Set the value in DB.
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3117
			view.SetColL( colSet->ColNo( cf_str_EAP_TLS_PEAP_ttls_pap_username_literal ),
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3118
				aSettings.iUsername);		
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3119
		    }
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3120
		// Password
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3121
		if ( aSettings.iPasswordPresent )
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3122
		    {
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3123
			// Validate length.
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3124
			if ( aSettings.iPassword.Length() > KMaxPapPasswordLengthInDb )
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3125
			    {
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3126
				// Password too long. Can not be stored in DB.				
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3127
				EAP_TRACE_DEBUG_SYMBIAN( ( _L(
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3128
					"EapTlsPeapUtils::SetConfigurationL: Too long Password. Length=%d \n" ),
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3129
				aSettings.iPassword.Length() ) );
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3130
				CleanupStack::PopAndDestroy( 3 ); // colset, view, buf
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3131
				User::Leave( KErrArgument );
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3132
			    }
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3133
						
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3134
			// Length is ok. Set the value in DB.	
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3135
			view.SetColL( colSet->ColNo(
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3136
				cf_str_EAP_TLS_PEAP_ttls_pap_password_literal ),
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3137
				aSettings.iPassword );
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3138
			
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3139
			// If password was supplied set password prompting off
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3140
			view.SetColL( colSet->ColNo(
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3141
				cf_str_EAP_TLS_PEAP_ttls_pap_password_prompt_literal ),
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3142
				EPapPasswordPromptOff );
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3143
		    }
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3144
				
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3145
		// Session validity time
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3146
		if ( aSettings.iSessionValidityTimePresent )
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3147
		    {
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3148
			// User or device management wants to store the session validity time.
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3149
			// Convert the time to micro seconds and save.			
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3150
			TInt64 validityInMicro =
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3151
			    ( aSettings.iSessionValidityTime )
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3152
			    *
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3153
			    KMicroSecsInAMinute;			
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3154
			view.SetColL( colSet->ColNo( maxSessionTime ), validityInMicro );
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3155
			
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3156
			// If max session validity time is supplied and non-zero, set password prompting ON.
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3157
			// It doesn't matter even if the password is supplied. If max session validity is supplied,
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3158
			// it means user needs to provide a password hence prompt should appear.			
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3159
			if( validityInMicro != 0)
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3160
			    {
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3161
				view.SetColL( colSet->ColNo(
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3162
					cf_str_EAP_TLS_PEAP_ttls_pap_password_prompt_literal ),
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3163
					EPapPasswordPromptOn );
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3164
			    }		
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3165
		    }
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3166
		
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3167
		// Last full authentication time should be made zero when EAP configurations are modified.
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3168
		// This makes sure that the next authentication with this EAP would be full authentication
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3169
		// instead of reauthentication even if the session is still valid.		
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3170
		view.SetColL( colSet->ColNo( lastFullAuthTime ), default_FullAuthTime );
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3171
		EAP_TRACE_DEBUG_SYMBIAN( ( _L(
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3172
			"Session Validity: EAP-Type=%d, Resetting Full Auth Time since settings are modified\n" ),
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3173
			aSettings.iEAPType ));
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3174
	    
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3175
		view.PutL();		
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3176
		CleanupStack::PopAndDestroy( 3 ); // colset, view, buf
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3177
		
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3178
	    EAP_TRACE_DEBUG_SYMBIAN((_L("EapTlsPeapUtils::SetConfigurationL - Return \n") ) );		
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3179
	    return; 
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3180
        } // if ( aEapVendorType == eap_type_ttls_plain_pap )
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3181
	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3182
	// Manual username
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3183
	{
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3184
		// Set the value in DB. Value could be empty. It doesn't matter.
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3185
		view.SetColL(colSet->ColNo(cf_str_EAP_TLS_PEAP_manual_username_literal), aSettings.iUsername);
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3186
		
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3187
		// This is to set the automatic or manual status.
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3188
		TUint useManualUsernameStatus;
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3189
		
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3190
		if (aSettings.iUsernamePresent)
45
bad0cc58d154 Revision: 201029
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
  3191
		{
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3192
			useManualUsernameStatus = ETLSPEAPUseManualUsernameYes;
45
bad0cc58d154 Revision: 201029
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
  3193
		}
bad0cc58d154 Revision: 201029
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
  3194
		else
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3195
		{
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3196
			useManualUsernameStatus = ETLSPEAPUseManualUsernameNo;
45
bad0cc58d154 Revision: 201029
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
  3197
		}
bad0cc58d154 Revision: 201029
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
  3198
		
bad0cc58d154 Revision: 201029
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
  3199
		// Set the value.
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3200
		view.SetColL(colSet->ColNo(cf_str_EAP_TLS_PEAP_use_manual_username_literal), 
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3201
			useManualUsernameStatus);
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3202
		
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3203
	}
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3204
		
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3205
	// Manual realm
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3206
	{
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3207
		// Set the value in DB. Value could be empty. It doesn't matter.
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3208
		view.SetColL(colSet->ColNo(cf_str_EAP_TLS_PEAP_manual_realm_literal), aSettings.iRealm);
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3209
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3210
		// This is to set the automatic or manual status.
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3211
		TUint useManualRealmStatus;
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3212
		
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3213
		if (aSettings.iRealmPresent)
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3214
		{
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3215
			useManualRealmStatus = ETLSPEAPUseManualRealmYes;
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3216
		}
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3217
		else
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3218
		{
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3219
			useManualRealmStatus = ETLSPEAPUseManualRealmNo;
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3220
		}
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3221
		
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3222
		// Set the value.
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3223
		view.SetColL(colSet->ColNo(cf_str_EAP_TLS_PEAP_use_manual_realm_literal),
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3224
			useManualRealmStatus);	
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3225
	}
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3226
	
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3227
	// Verify server realm
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3228
	if (aSettings.iVerifyServerRealmPresent)
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3229
	{
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3230
		if (aSettings.iVerifyServerRealm)
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3231
		{
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3232
			view.SetColL(colSet->ColNo(cf_str_EAP_TLS_PEAP_verify_certificate_realm_literal), 
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3233
				ETLSPEAPVerifyCertRealmYes);
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3234
		}
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3235
		else
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3236
		{			
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3237
			view.SetColL(colSet->ColNo(cf_str_EAP_TLS_PEAP_verify_certificate_realm_literal), 
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3238
				ETLSPEAPVerifyCertRealmNo);
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3239
		}
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3240
	}
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3241
	
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3242
	// Require client authentication
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3243
	if (aSettings.iRequireClientAuthenticationPresent)
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3244
	{
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3245
		if (aSettings.iRequireClientAuthentication)
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3246
		{
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3247
			view.SetColL(colSet->ColNo(cf_str_TLS_server_authenticates_client_policy_in_client_literal),
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3248
				ETLSPEAPServerAuthenticatesClientPolicyYes);
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3249
		}
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3250
		else
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3251
		{			
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3252
			view.SetColL(colSet->ColNo(cf_str_TLS_server_authenticates_client_policy_in_client_literal),
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3253
				ETLSPEAPServerAuthenticatesClientPolicyNo);
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3254
		}
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3255
	}
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3256
	
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3257
	// Session validity time
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3258
	if (aSettings.iSessionValidityTimePresent)
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3259
	{
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3260
		// User or device management wants to store the session validity time.
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3261
		// Convert the time to micro seconds and save.
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3262
		
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3263
		TInt64 validityInMicro = (aSettings.iSessionValidityTime) *  KMicroSecsInAMinute;
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3264
		
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3265
		view.SetColL(colSet->ColNo(maxSessionTime), validityInMicro);
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3266
	}
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3267
	
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3268
	// Last full authentication time should be made zero when EAP configurations are modified.
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3269
	// This makes sure that the next authentication with this EAP would be full authentication
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3270
	// instead of reauthentication even if the session is still valid.
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3271
	
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3272
	view.SetColL(colSet->ColNo(lastFullAuthTime), default_FullAuthTime);
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3273
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3274
	EAP_TRACE_DEBUG_SYMBIAN((_L("Session Validity: EAP-Type=%d, Resetting Full Auth Time since settings are modified\n"),
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3275
								aSettings.iEAPType ));	
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3276
	
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3277
	// PEAP versions
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3278
		
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3279
	if (aSettings.iPEAPVersionsPresent
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3280
		&& (aEapType == eap_type_peap
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3281
		|| aEapType == eap_type_ttls
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3282
#ifdef USE_FAST_EAP_TYPE		
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3283
		|| aEapType == eap_type_fast
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3284
#endif	
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3285
		))
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3286
	{
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3287
		TBuf8<KMaxPEAPVersionsStringLengthInDB> acceptedPEAPVersions;
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3288
		
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3289
		if (aSettings.iPEAPv0Allowed)
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3290
		{
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3291
			TInt tmp(0);
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3292
			acceptedPEAPVersions.Append(reinterpret_cast<const TUint8*>(&tmp), sizeof(TInt));
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3293
		}
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3294
		if (aSettings.iPEAPv1Allowed)
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3295
		{
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3296
			TInt tmp(1);
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3297
			acceptedPEAPVersions.Append(reinterpret_cast<const TUint8*>(&tmp), sizeof(TInt));
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3298
		}
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3299
		if (aSettings.iPEAPv2Allowed)
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3300
		{
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3301
			TInt tmp(2);
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3302
			acceptedPEAPVersions.Append(reinterpret_cast<const TUint8*>(&tmp), sizeof(TInt));
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3303
		}
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3304
		view.SetColL(colSet->ColNo(cf_str_EAP_TLS_PEAP_accepted_PEAP_versions_literal), acceptedPEAPVersions); 	
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3305
	}
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3306
	
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3307
	view.PutL();
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3308
	
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3309
	CleanupStack::PopAndDestroy(2); // view, colset	
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3310
	
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3311
#ifdef USE_FAST_EAP_TYPE		
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3312
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3313
	///////////////////////////////////////////////////////
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3314
	// This is only for EAP-FAST specific, Special settings.
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3315
	///////////////////////////////////////////////////////
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3316
	
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3317
	if(aEapType == eap_type_fast)
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3318
	{
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3319
		sqlStatement.Format(KSQL, &fastSpecialSettings, 
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3320
			&KServiceType, aIndexType, &KServiceIndex, aIndex, &KTunnelingType, aTunnelingVendorType);
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3321
		
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3322
		User::LeaveIfError(view.Prepare(aDatabase, TDbQuery(sqlStatement)));
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3323
		
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3324
		CleanupClosePushL(view);
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3325
		
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3326
		User::LeaveIfError(view.EvaluateAll());	
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3327
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3328
		view.FirstL();
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3329
		
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3330
		view.UpdateL();	
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3331
		
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3332
		// Get column set so we get the correct column numbers
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3333
		colSet = view.ColSetL();
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3334
		CleanupStack::PushL(colSet);	
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3335
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3336
		// Database view is ready for setting now. Set items one by one, if needed.
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3337
		
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3338
		// For provisioning modes.
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3339
		if (aSettings.iAuthProvModeAllowedPresent)
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3340
		{
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3341
			if (aSettings.iAuthProvModeAllowed)
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3342
			{
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3343
				view.SetColL(colSet->ColNo(cf_str_EAP_FAST_allow_server_authenticated_provisioning_mode_literal), 
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3344
					EFASTAuthProvModeAllowedYes);
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3345
			}
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3346
			else
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3347
			{			
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3348
				view.SetColL(colSet->ColNo(cf_str_EAP_FAST_allow_server_authenticated_provisioning_mode_literal), 
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3349
					EFASTAuthProvModeAllowedNo);
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3350
			}
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3351
		}
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3352
		
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3353
		if (aSettings.iUnauthProvModeAllowedPresent)
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3354
		{
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3355
			if (aSettings.iUnauthProvModeAllowed)
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3356
			{
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3357
				view.SetColL(colSet->ColNo(cf_str_EAP_FAST_allow_server_unauthenticated_provisioning_mode_ADHP_literal), 
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3358
					EFASTUnauthProvModeAllowedYes);
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3359
			}
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3360
			else
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3361
			{			
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3362
				view.SetColL(colSet->ColNo(cf_str_EAP_FAST_allow_server_unauthenticated_provisioning_mode_ADHP_literal), 
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3363
					EFASTUnauthProvModeAllowedNo);
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3364
			}
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3365
		}
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3366
		
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3367
		// For the warnings and prompts
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3368
		if (aSettings.iWarnADHPNoPACPresent)
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3369
		{
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3370
			if (aSettings.iWarnADHPNoPAC)
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3371
			{
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3372
				view.SetColL(colSet->ColNo(KFASTWarnADHPNoPAC), 
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3373
						EFASTWarnADHPNoPACYes);
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3374
			}
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3375
			else
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3376
			{			
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3377
				view.SetColL(colSet->ColNo(KFASTWarnADHPNoPAC), 
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3378
						EFASTWarnADHPNoPACNo);
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3379
			}
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3380
		}	
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3381
		
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3382
		if (aSettings.iWarnADHPNoMatchingPACPresent)
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3383
		{
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3384
			if (aSettings.iWarnADHPNoMatchingPAC)
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3385
			{
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3386
				view.SetColL(colSet->ColNo(KFASTWarnADHPNoMatchingPAC), 
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3387
						EFASTWarnADHPNoMatchingPACYes);
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3388
			}
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3389
			else
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3390
			{			
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3391
				view.SetColL(colSet->ColNo(KFASTWarnADHPNoMatchingPAC), 
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3392
						EFASTWarnADHPNoMatchingPACNo);
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3393
			}
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3394
		}	
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3395
		
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3396
		if (aSettings.iWarnNotDefaultServerPresent)
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3397
		{
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3398
			if (aSettings.iWarnADHPNoMatchingPAC)
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3399
			{
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3400
				view.SetColL(colSet->ColNo(KFASTWarnNotDefaultServer), 
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3401
						EFASTWarnNotDefaultServerYes);
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3402
			}
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3403
			else
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3404
			{			
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3405
				view.SetColL(colSet->ColNo(KFASTWarnNotDefaultServer), 
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3406
						EFASTWarnNotDefaultServerNo);
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3407
			}
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3408
		}	
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3409
		
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3410
		// For PAC group reference.
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3411
		if (aSettings.iPACGroupReferencePresent)
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3412
		{
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3413
			// The length of iPACGroupReference is already checked for max length.
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3414
			// So just store it in the DB.
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3415
			view.SetColL(colSet->ColNo(KFASTPACGroupImportReferenceCollection),
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3416
				aSettings.iPACGroupReference);
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3417
		}			
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3418
		
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3419
		view.PutL();
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3420
		
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3421
		CleanupStack::PopAndDestroy(2); // view, colset			
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3422
	
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3423
	} // End: if(aEapType == eap_type_fast)
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3424
	
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3425
#endif // #ifdef USE_FAST_EAP_TYPE		
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3426
	
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3427
	//////////////////
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3428
	// Cipher suites
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3429
	//////////////////
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3430
	
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3431
	if (aSettings.iCipherSuitesPresent)
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3432
	{
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3433
		sqlStatement.Format(KSQL, &ciphersuites, 
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3434
			&KServiceType, aIndexType, &KServiceIndex, aIndex, &KTunnelingType, aTunnelingVendorType);
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3435
		
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3436
		User::LeaveIfError(view.Prepare(aDatabase, TDbQuery(sqlStatement)));
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3437
		
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3438
		CleanupClosePushL(view);
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3439
		
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3440
		User::LeaveIfError(view.EvaluateAll());	
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3441
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3442
		// Delete old rows
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3443
		if (view.FirstL())
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3444
		{		
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3445
			do {
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3446
				view.DeleteL();
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3447
			} while (view.NextL() != EFalse);
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3448
		}	
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3449
		
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3450
		// Get column set so we get the correct column numbers
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3451
		colSet = view.ColSetL();
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3452
		CleanupStack::PushL(colSet);
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3453
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3454
		// Database view is ready for setting now. Set items one by one, if needed.
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3455
		
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3456
		for (TInt i = 0; i < aSettings.iCipherSuites.Count(); i++)
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3457
		{
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3458
			view.InsertL();			
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3459
			view.SetColL(colSet->ColNo(KServiceType), static_cast<TUint>(aIndexType));
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3460
			view.SetColL(colSet->ColNo(KServiceIndex), static_cast<TUint>(aIndex));			
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3461
			view.SetColL(colSet->ColNo(KTunnelingType), aTunnelingVendorType);
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3462
			view.SetColL(colSet->ColNo(KCipherSuite), aSettings.iCipherSuites[i]);
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3463
			view.PutL();	
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3464
		}
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3465
		
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3466
		CleanupStack::PopAndDestroy(2); // view, colset
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3467
	}
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3468
	
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3469
	/////////////////////////
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3470
	// User + CA Certificates
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3471
	/////////////////////////
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3472
	
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3473
	EAP_TRACE_DEBUG_SYMBIAN((_L("EapTlsPeapUtils::SetConfigurationL - aSettings.iCertificatesPresent=%d \n"), aSettings.iCertificatesPresent ) );
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3474
	
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3475
	if (aSettings.iCertificatesPresent)
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3476
	{
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3477
		// Needed for getting the Symbian's subject key id.
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3478
		CEapTlsPeapCertFetcher* certFetcher = CEapTlsPeapCertFetcher::NewL();
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3479
		CleanupStack::PushL(certFetcher);
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3480
				
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3481
		TBuf8<KKeyIdentifierLength> symbianSubjectKeyID;		
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3482
		
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3483
		// For USER certificate.		
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3484
		sqlStatement.Format(KSQL, &usercerts, 
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3485
			&KServiceType, aIndexType, &KServiceIndex, aIndex, &KTunnelingType, aTunnelingVendorType);
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3486
			
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3487
		User::LeaveIfError(view.Prepare(aDatabase, TDbQuery(sqlStatement)));
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3488
	
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3489
		CleanupClosePushL(view);
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3490
	
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3491
		User::LeaveIfError(view.EvaluateAll());	
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3492
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3493
		// Delete old rows
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3494
		if (view.FirstL())
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3495
		{		
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3496
			do {
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3497
				view.DeleteL();
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3498
			} while (view.NextL() != EFalse);
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3499
		}	
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3500
		
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3501
		// Get column set so we get the correct column numbers
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3502
		colSet = view.ColSetL();
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3503
		CleanupStack::PushL(colSet);
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3504
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3505
    	// Database view is ready for setting now. Set items one by one, if needed.
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3506
		
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3507
		TInt i(0);
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3508
		
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3509
		EAP_TRACE_DEBUG_SYMBIAN((_L("EapTlsPeapUtils::SetConfigurationL - aSettings.iCertificates.Count()=%d \n"), aSettings.iCertificates.Count() ) );
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3510
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3511
		for (i = 0; i < aSettings.iCertificates.Count(); i++)
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3512
		{
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3513
			if (aSettings.iCertificates[i].iCertType == CertificateEntry::EUser)
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3514
			{	
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3515
				// Validate the length and save other certificate details to the DB.
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3516
				if(aSettings.iCertificates[i].iSubjectName.Length() > KKeyIdentifierLength
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3517
				   || aSettings.iCertificates[i].iIssuerName.Length() > KGeneralStringMaxLength
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3518
				   || aSettings.iCertificates[i].iSerialNumber.Length() > KGeneralStringMaxLength
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3519
				   || aSettings.iCertificates[i].iSubjectKeyID.Length() > KGeneralStringMaxLength
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3520
				   || aSettings.iCertificates[i].iThumbprint.Length() > KThumbprintMaxLength)
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3521
				{
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3522
					// Too long data. Can not be stored in DB.
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3523
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3524
					EAP_TRACE_DEBUG_SYMBIAN((_L("EapTlsPeapUtils::SetConfigurationL : Too long USER cert details.\n")));
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3525
										
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3526
					User::Leave(KErrArgument);
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3527
				}					
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3528
						
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3529
				EAP_TRACE_DATA_DEBUG_SYMBIAN(("THIS IS SubjectKeyID:",
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3530
						aSettings.iCertificates[i].iSubjectKeyID.Ptr(), aSettings.iCertificates[i].iSubjectKeyID.Size()));
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3531
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3532
				// The cert label column is left empty
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3533
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3534
				view.InsertL();			
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3535
				view.SetColL(colSet->ColNo(KServiceType), static_cast<TUint>(aIndexType));
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3536
				view.SetColL(colSet->ColNo(KServiceIndex), static_cast<TUint>(aIndex));
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3537
				view.SetColL(colSet->ColNo(KTunnelingType), aTunnelingVendorType);				
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3538
																
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3539
				view.SetColL(colSet->ColNo(KSubjectName), aSettings.iCertificates[i].iSubjectName);
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3540
				view.SetColL(colSet->ColNo(KIssuerName), aSettings.iCertificates[i].iIssuerName);
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3541
				view.SetColL(colSet->ColNo(KSerialNumber), aSettings.iCertificates[i].iSerialNumber);
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3542
				view.SetColL(colSet->ColNo(KActualSubjectKeyIdentifier), aSettings.iCertificates[i].iSubjectKeyID);					
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3543
				
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3544
				// Special for thumb print (finger print). Need to convert it to 8 bits before storing in DB
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3545
				TBuf8<KThumbprintMaxLength> thumbPrint8Bit;
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3546
				thumbPrint8Bit.Copy(aSettings.iCertificates[i].iThumbprint);
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3547
				
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3548
				view.SetColL(colSet->ColNo(KThumbprint), thumbPrint8Bit);
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3549
				
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3550
				view.SetColL(colSet->ColNo(KSubjectKeyIdentifier), aSettings.iCertificates[i].iSubjectKeyID);
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3551
			
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3552
				view.PutL();	
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3553
				}
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3554
		}
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3555
		CleanupStack::PopAndDestroy(2); // view, colset			
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3556
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3557
		// Do the same for CA certificates.		
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3558
		sqlStatement.Format(KSQL, &cacerts, 
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3559
			&KServiceType, aIndexType, &KServiceIndex, aIndex, &KTunnelingType, aTunnelingVendorType);
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3560
		
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3561
		User::LeaveIfError(view.Prepare(aDatabase, TDbQuery(sqlStatement)));
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3562
		
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3563
		CleanupClosePushL(view);
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3564
		
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3565
		User::LeaveIfError(view.EvaluateAll());	
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3566
		
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3567
		// Delete old rows
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3568
		if (view.FirstL())
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3569
		{		
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3570
			do {
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3571
				view.DeleteL();
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3572
			} while (view.NextL() != EFalse);
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3573
		}	
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3574
			
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3575
		// Get column set so we get the correct column numbers
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3576
		colSet = view.ColSetL();
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3577
		CleanupStack::PushL(colSet);
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3578
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3579
		for (i = 0; i < aSettings.iCertificates.Count(); i++)
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3580
		{
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3581
			if (aSettings.iCertificates[i].iCertType == CertificateEntry::ECA)
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3582
			{
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3583
				// Validate the length and save other certificate details to the DB.
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3584
				if(aSettings.iCertificates[i].iSubjectName.Length() > KKeyIdentifierLength
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3585
				   || aSettings.iCertificates[i].iIssuerName.Length() > KGeneralStringMaxLength
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3586
				   || aSettings.iCertificates[i].iSerialNumber.Length() > KGeneralStringMaxLength
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3587
				   || aSettings.iCertificates[i].iSubjectKeyID.Length() > KGeneralStringMaxLength
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3588
				   || aSettings.iCertificates[i].iThumbprint.Length() > KThumbprintMaxLength)
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3589
				{
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3590
					// Too long data. Can not be stored in DB.
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3591
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3592
					EAP_TRACE_DEBUG_SYMBIAN((_L("EapTlsPeapUtils::SetConfigurationL:Too long CA cert details.\n")));
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3593
										
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3594
					User::Leave(KErrArgument);
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3595
				}					
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3596
					
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3597
				// The cert label column is left empty
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3598
				
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3599
				view.InsertL();			
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3600
				view.SetColL(colSet->ColNo(KServiceType), static_cast<TUint>(aIndexType));
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3601
				view.SetColL(colSet->ColNo(KServiceIndex), static_cast<TUint>(aIndex));				
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3602
				view.SetColL(colSet->ColNo(KTunnelingType),aTunnelingVendorType);
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3603
								
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3604
				view.SetColL(colSet->ColNo(KSubjectName), aSettings.iCertificates[i].iSubjectName);
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3605
				view.SetColL(colSet->ColNo(KIssuerName), aSettings.iCertificates[i].iIssuerName);
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3606
				view.SetColL(colSet->ColNo(KSerialNumber), aSettings.iCertificates[i].iSerialNumber);
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3607
				view.SetColL(colSet->ColNo(KActualSubjectKeyIdentifier), aSettings.iCertificates[i].iSubjectKeyID);					
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3608
				
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3609
				// Special for thumb print (finger print). Need to convert it to 8 bits before storing in DB
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3610
				TBuf8<KThumbprintMaxLength> thumbPrint8Bit;
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3611
				thumbPrint8Bit.Copy(aSettings.iCertificates[i].iThumbprint);
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3612
				
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3613
				view.SetColL(colSet->ColNo(KThumbprint), thumbPrint8Bit);
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3614
				
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3615
				// Get the "symbian's subject key id" using symbian API.
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3616
				// We use this subject key id for authentication.
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3617
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3618
				view.SetColL(colSet->ColNo(KSubjectKeyIdentifier), aSettings.iCertificates[i].iSubjectKeyID);
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3619
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3620
				EAP_TRACE_DATA_DEBUG_SYMBIAN( ( "EapTlsPeapUtils::SetConfigurationL - Adding CA cert to DB, Supplied (Actual) SubjectKeyID:",
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3621
					aSettings.iCertificates[i].iSubjectKeyID.Ptr(), aSettings.iCertificates[i].iSubjectKeyID.Size() ) );				
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3622
				
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3623
				view.PutL();
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3624
				}
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3625
		}
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3626
		
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3627
		CleanupStack::PopAndDestroy(2); // view, colset	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3628
		
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3629
		CleanupStack::PopAndDestroy(certFetcher);
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3630
		
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3631
	} // End of if (aSettings.iCertificatesPresent)
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3632
	
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3633
	CleanupStack::PopAndDestroy(); // buf
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3634
		
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3635
	/////////////////////
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3636
	// Encapsulated types
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3637
	/////////////////////
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3638
	
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3639
	EAP_TRACE_DEBUG_SYMBIAN((_L("EapTlsPeapUtils::SetConfigurationL - aSettings.iEncapsulatedEAPTypesPresent=%d \n"), aSettings.iEncapsulatedEAPTypesPresent ) );
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3640
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3641
	// Encapsulated types are only for EAP-PEAP, EAP-TTLS and EAP-FAST. Not for EAP-TLS.
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3642
	// This is just to be on safe side. In case if iEncapsulatedEAPTypesPresent is set true for EAP-TLS by the caller.
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3643
	if ( aEapType != eap_type_peap 
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3644
		 && aEapType != eap_type_ttls
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3645
#ifdef USE_FAST_EAP_TYPE
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3646
		 && aEapType != eap_type_fast
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3647
#endif		  		 
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3648
		  )
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3649
	{
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3650
		EAP_TRACE_DEBUG_SYMBIAN(
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3651
			(_L("EapTlsPeapUtils::SetConfigurationL - End - Since no encapsulated type for the EAPType =%d \n"),
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3652
			aEapVendorType  ) );
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3653
			
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3654
		return; // No need to proceed. No encapsulated type for EAP-TLS..
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3655
	}
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3656
	
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3657
#ifdef USE_EAP_EXPANDED_TYPES
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3658
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3659
	if (aSettings.iEncapsulatedEAPTypesPresent)
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3660
	{
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3661
		RExpandedEapTypePtrArray enabledEAPTypes;
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3662
		// This is just for dummy. All EAP types available here are enabled as default.
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3663
		RExpandedEapTypePtrArray disabledEAPTypes;
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3664
		SExpandedEAPType* expandedEAPTmp = 0;
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3665
	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3666
		for (TInt i = 0; i < aSettings.iEncapsulatedEAPTypes.Count(); i++)
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3667
		{
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3668
			expandedEAPTmp = new SExpandedEAPType;
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3669
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3670
			if (expandedEAPTmp == 0)
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3671
			{
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3672
				enabledEAPTypes.ResetAndDestroy();
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3673
				disabledEAPTypes.ResetAndDestroy();
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3674
				enabledEAPTypes.Close();
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3675
				disabledEAPTypes.Close();
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3676
				User::Leave(KErrNoMemory);				
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3677
			}
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3678
			
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3679
			// This fills the needed values for vendor id etc.
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3680
			eap_expanded_type_c tmpExpEAP(static_cast <eap_type_ietf_values_e> (aSettings.iEncapsulatedEAPTypes[i]));
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3681
			
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3682
			// This is only for plain-MSCHAPv2 as long as we are using the value 99 for it.
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3683
			if(aSettings.iEncapsulatedEAPTypes[i] == EAPSettings::EPlainMschapv2)
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3684
			{
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3685
				tmpExpEAP.set_eap_type_values(
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3686
					eap_type_vendor_id_hack,
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3687
					eap_type_vendor_type_plain_MSCHAPv2_hack);
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3688
			}
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3689
			
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3690
			// And this is for TTLS-PAP as long as we are using the value 98 for it.
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3691
			if(aSettings.iEncapsulatedEAPTypes[i] == EAPSettings::ETtlsPlainPap)
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3692
			{
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3693
				tmpExpEAP.set_eap_type_values(
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3694
					eap_type_vendor_id_hack,
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3695
					eap_type_vendor_type_ttls_plain_pap_hack);
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3696
			}
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3697
			
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3698
			// Some indirect way of forming the 8 byte string of an EAP type is needed here.
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3699
			TUint8 tmpExpBuffer[KExpandedEAPTypeSize]; // This is for the eap_expanded_type_c::write_type
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3700
			
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3701
			// This copies the 8 byte string of EAP type to tmpExpBuffer. 
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3702
			eap_status_e status = eap_expanded_type_c::write_type(0,
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3703
											0, // index should be zero here.
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3704
											tmpExpBuffer,
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3705
											KExpandedEAPTypeSize,
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3706
											true,
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3707
											tmpExpEAP);
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3708
											
45
bad0cc58d154 Revision: 201029
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
  3709
			// Now copy the 8 byte string to expandedEAPTmp.
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3710
			expandedEAPTmp->iExpandedEAPType.Copy(tmpExpBuffer, KExpandedEAPTypeSize);
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3711
			
45
bad0cc58d154 Revision: 201029
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
  3712
			EAP_TRACE_DATA_DEBUG_SYMBIAN(
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3713
				("EapTlsPeapUtils::SetConfigurationL: Expanded EAp type string",
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3714
				expandedEAPTmp->iExpandedEAPType.Ptr(), 
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3715
				expandedEAPTmp->iExpandedEAPType.Size() ) );						
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3716
														
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3717
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3718
			enabledEAPTypes.Append(expandedEAPTmp);
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3719
		}	
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3720
	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3721
	TRAPD(error, SetTunnelingExpandedEapDataL(
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3722
			aDatabase, 
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3723
			0, 
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3724
			enabledEAPTypes,
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3725
			disabledEAPTypes, 
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3726
			aIndexType,
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3727
			aIndex,
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3728
			aTunnelingType,
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3729
			aEapType));
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3730
			
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3731
		if( error != KErrNone )
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3732
		{
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3733
			EAP_TRACE_DEBUG_SYMBIAN((_L("EapTlsPeapUtils::SetConfigurationL - ########### Setting Expanded Tunneling types in the DB failed ############ \n") ) );
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3734
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3735
			enabledEAPTypes.ResetAndDestroy();
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3736
			disabledEAPTypes.ResetAndDestroy();
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3737
			enabledEAPTypes.Close();
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3738
			disabledEAPTypes.Close();
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3739
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3740
			User::Leave(KErrArgument); // There could be some problem in the encapsulated EAP type argument.
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3741
		}
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3742
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3743
		enabledEAPTypes.ResetAndDestroy();
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3744
		disabledEAPTypes.ResetAndDestroy();
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3745
		enabledEAPTypes.Close();
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3746
		disabledEAPTypes.Close();
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3747
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3748
	}
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3749
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3750
#else // For normal unexpanded EAP type.
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3751
	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3752
	if (aSettings.iEncapsulatedEAPTypesPresent)
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3753
	{
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3754
		TEapArray eapArray;
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3755
		
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3756
		TEap *eap;
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3757
		for (TInt i = 0; i < aSettings.iEncapsulatedEAPTypes.Count(); i++)
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3758
		{
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3759
			eap = new TEap;
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3760
			if (eap == 0)
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3761
			{
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3762
				eapArray.ResetAndDestroy();
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3763
				eapArray.Close();
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3764
				User::Leave(KErrNoMemory);				
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3765
			}
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3766
			
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3767
			eap->UID.NumFixedWidth(aSettings.iEncapsulatedEAPTypes[i], EDecimal, 2);
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3768
			eap->Enabled = ETrue;
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3769
			eapArray.Append(eap);
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3770
		}	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3771
	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3772
		TInt err(KErrNone);
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3773
		TRAP(err, SetEapDataL(
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3774
			aDatabase,
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3775
			0,
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3776
			eapArray,
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3777
			aIndexType,
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3778
			aIndex,
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3779
			aTunnelingType,
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3780
			aEapType));
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3781
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3782
		if( err != KErrNone )
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3783
		{
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3784
			EAP_TRACE_DEBUG_SYMBIAN((_L("EapTlsPeapUtils::SetConfigurationL - ########### Setting Tunneling types in the DB failed ############ \n") ) );
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3785
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3786
			eapArray.ResetAndDestroy();
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3787
			eapArray.Close();			
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3788
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3789
			User::Leave(KErrArgument); // There could be some problem in the encapsulated EAP type argument.
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3790
		}
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3791
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3792
		eapArray.ResetAndDestroy();
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3793
		eapArray.Close();			
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3794
	}
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3795
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3796
#endif //#ifdef USE_EAP_EXPANDED_TYPES
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3797
	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3798
	EAP_TRACE_DEBUG_SYMBIAN((_L("EapTlsPeapUtils::SetConfigurationL - End \n") ) );		
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3799
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3800
} // EapTlsPeapUtils::SetConfigurationL()
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3801
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3802
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3803
// ---------------------------------------------------------
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3804
// EapTlsPeapUtils::GetConfigurationL()
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3805
// ---------------------------------------------------------
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3806
//
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3807
void EapTlsPeapUtils::GetConfigurationL(
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3808
	RDbNamedDatabase& aDatabase,
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3809
	EAPSettings& aSettings, 
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3810
	const TIndexType aIndexType,
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3811
	const TInt aIndex,
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3812
	const eap_type_value_e aTunnelingType,
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3813
	const eap_type_value_e aEapType)
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3814
{
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3815
#ifdef USE_EAP_EXPANDED_TYPES
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3816
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3817
	TUint aTunnelingVendorType = aTunnelingType.get_vendor_type();
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3818
	TUint aEapVendorType = aEapType.get_vendor_type();
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3819
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3820
#else
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3821
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3822
	TUint aTunnelingVendorType = static_cast<TUint>(aTunnelingType);
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3823
	TUint aEapVendorType = static_cast<TUint>(aEapType);
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3824
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3825
#endif //#ifdef USE_EAP_EXPANDED_TYPES
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3826
		
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3827
	EAP_TRACE_DEBUG_SYMBIAN(
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3828
		(_L("EapTlsPeapUtils::GetConfigurationL aIndexType=%d, aIndex=%d, Tunneling vendor type=%d, Eap vendor type=%d \n"),
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3829
		aIndexType,aIndex, aTunnelingVendorType, aEapVendorType));
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3830
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3831
	HBufC* buf = HBufC::NewLC(KMaxSqlQueryLength);
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3832
	TPtr sqlStatement = buf->Des();	
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3833
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3834
	TPtrC settings;
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3835
	TPtrC usercerts;
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3836
	TPtrC cacerts;
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3837
	TPtrC ciphersuites;
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3838
	TPtrC maxSessionTime;
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3839
	
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3840
#ifdef USE_FAST_EAP_TYPE
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3841
	TPtrC fastSpecialSettings;		
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3842
#endif
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3843
	
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3844
	switch (aEapVendorType)
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3845
	{
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3846
	case eap_type_tls:
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3847
		{
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3848
			settings.Set(KTlsDatabaseTableName);
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3849
			usercerts.Set(KTlsAllowedUserCertsDatabaseTableName);
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3850
			cacerts.Set(KTlsAllowedCACertsDatabaseTableName);
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3851
			ciphersuites.Set(KTlsAllowedCipherSuitesDatabaseTableName);
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3852
			maxSessionTime.Set(cf_str_EAP_TLS_max_session_validity_time_literal);
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3853
		}
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3854
		break;
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3855
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3856
	case eap_type_peap:
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3857
		{
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3858
			settings.Set(KPeapDatabaseTableName);
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3859
			usercerts.Set(KPeapAllowedUserCertsDatabaseTableName);
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3860
			cacerts.Set(KPeapAllowedCACertsDatabaseTableName);
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3861
			ciphersuites.Set(KPeapAllowedCipherSuitesDatabaseTableName);
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3862
			maxSessionTime.Set(cf_str_EAP_PEAP_max_session_validity_time_literal);
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3863
		}
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3864
		break;
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3865
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3866
	case eap_type_ttls:
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3867
		{
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3868
			settings.Set(KTtlsDatabaseTableName);
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3869
			usercerts.Set(KTtlsAllowedUserCertsDatabaseTableName);
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3870
			cacerts.Set(KTtlsAllowedCACertsDatabaseTableName);
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3871
			ciphersuites.Set(KTtlsAllowedCipherSuitesDatabaseTableName);
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3872
			maxSessionTime.Set(cf_str_EAP_TTLS_max_session_validity_time_literal);
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3873
		}
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3874
		break;
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3875
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3876
#ifdef USE_FAST_EAP_TYPE
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3877
	case eap_type_fast:
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3878
		{
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3879
			settings.Set(KFastGeneralSettingsDBTableName); // This is general settings for FAST.
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3880
			fastSpecialSettings.Set(KFastSpecialSettingsDBTableName);
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3881
			
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3882
			usercerts.Set(KFastAllowedUserCertsDatabaseTableName);
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3883
			cacerts.Set(KFastAllowedCACertsDatabaseTableName);
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3884
			ciphersuites.Set(KFastAllowedCipherSuitesDatabaseTableName);
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3885
			maxSessionTime.Set(cf_str_EAP_FAST_max_session_validity_time_literal);
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3886
		}
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3887
		break;
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3888
#endif
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3889
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3890
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3891
	case eap_type_ttls_plain_pap:
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3892
		{
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3893
		settings.Set( KTtlsDatabaseTableName );
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3894
		maxSessionTime.Set( cf_str_EAP_TLS_PEAP_ttls_pap_max_session_validity_time_literal );
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3895
		}
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3896
		break;
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3897
		
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3898
	default:
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3899
		// Should never happen
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3900
		User::Leave(KErrArgument);
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3901
	}	
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3902
	
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3903
	RDbView view;
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3904
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3905
	// Form the query
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3906
	_LIT(KSQL, "SELECT * FROM %S WHERE %S=%d AND %S=%d AND %S=%d");
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3907
	
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3908
	//////////////////////////////////////////
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3909
	// This is for settings for all EAP types.
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3910
	// For EAP-FAST it is General settings.
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3911
	//////////////////////////////////////////
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3912
	
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3913
	sqlStatement.Format(KSQL, &settings, 
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3914
		&KServiceType, aIndexType, &KServiceIndex, aIndex, &KTunnelingType, aTunnelingVendorType);
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3915
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3916
	// Evaluate view
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3917
	User::LeaveIfError(view.Prepare(aDatabase, TDbQuery(sqlStatement)));
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3918
	
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3919
	CleanupClosePushL(view);
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3920
	
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3921
	User::LeaveIfError(view.EvaluateAll());	
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3922
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3923
	// Get the first (and only) row
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3924
	view.FirstL();
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3925
	view.GetL();				
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3926
	
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3927
	// Get column set so we get the correct column numbers
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3928
	CDbColSet* colSet = view.ColSetL();
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3929
	CleanupStack::PushL(colSet);
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3930
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3931
	aSettings.iEAPType = static_cast<EAPSettings::TEapType>(aEapVendorType);
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3932
	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3933
	EAP_TRACE_DEBUG_SYMBIAN((_L("EapTlsPeapUtils::GetConfigurationL - aSettings.iEAPType=%d \n"),aSettings.iEAPType) );
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3934
	
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3935
	//////////////////////////////////////////
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3936
	// This is only for plain PAP settings. //
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3937
	//////////////////////////////////////////
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3938
	if ( aEapType == eap_type_ttls_plain_pap )
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3939
		{		
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3940
	    // Username
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3941
	    TPtrC username = view.ColDes( colSet->ColNo(
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3942
	   		cf_str_EAP_TLS_PEAP_ttls_pap_username_literal ) );
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3943
	    aSettings.iUsername.Copy( username );
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3944
	    aSettings.iUsernamePresent = ETrue;
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3945
	
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3946
        // Password
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3947
	    TPtrC password = view.ColDes( colSet->ColNo(
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3948
    		cf_str_EAP_TLS_PEAP_ttls_pap_password_literal ) );
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3949
	    aSettings.iPassword.Copy( password );
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3950
	    aSettings.iPasswordPresent = ETrue;
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3951
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3952
	    // Session validity time	
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3953
	    TInt64 maxSessionTimeMicro = view.ColInt64( colSet->ColNo(
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3954
	    	cf_str_EAP_TLS_PEAP_ttls_pap_max_session_validity_time_literal ) );
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3955
	
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3956
	    // Convert the time to minutes.	
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3957
	    TInt64 maxSessionTimeMin = maxSessionTimeMicro / KMicroSecsInAMinute;
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3958
	
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3959
	    aSettings.iSessionValidityTime = static_cast<TUint>( maxSessionTimeMin );
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3960
	    aSettings.iSessionValidityTimePresent = ETrue;
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3961
		
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3962
	    CleanupStack::PopAndDestroy(3); // view, colset, buf
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3963
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3964
		return;
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3965
		}
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3966
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3967
	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3968
	// Username
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3969
	TPtrC username = view.ColDes(colSet->ColNo(cf_str_EAP_TLS_PEAP_manual_username_literal));
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3970
	aSettings.iUsername.Copy(username);
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3971
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3972
	// For manual or automatic status.
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3973
	TUint useUsername = view.ColUint(colSet->ColNo(cf_str_EAP_TLS_PEAP_use_manual_username_literal));
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3974
	if(useUsername == ETLSPEAPUseManualUsernameNo)
45
bad0cc58d154 Revision: 201029
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
  3975
	{
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3976
		aSettings.iUsernamePresent = EFalse;		
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3977
	}
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3978
	else
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3979
	{
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3980
		aSettings.iUsernamePresent = ETrue;		
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3981
	}
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3982
	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3983
	EAP_TRACE_DEBUG_SYMBIAN((_L("EapTlsPeapUtils::GetConfigurationL - Settings.iUsername=%S \n"), &(aSettings.iUsername) ) );
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3984
		
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3985
	// Realm
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3986
	TPtrC realm = view.ColDes(colSet->ColNo(cf_str_EAP_TLS_PEAP_manual_realm_literal));
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3987
	aSettings.iRealm.Copy(realm);
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3988
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3989
	// For manual or automatic status.
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3990
	TUint useRealm = view.ColUint(colSet->ColNo(cf_str_EAP_TLS_PEAP_use_manual_realm_literal));
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3991
	if(useRealm == ETLSPEAPUseManualRealmNo)
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3992
	{
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3993
		aSettings.iRealmPresent = EFalse;
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3994
	}
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3995
	else
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3996
	{
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  3997
		aSettings.iRealmPresent = ETrue;
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  3998
	}
45
bad0cc58d154 Revision: 201029
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
  3999
	
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4000
	EAP_TRACE_DEBUG_SYMBIAN((_L("EapTlsPeapUtils::GetConfigurationL - aSettings.iRealm=%S \n"),&(aSettings.iRealm)) );
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4001
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4002
	// Verify server realm	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4003
	TInt verifyrealm = view.ColUint(colSet->ColNo(cf_str_EAP_TLS_PEAP_verify_certificate_realm_literal));
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4004
	if (verifyrealm == 0)
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4005
	{
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4006
		aSettings.iVerifyServerRealm = EFalse;
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4007
	}
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4008
	else
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4009
	{
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4010
		aSettings.iVerifyServerRealm = ETrue;
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4011
	}
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4012
	aSettings.iVerifyServerRealmPresent = ETrue;
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4013
	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4014
	// Require client authentication
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4015
	TInt requireclientauth = view.ColUint(colSet->ColNo(cf_str_TLS_server_authenticates_client_policy_in_client_literal));
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4016
	if (requireclientauth == 0)
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4017
	{
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4018
		aSettings.iRequireClientAuthentication = EFalse;
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4019
	}
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4020
	else
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4021
	{
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4022
		aSettings.iRequireClientAuthentication = ETrue;
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4023
	}
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4024
	aSettings.iRequireClientAuthenticationPresent = ETrue;
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4025
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4026
	// Session validity time	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4027
	TInt64 maxSessionTimeMicro = view.ColInt64(colSet->ColNo(maxSessionTime));
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4028
	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4029
	// Convert the time to minutes.	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4030
	TInt64 maxSessionTimeMin = maxSessionTimeMicro / KMicroSecsInAMinute;
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4031
	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4032
	aSettings.iSessionValidityTime = static_cast<TUint>(maxSessionTimeMin);
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4033
	aSettings.iSessionValidityTimePresent = ETrue;
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4034
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4035
	// PEAP versions
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4036
	if (aEapType == eap_type_peap
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4037
		|| aEapType == eap_type_ttls
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4038
#ifdef USE_FAST_EAP_TYPE
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4039
		|| aEapType == eap_type_fast
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4040
#endif		
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4041
		)
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4042
	{
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4043
		TPtrC8 binaryValue = view.ColDes8(colSet->ColNo(cf_str_EAP_TLS_PEAP_accepted_PEAP_versions_literal));
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4044
		
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4045
		const TInt* allowedVersions = reinterpret_cast<const TInt *>(binaryValue.Ptr());
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4046
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4047
		TInt i;
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4048
		for (i = 0; i < static_cast<TInt>(binaryValue.Length() / sizeof(TInt)); i++)
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4049
		{
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4050
			switch(allowedVersions[i])
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4051
			{
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4052
			case 0:
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4053
				aSettings.iPEAPv0Allowed = ETrue;
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4054
				break;
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4055
			case 1:
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4056
				aSettings.iPEAPv1Allowed = ETrue;			
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4057
				break;
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4058
			case 2:
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4059
				aSettings.iPEAPv2Allowed = ETrue;
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4060
				
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4061
				break;		
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4062
			}
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4063
		}
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4064
		aSettings.iPEAPVersionsPresent = ETrue;
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4065
	}
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4066
	
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4067
	CleanupStack::PopAndDestroy(2); // view, colset
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4068
	
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4069
#ifdef USE_FAST_EAP_TYPE		
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4070
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4071
	///////////////////////////////////////////////////////
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4072
	// This is only for EAP-FAST specific, Special settings.
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4073
	///////////////////////////////////////////////////////	
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4074
	
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4075
	if(aEapType == eap_type_fast)
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4076
	{
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4077
		sqlStatement.Format(KSQL, &fastSpecialSettings, 
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4078
			&KServiceType, aIndexType, &KServiceIndex, aIndex, &KTunnelingType, aTunnelingVendorType);
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4079
	
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4080
		// Evaluate view
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4081
		User::LeaveIfError(view.Prepare(aDatabase, TDbQuery(sqlStatement)));
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4082
		
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4083
		CleanupClosePushL(view);
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4084
		
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4085
		User::LeaveIfError(view.EvaluateAll());	
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4086
	
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4087
		// Get the first (and only) row
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4088
		view.FirstL();
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4089
		view.GetL();				
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4090
		
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4091
		// Get column set so we get the correct column numbers
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4092
		CDbColSet* colSet = view.ColSetL();
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4093
		CleanupStack::PushL(colSet);
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4094
	
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4095
		// For provisioning modes.
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4096
		TUint authProvMode = view.ColUint(colSet->ColNo(cf_str_EAP_FAST_allow_server_authenticated_provisioning_mode_literal));
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4097
		if(authProvMode == EFASTAuthProvModeAllowedNo)
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4098
		{
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4099
			aSettings.iAuthProvModeAllowed = EFalse;
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4100
		}
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4101
		else
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4102
		{
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4103
			aSettings.iAuthProvModeAllowed = ETrue;
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4104
		}
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4105
		
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4106
		aSettings.iAuthProvModeAllowedPresent = ETrue;
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4107
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4108
		TUint unauthProvMode = view.ColUint(colSet->ColNo(cf_str_EAP_FAST_allow_server_unauthenticated_provisioning_mode_ADHP_literal));
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4109
		if(unauthProvMode == EFASTUnauthProvModeAllowedNo)
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4110
		{
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4111
			aSettings.iUnauthProvModeAllowed = EFalse;
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4112
		}
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4113
		else
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4114
		{
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4115
			aSettings.iUnauthProvModeAllowed = ETrue;
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4116
		}
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4117
		
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4118
		aSettings.iUnauthProvModeAllowedPresent = ETrue;		
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4119
		
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4120
		// For no PAC warning	
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4121
		TUint warn = view.ColUint(colSet->ColNo(KFASTWarnADHPNoPAC));
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4122
		if(warn == EFASTWarnADHPNoPACNo)
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4123
		{
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4124
			aSettings.iWarnADHPNoPAC = EFalse;
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4125
		}
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4126
		else
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4127
		{
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4128
			aSettings.iWarnADHPNoPAC = ETrue;
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4129
		}
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4130
		
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4131
		aSettings.iWarnADHPNoPACPresent = ETrue;
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4132
		
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4133
		// For no matching PAC warning		
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4134
		warn = view.ColUint(colSet->ColNo(KFASTWarnADHPNoMatchingPAC));
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4135
		if(warn == EFASTWarnADHPNoMatchingPACNo)
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4136
		{
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4137
			aSettings.iWarnADHPNoMatchingPAC = EFalse;
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4138
		}
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4139
		else
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4140
		{
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4141
			aSettings.iWarnADHPNoMatchingPAC = ETrue;
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4142
		}
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4143
		
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4144
		aSettings.iWarnADHPNoMatchingPACPresent = ETrue;		
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4145
		
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4146
		// For no default server warning
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4147
		warn = view.ColUint(colSet->ColNo(KFASTWarnNotDefaultServer));
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4148
		if(warn == EFASTWarnNotDefaultServerNo)
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4149
		{
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4150
			aSettings.iWarnNotDefaultServer = EFalse;
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4151
		}
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4152
		else
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4153
		{
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4154
			aSettings.iWarnNotDefaultServer = ETrue;
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4155
		}
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4156
		
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4157
		aSettings.iWarnNotDefaultServerPresent = ETrue;
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4158
		
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4159
		// For PAC group reference.
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4160
		TPtrC pacGroupRef = view.ColDes(colSet->ColNo(KFASTPACGroupImportReferenceCollection));
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4161
		if(pacGroupRef.Length())
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4162
		{
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4163
			aSettings.iPACGroupReference.Copy(pacGroupRef);
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4164
			
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4165
			aSettings.iPACGroupReferencePresent = ETrue;
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4166
		}
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4167
		
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4168
		CleanupStack::PopAndDestroy(2); // view, colset		
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4169
				
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4170
	} // End: if(aEapType == eap_type_fast) 
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4171
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4172
#endif //#ifdef USE_FAST_EAP_TYPE		
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4173
		
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4174
	
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4175
	//////////////////
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4176
	// Cipher suites
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4177
	//////////////////
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4178
	
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4179
	sqlStatement.Format(KSQL, &ciphersuites, 
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4180
		&KServiceType, aIndexType, &KServiceIndex, aIndex, &KTunnelingType, aTunnelingVendorType);
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4181
	
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4182
	User::LeaveIfError(view.Prepare(aDatabase, TDbQuery(sqlStatement)));
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4183
	
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4184
	CleanupClosePushL(view);
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4185
	
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4186
	User::LeaveIfError(view.EvaluateAll());	
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4187
		
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4188
	// Get column set so we get the correct column numbers
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4189
	colSet = view.ColSetL();
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4190
	CleanupStack::PushL(colSet);
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4191
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4192
	if (view.FirstL())
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4193
	{		
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4194
		do {
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4195
			view.GetL();
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4196
			{				
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4197
				aSettings.iCipherSuites.Append(view.ColUint(colSet->ColNo(KCipherSuite)));
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4198
			}
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4199
		} while (view.NextL() != EFalse);
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4200
	}
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4201
	
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4202
	EAP_TRACE_DEBUG_SYMBIAN((_L("EapTlsPeapUtils::GetConfigurationL - Total cipher suites appended=%d \n"),aSettings.iCipherSuites.Count()) );
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4203
	
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4204
	aSettings.iCipherSuitesPresent = ETrue;
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4205
	
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4206
	CleanupStack::PopAndDestroy(2); // view, colset
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4207
	
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4208
	/////////////////
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4209
	// User Certificates
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4210
	/////////////////
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4211
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4212
	sqlStatement.Format(KSQL, &usercerts, 
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4213
		&KServiceType, aIndexType, &KServiceIndex, aIndex, &KTunnelingType, aTunnelingVendorType);
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4214
	
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4215
	User::LeaveIfError(view.Prepare(aDatabase, TDbQuery(sqlStatement)));
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4216
	
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4217
	CleanupClosePushL(view);
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4218
	
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4219
	User::LeaveIfError(view.EvaluateAll());	
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4220
		
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4221
	// Get column set so we get the correct column numbers
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4222
	colSet = view.ColSetL();
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4223
	CleanupStack::PushL(colSet);
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4224
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4225
	if (view.FirstL())
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4226
	{		
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4227
		do {
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4228
			view.GetL();
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4229
			{
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4230
				// This is big object.
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4231
				CertificateEntry * certEntry = new (ELeave) CertificateEntry;
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4232
				CleanupStack::PushL(certEntry);
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4233
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4234
				certEntry->iCertType = CertificateEntry::EUser;
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4235
				
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4236
				certEntry->iSubjectName.Copy(view.ColDes(colSet->ColNo(KSubjectName)));
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4237
				if(certEntry->iSubjectName.Length())
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4238
				{
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4239
					certEntry->iSubjectNamePresent = ETrue;
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4240
				}
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4241
				
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4242
				certEntry->iIssuerName.Copy(view.ColDes(colSet->ColNo(KIssuerName)));
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4243
				if(certEntry->iIssuerName.Length())
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4244
				{
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4245
					certEntry->iIssuerNamePresent = ETrue;
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4246
				}
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4247
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4248
				certEntry->iSerialNumber.Copy(view.ColDes(colSet->ColNo(KSerialNumber)));
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4249
				if(certEntry->iSerialNumber.Length())
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4250
				{
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4251
					certEntry->iSerialNumberPresent = ETrue;
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4252
				}
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4253
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4254
				certEntry->iSubjectKeyID.Copy(view.ColDes8(colSet->ColNo(KActualSubjectKeyIdentifier))); // This is the subjectkey id we got in SetConfigurationL
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4255
				if(certEntry->iSubjectKeyID.Length())
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4256
				{
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4257
					certEntry->iSubjectKeyIDPresent = ETrue;
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4258
				}
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4259
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4260
				certEntry->iThumbprint.Copy(view.ColDes8(colSet->ColNo(KThumbprint)));				
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4261
				if(certEntry->iThumbprint.Length())
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4262
				{
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4263
					certEntry->iThumbprintPresent = ETrue;
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4264
				}
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4265
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4266
				aSettings.iCertificates.AppendL(*certEntry);
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4267
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4268
				EAP_TRACE_DATA_DEBUG_SYMBIAN( ( "EapTlsPeapUtils::GetConfigurationL - Filling User cert entry, SubjectKeyID:",
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4269
					certEntry->iSubjectKeyID.Ptr(), certEntry->iSubjectKeyID.Size() ) );
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4270
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4271
				CleanupStack::PopAndDestroy(certEntry);
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4272
			}
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4273
		} while (view.NextL() != EFalse);
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4274
	}
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4275
	
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4276
	CleanupStack::PopAndDestroy(2); // view, colset
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4277
	
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4278
	/////////////////
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4279
	// CA Certificates
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4280
	/////////////////
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4281
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4282
	sqlStatement.Format(KSQL, &cacerts, 
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4283
		&KServiceType, aIndexType, &KServiceIndex, aIndex, &KTunnelingType, aTunnelingVendorType);
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4284
	
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4285
	User::LeaveIfError(view.Prepare(aDatabase, TDbQuery(sqlStatement)));
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4286
	
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4287
	CleanupClosePushL(view);
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4288
	
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4289
	User::LeaveIfError(view.EvaluateAll());	
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4290
		
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4291
	// Get column set so we get the correct column numbers
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4292
	colSet = view.ColSetL();
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4293
	CleanupStack::PushL(colSet);
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4294
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4295
	if (view.FirstL())
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4296
	{		
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4297
		do {
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4298
			view.GetL();
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4299
			{	
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4300
				// This is big object.
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4301
				CertificateEntry * certEntry = new (ELeave) CertificateEntry;
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4302
				CleanupStack::PushL(certEntry);
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4303
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4304
				certEntry->iCertType = CertificateEntry::ECA;
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4305
				
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4306
				certEntry->iSubjectName.Copy(view.ColDes(colSet->ColNo(KSubjectName)));
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4307
				if(certEntry->iSubjectName.Length())
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4308
				{
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4309
					certEntry->iSubjectNamePresent = ETrue;
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4310
				}
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4311
				
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4312
				certEntry->iIssuerName.Copy(view.ColDes(colSet->ColNo(KIssuerName)));
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4313
				if(certEntry->iIssuerName.Length())
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4314
				{
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4315
					certEntry->iIssuerNamePresent = ETrue;
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4316
				}
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4317
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4318
				certEntry->iSerialNumber.Copy(view.ColDes(colSet->ColNo(KSerialNumber)));
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4319
				if(certEntry->iSerialNumber.Length())
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4320
				{
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4321
					certEntry->iSerialNumberPresent = ETrue;
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4322
				}
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4323
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4324
				certEntry->iSubjectKeyID.Copy(view.ColDes8(colSet->ColNo(KActualSubjectKeyIdentifier))); // This is the subjectkey id we got in SetConfigurationL
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4325
				if(certEntry->iSubjectKeyID.Length())
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4326
				{
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4327
					certEntry->iSubjectKeyIDPresent = ETrue;
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4328
				}
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4329
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4330
				certEntry->iThumbprint.Copy(view.ColDes8(colSet->ColNo(KThumbprint)));				
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4331
				if(certEntry->iThumbprint.Length())
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4332
				{
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4333
					certEntry->iThumbprintPresent = ETrue;
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4334
				}
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4335
				
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4336
				aSettings.iCertificates.AppendL(*certEntry);
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4337
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4338
				EAP_TRACE_DATA_DEBUG_SYMBIAN( ( "EapTlsPeapUtils::GetConfigurationL - Filling CA cert entry, SubjectKeyID:",
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4339
					certEntry->iSubjectKeyID.Ptr(), certEntry->iSubjectKeyID.Size() ) );
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4340
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4341
				CleanupStack::PopAndDestroy(certEntry);
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4342
			}
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4343
		} while (view.NextL() != EFalse);
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4344
	}
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4345
	
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4346
	CleanupStack::PopAndDestroy(3); // view, colset, buf
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4347
	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4348
	aSettings.iCertificatesPresent = ETrue;
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4349
	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4350
	EAP_TRACE_DEBUG_SYMBIAN((_L("**************** GetConfigurationL - Returning the below values: ***************\n")) );
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4351
	EAP_TRACE_DEBUG_SYMBIAN((_L("GetConfigurationL - Return these values for EAPType=%d"),aSettings.iEAPType) );
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4352
	EAP_TRACE_DEBUG_SYMBIAN((_L("GetConfigurationL - present=%d, Username=%S"),aSettings.iUsernamePresent, &(aSettings.iUsername)) );
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4353
	EAP_TRACE_DEBUG_SYMBIAN((_L("GetConfigurationL - present=%d, Password=%S"),aSettings.iPasswordPresent, &(aSettings.iPassword)) );
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4354
	EAP_TRACE_DEBUG_SYMBIAN((_L("GetConfigurationL - present=%d, Realm=%S"),aSettings.iRealmPresent, &(aSettings.iRealm)) );
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4355
	EAP_TRACE_DEBUG_SYMBIAN((_L("GetConfigurationL - present=%d, UsePseudonyms=%d"),aSettings.iUsePseudonymsPresent, aSettings.iUsePseudonyms) );
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4356
	EAP_TRACE_DEBUG_SYMBIAN((_L("GetConfigurationL - present=%d, VerifyServerRealm=%d"),
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4357
						aSettings.iVerifyServerRealmPresent, aSettings.iVerifyServerRealm) );
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4358
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4359
	EAP_TRACE_DEBUG_SYMBIAN((_L("GetConfigurationL - present=%d, RequireClientAuthentication=%d"),
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4360
						aSettings.iRequireClientAuthenticationPresent, aSettings.iRequireClientAuthentication) );
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4361
						
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4362
	EAP_TRACE_DEBUG_SYMBIAN((_L("GetConfigurationL - present=%d, SessionValidityTime=%d minutes"),
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4363
						aSettings.iSessionValidityTimePresent, aSettings.iSessionValidityTime) );
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4364
						
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4365
	EAP_TRACE_DEBUG_SYMBIAN((_L("GetConfigurationL - present=%d, CipherSuites Count=%d"),
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4366
						aSettings.iCipherSuitesPresent, aSettings.iCipherSuites.Count()) );
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4367
	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4368
	EAP_TRACE_DEBUG_SYMBIAN((_L("GetConfigurationL - present=%d, PEAPv0Allowed=%d, PEAPv1Allowed=%d, PEAPv2Allowed=%d"),
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4369
						aSettings.iPEAPVersionsPresent, aSettings.iPEAPv0Allowed,aSettings.iPEAPv1Allowed, aSettings.iPEAPv2Allowed ) );
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4370
	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4371
	EAP_TRACE_DEBUG_SYMBIAN((_L("GetConfigurationL - present=%d, Certificates Count=%d"),
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4372
						aSettings.iCertificatesPresent, aSettings.iCertificates.Count()) );
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4373
						
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4374
	EAP_TRACE_DEBUG_SYMBIAN((_L("GetConfigurationL - Certificate details below: \n")) );
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4375
	for( TInt n=0; n < aSettings.iCertificates.Count(); n++ )
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4376
	{
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4377
		EAP_TRACE_DEBUG_SYMBIAN((_L("GetConfigurationL - Certificate type:%d \n"), aSettings.iCertificates[n].iCertType) );
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4378
		
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4379
		EAP_TRACE_DEBUG_SYMBIAN((_L("GetConfigurationL - certificates - present=%d, SubjectName=%S"),
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4380
						aSettings.iCertificates[n].iSubjectNamePresent, &(aSettings.iCertificates[n].iSubjectName)) );
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4381
						
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4382
		EAP_TRACE_DEBUG_SYMBIAN((_L("GetConfigurationL - certificates - present=%d, IssuerName=%S"),
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4383
						aSettings.iCertificates[n].iIssuerNamePresent, &(aSettings.iCertificates[n].iIssuerName)) );
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4384
						
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4385
		EAP_TRACE_DEBUG_SYMBIAN((_L("GetConfigurationL - certificates - present=%d, SerialNumber=%S"),
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4386
						aSettings.iCertificates[n].iSerialNumberPresent, &(aSettings.iCertificates[n].iSerialNumber)) );
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4387
						
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4388
		EAP_TRACE_DEBUG_SYMBIAN((_L("GetConfigurationL - certificates - SubjectKeyID present=%d"),
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4389
						aSettings.iCertificates[n].iSubjectKeyIDPresent ) );
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4390
						
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4391
		EAP_TRACE_DATA_DEBUG_SYMBIAN( ( "SubjectKeyID:", aSettings.iCertificates[n].iSubjectKeyID.Ptr(), 
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4392
													aSettings.iCertificates[n].iSubjectKeyID.Size() ) );						
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4393
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4394
		EAP_TRACE_DEBUG_SYMBIAN((_L("GetConfigurationL - certificates - Thumbprint present=%d"),
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4395
						aSettings.iCertificates[n].iThumbprintPresent ) );
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4396
						
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4397
		EAP_TRACE_DATA_DEBUG_SYMBIAN( ( "Thumbprint:", aSettings.iCertificates[n].iThumbprint.Ptr(), 
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4398
													aSettings.iCertificates[n].iThumbprint.Size() ) );						
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4399
	}
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4400
	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4401
#ifdef USE_FAST_EAP_TYPE		
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4402
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4403
	EAP_TRACE_DEBUG_SYMBIAN((_L("GetConfigurationL - present=%d, AuthProvModeAllowed=%d"),
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4404
						aSettings.iAuthProvModeAllowedPresent, aSettings.iAuthProvModeAllowed) );
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4405
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4406
	EAP_TRACE_DEBUG_SYMBIAN((_L("GetConfigurationL - present=%d, UnauthProvModeAllowed=%d"),
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4407
						aSettings.iUnauthProvModeAllowedPresent, aSettings.iUnauthProvModeAllowed) );
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4408
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4409
	EAP_TRACE_DEBUG_SYMBIAN((_L("GetConfigurationL - present=%d, WarnADHPNoPAC=%d"),
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4410
			aSettings.iWarnADHPNoPACPresent, aSettings.iWarnADHPNoPAC) );
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4411
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4412
	EAP_TRACE_DEBUG_SYMBIAN((_L("GetConfigurationL - present=%d, WarnADHPNoMatchingPAC=%d"),
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4413
			aSettings.iWarnADHPNoMatchingPACPresent, aSettings.iWarnADHPNoMatchingPAC) );
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4414
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4415
	EAP_TRACE_DEBUG_SYMBIAN((_L("GetConfigurationL - present=%d, WarnNotDefaultServer=%d"),
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4416
			aSettings.iWarnNotDefaultServerPresent, aSettings.iWarnNotDefaultServer) );
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4417
	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4418
	EAP_TRACE_DEBUG_SYMBIAN((_L("GetConfigurationL - present=%d, PAC Group Ref=%S"),
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4419
						aSettings.iPACGroupReferencePresent, &(aSettings.iPACGroupReference)) );
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4420
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4421
#endif //#ifdef USE_FAST_EAP_TYPE		
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4422
					
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4423
	EAP_TRACE_DEBUG_SYMBIAN((_L("**************** GetConfigurationL - Returning the above values: ***************\n")) );
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4424
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4425
	
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4426
	//////////////////////	
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4427
	// Encapsulated types
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4428
	//////////////////////
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4429
	
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4430
	// Encapsulated types are only for EAP-PEAP, EAP-TTLS and EAP-FAST. Not for EAP-TLS.
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4431
	if ( aEapType != eap_type_peap 
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4432
		 && aEapType != eap_type_ttls
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4433
#ifdef USE_FAST_EAP_TYPE
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4434
		 && aEapType != eap_type_fast
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4435
#endif		 
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4436
		 )
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4437
	{
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4438
		aSettings.iEncapsulatedEAPTypesPresent = EFalse;
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4439
		
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4440
		EAP_TRACE_DEBUG_SYMBIAN(
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4441
			(_L("EapTlsPeapUtils::GetConfigurationL - End - Since no encapsulated type for the EAPType =%d \n"),
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4442
			aEapVendorType));
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4443
		
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4444
		return; // No need to proceed. Nothing more to provide.
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4445
	}
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4446
		
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4447
#ifdef USE_EAP_EXPANDED_TYPES
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4448
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4449
	RExpandedEapTypePtrArray enabledEAPTypes;
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4450
	RExpandedEapTypePtrArray disabledEAPTypes;
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4451
	
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4452
	TRAPD(error, GetTunnelingExpandedEapDataL(
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4453
			aDatabase, 
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4454
			0, 
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4455
			enabledEAPTypes,
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4456
			disabledEAPTypes, 
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4457
			aIndexType,
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4458
			aIndex,
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4459
			aTunnelingType,
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4460
			aEapType));
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4461
			
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4462
		if( error != KErrNone )
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4463
		{
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4464
			EAP_TRACE_DEBUG_SYMBIAN((_L("EapTlsPeapUtils::GetConfigurationL - ########### Getting Expanded Tunneling types from the DB failed ############ \n") ) );
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4465
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4466
			enabledEAPTypes.ResetAndDestroy();
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4467
			disabledEAPTypes.ResetAndDestroy();
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4468
			enabledEAPTypes.Close();
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4469
			disabledEAPTypes.Close();
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4470
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4471
			User::Leave(KErrGeneral);
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4472
		}
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4473
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4474
	// There should be some enabled EAP types (atleast one).
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4475
	if (enabledEAPTypes.Count() == 0)
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4476
	{
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4477
		// Nothing enabled. Some problem. 
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4478
		// We should get all the available EAP plugins on the device and make them enabled as default.
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4479
		
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4480
		RImplInfoPtrArray eapImplArray;
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4481
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4482
		TRAP(error, REComSession::ListImplementationsL(KEapTypeInterfaceUid, eapImplArray));
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4483
		if (error != KErrNone)
45
bad0cc58d154 Revision: 201029
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
  4484
		{
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4485
			EAP_TRACE_DEBUG_SYMBIAN((_L("EapTlsPeapUtils::GetConfigurationL - ########### Getting Expanded Tunneling types - Listing ECOM plugins failed ############ \n") ) );
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4486
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4487
			enabledEAPTypes.ResetAndDestroy();
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4488
			disabledEAPTypes.ResetAndDestroy();
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4489
			enabledEAPTypes.Close();
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4490
			disabledEAPTypes.Close();
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4491
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4492
			User::Leave(KErrNotFound);
45
bad0cc58d154 Revision: 201029
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
  4493
		}
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4494
		
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4495
		EAP_TRACE_DEBUG_SYMBIAN(
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4496
			(_L("GetConfigurationL - ListImplementationsL - No: of available EAP plugin implementations=%d \n"),
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4497
		 	eapImplArray.Count() ) );
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4498
		
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4499
		SExpandedEAPType* expandedEAPTmp;
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4500
		
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4501
		// Add the EAP types to enabledEAPTypes array now.
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4502
		
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4503
		for (TInt i = 0; i < eapImplArray.Count(); i++)
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4504
		{		
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4505
			if (aEapType == eap_type_peap)
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4506
			{
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4507
				// Some EAP types are not allowed inside EAP-PEAP.
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4508
				if (CEapType::IsDisallowedInsidePEAP(*eapImplArray[i]))
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4509
				{			
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4510
					continue;	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4511
				}
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4512
				
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4513
				expandedEAPTmp = new SExpandedEAPType;
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4514
				if (expandedEAPTmp == 0)
45
bad0cc58d154 Revision: 201029
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
  4515
				{
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4516
					enabledEAPTypes.ResetAndDestroy();
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4517
					disabledEAPTypes.ResetAndDestroy();
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4518
					enabledEAPTypes.Close();
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4519
					disabledEAPTypes.Close();
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4520
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4521
					eapImplArray.ResetAndDestroy();
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4522
					eapImplArray.Close();				
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4523
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4524
					User::Leave(KErrNoMemory);				
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4525
				}
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4526
				
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4527
				CleanupStack::PushL(expandedEAPTmp);
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4528
				
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4529
				expandedEAPTmp->iExpandedEAPType.Copy(eapImplArray[i]->DataType());
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4530
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4531
				enabledEAPTypes.Append(expandedEAPTmp);				
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4532
				
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4533
				CleanupStack::Pop(expandedEAPTmp);
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4534
			}
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4535
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4536
			if (aEapType == eap_type_ttls)
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4537
			{
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4538
				// Some EAP types are not allowed inside EAP-TTLS.
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4539
				if (CEapType::IsDisallowedInsideTTLS(*eapImplArray[i]))
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4540
				{			
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4541
					continue;	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4542
				}
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4543
				
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4544
				expandedEAPTmp = new SExpandedEAPType;
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4545
				if (expandedEAPTmp == 0)
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4546
				{
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4547
					enabledEAPTypes.ResetAndDestroy();
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4548
					disabledEAPTypes.ResetAndDestroy();
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4549
					enabledEAPTypes.Close();
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4550
					disabledEAPTypes.Close();
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4551
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4552
					eapImplArray.ResetAndDestroy();
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4553
					eapImplArray.Close();				
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4554
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4555
					User::Leave(KErrNoMemory);				
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4556
				}
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4557
				
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4558
				CleanupStack::PushL(expandedEAPTmp);
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4559
				
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4560
				expandedEAPTmp->iExpandedEAPType.Copy(eapImplArray[i]->DataType());
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4561
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4562
				enabledEAPTypes.Append(expandedEAPTmp);				
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4563
				
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4564
				CleanupStack::Pop(expandedEAPTmp);
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4565
			}
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4566
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4567
#ifdef USE_FAST_EAP_TYPE
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4568
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4569
			if (aEapType == eap_type_fast)
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4570
			{
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4571
				// Some EAP types are not allowed inside EAP-FAST.
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4572
				if (CEapType::IsDisallowedInsidePEAP(*eapImplArray[i]))
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4573
				{			
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4574
					continue;	
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4575
				}
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4576
				
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4577
				expandedEAPTmp = new SExpandedEAPType;
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4578
				if (expandedEAPTmp == 0)
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4579
				{
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4580
					enabledEAPTypes.ResetAndDestroy();
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4581
					disabledEAPTypes.ResetAndDestroy();
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4582
					enabledEAPTypes.Close();
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4583
					disabledEAPTypes.Close();
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4584
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4585
					eapImplArray.ResetAndDestroy();
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4586
					eapImplArray.Close();				
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4587
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4588
					User::Leave(KErrNoMemory);				
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4589
				}
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4590
				
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4591
				CleanupStack::PushL(expandedEAPTmp);
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4592
				
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4593
				expandedEAPTmp->iExpandedEAPType.Copy(eapImplArray[i]->DataType());
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4594
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4595
				enabledEAPTypes.Append(expandedEAPTmp);				
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4596
				
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4597
				CleanupStack::Pop(expandedEAPTmp);
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4598
			}
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4599
#endif // #ifdef USE_FAST_EAP_TYPE
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4600
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4601
		} // End: for (TInt i = 0; i < eapImplArray.Count(); i++)
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4602
		
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4603
		eapImplArray.ResetAndDestroy();
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4604
		eapImplArray.Close();
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4605
							
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4606
	} // End: if (enabledEAPTypes.Count() == 0)
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4607
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4608
	EAP_TRACE_DEBUG_SYMBIAN(
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4609
		(_L("EapTlsPeapUtils::GetConfigurationL - No: of available tunneled types for this EAP=%d \n"),
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4610
		enabledEAPTypes.Count()));
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4611
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4612
	// enabledEAPTypes contains the EAP types now (expanded).
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4613
	// Fill aSettings.iEncapsulatedEAPTypes here.
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4614
	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4615
	for (TInt i = 0; i < enabledEAPTypes.Count(); i++)
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4616
	{
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4617
		eap_expanded_type_c expEAPTmp;
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4618
		
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4619
		// This will read the expanded EAP from enabledEAPTypes[i]->iExpandedEAPType to expEAPTmp.
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4620
		// This makes easy to get the vendor type.
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4621
		eap_expanded_type_c::read_type( 0,
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4622
										0,
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4623
										enabledEAPTypes[i]->iExpandedEAPType.Ptr(),
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4624
										KExpandedEAPTypeSize,
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4625
										&expEAPTmp);
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4626
	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4627
		// We need to fill only the vendor type to aSettings.iEncapsulatedEAPTypes
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4628
		aSettings.iEncapsulatedEAPTypes.Append(expEAPTmp.get_vendor_type());
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4629
		
45
bad0cc58d154 Revision: 201029
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
  4630
		EAP_TRACE_DEBUG_SYMBIAN(
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4631
			(_L("EapTlsPeapUtils::GetConfigurationL - Available encapsulated type for this EAP(%d)=%d\n"),
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4632
			aEapVendorType, expEAPTmp.get_vendor_type()));
45
bad0cc58d154 Revision: 201029
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
  4633
	}
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4634
	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4635
	EAP_TRACE_DEBUG_SYMBIAN(
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4636
		(_L("EapTlsPeapUtils::GetConfigurationL - aSettings.iEncapsulatedEAPTypes.Count()=%d \n"),
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4637
		aSettings.iEncapsulatedEAPTypes.Count()));
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4638
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4639
	enabledEAPTypes.ResetAndDestroy();
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4640
	disabledEAPTypes.ResetAndDestroy();
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4641
	enabledEAPTypes.Close();
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4642
	disabledEAPTypes.Close();
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4643
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4644
	aSettings.iEncapsulatedEAPTypesPresent = ETrue;
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4645
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4646
#else // for Normal EAP types.
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4647
			
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4648
	TEapArray eapArray;
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4649
		
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4650
	TRAPD(err, GetEapDataL(
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4651
		aDatabase,
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4652
		0,
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4653
		eapArray, 
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4654
		aIndexType,
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4655
		aIndex,
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4656
		aTunnelingType,	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4657
		aEapType));
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4658
	if (err != KErrNone)
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4659
	{
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4660
		eapArray.ResetAndDestroy();
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4661
		eapArray.Close();
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4662
		User::Leave(KErrGeneral);
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4663
	}
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4664
	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4665
	RImplInfoPtrArray eapImplArray;
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4666
	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4667
	if (eapArray.Count() == 0)
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4668
	{
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4669
		// The array was empty. By default all types are enabled.
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4670
		TRAP(err, REComSession::ListImplementationsL(KEapTypeInterfaceUid, eapImplArray));
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4671
		if (err != KErrNone)
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4672
		{
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4673
			eapArray.ResetAndDestroy();
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4674
			eapArray.Close();
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4675
			User::Leave(KErrGeneral);
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4676
		}
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4677
		
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4678
		EAP_TRACE_DEBUG_SYMBIAN((_L("EapTlsPeapUtils::GetConfigurationL - ListImplementationsL - No: of available implementations=%d \n"), eapImplArray.Count() ) );
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4679
		
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4680
		TEap *eap;
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4681
		for (TInt i = 0; i < eapImplArray.Count(); i++)
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4682
		{
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4683
			if (CEapType::IsDisallowedInsidePEAP(*eapImplArray[i]))
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4684
			{			
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4685
				continue;	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4686
			}
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4687
			
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4688
			eap = new TEap;
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4689
			if (eap == 0)
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4690
			{
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4691
				eapArray.ResetAndDestroy();
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4692
				eapArray.Close();
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4693
				eapImplArray.ResetAndDestroy();
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4694
				eapImplArray.Close();				
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4695
				User::Leave(KErrGeneral);				
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4696
			}
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4697
			eap->UID.Copy(eapImplArray[i]->DataType());
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4698
			eap->Enabled = ETrue;
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4699
			eapArray.Append(eap);
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4700
		}	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4701
	}
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4702
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4703
	TInt i(0);
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4704
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4705
	for (i = 0; i < eapArray.Count(); i++)
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4706
	{
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4707
		if (eapArray[i]->Enabled)
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4708
		{
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4709
			TLex8 tmp(eapArray[i]->UID);
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4710
			TUint val(0);
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4711
			tmp.Val(val);
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4712
			aSettings.iEncapsulatedEAPTypes.Append(val);
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4713
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4714
			EAP_TRACE_DEBUG_SYMBIAN((_L("EapTlsPeapUtils::GetConfigurationL - Available encapsulated type for this EAP =%d \n"), val ) );
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4715
		}	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4716
	}
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4717
	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4718
	EAP_TRACE_DEBUG_SYMBIAN((_L("EapTlsPeapUtils::GetConfigurationL - eapArray.Count()=%d \n"),eapArray.Count() ) );
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4719
	EAP_TRACE_DEBUG_SYMBIAN((_L("EapTlsPeapUtils::GetConfigurationL - aSettings.iEncapsulatedEAPTypes.Count()=%d \n"),aSettings.iEncapsulatedEAPTypes.Count() ) );	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4720
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4721
	eapArray.ResetAndDestroy();
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4722
	eapArray.Close();
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4723
	eapImplArray.ResetAndDestroy();
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4724
	eapImplArray.Close();				
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4725
		
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4726
	aSettings.iEncapsulatedEAPTypesPresent = ETrue;
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4727
	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4728
#endif //#ifdef USE_EAP_EXPANDED_TYPES
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4729
	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4730
	EAP_TRACE_DEBUG_SYMBIAN((_L("EapTlsPeapUtils::GetConfigurationL - End \n") ) );	
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4731
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4732
} // EapTlsPeapUtils::GetConfigurationL()
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4733
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4734
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4735
void EapTlsPeapUtils::CopySettingsL(
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4736
	RDbNamedDatabase& aDatabase,
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4737
	const TDesC& aTableName,
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4738
	const TIndexType aSrcIndexType,
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4739
	const TInt aSrcIndex,
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4740
	const eap_type_value_e aSrcTunnelingType,
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4741
	const TIndexType aDestIndexType,
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4742
	const TInt aDestIndex,
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4743
	const eap_type_value_e aDestTunnelingType)
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4744
{
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4745
#ifdef USE_EAP_EXPANDED_TYPES
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4746
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4747
	TUint aSrcTunnelingVendorType = aSrcTunnelingType.get_vendor_type();
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4748
	TUint aDestTunnelingVendorType = aDestTunnelingType.get_vendor_type();
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4749
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4750
#else
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4751
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4752
	TUint aSrcTunnelingVendorType = static_cast<TUint>(aSrcTunnelingType);
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4753
	TUint aDestTunnelingVendorType = static_cast<TUint>(aDestTunnelingType);
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4754
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4755
#endif //#ifdef USE_EAP_EXPANDED_TYPES
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4756
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4757
    EAP_TRACE_DEBUG_SYMBIAN(
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4758
        (_L("EapTlsPeapUtils::CopySettingsL table=%s, aSrcIndexType=%d, aDestIndexType=%d, aSrcIndex=%d, aDestIndex=%d, SrcTunneling vendor type=%d, DestTunneling vendor type=%d \n"),
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4759
                aTableName.Ptr(), aSrcIndexType, aDestIndexType, aSrcIndex, aDestIndex, aSrcTunnelingVendorType, aDestTunnelingVendorType));
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4760
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4761
	HBufC* buf = HBufC::NewLC(KMaxSqlQueryLength);
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4762
	TPtr sqlStatement = buf->Des();
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4763
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4764
	_LIT(KSQL, "SELECT * FROM %S WHERE %S=%d AND %S=%d AND %S=%d");
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4765
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4766
	sqlStatement.Format(KSQL, &aTableName, 
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4767
		&KServiceType, aDestIndexType, &KServiceIndex, aDestIndex, &KTunnelingType, aDestTunnelingVendorType);
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4768
	
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4769
	RDbView view;
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4770
	
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4771
	User::LeaveIfError(view.Prepare(aDatabase, TDbQuery(sqlStatement), TDbWindow::EUnlimited, RDbView::EUpdatable));
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4772
	
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4773
	// View must be closed when no longer needed
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4774
	CleanupClosePushL(view);
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4775
	
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4776
	User::LeaveIfError(view.EvaluateAll());
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4777
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4778
	// Get column set so we get the correct column numbers
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4779
	CDbColSet* colSet = view.ColSetL();
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4780
	CleanupStack::PushL(colSet);
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4781
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4782
  if (view.FirstL())
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4783
  	{       
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4784
  	do 
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4785
  		{
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4786
  		view.GetL();
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4787
			if (view.ColUint(colSet->ColNo(KServiceType)) == static_cast<TUint>(aDestIndexType)
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4788
				&& view.ColUint(colSet->ColNo(KServiceIndex)) == static_cast<TUint>(aDestIndex)
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4789
				&& view.ColUint(colSet->ColNo(KTunnelingType)) == aDestTunnelingVendorType)
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4790
				{  		
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4791
      			EAP_TRACE_DEBUG_SYMBIAN((_L("EapTlsPeapUtils::CopySettingsL - Delete old records\n") ) );
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4792
      			view.DeleteL();
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4793
    			}
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4794
      		} while (view.NextL() != EFalse);
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4795
  		}
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4796
	
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4797
	view.Close();
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4798
	CleanupStack::PopAndDestroy(2); // view, colset
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4799
	
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4800
  	sqlStatement.Format(KSQL, &aTableName, 
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4801
        &KServiceType, aSrcIndexType, &KServiceIndex, aSrcIndex, &KTunnelingType, aSrcTunnelingVendorType);
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4802
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4803
  	User::LeaveIfError(view.Prepare(aDatabase, TDbQuery(sqlStatement), TDbWindow::EUnlimited , RDbView::EUpdatable));
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4804
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4805
	// View must be closed when no longer needed
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4806
	CleanupClosePushL(view);
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4807
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4808
  	User::LeaveIfError(view.EvaluateAll());
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4809
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4810
	// Get column set so we get the correct column numbers
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4811
	colSet = view.ColSetL();
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4812
	CleanupStack::PushL(colSet);
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4813
			
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4814
	TDbBookmark bookmark;
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4815
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4816
	if (view.FirstL())
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4817
	{		
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4818
		do {
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4819
			// Get the next line
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4820
			view.GetL();
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4821
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4822
			// Check if it was already copied			
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4823
			if (view.ColUint(colSet->ColNo(KServiceType)) != static_cast<TUint>(aDestIndexType)
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4824
				|| view.ColUint(colSet->ColNo(KServiceIndex)) != static_cast<TUint>(aDestIndex)
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4825
				|| view.ColUint(colSet->ColNo(KTunnelingType)) != aDestTunnelingVendorType)
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4826
			{
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4827
				bookmark = view.Bookmark();
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4828
				
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4829
				view.InsertCopyL();
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4830
				
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4831
				view.SetColL(colSet->ColNo(KServiceType), static_cast<TUint>(aDestIndexType));
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4832
    
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4833
	    		view.SetColL(colSet->ColNo(KServiceIndex), static_cast<TUint>(aDestIndex));
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4834
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4835
	    		view.SetColL(colSet->ColNo(KTunnelingType), aDestTunnelingVendorType);
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4836
				
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4837
				view.PutL();
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4838
			
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4839
				view.GotoL(bookmark);
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4840
			}
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4841
		} while (view.NextL() != EFalse);
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4842
	}
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4843
	else
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4844
		{
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4845
		EAP_TRACE_DEBUG_SYMBIAN(
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4846
			(_L("EapTlsPeapUtils::CopySettingsL - Nothing to Copy\n")));
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4847
		
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4848
		}
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4849
	
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4850
	view.Close();
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4851
	
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4852
	CleanupStack::PopAndDestroy(3); // view, colset, buf
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4853
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4854
} // EapTlsPeapUtils::CopySettingsL()
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4855
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4856
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4857
// ---------------------------------------------------------
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4858
// EapTlsPeapUtils::DeleteConfigurationL()
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4859
// ---------------------------------------------------------
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4860
//
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4861
void EapTlsPeapUtils::DeleteConfigurationL(	
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4862
	const TIndexType aIndexType,
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4863
	const TInt aIndex,
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4864
	const eap_type_value_e aTunnelingType,
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4865
	const eap_type_value_e aEapType)
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4866
{
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4867
#ifdef USE_EAP_EXPANDED_TYPES
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4868
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4869
	TUint aTunnelingVendorType = aTunnelingType.get_vendor_type();
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4870
	TUint aEapVendorType = aEapType.get_vendor_type();
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4871
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4872
#else
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4873
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4874
	TUint aTunnelingVendorType = static_cast<TUint>(aTunnelingType);
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4875
	TUint aEapVendorType = static_cast<TUint>(aEapType);
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4876
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4877
#endif //#ifdef USE_EAP_EXPANDED_TYPES
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4878
	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4879
	EAP_TRACE_DEBUG_SYMBIAN((_L("EapTlsPeapUtils::DeleteConfigurationL:Start:aIndexType=%d,aIndex=%d,aTunnelingVendorType=%d,aEapVendorType=%d"),
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4880
			aIndexType, aIndex, aTunnelingVendorType, aEapVendorType));
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4881
	
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4882
	TPtrC dbname;
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4883
	TPtrC settings;
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4884
	TPtrC usercerts;
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4885
	TPtrC cacerts;
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4886
	TPtrC ciphersuites;
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4887
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4888
#ifdef USE_FAST_EAP_TYPE
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4889
	TPtrC fastSpecialSettings;
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4890
#endif
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4891
	
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4892
	switch (aEapVendorType)
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4893
	{
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4894
	case eap_type_tls:
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4895
		{
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4896
			dbname.Set(KTlsDatabaseName);
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4897
			settings.Set(KTlsDatabaseTableName);
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4898
			usercerts.Set(KTlsAllowedUserCertsDatabaseTableName);
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4899
			cacerts.Set(KTlsAllowedCACertsDatabaseTableName);
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4900
			ciphersuites.Set(KTlsAllowedCipherSuitesDatabaseTableName);
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4901
		}
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4902
		break;
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4903
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4904
	case eap_type_peap:
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4905
		{
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4906
			dbname.Set(KPeapDatabaseName);
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4907
			settings.Set(KPeapDatabaseTableName);
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4908
			usercerts.Set(KPeapAllowedUserCertsDatabaseTableName);
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4909
			cacerts.Set(KPeapAllowedCACertsDatabaseTableName);
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4910
			ciphersuites.Set(KPeapAllowedCipherSuitesDatabaseTableName);
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4911
		}
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4912
		break;
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4913
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4914
	case eap_type_ttls:
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4915
		{
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4916
			dbname.Set(KTtlsDatabaseName);
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4917
			settings.Set(KTtlsDatabaseTableName);
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4918
			usercerts.Set(KTtlsAllowedUserCertsDatabaseTableName);
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4919
			cacerts.Set(KTtlsAllowedCACertsDatabaseTableName);
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4920
			ciphersuites.Set(KTtlsAllowedCipherSuitesDatabaseTableName);
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4921
		}
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4922
		break;
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4923
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4924
#ifdef USE_FAST_EAP_TYPE
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4925
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4926
	case eap_type_fast:
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4927
		{
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4928
			dbname.Set(KFastDatabaseName);
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4929
			settings.Set(KFastGeneralSettingsDBTableName); // This is general settings for FAST.
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4930
			fastSpecialSettings.Set(KFastSpecialSettingsDBTableName);
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4931
			
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4932
			usercerts.Set(KFastAllowedUserCertsDatabaseTableName);
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4933
			cacerts.Set(KFastAllowedCACertsDatabaseTableName);
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4934
			ciphersuites.Set(KFastAllowedCipherSuitesDatabaseTableName);
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4935
		}
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4936
		break;
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4937
#endif
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4938
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4939
	case eap_type_ttls_plain_pap:
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4940
		{
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4941
			dbname.Set( KTtlsDatabaseName );
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4942
			settings.Set( KTtlsDatabaseTableName );
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4943
		}
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4944
	break;
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4945
	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4946
	default:
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4947
		// Should never happen
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4948
		User::Leave(KErrArgument);
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4949
	}	
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4950
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4951
	RDbs session;
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4952
	RDbNamedDatabase database;
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4953
	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4954
	// Connect to the DBMS server.
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4955
	User::LeaveIfError(session.Connect());
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4956
	CleanupClosePushL(session);	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4957
		
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4958
#ifdef SYMBIAN_SECURE_DBMS
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4959
	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4960
	// Create the secure shared database with the specified secure policy.
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4961
	// Database will be created in the data caging path for DBMS (C:\private\100012a5).
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4962
	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4963
	TInt err = database.Create(session, dbname, KSecureUIDFormat);
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4964
	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4965
	if(err == KErrNone)
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4966
	{
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4967
		// Database was created so it was empty. No need for further actions.
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4968
		database.Destroy();
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4969
		CleanupStack::PopAndDestroy();
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4970
		return;
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4971
		
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4972
	} 
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4973
	else if (err != KErrAlreadyExists) 
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4974
	{
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4975
		User::LeaveIfError(err);
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4976
	}
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  4977
	
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4978
	// Database existed, open it.
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4979
	User::LeaveIfError(database.Open(session, dbname, KSecureUIDFormat));
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4980
	CleanupClosePushL(database);
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4981
		
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4982
#else
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4983
	// For non-secured database. The database will be created in the old location (c:\system\data).
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4984
	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4985
	RFs fsSession;		
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4986
	User::LeaveIfError(fsSession.Connect());
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4987
	CleanupClosePushL(fsSession);	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4988
	TInt err = database.Create(fsSession, dbname);
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4989
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4990
	if(err == KErrNone)
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4991
	{
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4992
		// Database was created so it was empty. No need for further actions.
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4993
		database.Destroy();
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4994
		CleanupStack::PopAndDestroy(2); // fsSession, database session
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4995
		return;
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4996
		
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4997
	} 
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4998
	else if (err != KErrAlreadyExists) 
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  4999
	{
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5000
		User::LeaveIfError(err);
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5001
	}
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5002
	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5003
	CleanupStack::PopAndDestroy(); // close fsSession
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5004
	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5005
	User::LeaveIfError(database.Open(session, dbname));
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5006
	CleanupClosePushL(database);		
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5007
	    
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5008
#endif // #ifdef SYMBIAN_SECURE_DBMS
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5009
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5010
	HBufC* buf = HBufC::NewLC(KMaxSqlQueryLength);
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5011
	TPtr sqlStatement = buf->Des();
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5012
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5013
	EAP_TRACE_DEBUG_SYMBIAN(
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5014
		(_L("EapTlsPeapUtils::DeleteConfigurationL - Deleting the tables\n")));
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5015
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5016
	_LIT(KSQL, "SELECT * FROM %S WHERE %S=%d AND %S=%d AND %S=%d");
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5017
	
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5018
	//--------------------- Deletion 1 ----------------------------//
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5019
	
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5020
	// For all EAPs delete the settings table. 
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5021
	// For EAP-FAST, this is delting the general settings table.
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5022
	
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5023
	sqlStatement.Format(KSQL, &settings, 
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5024
		&KServiceType, aIndexType, &KServiceIndex, aIndex, &KTunnelingType, aTunnelingVendorType);
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5025
	
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5026
	// Evaluate view
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5027
	RDbView view;
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5028
	User::LeaveIfError(view.Prepare(database,TDbQuery(sqlStatement), TDbWindow::EUnlimited));
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5029
	CleanupClosePushL(view);
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5030
	User::LeaveIfError(view.EvaluateAll());
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5031
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5032
	// Delete rows
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5033
	if (view.FirstL())
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5034
	{		
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5035
		do {
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5036
			view.DeleteL();
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5037
		} while (view.NextL() != EFalse);
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5038
	}
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5039
	
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5040
	CleanupStack::PopAndDestroy(); // view
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5041
	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5042
	EAP_TRACE_DEBUG_SYMBIAN((_L("EapTlsPeapUtils::DeleteConfigurationL: Deleted %s (general) settings table"), settings.Ptr()));	
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5043
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5044
	//////////////////////////////////////////
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5045
	// This is only for plain PAP settings. //
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5046
	//////////////////////////////////////////
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5047
	if ( aEapVendorType == eap_type_ttls_plain_pap )
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5048
		{
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5049
        CleanupStack::PopAndDestroy(3); // buf, database, session
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5050
        EAP_TRACE_DEBUG_SYMBIAN((_L("EapTlsPeapUtils::DeleteConfigurationL: Return")));	
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5051
        // we return here in case of pap because there is nothing to do else.
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5052
        return;
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5053
		}
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5054
	
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5055
	//--------------------- Deletion 2 ----------------------------//
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5056
	
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5057
	// For all EAPs delte the User cert table
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5058
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5059
//	KSQL2 is "SELECT * FROM %S WHERE %S=%d AND %S=%d AND %S=%d"
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5060
	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5061
	sqlStatement.Format(KSQL, &usercerts, 
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5062
		&KServiceType, aIndexType, &KServiceIndex, aIndex, &KTunnelingType, aTunnelingVendorType);
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5063
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5064
	// Evaluate view
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5065
	
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5066
	User::LeaveIfError(view.Prepare(database,TDbQuery(sqlStatement), TDbWindow::EUnlimited));
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5067
	CleanupClosePushL(view);
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5068
	User::LeaveIfError(view.EvaluateAll());
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5069
	
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5070
	if (view.FirstL())
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5071
	{		
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5072
		do {
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5073
			view.DeleteL();
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5074
		} while (view.NextL() != EFalse);
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5075
	}
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5076
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5077
	CleanupStack::PopAndDestroy(); // view
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5078
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5079
	EAP_TRACE_DEBUG_SYMBIAN((_L("EapTlsPeapUtils::DeleteConfigurationL: Deleted USER certs table")));	
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5080
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5081
	//--------------------- Deletion 3 ----------------------------//
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5082
	
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5083
	// For all EAPs delete the CA cert table
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5084
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5085
//	KSQL3 is "SELECT * FROM %S WHERE %S=%d AND %S=%d AND %S=%d"
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5086
	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5087
	sqlStatement.Format(KSQL, &cacerts, 
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5088
		&KServiceType, aIndexType, &KServiceIndex, aIndex, &KTunnelingType, aTunnelingVendorType);
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5089
	
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5090
	// Evaluate view
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5091
	
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5092
	User::LeaveIfError(view.Prepare(database,TDbQuery(sqlStatement), TDbWindow::EUnlimited));
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5093
	CleanupClosePushL(view);
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5094
	User::LeaveIfError(view.EvaluateAll());
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5095
	
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5096
	if (view.FirstL())
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5097
	{		
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5098
		do {
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5099
			view.DeleteL();
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5100
		} while (view.NextL() != EFalse);
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5101
	}
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5102
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5103
	CleanupStack::PopAndDestroy(); // view
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5104
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5105
	EAP_TRACE_DEBUG_SYMBIAN((_L("EapTlsPeapUtils::DeleteConfigurationL: Deleted CA certs table")));
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5106
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5107
	//--------------------- Deletion 4 ----------------------------//
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5108
	
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5109
	// For all EAPs delete the Cipher suite table
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5110
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5111
//	KSQL4 is "SELECT * FROM %S WHERE %S=%d AND %S=%d AND %S=%d"
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5112
	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5113
	sqlStatement.Format(KSQL, &ciphersuites, 
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5114
		&KServiceType, aIndexType, &KServiceIndex, aIndex, &KTunnelingType, aTunnelingVendorType);
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5115
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5116
	// Evaluate view
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5117
	
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5118
	User::LeaveIfError(view.Prepare(database,TDbQuery(sqlStatement), TDbWindow::EUnlimited));
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5119
	CleanupClosePushL(view);
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5120
	User::LeaveIfError(view.EvaluateAll());
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5121
	
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5122
	if (view.FirstL())
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5123
	{		
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5124
		do {
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5125
			view.DeleteL();
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5126
		} while (view.NextL() != EFalse);
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5127
	}
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5128
	
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5129
	CleanupStack::PopAndDestroy(&view); // Close view
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5130
		
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5131
	EAP_TRACE_DEBUG_SYMBIAN((_L("EapTlsPeapUtils::DeleteConfigurationL: Deleted cipher suits table")));	
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5132
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5133
	
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5134
#ifdef USE_FAST_EAP_TYPE	
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5135
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5136
	if(aEapVendorType == eap_type_fast)
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5137
	{
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5138
		//--------------------- Deletion 5 ----------------------------//
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5139
		
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5140
		// For EAP-FAST, delete the special settings table
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5141
		
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5142
		sqlStatement.Format(KSQL, &fastSpecialSettings, 
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5143
			&KServiceType, aIndexType, &KServiceIndex, aIndex, &KTunnelingType, aTunnelingVendorType);
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5144
	
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5145
		// Evaluate view
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5146
		
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5147
		User::LeaveIfError(view.Prepare(database,TDbQuery(sqlStatement), TDbWindow::EUnlimited));
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5148
		CleanupClosePushL(view);
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5149
		User::LeaveIfError(view.EvaluateAll());
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5150
		
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5151
		if (view.FirstL())
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5152
		{		
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5153
			do {
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5154
				view.DeleteL();
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5155
			} while (view.NextL() != EFalse);
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5156
		}
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5157
		
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5158
		CleanupStack::PopAndDestroy(&view); // Close view
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5159
			
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5160
		EAP_TRACE_DEBUG_SYMBIAN((_L("EapTlsPeapUtils::DeleteConfigurationL: Deleted EAP-FAST Special settings table")));	
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5161
				
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5162
	} // End: if(aEapVendorType == eap_type_fast)
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5163
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5164
#endif // End: #ifdef USE_FAST_EAP_TYPE	
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5165
	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5166
	// Close database
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5167
	CleanupStack::PopAndDestroy(3); // buf, database, session
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5168
	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5169
EAP_TRACE_DEBUG_SYMBIAN((_L("EapTlsPeapUtils::DeleteConfigurationL: End")));	
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5170
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5171
} // EapTlsPeapUtils::DeleteConfigurationL()
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5172
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5173
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5174
// ---------------------------------------------------------
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5175
// EapTlsPeapUtils::AddExtraCertColumnsL()
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5176
// ---------------------------------------------------------
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5177
//
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5178
void EapTlsPeapUtils::AddExtraCertColumnsL(
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5179
	RDbNamedDatabase& aDatabase, 
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5180
	TDesC& aTableName)
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5181
{
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5182
	// Check if the EXTRA cert columns are already in the table.
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5183
	
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5184
	CDbColSet* colSetCertTable = aDatabase.ColSetL(aTableName);
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5185
	User::LeaveIfNull(colSetCertTable);
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5186
	CleanupStack::PushL(colSetCertTable);	
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5187
	
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5188
	EAP_TRACE_DEBUG_SYMBIAN((_L("EapTlsPeapUtils::AddExtraCertColumnsL - Number of columns in %S table before addition=%d\n"),
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5189
	&aTableName, colSetCertTable->Count()));
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5190
		
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5191
	// Check if there is a column for Serial Number, for example.
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5192
	if(colSetCertTable->ColNo(KSerialNumber) == KDbNullColNo)
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5193
	{
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5194
		// The column is missing. Add all the EXTRA columns to the table.
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5195
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5196
		// EXTRA COLUMNS
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5197
		//// NAME //////////////// TYPE //////////// Constant /////////////////////
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5198
		//| ActualSubjectKeyId  | BINARY(20)	| KActualSubjectKeyIdentifier |//
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5199
		//| SubjectName			| VARCHAR(255)  | KSubjectName        |//	
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5200
		//| IssuerName			| VARCHAR(255)  | KIssuerName        |//	
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5201
		//| SerialNumber		| VARCHAR(255)  | KSerialNumber        |//	
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5202
		//| Thumbprint			| BINARY(64)	| KThumbprint        |//	
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5203
		//////////////////////////////////////////////////////////////////////////////
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5204
			
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5205
		EAP_TRACE_DEBUG_SYMBIAN((_L("EapTlsPeapUtils::AddExtraCertColumnsL - EXTRA cert columns missing from the table %S. Adding now.\n"),
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5206
		&aTableName));			
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5207
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5208
		HBufC* buf = HBufC::NewLC(KMaxSqlQueryLength);
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5209
		TPtr sqlStatement = buf->Des();
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5210
		
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5211
		_LIT(KSQLAlterTableForBin, "ALTER TABLE %S ADD %S BINARY(%d)");											 
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5212
	
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5213
		sqlStatement.Format(KSQLAlterTableForBin, &aTableName, 
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5214
			&KActualSubjectKeyIdentifier, KKeyIdentifierLength);
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5215
			
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5216
		User::LeaveIfError( aDatabase.Execute(sqlStatement));
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5217
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5218
		_LIT(KSQLAlterTableForVarChar, "ALTER TABLE %S ADD %S VARCHAR(%d)");											 
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5219
	
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5220
		sqlStatement.Format(KSQLAlterTableForVarChar, &aTableName, 
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5221
			&KSubjectName, KGeneralStringMaxLength);
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5222
			
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5223
		User::LeaveIfError( aDatabase.Execute(sqlStatement));
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5224
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5225
		sqlStatement.Format(KSQLAlterTableForVarChar, &aTableName, 
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5226
			&KIssuerName, KGeneralStringMaxLength);
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5227
			
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5228
		User::LeaveIfError( aDatabase.Execute(sqlStatement));
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5229
	
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5230
		sqlStatement.Format(KSQLAlterTableForVarChar, &aTableName, 
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5231
			&KSerialNumber, KGeneralStringMaxLength);
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5232
			
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5233
		User::LeaveIfError( aDatabase.Execute(sqlStatement));
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5234
	
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5235
		sqlStatement.Format(KSQLAlterTableForBin, &aTableName, 
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5236
			&KThumbprint, KThumbprintMaxLength);
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5237
			
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5238
		User::LeaveIfError( aDatabase.Execute(sqlStatement));
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5239
	
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5240
		CleanupStack::PopAndDestroy( buf ); // Delete buf or sqlStatement
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5241
	}
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5242
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5243
	CleanupStack::PopAndDestroy( colSetCertTable ); // Delete colSetCertTable.
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5244
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5245
	CDbColSet* colSetCertTableAfterAdd = aDatabase.ColSetL(aTableName);
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5246
	User::LeaveIfNull(colSetCertTableAfterAdd);
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5247
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5248
	EAP_TRACE_DEBUG_SYMBIAN((_L("EapTlsPeapUtils::AddExtraCertColumnsL - Number of columns in %S table after addition=%d\n"),
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5249
	&aTableName, colSetCertTableAfterAdd->Count()));
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5250
	
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5251
	delete colSetCertTableAfterAdd;
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5252
} // EapTlsPeapUtils::AddExtraCertColumnsL()
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5253
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5254
	
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5255
// ---------------------------------------------------------
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5256
// EapTlsPeapUtils::GetEapSettingsDataL()
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5257
// ---------------------------------------------------------
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5258
//
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5259
void EapTlsPeapUtils::GetEapSettingsDataL(
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5260
	RDbNamedDatabase& aDatabase,
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5261
	const TIndexType aIndexType,
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5262
	const TInt aIndex,
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5263
	const eap_type_value_e aTunnelingType,
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5264
	const eap_type_value_e aEapType,
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5265
	const TDesC& aDbColumnName,
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5266
	eap_variable_data_c * const aDbColumnValue)
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5267
{
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5268
#ifdef USE_EAP_EXPANDED_TYPES
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5269
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5270
	TUint aTunnelingVendorType = aTunnelingType.get_vendor_type();
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5271
	TUint aEapVendorType = aEapType.get_vendor_type();
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5272
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5273
#else
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5274
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5275
	TUint aTunnelingVendorType = static_cast<TUint>(aTunnelingType);
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5276
	TUint aEapVendorType = static_cast<TUint>(aEapType);
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5277
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5278
#endif //#ifdef USE_EAP_EXPANDED_TYPES
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5279
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5280
	
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5281
	EAP_TRACE_DEBUG_SYMBIAN(
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5282
	(_L("EapTlsPeapUtils::GetEapSettingsDataL-Start- aIndexType=%d, aIndex=%d, Tunneling vendor type=%d, Eap vendor type=%d \n"),
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5283
	aIndexType,aIndex, aTunnelingVendorType, aEapVendorType));
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5284
	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5285
	EAP_TRACE_DEBUG_SYMBIAN(
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5286
	(_L("EapTlsPeapUtils::GetEapSettingsDataL Get Column Name:%S \n"),
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5287
	&aDbColumnName));	
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5288
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5289
	TBufC<KMaxEapDbTableNameLength> generalSettingsTableName;
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5290
	
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5291
#if defined (USE_FAST_EAP_TYPE)	
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5292
	TBufC<KMaxEapDbTableNameLength> specialSettingsTableName;
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5293
#endif
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5294
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5295
	// Set the database table name based on the type
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5296
	switch (aEapVendorType)
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5297
	{
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5298
		case eap_type_tls:
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5299
			generalSettingsTableName = KTlsDatabaseTableName;
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5300
			break;
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5301
		
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5302
		case eap_type_peap:
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5303
			generalSettingsTableName = KPeapDatabaseTableName;	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5304
			break;
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5305
				
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5306
		case eap_type_ttls:
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5307
		case eap_type_ttls_plain_pap:
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5308
			generalSettingsTableName = KTtlsDatabaseTableName;
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5309
			break;
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5310
			
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5311
#if defined (USE_FAST_EAP_TYPE)
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5312
		case eap_type_fast:
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5313
			generalSettingsTableName = KFastGeneralSettingsDBTableName; // General settings
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5314
			specialSettingsTableName = KFastSpecialSettingsDBTableName; // Special settings  for only FAST
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5315
			break;
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5316
#endif // #if defined (USE_FAST_EAP_TYPE)
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5317
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5318
		default:
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5319
			{
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5320
				// Unsupported EAP type		
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5321
				// Should never happen
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5322
				
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5323
				EAP_TRACE_DEBUG_SYMBIAN(
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5324
					(_L("EapTlsPeapUtils::GetEapSettingsDataL: ERROR: Unsupported EAP type=%d"),
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5325
					aEapVendorType));
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5326
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5327
				User::Leave(KErrArgument);
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5328
			}
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5329
	}
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5330
	
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5331
	if(aDbColumnName.Size() <= 0)	
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5332
	{
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5333
		EAP_TRACE_DEBUG_SYMBIAN(
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5334
			(_L("EapTlsPeapUtils::GetEapSettingsDataL: ERROR: No Column Name!\n")));
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5335
		
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5336
		User::Leave(KErrArgument);
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5337
	}
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5338
	
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5339
	// Now do the database query
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5340
	HBufC* buf = HBufC::NewLC(KMaxSqlQueryLength);
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5341
	TPtr sqlStatement = buf->Des();
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5342
	
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5343
	_LIT(KSQLQueryRow, "SELECT %S FROM %S WHERE %S=%d AND %S=%d AND %S=%d");	
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5344
	
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5345
#if defined(USE_FAST_EAP_TYPE)
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5346
	
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5347
	// Unlike other EAP types, EAP-FAST has some settings in special settings table
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5348
	// (in KFastSpecialSettingsDBTableName)
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5349
	
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5350
	if(aEapType == eap_type_fast
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5351
	   && ((aDbColumnName.Compare(cf_str_EAP_FAST_allow_server_authenticated_provisioning_mode_literal) == 0)
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5352
	   || (aDbColumnName.Compare(cf_str_EAP_FAST_allow_server_unauthenticated_provisioning_mode_ADHP_literal) == 0)
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5353
	   || (aDbColumnName.Compare(KFASTWarnADHPNoPAC) == 0)
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5354
	   || (aDbColumnName.Compare(KFASTWarnADHPNoMatchingPAC) == 0)
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5355
	   || (aDbColumnName.Compare(KFASTWarnNotDefaultServer) == 0)
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5356
	   || (aDbColumnName.Compare(KFASTPACGroupImportReferenceCollection) == 0)
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5357
	   || (aDbColumnName.Compare(KFASTPACGroupDBReferenceCollection) == 0)))
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5358
	{
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5359
		EAP_TRACE_DEBUG_SYMBIAN(
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5360
			(_L("EapTlsPeapUtils::GetEapSettingsDataL: This field will be read from EAP-FAST's special table")));
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5361
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5362
		sqlStatement.Format(KSQLQueryRow, &aDbColumnName, &specialSettingsTableName, 
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5363
			&KServiceType, aIndexType, &KServiceIndex, aIndex, &KTunnelingType, aTunnelingVendorType);		
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5364
	}
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5365
	else
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5366
	{
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5367
		sqlStatement.Format(KSQLQueryRow, &aDbColumnName, &generalSettingsTableName, 
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5368
			&KServiceType, aIndexType, &KServiceIndex, aIndex, &KTunnelingType, aTunnelingVendorType);		
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5369
	}
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5370
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5371
#else
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5372
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5373
	{
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5374
		sqlStatement.Format(KSQLQueryRow, &aDbColumnName, &generalSettingsTableName, 
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5375
			&KServiceType, aIndexType, &KServiceIndex, aIndex, &KTunnelingType, aTunnelingVendorType);		
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5376
	}
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5377
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5378
#endif // End: #if defined(USE_FAST_EAP_TYPE)	
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5379
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5380
	EAP_TRACE_DEBUG_SYMBIAN(
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5381
	(_L("EapTlsPeapUtils::GetEapSettingsDataL - SQL query formated OK")));
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5382
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5383
	RDbView view;
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5384
	
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5385
	User::LeaveIfError(view.Prepare(
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5386
			aDatabase, 
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5387
			TDbQuery(sqlStatement), 
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5388
			TDbWindow::EUnlimited,
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5389
			RDbView::EReadOnly));	
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5390
		
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5391
    CleanupStack::PopAndDestroy(buf); // We don't need buf or sqlStatement any more.
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5392
    
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5393
	CleanupClosePushL(view);
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5394
	
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5395
	User::LeaveIfError(view.EvaluateAll());
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5396
	
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5397
	eap_status_e status(eap_status_ok);
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5398
			
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5399
	if (view.FirstL())
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5400
	{
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5401
		view.GetL();
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5402
					
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5403
		switch (view.ColType(KDefaultColumnInView_One))
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5404
		{
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5405
		case EDbColText:				
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5406
			{
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5407
			EAP_TRACE_DEBUG_SYMBIAN(
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5408
					(_L("EapTlsPeapUtils::GetEapSettingsDataL: EDbColText\n")));	
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5409
		    if ( !view.IsColNull( KDefaultColumnInView_One ) )
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5410
		    	{
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5411
			    status = aDbColumnValue->set_copy_of_buffer(
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5412
				    view.ColDes(KDefaultColumnInView_One).Ptr(),
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5413
				    view.ColDes(KDefaultColumnInView_One).Size());
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5414
		    	}
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5415
		    else
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5416
		    	{
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5417
		    	aDbColumnValue->reset();
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5418
		    	}
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5419
     		}
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5420
			break;
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5421
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5422
		case EDbColBinary:
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5423
			{				
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5424
			EAP_TRACE_DEBUG_SYMBIAN(
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5425
					(_L("EapTlsPeapUtils::GetEapSettingsDataL: EDbColBinary\n")));
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5426
			if ( !view.IsColNull( KDefaultColumnInView_One ) )
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5427
		    	{			
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5428
		    	status = aDbColumnValue->set_copy_of_buffer(
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5429
		    		view.ColDes8(KDefaultColumnInView_One).Ptr(),
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5430
					view.ColDes8(KDefaultColumnInView_One).Size());
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5431
		    	}
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5432
		    else
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5433
		    	{
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5434
		    	aDbColumnValue->reset();
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5435
		    	}
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5436
			}
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5437
			break;
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5438
			
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5439
		case EDbColUint32:
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5440
			{
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5441
			EAP_TRACE_DEBUG_SYMBIAN(
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5442
					(_L("EapTlsPeapUtils::GetEapSettingsDataL: EDbColUint32\n")));			
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5443
		    if ( !view.IsColNull( KDefaultColumnInView_One ) )
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5444
		    	{			
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5445
			    TUint value;
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5446
				value = view.ColUint32(KDefaultColumnInView_One);
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5447
				status = aDbColumnValue->set_copy_of_buffer(&value, sizeof(value));
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5448
		    	}
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5449
		    else
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5450
		    	{
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5451
		    	aDbColumnValue->reset();
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5452
		    	}
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5453
		    }
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5454
			break;
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5455
			
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5456
		case EDbColInt64:
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5457
			{
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5458
			EAP_TRACE_DEBUG_SYMBIAN(
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5459
					(_L("EapTlsPeapUtils::GetEapSettingsDataL: EDbColInt64\n")));			
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5460
		    if ( !view.IsColNull( KDefaultColumnInView_One ) )
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5461
		    	{			
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5462
			    TInt64 value;
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5463
				value = view.ColInt64(KDefaultColumnInView_One);
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5464
				status = aDbColumnValue->set_copy_of_buffer(&value, sizeof(value));
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5465
		    	}
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5466
		    else
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5467
		    	{
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5468
		    	aDbColumnValue->reset();
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5469
		    	}
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5470
			}
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5471
			break;
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5472
			
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5473
		case EDbColLongBinary:
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5474
			{
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5475
			// This needs special handling. (readstream). Not needed in this DB yet.	
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5476
				EAP_TRACE_DEBUG_SYMBIAN(
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5477
					(_L("EapTlsPeapUtils::GetEapSettingsDataL: ERROR: EDbColLongBinary not supported in this DB!\n")));	
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5478
				
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5479
				User::Leave(KErrNotSupported);
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5480
			}
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5481
			break;			
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5482
			
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5483
		default:
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5484
			EAP_TRACE_DEBUG_SYMBIAN(
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5485
				(_L("EapTlsPeapUtils::GetEapSettingsDataL: ERROR: Unsupported DB field! \n")));	
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5486
			
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5487
			User::Leave(KErrNotSupported);
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5488
			break;
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5489
		}
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5490
	}
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5491
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5492
	CleanupStack::PopAndDestroy( &view ); // Close view.
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5493
	
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5494
	if (status != eap_status_ok)
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5495
	{
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5496
		EAP_TRACE_DEBUG_SYMBIAN(
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5497
				(_L("EapTlsPeapUtils::GetEapSettingsDataL: Status=%d\n"), status));
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5498
	}
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5499
	
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5500
	EAP_TRACE_DATA_DEBUG_SYMBIAN(("GetEapSettingsDataL:DbColumnValue:",
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5501
		aDbColumnValue->get_data(aDbColumnValue->get_data_length()),
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5502
		aDbColumnValue->get_data_length()));
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5503
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5504
	EAP_TRACE_DEBUG_SYMBIAN(
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5505
		(_L("EapTlsPeapUtils::GetEapSettingsDataL: End \n")));
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5506
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5507
} // EapTlsPeapUtils::GetEapSettingsDataL()
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5508
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5509
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5510
// ---------------------------------------------------------
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5511
// EapTlsPeapUtils::SetEapSettingsDataL()
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5512
// ---------------------------------------------------------
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5513
//
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5514
void EapTlsPeapUtils::SetEapSettingsDataL(
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5515
	RDbNamedDatabase& aDatabase,
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5516
	const TIndexType aIndexType,
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5517
	const TInt aIndex,
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5518
	const eap_type_value_e aTunnelingType,
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5519
	const eap_type_value_e aEapType,
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5520
	const TDesC& aDbColumnName,
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5521
	const eap_variable_data_c * const aDbColumnValue)
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5522
{
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5523
#ifdef USE_EAP_EXPANDED_TYPES
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5524
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5525
	TUint aTunnelingVendorType = aTunnelingType.get_vendor_type();
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5526
	TUint aEapVendorType = aEapType.get_vendor_type();
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5527
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5528
#else
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5529
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5530
	TUint aTunnelingVendorType = static_cast<TUint>(aTunnelingType);
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5531
	TUint aEapVendorType = static_cast<TUint>(aEapType);
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5532
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5533
#endif //#ifdef USE_EAP_EXPANDED_TYPES
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5534
	
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5535
	EAP_TRACE_DEBUG_SYMBIAN(
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5536
	(_L("EapTlsPeapUtils::SetEapSettingsDataL-Start- aIndexType=%d, aIndex=%d, Tunneling vendor type=%d, Eap vendor type=%d \n"),
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5537
	aIndexType,aIndex, aTunnelingVendorType, aEapVendorType));
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5538
	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5539
	EAP_TRACE_DEBUG_SYMBIAN(
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5540
	(_L("EapTlsPeapUtils::SetEapSettingsDataL Set Column Name:%S \n"),
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5541
	&aDbColumnName));	
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5542
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5543
	EAP_TRACE_DATA_DEBUG_SYMBIAN(("SetEapSettingsDataL:DbColumnValue:",
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5544
		aDbColumnValue->get_data(aDbColumnValue->get_data_length()),
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5545
		aDbColumnValue->get_data_length()));
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5546
	
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5547
	TBufC<KMaxEapDbTableNameLength> generalSettingsTableName;
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5548
	
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5549
#if defined (USE_FAST_EAP_TYPE)	
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5550
	TBufC<KMaxEapDbTableNameLength> specialSettingsTableName;
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5551
#endif
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5552
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5553
	// Set the database table name based on the type
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5554
	switch (aEapVendorType)
45
bad0cc58d154 Revision: 201029
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
  5555
	{
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5556
		case eap_type_tls:
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5557
			generalSettingsTableName = KTlsDatabaseTableName;	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5558
			break;
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5559
		
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5560
		case eap_type_peap:
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5561
			generalSettingsTableName = KPeapDatabaseTableName;
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5562
			break;
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5563
				
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5564
		case eap_type_ttls:
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5565
		case eap_type_ttls_plain_pap:
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5566
			generalSettingsTableName = KTtlsDatabaseTableName;
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5567
			break;
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5568
			
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5569
#if defined (USE_FAST_EAP_TYPE)
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5570
		case eap_type_fast:
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5571
			generalSettingsTableName = KFastGeneralSettingsDBTableName; // General settings
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5572
			specialSettingsTableName = KFastSpecialSettingsDBTableName; // Special settings  for only FAST
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5573
			break;
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5574
#endif // #if defined (USE_FAST_EAP_TYPE)
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5575
			
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5576
		default:
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5577
			{
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5578
				// Unsupported EAP type		
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5579
				// Should never happen
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5580
				
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5581
				EAP_TRACE_DEBUG_SYMBIAN(
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5582
					(_L("EapTlsPeapUtils::SetEapSettingsDataL: ERROR: Unsupported EAP type=%d"),
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5583
					aEapVendorType));
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5584
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5585
				User::Leave(KErrArgument);
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5586
			}
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5587
	}
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5588
	
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5589
	if(aDbColumnName.Size() <= 0)	
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5590
	{
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5591
		EAP_TRACE_DEBUG_SYMBIAN(
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5592
			(_L("EapTlsPeapUtils::SetEapSettingsDataL: ERROR: No Column Name!\n")));
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5593
		
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5594
		User::Leave(KErrArgument);
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5595
	}
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5596
	
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5597
	// Now do the database query
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5598
	HBufC* buf = HBufC::NewLC(KMaxSqlQueryLength);
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5599
	TPtr sqlStatement = buf->Des();
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5600
	
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5601
	_LIT(KSQLQueryRow, "SELECT %S FROM %S WHERE %S=%d AND %S=%d AND %S=%d");	
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5602
	
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5603
#if defined(USE_FAST_EAP_TYPE)
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5604
	
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5605
	// Unlike other EAP types, EAP-FAST has some settings in special settings table
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5606
	// (in KFastSpecialSettingsDBTableName)
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5607
	
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5608
	if(aEapType == eap_type_fast
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5609
	   && ((aDbColumnName.Compare(cf_str_EAP_FAST_allow_server_authenticated_provisioning_mode_literal) == 0)
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5610
	   || (aDbColumnName.Compare(cf_str_EAP_FAST_allow_server_unauthenticated_provisioning_mode_ADHP_literal) == 0)
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5611
	   || (aDbColumnName.Compare(KFASTWarnADHPNoPAC) == 0)
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5612
	   || (aDbColumnName.Compare(KFASTWarnADHPNoMatchingPAC) == 0)
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5613
	   || (aDbColumnName.Compare(KFASTWarnNotDefaultServer) == 0)
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5614
	   || (aDbColumnName.Compare(KFASTPACGroupImportReferenceCollection) == 0)
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5615
	   || (aDbColumnName.Compare(KFASTPACGroupDBReferenceCollection) == 0)))
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5616
	{
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5617
		EAP_TRACE_DEBUG_SYMBIAN(
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5618
			(_L("EapTlsPeapUtils::SetEapSettingsDataL: This field will be read from EAP-FAST's special table")));
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5619
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5620
		sqlStatement.Format(KSQLQueryRow, &aDbColumnName, &specialSettingsTableName, 
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5621
			&KServiceType, aIndexType, &KServiceIndex, aIndex, &KTunnelingType, aTunnelingVendorType);		
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5622
	}
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5623
	else
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5624
	{
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5625
		sqlStatement.Format(KSQLQueryRow, &aDbColumnName, &generalSettingsTableName, 
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5626
			&KServiceType, aIndexType, &KServiceIndex, aIndex, &KTunnelingType, aTunnelingVendorType);		
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5627
	}
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5628
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5629
#else
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5630
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5631
	{
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5632
		sqlStatement.Format(KSQLQueryRow, &aDbColumnName, &generalSettingsTableName, 
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5633
			&KServiceType, aIndexType, &KServiceIndex, aIndex, &KTunnelingType, aTunnelingVendorType);		
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5634
	}
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5635
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5636
#endif // End: #if defined(USE_FAST_EAP_TYPE)	
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5637
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5638
	EAP_TRACE_DEBUG_SYMBIAN(
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5639
	(_L("EapTlsPeapUtils::SetEapSettingsDataL - SQL query formated OK")));
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5640
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5641
	RDbView view;
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5642
	
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5643
	User::LeaveIfError(view.Prepare(
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5644
			aDatabase, 
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5645
			TDbQuery(sqlStatement), 
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5646
			TDbWindow::EUnlimited,
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5647
			RDbView::EUpdatable));
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5648
	
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5649
	CleanupStack::PopAndDestroy(buf); // We don't need buf or sqlStatement any more.
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5650
   
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5651
	CleanupClosePushL(view);
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5652
	
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5653
	User::LeaveIfError(view.EvaluateAll());
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5654
	
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5655
	if (view.FirstL())
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5656
	{
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5657
		view.UpdateL(); // Here it is update.
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5658
				
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5659
		if(view.ColCount() == KDefaultColumnInView_One)
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5660
		{
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5661
			// There should be one column (only one) with the specified column name.
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5662
			
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5663
			HBufC8* dbColVal8 = HBufC8::NewLC(aDbColumnValue->get_data_length());			
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5664
			TPtr8 dbColValPtr8 = dbColVal8->Des();
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5665
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5666
			dbColValPtr8.Copy(
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5667
				aDbColumnValue->get_data( aDbColumnValue->get_data_length() ),
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5668
				aDbColumnValue->get_data_length() );
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5669
			
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5670
			switch (view.ColType(KDefaultColumnInView_One))
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5671
			{
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5672
			case EDbColText:				
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5673
				{
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5674
					TPtr dbColValPtr(0,dbColValPtr8.Size());
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5675
					dbColValPtr.Copy(dbColValPtr8);
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5676
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5677
					view.SetColL(KDefaultColumnInView_One, dbColValPtr);
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5678
				}
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5679
				break;
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5680
	
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5681
			case EDbColBinary:
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5682
				{
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5683
					view.SetColL(KDefaultColumnInView_One, dbColValPtr8);
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5684
				}
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5685
				break;
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5686
				
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5687
			case EDbColUint32:
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5688
				{
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5689
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5690
#if defined (USE_FAST_EAP_TYPE)
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5691
					
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5692
					EAP_TRACE_DEBUG_SYMBIAN(
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5693
							(_L("eap_am_type_tls_peap_symbian_c::authentication_finishedL WARNING, HACK to set Unauth Prov mode set to default (NO)!")));					
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5694
	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5695
					view.SetColL(KDefaultColumnInView_One, EFASTUnauthProvModeAllowedNo);
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5696
				
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5697
#endif // End: #if defined (USE_FAST_EAP_TYPE)
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5698
				}
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5699
				break;
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5700
				
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5701
			case EDbColInt64:
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5702
				{
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5703
					// Do some lexical analysis to get TInt64 value here and set it in DB.
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5704
					
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5705
					EAP_TRACE_DEBUG_SYMBIAN(
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5706
						(_L("EapTlsPeapUtils::SetEapSettingsDataL: ERROR: EDbColInt64 not supported here yet!\n")));	
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5707
					
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5708
					User::Leave(KErrNotSupported);					
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5709
				}
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5710
				break;
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5711
				
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5712
			case EDbColLongBinary:
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5713
				{
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5714
					// This needs special handling. (readstream). Not needed in this DB yet.	
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5715
					EAP_TRACE_DEBUG_SYMBIAN(
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5716
						(_L("EapTlsPeapUtils::SetEapSettingsDataL: ERROR: EDbColLongBinary not supported in this DB!\n")));	
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5717
					
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5718
					User::Leave(KErrNotSupported);
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5719
				}
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5720
				break;			
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5721
				
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5722
			default:
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5723
				EAP_TRACE_DEBUG_SYMBIAN(
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5724
					(_L("EapTlsPeapUtils::SetEapSettingsDataL: ERROR: Unsupported DB field! \n")));	
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5725
				
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5726
				User::Leave(KErrNotSupported);
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5727
				break;
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5728
			}
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5729
			
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5730
			CleanupStack::PopAndDestroy(dbColVal8);		
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5731
			
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5732
		} // End: if(view.ColCount() == KDefaultColumnInView_One)
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5733
		else
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5734
		{
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5735
			EAP_TRACE_DEBUG_SYMBIAN(
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5736
				(_L("EapTlsPeapUtils::SetEapSettingsDataL: ERROR: Too many columns in DB view, count=%d \n"),
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5737
				view.ColCount()));	
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5738
			
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5739
			User::Leave(KErrNotFound);
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5740
		}
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5741
	} // End: if (view.FirstL())
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5742
	
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5743
	// Now it should go to the DB.
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5744
	view.PutL();	
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5745
	
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5746
	CleanupStack::PopAndDestroy( &view ); // Close view.		
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5747
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5748
	EAP_TRACE_DEBUG_SYMBIAN(
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5749
		(_L("EapTlsPeapUtils::SetEapSettingsDataL: End \n")));	
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5750
}
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5751
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5752
/*
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5753
 * Alter table for added column, if doesn't exist
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5754
 * 
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5755
 */
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5756
void EapTlsPeapUtils::AlterTableL(
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5757
		RDbNamedDatabase& aDb,
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5758
		TAlterTableCmd aCmd,
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5759
		const TDesC& aTableName,
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5760
		const TDesC& aColumnName,
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5761
		const TDesC& aColumnDef )
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5762
		{
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5763
	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5764
		CDbColSet* colSet = aDb.ColSetL( aTableName );
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5765
		User::LeaveIfNull( colSet );
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5766
		CleanupStack::PushL( colSet );	
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5767
			
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5768
		EAP_TRACE_DEBUG_SYMBIAN( ( _L(
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5769
	        "EapTlsPeapUtils::AlterTableL() \
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5770
	        Number of columns in %S table is %d.\n" ),
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5771
			&aTableName, colSet->Count() ) );
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5772
		
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5773
	    if ( aCmd == EAddColumn )
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5774
	    	{
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5775
	    	// Check if there is a target column
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5776
	    	if( colSet->ColNo( aColumnName ) != KDbNullColNo )
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5777
	    		{
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5778
	    		EAP_TRACE_DEBUG_SYMBIAN( ( _L(
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5779
	   		        "EapTlsPeapUtils::AlterTableL() \
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5780
	   		        Column %S exists already in table %S.\n" ),
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5781
	    			&aColumnName, &aTableName ) );
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5782
	    		CleanupStack::PopAndDestroy( colSet );
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5783
	    		return;
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5784
	    		}
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5785
	    	}
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5786
	    else
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5787
	    	{
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5788
	    	// Check if there is a target column
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5789
	    	if( colSet->ColNo( aColumnName ) == KDbNullColNo )
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5790
	    		{
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5791
	    		EAP_TRACE_DEBUG_SYMBIAN( ( _L(
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5792
	   		        "EapTlsPeapUtils::AlterTableL() \
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5793
	   		        Column %S does not exists already in table %S.\n" ),
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5794
	    			&aColumnName, &aTableName ) );
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5795
	    		CleanupStack::PopAndDestroy( colSet );
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5796
	    		return;
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5797
	    		}
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5798
	    	}
46
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5799
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5800
		HBufC* buf = HBufC::NewLC( KMaxSqlQueryLength );
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5801
		TPtr sqlStatement = buf->Des();
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5802
			
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5803
		_LIT( KSqlAddCol, "ALTER TABLE %S ADD %S %S" );
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5804
		_LIT( KSqlRemoveCol, "ALTER TABLE %S DROP %S" );
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5805
		
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5806
		if ( aCmd == EAddColumn )
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5807
			{
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5808
			sqlStatement.Format( KSqlAddCol, &aTableName, 
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5809
			    &aColumnName, &aColumnDef );
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5810
			}
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5811
		else
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5812
			{
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5813
			sqlStatement.Format( KSqlRemoveCol, &aTableName, 
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5814
		        &aColumnName );
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5815
			}
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5816
			
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5817
		EAP_TRACE_DEBUG_SYMBIAN( ( _L(
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5818
			"EapTlsPeapUtils::AlterTableL(): sqlStatement=%S\n"),
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5819
			&sqlStatement ) );
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5820
		
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5821
		User::LeaveIfError( aDb.Execute( sqlStatement ) );		
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5822
		CleanupStack::PopAndDestroy( buf );
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5823
		CleanupStack::PopAndDestroy( colSet );
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5824
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5825
		CDbColSet* alteredColSet = aDb.ColSetL( aTableName );
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5826
		User::LeaveIfNull( alteredColSet );
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5827
		EAP_TRACE_DEBUG_SYMBIAN( ( _L(
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5828
	        "EapTlsPeapUtils::AlterTableL() \
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5829
	        Number of columns in %S table after adding is %d.\n" ),
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5830
			&aTableName, alteredColSet->Count() ) );
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5831
		delete alteredColSet;
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5832
			
c74b3d9f6b9e Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 45
diff changeset
  5833
		} // EapTlsPeapUtils::AlterTableL()
0
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5834
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5835
// End of file
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5836
c8830336c852 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  5837