63 //#include "eap_am_async_wait_symbian.h" |
63 //#include "eap_am_async_wait_symbian.h" |
64 #include "EapFastActive.h" |
64 #include "EapFastActive.h" |
65 #include "eap_tlv_header.h" |
65 #include "eap_tlv_header.h" |
66 #include "eap_tlv_message_data.h" |
66 #include "eap_tlv_message_data.h" |
67 #endif |
67 #endif |
68 |
68 #include <utf.h> |
69 #include "eap_ttls_pap_active.h" |
69 |
70 |
70 |
71 #ifdef USE_PAC_STORE |
71 #ifdef USE_PAC_STORE |
72 #include "pac_store_db_symbian.h" |
72 #include "pac_store_db_symbian.h" |
73 #include <f32file.h> |
73 #include <f32file.h> |
74 #endif |
74 #endif |
75 |
75 |
76 #ifdef USE_EAP_EXPANDED_TYPES |
|
77 #include "eap_header_string.h" |
76 #include "eap_header_string.h" |
78 #endif //#ifdef USE_EAP_EXPANDED_TYPES |
|
79 |
77 |
80 #if defined(USE_EAP_CONFIGURATION_TO_SKIP_USER_INTERACTIONS) |
78 #if defined(USE_EAP_CONFIGURATION_TO_SKIP_USER_INTERACTIONS) |
81 #include "eap_config.h" |
79 #include "eap_config.h" |
82 #include "eap_file_config.h" |
80 #include "eap_file_config.h" |
83 #include "eap_am_file_input_symbian.h" |
81 #include "eap_am_file_input_symbian.h" |
84 #endif |
82 #endif |
|
83 |
|
84 #include "EapConfigToolsSymbian.h" |
|
85 #include "EapConversion.h" |
|
86 |
|
87 #include <EapPluginTools.h> |
|
88 #include <mmtsy_names.h> |
|
89 |
85 |
90 |
86 const TUint KMaxSqlQueryLength = 512; |
91 const TUint KMaxSqlQueryLength = 512; |
87 const TUint KMaxDBFieldNameLength = 255; |
92 const TUint KMaxDBFieldNameLength = 255; |
88 const TUint KDSASignatureLength = 40; |
93 const TUint KDSASignatureLength = 40; |
89 const TInt KDefaultColumnInView_One = 1; // For DB view. |
94 const TInt KDefaultColumnInView_One = 1; // For DB view. |
90 const TInt KMicroSecsInASecond = 1000000; // 1000000 micro seconds is 1 second. |
95 const TInt KMicroSecsInASecond = 1000000; // 1000000 micro seconds is 1 second. |
91 |
96 |
|
97 #ifdef USE_FAST_EAP_TYPE |
|
98 |
|
99 const TUint KMaxDeviceSeedLength = RMobilePhone::KPhoneManufacturerIdSize+ |
|
100 RMobilePhone::KPhoneModelIdSize+ |
|
101 RMobilePhone::KPhoneSerialNumberSize; |
|
102 const TUint KMaxDeviceSeedSize = 2*KMaxDeviceSeedLength; |
|
103 #endif |
92 /** |
104 /** |
93 * Length of the MAC address |
105 * Length of the MAC address |
94 */ |
106 */ |
95 #ifdef USE_FAST_EAP_TYPE |
107 #ifdef USE_FAST_EAP_TYPE |
96 const TUint8 KMacAddressLength = 6; |
108 const TUint8 KMacAddressLength = 6; |
97 #endif |
109 #endif |
|
110 |
98 //-------------------------------------------------- |
111 //-------------------------------------------------- |
99 |
112 |
100 eap_am_type_tls_peap_symbian_c::eap_am_type_tls_peap_symbian_c( |
113 eap_am_type_tls_peap_symbian_c::eap_am_type_tls_peap_symbian_c( |
101 abs_eap_am_tools_c * const aTools, |
114 abs_eap_am_tools_c * const aTools, |
102 abs_eap_base_type_c * const aPartner, |
115 abs_eap_base_type_c * const aPartner, |
136 , m_peer_public_key(aTools) |
148 , m_peer_public_key(aTools) |
137 , m_param_p(aTools) |
149 , m_param_p(aTools) |
138 , m_param_q(aTools) |
150 , m_param_q(aTools) |
139 , m_param_g(aTools) |
151 , m_param_g(aTools) |
140 , m_shutdown_was_called(false) |
152 , m_shutdown_was_called(false) |
141 , m_identity_info(0) |
153 |
142 , m_tunneled_type(eap_type_none) |
154 , m_tunneled_type(eap_type_none) |
143 , m_verify_certificate_realm(true) |
155 , m_verify_certificate_realm(true) |
144 , m_allow_subdomain_matching(false) |
156 , m_allow_subdomain_matching(false) |
145 , m_latest_alert_description(tls_alert_description_none) |
157 , m_latest_alert_description(tls_alert_description_none) |
146 , m_use_manual_username(false) |
158 , m_use_manual_username(false) |
147 , m_manual_username(aTools) |
159 , m_manual_username(aTools) |
148 , m_use_manual_realm(false) |
160 , m_use_manual_realm(false) |
149 , m_manual_realm(aTools) |
161 , m_manual_realm(aTools) |
150 , m_tls_peap_server_authenticates_client_policy_flag(true) |
162 , m_tls_peap_server_authenticates_client_policy_flag(true) |
|
163 , m_use_automatic_ca_certificate(false) |
151 , m_configured(false) |
164 , m_configured(false) |
152 , m_max_session_time(0) |
165 , m_max_session_time(0) |
153 #if defined(USE_EAP_TLS_SESSION_TICKET) |
166 #if defined(USE_EAP_TLS_SESSION_TICKET) |
154 , m_use_session_ticket(false) |
167 , m_use_session_ticket(false) |
155 #endif //#if defined(USE_EAP_TLS_SESSION_TICKET) |
168 #endif //#if defined(USE_EAP_TLS_SESSION_TICKET) |
174 , m_references_and_data_blocks(aTools) |
187 , m_references_and_data_blocks(aTools) |
175 , m_new_references_and_data_blocks(aTools) |
188 , m_new_references_and_data_blocks(aTools) |
176 , m_ready_references_and_data_blocks(aTools) |
189 , m_ready_references_and_data_blocks(aTools) |
177 , m_serv_unauth_prov_mode(false) |
190 , m_serv_unauth_prov_mode(false) |
178 , m_serv_auth_prov_mode(false) |
191 , m_serv_auth_prov_mode(false) |
179 , m_is_notifier_connected(false) |
192 |
180 , m_notifier_data_to_user(NULL) |
193 , m_notifier_data_to_user(NULL) |
181 , m_notifier_data_pckg_to_user(NULL) |
194 , m_notifier_data_pckg_to_user(NULL) |
182 , m_notifier_data_from_user(NULL) |
195 |
183 , m_notifier_data_pckg_from_user(NULL) |
196 , iMMETELConnectionStatus(false) |
184 , m_completed_with_zero(false) |
197 , m_completed_with_zero(false) |
185 , m_verificationStatus(false) |
198 , m_verificationStatus(false) |
|
199 , m_pacStorePWBuf8(0) |
|
200 , m_userAction(EEapFastNotifierUserActionOk) |
|
201 , m_pacStoreDataRefType(eap_pac_store_data_type_none) |
186 , m_data_reference(m_am_tools) |
202 , m_data_reference(m_am_tools) |
187 , m_notifier_complete(false) |
|
188 , m_userResponse(m_am_tools) |
203 , m_userResponse(m_am_tools) |
|
204 , m_pending_operation(eap_fast_pac_store_pending_operation_none) |
189 , m_both_completed(0) |
205 , m_both_completed(0) |
190 , m_both_asked(0) |
206 , m_both_asked(0) |
|
207 , m_ready_references_array_index(0) |
|
208 , m_provisioning_mode(eap_fast_completion_operation_none) |
|
209 , iCompletionOperation(eap_fast_completion_operation_none) |
|
210 , iCompletion(eap_fast_initialize_pac_store_completion_none) |
191 #endif //#if defined(USE_FAST_EAP_TYPE) |
211 #endif //#if defined(USE_FAST_EAP_TYPE) |
|
212 |
|
213 , m_notifier_complete(false) |
192 |
214 |
193 #ifdef USE_PAC_STORE |
215 #ifdef USE_PAC_STORE |
194 ,iPacStoreDb(NULL) |
216 ,iPacStoreDb(NULL) |
195 #endif |
217 #endif |
196 |
218 |
197 #ifdef USE_EAP_CONFIGURATION_TO_SKIP_USER_INTERACTIONS |
219 #ifdef USE_EAP_CONFIGURATION_TO_SKIP_USER_INTERACTIONS |
198 , m_skip_user_interactions(false) |
220 , m_skip_user_interactions(false) |
199 , m_fileconfig(0) |
221 , m_fileconfig(0) |
200 #endif |
222 #endif |
201 |
223 |
202 |
224 , iEapTtlsPapMaxSessionConfigTime( 0 ) |
203 |
225 |
204 , iEapTtlsPapMaxSessionConfigTime( 0 ) |
226 |
205 , iEapTtlsPapActive( NULL ) |
227 |
206 |
228 , iPacStoreDeviceSeed(0) |
|
229 |
|
230 , iEapAuthNotifier(0) |
|
231 |
207 { |
232 { |
208 EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT); |
233 EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT); |
209 |
234 |
210 #ifdef USE_EAP_EXPANDED_TYPES |
|
211 |
|
212 m_tunneling_vendor_type = m_tunneling_type.get_vendor_type(); |
|
213 m_current_eap_vendor_type = m_current_eap_type.get_vendor_type(); |
|
214 |
|
215 #else |
|
216 |
|
217 m_tunneling_vendor_type = static_cast<TUint>(m_tunneling_type); |
|
218 m_current_eap_vendor_type = static_cast<TUint>(m_current_eap_type); |
|
219 |
|
220 #endif //#ifdef USE_EAP_EXPANDED_TYPES |
|
221 |
|
222 // Set the database table name based on the type |
235 // Set the database table name based on the type |
223 switch (m_current_eap_vendor_type) |
236 if (m_current_eap_type == eap_type_tls) |
224 { |
237 { |
225 case eap_type_tls: |
238 m_db_table_name = KTlsDatabaseTableName; |
226 m_db_table_name = KTlsDatabaseTableName; |
239 m_db_user_cert_table_name = KTlsAllowedUserCertsDatabaseTableName; |
227 m_db_user_cert_table_name = KTlsAllowedUserCertsDatabaseTableName; |
240 m_db_ca_cert_table_name = KTlsAllowedCACertsDatabaseTableName; |
228 m_db_ca_cert_table_name = KTlsAllowedCACertsDatabaseTableName; |
241 m_db_cipher_suite_table_name = KTlsAllowedCipherSuitesDatabaseTableName; |
229 m_db_cipher_suite_table_name = KTlsAllowedCipherSuitesDatabaseTableName; |
242 m_db_name = KTlsDatabaseName; |
230 m_db_name = KTlsDatabaseName; |
243 } |
231 break; |
244 else if (m_current_eap_type == eap_type_peap) |
232 |
245 { |
233 case eap_type_peap: |
246 m_db_table_name = KPeapDatabaseTableName; |
234 m_db_table_name = KPeapDatabaseTableName; |
247 m_db_user_cert_table_name = KPeapAllowedUserCertsDatabaseTableName; |
235 m_db_user_cert_table_name = KPeapAllowedUserCertsDatabaseTableName; |
248 m_db_ca_cert_table_name = KPeapAllowedCACertsDatabaseTableName; |
236 m_db_ca_cert_table_name = KPeapAllowedCACertsDatabaseTableName; |
249 m_db_cipher_suite_table_name = KPeapAllowedCipherSuitesDatabaseTableName; |
237 m_db_cipher_suite_table_name = KPeapAllowedCipherSuitesDatabaseTableName; |
250 m_db_name = KPeapDatabaseName; |
238 m_db_name = KPeapDatabaseName; |
251 } |
239 break; |
252 else if (m_current_eap_type == eap_type_ttls_plain_pap |
240 |
253 || m_current_eap_type == eap_type_ttls) |
241 case eap_type_ttls_plain_pap: |
254 { |
242 // use the same case as for eap_type_ttls; |
255 m_db_table_name = KTtlsDatabaseTableName; |
243 // break is not needed |
256 m_db_user_cert_table_name = KTtlsAllowedUserCertsDatabaseTableName; |
244 |
257 m_db_ca_cert_table_name = KTtlsAllowedCACertsDatabaseTableName; |
245 case eap_type_ttls: |
258 m_db_cipher_suite_table_name = KTtlsAllowedCipherSuitesDatabaseTableName; |
246 m_db_table_name = KTtlsDatabaseTableName; |
259 m_db_name = KTtlsDatabaseName; |
247 m_db_user_cert_table_name = KTtlsAllowedUserCertsDatabaseTableName; |
260 } |
248 m_db_ca_cert_table_name = KTtlsAllowedCACertsDatabaseTableName; |
|
249 m_db_cipher_suite_table_name = KTtlsAllowedCipherSuitesDatabaseTableName; |
|
250 m_db_name = KTtlsDatabaseName; |
|
251 break; |
|
252 |
261 |
253 #if defined (USE_FAST_EAP_TYPE) |
262 #if defined (USE_FAST_EAP_TYPE) |
254 case eap_type_fast: |
263 else if (m_current_eap_type == eap_type_fast) |
255 m_db_table_name = KFastGeneralSettingsDBTableName; // General settings |
264 { |
256 m_db_fast_special_table_name = KFastSpecialSettingsDBTableName; // Special settings for only FAST |
265 m_db_table_name = KFastGeneralSettingsDBTableName; // General settings |
257 m_db_user_cert_table_name = KFastAllowedUserCertsDatabaseTableName; |
266 m_db_fast_special_table_name = KFastSpecialSettingsDBTableName; // Special settings for only FAST |
258 m_db_ca_cert_table_name = KFastAllowedCACertsDatabaseTableName; |
267 m_db_user_cert_table_name = KFastAllowedUserCertsDatabaseTableName; |
259 m_db_cipher_suite_table_name = KFastAllowedCipherSuitesDatabaseTableName; |
268 m_db_ca_cert_table_name = KFastAllowedCACertsDatabaseTableName; |
260 m_db_name = KFastDatabaseName; |
269 m_db_cipher_suite_table_name = KFastAllowedCipherSuitesDatabaseTableName; |
261 break; |
270 m_db_name = KFastDatabaseName; |
|
271 } |
262 #endif // #if defined (USE_FAST_EAP_TYPE) |
272 #endif // #if defined (USE_FAST_EAP_TYPE) |
263 default: |
273 else |
264 { |
274 { |
265 // Unsupported type |
275 // Unsupported type |
266 // Should never happen |
276 // Should never happen |
267 EAP_TRACE_ERROR(m_am_tools, |
277 EAP_TRACE_ERROR(m_am_tools, |
268 TRACE_FLAGS_DEFAULT, ( |
278 TRACE_FLAGS_DEFAULT, |
269 EAPL("Unsupported EAP type, m_current_eap_vendor_type=%d \n"), |
279 (EAPL("Unsupported EAP type, m_current_eap_vendor_type=0xfe%06x%08x\n"), |
270 m_current_eap_vendor_type)); |
280 m_current_eap_type.get_vendor_id(), |
271 |
281 m_current_eap_type.get_vendor_type())); |
272 return; |
282 |
273 } |
283 return; |
274 } |
284 } |
275 |
285 |
276 if (receive_network_id != 0 |
286 if (receive_network_id != 0 |
277 && receive_network_id->get_is_valid_data() == true) |
287 && receive_network_id->get_is_valid_data() == true) |
278 { |
288 { |
422 if(m_cert_if->IsActive()) |
428 if(m_cert_if->IsActive()) |
423 { |
429 { |
424 m_cert_if->Cancel(); |
430 m_cert_if->Cancel(); |
425 } |
431 } |
426 } |
432 } |
427 |
433 |
428 if ( iEapTtlsPapActive ) |
434 if (iEapAuthNotifier != 0) |
429 { |
435 { |
430 if ( iEapTtlsPapActive->IsActive() ) |
436 iEapAuthNotifier->Cancel(); |
431 { |
437 } |
432 EAP_TRACE_DEBUG_SYMBIAN( |
438 |
433 ( _L( " eap_am_type_tls_peap_symbian_c::shutdown() \ |
439 |
434 Cancelling iEapTtlsPapActive." ) ) ); |
440 |
435 iEapTtlsPapActive->Cancel(); |
441 |
436 } |
442 #if defined(USE_FAST_EAP_TYPE) |
437 EAP_TRACE_DEBUG_SYMBIAN( |
443 |
438 ( _L( " eap_am_type_tls_peap_symbian_c::shutdown() \ |
444 |
439 Deleting iEapTtlsPapActive." ) ) ); |
445 |
440 delete iEapTtlsPapActive; |
446 #endif |
441 iEapTtlsPapActive = NULL; |
|
442 } |
|
443 |
|
444 #if defined(USE_FAST_EAP_TYPE) |
|
445 if( m_is_notifier_connected ) |
|
446 { |
|
447 EAP_TRACE_DEBUG_SYMBIAN( |
|
448 (_L(" eap_am_type_tls_peap_symbian_c::shutdown - calling m_notifier.CancelNotifier"))); |
|
449 if(IsActive()) |
|
450 { |
|
451 TInt error = m_notifier.CancelNotifier(KEapFastNotifierUid); |
|
452 EAP_TRACE_DEBUG_SYMBIAN( |
|
453 (_L("eap_am_type_tls_peap_symbian_c::shutdown - CancelNotifier=%d"), error)); |
|
454 } |
|
455 EAP_TRACE_DEBUG_SYMBIAN( |
|
456 (_L(" eap_am_type_securid_symbian_c::shutdown - calling m_notifier.Close()"))); |
|
457 |
|
458 m_notifier.Close(); // Call close only if it is connected. |
|
459 |
|
460 m_is_notifier_connected = false; |
|
461 |
|
462 } // End: if( m_is_notifier_connected ) |
|
463 |
447 |
464 if (m_partner != NULL) |
448 if (m_partner != NULL) |
465 { |
449 { |
466 EAP_TRACE_DEBUG_SYMBIAN( |
450 EAP_TRACE_DEBUG_SYMBIAN( |
467 (_L(" eap_am_type_tls_peap_symbian_c::shutdown - Cancel timers ..."))); |
451 (_L(" eap_am_type_tls_peap_symbian_c::shutdown - Cancel timers ..."))); |
468 |
452 |
|
453 #if defined(USE_FAST_EAP_TYPE) |
469 m_partner->cancel_timer( |
454 m_partner->cancel_timer( |
470 this, |
455 this, |
471 KRemoveIAPReferenceTimerID); |
456 KRemoveIAPReferenceTimerID); |
472 |
457 |
473 m_partner->cancel_timer( |
458 m_partner->cancel_timer( |
480 |
465 |
481 m_partner->cancel_timer( |
466 m_partner->cancel_timer( |
482 this, |
467 this, |
483 KHandleReadPacstoreTimerID); |
468 KHandleReadPacstoreTimerID); |
484 |
469 |
|
470 m_partner->cancel_timer( |
|
471 this, |
|
472 KHandleCompletePacstoreNokTimerID); |
|
473 |
|
474 m_partner->cancel_timer( |
|
475 this, |
|
476 KHandleCompletePacstoreOkTimerID); |
|
477 |
|
478 #endif |
485 EAP_TRACE_DEBUG_SYMBIAN( |
479 EAP_TRACE_DEBUG_SYMBIAN( |
486 (_L(" eap_am_type_tls_peap_symbian_c::shutdown - Timers canceled"))); |
480 (_L(" eap_am_type_tls_peap_symbian_c::shutdown - Timers canceled"))); |
487 } |
481 } |
488 |
482 |
489 if ( iEapFastActiveWaitNote ) |
483 #if defined(USE_FAST_EAP_TYPE) |
490 { |
484 |
491 if ( iEapFastActiveWaitNote->IsActive() ) |
|
492 { |
|
493 iEapFastActiveWaitNote->Cancel(); |
|
494 } |
|
495 delete iEapFastActiveWaitNote; |
|
496 iEapFastActiveWaitNote = NULL; |
|
497 } |
|
498 |
|
499 if ( iEapFastActiveNotes ) |
|
500 { |
|
501 if ( iEapFastActiveNotes->IsActive() ) |
|
502 { |
|
503 iEapFastActiveNotes->Cancel(); |
|
504 } |
|
505 delete iEapFastActiveNotes; |
|
506 iEapFastActiveNotes = NULL; |
|
507 } |
|
508 #endif // #if defined(USE_FAST_EAP_TYPE) |
485 #endif // #if defined(USE_FAST_EAP_TYPE) |
509 |
486 |
510 |
487 |
511 m_allowed_server_certs.Reset(); |
488 m_allowed_server_certs.ResetAndDestroy(); |
512 m_allowed_ca_certs.Close(); |
489 m_allowed_ca_certs.ResetAndDestroy(); |
513 m_allowed_cipher_suites.Close(); |
490 m_allowed_cipher_suites.Close(); |
514 m_allowed_user_certs.Reset(); |
491 m_allowed_user_certs.ResetAndDestroy(); |
515 |
492 |
516 #ifdef USE_PAC_STORE |
493 #ifdef USE_PAC_STORE |
517 #ifdef USE_FAST_EAP_TYPE |
494 #ifdef USE_FAST_EAP_TYPE |
518 |
495 |
519 if(m_current_eap_type == eap_type_fast && iPacStoreDb != NULL) |
496 if(m_current_eap_type == eap_type_fast && iPacStoreDb != NULL) |
520 { |
497 { |
521 iPacStoreDb->Close(); |
498 iPacStoreDb->Close(); |
522 } |
499 } |
523 |
500 |
524 TInt count=0; |
501 m_info_array.ResetAndDestroy(); |
525 while (count < m_info_array.Count()) |
|
526 { |
|
527 delete m_info_array[count].iData; |
|
528 delete m_info_array[count].iReference; |
|
529 } |
|
530 m_info_array.Reset(); |
|
531 |
502 |
532 EAP_TRACE_DEBUG_SYMBIAN( |
503 EAP_TRACE_DEBUG_SYMBIAN( |
533 (_L(" eap_am_type_tls_peap_symbian_c::shutdown - Arrays cleared"))); |
504 (_L(" eap_am_type_tls_peap_symbian_c::shutdown - Arrays cleared"))); |
534 |
505 |
535 #endif // End: #ifdef USE_FAST_EAP_TYPE |
506 #endif // End: #ifdef USE_FAST_EAP_TYPE |
569 EAP_ASSERT(m_shutdown_was_called == true); |
539 EAP_ASSERT(m_shutdown_was_called == true); |
570 |
540 |
571 m_database.Close(); |
541 m_database.Close(); |
572 m_session.Close(); |
542 m_session.Close(); |
573 |
543 |
|
544 delete m_notifier_data_to_user; |
|
545 delete m_notifier_data_pckg_to_user; |
|
546 |
|
547 |
574 #ifdef USE_FAST_EAP_TYPE |
548 #ifdef USE_FAST_EAP_TYPE |
575 |
549 |
576 if(m_current_eap_type == eap_type_fast) |
|
577 { |
|
578 delete m_notifier_data_to_user; |
|
579 delete m_notifier_data_pckg_to_user; |
|
580 |
|
581 delete m_notifier_data_from_user; |
|
582 delete m_notifier_data_pckg_from_user; |
|
583 } |
|
584 #endif // End: #ifdef USE_FAST_EAP_TYPE |
550 #endif // End: #ifdef USE_FAST_EAP_TYPE |
585 |
551 |
586 delete m_cert_if; |
552 delete m_cert_if; |
587 |
553 |
588 delete m_ca_certificate; |
554 delete m_ca_certificate; |
589 delete m_own_certificate; |
555 delete m_own_certificate; |
590 delete m_peer_certificate; |
556 delete m_peer_certificate; |
591 delete m_identity_info; |
|
592 |
|
593 #ifdef USE_EAP_EXPANDED_TYPES |
|
594 |
557 |
595 m_enabled_tunneling_exp_eap_array.ResetAndDestroy(); |
558 m_enabled_tunneling_exp_eap_array.ResetAndDestroy(); |
596 m_disabled_tunneling_exp_eap_array.ResetAndDestroy(); |
559 m_disabled_tunneling_exp_eap_array.ResetAndDestroy(); |
597 |
560 |
598 EAP_TRACE_DEBUG( |
561 EAP_TRACE_DEBUG( |
599 m_am_tools, |
562 m_am_tools, |
600 TRACE_FLAGS_DEFAULT, |
563 TRACE_FLAGS_DEFAULT, |
601 (EAPL("eap_am_type_tls_peap_symbian_c::~eap_am_type_tls_peap_symbian_c() tunneling done.\n"))); |
564 (EAPL("eap_am_type_tls_peap_symbian_c::~eap_am_type_tls_peap_symbian_c() tunneling done.\n"))); |
602 |
565 |
603 #else |
|
604 |
|
605 m_iap_eap_array.ResetAndDestroy(); |
|
606 |
|
607 #endif // #ifdef USE_EAP_EXPANDED_TYPES |
|
608 |
|
609 #ifdef USE_PAC_STORE |
566 #ifdef USE_PAC_STORE |
610 |
567 |
611 delete iPacStoreDb; |
568 delete iPacStoreDb; |
612 |
569 |
613 #endif // End: #ifdef USE_PAC_STORE |
570 #endif // End: #ifdef USE_PAC_STORE |
614 |
571 delete iEapAuthNotifier; |
|
572 iEapAuthNotifier = 0; |
|
573 |
615 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
574 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
616 } |
575 } |
617 //-------------------------------------------------- |
576 //-------------------------------------------------- |
618 |
577 |
619 // |
578 EAP_FUNC_EXPORT void eap_am_type_tls_peap_symbian_c::DlgComplete( TInt aStatus ) |
620 |
579 { |
621 void eap_am_type_tls_peap_symbian_c::RunL() |
|
622 { |
|
623 EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
624 |
|
625 EAP_TRACE_DEBUG_SYMBIAN( |
|
626 (_L("eap_am_type_tls_peap_symbian_c::RunL - iStatus.Int()=%d, m_state=%d "), |
|
627 iStatus.Int() , m_state)); |
|
628 |
|
629 #ifdef USE_FAST_EAP_TYPE |
580 #ifdef USE_FAST_EAP_TYPE |
630 eap_status_e status(eap_status_ok); |
581 m_userAction = EEapFastNotifierUserActionOk; |
631 |
582 #endif |
632 if (m_notifier_complete) |
583 eap_status_e status = m_am_tools->convert_am_error_to_eapol_error(aStatus); |
633 { |
584 |
634 |
585 |
635 TRAPD(err, CompleteNotifierL());// Only for the notifiers. |
586 if(m_notifier_complete) |
636 if (err != KErrNone) |
587 { |
637 { |
588 EAP_TRACE_DEBUG_SYMBIAN( |
638 EAP_TRACE_ERROR(m_am_tools, |
589 (_L("m_notifier_data_pckg_to_user"), |
639 TRACE_FLAGS_DEFAULT, ( |
590 m_notifier_data_pckg_to_user->Ptr(), |
640 EAPL("eap_am_type_tls_peap_symbian_c::RunL LEAVE from CompleteNotifierL, Error =%d \n"), |
591 m_notifier_data_pckg_to_user->Size())); |
641 err)); |
592 if ( aStatus == KErrCancel ) |
|
593 { |
|
594 EAP_TRACE_DEBUG_SYMBIAN( |
|
595 (_L("eap_am_type_tls_peap_symbian_c::DlgComplete - User cancelled the dialog"))); |
|
596 #ifdef USE_FAST_EAP_TYPE |
|
597 m_userAction = EEapFastNotifierUserActionCancel; |
|
598 #endif |
|
599 } |
|
600 else if( aStatus != KErrNone ) |
|
601 { |
|
602 EAP_TRACE_DEBUG_SYMBIAN( |
|
603 (_L("eap_am_type_tls_peap_symbian_c::DlgComplete - ERROR: dialog error=%d"), |
|
604 aStatus)); |
|
605 TBuf8<KMaxNotifItemLength> userNameUtf8; |
|
606 TBuf8<KMaxUiDataLength> challengeUtf8; |
|
607 userNameUtf8.Zero(); |
|
608 challengeUtf8.Zero(); |
|
609 |
|
610 CompleteQueryTtlsPapUserNameAndPassword( |
|
611 status, userNameUtf8, challengeUtf8 ); |
|
612 return; // m_am_tools->convert_am_error_to_eapol_error(aStatus); |
|
613 } |
|
614 |
|
615 if ( m_notifier_data_to_user->iPassword.Size() > 0 ) |
|
616 { |
|
617 HBufC8* notifier_data8 = NULL; |
|
618 TRAPD(err, notifier_data8 = HBufC8::NewL(m_notifier_data_to_user->iPassword.Size())); |
|
619 if (err) |
|
620 { |
|
621 return; |
|
622 } |
|
623 TPtr8 notifier_dataPtr8 = notifier_data8->Des(); |
|
624 |
|
625 notifier_dataPtr8.Copy(m_notifier_data_to_user->iPassword); // Unicode -> ascii. |
|
626 EAP_TRACE_DEBUG_SYMBIAN( |
|
627 (_L("eap_am_type_tls_peap_symbian_c::DlgComplete Data copy done"))); |
|
628 |
|
629 EAP_TRACE_DATA_DEBUG_SYMBIAN( |
|
630 ("eap_am_type_tls_peap_symbian_c::DlgComplete PW from UI (8bits)", |
|
631 notifier_dataPtr8.Ptr(), |
|
632 notifier_dataPtr8.Size())); |
|
633 |
|
634 #ifdef USE_FAST_EAP_TYPE |
|
635 status = m_userResponse.set_copy_of_buffer( |
|
636 notifier_dataPtr8.Ptr(), |
|
637 notifier_dataPtr8.Size()); |
|
638 #endif |
|
639 CleanupStack::PopAndDestroy( notifier_data8 ); |
|
640 } |
|
641 } |
|
642 m_notifier_complete = 0; |
|
643 |
|
644 if ( m_state == EPapChallenge) |
|
645 { |
|
646 TBuf8<KMaxNotifItemLength> userNameUtf8; |
|
647 TBuf8<KMaxUiDataLength> challengeUtf8; |
|
648 userNameUtf8.Zero(); |
|
649 challengeUtf8.Zero(); |
|
650 |
|
651 if (m_notifier_data_to_user->iUsername.Size()>0) |
|
652 { |
|
653 const TPtrC16 unicode_uname( |
|
654 reinterpret_cast<unsigned short *>(&m_notifier_data_to_user->iUsername), |
|
655 m_notifier_data_to_user->iUsername.Size()); // Length in unicode characters |
|
656 |
|
657 CnvUtfConverter::ConvertFromUnicodeToUtf8( userNameUtf8, unicode_uname ); |
642 } |
658 } |
643 |
659 EAP_TRACE_DATA_DEBUG( m_am_tools, TRACE_FLAGS_DEFAULT, ( |
644 m_notifier_complete = EFalse; |
660 EAPL( "userNameUtf8" ), |
645 } |
661 userNameUtf8.Ptr(), |
646 |
662 userNameUtf8.Size() ) ); |
647 if ( m_state == EPasswordCancel || |
663 |
|
664 if (m_notifier_data_to_user->iUidata.Size()>0) |
|
665 { |
|
666 const TPtrC16 unicode_pw( |
|
667 reinterpret_cast<unsigned short *>(&m_notifier_data_to_user->iUidata), |
|
668 m_notifier_data_to_user->iUidata.Size()); // Length in unicode characters |
|
669 |
|
670 CnvUtfConverter::ConvertFromUnicodeToUtf8( challengeUtf8, unicode_pw ); |
|
671 } |
|
672 EAP_TRACE_DATA_DEBUG( m_am_tools, TRACE_FLAGS_DEFAULT, ( |
|
673 EAPL( "challengeUtf8" ), |
|
674 challengeUtf8.Ptr(), |
|
675 challengeUtf8.Size() ) ); |
|
676 |
|
677 CompleteQueryTtlsPapUserNameAndPassword( |
|
678 status, userNameUtf8, challengeUtf8 ); |
|
679 } |
|
680 if ( m_state == EPapUserNameAndPassword ) |
|
681 { |
|
682 TBuf8<KMaxNotifItemLength> userNameUtf8; |
|
683 TBuf8<KMaxNotifItemLength> passwordUtf8; |
|
684 userNameUtf8.Zero(); |
|
685 passwordUtf8.Zero(); |
|
686 |
|
687 if (m_notifier_data_to_user->iUsername.Size()>0) |
|
688 { |
|
689 const TPtrC16 unicode_uname( |
|
690 reinterpret_cast<unsigned short *>(&m_notifier_data_to_user->iUsername), |
|
691 m_notifier_data_to_user->iUsername.Size()); // Length in unicode characters |
|
692 |
|
693 CnvUtfConverter::ConvertFromUnicodeToUtf8( userNameUtf8, unicode_uname ); |
|
694 EAP_TRACE_DATA_DEBUG( m_am_tools, TRACE_FLAGS_DEFAULT, ( |
|
695 EAPL( "userNameUtf8" ), |
|
696 userNameUtf8.Ptr(), |
|
697 userNameUtf8.Size() ) ); |
|
698 } |
|
699 if (m_notifier_data_to_user->iPassword.Size()>0) |
|
700 { |
|
701 const TPtrC16 unicode_pw( |
|
702 reinterpret_cast<unsigned short *>(&m_notifier_data_to_user->iPassword), |
|
703 m_notifier_data_to_user->iPassword.Size()); // Length in unicode characters |
|
704 |
|
705 CnvUtfConverter::ConvertFromUnicodeToUtf8( passwordUtf8, unicode_pw ); |
|
706 } |
|
707 EAP_TRACE_DATA_DEBUG( m_am_tools, TRACE_FLAGS_DEFAULT, ( |
|
708 EAPL( "passwordUtf8" ), |
|
709 passwordUtf8.Ptr(), |
|
710 passwordUtf8.Size() ) ); |
|
711 |
|
712 CompleteQueryTtlsPapUserNameAndPassword( |
|
713 status, userNameUtf8, passwordUtf8 ); |
|
714 |
|
715 TTtlsPapDbInfo aInDbInfo; |
|
716 aInDbInfo.iUsrPwdInfo.iPasswordPromptEnabled = m_notifier_data_to_user->iPasswordPromptEnabled; |
|
717 aInDbInfo.iUsrPwdInfo.iUserName.Copy(userNameUtf8); |
|
718 aInDbInfo.iUsrPwdInfo.iPassword.Copy(passwordUtf8); |
|
719 |
|
720 TRAPD(err1, WriteTtlsPapDbL( aInDbInfo)); |
|
721 if (err1) |
|
722 { |
|
723 // continue |
|
724 } |
|
725 } |
|
726 #ifdef USE_FAST_EAP_TYPE |
|
727 else if ( m_state == EPasswordCancel || |
648 m_state == EMasterkeyQuery || |
728 m_state == EMasterkeyQuery || |
649 m_state == EPasswordQuery || |
729 m_state == EPasswordQuery || |
650 m_state == EWrongPassword || |
730 m_state == EWrongPassword || |
651 m_state == EFilePasswordQuery ) |
731 m_state == EFilePasswordQuery ) |
652 { |
732 { |
653 m_eap_fast_completion_status = m_partner->set_timer( |
733 m_eap_fast_completion_status = m_partner->set_timer( |
654 this, |
734 this, |
655 KHandleReadPacstoreTimerID, |
735 KHandleReadPacstoreTimerID, |
656 &status, |
736 &aStatus, |
657 0); |
737 0); |
658 return; |
738 return; |
659 } |
739 } |
|
740 #endif |
|
741 |
|
742 } |
|
743 |
|
744 //-------------------------------------------------- |
|
745 |
|
746 // |
|
747 void eap_am_type_tls_peap_symbian_c::RunL() |
|
748 { |
|
749 EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
750 |
|
751 EAP_TRACE_DEBUG_SYMBIAN( |
|
752 (_L("eap_am_type_tls_peap_symbian_c::RunL - iStatus.Int()=%d, m_state=%d "), |
|
753 iStatus.Int() , m_state)); |
|
754 |
|
755 #ifdef USE_FAST_EAP_TYPE |
|
756 eap_status_e status(eap_status_ok); |
|
757 |
|
758 |
660 if (m_state == ENone) |
759 if (m_state == ENone) |
661 { |
760 { |
662 return; |
761 return; |
663 } |
762 } |
664 |
763 |
|
764 if ( m_state == EHandlingDeviceSeedQuery) |
|
765 { |
|
766 CompleteCreateDeviceSeedL( iStatus.Int() ); |
|
767 |
|
768 return; |
|
769 } |
665 #endif // #ifdef USE_FAST_EAP_TYPE |
770 #endif // #ifdef USE_FAST_EAP_TYPE |
666 |
771 |
667 if (iStatus.Int() != KErrNone) |
772 if (iStatus.Int() != KErrNone) |
668 { |
773 { |
669 // Notifier was cancelled or something went wrong |
774 // Notifier was cancelled or something went wrong |
780 default: |
886 default: |
781 return; |
887 return; |
782 } |
888 } |
783 } |
889 } |
784 } |
890 } |
785 else if (m_state == EHandlingManualIdentityQuery) |
|
786 { |
|
787 // Convert to 8-bit text |
|
788 TBuf8<KIdentityFieldLength> buf; |
|
789 buf.Copy(m_identity_info->iUsername); |
|
790 |
|
791 eap_status_e status = m_manual_username.set_copy_of_buffer( |
|
792 buf.Ptr(), |
|
793 buf.Size()); |
|
794 |
|
795 if (status != eap_status_ok) |
|
796 { |
|
797 EAP_TRACE_DEBUG( |
|
798 m_am_tools, |
|
799 TRACE_FLAGS_DEFAULT, |
|
800 (EAPL("ERROR: EAP-TLS: EHandlingIdentityQuery: Cannot read manual username.\n"))); |
|
801 |
|
802 get_am_partner()->complete_eap_identity_query( |
|
803 0, // 0 because identity query failed |
|
804 &m_receive_network_id, |
|
805 m_eap_identifier, |
|
806 status, |
|
807 false, |
|
808 0, |
|
809 false, |
|
810 0); |
|
811 } |
|
812 |
|
813 buf.Copy(m_identity_info->iRealm); |
|
814 status = m_manual_realm.set_copy_of_buffer( |
|
815 buf.Ptr(), |
|
816 buf.Size()); |
|
817 |
|
818 if (status != eap_status_ok) |
|
819 { |
|
820 EAP_TRACE_DEBUG( |
|
821 m_am_tools, |
|
822 TRACE_FLAGS_DEFAULT, |
|
823 (EAPL("ERROR: EAP-TLS: EHandlingIdentityQuery: Cannot read manual realm.\n"))); |
|
824 |
|
825 get_am_partner()->complete_eap_identity_query( |
|
826 0, // 0 because identity query failed |
|
827 &m_receive_network_id, |
|
828 m_eap_identifier, |
|
829 status, |
|
830 false, |
|
831 0, |
|
832 false, |
|
833 0); |
|
834 } |
|
835 |
|
836 // This must be true |
|
837 m_use_manual_realm = true; |
|
838 |
|
839 if (m_identity_info->iUseManualUsername) |
|
840 { |
|
841 m_use_manual_username = true; |
|
842 } |
|
843 else |
|
844 { |
|
845 m_use_manual_username = false; |
|
846 } |
|
847 |
|
848 |
|
849 get_am_partner()->complete_eap_identity_query( |
|
850 0, // 0 because identity query failed |
|
851 &m_receive_network_id, |
|
852 m_eap_identifier, |
|
853 eap_status_ok, |
|
854 m_use_manual_username, |
|
855 &m_manual_username, |
|
856 m_use_manual_realm, |
|
857 &m_manual_realm); |
|
858 |
|
859 TRAPD(err, SaveManualIdentityL( |
|
860 m_identity_info->iUseManualUsername, |
|
861 m_identity_info->iUsername, |
|
862 ETrue, |
|
863 m_identity_info->iRealm)); |
|
864 |
|
865 (void)EAP_STATUS_RETURN(m_am_tools, m_am_tools->convert_am_error_to_eapol_error(err)); |
|
866 |
|
867 // Ignore return value on purpose. It's not fatal if saving fails. |
|
868 |
|
869 delete m_identity_info; |
|
870 m_identity_info = 0; |
|
871 |
|
872 } |
|
873 |
891 |
874 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
892 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
875 } |
893 } |
876 |
894 |
877 //-------------------------------------------------- |
895 //-------------------------------------------------- |
878 |
896 #ifdef USE_FAST_EAP_TYPE |
879 // |
897 // |
880 |
898 // --------------------------------------------------------- |
|
899 // eap_am_type_tls_peap_symbian_c::CreateDeviceSeedAsync() |
|
900 // --------------------------------------------------------- |
|
901 // |
|
902 eap_status_e eap_am_type_tls_peap_symbian_c::CreateDeviceSeedAsync() |
|
903 { |
|
904 EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
905 |
|
906 EAP_TRACE_DEBUG_SYMBIAN( |
|
907 (_L("eap_am_type_tls_peap_symbian_c::CreateDeviceSeedAsync-Start ActiveStatus=%d"), |
|
908 IsActive())); |
|
909 |
|
910 if ( IsActive() ) |
|
911 { |
|
912 EAP_TRACE_DEBUG_SYMBIAN( |
|
913 (_L("CreateDeviceSeedAsync: Already active when tried to create device seed"))); |
|
914 |
|
915 return eap_status_device_busy; |
|
916 } |
|
917 |
|
918 eap_status_e status(eap_status_ok); |
|
919 |
|
920 m_state = EHandlingDeviceSeedQuery; |
|
921 |
|
922 // Create MMETEL connection. |
|
923 TRAPD(error, CreateMMETelConnectionL()); |
|
924 if(error !=KErrNone) |
|
925 { |
|
926 return m_am_tools->convert_am_error_to_eapol_error(error); |
|
927 } |
|
928 |
|
929 iPhone.GetPhoneId( iStatus, iDeviceId ); |
|
930 |
|
931 SetActive(); |
|
932 return status; |
|
933 } // eap_am_type_tls_peap_symbian_c::CreateDeviceSeedAsynch() |
|
934 |
|
935 //-------------------------------------------------- |
|
936 |
|
937 void eap_am_type_tls_peap_symbian_c::CompleteCreateDeviceSeedL( TInt aStatus ) |
|
938 { |
|
939 EAP_TRACE_DEBUG_SYMBIAN( |
|
940 (_L("eap_am_type_tls_peap_symbian_c::CompleteCreateDeviceSeedL aStatus=%d"), |
|
941 iStatus.Int())); |
|
942 if ( aStatus != KErrNone ) |
|
943 { |
|
944 EAP_TRACE_DEBUG_SYMBIAN( |
|
945 (_L("eap_am_type_tls_peap_symbian_c::CompleteCreateDeviceSeedL ERROR: aStatus=%d"), |
|
946 iStatus.Int())); |
|
947 } |
|
948 EAP_TRACE_DATA_DEBUG(m_am_tools, TRACE_FLAGS_DEFAULT, (EAPL("Manufacturer"), |
|
949 iDeviceId.iManufacturer.Ptr(), |
|
950 iDeviceId.iManufacturer.Size())); |
|
951 EAP_TRACE_DATA_DEBUG(m_am_tools, TRACE_FLAGS_DEFAULT, (EAPL("Model"), |
|
952 iDeviceId.iModel.Ptr(), |
|
953 iDeviceId.iModel.Size())); |
|
954 EAP_TRACE_DATA_DEBUG(m_am_tools, TRACE_FLAGS_DEFAULT, (EAPL("Revision"), |
|
955 iDeviceId.iRevision.Ptr(), |
|
956 iDeviceId.iRevision.Size())); |
|
957 EAP_TRACE_DATA_DEBUG(m_am_tools, TRACE_FLAGS_DEFAULT, (EAPL("SerialNumber"), |
|
958 iDeviceId.iSerialNumber.Ptr(), |
|
959 iDeviceId.iSerialNumber.Size())); |
|
960 |
|
961 // Combine all the above four items. |
|
962 TBuf<KMaxDeviceSeedLength> deviceSeed16; |
|
963 deviceSeed16 += iDeviceId.iManufacturer; |
|
964 deviceSeed16 += iDeviceId.iModel; |
|
965 deviceSeed16 += iDeviceId.iSerialNumber; |
|
966 |
|
967 TBuf8<KMaxDeviceSeedSize> deviceSeed8; |
|
968 deviceSeed8.Copy(deviceSeed16); |
|
969 |
|
970 if ( iPacStoreDeviceSeed == NULL ) |
|
971 { |
|
972 iPacStoreDeviceSeed = new eap_variable_data_c(m_am_tools); |
|
973 if ( iPacStoreDeviceSeed == NULL ) |
|
974 { |
|
975 User::Leave( KErrNoMemory ); |
|
976 } |
|
977 } |
|
978 |
|
979 #if defined(USE_EAP_CONFIGURATION_TO_SKIP_USER_INTERACTIONS) |
|
980 const char DUMMY_SEED[]="empty"; |
|
981 |
|
982 |
|
983 if (m_skip_user_interactions == true) |
|
984 { |
|
985 iPacStoreDeviceSeed->set_copy_of_buffer(DUMMY_SEED, sizeof(DUMMY_SEED)); |
|
986 } |
|
987 else |
|
988 #endif //#if defined(USE_EAP_CONFIGURATION_TO_SKIP_USER_INTERACTIONS) |
|
989 { |
|
990 |
|
991 if ( iPacStoreDeviceSeed != NULL ) |
|
992 { |
|
993 if( deviceSeed8.Size() > 0) |
|
994 { |
|
995 iPacStoreDeviceSeed->set_copy_of_buffer( |
|
996 deviceSeed8.Ptr(), |
|
997 deviceSeed8.Size()); |
|
998 } |
|
999 } |
|
1000 } |
|
1001 DisconnectMMETel(); |
|
1002 |
|
1003 ContinueInitializePacStore(); |
|
1004 |
|
1005 } // eap_am_type_tls_peap_symbian_c::CompleteCreateDeviceSeedL() |
|
1006 |
|
1007 #endif |
|
1008 //-------------------------------------------------- |
881 |
1009 |
882 void eap_am_type_tls_peap_symbian_c::DoCancel() |
1010 void eap_am_type_tls_peap_symbian_c::DoCancel() |
883 { |
1011 { |
884 EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT); |
1012 EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT); |
885 |
1013 |
917 |
1039 |
918 m_partner->cancel_timer( |
1040 m_partner->cancel_timer( |
919 this, |
1041 this, |
920 KHandleReadPacstoreTimerID); |
1042 KHandleReadPacstoreTimerID); |
921 |
1043 |
922 if( m_is_notifier_connected ) |
|
923 { |
|
924 EAP_TRACE_DEBUG_SYMBIAN( |
|
925 (_L(" eap_am_type_tls_peap_symbian_c::DoCancel - calling m_notifier.CancelNotifier"))); |
|
926 if(IsActive()) |
|
927 { |
|
928 TInt error = m_notifier.CancelNotifier(KEapFastNotifierUid); |
|
929 EAP_TRACE_DEBUG_SYMBIAN( |
|
930 (_L("eap_am_type_tls_peap_symbian_c::DoCancel:CancelNotifier=%d"), |
|
931 error)); |
|
932 } |
|
933 |
|
934 m_notifier.Close(); // Call close only if it is connected. |
|
935 |
|
936 m_is_notifier_connected = false; |
|
937 |
|
938 } // End: if( m_is_notifier_connected ) |
|
939 |
1044 |
940 #endif // #if defined(USE_FAST_EAP_TYPE) |
1045 #endif // #if defined(USE_FAST_EAP_TYPE) |
941 |
1046 |
942 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
1047 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
943 } |
1048 } |
944 |
1049 |
945 //-------------------------------------------------- |
1050 //-------------------------------------------------- |
946 |
1051 |
947 // |
1052 // |
948 |
|
949 eap_status_e eap_am_type_tls_peap_symbian_c::SaveManualIdentityL( |
1053 eap_status_e eap_am_type_tls_peap_symbian_c::SaveManualIdentityL( |
950 const TBool use_manual_username, |
1054 const TBool use_manual_username, |
951 TDesC& manual_username, |
1055 TDesC& manual_username, |
952 const TBool use_manual_realm, |
1056 const TBool use_manual_realm, |
953 TDesC& manual_realm) |
1057 TDesC& manual_realm) |
954 { |
1058 { |
955 EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT); |
1059 EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT); |
956 |
1060 |
957 // Validate length. |
1061 // Validate length. |
958 if(manual_username.Length() > KMaxManualUsernameLengthInDB |
1062 if(manual_username.Length() > KMaxUsernameLengthInDB |
959 || manual_realm.Length() > KMaxManualRealmLengthInDB) |
1063 || manual_realm.Length() > KMaxRealmLengthInDB) |
960 { |
1064 { |
961 // Username or realm too long. Can not be stored in DB. |
1065 // Username or realm too long. Can not be stored in DB. |
962 EAP_TRACE_DEBUG_SYMBIAN((_L("eap_am_type_tls_peap_symbian_c::SaveManualIdentityL: Too long username or realm. Length: UN=%d, Realm=%d\n"), |
1066 EAP_TRACE_DEBUG_SYMBIAN((_L("eap_am_type_tls_peap_symbian_c::SaveManualIdentityL: Too long username or realm. Length: manual_username=%d, manual_realm=%d\n"), |
963 manual_username.Length(), manual_realm.Length())); |
1067 manual_username.Length(), manual_realm.Length())); |
964 |
1068 |
965 User::Leave(KErrArgument); |
1069 User::Leave(KErrArgument); |
966 } |
1070 } |
967 |
1071 |
968 HBufC* sqlbuf = HBufC::NewLC(KMaxSqlQueryLength); |
1072 HBufC* sqlbuf = HBufC::NewLC(KMaxSqlQueryLength); |
969 TPtr sqlStatement = sqlbuf->Des(); |
1073 TPtr sqlStatement = sqlbuf->Des(); |
970 |
1074 |
971 RDbView view; |
1075 RDbView view; |
972 |
1076 |
973 _LIT(KSQL, "SELECT * FROM %S WHERE %S=%d AND %S=%d AND %S=%d"); |
1077 _LIT(KSQL, "SELECT * FROM %S WHERE %S=%d AND %S=%d AND %S=%d AND %S=%d"); |
974 |
1078 |
975 sqlStatement.Format(KSQL, &m_db_table_name, |
1079 sqlStatement.Format( |
976 &KServiceType, m_index_type, &KServiceIndex, m_index, &KTunnelingType, m_tunneling_vendor_type); |
1080 KSQL, |
|
1081 &m_db_table_name, |
|
1082 &KServiceType, |
|
1083 m_index_type, |
|
1084 &KServiceIndex, |
|
1085 m_index, |
|
1086 &KTunnelingTypeVendorId, |
|
1087 m_tunneling_type.get_vendor_id(), |
|
1088 &KTunnelingType, |
|
1089 m_tunneling_type.get_vendor_type()); |
977 |
1090 |
978 User::LeaveIfError(view.Prepare(m_database, TDbQuery(sqlStatement), TDbWindow::EUnlimited)); |
1091 User::LeaveIfError(view.Prepare(m_database, TDbQuery(sqlStatement), TDbWindow::EUnlimited)); |
979 CleanupClosePushL(view); |
1092 CleanupClosePushL(view); |
980 User::LeaveIfError(view.EvaluateAll()); |
1093 User::LeaveIfError(view.EvaluateAll()); |
981 |
1094 |
1384 m_cipher_suite = (tls_cipher_suites_e)*reinterpret_cast<u32_t *>( |
1501 m_cipher_suite = (tls_cipher_suites_e)*reinterpret_cast<u32_t *>( |
1385 cipher_suite.get_data(sizeof(u32_t))); |
1502 cipher_suite.get_data(sizeof(u32_t))); |
1386 } |
1503 } |
1387 } |
1504 } |
1388 |
1505 |
1389 //---------------------------------------------------------- |
|
1390 |
|
1391 #ifndef USE_EAP_EXPANDED_TYPES // This is not needed it seems. Still keeping it for normal EAP types. |
|
1392 // Intention of this is to get tunneled EAP types, but m_tunneled_type is not used |
|
1393 // anywhere other than this place. |
|
1394 |
|
1395 if (m_current_eap_type == eap_type_peap |
|
1396 #if defined(USE_TTLS_EAP_TYPE) |
|
1397 || m_current_eap_type == eap_type_ttls |
|
1398 #endif // #if defined(USE_TTLS_EAP_TYPE) |
|
1399 |
|
1400 #if defined(USE_FAST_EAP_TYPE) |
|
1401 || m_current_eap_type == eap_type_fast |
|
1402 #endif |
|
1403 |
|
1404 |
|
1405 ) |
|
1406 { |
|
1407 eap_variable_data_c tunneled_type(m_am_tools); |
|
1408 |
|
1409 eap_status_e status = type_configure_read( |
|
1410 cf_str_PEAP_tunneled_eap_type_hex_data.get_field(), |
|
1411 &tunneled_type); |
|
1412 if (status == eap_status_illegal_configure_type) |
|
1413 { |
|
1414 status = m_partner->read_configure( |
|
1415 cf_str_PEAP_tunneled_eap_type_u32_t.get_field(), |
|
1416 &tunneled_type); |
|
1417 } |
|
1418 if (status != eap_status_ok) |
|
1419 { |
|
1420 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
1421 return EAP_STATUS_RETURN(m_am_tools, status); |
|
1422 } |
|
1423 else if (tunneled_type.get_is_valid_data() == true |
|
1424 && tunneled_type.get_data_length() == sizeof(u32_t) |
|
1425 && tunneled_type.get_data(sizeof(u32_t)) != 0) |
|
1426 { |
|
1427 m_tunneled_type = static_cast<eap_type_value_e>( |
|
1428 *reinterpret_cast<u32_t *>(tunneled_type.get_data(sizeof(u32_t)))); |
|
1429 } |
|
1430 else if (tunneled_type.get_data_length() |
|
1431 == eap_expanded_type_c::get_eap_expanded_type_size() |
|
1432 && tunneled_type.get_data(tunneled_type.get_data_length()) != 0) |
|
1433 { |
|
1434 eap_expanded_type_c eap_type(eap_type_none); |
|
1435 |
|
1436 status = eap_type.set_expanded_type_data( |
|
1437 m_am_tools, |
|
1438 &tunneled_type); |
|
1439 if (status != eap_status_ok) |
|
1440 { |
|
1441 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
1442 return EAP_STATUS_RETURN(m_am_tools, status); |
|
1443 } |
|
1444 |
|
1445 status = eap_type.get_type_data( |
|
1446 m_am_tools, |
|
1447 &m_tunneled_type); |
|
1448 if (status != eap_status_ok) |
|
1449 { |
|
1450 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
1451 return EAP_STATUS_RETURN(m_am_tools, status); |
|
1452 } |
|
1453 } |
|
1454 } |
|
1455 |
|
1456 #endif //#ifndef USE_EAP_EXPANDED_TYPES |
|
1457 |
|
1458 //---------------------------------------------------------- |
1506 //---------------------------------------------------------- |
1459 |
1507 |
1460 { |
1508 { |
1461 eap_variable_data_c use_manual_username(m_am_tools); |
1509 eap_variable_data_c use_manual_username(m_am_tools); |
1462 |
1510 |
1601 // Read Maximum Session Validity Time from the config file |
1649 // Read Maximum Session Validity Time from the config file |
1602 eap_variable_data_c sessionTimeFromFile(m_am_tools); |
1650 eap_variable_data_c sessionTimeFromFile(m_am_tools); |
1603 |
1651 |
1604 eap_status_e status(eap_status_ok); |
1652 eap_status_e status(eap_status_ok); |
1605 |
1653 |
1606 switch (m_current_eap_vendor_type) |
1654 if (m_current_eap_type == eap_type_tls) |
1607 { |
1655 { |
1608 case eap_type_tls: |
1656 status = m_partner->read_configure( |
1609 { |
1657 cf_str_EAP_TLS_max_session_validity_time.get_field(), |
1610 status = m_partner->read_configure( |
1658 &sessionTimeFromFile); |
1611 cf_str_EAP_TLS_max_session_validity_time.get_field(), |
1659 } |
1612 &sessionTimeFromFile); |
1660 else if (m_current_eap_type == eap_type_peap) |
1613 } |
1661 { |
1614 break; |
1662 status = m_partner->read_configure( |
1615 |
1663 cf_str_EAP_PEAP_max_session_validity_time.get_field(), |
1616 case eap_type_peap: |
1664 &sessionTimeFromFile); |
1617 { |
1665 } |
1618 status = m_partner->read_configure( |
1666 else if (m_current_eap_type == eap_type_ttls) |
1619 cf_str_EAP_PEAP_max_session_validity_time.get_field(), |
1667 { |
1620 &sessionTimeFromFile); |
1668 status = m_partner->read_configure( |
1621 } |
1669 cf_str_EAP_TTLS_max_session_validity_time.get_field(), |
1622 break; |
1670 &sessionTimeFromFile); |
1623 |
1671 } |
1624 case eap_type_ttls: |
1672 else if (m_current_eap_type == eap_type_ttls_plain_pap) |
1625 { |
1673 { |
1626 status = m_partner->read_configure( |
|
1627 cf_str_EAP_TTLS_max_session_validity_time.get_field(), |
|
1628 &sessionTimeFromFile); |
|
1629 } |
|
1630 break; |
|
1631 |
|
1632 case eap_type_ttls_plain_pap: |
|
1633 { |
|
1634 // read PAP session time |
1674 // read PAP session time |
1635 status = m_partner->read_configure( |
1675 status = m_partner->read_configure( |
1636 cf_str_EAP_TLS_PEAP_ttls_pap_max_session_validity_time.get_field(), |
1676 cf_str_EAP_TLS_PEAP_ttls_pap_max_session_validity_time.get_field(), |
1637 &sessionTimeFromFile ); |
1677 &sessionTimeFromFile ); |
1638 } |
1678 } |
1639 break; |
|
1640 |
|
1641 #if defined(USE_FAST_EAP_TYPE) |
1679 #if defined(USE_FAST_EAP_TYPE) |
1642 case eap_type_fast: |
1680 else if (m_current_eap_type == eap_type_fast) |
1643 { |
1681 { |
1644 status = m_partner->read_configure( |
1682 status = m_partner->read_configure( |
1645 cf_str_EAP_FAST_max_session_validity_time.get_field(), |
1683 cf_str_EAP_FAST_max_session_validity_time.get_field(), |
1646 &sessionTimeFromFile); |
1684 &sessionTimeFromFile); |
1647 } |
1685 } |
1648 break; |
|
1649 #endif |
1686 #endif |
1650 |
1687 else |
1651 default: |
1688 { |
1652 { |
1689 // Should never happen |
1653 // Should never happen |
1690 EAP_TRACE_ERROR(m_am_tools, |
1654 EAP_TRACE_ERROR(m_am_tools, |
1691 TRACE_FLAGS_DEFAULT, ( |
1655 TRACE_FLAGS_DEFAULT, ( |
1692 EAPL("eap_am_type_tls_peap_symbian_c::configure(): Unsupported EAP type, m_current_eap_vendor_type=0xfe%06x%08x\n"), |
1656 EAPL("eap_am_type_tls_peap_symbian_c::configure - Unsupported EAP type, m_current_eap_vendor_type=%d \n"), |
1693 m_current_eap_type.get_vendor_id(), |
1657 m_current_eap_vendor_type)); |
1694 m_current_eap_type.get_vendor_type())); |
1658 } |
1695 } |
1659 } |
|
1660 |
1696 |
1661 // set m_max_session_time |
1697 // set m_max_session_time |
1662 if (status == eap_status_ok |
1698 if (status == eap_status_ok |
1663 && sessionTimeFromFile.get_is_valid_data() == true |
1699 && sessionTimeFromFile.get_is_valid_data() == true |
1664 && sessionTimeFromFile.get_data_length() == sizeof(u32_t)) |
1700 && sessionTimeFromFile.get_data_length() == sizeof(u32_t)) |
1755 |
1791 |
1756 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
1792 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
1757 |
1793 |
1758 status = eap_status_ok; |
1794 status = eap_status_ok; |
1759 |
1795 |
1760 if (m_allowed_ca_certs.Count() == 0) |
1796 if (m_use_automatic_ca_certificate == false) |
1761 { |
1797 { |
1762 // needed because of nonworking wrong settings |
1798 if (m_allowed_ca_certs.Count() == 0) |
|
1799 { |
|
1800 // needed because of nonworking wrong settings |
1763 #if defined(USE_FAST_EAP_TYPE) |
1801 #if defined(USE_FAST_EAP_TYPE) |
1764 if(m_current_eap_type == eap_type_fast && |
1802 if(m_current_eap_type == eap_type_fast |
1765 m_serv_auth_prov_mode != true) |
1803 && m_serv_auth_prov_mode != true) |
1766 { |
1804 { |
1767 // In the case of EAP-FAST, CA cert is must if m_serv_auth_prov_mode is TRUE. |
1805 // In the case of EAP-FAST, CA cert is must if m_serv_auth_prov_mode is TRUE. |
1768 status = eap_status_ok; |
1806 status = eap_status_ok; |
|
1807 |
|
1808 EAP_TRACE_DEBUG( |
|
1809 m_am_tools, |
|
1810 TRACE_FLAGS_DEFAULT, |
|
1811 (EAPL("eap_am_type_tls_peap_symbian_c::configure(): No CA certificate but exception for EAP-FAST as m_serv_auth_prov_mode is FALSE and for all m_serv_unauth_prov_mode \n"))); |
|
1812 } |
|
1813 else |
|
1814 #endif // #if defined(USE_FAST_EAP_TYPE) |
|
1815 { |
|
1816 EAP_TRACE_ERROR( |
|
1817 m_am_tools, |
|
1818 TRACE_FLAGS_DEFAULT, |
|
1819 (EAPL("eap_am_type_tls_peap_symbian_c::configure(): Error - No CA certificate\n"))); |
1769 |
1820 |
1770 EAP_TRACE_DEBUG(m_am_tools, |
1821 // No root certificate selected. Cannot continue. |
1771 TRACE_FLAGS_DEFAULT, ( |
1822 status = eap_status_ca_certificate_unknown; |
1772 EAPL("eap_am_type_tls_peap_symbian_c::configure - No CA certificate but exception for EAP-FAST as m_serv_auth_prov_mode is FALSE and for all m_serv_unauth_prov_mode \n"))); |
1823 send_error_notification(status); |
1773 } |
1824 } |
1774 else |
1825 } |
1775 #endif // #if defined(USE_FAST_EAP_TYPE) |
1826 else |
1776 { |
1827 { |
1777 EAP_TRACE_ERROR(m_am_tools, |
1828 EAP_TRACE_DEBUG( |
1778 TRACE_FLAGS_DEFAULT, ( |
1829 m_am_tools, |
1779 EAPL("eap_am_type_tls_peap_symbian_c::configure - Error - No CA certificate\n"))); |
1830 TRACE_FLAGS_DEFAULT, |
1780 |
1831 (EAPL("eap_am_type_tls_peap_symbian_c::configure(): %d CA certificates selected.\n"), |
1781 // No root certificate selected. Cannot continue. |
1832 m_allowed_ca_certs.Count())); |
1782 status = eap_status_ca_certificate_unknown; |
1833 } |
1783 send_error_notification(status); |
1834 } |
1784 } |
1835 else |
1785 } |
1836 { |
1786 |
1837 EAP_TRACE_DEBUG( |
|
1838 m_am_tools, |
|
1839 TRACE_FLAGS_DEFAULT, |
|
1840 (EAPL("eap_am_type_tls_peap_symbian_c::configure(): %d CA certificate selected in automatic CA selection.\n"), |
|
1841 m_allowed_ca_certs.Count())); |
|
1842 } |
|
1843 |
|
1844 |
1787 if(m_allowed_user_certs.Count() == 0) |
1845 if(m_allowed_user_certs.Count() == 0) |
1788 { |
1846 { |
1789 #if defined(USE_FAST_EAP_TYPE) |
1847 #if defined(USE_FAST_EAP_TYPE) |
1790 if(m_current_eap_type == eap_type_fast) |
1848 if(m_current_eap_type == eap_type_fast) |
1791 { |
1849 { |
1792 m_use_manual_realm = true; |
1850 m_use_manual_realm = true; |
1793 |
1851 |
1794 if (m_use_manual_username == false) |
1852 if (m_use_manual_username == false) |
1795 { |
1853 { |
1796 TRAPD(err, status=ConfigureL()); |
1854 TRAPD(err, status=ConfigureL()); |
1797 if (err != KErrNone) |
1855 if (err != KErrNone) |
1798 { |
1856 { |
1799 EAP_TRACE_ERROR(m_am_tools, |
1857 EAP_TRACE_ERROR(m_am_tools, |
1800 TRACE_FLAGS_DEFAULT, ( |
1858 TRACE_FLAGS_DEFAULT, ( |
1801 EAPL("eap_am_type_tls_peap_symbian_c::configure LEAVE from ConfigureL, Error =%d \n"), |
1859 EAPL("eap_am_type_tls_peap_symbian_c::configure LEAVE from ConfigureL, Error =%d \n"), |
1802 err)); |
1860 err)); |
1803 } |
|
1804 } |
1861 } |
1805 } |
1862 } |
|
1863 } |
1806 #endif // #if defined(USE_FAST_EAP_TYPE) |
1864 #endif // #if defined(USE_FAST_EAP_TYPE) |
1807 } |
1865 } |
|
1866 else |
|
1867 { |
|
1868 EAP_TRACE_DEBUG( |
|
1869 m_am_tools, |
|
1870 TRACE_FLAGS_DEFAULT, |
|
1871 (EAPL("eap_am_type_tls_peap_symbian_c::configure(): %d user certificates selected.\n"), |
|
1872 m_allowed_user_certs.Count())); |
|
1873 } |
|
1874 |
|
1875 |
1808 if (m_tls_peap_server_authenticates_client_policy_flag == true |
1876 if (m_tls_peap_server_authenticates_client_policy_flag == true |
1809 && m_allowed_user_certs.Count() == 0) |
1877 && m_allowed_user_certs.Count() == 0) |
1810 { |
1878 { |
1811 #if defined(USE_FAST_EAP_TYPE) |
1879 #if defined(USE_FAST_EAP_TYPE) |
1812 if (m_current_eap_type == eap_type_fast) |
1880 if (m_current_eap_type == eap_type_fast) |
1813 { |
1881 { |
1814 EAP_TRACE_DEBUG(m_am_tools, |
1882 EAP_TRACE_DEBUG( |
1815 TRACE_FLAGS_DEFAULT, |
1883 m_am_tools, |
1816 (EAPL("eap_am_type_tls_peap_symbian_c::configure - No USER certificate, but in eap_fast it's not mandatory\n"))); |
1884 TRACE_FLAGS_DEFAULT, |
1817 |
1885 (EAPL("eap_am_type_tls_peap_symbian_c::configure(): No USER certificate, but in eap_fast it's not mandatory\n"))); |
1818 } |
1886 } |
1819 else |
1887 else |
1820 #endif // #if defined(USE_FAST_EAP_TYPE) |
1888 #endif // #if defined(USE_FAST_EAP_TYPE) |
1821 { |
1889 { |
1822 EAP_TRACE_ERROR(m_am_tools, |
1890 EAP_TRACE_ERROR( |
1823 TRACE_FLAGS_DEFAULT, ( |
1891 m_am_tools, |
1824 EAPL("eap_am_type_tls_peap_symbian_c::configure - Error - No USER certificate\n"))); |
1892 TRACE_FLAGS_DEFAULT, |
1825 |
1893 (EAPL("eap_am_type_tls_peap_symbian_c::configure(): Error - No USER certificate\n"))); |
1826 // No user certificate selected. Cannot continue. |
1894 |
1827 status = eap_status_user_certificate_unknown; |
1895 // No user certificate selected. Cannot continue. |
1828 send_error_notification(status); |
1896 status = eap_status_user_certificate_unknown; |
|
1897 send_error_notification(status); |
1829 } |
1898 } |
1830 } |
1899 } |
1831 |
1900 |
1832 if (m_allowed_cipher_suites.Count() == 0) |
1901 if (m_allowed_cipher_suites.Count() == 0) |
1833 { |
1902 { |
1834 EAP_TRACE_ERROR(m_am_tools, |
1903 EAP_TRACE_ERROR( |
1835 TRACE_FLAGS_DEFAULT, ( |
1904 m_am_tools, |
1836 EAPL("eap_am_type_tls_peap_symbian_c::configure - Error - No cipher suit\n"))); |
1905 TRACE_FLAGS_DEFAULT, |
|
1906 (EAPL("eap_am_type_tls_peap_symbian_c::configure(): Error - No cipher suit\n"))); |
1837 |
1907 |
1838 // No sipher suites selected. Cannot continue. |
1908 // No sipher suites selected. Cannot continue. |
1839 status = eap_status_illegal_cipher_suite; |
1909 status = eap_status_illegal_cipher_suite; |
1840 send_error_notification(status); |
1910 send_error_notification(status); |
1841 } |
1911 } |
|
1912 else |
|
1913 { |
|
1914 EAP_TRACE_DEBUG( |
|
1915 m_am_tools, |
|
1916 TRACE_FLAGS_DEFAULT, |
|
1917 (EAPL("eap_am_type_tls_peap_symbian_c::configure(): %d cipher suites selected.\n"), |
|
1918 m_allowed_cipher_suites.Count())); |
|
1919 } |
1842 |
1920 |
1843 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
1921 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
1844 |
1922 |
1845 if (status != eap_status_ok) |
1923 if (status != eap_status_ok) |
1846 { |
1924 { |
1847 notify_configuration_error(status); |
1925 notify_configuration_error(status); |
1848 } |
1926 } |
1849 |
1927 |
1850 m_configured = true; |
1928 m_configured = true; |
1851 |
1929 |
1852 EAP_TRACE_DEBUG(m_am_tools, |
1930 EAP_TRACE_DEBUG( |
|
1931 m_am_tools, |
1853 TRACE_FLAGS_DEFAULT, |
1932 TRACE_FLAGS_DEFAULT, |
1854 (EAPL("eap_am_type_tls_peap_symbian_c::configure - END \n"))); |
1933 (EAPL("eap_am_type_tls_peap_symbian_c::configure(): END \n"))); |
1855 |
1934 |
1856 |
1935 |
1857 return EAP_STATUS_RETURN(m_am_tools, status); |
1936 return EAP_STATUS_RETURN(m_am_tools, status); |
1858 } |
1937 } |
1859 |
1938 |
1860 //-------------------------------------------------- |
1939 //-------------------------------------------------- |
|
1940 |
1861 #if defined(USE_FAST_EAP_TYPE) |
1941 #if defined(USE_FAST_EAP_TYPE) |
1862 |
1942 |
1863 eap_status_e eap_am_type_tls_peap_symbian_c::ConfigureL() |
1943 eap_status_e eap_am_type_tls_peap_symbian_c::ConfigureL() |
1864 { |
1944 { |
1865 |
1945 |
1866 eap_status_e status(eap_status_ok); |
1946 eap_status_e status(eap_status_ok); |
1867 |
1947 |
1868 _LIT(KTempUserName, "EAP-FAST-"); |
1948 _LIT(KTempUserName, "EAP-FAST-"); |
1869 TBuf8<10> TempUserName; |
1949 TBuf8<10> TempUserName; |
1870 |
1950 |
1871 TempUserName.Copy(KTempUserName); |
1951 TempUserName.Copy(KTempUserName); |
1872 |
1952 |
1873 HBufC8* buf = HBufC8::NewLC(KIdentityFieldLength); |
1953 HBufC8* buf = HBufC8::NewLC(KMaxNotifItemLength); |
|
1954 |
1874 TPtr8 bufPtr = buf->Des(); |
1955 TPtr8 bufPtr = buf->Des(); |
1875 |
1956 |
1876 HBufC8* tempUserBuf8 = HBufC8::NewLC(KMacAddressLength); |
1957 HBufC8* tempUserBuf8 = HBufC8::NewLC(KMacAddressLength); |
1877 TPtr8 tempUserBufPtr8 = tempUserBuf8->Des(); |
1958 TPtr8 tempUserBufPtr8 = tempUserBuf8->Des(); |
1878 |
1959 |
3247 } |
3333 } |
3248 else |
3334 else |
3249 { |
3335 { |
3250 // Get the first enabled EAP type (tunneling). |
3336 // Get the first enabled EAP type (tunneling). |
3251 |
3337 |
3252 TBuf8<KExpandedEAPTypeSize> tmpExpEAP(m_enabled_tunneling_exp_eap_array[0]->iExpandedEAPType); //first item. |
|
3253 |
|
3254 EAP_TRACE_DATA_DEBUG( |
3338 EAP_TRACE_DATA_DEBUG( |
3255 m_am_tools, |
3339 m_am_tools, |
3256 TRACE_FLAGS_DEFAULT, |
3340 TRACE_FLAGS_DEFAULT, |
3257 (EAPL("type_configure_read:Enabled expanded tunneling EAP type:"), |
3341 (EAPL("type_configure_read:Enabled expanded tunneling EAP type:"), |
3258 tmpExpEAP.Ptr(), |
3342 m_enabled_tunneling_exp_eap_array[0]->GetValue().Ptr(), |
3259 tmpExpEAP.Size())); |
3343 m_enabled_tunneling_exp_eap_array[0]->GetValue().Length())); |
3260 |
3344 |
3261 status = data->set_copy_of_buffer(tmpExpEAP.Ptr(), KExpandedEAPTypeSize); |
3345 status = data->set_copy_of_buffer( |
3262 if (status != eap_status_ok) |
3346 m_enabled_tunneling_exp_eap_array[0]->GetValue().Ptr(), |
3263 { |
3347 m_enabled_tunneling_exp_eap_array[0]->GetValue().Length()); |
3264 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
3348 if (status != eap_status_ok) |
3265 return EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error); |
3349 { |
3266 } |
3350 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
3351 return EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error); |
|
3352 } |
3267 |
3353 |
3268 EAP_TRACE_DATA_DEBUG( |
3354 EAP_TRACE_DATA_DEBUG( |
3269 m_am_tools, |
3355 m_am_tools, |
3270 TRACE_FLAGS_DEFAULT, |
3356 TRACE_FLAGS_DEFAULT, |
3271 (EAPL("EAP-PEAP or EAP-TTLS: Trying encapsulated EAP type:"), |
3357 (EAPL("EAP-PEAP or EAP-TTLS: Trying encapsulated EAP type:"), |
3272 tmpExpEAP.Ptr(), |
3358 m_enabled_tunneling_exp_eap_array[0]->GetValue().Ptr(), |
3273 tmpExpEAP.Size())); |
3359 m_enabled_tunneling_exp_eap_array[0]->GetValue().Length())); |
3274 } |
3360 } |
3275 |
3361 |
3276 #else // For normal EAP types. |
|
3277 |
|
3278 // We need to return here the next tunneled EAP type we should try. |
|
3279 TInt i; |
|
3280 |
|
3281 for (i = 0; i < m_iap_eap_array.Count(); i++) |
|
3282 { |
|
3283 // Find the first enabled EAP type (highest priority) |
|
3284 TEap *eapType = m_iap_eap_array[i]; |
|
3285 if (eapType->Enabled == 1) |
|
3286 { |
|
3287 // Convert the string to integer |
|
3288 TLex8 tmp(eapType->UID); |
|
3289 TInt val(0); |
|
3290 tmp.Val(val); |
|
3291 status = data->set_copy_of_buffer(reinterpret_cast<u8_t *>(&val), sizeof(TUint)); |
|
3292 if (status != eap_status_ok) |
|
3293 { |
|
3294 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
3295 return EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error); |
|
3296 } |
|
3297 EAP_TRACE_DEBUG(m_am_tools, TRACE_FLAGS_DEFAULT, (EAPL("EAP-PEAP: Trying encapsulated EAP type: %d.\n"), val)); |
|
3298 break; |
|
3299 } |
|
3300 } |
|
3301 if (i == m_iap_eap_array.Count()) |
|
3302 { |
|
3303 // Not found |
|
3304 if (m_is_client) |
|
3305 { |
|
3306 EAP_TRACE_DEBUG(m_am_tools, TRACE_FLAGS_DEFAULT, (EAPL("ERROR: No configured encapsulated EAP types.\n"))); |
|
3307 } |
|
3308 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
3309 return EAP_STATUS_RETURN(m_am_tools, eap_status_illegal_configure_field); |
|
3310 } |
|
3311 |
|
3312 #endif //#ifdef USE_EAP_EXPANDED_TYPES |
|
3313 |
|
3314 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
3362 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
3315 return EAP_STATUS_RETURN(m_am_tools, status); |
3363 return EAP_STATUS_RETURN(m_am_tools, status); |
3316 |
3364 |
3317 } // End of if (!wanted_field.compare(&type_field)) |
3365 } // End of if (!wanted_field.compare(&type_field)) |
3318 |
3366 |
3319 #if !defined(USE_EAP_EXPANDED_TYPES) |
|
3320 |
|
3321 // cf_str_PEAP_accepted_tunneled_client_types_hex_data is available only for expaned EAP types. |
|
3322 // cf_str_PEAP_accepted_tunneled_client_types_u32array should be used otherwise. |
|
3323 // So for cf_str_PEAP_accepted_tunneled_client_types_hex_data and eap_configure_type_hex_data |
|
3324 // we should return eap_status_illegal_configure_field. |
|
3325 // This is needed only if USE_EAP_EXPANDED_TYPES is not defined. Otherwise the field |
|
3326 // cf_str_PEAP_accepted_tunneled_client_types_hex_data can be read from the database using |
|
3327 // type_configure_readL (let it fall through). |
|
3328 |
|
3329 eap_variable_data_c tunneled_type_field(m_am_tools); |
|
3330 |
|
3331 status = tunneled_type_field.set_buffer( |
|
3332 cf_str_PEAP_accepted_tunneled_client_types_hex_data.get_field()->get_field(), |
|
3333 cf_str_PEAP_accepted_tunneled_client_types_hex_data.get_field()->get_field_length(), |
|
3334 false, |
|
3335 false); |
|
3336 if (status != eap_status_ok) |
|
3337 { |
|
3338 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
3339 return EAP_STATUS_RETURN(m_am_tools, status); |
|
3340 } |
|
3341 |
|
3342 if (!wanted_field.compare(&tunneled_type_field)) |
|
3343 { |
|
3344 // Check if the type is eap_configure_type_hex_data. |
|
3345 |
|
3346 if( eap_configure_type_hex_data == field->get_type() ) |
|
3347 { |
|
3348 // This field is used only for exapanded EAP types. |
|
3349 return EAP_STATUS_RETURN(m_am_tools, eap_status_illegal_configure_type); |
|
3350 } |
|
3351 } |
|
3352 |
|
3353 #else // For expanded EAP type. |
|
3354 |
3367 |
3355 // cf_str_PEAP_accepted_tunneled_client_types_u32array is available only for normal EAP types. |
3368 // cf_str_PEAP_accepted_tunneled_client_types_u32array is available only for normal EAP types. |
3356 // So for cf_str_PEAP_accepted_tunneled_client_types_u32array and eap_configure_type_u32array |
3369 // So for cf_str_PEAP_accepted_tunneled_client_types_u32array and eap_configure_type_u32array |
3357 // we should return eap_status_illegal_configure_field. |
3370 // we should return eap_status_illegal_configure_field. |
3358 |
3371 |
3435 |
3446 |
3436 // Now do the database query |
3447 // Now do the database query |
3437 HBufC* buf = HBufC::NewLC(KMaxSqlQueryLength); |
3448 HBufC* buf = HBufC::NewLC(KMaxSqlQueryLength); |
3438 TPtr sqlStatement = buf->Des(); |
3449 TPtr sqlStatement = buf->Des(); |
3439 |
3450 |
3440 _LIT(KSQLQueryRow, "SELECT %S FROM %S WHERE %S=%d AND %S=%d AND %S=%d"); |
3451 _LIT(KSQLQueryRow, "SELECT %S FROM %S WHERE %S=%d AND %S=%d AND %S=%d AND %S=%d"); |
3441 |
3452 |
3442 #if defined(USE_FAST_EAP_TYPE) |
3453 #if defined(USE_FAST_EAP_TYPE) |
3443 |
3454 |
3444 // Unlike other EAP types, EAP-FAST has some settings in special settings table |
3455 // Unlike other EAP types, EAP-FAST has some settings in special settings table |
3445 // (m_db_fast_special_table_name) |
3456 // (m_db_fast_special_table_name) |
3446 |
3457 |
3447 if(m_current_eap_type == eap_type_fast |
3458 if(m_current_eap_type == eap_type_fast |
3448 && ((unicodeString.Compare(cf_str_EAP_FAST_allow_server_authenticated_provisioning_mode_literal) == 0) |
3459 && ((unicodeString.Compare(cf_str_EAP_FAST_allow_server_authenticated_provisioning_mode_literal) == 0) |
3449 || (unicodeString.Compare(cf_str_EAP_FAST_allow_server_unauthenticated_provisioning_mode_ADHP_literal) == 0) |
3460 || (unicodeString.Compare(cf_str_EAP_FAST_allow_server_unauthenticated_provisioning_mode_ADHP_literal) == 0) |
3450 || (unicodeString.Compare(cf_str_EAP_FAST_warn_ADHP_no_PAC_literal) == 0) |
3461 || (unicodeString.Compare(KFASTWarnADHPNoPAC) == 0) |
3451 || (unicodeString.Compare(cf_str_EAP_FAST_warn_ADHP_no_matching_PAC_literal) == 0) |
3462 || (unicodeString.Compare(KFASTWarnADHPNoMatchingPAC) == 0) |
3452 || (unicodeString.Compare(cf_str_EAP_FAST_warn_ADHP_not_default_server_literal) == 0) |
3463 || (unicodeString.Compare(KFASTWarnNotDefaultServer) == 0) |
3453 || (unicodeString.Compare(KFASTPACGroupImportReferenceCollection) == 0) |
3464 || (unicodeString.Compare(KFASTPACGroupImportReferenceCollection) == 0) |
3454 || (unicodeString.Compare(KFASTPACGroupDBReferenceCollection) == 0))) |
3465 || (unicodeString.Compare(KFASTPACGroupDBReferenceCollection) == 0))) |
3455 { |
3466 { |
3456 if (unicodeString.Compare(cf_str_EAP_FAST_warn_ADHP_no_matching_PAC_literal) == 0) |
|
3457 { |
|
3458 unicodeString.Copy(KFASTWarnADHPNoMatchingPAC); |
|
3459 } |
|
3460 if (unicodeString.Compare(cf_str_EAP_FAST_warn_ADHP_no_PAC_literal) == 0) |
|
3461 { |
|
3462 unicodeString.Copy(KFASTWarnADHPNoPAC); |
|
3463 } |
|
3464 if (unicodeString.Compare(cf_str_EAP_FAST_warn_ADHP_not_default_server_literal) == 0) |
|
3465 { |
|
3466 unicodeString.Copy(KFASTWarnNotDefaultServer); |
|
3467 } |
|
3468 EAP_TRACE_DEBUG(m_am_tools, |
3467 EAP_TRACE_DEBUG(m_am_tools, |
3469 TRACE_FLAGS_DEFAULT, |
3468 TRACE_FLAGS_DEFAULT, |
3470 (EAPL("eap_am_type_tls_peap_symbian_c::type_configure_readL This field will be read from EAP-FAST's special table\n"))); |
3469 (EAPL("eap_am_type_tls_peap_symbian_c::type_configure_readL This field will be read from EAP-FAST's special table\n"))); |
3471 |
3470 |
3472 sqlStatement.Format(KSQLQueryRow, &unicodeString, &m_db_fast_special_table_name, |
3471 sqlStatement.Format( |
3473 &KServiceType, m_index_type, &KServiceIndex, m_index, &KTunnelingType, m_tunneling_vendor_type); |
3472 KSQLQueryRow, |
3474 } |
3473 &unicodeString, |
|
3474 &m_db_fast_special_table_name, |
|
3475 &KServiceType, |
|
3476 m_index_type, |
|
3477 &KServiceIndex, |
|
3478 m_index, |
|
3479 &KTunnelingTypeVendorId, |
|
3480 m_tunneling_type.get_vendor_id(), |
|
3481 &KTunnelingType, |
|
3482 m_tunneling_type.get_vendor_type()); |
|
3483 } |
3475 else |
3484 else |
3476 { |
3485 { |
3477 sqlStatement.Format(KSQLQueryRow, &unicodeString, &m_db_table_name, |
3486 sqlStatement.Format( |
3478 &KServiceType, m_index_type, &KServiceIndex, m_index, &KTunnelingType, m_tunneling_vendor_type); |
3487 KSQLQueryRow, |
3479 } |
3488 &unicodeString, |
|
3489 &m_db_table_name, |
|
3490 &KServiceType, |
|
3491 m_index_type, |
|
3492 &KServiceIndex, |
|
3493 m_index, |
|
3494 &KTunnelingTypeVendorId, |
|
3495 m_tunneling_type.get_vendor_id(), |
|
3496 &KTunnelingType, |
|
3497 m_tunneling_type.get_vendor_type()); |
|
3498 } |
3480 |
3499 |
3481 #else |
3500 #else |
3482 |
3501 |
3483 sqlStatement.Format(KSQLQueryRow, &unicodeString, &m_db_table_name, |
3502 sqlStatement.Format( |
3484 &KServiceType, m_index_type, &KServiceIndex, m_index, &KTunnelingType, m_tunneling_vendor_type); |
3503 KSQLQueryRow, |
|
3504 &unicodeString, |
|
3505 &m_db_table_name, |
|
3506 &KServiceType, |
|
3507 m_index_type, |
|
3508 &KServiceIndex, |
|
3509 m_index, |
|
3510 &KTunnelingTypeVendorId, |
|
3511 m_tunneling_type.get_vendor_id(), |
|
3512 &KTunnelingType, |
|
3513 m_tunneling_type.get_vendor_type()); |
3485 |
3514 |
3486 #endif // End: #if defined(USE_FAST_EAP_TYPE) |
3515 #endif // End: #if defined(USE_FAST_EAP_TYPE) |
3487 |
3516 |
3488 RDbView view; |
3517 RDbView view; |
3489 User::LeaveIfError(view.Prepare(m_database, TDbQuery(sqlStatement), TDbWindow::EUnlimited)); |
3518 User::LeaveIfError(view.Prepare(m_database, TDbQuery(sqlStatement), TDbWindow::EUnlimited)); |
3490 CleanupClosePushL(view); |
3519 CleanupClosePushL(view); |
3491 User::LeaveIfError(view.EvaluateAll()); |
3520 User::LeaveIfError(view.EvaluateAll()); |
3492 if (view.FirstL()) |
3521 if (view.FirstL()) |
4726 User::Leave(KErrArgument); |
4830 User::Leave(KErrArgument); |
4727 } |
4831 } |
4728 |
4832 |
4729 #if defined(_DEBUG) || defined(DEBUG) |
4833 #if defined(_DEBUG) || defined(DEBUG) |
4730 |
4834 |
4731 TPtr8 certPtr( |
4835 { |
4732 cert->get_data(cert->get_data_length()), |
4836 TPtr8 certPtr( |
4733 cert->get_data_length(), |
4837 cert->get_data(cert->get_data_length()), |
4734 cert->get_data_length()); |
4838 cert->get_data_length(), |
4735 CX509Certificate* x509Cert = CX509Certificate::NewL(certPtr); |
4839 cert->get_data_length()); |
4736 |
4840 |
4737 if( x509Cert != NULL ) |
4841 CX509Certificate* x509Cert = CX509Certificate::NewL(certPtr); |
4738 { |
4842 |
4739 CleanupStack::PushL(x509Cert); |
4843 if( x509Cert != NULL ) |
4740 |
4844 { |
4741 TKeyIdentifier KeyIdentifier = x509Cert->KeyIdentifierL(); |
4845 CleanupStack::PushL(x509Cert); |
4742 |
4846 |
4743 EAP_TRACE_DATA_DEBUG(m_am_tools, TRACE_FLAGS_DEFAULT, (EAPL("Key identifier is"), |
4847 TKeyIdentifier KeyIdentifier = x509Cert->KeyIdentifierL(); |
4744 KeyIdentifier.Ptr(), |
|
4745 KeyIdentifier.Size())); |
|
4746 |
|
4747 // This is for subject key id. |
|
4748 const CX509CertExtension* certExt = x509Cert->Extension(KSubjectKeyId); |
|
4749 |
|
4750 if (certExt) |
|
4751 { |
|
4752 const CX509SubjectKeyIdExt* subKeyExt = CX509SubjectKeyIdExt::NewLC(certExt->Data()); |
|
4753 EAP_UNREFERENCED_PARAMETER(subKeyExt); |
|
4754 |
|
4755 EAP_TRACE_DATA_DEBUG(m_am_tools, TRACE_FLAGS_DEFAULT, (EAPL("The Subject key Id is:"), |
|
4756 subKeyExt->KeyId().Ptr(), |
|
4757 subKeyExt->KeyId().Size())); |
|
4758 |
4848 |
4759 CleanupStack::PopAndDestroy(); // subKeyExt |
4849 EAP_TRACE_DATA_DEBUG( |
|
4850 m_am_tools, |
|
4851 TRACE_FLAGS_DEFAULT, |
|
4852 (EAPL("Key identifier is"), |
|
4853 KeyIdentifier.Ptr(), |
|
4854 KeyIdentifier.Size())); |
|
4855 |
|
4856 // This is for subject key id. |
|
4857 const CX509CertExtension* certExt = x509Cert->Extension(KSubjectKeyId); |
|
4858 |
|
4859 if (certExt) |
|
4860 { |
|
4861 const CX509SubjectKeyIdExt* subKeyExt = CX509SubjectKeyIdExt::NewLC(certExt->Data()); |
|
4862 EAP_UNREFERENCED_PARAMETER(subKeyExt); |
|
4863 |
|
4864 EAP_TRACE_DATA_DEBUG(m_am_tools, TRACE_FLAGS_DEFAULT, (EAPL("The Subject key Id is:"), |
|
4865 subKeyExt->KeyId().Ptr(), |
|
4866 subKeyExt->KeyId().Size())); |
|
4867 |
|
4868 CleanupStack::PopAndDestroy(); |
|
4869 } |
|
4870 else |
|
4871 { |
|
4872 EAP_TRACE_ERROR(m_am_tools, TRACE_FLAGS_DEFAULT, (EAPL("ERROR: verify_certificate_chainL - No extension for this certificate\n"))); |
|
4873 } |
|
4874 |
|
4875 CleanupStack::PopAndDestroy(); |
4760 } |
4876 } |
4761 else |
4877 } |
4762 { |
|
4763 EAP_TRACE_ERROR(m_am_tools, TRACE_FLAGS_DEFAULT, (EAPL("ERROR: verify_certificate_chainL - No extension for this certificate\n"))); |
|
4764 } |
|
4765 |
|
4766 CleanupStack::PopAndDestroy(x509Cert); |
|
4767 } |
|
4768 |
|
4769 #endif |
4878 #endif |
4770 |
4879 |
|
4880 temp = chain->ReAllocL(chain->Length() + cert->get_data_length()); |
|
4881 |
|
4882 CleanupStack::Pop(chain); |
|
4883 |
|
4884 chain = temp; |
|
4885 |
4771 CleanupStack::PushL(chain); |
4886 CleanupStack::PushL(chain); |
4772 temp = chain->ReAllocL(chain->Length() + cert->get_data_length()); |
4887 |
4773 chain = temp; |
|
4774 TPtr8 ptr = chain->Des(); |
4888 TPtr8 ptr = chain->Des(); |
|
4889 |
4775 ptr.Append(cert->get_data(cert->get_data_length()), cert->get_data_length()); |
4890 ptr.Append(cert->get_data(cert->get_data_length()), cert->get_data_length()); |
4776 if (i == 0) |
4891 if (i == 0) |
4777 { |
4892 { |
4778 // This is the peer certificate. Save it. |
4893 // This is the peer certificate. Save it. |
4779 if (m_peer_certificate != 0) |
4894 if (m_peer_certificate != 0) |
4780 { |
4895 { |
4781 delete m_peer_certificate; |
4896 delete m_peer_certificate; |
4782 } |
4897 } |
4783 m_peer_certificate = CX509Certificate::NewL(ptr); |
4898 m_peer_certificate = CX509Certificate::NewL(ptr); |
4784 } |
4899 } |
4785 CleanupStack::Pop(); |
4900 |
4786 } |
4901 } // for() |
4787 CleanupStack::PushL(chain); |
4902 |
|
4903 |
|
4904 EAP_TRACE_DEBUG( |
|
4905 m_am_tools, |
|
4906 TRACE_FLAGS_DEFAULT, |
|
4907 (EAPL("eap_am_type_tls_peap_symbian_c::verify_certificate_chainL(): calls chain->Des()\n"))); |
|
4908 |
4788 TPtr8 certChain = chain->Des(); |
4909 TPtr8 certChain = chain->Des(); |
4789 m_cert_if->ValidateChainL(certChain, m_allowed_ca_certs); |
4910 TBool aUseAutomaticCaCertificate = (m_use_automatic_ca_certificate == true) ? ETrue : EFalse; |
4790 |
4911 |
4791 CleanupStack::PopAndDestroy(); |
4912 EAP_TRACE_DEBUG( |
|
4913 m_am_tools, |
|
4914 TRACE_FLAGS_DEFAULT, |
|
4915 (EAPL("eap_am_type_tls_peap_symbian_c::verify_certificate_chainL(): calls m_cert_if->ValidateChainL()\n"))); |
|
4916 |
|
4917 m_cert_if->ValidateChainL(certChain, m_allowed_ca_certs, aUseAutomaticCaCertificate); |
|
4918 |
|
4919 CleanupStack::PopAndDestroy(chain); |
|
4920 |
4792 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
4921 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
4922 |
4793 // This returns eap_status_pending_request |
4923 // This returns eap_status_pending_request |
4794 User::Leave(KErrCompletion); |
4924 User::Leave(KErrCompletion); |
4795 |
4925 |
4796 } |
4926 } |
4797 |
4927 |
|
4928 //-------------------------------------------------- |
|
4929 |
|
4930 #if defined(USE_EAP_DEBUG_TRACE) |
|
4931 |
|
4932 static eap_const_string get_certificate_error_string(const enum TValidationError certificate_error) |
|
4933 { |
|
4934 #if defined(USE_EAP_TRACE_STRINGS) |
|
4935 EAP_IF_RETURN_STRING(certificate_error, EValidatedOK) |
|
4936 else EAP_IF_RETURN_STRING(certificate_error, EChainHasNoRoot) |
|
4937 else EAP_IF_RETURN_STRING(certificate_error, ESignatureInvalid) |
|
4938 else EAP_IF_RETURN_STRING(certificate_error, EDateOutOfRange) |
|
4939 else EAP_IF_RETURN_STRING(certificate_error, ENameIsExcluded) |
|
4940 else EAP_IF_RETURN_STRING(certificate_error, ENameNotPermitted) |
|
4941 else EAP_IF_RETURN_STRING(certificate_error, ENotCACert) |
|
4942 else EAP_IF_RETURN_STRING(certificate_error, ECertificateRevoked) |
|
4943 else EAP_IF_RETURN_STRING(certificate_error, EUnrecognizedCriticalExtension) |
|
4944 else EAP_IF_RETURN_STRING(certificate_error, ENoBasicConstraintInCACert) |
|
4945 else EAP_IF_RETURN_STRING(certificate_error, ENoAcceptablePolicy) |
|
4946 else EAP_IF_RETURN_STRING(certificate_error, EPathTooLong) |
|
4947 else EAP_IF_RETURN_STRING(certificate_error, ENegativePathLengthSpecified) |
|
4948 else EAP_IF_RETURN_STRING(certificate_error, ENamesDontChain) |
|
4949 else EAP_IF_RETURN_STRING(certificate_error, ERequiredPolicyNotFound) |
|
4950 else EAP_IF_RETURN_STRING(certificate_error, EBadKeyUsage) |
|
4951 else EAP_IF_RETURN_STRING(certificate_error, ERootCertNotSelfSigned) |
|
4952 else EAP_IF_RETURN_STRING(certificate_error, ECriticalExtendedKeyUsage) |
|
4953 else EAP_IF_RETURN_STRING(certificate_error, ECriticalCertPoliciesWithQualifiers) |
|
4954 else EAP_IF_RETURN_STRING(certificate_error, ECriticalPolicyMapping) |
|
4955 else EAP_IF_RETURN_STRING(certificate_error, ECriticalDeviceId) |
|
4956 else EAP_IF_RETURN_STRING(certificate_error, ECriticalSid) |
|
4957 else EAP_IF_RETURN_STRING(certificate_error, ECriticalVid) |
|
4958 else EAP_IF_RETURN_STRING(certificate_error, ECriticalCapabilities) |
|
4959 #endif // #if defined(USE_EAP_TRACE_STRINGS) |
|
4960 { |
|
4961 EAP_UNREFERENCED_PARAMETER(certificate_error); |
|
4962 return EAPL("Unknown TValidationError"); |
|
4963 } |
|
4964 } |
|
4965 |
|
4966 #endif //#if defined(USE_EAP_DEBUG_TRACE) |
|
4967 |
|
4968 //-------------------------------------------------- |
4798 |
4969 |
4799 void eap_am_type_tls_peap_symbian_c::complete_validate_chain( |
4970 void eap_am_type_tls_peap_symbian_c::complete_validate_chain( |
4800 CPKIXValidationResult& aValidationResult, eap_status_e aStatus) |
4971 CPKIXValidationResult& aValidationResult, |
|
4972 eap_status_e aStatus) |
4801 { |
4973 { |
4802 EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT); |
4974 EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT); |
4803 |
4975 |
|
4976 EAP_TRACE_DEBUG( |
|
4977 m_am_tools, |
|
4978 TRACE_FLAGS_DEFAULT, |
|
4979 (EAPL("eap_am_type_tls_peap_symbian_c::complete_validate_chain(): Certificate chain validation reason=%d=%s, status=%d=%s\n"), |
|
4980 aValidationResult.Error().iReason, |
|
4981 get_certificate_error_string(aValidationResult.Error().iReason), |
|
4982 aStatus, |
|
4983 eap_status_string_c::get_status_string(aStatus))); |
|
4984 |
4804 if(aStatus != eap_status_ok) |
4985 if(aStatus != eap_status_ok) |
4805 { |
4986 { |
4806 get_tls_am_partner()->complete_verify_certificate_chain(aStatus); |
4987 get_tls_am_partner()->complete_verify_certificate_chain(aStatus); |
4807 return; |
4988 return; |
4808 } |
4989 } |
4809 |
4990 |
4810 eap_status_e result; |
4991 eap_status_e result(eap_status_ok); |
|
4992 |
4811 if (aValidationResult.Error().iReason == EValidatedOK) |
4993 if (aValidationResult.Error().iReason == EValidatedOK) |
4812 { |
4994 { |
4813 EAP_TRACE_DEBUG(m_am_tools, TRACE_FLAGS_DEFAULT, |
4995 EAP_TRACE_DEBUG( |
4814 (EAPL("Certificate chain validation OK. Reason: %d\n"), |
4996 m_am_tools, |
4815 aValidationResult.Error().iReason)); |
4997 TRACE_FLAGS_DEFAULT, |
|
4998 (EAPL("Certificate chain validation OK. Reason: %d=%s\n"), |
|
4999 aValidationResult.Error().iReason, |
|
5000 get_certificate_error_string(aValidationResult.Error().iReason))); |
|
5001 |
4816 result = eap_status_ok; |
5002 result = eap_status_ok; |
4817 } |
5003 } |
4818 else |
5004 else |
4819 { |
5005 { |
4820 if (aValidationResult.Error().iReason == EDateOutOfRange) |
5006 if (aValidationResult.Error().iReason == EDateOutOfRange) |
4849 |
5038 |
4850 get_tls_am_partner()->complete_verify_certificate_chain(result); |
5039 get_tls_am_partner()->complete_verify_certificate_chain(result); |
4851 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
5040 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
4852 } |
5041 } |
4853 |
5042 |
|
5043 //-------------------------------------------------- |
|
5044 |
4854 #if defined(USE_FAST_EAP_TYPE) |
5045 #if defined(USE_FAST_EAP_TYPE) |
4855 #if defined(USE_EAP_CONFIGURATION_TO_SKIP_USER_INTERACTIONS) |
5046 #if defined(USE_EAP_CONFIGURATION_TO_SKIP_USER_INTERACTIONS) |
|
5047 |
4856 eap_status_e eap_am_type_tls_peap_symbian_c::ReadFileConfig() |
5048 eap_status_e eap_am_type_tls_peap_symbian_c::ReadFileConfig() |
4857 { |
5049 { |
4858 eap_status_e status = eap_status_ok; |
5050 eap_status_e status = eap_status_ok; |
4859 |
5051 |
4860 eap_am_file_input_symbian_c * const fileio = new eap_am_file_input_symbian_c(m_am_tools); |
5052 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
4861 |
5053 |
4862 eap_automatic_variable_c<eap_am_file_input_symbian_c> automatic_fileio(m_am_tools, fileio); |
5054 status = EapConfigToolsSymbian::EapReadDefaultConfigFileSymbian( |
4863 |
5055 m_am_tools, |
4864 if (fileio != 0 |
5056 &m_fileconfig); |
4865 && fileio->get_is_valid() == true) |
5057 if (status != eap_status_ok) |
4866 { |
5058 { |
4867 EAP_TRACE_DEBUG( |
5059 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
4868 m_am_tools, |
5060 return EAP_STATUS_RETURN(m_am_tools, status); |
4869 TRACE_FLAGS_DEFAULT, |
5061 } |
4870 (EAPL("Initialize file configuration.\n"))); |
5062 |
4871 |
5063 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
4872 eap_variable_data_c file_name_c_data(m_am_tools); |
5064 |
4873 |
5065 |
4874 { |
5066 eap_variable_data_c skip_user_interactions(m_am_tools); |
4875 #if defined(EAPOL_SYMBIAN_VERSION_7_0_s) |
5067 |
4876 eap_const_string const FILECONFIG_FILENAME_C |
5068 if (m_fileconfig != 0 |
4877 = "c:\\system\\data\\eap.conf"; |
5069 && m_fileconfig->get_is_valid() == true) |
4878 #else |
5070 { |
4879 eap_const_string const FILECONFIG_FILENAME_C |
5071 // Here we could try the final configuration option. |
4880 = "c:\\private\\101F8EC5\\eap.conf"; |
5072 status = m_fileconfig->read_configure( |
4881 #endif |
5073 cf_str_EAP_skip_user_interactions_for_testing_purposes.get_field(), |
4882 |
5074 &skip_user_interactions); |
4883 status = file_name_c_data.set_copy_of_buffer( |
5075 } |
4884 FILECONFIG_FILENAME_C, |
5076 |
4885 m_am_tools->strlen(FILECONFIG_FILENAME_C)); |
5077 if (status == eap_status_ok |
4886 if (status != eap_status_ok) |
5078 && skip_user_interactions.get_is_valid_data() == true) |
4887 { |
5079 { |
4888 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
5080 u32_t *skip_user_interactions_flag = reinterpret_cast<u32_t *>( |
4889 return EAP_STATUS_RETURN(m_am_tools, status); |
5081 skip_user_interactions.get_data(sizeof(u32_t))); |
4890 } |
5082 if (skip_user_interactions_flag != 0) |
4891 |
5083 { |
4892 status = file_name_c_data.add_end_null(); |
5084 if (*skip_user_interactions_flag != 0) |
4893 if (status != eap_status_ok) |
5085 { |
4894 { |
5086 m_skip_user_interactions = true; |
4895 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
5087 } |
4896 return EAP_STATUS_RETURN(m_am_tools, status); |
5088 else |
4897 } |
5089 { |
4898 } |
5090 m_skip_user_interactions = false; |
4899 |
5091 } |
4900 eap_variable_data_c file_name_z_data(m_am_tools); |
5092 } |
4901 |
5093 } |
4902 { |
5094 |
4903 #if defined(EAPOL_SYMBIAN_VERSION_7_0_s) |
5095 iPacStoreDb->SkipUserActions(m_skip_user_interactions); |
4904 eap_const_string const FILECONFIG_FILENAME_Z |
5096 |
4905 = "z:\\system\\data\\eap.conf"; |
5097 return status; |
4906 #else |
5098 } |
4907 eap_const_string const FILECONFIG_FILENAME_Z |
5099 |
4908 = "z:\\private\\101F8EC5\\eap.conf"; |
|
4909 #endif |
|
4910 |
|
4911 status = file_name_z_data.set_copy_of_buffer( |
|
4912 FILECONFIG_FILENAME_Z, |
|
4913 m_am_tools->strlen(FILECONFIG_FILENAME_Z)); |
|
4914 if (status != eap_status_ok) |
|
4915 { |
|
4916 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
4917 return EAP_STATUS_RETURN(m_am_tools, status); |
|
4918 } |
|
4919 |
|
4920 status = file_name_z_data.add_end_null(); |
|
4921 if (status != eap_status_ok) |
|
4922 { |
|
4923 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
4924 return EAP_STATUS_RETURN(m_am_tools, status); |
|
4925 } |
|
4926 } |
|
4927 |
|
4928 |
|
4929 |
|
4930 if (status == eap_status_ok) |
|
4931 { |
|
4932 // First try open from C: disk. |
|
4933 status = fileio->file_open( |
|
4934 &file_name_c_data, |
|
4935 eap_file_io_direction_read); |
|
4936 if (status == eap_status_ok) |
|
4937 { |
|
4938 EAP_TRACE_DEBUG( |
|
4939 m_am_tools, |
|
4940 TRACE_FLAGS_DEFAULT, |
|
4941 (EAPL("Opens configure file %s\n"), |
|
4942 file_name_c_data.get_data(file_name_c_data.get_data_length()))); |
|
4943 } |
|
4944 else if (status != eap_status_ok) |
|
4945 { |
|
4946 // Second try open from Z: disk. |
|
4947 status = fileio->file_open( |
|
4948 &file_name_z_data, |
|
4949 eap_file_io_direction_read); |
|
4950 if (status == eap_status_ok) |
|
4951 { |
|
4952 EAP_TRACE_DEBUG( |
|
4953 m_am_tools, |
|
4954 TRACE_FLAGS_DEFAULT, |
|
4955 (EAPL("Opens configure file %s\n"), |
|
4956 file_name_z_data.get_data(file_name_z_data.get_data_length()))); |
|
4957 } |
|
4958 } |
|
4959 |
|
4960 if (status == eap_status_ok) |
|
4961 { |
|
4962 // Some of the files were opened. |
|
4963 |
|
4964 m_fileconfig = new eap_file_config_c(m_am_tools); |
|
4965 if (m_fileconfig != 0 |
|
4966 && m_fileconfig->get_is_valid() == true) |
|
4967 { |
|
4968 status = m_fileconfig->configure(fileio); |
|
4969 if (status != eap_status_ok) |
|
4970 { |
|
4971 EAP_TRACE_DEBUG( |
|
4972 m_am_tools, |
|
4973 TRACE_FLAGS_DEFAULT, |
|
4974 (EAPL("ERROR: Configure read from %s failed.\n"), |
|
4975 file_name_c_data.get_data(file_name_c_data.get_data_length()))); |
|
4976 } |
|
4977 else |
|
4978 { |
|
4979 EAP_TRACE_DEBUG( |
|
4980 m_am_tools, |
|
4981 TRACE_FLAGS_DEFAULT, |
|
4982 (EAPL("Configure read from %s\n"), |
|
4983 file_name_c_data.get_data(file_name_c_data.get_data_length()))); |
|
4984 } |
|
4985 } |
|
4986 else |
|
4987 { |
|
4988 // No file configuration. |
|
4989 delete m_fileconfig; |
|
4990 m_fileconfig = 0; |
|
4991 |
|
4992 EAP_TRACE_DEBUG( |
|
4993 m_am_tools, |
|
4994 TRACE_FLAGS_DEFAULT, |
|
4995 (EAPL("ERROR: Cannot create configure object for file %s\n"), |
|
4996 file_name_c_data.get_data(file_name_c_data.get_data_length()))); |
|
4997 } |
|
4998 } |
|
4999 else |
|
5000 { |
|
5001 EAP_TRACE_DEBUG( |
|
5002 m_am_tools, |
|
5003 TRACE_FLAGS_DEFAULT, |
|
5004 (EAPL("ERROR: Cannot open configure file neither %s nor %s\n"), |
|
5005 file_name_c_data.get_data(file_name_c_data.get_data_length()), |
|
5006 file_name_z_data.get_data(file_name_z_data.get_data_length()))); |
|
5007 } |
|
5008 } |
|
5009 } |
|
5010 else |
|
5011 { |
|
5012 EAP_TRACE_DEBUG( |
|
5013 m_am_tools, |
|
5014 TRACE_FLAGS_DEFAULT, |
|
5015 (EAPL("Skips file configuration.\n"))); |
|
5016 } |
|
5017 |
|
5018 eap_variable_data_c skip_user_interactions(m_am_tools); |
|
5019 |
|
5020 if (m_fileconfig != 0 |
|
5021 && m_fileconfig->get_is_valid() == true) |
|
5022 { |
|
5023 // Here we could try the final configuration option. |
|
5024 status = m_fileconfig->read_configure( |
|
5025 cf_str_EAP_skip_user_interactions_for_testing_purposes.get_field(), |
|
5026 &skip_user_interactions); |
|
5027 } |
|
5028 |
|
5029 if (status == eap_status_ok |
|
5030 && skip_user_interactions.get_is_valid_data() == true) |
|
5031 { |
|
5032 u32_t *skip_user_interactions_flag = reinterpret_cast<u32_t *>( |
|
5033 skip_user_interactions.get_data(sizeof(u32_t))); |
|
5034 if (skip_user_interactions_flag != 0) |
|
5035 { |
|
5036 if (*skip_user_interactions_flag != 0) |
|
5037 { |
|
5038 m_skip_user_interactions = true; |
|
5039 } |
|
5040 else |
|
5041 { |
|
5042 m_skip_user_interactions = false; |
|
5043 } |
|
5044 } |
|
5045 } |
|
5046 |
|
5047 iPacStoreDb->SkipUserActions (m_skip_user_interactions); |
|
5048 |
|
5049 return status; |
|
5050 } |
|
5051 #endif //#if defined(USE_EAP_CONFIGURATION_TO_SKIP_USER_INTERACTIONS) |
5100 #endif //#if defined(USE_EAP_CONFIGURATION_TO_SKIP_USER_INTERACTIONS) |
5052 #endif |
5101 #endif |
5053 |
5102 |
5054 |
5103 |
5055 //-------------------------------------------------- |
5104 //-------------------------------------------------- |
5136 TRACE_FLAGS_DEFAULT, |
5189 TRACE_FLAGS_DEFAULT, |
5137 (EAPL("eap_am_type_tls_peap_symbian_c::complete_get_matching_certificates(): EHandlingIdentityQuery\n"))); |
5190 (EAPL("eap_am_type_tls_peap_symbian_c::complete_get_matching_certificates(): EHandlingIdentityQuery\n"))); |
5138 |
5191 |
5139 // Add found certs to allowed certificate list. |
5192 // Add found certs to allowed certificate list. |
5140 // This list is updated here because there might be certificates that have been removed. |
5193 // This list is updated here because there might be certificates that have been removed. |
5141 m_allowed_user_certs.Reset(); |
5194 m_allowed_user_certs.ResetAndDestroy(); |
5142 for (TInt i = 0; i < aMatchingCerts.Count(); i++) |
5195 |
5143 { |
5196 for (TInt i = 0; i < aMatchingCerts.Count() && aMatchingCerts[i] != 0; i++) |
5144 TRAPD(err, m_allowed_user_certs.AppendL(aMatchingCerts[i])); |
5197 { |
5145 if (err != KErrNone) |
5198 EapCertificateEntry * const entry = aMatchingCerts[i]->Copy(); |
|
5199 if (entry == 0) |
5146 { |
5200 { |
5147 EAP_TRACE_DEBUG( |
5201 EAP_TRACE_DEBUG( |
5148 m_am_tools, |
5202 m_am_tools, |
5149 TRACE_FLAGS_DEFAULT, |
5203 TRACE_FLAGS_DEFAULT, |
5150 (EAPL("ERROR: eap_am_type_tls_peap_symbian_c::complete_get_matching_certificates -EHandlingIdentityQuery- Error=%d\n"), |
5204 (EAPL("ERROR: EAP-TLS: No memory.\n"))); |
5151 err)); |
5205 |
|
5206 get_am_partner()->complete_eap_identity_query( |
|
5207 0, // 0 because identity query failed |
|
5208 &m_receive_network_id, |
|
5209 m_eap_identifier, |
|
5210 eap_status_allocation_error, |
|
5211 false, |
|
5212 0, |
|
5213 false, |
|
5214 0); |
|
5215 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
5216 return; |
|
5217 } |
|
5218 |
|
5219 TInt error = m_allowed_user_certs.Append(entry->Copy()); |
|
5220 if (error != KErrNone) |
|
5221 { |
|
5222 EAP_TRACE_DEBUG( |
|
5223 m_am_tools, |
|
5224 TRACE_FLAGS_DEFAULT, |
|
5225 (EAPL("ERROR: eap_am_type_tls_peap_symbian_c::complete_get_matching_certificates(): -EHandlingIdentityQuery- Error=%d\n"), |
|
5226 error)); |
5152 |
5227 |
5153 get_am_partner()->complete_eap_identity_query( |
5228 get_am_partner()->complete_eap_identity_query( |
5154 0, // 0 because identity query failed |
5229 0, // 0 because identity query failed |
5155 &m_receive_network_id, |
5230 &m_receive_network_id, |
5156 m_eap_identifier, |
5231 m_eap_identifier, |
5198 // Since there is no user certificate or manual realm configured |
5273 // Since there is no user certificate or manual realm configured |
5199 // the realm needs to be dig out from the CA certificate. |
5274 // the realm needs to be dig out from the CA certificate. |
5200 EAP_TRACE_DEBUG( |
5275 EAP_TRACE_DEBUG( |
5201 m_am_tools, |
5276 m_am_tools, |
5202 TRACE_FLAGS_DEFAULT, |
5277 TRACE_FLAGS_DEFAULT, |
5203 (EAPL("eap_am_type_tls_peap_symbian_c: no manual realm - no user cert. Get realm from CA certificate.\n"))); |
5278 (EAPL("eap_am_type_tls_peap_symbian_c::complete_get_matching_certificates(): no manual realm - no user cert. Get realm from CA certificate.\n"))); |
5204 |
5279 |
5205 TInt allowed_ca_cert_count = m_allowed_ca_certs.Count(); |
5280 TInt allowed_ca_cert_count = m_allowed_ca_certs.Count(); |
5206 TInt err(KErrNone); |
5281 TInt err(KErrNone); |
5207 |
5282 |
5208 if(allowed_ca_cert_count > 0) |
5283 if(allowed_ca_cert_count > 0) |
5209 { |
5284 { |
5210 TRAP(err, m_cert_if->ReadCACertificateL(m_allowed_ca_certs[0])); |
5285 TRAP(err, m_cert_if->ReadCACertificateL(*m_allowed_ca_certs[0])); |
5211 } |
5286 } |
5212 if (err != KErrNone || allowed_ca_cert_count <= 0) |
5287 |
|
5288 if (err != KErrNone |
|
5289 || allowed_ca_cert_count <= 0) |
5213 { |
5290 { |
5214 EAP_TRACE_DEBUG( |
5291 if (m_use_automatic_ca_certificate == false) |
5215 m_am_tools, |
5292 { |
5216 TRACE_FLAGS_DEFAULT, |
5293 EAP_TRACE_DEBUG( |
5217 (EAPL("ERROR: EAP-TLS: Cannot read user certificate or No CA cert configured, CA cert count=%d.\n"), |
5294 m_am_tools, |
5218 allowed_ca_cert_count)); |
5295 TRACE_FLAGS_DEFAULT, |
5219 |
5296 (EAPL("ERROR: EAP-TLS: eap_am_type_tls_peap_symbian_c::complete_get_matching_certificates(): Cannot read user certificate and no CA cert configured, CA cert count=%d.\n"), |
5220 get_am_partner()->complete_eap_identity_query( |
5297 allowed_ca_cert_count)); |
5221 0, // 0 because identity query failed |
5298 |
5222 &m_receive_network_id, |
5299 get_am_partner()->complete_eap_identity_query( |
5223 m_eap_identifier, |
5300 0, // 0 because identity query failed |
5224 eap_status_illegal_certificate, |
5301 &m_receive_network_id, |
5225 false, |
5302 m_eap_identifier, |
5226 0, |
5303 eap_status_illegal_certificate, |
5227 false, |
5304 false, |
5228 0); |
5305 0, |
5229 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
5306 false, |
5230 return; |
5307 0); |
|
5308 |
|
5309 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
5310 return; |
|
5311 } |
|
5312 else |
|
5313 { |
|
5314 EAP_TRACE_DEBUG( |
|
5315 m_am_tools, |
|
5316 TRACE_FLAGS_DEFAULT, |
|
5317 (EAPL("WARNING: EAP-TLS: eap_am_type_tls_peap_symbian_c::complete_get_matching_certificates(): Cannot read user certificate and automatic CA cert configured, CA cert count=%d.\n"), |
|
5318 m_allowed_ca_certs.Count())); |
|
5319 |
|
5320 get_am_partner()->complete_eap_identity_query( |
|
5321 0, // 0 because certificate query failed |
|
5322 &m_receive_network_id, |
|
5323 m_eap_identifier, |
|
5324 eap_status_ok, |
|
5325 false, |
|
5326 0, |
|
5327 false, |
|
5328 0); |
|
5329 } |
5231 } |
5330 } |
|
5331 |
5232 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
5332 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
5233 return; |
5333 return; |
5234 } |
5334 } |
5235 else |
5335 else |
5236 { |
5336 { |
5263 else if (m_state == EHandlingChainQuery) |
5363 else if (m_state == EHandlingChainQuery) |
5264 { |
5364 { |
5265 |
5365 |
5266 if (aMatchingCerts.Count() > 0) |
5366 if (aMatchingCerts.Count() > 0) |
5267 { |
5367 { |
5268 m_allowed_user_certs.Reset(); |
5368 TInt error; |
5269 |
5369 |
5270 for (TInt i = 0; i < aMatchingCerts.Count(); i++) |
5370 m_allowed_user_certs.ResetAndDestroy(); |
|
5371 |
|
5372 for (TInt i = 0; i < aMatchingCerts.Count(); i++) |
|
5373 { |
|
5374 EapCertificateEntry * const entry = aMatchingCerts[i]->Copy(); |
|
5375 if (entry != 0) |
5271 { |
5376 { |
5272 TRAPD(err, m_allowed_user_certs.AppendL(aMatchingCerts[i])); |
5377 TRAP(error, m_allowed_user_certs.AppendL(entry)); |
5273 if (err != KErrNone) |
5378 } |
5274 { |
5379 else |
5275 EAP_TRACE_DEBUG(m_am_tools, TRACE_FLAGS_DEFAULT, (EAPL("eap_am_type_tls_peap_symbian_c::complete_get_matching_certificates -EHandlingChainQuery- Error=%d\n"), |
5380 { |
5276 err)); |
5381 error = KErrNoMemory; |
5277 |
5382 } |
5278 get_tls_am_partner()->complete_query_certificate_chain(0, eap_status_allocation_error); |
5383 |
5279 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
5384 if (error != KErrNone) |
5280 return; |
5385 { |
5281 } |
5386 EAP_TRACE_DEBUG(m_am_tools, TRACE_FLAGS_DEFAULT, (EAPL("ERROR: eap_am_type_tls_peap_symbian_c::complete_get_matching_certificates -EHandlingChainQuery- Error=%d\n"), |
|
5387 error)); |
|
5388 |
|
5389 get_tls_am_partner()->complete_query_certificate_chain(0, eap_status_allocation_error); |
|
5390 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
5391 return; |
|
5392 } |
5282 } |
5393 } |
5283 } |
5394 } |
5284 |
5395 |
5285 if (m_allowed_user_certs.Count() == 0) |
5396 if (m_allowed_user_certs.Count() == 0) |
5286 { |
5397 { |
5287 // No matching or allowed certs and no pre-loaded cert. |
5398 // No matching or allowed certs and no pre-loaded cert. |
5288 // Could not find matching certificate |
5399 // Could not find matching certificate |
5289 |
5400 |
5290 EAP_TRACE_DEBUG(m_am_tools, TRACE_FLAGS_DEFAULT, (EAPL("EAP-TLS: Could not find proper user certificate.\n"))); |
5401 EAP_TRACE_DEBUG( |
|
5402 m_am_tools, |
|
5403 TRACE_FLAGS_DEFAULT, |
|
5404 (EAPL("EAP-TLS: Could not find proper user certificate.\n"))); |
5291 |
5405 |
5292 if (m_tls_peap_server_authenticates_client_policy_flag == true) |
5406 if (m_tls_peap_server_authenticates_client_policy_flag == true) |
5293 { |
5407 { |
|
5408 EAP_TRACE_DEBUG( |
|
5409 m_am_tools, |
|
5410 TRACE_FLAGS_DEFAULT, |
|
5411 (EAPL("ERROR: EAP-TLS: Could not find proper user certificate and anonymous cliet is not allowed.\n"))); |
|
5412 |
5294 send_error_notification(eap_status_user_certificate_unknown); |
5413 send_error_notification(eap_status_user_certificate_unknown); |
5295 } |
5414 } |
5296 |
5415 |
5297 get_tls_am_partner()->complete_query_certificate_chain(0, eap_status_illegal_certificate); |
5416 get_tls_am_partner()->complete_query_certificate_chain(0, eap_status_illegal_certificate); |
5298 |
5417 |
6142 { |
6270 { |
6143 EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT); |
6271 EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT); |
6144 |
6272 |
6145 eap_status_e status(eap_status_illegal_eap_type); |
6273 eap_status_e status(eap_status_illegal_eap_type); |
6146 |
6274 |
6147 #ifdef USE_EAP_EXPANDED_TYPES |
|
6148 |
|
6149 EAP_TRACE_DEBUG(m_am_tools, |
6275 EAP_TRACE_DEBUG(m_am_tools, |
6150 TRACE_FLAGS_DEFAULT, |
6276 TRACE_FLAGS_DEFAULT, |
6151 (EAPL("eap_am_type_tls_peap_symbian_c::check_is_valid_eap_type:Given EAP vendor ID=%x, type=%x\n"), |
6277 (EAPL("eap_am_type_tls_peap_symbian_c::check_is_valid_eap_type:Given EAP-type=0xfe%06x%08x\n"), |
6152 eap_type.get_vendor_id(), eap_type.get_vendor_type())); |
6278 eap_type.get_vendor_id(), |
|
6279 eap_type.get_vendor_type())); |
6153 |
6280 |
6154 for (TInt i = 0; i < m_enabled_tunneling_exp_eap_array.Count(); i++) |
6281 for (TInt i = 0; i < m_enabled_tunneling_exp_eap_array.Count(); i++) |
6155 { |
6282 { |
6156 eap_expanded_type_c expEAPTmp; |
6283 eap_expanded_type_c expEAPTmp; |
6157 |
6284 |
6158 // This will read the expanded EAP from enabledEAPTypes[i]->iExpandedEAPType to expEAPTmp. |
6285 TInt error = CEapConversion::ConvertExpandedEAPTypeToInternalType( |
6159 // This makes easy to get the vendor type. |
6286 m_enabled_tunneling_exp_eap_array[i], |
6160 eap_expanded_type_c::read_type( m_am_tools, |
6287 &expEAPTmp); |
6161 0, |
6288 |
6162 m_enabled_tunneling_exp_eap_array[i]->iExpandedEAPType.Ptr(), |
6289 if (error != KErrNone) |
6163 KExpandedEAPTypeSize, |
6290 { |
6164 &expEAPTmp); |
6291 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
6165 |
6292 return EAP_STATUS_RETURN(m_am_tools, m_am_tools->convert_am_error_to_eapol_error(error)); |
|
6293 } |
|
6294 |
6166 EAP_TRACE_DATA_DEBUG( |
6295 EAP_TRACE_DATA_DEBUG( |
6167 m_am_tools, |
6296 m_am_tools, |
6168 TRACE_FLAGS_DEFAULT, |
6297 TRACE_FLAGS_DEFAULT, |
6169 (EAPL("check_is_valid_eap_type:Checking with EAP type:"), |
6298 (EAPL("check_is_valid_eap_type:Checking with EAP type:"), |
6170 m_enabled_tunneling_exp_eap_array[i]->iExpandedEAPType.Ptr(), |
6299 m_enabled_tunneling_exp_eap_array[i]->GetValue().Ptr(), |
6171 m_enabled_tunneling_exp_eap_array[i]->iExpandedEAPType.Size())); |
6300 m_enabled_tunneling_exp_eap_array[i]->GetValue().Size())); |
6172 |
6301 |
6173 if (eap_type == expEAPTmp) |
6302 if (eap_type == expEAPTmp) |
6174 { |
6303 { |
6175 // This EAp type is one among the enabled ones. Hence a valid EAP type. |
6304 // This EAp type is one among the enabled ones. Hence a valid EAP type. |
6176 status = eap_status_ok; |
6305 status = eap_status_ok; |
6177 break; |
6306 break; |
6178 } |
6307 } |
6179 } |
6308 } |
6180 |
6309 |
6181 #else // For normal EAP types. |
|
6182 |
|
6183 TEap *eapType = 0; |
|
6184 |
|
6185 TInt i(0); |
|
6186 |
|
6187 for (i = 0; i < m_iap_eap_array.Count(); i++) |
|
6188 { |
|
6189 // Try next EAP type |
|
6190 eapType = m_iap_eap_array[i]; |
|
6191 if (eapType->Enabled == 1) |
|
6192 { |
|
6193 // Convert the string to integer |
|
6194 TLex8 tmp(eapType->UID); |
|
6195 TInt val(0); |
|
6196 tmp.Val(val); |
|
6197 if (val == eap_type) |
|
6198 { |
|
6199 // Allowed |
|
6200 status = eap_status_ok; |
|
6201 break; |
|
6202 } |
|
6203 } |
|
6204 } |
|
6205 |
|
6206 #endif //#ifdef USE_EAP_EXPANDED_TYPES |
|
6207 |
|
6208 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
6310 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
6209 |
|
6210 return EAP_STATUS_RETURN(m_am_tools, status); |
6311 return EAP_STATUS_RETURN(m_am_tools, status); |
6211 } |
6312 } |
6212 |
6313 |
6213 //-------------------------------------------------- |
6314 //-------------------------------------------------- |
6214 |
6315 |
6221 TRACE_FLAGS_DEFAULT, |
6322 TRACE_FLAGS_DEFAULT, |
6222 (EAPL("eap_am_type_tls_peap_symbian_c::get_eap_type_list - Start\n"))); |
6323 (EAPL("eap_am_type_tls_peap_symbian_c::get_eap_type_list - Start\n"))); |
6223 |
6324 |
6224 eap_status_e status(eap_status_illegal_eap_type); |
6325 eap_status_e status(eap_status_illegal_eap_type); |
6225 |
6326 |
6226 #ifdef USE_EAP_EXPANDED_TYPES |
|
6227 |
|
6228 // We need to return only the EAP types available as enabled types. |
6327 // We need to return only the EAP types available as enabled types. |
6229 // It means only the ones available in m_enabled_tunneling_exp_eap_array. |
6328 // It means only the ones available in m_enabled_tunneling_exp_eap_array. |
6230 |
6329 |
6231 for (TInt i = 0; i < m_enabled_tunneling_exp_eap_array.Count(); i++) |
6330 for (TInt i = 0; i < m_enabled_tunneling_exp_eap_array.Count(); i++) |
6232 { |
6331 { |
6233 TBuf8<KExpandedEAPTypeSize> tmpExpEAP(m_enabled_tunneling_exp_eap_array[i]->iExpandedEAPType); |
|
6234 |
|
6235 EAP_TRACE_DEBUG( |
6332 EAP_TRACE_DEBUG( |
6236 m_am_tools, |
6333 m_am_tools, |
6237 TRACE_FLAGS_DEFAULT, |
6334 TRACE_FLAGS_DEFAULT, |
6238 (EAPL("eap_am_type_tls_peap_symbian_c::get_eap_type_list:Enabled expanded EAP type at index=%d\n"), |
6335 (EAPL("eap_am_type_tls_peap_symbian_c::get_eap_type_list:Enabled expanded EAP type at index=%d\n"), |
6239 i)); |
6336 i)); |
6240 |
6337 |
6241 EAP_TRACE_DATA_DEBUG( |
6338 EAP_TRACE_DATA_DEBUG( |
6242 m_am_tools, |
6339 m_am_tools, |
6243 TRACE_FLAGS_DEFAULT, |
6340 TRACE_FLAGS_DEFAULT, |
6244 (EAPL("Enabled expanded EAP type:"), |
6341 (EAPL("Enabled expanded EAP type:"), |
6245 tmpExpEAP.Ptr(), |
6342 m_enabled_tunneling_exp_eap_array[i]->GetValue().Ptr(), |
6246 tmpExpEAP.Size())); |
6343 m_enabled_tunneling_exp_eap_array[i]->GetValue().Size())); |
6247 |
6344 |
6248 // This is for one expanded EAP type (for the above one). |
6345 // This is for one expanded EAP type (for the above one). |
6249 eap_type_value_e * expandedEAPType = new eap_type_value_e(); |
6346 eap_type_value_e * expandedEAPType = new eap_type_value_e(); |
6250 |
6347 |
6251 // Read the expanded EAP type details from an item in m_enabled_tunneling_exp_eap_array. |
6348 eap_automatic_variable_c<eap_type_value_e> automatic_expandedEAPType( |
6252 status = eap_type_value_e::read_type(m_am_tools, |
6349 m_am_tools, |
6253 0, |
6350 expandedEAPType); |
6254 &tmpExpEAP, |
6351 |
6255 tmpExpEAP.Length(), |
6352 TInt error = CEapConversion::ConvertExpandedEAPTypeToInternalType( |
6256 expandedEAPType); |
6353 m_enabled_tunneling_exp_eap_array[i], |
6257 if (status != eap_status_ok) |
6354 expandedEAPType); |
6258 { |
6355 |
6259 delete expandedEAPType; |
6356 if (error != KErrNone) |
6260 expandedEAPType = 0; |
6357 { |
6261 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
6358 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
6262 return EAP_STATUS_RETURN(m_am_tools, status); |
6359 return EAP_STATUS_RETURN(m_am_tools, m_am_tools->convert_am_error_to_eapol_error(error)); |
6263 } |
6360 } |
|
6361 |
|
6362 automatic_expandedEAPType.do_not_free_variable(); |
6264 |
6363 |
6265 // Add EAP-type to list. |
6364 // Add EAP-type to list. |
6266 status = eap_type_list->add_object(expandedEAPType, true); |
6365 status = eap_type_list->add_object(expandedEAPType, true); |
6267 if (status != eap_status_ok) |
6366 if (status != eap_status_ok) |
6268 { |
6367 { |
6274 EAP_UNREFERENCED_PARAMETER(eap_string); |
6373 EAP_UNREFERENCED_PARAMETER(eap_string); |
6275 |
6374 |
6276 EAP_TRACE_DEBUG( |
6375 EAP_TRACE_DEBUG( |
6277 m_am_tools, |
6376 m_am_tools, |
6278 TRACE_FLAGS_DEFAULT, |
6377 TRACE_FLAGS_DEFAULT, |
6279 (EAPL("get_eap_type_list():added EAP-type=0x%08x=%s\n"), |
6378 (EAPL("get_eap_type_list():added EAP-type=0xfe%06x%08x=%s\n"), |
|
6379 expandedEAPType->get_vendor_id(), |
6280 expandedEAPType->get_vendor_type(), |
6380 expandedEAPType->get_vendor_type(), |
6281 eap_string.get_eap_type_string(*expandedEAPType))); |
6381 eap_header_string_c::get_eap_type_string(*expandedEAPType))); |
6282 |
6382 |
6283 }// for() |
6383 }// for() |
6284 |
|
6285 #else // for normal EAP types. |
|
6286 |
|
6287 TEap *eapType = 0; |
|
6288 |
|
6289 status = eap_type_list->reset(); |
|
6290 if (status != eap_status_ok) |
|
6291 { |
|
6292 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
6293 return EAP_STATUS_RETURN(m_am_tools, status); |
|
6294 } |
|
6295 |
|
6296 |
|
6297 for (TInt i = 0; i < m_iap_eap_array.Count(); i++) |
|
6298 { |
|
6299 // Check if type is enabled |
|
6300 eapType = m_iap_eap_array[i]; |
|
6301 if (eapType->Enabled == 1) |
|
6302 { |
|
6303 TLex8 tmp(eapType->UID); |
|
6304 TInt val(0); |
|
6305 tmp.Val(val); |
|
6306 |
|
6307 eap_type_value_e * const eap_type = new eap_type_value_e(static_cast<eap_type_ietf_values_e>(val)); |
|
6308 if (eap_type == 0) |
|
6309 { |
|
6310 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
6311 return EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error); |
|
6312 } |
|
6313 |
|
6314 status = eap_type_list->add_object(eap_type, true); |
|
6315 if (status != eap_status_ok) |
|
6316 { |
|
6317 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
6318 return EAP_STATUS_RETURN(m_am_tools, status); |
|
6319 } |
|
6320 } |
|
6321 } // for() |
|
6322 |
|
6323 #endif // #ifdef USE_EAP_EXPANDED_TYPES |
|
6324 |
6384 |
6325 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
6385 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
6326 return eap_status_ok; |
6386 return eap_status_ok; |
6327 } |
6387 } |
|
6388 |
|
6389 //-------------------------------------------------- |
6328 |
6390 |
6329 eap_status_e eap_am_type_tls_peap_symbian_c::unload_module(const eap_type_value_e /*type*/) |
6391 eap_status_e eap_am_type_tls_peap_symbian_c::unload_module(const eap_type_value_e /*type*/) |
6330 { |
6392 { |
6331 EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT); |
6393 EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT); |
6332 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
6394 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
6333 return EAP_STATUS_RETURN(m_am_tools, eap_status_not_supported); |
6395 return EAP_STATUS_RETURN(m_am_tools, eap_status_not_supported); |
6334 } |
6396 } |
6335 |
6397 |
|
6398 //-------------------------------------------------- |
6336 |
6399 |
6337 void eap_am_type_tls_peap_symbian_c::send_error_notification(const eap_status_e error) |
6400 void eap_am_type_tls_peap_symbian_c::send_error_notification(const eap_status_e error) |
6338 { |
6401 { |
6339 EAP_TRACE_DEBUG(m_am_tools, |
6402 EAP_TRACE_DEBUG(m_am_tools, |
6340 TRACE_FLAGS_DEFAULT, |
6403 TRACE_FLAGS_DEFAULT, |
6626 { |
6696 { |
6627 EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT); |
6697 EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT); |
6628 |
6698 |
6629 EAP_TRACE_DEBUG(m_am_tools, |
6699 EAP_TRACE_DEBUG(m_am_tools, |
6630 TRACE_FLAGS_DEFAULT, ( |
6700 TRACE_FLAGS_DEFAULT, ( |
6631 EAPL("eap_am_type_tls_peap_symbian_c::is_session_valid - m_current_eap_vendor_type=%d \n"), |
6701 EAPL("eap_am_type_tls_peap_symbian_c::is_session_valid - m_current_eap_vendor_type=0xfe%06x%08x\n"), |
6632 m_current_eap_vendor_type)); |
6702 m_current_eap_type.get_vendor_id(), |
|
6703 m_current_eap_type.get_vendor_type())); |
6633 |
6704 |
6634 TPtrC maxSessionTimeString; |
6705 TPtrC maxSessionTimeString; |
6635 TPtrC lastFullAuthTimeString; |
6706 TPtrC lastFullAuthTimeString; |
6636 |
6707 |
6637 switch (m_current_eap_vendor_type) |
6708 if (m_current_eap_type == eap_type_tls) |
6638 { |
6709 { |
6639 case eap_type_tls: |
6710 maxSessionTimeString.Set(cf_str_EAP_TLS_max_session_validity_time_literal); |
6640 { |
6711 lastFullAuthTimeString.Set(KTLSLastFullAuthTime); |
6641 maxSessionTimeString.Set(cf_str_EAP_TLS_max_session_validity_time_literal); |
6712 } |
6642 lastFullAuthTimeString.Set(KTLSLastFullAuthTime); |
6713 else if (m_current_eap_type == eap_type_peap) |
6643 } |
6714 { |
6644 break; |
6715 maxSessionTimeString.Set(cf_str_EAP_PEAP_max_session_validity_time_literal); |
6645 |
6716 lastFullAuthTimeString.Set(KPEAPLastFullAuthTime); |
6646 case eap_type_peap: |
6717 } |
6647 { |
6718 else if (m_current_eap_type == eap_type_ttls) |
6648 maxSessionTimeString.Set(cf_str_EAP_PEAP_max_session_validity_time_literal); |
6719 { |
6649 lastFullAuthTimeString.Set(KPEAPLastFullAuthTime); |
6720 maxSessionTimeString.Set(cf_str_EAP_TTLS_max_session_validity_time_literal); |
6650 } |
6721 lastFullAuthTimeString.Set(KTTLSLastFullAuthTime); |
6651 break; |
6722 } |
6652 |
|
6653 case eap_type_ttls: |
|
6654 { |
|
6655 maxSessionTimeString.Set(cf_str_EAP_TTLS_max_session_validity_time_literal); |
|
6656 lastFullAuthTimeString.Set(KTTLSLastFullAuthTime); |
|
6657 } |
|
6658 break; |
|
6659 |
|
6660 #if defined(USE_FAST_EAP_TYPE) |
6723 #if defined(USE_FAST_EAP_TYPE) |
6661 case eap_type_fast: |
6724 else if (m_current_eap_type == eap_type_fast) |
6662 { |
6725 { |
6663 maxSessionTimeString.Set(cf_str_EAP_FAST_max_session_validity_time_literal); |
6726 maxSessionTimeString.Set(cf_str_EAP_FAST_max_session_validity_time_literal); |
6664 lastFullAuthTimeString.Set(KFASTLastFullAuthTime); |
6727 lastFullAuthTimeString.Set(KFASTLastFullAuthTime); |
6665 } |
6728 } |
6666 break; |
|
6667 #endif |
6729 #endif |
6668 |
6730 else if (m_current_eap_type == eap_type_ttls_plain_pap) |
6669 case eap_type_ttls_plain_pap: |
6731 { |
6670 { |
6732 // we should not come here, ttls pap has its own |
6671 // we should not come here, ttls pap has its own |
6733 // method for checking session validity |
6672 // method for checking session validity |
6734 EAP_TRACE_ERROR( m_am_tools, TRACE_FLAGS_DEFAULT, ( |
6673 EAP_TRACE_ERROR( m_am_tools, TRACE_FLAGS_DEFAULT, ( |
6735 EAPL( "ERROR: wrong eap type.\n" ) ) ); |
6674 EAPL( "ERROR: wrong eap type.\n" ) ) ); |
6736 return false; |
6675 return false; |
6737 } |
6676 } |
6738 else |
6677 |
6739 { |
6678 default: |
6740 // Should never happen |
6679 { |
6741 EAP_TRACE_ERROR(m_am_tools, |
6680 // Should never happen |
6742 TRACE_FLAGS_DEFAULT, ( |
6681 EAP_TRACE_ERROR(m_am_tools, |
6743 EAPL("Unsupported EAP type, m_current_eap_vendor_type=0xfe%06x%08x\n"), |
6682 TRACE_FLAGS_DEFAULT, ( |
6744 m_current_eap_type.get_vendor_id(), |
6683 EAPL("Unsupported EAP type, m_current_eap_vendor_type=%d \n"), |
6745 m_current_eap_type.get_vendor_type())); |
6684 m_current_eap_vendor_type)); |
6746 |
6685 |
6747 return false; // Treat this as Session invalid. |
6686 return false; // Treat this as Session invalid. |
6748 } |
6687 } |
|
6688 } |
|
6689 |
6749 |
6690 HBufC* buf = HBufC::NewLC(KMaxSqlQueryLength); |
6750 HBufC* buf = HBufC::NewLC(KMaxSqlQueryLength); |
6691 TPtr sqlStatement = buf->Des(); |
6751 TPtr sqlStatement = buf->Des(); |
6692 |
6752 |
6693 // Query all the relevant parameters |
6753 // Query all the relevant parameters |
6694 _LIT(KSQLQuery, "SELECT %S, %S FROM %S WHERE %S=%d AND %S=%d AND %S=%d"); |
6754 _LIT(KSQLQuery, "SELECT %S, %S FROM %S WHERE %S=%d AND %S=%d AND %S=%d AND %S=%d"); |
6695 sqlStatement.Format(KSQLQuery, &maxSessionTimeString, &lastFullAuthTimeString, &m_db_table_name, |
6755 |
6696 &KServiceType, m_index_type, |
6756 sqlStatement.Format( |
6697 &KServiceIndex, m_index, &KTunnelingType, m_tunneling_vendor_type); |
6757 KSQLQuery, |
|
6758 &maxSessionTimeString, |
|
6759 &lastFullAuthTimeString, |
|
6760 &m_db_table_name, |
|
6761 &KServiceType, |
|
6762 m_index_type, |
|
6763 &KServiceIndex, |
|
6764 m_index, |
|
6765 &KTunnelingTypeVendorId, |
|
6766 m_tunneling_type.get_vendor_id(), |
|
6767 &KTunnelingType, |
|
6768 m_tunneling_type.get_vendor_type()); |
6698 |
6769 |
6699 RDbView view; |
6770 RDbView view; |
6700 // Evaluate view |
6771 // Evaluate view |
6701 User::LeaveIfError(view.Prepare(m_database, TDbQuery(sqlStatement))); |
6772 User::LeaveIfError(view.Prepare(m_database, TDbQuery(sqlStatement))); |
6702 CleanupClosePushL(view); |
6773 CleanupClosePushL(view); |
6804 { |
6875 { |
6805 EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT); |
6876 EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT); |
6806 |
6877 |
6807 EAP_TRACE_DEBUG(m_am_tools, |
6878 EAP_TRACE_DEBUG(m_am_tools, |
6808 TRACE_FLAGS_DEFAULT, |
6879 TRACE_FLAGS_DEFAULT, |
6809 (EAPL("eap_am_type_tls_peap_symbian_c::store_authentication_timeL, index type=%d, index=%d, tunneling type=%d, current eap type=%d\n"), |
6880 (EAPL("eap_am_type_tls_peap_symbian_c::store_authentication_timeL, index type=%d, index=%d, tunneling type=0xfe%06x%08x, current eap type=0xfe%06x%08x\n"), |
6810 m_index_type, m_index, m_tunneling_vendor_type, m_current_eap_vendor_type)); |
6881 m_index_type, |
|
6882 m_index, |
|
6883 m_tunneling_type.get_vendor_id(), |
|
6884 m_tunneling_type.get_vendor_type(), |
|
6885 m_current_eap_type.get_vendor_id(), |
|
6886 m_current_eap_type.get_vendor_type())); |
6811 |
6887 |
6812 TPtrC lastFullAuthTimeString; |
6888 TPtrC lastFullAuthTimeString; |
6813 |
6889 |
6814 switch (m_current_eap_vendor_type) |
6890 if (m_current_eap_type == eap_type_tls) |
6815 { |
6891 { |
6816 case eap_type_tls: |
6892 lastFullAuthTimeString.Set(KTLSLastFullAuthTime); |
6817 { |
6893 } |
6818 lastFullAuthTimeString.Set(KTLSLastFullAuthTime); |
6894 else if (m_current_eap_type == eap_type_peap) |
6819 } |
6895 { |
6820 break; |
6896 lastFullAuthTimeString.Set(KPEAPLastFullAuthTime); |
6821 |
6897 } |
6822 case eap_type_peap: |
6898 else if (m_current_eap_type == eap_type_ttls) |
6823 { |
6899 { |
6824 lastFullAuthTimeString.Set(KPEAPLastFullAuthTime); |
6900 lastFullAuthTimeString.Set(KTTLSLastFullAuthTime); |
6825 } |
6901 } |
6826 break; |
6902 else if (m_current_eap_type == eap_type_ttls_plain_pap) |
6827 |
6903 { |
6828 case eap_type_ttls: |
|
6829 { |
|
6830 lastFullAuthTimeString.Set(KTTLSLastFullAuthTime); |
|
6831 } |
|
6832 break; |
|
6833 |
|
6834 case eap_type_ttls_plain_pap: |
|
6835 { |
|
6836 lastFullAuthTimeString.Set( KTTLSPAPLastFullAuthTime ); |
6904 lastFullAuthTimeString.Set( KTTLSPAPLastFullAuthTime ); |
6837 } |
6905 } |
6838 break; |
|
6839 |
|
6840 #if defined(USE_FAST_EAP_TYPE) |
6906 #if defined(USE_FAST_EAP_TYPE) |
6841 case eap_type_fast: |
6907 else if (m_current_eap_type == eap_type_fast) |
6842 { |
6908 { |
6843 lastFullAuthTimeString.Set(KFASTLastFullAuthTime); |
6909 lastFullAuthTimeString.Set(KFASTLastFullAuthTime); |
6844 } |
6910 } |
6845 break; |
|
6846 #endif |
6911 #endif |
6847 |
6912 else |
6848 default: |
6913 { |
6849 { |
6914 // Should never happen |
6850 // Should never happen |
6915 EAP_TRACE_ERROR(m_am_tools, |
6851 EAP_TRACE_ERROR(m_am_tools, |
6916 TRACE_FLAGS_DEFAULT, ( |
6852 TRACE_FLAGS_DEFAULT, ( |
6917 EAPL("Unsupported EAP type, m_current_eap_vendor_type=0xfe%06x%08x\n"), |
6853 EAPL("Unsupported EAP type, m_current_eap_vendor_type=%d \n"), |
6918 m_current_eap_type.get_vendor_id(), |
6854 m_current_eap_vendor_type)); |
6919 m_current_eap_type.get_vendor_type())); |
6855 |
6920 |
6856 User::Leave(KErrNotSupported); |
6921 User::Leave(KErrNotSupported); |
6857 } |
6922 } |
6858 } |
|
6859 |
6923 |
6860 HBufC* buf = HBufC::NewLC(KMaxSqlQueryLength); |
6924 HBufC* buf = HBufC::NewLC(KMaxSqlQueryLength); |
6861 TPtr sqlStatement = buf->Des(); |
6925 TPtr sqlStatement = buf->Des(); |
6862 |
6926 |
6863 // Query all the relevant parameters |
6927 // Query all the relevant parameters |
6864 _LIT(KSQLQuery, "SELECT %S FROM %S WHERE %S=%d AND %S=%d AND %S=%d"); |
6928 _LIT(KSQLQuery, "SELECT %S FROM %S WHERE %S=%d AND %S=%d AND %S=%d AND %S=%d"); |
6865 sqlStatement.Format(KSQLQuery, &lastFullAuthTimeString, &m_db_table_name, |
6929 |
6866 &KServiceType, m_index_type, |
6930 sqlStatement.Format( |
6867 &KServiceIndex, m_index, &KTunnelingType, m_tunneling_vendor_type); |
6931 KSQLQuery, |
|
6932 &lastFullAuthTimeString, |
|
6933 &m_db_table_name, |
|
6934 &KServiceType, |
|
6935 m_index_type, |
|
6936 &KServiceIndex, |
|
6937 m_index, |
|
6938 &KTunnelingTypeVendorId, |
|
6939 m_tunneling_type.get_vendor_id(), |
|
6940 &KTunnelingType, |
|
6941 m_tunneling_type.get_vendor_type()); |
6868 |
6942 |
6869 RDbView view; |
6943 RDbView view; |
6870 // Evaluate view |
6944 // Evaluate view |
6871 User::LeaveIfError(view.Prepare(m_database, TDbQuery(sqlStatement), TDbWindow::EUnlimited)); |
6945 User::LeaveIfError(view.Prepare(m_database, TDbQuery(sqlStatement), TDbWindow::EUnlimited)); |
6872 CleanupClosePushL(view); |
6946 CleanupClosePushL(view); |
7071 EAP_TRACE_DATA_DEBUG_SYMBIAN( |
7145 EAP_TRACE_DATA_DEBUG_SYMBIAN( |
7072 ("eap_am_type_tls_peap_symbian_c::query_user_permission_for_A_ID(): in_pac_attribute_A_ID", |
7146 ("eap_am_type_tls_peap_symbian_c::query_user_permission_for_A_ID(): in_pac_attribute_A_ID", |
7073 (A_IDPtr.Ptr()), |
7147 (A_IDPtr.Ptr()), |
7074 (in_pac_attribute_A_ID->get_data_length()))); |
7148 (in_pac_attribute_A_ID->get_data_length()))); |
7075 |
7149 |
7076 if (A_ID_infoPtr.Size()>KMaxEapFastNotifierBufLength) |
7150 if (A_ID_infoPtr.Size()>=KMaxNotifItemLength) |
7077 { |
7151 { |
7078 CleanupStack::PopAndDestroy(3); // A_ID, A_ID_info |
7152 CleanupStack::PopAndDestroy(3); // A_ID, A_ID_info |
7079 status = m_am_tools->convert_am_error_to_eapol_error(KErrArgument); |
7153 status = m_am_tools->convert_am_error_to_eapol_error(KErrArgument); |
7080 |
7154 |
7081 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
7155 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
7082 return EAP_STATUS_RETURN(m_am_tools, m_eap_fast_completion_status); |
7156 return EAP_STATUS_RETURN(m_am_tools, m_eap_fast_completion_status); |
7083 } |
7157 } |
7084 |
7158 |
7085 TBool startedOk = ETrue; |
7159 TBool startedOk = ETrue; |
7086 |
7160 |
7087 if (!iEapFastActiveNotes) |
7161 TEapExpandedType aEapType(*EapExpandedTypeFast.GetType()); |
7088 { |
7162 |
7089 TRAPD( err, iEapFastActiveNotes = CEapFastActive::NewL( this ) ); |
7163 m_notifier_data_to_user->iPassword.Copy(A_ID_infoPtr); |
7090 |
7164 |
7091 if ( err != KErrNone ) |
7165 if (iEapAuthNotifier == 0) |
7092 { |
7166 { |
7093 status = eap_status_allocation_error; |
7167 TRAPD(err, iEapAuthNotifier = CEapAuthNotifier::NewL( *this )); |
7094 } |
7168 if (err) |
7095 } |
7169 { |
7096 if ( status == KErrNone ) |
7170 return eap_status_process_general_error; |
7097 { |
7171 } |
7098 //update buffer |
7172 } |
7099 iEapFastActiveNotes->UpdateInputBuf( A_ID_infoPtr ); |
7173 else |
7100 // start query install dialog |
7174 { |
7101 // asynch. call, return immediately |
7175 TRAPD(err1, iEapAuthNotifier->Cancel()); |
7102 startedOk = iEapFastActiveNotes->Start( |
7176 if (err1) |
7103 CEapFastActive::EEapFastActiveInstallPacQueryDialog ); |
7177 { |
7104 if ( startedOk == EFalse ) |
7178 return eap_status_process_general_error; |
7105 { |
7179 } |
7106 status = eap_status_process_general_error; |
7180 } |
7107 } |
7181 |
7108 } |
7182 TRAPD(err2, iEapAuthNotifier->StartL(CEapAuthNotifier::EEapNotifierTypeFastInstallPacQueryDialog, m_notifier_data_to_user, aEapType)); |
7109 else |
7183 if (err2) |
7110 { |
7184 { |
7111 status = eap_status_process_general_error; |
7185 return eap_status_process_general_error; |
7112 } |
7186 } |
|
7187 |
|
7188 |
7113 |
7189 |
7114 CleanupStack::PopAndDestroy(3); // A_ID, A_ID_info |
7190 CleanupStack::PopAndDestroy(3); // A_ID, A_ID_info |
7115 |
7191 |
7116 return status; |
7192 return status; |
7117 } |
7193 } |
7118 |
7194 |
|
7195 //-------------------------------------------------- |
7119 |
7196 |
7120 EAP_FUNC_EXPORT eap_status_e eap_am_type_tls_peap_symbian_c::read_PAC_store_data( |
7197 EAP_FUNC_EXPORT eap_status_e eap_am_type_tls_peap_symbian_c::read_PAC_store_data( |
7121 const eap_fast_pac_store_pending_operation_e in_pending_operation, |
7198 const eap_fast_pac_store_pending_operation_e in_pending_operation, |
7122 EAP_TEMPLATE_CONST eap_array_c<eap_fast_pac_store_data_c> * const in_references) |
7199 EAP_TEMPLATE_CONST eap_array_c<eap_fast_pac_store_data_c> * const in_references) |
7123 { |
7200 { |
7601 dataType = eap_pac_store_data_type_PAC_data; |
7678 dataType = eap_pac_store_data_type_PAC_data; |
7602 break; |
7679 break; |
7603 } |
7680 } |
7604 } |
7681 } |
7605 |
7682 |
7606 TInt count = 0; |
7683 m_info_array.ResetAndDestroy(); |
7607 |
|
7608 m_info_array.Reset(); |
|
7609 |
7684 |
7610 iPacStoreDb->GetPacStoreDataL(dbTableName, m_info_array); |
7685 iPacStoreDb->GetPacStoreDataL(dbTableName, m_info_array); |
7611 |
7686 |
7612 EAP_TRACE_DEBUG_SYMBIAN( |
7687 EAP_TRACE_DEBUG_SYMBIAN( |
7613 (_L("eap_am_type_tls_peap_symbian_c::ReadPACStoredataL:Number of entries in table %S=%d\n"), |
7688 (_L("eap_am_type_tls_peap_symbian_c::ReadPACStoredataL:Number of entries in table %S=%d\n"), |
7614 &dbTableName, m_info_array.Count())); |
7689 &dbTableName, m_info_array.Count())); |
7615 |
7690 |
7616 while (count < m_info_array.Count()) |
7691 TInt first_index = 0; |
|
7692 |
|
7693 while (m_info_array.Count() > 0) |
7617 { |
7694 { |
7618 TPtr8 infoDataPtr = m_info_array[count].iData->Des(); |
7695 if (m_info_array[first_index] != 0 |
7619 TPtr8 infoRefPtr = m_info_array[count].iReference->Des(); |
7696 && m_info_array[first_index]->GetIsValid() != EFalse) |
|
7697 { |
|
7698 // Note this will get always the first object of array. After the first object is processed it is destryed and removed from array. |
|
7699 TPtr8 infoDataPtr = m_info_array[first_index]->GetData()->Des(); |
|
7700 TPtr8 infoRefPtr = m_info_array[first_index]->GetReference()->Des(); |
|
7701 |
|
7702 EAP_TRACE_DATA_DEBUG_SYMBIAN( |
|
7703 ("eap_am_type_tls_peap_symbian_c::ReadPACStoredataL: BINARY value from PAC DB (reference)", |
|
7704 infoRefPtr.Ptr(), |
|
7705 infoRefPtr.Size())); |
|
7706 |
|
7707 EAP_TRACE_DATA_DEBUG_SYMBIAN( |
|
7708 ("eap_am_type_tls_peap_symbian_c::ReadPACStoredataL: BINARY value from PAC DB (value)", |
|
7709 infoDataPtr.Ptr(), |
|
7710 infoDataPtr.Size())); |
|
7711 |
|
7712 eap_fast_pac_store_data_c * const new_data = new eap_fast_pac_store_data_c(m_am_tools); |
|
7713 |
|
7714 eap_automatic_variable_c<eap_fast_pac_store_data_c> automatic_new_data( |
|
7715 m_am_tools, new_data); |
|
7716 |
|
7717 if (new_data == 0) |
|
7718 { |
|
7719 m_eap_fast_completion_status = eap_status_allocation_error; |
|
7720 (void) EAP_STATUS_RETURN(m_am_tools, m_eap_fast_completion_status); |
|
7721 break; |
|
7722 } |
|
7723 |
|
7724 new_data->set_type(dataType); |
|
7725 |
|
7726 // Set the reference. |
|
7727 m_eap_fast_completion_status = new_data->get_writable_reference()->set_copy_of_buffer(infoRefPtr.Ptr(), infoRefPtr.Size()); |
|
7728 if (m_eap_fast_completion_status != eap_status_ok) |
|
7729 { |
|
7730 (void) EAP_STATUS_RETURN(m_am_tools, m_eap_fast_completion_status); |
|
7731 delete m_info_array[first_index]; |
|
7732 m_info_array.Remove(first_index); |
|
7733 break; |
|
7734 } |
|
7735 |
|
7736 m_eap_fast_completion_status = new_data->get_writable_data()->set_copy_of_buffer(infoDataPtr.Ptr(), infoDataPtr.Size()); |
|
7737 if (m_eap_fast_completion_status != eap_status_ok) |
|
7738 { |
|
7739 (void) EAP_STATUS_RETURN(m_am_tools, m_eap_fast_completion_status); |
|
7740 delete m_info_array[first_index]; |
|
7741 m_info_array.Remove(first_index); |
|
7742 break; |
|
7743 } |
|
7744 |
|
7745 automatic_new_data.do_not_free_variable(); |
|
7746 |
|
7747 m_eap_fast_completion_status = m_references_and_data_blocks.add_object(new_data, true); |
|
7748 if (m_eap_fast_completion_status != eap_status_ok) |
|
7749 { |
|
7750 (void) EAP_STATUS_RETURN(m_am_tools, m_eap_fast_completion_status); |
|
7751 delete m_info_array[first_index]; |
|
7752 m_info_array.Remove(first_index); |
|
7753 break; |
|
7754 } |
|
7755 EAP_TRACE_DATA_DEBUG_SYMBIAN( |
|
7756 ("For GROUP, AID, PAC INFOs - added data", |
|
7757 (new_data->get_data())->get_data((new_data->get_data())->get_data_length()), |
|
7758 (new_data->get_data())->get_data_length())); |
|
7759 } |
|
7760 |
|
7761 delete m_info_array[first_index]; |
|
7762 m_info_array.Remove(first_index); |
7620 |
7763 |
7621 EAP_TRACE_DATA_DEBUG_SYMBIAN( |
7764 |
7622 ("eap_am_type_tls_peap_symbian_c::ReadPACStoredataL: BINARY value from PAC DB (reference)", |
|
7623 infoRefPtr.Ptr(), |
|
7624 infoRefPtr.Size())); |
|
7625 |
|
7626 EAP_TRACE_DATA_DEBUG_SYMBIAN( |
|
7627 ("eap_am_type_tls_peap_symbian_c::ReadPACStoredataL: BINARY value from PAC DB (value)", |
|
7628 infoDataPtr.Ptr(), |
|
7629 infoDataPtr.Size())); |
|
7630 |
|
7631 eap_fast_pac_store_data_c * const new_data = new eap_fast_pac_store_data_c(m_am_tools); |
|
7632 |
|
7633 eap_automatic_variable_c<eap_fast_pac_store_data_c> automatic_new_data( |
|
7634 m_am_tools, new_data); |
|
7635 |
|
7636 if (new_data == 0) |
|
7637 { |
|
7638 m_eap_fast_completion_status = eap_status_allocation_error; |
|
7639 (void) EAP_STATUS_RETURN(m_am_tools, m_eap_fast_completion_status); |
|
7640 break; |
|
7641 } |
|
7642 |
|
7643 new_data->set_type(dataType); |
|
7644 |
|
7645 // Set the reference. |
|
7646 m_eap_fast_completion_status = new_data->get_writable_reference()->set_copy_of_buffer(infoRefPtr.Ptr(), infoRefPtr.Size()); |
|
7647 if (m_eap_fast_completion_status != eap_status_ok) |
|
7648 { |
|
7649 (void) EAP_STATUS_RETURN(m_am_tools, m_eap_fast_completion_status); |
|
7650 delete m_info_array[count].iData; |
|
7651 delete m_info_array[count].iReference; |
|
7652 break; |
|
7653 } |
|
7654 |
|
7655 m_eap_fast_completion_status = new_data->get_writable_data()->set_copy_of_buffer(infoDataPtr.Ptr(),infoDataPtr.Size() ); |
|
7656 if (m_eap_fast_completion_status != eap_status_ok) |
|
7657 { |
|
7658 (void) EAP_STATUS_RETURN(m_am_tools, m_eap_fast_completion_status); |
|
7659 delete m_info_array[count].iData; |
|
7660 delete m_info_array[count].iReference; |
|
7661 break; |
|
7662 } |
|
7663 |
|
7664 automatic_new_data.do_not_free_variable(); |
|
7665 |
|
7666 m_eap_fast_completion_status = m_references_and_data_blocks.add_object(new_data, true); |
|
7667 if (m_eap_fast_completion_status != eap_status_ok) |
|
7668 { |
|
7669 (void) EAP_STATUS_RETURN(m_am_tools, m_eap_fast_completion_status); |
|
7670 delete m_info_array[count].iData; |
|
7671 delete m_info_array[count].iReference; |
|
7672 break; |
|
7673 } |
|
7674 |
|
7675 delete m_info_array[count].iData; |
|
7676 delete m_info_array[count].iReference; |
|
7677 |
|
7678 EAP_TRACE_DATA_DEBUG_SYMBIAN( |
|
7679 ("For GROUP, AID, PAC INFOs - added data", |
|
7680 (new_data->get_data())->get_data((new_data->get_data())->get_data_length()), |
|
7681 (new_data->get_data())->get_data_length())); |
|
7682 |
|
7683 count++; |
|
7684 } // End: while |
7765 } // End: while |
7685 |
7766 |
7686 |
7767 |
7687 if (m_eap_fast_completion_status != eap_status_ok) |
7768 if (m_eap_fast_completion_status != eap_status_ok) |
7688 { |
7769 { |
8553 { |
8680 { |
8554 EAP_TRACE_DEBUG_SYMBIAN( |
8681 EAP_TRACE_DEBUG_SYMBIAN( |
8555 (_L("eap_am_type_tls_peap_symbian_c::complete_add_imported_PAC_file: NO GROUP REFERENCE !!!!"))); |
8682 (_L("eap_am_type_tls_peap_symbian_c::complete_add_imported_PAC_file: NO GROUP REFERENCE !!!!"))); |
8556 |
8683 |
8557 } |
8684 } |
8558 |
8685 |
8559 HBufC* FilePath = HBufC::NewLC(KMaxFileName); // must be defined to correct maxs dir length |
8686 HBufC* FilePath = HBufC::NewLC(KMaxFileName); // must be defined to correct maxs dir length |
8560 TPtr FilePathPtr = FilePath->Des(); |
8687 TPtr FilePathPtr = FilePath->Des(); |
8561 HBufC8* FilePath8 = HBufC8::NewLC(KMaxFileName); // must be defined to correct maxs dir length |
8688 HBufC8* FilePath8 = HBufC8::NewLC(KMaxFileName); // must be defined to correct maxs dir length |
8562 TPtr8 FilePathPtr8 = FilePath8->Des(); |
8689 TPtr8 FilePathPtr8 = FilePath8->Des(); |
8563 |
8690 |
8564 _LIT8(KPacStoreSourceDir, "c:\\private\\101f8ec5\\PACGroup\\"); // in dir are dirs where from files are read |
|
8565 FilePathPtr8.Zero(); |
8691 FilePathPtr8.Zero(); |
8566 FilePathPtr8.Append(KPacStoreSourceDir); |
|
8567 FilePathPtr8.Append(refPtr); |
8692 FilePathPtr8.Append(refPtr); |
8568 FilePathPtr8.Append(KSeparator); |
8693 FilePathPtr8.Append(KSeparator); |
8569 FilePathPtr8.Append(bufPtr); |
8694 FilePathPtr8.Append(bufPtr); |
8570 |
8695 |
|
8696 // Copy is the only function that takes TPtr8 type of parameter. |
8571 FilePathPtr.Copy(FilePathPtr8); |
8697 FilePathPtr.Copy(FilePathPtr8); |
|
8698 |
|
8699 { |
|
8700 TFileName aPrivateDatabasePathName; |
|
8701 |
|
8702 EapPluginTools::GetPrivatePathL( |
|
8703 aPrivateDatabasePathName); |
|
8704 |
|
8705 aPrivateDatabasePathName.Append(KPacStoreSourceDir); |
|
8706 aPrivateDatabasePathName.Append(FilePathPtr); |
|
8707 |
|
8708 FilePathPtr.Copy(aPrivateDatabasePathName); |
|
8709 } |
8572 |
8710 |
8573 EAP_TRACE_DATA_DEBUG( |
8711 EAP_TRACE_DATA_DEBUG( |
8574 m_am_tools, |
8712 m_am_tools, |
8575 TRACE_FLAGS_DEFAULT, |
8713 TRACE_FLAGS_DEFAULT, |
8576 (EAPL("eap_am_type_tls_peap_symbian_c::complete_add_imported_PAC_file: Delete File"), |
8714 (EAPL("eap_am_type_tls_peap_symbian_c::complete_add_imported_PAC_file: Delete File"), |
8852 { |
8990 { |
8853 eap_status_e status( eap_status_ok ); |
8991 eap_status_e status( eap_status_ok ); |
8854 m_provisioning_mode = provisioning_mode; // save provis. mode |
8992 m_provisioning_mode = provisioning_mode; // save provis. mode |
8855 |
8993 |
8856 TInt err = KErrNone; |
8994 TInt err = KErrNone; |
8857 if ( !iEapFastActiveWaitNote ) |
8995 |
8858 { |
8996 |
8859 TRAP( err, iEapFastActiveWaitNote = CEapFastActive::NewL( this ) ); |
8997 TEapExpandedType aEapType(*EapExpandedTypeFast.GetType()); |
8860 } |
8998 |
8861 if ( !iEapFastActiveNotes ) |
8999 m_notifier_data_to_user->iPassword.Zero(); |
8862 { |
9000 |
8863 TRAP( err, iEapFastActiveNotes = CEapFastActive::NewL( this ) ); |
9001 if (iEapAuthNotifier == 0) |
8864 } |
9002 { |
8865 if ( err != KErrNone ) |
9003 TRAPD(err, iEapAuthNotifier = CEapAuthNotifier::NewL( *this )); |
8866 { |
9004 if (err) |
8867 status = eap_status_allocation_error; |
9005 { |
8868 } |
9006 return eap_status_process_general_error; |
8869 /** |
9007 } |
8870 * The note is started in a separate active object. |
9008 } |
8871 * When user cancels waiting note, |
9009 else |
8872 * SendErrorNotification( eap_status_user_cancel_authentication ) |
9010 { |
8873 * will be called in iEapFastActiveWaitNote->RunL(). |
9011 TRAPD(err1, iEapAuthNotifier->Cancel()); |
8874 * Otherwise note is stopped using iEapFastActiveWaitNote.Start() method. |
9012 if (err1) |
8875 */ |
9013 { |
8876 TBool startedOk = ETrue; |
9014 return eap_status_process_general_error; |
8877 |
9015 } |
|
9016 } |
|
9017 |
8878 if ( pac_type == eap_fast_pac_type_tunnel_pac |
9018 if ( pac_type == eap_fast_pac_type_tunnel_pac |
8879 && |
9019 && provisioning_mode == eap_fast_completion_operation_server_authenticated_provisioning_mode |
8880 provisioning_mode == |
9020 && status == eap_status_ok ) |
8881 eap_fast_completion_operation_server_authenticated_provisioning_mode |
9021 { |
8882 && |
9022 TRAPD(err2, iEapAuthNotifier->StartL(CEapAuthNotifier::EEapNotifierTypeFastStartAuthProvWaitNote, m_notifier_data_to_user, aEapType)); |
8883 status == eap_status_ok ) |
9023 if (err2) |
8884 { |
9024 { |
8885 EAP_TRACE_DEBUG_SYMBIAN( ( _L("eap_am_type_tls_peap_symbian_c:: \ |
9025 return eap_status_process_general_error; |
8886 indicates_eap_fast_provisioning_starts Authenticated provisioning!"))); |
9026 } |
8887 startedOk = iEapFastActiveWaitNote->Start( |
9027 } |
8888 CEapFastActive::EEapFastActiveStartAuthProvWaitNote ); |
|
8889 } |
|
8890 else if ( |
9028 else if ( |
8891 pac_type == eap_fast_pac_type_tunnel_pac |
9029 pac_type == eap_fast_pac_type_tunnel_pac |
8892 && |
9030 && provisioning_mode == eap_fast_completion_operation_server_unauthenticated_provisioning_mode_ADHP |
8893 provisioning_mode == |
9031 && status == eap_status_ok ) |
8894 eap_fast_completion_operation_server_unauthenticated_provisioning_mode_ADHP |
9032 { |
8895 && |
9033 TRAPD(err3, iEapAuthNotifier->StartL(CEapAuthNotifier::EEapNotifierTypeFastStartUnauthProvWaitNote, m_notifier_data_to_user, aEapType)); |
8896 status == eap_status_ok ) |
9034 if (err3) |
8897 { |
9035 { |
8898 EAP_TRACE_DEBUG_SYMBIAN( (_L("eap_am_type_tls_peap_symbian_c:: \ |
9036 return eap_status_process_general_error; |
8899 indicates_eap_fast_provisioning_starts UnAuthenticated provisioning!"))); |
9037 } |
8900 startedOk = iEapFastActiveWaitNote->Start( |
9038 } |
8901 CEapFastActive::EEapFastActiveStartUnauthProvWaitNote ); |
9039 |
8902 } |
9040 |
8903 if ( startedOk == EFalse ) |
9041 |
8904 { |
|
8905 status = eap_status_process_general_error; |
|
8906 } |
|
8907 if ( status != eap_status_ok ) |
|
8908 { |
|
8909 EAP_TRACE_DEBUG_SYMBIAN( (_L("eap_am_type_tls_peap_symbian_c:: \ |
|
8910 indicates_eap_fast_provisioning_starts ERROR: status=%d."), status ) ); |
|
8911 } |
|
8912 return status; |
9042 return status; |
8913 } |
9043 } |
8914 |
9044 |
8915 // --------------------------------------------------------------------------- |
9045 // --------------------------------------------------------------------------- |
8916 // eap_am_type_tls_peap_symbian_c::indicates_eap_fast_provisioning_ends |
9046 // eap_am_type_tls_peap_symbian_c::indicates_eap_fast_provisioning_ends |
8930 eap_status_e status( eap_status_ok ); |
9060 eap_status_e status( eap_status_ok ); |
8931 |
9061 |
8932 if ( pac_type == eap_fast_pac_type_tunnel_pac ) |
9062 if ( pac_type == eap_fast_pac_type_tunnel_pac ) |
8933 { |
9063 { |
8934 // stop wait note; |
9064 // stop wait note; |
8935 if ( iEapFastActiveWaitNote ) |
9065 TEapExpandedType aEapType(*EapExpandedTypeFast.GetType()); |
8936 { |
9066 |
8937 if ( iEapFastActiveWaitNote->IsActive() ) |
9067 m_notifier_data_to_user->iPassword.Zero(); |
8938 { |
9068 |
8939 iEapFastActiveWaitNote->Cancel(); |
9069 if (iEapAuthNotifier == 0) |
8940 } |
9070 { |
8941 delete iEapFastActiveWaitNote; |
9071 TRAPD(err, iEapAuthNotifier = CEapAuthNotifier::NewL( *this )); |
8942 iEapFastActiveWaitNote = NULL; |
9072 if (err) |
|
9073 { |
|
9074 return eap_status_process_general_error; |
|
9075 } |
|
9076 } |
|
9077 else |
|
9078 { |
|
9079 TRAPD(err1, iEapAuthNotifier->Cancel()); |
|
9080 if (err1) |
|
9081 { |
|
9082 return eap_status_process_general_error; |
|
9083 } |
|
9084 } |
|
9085 |
|
9086 if( provisioning_successfull ) |
|
9087 { |
|
9088 TRAPD(err2, iEapAuthNotifier->StartL(CEapAuthNotifier::EEapNotifierTypeFastShowProvSuccessNote, m_notifier_data_to_user, aEapType)); |
|
9089 if (err2) |
|
9090 { |
|
9091 return eap_status_process_general_error; |
|
9092 } |
8943 } |
9093 } |
8944 |
9094 else |
8945 if ( iEapFastActiveNotes ) |
9095 { |
8946 { |
9096 TRAPD(err3, iEapAuthNotifier->StartL(CEapAuthNotifier::EEapNotifierTypeFastShowProvNotSuccessNote, m_notifier_data_to_user, aEapType)); |
8947 if( provisioning_successfull ) |
9097 if (err3) |
8948 { |
9098 { |
8949 // synch. call |
9099 return eap_status_process_general_error; |
8950 iEapFastActiveNotes->Start( CEapFastActive:: |
9100 } |
8951 EEapFastActiveShowProvSuccessNote, ETrue ); |
9101 } |
8952 } |
9102 def |
8953 else |
|
8954 { |
|
8955 // synch. call |
|
8956 iEapFastActiveNotes->Start( CEapFastActive:: |
|
8957 EapFastActiveShowProvNotSuccessNote, ETrue ); |
|
8958 } |
|
8959 } |
|
8960 } // if ( pac_type == eap_fast_pac_type_tunnel_pac ) |
9103 } // if ( pac_type == eap_fast_pac_type_tunnel_pac ) |
8961 |
9104 |
8962 return status; |
9105 return status; |
8963 } |
9106 } |
8964 |
9107 |
8965 #endif //#if defined(USE_FAST_EAP_TYPE) |
9108 #endif //#if defined(USE_FAST_EAP_TYPE) |
|
9109 |
|
9110 //-------------------------------------------------- |
8966 |
9111 |
8967 #ifdef USE_PAC_STORE |
9112 #ifdef USE_PAC_STORE |
8968 |
9113 |
8969 void eap_am_type_tls_peap_symbian_c::GetPacStoreDbDataL( |
9114 void eap_am_type_tls_peap_symbian_c::GetPacStoreDbDataL( |
8970 const eap_pac_store_data_type_e aPacStoreDataType, |
9115 const eap_pac_store_data_type_e aPacStoreDataType, |
9232 |
9377 |
9233 #endif // End: #ifdef USE_PAC_STORE |
9378 #endif // End: #ifdef USE_PAC_STORE |
9234 |
9379 |
9235 //-------------------------------------------------- |
9380 //-------------------------------------------------- |
9236 |
9381 |
9237 #if defined(USE_FAST_EAP_TYPE) |
9382 #ifdef USE_FAST_EAP_TYPE |
9238 |
|
9239 eap_status_e eap_am_type_tls_peap_symbian_c::ShowNotifierItemAndGetResponse( |
|
9240 EEapFastNotifierUiItem aNotifierUiItem, TBool aSetActive ) |
|
9241 { |
|
9242 EAP_TRACE_DEBUG_SYMBIAN( |
|
9243 (_L("eap_am_type_tls_peap_symbian_c::ShowNotifierItem aNotifierUiItem=%d, ActiveStatus=%d "), |
|
9244 aNotifierUiItem, IsActive())); |
|
9245 |
|
9246 if ( aSetActive && IsActive() ) |
|
9247 { |
|
9248 EAP_TRACE_DEBUG_SYMBIAN( |
|
9249 (_L("ShowNotifierItemAndGetResponse: Already active when tried to show Notifier"))); |
|
9250 |
|
9251 return eap_status_device_busy; |
|
9252 } |
|
9253 |
|
9254 eap_status_e status( eap_status_ok ); |
|
9255 |
|
9256 if( !m_is_notifier_connected ) |
|
9257 { |
|
9258 TInt error = m_notifier.Connect(); |
|
9259 |
|
9260 EAP_TRACE_DEBUG_SYMBIAN( |
|
9261 (_L("eap_am_type_tls_peap_symbian_c::ShowNotifierItem - m_notifier.Connect() returned error=%d\n"), error)); |
|
9262 |
|
9263 if( error != KErrNone) |
|
9264 { |
|
9265 // Can not connect to notifier. |
|
9266 return m_am_tools->convert_am_error_to_eapol_error(error); |
|
9267 } |
|
9268 |
|
9269 m_is_notifier_connected = ETrue; // Got connectted to notifier. |
|
9270 } |
|
9271 |
|
9272 // Update the values needed for notifier. |
|
9273 m_notifier_data_to_user->iEapFastNotifierUiItem = aNotifierUiItem; |
|
9274 |
|
9275 EAP_TRACE_DEBUG_SYMBIAN( |
|
9276 (_L("m_notifier_data_pckg_to_user"), |
|
9277 m_notifier_data_pckg_to_user->Ptr(), |
|
9278 m_notifier_data_pckg_to_user->Size())); |
|
9279 |
|
9280 m_notifier_data_from_user->iEapFastNotifierBuffer.Delete(0,KMaxEapFastNotifierBufLength); |
|
9281 |
|
9282 EAP_TRACE_DEBUG_SYMBIAN( |
|
9283 (_L("eap_am_type_tls_peap_symbian_c::ShowNotifierItem - StartNotifierAndGetResponse"))); |
|
9284 |
|
9285 m_notifier.StartNotifierAndGetResponse( |
|
9286 iStatus, |
|
9287 KEapFastNotifierUid, |
|
9288 *m_notifier_data_pckg_to_user, |
|
9289 *m_notifier_data_pckg_from_user); |
|
9290 |
|
9291 if ( aSetActive ) |
|
9292 { |
|
9293 m_notifier_complete = ETrue; |
|
9294 SetActive(); |
|
9295 } |
|
9296 |
|
9297 EAP_TRACE_DEBUG_SYMBIAN( |
|
9298 (_L("eap_am_type_tls_peap_symbian_c::ShowNotifierItem - End"))); |
|
9299 |
|
9300 return status; |
|
9301 } |
|
9302 |
|
9303 //-------------------------------------------------- |
9383 //-------------------------------------------------- |
9304 |
9384 |
9305 eap_status_e eap_am_type_tls_peap_symbian_c::RemoveIAPReference() |
9385 eap_status_e eap_am_type_tls_peap_symbian_c::RemoveIAPReference() |
9306 { |
9386 { |
9307 EAP_TRACE_DEBUG_SYMBIAN( |
9387 EAP_TRACE_DEBUG_SYMBIAN( |
9308 (_L("eap_am_type_tls_peap_symbian_c::RemoveIAPReference - Start"))); |
9388 (_L("eap_am_type_tls_peap_symbian_c::RemoveIAPReference - Start"))); |
9309 m_eap_fast_completion_status = eap_status_ok; |
9389 m_eap_fast_completion_status = eap_status_ok; |
9310 |
9390 |
9311 eap_variable_data_c aIapReference(m_am_tools); |
9391 eap_variable_data_c aIapReference(m_am_tools); |
9463 TPtr8 PathPtr8 = Path8->Des(); |
9545 TPtr8 PathPtr8 = Path8->Des(); |
9464 HBufC8* readData = NULL; |
9546 HBufC8* readData = NULL; |
9465 TBool FileFound(EFalse); |
9547 TBool FileFound(EFalse); |
9466 |
9548 |
9467 PathPtr8.Zero(); |
9549 PathPtr8.Zero(); |
9468 PathPtr8.Append(KPacStoreSourceDir); |
|
9469 PathPtr8.Append(group_referencePtr8); |
9550 PathPtr8.Append(group_referencePtr8); |
9470 PathPtr8.Append(KSeparator); |
9551 PathPtr8.Append(KSeparator); |
|
9552 |
9471 EAP_TRACE_DATA_DEBUG( |
9553 EAP_TRACE_DATA_DEBUG( |
9472 m_am_tools, |
9554 m_am_tools, |
9473 TRACE_FLAGS_DEFAULT, |
9555 TRACE_FLAGS_DEFAULT, |
9474 (EAPL("eap_am_type_tls_peap_symbian_c::ImportFilesL: Path8"), |
9556 (EAPL("eap_am_type_tls_peap_symbian_c::ImportFilesL: Path8"), |
9475 PathPtr8.Ptr(), |
9557 PathPtr8.Ptr(), |
9476 PathPtr8.Size())); |
9558 PathPtr8.Size())); |
|
9559 |
9477 PathPtr.Zero(); |
9560 PathPtr.Zero(); |
|
9561 // Copy is the only function that takes TPtr8 type of parameter. |
9478 PathPtr.Copy(PathPtr8); |
9562 PathPtr.Copy(PathPtr8); |
9479 |
9563 |
|
9564 { |
|
9565 TFileName aPrivateDatabasePathName; |
|
9566 |
|
9567 EapPluginTools::GetPrivatePathL( |
|
9568 aPrivateDatabasePathName); |
|
9569 |
|
9570 aPrivateDatabasePathName.Append(KPacStoreSourceDir); |
|
9571 aPrivateDatabasePathName.Append(PathPtr); |
|
9572 |
|
9573 PathPtr.Copy(aPrivateDatabasePathName); |
|
9574 } |
|
9575 |
9480 EAP_TRACE_DATA_DEBUG( |
9576 EAP_TRACE_DATA_DEBUG( |
9481 m_am_tools, |
9577 m_am_tools, |
9482 TRACE_FLAGS_DEFAULT, |
9578 TRACE_FLAGS_DEFAULT, |
9483 (EAPL("eap_am_type_tls_peap_symbian_c::ImportFilesL: Path"), |
9579 (EAPL("eap_am_type_tls_peap_symbian_c::ImportFilesL: Path"), |
9484 PathPtr.Ptr(), |
9580 PathPtr.Ptr(), |
9485 PathPtr.Size())); |
9581 PathPtr.Size())); |
9486 |
9582 |
9487 EAP_TRACE_DEBUG_SYMBIAN( |
9583 EAP_TRACE_DEBUG_SYMBIAN( |
9488 (_L("eap_am_type_tls_peap_symbian_c::ImportFilesL: Check directory availability"))); |
9584 (_L("eap_am_type_tls_peap_symbian_c::ImportFilesL: Check directory availability"))); |
9489 |
9585 |
9490 if (aFs.GetDir(PathPtr, KEntryAttNormal, ESortByName, files) == KErrNone) |
9586 if (aFs.GetDir(PathPtr, KEntryAttNormal, ESortByName, files) == KErrNone) |
9491 { |
9587 { |
9554 } |
9650 } |
9555 } |
9651 } |
9556 else if(directoryEmpty == false && directoryExists == true && FileFound != EFalse) |
9652 else if(directoryEmpty == false && directoryExists == true && FileFound != EFalse) |
9557 { |
9653 { |
9558 PathPtr8.Zero(); |
9654 PathPtr8.Zero(); |
9559 PathPtr8.Append(KPacStoreSourceDir); |
|
9560 PathPtr8.Append(group_referencePtr8); |
9655 PathPtr8.Append(group_referencePtr8); |
9561 PathPtr8.Append(KSeparator); |
9656 PathPtr8.Append(KSeparator); |
9562 PathPtr8.Append(filenamePtr8); |
9657 PathPtr8.Append(filenamePtr8); |
|
9658 |
9563 EAP_TRACE_DATA_DEBUG( |
9659 EAP_TRACE_DATA_DEBUG( |
9564 m_am_tools, |
9660 m_am_tools, |
9565 TRACE_FLAGS_DEFAULT, |
9661 TRACE_FLAGS_DEFAULT, |
9566 (EAPL("eap_am_type_tls_peap_symbian_c::ImportFilesL: Path8"), |
9662 (EAPL("eap_am_type_tls_peap_symbian_c::ImportFilesL: Path8"), |
9567 PathPtr8.Ptr(), |
9663 PathPtr8.Ptr(), |
9568 PathPtr8.Size())); |
9664 PathPtr8.Size())); |
|
9665 |
9569 PathPtr.Zero(); |
9666 PathPtr.Zero(); |
9570 PathPtr.Copy(PathPtr8); |
9667 PathPtr.Copy(PathPtr8); |
|
9668 |
|
9669 { |
|
9670 TFileName aPrivateDatabasePathName; |
|
9671 |
|
9672 EapPluginTools::GetPrivatePathL( |
|
9673 aPrivateDatabasePathName); |
|
9674 |
|
9675 aPrivateDatabasePathName.Append(KPacStoreSourceDir); |
|
9676 aPrivateDatabasePathName.Append(PathPtr); |
|
9677 |
|
9678 PathPtr.Copy(aPrivateDatabasePathName); |
|
9679 } |
9571 |
9680 |
|
9681 EAP_TRACE_DATA_DEBUG( |
|
9682 m_am_tools, |
|
9683 TRACE_FLAGS_DEFAULT, |
|
9684 (EAPL("eap_am_type_tls_peap_symbian_c::ImportFilesL: PathPtr"), |
|
9685 PathPtr.Ptr(), |
|
9686 PathPtr.Size())); |
|
9687 |
9572 EAP_TRACE_DEBUG_SYMBIAN( |
9688 EAP_TRACE_DEBUG_SYMBIAN( |
9573 (_L("eap_am_type_tls_peap_symbian_c::ImportFilesL: Read file"))); |
9689 (_L("eap_am_type_tls_peap_symbian_c::ImportFilesL: Read file"))); |
9574 |
9690 |
9575 RFile file; |
9691 RFile file; |
|
9692 |
9576 if(file.Open(aFs, PathPtr, EFileRead)==KErrNone) |
9693 if(file.Open(aFs, PathPtr, EFileRead)==KErrNone) |
9577 { |
9694 { |
9578 readData= HBufC8::NewLC(filesize); |
9695 readData= HBufC8::NewLC(filesize); |
9579 TPtr8 readDataPtr = readData->Des(); |
9696 TPtr8 readDataPtr = readData->Des(); |
9580 file.Read(readDataPtr); |
9697 file.Read(readDataPtr); |
10267 (new_data->get_data())->get_data_length())); |
10479 (new_data->get_data())->get_data_length())); |
10268 |
10480 |
10269 m_both_completed++; |
10481 m_both_completed++; |
10270 return m_eap_fast_completion_status; |
10482 return m_eap_fast_completion_status; |
10271 |
10483 |
10272 } |
10484 } |
10273 |
10485 |
10274 // --------------------------------------------------------- |
10486 // --------------------------------------------------------- |
10275 // eap_am_type_tls_peap_symbian_c::CompleteNotifier |
10487 // eap_am_type_tls_peap_symbian_c::CompleteNotifier |
10276 // --------------------------------------------------------- |
10488 // --------------------------------------------------------- |
10277 // |
10489 // |
10278 eap_status_e eap_am_type_tls_peap_symbian_c::CompleteNotifierL() |
10490 eap_status_e eap_am_type_tls_peap_symbian_c::CompleteNotifierL() |
10279 { |
10491 { |
10280 eap_status_e status( eap_status_ok ); |
10492 eap_status_e status( eap_status_ok ); |
10281 switch ( m_state ) |
10493 switch ( m_state ) |
10282 { |
10494 { |
10283 case EPasswordCancel: |
10495 case EPasswordCancel: |
10284 case EPasswordQuery: |
10496 case EPasswordQuery: |
10285 case EWrongPassword: |
10497 case EWrongPassword: |
10286 case EFilePasswordQuery: |
10498 case EFilePasswordQuery: |
10287 case EMasterkeyQuery: |
10499 case EMasterkeyQuery: |
10288 { |
10500 { |
10289 EAP_TRACE_DEBUG_SYMBIAN( |
10501 |
10290 (_L("m_notifier_data_pckg_from_user"), |
|
10291 m_notifier_data_pckg_from_user->Ptr(), |
|
10292 m_notifier_data_pckg_from_user->Size())); |
|
10293 if ( iStatus.Int() == KErrCancel ) |
|
10294 { |
|
10295 EAP_TRACE_DEBUG_SYMBIAN( |
|
10296 (_L("eap_am_type_tls_peap_symbian_c::CompleteNotifierL - User cancelled the notifier item"))); |
|
10297 m_userAction = EEapFastNotifierUserActionCancel; |
|
10298 } |
|
10299 else if( iStatus.Int() != KErrNone ) |
|
10300 { |
|
10301 EAP_TRACE_DEBUG_SYMBIAN( |
|
10302 (_L("eap_am_type_tls_peap_symbian_c::CompleteNotifierL - ERROR: Notifier error=%d"), |
|
10303 iStatus.Int())); |
|
10304 return m_am_tools->convert_am_error_to_eapol_error(iStatus.Int()); |
|
10305 } |
|
10306 EAP_TRACE_DEBUG_SYMBIAN( |
|
10307 (_L("CompleteNotifierL - Notifier return UiItem=%d, UserAction=%d"), |
|
10308 m_notifier_data_from_user->iEapFastNotifierUiItem, |
|
10309 m_notifier_data_from_user->iEapFastNotifierUserAction)); |
|
10310 |
|
10311 EAP_TRACE_DATA_DEBUG_SYMBIAN( |
|
10312 ("CompleteNotifierL:UserInput:", |
|
10313 m_notifier_data_from_user->iEapFastNotifierBuffer.Ptr(), |
|
10314 m_notifier_data_from_user->iEapFastNotifierBuffer.Size())); |
|
10315 |
|
10316 if ( m_notifier_data_from_user->iEapFastNotifierBuffer.Size() > 0 ) |
|
10317 { |
|
10318 HBufC8* notifier_data8 = HBufC8::NewLC(m_notifier_data_from_user->iEapFastNotifierBuffer.Size()); |
|
10319 TPtr8 notifier_dataPtr8 = notifier_data8->Des(); |
|
10320 |
|
10321 notifier_dataPtr8.Copy(m_notifier_data_from_user->iEapFastNotifierBuffer); // Unicode -> ascii. |
|
10322 EAP_TRACE_DEBUG_SYMBIAN( |
|
10323 (_L("eap_am_type_tls_peap_symbian_c::CompleteNotifierL ShowNotifierItem - Data copy done"))); |
|
10324 |
|
10325 EAP_TRACE_DATA_DEBUG_SYMBIAN( |
|
10326 ("eap_am_type_tls_peap_symbian_c::CompleteNotifierL ShowNotifierItem:PW from UI (8bits)", |
|
10327 notifier_dataPtr8.Ptr(), |
|
10328 notifier_dataPtr8.Size())); |
|
10329 |
|
10330 status = m_userResponse.set_copy_of_buffer( |
|
10331 notifier_dataPtr8.Ptr(), |
|
10332 notifier_dataPtr8.Size()); |
|
10333 |
|
10334 CleanupStack::PopAndDestroy( notifier_data8 ); |
|
10335 } |
|
10336 break; |
10502 break; |
|
10503 |
10337 } |
10504 } |
10338 default: |
10505 default: |
10339 { |
10506 { |
10340 EAP_TRACE_DEBUG_SYMBIAN( |
10507 EAP_TRACE_DEBUG_SYMBIAN( |
10341 ( _L( "eap_am_type_tls_peap_symbian_c::CompleteNotifierL() m_state = %d not supported." ), |
10508 ( _L( "eap_am_type_tls_peap_symbian_c::CompleteNotifierL() m_state = %d not supported." ), |
10342 m_state ) ); |
10509 m_state ) ); |
10343 } |
10510 } |
10344 } |
10511 } |
10345 return status; |
10512 return status; |
10346 } |
10513 } |
10347 |
10514 |
10348 //-------------------------------------------------- |
10515 //-------------------------------------------------- |
10349 |
10516 |
10350 void eap_am_type_tls_peap_symbian_c::ConvertUnicodeToAsciiL(const TDesC16& aFromUnicode, TDes8& aToAscii) |
10517 void eap_am_type_tls_peap_symbian_c::ConvertUnicodeToAsciiL(const TDesC16& aFromUnicode, TDes8& aToAscii) |
10351 { |
10518 { |
10352 EAP_TRACE_DATA_DEBUG_SYMBIAN( |
10519 EAP_TRACE_DATA_DEBUG_SYMBIAN( |
10353 ("eap_am_type_tls_peap_symbian_c::ConvertUnicodeToAsciiL:From TEXT", |
10520 ("eap_am_type_tls_peap_symbian_c::ConvertUnicodeToAsciiL:From TEXT", |
10354 aFromUnicode.Ptr(), |
10521 aFromUnicode.Ptr(), |
10355 aFromUnicode.Size())); |
10522 aFromUnicode.Size())); |
10356 |
10523 |
10357 if(aFromUnicode.Length() <= 0) |
10524 if(aFromUnicode.Length() <= 0) |
10358 { |
10525 { |
10359 EAP_TRACE_DEBUG_SYMBIAN( |
|
10360 (_L("eap_am_type_tls_peap_symbian_c::ConvertUnicodeToAsciiL: Return: NOTHING TO CONVERT"))); |
|
10361 |
|
10362 return; |
|
10363 } |
|
10364 |
|
10365 EAP_TRACE_DEBUG_SYMBIAN( |
10526 EAP_TRACE_DEBUG_SYMBIAN( |
10366 (_L("eap_am_type_tls_peap_symbian_c::ConvertUnicodeToAsciiL, aFromUnicode.Length=%d, aFromUnicode.Size=%d"), |
10527 (_L("eap_am_type_tls_peap_symbian_c::ConvertUnicodeToAsciiL: Return: NOTHING TO CONVERT"))); |
10367 aFromUnicode.Length(), aFromUnicode.Size())); |
10528 |
10368 |
10529 return; |
10369 // Convert from Unicode to ascii. |
10530 } |
10370 HBufC8* aFromUnicodeBuf8 = HBufC8::NewLC(aFromUnicode.Length()); // Half times size of source (or length) is enough here. |
10531 |
10371 TPtr8 aFromUnicodePtr8 = aFromUnicodeBuf8->Des(); |
10532 EAP_TRACE_DEBUG_SYMBIAN( |
10372 |
10533 (_L("eap_am_type_tls_peap_symbian_c::ConvertUnicodeToAsciiL, aFromUnicode.Length=%d, aFromUnicode.Size=%d"), |
10373 EAP_TRACE_DEBUG_SYMBIAN( |
10534 aFromUnicode.Length(), aFromUnicode.Size())); |
10374 (_L("eap_am_type_tls_peap_symbian_c::ConvertUnicodeToAsciiL, aFromUnicodePtr8.Length=%d, aFromUnicodePtr8.Size=%d, aFromUnicodePtr8.MaxLength=%d, aFromUnicodePtr8.MaxSize=%d"), |
10535 |
10375 aFromUnicodePtr8.Length(), aFromUnicodePtr8.Size(), aFromUnicodePtr8.MaxLength(), aFromUnicodePtr8.MaxSize())); |
10536 // Convert from Unicode to ascii. |
10376 |
10537 HBufC8* aFromUnicodeBuf8 = HBufC8::NewLC(aFromUnicode.Length()); // Half times size of source (or length) is enough here. |
10377 aFromUnicodePtr8.Copy(aFromUnicode); // Unicode -> ascii. |
10538 TPtr8 aFromUnicodePtr8 = aFromUnicodeBuf8->Des(); |
10378 |
10539 |
10379 aToAscii = aFromUnicodePtr8; |
10540 EAP_TRACE_DEBUG_SYMBIAN( |
10380 |
10541 (_L("eap_am_type_tls_peap_symbian_c::ConvertUnicodeToAsciiL, aFromUnicodePtr8.Length=%d, aFromUnicodePtr8.Size=%d, aFromUnicodePtr8.MaxLength=%d, aFromUnicodePtr8.MaxSize=%d"), |
10381 CleanupStack::PopAndDestroy(aFromUnicodeBuf8); // Delete aFromUnicodeBuf8. |
10542 aFromUnicodePtr8.Length(), aFromUnicodePtr8.Size(), aFromUnicodePtr8.MaxLength(), aFromUnicodePtr8.MaxSize())); |
10382 |
10543 |
10383 EAP_TRACE_DATA_DEBUG_SYMBIAN( |
10544 aFromUnicodePtr8.Copy(aFromUnicode); // Unicode -> ascii. |
10384 ("eap_am_type_tls_peap_symbian_c::ConvertUnicodeToAsciiL:To ASCII", |
10545 |
10385 aToAscii.Ptr(), |
10546 aToAscii = aFromUnicodePtr8; |
10386 aToAscii.Size())); |
10547 |
10387 } |
10548 CleanupStack::PopAndDestroy(aFromUnicodeBuf8); // Delete aFromUnicodeBuf8. |
|
10549 |
|
10550 EAP_TRACE_DATA_DEBUG_SYMBIAN( |
|
10551 ("eap_am_type_tls_peap_symbian_c::ConvertUnicodeToAsciiL:To ASCII", |
|
10552 aToAscii.Ptr(), |
|
10553 aToAscii.Size())); |
|
10554 } |
10388 |
10555 |
10389 |
10556 |
10390 // --------------------------------------------------------- |
10557 // --------------------------------------------------------- |
10391 // eap_am_type_tls_peap_symbian_c::CheckPasswordTimeValidityL() |
10558 // eap_am_type_tls_peap_symbian_c::CheckPasswordTimeValidityL() |
10392 // --------------------------------------------------------- |
10559 // --------------------------------------------------------- |
10393 // |
10560 // |
10394 void eap_am_type_tls_peap_symbian_c::CheckPasswordTimeValidityL() |
10561 void eap_am_type_tls_peap_symbian_c::CheckPasswordTimeValidityL() |
10395 { |
10562 { |
10396 /* Check validity of password against timelimit */ |
10563 /* Check validity of password against timelimit */ |
10397 |
10564 |
10398 EAP_TRACE_DEBUG(m_am_tools, |
10565 EAP_TRACE_DEBUG(m_am_tools, |
10399 TRACE_FLAGS_DEFAULT, ( |
10566 TRACE_FLAGS_DEFAULT, ( |
10400 EAPL("CheckPasswordTimeValidityL - Start\n"))); |
10567 EAPL("CheckPasswordTimeValidityL - Start\n"))); |
10884 CleanupStack::PopAndDestroy(&view); // Close view. |
11059 CleanupStack::PopAndDestroy(&view); // Close view. |
10885 CleanupStack::PopAndDestroy(buf); // Delete buf. |
11060 CleanupStack::PopAndDestroy(buf); // Delete buf. |
10886 |
11061 |
10887 /* update end */ |
11062 /* update end */ |
10888 |
11063 |
10889 } // eap_am_type_tls_peap_symbian_c::UpdatePasswordTimeL() |
11064 } // eap_am_type_tls_peap_symbian_c::UpdatePasswordTimeL() |
10890 |
11065 |
|
11066 //-------------------------------------------------- |
10891 |
11067 |
10892 eap_status_e eap_am_type_tls_peap_symbian_c::CreateMasterkeyL() |
11068 eap_status_e eap_am_type_tls_peap_symbian_c::CreateMasterkeyL() |
10893 { |
11069 { |
10894 HBufC8* password = HBufC8::NewLC(m_userResponse.get_data_length()); |
11070 HBufC8* password = HBufC8::NewLC(m_userResponse.get_data_length()); |
10895 TPtr8 passwordPtr = password->Des(); |
11071 TPtr8 passwordPtr = password->Des(); |
10896 m_PAC_store_password.set_copy_of_buffer(&m_userResponse); |
11072 m_PAC_store_password.set_copy_of_buffer(&m_userResponse); |
10897 passwordPtr.Copy(m_userResponse.get_data(), m_userResponse.get_data_length()); |
11073 passwordPtr.Copy(m_userResponse.get_data(), m_userResponse.get_data_length()); |
10898 m_eap_fast_completion_status = m_am_tools->convert_am_error_to_eapol_error(iPacStoreDb->CreateAndSaveMasterKeyL(passwordPtr)); |
11074 m_eap_fast_completion_status = m_am_tools->convert_am_error_to_eapol_error(iPacStoreDb->CreateAndSaveMasterKeyL(passwordPtr)); |
10899 CleanupStack::PopAndDestroy(password); |
11075 CleanupStack::PopAndDestroy(password); |
10900 return m_eap_fast_completion_status; |
11076 return m_eap_fast_completion_status; |
10901 } |
11077 } |
|
11078 |
10902 #endif //#if defined(USE_FAST_EAP_TYPE) |
11079 #endif //#if defined(USE_FAST_EAP_TYPE) |
10903 |
11080 |
10904 |
11081 |
10905 |
11082 |
10906 // ================= TTLS-PAP public exported ======================= |
11083 // ================= TTLS-PAP public exported ======================= |
10907 |
11084 |
10908 // ------------------------------------------------------------------------ |
11085 // ------------------------------------------------------------------------ |
10909 // eap_am_type_tls_peap_symbian_c::is_ttls_pap_session_valid() |
11086 // eap_am_type_tls_peap_symbian_c::is_ttls_pap_session_valid() |
10910 // ------------------------------------------------------------------------ |
11087 // ------------------------------------------------------------------------ |
10911 // |
11088 // |
10912 EAP_FUNC_EXPORT |
11089 EAP_FUNC_EXPORT bool eap_am_type_tls_peap_symbian_c::is_ttls_pap_session_valid() |
10913 bool eap_am_type_tls_peap_symbian_c::is_ttls_pap_session_valid() |
11090 { |
10914 { |
11091 EAP_TRACE_DEBUG_SYMBIAN((_L( "eap_am_type_tls_peap_symbian_c::is_ttls_pap_session_valid()" ))); |
10915 DEBUG( "eap_am_type_tls_peap_symbian_c::is_ttls_pap_session_valid()" ); |
|
10916 |
11092 |
10917 TBool isValid = EFalse; |
11093 TBool isValid = EFalse; |
10918 TInt err = KErrNone; |
11094 TInt err = KErrNone; |
10919 bool retVal = false; |
11095 bool retVal = false; |
10920 |
11096 |
10921 TRAP( err, isValid = IsTtlsPapSessionValidL() ); |
11097 TRAP( err, isValid = IsTtlsPapSessionValidL() ); |
10922 if ( err != KErrNone ) |
11098 if ( err != KErrNone ) |
10923 { |
11099 { |
10924 DEBUG1( "eap_am_type_tls_peap_symbian_c::is_ttls_pap_session_valid() ERROR: \ |
11100 EAP_TRACE_DEBUG_SYMBIAN((_L("ERROR: eap_am_type_tls_peap_symbian_c::is_ttls_pap_session_valid(): Leave, err==%d."), err )); |
10925 Leave, err==%d.", err ); |
|
10926 retVal = false; |
11101 retVal = false; |
10927 } |
11102 } |
10928 else |
11103 else |
10929 { |
11104 { |
10930 retVal = ( isValid ) ? true : false; |
11105 retVal = ( isValid ) ? true : false; |
10931 } |
11106 } |
10932 return retVal; |
11107 return retVal; |
10933 } |
11108 } |
10934 |
11109 |
10935 // ------------------------------------------------------------------------ |
11110 // ------------------------------------------------------------------------ |
10936 // eap_am_type_tls_peap_symbian_c::query_ttls_pap_username_and_password() |
11111 // eap_am_type_tls_peap_symbian_c::query_ttls_pap_username_and_password() |
10937 // ------------------------------------------------------------------------ |
11112 // ------------------------------------------------------------------------ |
10938 // |
11113 // |
10939 EAP_FUNC_EXPORT eap_status_e |
11114 EAP_FUNC_EXPORT eap_status_e eap_am_type_tls_peap_symbian_c::query_ttls_pap_username_and_password( |
10940 eap_am_type_tls_peap_symbian_c::query_ttls_pap_username_and_password( |
|
10941 const eap_variable_data_c * const aInSrvChallengeUtf8 ) |
11115 const eap_variable_data_c * const aInSrvChallengeUtf8 ) |
10942 { |
11116 { |
10943 DEBUG( "eap_am_type_tls_peap_symbian_c::query_ttls_pap_username_and_password()" ); |
11117 EAP_TRACE_DEBUG_SYMBIAN((_L( "eap_am_type_tls_peap_symbian_c::query_ttls_pap_username_and_password()" ))); |
10944 |
11118 |
10945 eap_status_e status( eap_status_pending_request ); |
11119 eap_status_e status( eap_status_pending_request ); |
10946 |
11120 TEapExpandedType aEapType(*EapExpandedTypeTtlsPap.GetType()); |
10947 if ( !iEapTtlsPapActive ) |
11121 |
|
11122 m_notifier_data_to_user->iUsername.Zero(); |
|
11123 m_notifier_data_to_user->iPassword.Zero(); |
|
11124 m_notifier_data_to_user->iUidata.Zero(); |
|
11125 |
|
11126 if (aInSrvChallengeUtf8 != NULL) |
10948 { |
11127 { |
10949 TRAPD( err, iEapTtlsPapActive = CEapTtlsPapActive::NewL( |
11128 const TPtrC8 utf8( |
10950 this, m_am_tools ) ); |
11129 aInSrvChallengeUtf8->get_data(), aInSrvChallengeUtf8->get_data_length()*2); // Length in bytes |
10951 if ( err != KErrNone ) |
11130 |
10952 { |
11131 TPtr16 unicode(reinterpret_cast<unsigned short *>(&m_notifier_data_to_user->iUidata), m_notifier_data_to_user->iUidata.Size()); |
10953 DEBUG1( "eap_am_type_tls_peap_symbian_c::query_ttls_pap_username_and_password() \ |
11132 CnvUtfConverter::ConvertToUnicodeFromUtf8(unicode, utf8); |
10954 ERROR: CEapTtlsPapActive::NewL(), err=%d.", err ); |
11133 |
10955 return ConvertAmErrorToEapolError( err ); |
11134 m_state = EPapChallenge; |
10956 } |
11135 TEapExpandedType aEapType(*EapExpandedTypeTtlsPap.GetType()); |
10957 } |
11136 |
10958 if ( aInSrvChallengeUtf8 != NULL ) |
11137 if (iEapAuthNotifier == 0) |
10959 { |
11138 { |
10960 iEapTtlsPapActive->UpdateSrvChallenge( *aInSrvChallengeUtf8 ); |
11139 TRAPD(err, iEapAuthNotifier = CEapAuthNotifier::NewL( *this )); |
10961 } |
11140 if (err) |
10962 TBool startedOk = iEapTtlsPapActive->Start( |
11141 { |
10963 CEapTtlsPapActive::EEapTtlsPapActiveQueryUserNameAndPassword ); |
11142 return eap_status_process_general_error; |
10964 if ( !startedOk ) |
11143 } |
10965 { |
11144 } |
10966 status = eap_status_process_general_error; |
11145 TRAPD(err1, iEapAuthNotifier->StartL(CEapAuthNotifier::EEapNotifierTypePapChallengeReplyQueryDialog, m_notifier_data_to_user, aEapType)); |
10967 } |
11146 if (err1) |
10968 if ( status != eap_status_pending_request ) |
11147 { |
10969 { |
11148 return eap_status_process_general_error; |
10970 DEBUG( "eap_am_type_tls_peap_symbian_c::query_ttls_pap_username_and_password() \ |
11149 } |
10971 ERROR: status != eap_status_pending_request" ); |
11150 } |
10972 } |
11151 else |
|
11152 { |
|
11153 m_state = EPapUserNameAndPassword; |
|
11154 |
|
11155 TTtlsPapDbInfo aInDbInfo; |
|
11156 TRAPD(err2, ReadTtlsPapDbL(aInDbInfo)); |
|
11157 if (err2) |
|
11158 { |
|
11159 return eap_status_process_general_error; |
|
11160 } |
|
11161 |
|
11162 m_notifier_data_to_user->iPasswordPromptEnabled = aInDbInfo.iUsrPwdInfo.iPasswordPromptEnabled; |
|
11163 if (m_notifier_data_to_user->iPasswordPromptEnabled || |
|
11164 (aInDbInfo.iUsrPwdInfo.iUserName.Size() == 0 && |
|
11165 aInDbInfo.iUsrPwdInfo.iPassword.Size() == 0)) |
|
11166 { |
|
11167 m_notifier_data_to_user->iUsername.Zero(); |
|
11168 m_notifier_data_to_user->iPassword.Zero(); |
|
11169 TRAPD(err3,SetTtlsPapColumnToNullL( cf_str_EAP_TLS_PEAP_ttls_pap_password_literal )); |
|
11170 if (err3) |
|
11171 { |
|
11172 return eap_status_process_general_error; |
|
11173 } |
|
11174 |
|
11175 if (iEapAuthNotifier == 0) |
|
11176 { |
|
11177 TRAPD(err4, iEapAuthNotifier = CEapAuthNotifier::NewL( *this )); |
|
11178 if (err4) |
|
11179 { |
|
11180 return eap_status_process_general_error; |
|
11181 } |
|
11182 } |
|
11183 else |
|
11184 { |
|
11185 TRAPD(err5,iEapAuthNotifier->Cancel()); |
|
11186 if (err5) |
|
11187 { |
|
11188 return eap_status_process_general_error; |
|
11189 } |
|
11190 } |
|
11191 TRAPD(err6, iEapAuthNotifier->StartL(CEapAuthNotifier::EEapNotifierTypePapAuthQueryDialog, m_notifier_data_to_user, aEapType)); |
|
11192 if (err6) |
|
11193 { |
|
11194 return eap_status_process_general_error; |
|
11195 } |
|
11196 } |
|
11197 else |
|
11198 { |
|
11199 m_notifier_data_to_user->iUsername = aInDbInfo.iUsrPwdInfo.iUserName; |
|
11200 m_notifier_data_to_user->iPassword = aInDbInfo.iUsrPwdInfo.iPassword; |
|
11201 DlgComplete(KErrNone); |
|
11202 } |
|
11203 } |
|
11204 |
10973 return status; |
11205 return status; |
10974 } |
11206 } |
10975 |
11207 |
10976 // ================= TTLS-PAP public not exported ======================= |
11208 // ================= TTLS-PAP public not exported ======================= |
10977 |
11209 |
10978 // ------------------------------------------------------------------------ |
11210 // ------------------------------------------------------------------------ |
10979 // eap_am_type_tls_peap_symbian_c::verify_ttls_pap_username_and_password() |
11211 // eap_am_type_tls_peap_symbian_c::verify_ttls_pap_username_and_password() |
10980 // ------------------------------------------------------------------------ |
11212 // ------------------------------------------------------------------------ |
10981 // |
11213 // |
10982 eap_status_e |
11214 eap_status_e eap_am_type_tls_peap_symbian_c::verify_ttls_pap_username_and_password( |
10983 eap_am_type_tls_peap_symbian_c::verify_ttls_pap_username_and_password( |
|
10984 const eap_variable_data_c * const /*aUserName*/, |
11215 const eap_variable_data_c * const /*aUserName*/, |
10985 const eap_variable_data_c * const /*aUserPassword*/ ) |
11216 const eap_variable_data_c * const /*aUserPassword*/ ) |
10986 { |
11217 { |
10987 DEBUG( "eap_am_type_tls_peap_symbian_c::verify_ttls_pap_username_and_password()" ); |
11218 EAP_TRACE_DEBUG_SYMBIAN((_L( "eap_am_type_tls_peap_symbian_c::verify_ttls_pap_username_and_password()" ))); |
10988 return eap_status_not_supported; |
11219 return eap_status_not_supported; |
10989 } |
11220 } |
10990 |
11221 |
10991 // ================= TTLS-PAP public new ======================= |
11222 // ================= TTLS-PAP public new ======================= |
10992 |
11223 |
10993 // ------------------------------------------------------------------------ |
11224 // ------------------------------------------------------------------------ |
10994 // eap_am_type_tls_peap_symbian_c::CompleteQueryTtlsPapUserNameAndPassword() |
11225 // eap_am_type_tls_peap_symbian_c::CompleteQueryTtlsPapUserNameAndPassword() |
10995 // ------------------------------------------------------------------------ |
11226 // ------------------------------------------------------------------------ |
10996 // |
11227 // |
10997 eap_status_e |
11228 eap_status_e eap_am_type_tls_peap_symbian_c::CompleteQueryTtlsPapUserNameAndPassword( |
10998 eap_am_type_tls_peap_symbian_c::CompleteQueryTtlsPapUserNameAndPassword( |
|
10999 eap_status_e aStatus, |
11229 eap_status_e aStatus, |
11000 const TDesC8& aUserNameUtf8, |
11230 const TDesC8& aUserNameUtf8, |
11001 const TDesC8& aPasswordUtf8 ) |
11231 const TDesC8& aPasswordUtf8 ) |
11002 { |
11232 { |
11003 DEBUG( "eap_am_type_tls_peap_symbian_c::CompleteQueryTtlsPapUserNameAndPassword()" ); |
11233 EAP_TRACE_DEBUG_SYMBIAN((_L( "eap_am_type_tls_peap_symbian_c::CompleteQueryTtlsPapUserNameAndPassword()" ))); |
11004 |
11234 |
11005 eap_status_e retStatus = aStatus; |
11235 eap_status_e retStatus = aStatus; |
11006 eap_status_e tmpStatus = eap_status_ok; |
11236 eap_status_e tmpStatus = eap_status_ok; |
11007 |
11237 |
11008 eap_variable_data_c userNameUtf8( m_am_tools ); |
11238 eap_variable_data_c userNameUtf8( m_am_tools ); |
11020 { |
11250 { |
11021 retStatus = tmpStatus; |
11251 retStatus = tmpStatus; |
11022 } |
11252 } |
11023 if ( m_tls_am_partner == NULL ) |
11253 if ( m_tls_am_partner == NULL ) |
11024 { |
11254 { |
11025 DEBUG( "eap_am_type_tls_peap_symbian_c::CompleteQueryTtlsPapUserNameAndPassword() \ |
11255 EAP_TRACE_DEBUG_SYMBIAN((_L( "ERROR: eap_am_type_tls_peap_symbian_c::CompleteQueryTtlsPapUserNameAndPassword(): m_tls_am_partner is NULL." ))); |
11026 ERROR: m_tls_am_partner is NULL." ); |
|
11027 return eap_status_process_general_error; |
11256 return eap_status_process_general_error; |
11028 } |
11257 } |
11029 retStatus = m_tls_am_partner-> |
11258 retStatus = m_tls_am_partner-> |
11030 complete_query_ttls_pap_username_and_password( |
11259 complete_query_ttls_pap_username_and_password( |
11031 &userNameUtf8, &passwordUtf8, retStatus ); |
11260 &userNameUtf8, &passwordUtf8, retStatus ); |
11032 return retStatus; |
11261 return retStatus; |
11033 } // eap_am_type_tls_peap_symbian_c::CompleteQueryTtlsPapUserNameAndPassword( |
11262 } // eap_am_type_tls_peap_symbian_c::CompleteQueryTtlsPapUserNameAndPassword( |
11034 |
11263 |
11035 |
11264 |
11036 // ------------------------------------------------------------------------ |
11265 // ------------------------------------------------------------------------ |
11037 // eap_am_type_tls_peap_symbian_c::ConvertAmErrorToEapolError() |
11266 // eap_am_type_tls_peap_symbian_c::ConvertAmErrorToEapolError() |
11038 // ------------------------------------------------------------------------ |
11267 // ------------------------------------------------------------------------ |
11039 // |
11268 // |
11040 eap_status_e |
11269 eap_status_e |
11041 eap_am_type_tls_peap_symbian_c::ConvertAmErrorToEapolError( TInt aErr ) |
11270 eap_am_type_tls_peap_symbian_c::ConvertAmErrorToEapolError( TInt aErr ) |
11042 { |
11271 { |
11043 DEBUG( "eap_am_type_tls_peap_symbian_c::ConvertAmErrorToEapolError()" ); |
11272 EAP_TRACE_DEBUG_SYMBIAN((_L( "eap_am_type_tls_peap_symbian_c::ConvertAmErrorToEapolError()" ))); |
11044 if ( m_am_tools ) |
11273 if ( m_am_tools ) |
11045 { |
11274 { |
11046 return m_am_tools->convert_am_error_to_eapol_error( aErr ); |
11275 return m_am_tools->convert_am_error_to_eapol_error( aErr ); |
11047 } |
11276 } |
11048 return eap_status_process_general_error; |
11277 return eap_status_process_general_error; |
11049 } |
11278 } |
11050 |
11279 |
11051 |
11280 |
11052 // ------------------------------------------------------------------------ |
11281 // ------------------------------------------------------------------------ |
11053 // eap_am_type_tls_peap_symbian_c::ReadTtlsPapDbL() |
11282 // eap_am_type_tls_peap_symbian_c::ReadTtlsPapDbL() |
11054 // ------------------------------------------------------------------------ |
11283 // ------------------------------------------------------------------------ |
11128 //| EAP_TLS_PEAP_ttls_pap_password | VARCHAR(128) | cf_str_EAP_TLS_PEAP_ttls_pap_password_literal |// |
11357 //| EAP_TLS_PEAP_ttls_pap_password | VARCHAR(128) | cf_str_EAP_TLS_PEAP_ttls_pap_password_literal |// |
11129 //| EAP_TLS_PEAP_ttls_pap_max_session_validity_time | BIGINT | cf_str_EAP_TLS_PEAP_ttls_pap_max_session_validity_time_literal |// |
11358 //| EAP_TLS_PEAP_ttls_pap_max_session_validity_time | BIGINT | cf_str_EAP_TLS_PEAP_ttls_pap_max_session_validity_time_literal |// |
11130 //| EAP_TLS_PEAP_ttls_pap_last_full_authentication_time | BIGINT | KTTLSPAPLastFullAuthTime |// |
11359 //| EAP_TLS_PEAP_ttls_pap_last_full_authentication_time | BIGINT | KTTLSPAPLastFullAuthTime |// |
11131 void eap_am_type_tls_peap_symbian_c::WriteTtlsPapDbL( |
11360 void eap_am_type_tls_peap_symbian_c::WriteTtlsPapDbL( |
11132 const TTtlsPapDbInfo& aInDbInfo ) |
11361 const TTtlsPapDbInfo& aInDbInfo ) |
11133 { |
11362 { |
11134 DEBUG( "eap_am_type_tls_peap_symbian_c::WriteTtlsPapDbL()" ); |
11363 EAP_TRACE_DEBUG_SYMBIAN((_L( "eap_am_type_tls_peap_symbian_c::WriteTtlsPapDbL()" ))); |
11135 |
11364 |
11136 |
11365 |
11137 HBufC* buf = HBufC::NewLC( KMaxSqlQueryLength ); |
11366 HBufC* buf = HBufC::NewLC( KMaxSqlQueryLength ); |
11138 TPtr sqlStatement = buf->Des(); |
11367 TPtr sqlStatement = buf->Des(); |
11139 |
11368 |
11140 // Query all the relevant parameters |
11369 // Query all the relevant parameters |
11141 _LIT( KSQLQuery, |
11370 _LIT( KSQLQuery, |
11142 "SELECT %S, %S, %S, %S, %S FROM %S WHERE %S=%d AND %S=%d AND %S=%d" ); |
11371 "SELECT %S, %S, %S, %S, %S FROM %S WHERE %S=%d AND %S=%d AND %S=%d AND %S=%d" ); |
11143 sqlStatement.Format( KSQLQuery, |
11372 |
|
11373 sqlStatement.Format( |
|
11374 KSQLQuery, |
11144 &cf_str_EAP_TLS_PEAP_ttls_pap_password_prompt_literal, // select´ |
11375 &cf_str_EAP_TLS_PEAP_ttls_pap_password_prompt_literal, // select´ |
11145 &cf_str_EAP_TLS_PEAP_ttls_pap_username_literal, // select |
11376 &cf_str_EAP_TLS_PEAP_ttls_pap_username_literal, // select |
11146 &cf_str_EAP_TLS_PEAP_ttls_pap_password_literal, // select |
11377 &cf_str_EAP_TLS_PEAP_ttls_pap_password_literal, // select |
11147 &cf_str_EAP_TLS_PEAP_ttls_pap_max_session_validity_time_literal, // select |
11378 &cf_str_EAP_TLS_PEAP_ttls_pap_max_session_validity_time_literal, // select |
11148 &KTTLSPAPLastFullAuthTime, // select |
11379 &KTTLSPAPLastFullAuthTime, // select |
11149 &KTtlsDatabaseTableName, // from |
11380 &KTtlsDatabaseTableName, // from |
11150 &KServiceType, m_index_type, // where %S=%d |
11381 &KServiceType, |
11151 &KServiceIndex, m_index, // where %S=%d |
11382 m_index_type, |
11152 &KTunnelingType, m_tunneling_vendor_type ); // where %S=%d |
11383 &KServiceIndex, |
|
11384 m_index, |
|
11385 &KTunnelingTypeVendorId, |
|
11386 m_tunneling_type.get_vendor_id(), |
|
11387 &KTunnelingType, |
|
11388 m_tunneling_type.get_vendor_type()); |
11153 |
11389 |
11154 RDbView view; |
11390 RDbView view; |
11155 // Evaluate view |
11391 // Evaluate view |
11156 User::LeaveIfError( view.Prepare( m_database, TDbQuery( sqlStatement ) ) ); |
11392 User::LeaveIfError( view.Prepare( m_database, TDbQuery( sqlStatement ) ) ); |
11157 CleanupClosePushL( view ); |
11393 CleanupClosePushL( view ); |
11193 } |
11429 } |
11194 |
11430 |
11195 CleanupStack::PopAndDestroy( &view ); // Close view. |
11431 CleanupStack::PopAndDestroy( &view ); // Close view. |
11196 CleanupStack::PopAndDestroy( buf ); // Delete buf. |
11432 CleanupStack::PopAndDestroy( buf ); // Delete buf. |
11197 |
11433 |
11198 } // eap_am_type_tls_peap_symbian_c::WriteTtlsPapDbL() |
11434 } // eap_am_type_tls_peap_symbian_c::WriteTtlsPapDbL() |
11199 |
11435 |
11200 |
11436 |
11201 // ------------------------------------------------------------------------ |
11437 // ------------------------------------------------------------------------ |
11202 // eap_am_type_tls_peap_symbian_c::SetTtlsPapColumnToNullL |
11438 // eap_am_type_tls_peap_symbian_c::SetTtlsPapColumnToNullL |
11203 // ------------------------------------------------------------------------ |
11439 // ------------------------------------------------------------------------ |
11204 // |
11440 // |
11205 void eap_am_type_tls_peap_symbian_c::SetTtlsPapColumnToNullL( const TDesC& aColName ) |
11441 void eap_am_type_tls_peap_symbian_c::SetTtlsPapColumnToNullL( const TDesC& aColName ) |
11206 { |
11442 { |
11207 DEBUG( "eap_am_type_tls_peap_symbian_c::SetColumnNullL()" ); |
11443 EAP_TRACE_DEBUG_SYMBIAN((_L( "eap_am_type_tls_peap_symbian_c::SetColumnNullL()" ))); |
11208 |
11444 |
11209 HBufC* buf = HBufC::NewLC( KMaxSqlQueryLength ); |
11445 HBufC* buf = HBufC::NewLC( KMaxSqlQueryLength ); |
11210 TPtr sqlStatement = buf->Des(); |
11446 TPtr sqlStatement = buf->Des(); |
11211 |
11447 |
11212 // Query all the relevant parameters |
11448 // Query all the relevant parameters |
11213 _LIT( KSQLQuery, |
11449 _LIT( KSQLQuery, |
11214 "SELECT %S FROM %S WHERE %S=%d AND %S=%d AND %S=%d" ); |
11450 "SELECT %S FROM %S WHERE %S=%d AND %S=%d AND %S=%d AND %S=%d" ); |
11215 sqlStatement.Format( KSQLQuery, |
11451 |
|
11452 sqlStatement.Format( |
|
11453 KSQLQuery, |
11216 &aColName, // select´ |
11454 &aColName, // select´ |
11217 &KTtlsDatabaseTableName, // from |
11455 &KTtlsDatabaseTableName, // from |
11218 &KServiceType, m_index_type, // where %S=%d |
11456 &KServiceType, |
11219 &KServiceIndex, m_index, // where %S=%d |
11457 m_index_type, |
11220 &KTunnelingType, m_tunneling_vendor_type ); // where %S=%d |
11458 &KServiceIndex, |
|
11459 m_index, |
|
11460 &KTunnelingTypeVendorId, |
|
11461 m_tunneling_type.get_vendor_id(), |
|
11462 &KTunnelingType, |
|
11463 m_tunneling_type.get_vendor_type()); |
11221 |
11464 |
11222 RDbView view; |
11465 RDbView view; |
11223 // Evaluate view |
11466 // Evaluate view |
11224 User::LeaveIfError( view.Prepare( m_database, TDbQuery( sqlStatement ) ) ); |
11467 User::LeaveIfError( view.Prepare( m_database, TDbQuery( sqlStatement ) ) ); |
11225 CleanupClosePushL( view ); |
11468 CleanupClosePushL( view ); |
11243 } |
11486 } |
11244 |
11487 |
11245 CleanupStack::PopAndDestroy( &view ); // Close view. |
11488 CleanupStack::PopAndDestroy( &view ); // Close view. |
11246 CleanupStack::PopAndDestroy( buf ); // Delete buf. |
11489 CleanupStack::PopAndDestroy( buf ); // Delete buf. |
11247 |
11490 |
11248 } // eap_am_type_tls_peap_symbian_c::SetTtlsPapColumnToNullL() |
11491 } // eap_am_type_tls_peap_symbian_c::SetTtlsPapColumnToNullL() |
11249 |
11492 |
11250 |
11493 |
11251 // ================= TTLS-PAP private ======================= |
11494 // ================= TTLS-PAP private ======================= |
11252 |
11495 |
11253 // ------------------------------------------------------------------------ |
11496 // ------------------------------------------------------------------------ |
11254 // eap_am_type_tls_peap_symbian_c::IsTtlsPapSessionValidL() |
11497 // eap_am_type_tls_peap_symbian_c::IsTtlsPapSessionValidL() |
11255 // ------------------------------------------------------------------------ |
11498 // ------------------------------------------------------------------------ |
11256 // |
11499 // |
11257 TBool eap_am_type_tls_peap_symbian_c::IsTtlsPapSessionValidL() |
11500 TBool eap_am_type_tls_peap_symbian_c::IsTtlsPapSessionValidL() |
11258 { |
11501 { |
11259 DEBUG( "eap_am_type_tls_peap_symbian_c::IsTtlsPapSessionValidL()" ); |
11502 EAP_TRACE_DEBUG_SYMBIAN((_L( "eap_am_type_tls_peap_symbian_c::IsTtlsPapSessionValidL()" ))); |
11260 |
11503 |
11261 TTtlsPapDbInfo dbInfo; |
11504 TTtlsPapDbInfo dbInfo; |
11262 TInt err = KErrNone; |
11505 TInt err = KErrNone; |
11263 TBool retValue = EFalse; |
11506 TBool retValue = EFalse; |
11264 |
11507 |
11265 TRAP( err, ReadTtlsPapDbL( dbInfo ) ); |
11508 TRAP( err, ReadTtlsPapDbL( dbInfo ) ); |
11266 |
11509 |
11267 if ( err != KErrNone ) |
11510 if ( err != KErrNone ) |
11268 { |
11511 { |
11269 DEBUG1( "eap_am_type_tls_peap_symbian_c::IsTtlsPapSessionValidL() ERROR: \ |
11512 EAP_TRACE_DEBUG_SYMBIAN((_L("ERROR: eap_am_type_tls_peap_symbian_c::IsTtlsPapSessionValidL(): Leave happened, err=%d."), err )); |
11270 Leave happened, err=%d.", err ); |
|
11271 retValue = EFalse; |
11513 retValue = EFalse; |
11272 } |
11514 } |
11273 else |
11515 else |
11274 { |
11516 { |
11275 if ( dbInfo.iUsrPwdInfo.iPasswordPromptEnabled ) |
11517 if ( dbInfo.iUsrPwdInfo.iPasswordPromptEnabled ) |
11276 { |
11518 { |
11277 // If the max session time from DB is zero then we use the |
11519 // If the max session time from DB is zero then we use the |
11278 // one read from configuration file. |
11520 // one read from configuration file. |
11279 if( dbInfo.iMaxSessionTime == 0 ) |
11521 if( dbInfo.iMaxSessionTime == 0 ) |
11280 { |
11522 { |
11281 DEBUG( "eap_am_type_tls_peap_symbian_c::IsTtlsPapSessionValidL() \ |
11523 EAP_TRACE_DEBUG_SYMBIAN((_L( "eap_am_type_tls_peap_symbian_c::IsTtlsPapSessionValidL() Using max TTLS PAP session validity time from config file." ))); |
11282 Using max TTLS PAP session validity time from config file." ); |
|
11283 |
11524 |
11284 // use value from config file |
11525 // use value from config file |
11285 dbInfo.iMaxSessionTime = iEapTtlsPapMaxSessionConfigTime; |
11526 dbInfo.iMaxSessionTime = iEapTtlsPapMaxSessionConfigTime; |
11286 } |
11527 } |
11287 |
11528 |
11288 retValue = CheckTtlsPapSessionValidity( dbInfo.iMaxSessionTime, |
11529 retValue = CheckTtlsPapSessionValidity( dbInfo.iMaxSessionTime, |
11289 dbInfo.iLastFullAuthTime ); |
11530 dbInfo.iLastFullAuthTime ); |
11290 } |
11531 } |
11291 } |
11532 } |
11292 return retValue; |
11533 return retValue; |
11293 } // eap_am_type_tls_peap_symbian_c::IsTtlsPapSessionValidL() |
11534 } // eap_am_type_tls_peap_symbian_c::IsTtlsPapSessionValidL() |
11294 |
11535 |
11295 |
11536 |
11296 // ------------------------------------------------------------------------ |
11537 // ------------------------------------------------------------------------ |
11297 // eap_am_type_tls_peap_symbian_c::CheckTtlsPapSessionValidity() |
11538 // eap_am_type_tls_peap_symbian_c::CheckTtlsPapSessionValidity() |
11298 // ------------------------------------------------------------------------ |
11539 // ------------------------------------------------------------------------ |
11299 // |
11540 // |
11300 TBool eap_am_type_tls_peap_symbian_c::CheckTtlsPapSessionValidity( |
11541 TBool eap_am_type_tls_peap_symbian_c::CheckTtlsPapSessionValidity( |
11301 const TInt64& aInMaxSessionTime, |
11542 const TInt64& aInMaxSessionTime, |
11302 const TInt64& aInLastFullAuthTime ) |
11543 const TInt64& aInLastFullAuthTime ) |
11303 { |
11544 { |
11304 DEBUG( "eap_am_type_tls_peap_symbian_c::CheckTtlsPapSessionValidity()" ); |
11545 EAP_TRACE_DEBUG_SYMBIAN((_L( "eap_am_type_tls_peap_symbian_c::CheckTtlsPapSessionValidity()" ))); |
11305 |
11546 |
11306 // Get the current time. |
11547 // Get the current time. |
11307 TTime currentTime; |
11548 TTime currentTime; |
11308 currentTime.UniversalTime(); |
11549 currentTime.UniversalTime(); |
11309 |
11550 |
11369 ( EAPL( "eap_am_type_tls_peap_symbian_c::CheckTtlsPapSessionValidity - Session NOT Valid \n" ) ) ); |
11610 ( EAPL( "eap_am_type_tls_peap_symbian_c::CheckTtlsPapSessionValidity - Session NOT Valid \n" ) ) ); |
11370 EAP_TRACE_END( m_am_tools, TRACE_FLAGS_DEFAULT ); |
11611 EAP_TRACE_END( m_am_tools, TRACE_FLAGS_DEFAULT ); |
11371 |
11612 |
11372 return EFalse; |
11613 return EFalse; |
11373 } |
11614 } |
11374 } // eap_am_type_tls_peap_symbian_c::CheckTtlsPapSessionValidity |
11615 } // eap_am_type_tls_peap_symbian_c::CheckTtlsPapSessionValidity |
11375 |
11616 |
|
11617 //-------------------------------------------------- |
|
11618 #if defined(USE_FAST_EAP_TYPE) |
|
11619 |
|
11620 TInt eap_am_type_tls_peap_symbian_c::CreateMMETelConnectionL() |
|
11621 { |
|
11622 EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
11623 EAP_TRACE_DEBUG(m_am_tools, TRACE_FLAGS_DEFAULT, (EAPL("Creating MMETel connection.\n"))); |
|
11624 |
|
11625 TInt errorCode = KErrNone; |
|
11626 |
|
11627 // MMETel need to be connected only once. |
|
11628 if( !iMMETELConnectionStatus ) |
|
11629 { |
|
11630 RTelServer::TPhoneInfo phoneInfo; |
|
11631 TInt phoneCount = 0; |
|
11632 |
|
11633 // Connect to ETel server |
|
11634 User::LeaveIfError( iServer.Connect() ); |
|
11635 |
|
11636 EAP_TRACE_DEBUG(m_am_tools, TRACE_FLAGS_DEFAULT, (EAPL("Connected to ETel server.\n"))); |
|
11637 |
|
11638 // This function loads an ETel TSY module, mmtsy. |
|
11639 errorCode = iServer.LoadPhoneModule( KMmTsyModuleName ); |
|
11640 |
|
11641 EAP_TRACE_DEBUG(m_am_tools, TRACE_FLAGS_DEFAULT, (EAPL("Loaded phone module.\n"))); |
|
11642 |
|
11643 if ( errorCode != KErrNone && errorCode != KErrAlreadyExists ) |
|
11644 { |
|
11645 User::Leave( errorCode ); |
|
11646 } |
|
11647 |
|
11648 iServer.SetExtendedErrorGranularity( RTelServer::EErrorExtended ); |
|
11649 |
|
11650 // This function retrieves the total number of phones supported by all |
|
11651 // the currently loaded ETel (TSY) modules. |
|
11652 User::LeaveIfError( iServer.EnumeratePhones( phoneCount ) ); |
|
11653 |
|
11654 EAP_TRACE_DEBUG(m_am_tools, TRACE_FLAGS_DEFAULT, (EAPL("Number of phones supported by the loaded ETel = %d.\n"), phoneCount)); |
|
11655 |
|
11656 // This function retrieves information associated with the specified phone |
|
11657 while ( ( phoneCount-- ) && ( phoneInfo.iName != KMmTsyPhoneName ) ) |
|
11658 { |
|
11659 User::LeaveIfError( iServer.GetPhoneInfo( phoneCount, phoneInfo ) ); |
|
11660 |
|
11661 EAP_TRACE_DEBUG(m_am_tools, TRACE_FLAGS_DEFAULT, (EAPL("Got phone info.\n"))); |
|
11662 } |
|
11663 |
|
11664 // This function opens a phone subsession by name. ("DefaultPhone"). |
|
11665 User::LeaveIfError( iPhone.Open( iServer, phoneInfo.iName ) ); |
|
11666 |
|
11667 EAP_TRACE_DEBUG(m_am_tools, TRACE_FLAGS_DEFAULT, (EAPL("Opened phone subsession.\n"))); |
|
11668 |
|
11669 // MMETel connected and the phone module loaded fine. |
|
11670 iMMETELConnectionStatus = ETrue; |
|
11671 } |
|
11672 else |
|
11673 { |
|
11674 // MMETel already connected. |
|
11675 EAP_TRACE_DEBUG(m_am_tools, TRACE_FLAGS_DEFAULT, (EAPL("MMETel connected once already.\n"))); |
|
11676 } |
|
11677 |
|
11678 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
11679 |
|
11680 return errorCode; |
|
11681 } |
|
11682 |
|
11683 //-------------------------------------------------- |
|
11684 |
|
11685 void eap_am_type_tls_peap_symbian_c::DisconnectMMETel() |
|
11686 { |
|
11687 if( iMMETELConnectionStatus ) |
|
11688 { |
|
11689 EAP_TRACE_DEBUG(m_am_tools, TRACE_FLAGS_DEFAULT, (EAPL("Closing RMobilePhone and MMETEL.\n"))); |
|
11690 |
|
11691 iPhone.Close(); |
|
11692 iServer.Close(); // Phone module is unloaded automatically when RTelServer session is closed |
|
11693 |
|
11694 iMMETELConnectionStatus = EFalse; |
|
11695 } |
|
11696 else |
|
11697 { |
|
11698 EAP_TRACE_DEBUG(m_am_tools, TRACE_FLAGS_DEFAULT, (EAPL("RMobilePhone and MMETEL already closed.\n"))); |
|
11699 } |
|
11700 } |
|
11701 #endif |
|
11702 //-------------------------------------------------- |
11376 |
11703 |
11377 // End of file. |
11704 // End of file. |