48 #include "eap_am_tools_symbian.h" |
51 #include "eap_am_tools_symbian.h" |
49 #include "EapTraceSymbian.h" |
52 #include "EapTraceSymbian.h" |
50 #include "EapConversion.h" |
53 #include "EapConversion.h" |
51 #include "EapExpandedType.h" |
54 #include "EapExpandedType.h" |
52 |
55 |
53 #ifdef USE_PAC_STORE |
|
54 #include "pac_store_db_symbian.h" |
|
55 #endif |
|
56 |
56 |
57 #include "eapol_key_types.h" |
57 #include "eapol_key_types.h" |
58 |
58 |
59 // LOCAL CONSTANTS |
59 // LOCAL CONSTANTS |
60 |
60 |
61 // The version number of this interface. At the moment this version number is |
61 // The version number of this interface. At the moment this version number is |
62 // common for all three plug-in interfaces. |
62 // common for all three plug-in interfaces. |
63 const TUint KInterfaceVersion = 1; |
63 const TUint KInterfaceVersion = 1; |
64 |
64 |
65 #if defined(USE_FAST_EAP_TYPE) |
65 #if defined(USE_FAST_EAP_TYPE) |
66 const u8_t EAP_RAS_SOURCE[] = "ras_src"; |
66 const u32_t KRemovePacStoreInitializationTimerID = 0; |
67 const u8_t EAP_RAS_DESTINATION[] = "ras_des"; |
|
68 #endif //#if defined(USE_FAST_EAP_TYPE) |
67 #endif //#if defined(USE_FAST_EAP_TYPE) |
69 |
68 |
70 // ================= MEMBER FUNCTIONS ======================= |
69 // ================= MEMBER FUNCTIONS ======================= |
71 |
|
72 |
70 |
73 CEapTlsPeap::CEapTlsPeap(const TIndexType aIndexType, |
71 CEapTlsPeap::CEapTlsPeap(const TIndexType aIndexType, |
74 const TInt aIndex, |
72 const TInt aIndex, |
75 const eap_type_value_e aEapType) |
73 const eap_type_value_e aEapType, |
|
74 abs_eap_am_tools_c * const aTools) |
76 : iIndexType(aIndexType) |
75 : iIndexType(aIndexType) |
77 , iIndex(aIndex) |
76 , iIndex(aIndex) |
78 , iEapType(aEapType) |
77 , iEapType(aEapType) |
79 , iTunnelingType(eap_type_none) |
78 , iTunnelingType(eap_type_none) |
|
79 , m_am_tools(aTools) |
80 #if defined(USE_FAST_EAP_TYPE) |
80 #if defined(USE_FAST_EAP_TYPE) |
81 , iApplication(NULL) |
81 , iPacStoreInitialization(NULL) |
82 #endif |
82 , iInitializer(NULL) |
83 , m_am_tools(abs_eap_am_tools_c::new_abs_eap_am_tools_c()) |
83 #endif //#if defined(USE_FAST_EAP_TYPE) |
84 { |
84 { |
85 EAP_TRACE_DEBUG_SYMBIAN((_L("CEapTlsPeap::CEapTlsPeap()\n"))); |
85 EAP_TRACE_DEBUG_SYMBIAN((_L("CEapTlsPeap::CEapTlsPeap()\n"))); |
86 EAP_TRACE_RETURN_STRING_SYMBIAN(_L("returns: CEapTlsPeap::CEapTlsPeap()\n")); |
86 EAP_TRACE_RETURN_STRING_SYMBIAN(_L("returns: CEapTlsPeap::CEapTlsPeap()\n")); |
87 |
87 } |
88 if (m_am_tools == 0) |
88 |
89 { |
89 // ---------------------------------------------------------- |
90 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
90 |
91 return; |
91 CEapTlsPeap* CEapTlsPeap::NewTlsL(SPluginInfo *aIapInfo) |
92 } |
|
93 |
|
94 #if defined(USE_FAST_EAP_TYPE) |
|
95 if(iEapType == eap_type_fast) |
|
96 { |
|
97 eap_variable_data_c source(m_am_tools); |
|
98 |
|
99 eap_status_e status = source.set_copy_of_buffer( |
|
100 EAP_RAS_SOURCE, |
|
101 sizeof(EAP_RAS_SOURCE)); |
|
102 if (status != eap_status_ok) |
|
103 { |
|
104 EAP_TRACE_DEBUG_SYMBIAN((_L("ERROR: CEapTlsPeap::CEapTlsPeap(): status = %s\n"), |
|
105 eap_status_string_c::get_status_string(status))); |
|
106 return; |
|
107 } |
|
108 |
|
109 eap_variable_data_c destination(m_am_tools); |
|
110 |
|
111 status = destination.set_copy_of_buffer( |
|
112 EAP_RAS_DESTINATION, |
|
113 sizeof(EAP_RAS_DESTINATION)); |
|
114 if (status != eap_status_ok) |
|
115 { |
|
116 EAP_TRACE_DEBUG_SYMBIAN((_L("ERROR: CEapTlsPeap::CEapTlsPeap(): status = %s\n"), |
|
117 eap_status_string_c::get_status_string(status))); |
|
118 return; |
|
119 } |
|
120 |
|
121 eap_am_network_id_c dummy_id(m_am_tools, &source, &destination, eapol_ethernet_type_pae); |
|
122 |
|
123 if (dummy_id.get_is_valid() == false) |
|
124 { |
|
125 EAP_TRACE_DEBUG_SYMBIAN((_L("ERROR: CEapTlsPeap::NewPeapL() dummy_id not valid\n"))); |
|
126 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
127 return; |
|
128 } |
|
129 |
|
130 if (dummy_id.get_is_valid_data() == false) |
|
131 { |
|
132 EAP_TRACE_DEBUG_SYMBIAN((_L("ERROR: CEapTlsPeap::NewPeapL() dummy_id data not valid\n"))); |
|
133 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
134 return; |
|
135 } |
|
136 |
|
137 |
|
138 TRAPD(err, iApplication = GetTlsInterfaceL( |
|
139 m_am_tools, |
|
140 true, |
|
141 &dummy_id)); |
|
142 if (err) |
|
143 { |
|
144 EAP_TRACE_DEBUG_SYMBIAN((_L("ERROR: CEapTlsPeap::NewPeapL() iApplication couldn't be created\n"))); |
|
145 |
|
146 } |
|
147 } |
|
148 #endif //#if defined(USE_FAST_EAP_TYPE) |
|
149 |
|
150 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
151 |
|
152 } |
|
153 |
|
154 // ---------------------------------------------------------- |
|
155 |
|
156 CEapTlsPeap* CEapTlsPeap::NewTlsL(SIapInfo *aIapInfo) |
|
157 { |
92 { |
158 EAP_TRACE_DEBUG_SYMBIAN((_L("CEapTlsPeap::NewTlsL()\n"))); |
93 EAP_TRACE_DEBUG_SYMBIAN((_L("CEapTlsPeap::NewTlsL()\n"))); |
159 EAP_TRACE_RETURN_STRING_SYMBIAN(_L("returns: CEapTlsPeap::NewTlsL()\n")); |
94 EAP_TRACE_RETURN_STRING_SYMBIAN(_L("returns: CEapTlsPeap::NewTlsL()\n")); |
160 |
95 |
161 return new (ELeave) CEapTlsPeap(aIapInfo->indexType, aIapInfo->index, eap_type_tls); |
96 CEapTlsPeap* self = new (ELeave) CEapTlsPeap(aIapInfo->indexType, aIapInfo->index, eap_type_tls, aIapInfo->aTools); |
162 } |
97 |
163 |
98 CleanupStack::PushL(self); |
164 // ---------------------------------------------------------- |
99 |
165 |
100 self->ConstructL(); |
166 CEapTlsPeap* CEapTlsPeap::NewPeapL(SIapInfo *aIapInfo) |
101 |
|
102 CleanupStack::Pop(self); |
|
103 |
|
104 return self; |
|
105 } |
|
106 |
|
107 // ---------------------------------------------------------- |
|
108 |
|
109 CEapTlsPeap* CEapTlsPeap::NewPeapL(SPluginInfo *aIapInfo) |
167 { |
110 { |
168 EAP_TRACE_DEBUG_SYMBIAN((_L("CEapTlsPeap::NewPeapL()\n"))); |
111 EAP_TRACE_DEBUG_SYMBIAN((_L("CEapTlsPeap::NewPeapL()\n"))); |
169 EAP_TRACE_RETURN_STRING_SYMBIAN(_L("returns: CEapTlsPeap::NewPeapL()\n")); |
112 EAP_TRACE_RETURN_STRING_SYMBIAN(_L("returns: CEapTlsPeap::NewPeapL()\n")); |
170 |
113 |
171 return new (ELeave) CEapTlsPeap(aIapInfo->indexType, aIapInfo->index, eap_type_peap); |
114 CEapTlsPeap* self = new (ELeave) CEapTlsPeap(aIapInfo->indexType, aIapInfo->index, eap_type_peap, aIapInfo->aTools); |
|
115 |
|
116 CleanupStack::PushL(self); |
|
117 |
|
118 self->ConstructL(); |
|
119 |
|
120 CleanupStack::Pop(self); |
|
121 |
|
122 return self; |
172 } |
123 } |
173 |
124 |
174 // ---------------------------------------------------------- |
125 // ---------------------------------------------------------- |
175 |
126 |
176 #if defined(USE_TTLS_EAP_TYPE) |
127 #if defined(USE_TTLS_EAP_TYPE) |
177 |
128 |
178 CEapTlsPeap* CEapTlsPeap::NewTtlsL(SIapInfo *aIapInfo) |
129 CEapTlsPeap* CEapTlsPeap::NewTtlsL(SPluginInfo *aIapInfo) |
179 { |
130 { |
180 EAP_TRACE_DEBUG_SYMBIAN((_L("CEapTlsPeap::NewTtlsL()\n"))); |
131 EAP_TRACE_DEBUG_SYMBIAN((_L("CEapTlsPeap::NewTtlsL()\n"))); |
181 EAP_TRACE_RETURN_STRING_SYMBIAN(_L("returns: CEapTlsPeap::NewTtlsL()\n")); |
132 EAP_TRACE_RETURN_STRING_SYMBIAN(_L("returns: CEapTlsPeap::NewTtlsL()\n")); |
182 |
133 |
183 return new (ELeave) CEapTlsPeap(aIapInfo->indexType, aIapInfo->index, eap_type_ttls); |
134 CEapTlsPeap* self = new (ELeave) CEapTlsPeap(aIapInfo->indexType, aIapInfo->index, eap_type_ttls, aIapInfo->aTools); |
|
135 |
|
136 CleanupStack::PushL(self); |
|
137 |
|
138 self->ConstructL(); |
|
139 |
|
140 CleanupStack::Pop(self); |
|
141 |
|
142 return self; |
184 } |
143 } |
185 |
144 |
186 #endif // #if defined(USE_TTLS_EAP_TYPE) |
145 #endif // #if defined(USE_TTLS_EAP_TYPE) |
187 |
146 |
188 // ---------------------------------------------------------- |
147 // ---------------------------------------------------------- |
191 // --------------------------------------------------------- |
150 // --------------------------------------------------------- |
192 // CEapTtlsPapActive::NewTtlsPapL() |
151 // CEapTtlsPapActive::NewTtlsPapL() |
193 // --------------------------------------------------------- |
152 // --------------------------------------------------------- |
194 // |
153 // |
195 |
154 |
196 CEapTlsPeap* CEapTlsPeap::NewTtlsPapL( SIapInfo* aIapInfo ) |
155 CEapTlsPeap* CEapTlsPeap::NewTtlsPapL( SPluginInfo* aIapInfo ) |
197 { |
156 { |
198 EAP_TRACE_DEBUG_SYMBIAN((_L("CEapTlsPeap::NewTtlsPapL()\n"))); |
157 EAP_TRACE_DEBUG_SYMBIAN((_L("CEapTlsPeap::NewTtlsPapL()\n"))); |
199 EAP_TRACE_RETURN_STRING_SYMBIAN(_L("returns: CEapTlsPeap::NewTtlsPapL()\n")); |
158 EAP_TRACE_RETURN_STRING_SYMBIAN(_L("returns: CEapTlsPeap::NewTtlsPapL()\n")); |
200 |
159 |
201 return new (ELeave) CEapTlsPeap( |
160 CEapTlsPeap* self = new (ELeave) CEapTlsPeap(aIapInfo->indexType, aIapInfo->index, eap_expanded_type_ttls_plain_pap.get_type(), aIapInfo->aTools); |
202 aIapInfo->indexType, aIapInfo->index, eap_expanded_type_ttls_plain_pap.get_type() ); |
161 |
203 } |
162 CleanupStack::PushL(self); |
|
163 |
|
164 self->ConstructL(); |
|
165 |
|
166 CleanupStack::Pop(self); |
|
167 |
|
168 return self; |
|
169 } |
204 |
170 |
205 |
171 |
206 // ---------------------------------------------------------- |
172 // ---------------------------------------------------------- |
207 |
173 |
208 #if defined(USE_FAST_EAP_TYPE) |
174 #if defined(USE_FAST_EAP_TYPE) |
209 |
175 |
210 CEapTlsPeap* CEapTlsPeap::NewFastL(SIapInfo *aIapInfo) |
176 CEapTlsPeap* CEapTlsPeap::NewFastL(SPluginInfo *aIapInfo) |
211 { |
177 { |
212 EAP_TRACE_DEBUG_SYMBIAN((_L("CEapTlsPeap::NewFastL()\n"))); |
178 EAP_TRACE_DEBUG_SYMBIAN((_L("CEapTlsPeap::NewFastL()\n"))); |
213 EAP_TRACE_RETURN_STRING_SYMBIAN(_L("returns: CEapTlsPeap::NewFastL()\n")); |
179 EAP_TRACE_RETURN_STRING_SYMBIAN(_L("returns: CEapTlsPeap::NewFastL()\n")); |
214 |
180 |
215 return new (ELeave) CEapTlsPeap(aIapInfo->indexType, aIapInfo->index, eap_type_fast); |
181 CEapTlsPeap* self = new (ELeave) CEapTlsPeap(aIapInfo->indexType, aIapInfo->index, eap_type_fast, aIapInfo->aTools); |
|
182 |
|
183 CleanupStack::PushL(self); |
|
184 |
|
185 self->ConstructL(); |
|
186 |
|
187 CleanupStack::Pop(self); |
|
188 |
|
189 return self; |
216 } |
190 } |
217 |
191 |
218 #endif // #if defined(USE_FAST_EAP_TYPE) |
192 #endif // #if defined(USE_FAST_EAP_TYPE) |
|
193 |
|
194 //-------------------------------------------------- |
|
195 |
|
196 // |
|
197 void CEapTlsPeap::ConstructL() |
|
198 { |
|
199 EAP_TRACE_DEBUG_SYMBIAN((_L("CEapTlsPeap::ConstructL()\n"))); |
|
200 EAP_TRACE_RETURN_STRING_SYMBIAN(_L("returns: CEapTlsPeap::ConstructL()\n")); |
|
201 |
|
202 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|
203 |
|
204 eap_status_e status(eap_status_ok); |
|
205 |
|
206 { |
|
207 const u8_t DEFAULT_PREFIX[] = "EAP-SERVER"; |
|
208 eap_variable_data_c tmp_prefix(m_am_tools); |
|
209 |
|
210 if (tmp_prefix.get_is_valid() == false) |
|
211 { |
|
212 status = eap_status_allocation_error; |
|
213 (void) EAP_STATUS_RETURN(m_am_tools, status); |
|
214 } |
|
215 |
|
216 if (status == eap_status_ok) |
|
217 { |
|
218 status = tmp_prefix.set_copy_of_buffer(DEFAULT_PREFIX, sizeof(DEFAULT_PREFIX)-1ul);; |
|
219 if (status != eap_status_ok) |
|
220 { |
|
221 (void) EAP_STATUS_RETURN(m_am_tools, status); |
|
222 } |
|
223 } |
|
224 |
|
225 if (status == eap_status_ok) |
|
226 { |
|
227 status = tmp_prefix.add_end_null(); |
|
228 if (status != eap_status_ok) |
|
229 { |
|
230 (void) EAP_STATUS_RETURN(m_am_tools, status); |
|
231 } |
|
232 } |
|
233 |
|
234 if (status == eap_status_ok) |
|
235 { |
|
236 status = m_am_tools->set_trace_prefix(&tmp_prefix); |
|
237 if (status != eap_status_ok) |
|
238 { |
|
239 (void) EAP_STATUS_RETURN(m_am_tools, status); |
|
240 } |
|
241 } |
|
242 } |
|
243 |
|
244 if (status != eap_status_ok) |
|
245 { |
|
246 User::Leave(m_am_tools->convert_eapol_error_to_am_error(EAP_STATUS_RETURN(m_am_tools, status))); |
|
247 } |
|
248 |
|
249 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|
250 } |
219 |
251 |
220 // ---------------------------------------------------------- |
252 // ---------------------------------------------------------- |
221 |
253 |
222 CEapTlsPeap::~CEapTlsPeap() |
254 CEapTlsPeap::~CEapTlsPeap() |
223 { |
255 { |
224 EAP_TRACE_DEBUG_SYMBIAN((_L("CEapTlsPeap::~CEapTlsPeap()\n"))); |
256 EAP_TRACE_DEBUG_SYMBIAN((_L("CEapTlsPeap::~CEapTlsPeap()\n"))); |
225 EAP_TRACE_RETURN_STRING_SYMBIAN(_L("returns: CEapTlsPeap::~CEapTlsPeap()\n")); |
257 EAP_TRACE_RETURN_STRING_SYMBIAN(_L("returns: CEapTlsPeap::~CEapTlsPeap()\n")); |
226 |
258 |
227 iEapArray.ResetAndDestroy(); |
259 iEapArray.ResetAndDestroy(); |
228 |
260 |
229 if (iType != NULL) |
261 #if defined(USE_FAST_EAP_TYPE) |
230 { |
262 delete iPacStoreInitialization; |
231 iType->shutdown(); |
263 iPacStoreInitialization = 0; |
232 // type deletes all |
264 iInitializer = 0; |
233 delete iType; |
265 #endif // #if defined(USE_FAST_EAP_TYPE) |
234 iType = NULL; |
266 |
235 } |
|
236 |
|
237 EAP_TRACE_DEBUG_SYMBIAN((_L("CEapTlsPeap::~CEapTlsPeap() iType deleted\n"))); |
267 EAP_TRACE_DEBUG_SYMBIAN((_L("CEapTlsPeap::~CEapTlsPeap() iType deleted\n"))); |
238 |
268 } |
239 #if defined(USE_FAST_EAP_TYPE) |
269 |
240 if (iApplication != NULL) |
|
241 { |
|
242 // iApplication->shutdown(); |
|
243 // delete iApplication; |
|
244 iApplication = NULL; |
|
245 } |
|
246 #endif //#if defined(USE_FAST_EAP_TYPE) |
|
247 |
|
248 abs_eap_am_tools_c::delete_abs_eap_am_tools_c(m_am_tools); |
|
249 } |
|
250 |
|
251 #if defined(USE_FAST_EAP_TYPE) |
|
252 // ---------------------------------------------------------- |
|
253 tls_application_eap_fast_c* CEapTlsPeap::GetTlsInterfaceL(abs_eap_am_tools_c* const aTools, |
|
254 const bool is_client_when_true, |
|
255 const eap_am_network_id_c * const receive_network_id) |
|
256 { |
|
257 EAP_TRACE_DEBUG_SYMBIAN((_L("CEapTlsPeap::GetTlsInterfaceL()\n"))); |
|
258 EAP_TRACE_RETURN_STRING_SYMBIAN(_L("returns: CEapTlsPeap::GetTlsInterfaceL()\n")); |
|
259 |
|
260 EAP_TRACE_DEBUG_SYMBIAN( |
|
261 (_L("CEapTlsPeap::GetTlsInterfaceL -Start- iIndexType=%d, iIndex=%d, Tunneling vendor type=%d, Eap vendor type=%d \n"), |
|
262 iIndexType,iIndex, iTunnelingType.get_vendor_type(), iEapType.get_vendor_type())); |
|
263 |
|
264 // Create adaptation layer |
|
265 eap_am_type_tls_peap_symbian_c* amEapType; |
|
266 tls_record_c* record; |
|
267 |
|
268 eap_core_c* const eap_core = reinterpret_cast<eap_core_c *> (new dummy_eap_core_c( |
|
269 aTools, |
|
270 0, |
|
271 is_client_when_true, |
|
272 receive_network_id, |
|
273 true)); |
|
274 if (eap_core == 0) |
|
275 { |
|
276 // Out of memory |
|
277 User::Leave(KErrNoMemory); |
|
278 } |
|
279 else if (eap_core->get_is_valid() == false) |
|
280 { |
|
281 // Out of memory |
|
282 eap_core->shutdown(); |
|
283 delete eap_core; |
|
284 User::Leave(KErrGeneral); |
|
285 } |
|
286 |
|
287 EAP_TRACE_DEBUG_SYMBIAN( |
|
288 (_L("CEapTlsPeap::GetTlsInterfaceL - created eap_core_c \n"))); |
|
289 |
|
290 amEapType = eap_am_type_tls_peap_symbian_c::NewL( |
|
291 aTools, |
|
292 eap_core, |
|
293 iIndexType, |
|
294 iIndex, |
|
295 iTunnelingType, |
|
296 iEapType, |
|
297 is_client_when_true, |
|
298 receive_network_id); |
|
299 if (amEapType->get_is_valid() == false) |
|
300 { |
|
301 amEapType->shutdown(); |
|
302 delete amEapType; |
|
303 User::Leave(KErrGeneral); |
|
304 } |
|
305 |
|
306 amEapType->configure(); |
|
307 |
|
308 EAP_TRACE_DEBUG_SYMBIAN( |
|
309 (_L("CEapTlsPeap::GetTlsInterfaceL - created eap_am_type_tls_peap_symbian_c \n"))); |
|
310 |
|
311 tls_application_eap_fast_c* application = 0; |
|
312 |
|
313 if(iEapType == eap_type_fast) |
|
314 { |
|
315 application = new tls_application_eap_fast_c( |
|
316 aTools, |
|
317 eap_core, |
|
318 true, |
|
319 is_client_when_true, |
|
320 iEapType, |
|
321 receive_network_id, |
|
322 amEapType); |
|
323 |
|
324 if (application) |
|
325 { |
|
326 application->configure(); |
|
327 |
|
328 EAP_TRACE_DEBUG_SYMBIAN( |
|
329 (_L("CEapTlsPeap::GetTlsInterfaceL - created tls_application_eap_fast_c \n"))); |
|
330 application->start_initialize_PAC_store(); |
|
331 } |
|
332 } |
|
333 |
|
334 |
|
335 EAP_TRACE_DEBUG_SYMBIAN( |
|
336 (_L("CEapTlsPeap::GetTlsInterfaceL - Creating tls_record_c \n"))); |
|
337 |
|
338 record = new tls_record_c( |
|
339 aTools, |
|
340 amEapType, |
|
341 false, |
|
342 application, |
|
343 true, |
|
344 is_client_when_true, |
|
345 iEapType, |
|
346 receive_network_id); |
|
347 if (record == 0) |
|
348 { |
|
349 // Out of memory |
|
350 // application takes care of eap_core_c deletion |
|
351 application->shutdown(); |
|
352 delete application; |
|
353 amEapType->shutdown(); |
|
354 delete amEapType; |
|
355 User::Leave(KErrGeneral); |
|
356 } |
|
357 else if (record->get_is_valid() == false) |
|
358 { |
|
359 // Out of memory |
|
360 // record takes care of application deletion |
|
361 record->shutdown(); |
|
362 delete record; |
|
363 amEapType->shutdown(); |
|
364 delete amEapType; |
|
365 User::Leave(KErrGeneral); |
|
366 } |
|
367 |
|
368 EAP_TRACE_DEBUG_SYMBIAN( |
|
369 (_L("CEapTlsPeap::GetTlsInterfaceL - Creating the OS independent portion - eap_type_tls_peap_c \n"))); |
|
370 |
|
371 // Create the OS independent portion |
|
372 |
|
373 iType = new eap_type_tls_peap_c( |
|
374 aTools, |
|
375 eap_core, |
|
376 amEapType, |
|
377 true, |
|
378 record, |
|
379 true, |
|
380 is_client_when_true, |
|
381 iEapType, |
|
382 receive_network_id); |
|
383 if (iType == 0) |
|
384 { |
|
385 // Out of memory |
|
386 // record takes care of application deletion |
|
387 record->shutdown(); |
|
388 delete record; |
|
389 amEapType->shutdown(); |
|
390 delete amEapType; |
|
391 User::Leave(KErrNoMemory); |
|
392 } |
|
393 else if(iType->get_is_valid() == false) |
|
394 { |
|
395 iType->shutdown(); |
|
396 // type deletes all |
|
397 delete iType; |
|
398 iType = NULL; |
|
399 User::Leave(KErrGeneral); |
|
400 } |
|
401 |
|
402 return application; |
|
403 } |
|
404 #endif |
|
405 // ---------------------------------------------------------- |
270 // ---------------------------------------------------------- |
406 |
271 |
407 #ifdef USE_EAP_SIMPLE_CONFIG |
272 #ifdef USE_EAP_SIMPLE_CONFIG |
408 |
273 |
409 eap_base_type_c* CEapTlsPeap::GetStackInterfaceL(abs_eap_am_tools_c* const aTools, |
274 eap_base_type_c* CEapTlsPeap::GetStackInterfaceL( |
410 abs_eap_base_type_c* const aPartner, |
275 abs_eap_am_tools_c* const aTools, |
411 const bool is_client_when_true, |
276 abs_eap_base_type_c* const aPartner, |
412 const eap_am_network_id_c * const receive_network_id, |
277 const bool is_client_when_true, |
413 abs_eap_configuration_if_c * const /*configuration_if*/) |
278 const eap_am_network_id_c * const receive_network_id, |
|
279 abs_eap_configuration_if_c * const /*configuration_if*/) |
414 |
280 |
415 #else |
281 #else |
416 |
282 |
417 eap_base_type_c* CEapTlsPeap::GetStackInterfaceL(abs_eap_am_tools_c* const aTools, |
283 eap_base_type_c* CEapTlsPeap::GetStackInterfaceL( |
418 abs_eap_base_type_c* const aPartner, |
284 abs_eap_am_tools_c* const aTools, |
419 const bool is_client_when_true, |
285 abs_eap_base_type_c* const aPartner, |
420 const eap_am_network_id_c * const receive_network_id) |
286 const bool is_client_when_true, |
|
287 const eap_am_network_id_c * const receive_network_id) |
421 |
288 |
422 #endif // #ifdef USE_EAP_SIMPLE_CONFIG |
289 #endif // #ifdef USE_EAP_SIMPLE_CONFIG |
423 { |
290 { |
424 EAP_TRACE_DEBUG_SYMBIAN((_L("CEapTlsPeap::GetStackInterfaceL()\n"))); |
291 EAP_TRACE_DEBUG_SYMBIAN((_L("CEapTlsPeap::GetStackInterfaceL()\n"))); |
425 EAP_TRACE_RETURN_STRING_SYMBIAN(_L("returns: CEapTlsPeap::GetStackInterfaceL()\n")); |
292 EAP_TRACE_RETURN_STRING_SYMBIAN(_L("returns: CEapTlsPeap::GetStackInterfaceL()\n")); |
1395 |
1264 |
1396 } |
1265 } |
1397 |
1266 |
1398 // ---------------------------------------------------------- |
1267 // ---------------------------------------------------------- |
1399 |
1268 |
|
1269 TInt CEapTlsPeap::InitialisePacStore(AbsPacStoreInitializer * const initializer) |
|
1270 { |
|
1271 |
|
1272 #if defined(USE_FAST_EAP_TYPE) |
|
1273 |
|
1274 if (iEapType == eap_type_fast) |
|
1275 { |
|
1276 iInitializer = 0; |
|
1277 |
|
1278 delete iPacStoreInitialization; |
|
1279 |
|
1280 TRAPD(error, (iPacStoreInitialization = CPacStoreInitialization::NewL(iIndexType, iIndex, iEapType, m_am_tools))); |
|
1281 if (error != KErrNone) |
|
1282 { |
|
1283 if (iPacStoreInitialization != 0) |
|
1284 { |
|
1285 delete iPacStoreInitialization; |
|
1286 iPacStoreInitialization = 0; |
|
1287 } |
|
1288 |
|
1289 return error; |
|
1290 } |
|
1291 |
|
1292 iInitializer = initializer; |
|
1293 |
|
1294 eap_status_e status = iPacStoreInitialization->InitialisePacStore(this); |
|
1295 if (status != eap_status_ok) |
|
1296 { |
|
1297 return m_am_tools->convert_eapol_error_to_am_error(EAP_STATUS_RETURN(m_am_tools, status)); |
|
1298 } |
|
1299 } |
|
1300 |
|
1301 #else |
|
1302 |
|
1303 EAP_UNREFERENCED_PARAMETER(initializer); |
|
1304 |
|
1305 #endif //#if defined(USE_FAST_EAP_TYPE) |
|
1306 |
|
1307 return KErrNone; |
|
1308 |
|
1309 } |
|
1310 |
|
1311 //-------------------------------------------------- |
|
1312 |
|
1313 #if defined(USE_FAST_EAP_TYPE) |
|
1314 |
|
1315 eap_status_e CEapTlsPeap::complete_start_initialize_PAC_store( |
|
1316 const eap_fast_completion_operation_e completion_operation, |
|
1317 const eap_fast_initialize_pac_store_completion_e completion) |
|
1318 { |
|
1319 EAP_TRACE_DEBUG( |
|
1320 m_am_tools, |
|
1321 TRACE_FLAGS_DEFAULT, |
|
1322 (EAPL("this = 0x%08x, message_function: starts: CEapTlsPeap::complete_start_initialize_PAC_store(): completion_operation=%d, completion=%d\n"), |
|
1323 this, |
|
1324 completion_operation, |
|
1325 completion)); |
|
1326 |
|
1327 EAP_TRACE_RETURN_STRING(m_am_tools, "returns: CEapTlsPeap::complete_start_initialize_PAC_store()"); |
|
1328 |
|
1329 EAP_UNREFERENCED_PARAMETER(completion_operation); |
|
1330 EAP_UNREFERENCED_PARAMETER(completion); |
|
1331 |
|
1332 EAP_ASSERT(completion_operation == eap_fast_completion_operation_none); |
|
1333 EAP_ASSERT(completion == eap_fast_initialize_pac_store_only); |
|
1334 |
|
1335 TInt error = iInitializer->CompleteInitialisePacStore(); |
|
1336 |
|
1337 if (error != KErrNone) |
|
1338 { |
|
1339 delete iPacStoreInitialization; |
|
1340 iPacStoreInitialization = 0; |
|
1341 iInitializer = 0; |
|
1342 } |
|
1343 else |
|
1344 { |
|
1345 eap_status_e status = m_am_tools->am_set_timer( |
|
1346 this, |
|
1347 KRemovePacStoreInitializationTimerID, |
|
1348 0, |
|
1349 0); |
|
1350 |
|
1351 error = m_am_tools->convert_eapol_error_to_am_error(EAP_STATUS_RETURN(m_am_tools, status)); |
|
1352 } |
|
1353 |
|
1354 return EAP_STATUS_RETURN(m_am_tools, m_am_tools->convert_am_error_to_eapol_error(error)); |
|
1355 } |
|
1356 |
|
1357 #endif //#if defined(USE_FAST_EAP_TYPE) |
|
1358 |
|
1359 // ---------------------------------------------------------- |
|
1360 |
1400 #ifdef USE_PAC_STORE |
1361 #ifdef USE_PAC_STORE |
1401 |
1362 |
1402 void CEapTlsPeap::UpdatePacStoreCleanupTableL(const TIndexType aIndexType, |
1363 void CEapTlsPeap::UpdatePacStoreCleanupTableL(const TIndexType aIndexType, |
1403 const TInt aIndex, |
1364 const TInt aIndex, |
1404 const eap_type_value_e aTunnelingType) |
1365 const eap_type_value_e aTunnelingType) |
1407 EAP_TRACE_RETURN_STRING_SYMBIAN(_L("returns: CEapTlsPeap::UpdatePacStoreCleanupTableL()\n")); |
1368 EAP_TRACE_RETURN_STRING_SYMBIAN(_L("returns: CEapTlsPeap::UpdatePacStoreCleanupTableL()\n")); |
1408 |
1369 |
1409 EAP_TRACE_DEBUG_SYMBIAN( |
1370 EAP_TRACE_DEBUG_SYMBIAN( |
1410 (_L("CEapTlsPeap::UpdatePacStoreCleanupTableL: Start"))); |
1371 (_L("CEapTlsPeap::UpdatePacStoreCleanupTableL: Start"))); |
1411 |
1372 |
1412 CPacStoreDatabase * pacStoreDb = CPacStoreDatabase::NewL(); |
1373 CPacStoreDatabase * pacStoreDb = CPacStoreDatabase::NewL(m_am_tools); |
1413 User::LeaveIfNull(pacStoreDb); |
1374 User::LeaveIfNull(pacStoreDb); |
1414 |
1375 CleanupStack::PushL(pacStoreDb); |
|
1376 |
1415 EAP_TRACE_DEBUG_SYMBIAN( |
1377 EAP_TRACE_DEBUG_SYMBIAN( |
1416 (_L("CEapTlsPeap::UpdatePacStoreCleanupTableL Created PAC store"))); |
1378 (_L("CEapTlsPeap::UpdatePacStoreCleanupTableL Created PAC store"))); |
1417 |
1379 |
1418 pacStoreDb->OpenPacStoreL(); |
1380 //pacStoreDb->OpenPacStoreL(); |
1419 |
1381 |
1420 EAP_TRACE_DEBUG_SYMBIAN( |
1382 EAP_TRACE_DEBUG_SYMBIAN( |
1421 (_L("CEapTlsPeap::UpdatePacStoreCleanupTableL Opened PAC store"))); |
1383 (_L("CEapTlsPeap::UpdatePacStoreCleanupTableL Opened PAC store"))); |
1422 |
1384 |
1423 pacStoreDb->AddACleanupReferenceEntryL(aIndexType, aIndex, aTunnelingType); |
1385 pacStoreDb->AddACleanupReferenceEntryL(aIndexType, aIndex, aTunnelingType); |
1424 |
1386 |
1425 EAP_TRACE_DEBUG_SYMBIAN( |
1387 EAP_TRACE_DEBUG_SYMBIAN( |
1426 (_L("CEapTlsPeap::UpdatePacStoreCleanupTableL: AddACleanupReferenceEntryL returns"))); |
1388 (_L("CEapTlsPeap::UpdatePacStoreCleanupTableL: AddACleanupReferenceEntryL returns"))); |
1427 |
1389 |
1428 pacStoreDb->Close(); |
1390 //pacStoreDb->Close(); |
1429 |
1391 |
1430 EAP_TRACE_DEBUG_SYMBIAN( |
1392 EAP_TRACE_DEBUG_SYMBIAN( |
1431 (_L("CEapTlsPeap::UpdatePacStoreCleanupTableL: pacStoreDb Closed"))); |
1393 (_L("CEapTlsPeap::UpdatePacStoreCleanupTableL: pacStoreDb Closed"))); |
1432 |
1394 |
1433 delete pacStoreDb; |
1395 CleanupStack::PopAndDestroy(pacStoreDb); |
1434 |
1396 |
1435 EAP_TRACE_DEBUG_SYMBIAN( |
1397 EAP_TRACE_DEBUG_SYMBIAN( |
1436 (_L("CEapTlsPeap::UpdatePacStoreCleanupTableL: End"))); |
1398 (_L("CEapTlsPeap::UpdatePacStoreCleanupTableL: End"))); |
1437 |
1399 |
1438 } |
1400 } |
1439 |
1401 |
1440 #endif // #ifdef USE_PAC_STORE |
1402 #endif // #ifdef USE_PAC_STORE |
1441 |
1403 |
|
1404 //-------------------------------------------------- |
|
1405 |
|
1406 // |
|
1407 EAP_FUNC_EXPORT eap_status_e CEapTlsPeap::timer_expired( |
|
1408 const u32_t id, |
|
1409 void *data) |
|
1410 { |
|
1411 EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
1412 EAP_UNREFERENCED_PARAMETER(id); // in release |
|
1413 EAP_UNREFERENCED_PARAMETER(data); // in release |
|
1414 |
|
1415 eap_status_e status = eap_status_ok; |
|
1416 |
|
1417 EAP_TRACE_DEBUG(m_am_tools, TRACE_FLAGS_DEFAULT, (EAPL("TIMER: [0x%08x]->CEapTlsPeap::timer_expired(id 0x%02x, data 0x%08x).\n"), |
|
1418 this, id, data)); |
|
1419 |
|
1420 #if defined(USE_FAST_EAP_TYPE) |
|
1421 |
|
1422 if(id == KRemovePacStoreInitializationTimerID) |
|
1423 { |
|
1424 delete iPacStoreInitialization; |
|
1425 iPacStoreInitialization = 0; |
|
1426 iInitializer = 0; |
|
1427 } |
|
1428 |
|
1429 #endif // #if defined(USE_FAST_EAP_TYPE) |
|
1430 |
|
1431 return EAP_STATUS_RETURN(m_am_tools, status); |
|
1432 |
|
1433 } |
|
1434 |
|
1435 //-------------------------------------------------- |
|
1436 |
|
1437 // |
|
1438 EAP_FUNC_EXPORT eap_status_e CEapTlsPeap::timer_delete_data( |
|
1439 const u32_t id, |
|
1440 void *data) |
|
1441 { |
|
1442 EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
1443 EAP_UNREFERENCED_PARAMETER(id); // in release |
|
1444 EAP_UNREFERENCED_PARAMETER(data); // in release |
|
1445 |
|
1446 eap_status_e status = eap_status_ok; |
|
1447 |
|
1448 EAP_TRACE_DEBUG(m_am_tools, TRACE_FLAGS_DEFAULT, (EAPL("TIMER: [0x%08x]->CEapTlsPeap::timer_delete_data(id 0x%02x, data 0x%08x).\n"), |
|
1449 this, id, data)); |
|
1450 |
|
1451 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
1452 return EAP_STATUS_RETURN(m_am_tools, status); |
|
1453 } |
|
1454 |
1442 // ---------------------------------------------------------- |
1455 // ---------------------------------------------------------- |
1443 // End of file |
1456 // End of file |
1444 |
1457 |