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 #include <utf.h> |
68 |
69 |
69 #include "eap_ttls_pap_active.h" |
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 |
76 #include "eap_header_string.h" |
77 #include "eap_header_string.h" |
|
78 #endif //#ifdef USE_EAP_EXPANDED_TYPES |
77 |
79 |
78 #if defined(USE_EAP_CONFIGURATION_TO_SKIP_USER_INTERACTIONS) |
80 #if defined(USE_EAP_CONFIGURATION_TO_SKIP_USER_INTERACTIONS) |
79 #include "eap_config.h" |
81 #include "eap_config.h" |
80 #include "eap_file_config.h" |
82 #include "eap_file_config.h" |
81 #include "eap_am_file_input_symbian.h" |
83 #include "eap_am_file_input_symbian.h" |
82 #endif |
84 #endif |
83 |
|
84 #include "EapConfigToolsSymbian.h" |
|
85 #include "EapConversion.h" |
|
86 #include "EapPluginTools.h" |
|
87 |
|
88 #include <mmtsy_names.h> |
|
89 |
|
90 |
85 |
91 const TUint KMaxSqlQueryLength = 512; |
86 const TUint KMaxSqlQueryLength = 512; |
92 const TUint KMaxDBFieldNameLength = 255; |
87 const TUint KMaxDBFieldNameLength = 255; |
93 const TUint KDSASignatureLength = 40; |
88 const TUint KDSASignatureLength = 40; |
94 const TInt KDefaultColumnInView_One = 1; // For DB view. |
89 const TInt KDefaultColumnInView_One = 1; // For DB view. |
95 const TInt KMicroSecsInASecond = 1000000; // 1000000 micro seconds is 1 second. |
90 const TInt KMicroSecsInASecond = 1000000; // 1000000 micro seconds is 1 second. |
96 |
91 |
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 |
|
104 /** |
92 /** |
105 * Length of the MAC address |
93 * Length of the MAC address |
106 */ |
94 */ |
107 #ifdef USE_FAST_EAP_TYPE |
95 #ifdef USE_FAST_EAP_TYPE |
108 const TUint8 KMacAddressLength = 6; |
96 const TUint8 KMacAddressLength = 6; |
109 #endif |
97 #endif |
110 |
|
111 //-------------------------------------------------- |
98 //-------------------------------------------------- |
112 |
99 |
113 eap_am_type_tls_peap_symbian_c::eap_am_type_tls_peap_symbian_c( |
100 eap_am_type_tls_peap_symbian_c::eap_am_type_tls_peap_symbian_c( |
114 abs_eap_am_tools_c * const aTools, |
101 abs_eap_am_tools_c * const aTools, |
115 abs_eap_base_type_c * const aPartner, |
102 abs_eap_base_type_c * const aPartner, |
187 , m_references_and_data_blocks(aTools) |
174 , m_references_and_data_blocks(aTools) |
188 , m_new_references_and_data_blocks(aTools) |
175 , m_new_references_and_data_blocks(aTools) |
189 , m_ready_references_and_data_blocks(aTools) |
176 , m_ready_references_and_data_blocks(aTools) |
190 , m_serv_unauth_prov_mode(false) |
177 , m_serv_unauth_prov_mode(false) |
191 , m_serv_auth_prov_mode(false) |
178 , m_serv_auth_prov_mode(false) |
192 |
179 , m_is_notifier_connected(false) |
193 , m_notifier_data_to_user(NULL) |
180 , m_notifier_data_to_user(NULL) |
194 , m_notifier_data_pckg_to_user(NULL) |
181 , m_notifier_data_pckg_to_user(NULL) |
195 |
182 , m_notifier_data_from_user(NULL) |
196 , iMMETELConnectionStatus(false) |
183 , m_notifier_data_pckg_from_user(NULL) |
197 , m_completed_with_zero(false) |
184 , m_completed_with_zero(false) |
198 , m_verificationStatus(false) |
185 , m_verificationStatus(false) |
199 , m_pacStorePWBuf8(0) |
|
200 , m_userAction(EEapFastNotifierUserActionOk) |
|
201 , m_pacStoreDataRefType(eap_pac_store_data_type_none) |
|
202 , m_data_reference(m_am_tools) |
186 , m_data_reference(m_am_tools) |
|
187 , m_notifier_complete(false) |
203 , m_userResponse(m_am_tools) |
188 , m_userResponse(m_am_tools) |
204 , m_pending_operation(eap_fast_pac_store_pending_operation_none) |
|
205 , m_both_completed(0) |
189 , m_both_completed(0) |
206 , m_both_asked(0) |
190 , 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) |
|
211 #endif //#if defined(USE_FAST_EAP_TYPE) |
191 #endif //#if defined(USE_FAST_EAP_TYPE) |
212 |
|
213 , m_notifier_complete(false) |
|
214 |
192 |
215 #ifdef USE_PAC_STORE |
193 #ifdef USE_PAC_STORE |
216 ,iPacStoreDb(NULL) |
194 ,iPacStoreDb(NULL) |
217 #endif |
195 #endif |
218 |
196 |
219 #ifdef USE_EAP_CONFIGURATION_TO_SKIP_USER_INTERACTIONS |
197 #ifdef USE_EAP_CONFIGURATION_TO_SKIP_USER_INTERACTIONS |
220 , m_skip_user_interactions(false) |
198 , m_skip_user_interactions(false) |
221 , m_fileconfig(0) |
199 , m_fileconfig(0) |
222 #endif |
200 #endif |
223 |
201 |
224 , iEapTtlsPapMaxSessionConfigTime( 0 ) |
202 |
225 |
203 |
226 |
204 , iEapTtlsPapMaxSessionConfigTime( 0 ) |
227 |
205 , iEapTtlsPapActive( NULL ) |
228 , iPacStoreDeviceSeed(0) |
206 |
229 |
|
230 , iEapAuthNotifier(0) |
|
231 |
|
232 { |
207 { |
233 EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT); |
208 EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT); |
234 |
209 |
|
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 |
235 // Set the database table name based on the type |
222 // Set the database table name based on the type |
236 if (m_current_eap_type == eap_type_tls) |
223 switch (m_current_eap_vendor_type) |
237 { |
224 { |
238 m_db_table_name = KTlsDatabaseTableName; |
225 case eap_type_tls: |
239 m_db_user_cert_table_name = KTlsAllowedUserCertsDatabaseTableName; |
226 m_db_table_name = KTlsDatabaseTableName; |
240 m_db_ca_cert_table_name = KTlsAllowedCACertsDatabaseTableName; |
227 m_db_user_cert_table_name = KTlsAllowedUserCertsDatabaseTableName; |
241 m_db_cipher_suite_table_name = KTlsAllowedCipherSuitesDatabaseTableName; |
228 m_db_ca_cert_table_name = KTlsAllowedCACertsDatabaseTableName; |
242 m_db_name = KTlsDatabaseName; |
229 m_db_cipher_suite_table_name = KTlsAllowedCipherSuitesDatabaseTableName; |
243 } |
230 m_db_name = KTlsDatabaseName; |
244 else if (m_current_eap_type == eap_type_peap) |
231 break; |
245 { |
232 |
246 m_db_table_name = KPeapDatabaseTableName; |
233 case eap_type_peap: |
247 m_db_user_cert_table_name = KPeapAllowedUserCertsDatabaseTableName; |
234 m_db_table_name = KPeapDatabaseTableName; |
248 m_db_ca_cert_table_name = KPeapAllowedCACertsDatabaseTableName; |
235 m_db_user_cert_table_name = KPeapAllowedUserCertsDatabaseTableName; |
249 m_db_cipher_suite_table_name = KPeapAllowedCipherSuitesDatabaseTableName; |
236 m_db_ca_cert_table_name = KPeapAllowedCACertsDatabaseTableName; |
250 m_db_name = KPeapDatabaseName; |
237 m_db_cipher_suite_table_name = KPeapAllowedCipherSuitesDatabaseTableName; |
251 } |
238 m_db_name = KPeapDatabaseName; |
252 else if (m_current_eap_type == eap_expanded_type_ttls_plain_pap.get_type() |
239 break; |
253 || m_current_eap_type == eap_type_ttls) |
240 |
254 { |
241 case eap_type_ttls_plain_pap: |
255 m_db_table_name = KTtlsDatabaseTableName; |
242 // use the same case as for eap_type_ttls; |
256 m_db_user_cert_table_name = KTtlsAllowedUserCertsDatabaseTableName; |
243 // break is not needed |
257 m_db_ca_cert_table_name = KTtlsAllowedCACertsDatabaseTableName; |
244 |
258 m_db_cipher_suite_table_name = KTtlsAllowedCipherSuitesDatabaseTableName; |
245 case eap_type_ttls: |
259 m_db_name = KTtlsDatabaseName; |
246 m_db_table_name = KTtlsDatabaseTableName; |
260 } |
247 m_db_user_cert_table_name = KTtlsAllowedUserCertsDatabaseTableName; |
|
248 m_db_ca_cert_table_name = KTtlsAllowedCACertsDatabaseTableName; |
|
249 m_db_cipher_suite_table_name = KTtlsAllowedCipherSuitesDatabaseTableName; |
|
250 m_db_name = KTtlsDatabaseName; |
|
251 break; |
261 |
252 |
262 #if defined (USE_FAST_EAP_TYPE) |
253 #if defined (USE_FAST_EAP_TYPE) |
263 else if (m_current_eap_type == eap_type_fast) |
254 case eap_type_fast: |
264 { |
255 m_db_table_name = KFastGeneralSettingsDBTableName; // General settings |
265 m_db_table_name = KFastGeneralSettingsDBTableName; // General settings |
256 m_db_fast_special_table_name = KFastSpecialSettingsDBTableName; // Special settings for only FAST |
266 m_db_fast_special_table_name = KFastSpecialSettingsDBTableName; // Special settings for only FAST |
257 m_db_user_cert_table_name = KFastAllowedUserCertsDatabaseTableName; |
267 m_db_user_cert_table_name = KFastAllowedUserCertsDatabaseTableName; |
258 m_db_ca_cert_table_name = KFastAllowedCACertsDatabaseTableName; |
268 m_db_ca_cert_table_name = KFastAllowedCACertsDatabaseTableName; |
259 m_db_cipher_suite_table_name = KFastAllowedCipherSuitesDatabaseTableName; |
269 m_db_cipher_suite_table_name = KFastAllowedCipherSuitesDatabaseTableName; |
260 m_db_name = KFastDatabaseName; |
270 m_db_name = KFastDatabaseName; |
261 break; |
271 } |
|
272 #endif // #if defined (USE_FAST_EAP_TYPE) |
262 #endif // #if defined (USE_FAST_EAP_TYPE) |
273 else |
263 default: |
274 { |
264 { |
275 // Unsupported type |
265 // Unsupported type |
276 // Should never happen |
266 // Should never happen |
277 EAP_TRACE_ERROR(m_am_tools, |
267 EAP_TRACE_ERROR(m_am_tools, |
278 TRACE_FLAGS_DEFAULT, |
268 TRACE_FLAGS_DEFAULT, ( |
279 (EAPL("Unsupported EAP type, m_current_eap_vendor_type=0xfe%06x%08x\n"), |
269 EAPL("Unsupported EAP type, m_current_eap_vendor_type=%d \n"), |
280 m_current_eap_type.get_vendor_id(), |
270 m_current_eap_vendor_type)); |
281 m_current_eap_type.get_vendor_type())); |
271 |
282 |
272 return; |
283 return; |
273 } |
284 } |
274 } |
285 |
275 |
286 if (receive_network_id != 0 |
276 if (receive_network_id != 0 |
287 && receive_network_id->get_is_valid_data() == true) |
277 && receive_network_id->get_is_valid_data() == true) |
288 { |
278 { |
456 |
480 |
457 m_partner->cancel_timer( |
481 m_partner->cancel_timer( |
458 this, |
482 this, |
459 KHandleReadPacstoreTimerID); |
483 KHandleReadPacstoreTimerID); |
460 |
484 |
461 m_partner->cancel_timer( |
|
462 this, |
|
463 KHandleCompletePacstoreNokTimerID); |
|
464 |
|
465 m_partner->cancel_timer( |
|
466 this, |
|
467 KHandleCompletePacstoreOkTimerID); |
|
468 |
|
469 #endif |
|
470 EAP_TRACE_DEBUG_SYMBIAN( |
485 EAP_TRACE_DEBUG_SYMBIAN( |
471 (_L(" eap_am_type_tls_peap_symbian_c::shutdown - Timers canceled"))); |
486 (_L(" eap_am_type_tls_peap_symbian_c::shutdown - Timers canceled"))); |
472 } |
487 } |
473 |
488 |
474 #if defined(USE_FAST_EAP_TYPE) |
489 if ( iEapFastActiveWaitNote ) |
475 |
490 { |
|
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 } |
476 #endif // #if defined(USE_FAST_EAP_TYPE) |
508 #endif // #if defined(USE_FAST_EAP_TYPE) |
477 |
509 |
478 |
510 |
479 m_allowed_server_certs.ResetAndDestroy(); |
511 m_allowed_server_certs.Reset(); |
480 m_allowed_ca_certs.ResetAndDestroy(); |
512 m_allowed_ca_certs.Close(); |
481 m_allowed_cipher_suites.Close(); |
513 m_allowed_cipher_suites.Close(); |
482 m_allowed_user_certs.ResetAndDestroy(); |
514 m_allowed_user_certs.Reset(); |
483 |
515 |
484 #ifdef USE_PAC_STORE |
516 #ifdef USE_PAC_STORE |
485 #ifdef USE_FAST_EAP_TYPE |
517 #ifdef USE_FAST_EAP_TYPE |
486 |
518 |
487 if(m_current_eap_type == eap_type_fast && iPacStoreDb != NULL) |
519 if(m_current_eap_type == eap_type_fast && iPacStoreDb != NULL) |
488 { |
520 { |
489 iPacStoreDb->Close(); |
521 iPacStoreDb->Close(); |
490 } |
522 } |
491 |
523 |
492 m_info_array.ResetAndDestroy(); |
524 TInt count=0; |
|
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(); |
493 |
531 |
494 EAP_TRACE_DEBUG_SYMBIAN( |
532 EAP_TRACE_DEBUG_SYMBIAN( |
495 (_L(" eap_am_type_tls_peap_symbian_c::shutdown - Arrays cleared"))); |
533 (_L(" eap_am_type_tls_peap_symbian_c::shutdown - Arrays cleared"))); |
496 |
534 |
497 #endif // End: #ifdef USE_FAST_EAP_TYPE |
535 #endif // End: #ifdef USE_FAST_EAP_TYPE |
530 EAP_ASSERT(m_shutdown_was_called == true); |
569 EAP_ASSERT(m_shutdown_was_called == true); |
531 |
570 |
532 m_database.Close(); |
571 m_database.Close(); |
533 m_session.Close(); |
572 m_session.Close(); |
534 |
573 |
535 delete m_notifier_data_to_user; |
574 #ifdef USE_FAST_EAP_TYPE |
536 delete m_notifier_data_pckg_to_user; |
575 |
|
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 |
537 |
585 |
538 delete m_cert_if; |
586 delete m_cert_if; |
539 |
587 |
540 delete m_ca_certificate; |
588 delete m_ca_certificate; |
541 delete m_own_certificate; |
589 delete m_own_certificate; |
542 delete m_peer_certificate; |
590 delete m_peer_certificate; |
|
591 delete m_identity_info; |
|
592 |
|
593 #ifdef USE_EAP_EXPANDED_TYPES |
543 |
594 |
544 m_enabled_tunneling_exp_eap_array.ResetAndDestroy(); |
595 m_enabled_tunneling_exp_eap_array.ResetAndDestroy(); |
545 m_disabled_tunneling_exp_eap_array.ResetAndDestroy(); |
596 m_disabled_tunneling_exp_eap_array.ResetAndDestroy(); |
546 |
597 |
547 EAP_TRACE_DEBUG( |
598 EAP_TRACE_DEBUG( |
548 m_am_tools, |
599 m_am_tools, |
549 TRACE_FLAGS_DEFAULT, |
600 TRACE_FLAGS_DEFAULT, |
550 (EAPL("eap_am_type_tls_peap_symbian_c::~eap_am_type_tls_peap_symbian_c() tunneling done.\n"))); |
601 (EAPL("eap_am_type_tls_peap_symbian_c::~eap_am_type_tls_peap_symbian_c() tunneling done.\n"))); |
551 |
602 |
|
603 #else |
|
604 |
|
605 m_iap_eap_array.ResetAndDestroy(); |
|
606 |
|
607 #endif // #ifdef USE_EAP_EXPANDED_TYPES |
|
608 |
552 #ifdef USE_PAC_STORE |
609 #ifdef USE_PAC_STORE |
553 |
610 |
554 delete iPacStoreDb; |
611 delete iPacStoreDb; |
555 |
612 |
556 #endif // #ifdef USE_PAC_STORE |
613 #endif // End: #ifdef USE_PAC_STORE |
557 |
614 |
558 delete iEapAuthNotifier; |
|
559 iEapAuthNotifier = 0; |
|
560 |
|
561 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
615 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
562 } |
616 } |
563 //-------------------------------------------------- |
617 //-------------------------------------------------- |
564 |
618 |
565 EAP_FUNC_EXPORT void eap_am_type_tls_peap_symbian_c::DlgComplete( TInt aStatus ) |
|
566 { |
|
567 EAP_TRACE_DEBUG( |
|
568 m_am_tools, |
|
569 TRACE_FLAGS_DEFAULT, |
|
570 (EAPL("TLS: function: eap_am_type_tls_peap_symbian_c::DlgComplete(): m_notifier_complete=%d, m_state=%d\n"), |
|
571 m_notifier_complete, |
|
572 m_state)); |
|
573 |
|
574 EAP_TRACE_RETURN_STRING(m_am_tools, "returns: eap_am_type_tls_peap_symbian_c::DlgComplete()"); |
|
575 |
|
576 #ifdef USE_FAST_EAP_TYPE |
|
577 m_userAction = EEapFastNotifierUserActionOk; |
|
578 #endif |
|
579 |
|
580 eap_status_e status = m_am_tools->convert_am_error_to_eapol_error(aStatus); |
|
581 |
|
582 if(m_notifier_complete) |
|
583 { |
|
584 EAP_TRACE_DATA_DEBUG( |
|
585 m_am_tools, |
|
586 TRACE_FLAGS_DEFAULT, |
|
587 (EAPL( "m_notifier_data_pckg_to_user" ), |
|
588 m_notifier_data_pckg_to_user->Ptr(), |
|
589 m_notifier_data_pckg_to_user->Size() ) ); |
|
590 |
|
591 if ( aStatus == KErrCancel ) |
|
592 { |
|
593 EAP_TRACE_DEBUG( |
|
594 m_am_tools, |
|
595 TRACE_FLAGS_DEFAULT, |
|
596 (EAPL("TLS: function: eap_am_type_tls_peap_symbian_c::DlgComplete(): User cancelled the dialog\n"))); |
|
597 |
|
598 #ifdef USE_FAST_EAP_TYPE |
|
599 m_userAction = EEapFastNotifierUserActionCancel; |
|
600 #endif |
|
601 } |
|
602 else if( aStatus != KErrNone ) |
|
603 { |
|
604 EAP_TRACE_DEBUG( |
|
605 m_am_tools, |
|
606 TRACE_FLAGS_DEFAULT, |
|
607 (EAPL("ERROR: TLS: function: eap_am_type_tls_peap_symbian_c::DlgComplete(): dialog error=%d\n"), |
|
608 aStatus)); |
|
609 |
|
610 TBuf8<KMaxNotifItemLength> userNameUtf8; |
|
611 TBuf8<KMaxUiDataLength> challengeUtf8; |
|
612 userNameUtf8.Zero(); |
|
613 challengeUtf8.Zero(); |
|
614 |
|
615 CompleteQueryTtlsPapUserNameAndPassword( |
|
616 status, userNameUtf8, challengeUtf8 ); |
|
617 |
|
618 return; // m_am_tools->convert_am_error_to_eapol_error(aStatus); |
|
619 } |
|
620 |
|
621 if ( m_notifier_data_to_user->iPassword.Size() > 0 ) |
|
622 { |
|
623 HBufC8* notifier_data8 = NULL; |
|
624 TRAPD(err, notifier_data8 = HBufC8::NewL(m_notifier_data_to_user->iPassword.Size())); |
|
625 if (err) |
|
626 { |
|
627 return; |
|
628 } |
|
629 TPtr8 notifier_dataPtr8 = notifier_data8->Des(); |
|
630 |
|
631 notifier_dataPtr8.Copy(m_notifier_data_to_user->iPassword); // Unicode -> ascii. |
|
632 |
|
633 EAP_TRACE_DATA_DEBUG( |
|
634 m_am_tools, |
|
635 TRACE_FLAGS_DEFAULT, |
|
636 (EAPL( "eap_am_type_tls_peap_symbian_c::DlgComplete PW from UI (8bits)" ), |
|
637 notifier_dataPtr8.Ptr(), |
|
638 notifier_dataPtr8.Size() ) ); |
|
639 |
|
640 #ifdef USE_FAST_EAP_TYPE |
|
641 status = m_userResponse.set_copy_of_buffer( |
|
642 notifier_dataPtr8.Ptr(), |
|
643 notifier_dataPtr8.Size()); |
|
644 #endif |
|
645 CleanupStack::PopAndDestroy( notifier_data8 ); |
|
646 } |
|
647 } |
|
648 |
|
649 m_notifier_complete = 0; |
|
650 |
|
651 if ( m_state == EPapChallenge) |
|
652 { |
|
653 EAP_TRACE_DEBUG( |
|
654 m_am_tools, |
|
655 TRACE_FLAGS_DEFAULT, |
|
656 (EAPL("TLS: function: eap_am_type_tls_peap_symbian_c::DlgComplete(): EPapChallenge\n"))); |
|
657 |
|
658 m_state = EPapUserNameAndPassword; |
|
659 TEapExpandedType aEapType(*EapExpandedTypeTtlsPap.GetType()); |
|
660 |
|
661 if (iEapAuthNotifier == 0) |
|
662 { |
|
663 TRAPD(err, iEapAuthNotifier = CEapAuthNotifier::NewL( *this )); |
|
664 if (err) |
|
665 { |
|
666 eap_variable_data_c userNameUtf8( m_am_tools ); |
|
667 eap_variable_data_c passwordUtf8( m_am_tools ); |
|
668 |
|
669 (void) m_tls_am_partner-> |
|
670 complete_query_ttls_pap_username_and_password( |
|
671 &userNameUtf8, &passwordUtf8, eap_status_process_general_error); |
|
672 return; |
|
673 } |
|
674 } |
|
675 |
|
676 |
|
677 TTtlsPapDbInfo aInDbInfo; |
|
678 TRAPD(err2, ReadTtlsPapDbL(aInDbInfo)); |
|
679 if (err2) |
|
680 { |
|
681 eap_variable_data_c userNameUtf8( m_am_tools ); |
|
682 eap_variable_data_c passwordUtf8( m_am_tools ); |
|
683 |
|
684 (void) m_tls_am_partner-> |
|
685 complete_query_ttls_pap_username_and_password( |
|
686 &userNameUtf8, &passwordUtf8, eap_status_process_general_error); |
|
687 return; |
|
688 } |
|
689 |
|
690 m_notifier_data_to_user->iPasswordPromptEnabled = aInDbInfo.iUsrPwdInfo.iPasswordPromptEnabled; |
|
691 |
|
692 if (m_notifier_data_to_user->iPasswordPromptEnabled || |
|
693 (aInDbInfo.iUsrPwdInfo.iUserName.Size() == 0 && |
|
694 aInDbInfo.iUsrPwdInfo.iPassword.Size() == 0)) |
|
695 { |
|
696 m_notifier_data_to_user->iUsername.Zero(); |
|
697 m_notifier_data_to_user->iPassword.Zero(); |
|
698 |
|
699 TRAPD(err3,SetTtlsPapColumnToNullL( cf_str_EAP_TLS_PEAP_ttls_pap_password_literal )); |
|
700 if (err3) |
|
701 { |
|
702 eap_variable_data_c userNameUtf8( m_am_tools ); |
|
703 eap_variable_data_c passwordUtf8( m_am_tools ); |
|
704 |
|
705 (void) m_tls_am_partner-> |
|
706 complete_query_ttls_pap_username_and_password( |
|
707 &userNameUtf8, &passwordUtf8, eap_status_process_general_error); |
|
708 return; |
|
709 } |
|
710 |
|
711 if (iEapAuthNotifier == 0) |
|
712 { |
|
713 TRAPD(err4, iEapAuthNotifier = CEapAuthNotifier::NewL( *this )); |
|
714 if (err4) |
|
715 { |
|
716 eap_variable_data_c userNameUtf8( m_am_tools ); |
|
717 eap_variable_data_c passwordUtf8( m_am_tools ); |
|
718 |
|
719 (void) m_tls_am_partner-> |
|
720 complete_query_ttls_pap_username_and_password( |
|
721 &userNameUtf8, &passwordUtf8, eap_status_process_general_error); |
|
722 return; |
|
723 } |
|
724 } |
|
725 else |
|
726 { |
|
727 TRAPD(err5,iEapAuthNotifier->Cancel()); |
|
728 if (err5) |
|
729 { |
|
730 eap_variable_data_c userNameUtf8( m_am_tools ); |
|
731 eap_variable_data_c passwordUtf8( m_am_tools ); |
|
732 |
|
733 (void) m_tls_am_partner-> |
|
734 complete_query_ttls_pap_username_and_password( |
|
735 &userNameUtf8, &passwordUtf8, eap_status_process_general_error); |
|
736 return; |
|
737 } |
|
738 } |
|
739 |
|
740 TRAPD(err6, iEapAuthNotifier->StartL(CEapAuthNotifier::EEapNotifierTypePapAuthQueryDialog, m_notifier_data_to_user, aEapType)); |
|
741 if (err6) |
|
742 { |
|
743 eap_variable_data_c userNameUtf8( m_am_tools ); |
|
744 eap_variable_data_c passwordUtf8( m_am_tools ); |
|
745 |
|
746 (void) m_tls_am_partner-> |
|
747 complete_query_ttls_pap_username_and_password( |
|
748 &userNameUtf8, &passwordUtf8, eap_status_process_general_error); |
|
749 return; |
|
750 } |
|
751 } |
|
752 else |
|
753 { |
|
754 m_notifier_data_to_user->iUsername = aInDbInfo.iUsrPwdInfo.iUserName; |
|
755 |
|
756 EAP_TRACE_DATA_DEBUG( |
|
757 m_am_tools, |
|
758 TRACE_FLAGS_DEFAULT, |
|
759 (EAPL("eap_am_type_tls_peap_symbian_c::query_ttls_pap_username_and_password(): iUserName"), |
|
760 m_notifier_data_to_user->iUsername.Ptr(), |
|
761 m_notifier_data_to_user->iUsername.Size())); |
|
762 |
|
763 m_notifier_data_to_user->iPassword = aInDbInfo.iUsrPwdInfo.iPassword; |
|
764 |
|
765 EAP_TRACE_DATA_DEBUG( |
|
766 m_am_tools, |
|
767 TRACE_FLAGS_DEFAULT, |
|
768 (EAPL("eap_am_type_tls_peap_symbian_c::query_ttls_pap_username_and_password(): iPassword"), |
|
769 m_notifier_data_to_user->iPassword.Ptr(), |
|
770 m_notifier_data_to_user->iPassword.Size())); |
|
771 |
|
772 DlgComplete(KErrNone); |
|
773 } |
|
774 |
|
775 } |
|
776 else if ( m_state == EPapUserNameAndPassword ) |
|
777 { |
|
778 EAP_TRACE_DEBUG( |
|
779 m_am_tools, |
|
780 TRACE_FLAGS_DEFAULT, |
|
781 (EAPL("TLS: function: eap_am_type_tls_peap_symbian_c::DlgComplete(): EPapUserNameAndPassword\n"))); |
|
782 |
|
783 TBuf8<KMaxNotifItemLength> userNameUtf8; |
|
784 TBuf8<KMaxNotifItemLength> passwordUtf8; |
|
785 userNameUtf8.Zero(); |
|
786 passwordUtf8.Zero(); |
|
787 |
|
788 if (m_notifier_data_to_user->iUsername.Size()>0) |
|
789 { |
|
790 CnvUtfConverter::ConvertFromUnicodeToUtf8( userNameUtf8, m_notifier_data_to_user->iUsername ); |
|
791 |
|
792 EAP_TRACE_DATA_DEBUG( |
|
793 m_am_tools, |
|
794 TRACE_FLAGS_DEFAULT, |
|
795 (EAPL( "userNameUtf8" ), |
|
796 userNameUtf8.Ptr(), |
|
797 userNameUtf8.Size() ) ); |
|
798 } |
|
799 |
|
800 if (m_notifier_data_to_user->iPassword.Size()>0) |
|
801 { |
|
802 CnvUtfConverter::ConvertFromUnicodeToUtf8( passwordUtf8, m_notifier_data_to_user->iPassword ); |
|
803 } |
|
804 |
|
805 EAP_TRACE_DATA_DEBUG( |
|
806 m_am_tools, |
|
807 TRACE_FLAGS_DEFAULT, |
|
808 (EAPL( "passwordUtf8" ), |
|
809 passwordUtf8.Ptr(), |
|
810 passwordUtf8.Size() ) ); |
|
811 |
|
812 CompleteQueryTtlsPapUserNameAndPassword( |
|
813 status, userNameUtf8, passwordUtf8 ); |
|
814 |
|
815 TTtlsPapDbInfo aInDbInfo; |
|
816 aInDbInfo.iUsrPwdInfo.iPasswordPromptEnabled = m_notifier_data_to_user->iPasswordPromptEnabled; |
|
817 aInDbInfo.iUsrPwdInfo.iUserName.Copy(userNameUtf8); |
|
818 aInDbInfo.iUsrPwdInfo.iPassword.Copy(passwordUtf8); |
|
819 |
|
820 TRAPD(err1, WriteTtlsPapDbL( aInDbInfo)); |
|
821 if (err1) |
|
822 { |
|
823 // continue |
|
824 } |
|
825 } |
|
826 #ifdef USE_FAST_EAP_TYPE |
|
827 else if ( m_state == EPasswordCancel |
|
828 || m_state == EMasterkeyQuery |
|
829 || m_state == EPasswordQuery |
|
830 || m_state == EWrongPassword |
|
831 || m_state == EFilePasswordQuery ) |
|
832 { |
|
833 EAP_TRACE_DEBUG( |
|
834 m_am_tools, |
|
835 TRACE_FLAGS_DEFAULT, |
|
836 (EAPL("TLS: function: eap_am_type_tls_peap_symbian_c::DlgComplete(): else\n"))); |
|
837 |
|
838 m_eap_fast_completion_status = m_partner->set_timer( |
|
839 this, |
|
840 KHandleReadPacstoreTimerID, |
|
841 &aStatus, |
|
842 0); |
|
843 return; |
|
844 } |
|
845 #endif //#ifdef USE_FAST_EAP_TYPE |
|
846 |
|
847 } |
|
848 |
|
849 //-------------------------------------------------- |
|
850 |
|
851 // |
619 // |
|
620 |
852 void eap_am_type_tls_peap_symbian_c::RunL() |
621 void eap_am_type_tls_peap_symbian_c::RunL() |
853 { |
622 { |
854 EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT); |
623 EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT); |
855 |
624 |
856 EAP_TRACE_DEBUG_SYMBIAN( |
625 EAP_TRACE_DEBUG_SYMBIAN( |
857 (_L("eap_am_type_tls_peap_symbian_c::RunL - iStatus.Int()=%d, m_state=%d "), |
626 (_L("eap_am_type_tls_peap_symbian_c::RunL - iStatus.Int()=%d, m_state=%d "), |
858 iStatus.Int() , m_state)); |
627 iStatus.Int() , m_state)); |
859 |
628 |
860 #ifdef USE_FAST_EAP_TYPE |
629 #ifdef USE_FAST_EAP_TYPE |
|
630 eap_status_e status(eap_status_ok); |
|
631 |
|
632 if (m_notifier_complete) |
|
633 { |
|
634 |
|
635 TRAPD(err, CompleteNotifierL());// Only for the notifiers. |
|
636 if (err != KErrNone) |
|
637 { |
|
638 EAP_TRACE_ERROR(m_am_tools, |
|
639 TRACE_FLAGS_DEFAULT, ( |
|
640 EAPL("eap_am_type_tls_peap_symbian_c::RunL LEAVE from CompleteNotifierL, Error =%d \n"), |
|
641 err)); |
|
642 } |
|
643 |
|
644 m_notifier_complete = EFalse; |
|
645 } |
|
646 |
|
647 if ( m_state == EPasswordCancel || |
|
648 m_state == EMasterkeyQuery || |
|
649 m_state == EPasswordQuery || |
|
650 m_state == EWrongPassword || |
|
651 m_state == EFilePasswordQuery ) |
|
652 { |
|
653 m_eap_fast_completion_status = m_partner->set_timer( |
|
654 this, |
|
655 KHandleReadPacstoreTimerID, |
|
656 &status, |
|
657 0); |
|
658 return; |
|
659 } |
861 if (m_state == ENone) |
660 if (m_state == ENone) |
862 { |
661 { |
863 return; |
662 return; |
864 } |
663 } |
865 |
664 |
866 if ( m_state == EHandlingDeviceSeedQuery) |
|
867 { |
|
868 CompleteCreateDeviceSeedL( iStatus.Int() ); |
|
869 |
|
870 return; |
|
871 } |
|
872 #endif // #ifdef USE_FAST_EAP_TYPE |
665 #endif // #ifdef USE_FAST_EAP_TYPE |
873 |
666 |
874 if (iStatus.Int() != KErrNone) |
667 if (iStatus.Int() != KErrNone) |
875 { |
668 { |
876 // Notifier was cancelled or something went wrong |
669 // Notifier was cancelled or something went wrong |
988 default: |
780 default: |
989 return; |
781 return; |
990 } |
782 } |
991 } |
783 } |
992 } |
784 } |
|
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 } |
993 |
873 |
994 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
874 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
995 } |
875 } |
996 |
876 |
997 //-------------------------------------------------- |
877 //-------------------------------------------------- |
998 #ifdef USE_FAST_EAP_TYPE |
878 |
999 // |
879 // |
1000 // --------------------------------------------------------- |
880 |
1001 // eap_am_type_tls_peap_symbian_c::CreateDeviceSeedAsync() |
|
1002 // --------------------------------------------------------- |
|
1003 // |
|
1004 eap_status_e eap_am_type_tls_peap_symbian_c::CreateDeviceSeedAsync() |
|
1005 { |
|
1006 EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
1007 |
|
1008 EAP_TRACE_DEBUG_SYMBIAN( |
|
1009 (_L("eap_am_type_tls_peap_symbian_c::CreateDeviceSeedAsync-Start ActiveStatus=%d"), |
|
1010 IsActive())); |
|
1011 |
|
1012 if ( IsActive() ) |
|
1013 { |
|
1014 EAP_TRACE_DEBUG_SYMBIAN( |
|
1015 (_L("CreateDeviceSeedAsync: Already active when tried to create device seed"))); |
|
1016 |
|
1017 return eap_status_device_busy; |
|
1018 } |
|
1019 |
|
1020 eap_status_e status(eap_status_ok); |
|
1021 |
|
1022 m_state = EHandlingDeviceSeedQuery; |
|
1023 |
|
1024 // Create MMETEL connection. |
|
1025 TRAPD(error, CreateMMETelConnectionL()); |
|
1026 if(error !=KErrNone) |
|
1027 { |
|
1028 return m_am_tools->convert_am_error_to_eapol_error(error); |
|
1029 } |
|
1030 |
|
1031 iPhone.GetPhoneId( iStatus, iDeviceId ); |
|
1032 |
|
1033 SetActive(); |
|
1034 return status; |
|
1035 } // eap_am_type_tls_peap_symbian_c::CreateDeviceSeedAsynch() |
|
1036 |
|
1037 //-------------------------------------------------- |
|
1038 |
|
1039 void eap_am_type_tls_peap_symbian_c::CompleteCreateDeviceSeedL( TInt aStatus ) |
|
1040 { |
|
1041 EAP_TRACE_DEBUG_SYMBIAN( |
|
1042 (_L("eap_am_type_tls_peap_symbian_c::CompleteCreateDeviceSeedL aStatus=%d"), |
|
1043 iStatus.Int())); |
|
1044 if ( aStatus != KErrNone ) |
|
1045 { |
|
1046 EAP_TRACE_DEBUG_SYMBIAN( |
|
1047 (_L("eap_am_type_tls_peap_symbian_c::CompleteCreateDeviceSeedL ERROR: aStatus=%d"), |
|
1048 iStatus.Int())); |
|
1049 } |
|
1050 EAP_TRACE_DATA_DEBUG(m_am_tools, TRACE_FLAGS_DEFAULT, (EAPL("Manufacturer"), |
|
1051 iDeviceId.iManufacturer.Ptr(), |
|
1052 iDeviceId.iManufacturer.Size())); |
|
1053 EAP_TRACE_DATA_DEBUG(m_am_tools, TRACE_FLAGS_DEFAULT, (EAPL("Model"), |
|
1054 iDeviceId.iModel.Ptr(), |
|
1055 iDeviceId.iModel.Size())); |
|
1056 EAP_TRACE_DATA_DEBUG(m_am_tools, TRACE_FLAGS_DEFAULT, (EAPL("Revision"), |
|
1057 iDeviceId.iRevision.Ptr(), |
|
1058 iDeviceId.iRevision.Size())); |
|
1059 EAP_TRACE_DATA_DEBUG(m_am_tools, TRACE_FLAGS_DEFAULT, (EAPL("SerialNumber"), |
|
1060 iDeviceId.iSerialNumber.Ptr(), |
|
1061 iDeviceId.iSerialNumber.Size())); |
|
1062 |
|
1063 // Combine all the above four items. |
|
1064 TBuf<KMaxDeviceSeedLength> deviceSeed16; |
|
1065 deviceSeed16 += iDeviceId.iManufacturer; |
|
1066 deviceSeed16 += iDeviceId.iModel; |
|
1067 deviceSeed16 += iDeviceId.iSerialNumber; |
|
1068 |
|
1069 TBuf8<KMaxDeviceSeedSize> deviceSeed8; |
|
1070 deviceSeed8.Copy(deviceSeed16); |
|
1071 |
|
1072 if ( iPacStoreDeviceSeed == NULL ) |
|
1073 { |
|
1074 iPacStoreDeviceSeed = new eap_variable_data_c(m_am_tools); |
|
1075 if ( iPacStoreDeviceSeed == NULL ) |
|
1076 { |
|
1077 User::Leave( KErrNoMemory ); |
|
1078 } |
|
1079 } |
|
1080 |
|
1081 #if defined(USE_EAP_CONFIGURATION_TO_SKIP_USER_INTERACTIONS) |
|
1082 const char DUMMY_SEED[]="empty"; |
|
1083 |
|
1084 |
|
1085 if (m_skip_user_interactions == true) |
|
1086 { |
|
1087 iPacStoreDeviceSeed->set_copy_of_buffer(DUMMY_SEED, sizeof(DUMMY_SEED)); |
|
1088 } |
|
1089 else |
|
1090 #endif //#if defined(USE_EAP_CONFIGURATION_TO_SKIP_USER_INTERACTIONS) |
|
1091 { |
|
1092 |
|
1093 if ( iPacStoreDeviceSeed != NULL ) |
|
1094 { |
|
1095 if( deviceSeed8.Size() > 0) |
|
1096 { |
|
1097 iPacStoreDeviceSeed->set_copy_of_buffer( |
|
1098 deviceSeed8.Ptr(), |
|
1099 deviceSeed8.Size()); |
|
1100 } |
|
1101 } |
|
1102 } |
|
1103 DisconnectMMETel(); |
|
1104 |
|
1105 ContinueInitializePacStore(); |
|
1106 |
|
1107 } // eap_am_type_tls_peap_symbian_c::CompleteCreateDeviceSeedL() |
|
1108 |
|
1109 #endif |
|
1110 //-------------------------------------------------- |
|
1111 |
881 |
1112 void eap_am_type_tls_peap_symbian_c::DoCancel() |
882 void eap_am_type_tls_peap_symbian_c::DoCancel() |
1113 { |
883 { |
1114 EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT); |
884 EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT); |
1115 |
885 |
1141 |
917 |
1142 m_partner->cancel_timer( |
918 m_partner->cancel_timer( |
1143 this, |
919 this, |
1144 KHandleReadPacstoreTimerID); |
920 KHandleReadPacstoreTimerID); |
1145 |
921 |
|
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 ) |
1146 |
939 |
1147 #endif // #if defined(USE_FAST_EAP_TYPE) |
940 #endif // #if defined(USE_FAST_EAP_TYPE) |
1148 |
941 |
1149 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
942 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
1150 } |
943 } |
1151 |
944 |
1152 //-------------------------------------------------- |
945 //-------------------------------------------------- |
1153 |
946 |
1154 // |
947 // |
|
948 |
1155 eap_status_e eap_am_type_tls_peap_symbian_c::SaveManualIdentityL( |
949 eap_status_e eap_am_type_tls_peap_symbian_c::SaveManualIdentityL( |
1156 const TBool use_manual_username, |
950 const TBool use_manual_username, |
1157 TDesC& manual_username, |
951 TDesC& manual_username, |
1158 const TBool use_manual_realm, |
952 const TBool use_manual_realm, |
1159 TDesC& manual_realm) |
953 TDesC& manual_realm) |
1160 { |
954 { |
1161 EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT); |
955 EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT); |
1162 |
956 |
1163 // Validate length. |
957 // Validate length. |
1164 if(manual_username.Length() > KMaxUsernameLengthInDB |
958 if(manual_username.Length() > KMaxManualUsernameLengthInDB |
1165 || manual_realm.Length() > KMaxRealmLengthInDB) |
959 || manual_realm.Length() > KMaxManualRealmLengthInDB) |
1166 { |
960 { |
1167 // Username or realm too long. Can not be stored in DB. |
961 // Username or realm too long. Can not be stored in DB. |
1168 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"), |
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"), |
1169 manual_username.Length(), manual_realm.Length())); |
963 manual_username.Length(), manual_realm.Length())); |
1170 |
964 |
1171 User::Leave(KErrArgument); |
965 User::Leave(KErrArgument); |
1172 } |
966 } |
1173 |
967 |
1174 HBufC* sqlbuf = HBufC::NewLC(KMaxSqlQueryLength); |
968 HBufC* sqlbuf = HBufC::NewLC(KMaxSqlQueryLength); |
1175 TPtr sqlStatement = sqlbuf->Des(); |
969 TPtr sqlStatement = sqlbuf->Des(); |
1176 |
970 |
1177 RDbView view; |
971 RDbView view; |
1178 |
972 |
1179 _LIT(KSQL, "SELECT * FROM %S WHERE %S=%d AND %S=%d AND %S=%d AND %S=%d"); |
973 _LIT(KSQL, "SELECT * FROM %S WHERE %S=%d AND %S=%d AND %S=%d"); |
1180 |
974 |
1181 sqlStatement.Format( |
975 sqlStatement.Format(KSQL, &m_db_table_name, |
1182 KSQL, |
976 &KServiceType, m_index_type, &KServiceIndex, m_index, &KTunnelingType, m_tunneling_vendor_type); |
1183 &m_db_table_name, |
|
1184 &KServiceType, |
|
1185 m_index_type, |
|
1186 &KServiceIndex, |
|
1187 m_index, |
|
1188 &KTunnelingTypeVendorId, |
|
1189 m_tunneling_type.get_vendor_id(), |
|
1190 &KTunnelingType, |
|
1191 m_tunneling_type.get_vendor_type()); |
|
1192 |
977 |
1193 User::LeaveIfError(view.Prepare(m_database, TDbQuery(sqlStatement), TDbWindow::EUnlimited)); |
978 User::LeaveIfError(view.Prepare(m_database, TDbQuery(sqlStatement), TDbWindow::EUnlimited)); |
1194 CleanupClosePushL(view); |
979 CleanupClosePushL(view); |
1195 User::LeaveIfError(view.EvaluateAll()); |
980 User::LeaveIfError(view.EvaluateAll()); |
1196 |
981 |
1605 } |
1386 } |
1606 } |
1387 } |
1607 |
1388 |
1608 //---------------------------------------------------------- |
1389 //---------------------------------------------------------- |
1609 |
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 //---------------------------------------------------------- |
|
1459 |
1610 { |
1460 { |
1611 eap_variable_data_c use_manual_username(m_am_tools); |
1461 eap_variable_data_c use_manual_username(m_am_tools); |
1612 |
1462 |
1613 eap_status_e status = type_configure_read( |
1463 eap_status_e status = type_configure_read( |
1614 cf_str_EAP_TLS_PEAP_use_manual_username.get_field(), |
1464 cf_str_EAP_TLS_PEAP_use_manual_username.get_field(), |
1751 // Read Maximum Session Validity Time from the config file |
1601 // Read Maximum Session Validity Time from the config file |
1752 eap_variable_data_c sessionTimeFromFile(m_am_tools); |
1602 eap_variable_data_c sessionTimeFromFile(m_am_tools); |
1753 |
1603 |
1754 eap_status_e status(eap_status_ok); |
1604 eap_status_e status(eap_status_ok); |
1755 |
1605 |
1756 if (m_current_eap_type == eap_type_tls) |
1606 switch (m_current_eap_vendor_type) |
1757 { |
1607 { |
1758 status = type_configure_read( |
1608 case eap_type_tls: |
1759 cf_str_EAP_TLS_max_session_validity_time.get_field(), |
1609 { |
1760 &sessionTimeFromFile); |
1610 status = m_partner->read_configure( |
1761 } |
1611 cf_str_EAP_TLS_max_session_validity_time.get_field(), |
1762 else if (m_current_eap_type == eap_type_peap) |
1612 &sessionTimeFromFile); |
1763 { |
1613 } |
1764 status = type_configure_read( |
1614 break; |
1765 cf_str_EAP_PEAP_max_session_validity_time.get_field(), |
1615 |
1766 &sessionTimeFromFile); |
1616 case eap_type_peap: |
1767 } |
1617 { |
1768 else if (m_current_eap_type == eap_type_ttls) |
1618 status = m_partner->read_configure( |
1769 { |
1619 cf_str_EAP_PEAP_max_session_validity_time.get_field(), |
1770 status = type_configure_read( |
1620 &sessionTimeFromFile); |
1771 cf_str_EAP_TTLS_max_session_validity_time.get_field(), |
1621 } |
1772 &sessionTimeFromFile); |
1622 break; |
1773 } |
1623 |
1774 else if (m_current_eap_type == eap_expanded_type_ttls_plain_pap.get_type()) |
1624 case eap_type_ttls: |
1775 { |
1625 { |
|
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 { |
1776 // read PAP session time |
1634 // read PAP session time |
1777 status = type_configure_read( |
1635 status = m_partner->read_configure( |
1778 cf_str_EAP_TLS_PEAP_ttls_pap_max_session_validity_time.get_field(), |
1636 cf_str_EAP_TLS_PEAP_ttls_pap_max_session_validity_time.get_field(), |
1779 &sessionTimeFromFile ); |
1637 &sessionTimeFromFile ); |
1780 } |
1638 } |
|
1639 break; |
|
1640 |
1781 #if defined(USE_FAST_EAP_TYPE) |
1641 #if defined(USE_FAST_EAP_TYPE) |
1782 else if (m_current_eap_type == eap_type_fast) |
1642 case eap_type_fast: |
1783 { |
1643 { |
1784 status = type_configure_read( |
1644 status = m_partner->read_configure( |
1785 cf_str_EAP_FAST_max_session_validity_time.get_field(), |
1645 cf_str_EAP_FAST_max_session_validity_time.get_field(), |
1786 &sessionTimeFromFile); |
1646 &sessionTimeFromFile); |
1787 } |
1647 } |
|
1648 break; |
1788 #endif |
1649 #endif |
1789 else |
1650 |
1790 { |
1651 default: |
1791 // Should never happen |
1652 { |
1792 EAP_TRACE_ERROR(m_am_tools, |
1653 // Should never happen |
1793 TRACE_FLAGS_DEFAULT, ( |
1654 EAP_TRACE_ERROR(m_am_tools, |
1794 EAPL("eap_am_type_tls_peap_symbian_c::configure(): Unsupported EAP type, m_current_eap_vendor_type=0xfe%06x%08x\n"), |
1655 TRACE_FLAGS_DEFAULT, ( |
1795 m_current_eap_type.get_vendor_id(), |
1656 EAPL("eap_am_type_tls_peap_symbian_c::configure - Unsupported EAP type, m_current_eap_vendor_type=%d \n"), |
1796 m_current_eap_type.get_vendor_type())); |
1657 m_current_eap_vendor_type)); |
1797 } |
1658 } |
|
1659 } |
1798 |
1660 |
1799 // set m_max_session_time |
1661 // set m_max_session_time |
1800 if (status == eap_status_ok |
1662 if (status == eap_status_ok |
1801 && sessionTimeFromFile.get_is_valid_data() == true |
1663 && sessionTimeFromFile.get_is_valid_data() == true |
1802 && sessionTimeFromFile.get_data_length() == sizeof(u32_t)) |
1664 && sessionTimeFromFile.get_data_length() == sizeof(u32_t)) |
1893 |
1755 |
1894 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
1756 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
1895 |
1757 |
1896 status = eap_status_ok; |
1758 status = eap_status_ok; |
1897 |
1759 |
1898 if (m_use_automatic_ca_certificate == false) |
1760 if (m_allowed_ca_certs.Count() == 0) |
1899 { |
1761 { |
1900 if (m_allowed_ca_certs.Count() == 0) |
1762 // needed because of nonworking wrong settings |
1901 { |
|
1902 // needed because of nonworking wrong settings |
|
1903 #if defined(USE_FAST_EAP_TYPE) |
1763 #if defined(USE_FAST_EAP_TYPE) |
1904 if(m_current_eap_type == eap_type_fast |
1764 if(m_current_eap_type == eap_type_fast && |
1905 && m_serv_auth_prov_mode != true) |
1765 m_serv_auth_prov_mode != true) |
1906 { |
1766 { |
1907 // In the case of EAP-FAST, CA cert is must if m_serv_auth_prov_mode is TRUE. |
1767 // In the case of EAP-FAST, CA cert is must if m_serv_auth_prov_mode is TRUE. |
1908 status = eap_status_ok; |
1768 status = eap_status_ok; |
1909 |
1769 |
1910 EAP_TRACE_DEBUG( |
1770 EAP_TRACE_DEBUG(m_am_tools, |
1911 m_am_tools, |
1771 TRACE_FLAGS_DEFAULT, ( |
1912 TRACE_FLAGS_DEFAULT, |
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"))); |
1913 (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"))); |
1773 } |
1914 } |
1774 else |
1915 else |
|
1916 #endif // #if defined(USE_FAST_EAP_TYPE) |
1775 #endif // #if defined(USE_FAST_EAP_TYPE) |
1917 { |
1776 { |
1918 EAP_TRACE_ERROR( |
1777 EAP_TRACE_ERROR(m_am_tools, |
1919 m_am_tools, |
1778 TRACE_FLAGS_DEFAULT, ( |
1920 TRACE_FLAGS_DEFAULT, |
1779 EAPL("eap_am_type_tls_peap_symbian_c::configure - Error - No CA certificate\n"))); |
1921 (EAPL("eap_am_type_tls_peap_symbian_c::configure(): Error - No CA certificate\n"))); |
1780 |
1922 |
1781 // No root certificate selected. Cannot continue. |
1923 // No root certificate selected. Cannot continue. |
1782 status = eap_status_ca_certificate_unknown; |
1924 status = eap_status_ca_certificate_unknown; |
1783 send_error_notification(status); |
1925 send_error_notification(status); |
1784 } |
1926 } |
1785 } |
1927 } |
1786 |
1928 else |
|
1929 { |
|
1930 EAP_TRACE_DEBUG( |
|
1931 m_am_tools, |
|
1932 TRACE_FLAGS_DEFAULT, |
|
1933 (EAPL("eap_am_type_tls_peap_symbian_c::configure(): %d CA certificates selected.\n"), |
|
1934 m_allowed_ca_certs.Count())); |
|
1935 } |
|
1936 } |
|
1937 else |
|
1938 { |
|
1939 EAP_TRACE_DEBUG( |
|
1940 m_am_tools, |
|
1941 TRACE_FLAGS_DEFAULT, |
|
1942 (EAPL("eap_am_type_tls_peap_symbian_c::configure(): %d CA certificate selected in automatic CA selection.\n"), |
|
1943 m_allowed_ca_certs.Count())); |
|
1944 } |
|
1945 |
|
1946 |
|
1947 if(m_allowed_user_certs.Count() == 0) |
1787 if(m_allowed_user_certs.Count() == 0) |
1948 { |
1788 { |
1949 #if defined(USE_FAST_EAP_TYPE) |
1789 #if defined(USE_FAST_EAP_TYPE) |
1950 if(m_current_eap_type == eap_type_fast) |
1790 if(m_current_eap_type == eap_type_fast) |
1951 { |
1791 { |
1952 m_use_manual_realm = true; |
1792 m_use_manual_realm = true; |
1953 |
1793 |
1954 if (m_use_manual_username == false) |
1794 if (m_use_manual_username == false) |
1955 { |
1795 { |
1956 TRAPD(err, status=ConfigureL()); |
1796 TRAPD(err, status=ConfigureL()); |
1957 if (err != KErrNone) |
1797 if (err != KErrNone) |
1958 { |
1798 { |
1959 EAP_TRACE_ERROR(m_am_tools, |
1799 EAP_TRACE_ERROR(m_am_tools, |
1960 TRACE_FLAGS_DEFAULT, ( |
1800 TRACE_FLAGS_DEFAULT, ( |
1961 EAPL("eap_am_type_tls_peap_symbian_c::configure LEAVE from ConfigureL, Error =%d \n"), |
1801 EAPL("eap_am_type_tls_peap_symbian_c::configure LEAVE from ConfigureL, Error =%d \n"), |
1962 err)); |
1802 err)); |
|
1803 } |
1963 } |
1804 } |
1964 } |
1805 } |
1965 } |
|
1966 #endif // #if defined(USE_FAST_EAP_TYPE) |
1806 #endif // #if defined(USE_FAST_EAP_TYPE) |
1967 } |
1807 } |
1968 else |
|
1969 { |
|
1970 EAP_TRACE_DEBUG( |
|
1971 m_am_tools, |
|
1972 TRACE_FLAGS_DEFAULT, |
|
1973 (EAPL("eap_am_type_tls_peap_symbian_c::configure(): %d user certificates selected.\n"), |
|
1974 m_allowed_user_certs.Count())); |
|
1975 } |
|
1976 |
|
1977 |
|
1978 if (m_tls_peap_server_authenticates_client_policy_flag == true |
1808 if (m_tls_peap_server_authenticates_client_policy_flag == true |
1979 && m_allowed_user_certs.Count() == 0) |
1809 && m_allowed_user_certs.Count() == 0) |
1980 { |
1810 { |
1981 #if defined(USE_FAST_EAP_TYPE) |
1811 #if defined(USE_FAST_EAP_TYPE) |
1982 if (m_current_eap_type == eap_type_fast) |
1812 if (m_current_eap_type == eap_type_fast) |
1983 { |
1813 { |
1984 EAP_TRACE_DEBUG( |
1814 EAP_TRACE_DEBUG(m_am_tools, |
1985 m_am_tools, |
1815 TRACE_FLAGS_DEFAULT, |
1986 TRACE_FLAGS_DEFAULT, |
1816 (EAPL("eap_am_type_tls_peap_symbian_c::configure - No USER certificate, but in eap_fast it's not mandatory\n"))); |
1987 (EAPL("eap_am_type_tls_peap_symbian_c::configure(): No USER certificate, but in eap_fast it's not mandatory\n"))); |
1817 |
1988 } |
1818 } |
1989 else |
1819 else |
1990 #endif // #if defined(USE_FAST_EAP_TYPE) |
1820 #endif // #if defined(USE_FAST_EAP_TYPE) |
1991 { |
1821 { |
1992 EAP_TRACE_ERROR( |
1822 EAP_TRACE_ERROR(m_am_tools, |
1993 m_am_tools, |
1823 TRACE_FLAGS_DEFAULT, ( |
1994 TRACE_FLAGS_DEFAULT, |
1824 EAPL("eap_am_type_tls_peap_symbian_c::configure - Error - No USER certificate\n"))); |
1995 (EAPL("eap_am_type_tls_peap_symbian_c::configure(): Error - No USER certificate\n"))); |
1825 |
1996 |
1826 // No user certificate selected. Cannot continue. |
1997 // No user certificate selected. Cannot continue. |
1827 status = eap_status_user_certificate_unknown; |
1998 status = eap_status_user_certificate_unknown; |
1828 send_error_notification(status); |
1999 send_error_notification(status); |
|
2000 } |
1829 } |
2001 } |
1830 } |
2002 |
1831 |
2003 if (m_allowed_cipher_suites.Count() == 0) |
1832 if (m_allowed_cipher_suites.Count() == 0) |
2004 { |
1833 { |
2005 EAP_TRACE_ERROR( |
1834 EAP_TRACE_ERROR(m_am_tools, |
2006 m_am_tools, |
1835 TRACE_FLAGS_DEFAULT, ( |
2007 TRACE_FLAGS_DEFAULT, |
1836 EAPL("eap_am_type_tls_peap_symbian_c::configure - Error - No cipher suit\n"))); |
2008 (EAPL("eap_am_type_tls_peap_symbian_c::configure(): Error - No cipher suit\n"))); |
|
2009 |
1837 |
2010 // No sipher suites selected. Cannot continue. |
1838 // No sipher suites selected. Cannot continue. |
2011 status = eap_status_illegal_cipher_suite; |
1839 status = eap_status_illegal_cipher_suite; |
2012 send_error_notification(status); |
1840 send_error_notification(status); |
2013 } |
1841 } |
2014 else |
|
2015 { |
|
2016 EAP_TRACE_DEBUG( |
|
2017 m_am_tools, |
|
2018 TRACE_FLAGS_DEFAULT, |
|
2019 (EAPL("eap_am_type_tls_peap_symbian_c::configure(): %d cipher suites selected.\n"), |
|
2020 m_allowed_cipher_suites.Count())); |
|
2021 } |
|
2022 |
1842 |
2023 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
1843 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
2024 |
1844 |
2025 if (status != eap_status_ok) |
1845 if (status != eap_status_ok) |
2026 { |
1846 { |
2027 notify_configuration_error(status); |
1847 notify_configuration_error(status); |
2028 } |
1848 } |
2029 |
1849 |
2030 m_configured = true; |
1850 m_configured = true; |
2031 |
1851 |
2032 EAP_TRACE_DEBUG( |
1852 EAP_TRACE_DEBUG(m_am_tools, |
2033 m_am_tools, |
|
2034 TRACE_FLAGS_DEFAULT, |
1853 TRACE_FLAGS_DEFAULT, |
2035 (EAPL("eap_am_type_tls_peap_symbian_c::configure(): END \n"))); |
1854 (EAPL("eap_am_type_tls_peap_symbian_c::configure - END \n"))); |
2036 |
1855 |
2037 |
1856 |
2038 return EAP_STATUS_RETURN(m_am_tools, status); |
1857 return EAP_STATUS_RETURN(m_am_tools, status); |
2039 } |
1858 } |
2040 |
1859 |
2041 //-------------------------------------------------- |
1860 //-------------------------------------------------- |
2042 |
|
2043 #if defined(USE_FAST_EAP_TYPE) |
1861 #if defined(USE_FAST_EAP_TYPE) |
2044 |
1862 |
2045 eap_status_e eap_am_type_tls_peap_symbian_c::ConfigureL() |
1863 eap_status_e eap_am_type_tls_peap_symbian_c::ConfigureL() |
2046 { |
1864 { |
2047 |
1865 |
2048 eap_status_e status(eap_status_ok); |
1866 eap_status_e status(eap_status_ok); |
2049 |
1867 |
2050 _LIT(KTempUserName, "EAP-FAST-"); |
1868 _LIT(KTempUserName, "EAP-FAST-"); |
2051 TBuf8<10> TempUserName; |
1869 TBuf8<10> TempUserName; |
2052 |
1870 |
2053 TempUserName.Copy(KTempUserName); |
1871 TempUserName.Copy(KTempUserName); |
2054 |
1872 |
2055 HBufC8* buf = HBufC8::NewLC(KMaxNotifItemLength); |
1873 HBufC8* buf = HBufC8::NewLC(KIdentityFieldLength); |
2056 |
|
2057 TPtr8 bufPtr = buf->Des(); |
1874 TPtr8 bufPtr = buf->Des(); |
2058 |
1875 |
2059 HBufC8* tempUserBuf8 = HBufC8::NewLC(KMacAddressLength); |
1876 HBufC8* tempUserBuf8 = HBufC8::NewLC(KMacAddressLength); |
2060 TPtr8 tempUserBufPtr8 = tempUserBuf8->Des(); |
1877 TPtr8 tempUserBufPtr8 = tempUserBuf8->Des(); |
2061 |
1878 |
3438 } |
3247 } |
3439 else |
3248 else |
3440 { |
3249 { |
3441 // Get the first enabled EAP type (tunneling). |
3250 // Get the first enabled EAP type (tunneling). |
3442 |
3251 |
|
3252 TBuf8<KExpandedEAPTypeSize> tmpExpEAP(m_enabled_tunneling_exp_eap_array[0]->iExpandedEAPType); //first item. |
|
3253 |
3443 EAP_TRACE_DATA_DEBUG( |
3254 EAP_TRACE_DATA_DEBUG( |
3444 m_am_tools, |
3255 m_am_tools, |
3445 TRACE_FLAGS_DEFAULT, |
3256 TRACE_FLAGS_DEFAULT, |
3446 (EAPL("type_configure_read:Enabled expanded tunneling EAP type:"), |
3257 (EAPL("type_configure_read:Enabled expanded tunneling EAP type:"), |
3447 m_enabled_tunneling_exp_eap_array[0]->GetValue().Ptr(), |
3258 tmpExpEAP.Ptr(), |
3448 m_enabled_tunneling_exp_eap_array[0]->GetValue().Length())); |
3259 tmpExpEAP.Size())); |
3449 |
3260 |
3450 status = data->set_copy_of_buffer( |
3261 status = data->set_copy_of_buffer(tmpExpEAP.Ptr(), KExpandedEAPTypeSize); |
3451 m_enabled_tunneling_exp_eap_array[0]->GetValue().Ptr(), |
3262 if (status != eap_status_ok) |
3452 m_enabled_tunneling_exp_eap_array[0]->GetValue().Length()); |
3263 { |
3453 if (status != eap_status_ok) |
3264 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
3454 { |
3265 return EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error); |
3455 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
3266 } |
3456 return EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error); |
|
3457 } |
|
3458 |
3267 |
3459 EAP_TRACE_DATA_DEBUG( |
3268 EAP_TRACE_DATA_DEBUG( |
3460 m_am_tools, |
3269 m_am_tools, |
3461 TRACE_FLAGS_DEFAULT, |
3270 TRACE_FLAGS_DEFAULT, |
3462 (EAPL("EAP-PEAP or EAP-TTLS: Trying encapsulated EAP type:"), |
3271 (EAPL("EAP-PEAP or EAP-TTLS: Trying encapsulated EAP type:"), |
3463 m_enabled_tunneling_exp_eap_array[0]->GetValue().Ptr(), |
3272 tmpExpEAP.Ptr(), |
3464 m_enabled_tunneling_exp_eap_array[0]->GetValue().Length())); |
3273 tmpExpEAP.Size())); |
3465 } |
3274 } |
3466 |
3275 |
|
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 |
3467 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
3314 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
3468 return EAP_STATUS_RETURN(m_am_tools, status); |
3315 return EAP_STATUS_RETURN(m_am_tools, status); |
3469 |
3316 |
3470 } // End of if (!wanted_field.compare(&type_field)) |
3317 } // End of if (!wanted_field.compare(&type_field)) |
3471 |
3318 |
|
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. |
3472 |
3354 |
3473 // cf_str_PEAP_accepted_tunneled_client_types_u32array is available only for normal EAP types. |
3355 // cf_str_PEAP_accepted_tunneled_client_types_u32array is available only for normal EAP types. |
3474 // So for cf_str_PEAP_accepted_tunneled_client_types_u32array and eap_configure_type_u32array |
3356 // So for cf_str_PEAP_accepted_tunneled_client_types_u32array and eap_configure_type_u32array |
3475 // we should return eap_status_illegal_configure_field. |
3357 // we should return eap_status_illegal_configure_field. |
3476 |
3358 |
3547 |
3435 |
3548 // Now do the database query |
3436 // Now do the database query |
3549 HBufC* buf = HBufC::NewLC(KMaxSqlQueryLength); |
3437 HBufC* buf = HBufC::NewLC(KMaxSqlQueryLength); |
3550 TPtr sqlStatement = buf->Des(); |
3438 TPtr sqlStatement = buf->Des(); |
3551 |
3439 |
3552 _LIT(KSQLQueryRow, "SELECT %S FROM %S WHERE %S=%d AND %S=%d AND %S=%d AND %S=%d"); |
3440 _LIT(KSQLQueryRow, "SELECT %S FROM %S WHERE %S=%d AND %S=%d AND %S=%d"); |
3553 |
3441 |
3554 #if defined(USE_FAST_EAP_TYPE) |
3442 #if defined(USE_FAST_EAP_TYPE) |
3555 |
3443 |
3556 // Unlike other EAP types, EAP-FAST has some settings in special settings table |
3444 // Unlike other EAP types, EAP-FAST has some settings in special settings table |
3557 // (m_db_fast_special_table_name) |
3445 // (m_db_fast_special_table_name) |
3558 |
3446 |
3559 if(m_current_eap_type == eap_type_fast |
3447 if(m_current_eap_type == eap_type_fast |
3560 && ((unicodeString.Compare(cf_str_EAP_FAST_allow_server_authenticated_provisioning_mode_literal) == 0) |
3448 && ((unicodeString.Compare(cf_str_EAP_FAST_allow_server_authenticated_provisioning_mode_literal) == 0) |
3561 || (unicodeString.Compare(cf_str_EAP_FAST_allow_server_unauthenticated_provisioning_mode_ADHP_literal) == 0) |
3449 || (unicodeString.Compare(cf_str_EAP_FAST_allow_server_unauthenticated_provisioning_mode_ADHP_literal) == 0) |
3562 || (unicodeString.Compare(KFASTWarnADHPNoPAC) == 0) |
3450 || (unicodeString.Compare(cf_str_EAP_FAST_warn_ADHP_no_PAC_literal) == 0) |
3563 || (unicodeString.Compare(KFASTWarnADHPNoMatchingPAC) == 0) |
3451 || (unicodeString.Compare(cf_str_EAP_FAST_warn_ADHP_no_matching_PAC_literal) == 0) |
3564 || (unicodeString.Compare(KFASTWarnNotDefaultServer) == 0) |
3452 || (unicodeString.Compare(cf_str_EAP_FAST_warn_ADHP_not_default_server_literal) == 0) |
3565 || (unicodeString.Compare(KFASTPACGroupImportReferenceCollection) == 0) |
3453 || (unicodeString.Compare(KFASTPACGroupImportReferenceCollection) == 0) |
3566 || (unicodeString.Compare(KFASTPACGroupDBReferenceCollection) == 0))) |
3454 || (unicodeString.Compare(KFASTPACGroupDBReferenceCollection) == 0))) |
3567 { |
3455 { |
|
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 } |
3568 EAP_TRACE_DEBUG(m_am_tools, |
3468 EAP_TRACE_DEBUG(m_am_tools, |
3569 TRACE_FLAGS_DEFAULT, |
3469 TRACE_FLAGS_DEFAULT, |
3570 (EAPL("eap_am_type_tls_peap_symbian_c::type_configure_readL This field will be read from EAP-FAST's special table\n"))); |
3470 (EAPL("eap_am_type_tls_peap_symbian_c::type_configure_readL This field will be read from EAP-FAST's special table\n"))); |
3571 |
3471 |
3572 sqlStatement.Format( |
3472 sqlStatement.Format(KSQLQueryRow, &unicodeString, &m_db_fast_special_table_name, |
3573 KSQLQueryRow, |
3473 &KServiceType, m_index_type, &KServiceIndex, m_index, &KTunnelingType, m_tunneling_vendor_type); |
3574 &unicodeString, |
3474 } |
3575 &m_db_fast_special_table_name, |
|
3576 &KServiceType, |
|
3577 m_index_type, |
|
3578 &KServiceIndex, |
|
3579 m_index, |
|
3580 &KTunnelingTypeVendorId, |
|
3581 m_tunneling_type.get_vendor_id(), |
|
3582 &KTunnelingType, |
|
3583 m_tunneling_type.get_vendor_type()); |
|
3584 } |
|
3585 else |
3475 else |
3586 { |
3476 { |
3587 sqlStatement.Format( |
3477 sqlStatement.Format(KSQLQueryRow, &unicodeString, &m_db_table_name, |
3588 KSQLQueryRow, |
3478 &KServiceType, m_index_type, &KServiceIndex, m_index, &KTunnelingType, m_tunneling_vendor_type); |
3589 &unicodeString, |
3479 } |
3590 &m_db_table_name, |
|
3591 &KServiceType, |
|
3592 m_index_type, |
|
3593 &KServiceIndex, |
|
3594 m_index, |
|
3595 &KTunnelingTypeVendorId, |
|
3596 m_tunneling_type.get_vendor_id(), |
|
3597 &KTunnelingType, |
|
3598 m_tunneling_type.get_vendor_type()); |
|
3599 } |
|
3600 |
3480 |
3601 #else |
3481 #else |
3602 |
3482 |
3603 sqlStatement.Format( |
3483 sqlStatement.Format(KSQLQueryRow, &unicodeString, &m_db_table_name, |
3604 KSQLQueryRow, |
3484 &KServiceType, m_index_type, &KServiceIndex, m_index, &KTunnelingType, m_tunneling_vendor_type); |
3605 &unicodeString, |
|
3606 &m_db_table_name, |
|
3607 &KServiceType, |
|
3608 m_index_type, |
|
3609 &KServiceIndex, |
|
3610 m_index, |
|
3611 &KTunnelingTypeVendorId, |
|
3612 m_tunneling_type.get_vendor_id(), |
|
3613 &KTunnelingType, |
|
3614 m_tunneling_type.get_vendor_type()); |
|
3615 |
3485 |
3616 #endif // End: #if defined(USE_FAST_EAP_TYPE) |
3486 #endif // End: #if defined(USE_FAST_EAP_TYPE) |
3617 |
3487 |
3618 RDbView view; |
3488 RDbView view; |
3619 User::LeaveIfError(view.Prepare(m_database, TDbQuery(sqlStatement), TDbWindow::EUnlimited)); |
3489 User::LeaveIfError(view.Prepare(m_database, TDbQuery(sqlStatement), TDbWindow::EUnlimited)); |
3620 CleanupClosePushL(view); |
3490 CleanupClosePushL(view); |
3621 User::LeaveIfError(view.EvaluateAll()); |
3491 User::LeaveIfError(view.EvaluateAll()); |
3622 if (view.FirstL()) |
3492 if (view.FirstL()) |
3954 return EAP_STATUS_RETURN(m_am_tools, eap_status_ok); |
3786 return EAP_STATUS_RETURN(m_am_tools, eap_status_ok); |
3955 } |
3787 } |
3956 |
3788 |
3957 //-------------------------------------------------- |
3789 //-------------------------------------------------- |
3958 |
3790 |
3959 eap_status_e eap_am_type_tls_peap_symbian_c::select_cipher_suite( |
|
3960 const bool select_all_cipher_suites, |
|
3961 const tls_cipher_suites_e test_cipher_suite, |
|
3962 const TAlgorithmId testcertAlgorithm, |
|
3963 const TAlgorithmId certAlgorithm, |
|
3964 eap_array_c<u16_t> * cipher_suites) |
|
3965 { |
|
3966 EAP_TRACE_DEBUG( |
|
3967 m_am_tools, |
|
3968 TRACE_FLAGS_DEFAULT, |
|
3969 (EAPL("eap_am_type_tls_peap_symbian_c::select_cipher_suite(), select_all_cipher_suites=%d, test_cipher_suite=%d, testcertAlgorithm=%d, certAlgorithm=%d\n"), |
|
3970 select_all_cipher_suites, |
|
3971 test_cipher_suite, |
|
3972 testcertAlgorithm, |
|
3973 certAlgorithm)); |
|
3974 |
|
3975 eap_status_e status(eap_status_ok); |
|
3976 |
|
3977 // Cipher suite must be allowed AND the algorithm must match the certificates algorithm. |
|
3978 // Also select_all_cipher_suites can be used to add all cipher suites to the list. |
|
3979 |
|
3980 TInt found = m_allowed_cipher_suites.Find(test_cipher_suite); |
|
3981 |
|
3982 EAP_TRACE_DEBUG( |
|
3983 m_am_tools, |
|
3984 TRACE_FLAGS_DEFAULT, |
|
3985 (EAPL("eap_am_type_tls_peap_symbian_c::select_cipher_suite(), found=%d, cipher suite=%d, KErrNotFound=%d\n"), |
|
3986 found, |
|
3987 test_cipher_suite, |
|
3988 KErrNotFound)); |
|
3989 |
|
3990 if (found != KErrNotFound |
|
3991 && (select_all_cipher_suites == true |
|
3992 || testcertAlgorithm == certAlgorithm)) |
|
3993 { |
|
3994 u16_t *tmp_object = new u16_t; |
|
3995 if (tmp_object == 0) |
|
3996 { |
|
3997 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
3998 return EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error); |
|
3999 } |
|
4000 *tmp_object = eap_htons(test_cipher_suite); |
|
4001 |
|
4002 EAP_TRACE_DEBUG( |
|
4003 m_am_tools, |
|
4004 TRACE_FLAGS_DEFAULT, |
|
4005 (EAPL("eap_am_type_tls_peap_symbian_c::select_cipher_suite(), adds cipher suite=%d\n"), |
|
4006 test_cipher_suite)); |
|
4007 |
|
4008 status = cipher_suites->add_object(tmp_object, true); |
|
4009 } |
|
4010 |
|
4011 return EAP_STATUS_RETURN(m_am_tools, status); |
|
4012 } |
|
4013 |
|
4014 //-------------------------------------------------- |
|
4015 |
3791 |
4016 EAP_FUNC_EXPORT eap_status_e eap_am_type_tls_peap_symbian_c::query_cipher_suites_and_previous_session() |
3792 EAP_FUNC_EXPORT eap_status_e eap_am_type_tls_peap_symbian_c::query_cipher_suites_and_previous_session() |
4017 { |
3793 { |
4018 EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT); |
3794 EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT); |
4019 |
3795 |
4149 |
3914 |
4150 const CSubjectPublicKeyInfo& public_key = m_ca_certificate->PublicKey(); |
3915 const CSubjectPublicKeyInfo& public_key = m_ca_certificate->PublicKey(); |
4151 |
3916 |
4152 certAlgorithm = public_key.AlgorithmId(); |
3917 certAlgorithm = public_key.AlgorithmId(); |
4153 } |
3918 } |
4154 |
3919 |
4155 |
3920 // IF cipher suite is allowed |
4156 status = select_cipher_suite( |
3921 if (m_allowed_cipher_suites.Find(tls_cipher_suites_TLS_RSA_WITH_3DES_EDE_CBC_SHA) != KErrNotFound |
4157 select_all_cipher_suites, |
3922 // AND the algorithm matches the certificates algorithm |
4158 tls_cipher_suites_TLS_RSA_WITH_3DES_EDE_CBC_SHA, |
3923 && (select_all_cipher_suites == true |
4159 certAlgorithm, |
3924 || certAlgorithm == ERSA)) |
4160 ERSA, |
3925 // THEN add it to list. |
4161 &cipher_suites); |
3926 { |
4162 if (status != eap_status_ok) |
3927 u16_t *tmp_object = new u16_t; |
4163 { |
3928 if (tmp_object == 0) |
4164 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
3929 { |
4165 return EAP_STATUS_RETURN(m_am_tools, status); |
3930 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
4166 } |
3931 return EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error); |
4167 |
3932 } |
4168 status = select_cipher_suite( |
3933 *tmp_object = eap_htons(tls_cipher_suites_TLS_RSA_WITH_3DES_EDE_CBC_SHA); |
4169 select_all_cipher_suites, |
3934 |
4170 tls_cipher_suites_TLS_RSA_WITH_AES_128_CBC_SHA, |
3935 status = cipher_suites.add_object(tmp_object, true); |
4171 certAlgorithm, |
3936 if (status != eap_status_ok) |
4172 ERSA, |
3937 { |
4173 &cipher_suites); |
3938 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
4174 if (status != eap_status_ok) |
3939 return EAP_STATUS_RETURN(m_am_tools, status); |
4175 { |
3940 } |
4176 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
3941 } |
4177 return EAP_STATUS_RETURN(m_am_tools, status); |
3942 if (m_allowed_cipher_suites.Find(tls_cipher_suites_TLS_RSA_WITH_AES_128_CBC_SHA) != KErrNotFound |
4178 } |
3943 // AND the algorithm matches the certificates algorithm |
4179 |
3944 && (select_all_cipher_suites == true |
4180 status = select_cipher_suite( |
3945 || certAlgorithm == ERSA)) |
4181 select_all_cipher_suites, |
3946 // THEN add it to list. |
4182 tls_cipher_suites_TLS_DHE_DSS_WITH_3DES_EDE_CBC_SHA, |
3947 { |
4183 certAlgorithm, |
3948 u16_t *tmp_object = new u16_t; |
4184 EDSA, |
3949 if (tmp_object == 0) |
4185 &cipher_suites); |
3950 { |
4186 if (status != eap_status_ok) |
3951 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
4187 { |
3952 return EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error); |
4188 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
3953 } |
4189 return EAP_STATUS_RETURN(m_am_tools, status); |
3954 *tmp_object = eap_htons(tls_cipher_suites_TLS_RSA_WITH_AES_128_CBC_SHA); |
4190 } |
3955 |
4191 |
3956 status = cipher_suites.add_object(tmp_object, true); |
4192 status = select_cipher_suite( |
3957 if (status != eap_status_ok) |
4193 select_all_cipher_suites, |
3958 { |
4194 tls_cipher_suites_TLS_DHE_DSS_WITH_AES_128_CBC_SHA, |
3959 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
4195 certAlgorithm, |
3960 return EAP_STATUS_RETURN(m_am_tools, status); |
4196 EDSA, |
3961 } |
4197 &cipher_suites); |
3962 } |
4198 if (status != eap_status_ok) |
3963 if (m_allowed_cipher_suites.Find(tls_cipher_suites_TLS_DHE_DSS_WITH_3DES_EDE_CBC_SHA) != KErrNotFound |
4199 { |
3964 // AND the algorithm matches the certificates algorithm |
4200 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
3965 && (select_all_cipher_suites == true |
4201 return EAP_STATUS_RETURN(m_am_tools, status); |
3966 || certAlgorithm == EDSA)) |
4202 } |
3967 // THEN add it to list. |
4203 |
3968 { |
4204 status = select_cipher_suite( |
3969 u16_t *tmp_object = new u16_t; |
4205 select_all_cipher_suites, |
3970 if (tmp_object == 0) |
4206 tls_cipher_suites_TLS_DHE_RSA_WITH_3DES_EDE_CBC_SHA, |
3971 { |
4207 certAlgorithm, |
3972 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
4208 ERSA, |
3973 return EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error); |
4209 &cipher_suites); |
3974 } |
4210 if (status != eap_status_ok) |
3975 *tmp_object = eap_htons(tls_cipher_suites_TLS_DHE_DSS_WITH_3DES_EDE_CBC_SHA); |
4211 { |
3976 |
4212 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
3977 status = cipher_suites.add_object(tmp_object, true); |
4213 return EAP_STATUS_RETURN(m_am_tools, status); |
3978 if (status != eap_status_ok) |
4214 } |
3979 { |
4215 |
3980 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
4216 status = select_cipher_suite( |
3981 return EAP_STATUS_RETURN(m_am_tools, status); |
4217 select_all_cipher_suites, |
3982 } |
4218 tls_cipher_suites_TLS_DHE_RSA_WITH_AES_128_CBC_SHA, |
3983 } |
4219 certAlgorithm, |
3984 if (m_allowed_cipher_suites.Find(tls_cipher_suites_TLS_DHE_DSS_WITH_AES_128_CBC_SHA) != KErrNotFound |
4220 ERSA, |
3985 // AND the algorithm matches the certificates algorithm |
4221 &cipher_suites); |
3986 && (select_all_cipher_suites == true |
4222 if (status != eap_status_ok) |
3987 || certAlgorithm == EDSA)) |
4223 { |
3988 // THEN add it to list. |
4224 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
3989 { |
4225 return EAP_STATUS_RETURN(m_am_tools, status); |
3990 u16_t *tmp_object = new u16_t; |
4226 } |
3991 if (tmp_object == 0) |
4227 |
3992 { |
4228 status = select_cipher_suite( |
3993 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
4229 select_all_cipher_suites, |
3994 return EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error); |
4230 tls_cipher_suites_TLS_RSA_WITH_RC4_128_MD5, |
3995 } |
4231 certAlgorithm, |
3996 *tmp_object = eap_htons(tls_cipher_suites_TLS_DHE_DSS_WITH_AES_128_CBC_SHA); |
4232 ERSA, |
3997 |
4233 &cipher_suites); |
3998 status = cipher_suites.add_object(tmp_object, true); |
4234 if (status != eap_status_ok) |
3999 if (status != eap_status_ok) |
4235 { |
4000 { |
4236 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
4001 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
4237 return EAP_STATUS_RETURN(m_am_tools, status); |
4002 return EAP_STATUS_RETURN(m_am_tools, status); |
4238 } |
4003 } |
4239 |
4004 } |
4240 status = select_cipher_suite( |
4005 if (m_allowed_cipher_suites.Find(tls_cipher_suites_TLS_DHE_RSA_WITH_3DES_EDE_CBC_SHA) != KErrNotFound |
4241 select_all_cipher_suites, |
4006 // AND the algorithm matches the certificates algorithm |
4242 tls_cipher_suites_TLS_RSA_WITH_RC4_128_SHA, |
4007 && (select_all_cipher_suites == true |
4243 certAlgorithm, |
4008 || certAlgorithm == ERSA)) |
4244 ERSA, |
4009 // THEN add it to list. |
4245 &cipher_suites); |
4010 { |
4246 if (status != eap_status_ok) |
4011 u16_t *tmp_object = new u16_t; |
4247 { |
4012 if (tmp_object == 0) |
4248 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
4013 { |
4249 return EAP_STATUS_RETURN(m_am_tools, status); |
4014 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
4250 } |
4015 return EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error); |
4251 |
4016 } |
4252 |
4017 *tmp_object = eap_htons(tls_cipher_suites_TLS_DHE_RSA_WITH_3DES_EDE_CBC_SHA); |
|
4018 |
|
4019 status = cipher_suites.add_object(tmp_object, true); |
|
4020 if (status != eap_status_ok) |
|
4021 { |
|
4022 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
4023 return EAP_STATUS_RETURN(m_am_tools, status); |
|
4024 } |
|
4025 } |
|
4026 if (m_allowed_cipher_suites.Find(tls_cipher_suites_TLS_DHE_RSA_WITH_AES_128_CBC_SHA) != KErrNotFound |
|
4027 // AND the algorithm matches the certificates algorithm |
|
4028 && (select_all_cipher_suites == true |
|
4029 || certAlgorithm == ERSA)) |
|
4030 // THEN add it to list. |
|
4031 { |
|
4032 u16_t *tmp_object = new u16_t; |
|
4033 if (tmp_object == 0) |
|
4034 { |
|
4035 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
4036 return EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error); |
|
4037 } |
|
4038 *tmp_object = eap_htons(tls_cipher_suites_TLS_DHE_RSA_WITH_AES_128_CBC_SHA); |
|
4039 |
|
4040 status = cipher_suites.add_object(tmp_object, true); |
|
4041 if (status != eap_status_ok) |
|
4042 { |
|
4043 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
4044 return EAP_STATUS_RETURN(m_am_tools, status); |
|
4045 } |
|
4046 } |
|
4047 if (m_allowed_cipher_suites.Find(tls_cipher_suites_TLS_RSA_WITH_RC4_128_MD5) != KErrNotFound |
|
4048 // AND the algorithm matches the certificates algorithm |
|
4049 && (select_all_cipher_suites == true |
|
4050 || certAlgorithm == ERSA)) |
|
4051 // THEN add it to list. |
|
4052 { |
|
4053 u16_t *tmp_object = new u16_t; |
|
4054 if (tmp_object == 0) |
|
4055 { |
|
4056 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
4057 return EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error); |
|
4058 } |
|
4059 *tmp_object = eap_htons(tls_cipher_suites_TLS_RSA_WITH_RC4_128_MD5); |
|
4060 |
|
4061 status = cipher_suites.add_object(tmp_object, true); |
|
4062 if (status != eap_status_ok) |
|
4063 { |
|
4064 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
4065 return EAP_STATUS_RETURN(m_am_tools, status); |
|
4066 } |
|
4067 } |
|
4068 if (m_allowed_cipher_suites.Find(tls_cipher_suites_TLS_RSA_WITH_RC4_128_SHA) != KErrNotFound |
|
4069 // AND the algorithm matches the certificates algorithm |
|
4070 && (select_all_cipher_suites == true |
|
4071 || certAlgorithm == ERSA)) |
|
4072 // THEN add it to list.) |
|
4073 { |
|
4074 u16_t *tmp_object = new u16_t; |
|
4075 if (tmp_object == 0) |
|
4076 { |
|
4077 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
4078 return EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error); |
|
4079 } |
|
4080 *tmp_object = eap_htons(tls_cipher_suites_TLS_RSA_WITH_RC4_128_SHA); |
|
4081 |
|
4082 status = cipher_suites.add_object(tmp_object, true); |
|
4083 if (status != eap_status_ok) |
|
4084 { |
|
4085 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
4086 return EAP_STATUS_RETURN(m_am_tools, status); |
|
4087 } |
|
4088 } |
4253 |
4089 |
4254 if (is_session_valid()) |
4090 if (is_session_valid()) |
4255 { |
4091 { |
4256 EAP_TRACE_DEBUG( |
4092 EAP_TRACE_DEBUG( |
4257 m_am_tools, |
4093 m_am_tools, |
4924 User::Leave(KErrArgument); |
4726 User::Leave(KErrArgument); |
4925 } |
4727 } |
4926 |
4728 |
4927 #if defined(_DEBUG) || defined(DEBUG) |
4729 #if defined(_DEBUG) || defined(DEBUG) |
4928 |
4730 |
4929 { |
4731 TPtr8 certPtr( |
4930 TPtr8 certPtr( |
4732 cert->get_data(cert->get_data_length()), |
4931 cert->get_data(cert->get_data_length()), |
4733 cert->get_data_length(), |
4932 cert->get_data_length(), |
4734 cert->get_data_length()); |
4933 cert->get_data_length()); |
4735 CX509Certificate* x509Cert = CX509Certificate::NewL(certPtr); |
4934 |
4736 |
4935 CX509Certificate* x509Cert = CX509Certificate::NewL(certPtr); |
4737 if( x509Cert != NULL ) |
4936 |
4738 { |
4937 if( x509Cert != NULL ) |
4739 CleanupStack::PushL(x509Cert); |
4938 { |
4740 |
4939 CleanupStack::PushL(x509Cert); |
4741 TKeyIdentifier KeyIdentifier = x509Cert->KeyIdentifierL(); |
4940 |
4742 |
4941 TKeyIdentifier KeyIdentifier = x509Cert->KeyIdentifierL(); |
4743 EAP_TRACE_DATA_DEBUG(m_am_tools, TRACE_FLAGS_DEFAULT, (EAPL("Key identifier is"), |
|
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())); |
4942 |
4758 |
4943 EAP_TRACE_DATA_DEBUG( |
4759 CleanupStack::PopAndDestroy(); // subKeyExt |
4944 m_am_tools, |
4760 } |
4945 TRACE_FLAGS_DEFAULT, |
4761 else |
4946 (EAPL("Key identifier is"), |
4762 { |
4947 KeyIdentifier.Ptr(), |
4763 EAP_TRACE_ERROR(m_am_tools, TRACE_FLAGS_DEFAULT, (EAPL("ERROR: verify_certificate_chainL - No extension for this certificate\n"))); |
4948 KeyIdentifier.Size())); |
4764 } |
4949 |
4765 |
4950 // This is for subject key id. |
4766 CleanupStack::PopAndDestroy(x509Cert); |
4951 const CX509CertExtension* certExt = x509Cert->Extension(KSubjectKeyId); |
4767 } |
4952 |
4768 |
4953 if (certExt) |
|
4954 { |
|
4955 const CX509SubjectKeyIdExt* subKeyExt = CX509SubjectKeyIdExt::NewLC(certExt->Data()); |
|
4956 EAP_UNREFERENCED_PARAMETER(subKeyExt); |
|
4957 |
|
4958 EAP_TRACE_DATA_DEBUG(m_am_tools, TRACE_FLAGS_DEFAULT, (EAPL("The Subject key Id is:"), |
|
4959 subKeyExt->KeyId().Ptr(), |
|
4960 subKeyExt->KeyId().Size())); |
|
4961 |
|
4962 CleanupStack::PopAndDestroy(); |
|
4963 } |
|
4964 else |
|
4965 { |
|
4966 EAP_TRACE_ERROR(m_am_tools, TRACE_FLAGS_DEFAULT, (EAPL("ERROR: verify_certificate_chainL - No extension for this certificate\n"))); |
|
4967 } |
|
4968 |
|
4969 CleanupStack::PopAndDestroy(); |
|
4970 } |
|
4971 } |
|
4972 #endif |
4769 #endif |
4973 |
4770 |
|
4771 CleanupStack::PushL(chain); |
4974 temp = chain->ReAllocL(chain->Length() + cert->get_data_length()); |
4772 temp = chain->ReAllocL(chain->Length() + cert->get_data_length()); |
4975 |
|
4976 CleanupStack::Pop(chain); |
|
4977 |
|
4978 chain = temp; |
4773 chain = temp; |
4979 |
|
4980 CleanupStack::PushL(chain); |
|
4981 |
|
4982 TPtr8 ptr = chain->Des(); |
4774 TPtr8 ptr = chain->Des(); |
4983 |
|
4984 ptr.Append(cert->get_data(cert->get_data_length()), cert->get_data_length()); |
4775 ptr.Append(cert->get_data(cert->get_data_length()), cert->get_data_length()); |
4985 if (i == 0) |
4776 if (i == 0) |
4986 { |
4777 { |
4987 // This is the peer certificate. Save it. |
4778 // This is the peer certificate. Save it. |
4988 if (m_peer_certificate != 0) |
4779 if (m_peer_certificate != 0) |
4989 { |
4780 { |
4990 delete m_peer_certificate; |
4781 delete m_peer_certificate; |
4991 } |
4782 } |
4992 m_peer_certificate = CX509Certificate::NewL(ptr); |
4783 m_peer_certificate = CX509Certificate::NewL(ptr); |
4993 } |
4784 } |
4994 |
4785 CleanupStack::Pop(); |
4995 } // for() |
4786 } |
4996 |
4787 CleanupStack::PushL(chain); |
4997 |
|
4998 EAP_TRACE_DEBUG( |
|
4999 m_am_tools, |
|
5000 TRACE_FLAGS_DEFAULT, |
|
5001 (EAPL("eap_am_type_tls_peap_symbian_c::verify_certificate_chainL(): calls chain->Des()\n"))); |
|
5002 |
|
5003 TPtr8 certChain = chain->Des(); |
4788 TPtr8 certChain = chain->Des(); |
5004 TBool aUseAutomaticCaCertificate = (m_use_automatic_ca_certificate == true) ? ETrue : EFalse; |
4789 m_cert_if->ValidateChainL(certChain, m_allowed_ca_certs); |
5005 |
4790 |
5006 EAP_TRACE_DEBUG( |
4791 CleanupStack::PopAndDestroy(); |
5007 m_am_tools, |
|
5008 TRACE_FLAGS_DEFAULT, |
|
5009 (EAPL("eap_am_type_tls_peap_symbian_c::verify_certificate_chainL(): calls m_cert_if->ValidateChainL()\n"))); |
|
5010 |
|
5011 m_cert_if->ValidateChainL(certChain, m_allowed_ca_certs, aUseAutomaticCaCertificate); |
|
5012 |
|
5013 CleanupStack::PopAndDestroy(chain); |
|
5014 |
|
5015 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
4792 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
5016 |
|
5017 // This returns eap_status_pending_request |
4793 // This returns eap_status_pending_request |
5018 User::Leave(KErrCompletion); |
4794 User::Leave(KErrCompletion); |
5019 |
4795 |
5020 } |
4796 } |
5021 |
4797 |
5022 //-------------------------------------------------- |
|
5023 |
|
5024 #if defined(USE_EAP_DEBUG_TRACE) |
|
5025 |
|
5026 static eap_const_string get_certificate_error_string(const enum TValidationError certificate_error) |
|
5027 { |
|
5028 #if defined(USE_EAP_TRACE_STRINGS) |
|
5029 EAP_IF_RETURN_STRING(certificate_error, EValidatedOK) |
|
5030 else EAP_IF_RETURN_STRING(certificate_error, EChainHasNoRoot) |
|
5031 else EAP_IF_RETURN_STRING(certificate_error, ESignatureInvalid) |
|
5032 else EAP_IF_RETURN_STRING(certificate_error, EDateOutOfRange) |
|
5033 else EAP_IF_RETURN_STRING(certificate_error, ENameIsExcluded) |
|
5034 else EAP_IF_RETURN_STRING(certificate_error, ENameNotPermitted) |
|
5035 else EAP_IF_RETURN_STRING(certificate_error, ENotCACert) |
|
5036 else EAP_IF_RETURN_STRING(certificate_error, ECertificateRevoked) |
|
5037 else EAP_IF_RETURN_STRING(certificate_error, EUnrecognizedCriticalExtension) |
|
5038 else EAP_IF_RETURN_STRING(certificate_error, ENoBasicConstraintInCACert) |
|
5039 else EAP_IF_RETURN_STRING(certificate_error, ENoAcceptablePolicy) |
|
5040 else EAP_IF_RETURN_STRING(certificate_error, EPathTooLong) |
|
5041 else EAP_IF_RETURN_STRING(certificate_error, ENegativePathLengthSpecified) |
|
5042 else EAP_IF_RETURN_STRING(certificate_error, ENamesDontChain) |
|
5043 else EAP_IF_RETURN_STRING(certificate_error, ERequiredPolicyNotFound) |
|
5044 else EAP_IF_RETURN_STRING(certificate_error, EBadKeyUsage) |
|
5045 else EAP_IF_RETURN_STRING(certificate_error, ERootCertNotSelfSigned) |
|
5046 else EAP_IF_RETURN_STRING(certificate_error, ECriticalExtendedKeyUsage) |
|
5047 else EAP_IF_RETURN_STRING(certificate_error, ECriticalCertPoliciesWithQualifiers) |
|
5048 else EAP_IF_RETURN_STRING(certificate_error, ECriticalPolicyMapping) |
|
5049 else EAP_IF_RETURN_STRING(certificate_error, ECriticalDeviceId) |
|
5050 else EAP_IF_RETURN_STRING(certificate_error, ECriticalSid) |
|
5051 else EAP_IF_RETURN_STRING(certificate_error, ECriticalVid) |
|
5052 else EAP_IF_RETURN_STRING(certificate_error, ECriticalCapabilities) |
|
5053 #endif // #if defined(USE_EAP_TRACE_STRINGS) |
|
5054 { |
|
5055 EAP_UNREFERENCED_PARAMETER(certificate_error); |
|
5056 return EAPL("Unknown TValidationError"); |
|
5057 } |
|
5058 } |
|
5059 |
|
5060 #endif //#if defined(USE_EAP_DEBUG_TRACE) |
|
5061 |
|
5062 //-------------------------------------------------- |
|
5063 |
4798 |
5064 void eap_am_type_tls_peap_symbian_c::complete_validate_chain( |
4799 void eap_am_type_tls_peap_symbian_c::complete_validate_chain( |
5065 const CPKIXValidationResult * const aValidationResult, |
4800 CPKIXValidationResult& aValidationResult, eap_status_e aStatus) |
5066 const eap_status_e aStatus) |
|
5067 { |
4801 { |
5068 EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT); |
4802 EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT); |
5069 |
4803 |
5070 TValidationError validationError(EBadKeyUsage); |
|
5071 |
|
5072 if (aValidationResult != 0) |
|
5073 { |
|
5074 validationError = aValidationResult->Error().iReason; |
|
5075 } |
|
5076 |
|
5077 EAP_TRACE_DEBUG( |
|
5078 m_am_tools, |
|
5079 TRACE_FLAGS_DEFAULT, |
|
5080 (EAPL("eap_am_type_tls_peap_symbian_c::complete_validate_chain(): Certificate chain validation reason=%d=%s, status=%d=%s\n"), |
|
5081 validationError, |
|
5082 get_certificate_error_string(validationError), |
|
5083 aStatus, |
|
5084 eap_status_string_c::get_status_string(aStatus))); |
|
5085 |
|
5086 if(aStatus != eap_status_ok) |
4804 if(aStatus != eap_status_ok) |
5087 { |
4805 { |
5088 get_tls_am_partner()->complete_verify_certificate_chain(aStatus); |
4806 get_tls_am_partner()->complete_verify_certificate_chain(aStatus); |
5089 return; |
4807 return; |
5090 } |
4808 } |
5091 |
4809 |
5092 eap_status_e result(eap_status_ok); |
4810 eap_status_e result; |
5093 |
4811 if (aValidationResult.Error().iReason == EValidatedOK) |
5094 if (validationError == EValidatedOK) |
4812 { |
5095 { |
4813 EAP_TRACE_DEBUG(m_am_tools, TRACE_FLAGS_DEFAULT, |
5096 EAP_TRACE_DEBUG( |
4814 (EAPL("Certificate chain validation OK. Reason: %d\n"), |
5097 m_am_tools, |
4815 aValidationResult.Error().iReason)); |
5098 TRACE_FLAGS_DEFAULT, |
|
5099 (EAPL("Certificate chain validation OK. Reason: %d=%s\n"), |
|
5100 validationError, |
|
5101 get_certificate_error_string(validationError))); |
|
5102 |
|
5103 result = eap_status_ok; |
4816 result = eap_status_ok; |
5104 } |
4817 } |
5105 else |
4818 else |
5106 { |
4819 { |
5107 if (validationError == EDateOutOfRange) |
4820 if (aValidationResult.Error().iReason == EDateOutOfRange) |
5108 { |
4821 { |
5109 send_error_notification(eap_status_certificate_expired); |
4822 send_error_notification(eap_status_certificate_expired); |
5110 // Ignore error on purpose |
4823 // Ignore error on purpose |
5111 } |
4824 } |
5112 else |
4825 else |
5113 { |
4826 { |
5114 send_error_notification(eap_status_illegal_certificate); |
4827 send_error_notification(eap_status_illegal_certificate); |
5115 // Ignore error on purpose |
4828 // Ignore error on purpose |
5116 } |
4829 } |
5117 |
4830 |
5118 EAP_TRACE_DEBUG( |
4831 EAP_TRACE_DEBUG(m_am_tools, TRACE_FLAGS_DEFAULT, |
5119 m_am_tools, |
4832 (EAPL("ERROR: Certificate chain validation FAILED. Reason: %d\n"), |
5120 TRACE_FLAGS_DEFAULT, |
4833 aValidationResult.Error().iReason)); |
5121 (EAPL("ERROR: Certificate chain validation FAILED. Reason: %d=%s\n"), |
|
5122 validationError, |
|
5123 get_certificate_error_string(validationError))); |
|
5124 |
4834 |
5125 result = eap_status_illegal_certificate; |
4835 result = eap_status_illegal_certificate; |
5126 } |
4836 } |
5127 |
4837 |
5128 // Copy the public key |
4838 // Copy the public key |
5139 |
4849 |
5140 get_tls_am_partner()->complete_verify_certificate_chain(result); |
4850 get_tls_am_partner()->complete_verify_certificate_chain(result); |
5141 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
4851 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
5142 } |
4852 } |
5143 |
4853 |
5144 //-------------------------------------------------- |
|
5145 |
|
5146 #if defined(USE_FAST_EAP_TYPE) |
4854 #if defined(USE_FAST_EAP_TYPE) |
5147 #if defined(USE_EAP_CONFIGURATION_TO_SKIP_USER_INTERACTIONS) |
4855 #if defined(USE_EAP_CONFIGURATION_TO_SKIP_USER_INTERACTIONS) |
5148 |
|
5149 eap_status_e eap_am_type_tls_peap_symbian_c::ReadFileConfig() |
4856 eap_status_e eap_am_type_tls_peap_symbian_c::ReadFileConfig() |
5150 { |
4857 { |
5151 eap_status_e status = eap_status_ok; |
4858 eap_status_e status = eap_status_ok; |
5152 |
4859 |
5153 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
4860 eap_am_file_input_symbian_c * const fileio = new eap_am_file_input_symbian_c(m_am_tools); |
5154 |
4861 |
5155 status = EapConfigToolsSymbian::EapReadDefaultConfigFileSymbian( |
4862 eap_automatic_variable_c<eap_am_file_input_symbian_c> automatic_fileio(m_am_tools, fileio); |
5156 m_am_tools, |
4863 |
5157 &m_fileconfig); |
4864 if (fileio != 0 |
5158 if (status != eap_status_ok) |
4865 && fileio->get_is_valid() == true) |
5159 { |
4866 { |
5160 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
4867 EAP_TRACE_DEBUG( |
5161 return EAP_STATUS_RETURN(m_am_tools, status); |
4868 m_am_tools, |
5162 } |
4869 TRACE_FLAGS_DEFAULT, |
5163 |
4870 (EAPL("Initialize file configuration.\n"))); |
5164 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
4871 |
5165 |
4872 eap_variable_data_c file_name_c_data(m_am_tools); |
5166 |
4873 |
5167 eap_variable_data_c skip_user_interactions(m_am_tools); |
4874 { |
5168 |
4875 #if defined(EAPOL_SYMBIAN_VERSION_7_0_s) |
5169 if (m_fileconfig != 0 |
4876 eap_const_string const FILECONFIG_FILENAME_C |
5170 && m_fileconfig->get_is_valid() == true) |
4877 = "c:\\system\\data\\eap.conf"; |
5171 { |
4878 #else |
5172 // Here we could try the final configuration option. |
4879 eap_const_string const FILECONFIG_FILENAME_C |
5173 status = m_fileconfig->read_configure( |
4880 = "c:\\private\\101F8EC5\\eap.conf"; |
5174 cf_str_EAP_skip_user_interactions_for_testing_purposes.get_field(), |
4881 #endif |
5175 &skip_user_interactions); |
4882 |
5176 } |
4883 status = file_name_c_data.set_copy_of_buffer( |
5177 |
4884 FILECONFIG_FILENAME_C, |
5178 if (status == eap_status_ok |
4885 m_am_tools->strlen(FILECONFIG_FILENAME_C)); |
5179 && skip_user_interactions.get_is_valid_data() == true) |
4886 if (status != eap_status_ok) |
5180 { |
4887 { |
5181 u32_t *skip_user_interactions_flag = reinterpret_cast<u32_t *>( |
4888 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
5182 skip_user_interactions.get_data(sizeof(u32_t))); |
4889 return EAP_STATUS_RETURN(m_am_tools, status); |
5183 if (skip_user_interactions_flag != 0) |
4890 } |
5184 { |
4891 |
5185 if (*skip_user_interactions_flag != 0) |
4892 status = file_name_c_data.add_end_null(); |
5186 { |
4893 if (status != eap_status_ok) |
5187 m_skip_user_interactions = true; |
4894 { |
5188 } |
4895 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
5189 else |
4896 return EAP_STATUS_RETURN(m_am_tools, status); |
5190 { |
4897 } |
5191 m_skip_user_interactions = false; |
4898 } |
5192 } |
4899 |
5193 } |
4900 eap_variable_data_c file_name_z_data(m_am_tools); |
5194 } |
4901 |
5195 |
4902 { |
5196 iPacStoreDb->SkipUserActions(m_skip_user_interactions); |
4903 #if defined(EAPOL_SYMBIAN_VERSION_7_0_s) |
5197 |
4904 eap_const_string const FILECONFIG_FILENAME_Z |
5198 return status; |
4905 = "z:\\system\\data\\eap.conf"; |
5199 } |
4906 #else |
5200 |
4907 eap_const_string const FILECONFIG_FILENAME_Z |
|
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 } |
5201 #endif //#if defined(USE_EAP_CONFIGURATION_TO_SKIP_USER_INTERACTIONS) |
5051 #endif //#if defined(USE_EAP_CONFIGURATION_TO_SKIP_USER_INTERACTIONS) |
5202 #endif |
5052 #endif |
5203 |
5053 |
5204 |
5054 |
5205 //-------------------------------------------------- |
5055 //-------------------------------------------------- |
5290 TRACE_FLAGS_DEFAULT, |
5136 TRACE_FLAGS_DEFAULT, |
5291 (EAPL("eap_am_type_tls_peap_symbian_c::complete_get_matching_certificates(): EHandlingIdentityQuery\n"))); |
5137 (EAPL("eap_am_type_tls_peap_symbian_c::complete_get_matching_certificates(): EHandlingIdentityQuery\n"))); |
5292 |
5138 |
5293 // Add found certs to allowed certificate list. |
5139 // Add found certs to allowed certificate list. |
5294 // This list is updated here because there might be certificates that have been removed. |
5140 // This list is updated here because there might be certificates that have been removed. |
5295 m_allowed_user_certs.ResetAndDestroy(); |
5141 m_allowed_user_certs.Reset(); |
5296 |
5142 for (TInt i = 0; i < aMatchingCerts.Count(); i++) |
5297 for (TInt i = 0; i < aMatchingCerts.Count() && aMatchingCerts[i] != 0; i++) |
5143 { |
5298 { |
5144 TRAPD(err, m_allowed_user_certs.AppendL(aMatchingCerts[i])); |
5299 EapCertificateEntry * const entry = aMatchingCerts[i]->Copy(); |
5145 if (err != KErrNone) |
5300 if (entry == 0) |
|
5301 { |
5146 { |
5302 EAP_TRACE_DEBUG( |
5147 EAP_TRACE_DEBUG( |
5303 m_am_tools, |
5148 m_am_tools, |
5304 TRACE_FLAGS_DEFAULT, |
5149 TRACE_FLAGS_DEFAULT, |
5305 (EAPL("ERROR: EAP-TLS: No memory.\n"))); |
5150 (EAPL("ERROR: eap_am_type_tls_peap_symbian_c::complete_get_matching_certificates -EHandlingIdentityQuery- Error=%d\n"), |
5306 |
5151 err)); |
|
5152 |
5307 get_am_partner()->complete_eap_identity_query( |
5153 get_am_partner()->complete_eap_identity_query( |
5308 0, // 0 because identity query failed |
5154 0, // 0 because identity query failed |
5309 &m_receive_network_id, |
5155 &m_receive_network_id, |
5310 m_eap_identifier, |
5156 m_eap_identifier, |
5311 eap_status_allocation_error, |
5157 eap_status_allocation_error, |
5312 false, |
5158 false, |
5313 0, |
5159 0, |
5314 false, |
5160 false, |
5315 0); |
5161 0); |
5316 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
5317 return; |
|
5318 } |
|
5319 |
|
5320 TInt error = m_allowed_user_certs.Append(entry); |
|
5321 if (error != KErrNone) |
|
5322 { |
|
5323 EAP_TRACE_DEBUG( |
|
5324 m_am_tools, |
|
5325 TRACE_FLAGS_DEFAULT, |
|
5326 (EAPL("ERROR: eap_am_type_tls_peap_symbian_c::complete_get_matching_certificates(): -EHandlingIdentityQuery- Error=%d\n"), |
|
5327 error)); |
|
5328 |
|
5329 get_am_partner()->complete_eap_identity_query( |
|
5330 0, // 0 because identity query failed |
|
5331 &m_receive_network_id, |
|
5332 m_eap_identifier, |
|
5333 eap_status_allocation_error, |
|
5334 false, |
|
5335 0, |
|
5336 false, |
|
5337 0); |
|
5338 |
|
5339 delete entry; |
|
5340 |
5162 |
5341 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
5163 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
5342 return; |
5164 return; |
5343 } |
5165 } |
5344 } |
5166 } |
5376 // Since there is no user certificate or manual realm configured |
5198 // Since there is no user certificate or manual realm configured |
5377 // the realm needs to be dig out from the CA certificate. |
5199 // the realm needs to be dig out from the CA certificate. |
5378 EAP_TRACE_DEBUG( |
5200 EAP_TRACE_DEBUG( |
5379 m_am_tools, |
5201 m_am_tools, |
5380 TRACE_FLAGS_DEFAULT, |
5202 TRACE_FLAGS_DEFAULT, |
5381 (EAPL("eap_am_type_tls_peap_symbian_c::complete_get_matching_certificates(): no manual realm - no user cert. Get realm from CA certificate.\n"))); |
5203 (EAPL("eap_am_type_tls_peap_symbian_c: no manual realm - no user cert. Get realm from CA certificate.\n"))); |
5382 |
5204 |
5383 TInt allowed_ca_cert_count = m_allowed_ca_certs.Count(); |
5205 TInt allowed_ca_cert_count = m_allowed_ca_certs.Count(); |
5384 TInt err(KErrNone); |
5206 TInt err(KErrNone); |
5385 |
5207 |
5386 if(allowed_ca_cert_count > 0) |
5208 if(allowed_ca_cert_count > 0) |
5387 { |
5209 { |
5388 TRAP(err, m_cert_if->ReadCACertificateL(*m_allowed_ca_certs[0])); |
5210 TRAP(err, m_cert_if->ReadCACertificateL(m_allowed_ca_certs[0])); |
5389 } |
5211 } |
5390 |
5212 if (err != KErrNone || allowed_ca_cert_count <= 0) |
5391 if (err != KErrNone |
|
5392 || allowed_ca_cert_count <= 0) |
|
5393 { |
5213 { |
5394 if (m_use_automatic_ca_certificate == false) |
5214 EAP_TRACE_DEBUG( |
5395 { |
5215 m_am_tools, |
5396 EAP_TRACE_DEBUG( |
5216 TRACE_FLAGS_DEFAULT, |
5397 m_am_tools, |
5217 (EAPL("ERROR: EAP-TLS: Cannot read user certificate or No CA cert configured, CA cert count=%d.\n"), |
5398 TRACE_FLAGS_DEFAULT, |
5218 allowed_ca_cert_count)); |
5399 (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"), |
5219 |
5400 allowed_ca_cert_count)); |
5220 get_am_partner()->complete_eap_identity_query( |
5401 |
5221 0, // 0 because identity query failed |
5402 get_am_partner()->complete_eap_identity_query( |
5222 &m_receive_network_id, |
5403 0, // 0 because identity query failed |
5223 m_eap_identifier, |
5404 &m_receive_network_id, |
5224 eap_status_illegal_certificate, |
5405 m_eap_identifier, |
5225 false, |
5406 eap_status_illegal_certificate, |
5226 0, |
5407 false, |
5227 false, |
5408 0, |
5228 0); |
5409 false, |
5229 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
5410 0); |
5230 return; |
5411 |
|
5412 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
5413 return; |
|
5414 } |
|
5415 else |
|
5416 { |
|
5417 EAP_TRACE_DEBUG( |
|
5418 m_am_tools, |
|
5419 TRACE_FLAGS_DEFAULT, |
|
5420 (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"), |
|
5421 m_allowed_ca_certs.Count())); |
|
5422 |
|
5423 get_am_partner()->complete_eap_identity_query( |
|
5424 0, // 0 because certificate query failed |
|
5425 &m_receive_network_id, |
|
5426 m_eap_identifier, |
|
5427 eap_status_ok, |
|
5428 false, |
|
5429 0, |
|
5430 false, |
|
5431 0); |
|
5432 } |
|
5433 } |
5231 } |
5434 |
|
5435 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
5232 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
5436 return; |
5233 return; |
5437 } |
5234 } |
5438 else |
5235 else |
5439 { |
5236 { |
5466 else if (m_state == EHandlingChainQuery) |
5263 else if (m_state == EHandlingChainQuery) |
5467 { |
5264 { |
5468 |
5265 |
5469 if (aMatchingCerts.Count() > 0) |
5266 if (aMatchingCerts.Count() > 0) |
5470 { |
5267 { |
5471 TInt error; |
5268 m_allowed_user_certs.Reset(); |
5472 |
5269 |
5473 m_allowed_user_certs.ResetAndDestroy(); |
5270 for (TInt i = 0; i < aMatchingCerts.Count(); i++) |
5474 |
|
5475 for (TInt i = 0; i < aMatchingCerts.Count(); i++) |
|
5476 { |
|
5477 EapCertificateEntry * const entry = aMatchingCerts[i]->Copy(); |
|
5478 if (entry != 0) |
|
5479 { |
5271 { |
5480 TRAP(error, m_allowed_user_certs.AppendL(entry)); |
5272 TRAPD(err, m_allowed_user_certs.AppendL(aMatchingCerts[i])); |
5481 } |
5273 if (err != KErrNone) |
5482 else |
5274 { |
5483 { |
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"), |
5484 error = KErrNoMemory; |
5276 err)); |
5485 } |
5277 |
5486 |
5278 get_tls_am_partner()->complete_query_certificate_chain(0, eap_status_allocation_error); |
5487 if (error != KErrNone) |
5279 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
5488 { |
5280 return; |
5489 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"), |
5281 } |
5490 error)); |
|
5491 |
|
5492 get_tls_am_partner()->complete_query_certificate_chain(0, eap_status_allocation_error); |
|
5493 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
5494 return; |
|
5495 } |
|
5496 } |
5282 } |
5497 } |
5283 } |
5498 |
5284 |
5499 if (m_allowed_user_certs.Count() == 0) |
5285 if (m_allowed_user_certs.Count() == 0) |
5500 { |
5286 { |
5501 // No matching or allowed certs and no pre-loaded cert. |
5287 // No matching or allowed certs and no pre-loaded cert. |
5502 // Could not find matching certificate |
5288 // Could not find matching certificate |
5503 |
5289 |
5504 EAP_TRACE_DEBUG( |
5290 EAP_TRACE_DEBUG(m_am_tools, TRACE_FLAGS_DEFAULT, (EAPL("EAP-TLS: Could not find proper user certificate.\n"))); |
5505 m_am_tools, |
|
5506 TRACE_FLAGS_DEFAULT, |
|
5507 (EAPL("EAP-TLS: Could not find proper user certificate.\n"))); |
|
5508 |
5291 |
5509 if (m_tls_peap_server_authenticates_client_policy_flag == true) |
5292 if (m_tls_peap_server_authenticates_client_policy_flag == true) |
5510 { |
5293 { |
5511 EAP_TRACE_DEBUG( |
|
5512 m_am_tools, |
|
5513 TRACE_FLAGS_DEFAULT, |
|
5514 (EAPL("ERROR: EAP-TLS: Could not find proper user certificate and anonymous cliet is not allowed.\n"))); |
|
5515 |
|
5516 send_error_notification(eap_status_user_certificate_unknown); |
5294 send_error_notification(eap_status_user_certificate_unknown); |
5517 } |
5295 } |
5518 |
5296 |
5519 get_tls_am_partner()->complete_query_certificate_chain(0, eap_status_illegal_certificate); |
5297 get_tls_am_partner()->complete_query_certificate_chain(0, eap_status_illegal_certificate); |
5520 |
5298 |
6373 { |
6142 { |
6374 EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT); |
6143 EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT); |
6375 |
6144 |
6376 eap_status_e status(eap_status_illegal_eap_type); |
6145 eap_status_e status(eap_status_illegal_eap_type); |
6377 |
6146 |
|
6147 #ifdef USE_EAP_EXPANDED_TYPES |
|
6148 |
6378 EAP_TRACE_DEBUG(m_am_tools, |
6149 EAP_TRACE_DEBUG(m_am_tools, |
6379 TRACE_FLAGS_DEFAULT, |
6150 TRACE_FLAGS_DEFAULT, |
6380 (EAPL("eap_am_type_tls_peap_symbian_c::check_is_valid_eap_type:Given EAP-type=0xfe%06x%08x\n"), |
6151 (EAPL("eap_am_type_tls_peap_symbian_c::check_is_valid_eap_type:Given EAP vendor ID=%x, type=%x\n"), |
6381 eap_type.get_vendor_id(), |
6152 eap_type.get_vendor_id(), eap_type.get_vendor_type())); |
6382 eap_type.get_vendor_type())); |
|
6383 |
6153 |
6384 for (TInt i = 0; i < m_enabled_tunneling_exp_eap_array.Count(); i++) |
6154 for (TInt i = 0; i < m_enabled_tunneling_exp_eap_array.Count(); i++) |
6385 { |
6155 { |
6386 eap_expanded_type_c expEAPTmp; |
6156 eap_expanded_type_c expEAPTmp; |
6387 |
6157 |
6388 TInt error = CEapConversion::ConvertExpandedEAPTypeToInternalType( |
6158 // This will read the expanded EAP from enabledEAPTypes[i]->iExpandedEAPType to expEAPTmp. |
6389 m_enabled_tunneling_exp_eap_array[i], |
6159 // This makes easy to get the vendor type. |
6390 &expEAPTmp); |
6160 eap_expanded_type_c::read_type( m_am_tools, |
6391 |
6161 0, |
6392 if (error != KErrNone) |
6162 m_enabled_tunneling_exp_eap_array[i]->iExpandedEAPType.Ptr(), |
6393 { |
6163 KExpandedEAPTypeSize, |
6394 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
6164 &expEAPTmp); |
6395 return EAP_STATUS_RETURN(m_am_tools, m_am_tools->convert_am_error_to_eapol_error(error)); |
6165 |
6396 } |
|
6397 |
|
6398 EAP_TRACE_DATA_DEBUG( |
6166 EAP_TRACE_DATA_DEBUG( |
6399 m_am_tools, |
6167 m_am_tools, |
6400 TRACE_FLAGS_DEFAULT, |
6168 TRACE_FLAGS_DEFAULT, |
6401 (EAPL("check_is_valid_eap_type:Checking with EAP type:"), |
6169 (EAPL("check_is_valid_eap_type:Checking with EAP type:"), |
6402 m_enabled_tunneling_exp_eap_array[i]->GetValue().Ptr(), |
6170 m_enabled_tunneling_exp_eap_array[i]->iExpandedEAPType.Ptr(), |
6403 m_enabled_tunneling_exp_eap_array[i]->GetValue().Size())); |
6171 m_enabled_tunneling_exp_eap_array[i]->iExpandedEAPType.Size())); |
6404 |
6172 |
6405 if (eap_type == expEAPTmp) |
6173 if (eap_type == expEAPTmp) |
6406 { |
6174 { |
6407 // This EAp type is one among the enabled ones. Hence a valid EAP type. |
6175 // This EAp type is one among the enabled ones. Hence a valid EAP type. |
6408 status = eap_status_ok; |
6176 status = eap_status_ok; |
6409 break; |
6177 break; |
6410 } |
6178 } |
6411 } |
6179 } |
6412 |
6180 |
|
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 |
6413 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
6208 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
6209 |
6414 return EAP_STATUS_RETURN(m_am_tools, status); |
6210 return EAP_STATUS_RETURN(m_am_tools, status); |
6415 } |
6211 } |
6416 |
6212 |
6417 //-------------------------------------------------- |
6213 //-------------------------------------------------- |
6418 |
6214 |
6425 TRACE_FLAGS_DEFAULT, |
6221 TRACE_FLAGS_DEFAULT, |
6426 (EAPL("eap_am_type_tls_peap_symbian_c::get_eap_type_list - Start\n"))); |
6222 (EAPL("eap_am_type_tls_peap_symbian_c::get_eap_type_list - Start\n"))); |
6427 |
6223 |
6428 eap_status_e status(eap_status_illegal_eap_type); |
6224 eap_status_e status(eap_status_illegal_eap_type); |
6429 |
6225 |
|
6226 #ifdef USE_EAP_EXPANDED_TYPES |
|
6227 |
6430 // We need to return only the EAP types available as enabled types. |
6228 // We need to return only the EAP types available as enabled types. |
6431 // It means only the ones available in m_enabled_tunneling_exp_eap_array. |
6229 // It means only the ones available in m_enabled_tunneling_exp_eap_array. |
6432 |
6230 |
6433 for (TInt i = 0; i < m_enabled_tunneling_exp_eap_array.Count(); i++) |
6231 for (TInt i = 0; i < m_enabled_tunneling_exp_eap_array.Count(); i++) |
6434 { |
6232 { |
|
6233 TBuf8<KExpandedEAPTypeSize> tmpExpEAP(m_enabled_tunneling_exp_eap_array[i]->iExpandedEAPType); |
|
6234 |
6435 EAP_TRACE_DEBUG( |
6235 EAP_TRACE_DEBUG( |
6436 m_am_tools, |
6236 m_am_tools, |
6437 TRACE_FLAGS_DEFAULT, |
6237 TRACE_FLAGS_DEFAULT, |
6438 (EAPL("eap_am_type_tls_peap_symbian_c::get_eap_type_list:Enabled expanded EAP type at index=%d\n"), |
6238 (EAPL("eap_am_type_tls_peap_symbian_c::get_eap_type_list:Enabled expanded EAP type at index=%d\n"), |
6439 i)); |
6239 i)); |
6440 |
6240 |
6441 EAP_TRACE_DATA_DEBUG( |
6241 EAP_TRACE_DATA_DEBUG( |
6442 m_am_tools, |
6242 m_am_tools, |
6443 TRACE_FLAGS_DEFAULT, |
6243 TRACE_FLAGS_DEFAULT, |
6444 (EAPL("Enabled expanded EAP type:"), |
6244 (EAPL("Enabled expanded EAP type:"), |
6445 m_enabled_tunneling_exp_eap_array[i]->GetValue().Ptr(), |
6245 tmpExpEAP.Ptr(), |
6446 m_enabled_tunneling_exp_eap_array[i]->GetValue().Size())); |
6246 tmpExpEAP.Size())); |
6447 |
6247 |
6448 // This is for one expanded EAP type (for the above one). |
6248 // This is for one expanded EAP type (for the above one). |
6449 eap_type_value_e * expandedEAPType = new eap_type_value_e(); |
6249 eap_type_value_e * expandedEAPType = new eap_type_value_e(); |
6450 |
6250 |
6451 eap_automatic_variable_c<eap_type_value_e> automatic_expandedEAPType( |
6251 // Read the expanded EAP type details from an item in m_enabled_tunneling_exp_eap_array. |
6452 m_am_tools, |
6252 status = eap_type_value_e::read_type(m_am_tools, |
6453 expandedEAPType); |
6253 0, |
6454 |
6254 &tmpExpEAP, |
6455 TInt error = CEapConversion::ConvertExpandedEAPTypeToInternalType( |
6255 tmpExpEAP.Length(), |
6456 m_enabled_tunneling_exp_eap_array[i], |
6256 expandedEAPType); |
6457 expandedEAPType); |
6257 if (status != eap_status_ok) |
6458 |
6258 { |
6459 if (error != KErrNone) |
6259 delete expandedEAPType; |
6460 { |
6260 expandedEAPType = 0; |
6461 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
6261 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
6462 return EAP_STATUS_RETURN(m_am_tools, m_am_tools->convert_am_error_to_eapol_error(error)); |
6262 return EAP_STATUS_RETURN(m_am_tools, status); |
6463 } |
6263 } |
6464 |
|
6465 automatic_expandedEAPType.do_not_free_variable(); |
|
6466 |
6264 |
6467 // Add EAP-type to list. |
6265 // Add EAP-type to list. |
6468 status = eap_type_list->add_object(expandedEAPType, true); |
6266 status = eap_type_list->add_object(expandedEAPType, true); |
6469 if (status != eap_status_ok) |
6267 if (status != eap_status_ok) |
6470 { |
6268 { |
6476 EAP_UNREFERENCED_PARAMETER(eap_string); |
6274 EAP_UNREFERENCED_PARAMETER(eap_string); |
6477 |
6275 |
6478 EAP_TRACE_DEBUG( |
6276 EAP_TRACE_DEBUG( |
6479 m_am_tools, |
6277 m_am_tools, |
6480 TRACE_FLAGS_DEFAULT, |
6278 TRACE_FLAGS_DEFAULT, |
6481 (EAPL("get_eap_type_list():added EAP-type=0xfe%06x%08x=%s\n"), |
6279 (EAPL("get_eap_type_list():added EAP-type=0x%08x=%s\n"), |
6482 expandedEAPType->get_vendor_id(), |
|
6483 expandedEAPType->get_vendor_type(), |
6280 expandedEAPType->get_vendor_type(), |
6484 eap_header_string_c::get_eap_type_string(*expandedEAPType))); |
6281 eap_string.get_eap_type_string(*expandedEAPType))); |
6485 |
6282 |
6486 }// for() |
6283 }// 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 |
6487 |
6324 |
6488 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
6325 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
6489 return eap_status_ok; |
6326 return eap_status_ok; |
6490 } |
6327 } |
6491 |
|
6492 //-------------------------------------------------- |
|
6493 |
6328 |
6494 eap_status_e eap_am_type_tls_peap_symbian_c::unload_module(const eap_type_value_e /*type*/) |
6329 eap_status_e eap_am_type_tls_peap_symbian_c::unload_module(const eap_type_value_e /*type*/) |
6495 { |
6330 { |
6496 EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT); |
6331 EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT); |
6497 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
6332 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
6498 return EAP_STATUS_RETURN(m_am_tools, eap_status_not_supported); |
6333 return EAP_STATUS_RETURN(m_am_tools, eap_status_not_supported); |
6499 } |
6334 } |
6500 |
6335 |
6501 //-------------------------------------------------- |
|
6502 |
6336 |
6503 void eap_am_type_tls_peap_symbian_c::send_error_notification(const eap_status_e error) |
6337 void eap_am_type_tls_peap_symbian_c::send_error_notification(const eap_status_e error) |
6504 { |
6338 { |
6505 EAP_TRACE_DEBUG(m_am_tools, |
6339 EAP_TRACE_DEBUG(m_am_tools, |
6506 TRACE_FLAGS_DEFAULT, |
6340 TRACE_FLAGS_DEFAULT, |
6785 { |
6626 { |
6786 EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT); |
6627 EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT); |
6787 |
6628 |
6788 EAP_TRACE_DEBUG(m_am_tools, |
6629 EAP_TRACE_DEBUG(m_am_tools, |
6789 TRACE_FLAGS_DEFAULT, ( |
6630 TRACE_FLAGS_DEFAULT, ( |
6790 EAPL("eap_am_type_tls_peap_symbian_c::is_session_valid - m_current_eap_vendor_type=0xfe%06x%08x\n"), |
6631 EAPL("eap_am_type_tls_peap_symbian_c::is_session_valid - m_current_eap_vendor_type=%d \n"), |
6791 m_current_eap_type.get_vendor_id(), |
6632 m_current_eap_vendor_type)); |
6792 m_current_eap_type.get_vendor_type())); |
|
6793 |
6633 |
6794 TPtrC maxSessionTimeString; |
6634 TPtrC maxSessionTimeString; |
6795 TPtrC lastFullAuthTimeString; |
6635 TPtrC lastFullAuthTimeString; |
6796 |
6636 |
6797 if (m_current_eap_type == eap_type_tls) |
6637 switch (m_current_eap_vendor_type) |
6798 { |
6638 { |
6799 maxSessionTimeString.Set(cf_str_EAP_TLS_max_session_validity_time_literal); |
6639 case eap_type_tls: |
6800 lastFullAuthTimeString.Set(KTLSLastFullAuthTime); |
6640 { |
6801 } |
6641 maxSessionTimeString.Set(cf_str_EAP_TLS_max_session_validity_time_literal); |
6802 else if (m_current_eap_type == eap_type_peap) |
6642 lastFullAuthTimeString.Set(KTLSLastFullAuthTime); |
6803 { |
6643 } |
6804 maxSessionTimeString.Set(cf_str_EAP_PEAP_max_session_validity_time_literal); |
6644 break; |
6805 lastFullAuthTimeString.Set(KPEAPLastFullAuthTime); |
6645 |
6806 } |
6646 case eap_type_peap: |
6807 else if (m_current_eap_type == eap_type_ttls) |
6647 { |
6808 { |
6648 maxSessionTimeString.Set(cf_str_EAP_PEAP_max_session_validity_time_literal); |
6809 maxSessionTimeString.Set(cf_str_EAP_TTLS_max_session_validity_time_literal); |
6649 lastFullAuthTimeString.Set(KPEAPLastFullAuthTime); |
6810 lastFullAuthTimeString.Set(KTTLSLastFullAuthTime); |
6650 } |
6811 } |
6651 break; |
|
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 |
6812 #if defined(USE_FAST_EAP_TYPE) |
6660 #if defined(USE_FAST_EAP_TYPE) |
6813 else if (m_current_eap_type == eap_type_fast) |
6661 case eap_type_fast: |
6814 { |
6662 { |
6815 maxSessionTimeString.Set(cf_str_EAP_FAST_max_session_validity_time_literal); |
6663 maxSessionTimeString.Set(cf_str_EAP_FAST_max_session_validity_time_literal); |
6816 lastFullAuthTimeString.Set(KFASTLastFullAuthTime); |
6664 lastFullAuthTimeString.Set(KFASTLastFullAuthTime); |
6817 } |
6665 } |
|
6666 break; |
6818 #endif |
6667 #endif |
6819 else if (m_current_eap_type == eap_expanded_type_ttls_plain_pap.get_type()) |
6668 |
6820 { |
6669 case eap_type_ttls_plain_pap: |
6821 // we should not come here, ttls pap has its own |
6670 { |
6822 // method for checking session validity |
6671 // we should not come here, ttls pap has its own |
6823 EAP_TRACE_ERROR( m_am_tools, TRACE_FLAGS_DEFAULT, ( |
6672 // method for checking session validity |
6824 EAPL( "ERROR: wrong eap type.\n" ) ) ); |
6673 EAP_TRACE_ERROR( m_am_tools, TRACE_FLAGS_DEFAULT, ( |
6825 return false; |
6674 EAPL( "ERROR: wrong eap type.\n" ) ) ); |
6826 } |
6675 return false; |
6827 else |
6676 } |
6828 { |
6677 |
6829 // Should never happen |
6678 default: |
6830 EAP_TRACE_ERROR(m_am_tools, |
6679 { |
6831 TRACE_FLAGS_DEFAULT, ( |
6680 // Should never happen |
6832 EAPL("Unsupported EAP type, m_current_eap_vendor_type=0xfe%06x%08x\n"), |
6681 EAP_TRACE_ERROR(m_am_tools, |
6833 m_current_eap_type.get_vendor_id(), |
6682 TRACE_FLAGS_DEFAULT, ( |
6834 m_current_eap_type.get_vendor_type())); |
6683 EAPL("Unsupported EAP type, m_current_eap_vendor_type=%d \n"), |
6835 |
6684 m_current_eap_vendor_type)); |
6836 return false; // Treat this as Session invalid. |
6685 |
6837 } |
6686 return false; // Treat this as Session invalid. |
|
6687 } |
|
6688 } |
6838 |
6689 |
6839 HBufC* buf = HBufC::NewLC(KMaxSqlQueryLength); |
6690 HBufC* buf = HBufC::NewLC(KMaxSqlQueryLength); |
6840 TPtr sqlStatement = buf->Des(); |
6691 TPtr sqlStatement = buf->Des(); |
6841 |
6692 |
6842 // Query all the relevant parameters |
6693 // Query all the relevant parameters |
6843 _LIT(KSQLQuery, "SELECT %S, %S FROM %S WHERE %S=%d AND %S=%d AND %S=%d AND %S=%d"); |
6694 _LIT(KSQLQuery, "SELECT %S, %S FROM %S WHERE %S=%d AND %S=%d AND %S=%d"); |
6844 |
6695 sqlStatement.Format(KSQLQuery, &maxSessionTimeString, &lastFullAuthTimeString, &m_db_table_name, |
6845 sqlStatement.Format( |
6696 &KServiceType, m_index_type, |
6846 KSQLQuery, |
6697 &KServiceIndex, m_index, &KTunnelingType, m_tunneling_vendor_type); |
6847 &maxSessionTimeString, |
|
6848 &lastFullAuthTimeString, |
|
6849 &m_db_table_name, |
|
6850 &KServiceType, |
|
6851 m_index_type, |
|
6852 &KServiceIndex, |
|
6853 m_index, |
|
6854 &KTunnelingTypeVendorId, |
|
6855 m_tunneling_type.get_vendor_id(), |
|
6856 &KTunnelingType, |
|
6857 m_tunneling_type.get_vendor_type()); |
|
6858 |
6698 |
6859 RDbView view; |
6699 RDbView view; |
6860 // Evaluate view |
6700 // Evaluate view |
6861 User::LeaveIfError(view.Prepare(m_database, TDbQuery(sqlStatement))); |
6701 User::LeaveIfError(view.Prepare(m_database, TDbQuery(sqlStatement))); |
6862 CleanupClosePushL(view); |
6702 CleanupClosePushL(view); |
6964 { |
6804 { |
6965 EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT); |
6805 EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT); |
6966 |
6806 |
6967 EAP_TRACE_DEBUG(m_am_tools, |
6807 EAP_TRACE_DEBUG(m_am_tools, |
6968 TRACE_FLAGS_DEFAULT, |
6808 TRACE_FLAGS_DEFAULT, |
6969 (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"), |
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"), |
6970 m_index_type, |
6810 m_index_type, m_index, m_tunneling_vendor_type, m_current_eap_vendor_type)); |
6971 m_index, |
|
6972 m_tunneling_type.get_vendor_id(), |
|
6973 m_tunneling_type.get_vendor_type(), |
|
6974 m_current_eap_type.get_vendor_id(), |
|
6975 m_current_eap_type.get_vendor_type())); |
|
6976 |
6811 |
6977 TPtrC lastFullAuthTimeString; |
6812 TPtrC lastFullAuthTimeString; |
6978 |
6813 |
6979 if (m_current_eap_type == eap_type_tls) |
6814 switch (m_current_eap_vendor_type) |
6980 { |
6815 { |
6981 lastFullAuthTimeString.Set(KTLSLastFullAuthTime); |
6816 case eap_type_tls: |
6982 } |
6817 { |
6983 else if (m_current_eap_type == eap_type_peap) |
6818 lastFullAuthTimeString.Set(KTLSLastFullAuthTime); |
6984 { |
6819 } |
6985 lastFullAuthTimeString.Set(KPEAPLastFullAuthTime); |
6820 break; |
6986 } |
6821 |
6987 else if (m_current_eap_type == eap_type_ttls) |
6822 case eap_type_peap: |
6988 { |
6823 { |
6989 lastFullAuthTimeString.Set(KTTLSLastFullAuthTime); |
6824 lastFullAuthTimeString.Set(KPEAPLastFullAuthTime); |
6990 } |
6825 } |
6991 else if (m_current_eap_type == eap_expanded_type_ttls_plain_pap.get_type()) |
6826 break; |
6992 { |
6827 |
|
6828 case eap_type_ttls: |
|
6829 { |
|
6830 lastFullAuthTimeString.Set(KTTLSLastFullAuthTime); |
|
6831 } |
|
6832 break; |
|
6833 |
|
6834 case eap_type_ttls_plain_pap: |
|
6835 { |
6993 lastFullAuthTimeString.Set( KTTLSPAPLastFullAuthTime ); |
6836 lastFullAuthTimeString.Set( KTTLSPAPLastFullAuthTime ); |
6994 } |
6837 } |
|
6838 break; |
|
6839 |
6995 #if defined(USE_FAST_EAP_TYPE) |
6840 #if defined(USE_FAST_EAP_TYPE) |
6996 else if (m_current_eap_type == eap_type_fast) |
6841 case eap_type_fast: |
6997 { |
6842 { |
6998 lastFullAuthTimeString.Set(KFASTLastFullAuthTime); |
6843 lastFullAuthTimeString.Set(KFASTLastFullAuthTime); |
6999 } |
6844 } |
|
6845 break; |
7000 #endif |
6846 #endif |
7001 else |
6847 |
7002 { |
6848 default: |
7003 // Should never happen |
6849 { |
7004 EAP_TRACE_ERROR(m_am_tools, |
6850 // Should never happen |
7005 TRACE_FLAGS_DEFAULT, ( |
6851 EAP_TRACE_ERROR(m_am_tools, |
7006 EAPL("Unsupported EAP type, m_current_eap_vendor_type=0xfe%06x%08x\n"), |
6852 TRACE_FLAGS_DEFAULT, ( |
7007 m_current_eap_type.get_vendor_id(), |
6853 EAPL("Unsupported EAP type, m_current_eap_vendor_type=%d \n"), |
7008 m_current_eap_type.get_vendor_type())); |
6854 m_current_eap_vendor_type)); |
7009 |
6855 |
7010 User::Leave(KErrNotSupported); |
6856 User::Leave(KErrNotSupported); |
7011 } |
6857 } |
|
6858 } |
7012 |
6859 |
7013 HBufC* buf = HBufC::NewLC(KMaxSqlQueryLength); |
6860 HBufC* buf = HBufC::NewLC(KMaxSqlQueryLength); |
7014 TPtr sqlStatement = buf->Des(); |
6861 TPtr sqlStatement = buf->Des(); |
7015 |
6862 |
7016 // Query all the relevant parameters |
6863 // Query all the relevant parameters |
7017 _LIT(KSQLQuery, "SELECT %S FROM %S WHERE %S=%d AND %S=%d AND %S=%d AND %S=%d"); |
6864 _LIT(KSQLQuery, "SELECT %S FROM %S WHERE %S=%d AND %S=%d AND %S=%d"); |
7018 |
6865 sqlStatement.Format(KSQLQuery, &lastFullAuthTimeString, &m_db_table_name, |
7019 sqlStatement.Format( |
6866 &KServiceType, m_index_type, |
7020 KSQLQuery, |
6867 &KServiceIndex, m_index, &KTunnelingType, m_tunneling_vendor_type); |
7021 &lastFullAuthTimeString, |
|
7022 &m_db_table_name, |
|
7023 &KServiceType, |
|
7024 m_index_type, |
|
7025 &KServiceIndex, |
|
7026 m_index, |
|
7027 &KTunnelingTypeVendorId, |
|
7028 m_tunneling_type.get_vendor_id(), |
|
7029 &KTunnelingType, |
|
7030 m_tunneling_type.get_vendor_type()); |
|
7031 |
6868 |
7032 RDbView view; |
6869 RDbView view; |
7033 // Evaluate view |
6870 // Evaluate view |
7034 User::LeaveIfError(view.Prepare(m_database, TDbQuery(sqlStatement), TDbWindow::EUnlimited)); |
6871 User::LeaveIfError(view.Prepare(m_database, TDbQuery(sqlStatement), TDbWindow::EUnlimited)); |
7035 CleanupClosePushL(view); |
6872 CleanupClosePushL(view); |
7036 User::LeaveIfError(view.EvaluateAll()); |
6873 User::LeaveIfError(view.EvaluateAll()); |
7037 |
6874 |
7038 // Get the first (and only) row for update. |
6875 // Get the first (and only) row for updation. |
7039 view.FirstL(); |
6876 view.FirstL(); |
7040 view.UpdateL(); |
6877 view.UpdateL(); |
7041 |
6878 |
7042 // Get column set so we get the correct column numbers |
6879 // Get column set so we get the correct column numbers |
7043 CDbColSet* colSet = view.ColSetL(); |
6880 CDbColSet* colSet = view.ColSetL(); |
7234 EAP_TRACE_DATA_DEBUG_SYMBIAN( |
7071 EAP_TRACE_DATA_DEBUG_SYMBIAN( |
7235 ("eap_am_type_tls_peap_symbian_c::query_user_permission_for_A_ID(): in_pac_attribute_A_ID", |
7072 ("eap_am_type_tls_peap_symbian_c::query_user_permission_for_A_ID(): in_pac_attribute_A_ID", |
7236 (A_IDPtr.Ptr()), |
7073 (A_IDPtr.Ptr()), |
7237 (in_pac_attribute_A_ID->get_data_length()))); |
7074 (in_pac_attribute_A_ID->get_data_length()))); |
7238 |
7075 |
7239 if (A_ID_infoPtr.Size()>=KMaxNotifItemLength) |
7076 if (A_ID_infoPtr.Size()>KMaxEapFastNotifierBufLength) |
7240 { |
7077 { |
7241 CleanupStack::PopAndDestroy(3); // A_ID, A_ID_info |
7078 CleanupStack::PopAndDestroy(3); // A_ID, A_ID_info |
7242 status = m_am_tools->convert_am_error_to_eapol_error(KErrArgument); |
7079 status = m_am_tools->convert_am_error_to_eapol_error(KErrArgument); |
7243 |
7080 |
7244 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
7081 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
7245 return EAP_STATUS_RETURN(m_am_tools, m_eap_fast_completion_status); |
7082 return EAP_STATUS_RETURN(m_am_tools, m_eap_fast_completion_status); |
7246 } |
7083 } |
7247 |
7084 |
7248 TEapExpandedType aEapType(*EapExpandedTypeFast.GetType()); |
7085 TBool startedOk = ETrue; |
7249 |
7086 |
7250 m_notifier_data_to_user->iPassword.Copy(A_ID_infoPtr); |
7087 if (!iEapFastActiveNotes) |
7251 |
7088 { |
7252 if (iEapAuthNotifier == 0) |
7089 TRAPD( err, iEapFastActiveNotes = CEapFastActive::NewL( this ) ); |
7253 { |
7090 |
7254 TRAPD(err, iEapAuthNotifier = CEapAuthNotifier::NewL( *this )); |
7091 if ( err != KErrNone ) |
7255 if (err) |
7092 { |
7256 { |
7093 status = eap_status_allocation_error; |
7257 return eap_status_process_general_error; |
7094 } |
7258 } |
7095 } |
7259 } |
7096 if ( status == KErrNone ) |
7260 else |
7097 { |
7261 { |
7098 //update buffer |
7262 TRAPD(err1, iEapAuthNotifier->Cancel()); |
7099 iEapFastActiveNotes->UpdateInputBuf( A_ID_infoPtr ); |
7263 if (err1) |
7100 // start query install dialog |
7264 { |
7101 // asynch. call, return immediately |
7265 return eap_status_process_general_error; |
7102 startedOk = iEapFastActiveNotes->Start( |
7266 } |
7103 CEapFastActive::EEapFastActiveInstallPacQueryDialog ); |
7267 } |
7104 if ( startedOk == EFalse ) |
7268 |
7105 { |
7269 TRAPD(err2, iEapAuthNotifier->StartL(CEapAuthNotifier::EEapNotifierTypeFastInstallPacQueryDialog, m_notifier_data_to_user, aEapType)); |
7106 status = eap_status_process_general_error; |
7270 if (err2) |
7107 } |
7271 { |
7108 } |
7272 return eap_status_process_general_error; |
7109 else |
7273 } |
7110 { |
7274 |
7111 status = eap_status_process_general_error; |
7275 |
7112 } |
7276 |
7113 |
7277 CleanupStack::PopAndDestroy(3); // A_ID, A_ID_info |
7114 CleanupStack::PopAndDestroy(3); // A_ID, A_ID_info |
7278 |
7115 |
7279 return status; |
7116 return status; |
7280 } |
7117 } |
7281 |
7118 |
7282 //-------------------------------------------------- |
|
7283 |
7119 |
7284 EAP_FUNC_EXPORT eap_status_e eap_am_type_tls_peap_symbian_c::read_PAC_store_data( |
7120 EAP_FUNC_EXPORT eap_status_e eap_am_type_tls_peap_symbian_c::read_PAC_store_data( |
7285 const eap_fast_pac_store_pending_operation_e in_pending_operation, |
7121 const eap_fast_pac_store_pending_operation_e in_pending_operation, |
7286 EAP_TEMPLATE_CONST eap_array_c<eap_fast_pac_store_data_c> * const in_references) |
7122 EAP_TEMPLATE_CONST eap_array_c<eap_fast_pac_store_data_c> * const in_references) |
7287 { |
7123 { |
7765 dataType = eap_pac_store_data_type_PAC_data; |
7601 dataType = eap_pac_store_data_type_PAC_data; |
7766 break; |
7602 break; |
7767 } |
7603 } |
7768 } |
7604 } |
7769 |
7605 |
7770 m_info_array.ResetAndDestroy(); |
7606 TInt count = 0; |
|
7607 |
|
7608 m_info_array.Reset(); |
7771 |
7609 |
7772 iPacStoreDb->GetPacStoreDataL(dbTableName, m_info_array); |
7610 iPacStoreDb->GetPacStoreDataL(dbTableName, m_info_array); |
7773 |
7611 |
7774 EAP_TRACE_DEBUG_SYMBIAN( |
7612 EAP_TRACE_DEBUG_SYMBIAN( |
7775 (_L("eap_am_type_tls_peap_symbian_c::ReadPACStoredataL:Number of entries in table %S=%d\n"), |
7613 (_L("eap_am_type_tls_peap_symbian_c::ReadPACStoredataL:Number of entries in table %S=%d\n"), |
7776 &dbTableName, m_info_array.Count())); |
7614 &dbTableName, m_info_array.Count())); |
7777 |
7615 |
7778 TInt first_index = 0; |
7616 while (count < m_info_array.Count()) |
7779 |
|
7780 while (m_info_array.Count() > 0) |
|
7781 { |
7617 { |
7782 if (m_info_array[first_index] != 0 |
7618 TPtr8 infoDataPtr = m_info_array[count].iData->Des(); |
7783 && m_info_array[first_index]->GetIsValid() != EFalse) |
7619 TPtr8 infoRefPtr = m_info_array[count].iReference->Des(); |
7784 { |
7620 |
7785 // Note this will get always the first object of array. After the first object is processed it is destryed and removed from array. |
7621 EAP_TRACE_DATA_DEBUG_SYMBIAN( |
7786 TPtr8 infoDataPtr = m_info_array[first_index]->GetData()->Des(); |
7622 ("eap_am_type_tls_peap_symbian_c::ReadPACStoredataL: BINARY value from PAC DB (reference)", |
7787 TPtr8 infoRefPtr = m_info_array[first_index]->GetReference()->Des(); |
7623 infoRefPtr.Ptr(), |
7788 |
7624 infoRefPtr.Size())); |
7789 EAP_TRACE_DATA_DEBUG_SYMBIAN( |
7625 |
7790 ("eap_am_type_tls_peap_symbian_c::ReadPACStoredataL: BINARY value from PAC DB (reference)", |
7626 EAP_TRACE_DATA_DEBUG_SYMBIAN( |
7791 infoRefPtr.Ptr(), |
7627 ("eap_am_type_tls_peap_symbian_c::ReadPACStoredataL: BINARY value from PAC DB (value)", |
7792 infoRefPtr.Size())); |
7628 infoDataPtr.Ptr(), |
7793 |
7629 infoDataPtr.Size())); |
7794 EAP_TRACE_DATA_DEBUG_SYMBIAN( |
7630 |
7795 ("eap_am_type_tls_peap_symbian_c::ReadPACStoredataL: BINARY value from PAC DB (value)", |
7631 eap_fast_pac_store_data_c * const new_data = new eap_fast_pac_store_data_c(m_am_tools); |
7796 infoDataPtr.Ptr(), |
7632 |
7797 infoDataPtr.Size())); |
7633 eap_automatic_variable_c<eap_fast_pac_store_data_c> automatic_new_data( |
7798 |
7634 m_am_tools, new_data); |
7799 eap_fast_pac_store_data_c * const new_data = new eap_fast_pac_store_data_c(m_am_tools); |
7635 |
7800 |
7636 if (new_data == 0) |
7801 eap_automatic_variable_c<eap_fast_pac_store_data_c> automatic_new_data( |
7637 { |
7802 m_am_tools, new_data); |
7638 m_eap_fast_completion_status = eap_status_allocation_error; |
7803 |
7639 (void) EAP_STATUS_RETURN(m_am_tools, m_eap_fast_completion_status); |
7804 if (new_data == 0) |
7640 break; |
7805 { |
7641 } |
7806 m_eap_fast_completion_status = eap_status_allocation_error; |
7642 |
7807 (void) EAP_STATUS_RETURN(m_am_tools, m_eap_fast_completion_status); |
7643 new_data->set_type(dataType); |
7808 break; |
7644 |
7809 } |
7645 // Set the reference. |
7810 |
7646 m_eap_fast_completion_status = new_data->get_writable_reference()->set_copy_of_buffer(infoRefPtr.Ptr(), infoRefPtr.Size()); |
7811 new_data->set_type(dataType); |
7647 if (m_eap_fast_completion_status != eap_status_ok) |
7812 |
7648 { |
7813 // Set the reference. |
7649 (void) EAP_STATUS_RETURN(m_am_tools, m_eap_fast_completion_status); |
7814 m_eap_fast_completion_status = new_data->get_writable_reference()->set_copy_of_buffer(infoRefPtr.Ptr(), infoRefPtr.Size()); |
7650 delete m_info_array[count].iData; |
7815 if (m_eap_fast_completion_status != eap_status_ok) |
7651 delete m_info_array[count].iReference; |
7816 { |
7652 break; |
7817 (void) EAP_STATUS_RETURN(m_am_tools, m_eap_fast_completion_status); |
7653 } |
7818 delete m_info_array[first_index]; |
7654 |
7819 m_info_array.Remove(first_index); |
7655 m_eap_fast_completion_status = new_data->get_writable_data()->set_copy_of_buffer(infoDataPtr.Ptr(),infoDataPtr.Size() ); |
7820 break; |
7656 if (m_eap_fast_completion_status != eap_status_ok) |
7821 } |
7657 { |
7822 |
7658 (void) EAP_STATUS_RETURN(m_am_tools, m_eap_fast_completion_status); |
7823 m_eap_fast_completion_status = new_data->get_writable_data()->set_copy_of_buffer(infoDataPtr.Ptr(), infoDataPtr.Size()); |
7659 delete m_info_array[count].iData; |
7824 if (m_eap_fast_completion_status != eap_status_ok) |
7660 delete m_info_array[count].iReference; |
7825 { |
7661 break; |
7826 (void) EAP_STATUS_RETURN(m_am_tools, m_eap_fast_completion_status); |
7662 } |
7827 delete m_info_array[first_index]; |
7663 |
7828 m_info_array.Remove(first_index); |
7664 automatic_new_data.do_not_free_variable(); |
7829 break; |
7665 |
7830 } |
7666 m_eap_fast_completion_status = m_references_and_data_blocks.add_object(new_data, true); |
7831 |
7667 if (m_eap_fast_completion_status != eap_status_ok) |
7832 automatic_new_data.do_not_free_variable(); |
7668 { |
7833 |
7669 (void) EAP_STATUS_RETURN(m_am_tools, m_eap_fast_completion_status); |
7834 m_eap_fast_completion_status = m_references_and_data_blocks.add_object(new_data, true); |
7670 delete m_info_array[count].iData; |
7835 if (m_eap_fast_completion_status != eap_status_ok) |
7671 delete m_info_array[count].iReference; |
7836 { |
7672 break; |
7837 (void) EAP_STATUS_RETURN(m_am_tools, m_eap_fast_completion_status); |
7673 } |
7838 delete m_info_array[first_index]; |
|
7839 m_info_array.Remove(first_index); |
|
7840 break; |
|
7841 } |
|
7842 EAP_TRACE_DATA_DEBUG_SYMBIAN( |
|
7843 ("For GROUP, AID, PAC INFOs - added data", |
|
7844 (new_data->get_data())->get_data((new_data->get_data())->get_data_length()), |
|
7845 (new_data->get_data())->get_data_length())); |
|
7846 } |
|
7847 |
7674 |
7848 delete m_info_array[first_index]; |
7675 delete m_info_array[count].iData; |
7849 m_info_array.Remove(first_index); |
7676 delete m_info_array[count].iReference; |
7850 |
7677 |
7851 |
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++; |
7852 } // End: while |
7684 } // End: while |
7853 |
7685 |
7854 |
7686 |
7855 if (m_eap_fast_completion_status != eap_status_ok) |
7687 if (m_eap_fast_completion_status != eap_status_ok) |
7856 { |
7688 { |
9059 |
8843 |
9060 // --------------------------------------------------------------------------- |
8844 // --------------------------------------------------------------------------- |
9061 // eap_am_type_tls_peap_symbian_c::indicates_eap_fast_provisioning_starts |
8845 // eap_am_type_tls_peap_symbian_c::indicates_eap_fast_provisioning_starts |
9062 // --------------------------------------------------------------------------- |
8846 // --------------------------------------------------------------------------- |
9063 // |
8847 // |
9064 EAP_FUNC_EXPORT eap_status_e eap_am_type_tls_peap_symbian_c::indicates_eap_fast_provisioning_starts( |
8848 EAP_FUNC_EXPORT |
|
8849 eap_status_e eap_am_type_tls_peap_symbian_c::indicates_eap_fast_provisioning_starts( |
9065 const eap_fast_completion_operation_e provisioning_mode, |
8850 const eap_fast_completion_operation_e provisioning_mode, |
9066 const eap_fast_pac_type_e pac_type ) |
8851 const eap_fast_pac_type_e pac_type ) |
9067 { |
8852 { |
9068 eap_status_e status( eap_status_ok ); |
8853 eap_status_e status( eap_status_ok ); |
9069 m_provisioning_mode = provisioning_mode; // save provis. mode |
8854 m_provisioning_mode = provisioning_mode; // save provis. mode |
9070 |
8855 |
9071 TInt error(KErrNone); |
8856 TInt err = KErrNone; |
9072 |
8857 if ( !iEapFastActiveWaitNote ) |
9073 TEapExpandedType aEapType(*EapExpandedTypeFast.GetType()); |
8858 { |
9074 |
8859 TRAP( err, iEapFastActiveWaitNote = CEapFastActive::NewL( this ) ); |
9075 m_notifier_data_to_user->iPassword.Zero(); |
8860 } |
9076 |
8861 if ( !iEapFastActiveNotes ) |
9077 if (iEapAuthNotifier == 0) |
8862 { |
9078 { |
8863 TRAP( err, iEapFastActiveNotes = CEapFastActive::NewL( this ) ); |
9079 TRAP(error, iEapAuthNotifier = CEapAuthNotifier::NewL( *this )); |
8864 } |
9080 if (error) |
8865 if ( err != KErrNone ) |
9081 { |
8866 { |
9082 return m_am_tools->convert_am_error_to_eapol_error(error); |
8867 status = eap_status_allocation_error; |
9083 } |
8868 } |
9084 } |
8869 /** |
9085 else |
8870 * The note is started in a separate active object. |
9086 { |
8871 * When user cancels waiting note, |
9087 TRAP(error, iEapAuthNotifier->Cancel()); |
8872 * SendErrorNotification( eap_status_user_cancel_authentication ) |
9088 if (error) |
8873 * will be called in iEapFastActiveWaitNote->RunL(). |
9089 { |
8874 * Otherwise note is stopped using iEapFastActiveWaitNote.Start() method. |
9090 return m_am_tools->convert_am_error_to_eapol_error(error); |
8875 */ |
9091 } |
8876 TBool startedOk = ETrue; |
9092 } |
8877 |
9093 |
|
9094 if ( pac_type == eap_fast_pac_type_tunnel_pac |
8878 if ( pac_type == eap_fast_pac_type_tunnel_pac |
9095 && provisioning_mode == eap_fast_completion_operation_server_authenticated_provisioning_mode |
8879 && |
9096 && status == eap_status_ok ) |
8880 provisioning_mode == |
9097 { |
8881 eap_fast_completion_operation_server_authenticated_provisioning_mode |
9098 TRAP(error, iEapAuthNotifier->StartL(CEapAuthNotifier::EEapNotifierTypeFastStartAuthProvWaitNote, m_notifier_data_to_user, aEapType)); |
8882 && |
9099 if (error) |
8883 status == eap_status_ok ) |
9100 { |
8884 { |
9101 return m_am_tools->convert_am_error_to_eapol_error(error); |
8885 EAP_TRACE_DEBUG_SYMBIAN( ( _L("eap_am_type_tls_peap_symbian_c:: \ |
9102 } |
8886 indicates_eap_fast_provisioning_starts Authenticated provisioning!"))); |
9103 } |
8887 startedOk = iEapFastActiveWaitNote->Start( |
|
8888 CEapFastActive::EEapFastActiveStartAuthProvWaitNote ); |
|
8889 } |
9104 else if ( |
8890 else if ( |
9105 pac_type == eap_fast_pac_type_tunnel_pac |
8891 pac_type == eap_fast_pac_type_tunnel_pac |
9106 && provisioning_mode == eap_fast_completion_operation_server_unauthenticated_provisioning_mode_ADHP |
8892 && |
9107 && status == eap_status_ok ) |
8893 provisioning_mode == |
9108 { |
8894 eap_fast_completion_operation_server_unauthenticated_provisioning_mode_ADHP |
9109 TRAP(error, iEapAuthNotifier->StartL(CEapAuthNotifier::EEapNotifierTypeFastStartUnauthProvWaitNote, m_notifier_data_to_user, aEapType)); |
8895 && |
9110 if (error) |
8896 status == eap_status_ok ) |
9111 { |
8897 { |
9112 return m_am_tools->convert_am_error_to_eapol_error(error); |
8898 EAP_TRACE_DEBUG_SYMBIAN( (_L("eap_am_type_tls_peap_symbian_c:: \ |
9113 } |
8899 indicates_eap_fast_provisioning_starts UnAuthenticated provisioning!"))); |
9114 } |
8900 startedOk = iEapFastActiveWaitNote->Start( |
9115 |
8901 CEapFastActive::EEapFastActiveStartUnauthProvWaitNote ); |
9116 |
8902 } |
9117 |
8903 if ( startedOk == EFalse ) |
|
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 } |
9118 return status; |
8912 return status; |
9119 } |
8913 } |
9120 |
8914 |
9121 // --------------------------------------------------------------------------- |
8915 // --------------------------------------------------------------------------- |
9122 // eap_am_type_tls_peap_symbian_c::indicates_eap_fast_provisioning_ends |
8916 // eap_am_type_tls_peap_symbian_c::indicates_eap_fast_provisioning_ends |
9123 // --------------------------------------------------------------------------- |
8917 // --------------------------------------------------------------------------- |
9124 // |
8918 // |
9125 EAP_FUNC_EXPORT eap_status_e eap_am_type_tls_peap_symbian_c::indicates_eap_fast_provisioning_ends( |
8919 EAP_FUNC_EXPORT |
|
8920 eap_status_e eap_am_type_tls_peap_symbian_c::indicates_eap_fast_provisioning_ends( |
9126 const bool provisioning_successfull, |
8921 const bool provisioning_successfull, |
9127 const eap_fast_completion_operation_e provisioning_mode, |
8922 const eap_fast_completion_operation_e provisioning_mode, |
9128 const eap_fast_pac_type_e pac_type ) |
8923 const eap_fast_pac_type_e pac_type ) |
9129 { |
8924 { |
9130 EAP_TRACE_DEBUG_SYMBIAN( (_L("eap_am_type_tls_peap_symbian_c::indicates_eap_fast_provisioning_ends()"))); |
8925 EAP_TRACE_DEBUG_SYMBIAN( (_L("eap_am_type_tls_peap_symbian_c:: \ |
|
8926 indicates_eap_fast_provisioning_ends()"))); |
9131 |
8927 |
9132 EAP_UNREFERENCED_PARAMETER(provisioning_mode); |
8928 EAP_UNREFERENCED_PARAMETER(provisioning_mode); |
9133 |
8929 |
9134 TInt error(KErrNone); |
|
9135 |
|
9136 eap_status_e status( eap_status_ok ); |
8930 eap_status_e status( eap_status_ok ); |
9137 |
8931 |
9138 if ( pac_type == eap_fast_pac_type_tunnel_pac ) |
8932 if ( pac_type == eap_fast_pac_type_tunnel_pac ) |
9139 { |
8933 { |
9140 // stop wait note; |
8934 // stop wait note; |
9141 TEapExpandedType aEapType(*EapExpandedTypeFast.GetType()); |
8935 if ( iEapFastActiveWaitNote ) |
9142 |
8936 { |
9143 m_notifier_data_to_user->iPassword.Zero(); |
8937 if ( iEapFastActiveWaitNote->IsActive() ) |
9144 |
8938 { |
9145 if (iEapAuthNotifier == 0) |
8939 iEapFastActiveWaitNote->Cancel(); |
9146 { |
8940 } |
9147 TRAP(error, iEapAuthNotifier = CEapAuthNotifier::NewL( *this )); |
8941 delete iEapFastActiveWaitNote; |
9148 if (error) |
8942 iEapFastActiveWaitNote = NULL; |
9149 { |
8943 } |
9150 return m_am_tools->convert_am_error_to_eapol_error(error); |
8944 |
9151 } |
8945 if ( iEapFastActiveNotes ) |
9152 } |
8946 { |
9153 else |
8947 if( provisioning_successfull ) |
9154 { |
8948 { |
9155 TRAP(error, iEapAuthNotifier->Cancel()); |
8949 // synch. call |
9156 if (error) |
8950 iEapFastActiveNotes->Start( CEapFastActive:: |
9157 { |
8951 EEapFastActiveShowProvSuccessNote, ETrue ); |
9158 return m_am_tools->convert_am_error_to_eapol_error(error); |
8952 } |
9159 } |
8953 else |
9160 } |
8954 { |
9161 |
8955 // synch. call |
9162 if( !provisioning_successfull ) |
8956 iEapFastActiveNotes->Start( CEapFastActive:: |
9163 { |
8957 EapFastActiveShowProvNotSuccessNote, ETrue ); |
9164 TRAP(error, iEapAuthNotifier->StartL(CEapAuthNotifier::EEapNotifierTypeFastShowProvNotSuccessNote, m_notifier_data_to_user, aEapType)); |
8958 } |
9165 if (error) |
8959 } |
9166 { |
8960 } // if ( pac_type == eap_fast_pac_type_tunnel_pac ) |
9167 return m_am_tools->convert_am_error_to_eapol_error(error); |
|
9168 } |
|
9169 } |
|
9170 } // if ( pac_type == eap_fast_pac_type_tunnel_pac ) |
|
9171 |
8961 |
9172 return status; |
8962 return status; |
9173 } |
8963 } |
9174 |
8964 |
9175 #endif //#if defined(USE_FAST_EAP_TYPE) |
8965 #endif //#if defined(USE_FAST_EAP_TYPE) |
9176 |
|
9177 //-------------------------------------------------- |
|
9178 |
8966 |
9179 #ifdef USE_PAC_STORE |
8967 #ifdef USE_PAC_STORE |
9180 |
8968 |
9181 void eap_am_type_tls_peap_symbian_c::GetPacStoreDbDataL( |
8969 void eap_am_type_tls_peap_symbian_c::GetPacStoreDbDataL( |
9182 const eap_pac_store_data_type_e aPacStoreDataType, |
8970 const eap_pac_store_data_type_e aPacStoreDataType, |
9444 |
9232 |
9445 #endif // End: #ifdef USE_PAC_STORE |
9233 #endif // End: #ifdef USE_PAC_STORE |
9446 |
9234 |
9447 //-------------------------------------------------- |
9235 //-------------------------------------------------- |
9448 |
9236 |
9449 #ifdef USE_FAST_EAP_TYPE |
9237 #if defined(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 |
9450 //-------------------------------------------------- |
9303 //-------------------------------------------------- |
9451 |
9304 |
9452 eap_status_e eap_am_type_tls_peap_symbian_c::RemoveIAPReference() |
9305 eap_status_e eap_am_type_tls_peap_symbian_c::RemoveIAPReference() |
9453 { |
9306 { |
9454 EAP_TRACE_DEBUG_SYMBIAN( |
9307 EAP_TRACE_DEBUG_SYMBIAN( |
9455 (_L("eap_am_type_tls_peap_symbian_c::RemoveIAPReference - Start"))); |
9308 (_L("eap_am_type_tls_peap_symbian_c::RemoveIAPReference - Start"))); |
9456 m_eap_fast_completion_status = eap_status_ok; |
9309 m_eap_fast_completion_status = eap_status_ok; |
9457 |
9310 |
9458 eap_variable_data_c aIapReference(m_am_tools); |
9311 eap_variable_data_c aIapReference(m_am_tools); |
9706 m_eap_fast_completion_status = m_partner->set_timer( |
9543 m_eap_fast_completion_status = m_partner->set_timer( |
9707 this, |
9544 this, |
9708 KHandleCompletePacstoreOkTimerID, |
9545 KHandleCompletePacstoreOkTimerID, |
9709 &m_eap_fast_completion_status, |
9546 &m_eap_fast_completion_status, |
9710 1); |
9547 1); |
|
9548 if (readData != NULL) |
|
9549 CleanupStack::PopAndDestroy(readData); |
9711 CleanupStack::PopAndDestroy(5); // Path, Path8, filename, buf2, group_reference8 |
9550 CleanupStack::PopAndDestroy(5); // Path, Path8, filename, buf2, group_reference8 |
9712 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
9551 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
9713 return EAP_STATUS_RETURN(m_am_tools, m_eap_fast_completion_status); |
9552 return EAP_STATUS_RETURN(m_am_tools, m_eap_fast_completion_status); |
9714 } |
9553 } |
9715 } |
9554 } |
9716 } |
9555 } |
9717 else if(directoryEmpty == false && directoryExists == true && FileFound != EFalse) |
9556 else if(directoryEmpty == false && directoryExists == true && FileFound != EFalse) |
9718 { |
9557 { |
9719 PathPtr8.Zero(); |
9558 PathPtr8.Zero(); |
|
9559 PathPtr8.Append(KPacStoreSourceDir); |
9720 PathPtr8.Append(group_referencePtr8); |
9560 PathPtr8.Append(group_referencePtr8); |
9721 PathPtr8.Append(KSeparator); |
9561 PathPtr8.Append(KSeparator); |
9722 PathPtr8.Append(filenamePtr8); |
9562 PathPtr8.Append(filenamePtr8); |
9723 |
|
9724 EAP_TRACE_DATA_DEBUG( |
9563 EAP_TRACE_DATA_DEBUG( |
9725 m_am_tools, |
9564 m_am_tools, |
9726 TRACE_FLAGS_DEFAULT, |
9565 TRACE_FLAGS_DEFAULT, |
9727 (EAPL("eap_am_type_tls_peap_symbian_c::ImportFilesL: Path8"), |
9566 (EAPL("eap_am_type_tls_peap_symbian_c::ImportFilesL: Path8"), |
9728 PathPtr8.Ptr(), |
9567 PathPtr8.Ptr(), |
9729 PathPtr8.Size())); |
9568 PathPtr8.Size())); |
9730 |
|
9731 PathPtr.Zero(); |
9569 PathPtr.Zero(); |
9732 PathPtr.Copy(PathPtr8); |
9570 PathPtr.Copy(PathPtr8); |
9733 |
|
9734 { |
|
9735 TFileName aPrivateDatabasePathName; |
|
9736 |
|
9737 EapPluginTools::GetPrivatePathL( |
|
9738 aPrivateDatabasePathName); |
|
9739 |
|
9740 aPrivateDatabasePathName.Append(KPacStoreSourceDir); |
|
9741 aPrivateDatabasePathName.Append(PathPtr); |
|
9742 |
|
9743 PathPtr.Copy(aPrivateDatabasePathName); |
|
9744 } |
|
9745 |
9571 |
9746 EAP_TRACE_DATA_DEBUG( |
|
9747 m_am_tools, |
|
9748 TRACE_FLAGS_DEFAULT, |
|
9749 (EAPL("eap_am_type_tls_peap_symbian_c::ImportFilesL: PathPtr"), |
|
9750 PathPtr.Ptr(), |
|
9751 PathPtr.Size())); |
|
9752 |
|
9753 EAP_TRACE_DEBUG_SYMBIAN( |
9572 EAP_TRACE_DEBUG_SYMBIAN( |
9754 (_L("eap_am_type_tls_peap_symbian_c::ImportFilesL: Read file"))); |
9573 (_L("eap_am_type_tls_peap_symbian_c::ImportFilesL: Read file"))); |
9755 |
9574 |
9756 RFile file; |
9575 RFile file; |
9757 |
|
9758 if(file.Open(aFs, PathPtr, EFileRead)==KErrNone) |
9576 if(file.Open(aFs, PathPtr, EFileRead)==KErrNone) |
9759 { |
9577 { |
9760 readData= HBufC8::NewLC(filesize); |
9578 readData= HBufC8::NewLC(filesize); |
9761 TPtr8 readDataPtr = readData->Des(); |
9579 TPtr8 readDataPtr = readData->Des(); |
9762 file.Read(readDataPtr); |
9580 file.Read(readDataPtr); |
10518 (new_data->get_data())->get_data_length())); |
10267 (new_data->get_data())->get_data_length())); |
10519 |
10268 |
10520 m_both_completed++; |
10269 m_both_completed++; |
10521 return m_eap_fast_completion_status; |
10270 return m_eap_fast_completion_status; |
10522 |
10271 |
10523 } |
10272 } |
|
10273 |
|
10274 // --------------------------------------------------------- |
|
10275 // eap_am_type_tls_peap_symbian_c::CompleteNotifier |
|
10276 // --------------------------------------------------------- |
|
10277 // |
|
10278 eap_status_e eap_am_type_tls_peap_symbian_c::CompleteNotifierL() |
|
10279 { |
|
10280 eap_status_e status( eap_status_ok ); |
|
10281 switch ( m_state ) |
|
10282 { |
|
10283 case EPasswordCancel: |
|
10284 case EPasswordQuery: |
|
10285 case EWrongPassword: |
|
10286 case EFilePasswordQuery: |
|
10287 case EMasterkeyQuery: |
|
10288 { |
|
10289 EAP_TRACE_DEBUG_SYMBIAN( |
|
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; |
|
10337 } |
|
10338 default: |
|
10339 { |
|
10340 EAP_TRACE_DEBUG_SYMBIAN( |
|
10341 ( _L( "eap_am_type_tls_peap_symbian_c::CompleteNotifierL() m_state = %d not supported." ), |
|
10342 m_state ) ); |
|
10343 } |
|
10344 } |
|
10345 return status; |
|
10346 } |
10524 |
10347 |
10525 //-------------------------------------------------- |
10348 //-------------------------------------------------- |
10526 |
10349 |
10527 void eap_am_type_tls_peap_symbian_c::ConvertUnicodeToAsciiL(const TDesC16& aFromUnicode, TDes8& aToAscii) |
10350 void eap_am_type_tls_peap_symbian_c::ConvertUnicodeToAsciiL(const TDesC16& aFromUnicode, TDes8& aToAscii) |
10528 { |
10351 { |
10529 EAP_TRACE_DATA_DEBUG_SYMBIAN( |
10352 EAP_TRACE_DATA_DEBUG_SYMBIAN( |
10530 ("eap_am_type_tls_peap_symbian_c::ConvertUnicodeToAsciiL:From TEXT", |
10353 ("eap_am_type_tls_peap_symbian_c::ConvertUnicodeToAsciiL:From TEXT", |
10531 aFromUnicode.Ptr(), |
10354 aFromUnicode.Ptr(), |
10532 aFromUnicode.Size())); |
10355 aFromUnicode.Size())); |
10533 |
10356 |
10534 if(aFromUnicode.Length() <= 0) |
10357 if(aFromUnicode.Length() <= 0) |
10535 { |
10358 { |
|
10359 EAP_TRACE_DEBUG_SYMBIAN( |
|
10360 (_L("eap_am_type_tls_peap_symbian_c::ConvertUnicodeToAsciiL: Return: NOTHING TO CONVERT"))); |
|
10361 |
|
10362 return; |
|
10363 } |
|
10364 |
10536 EAP_TRACE_DEBUG_SYMBIAN( |
10365 EAP_TRACE_DEBUG_SYMBIAN( |
10537 (_L("eap_am_type_tls_peap_symbian_c::ConvertUnicodeToAsciiL: Return: NOTHING TO CONVERT"))); |
10366 (_L("eap_am_type_tls_peap_symbian_c::ConvertUnicodeToAsciiL, aFromUnicode.Length=%d, aFromUnicode.Size=%d"), |
10538 |
10367 aFromUnicode.Length(), aFromUnicode.Size())); |
10539 return; |
10368 |
10540 } |
10369 // Convert from Unicode to ascii. |
10541 |
10370 HBufC8* aFromUnicodeBuf8 = HBufC8::NewLC(aFromUnicode.Length()); // Half times size of source (or length) is enough here. |
10542 EAP_TRACE_DEBUG_SYMBIAN( |
10371 TPtr8 aFromUnicodePtr8 = aFromUnicodeBuf8->Des(); |
10543 (_L("eap_am_type_tls_peap_symbian_c::ConvertUnicodeToAsciiL, aFromUnicode.Length=%d, aFromUnicode.Size=%d"), |
10372 |
10544 aFromUnicode.Length(), aFromUnicode.Size())); |
10373 EAP_TRACE_DEBUG_SYMBIAN( |
10545 |
10374 (_L("eap_am_type_tls_peap_symbian_c::ConvertUnicodeToAsciiL, aFromUnicodePtr8.Length=%d, aFromUnicodePtr8.Size=%d, aFromUnicodePtr8.MaxLength=%d, aFromUnicodePtr8.MaxSize=%d"), |
10546 // Convert from Unicode to ascii. |
10375 aFromUnicodePtr8.Length(), aFromUnicodePtr8.Size(), aFromUnicodePtr8.MaxLength(), aFromUnicodePtr8.MaxSize())); |
10547 HBufC8* aFromUnicodeBuf8 = HBufC8::NewLC(aFromUnicode.Length()); // Half times size of source (or length) is enough here. |
10376 |
10548 TPtr8 aFromUnicodePtr8 = aFromUnicodeBuf8->Des(); |
10377 aFromUnicodePtr8.Copy(aFromUnicode); // Unicode -> ascii. |
10549 |
10378 |
10550 EAP_TRACE_DEBUG_SYMBIAN( |
10379 aToAscii = aFromUnicodePtr8; |
10551 (_L("eap_am_type_tls_peap_symbian_c::ConvertUnicodeToAsciiL, aFromUnicodePtr8.Length=%d, aFromUnicodePtr8.Size=%d, aFromUnicodePtr8.MaxLength=%d, aFromUnicodePtr8.MaxSize=%d"), |
10380 |
10552 aFromUnicodePtr8.Length(), aFromUnicodePtr8.Size(), aFromUnicodePtr8.MaxLength(), aFromUnicodePtr8.MaxSize())); |
10381 CleanupStack::PopAndDestroy(aFromUnicodeBuf8); // Delete aFromUnicodeBuf8. |
10553 |
10382 |
10554 aFromUnicodePtr8.Copy(aFromUnicode); // Unicode -> ascii. |
10383 EAP_TRACE_DATA_DEBUG_SYMBIAN( |
10555 |
10384 ("eap_am_type_tls_peap_symbian_c::ConvertUnicodeToAsciiL:To ASCII", |
10556 aToAscii = aFromUnicodePtr8; |
10385 aToAscii.Ptr(), |
10557 |
10386 aToAscii.Size())); |
10558 CleanupStack::PopAndDestroy(aFromUnicodeBuf8); // Delete aFromUnicodeBuf8. |
10387 } |
10559 |
|
10560 EAP_TRACE_DATA_DEBUG_SYMBIAN( |
|
10561 ("eap_am_type_tls_peap_symbian_c::ConvertUnicodeToAsciiL:To ASCII", |
|
10562 aToAscii.Ptr(), |
|
10563 aToAscii.Size())); |
|
10564 } |
|
10565 |
10388 |
10566 |
10389 |
10567 // --------------------------------------------------------- |
10390 // --------------------------------------------------------- |
10568 // eap_am_type_tls_peap_symbian_c::CheckPasswordTimeValidityL() |
10391 // eap_am_type_tls_peap_symbian_c::CheckPasswordTimeValidityL() |
10569 // --------------------------------------------------------- |
10392 // --------------------------------------------------------- |
10570 // |
10393 // |
10571 void eap_am_type_tls_peap_symbian_c::CheckPasswordTimeValidityL() |
10394 void eap_am_type_tls_peap_symbian_c::CheckPasswordTimeValidityL() |
10572 { |
10395 { |
10573 /* Check validity of password against timelimit */ |
10396 /* Check validity of password against timelimit */ |
10574 |
10397 |
10575 EAP_TRACE_DEBUG(m_am_tools, |
10398 EAP_TRACE_DEBUG(m_am_tools, |
10576 TRACE_FLAGS_DEFAULT, ( |
10399 TRACE_FLAGS_DEFAULT, ( |
10577 EAPL("CheckPasswordTimeValidityL - Start\n"))); |
10400 EAPL("CheckPasswordTimeValidityL - Start\n"))); |
11069 CleanupStack::PopAndDestroy(&view); // Close view. |
10884 CleanupStack::PopAndDestroy(&view); // Close view. |
11070 CleanupStack::PopAndDestroy(buf); // Delete buf. |
10885 CleanupStack::PopAndDestroy(buf); // Delete buf. |
11071 |
10886 |
11072 /* update end */ |
10887 /* update end */ |
11073 |
10888 |
11074 } // eap_am_type_tls_peap_symbian_c::UpdatePasswordTimeL() |
10889 } // eap_am_type_tls_peap_symbian_c::UpdatePasswordTimeL() |
11075 |
10890 |
11076 //-------------------------------------------------- |
|
11077 |
10891 |
11078 eap_status_e eap_am_type_tls_peap_symbian_c::CreateMasterkeyL() |
10892 eap_status_e eap_am_type_tls_peap_symbian_c::CreateMasterkeyL() |
11079 { |
10893 { |
11080 HBufC8* password = HBufC8::NewLC(m_userResponse.get_data_length()); |
10894 HBufC8* password = HBufC8::NewLC(m_userResponse.get_data_length()); |
11081 TPtr8 passwordPtr = password->Des(); |
10895 TPtr8 passwordPtr = password->Des(); |
11082 m_PAC_store_password.set_copy_of_buffer(&m_userResponse); |
10896 m_PAC_store_password.set_copy_of_buffer(&m_userResponse); |
11083 passwordPtr.Copy(m_userResponse.get_data(), m_userResponse.get_data_length()); |
10897 passwordPtr.Copy(m_userResponse.get_data(), m_userResponse.get_data_length()); |
11084 m_eap_fast_completion_status = m_am_tools->convert_am_error_to_eapol_error(iPacStoreDb->CreateAndSaveMasterKeyL(passwordPtr)); |
10898 m_eap_fast_completion_status = m_am_tools->convert_am_error_to_eapol_error(iPacStoreDb->CreateAndSaveMasterKeyL(passwordPtr)); |
11085 CleanupStack::PopAndDestroy(password); |
10899 CleanupStack::PopAndDestroy(password); |
11086 return m_eap_fast_completion_status; |
10900 return m_eap_fast_completion_status; |
11087 } |
10901 } |
11088 |
|
11089 #endif //#if defined(USE_FAST_EAP_TYPE) |
10902 #endif //#if defined(USE_FAST_EAP_TYPE) |
11090 |
10903 |
11091 |
10904 |
11092 |
10905 |
11093 // ================= TTLS-PAP public exported ======================= |
10906 // ================= TTLS-PAP public exported ======================= |
11094 |
10907 |
11095 // ------------------------------------------------------------------------ |
10908 // ------------------------------------------------------------------------ |
11096 // eap_am_type_tls_peap_symbian_c::is_ttls_pap_session_valid() |
10909 // eap_am_type_tls_peap_symbian_c::is_ttls_pap_session_valid() |
11097 // ------------------------------------------------------------------------ |
10910 // ------------------------------------------------------------------------ |
11098 // |
10911 // |
11099 EAP_FUNC_EXPORT bool eap_am_type_tls_peap_symbian_c::is_ttls_pap_session_valid() |
10912 EAP_FUNC_EXPORT |
11100 { |
10913 bool eap_am_type_tls_peap_symbian_c::is_ttls_pap_session_valid() |
11101 EAP_TRACE_DEBUG_SYMBIAN((_L( "eap_am_type_tls_peap_symbian_c::is_ttls_pap_session_valid()" ))); |
10914 { |
|
10915 DEBUG( "eap_am_type_tls_peap_symbian_c::is_ttls_pap_session_valid()" ); |
11102 |
10916 |
11103 TBool isValid = EFalse; |
10917 TBool isValid = EFalse; |
11104 TInt err = KErrNone; |
10918 TInt err = KErrNone; |
11105 bool retVal = false; |
10919 bool retVal = false; |
11106 |
10920 |
11107 TRAP( err, isValid = IsTtlsPapSessionValidL() ); |
10921 TRAP( err, isValid = IsTtlsPapSessionValidL() ); |
11108 if ( err != KErrNone ) |
10922 if ( err != KErrNone ) |
11109 { |
10923 { |
11110 EAP_TRACE_DEBUG_SYMBIAN((_L("ERROR: eap_am_type_tls_peap_symbian_c::is_ttls_pap_session_valid(): Leave, err==%d."), err )); |
10924 DEBUG1( "eap_am_type_tls_peap_symbian_c::is_ttls_pap_session_valid() ERROR: \ |
|
10925 Leave, err==%d.", err ); |
11111 retVal = false; |
10926 retVal = false; |
11112 } |
10927 } |
11113 else |
10928 else |
11114 { |
10929 { |
11115 retVal = ( isValid ) ? true : false; |
10930 retVal = ( isValid ) ? true : false; |
11116 } |
10931 } |
11117 return retVal; |
10932 return retVal; |
11118 } |
10933 } |
11119 |
10934 |
11120 // ------------------------------------------------------------------------ |
10935 // ------------------------------------------------------------------------ |
11121 // eap_am_type_tls_peap_symbian_c::query_ttls_pap_username_and_password() |
10936 // eap_am_type_tls_peap_symbian_c::query_ttls_pap_username_and_password() |
11122 // ------------------------------------------------------------------------ |
10937 // ------------------------------------------------------------------------ |
11123 // |
10938 // |
11124 EAP_FUNC_EXPORT eap_status_e eap_am_type_tls_peap_symbian_c::query_ttls_pap_username_and_password( |
10939 EAP_FUNC_EXPORT eap_status_e |
|
10940 eap_am_type_tls_peap_symbian_c::query_ttls_pap_username_and_password( |
11125 const eap_variable_data_c * const aInSrvChallengeUtf8 ) |
10941 const eap_variable_data_c * const aInSrvChallengeUtf8 ) |
11126 { |
10942 { |
11127 EAP_TRACE_DEBUG_SYMBIAN((_L( "eap_am_type_tls_peap_symbian_c::query_ttls_pap_username_and_password()" ))); |
10943 DEBUG( "eap_am_type_tls_peap_symbian_c::query_ttls_pap_username_and_password()" ); |
11128 |
10944 |
11129 eap_status_e status( eap_status_pending_request ); |
10945 eap_status_e status( eap_status_pending_request ); |
11130 TEapExpandedType aEapType(*EapExpandedTypeTtlsPap.GetType()); |
10946 |
11131 |
10947 if ( !iEapTtlsPapActive ) |
11132 m_notifier_data_to_user->iUsername.Zero(); |
10948 { |
11133 m_notifier_data_to_user->iPassword.Zero(); |
10949 TRAPD( err, iEapTtlsPapActive = CEapTtlsPapActive::NewL( |
11134 m_notifier_data_to_user->iUidata.Zero(); |
10950 this, m_am_tools ) ); |
11135 |
10951 if ( err != KErrNone ) |
11136 if ((aInSrvChallengeUtf8 != NULL) && (aInSrvChallengeUtf8->get_data_length() != 0)) |
10952 { |
11137 { |
10953 DEBUG1( "eap_am_type_tls_peap_symbian_c::query_ttls_pap_username_and_password() \ |
11138 const TPtrC8 utf8( |
10954 ERROR: CEapTtlsPapActive::NewL(), err=%d.", err ); |
11139 aInSrvChallengeUtf8->get_data(), |
10955 return ConvertAmErrorToEapolError( err ); |
11140 aInSrvChallengeUtf8->get_data_length()*2); // Length in bytes |
10956 } |
11141 |
10957 } |
11142 CnvUtfConverter::ConvertToUnicodeFromUtf8(m_notifier_data_to_user->iUidata, utf8); |
10958 if ( aInSrvChallengeUtf8 != NULL ) |
11143 |
10959 { |
11144 EAP_TRACE_DATA_DEBUG( |
10960 iEapTtlsPapActive->UpdateSrvChallenge( *aInSrvChallengeUtf8 ); |
11145 m_am_tools, |
10961 } |
11146 TRACE_FLAGS_DEFAULT, |
10962 TBool startedOk = iEapTtlsPapActive->Start( |
11147 (EAPL("eap_am_type_tls_peap_symbian_c::query_ttls_pap_username_and_password(): iUidata"), |
10963 CEapTtlsPapActive::EEapTtlsPapActiveQueryUserNameAndPassword ); |
11148 m_notifier_data_to_user->iUidata.Ptr(), |
10964 if ( !startedOk ) |
11149 m_notifier_data_to_user->iUidata.Size())); |
10965 { |
11150 |
10966 status = eap_status_process_general_error; |
11151 m_state = EPapChallenge; |
10967 } |
11152 TEapExpandedType aEapType(*EapExpandedTypeTtlsPap.GetType()); |
10968 if ( status != eap_status_pending_request ) |
11153 |
10969 { |
11154 if (iEapAuthNotifier == 0) |
10970 DEBUG( "eap_am_type_tls_peap_symbian_c::query_ttls_pap_username_and_password() \ |
11155 { |
10971 ERROR: status != eap_status_pending_request" ); |
11156 TRAPD(err, iEapAuthNotifier = CEapAuthNotifier::NewL( *this )); |
10972 } |
11157 if (err) |
|
11158 { |
|
11159 return eap_status_process_general_error; |
|
11160 } |
|
11161 } |
|
11162 |
|
11163 TRAPD(err1, iEapAuthNotifier->StartL(CEapAuthNotifier::EEapNotifierTypePapChallengeDialog, m_notifier_data_to_user, aEapType)); |
|
11164 if (err1) |
|
11165 { |
|
11166 return eap_status_process_general_error; |
|
11167 } |
|
11168 } |
|
11169 else |
|
11170 { |
|
11171 m_state = EPapUserNameAndPassword; |
|
11172 |
|
11173 TTtlsPapDbInfo aInDbInfo; |
|
11174 TRAPD(err2, ReadTtlsPapDbL(aInDbInfo)); |
|
11175 if (err2) |
|
11176 { |
|
11177 return eap_status_process_general_error; |
|
11178 } |
|
11179 |
|
11180 m_notifier_data_to_user->iPasswordPromptEnabled = aInDbInfo.iUsrPwdInfo.iPasswordPromptEnabled; |
|
11181 |
|
11182 if (m_notifier_data_to_user->iPasswordPromptEnabled |
|
11183 || aInDbInfo.iUsrPwdInfo.iUserName.Size() == 0 |
|
11184 || aInDbInfo.iUsrPwdInfo.iPassword.Size() == 0) |
|
11185 { |
|
11186 if (aInDbInfo.iUsrPwdInfo.iUserName.Size() == 0) |
|
11187 { |
|
11188 m_notifier_data_to_user->iUsername.Zero(); |
|
11189 } |
|
11190 else |
|
11191 { |
|
11192 m_notifier_data_to_user->iUsername = aInDbInfo.iUsrPwdInfo.iUserName; |
|
11193 } |
|
11194 |
|
11195 m_notifier_data_to_user->iPassword.Zero(); |
|
11196 |
|
11197 TRAPD(err3,SetTtlsPapColumnToNullL( cf_str_EAP_TLS_PEAP_ttls_pap_password_literal )); |
|
11198 if (err3) |
|
11199 { |
|
11200 return eap_status_process_general_error; |
|
11201 } |
|
11202 |
|
11203 if (iEapAuthNotifier == 0) |
|
11204 { |
|
11205 TRAPD(err4, iEapAuthNotifier = CEapAuthNotifier::NewL( *this )); |
|
11206 if (err4) |
|
11207 { |
|
11208 return eap_status_process_general_error; |
|
11209 } |
|
11210 } |
|
11211 else |
|
11212 { |
|
11213 TRAPD(err5,iEapAuthNotifier->Cancel()); |
|
11214 if (err5) |
|
11215 { |
|
11216 return eap_status_process_general_error; |
|
11217 } |
|
11218 } |
|
11219 |
|
11220 TRAPD(err6, iEapAuthNotifier->StartL(CEapAuthNotifier::EEapNotifierTypePapUsernamePasswordDialog, m_notifier_data_to_user, aEapType)); |
|
11221 if (err6) |
|
11222 { |
|
11223 return eap_status_process_general_error; |
|
11224 } |
|
11225 } |
|
11226 else |
|
11227 { |
|
11228 m_notifier_data_to_user->iUsername = aInDbInfo.iUsrPwdInfo.iUserName; |
|
11229 |
|
11230 EAP_TRACE_DATA_DEBUG( |
|
11231 m_am_tools, |
|
11232 TRACE_FLAGS_DEFAULT, |
|
11233 (EAPL("eap_am_type_tls_peap_symbian_c::query_ttls_pap_username_and_password(): iUserName"), |
|
11234 m_notifier_data_to_user->iUsername.Ptr(), |
|
11235 m_notifier_data_to_user->iUsername.Size())); |
|
11236 |
|
11237 m_notifier_data_to_user->iPassword = aInDbInfo.iUsrPwdInfo.iPassword; |
|
11238 |
|
11239 EAP_TRACE_DATA_DEBUG( |
|
11240 m_am_tools, |
|
11241 TRACE_FLAGS_DEFAULT, |
|
11242 (EAPL("eap_am_type_tls_peap_symbian_c::query_ttls_pap_username_and_password(): iPassword"), |
|
11243 m_notifier_data_to_user->iPassword.Ptr(), |
|
11244 m_notifier_data_to_user->iPassword.Size())); |
|
11245 |
|
11246 DlgComplete(KErrNone); |
|
11247 } |
|
11248 } |
|
11249 |
|
11250 return status; |
10973 return status; |
11251 } |
10974 } |
11252 |
10975 |
11253 // ================= TTLS-PAP public not exported ======================= |
10976 // ================= TTLS-PAP public not exported ======================= |
11254 |
10977 |
11255 // ------------------------------------------------------------------------ |
10978 // ------------------------------------------------------------------------ |
11256 // eap_am_type_tls_peap_symbian_c::verify_ttls_pap_username_and_password() |
10979 // eap_am_type_tls_peap_symbian_c::verify_ttls_pap_username_and_password() |
11257 // ------------------------------------------------------------------------ |
10980 // ------------------------------------------------------------------------ |
11258 // |
10981 // |
11259 eap_status_e eap_am_type_tls_peap_symbian_c::verify_ttls_pap_username_and_password( |
10982 eap_status_e |
|
10983 eap_am_type_tls_peap_symbian_c::verify_ttls_pap_username_and_password( |
11260 const eap_variable_data_c * const /*aUserName*/, |
10984 const eap_variable_data_c * const /*aUserName*/, |
11261 const eap_variable_data_c * const /*aUserPassword*/ ) |
10985 const eap_variable_data_c * const /*aUserPassword*/ ) |
11262 { |
10986 { |
11263 EAP_TRACE_DEBUG_SYMBIAN((_L( "eap_am_type_tls_peap_symbian_c::verify_ttls_pap_username_and_password()" ))); |
10987 DEBUG( "eap_am_type_tls_peap_symbian_c::verify_ttls_pap_username_and_password()" ); |
11264 return eap_status_not_supported; |
10988 return eap_status_not_supported; |
11265 } |
10989 } |
11266 |
10990 |
11267 // ================= TTLS-PAP public new ======================= |
10991 // ================= TTLS-PAP public new ======================= |
11268 |
10992 |
11269 // ------------------------------------------------------------------------ |
10993 // ------------------------------------------------------------------------ |
11270 // eap_am_type_tls_peap_symbian_c::CompleteQueryTtlsPapUserNameAndPassword() |
10994 // eap_am_type_tls_peap_symbian_c::CompleteQueryTtlsPapUserNameAndPassword() |
11271 // ------------------------------------------------------------------------ |
10995 // ------------------------------------------------------------------------ |
11272 // |
10996 // |
11273 eap_status_e eap_am_type_tls_peap_symbian_c::CompleteQueryTtlsPapUserNameAndPassword( |
10997 eap_status_e |
|
10998 eap_am_type_tls_peap_symbian_c::CompleteQueryTtlsPapUserNameAndPassword( |
11274 eap_status_e aStatus, |
10999 eap_status_e aStatus, |
11275 const TDesC8& aUserNameUtf8, |
11000 const TDesC8& aUserNameUtf8, |
11276 const TDesC8& aPasswordUtf8 ) |
11001 const TDesC8& aPasswordUtf8 ) |
11277 { |
11002 { |
11278 EAP_TRACE_DEBUG_SYMBIAN((_L( "eap_am_type_tls_peap_symbian_c::CompleteQueryTtlsPapUserNameAndPassword()" ))); |
11003 DEBUG( "eap_am_type_tls_peap_symbian_c::CompleteQueryTtlsPapUserNameAndPassword()" ); |
11279 |
11004 |
11280 eap_status_e retStatus = aStatus; |
11005 eap_status_e retStatus = aStatus; |
11281 eap_status_e tmpStatus = eap_status_ok; |
11006 eap_status_e tmpStatus = eap_status_ok; |
11282 |
11007 |
11283 eap_variable_data_c userNameUtf8( m_am_tools ); |
11008 eap_variable_data_c userNameUtf8( m_am_tools ); |
11425 //| EAP_TLS_PEAP_ttls_pap_password | VARCHAR(128) | cf_str_EAP_TLS_PEAP_ttls_pap_password_literal |// |
11128 //| EAP_TLS_PEAP_ttls_pap_password | VARCHAR(128) | cf_str_EAP_TLS_PEAP_ttls_pap_password_literal |// |
11426 //| EAP_TLS_PEAP_ttls_pap_max_session_validity_time | BIGINT | cf_str_EAP_TLS_PEAP_ttls_pap_max_session_validity_time_literal |// |
11129 //| EAP_TLS_PEAP_ttls_pap_max_session_validity_time | BIGINT | cf_str_EAP_TLS_PEAP_ttls_pap_max_session_validity_time_literal |// |
11427 //| EAP_TLS_PEAP_ttls_pap_last_full_authentication_time | BIGINT | KTTLSPAPLastFullAuthTime |// |
11130 //| EAP_TLS_PEAP_ttls_pap_last_full_authentication_time | BIGINT | KTTLSPAPLastFullAuthTime |// |
11428 void eap_am_type_tls_peap_symbian_c::WriteTtlsPapDbL( |
11131 void eap_am_type_tls_peap_symbian_c::WriteTtlsPapDbL( |
11429 const TTtlsPapDbInfo& aInDbInfo ) |
11132 const TTtlsPapDbInfo& aInDbInfo ) |
11430 { |
11133 { |
11431 EAP_TRACE_DEBUG_SYMBIAN((_L( "eap_am_type_tls_peap_symbian_c::WriteTtlsPapDbL()" ))); |
11134 DEBUG( "eap_am_type_tls_peap_symbian_c::WriteTtlsPapDbL()" ); |
11432 |
11135 |
11433 |
11136 |
11434 HBufC* buf = HBufC::NewLC( KMaxSqlQueryLength ); |
11137 HBufC* buf = HBufC::NewLC( KMaxSqlQueryLength ); |
11435 TPtr sqlStatement = buf->Des(); |
11138 TPtr sqlStatement = buf->Des(); |
11436 |
11139 |
11437 // Query all the relevant parameters |
11140 // Query all the relevant parameters |
11438 _LIT( KSQLQuery, |
11141 _LIT( KSQLQuery, |
11439 "SELECT %S, %S, %S, %S, %S FROM %S WHERE %S=%d AND %S=%d AND %S=%d AND %S=%d" ); |
11142 "SELECT %S, %S, %S, %S, %S FROM %S WHERE %S=%d AND %S=%d AND %S=%d" ); |
11440 |
11143 sqlStatement.Format( KSQLQuery, |
11441 sqlStatement.Format( |
|
11442 KSQLQuery, |
|
11443 &cf_str_EAP_TLS_PEAP_ttls_pap_password_prompt_literal, // select´ |
11144 &cf_str_EAP_TLS_PEAP_ttls_pap_password_prompt_literal, // select´ |
11444 &cf_str_EAP_TLS_PEAP_ttls_pap_username_literal, // select |
11145 &cf_str_EAP_TLS_PEAP_ttls_pap_username_literal, // select |
11445 &cf_str_EAP_TLS_PEAP_ttls_pap_password_literal, // select |
11146 &cf_str_EAP_TLS_PEAP_ttls_pap_password_literal, // select |
11446 &cf_str_EAP_TLS_PEAP_ttls_pap_max_session_validity_time_literal, // select |
11147 &cf_str_EAP_TLS_PEAP_ttls_pap_max_session_validity_time_literal, // select |
11447 &KTTLSPAPLastFullAuthTime, // select |
11148 &KTTLSPAPLastFullAuthTime, // select |
11448 &KTtlsDatabaseTableName, // from |
11149 &KTtlsDatabaseTableName, // from |
11449 &KServiceType, |
11150 &KServiceType, m_index_type, // where %S=%d |
11450 m_index_type, |
11151 &KServiceIndex, m_index, // where %S=%d |
11451 &KServiceIndex, |
11152 &KTunnelingType, m_tunneling_vendor_type ); // where %S=%d |
11452 m_index, |
|
11453 &KTunnelingTypeVendorId, |
|
11454 m_tunneling_type.get_vendor_id(), |
|
11455 &KTunnelingType, |
|
11456 m_tunneling_type.get_vendor_type()); |
|
11457 |
11153 |
11458 RDbView view; |
11154 RDbView view; |
11459 // Evaluate view |
11155 // Evaluate view |
11460 User::LeaveIfError( view.Prepare( m_database, TDbQuery( sqlStatement ) ) ); |
11156 User::LeaveIfError( view.Prepare( m_database, TDbQuery( sqlStatement ) ) ); |
11461 CleanupClosePushL( view ); |
11157 CleanupClosePushL( view ); |
11511 } |
11193 } |
11512 |
11194 |
11513 CleanupStack::PopAndDestroy( &view ); // Close view. |
11195 CleanupStack::PopAndDestroy( &view ); // Close view. |
11514 CleanupStack::PopAndDestroy( buf ); // Delete buf. |
11196 CleanupStack::PopAndDestroy( buf ); // Delete buf. |
11515 |
11197 |
11516 } // eap_am_type_tls_peap_symbian_c::WriteTtlsPapDbL() |
11198 } // eap_am_type_tls_peap_symbian_c::WriteTtlsPapDbL() |
11517 |
11199 |
11518 |
11200 |
11519 // ------------------------------------------------------------------------ |
11201 // ------------------------------------------------------------------------ |
11520 // eap_am_type_tls_peap_symbian_c::SetTtlsPapColumnToNullL |
11202 // eap_am_type_tls_peap_symbian_c::SetTtlsPapColumnToNullL |
11521 // ------------------------------------------------------------------------ |
11203 // ------------------------------------------------------------------------ |
11522 // |
11204 // |
11523 void eap_am_type_tls_peap_symbian_c::SetTtlsPapColumnToNullL( const TDesC& aColName ) |
11205 void eap_am_type_tls_peap_symbian_c::SetTtlsPapColumnToNullL( const TDesC& aColName ) |
11524 { |
11206 { |
11525 EAP_TRACE_DEBUG_SYMBIAN((_L( "eap_am_type_tls_peap_symbian_c::SetColumnNullL()" ))); |
11207 DEBUG( "eap_am_type_tls_peap_symbian_c::SetColumnNullL()" ); |
11526 |
11208 |
11527 HBufC* buf = HBufC::NewLC( KMaxSqlQueryLength ); |
11209 HBufC* buf = HBufC::NewLC( KMaxSqlQueryLength ); |
11528 TPtr sqlStatement = buf->Des(); |
11210 TPtr sqlStatement = buf->Des(); |
11529 |
11211 |
11530 // Query all the relevant parameters |
11212 // Query all the relevant parameters |
11531 _LIT( KSQLQuery, |
11213 _LIT( KSQLQuery, |
11532 "SELECT %S FROM %S WHERE %S=%d AND %S=%d AND %S=%d AND %S=%d" ); |
11214 "SELECT %S FROM %S WHERE %S=%d AND %S=%d AND %S=%d" ); |
11533 |
11215 sqlStatement.Format( KSQLQuery, |
11534 sqlStatement.Format( |
|
11535 KSQLQuery, |
|
11536 &aColName, // select´ |
11216 &aColName, // select´ |
11537 &KTtlsDatabaseTableName, // from |
11217 &KTtlsDatabaseTableName, // from |
11538 &KServiceType, |
11218 &KServiceType, m_index_type, // where %S=%d |
11539 m_index_type, |
11219 &KServiceIndex, m_index, // where %S=%d |
11540 &KServiceIndex, |
11220 &KTunnelingType, m_tunneling_vendor_type ); // where %S=%d |
11541 m_index, |
|
11542 &KTunnelingTypeVendorId, |
|
11543 m_tunneling_type.get_vendor_id(), |
|
11544 &KTunnelingType, |
|
11545 m_tunneling_type.get_vendor_type()); |
|
11546 |
11221 |
11547 RDbView view; |
11222 RDbView view; |
11548 // Evaluate view |
11223 // Evaluate view |
11549 User::LeaveIfError( view.Prepare( m_database, TDbQuery( sqlStatement ) ) ); |
11224 User::LeaveIfError( view.Prepare( m_database, TDbQuery( sqlStatement ) ) ); |
11550 CleanupClosePushL( view ); |
11225 CleanupClosePushL( view ); |
11568 } |
11243 } |
11569 |
11244 |
11570 CleanupStack::PopAndDestroy( &view ); // Close view. |
11245 CleanupStack::PopAndDestroy( &view ); // Close view. |
11571 CleanupStack::PopAndDestroy( buf ); // Delete buf. |
11246 CleanupStack::PopAndDestroy( buf ); // Delete buf. |
11572 |
11247 |
11573 } // eap_am_type_tls_peap_symbian_c::SetTtlsPapColumnToNullL() |
11248 } // eap_am_type_tls_peap_symbian_c::SetTtlsPapColumnToNullL() |
11574 |
11249 |
11575 |
11250 |
11576 // ================= TTLS-PAP private ======================= |
11251 // ================= TTLS-PAP private ======================= |
11577 |
11252 |
11578 // ------------------------------------------------------------------------ |
11253 // ------------------------------------------------------------------------ |
11579 // eap_am_type_tls_peap_symbian_c::IsTtlsPapSessionValidL() |
11254 // eap_am_type_tls_peap_symbian_c::IsTtlsPapSessionValidL() |
11580 // ------------------------------------------------------------------------ |
11255 // ------------------------------------------------------------------------ |
11581 // |
11256 // |
11582 TBool eap_am_type_tls_peap_symbian_c::IsTtlsPapSessionValidL() |
11257 TBool eap_am_type_tls_peap_symbian_c::IsTtlsPapSessionValidL() |
11583 { |
11258 { |
11584 EAP_TRACE_DEBUG_SYMBIAN((_L( "eap_am_type_tls_peap_symbian_c::IsTtlsPapSessionValidL()" ))); |
11259 DEBUG( "eap_am_type_tls_peap_symbian_c::IsTtlsPapSessionValidL()" ); |
11585 |
11260 |
11586 TTtlsPapDbInfo dbInfo; |
11261 TTtlsPapDbInfo dbInfo; |
11587 TInt err = KErrNone; |
11262 TInt err = KErrNone; |
11588 TBool retValue = EFalse; |
11263 TBool retValue = EFalse; |
11589 |
11264 |
11590 TRAP( err, ReadTtlsPapDbL( dbInfo ) ); |
11265 TRAP( err, ReadTtlsPapDbL( dbInfo ) ); |
11591 |
11266 |
11592 if ( err != KErrNone ) |
11267 if ( err != KErrNone ) |
11593 { |
11268 { |
11594 EAP_TRACE_DEBUG_SYMBIAN((_L("ERROR: eap_am_type_tls_peap_symbian_c::IsTtlsPapSessionValidL(): Leave happened, err=%d."), err )); |
11269 DEBUG1( "eap_am_type_tls_peap_symbian_c::IsTtlsPapSessionValidL() ERROR: \ |
|
11270 Leave happened, err=%d.", err ); |
11595 retValue = EFalse; |
11271 retValue = EFalse; |
11596 } |
11272 } |
11597 else |
11273 else |
11598 { |
11274 { |
11599 if ( dbInfo.iUsrPwdInfo.iPasswordPromptEnabled ) |
11275 if ( dbInfo.iUsrPwdInfo.iPasswordPromptEnabled ) |
11600 { |
11276 { |
11601 // If the max session time from DB is zero then we use the |
11277 // If the max session time from DB is zero then we use the |
11602 // one read from configuration file. |
11278 // one read from configuration file. |
11603 if( dbInfo.iMaxSessionTime == 0 ) |
11279 if( dbInfo.iMaxSessionTime == 0 ) |
11604 { |
11280 { |
11605 EAP_TRACE_DEBUG_SYMBIAN((_L( "eap_am_type_tls_peap_symbian_c::IsTtlsPapSessionValidL() Using max TTLS PAP session validity time from config file." ))); |
11281 DEBUG( "eap_am_type_tls_peap_symbian_c::IsTtlsPapSessionValidL() \ |
|
11282 Using max TTLS PAP session validity time from config file." ); |
11606 |
11283 |
11607 // use value from config file |
11284 // use value from config file |
11608 dbInfo.iMaxSessionTime = iEapTtlsPapMaxSessionConfigTime; |
11285 dbInfo.iMaxSessionTime = iEapTtlsPapMaxSessionConfigTime; |
11609 } |
11286 } |
11610 |
11287 |
11611 retValue = CheckTtlsPapSessionValidity( dbInfo.iMaxSessionTime, |
11288 retValue = CheckTtlsPapSessionValidity( dbInfo.iMaxSessionTime, |
11612 dbInfo.iLastFullAuthTime ); |
11289 dbInfo.iLastFullAuthTime ); |
11613 } |
11290 } |
11614 } |
11291 } |
11615 return retValue; |
11292 return retValue; |
11616 } // eap_am_type_tls_peap_symbian_c::IsTtlsPapSessionValidL() |
11293 } // eap_am_type_tls_peap_symbian_c::IsTtlsPapSessionValidL() |
11617 |
11294 |
11618 |
11295 |
11619 // ------------------------------------------------------------------------ |
11296 // ------------------------------------------------------------------------ |
11620 // eap_am_type_tls_peap_symbian_c::CheckTtlsPapSessionValidity() |
11297 // eap_am_type_tls_peap_symbian_c::CheckTtlsPapSessionValidity() |
11621 // ------------------------------------------------------------------------ |
11298 // ------------------------------------------------------------------------ |
11622 // |
11299 // |
11623 TBool eap_am_type_tls_peap_symbian_c::CheckTtlsPapSessionValidity( |
11300 TBool eap_am_type_tls_peap_symbian_c::CheckTtlsPapSessionValidity( |
11624 const TInt64& aInMaxSessionTime, |
11301 const TInt64& aInMaxSessionTime, |
11625 const TInt64& aInLastFullAuthTime ) |
11302 const TInt64& aInLastFullAuthTime ) |
11626 { |
11303 { |
11627 EAP_TRACE_DEBUG_SYMBIAN((_L( "eap_am_type_tls_peap_symbian_c::CheckTtlsPapSessionValidity()" ))); |
11304 DEBUG( "eap_am_type_tls_peap_symbian_c::CheckTtlsPapSessionValidity()" ); |
11628 |
11305 |
11629 // Get the current time. |
11306 // Get the current time. |
11630 TTime currentTime; |
11307 TTime currentTime; |
11631 currentTime.UniversalTime(); |
11308 currentTime.UniversalTime(); |
11632 |
11309 |
11692 ( EAPL( "eap_am_type_tls_peap_symbian_c::CheckTtlsPapSessionValidity - Session NOT Valid \n" ) ) ); |
11369 ( EAPL( "eap_am_type_tls_peap_symbian_c::CheckTtlsPapSessionValidity - Session NOT Valid \n" ) ) ); |
11693 EAP_TRACE_END( m_am_tools, TRACE_FLAGS_DEFAULT ); |
11370 EAP_TRACE_END( m_am_tools, TRACE_FLAGS_DEFAULT ); |
11694 |
11371 |
11695 return EFalse; |
11372 return EFalse; |
11696 } |
11373 } |
11697 } // eap_am_type_tls_peap_symbian_c::CheckTtlsPapSessionValidity |
11374 } // eap_am_type_tls_peap_symbian_c::CheckTtlsPapSessionValidity |
11698 |
11375 |
11699 //-------------------------------------------------- |
|
11700 #if defined(USE_FAST_EAP_TYPE) |
|
11701 |
|
11702 TInt eap_am_type_tls_peap_symbian_c::CreateMMETelConnectionL() |
|
11703 { |
|
11704 EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
11705 EAP_TRACE_DEBUG(m_am_tools, TRACE_FLAGS_DEFAULT, (EAPL("Creating MMETel connection.\n"))); |
|
11706 |
|
11707 TInt errorCode = KErrNone; |
|
11708 |
|
11709 // MMETel need to be connected only once. |
|
11710 if( !iMMETELConnectionStatus ) |
|
11711 { |
|
11712 RTelServer::TPhoneInfo phoneInfo; |
|
11713 TInt phoneCount = 0; |
|
11714 |
|
11715 // Connect to ETel server |
|
11716 User::LeaveIfError( iServer.Connect() ); |
|
11717 |
|
11718 EAP_TRACE_DEBUG(m_am_tools, TRACE_FLAGS_DEFAULT, (EAPL("Connected to ETel server.\n"))); |
|
11719 |
|
11720 // This function loads an ETel TSY module, mmtsy. |
|
11721 errorCode = iServer.LoadPhoneModule( KMmTsyModuleName ); |
|
11722 |
|
11723 EAP_TRACE_DEBUG(m_am_tools, TRACE_FLAGS_DEFAULT, (EAPL("Loaded phone module.\n"))); |
|
11724 |
|
11725 if ( errorCode != KErrNone && errorCode != KErrAlreadyExists ) |
|
11726 { |
|
11727 User::Leave( errorCode ); |
|
11728 } |
|
11729 |
|
11730 iServer.SetExtendedErrorGranularity( RTelServer::EErrorExtended ); |
|
11731 |
|
11732 // This function retrieves the total number of phones supported by all |
|
11733 // the currently loaded ETel (TSY) modules. |
|
11734 User::LeaveIfError( iServer.EnumeratePhones( phoneCount ) ); |
|
11735 |
|
11736 EAP_TRACE_DEBUG(m_am_tools, TRACE_FLAGS_DEFAULT, (EAPL("Number of phones supported by the loaded ETel = %d.\n"), phoneCount)); |
|
11737 |
|
11738 // This function retrieves information associated with the specified phone |
|
11739 while ( ( phoneCount-- ) && ( phoneInfo.iName != KMmTsyPhoneName ) ) |
|
11740 { |
|
11741 User::LeaveIfError( iServer.GetPhoneInfo( phoneCount, phoneInfo ) ); |
|
11742 |
|
11743 EAP_TRACE_DEBUG(m_am_tools, TRACE_FLAGS_DEFAULT, (EAPL("Got phone info.\n"))); |
|
11744 } |
|
11745 |
|
11746 // This function opens a phone subsession by name. ("DefaultPhone"). |
|
11747 User::LeaveIfError( iPhone.Open( iServer, phoneInfo.iName ) ); |
|
11748 |
|
11749 EAP_TRACE_DEBUG(m_am_tools, TRACE_FLAGS_DEFAULT, (EAPL("Opened phone subsession.\n"))); |
|
11750 |
|
11751 // MMETel connected and the phone module loaded fine. |
|
11752 iMMETELConnectionStatus = ETrue; |
|
11753 } |
|
11754 else |
|
11755 { |
|
11756 // MMETel already connected. |
|
11757 EAP_TRACE_DEBUG(m_am_tools, TRACE_FLAGS_DEFAULT, (EAPL("MMETel connected once already.\n"))); |
|
11758 } |
|
11759 |
|
11760 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
11761 |
|
11762 return errorCode; |
|
11763 } |
|
11764 |
|
11765 //-------------------------------------------------- |
|
11766 |
|
11767 void eap_am_type_tls_peap_symbian_c::DisconnectMMETel() |
|
11768 { |
|
11769 if( iMMETELConnectionStatus ) |
|
11770 { |
|
11771 EAP_TRACE_DEBUG(m_am_tools, TRACE_FLAGS_DEFAULT, (EAPL("Closing RMobilePhone and MMETEL.\n"))); |
|
11772 |
|
11773 iPhone.Close(); |
|
11774 iServer.Close(); // Phone module is unloaded automatically when RTelServer session is closed |
|
11775 |
|
11776 iMMETELConnectionStatus = EFalse; |
|
11777 } |
|
11778 else |
|
11779 { |
|
11780 EAP_TRACE_DEBUG(m_am_tools, TRACE_FLAGS_DEFAULT, (EAPL("RMobilePhone and MMETEL already closed.\n"))); |
|
11781 } |
|
11782 } |
|
11783 #endif |
|
11784 //-------------------------------------------------- |
|
11785 |
11376 |
11786 // End of file. |
11377 // End of file. |