1 /* |
|
2 * Copyright (c) 2001-2010 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of the License "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: Conversion functions between common code and Symbian code. |
|
15 * |
|
16 */ |
|
17 |
|
18 /* |
|
19 * %version: 50 % |
|
20 */ |
|
21 |
|
22 // This is enumeration of EAPOL source code. |
|
23 #if defined(USE_EAP_MINIMUM_RELEASE_TRACES) |
|
24 #undef EAP_FILE_NUMBER_ENUM |
|
25 #define EAP_FILE_NUMBER_ENUM 738 |
|
26 #undef EAP_FILE_NUMBER_DATE |
|
27 #define EAP_FILE_NUMBER_DATE 1127594498 |
|
28 #endif //#if defined(USE_EAP_MINIMUM_RELEASE_TRACES) |
|
29 |
|
30 |
|
31 // INCLUDE FILES |
|
32 |
|
33 #include "EapConversion.h" |
|
34 #include "eap_am_assert.h" |
|
35 #include <EapTypeInfo.h> |
|
36 #include "abs_eap_am_tools.h" |
|
37 #include "eap_automatic_variable.h" |
|
38 #include <utf.h> // for CnvUtfConverter |
|
39 #include "abs_eap_plugin_message.h" |
|
40 #include "eap_plugin_message_base.h" |
|
41 #include "abs_eap_am_message_if.h" |
|
42 #include "eap_am_message_if.h" |
|
43 #include "eap_automatic_variable.h" |
|
44 #include "eap_plugin_client_message_if.h" |
|
45 #include "eap_am_message_if_symbian.h" |
|
46 #include "EapTraceSymbian.h" |
|
47 |
|
48 // LOCAL CONSTANTS |
|
49 |
|
50 |
|
51 // ================= MEMBER FUNCTIONS ======================= |
|
52 |
|
53 EAP_FUNC_EXPORT TInt CEapConversion::ConvertFromTDesCToInternal( |
|
54 abs_eap_am_tools_c * const tools, |
|
55 const TDesC & input16, |
|
56 eap_variable_data_c * const target8) |
|
57 { |
|
58 HBufC16* buf16 = HBufC16::New(input16.Length()); |
|
59 if (buf16 == 0) |
|
60 { |
|
61 return KErrNoMemory; |
|
62 } |
|
63 |
|
64 buf16->Des().Copy(input16); |
|
65 |
|
66 TPtr16 inBufPtr16 = buf16->Des(); |
|
67 |
|
68 TInt error = ConvertFromBuf16ToInternal( |
|
69 tools, |
|
70 &inBufPtr16, |
|
71 target8); |
|
72 |
|
73 delete buf16; |
|
74 |
|
75 return error; |
|
76 } |
|
77 |
|
78 // ---------------------------------------------------------- |
|
79 |
|
80 EAP_FUNC_EXPORT TInt CEapConversion::ConvertCipherSuitesToInternalType( |
|
81 abs_eap_am_tools_c * const tools, |
|
82 const RArray<TUint> * const aCipherSuites, |
|
83 eap_array_c<u16_t> * const internal_cipher_suites) |
|
84 { |
|
85 EAP_TRACE_DEBUG( |
|
86 tools, |
|
87 TRACE_FLAGS_DEFAULT, |
|
88 (EAPL("CEapConversion::ConvertCipherSuitesToInternalType()\n"))); |
|
89 |
|
90 EAP_TRACE_RETURN_STRING(tools, "returns: CEapConversion::ConvertCipherSuitesToInternalType()"); |
|
91 |
|
92 eap_status_e status(eap_status_ok); |
|
93 |
|
94 if (aCipherSuites == 0 |
|
95 || internal_cipher_suites == 0) |
|
96 { |
|
97 return (tools->convert_eapol_error_to_am_error( |
|
98 EAP_STATUS_RETURN(tools, eap_status_illegal_parameter))); |
|
99 } |
|
100 |
|
101 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|
102 |
|
103 for (TInt ind = 0; ind < aCipherSuites->Count(); ind++) |
|
104 { |
|
105 u16_t * const tmp_object = new u16_t; |
|
106 if (tmp_object == 0) |
|
107 { |
|
108 EAP_TRACE_END(tools, TRACE_FLAGS_DEFAULT); |
|
109 return (tools->convert_eapol_error_to_am_error( |
|
110 EAP_STATUS_RETURN(tools, eap_status_allocation_error))); |
|
111 } |
|
112 *tmp_object = static_cast<u16_t>((*aCipherSuites)[ind]); |
|
113 status = internal_cipher_suites->add_object(tmp_object, true); |
|
114 if (status != eap_status_ok) |
|
115 { |
|
116 return (tools->convert_eapol_error_to_am_error( |
|
117 EAP_STATUS_RETURN(tools, status))); |
|
118 } |
|
119 } |
|
120 |
|
121 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|
122 |
|
123 return KErrNone; |
|
124 } |
|
125 |
|
126 // ---------------------------------------------------------- |
|
127 |
|
128 EAP_FUNC_EXPORT TInt CEapConversion::ConvertInternalTypeToCipherSuites( |
|
129 abs_eap_am_tools_c * const tools, |
|
130 const eap_array_c<u16_t> * const internal_cipher_suites, |
|
131 RArray<TUint> * const aCipherSuites) |
|
132 { |
|
133 EAP_TRACE_DEBUG( |
|
134 tools, |
|
135 TRACE_FLAGS_DEFAULT, |
|
136 (EAPL("CEapConversion::ConvertInternalTypeToCipherSuites()\n"))); |
|
137 |
|
138 EAP_TRACE_RETURN_STRING(tools, "returns: CEapConversion::ConvertInternalTypeToCipherSuites()"); |
|
139 |
|
140 if (aCipherSuites == 0 |
|
141 || internal_cipher_suites == 0) |
|
142 { |
|
143 return (tools->convert_eapol_error_to_am_error( |
|
144 EAP_STATUS_RETURN(tools, eap_status_illegal_parameter))); |
|
145 } |
|
146 |
|
147 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|
148 |
|
149 for (TInt ind = 0; ind < internal_cipher_suites->get_object_count(); ind++) |
|
150 { |
|
151 const u16_t * const tmp_object = internal_cipher_suites->get_object(ind); |
|
152 if (tmp_object == 0) |
|
153 { |
|
154 EAP_TRACE_END(tools, TRACE_FLAGS_DEFAULT); |
|
155 return (tools->convert_eapol_error_to_am_error( |
|
156 EAP_STATUS_RETURN(tools, eap_status_allocation_error))); |
|
157 } |
|
158 |
|
159 TInt error = aCipherSuites->Append(static_cast<TUint>(*tmp_object)); |
|
160 if (error != KErrNone) |
|
161 { |
|
162 return (error); |
|
163 } |
|
164 } |
|
165 |
|
166 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|
167 |
|
168 return KErrNone; |
|
169 } |
|
170 |
|
171 // ---------------------------------------------------------- |
|
172 |
|
173 EAP_FUNC_EXPORT TInt CEapConversion::ConvertFromInternalToBuf16( |
|
174 abs_eap_am_tools_c * const tools, |
|
175 const eap_variable_data_c * const input8, |
|
176 TDes * const target16) |
|
177 { |
|
178 EAP_TRACE_DATA_DEBUG( |
|
179 tools, |
|
180 TRACE_FLAGS_DEFAULT, |
|
181 (EAPL("CEapConversion::ConvertFromInternalToBuf16(): input8"), |
|
182 input8->get_data(), |
|
183 input8->get_data_length())); |
|
184 |
|
185 EAP_TRACE_RETURN_STRING(tools, "returns: CEapConversion::ConvertFromInternalToBuf16()"); |
|
186 |
|
187 TPtrC8 inBufPtrC8(input8->get_data(), input8->get_data_length()); |
|
188 |
|
189 // convert utf8 -> unicode, |
|
190 // aInBuf8 is UTF8 string, unicode max length is |
|
191 // then the length of UTF8 string. |
|
192 // NOTE, HBufC16 length means count of 16-bit objects. |
|
193 HBufC16 * outBuf16 = HBufC16::New(inBufPtrC8.Size()); |
|
194 if (outBuf16 == 0) |
|
195 { |
|
196 EAP_UNREFERENCED_PARAMETER(tools); |
|
197 return KErrNoMemory; |
|
198 } |
|
199 |
|
200 TPtr16 outBufPtr16 = outBuf16->Des(); |
|
201 |
|
202 CnvUtfConverter::ConvertToUnicodeFromUtf8(outBufPtr16, inBufPtrC8); |
|
203 |
|
204 target16->Copy(outBufPtr16); |
|
205 |
|
206 EAP_TRACE_DATA_DEBUG( |
|
207 tools, |
|
208 TRACE_FLAGS_DEFAULT, |
|
209 (EAPL("CEapConversion::ConvertFromInternalToBuf16(): outBufPtr16"), |
|
210 outBufPtr16.Ptr(), |
|
211 outBufPtr16.Size())); |
|
212 |
|
213 delete outBuf16; |
|
214 outBuf16 = NULL; |
|
215 |
|
216 return KErrNone; |
|
217 } |
|
218 |
|
219 // ---------------------------------------------------------- |
|
220 |
|
221 EAP_FUNC_EXPORT TInt CEapConversion::ConvertFromBuf16ToInternal( |
|
222 abs_eap_am_tools_c * const tools, |
|
223 const TDes * const input16, |
|
224 eap_variable_data_c * const target8) |
|
225 { |
|
226 EAP_TRACE_DATA_DEBUG( |
|
227 tools, |
|
228 TRACE_FLAGS_DEFAULT, |
|
229 (EAPL("CEapConversion::ConvertFromBuf16ToInternal(): input16"), |
|
230 input16->Ptr(), |
|
231 input16->Size())); |
|
232 |
|
233 EAP_TRACE_RETURN_STRING(tools, "returns: CEapConversion::ConvertFromBuf16ToInternal()"); |
|
234 |
|
235 if (tools == 0) |
|
236 { |
|
237 return KErrArgument; |
|
238 } |
|
239 |
|
240 // "In UTF-8, characters are encoded using sequences of 1 to 6 octets." |
|
241 // RFC2279 - UTF-8 |
|
242 const TUint KMaxNumberOfOctetsPerUtf8Char = 6; |
|
243 // Convert unicode -> utf8. |
|
244 // Note, HBufC16 length means the number of 16-bit values or |
|
245 // data items represented by the descriptor. |
|
246 // Multiply number of charachters by max number of octets for char. |
|
247 HBufC8 * aOutBuf8 = HBufC8::New(input16->Length() * KMaxNumberOfOctetsPerUtf8Char); |
|
248 if (aOutBuf8 == 0) |
|
249 { |
|
250 return KErrNoMemory; |
|
251 } |
|
252 |
|
253 TPtr8 outBufPtr8(aOutBuf8->Des()); |
|
254 |
|
255 CnvUtfConverter::ConvertFromUnicodeToUtf8(outBufPtr8, *input16); |
|
256 |
|
257 eap_status_e status = target8->set_copy_of_buffer(aOutBuf8->Ptr(), aOutBuf8->Length()); |
|
258 |
|
259 delete aOutBuf8; |
|
260 aOutBuf8 = NULL; |
|
261 |
|
262 EAP_TRACE_DATA_DEBUG( |
|
263 tools, |
|
264 TRACE_FLAGS_DEFAULT, |
|
265 (EAPL("CEapConversion::ConvertFromBuf16ToInternal(): target8"), |
|
266 target8->get_data(), |
|
267 target8->get_data_length())); |
|
268 |
|
269 return (tools->convert_eapol_error_to_am_error( |
|
270 EAP_STATUS_RETURN(tools, status))); |
|
271 } |
|
272 |
|
273 // ---------------------------------------------------------- |
|
274 |
|
275 EAP_FUNC_EXPORT TInt CEapConversion::ConvertEAPTypesToInternalTypes( |
|
276 abs_eap_am_tools_c * const tools, |
|
277 const RArray<TUint> * const EncapsulatedEAPTypes, |
|
278 eap_array_c<eap_type_value_e> * const target) |
|
279 { |
|
280 EAP_TRACE_DEBUG( |
|
281 tools, |
|
282 TRACE_FLAGS_DEFAULT, |
|
283 (EAPL("CEapConversion::ConvertEAPTypesToInternalTypes()\n"))); |
|
284 |
|
285 EAP_TRACE_RETURN_STRING(tools, "returns: CEapConversion::ConvertEAPTypesToInternalTypes()"); |
|
286 |
|
287 eap_status_e status(eap_status_ok); |
|
288 |
|
289 if (tools == 0) |
|
290 { |
|
291 return KErrGeneral; |
|
292 } |
|
293 if (EncapsulatedEAPTypes == 0 |
|
294 || target == 0) |
|
295 { |
|
296 return (tools->convert_eapol_error_to_am_error( |
|
297 EAP_STATUS_RETURN(tools, eap_status_illegal_parameter))); |
|
298 } |
|
299 |
|
300 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|
301 |
|
302 for (TInt ind = 0; ind < EncapsulatedEAPTypes->Count(); ind++) |
|
303 { |
|
304 eap_type_value_e * const tmp_object = new eap_type_value_e( |
|
305 static_cast<eap_type_ietf_values_e>((*EncapsulatedEAPTypes)[ind])); |
|
306 if (tmp_object == 0) |
|
307 { |
|
308 EAP_TRACE_END(tools, TRACE_FLAGS_DEFAULT); |
|
309 return (tools->convert_eapol_error_to_am_error( |
|
310 EAP_STATUS_RETURN(tools, eap_status_allocation_error))); |
|
311 } |
|
312 status = target->add_object(tmp_object, true); |
|
313 if (status != eap_status_ok) |
|
314 { |
|
315 return (tools->convert_eapol_error_to_am_error( |
|
316 EAP_STATUS_RETURN(tools, status))); |
|
317 } |
|
318 } |
|
319 |
|
320 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|
321 |
|
322 return KErrNone; |
|
323 } |
|
324 |
|
325 // ---------------------------------------------------------- |
|
326 |
|
327 EAP_FUNC_EXPORT TInt CEapConversion::ConvertInternalTypesToEAPTypes( |
|
328 abs_eap_am_tools_c * const tools, |
|
329 const eap_array_c<eap_type_value_e> * const internal_eap_types, |
|
330 RArray<TUint> * const target) |
|
331 { |
|
332 EAP_TRACE_DEBUG( |
|
333 tools, |
|
334 TRACE_FLAGS_DEFAULT, |
|
335 (EAPL("CEapConversion::ConvertInternalTypesToEAPTypes()\n"))); |
|
336 |
|
337 EAP_TRACE_RETURN_STRING(tools, "returns: CEapConversion::ConvertInternalTypesToEAPTypes()"); |
|
338 |
|
339 if (internal_eap_types == 0 |
|
340 || target == 0) |
|
341 { |
|
342 return (tools->convert_eapol_error_to_am_error( |
|
343 EAP_STATUS_RETURN(tools, eap_status_illegal_parameter))); |
|
344 } |
|
345 |
|
346 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|
347 |
|
348 for (TInt ind = 0; ind < internal_eap_types->get_object_count(); ind++) |
|
349 { |
|
350 const eap_type_value_e * const tmp_object = internal_eap_types->get_object(ind); |
|
351 if (tmp_object == 0) |
|
352 { |
|
353 EAP_TRACE_END(tools, TRACE_FLAGS_DEFAULT); |
|
354 return (tools->convert_eapol_error_to_am_error( |
|
355 EAP_STATUS_RETURN(tools, eap_status_allocation_error))); |
|
356 } |
|
357 |
|
358 TInt error = target->Append(static_cast<TUint>(tmp_object->get_vendor_type())); |
|
359 if (error != KErrNone) |
|
360 { |
|
361 return (error); |
|
362 } |
|
363 } |
|
364 |
|
365 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|
366 |
|
367 return KErrNone; |
|
368 } |
|
369 |
|
370 // ---------------------------------------------------------- |
|
371 |
|
372 EAP_FUNC_EXPORT TInt CEapConversion::ConvertExpandedEAPTypeToInternalType( |
|
373 const TEapExpandedType * const EncapsulatedExpandedEAPType, |
|
374 eap_type_value_e * const target) |
|
375 { |
|
376 EAP_TRACE_DEBUG_SYMBIAN((_L("CEapConversion::ConvertExpandedEAPTypeToInternalType()\n"))); |
|
377 |
|
378 EAP_TRACE_RETURN_STRING_SYMBIAN((_L("returns: CEapConversion::ConvertExpandedEAPTypeToInternalType()\n"))); |
|
379 |
|
380 eap_status_e status = target->set_expanded_type_data( |
|
381 0, // NOTE, we do not have abs_eap_am_tools_c object here. |
|
382 EncapsulatedExpandedEAPType->GetValue().Ptr(), |
|
383 EncapsulatedExpandedEAPType->GetValue().Length()); |
|
384 if (status != eap_status_ok) |
|
385 { |
|
386 return KErrGeneral; |
|
387 } |
|
388 |
|
389 return KErrNone; |
|
390 } |
|
391 |
|
392 // ---------------------------------------------------------- |
|
393 |
|
394 EAP_FUNC_EXPORT TInt CEapConversion::ConvertInternalTypeToExpandedEAPType( |
|
395 const eap_type_value_e * const source, |
|
396 TEapExpandedType * const EncapsulatedExpandedEAPType) |
|
397 { |
|
398 EAP_TRACE_DEBUG_SYMBIAN((_L("CEapConversion::ConvertInternalTypeToExpandedEAPType()\n"))); |
|
399 |
|
400 EAP_TRACE_RETURN_STRING_SYMBIAN((_L("returns: CEapConversion::ConvertInternalTypeToExpandedEAPType()\n"))); |
|
401 |
|
402 TInt error = EncapsulatedExpandedEAPType->SetValue( |
|
403 source->get_vendor_id(), |
|
404 source->get_vendor_type()); |
|
405 |
|
406 return error; |
|
407 } |
|
408 |
|
409 // ---------------------------------------------------------- |
|
410 |
|
411 EAP_FUNC_EXPORT TInt CEapConversion::ConvertExpandedEAPTypesToInternalTypes( |
|
412 abs_eap_am_tools_c * const tools, |
|
413 const RArray<TEapExpandedType> * const EncapsulatedExpandedEAPTypes, |
|
414 eap_array_c<eap_type_value_e> * const target) |
|
415 { |
|
416 EAP_TRACE_DEBUG( |
|
417 tools, |
|
418 TRACE_FLAGS_DEFAULT, |
|
419 (EAPL("CEapConversion::ConvertExpandedEAPTypesToInternalTypes()\n"))); |
|
420 |
|
421 EAP_TRACE_RETURN_STRING(tools, "returns: CEapConversion::ConvertExpandedEAPTypesToInternalTypes()"); |
|
422 |
|
423 eap_status_e status(eap_status_ok); |
|
424 |
|
425 if (EncapsulatedExpandedEAPTypes == 0 |
|
426 || target == 0) |
|
427 { |
|
428 return (tools->convert_eapol_error_to_am_error( |
|
429 EAP_STATUS_RETURN(tools, eap_status_illegal_parameter))); |
|
430 } |
|
431 |
|
432 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|
433 |
|
434 for (TInt ind = 0; ind < EncapsulatedExpandedEAPTypes->Count(); ind++) |
|
435 { |
|
436 TEapExpandedType ExpandedEAPType = (*EncapsulatedExpandedEAPTypes)[ind]; |
|
437 |
|
438 eap_type_value_e * const new_object = new eap_type_value_e(); |
|
439 if (new_object == 0) |
|
440 { |
|
441 EAP_TRACE_END(tools, TRACE_FLAGS_DEFAULT); |
|
442 return (tools->convert_eapol_error_to_am_error( |
|
443 EAP_STATUS_RETURN(tools, eap_status_allocation_error))); |
|
444 } |
|
445 |
|
446 TInt error = ConvertExpandedEAPTypeToInternalType( |
|
447 &ExpandedEAPType, |
|
448 new_object); |
|
449 if (error != KErrNone) |
|
450 { |
|
451 delete new_object; |
|
452 (void) EAP_STATUS_RETURN(tools, tools->convert_am_error_to_eapol_error(error)); |
|
453 return error; |
|
454 } |
|
455 |
|
456 status = target->add_object(new_object, true); |
|
457 if (status != eap_status_ok) |
|
458 { |
|
459 return (tools->convert_eapol_error_to_am_error( |
|
460 EAP_STATUS_RETURN(tools, status))); |
|
461 } |
|
462 } |
|
463 |
|
464 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|
465 |
|
466 return KErrNone; |
|
467 } |
|
468 |
|
469 // ---------------------------------------------------------- |
|
470 |
|
471 EAP_FUNC_EXPORT TInt CEapConversion::ConvertInternalTypesToExpandedEAPTypes( |
|
472 abs_eap_am_tools_c * const tools, |
|
473 const eap_array_c<eap_type_value_e> * const source, |
|
474 RArray<TEapExpandedType> * const EncapsulatedExpandedEAPTypes) |
|
475 { |
|
476 EAP_TRACE_DEBUG( |
|
477 tools, |
|
478 TRACE_FLAGS_DEFAULT, |
|
479 (EAPL("CEapConversion::ConvertInternalTypesToExpandedEAPTypes()\n"))); |
|
480 |
|
481 EAP_TRACE_RETURN_STRING(tools, "returns: CEapConversion::ConvertInternalTypesToExpandedEAPTypes()"); |
|
482 |
|
483 if (source == 0 |
|
484 || EncapsulatedExpandedEAPTypes == 0) |
|
485 { |
|
486 return (tools->convert_eapol_error_to_am_error( |
|
487 EAP_STATUS_RETURN(tools, eap_status_illegal_parameter))); |
|
488 } |
|
489 |
|
490 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|
491 |
|
492 TEapExpandedType EapType; |
|
493 |
|
494 for (TInt ind = 0; ind < source->get_object_count(); ind++) |
|
495 { |
|
496 const eap_type_value_e * const tmp_object = source->get_object(ind); |
|
497 if (tmp_object == 0) |
|
498 { |
|
499 EAP_TRACE_END(tools, TRACE_FLAGS_DEFAULT); |
|
500 return (tools->convert_eapol_error_to_am_error( |
|
501 EAP_STATUS_RETURN(tools, eap_status_allocation_error))); |
|
502 } |
|
503 |
|
504 TInt error = ConvertInternalTypeToExpandedEAPType( |
|
505 tmp_object, |
|
506 &EapType); |
|
507 if (error != KErrNone) |
|
508 { |
|
509 (void) EAP_STATUS_RETURN(tools, tools->convert_am_error_to_eapol_error(error)); |
|
510 return (error); |
|
511 } |
|
512 |
|
513 error = EncapsulatedExpandedEAPTypes->Append(EapType); |
|
514 if (error != KErrNone) |
|
515 { |
|
516 (void) EAP_STATUS_RETURN(tools, tools->convert_am_error_to_eapol_error(error)); |
|
517 return (error); |
|
518 } |
|
519 } |
|
520 |
|
521 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|
522 |
|
523 return KErrNone; |
|
524 } |
|
525 |
|
526 // ---------------------------------------------------------- |
|
527 |
|
528 EAP_FUNC_EXPORT TInt CEapConversion::ConvertInternalTypesToHBufC8( |
|
529 abs_eap_am_tools_c * const tools, |
|
530 const eap_array_c<eap_type_value_e> * const source, |
|
531 HBufC8 ** const EncapsulatedExpandedEAPTypesData) |
|
532 { |
|
533 EAP_TRACE_DEBUG( |
|
534 tools, |
|
535 TRACE_FLAGS_DEFAULT, |
|
536 (EAPL("CEapConversion::ConvertInternalTypesToHBufC8(): EncapsulatedExpandedEAPTypesData=0x%08x, source=0x%08x\n"), |
|
537 EncapsulatedExpandedEAPTypesData, |
|
538 source)); |
|
539 |
|
540 EAP_TRACE_RETURN_STRING(tools, "returns: CEapConversion::ConvertInternalTypesToHBufC8()"); |
|
541 |
|
542 if (EncapsulatedExpandedEAPTypesData == 0 |
|
543 || source == 0) |
|
544 { |
|
545 return (tools->convert_eapol_error_to_am_error( |
|
546 EAP_STATUS_RETURN(tools, eap_status_illegal_parameter))); |
|
547 } |
|
548 |
|
549 *EncapsulatedExpandedEAPTypesData = HBufC8::New(source->get_object_count()*KEapExpandedTypeLength); |
|
550 |
|
551 eap_automatic_variable_c<HBufC8> automatic_EncapsulatedExpandedEAPTypesData( |
|
552 tools, |
|
553 *EncapsulatedExpandedEAPTypesData); |
|
554 |
|
555 TPtr8 aDbBinaryColumnValuePtr = (*EncapsulatedExpandedEAPTypesData)->Des(); |
|
556 |
|
557 TEapExpandedType EapType; |
|
558 |
|
559 for (u32_t ind = 0; ind < source->get_object_count(); ind++) |
|
560 { |
|
561 const eap_type_value_e * const tmp_object = source->get_object(ind); |
|
562 if (tmp_object == 0) |
|
563 { |
|
564 EAP_TRACE_END(tools, TRACE_FLAGS_DEFAULT); |
|
565 return (tools->convert_eapol_error_to_am_error( |
|
566 EAP_STATUS_RETURN(tools, eap_status_allocation_error))); |
|
567 } |
|
568 |
|
569 TInt error = ConvertInternalTypeToExpandedEAPType( |
|
570 tmp_object, |
|
571 &EapType); |
|
572 if (error != KErrNone) |
|
573 { |
|
574 (void) EAP_STATUS_RETURN(tools, tools->convert_am_error_to_eapol_error(error)); |
|
575 return (error); |
|
576 } |
|
577 |
|
578 aDbBinaryColumnValuePtr.Append(EapType.GetValue()); |
|
579 } |
|
580 |
|
581 |
|
582 automatic_EncapsulatedExpandedEAPTypesData.do_not_free_variable(); |
|
583 |
|
584 return KErrNone; |
|
585 } |
|
586 |
|
587 // ---------------------------------------------------------- |
|
588 |
|
589 EAP_FUNC_EXPORT TInt CEapConversion::ConvertHBufC8ToInternalTypes( |
|
590 abs_eap_am_tools_c * const tools, |
|
591 const HBufC8 * const EncapsulatedExpandedEAPTypesData, |
|
592 eap_array_c<eap_type_value_e> * const target) |
|
593 { |
|
594 EAP_TRACE_DEBUG( |
|
595 tools, |
|
596 TRACE_FLAGS_DEFAULT, |
|
597 (EAPL("CEapConversion::ConvertHBufC8ToInternalTypes(): EncapsulatedExpandedEAPTypesData=0x%08x, target=0x%08x\n"), |
|
598 EncapsulatedExpandedEAPTypesData, |
|
599 target)); |
|
600 |
|
601 EAP_TRACE_RETURN_STRING(tools, "returns: CEapConversion::ConvertHBufC8ToInternalTypes()"); |
|
602 |
|
603 if (EncapsulatedExpandedEAPTypesData == 0 |
|
604 || target == 0) |
|
605 { |
|
606 return (tools->convert_eapol_error_to_am_error( |
|
607 EAP_STATUS_RETURN(tools, eap_status_illegal_parameter))); |
|
608 } |
|
609 |
|
610 u32_t eap_type_count = EncapsulatedExpandedEAPTypesData->Length() / KEapExpandedTypeLength; |
|
611 |
|
612 target->reset(); |
|
613 |
|
614 const TUint8 * const data = EncapsulatedExpandedEAPTypesData->Ptr(); |
|
615 u32_t offset = 0ul; |
|
616 |
|
617 for (u32_t ind = 0; ind < eap_type_count; ind++) |
|
618 { |
|
619 eap_type_value_e * const new_object = new eap_type_value_e(); |
|
620 |
|
621 eap_automatic_variable_c<eap_type_value_e> automatic_new_object( |
|
622 tools, |
|
623 new_object); |
|
624 |
|
625 if (new_object == 0) |
|
626 { |
|
627 EAP_TRACE_END(tools, TRACE_FLAGS_DEFAULT); |
|
628 return (tools->convert_eapol_error_to_am_error( |
|
629 EAP_STATUS_RETURN(tools, eap_status_allocation_error))); |
|
630 } |
|
631 |
|
632 eap_status_e status = new_object->set_expanded_type_data( |
|
633 tools, |
|
634 &(data[offset]), |
|
635 KEapExpandedTypeLength); |
|
636 if (status != eap_status_ok) |
|
637 { |
|
638 return (tools->convert_eapol_error_to_am_error( |
|
639 EAP_STATUS_RETURN(tools, status))); |
|
640 } |
|
641 |
|
642 offset += KEapExpandedTypeLength; |
|
643 |
|
644 automatic_new_object.do_not_free_variable(); |
|
645 |
|
646 status = target->add_object(new_object, true); |
|
647 if (status != eap_status_ok) |
|
648 { |
|
649 return (tools->convert_eapol_error_to_am_error( |
|
650 EAP_STATUS_RETURN(tools, status))); |
|
651 } |
|
652 } |
|
653 |
|
654 return KErrNone; |
|
655 } |
|
656 |
|
657 // ---------------------------------------------------------- |
|
658 |
|
659 EAP_FUNC_EXPORT TInt CEapConversion::ConvertCertificatesToInternalType( |
|
660 abs_eap_am_tools_c * const tools, |
|
661 const RPointerArray<EapCertificateEntry> * const aCertificates, |
|
662 eap_array_c<eap_certificate_entry_c> * const internal_certificates) |
|
663 { |
|
664 EAP_TRACE_DEBUG( |
|
665 tools, |
|
666 TRACE_FLAGS_DEFAULT, |
|
667 (EAPL("CEapConversion::ConvertCertificatesToInternalType()\n"))); |
|
668 |
|
669 EAP_TRACE_RETURN_STRING(tools, "returns: CEapConversion::ConvertCertificatesToInternalType()"); |
|
670 |
|
671 eap_status_e status(eap_status_ok); |
|
672 |
|
673 if (aCertificates == 0 |
|
674 || internal_certificates == 0) |
|
675 { |
|
676 EAP_STATIC_ASSERT(eap_certificate_entry_c::eap_certificate_type_CA == static_cast<eap_certificate_entry_c::eap_certificate_type_e>(EapCertificateEntry::ECA)); |
|
677 EAP_STATIC_ASSERT(eap_certificate_entry_c::eap_certificate_type_user == static_cast<eap_certificate_entry_c::eap_certificate_type_e>(EapCertificateEntry::EUser)); |
|
678 return (tools->convert_eapol_error_to_am_error( |
|
679 EAP_STATUS_RETURN(tools, eap_status_illegal_parameter))); |
|
680 } |
|
681 |
|
682 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|
683 |
|
684 for( TInt count=0; count < aCertificates->Count(); count++ ) |
|
685 { |
|
686 const EapCertificateEntry * const cert = (*aCertificates)[count]; |
|
687 if (cert == 0) |
|
688 { |
|
689 return (tools->convert_eapol_error_to_am_error( |
|
690 EAP_STATUS_RETURN(tools, eap_status_allocation_error))); |
|
691 } |
|
692 |
|
693 eap_certificate_entry_c * const int_entry = new eap_certificate_entry_c(tools); |
|
694 |
|
695 eap_automatic_variable_c<eap_certificate_entry_c> automatic_certificate_entry( |
|
696 tools, |
|
697 int_entry); |
|
698 |
|
699 if (int_entry == 0) |
|
700 { |
|
701 return (tools->convert_eapol_error_to_am_error( |
|
702 EAP_STATUS_RETURN(tools, eap_status_illegal_parameter))); |
|
703 } |
|
704 |
|
705 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|
706 |
|
707 if (cert->GetCertType() != EapCertificateEntry::EUser |
|
708 && cert->GetCertType() != EapCertificateEntry::ECA) |
|
709 { |
|
710 return (tools->convert_eapol_error_to_am_error( |
|
711 EAP_STATUS_RETURN(tools, eap_status_illegal_parameter))); |
|
712 } |
|
713 |
|
714 int_entry->m_CertType = static_cast<eap_certificate_entry_c::eap_certificate_type_e>(cert->GetCertType()); |
|
715 |
|
716 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|
717 |
|
718 if (cert->GetSubjectNamePresent()) |
|
719 { |
|
720 ConvertFromBuf16ToInternal(tools, cert->GetSubjectName(), &(int_entry->m_SubjectName)); |
|
721 |
|
722 int_entry->m_SubjectNamePresent = true; |
|
723 } |
|
724 |
|
725 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|
726 |
|
727 if (cert->GetIssuerNamePresent()) |
|
728 { |
|
729 ConvertFromBuf16ToInternal(tools, cert->GetIssuerName(), &(int_entry->m_IssuerName)); |
|
730 |
|
731 int_entry->m_IssuerNamePresent = true; |
|
732 } |
|
733 |
|
734 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|
735 |
|
736 if (cert->GetSerialNumberPresent()) |
|
737 { |
|
738 ConvertFromBuf16ToInternal(tools, cert->GetSerialNumber(), &(int_entry->m_SerialNumber)); |
|
739 |
|
740 int_entry->m_SerialNumberPresent = true; |
|
741 } |
|
742 |
|
743 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|
744 |
|
745 if (cert->GetSubjectKeyIdPresent()) |
|
746 { |
|
747 status = int_entry->m_SubjectKeyID.set_copy_of_buffer(cert->GetSubjectKeyId().Ptr(), cert->GetSubjectKeyId().Length()); |
|
748 if (status != eap_status_ok) |
|
749 { |
|
750 return (tools->convert_eapol_error_to_am_error( |
|
751 EAP_STATUS_RETURN(tools, status))); |
|
752 } |
|
753 |
|
754 int_entry->m_SubjectKeyIDPresent = true; |
|
755 } |
|
756 |
|
757 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|
758 |
|
759 if (cert->GetThumbprintPresent()) |
|
760 { |
|
761 ConvertFromBuf16ToInternal(tools, cert->GetThumbprint(), &(int_entry->m_Thumbprint)); |
|
762 |
|
763 int_entry->m_ThumbprintPresent = true; |
|
764 } |
|
765 |
|
766 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|
767 |
|
768 if (cert->GetLabelPresent()) |
|
769 { |
|
770 ConvertFromBuf16ToInternal(tools, cert->GetLabel(), &(int_entry->m_Label)); |
|
771 |
|
772 int_entry->m_LabelPresent = true; |
|
773 } |
|
774 |
|
775 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|
776 |
|
777 if (cert->GetPrimaryNamePresent()) |
|
778 { |
|
779 ConvertFromBuf16ToInternal(tools, cert->GetPrimaryName(), &(int_entry->m_PrimaryName)); |
|
780 |
|
781 int_entry->m_PrimaryNamePresent = true; |
|
782 } |
|
783 |
|
784 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|
785 |
|
786 if (cert->GetSecondaryNamePresent()) |
|
787 { |
|
788 ConvertFromBuf16ToInternal(tools, cert->GetSecondaryName(), &(int_entry->m_SecondaryName)); |
|
789 |
|
790 int_entry->m_SecondaryNamePresent = true; |
|
791 } |
|
792 |
|
793 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|
794 |
|
795 if (cert->GetIsEnabledPresent()) |
|
796 { |
|
797 if (cert->GetIsEnabled()) |
|
798 { |
|
799 int_entry->m_iIsEnabled = true; |
|
800 } |
|
801 else |
|
802 { |
|
803 int_entry->m_iIsEnabled = false; |
|
804 } |
|
805 |
|
806 int_entry->m_iIsEnabledPresent = true; |
|
807 } |
|
808 |
|
809 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|
810 |
|
811 automatic_certificate_entry.do_not_free_variable(); |
|
812 |
|
813 status = internal_certificates->add_object(int_entry, true); |
|
814 if (status != eap_status_ok) |
|
815 { |
|
816 return (tools->convert_eapol_error_to_am_error( |
|
817 EAP_STATUS_RETURN(tools, status))); |
|
818 } |
|
819 } |
|
820 |
|
821 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|
822 |
|
823 return KErrNone; |
|
824 } |
|
825 |
|
826 // ---------------------------------------------------------- |
|
827 |
|
828 EAP_FUNC_EXPORT TInt CEapConversion::ConvertInternalTypeToCertificates( |
|
829 abs_eap_am_tools_c * const tools, |
|
830 const eap_certificate_entry_c::eap_certificate_type_e select_certificate_type, |
|
831 const eap_array_c<eap_certificate_entry_c> * const internal_certificates, |
|
832 RPointerArray<EapCertificateEntry> * const aCertificates) |
|
833 { |
|
834 EAP_TRACE_DEBUG( |
|
835 tools, |
|
836 TRACE_FLAGS_DEFAULT, |
|
837 (EAPL("CEapConversion::ConvertInternalTypeToCertificates()\n"))); |
|
838 |
|
839 EAP_TRACE_RETURN_STRING(tools, "returns: CEapConversion::ConvertInternalTypeToCertificates()"); |
|
840 |
|
841 if (aCertificates == 0 |
|
842 || internal_certificates == 0) |
|
843 { |
|
844 EAP_STATIC_ASSERT(eap_certificate_entry_c::eap_certificate_type_CA == static_cast<eap_certificate_entry_c::eap_certificate_type_e>(EapCertificateEntry::ECA)); |
|
845 EAP_STATIC_ASSERT(eap_certificate_entry_c::eap_certificate_type_user == static_cast<eap_certificate_entry_c::eap_certificate_type_e>(EapCertificateEntry::EUser)); |
|
846 return (tools->convert_eapol_error_to_am_error( |
|
847 EAP_STATUS_RETURN(tools, eap_status_illegal_parameter))); |
|
848 } |
|
849 |
|
850 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|
851 |
|
852 for( u32_t count=0; count < internal_certificates->get_object_count(); count++ ) |
|
853 { |
|
854 const eap_certificate_entry_c * const int_entry = internal_certificates->get_object(count); |
|
855 if (int_entry == 0) |
|
856 { |
|
857 return (tools->convert_eapol_error_to_am_error( |
|
858 EAP_STATUS_RETURN(tools, eap_status_illegal_parameter))); |
|
859 } |
|
860 |
|
861 if (int_entry->m_CertType == select_certificate_type) |
|
862 { |
|
863 EapCertificateEntry * cert = new EapCertificateEntry; |
|
864 |
|
865 eap_automatic_variable_c<EapCertificateEntry> automatic_cert( |
|
866 tools, |
|
867 cert); |
|
868 |
|
869 if (cert == 0) |
|
870 { |
|
871 return (tools->convert_eapol_error_to_am_error( |
|
872 EAP_STATUS_RETURN(tools, eap_status_allocation_error))); |
|
873 } |
|
874 |
|
875 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|
876 |
|
877 cert->SetCertType(static_cast<EapCertificateEntry::TCertType>(int_entry->m_CertType)); |
|
878 |
|
879 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|
880 |
|
881 if (int_entry->m_SubjectNamePresent == true) |
|
882 { |
|
883 ConvertFromInternalToBuf16(tools, &(int_entry->m_SubjectName), cert->GetSubjectNameWritable()); |
|
884 |
|
885 cert->SetSubjectNamePresent(); |
|
886 } |
|
887 |
|
888 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|
889 |
|
890 if (int_entry->m_IssuerNamePresent == true) |
|
891 { |
|
892 ConvertFromInternalToBuf16(tools, &(int_entry->m_IssuerName), cert->GetIssuerNameWritable()); |
|
893 |
|
894 cert->SetIssuerNamePresent(); |
|
895 } |
|
896 |
|
897 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|
898 |
|
899 if (int_entry->m_SerialNumberPresent == true) |
|
900 { |
|
901 ConvertFromInternalToBuf16(tools, &(int_entry->m_SerialNumber), cert->GetSerialNumberWritable()); |
|
902 |
|
903 cert->SetSerialNumberPresent(); |
|
904 } |
|
905 |
|
906 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|
907 |
|
908 if (int_entry->m_SubjectKeyIDPresent == true) |
|
909 { |
|
910 cert->GetSubjectKeyIdWritable()->Copy(int_entry->m_SubjectKeyID.get_data(), int_entry->m_SubjectKeyID.get_data_length()); |
|
911 |
|
912 cert->SetSubjectKeyIdPresent(); |
|
913 } |
|
914 |
|
915 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|
916 |
|
917 if (int_entry->m_ThumbprintPresent == true) |
|
918 { |
|
919 ConvertFromInternalToBuf16(tools, &(int_entry->m_Thumbprint), cert->GetThumbprintWritable()); |
|
920 |
|
921 cert->SetThumbprintPresent(); |
|
922 } |
|
923 |
|
924 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|
925 |
|
926 if (int_entry->m_LabelPresent == true) |
|
927 { |
|
928 ConvertFromInternalToBuf16(tools, &(int_entry->m_Label), cert->GetLabelWritable()); |
|
929 |
|
930 cert->SetLabelPresent(); |
|
931 } |
|
932 |
|
933 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|
934 |
|
935 if (int_entry->m_PrimaryNamePresent == true) |
|
936 { |
|
937 ConvertFromInternalToBuf16(tools, &(int_entry->m_PrimaryName), cert->GetPrimaryNameWritable()); |
|
938 |
|
939 cert->SetPrimaryNamePresent(); |
|
940 } |
|
941 |
|
942 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|
943 |
|
944 if (int_entry->m_SecondaryNamePresent == true) |
|
945 { |
|
946 ConvertFromInternalToBuf16(tools, &(int_entry->m_SecondaryName), cert->GetSecondaryNameWritable()); |
|
947 |
|
948 cert->SetSecondaryNamePresent(); |
|
949 } |
|
950 |
|
951 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|
952 |
|
953 if (int_entry->m_iIsEnabledPresent == true) |
|
954 { |
|
955 if (int_entry->m_iIsEnabled == true) |
|
956 { |
|
957 cert->SetIsEnabled(ETrue); |
|
958 } |
|
959 |
|
960 cert->SetIsEnabledPresent(); |
|
961 } |
|
962 |
|
963 EAP_TRACE_SETTINGS(cert); |
|
964 |
|
965 TInt error = aCertificates->Append(cert); |
|
966 if (error != KErrNone) |
|
967 { |
|
968 aCertificates->ResetAndDestroy(); // ResetAndDestroy() function must be called because the objects represented by the array need to be deleted before the array object is destroyed. |
|
969 aCertificates->Close(); // The Close() function must be called before RPointerArray object is destroyed. |
|
970 |
|
971 (void) EAP_STATUS_RETURN(tools, tools->convert_am_error_to_eapol_error(error)); |
|
972 return (error); |
|
973 } |
|
974 |
|
975 automatic_cert.do_not_free_variable(); |
|
976 } |
|
977 } // for() |
|
978 |
|
979 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|
980 |
|
981 return KErrNone; |
|
982 } |
|
983 |
|
984 // ---------------------------------------------------------- |
|
985 |
|
986 EAP_FUNC_EXPORT TInt CEapConversion::ConvertEAPSettingsToInternalType( |
|
987 abs_eap_am_tools_c * const tools, |
|
988 const EAPSettings * const aSettings, |
|
989 eap_method_settings_c * const internal_settings) |
|
990 { |
|
991 EAP_TRACE_DEBUG( |
|
992 tools, |
|
993 TRACE_FLAGS_DEFAULT, |
|
994 (EAPL("CEapConversion::ConvertEAPSettingsToInternalType()\n"))); |
|
995 |
|
996 EAP_TRACE_RETURN_STRING(tools, "returns: CEapConversion::ConvertEAPSettingsToInternalType()"); |
|
997 |
|
998 if (aSettings == 0 |
|
999 || internal_settings == 0) |
|
1000 { |
|
1001 return (tools->convert_eapol_error_to_am_error( |
|
1002 EAP_STATUS_RETURN(tools, eap_status_illegal_parameter))); |
|
1003 } |
|
1004 |
|
1005 EAP_TRACE_SETTINGS(aSettings); |
|
1006 |
|
1007 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|
1008 |
|
1009 if (aSettings->iEAPExpandedType != (*EapExpandedTypeNone.GetType())) |
|
1010 { |
|
1011 eap_status_e status = internal_settings->m_EAPType.set_expanded_type_data( |
|
1012 tools, |
|
1013 aSettings->iEAPExpandedType.GetValue().Ptr(), |
|
1014 aSettings->iEAPExpandedType.GetValue().Length()); |
|
1015 if (status != eap_status_ok) |
|
1016 { |
|
1017 return (tools->convert_eapol_error_to_am_error( |
|
1018 EAP_STATUS_RETURN(tools, status))); |
|
1019 } |
|
1020 } |
|
1021 |
|
1022 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|
1023 |
|
1024 if (aSettings->iUseAutomaticCACertificatePresent) |
|
1025 { |
|
1026 internal_settings->m_UseAutomaticCACertificatePresent = true; |
|
1027 |
|
1028 if (aSettings->iUseAutomaticCACertificate) |
|
1029 { |
|
1030 internal_settings->m_UseAutomaticCACertificate = true; |
|
1031 } |
|
1032 else |
|
1033 { |
|
1034 internal_settings->m_UseAutomaticCACertificate = false; |
|
1035 } |
|
1036 } |
|
1037 |
|
1038 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|
1039 |
|
1040 if (aSettings->iUseAutomaticUsernamePresent) |
|
1041 { |
|
1042 internal_settings->m_UseAutomaticUsernamePresent = true; |
|
1043 |
|
1044 if (aSettings->iUseAutomaticUsername) |
|
1045 { |
|
1046 internal_settings->m_UseAutomaticUsername = true; |
|
1047 } |
|
1048 else |
|
1049 { |
|
1050 internal_settings->m_UseAutomaticUsername = false; |
|
1051 } |
|
1052 } |
|
1053 |
|
1054 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|
1055 |
|
1056 if (aSettings->iUseAutomaticRealmPresent) |
|
1057 { |
|
1058 internal_settings->m_UseAutomaticRealmPresent = true; |
|
1059 |
|
1060 if (aSettings->iUseAutomaticRealm) |
|
1061 { |
|
1062 internal_settings->m_UseAutomaticRealm = true; |
|
1063 } |
|
1064 else |
|
1065 { |
|
1066 internal_settings->m_UseAutomaticRealm = false; |
|
1067 } |
|
1068 } |
|
1069 |
|
1070 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|
1071 |
|
1072 if (aSettings->iUsernamePresent) |
|
1073 { |
|
1074 TInt error = ConvertFromBuf16ToInternal(tools, &(aSettings->iUsername), &(internal_settings->m_Username_fix)); |
|
1075 if (error) |
|
1076 { |
|
1077 return error; |
|
1078 } |
|
1079 |
|
1080 internal_settings->m_UsernamePresent = true; |
|
1081 } |
|
1082 |
|
1083 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|
1084 |
|
1085 if (aSettings->iPasswordExistPresent) |
|
1086 { |
|
1087 internal_settings->m_PasswordExistPresent = true; |
|
1088 |
|
1089 if (aSettings->iPasswordExist) |
|
1090 { |
|
1091 internal_settings->m_PasswordExist = true; |
|
1092 } |
|
1093 else |
|
1094 { |
|
1095 internal_settings->m_PasswordExist = false; |
|
1096 } |
|
1097 } |
|
1098 |
|
1099 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|
1100 |
|
1101 if (aSettings->iPasswordPresent) |
|
1102 { |
|
1103 TInt error = ConvertFromBuf16ToInternal(tools, &(aSettings->iPassword), &(internal_settings->m_Password)); |
|
1104 if (error) |
|
1105 { |
|
1106 return error; |
|
1107 } |
|
1108 |
|
1109 internal_settings->m_PasswordPresent = true; |
|
1110 } |
|
1111 |
|
1112 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|
1113 |
|
1114 if (aSettings->iRealmPresent) |
|
1115 { |
|
1116 TInt error = ConvertFromBuf16ToInternal(tools, &(aSettings->iRealm), &(internal_settings->m_Realm)); |
|
1117 if (error) |
|
1118 { |
|
1119 return error; |
|
1120 } |
|
1121 |
|
1122 internal_settings->m_RealmPresent = true; |
|
1123 } |
|
1124 |
|
1125 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|
1126 |
|
1127 if (aSettings->iUsePseudonymsPresent) |
|
1128 { |
|
1129 internal_settings->m_UsePseudonymsPresent = true; |
|
1130 |
|
1131 if (aSettings->iUsePseudonyms) |
|
1132 { |
|
1133 internal_settings->m_UsePseudonyms = true; |
|
1134 } |
|
1135 else |
|
1136 { |
|
1137 internal_settings->m_UsePseudonyms = false; |
|
1138 } |
|
1139 } |
|
1140 |
|
1141 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|
1142 |
|
1143 if (aSettings->iVerifyServerRealmPresent) |
|
1144 { |
|
1145 internal_settings->m_VerifyServerRealmPresent = true; |
|
1146 |
|
1147 if (aSettings->iVerifyServerRealm) |
|
1148 { |
|
1149 internal_settings->m_VerifyServerRealm = true; |
|
1150 } |
|
1151 else |
|
1152 { |
|
1153 internal_settings->m_VerifyServerRealm = false; |
|
1154 } |
|
1155 } |
|
1156 |
|
1157 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|
1158 |
|
1159 if (aSettings->iRequireClientAuthenticationPresent) |
|
1160 { |
|
1161 internal_settings->m_RequireClientAuthenticationPresent = true; |
|
1162 |
|
1163 if (aSettings->iRequireClientAuthentication) |
|
1164 { |
|
1165 internal_settings->m_RequireClientAuthentication = true; |
|
1166 } |
|
1167 else |
|
1168 { |
|
1169 internal_settings->m_RequireClientAuthentication = false; |
|
1170 } |
|
1171 } |
|
1172 |
|
1173 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|
1174 |
|
1175 if (aSettings->iSessionValidityTimePresent) |
|
1176 { |
|
1177 internal_settings->m_SessionValidityTimePresent = true; |
|
1178 |
|
1179 internal_settings->m_SessionValidityTime = static_cast<u32_t>(aSettings->iSessionValidityTime); |
|
1180 } |
|
1181 |
|
1182 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|
1183 |
|
1184 if (aSettings->iCipherSuitesPresent) |
|
1185 { |
|
1186 TInt error = ConvertCipherSuitesToInternalType( |
|
1187 tools, |
|
1188 &(aSettings->iCipherSuites), |
|
1189 &(internal_settings->m_CipherSuites)); |
|
1190 if (error) |
|
1191 { |
|
1192 return error; |
|
1193 } |
|
1194 |
|
1195 internal_settings->m_CipherSuitesPresent = true; |
|
1196 } |
|
1197 |
|
1198 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|
1199 |
|
1200 if (aSettings->iPEAPVersionsPresent) |
|
1201 { |
|
1202 internal_settings->m_PEAPVersionsPresent = true; |
|
1203 |
|
1204 if (aSettings->iPEAPv0Allowed) |
|
1205 { |
|
1206 internal_settings->m_PEAPv0Allowed = true; |
|
1207 } |
|
1208 else |
|
1209 { |
|
1210 internal_settings->m_PEAPv0Allowed = false; |
|
1211 } |
|
1212 |
|
1213 if (aSettings->iPEAPv1Allowed) |
|
1214 { |
|
1215 internal_settings->m_PEAPv1Allowed = true; |
|
1216 } |
|
1217 else |
|
1218 { |
|
1219 internal_settings->m_PEAPv1Allowed = false; |
|
1220 } |
|
1221 |
|
1222 if (aSettings->iPEAPv2Allowed) |
|
1223 { |
|
1224 internal_settings->m_PEAPv2Allowed = true; |
|
1225 } |
|
1226 else |
|
1227 { |
|
1228 internal_settings->m_PEAPv2Allowed = false; |
|
1229 } |
|
1230 } |
|
1231 |
|
1232 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|
1233 |
|
1234 if (aSettings->iCertificatesPresent) |
|
1235 { |
|
1236 TInt error = ConvertCertificatesToInternalType( |
|
1237 tools, |
|
1238 &(aSettings->iCertificates), |
|
1239 &(internal_settings->m_Certificates)); |
|
1240 if (error) |
|
1241 { |
|
1242 return error; |
|
1243 } |
|
1244 |
|
1245 internal_settings->m_CertificatesPresent = true; |
|
1246 } |
|
1247 |
|
1248 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|
1249 |
|
1250 if (aSettings->iEnabledEncapsulatedEAPExpandedTypesPresent) |
|
1251 { |
|
1252 TInt error = ConvertExpandedEAPTypesToInternalTypes( |
|
1253 tools, |
|
1254 &(aSettings->iEnabledEncapsulatedEAPExpandedTypes), |
|
1255 &(internal_settings->m_EnabledEncapsulatedEAPTypes)); |
|
1256 if (error) |
|
1257 { |
|
1258 return error; |
|
1259 } |
|
1260 |
|
1261 internal_settings->m_EnabledEncapsulatedEAPTypesPresent = true; |
|
1262 } |
|
1263 |
|
1264 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|
1265 |
|
1266 if (aSettings->iDisabledEncapsulatedEAPExpandedTypesPresent) |
|
1267 { |
|
1268 TInt error = ConvertExpandedEAPTypesToInternalTypes( |
|
1269 tools, |
|
1270 &(aSettings->iDisabledEncapsulatedEAPExpandedTypes), |
|
1271 &(internal_settings->m_DisabledEncapsulatedEAPTypes)); |
|
1272 if (error) |
|
1273 { |
|
1274 return error; |
|
1275 } |
|
1276 |
|
1277 internal_settings->m_DisabledEncapsulatedEAPTypesPresent = true; |
|
1278 } |
|
1279 |
|
1280 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|
1281 |
|
1282 if (aSettings->iAuthProvModeAllowedPresent) |
|
1283 { |
|
1284 internal_settings->m_AuthProvModeAllowedPresent = true; |
|
1285 |
|
1286 if (aSettings->iAuthProvModeAllowed) |
|
1287 { |
|
1288 internal_settings->m_AuthProvModeAllowed = true; |
|
1289 } |
|
1290 else |
|
1291 { |
|
1292 internal_settings->m_AuthProvModeAllowed = false; |
|
1293 } |
|
1294 } |
|
1295 |
|
1296 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|
1297 |
|
1298 if (aSettings->iUnauthProvModeAllowedPresent) |
|
1299 { |
|
1300 internal_settings->m_UnauthProvModeAllowedPresent = true; |
|
1301 |
|
1302 if (aSettings->iUnauthProvModeAllowed) |
|
1303 { |
|
1304 internal_settings->m_UnauthProvModeAllowed = true; |
|
1305 } |
|
1306 else |
|
1307 { |
|
1308 internal_settings->m_UnauthProvModeAllowed = false; |
|
1309 } |
|
1310 } |
|
1311 |
|
1312 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|
1313 |
|
1314 if (aSettings->iPACGroupReferencePresent) |
|
1315 { |
|
1316 TInt error = ConvertFromBuf16ToInternal(tools, &(aSettings->iPACGroupReference), &(internal_settings->m_PACGroupReference)); |
|
1317 if (error) |
|
1318 { |
|
1319 return error; |
|
1320 } |
|
1321 |
|
1322 internal_settings->m_RealmPresent = true; |
|
1323 } |
|
1324 |
|
1325 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|
1326 |
|
1327 if (aSettings->iWarnADHPNoPACPresent) |
|
1328 { |
|
1329 internal_settings->m_WarnADHPNoPACPresent = true; |
|
1330 |
|
1331 if (aSettings->iWarnADHPNoPAC) |
|
1332 { |
|
1333 internal_settings->m_WarnADHPNoPAC = true; |
|
1334 } |
|
1335 else |
|
1336 { |
|
1337 internal_settings->m_WarnADHPNoPAC = false; |
|
1338 } |
|
1339 } |
|
1340 |
|
1341 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|
1342 |
|
1343 if (aSettings->iWarnADHPNoMatchingPACPresent) |
|
1344 { |
|
1345 internal_settings->m_WarnADHPNoMatchingPACPresent = true; |
|
1346 |
|
1347 if (aSettings->iWarnADHPNoMatchingPAC) |
|
1348 { |
|
1349 internal_settings->m_WarnADHPNoMatchingPAC = true; |
|
1350 } |
|
1351 else |
|
1352 { |
|
1353 internal_settings->m_WarnADHPNoMatchingPAC = false; |
|
1354 } |
|
1355 } |
|
1356 |
|
1357 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|
1358 |
|
1359 if (aSettings->iWarnNotDefaultServerPresent) |
|
1360 { |
|
1361 internal_settings->m_WarnNotDefaultServerPresent = true; |
|
1362 |
|
1363 if (aSettings->iWarnNotDefaultServer) |
|
1364 { |
|
1365 internal_settings->m_WarnNotDefaultServer = true; |
|
1366 } |
|
1367 else |
|
1368 { |
|
1369 internal_settings->m_WarnNotDefaultServer = false; |
|
1370 } |
|
1371 } |
|
1372 |
|
1373 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|
1374 |
|
1375 if (aSettings->iShowPassWordPromptPresent) |
|
1376 { |
|
1377 internal_settings->m_ShowPassWordPromptPresent = true; |
|
1378 |
|
1379 if (aSettings->iShowPassWordPrompt) |
|
1380 { |
|
1381 internal_settings->m_ShowPassWordPrompt = true; |
|
1382 } |
|
1383 else |
|
1384 { |
|
1385 internal_settings->m_ShowPassWordPrompt = false; |
|
1386 } |
|
1387 } |
|
1388 |
|
1389 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|
1390 |
|
1391 if (aSettings->iUseIdentityPrivacyPresent) |
|
1392 { |
|
1393 internal_settings->m_UseIdentityPrivacyPresent = true; |
|
1394 |
|
1395 if (aSettings->iUseIdentityPrivacy) |
|
1396 { |
|
1397 internal_settings->m_UseIdentityPrivacy = true; |
|
1398 } |
|
1399 else |
|
1400 { |
|
1401 internal_settings->m_UseIdentityPrivacy = false; |
|
1402 } |
|
1403 } |
|
1404 |
|
1405 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|
1406 |
|
1407 EAP_TRACE_METHOD_SETTINGS(internal_settings); |
|
1408 |
|
1409 return KErrNone; |
|
1410 } |
|
1411 |
|
1412 // ---------------------------------------------------------- |
|
1413 |
|
1414 EAP_FUNC_EXPORT TInt CEapConversion::ConvertInternalTypeToEAPSettings( |
|
1415 abs_eap_am_tools_c * const tools, |
|
1416 const eap_method_settings_c * const internal_settings, |
|
1417 EAPSettings * const aSettings) |
|
1418 { |
|
1419 EAP_TRACE_DEBUG( |
|
1420 tools, |
|
1421 TRACE_FLAGS_DEFAULT, |
|
1422 (EAPL("CEapConversion::ConvertInternalTypeToEAPSettings()\n"))); |
|
1423 |
|
1424 EAP_TRACE_RETURN_STRING(tools, "returns: CEapConversion::ConvertInternalTypeToEAPSettings()"); |
|
1425 |
|
1426 if (aSettings == 0 |
|
1427 || internal_settings == 0) |
|
1428 { |
|
1429 return (tools->convert_eapol_error_to_am_error( |
|
1430 EAP_STATUS_RETURN(tools, eap_status_illegal_parameter))); |
|
1431 } |
|
1432 |
|
1433 EAP_TRACE_METHOD_SETTINGS(internal_settings); |
|
1434 |
|
1435 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|
1436 |
|
1437 { |
|
1438 eap_variable_data_c eap_data(tools); |
|
1439 |
|
1440 eap_status_e status = internal_settings->m_EAPType.get_expanded_type_data( |
|
1441 tools, |
|
1442 &eap_data); |
|
1443 if (status != eap_status_ok) |
|
1444 { |
|
1445 return (tools->convert_eapol_error_to_am_error( |
|
1446 EAP_STATUS_RETURN(tools, status))); |
|
1447 } |
|
1448 |
|
1449 TInt error = aSettings->iEAPExpandedType.SetValue( |
|
1450 eap_data.get_data(), |
|
1451 eap_data.get_data_length()); |
|
1452 } |
|
1453 |
|
1454 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|
1455 |
|
1456 if (internal_settings->m_UseAutomaticCACertificatePresent == true) |
|
1457 { |
|
1458 aSettings->iUseAutomaticCACertificatePresent = ETrue; |
|
1459 |
|
1460 if (internal_settings->m_UseAutomaticCACertificate == true) |
|
1461 { |
|
1462 aSettings->iUseAutomaticCACertificate = ETrue; |
|
1463 } |
|
1464 else |
|
1465 { |
|
1466 aSettings->iUseAutomaticCACertificate = EFalse; |
|
1467 } |
|
1468 } |
|
1469 |
|
1470 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|
1471 |
|
1472 if (internal_settings->m_UseAutomaticUsernamePresent == true) |
|
1473 { |
|
1474 aSettings->iUseAutomaticUsernamePresent = ETrue; |
|
1475 |
|
1476 if (internal_settings->m_UseAutomaticUsername == true) |
|
1477 { |
|
1478 aSettings->iUseAutomaticUsername = ETrue; |
|
1479 } |
|
1480 else |
|
1481 { |
|
1482 aSettings->iUseAutomaticUsername = EFalse; |
|
1483 } |
|
1484 } |
|
1485 |
|
1486 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|
1487 |
|
1488 if (internal_settings->m_UseAutomaticRealmPresent == true) |
|
1489 { |
|
1490 aSettings->iUseAutomaticRealmPresent = ETrue; |
|
1491 |
|
1492 if (internal_settings->m_UseAutomaticRealm == true) |
|
1493 { |
|
1494 aSettings->iUseAutomaticRealm = ETrue; |
|
1495 } |
|
1496 else |
|
1497 { |
|
1498 aSettings->iUseAutomaticRealm = EFalse; |
|
1499 } |
|
1500 } |
|
1501 |
|
1502 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|
1503 |
|
1504 if (internal_settings->m_UsernamePresent == true) |
|
1505 { |
|
1506 TInt error = ConvertFromInternalToBuf16(tools, &(internal_settings->m_Username_fix), &(aSettings->iUsername)); |
|
1507 if (error) |
|
1508 { |
|
1509 return error; |
|
1510 } |
|
1511 |
|
1512 aSettings->iUsernamePresent = ETrue; |
|
1513 } |
|
1514 |
|
1515 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|
1516 |
|
1517 if (internal_settings->m_PasswordExistPresent == true) |
|
1518 { |
|
1519 aSettings->iPasswordExistPresent = ETrue; |
|
1520 |
|
1521 if (internal_settings->m_PasswordExist == true) |
|
1522 { |
|
1523 aSettings->iPasswordExist = ETrue; |
|
1524 } |
|
1525 else |
|
1526 { |
|
1527 aSettings->iPasswordExist = EFalse; |
|
1528 } |
|
1529 } |
|
1530 |
|
1531 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|
1532 |
|
1533 if (internal_settings->m_PasswordPresent == true) |
|
1534 { |
|
1535 TInt error = ConvertFromInternalToBuf16(tools, &(internal_settings->m_Password), &(aSettings->iPassword)); |
|
1536 if (error) |
|
1537 { |
|
1538 return error; |
|
1539 } |
|
1540 |
|
1541 aSettings->iPasswordPresent = ETrue; |
|
1542 } |
|
1543 |
|
1544 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|
1545 |
|
1546 if (internal_settings->m_RealmPresent == true) |
|
1547 { |
|
1548 TInt error = ConvertFromInternalToBuf16(tools, &(internal_settings->m_Realm), &(aSettings->iRealm)); |
|
1549 if (error) |
|
1550 { |
|
1551 return error; |
|
1552 } |
|
1553 |
|
1554 aSettings->iRealmPresent = ETrue; |
|
1555 } |
|
1556 |
|
1557 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|
1558 |
|
1559 if (internal_settings->m_UsePseudonymsPresent == true) |
|
1560 { |
|
1561 aSettings->iUsePseudonymsPresent = ETrue; |
|
1562 |
|
1563 if (internal_settings->m_UsePseudonyms == true) |
|
1564 { |
|
1565 aSettings->iUsePseudonyms = ETrue; |
|
1566 } |
|
1567 else |
|
1568 { |
|
1569 aSettings->iUsePseudonyms = EFalse; |
|
1570 } |
|
1571 } |
|
1572 |
|
1573 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|
1574 |
|
1575 if (internal_settings->m_VerifyServerRealmPresent == true) |
|
1576 { |
|
1577 aSettings->iVerifyServerRealmPresent = ETrue; |
|
1578 |
|
1579 if (internal_settings->m_VerifyServerRealm == true) |
|
1580 { |
|
1581 aSettings->iVerifyServerRealm = ETrue; |
|
1582 } |
|
1583 else |
|
1584 { |
|
1585 aSettings->iVerifyServerRealm = EFalse; |
|
1586 } |
|
1587 } |
|
1588 |
|
1589 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|
1590 |
|
1591 if (internal_settings->m_RequireClientAuthenticationPresent == true) |
|
1592 { |
|
1593 aSettings->iRequireClientAuthenticationPresent = ETrue; |
|
1594 |
|
1595 if (internal_settings->m_RequireClientAuthentication == true) |
|
1596 { |
|
1597 aSettings->iRequireClientAuthentication = ETrue; |
|
1598 } |
|
1599 else |
|
1600 { |
|
1601 aSettings->iRequireClientAuthentication = EFalse; |
|
1602 } |
|
1603 } |
|
1604 |
|
1605 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|
1606 |
|
1607 if (internal_settings->m_SessionValidityTimePresent == true) |
|
1608 { |
|
1609 aSettings->iSessionValidityTimePresent = ETrue; |
|
1610 |
|
1611 aSettings->iSessionValidityTime = static_cast<TUint>(internal_settings->m_SessionValidityTime); |
|
1612 } |
|
1613 |
|
1614 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|
1615 |
|
1616 if (internal_settings->m_CipherSuitesPresent == true) |
|
1617 { |
|
1618 TInt error = ConvertInternalTypeToCipherSuites( |
|
1619 tools, |
|
1620 &(internal_settings->m_CipherSuites), |
|
1621 &(aSettings->iCipherSuites)); |
|
1622 if (error) |
|
1623 { |
|
1624 return error; |
|
1625 } |
|
1626 |
|
1627 aSettings->iCipherSuitesPresent = ETrue; |
|
1628 } |
|
1629 |
|
1630 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|
1631 |
|
1632 if (internal_settings->m_PEAPVersionsPresent == true) |
|
1633 { |
|
1634 aSettings->iPEAPVersionsPresent = ETrue; |
|
1635 |
|
1636 if (internal_settings->m_PEAPv0Allowed == true) |
|
1637 { |
|
1638 aSettings->iPEAPv0Allowed = ETrue; |
|
1639 } |
|
1640 else |
|
1641 { |
|
1642 aSettings->iPEAPv0Allowed = EFalse; |
|
1643 } |
|
1644 |
|
1645 if (internal_settings->m_PEAPv1Allowed == true) |
|
1646 { |
|
1647 aSettings->iPEAPv1Allowed = ETrue; |
|
1648 } |
|
1649 else |
|
1650 { |
|
1651 aSettings->iPEAPv1Allowed = EFalse; |
|
1652 } |
|
1653 |
|
1654 if (internal_settings->m_PEAPv2Allowed == true) |
|
1655 { |
|
1656 aSettings->iPEAPv2Allowed = ETrue; |
|
1657 } |
|
1658 else |
|
1659 { |
|
1660 aSettings->iPEAPv2Allowed = EFalse; |
|
1661 } |
|
1662 } |
|
1663 |
|
1664 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|
1665 |
|
1666 if (internal_settings->m_CertificatesPresent == true) |
|
1667 { |
|
1668 TInt error = KErrNone; |
|
1669 |
|
1670 error = ConvertInternalTypeToCertificates( |
|
1671 tools, |
|
1672 eap_certificate_entry_c::eap_certificate_type_user, |
|
1673 &(internal_settings->m_Certificates), |
|
1674 &(aSettings->iCertificates)); |
|
1675 |
|
1676 if (error) |
|
1677 { |
|
1678 return error; |
|
1679 } |
|
1680 |
|
1681 error = ConvertInternalTypeToCertificates( |
|
1682 tools, |
|
1683 eap_certificate_entry_c::eap_certificate_type_CA, |
|
1684 &(internal_settings->m_Certificates), |
|
1685 &(aSettings->iCertificates)); |
|
1686 |
|
1687 if (error) |
|
1688 { |
|
1689 return error; |
|
1690 } |
|
1691 |
|
1692 aSettings->iCertificatesPresent = ETrue; |
|
1693 } |
|
1694 |
|
1695 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|
1696 |
|
1697 if (internal_settings->m_EnabledEncapsulatedEAPTypesPresent == true) |
|
1698 { |
|
1699 TInt error = ConvertInternalTypesToExpandedEAPTypes( |
|
1700 tools, |
|
1701 &(internal_settings->m_EnabledEncapsulatedEAPTypes), |
|
1702 &(aSettings->iEnabledEncapsulatedEAPExpandedTypes)); |
|
1703 if (error) |
|
1704 { |
|
1705 return error; |
|
1706 } |
|
1707 |
|
1708 aSettings->iEnabledEncapsulatedEAPExpandedTypesPresent = ETrue; |
|
1709 } |
|
1710 |
|
1711 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|
1712 |
|
1713 if (internal_settings->m_DisabledEncapsulatedEAPTypesPresent == true) |
|
1714 { |
|
1715 TInt error = ConvertInternalTypesToExpandedEAPTypes( |
|
1716 tools, |
|
1717 &(internal_settings->m_DisabledEncapsulatedEAPTypes), |
|
1718 &(aSettings->iDisabledEncapsulatedEAPExpandedTypes)); |
|
1719 if (error) |
|
1720 { |
|
1721 return error; |
|
1722 } |
|
1723 |
|
1724 aSettings->iDisabledEncapsulatedEAPExpandedTypesPresent = ETrue; |
|
1725 } |
|
1726 |
|
1727 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|
1728 |
|
1729 if (internal_settings->m_AuthProvModeAllowedPresent == true) |
|
1730 { |
|
1731 aSettings->iAuthProvModeAllowedPresent = ETrue; |
|
1732 |
|
1733 if (internal_settings->m_AuthProvModeAllowed == true) |
|
1734 { |
|
1735 aSettings->iAuthProvModeAllowed = ETrue; |
|
1736 } |
|
1737 else |
|
1738 { |
|
1739 aSettings->iAuthProvModeAllowed = EFalse; |
|
1740 } |
|
1741 } |
|
1742 |
|
1743 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|
1744 |
|
1745 if (internal_settings->m_UnauthProvModeAllowedPresent == true) |
|
1746 { |
|
1747 aSettings->iUnauthProvModeAllowedPresent = ETrue; |
|
1748 |
|
1749 if (internal_settings->m_UnauthProvModeAllowed == true) |
|
1750 { |
|
1751 aSettings->iUnauthProvModeAllowed = ETrue; |
|
1752 } |
|
1753 else |
|
1754 { |
|
1755 aSettings->iUnauthProvModeAllowed = EFalse; |
|
1756 } |
|
1757 } |
|
1758 |
|
1759 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|
1760 |
|
1761 if (internal_settings->m_PACGroupReferencePresent == true) |
|
1762 { |
|
1763 TInt error = ConvertFromInternalToBuf16(tools, &(internal_settings->m_PACGroupReference), &(aSettings->iPACGroupReference)); |
|
1764 if (error) |
|
1765 { |
|
1766 return error; |
|
1767 } |
|
1768 |
|
1769 aSettings->iPACGroupReferencePresent = ETrue; |
|
1770 } |
|
1771 |
|
1772 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|
1773 |
|
1774 if (internal_settings->m_WarnADHPNoPACPresent == true) |
|
1775 { |
|
1776 aSettings->iWarnADHPNoPACPresent = ETrue; |
|
1777 |
|
1778 if (internal_settings->m_WarnADHPNoPAC == true) |
|
1779 { |
|
1780 aSettings->iWarnADHPNoPAC = ETrue; |
|
1781 } |
|
1782 else |
|
1783 { |
|
1784 aSettings->iWarnADHPNoPAC = EFalse; |
|
1785 } |
|
1786 } |
|
1787 |
|
1788 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|
1789 |
|
1790 if (internal_settings->m_WarnADHPNoMatchingPACPresent == true) |
|
1791 { |
|
1792 aSettings->iWarnADHPNoMatchingPACPresent = ETrue; |
|
1793 |
|
1794 if (internal_settings->m_WarnADHPNoMatchingPAC == true) |
|
1795 { |
|
1796 aSettings->iWarnADHPNoMatchingPAC = ETrue; |
|
1797 } |
|
1798 else |
|
1799 { |
|
1800 aSettings->iWarnADHPNoMatchingPAC = EFalse; |
|
1801 } |
|
1802 } |
|
1803 |
|
1804 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|
1805 |
|
1806 if (internal_settings->m_WarnNotDefaultServerPresent == true) |
|
1807 { |
|
1808 aSettings->iWarnNotDefaultServerPresent = ETrue; |
|
1809 |
|
1810 if (internal_settings->m_WarnNotDefaultServer == true) |
|
1811 { |
|
1812 aSettings->iWarnNotDefaultServer = ETrue; |
|
1813 } |
|
1814 else |
|
1815 { |
|
1816 aSettings->iWarnNotDefaultServer = EFalse; |
|
1817 } |
|
1818 } |
|
1819 |
|
1820 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|
1821 |
|
1822 if (internal_settings->m_ShowPassWordPromptPresent == true) |
|
1823 { |
|
1824 aSettings->iShowPassWordPromptPresent = ETrue; |
|
1825 |
|
1826 if (internal_settings->m_ShowPassWordPrompt == true) |
|
1827 { |
|
1828 aSettings->iShowPassWordPrompt = ETrue; |
|
1829 } |
|
1830 else |
|
1831 { |
|
1832 aSettings->iShowPassWordPrompt = EFalse; |
|
1833 } |
|
1834 } |
|
1835 |
|
1836 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|
1837 |
|
1838 if (internal_settings->m_UseIdentityPrivacyPresent == true) |
|
1839 { |
|
1840 aSettings->iUseIdentityPrivacyPresent = ETrue; |
|
1841 |
|
1842 if (internal_settings->m_UseIdentityPrivacy == true) |
|
1843 { |
|
1844 aSettings->iUseIdentityPrivacy = ETrue; |
|
1845 } |
|
1846 else |
|
1847 { |
|
1848 aSettings->iUseIdentityPrivacy = EFalse; |
|
1849 } |
|
1850 } |
|
1851 |
|
1852 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|
1853 |
|
1854 EAP_TRACE_SETTINGS(aSettings); |
|
1855 |
|
1856 return KErrNone; |
|
1857 } |
|
1858 |
|
1859 // ---------------------------------------------------------- |
|
1860 // End of file |
|