32 |
32 |
33 #include "EapMsChapV2DbUtils.h" |
33 #include "EapMsChapV2DbUtils.h" |
34 #include "EapMsChapV2DbDefaults.h" |
34 #include "EapMsChapV2DbDefaults.h" |
35 #include "EapMsChapV2DbParameterNames.h" |
35 #include "EapMsChapV2DbParameterNames.h" |
36 |
36 |
37 #include "eap_am_trace_symbian.h" |
37 #include <EapTraceSymbian.h> |
|
38 #include "EapPluginTools.h" |
38 |
39 |
39 const TUint KMaxSqlQueryLength = 512; |
40 const TUint KMaxSqlQueryLength = 512; |
40 const TInt KMicroSecsInAMinute = 60000000; // 60000000 micro seconds is 1 minute. |
41 const TInt KMicroSecsInAMinute = 60000000; // 60000000 micro seconds is 1 minute. |
41 |
42 |
42 // ================= MEMBER FUNCTIONS ======================= |
43 // ================= MEMBER FUNCTIONS ======================= |
43 |
44 |
44 void EapMsChapV2DbUtils::OpenDatabaseL(RDbNamedDatabase& aDatabase, RDbs& aSession, const TIndexType aIndexType, |
45 void EapMsChapV2DbUtils::OpenDatabaseL( |
45 const TInt aIndex, const eap_type_value_e aTunnelingType) |
46 RDbNamedDatabase& aDatabase, |
|
47 RFs& aFileServerSession, |
|
48 const TIndexType aIndexType, |
|
49 const TInt aIndex, |
|
50 const eap_type_value_e aTunnelingType) |
46 { |
51 { |
47 #ifdef USE_EAP_EXPANDED_TYPES |
52 EAP_TRACE_DEBUG_SYMBIAN( |
48 |
53 (_L("EapMsChapV2DbUtils::OpenDatabaseL(): - Start - aIndexType=%d, aIndex=%d, aTunnelingType=0xfe%06x%08x\n"), |
49 TUint aTunnelingVendorType = aTunnelingType.get_vendor_type(); |
54 aIndexType, |
50 |
55 aIndex, |
51 #else |
56 aTunnelingType.get_vendor_id(), |
52 |
57 aTunnelingType.get_vendor_type())); |
53 TUint aTunnelingVendorType = static_cast<TUint>(aTunnelingType); |
58 |
54 |
59 EAP_TRACE_RETURN_STRING_SYMBIAN(_L("returns: EapMsChapV2DbUtils::OpenDatabaseL()\n")); |
55 #endif //#ifdef USE_EAP_EXPANDED_TYPES |
|
56 |
|
57 EAP_TRACE_DEBUG_SYMBIAN((_L("EapMsChapV2DbUtils::OpenDatabaseL -Start- aIndexType=%d, aIndex=%d, aTunnelingVendorType=%d \n"), |
|
58 aIndexType,aIndex,aTunnelingVendorType) ); |
|
59 |
60 |
60 // 1. Open/create a database |
61 // 1. Open/create a database |
61 |
62 |
62 // Connect to the DBMS server. |
63 TInt error(KErrNone); |
63 User::LeaveIfError(aSession.Connect()); |
64 TFileName aPrivateDatabasePathName; |
64 CleanupClosePushL(aSession); |
65 |
65 // aSession and aDatabase are pushed to the cleanup stack even though they may be member |
66 EapPluginTools::CreateDatabaseLC( |
66 // variables of the calling class and would be closed in the destructor anyway. This ensures |
67 aDatabase, |
67 // that if they are not member variables they will be closed. Closing the handle twice |
68 aFileServerSession, |
68 // does no harm. |
69 error, |
69 |
70 KEapMsChapV2DatabaseName, |
70 #ifdef SYMBIAN_SECURE_DBMS |
71 aPrivateDatabasePathName); |
71 |
72 |
72 // Create the secure shared database with the specified secure policy. |
73 if(error == KErrNone) |
73 // Database will be created in the data caging path for DBMS (C:\private\100012a5). |
|
74 |
|
75 TInt err = aDatabase.Create(aSession, KDatabaseName, KSecureUIDFormat); |
|
76 |
|
77 EAP_TRACE_DEBUG_SYMBIAN((_L("EapMsChapV2DbUtils::OpenDatabaseL - Created Secure DB for eapmsmhapv2.dat. err=%d\n"), err)); |
|
78 |
|
79 |
|
80 if(err == KErrNone) |
|
81 { |
74 { |
82 aDatabase.Close(); |
75 aDatabase.Close(); |
83 |
76 } |
84 } else if (err != KErrAlreadyExists) |
77 else if (error != KErrAlreadyExists) |
85 { |
78 { |
86 User::LeaveIfError(err); |
79 User::LeaveIfError(error); |
87 } |
80 } |
88 |
81 |
89 User::LeaveIfError(aDatabase.Open(aSession, KDatabaseName, KSecureUIDFormat)); |
82 EAP_TRACE_DEBUG_SYMBIAN((_L("EapMsChapV2DbUtils::OpenDatabaseL(): - calls aDatabase.Open()\n"))); |
90 CleanupClosePushL(aDatabase); |
83 |
91 |
84 error = aDatabase.Open(aFileServerSession, aPrivateDatabasePathName); |
92 #else |
85 |
93 // For non-secured database. The database will be created in the old location (c:\system\data). |
86 EAP_TRACE_DEBUG_SYMBIAN((_L("EapMsChapV2DbUtils::OpenDatabaseL(): - Opened private DB for EAP-MsChapV2. error=%d\n"), error)); |
94 |
87 |
95 RFs fsSession; |
88 User::LeaveIfError(error); |
96 User::LeaveIfError(fsSession.Connect()); |
89 |
97 CleanupClosePushL(fsSession); |
90 // 2. Create the MSCHAPv2 table to database (ignore error if database exists) |
98 TInt err = aDatabase.Create(fsSession, KDatabaseName); |
91 // Table columns: |
99 |
92 //// NAME ///////////////////////////////////////////////// TYPE ////////////// Constant ///////// |
100 EAP_TRACE_DEBUG_SYMBIAN((_L("EapMsChapV2DbUtils::OpenDatabaseL - Created Non-Secure DB for eapmsmhapv2.dat. err=%d\n"), err)); |
93 //| ServiceType | UNSIGNED INTEGER | KServiceType |// |
101 |
94 //| ServiceIndex | UNSIGNED INTEGER | KServiceIndex |// |
102 |
95 //| TunnelingTypeVendorId | UNSIGNED INTEGER | KTunnelingTypeVendorId |// |
103 if(err == KErrNone) |
96 //| TunnelingType | UNSIGNED INTEGER | KTunnelingType |// |
104 { |
97 //| EAP_MSCHAPV2_password_prompt | UNSIGNED INTEGER | cf_str_EAP_MSCHAPV2_password_prompt_literal |// |
105 aDatabase.Close(); |
98 //| EAP_MSCHAPV2_username | VARCHAR(255) | cf_str_EAP_MSCHAPV2_username_literal |// |
106 |
99 //| EAP_MSCHAPV2_password | VARCHAR(255) | cf_str_EAP_MSCHAPV2_password_literal |// |
107 } else if (err != KErrAlreadyExists) |
100 //| EAP_MSCHAPv2_max_session_validity_time | BIGINT | cf_str_EAP_MSCHAPv2_max_session_validity_time_literal |// |
108 { |
101 //| EAP_MSCHAPv2_last_full_authentication_time | BIGINT | KMSCHAPv2LastFullAuthTime |// |
109 User::LeaveIfError(err); |
102 ////////////////////////////////////////////////////////////////////////////////////////////////// |
110 } |
103 |
111 CleanupStack::PopAndDestroy(); // close fsSession |
104 EAP_TRACE_DEBUG_SYMBIAN((_L("EapMsChapV2DbUtils::OpenDatabaseL(): calls HBufC::NewLC()\n"))); |
112 |
|
113 User::LeaveIfError(aDatabase.Open(aSession, KDatabaseName)); |
|
114 CleanupClosePushL(aDatabase); |
|
115 |
|
116 #endif // #ifdef SYMBIAN_SECURE_DBMS |
|
117 |
|
118 // 2. Create the MSCHAPv2 table to database (ignore error if database exists) |
|
119 // Table columns: |
|
120 //// NAME ///////////////////////////////////////////////// TYPE ////////////// Constant ///////// |
|
121 //| ServiceType | UNSIGNED INTEGER | KServiceType |// |
|
122 //| ServiceIndex | UNSIGNED INTEGER | KServiceIndex |// |
|
123 //| TunnelingType | UNSIGNED INTEGER | KTunnelingType |// |
|
124 //| EAP_MSCHAPV2_password_prompt | UNSIGNED INTEGER | cf_str_EAP_MSCHAPV2_password_prompt_literal |// |
|
125 //| EAP_MSCHAPV2_username | VARCHAR(255) | cf_str_EAP_MSCHAPV2_username_literal |// |
|
126 //| EAP_MSCHAPV2_password | VARCHAR(255) | cf_str_EAP_MSCHAPV2_password_literal |// |
|
127 //| EAP_MSCHAPv2_max_session_validity_time | BIGINT | cf_str_EAP_MSCHAPv2_max_session_validity_time_literal |// |
|
128 //| EAP_MSCHAPv2_last_full_authentication_time | BIGINT | KMSCHAPv2LastFullAuthTime |// |
|
129 ////////////////////////////////////////////////////////////////////////////////////////////////// |
|
130 |
105 |
131 HBufC* buf = HBufC::NewLC(KMaxSqlQueryLength); |
106 HBufC* buf = HBufC::NewLC(KMaxSqlQueryLength); |
132 TPtr sqlStatement = buf->Des(); |
107 TPtr sqlStatement = buf->Des(); |
133 |
108 |
134 _LIT(KSQLCreateTable1, "CREATE TABLE %S (%S UNSIGNED INTEGER, \ |
109 _LIT(KSQLCreateTable1, "CREATE TABLE %S \ |
135 %S UNSIGNED INTEGER, \ |
110 (%S UNSIGNED INTEGER, \ |
136 %S UNSIGNED INTEGER, \ |
111 %S UNSIGNED INTEGER, \ |
137 %S UNSIGNED INTEGER, \ |
112 %S UNSIGNED INTEGER, \ |
138 %S VARCHAR(255), \ |
113 %S UNSIGNED INTEGER, \ |
139 %S VARCHAR(255), \ |
114 %S UNSIGNED INTEGER, \ |
140 %S BIGINT, \ |
115 %S VARCHAR(255), \ |
141 %S BIGINT)"); |
116 %S VARCHAR(255), \ |
|
117 %S BIGINT, \ |
|
118 %S BIGINT)"); |
|
119 |
|
120 EAP_TRACE_DEBUG_SYMBIAN((_L("EapMsChapV2DbUtils::OpenDatabaseL(): calls sqlStatement.Format()\n"))); |
142 |
121 |
143 sqlStatement.Format(KSQLCreateTable1, |
122 sqlStatement.Format(KSQLCreateTable1, |
144 &KMsChapV2TableName, |
123 &KMsChapV2TableName, |
145 &KServiceType, |
124 &KServiceType, |
146 &KServiceIndex, |
125 &KServiceIndex, |
|
126 &KTunnelingTypeVendorId, |
147 &KTunnelingType, |
127 &KTunnelingType, |
148 &cf_str_EAP_MSCHAPV2_password_prompt_literal, |
128 &cf_str_EAP_MSCHAPV2_password_prompt_literal, |
149 &cf_str_EAP_MSCHAPV2_username_literal, |
129 &cf_str_EAP_MSCHAPV2_username_literal, |
150 &cf_str_EAP_MSCHAPV2_password_literal, |
130 &cf_str_EAP_MSCHAPV2_password_literal, |
151 &cf_str_EAP_MSCHAPv2_max_session_validity_time_literal, |
131 &cf_str_EAP_MSCHAPv2_max_session_validity_time_literal, |
152 &KMSCHAPv2LastFullAuthTime); |
132 &KMSCHAPv2LastFullAuthTime); |
153 |
133 |
154 err = aDatabase.Execute(sqlStatement); |
134 EAP_TRACE_DEBUG_SYMBIAN((_L("EapMsChapV2DbUtils::OpenDatabaseL(): calls aDatabase.Execute()\n"))); |
155 if (err != KErrNone && err != KErrAlreadyExists) |
135 |
156 { |
136 error = aDatabase.Execute(sqlStatement); |
157 User::Leave(err); |
137 if (error != KErrNone && error != KErrAlreadyExists) |
|
138 { |
|
139 EAP_TRACE_DEBUG_SYMBIAN((_L("ERROR: EapMsChapV2DbUtils::OpenDatabaseL(): aDatabase.Execute() error=%d\n"), |
|
140 error)); |
|
141 |
|
142 User::Leave(error); |
158 } |
143 } |
159 |
144 |
160 // 4. Check if database table contains a row for this service type and id |
145 // 4. Check if database table contains a row for this service type and id |
161 |
146 |
162 _LIT(KSQLQueryRow, "SELECT %S FROM %S WHERE %S=%d AND %S=%d AND %S=%d"); |
147 EAP_TRACE_DEBUG_SYMBIAN((_L("EapMsChapV2DbUtils::OpenDatabaseL(): calls sqlStatement.Format()\n"))); |
|
148 |
|
149 _LIT(KSQLQueryRow, "SELECT %S FROM %S WHERE %S=%d AND %S=%d AND %S=%d AND %S=%d"); |
163 sqlStatement.Format(KSQLQueryRow, |
150 sqlStatement.Format(KSQLQueryRow, |
164 &cf_str_EAP_MSCHAPV2_username_literal, |
151 &cf_str_EAP_MSCHAPV2_username_literal, |
165 &KMsChapV2TableName, |
152 &KMsChapV2TableName, |
166 &KServiceType, |
153 &KServiceType, |
167 aIndexType, |
154 aIndexType, |
168 &KServiceIndex, |
155 &KServiceIndex, |
169 aIndex, |
156 aIndex, |
170 &KTunnelingType, |
157 &KTunnelingTypeVendorId, |
171 aTunnelingVendorType); |
158 aTunnelingType.get_vendor_id(), |
172 |
159 &KTunnelingType, |
|
160 aTunnelingType.get_vendor_type()); |
|
161 |
173 RDbView view; |
162 RDbView view; |
174 User::LeaveIfError(view.Prepare(aDatabase, TDbQuery(sqlStatement), TDbWindow::EUnlimited)); |
163 |
|
164 EAP_TRACE_DEBUG_SYMBIAN((_L("EapMsChapV2DbUtils::OpenDatabaseL(): calls view.Prepare()\n"))); |
|
165 |
|
166 error = view.Prepare(aDatabase, TDbQuery(sqlStatement), TDbWindow::EUnlimited); |
|
167 |
|
168 EAP_TRACE_DEBUG_SYMBIAN((_L("EapMsChapV2DbUtils::OpenDatabaseL(): view.Prepare() error=%d\n"), |
|
169 error)); |
|
170 |
|
171 User::LeaveIfError(error); |
175 // View must be closed when no longer needed |
172 // View must be closed when no longer needed |
176 CleanupClosePushL(view); |
173 CleanupClosePushL(view); |
177 User::LeaveIfError(view.EvaluateAll()); |
174 |
|
175 EAP_TRACE_DEBUG_SYMBIAN((_L("EapMsChapV2DbUtils::OpenDatabaseL(): calls view.EvaluateAll()\n"))); |
|
176 |
|
177 error = view.EvaluateAll(); |
|
178 |
|
179 EAP_TRACE_DEBUG_SYMBIAN((_L("EapMsChapV2DbUtils::OpenDatabaseL(): view.EvaluateAll() error=%d\n"), |
|
180 error)); |
|
181 |
|
182 User::LeaveIfError(error); |
178 |
183 |
179 // 5. If row is not found then add it |
184 // 5. If row is not found then add it |
180 |
185 |
|
186 EAP_TRACE_DEBUG_SYMBIAN((_L("EapMsChapV2DbUtils::OpenDatabaseL(): calls view.CountL()\n"))); |
|
187 |
181 TInt rows = view.CountL(); |
188 TInt rows = view.CountL(); |
182 CleanupStack::PopAndDestroy(); // view |
189 |
|
190 EAP_TRACE_DEBUG_SYMBIAN((_L("EapMsChapV2DbUtils::OpenDatabaseL(): view.CountL() rows=%d\n"), |
|
191 rows)); |
|
192 |
|
193 CleanupStack::PopAndDestroy(&view); |
183 if (rows == 0) |
194 if (rows == 0) |
184 { |
195 { |
185 _LIT(KSQLInsert, "SELECT * FROM %S"); |
196 _LIT(KSQLInsert, "SELECT * FROM %S"); |
186 sqlStatement.Format(KSQLInsert, &KMsChapV2TableName); |
197 sqlStatement.Format(KSQLInsert, &KMsChapV2TableName); |
187 |
198 |
188 view.Prepare(aDatabase, TDbQuery(sqlStatement), TDbWindow::EUnlimited, RDbView::EInsertOnly); |
199 EAP_TRACE_DEBUG_SYMBIAN((_L("EapMsChapV2DbUtils::OpenDatabaseL(): calls view.Prepare()\n"))); |
|
200 |
|
201 error = view.Prepare(aDatabase, TDbQuery(sqlStatement), TDbWindow::EUnlimited, RDbView::EInsertOnly); |
|
202 |
|
203 EAP_TRACE_DEBUG_SYMBIAN((_L("EapMsChapV2DbUtils::OpenDatabaseL(): view.Prepare() error=%d\n"), |
|
204 error)); |
|
205 |
|
206 User::LeaveIfError(error); |
189 CleanupClosePushL(view); |
207 CleanupClosePushL(view); |
190 |
208 |
191 // Get column set so we get the correct column numbers |
209 // Get column set so we get the correct column numbers |
|
210 EAP_TRACE_DEBUG_SYMBIAN((_L("EapMsChapV2DbUtils::OpenDatabaseL(): calls view.ColSetL()\n"))); |
|
211 |
192 CDbColSet* colSet = view.ColSetL(); |
212 CDbColSet* colSet = view.ColSetL(); |
193 CleanupStack::PushL(colSet); |
213 CleanupStack::PushL(colSet); |
194 |
214 |
|
215 EAP_TRACE_DEBUG_SYMBIAN((_L("EapMsChapV2DbUtils::OpenDatabaseL(): calls view.InsertL()\n"))); |
|
216 |
195 view.InsertL(); |
217 view.InsertL(); |
196 view.SetColL(colSet->ColNo(KServiceType), static_cast<TInt> (aIndexType)); |
218 view.SetColL(colSet->ColNo(KServiceType), static_cast<TInt> (aIndexType)); |
197 view.SetColL(colSet->ColNo(KServiceIndex), aIndex); |
219 view.SetColL(colSet->ColNo(KServiceIndex), aIndex); |
198 view.SetColL(colSet->ColNo(KTunnelingType), aTunnelingVendorType); |
220 view.SetColL(colSet->ColNo(KTunnelingTypeVendorId), aTunnelingType.get_vendor_id()); |
199 |
221 view.SetColL(colSet->ColNo(KTunnelingType), aTunnelingType.get_vendor_type()); |
200 view.SetColL(colSet->ColNo(cf_str_EAP_MSCHAPV2_password_prompt_literal), default_EAP_MSCHAPV2_password_prompt); |
222 |
201 |
223 view.SetColL(colSet->ColNo(cf_str_EAP_MSCHAPV2_password_prompt_literal), default_EAP_password_prompt); |
202 view.SetColL(colSet->ColNo(cf_str_EAP_MSCHAPV2_username_literal), default_EAP_MSCHAPV2_username); |
224 |
203 |
225 view.SetColL(colSet->ColNo(cf_str_EAP_MSCHAPV2_username_literal), default_EAP_username); |
204 view.SetColL(colSet->ColNo(cf_str_EAP_MSCHAPV2_password_literal), default_EAP_MSCHAPV2_password); |
226 |
|
227 view.SetColL(colSet->ColNo(cf_str_EAP_MSCHAPV2_password_literal), default_EAP_password); |
205 |
228 |
206 view.SetColL(colSet->ColNo(cf_str_EAP_MSCHAPv2_max_session_validity_time_literal), default_MaxSessionTime); |
229 view.SetColL(colSet->ColNo(cf_str_EAP_MSCHAPv2_max_session_validity_time_literal), default_MaxSessionTime); |
207 |
230 |
208 view.SetColL(colSet->ColNo(KMSCHAPv2LastFullAuthTime), default_FullAuthTime); |
231 view.SetColL(colSet->ColNo(KMSCHAPv2LastFullAuthTime), default_FullAuthTime); |
209 |
232 |
210 view.PutL(); |
233 view.PutL(); |
211 |
234 |
212 CleanupStack::PopAndDestroy( colSet ); // Delete colSet. |
235 CleanupStack::PopAndDestroy(colSet); |
213 |
236 CleanupStack::PopAndDestroy(&view); |
214 CleanupStack::PopAndDestroy( &view ); // Close view. |
|
215 } |
237 } |
216 |
238 |
217 CleanupStack::PopAndDestroy( buf ); // Delete buf |
239 aDatabase.Compact(); |
|
240 |
|
241 CleanupStack::PopAndDestroy( buf ); |
218 CleanupStack::Pop( &aDatabase ); |
242 CleanupStack::Pop( &aDatabase ); |
219 CleanupStack::Pop( &aSession ); |
243 CleanupStack::Pop( &aFileServerSession ); |
220 |
|
221 aDatabase.Compact(); |
|
222 } |
244 } |
223 |
245 |
224 |
246 |
225 void EapMsChapV2DbUtils::SetIndexL( |
247 void EapMsChapV2DbUtils::SetIndexL( |
226 RDbNamedDatabase& aDatabase, |
248 RDbNamedDatabase& aDatabase, |
277 CleanupStack::PushL(colSet); |
311 CleanupStack::PushL(colSet); |
278 |
312 |
279 view.UpdateL(); |
313 view.UpdateL(); |
280 |
314 |
281 view.SetColL(colSet->ColNo(KServiceType), static_cast<TUint>(aNewIndexType)); |
315 view.SetColL(colSet->ColNo(KServiceType), static_cast<TUint>(aNewIndexType)); |
282 |
|
283 view.SetColL(colSet->ColNo(KServiceIndex), aNewIndex); |
316 view.SetColL(colSet->ColNo(KServiceIndex), aNewIndex); |
284 |
317 view.SetColL(colSet->ColNo(KTunnelingTypeVendorId), aNewTunnelingType.get_vendor_id()); |
285 view.SetColL(colSet->ColNo(KTunnelingType), aNewTunnelingVendorType); |
318 view.SetColL(colSet->ColNo(KTunnelingType), aNewTunnelingType.get_vendor_type()); |
286 |
319 |
287 view.PutL(); |
320 view.PutL(); |
288 |
321 |
289 CleanupStack::PopAndDestroy(3); // view, colset, buf |
322 CleanupStack::PopAndDestroy(colSet); |
|
323 CleanupStack::PopAndDestroy(&view); |
|
324 CleanupStack::PopAndDestroy(buf); |
290 } |
325 } |
291 |
326 |
292 void EapMsChapV2DbUtils::SetConfigurationL( |
327 void EapMsChapV2DbUtils::SetConfigurationL( |
293 RDbNamedDatabase& aDatabase, |
328 RDbNamedDatabase& aDatabase, |
294 const EAPSettings& aSettings, |
329 const EAPSettings& aSettings, |
295 const TIndexType aIndexType, |
330 const TIndexType aIndexType, |
296 const TInt aIndex, |
331 const TInt aIndex, |
297 const eap_type_value_e aTunnelingType) |
332 const eap_type_value_e aTunnelingType) |
298 { |
333 { |
299 #ifdef USE_EAP_EXPANDED_TYPES |
334 EAP_TRACE_DEBUG_SYMBIAN( |
300 |
335 (_L("EapMsChapV2DbUtils::SetConfigurationL(): -Start- aIndexType=%d, aIndex=%d, aTunnelingType=0xfe%06x%08x\n"), |
301 TUint aTunnelingVendorType = aTunnelingType.get_vendor_type(); |
336 aIndexType, |
302 |
337 aIndex, |
303 #else |
338 aTunnelingType.get_vendor_id(), |
304 |
339 aTunnelingType.get_vendor_type())); |
305 TUint aTunnelingVendorType = static_cast<TUint>(aTunnelingType); |
340 |
306 |
341 EAP_TRACE_RETURN_STRING_SYMBIAN(_L("returns: EapMsChapV2DbUtils::SetConfigurationL()\n")); |
307 #endif //#ifdef USE_EAP_EXPANDED_TYPES |
342 |
|
343 EAP_TRACE_SETTINGS(&aSettings); |
308 |
344 |
309 // Check if the settings are for the correct type |
345 // Check if the settings are for the correct type |
310 if (aSettings.iEAPType != EAPSettings::EEapMschapv2 && |
346 if (aSettings.iEAPExpandedType != (*EapExpandedTypeMsChapv2.GetType()) |
311 aSettings.iEAPType != EAPSettings::EPlainMschapv2) |
347 && aSettings.iEAPExpandedType != (*EapExpandedPlainMsChapv2.GetType())) |
312 { |
348 { |
313 User::Leave(KErrNotSupported); |
349 User::Leave(KErrNotSupported); |
314 } |
350 } |
315 |
351 |
316 HBufC* buf = HBufC::NewLC(KMaxSqlQueryLength); |
352 HBufC* buf = HBufC::NewLC(KMaxSqlQueryLength); |
317 TPtr sqlStatement = buf->Des(); |
353 TPtr sqlStatement = buf->Des(); |
318 |
354 |
319 RDbView view; |
355 RDbView view; |
320 |
356 |
321 _LIT(KSQLQuery, "SELECT * FROM %S WHERE %S=%d AND %S=%d AND %S=%d"); |
357 _LIT(KSQLQuery, "SELECT * FROM %S WHERE %S=%d AND %S=%d AND %S=%d AND %S=%d"); |
322 sqlStatement.Format(KSQLQuery, &KMsChapV2TableName, |
358 |
323 &KServiceType, aIndexType, &KServiceIndex, aIndex, &KTunnelingType, aTunnelingVendorType); |
359 sqlStatement.Format(KSQLQuery, |
|
360 &KMsChapV2TableName, |
|
361 &KServiceType, |
|
362 aIndexType, |
|
363 &KServiceIndex, |
|
364 aIndex, |
|
365 &KTunnelingTypeVendorId, |
|
366 aTunnelingType.get_vendor_id(), |
|
367 &KTunnelingType, |
|
368 aTunnelingType.get_vendor_type()); |
324 |
369 |
325 // Evaluate view |
370 // Evaluate view |
326 User::LeaveIfError(view.Prepare(aDatabase, TDbQuery(sqlStatement))); |
371 User::LeaveIfError(view.Prepare(aDatabase, TDbQuery(sqlStatement))); |
327 |
372 |
328 CleanupClosePushL(view); |
373 CleanupClosePushL(view); |
343 // Validate length. |
388 // Validate length. |
344 if(aSettings.iUsername.Length() > KMaxUsernameLengthInDB) |
389 if(aSettings.iUsername.Length() > KMaxUsernameLengthInDB) |
345 { |
390 { |
346 // Username too long. Can not be stored in DB. |
391 // Username too long. Can not be stored in DB. |
347 |
392 |
348 EAP_TRACE_DEBUG_SYMBIAN((_L("EapMsChapV2DbUtils::SetConfigurationL: Too long Username. Length=%d \n"), |
393 EAP_TRACE_DEBUG_SYMBIAN((_L("ERROR: EapMsChapV2DbUtils::SetConfigurationL(): Too long Username. Length=%d \n"), |
349 aSettings.iUsername.Length())); |
394 aSettings.iUsername.Length())); |
350 |
395 |
351 User::Leave(KErrArgument); |
396 User::Leave(KErrArgument); |
352 } |
397 } |
353 |
398 |
354 // Length is ok. Set the value in DB. |
399 // Length is ok. Set the value in DB. |
355 view.SetColL(colSet->ColNo(cf_str_EAP_MSCHAPV2_username_literal), aSettings.iUsername); |
400 view.SetColL(colSet->ColNo(cf_str_EAP_MSCHAPV2_username_literal), aSettings.iUsername); |
356 } |
401 } |
357 |
402 |
|
403 // Password existence. |
|
404 if (aSettings.iPasswordExistPresent |
|
405 && !aSettings.iPasswordExist) |
|
406 { |
|
407 // Clear password from database. |
|
408 view.SetColL(colSet->ColNo(cf_str_EAP_MSCHAPV2_password_literal), KNullPasswordData); |
|
409 view.SetColNullL(colSet->ColNo(cf_str_EAP_MSCHAPV2_password_literal)); |
|
410 } |
|
411 |
358 // Password |
412 // Password |
359 if (aSettings.iPasswordPresent) |
413 if (aSettings.iPasswordPresent) |
360 { |
414 { |
361 // Validate length. |
415 // Validate length. |
362 if(aSettings.iPassword.Length() > KMaxPasswordLengthInDB) |
416 if(aSettings.iPassword.Length() > KMaxPasswordLengthInDB) |
363 { |
417 { |
364 // Password too long. Can not be stored in DB. |
418 // Password too long. Can not be stored in DB. |
365 |
419 |
366 EAP_TRACE_DEBUG_SYMBIAN((_L("EapMsChapV2DbUtils::SetConfigurationL: Too long Password. Length=%d \n"), |
420 EAP_TRACE_DEBUG_SYMBIAN((_L("ERROR: EapMsChapV2DbUtils::SetConfigurationL(): Too long Password. Length=%d \n"), |
367 aSettings.iPassword.Length())); |
421 aSettings.iPassword.Length())); |
368 |
422 |
369 User::Leave(KErrArgument); |
423 User::Leave(KErrArgument); |
370 } |
424 } |
371 |
425 |
372 // Length is ok. Set the value in DB. |
426 // Length is ok. Set the value in DB. |
373 view.SetColL(colSet->ColNo(cf_str_EAP_MSCHAPV2_password_literal), aSettings.iPassword); |
427 view.SetColL(colSet->ColNo(cf_str_EAP_MSCHAPV2_password_literal), aSettings.iPassword); |
374 |
428 |
|
429 } |
|
430 |
|
431 if (aSettings.iShowPassWordPromptPresent) |
|
432 { |
375 // If password was supplied set password prompting off |
433 // If password was supplied set password prompting off |
376 view.SetColL(colSet->ColNo(cf_str_EAP_MSCHAPV2_password_prompt_literal), EMSCHAPV2PasswordPromptOff); |
434 if (aSettings.iShowPassWordPrompt == EFalse) |
377 } |
435 { |
378 |
436 view.SetColL(colSet->ColNo(cf_str_EAP_MSCHAPV2_password_prompt_literal), EEapDbFalse ); |
|
437 } |
|
438 else |
|
439 { |
|
440 view.SetColL(colSet->ColNo(cf_str_EAP_MSCHAPV2_password_prompt_literal), EEapDbTrue ); |
|
441 } |
|
442 } |
|
443 |
379 // Session validity time |
444 // Session validity time |
380 if (aSettings.iSessionValidityTimePresent) |
445 if (aSettings.iSessionValidityTimePresent) |
381 { |
446 { |
382 // User or device management wants to store the session validity time. |
447 // User or device management wants to store the session validity time. |
383 // Convert the time to micro seconds and save. |
448 // Convert the time to micro seconds and save. |
390 // It doesn't matter even if the password is supplied. If max session validity is supplied, |
455 // It doesn't matter even if the password is supplied. If max session validity is supplied, |
391 // it means user needs to provide a password hence prompt should appear. |
456 // it means user needs to provide a password hence prompt should appear. |
392 |
457 |
393 if( validityInMicro != 0) |
458 if( validityInMicro != 0) |
394 { |
459 { |
395 view.SetColL(colSet->ColNo(cf_str_EAP_MSCHAPV2_password_prompt_literal), EMSCHAPV2PasswordPromptOn); |
460 view.SetColL(colSet->ColNo(cf_str_EAP_MSCHAPV2_password_prompt_literal), EEapDbTrue); |
396 } |
461 } |
397 } |
462 } |
398 |
463 |
399 // Last full authentication time should be made zero when EAP configurations are modified. |
464 // Last full authentication time should be made zero when EAP configurations are modified. |
400 // This makes sure that the next authentication with this EAP would be full authentication |
465 // This makes sure that the next authentication with this EAP would be full authentication |
401 // instead of reauthentication even if the session is still valid. |
466 // instead of reauthentication even if the session is still valid. |
402 |
467 |
403 view.SetColL(colSet->ColNo(KMSCHAPv2LastFullAuthTime), default_FullAuthTime); |
468 view.SetColL(colSet->ColNo(KMSCHAPv2LastFullAuthTime), default_FullAuthTime); |
404 |
469 |
405 EAP_TRACE_DEBUG_SYMBIAN((_L("Session Validity: EAP-Type=%d, Resetting Full Auth Time since settings are modified\n"), |
470 EAP_TRACE_DEBUG_SYMBIAN((_L("EapMsChapV2DbUtils::SetConfigurationL(): Session Validity: Resetting Full Auth Time since settings are modified\n"))); |
406 aSettings.iEAPType )); |
471 |
407 |
|
408 view.PutL(); |
472 view.PutL(); |
409 CleanupStack::PopAndDestroy(3); // view, colset, buf |
473 |
410 |
474 CleanupStack::PopAndDestroy(colSet); |
|
475 CleanupStack::PopAndDestroy(&view); |
|
476 CleanupStack::PopAndDestroy(buf); |
411 } |
477 } |
412 |
478 |
413 void EapMsChapV2DbUtils::GetConfigurationL( |
479 void EapMsChapV2DbUtils::GetConfigurationL( |
414 RDbNamedDatabase& aDatabase, |
480 RDbNamedDatabase& aDatabase, |
415 EAPSettings& aSettings, |
481 EAPSettings& aSettings, |
416 const TIndexType aIndexType, |
482 const TIndexType aIndexType, |
417 const TInt aIndex, |
483 const TInt aIndex, |
418 const eap_type_value_e aTunnelingType) |
484 const eap_type_value_e aTunnelingType) |
419 { |
485 { |
420 #ifdef USE_EAP_EXPANDED_TYPES |
486 EAP_TRACE_DEBUG_SYMBIAN( |
421 |
487 (_L("EapMsChapV2DbUtils::GetConfigurationL(): -Start- aIndexType=%d, aIndex=%d, aTunnelingType=0xfe%06x%08x\n"), |
422 TUint aTunnelingVendorType = aTunnelingType.get_vendor_type(); |
488 aIndexType, |
423 |
489 aIndex, |
424 #else |
490 aTunnelingType.get_vendor_id(), |
425 |
491 aTunnelingType.get_vendor_type())); |
426 TUint aTunnelingVendorType = static_cast<TUint>(aTunnelingType); |
492 |
427 |
493 EAP_TRACE_RETURN_STRING_SYMBIAN(_L("returns: EapMsChapV2DbUtils::GetConfigurationL()\n")); |
428 #endif //#ifdef USE_EAP_EXPANDED_TYPES |
|
429 |
494 |
430 HBufC* buf = HBufC::NewLC(KMaxSqlQueryLength); |
495 HBufC* buf = HBufC::NewLC(KMaxSqlQueryLength); |
431 TPtr sqlStatement = buf->Des(); |
496 TPtr sqlStatement = buf->Des(); |
432 |
497 |
433 RDbView view; |
498 RDbView view; |
434 |
499 |
435 // Form the query |
500 // Form the query |
436 _LIT(KSQLQuery, "SELECT * FROM %S WHERE %S=%d AND %S=%d AND %S=%d"); |
501 _LIT(KSQLQuery, "SELECT * FROM %S WHERE %S=%d AND %S=%d AND %S=%d AND %S=%d"); |
437 sqlStatement.Format(KSQLQuery, &KMsChapV2TableName, |
502 |
438 &KServiceType, aIndexType, &KServiceIndex, aIndex, &KTunnelingType, aTunnelingVendorType); |
503 sqlStatement.Format(KSQLQuery, |
|
504 &KMsChapV2TableName, |
|
505 &KServiceType, |
|
506 aIndexType, |
|
507 &KServiceIndex, |
|
508 aIndex, |
|
509 &KTunnelingTypeVendorId, |
|
510 aTunnelingType.get_vendor_id(), |
|
511 &KTunnelingType, |
|
512 aTunnelingType.get_vendor_type()); |
439 |
513 |
440 // Evaluate view |
514 // Evaluate view |
441 User::LeaveIfError(view.Prepare(aDatabase, TDbQuery(sqlStatement))); |
515 User::LeaveIfError(view.Prepare(aDatabase, TDbQuery(sqlStatement))); |
442 |
516 |
443 CleanupClosePushL(view); |
517 CleanupClosePushL(view); |
450 |
524 |
451 // Get column set so we get the correct column numbers |
525 // Get column set so we get the correct column numbers |
452 CDbColSet* colSet = view.ColSetL(); |
526 CDbColSet* colSet = view.ColSetL(); |
453 CleanupStack::PushL(colSet); |
527 CleanupStack::PushL(colSet); |
454 |
528 |
455 aSettings.iEAPType = EAPSettings::EEapMschapv2; |
529 aSettings.iEAPExpandedType = *EapExpandedTypeMsChapv2.GetType(); |
456 |
530 |
457 // Username |
531 // Username |
458 TPtrC username = view.ColDes(colSet->ColNo(cf_str_EAP_MSCHAPV2_username_literal)); |
532 TPtrC username = view.ColDes(colSet->ColNo(cf_str_EAP_MSCHAPV2_username_literal)); |
459 aSettings.iUsername.Copy(username); |
533 aSettings.iUsername.Copy(username); |
460 aSettings.iUsernamePresent = ETrue; |
534 aSettings.iUsernamePresent = ETrue; |
461 |
535 |
|
536 // Password existence. |
|
537 aSettings.iPasswordExistPresent = ETrue; |
|
538 aSettings.iPasswordExist = ! view.IsColNull(colSet->ColNo(cf_str_EAP_MSCHAPV2_password_literal)); |
|
539 |
|
540 #if defined(USE_EAP_PASSWORD_READ_FROM_DATABASE) |
462 // Password |
541 // Password |
463 TPtrC password = view.ColDes(colSet->ColNo(cf_str_EAP_MSCHAPV2_password_literal)); |
542 TPtrC password = view.ColDes(colSet->ColNo(cf_str_EAP_MSCHAPV2_password_literal)); |
464 aSettings.iPassword.Copy(password); |
543 aSettings.iPassword.Copy(password); |
465 aSettings.iPasswordPresent = ETrue; |
544 aSettings.iPasswordPresent = ETrue; |
466 |
545 #else |
|
546 EAP_TRACE_DEBUG_SYMBIAN((_L("WARNING: EapMsChapV2DbUtils::GetConfigurationL(): Password read is disabled\n"))); |
|
547 #endif //#if defined(USE_EAP_PASSWORD_READ_FROM_DATABASE) |
|
548 |
|
549 aSettings.iShowPassWordPromptPresent = ETrue; |
|
550 |
|
551 TUint aShow = view.ColUint(colSet->ColNo(cf_str_EAP_MSCHAPV2_password_prompt_literal)); |
|
552 if(aShow == EEapDbFalse) |
|
553 { |
|
554 aSettings.iShowPassWordPrompt = EFalse; |
|
555 } |
|
556 else |
|
557 { |
|
558 aSettings.iShowPassWordPrompt = ETrue; |
|
559 } |
|
560 |
467 // Session validity time |
561 // Session validity time |
468 TInt64 maxSessionTimeMicro = view.ColInt64(colSet->ColNo(cf_str_EAP_MSCHAPv2_max_session_validity_time_literal)); |
562 TInt64 maxSessionTimeMicro = view.ColInt64(colSet->ColNo(cf_str_EAP_MSCHAPv2_max_session_validity_time_literal)); |
469 |
563 |
470 // Convert the time to minutes. |
564 // Convert the time to minutes. |
471 TInt64 maxSessionTimeMin = maxSessionTimeMicro / KMicroSecsInAMinute; |
565 TInt64 maxSessionTimeMin = maxSessionTimeMicro / KMicroSecsInAMinute; |
472 |
566 |
473 aSettings.iSessionValidityTime = static_cast<TUint>(maxSessionTimeMin); |
567 aSettings.iSessionValidityTime = static_cast<TUint>(maxSessionTimeMin); |
474 aSettings.iSessionValidityTimePresent = ETrue; |
568 aSettings.iSessionValidityTimePresent = ETrue; |
475 |
569 |
476 CleanupStack::PopAndDestroy(3); // view, colset, buf |
570 CleanupStack::PopAndDestroy(colSet); |
|
571 CleanupStack::PopAndDestroy(&view); |
|
572 CleanupStack::PopAndDestroy(buf); |
|
573 |
|
574 EAP_TRACE_SETTINGS(&aSettings); |
477 } |
575 } |
478 |
576 |
479 void EapMsChapV2DbUtils::CopySettingsL( |
577 void EapMsChapV2DbUtils::CopySettingsL( |
480 RDbNamedDatabase& aDatabase, |
578 RDbNamedDatabase& aDatabase, |
481 const TIndexType aSrcIndexType, |
579 const TIndexType aSrcIndexType, |
532 CDbColSet* colSet = view.ColSetL(); |
642 CDbColSet* colSet = view.ColSetL(); |
533 |
643 |
534 CleanupStack::PushL(colSet); |
644 CleanupStack::PushL(colSet); |
535 |
645 |
536 view.SetColL(colSet->ColNo(KServiceType), static_cast<TUint>(aDestIndexType)); |
646 view.SetColL(colSet->ColNo(KServiceType), static_cast<TUint>(aDestIndexType)); |
537 |
|
538 view.SetColL(colSet->ColNo(KServiceIndex), aDestIndex); |
647 view.SetColL(colSet->ColNo(KServiceIndex), aDestIndex); |
539 |
648 view.SetColL(colSet->ColNo(KTunnelingTypeVendorId), aDestTunnelingType.get_vendor_id()); |
540 view.SetColL(colSet->ColNo(KTunnelingType), aDestTunnelingVendorType); |
649 view.SetColL(colSet->ColNo(KTunnelingType), aDestTunnelingType.get_vendor_type()); |
541 |
650 |
542 view.PutL(); |
651 view.PutL(); |
543 |
652 |
544 CleanupStack::PopAndDestroy(3); // view, colset, buf |
653 CleanupStack::PopAndDestroy(colSet); |
|
654 CleanupStack::PopAndDestroy(&view); |
|
655 CleanupStack::PopAndDestroy(buf); |
545 } |
656 } |
546 |
657 |
547 void EapMsChapV2DbUtils::DeleteConfigurationL( |
658 void EapMsChapV2DbUtils::DeleteConfigurationL( |
548 const TIndexType aIndexType, |
659 const TIndexType aIndexType, |
549 const TInt aIndex, |
660 const TInt aIndex, |
550 const eap_type_value_e aTunnelingType) |
661 const eap_type_value_e aTunnelingType) |
551 { |
662 { |
552 #ifdef USE_EAP_EXPANDED_TYPES |
663 EAP_TRACE_DEBUG_SYMBIAN( |
553 |
664 (_L("EapMsChapV2DbUtils::DeleteConfigurationL(): -Start- aIndexType=%d, aIndex=%d, aTunnelingType=0xfe%06x%08x\n"), |
554 TUint aTunnelingVendorType = aTunnelingType.get_vendor_type(); |
665 aIndexType, |
555 |
666 aIndex, |
556 #else |
667 aTunnelingType.get_vendor_id(), |
557 |
668 aTunnelingType.get_vendor_type())); |
558 TUint aTunnelingVendorType = static_cast<TUint>(aTunnelingType); |
669 |
559 |
670 EAP_TRACE_RETURN_STRING_SYMBIAN(_L("returns: EapMsChapV2DbUtils::DeleteConfigurationL()\n")); |
560 #endif //#ifdef USE_EAP_EXPANDED_TYPES |
671 |
561 |
672 RDbNamedDatabase aDatabase; |
562 RDbs session; |
673 RFs aFileServerSession; |
563 RDbNamedDatabase database; |
674 |
564 // Connect to the DBMS server. |
675 TInt error(KErrNone); |
565 User::LeaveIfError(session.Connect()); |
676 TFileName aPrivateDatabasePathName; |
566 CleanupClosePushL(session); |
677 |
567 |
678 error = aFileServerSession.Connect(); |
568 #ifdef SYMBIAN_SECURE_DBMS |
679 EAP_TRACE_DEBUG_SYMBIAN((_L("EapMsChapV2DbUtils::DeleteConfigurationL(): - aFileServerSession.Connect(), error=%d\n"), error)); |
569 |
680 User::LeaveIfError(error); |
570 // Create the secure shared database with the specified secure policy. |
681 |
571 // Database will be created in the data caging path for DBMS (C:\private\100012a5). |
682 EapPluginTools::CreateDatabaseLC( |
572 |
683 aDatabase, |
573 TInt err = database.Create(session, KDatabaseName, KSecureUIDFormat); |
684 aFileServerSession, |
574 |
685 error, |
575 if(err == KErrNone) |
686 KEapMsChapV2DatabaseName, |
|
687 aPrivateDatabasePathName); |
|
688 |
|
689 if(error == KErrNone) |
576 { |
690 { |
577 // Database was created so it was empty. No need for further actions. |
691 // Database was created so it was empty. No need for further actions. |
578 database.Destroy(); |
692 aDatabase.Destroy(); |
579 CleanupStack::PopAndDestroy(); |
693 CleanupStack::PopAndDestroy(&aDatabase); |
|
694 CleanupStack::PopAndDestroy(&aFileServerSession); |
580 return; |
695 return; |
581 |
696 } |
582 } |
697 else if (error != KErrAlreadyExists) |
583 else if (err != KErrAlreadyExists) |
698 { |
584 { |
699 User::LeaveIfError(error); |
585 User::LeaveIfError(err); |
700 } |
586 } |
701 |
587 |
702 EAP_TRACE_DEBUG_SYMBIAN((_L("EapMsChapV2DbUtils::DeleteConfigurationL(): - calls aDatabase.Open()\n"))); |
588 // Database existed, open it. |
703 |
589 User::LeaveIfError(database.Open(session, KDatabaseName, KSecureUIDFormat)); |
704 error = aDatabase.Open(aFileServerSession, aPrivateDatabasePathName); |
590 CleanupClosePushL(database); |
705 |
591 |
706 EAP_TRACE_DEBUG_SYMBIAN((_L("EapMsChapV2DbUtils::DeleteConfigurationL(): - Opened private DB for EAP-MsChapV2. error=%d\n"), error)); |
592 #else |
707 |
593 // For non-secured database. The database will be created in the old location (c:\system\data). |
708 User::LeaveIfError(error); |
594 |
|
595 RFs fsSession; |
|
596 User::LeaveIfError(fsSession.Connect()); |
|
597 CleanupClosePushL(fsSession); |
|
598 TInt err = database.Create(fsSession, KDatabaseName); |
|
599 |
|
600 if(err == KErrNone) |
|
601 { |
|
602 // Database was created so it was empty. No need for further actions. |
|
603 database.Destroy(); |
|
604 CleanupStack::PopAndDestroy(2); // fsSession, database session |
|
605 return; |
|
606 |
|
607 } |
|
608 else if (err != KErrAlreadyExists) |
|
609 { |
|
610 User::LeaveIfError(err); |
|
611 } |
|
612 |
|
613 CleanupStack::PopAndDestroy(); // close fsSession |
|
614 |
|
615 User::LeaveIfError(database.Open(session, KDatabaseName)); |
|
616 CleanupClosePushL(database); |
|
617 |
|
618 #endif // #ifdef SYMBIAN_SECURE_DBMS |
|
619 |
709 |
620 HBufC* buf = HBufC::NewLC(KMaxSqlQueryLength); |
710 HBufC* buf = HBufC::NewLC(KMaxSqlQueryLength); |
621 TPtr sqlStatement = buf->Des(); |
711 TPtr sqlStatement = buf->Des(); |
622 |
712 |
623 // Main settings table |
713 // Main settings table |
624 _LIT(KSQL, "SELECT * FROM %S WHERE %S=%d AND %S=%d AND %S=%d"); |
714 _LIT(KSQL, "SELECT * FROM %S WHERE %S=%d AND %S=%d AND %S=%d AND %S=%d"); |
625 sqlStatement.Format(KSQL, &KMsChapV2TableName, |
715 |
626 &KServiceType, aIndexType, &KServiceIndex, aIndex, &KTunnelingType, aTunnelingVendorType); |
716 sqlStatement.Format(KSQL, |
|
717 &KMsChapV2TableName, |
|
718 &KServiceType, |
|
719 aIndexType, |
|
720 &KServiceIndex, |
|
721 aIndex, |
|
722 &KTunnelingTypeVendorId, |
|
723 aTunnelingType.get_vendor_id(), |
|
724 &KTunnelingType, |
|
725 aTunnelingType.get_vendor_type()); |
|
726 |
627 // Evaluate view |
727 // Evaluate view |
628 RDbView view; |
728 RDbView view; |
629 User::LeaveIfError(view.Prepare(database,TDbQuery(sqlStatement), TDbWindow::EUnlimited)); |
729 User::LeaveIfError(view.Prepare(aDatabase,TDbQuery(sqlStatement), TDbWindow::EUnlimited)); |
630 CleanupClosePushL(view); |
730 CleanupClosePushL(view); |
631 User::LeaveIfError(view.EvaluateAll()); |
731 User::LeaveIfError(view.EvaluateAll()); |
632 |
732 |
633 // Delete rows |
733 // Delete rows |
634 if (view.FirstL()) |
734 if (view.FirstL()) |
635 { |
735 { |
636 do { |
736 do { |
637 view.DeleteL(); |
737 view.DeleteL(); |
638 } while (view.NextL() != EFalse); |
738 } while (view.NextL() != EFalse); |
639 } |
739 } |
640 |
740 |
641 // Close database |
741 CleanupStack::PopAndDestroy(&view); |
642 CleanupStack::PopAndDestroy(4); // view, buf, database, session |
742 CleanupStack::PopAndDestroy(buf); |
|
743 CleanupStack::PopAndDestroy(&aDatabase); |
|
744 CleanupStack::PopAndDestroy(&aFileServerSession); |
643 } |
745 } |
644 |
746 |
645 // End of File |
747 // End of File |