26
|
1 |
/*
|
|
2 |
* Copyright (c) 2001-2010 Nokia Corporation and/or its subsidiary(-ies).
|
|
3 |
* All rights reserved.
|
|
4 |
* This component and the accompanying materials are made available
|
|
5 |
* under the terms of the License "Eclipse Public License v1.0"
|
|
6 |
* which accompanies this distribution, and is available
|
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
|
8 |
*
|
|
9 |
* Initial Contributors:
|
|
10 |
* Nokia Corporation - initial contribution.
|
|
11 |
*
|
|
12 |
* Contributors:
|
|
13 |
*
|
|
14 |
* Description: EAP and WLAN authentication protocols.
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
/*
|
|
19 |
* %version: 48 %
|
|
20 |
*/
|
|
21 |
|
|
22 |
#include "eap_am_stack_symbian.h"
|
|
23 |
#include "eap_array_algorithms.h"
|
|
24 |
#include "eap_base_type.h"
|
|
25 |
#include "eap_header_string.h"
|
|
26 |
#include "EapConversion.h"
|
|
27 |
#include "eapol_key_state_string.h"
|
|
28 |
#include "eap_type_tls_peap_types.h"
|
|
29 |
#include "EapPluginDbDefaults.h"
|
|
30 |
#include "EapConfigToolsSymbian.h"
|
|
31 |
#include "eap_am_general_settings_symbian.h"
|
|
32 |
|
|
33 |
class CEapTypePlugin;
|
|
34 |
|
|
35 |
// LOCAL CONSTANTS
|
|
36 |
const TUint KMaxSqlQueryLength = 2048;
|
|
37 |
|
|
38 |
const TUint KExpandedEAPSize = 8;
|
|
39 |
|
|
40 |
//--------------------------------------------------
|
|
41 |
|
|
42 |
EAP_FUNC_EXPORT eap_am_stack_symbian_c::eap_am_stack_symbian_c(class abs_eap_am_tools_c * tools, bool is_client_when_true)
|
|
43 |
: CActive(0)
|
|
44 |
, iTools (tools)
|
|
45 |
, iIsClient(is_client_when_true)
|
|
46 |
, iPartner(0)
|
|
47 |
, m_client_config(tools)
|
|
48 |
, iFileconfig(0)
|
|
49 |
, iEnabledEapMethodsArray(tools)
|
|
50 |
, iDisabledEapMethodsArray(tools)
|
|
51 |
, m_eap_type_array(tools)
|
|
52 |
, iConfigurationIf(0)
|
|
53 |
, iIndexType(ELan)
|
|
54 |
, iIndex(0UL)
|
|
55 |
, iCurrentEapIndex(0)
|
|
56 |
, m_selected_eapol_key_authentication_type(eapol_key_authentication_type_none)
|
|
57 |
{
|
|
58 |
EAP_TRACE_DEBUG(
|
|
59 |
tools,
|
|
60 |
TRACE_FLAGS_DEFAULT,
|
|
61 |
(EAPL("eap_am_stack_symbian_c::eap_am_stack_symbian_c()\n")));
|
|
62 |
|
|
63 |
EAP_TRACE_RETURN_STRING(tools, "returns: eap_am_stack_symbian_c::eap_am_stack_symbian_c()");
|
|
64 |
|
|
65 |
iIsValid = ETrue;
|
|
66 |
|
|
67 |
return;
|
|
68 |
}
|
|
69 |
|
|
70 |
//--------------------------------------------------
|
|
71 |
|
|
72 |
EAP_FUNC_EXPORT eap_am_stack_symbian_c::~eap_am_stack_symbian_c()
|
|
73 |
{
|
|
74 |
EAP_TRACE_DEBUG(
|
|
75 |
iTools,
|
|
76 |
TRACE_FLAGS_DEFAULT,
|
|
77 |
(EAPL("eap_am_stack_symbian_c::~eap_am_stack_symbian_c()\n")));
|
|
78 |
|
|
79 |
Cancel();
|
|
80 |
|
|
81 |
EAP_TRACE_RETURN_STRING(iTools, "returns: eap_am_stack_symbian_c::~eap_am_stack_symbian_c()");
|
|
82 |
}
|
|
83 |
|
|
84 |
//--------------------------------------------------
|
|
85 |
|
|
86 |
EAP_FUNC_EXPORT bool eap_am_stack_symbian_c::get_is_valid()
|
|
87 |
{
|
|
88 |
return iIsValid;
|
|
89 |
}
|
|
90 |
|
|
91 |
//--------------------------------------------------
|
|
92 |
|
|
93 |
EAP_FUNC_EXPORT eap_status_e eap_am_stack_symbian_c::set_partner(abs_eap_am_stack_c * partner, abs_eap_configuration_if_c * configuration_if)
|
|
94 |
{
|
|
95 |
eap_status_e aStatus(eap_status_ok);
|
|
96 |
iPartner = partner;
|
|
97 |
iConfigurationIf = configuration_if;
|
|
98 |
return aStatus;
|
|
99 |
}
|
|
100 |
|
|
101 |
//--------------------------------------------------
|
|
102 |
|
|
103 |
eap_status_e eap_am_stack_symbian_c::reset_eap_configuration()
|
|
104 |
{
|
|
105 |
EAP_TRACE_BEGIN(iTools, TRACE_FLAGS_DEFAULT);
|
|
106 |
|
|
107 |
EAP_TRACE_DEBUG(
|
|
108 |
iTools,
|
|
109 |
TRACE_FLAGS_DEFAULT,
|
|
110 |
(EAPL("eap_am_stack_symbian_c::reset_eap_configuration(): %s, this = 0x%08x\n"),
|
|
111 |
(iIsClient == true) ? "client": "server",
|
|
112 |
this));
|
|
113 |
|
|
114 |
EAP_TRACE_RETURN_STRING(iTools, "returns: eap_am_stack_symbian_c::reset_eap_configuration()");
|
|
115 |
|
|
116 |
eap_status_e status(eap_status_ok);
|
|
117 |
|
|
118 |
TRAPD(error, ReadEAPSettingsL());
|
|
119 |
if (error != KErrNone)
|
|
120 |
{
|
|
121 |
EAP_TRACE_ERROR(
|
|
122 |
iTools,
|
|
123 |
TRACE_FLAGS_DEFAULT,
|
|
124 |
(EAPL("EAP settings reading from CommDb failed or cancelled(error %d).\n"), error));
|
|
125 |
|
|
126 |
status = iTools->convert_am_error_to_eapol_error(error);
|
|
127 |
}
|
|
128 |
|
|
129 |
EAP_TRACE_END(iTools, TRACE_FLAGS_DEFAULT);
|
|
130 |
return EAP_STATUS_RETURN(iTools, status);
|
|
131 |
}
|
|
132 |
|
|
133 |
//--------------------------------------------------
|
|
134 |
|
|
135 |
// This is documented in abs_eap_stack_interface_c::configure().
|
|
136 |
EAP_FUNC_EXPORT eap_status_e eap_am_stack_symbian_c::configure(
|
|
137 |
const eap_variable_data_c * const client_configuration)
|
|
138 |
{
|
|
139 |
EAP_TRACE_BEGIN(iTools, TRACE_FLAGS_DEFAULT);
|
|
140 |
|
|
141 |
EAP_TRACE_DEBUG(
|
|
142 |
iTools,
|
|
143 |
TRACE_FLAGS_DEFAULT,
|
|
144 |
(EAPL("eap_am_stack_symbian_c::configure(): %s, this = 0x%08x => 0x%08x\n"),
|
|
145 |
(iIsClient == true) ? "client": "server",
|
|
146 |
this,
|
|
147 |
dynamic_cast<abs_eap_base_timer_c *>(this)));
|
|
148 |
|
|
149 |
EAP_TRACE_RETURN_STRING(iTools, "returns: eap_am_stack_symbian_c::configure()");
|
|
150 |
|
|
151 |
TInt error(KErrNone);
|
|
152 |
eap_status_e status(eap_status_ok);
|
|
153 |
|
|
154 |
// - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
155 |
|
|
156 |
if (client_configuration != 0
|
|
157 |
&& client_configuration->get_is_valid_data() == true)
|
|
158 |
{
|
|
159 |
status = m_client_config.read_configuration_message(client_configuration);
|
|
160 |
if (status != eap_status_ok)
|
|
161 |
{
|
|
162 |
EAP_TRACE_END(iTools, TRACE_FLAGS_DEFAULT);
|
|
163 |
return EAP_STATUS_RETURN(iTools, status);
|
|
164 |
}
|
|
165 |
}
|
|
166 |
|
|
167 |
// - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
168 |
|
|
169 |
// Open the database session
|
|
170 |
error = iSession.Connect();
|
|
171 |
if (error != KErrNone)
|
|
172 |
{
|
|
173 |
status = EAP_STATUS_RETURN(iTools, iTools->convert_am_error_to_eapol_error(error));
|
|
174 |
|
|
175 |
EAP_TRACE_DEBUG(
|
|
176 |
iTools,
|
|
177 |
TRACE_FLAGS_DEFAULT,
|
|
178 |
(EAPL("RDbs::Connect() failed %d.\n"),
|
|
179 |
status));
|
|
180 |
EAP_TRACE_END(iTools, TRACE_FLAGS_DEFAULT);
|
|
181 |
return EAP_STATUS_RETURN(iTools, status);
|
|
182 |
}
|
|
183 |
|
|
184 |
EAP_TRACE_DEBUG(
|
|
185 |
iTools,
|
|
186 |
TRACE_FLAGS_DEFAULT,
|
|
187 |
(EAPL("Database session initialized...\n")));
|
|
188 |
|
|
189 |
// Connect to FS
|
|
190 |
error = iFs.Connect();
|
|
191 |
if (error != KErrNone)
|
|
192 |
{
|
|
193 |
status = EAP_STATUS_RETURN(iTools, iTools->convert_am_error_to_eapol_error(error));
|
|
194 |
|
|
195 |
EAP_TRACE_DEBUG(
|
|
196 |
iTools,
|
|
197 |
TRACE_FLAGS_DEFAULT,
|
|
198 |
(EAPL("RFs::Connect() failed %d.\n"),
|
|
199 |
status));
|
|
200 |
EAP_TRACE_END(iTools, TRACE_FLAGS_DEFAULT);
|
|
201 |
return EAP_STATUS_RETURN(iTools, status);
|
|
202 |
}
|
|
203 |
|
|
204 |
EAP_TRACE_DEBUG(
|
|
205 |
iTools,
|
|
206 |
TRACE_FLAGS_DEFAULT,
|
|
207 |
(EAPL("Fileserver session initialized...\n")));
|
|
208 |
|
|
209 |
// - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
210 |
|
|
211 |
status = EapConfigToolsSymbian::EapReadDefaultConfigFileSymbian(
|
|
212 |
iTools,
|
|
213 |
&iFileconfig);
|
|
214 |
if (status != eap_status_ok)
|
|
215 |
{
|
|
216 |
EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
|
|
217 |
return EAP_STATUS_RETURN(iTools, status);
|
|
218 |
}
|
|
219 |
|
|
220 |
// - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
221 |
|
|
222 |
#if defined(USE_EAP_FILE_TRACE)
|
|
223 |
{
|
|
224 |
eap_variable_data_c trace_output_file(iTools);
|
|
225 |
|
|
226 |
status = read_configure(
|
|
227 |
cf_str_EAP_TRACE_output_file_name.get_field(),
|
|
228 |
&trace_output_file);
|
|
229 |
if (status == eap_status_ok
|
|
230 |
&& trace_output_file.get_is_valid_data() == true)
|
|
231 |
{
|
|
232 |
status = iTools->set_trace_file_name(&trace_output_file);
|
|
233 |
if (status == eap_status_ok)
|
|
234 |
{
|
|
235 |
// OK, set the default trace mask.
|
|
236 |
iTools->set_trace_mask(
|
|
237 |
eap_am_tools_c::eap_trace_mask_debug
|
|
238 |
| eap_am_tools_c::eap_trace_mask_always
|
|
239 |
| eap_am_tools_c::eap_trace_mask_error
|
|
240 |
| eap_am_tools_c::eap_trace_mask_message_data);
|
|
241 |
}
|
|
242 |
}
|
|
243 |
}
|
|
244 |
#endif //#if defined(USE_EAP_FILE_TRACE)
|
|
245 |
|
|
246 |
|
|
247 |
// - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
248 |
|
|
249 |
{
|
|
250 |
eap_variable_data_c EAP_TRACE_enable_timer_traces(iTools);
|
|
251 |
|
|
252 |
status = read_configure(
|
|
253 |
cf_str_EAP_TRACE_enable_timer_traces.get_field(),
|
|
254 |
&EAP_TRACE_enable_timer_traces);
|
|
255 |
if (status == eap_status_ok
|
|
256 |
&& EAP_TRACE_enable_timer_traces.get_is_valid_data() == true)
|
|
257 |
{
|
|
258 |
u32_t *enable_timer_traces = reinterpret_cast<u32_t *>(
|
|
259 |
EAP_TRACE_enable_timer_traces.get_data(sizeof(u32_t)));
|
|
260 |
if (enable_timer_traces != 0
|
|
261 |
&& *enable_timer_traces != 0)
|
|
262 |
{
|
|
263 |
iTools->set_trace_mask(
|
|
264 |
iTools->get_trace_mask()
|
|
265 |
| TRACE_FLAGS_TIMER
|
|
266 |
);
|
|
267 |
}
|
|
268 |
}
|
|
269 |
}
|
|
270 |
|
|
271 |
// - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
272 |
|
|
273 |
{
|
|
274 |
eap_variable_data_c EAP_TRACE_enable_timer_queue_traces(iTools);
|
|
275 |
|
|
276 |
status = read_configure(
|
|
277 |
cf_str_EAP_TRACE_enable_timer_queue_traces.get_field(),
|
|
278 |
&EAP_TRACE_enable_timer_queue_traces);
|
|
279 |
if (status == eap_status_ok
|
|
280 |
&& EAP_TRACE_enable_timer_queue_traces.get_is_valid_data() == true)
|
|
281 |
{
|
|
282 |
u32_t *enable_timer_queue_traces = reinterpret_cast<u32_t *>(
|
|
283 |
EAP_TRACE_enable_timer_queue_traces.get_data(sizeof(u32_t)));
|
|
284 |
if (enable_timer_queue_traces != 0
|
|
285 |
&& *enable_timer_queue_traces != 0)
|
|
286 |
{
|
|
287 |
iTools->set_trace_mask(
|
|
288 |
iTools->get_trace_mask()
|
|
289 |
| TRACE_FLAGS_TIMER_QUEUE
|
|
290 |
);
|
|
291 |
}
|
|
292 |
}
|
|
293 |
}
|
|
294 |
|
|
295 |
{
|
|
296 |
eap_variable_data_c EAP_TRACE_enable_function_traces(iTools);
|
|
297 |
|
|
298 |
status = read_configure(
|
|
299 |
cf_str_EAP_TRACE_enable_function_traces.get_field(),
|
|
300 |
&EAP_TRACE_enable_function_traces);
|
|
301 |
if (status == eap_status_ok
|
|
302 |
&& EAP_TRACE_enable_function_traces.get_is_valid_data() == true)
|
|
303 |
{
|
|
304 |
u32_t *enable_function_traces = reinterpret_cast<u32_t *>(
|
|
305 |
EAP_TRACE_enable_function_traces.get_data(sizeof(u32_t)));
|
|
306 |
if (enable_function_traces != 0
|
|
307 |
&& *enable_function_traces != 0)
|
|
308 |
{
|
|
309 |
iTools->set_trace_mask(
|
|
310 |
iTools->get_trace_mask()
|
|
311 |
| eap_am_tools_c::eap_trace_mask_functions
|
|
312 |
);
|
|
313 |
}
|
|
314 |
}
|
|
315 |
}
|
|
316 |
|
|
317 |
// - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
318 |
|
|
319 |
EAP_TRACE_DEBUG(
|
|
320 |
iTools,
|
|
321 |
TRACE_FLAGS_DEFAULT,
|
|
322 |
(EAPL("Created timer...\n")));
|
|
323 |
|
|
324 |
EAP_TRACE_END(iTools, TRACE_FLAGS_DEFAULT);
|
|
325 |
return EAP_STATUS_RETURN(iTools, eap_status_ok);
|
|
326 |
|
|
327 |
}
|
|
328 |
|
|
329 |
//--------------------------------------------------
|
|
330 |
|
|
331 |
eap_status_e eap_am_stack_symbian_c::reset_eap_plugins()
|
|
332 |
{
|
|
333 |
EAP_TRACE_BEGIN(iTools, TRACE_FLAGS_DEFAULT);
|
|
334 |
|
|
335 |
EAP_TRACE_DEBUG(
|
|
336 |
iTools,
|
|
337 |
TRACE_FLAGS_DEFAULT,
|
|
338 |
(EAPL("eap_am_stack_symbian_c::reset_eap_plugins(): %s, this = 0x%08x => 0x%08x\n"),
|
|
339 |
(iIsClient == true) ? "client": "server",
|
|
340 |
this,
|
|
341 |
dynamic_cast<abs_eap_base_timer_c *>(this)));
|
|
342 |
|
|
343 |
// Unload all loaded plugins
|
|
344 |
for(int ind = 0; ind < m_plugin_if_array.Count(); ind++)
|
|
345 |
{
|
|
346 |
delete m_plugin_if_array[ind];
|
|
347 |
}
|
|
348 |
|
|
349 |
m_plugin_if_array.Close();
|
|
350 |
|
|
351 |
|
|
352 |
iEnabledEapMethodsArray.reset();
|
|
353 |
iDisabledEapMethodsArray.reset();
|
|
354 |
|
|
355 |
|
|
356 |
m_eap_type_array.reset();
|
|
357 |
|
|
358 |
EAP_TRACE_END(iTools, TRACE_FLAGS_DEFAULT);
|
|
359 |
return EAP_STATUS_RETURN(iTools, eap_status_ok);
|
|
360 |
}
|
|
361 |
|
|
362 |
//--------------------------------------------------
|
|
363 |
|
|
364 |
// This is documented in abs_eap_stack_interface_c::shutdown().
|
|
365 |
EAP_FUNC_EXPORT eap_status_e eap_am_stack_symbian_c::shutdown()
|
|
366 |
{
|
|
367 |
EAP_TRACE_BEGIN(iTools, TRACE_FLAGS_DEFAULT);
|
|
368 |
|
|
369 |
EAP_TRACE_ALWAYS(
|
|
370 |
iTools,
|
|
371 |
TRACE_FLAGS_DEFAULT,
|
|
372 |
(EAPL("eap_am_stack_symbian_c::shutdown(): %s, this = 0x%08x => 0x%08x\n"),
|
|
373 |
(iIsClient == true) ? "client": "server",
|
|
374 |
this,
|
|
375 |
dynamic_cast<abs_eap_base_timer_c *>(this)));
|
|
376 |
|
|
377 |
delete iFileconfig;
|
|
378 |
iFileconfig = 0;
|
|
379 |
|
|
380 |
(void) reset_eap_plugins();
|
|
381 |
|
|
382 |
EAP_TRACE_END(iTools, TRACE_FLAGS_DEFAULT);
|
|
383 |
return EAP_STATUS_RETURN(iTools, eap_status_ok);
|
|
384 |
}
|
|
385 |
|
|
386 |
//--------------------------------------------------
|
|
387 |
|
|
388 |
EAP_FUNC_EXPORT eap_status_e eap_am_stack_symbian_c::read_configure(
|
|
389 |
const eap_configuration_field_c * const field,
|
|
390 |
eap_variable_data_c * const data)
|
|
391 |
{
|
|
392 |
EAP_TRACE_BEGIN(iTools, TRACE_FLAGS_DEFAULT);
|
|
393 |
EAP_ASSERT_ALWAYS_TOOLS(iTools, data != NULL);
|
|
394 |
|
|
395 |
EAP_TRACE_DEBUG(
|
|
396 |
iTools,
|
|
397 |
TRACE_FLAGS_DEFAULT,
|
|
398 |
(EAPL("eap_am_stack_symbian_c::read_configure(): %s, %d=%s, this = 0x%08x => 0x%08x\n"),
|
|
399 |
(iIsClient == true) ? "client": "server",
|
|
400 |
m_selected_eapol_key_authentication_type,
|
|
401 |
eapol_key_state_string_c::get_eapol_key_authentication_type_string(m_selected_eapol_key_authentication_type),
|
|
402 |
this,
|
|
403 |
dynamic_cast<abs_eap_base_timer_c *>(this)));
|
|
404 |
|
|
405 |
EAP_TRACE_DATA_DEBUG(
|
|
406 |
iTools,
|
|
407 |
TRACE_FLAGS_DEFAULT,
|
|
408 |
(EAPL("eap_am_stack_symbian_c::read_configure()"),
|
|
409 |
field->get_field(),
|
|
410 |
field->get_field_length()));
|
|
411 |
|
|
412 |
EAP_TRACE_RETURN_STRING(iTools, "returns: eap_am_stack_symbian_c::read_configure()");
|
|
413 |
|
|
414 |
// Trap must be set here because the OS independent portion of EAPOL
|
|
415 |
// that calls this function does not know anything about Symbian.
|
|
416 |
eap_status_e status(eap_status_ok);
|
|
417 |
|
|
418 |
// Check if the wanted parameter is default type
|
|
419 |
if (field->compare(iTools, cf_str_EAP_default_type_hex_data.get_field()) == true)
|
|
420 |
{
|
|
421 |
// First check do we have read configuration from databases.
|
|
422 |
if (m_selected_eapol_key_authentication_type == eapol_key_authentication_type_WPS)
|
|
423 |
{
|
|
424 |
EAP_TRACE_DEBUG(
|
|
425 |
iTools,
|
|
426 |
TRACE_FLAGS_DEFAULT,
|
|
427 |
(EAPL("m_selected_eapol_key_authentication_type = eapol_key_authentication_type_WPS\n")));
|
|
428 |
|
|
429 |
status = eap_expanded_type_simple_config.get_type().get_expanded_type_data(
|
|
430 |
iTools,
|
|
431 |
data);
|
|
432 |
|
|
433 |
if (status == eap_status_ok)
|
|
434 |
{
|
|
435 |
set_current_eap_index(0);
|
|
436 |
}
|
|
437 |
|
|
438 |
EAP_TRACE_END(iTools, TRACE_FLAGS_DEFAULT);
|
|
439 |
return EAP_STATUS_RETURN(iTools, status);
|
|
440 |
}
|
|
441 |
else if (iEnabledEapMethodsArray.get_object_count() == 0ul)
|
|
442 |
{
|
|
443 |
EAP_TRACE_ERROR(
|
|
444 |
iTools,
|
|
445 |
TRACE_FLAGS_DEFAULT,
|
|
446 |
(EAPL("EAP settings not read from CommsDat\n")));
|
|
447 |
|
|
448 |
EAP_TRACE_END(iTools, TRACE_FLAGS_DEFAULT);
|
|
449 |
return EAP_STATUS_RETURN(iTools, eap_status_process_general_error);
|
|
450 |
}
|
|
451 |
|
|
452 |
// Now we need to return here the next EAP type we should try
|
|
453 |
|
|
454 |
TInt ind = get_current_eap_index();
|
|
455 |
|
|
456 |
|
|
457 |
if (get_current_eap_index() < iEnabledEapMethodsArray.get_object_count())
|
|
458 |
{
|
|
459 |
eap_type_value_e * const next_eap_method = iEnabledEapMethodsArray.get_object(get_current_eap_index());
|
|
460 |
if (next_eap_method != 0
|
|
461 |
&& next_eap_method->get_is_valid() == true)
|
|
462 |
{
|
|
463 |
status = data->set_buffer_length(eap_expanded_type_c::get_eap_expanded_type_size());
|
|
464 |
if (status != eap_status_ok)
|
|
465 |
{
|
|
466 |
EAP_TRACE_END(iTools, TRACE_FLAGS_DEFAULT);
|
|
467 |
return EAP_STATUS_RETURN(iTools, eap_status_allocation_error);
|
|
468 |
}
|
|
469 |
|
|
470 |
status = data->set_data_length(eap_expanded_type_c::get_eap_expanded_type_size());
|
|
471 |
if (status != eap_status_ok)
|
|
472 |
{
|
|
473 |
EAP_TRACE_END(iTools, TRACE_FLAGS_DEFAULT);
|
|
474 |
return EAP_STATUS_RETURN(iTools, status);
|
|
475 |
}
|
|
476 |
|
|
477 |
status = eap_expanded_type_c::write_type(
|
|
478 |
iTools,
|
|
479 |
0ul,
|
|
480 |
data->get_data(),
|
|
481 |
data->get_data_length(),
|
|
482 |
true,
|
|
483 |
*next_eap_method);
|
|
484 |
if (status != eap_status_ok)
|
|
485 |
{
|
|
486 |
EAP_TRACE_END(iTools, TRACE_FLAGS_DEFAULT);
|
|
487 |
return EAP_STATUS_RETURN(iTools, status);
|
|
488 |
}
|
|
489 |
}
|
|
490 |
}
|
|
491 |
|
|
492 |
|
|
493 |
|
|
494 |
if (ind >= iEnabledEapMethodsArray.get_object_count())
|
|
495 |
{
|
|
496 |
// Not found any other EAP type as enabled.
|
|
497 |
// Send WLM notification because there is no way that the authentication
|
|
498 |
// can be successful if we don't have any EAP types to use...
|
|
499 |
if (iIsClient)
|
|
500 |
{
|
|
501 |
EAP_TRACE_ERROR(
|
|
502 |
iTools,
|
|
503 |
TRACE_FLAGS_DEFAULT,
|
|
504 |
(EAPL("ERROR: read_configure: No configured EAP types or all tried unsuccessfully.\n")));
|
|
505 |
}
|
|
506 |
|
|
507 |
EAP_TRACE_END(iTools, TRACE_FLAGS_DEFAULT);
|
|
508 |
return EAP_STATUS_RETURN(iTools, eap_status_illegal_configure_field);
|
|
509 |
}
|
|
510 |
|
|
511 |
EAP_TRACE_END(iTools, TRACE_FLAGS_DEFAULT);
|
|
512 |
return EAP_STATUS_RETURN(iTools, status);
|
|
513 |
|
|
514 |
} // if ()
|
|
515 |
|
|
516 |
|
|
517 |
#if defined(USE_EAP_FILECONFIG)
|
|
518 |
{
|
|
519 |
status = m_client_config.read_configure(field, data);
|
|
520 |
if (status != eap_status_ok)
|
|
521 |
{
|
|
522 |
if (iFileconfig != 0
|
|
523 |
&& iFileconfig->get_is_valid() == true)
|
|
524 |
{
|
|
525 |
// Here we could try the final configuration option.
|
|
526 |
status = iFileconfig->read_configure(
|
|
527 |
field,
|
|
528 |
data);
|
|
529 |
}
|
|
530 |
}
|
|
531 |
}
|
|
532 |
#endif //#if defined(USE_EAP_FILECONFIG)
|
|
533 |
|
|
534 |
|
|
535 |
iTools->trace_configuration(
|
|
536 |
status,
|
|
537 |
field,
|
|
538 |
data);
|
|
539 |
|
|
540 |
EAP_TRACE_END(iTools, TRACE_FLAGS_DEFAULT);
|
|
541 |
return EAP_STATUS_RETURN(iTools, status);
|
|
542 |
}
|
|
543 |
|
|
544 |
//--------------------------------------------------
|
|
545 |
|
|
546 |
EAP_FUNC_EXPORT eap_status_e eap_am_stack_symbian_c::set_timer(
|
|
547 |
abs_eap_base_timer_c * const p_initializer,
|
|
548 |
const u32_t p_id,
|
|
549 |
void * const p_data,
|
|
550 |
const u32_t p_time_ms)
|
|
551 |
{
|
|
552 |
EAP_TRACE_BEGIN(iTools, TRACE_FLAGS_DEFAULT);
|
|
553 |
|
|
554 |
const eap_status_e status = iTools->am_set_timer(
|
|
555 |
p_initializer,
|
|
556 |
p_id,
|
|
557 |
p_data,
|
|
558 |
p_time_ms);
|
|
559 |
|
|
560 |
EAP_TRACE_END(iTools, TRACE_FLAGS_DEFAULT);
|
|
561 |
return EAP_STATUS_RETURN(iTools, status);
|
|
562 |
}
|
|
563 |
|
|
564 |
//--------------------------------------------------
|
|
565 |
|
|
566 |
EAP_FUNC_EXPORT eap_status_e eap_am_stack_symbian_c::cancel_timer(
|
|
567 |
abs_eap_base_timer_c * const p_initializer,
|
|
568 |
const u32_t p_id)
|
|
569 |
{
|
|
570 |
EAP_TRACE_BEGIN(iTools, TRACE_FLAGS_DEFAULT);
|
|
571 |
|
|
572 |
const eap_status_e status = iTools->am_cancel_timer(
|
|
573 |
p_initializer,
|
|
574 |
p_id);
|
|
575 |
|
|
576 |
EAP_TRACE_END(iTools, TRACE_FLAGS_DEFAULT);
|
|
577 |
return EAP_STATUS_RETURN(iTools, status);
|
|
578 |
}
|
|
579 |
|
|
580 |
//--------------------------------------------------
|
|
581 |
|
|
582 |
EAP_FUNC_EXPORT eap_status_e eap_am_stack_symbian_c::check_is_valid_eap_type(
|
|
583 |
const eap_type_value_e eap_type)
|
|
584 |
{
|
|
585 |
EAP_TRACE_BEGIN(iTools, TRACE_FLAGS_DEFAULT);
|
|
586 |
|
|
587 |
EAP_TRACE_DEBUG(
|
|
588 |
iTools,
|
|
589 |
TRACE_FLAGS_DEFAULT,
|
|
590 |
(EAPL("eap_am_stack_symbian_c::check_is_valid_eap_type(): %s, %d=%s, this = 0x%08x => 0x%08x, EAP-type=0xfe%06x%08x=%s\n"),
|
|
591 |
(iIsClient == true) ? "client": "server",
|
|
592 |
m_selected_eapol_key_authentication_type,
|
|
593 |
eapol_key_state_string_c::get_eapol_key_authentication_type_string(m_selected_eapol_key_authentication_type),
|
|
594 |
this,
|
|
595 |
dynamic_cast<abs_eap_base_timer_c *>(this),
|
|
596 |
eap_type.get_vendor_id(),
|
|
597 |
eap_type.get_vendor_type(),
|
|
598 |
eap_header_string_c::get_eap_type_string(eap_type)));
|
|
599 |
|
|
600 |
EAP_TRACE_RETURN_STRING(iTools, "returns: eap_am_stack_symbian_c::check_is_valid_eap_type()");
|
|
601 |
|
|
602 |
if (m_selected_eapol_key_authentication_type == eapol_key_authentication_type_WPS
|
|
603 |
&& eap_type == eap_expanded_type_simple_config.get_type())
|
|
604 |
{
|
|
605 |
EAP_TRACE_DEBUG(
|
|
606 |
iTools,
|
|
607 |
TRACE_FLAGS_DEFAULT, (EAPL("eap_am_stack_symbian_c::check_is_valid_eap_type(): WPS does not use CommDbIf anymore.\n")));
|
|
608 |
|
|
609 |
return EAP_STATUS_RETURN(iTools, eap_status_ok);
|
|
610 |
}
|
|
611 |
|
|
612 |
|
|
613 |
for (int ind = 0; ind < iEnabledEapMethodsArray.get_object_count(); ++ind)
|
|
614 |
{
|
|
615 |
const eap_type_value_e * const allowed_eap_method = iEnabledEapMethodsArray.get_object(ind);
|
|
616 |
|
|
617 |
if (allowed_eap_method != 0
|
|
618 |
&& eap_type == *allowed_eap_method)
|
|
619 |
{
|
|
620 |
// This is Allowed and Valid.
|
|
621 |
EAP_TRACE_END(iTools, TRACE_FLAGS_DEFAULT);
|
|
622 |
return EAP_STATUS_RETURN(iTools, eap_status_ok);
|
|
623 |
}
|
|
624 |
} // for()
|
|
625 |
|
|
626 |
|
|
627 |
EAP_TRACE_DEBUG(
|
|
628 |
iTools,
|
|
629 |
TRACE_FLAGS_DEFAULT,
|
|
630 |
(EAPL("ERROR: %s: check_is_valid_eap_type(): not supported EAP-type=0xfe%06x%08x=%s\n"),
|
|
631 |
(iIsClient == true ? "client": "server"),
|
|
632 |
eap_type.get_vendor_id(),
|
|
633 |
eap_type.get_vendor_type(),
|
|
634 |
eap_header_string_c::get_eap_type_string(eap_type)));
|
|
635 |
|
|
636 |
|
|
637 |
EAP_TRACE_END(iTools, TRACE_FLAGS_DEFAULT);
|
|
638 |
return EAP_STATUS_RETURN(iTools, eap_status_illegal_eap_type);
|
|
639 |
}
|
|
640 |
|
|
641 |
//--------------------------------------------------
|
|
642 |
|
|
643 |
EAP_FUNC_EXPORT eap_status_e eap_am_stack_symbian_c::get_eap_type_list(
|
|
644 |
eap_array_c<eap_type_value_e> * const eap_type_list)
|
|
645 |
{
|
|
646 |
EAP_TRACE_BEGIN(iTools, TRACE_FLAGS_DEFAULT);
|
|
647 |
|
|
648 |
EAP_TRACE_DEBUG(
|
|
649 |
iTools,
|
|
650 |
TRACE_FLAGS_DEFAULT,
|
|
651 |
(EAPL("eap_am_stack_symbian_c::get_eap_type_list(): %s, %d=%s, this = 0x%08x => 0x%08x\n"),
|
|
652 |
(iIsClient == true) ? "client": "server",
|
|
653 |
m_selected_eapol_key_authentication_type,
|
|
654 |
eapol_key_state_string_c::get_eapol_key_authentication_type_string(m_selected_eapol_key_authentication_type),
|
|
655 |
this,
|
|
656 |
dynamic_cast<abs_eap_base_timer_c *>(this)));
|
|
657 |
|
|
658 |
EAP_TRACE_RETURN_STRING(iTools, "returns: eap_am_stack_symbian_c::get_eap_type_list()");
|
|
659 |
|
|
660 |
eap_status_e status(eap_status_illegal_eap_type);
|
|
661 |
|
|
662 |
status = eap_type_list->reset();
|
|
663 |
if (status != eap_status_ok)
|
|
664 |
{
|
|
665 |
EAP_TRACE_END(iTools, TRACE_FLAGS_DEFAULT);
|
|
666 |
return EAP_STATUS_RETURN(iTools, status);
|
|
667 |
}
|
|
668 |
|
|
669 |
if (m_selected_eapol_key_authentication_type == eapol_key_authentication_type_WPS)
|
|
670 |
{
|
|
671 |
EAP_TRACE_DEBUG(
|
|
672 |
iTools,
|
|
673 |
TRACE_FLAGS_DEFAULT, (EAPL("eap_am_stack_symbian_c::get_eap_type_list(): WPS does not use CommDbIf anymore.\n")));
|
|
674 |
|
|
675 |
// This is for one expanded EAP type (for the above one).
|
|
676 |
eap_expanded_type_c * expandedEAPType = new eap_type_value_e(eap_expanded_type_simple_config.get_type());
|
|
677 |
|
|
678 |
// Add WPS EAP-type to list.
|
|
679 |
status = eap_type_list->add_object(expandedEAPType, true);
|
|
680 |
if (status != eap_status_ok)
|
|
681 |
{
|
|
682 |
EAP_TRACE_END(iTools, TRACE_FLAGS_DEFAULT);
|
|
683 |
return EAP_STATUS_RETURN(iTools, status);
|
|
684 |
}
|
|
685 |
|
|
686 |
return EAP_STATUS_RETURN(iTools, eap_status_ok);
|
|
687 |
}
|
|
688 |
|
|
689 |
// This function is same as get_selected_eap_types in behavior.
|
|
690 |
|
|
691 |
// We need to return only the EAP types available as enabled types.
|
|
692 |
// It means only the ones available in m_enabled_expanded_eap_array.
|
|
693 |
|
|
694 |
|
|
695 |
for (TInt ind = 0; ind < iEnabledEapMethodsArray.get_object_count(); ++ind)
|
|
696 |
{
|
|
697 |
const eap_type_value_e * const allowed_eap_method = iEnabledEapMethodsArray.get_object(ind);
|
|
698 |
|
|
699 |
if (allowed_eap_method != 0
|
|
700 |
&& allowed_eap_method->get_is_valid() == true)
|
|
701 |
{
|
|
702 |
EAP_TRACE_DEBUG(
|
|
703 |
iTools,
|
|
704 |
TRACE_FLAGS_DEFAULT,
|
|
705 |
(EAPL("eap_am_stack_symbian_c::ReadEAPSettingsL(): Enabled expanded EAP type at index=%d, EAP-type=0xfe%06x%08x\n"),
|
|
706 |
ind,
|
|
707 |
allowed_eap_method->get_vendor_id(),
|
|
708 |
allowed_eap_method->get_vendor_type()));
|
|
709 |
|
|
710 |
status = eap_type_list->add_object(allowed_eap_method->copy(), true);
|
|
711 |
if (status != eap_status_ok)
|
|
712 |
{
|
|
713 |
EAP_TRACE_END(iTools, TRACE_FLAGS_DEFAULT);
|
|
714 |
return EAP_STATUS_RETURN(iTools, status);
|
|
715 |
}
|
|
716 |
}
|
|
717 |
} // for()
|
|
718 |
|
|
719 |
|
|
720 |
EAP_TRACE_END(iTools, TRACE_FLAGS_DEFAULT);
|
|
721 |
return EAP_STATUS_RETURN(iTools, status);
|
|
722 |
}
|
|
723 |
|
|
724 |
//--------------------------------------------------
|
|
725 |
|
|
726 |
EAP_FUNC_EXPORT eap_status_e eap_am_stack_symbian_c::load_module(
|
|
727 |
const eap_type_value_e type,
|
|
728 |
const eap_type_value_e tunneling_type,
|
|
729 |
abs_eap_base_type_c * const partner,
|
|
730 |
eap_base_type_c ** const eap_type,
|
|
731 |
const bool is_client_when_true,
|
|
732 |
const eap_am_network_id_c * const receive_network_id)
|
|
733 |
{
|
|
734 |
EAP_TRACE_BEGIN(iTools, TRACE_FLAGS_DEFAULT);
|
|
735 |
|
|
736 |
EAP_TRACE_DEBUG(
|
|
737 |
iTools,
|
|
738 |
TRACE_FLAGS_DEFAULT,
|
|
739 |
(EAPL("eap_am_stack_symbian_c::load_module(type %d=%s, tunneling_type %d=%s)\n"),
|
|
740 |
convert_eap_type_to_u32_t(type),
|
|
741 |
eap_header_string_c::get_eap_type_string(type),
|
|
742 |
convert_eap_type_to_u32_t(tunneling_type),
|
|
743 |
eap_header_string_c::get_eap_type_string(tunneling_type)));
|
|
744 |
|
|
745 |
EAP_TRACE_RETURN_STRING(iTools, "returns: eap_am_stack_symbian_c::load_module()");
|
|
746 |
|
|
747 |
eap_status_e status(eap_status_process_general_error);
|
|
748 |
|
|
749 |
CEapTypePlugin* eapType = 0;
|
|
750 |
TInt error(KErrNone);
|
|
751 |
|
|
752 |
// Check if this EAP type has already been loaded
|
|
753 |
TInt eapArrayIndex = find<eap_type_value_e>(
|
|
754 |
&m_eap_type_array,
|
|
755 |
&type,
|
|
756 |
iTools);
|
|
757 |
|
|
758 |
if (eapArrayIndex >= 0)
|
|
759 |
{
|
|
760 |
// We found the entry in the array.
|
|
761 |
EAP_TRACE_DEBUG(
|
|
762 |
iTools,
|
|
763 |
TRACE_FLAGS_DEFAULT,
|
|
764 |
(EAPL("eap_am_stack_symbian_c::load_module(type %d=%s, tunneling_type %d=%s) already loaded.\n"),
|
|
765 |
convert_eap_type_to_u32_t(type),
|
|
766 |
eap_header_string_c::get_eap_type_string(type),
|
|
767 |
convert_eap_type_to_u32_t(tunneling_type),
|
|
768 |
eap_header_string_c::get_eap_type_string(tunneling_type)));
|
|
769 |
|
|
770 |
// Yep. It was loaded already.
|
|
771 |
eapType = m_plugin_if_array[eapArrayIndex];
|
|
772 |
}
|
|
773 |
else
|
|
774 |
{
|
|
775 |
EAP_TRACE_DEBUG(
|
|
776 |
iTools,
|
|
777 |
TRACE_FLAGS_DEFAULT,
|
|
778 |
(EAPL("eap_am_stack_symbian_c::load_module(type %d=%s, tunneling_type %d=%s) load new, iIndexType=%d, iIndex=%d.\n"),
|
|
779 |
convert_eap_type_to_u32_t(type),
|
|
780 |
eap_header_string_c::get_eap_type_string(type),
|
|
781 |
convert_eap_type_to_u32_t(tunneling_type),
|
|
782 |
eap_header_string_c::get_eap_type_string(tunneling_type),
|
|
783 |
iIndexType,
|
|
784 |
iIndex));
|
|
785 |
|
|
786 |
TBuf8<KExpandedEAPSize> expanded_type;
|
|
787 |
|
|
788 |
// Some indirect way of forming the 8 byte string of an EAP type for the cue is needed here.
|
|
789 |
TUint8 tmp_expanded_type[KExpandedEAPSize];
|
|
790 |
|
|
791 |
// This is to make the tmp_expanded_type in 8 byte string with correct vendor type and vendor id details.
|
|
792 |
status = eap_expanded_type_c::write_type(iTools,
|
|
793 |
0, // index should be zero here.
|
|
794 |
tmp_expanded_type,
|
|
795 |
KExpandedEAPSize,
|
|
796 |
true,
|
|
797 |
type);
|
|
798 |
if (status != eap_status_ok)
|
|
799 |
{
|
|
800 |
EAP_TRACE_DEBUG(
|
|
801 |
iTools,
|
|
802 |
TRACE_FLAGS_DEFAULT,
|
|
803 |
(EAPL("load_module: eap_expanded_type_c::write_type(): failed status=%d=%s\n"),
|
|
804 |
status,
|
|
805 |
eap_status_string_c::get_status_string(status)));
|
|
806 |
|
|
807 |
EAP_TRACE_END(iTools, TRACE_FLAGS_DEFAULT);
|
|
808 |
return EAP_STATUS_RETURN(iTools, status);
|
|
809 |
}
|
|
810 |
|
|
811 |
// Now copy the 8 byte string to the real expanded cue.
|
|
812 |
expanded_type.Copy(tmp_expanded_type, KExpandedEAPSize);
|
|
813 |
|
|
814 |
EAP_TRACE_DATA_DEBUG(
|
|
815 |
iTools,
|
|
816 |
TRACE_FLAGS_DEFAULT,
|
|
817 |
(EAPL("EAPOL:eap_am_stack_symbian_c::load_module(): expanded_type:"),
|
|
818 |
expanded_type.Ptr(),
|
|
819 |
expanded_type.Size()));
|
|
820 |
|
|
821 |
|
|
822 |
// We must have a trap here since the EAPOL core knows nothing about Symbian.
|
|
823 |
TRAP(error, (eapType = CEapTypePlugin::NewL(
|
|
824 |
expanded_type,
|
|
825 |
iIndexType,
|
|
826 |
iIndex)));
|
|
827 |
if (error != KErrNone
|
|
828 |
|| eapType == 0)
|
|
829 |
{
|
|
830 |
// Interface not found or implementation creation function failed
|
|
831 |
status = iTools->convert_am_error_to_eapol_error(error);
|
|
832 |
if (status == eap_status_ok)
|
|
833 |
{
|
|
834 |
status = eap_status_allocation_error;
|
|
835 |
}
|
|
836 |
|
|
837 |
EAP_TRACE_DEBUG(
|
|
838 |
iTools,
|
|
839 |
TRACE_FLAGS_DEFAULT,
|
|
840 |
(EAPL("ERROR: ECom could not find/initiate implementation, error=%d, status=%d=%s.\n"),
|
|
841 |
error,
|
|
842 |
status,
|
|
843 |
eap_status_string_c::get_status_string(status)));
|
|
844 |
|
|
845 |
EAP_TRACE_END(iTools, TRACE_FLAGS_DEFAULT);
|
|
846 |
return EAP_STATUS_RETURN(iTools, status);
|
|
847 |
}
|
|
848 |
}
|
|
849 |
|
|
850 |
|
|
851 |
{
|
|
852 |
TEapExpandedType expanded_type;
|
|
853 |
|
|
854 |
error = CEapConversion::ConvertInternalTypeToExpandedEAPType(
|
|
855 |
&tunneling_type,
|
|
856 |
&expanded_type);
|
|
857 |
if (error != KErrNone)
|
|
858 |
{
|
|
859 |
status = iTools->convert_am_error_to_eapol_error(error);
|
|
860 |
EAP_TRACE_DEBUG(
|
|
861 |
iTools,
|
|
862 |
TRACE_FLAGS_DEFAULT,
|
|
863 |
(EAPL("ERROR: CEapConversion::ConvertInternalTypeToExpandedEAPType(): failed error=%d, status=%d=%s\n"),
|
|
864 |
error,
|
|
865 |
status,
|
|
866 |
eap_status_string_c::get_status_string(status)));
|
|
867 |
EAP_TRACE_END(iTools, TRACE_FLAGS_DEFAULT);
|
|
868 |
return EAP_STATUS_RETURN(iTools, status);
|
|
869 |
}
|
|
870 |
|
|
871 |
eapType->SetTunnelingType(expanded_type);
|
|
872 |
}
|
|
873 |
|
|
874 |
// Create the EAP protocol interface implementation.
|
|
875 |
|
|
876 |
TRAP(error, (*eap_type = eapType->GetStackInterfaceL(iTools,
|
|
877 |
partner,
|
|
878 |
is_client_when_true,
|
|
879 |
receive_network_id,
|
|
880 |
this)));
|
|
881 |
|
|
882 |
if (error != KErrNone
|
|
883 |
|| *eap_type == 0
|
|
884 |
|| (*eap_type)->get_is_valid() == false)
|
|
885 |
{
|
|
886 |
status = iTools->convert_am_error_to_eapol_error(error);
|
|
887 |
if (status == eap_status_ok)
|
|
888 |
{
|
|
889 |
status = eap_status_allocation_error;
|
|
890 |
}
|
|
891 |
|
|
892 |
EAP_TRACE_DEBUG(
|
|
893 |
iTools,
|
|
894 |
TRACE_FLAGS_DEFAULT,
|
|
895 |
(EAPL("ERROR: Could not create EAP type interface instance. error=%d, status=%d=%s\n"),
|
|
896 |
error,
|
|
897 |
status,
|
|
898 |
eap_status_string_c::get_status_string(status)));
|
|
899 |
|
|
900 |
if (eapArrayIndex == KErrNotFound)
|
|
901 |
{
|
|
902 |
// No need to call shutdown here because GetStackInterfaceL has done it.
|
|
903 |
delete eapType;
|
|
904 |
}
|
|
905 |
// Note: even in error cases eap_core_c deletes eap_type
|
|
906 |
}
|
|
907 |
else
|
|
908 |
{
|
|
909 |
status = eap_status_ok;
|
|
910 |
if (eapArrayIndex == KErrNotFound)
|
|
911 |
{
|
|
912 |
// Add plugin information to the member arrays. There is no need to store eap_type pointer because
|
|
913 |
// the stack takes care of its deletion.
|
|
914 |
if (m_plugin_if_array.Append(eapType) != KErrNone)
|
|
915 |
{
|
|
916 |
delete eapType;
|
|
917 |
status = eap_status_allocation_error;
|
|
918 |
EAP_TRACE_END(iTools, TRACE_FLAGS_DEFAULT);
|
|
919 |
return EAP_STATUS_RETURN(iTools, status);
|
|
920 |
}
|
|
921 |
|
|
922 |
eap_type_value_e * tmpEAPType = new eap_type_value_e();
|
|
923 |
if(tmpEAPType == NULL)
|
|
924 |
{
|
|
925 |
EAP_TRACE_DEBUG(
|
|
926 |
iTools,
|
|
927 |
TRACE_FLAGS_DEFAULT,
|
|
928 |
(EAPL("ERROR: eap_am_stack_symbian_c::load_module() eap_type_value_e creation failed\n")));
|
|
929 |
EAP_TRACE_END(iTools, TRACE_FLAGS_DEFAULT);
|
|
930 |
return EAP_STATUS_RETURN(iTools, eap_status_allocation_error);
|
|
931 |
}
|
|
932 |
|
|
933 |
*tmpEAPType = type;
|
|
934 |
|
|
935 |
status = m_eap_type_array.add_object(tmpEAPType, true);
|
|
936 |
|
|
937 |
if (status != eap_status_ok)
|
|
938 |
{
|
|
939 |
// Remove the eap type added just previously
|
|
940 |
m_plugin_if_array.Remove(m_plugin_if_array.Count() - 1);
|
|
941 |
delete eapType;
|
|
942 |
status = eap_status_allocation_error;
|
|
943 |
EAP_TRACE_END(iTools, TRACE_FLAGS_DEFAULT);
|
|
944 |
return EAP_STATUS_RETURN(iTools, status);
|
|
945 |
}
|
|
946 |
}
|
|
947 |
}
|
|
948 |
|
|
949 |
EAP_TRACE_END(iTools, TRACE_FLAGS_DEFAULT);
|
|
950 |
return EAP_STATUS_RETURN(iTools, status);
|
|
951 |
}
|
|
952 |
|
|
953 |
//--------------------------------------------------
|
|
954 |
|
|
955 |
void eap_am_stack_symbian_c::RunL()
|
|
956 |
{
|
|
957 |
EAP_TRACE_BEGIN(iTools, TRACE_FLAGS_DEFAULT);
|
|
958 |
EAP_TRACE_DEBUG(
|
|
959 |
iTools,
|
|
960 |
TRACE_FLAGS_DEFAULT,
|
|
961 |
(EAPL("eap_am_stack_symbian_c::RunL(): iStatus.Int() = %d\n"),
|
|
962 |
iStatus.Int()));
|
|
963 |
|
|
964 |
if (iStatus.Int() != KErrNone)
|
|
965 |
{
|
|
966 |
EAP_TRACE_END(iTools, TRACE_FLAGS_DEFAULT);
|
|
967 |
return;
|
|
968 |
}
|
|
969 |
|
|
970 |
// Authentication cancelled.
|
|
971 |
EAP_TRACE_ALWAYS(
|
|
972 |
iTools,
|
|
973 |
TRACE_FLAGS_ALWAYS|TRACE_FLAGS_DEFAULT,
|
|
974 |
(EAPL("Authentication cancelled.\n")));
|
|
975 |
|
|
976 |
// Reset index of current EAP-type.
|
|
977 |
set_current_eap_index(0ul);
|
|
978 |
|
|
979 |
EAP_TRACE_END(iTools, TRACE_FLAGS_DEFAULT);
|
|
980 |
}
|
|
981 |
|
|
982 |
//--------------------------------------------------
|
|
983 |
|
|
984 |
void eap_am_stack_symbian_c::read_configureL(
|
|
985 |
const TDesC& aDbName,
|
|
986 |
const TDesC& aTableName,
|
|
987 |
eap_config_string field,
|
|
988 |
const u32_t /*field_length*/,
|
|
989 |
eap_variable_data_c * const data)
|
|
990 |
{
|
|
991 |
EAP_TRACE_BEGIN(iTools, TRACE_FLAGS_DEFAULT);
|
|
992 |
|
|
993 |
EAP_TRACE_DEBUG(
|
|
994 |
iTools,
|
|
995 |
TRACE_FLAGS_DEFAULT,
|
|
996 |
(EAPL("eap_am_stack_symbian_c::read_configureL(): %s, %d=%s, this = 0x%08x => 0x%08x\n"),
|
|
997 |
(iIsClient == true) ? "client": "server",
|
|
998 |
m_selected_eapol_key_authentication_type,
|
|
999 |
eapol_key_state_string_c::get_eapol_key_authentication_type_string(m_selected_eapol_key_authentication_type),
|
|
1000 |
this,
|
|
1001 |
dynamic_cast<abs_eap_base_timer_c *>(this)));
|
|
1002 |
|
|
1003 |
EAP_TRACE_RETURN_STRING(iTools, "returns: eap_am_stack_symbian_c::read_configureL()");
|
|
1004 |
|
|
1005 |
if (m_selected_eapol_key_authentication_type == eapol_key_authentication_type_WPS)
|
|
1006 |
{
|
|
1007 |
EAP_TRACE_DEBUG(
|
|
1008 |
iTools,
|
|
1009 |
TRACE_FLAGS_DEFAULT, (EAPL("eap_am_stack_symbian_c::read_configureL(): WPS does not use CommDbIf anymore.\n")));
|
|
1010 |
User::Leave(KErrNotSupported);
|
|
1011 |
}
|
|
1012 |
|
|
1013 |
// Open database
|
|
1014 |
RDbNamedDatabase db;
|
|
1015 |
|
|
1016 |
User::LeaveIfError(db.Open(iSession, aDbName, KEapSecureUIDFormat));
|
|
1017 |
|
|
1018 |
CleanupClosePushL(db);
|
|
1019 |
|
|
1020 |
const TUint BUFFER_SIZE = 128ul;
|
|
1021 |
|
|
1022 |
// Create a buffer for the ascii strings - initialised with the argument
|
|
1023 |
HBufC8* asciibuf = HBufC8::NewLC(BUFFER_SIZE);
|
|
1024 |
TPtr8 asciiString = asciibuf->Des();
|
|
1025 |
asciiString.Copy(reinterpret_cast<const unsigned char *>(field));
|
|
1026 |
|
|
1027 |
// Buffer for unicode parameter
|
|
1028 |
HBufC* unicodebuf = HBufC::NewLC(BUFFER_SIZE);
|
|
1029 |
TPtr unicodeString = unicodebuf->Des();
|
|
1030 |
|
|
1031 |
// Convert to unicode
|
|
1032 |
unicodeString.Copy(asciiString);
|
|
1033 |
|
|
1034 |
// Now do the database query
|
|
1035 |
HBufC* buf = HBufC::NewLC(KMaxSqlQueryLength);
|
|
1036 |
TPtr sqlStatement = buf->Des();
|
|
1037 |
_LIT(KSQLQueryRow, "SELECT %S FROM %S");
|
|
1038 |
sqlStatement.Format( KSQLQueryRow, &unicodeString, &aTableName );
|
|
1039 |
|
|
1040 |
RDbView view;
|
|
1041 |
User::LeaveIfError(view.Prepare(db, TDbQuery(sqlStatement), TDbWindow::EUnlimited));
|
|
1042 |
CleanupClosePushL(view);
|
|
1043 |
User::LeaveIfError(view.EvaluateAll());
|
|
1044 |
if (view.FirstL())
|
|
1045 |
{
|
|
1046 |
eap_status_e status(eap_status_process_general_error);
|
|
1047 |
const TDbColNo FIRST_COLUMN = 1ul;
|
|
1048 |
view.GetL();
|
|
1049 |
switch (view.ColType(FIRST_COLUMN))
|
|
1050 |
{
|
|
1051 |
case EDbColText:
|
|
1052 |
{
|
|
1053 |
unicodeString = view.ColDes(FIRST_COLUMN);
|
|
1054 |
// Convert to 8-bit
|
|
1055 |
asciiString.Copy(unicodeString);
|
|
1056 |
if (asciiString.Size() > 0)
|
|
1057 |
{
|
|
1058 |
status = data->set_copy_of_buffer(asciiString.Ptr(), asciiString.Size());
|
|
1059 |
if (status != eap_status_ok)
|
|
1060 |
{
|
|
1061 |
User::Leave(KErrNoMemory);
|
|
1062 |
}
|
|
1063 |
}
|
|
1064 |
}
|
|
1065 |
break;
|
|
1066 |
case EDbColUint32:
|
|
1067 |
{
|
|
1068 |
TUint value;
|
|
1069 |
value = view.ColUint32(FIRST_COLUMN);
|
|
1070 |
status = data->set_copy_of_buffer((const unsigned char *) &value, sizeof(value));
|
|
1071 |
if (status != eap_status_ok)
|
|
1072 |
{
|
|
1073 |
User::Leave(KErrNoMemory);
|
|
1074 |
}
|
|
1075 |
}
|
|
1076 |
break;
|
|
1077 |
default:
|
|
1078 |
EAP_TRACE_DEBUG(
|
|
1079 |
iTools,
|
|
1080 |
TRACE_FLAGS_DEFAULT,
|
|
1081 |
(EAPL("read_configureL: Unexpected column type.\n")));
|
|
1082 |
User::Panic(_L("EAPOL"), 1);
|
|
1083 |
}
|
|
1084 |
}
|
|
1085 |
else
|
|
1086 |
{
|
|
1087 |
// Could not find parameter
|
|
1088 |
EAP_TRACE_DEBUG(
|
|
1089 |
iTools,
|
|
1090 |
TRACE_FLAGS_DEFAULT,
|
|
1091 |
(EAPL("read_configureL: Could not find configuration parameter.\n")));
|
|
1092 |
User::Leave(KErrNotFound);
|
|
1093 |
}
|
|
1094 |
|
|
1095 |
// Close database
|
|
1096 |
CleanupStack::PopAndDestroy(&view);
|
|
1097 |
CleanupStack::PopAndDestroy(buf);
|
|
1098 |
CleanupStack::PopAndDestroy(unicodebuf);
|
|
1099 |
CleanupStack::PopAndDestroy(asciibuf);
|
|
1100 |
CleanupStack::PopAndDestroy(&db);
|
|
1101 |
|
|
1102 |
|
|
1103 |
EAP_TRACE_END(iTools, TRACE_FLAGS_DEFAULT);
|
|
1104 |
}
|
|
1105 |
|
|
1106 |
//--------------------------------------------------
|
|
1107 |
|
|
1108 |
//
|
|
1109 |
void eap_am_stack_symbian_c::DoCancel()
|
|
1110 |
{
|
|
1111 |
EAP_TRACE_BEGIN(iTools, TRACE_FLAGS_DEFAULT);
|
|
1112 |
|
|
1113 |
EAP_TRACE_DEBUG(
|
|
1114 |
iTools,
|
|
1115 |
TRACE_FLAGS_DEFAULT,
|
|
1116 |
(EAPL("eap_am_stack_symbian_c::DoCancel()\n")));
|
|
1117 |
|
|
1118 |
EAP_TRACE_END(iTools, TRACE_FLAGS_DEFAULT);
|
|
1119 |
}
|
|
1120 |
|
|
1121 |
//----------------------------------------------------------------------------
|
|
1122 |
|
|
1123 |
TInt eap_am_stack_symbian_c::RunError(TInt aError)
|
|
1124 |
{
|
|
1125 |
EAP_TRACE_DEBUG(
|
|
1126 |
iTools,
|
|
1127 |
TRACE_FLAGS_DEFAULT,
|
|
1128 |
(EAPL("eap_am_stack_symbian_c::RunError(): aError=%d, this=0x%08x\n"),
|
|
1129 |
aError,
|
|
1130 |
this));
|
|
1131 |
|
|
1132 |
return aError;
|
|
1133 |
}
|
|
1134 |
|
|
1135 |
//--------------------------------------------------
|
|
1136 |
|
|
1137 |
EAP_FUNC_EXPORT eap_status_e eap_am_stack_symbian_c::save_simple_config_session(
|
|
1138 |
const simple_config_state_e state,
|
|
1139 |
EAP_TEMPLATE_CONST eap_array_c<simple_config_credential_c> * const credential_array,
|
|
1140 |
const eap_variable_data_c * const new_password,
|
|
1141 |
const simple_config_Device_Password_ID_e Device_Password_ID,
|
|
1142 |
const simple_config_payloads_c * const other_configuration)
|
|
1143 |
{
|
|
1144 |
EAP_TRACE_DEBUG(
|
|
1145 |
iTools,
|
|
1146 |
TRACE_FLAGS_DEFAULT,
|
|
1147 |
(EAPL("%s: eap_am_stack_symbian_c::save_simple_config_session()\n"),
|
|
1148 |
(iIsClient == true ? "client": "server")));
|
|
1149 |
|
|
1150 |
eap_status_e status(eap_status_ok);
|
|
1151 |
|
|
1152 |
status = iConfigurationIf->save_simple_config_session(
|
|
1153 |
state,
|
|
1154 |
credential_array,
|
|
1155 |
new_password,
|
|
1156 |
Device_Password_ID,
|
|
1157 |
other_configuration);
|
|
1158 |
|
|
1159 |
EAP_TRACE_END(iTools, TRACE_FLAGS_DEFAULT);
|
|
1160 |
return EAP_STATUS_RETURN(iTools, status);
|
|
1161 |
}
|
|
1162 |
|
|
1163 |
//--------------------------------------------------
|
|
1164 |
|
|
1165 |
//
|
|
1166 |
void eap_am_stack_symbian_c::ReadEAPSettingsL()
|
|
1167 |
{
|
|
1168 |
EAP_TRACE_BEGIN(iTools, TRACE_FLAGS_DEFAULT);
|
|
1169 |
|
|
1170 |
EAP_TRACE_DEBUG(
|
|
1171 |
iTools,
|
|
1172 |
TRACE_FLAGS_DEFAULT,
|
|
1173 |
(EAPL("eap_am_stack_symbian_c::ReadEAPSettingsL(): %s, %d=%s, this = 0x%08x => 0x%08x\n"),
|
|
1174 |
(iIsClient == true) ? "client": "server",
|
|
1175 |
m_selected_eapol_key_authentication_type,
|
|
1176 |
eapol_key_state_string_c::get_eapol_key_authentication_type_string(m_selected_eapol_key_authentication_type),
|
|
1177 |
this,
|
|
1178 |
dynamic_cast<abs_eap_base_timer_c *>(this)));
|
|
1179 |
|
|
1180 |
EAP_TRACE_RETURN_STRING(iTools, "returns: eap_am_stack_symbian_c::ReadEAPSettingsL()");
|
|
1181 |
|
|
1182 |
eap_status_e status(eap_status_ok);
|
|
1183 |
|
|
1184 |
if (m_selected_eapol_key_authentication_type == eapol_key_authentication_type_WPS
|
|
1185 |
|| iIndex == 0)
|
|
1186 |
{
|
|
1187 |
EAP_TRACE_DEBUG(
|
|
1188 |
iTools,
|
|
1189 |
TRACE_FLAGS_DEFAULT, (EAPL("eap_am_stack_symbian_c::ReadEAPSettingsL(): WPS does not use CommDbIf anymore.\n")));
|
|
1190 |
return;
|
|
1191 |
}
|
|
1192 |
|
|
1193 |
status = reset_eap_plugins();
|
|
1194 |
if (status != eap_status_ok)
|
|
1195 |
{
|
|
1196 |
EAP_TRACE_END(iTools, TRACE_FLAGS_DEFAULT);
|
|
1197 |
User::Leave(iTools->convert_eapol_error_to_am_error(EAP_STATUS_RETURN(iTools, status)));
|
|
1198 |
}
|
|
1199 |
|
|
1200 |
if (iIndexType == ELan
|
|
1201 |
|| iIndexType == EVpn)
|
|
1202 |
{
|
|
1203 |
EAP_TRACE_DEBUG(
|
|
1204 |
iTools,
|
|
1205 |
TRACE_FLAGS_DEFAULT,
|
|
1206 |
(EAPL("eap_am_stack_symbian_c::ReadEAPSettingsL(): Beginning to read IAP settings - Type: %d, Index: %d.\n"), iIndexType, iIndex));
|
|
1207 |
|
|
1208 |
|
|
1209 |
{
|
|
1210 |
{
|
|
1211 |
eap_am_general_settings_symbian_c * const general_setting = new eap_am_general_settings_symbian_c(iTools);
|
|
1212 |
|
|
1213 |
if (general_setting == 0)
|
|
1214 |
{
|
|
1215 |
User::Leave(KErrNoMemory);
|
|
1216 |
}
|
|
1217 |
if (general_setting->get_is_valid() == false)
|
|
1218 |
{
|
|
1219 |
general_setting->shutdown();
|
|
1220 |
delete general_setting;
|
|
1221 |
User::Leave(KErrNoMemory);
|
|
1222 |
}
|
|
1223 |
|
|
1224 |
status = general_setting->configure();
|
|
1225 |
if (status != eap_status_ok)
|
|
1226 |
{
|
|
1227 |
general_setting->shutdown();
|
|
1228 |
delete general_setting;
|
|
1229 |
User::Leave(iTools->convert_eapol_error_to_am_error(EAP_STATUS_RETURN(iTools, status)));
|
|
1230 |
}
|
|
1231 |
|
|
1232 |
status = general_setting->read_eap_methods_synchronously(
|
|
1233 |
iIndexType,
|
|
1234 |
iIndex,
|
|
1235 |
&iEnabledEapMethodsArray,
|
|
1236 |
&iDisabledEapMethodsArray);
|
|
1237 |
|
|
1238 |
general_setting->shutdown();
|
|
1239 |
delete general_setting;
|
|
1240 |
}
|
|
1241 |
|
|
1242 |
if (status != eap_status_ok)
|
|
1243 |
{
|
|
1244 |
User::Leave(iTools->convert_eapol_error_to_am_error(EAP_STATUS_RETURN(iTools, status)));
|
|
1245 |
}
|
|
1246 |
|
|
1247 |
// Trace enabled.
|
|
1248 |
for (TInt ind = 0; ind < iEnabledEapMethodsArray.get_object_count(); ++ind)
|
|
1249 |
{
|
|
1250 |
const eap_type_value_e * const allowed_eap_method = iEnabledEapMethodsArray.get_object(ind);
|
|
1251 |
|
|
1252 |
if (allowed_eap_method != 0
|
|
1253 |
&& allowed_eap_method->get_is_valid() == true)
|
|
1254 |
{
|
|
1255 |
EAP_TRACE_DEBUG(
|
|
1256 |
iTools,
|
|
1257 |
TRACE_FLAGS_DEFAULT,
|
|
1258 |
(EAPL("eap_am_stack_symbian_c::ReadEAPSettingsL(): Enabled expanded EAP type at index=%d, EAP-type=0xfe%06x%08x\n"),
|
|
1259 |
ind,
|
|
1260 |
allowed_eap_method->get_vendor_id(),
|
|
1261 |
allowed_eap_method->get_vendor_type()));
|
|
1262 |
}
|
|
1263 |
} // for()
|
|
1264 |
|
|
1265 |
// Trace disabled.
|
|
1266 |
for (TInt ind = 0; ind < iDisabledEapMethodsArray.get_object_count(); ++ind)
|
|
1267 |
{
|
|
1268 |
const eap_type_value_e * const allowed_eap_method = iDisabledEapMethodsArray.get_object(ind);
|
|
1269 |
|
|
1270 |
if (allowed_eap_method != 0
|
|
1271 |
&& allowed_eap_method->get_is_valid() == true)
|
|
1272 |
{
|
|
1273 |
EAP_TRACE_DEBUG(
|
|
1274 |
iTools,
|
|
1275 |
TRACE_FLAGS_DEFAULT,
|
|
1276 |
(EAPL("eap_am_stack_symbian_c::ReadEAPSettingsL(): Disabled expanded EAP type at index=%d, EAP-type=0xfe%06x%08x\n"),
|
|
1277 |
ind,
|
|
1278 |
allowed_eap_method->get_vendor_id(),
|
|
1279 |
allowed_eap_method->get_vendor_type()));
|
|
1280 |
}
|
|
1281 |
} // for()
|
|
1282 |
}
|
|
1283 |
|
|
1284 |
|
|
1285 |
}
|
|
1286 |
else
|
|
1287 |
{
|
|
1288 |
// Unsupported bearer.
|
|
1289 |
|
|
1290 |
EAP_TRACE_DEBUG(
|
|
1291 |
iTools,
|
|
1292 |
TRACE_FLAGS_DEFAULT,
|
|
1293 |
(EAPL("ERROR: eap_am_stack_symbian_c::ReadEAPSettingsL() - LEAVE - unsupported bearer\n")));
|
|
1294 |
|
|
1295 |
User::Leave(KErrNotSupported);
|
|
1296 |
}
|
|
1297 |
|
|
1298 |
EAP_TRACE_END(iTools, TRACE_FLAGS_DEFAULT);
|
|
1299 |
}
|
|
1300 |
|
|
1301 |
//--------------------------------------------------
|
|
1302 |
|
|
1303 |
void eap_am_stack_symbian_c::SetToTopPriorityL(const eap_type_value_e aEapType)
|
|
1304 |
{
|
|
1305 |
EAP_TRACE_BEGIN(iTools, TRACE_FLAGS_DEFAULT);
|
|
1306 |
|
|
1307 |
EAP_TRACE_DEBUG(
|
|
1308 |
iTools,
|
|
1309 |
TRACE_FLAGS_DEFAULT,
|
|
1310 |
(EAPL("eap_am_stack_symbian_c::SetToTopPriorityL() - for EXP EAP types, %d=%s\n"),
|
|
1311 |
m_selected_eapol_key_authentication_type,
|
|
1312 |
eapol_key_state_string_c::get_eapol_key_authentication_type_string(m_selected_eapol_key_authentication_type)));
|
|
1313 |
|
|
1314 |
EAP_TRACE_RETURN_STRING(iTools, "returns: eap_am_stack_symbian_c::SetToTopPriorityL()");
|
|
1315 |
|
|
1316 |
if (m_selected_eapol_key_authentication_type == eapol_key_authentication_type_WPS)
|
|
1317 |
{
|
|
1318 |
EAP_TRACE_DEBUG(
|
|
1319 |
iTools,
|
|
1320 |
TRACE_FLAGS_DEFAULT, (EAPL("eap_am_stack_symbian_c::SetToTopPriorityL(): WPS does not use CommDbIf anymore.\n")));
|
|
1321 |
return;
|
|
1322 |
}
|
|
1323 |
|
|
1324 |
if (iIndexType == ELan
|
|
1325 |
|| iIndexType == EVpn)
|
|
1326 |
{
|
|
1327 |
|
|
1328 |
|
|
1329 |
|
|
1330 |
}
|
|
1331 |
else
|
|
1332 |
{
|
|
1333 |
// Unsupported bearer.
|
|
1334 |
|
|
1335 |
EAP_TRACE_DEBUG(
|
|
1336 |
iTools,
|
|
1337 |
TRACE_FLAGS_DEFAULT,
|
|
1338 |
(EAPL("ERROR: eap_am_stack_symbian_c::SetToTopPriorityL() - LEAVE - unsupported bearer\n")));
|
|
1339 |
|
|
1340 |
User::Leave(KErrNotSupported);
|
|
1341 |
}
|
|
1342 |
|
|
1343 |
EAP_TRACE_END(iTools, TRACE_FLAGS_DEFAULT);
|
|
1344 |
}
|
|
1345 |
|
|
1346 |
//--------------------------------------------------
|
|
1347 |
|
|
1348 |
EAP_FUNC_EXPORT eap_status_e eap_am_stack_symbian_c::set_eap_database_reference_values(
|
|
1349 |
const eap_variable_data_c * const reference)
|
|
1350 |
{
|
|
1351 |
eap_status_e status(eap_status_ok);
|
|
1352 |
|
|
1353 |
EAP_TRACE_DEBUG(
|
|
1354 |
iTools,
|
|
1355 |
TRACE_FLAGS_DEFAULT,
|
|
1356 |
(EAPL("eap_am_stack_symbian_c::set_eap_database_reference_values(): %s, this = 0x%08x => 0x%08x\n"),
|
|
1357 |
(iIsClient == true) ? "client": "server",
|
|
1358 |
this,
|
|
1359 |
dynamic_cast<abs_eap_base_timer_c *>(this)));
|
|
1360 |
|
|
1361 |
EAP_TRACE_RETURN_STRING(iTools, "returns: eap_am_stack_symbian_c::set_eap_database_reference_values()");
|
|
1362 |
|
|
1363 |
const eapol_wlan_database_reference_values_s * const database_reference_values
|
|
1364 |
= reinterpret_cast<eapol_wlan_database_reference_values_s *>(
|
|
1365 |
reference->get_data(sizeof(eapol_wlan_database_reference_values_s)));
|
|
1366 |
if (database_reference_values == 0)
|
|
1367 |
{
|
|
1368 |
EAP_TRACE_END(iTools, TRACE_FLAGS_DEFAULT);
|
|
1369 |
return EAP_STATUS_RETURN(iTools, eap_status_allocation_error);
|
|
1370 |
}
|
|
1371 |
|
|
1372 |
iIndexType = static_cast<TIndexType>(database_reference_values->m_database_index_type);
|
|
1373 |
iIndex = database_reference_values->m_database_index;
|
|
1374 |
|
|
1375 |
EAP_TRACE_DEBUG(
|
|
1376 |
iTools,
|
|
1377 |
TRACE_FLAGS_DEFAULT,
|
|
1378 |
(EAPL("eap_am_stack_symbian_c::set_eap_database_reference_values(): iIndexType=%d, iIndex=%d.\n"),
|
|
1379 |
iIndexType,
|
|
1380 |
iIndex));
|
|
1381 |
|
|
1382 |
// - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
1383 |
|
|
1384 |
return EAP_STATUS_RETURN(iTools, status);
|
|
1385 |
}
|
|
1386 |
|
|
1387 |
//--------------------------------------------------
|
|
1388 |
|
|
1389 |
TInt eap_am_stack_symbian_c::get_current_eap_index()
|
|
1390 |
{
|
|
1391 |
return iCurrentEapIndex;
|
|
1392 |
}
|
|
1393 |
|
|
1394 |
//--------------------------------------------------
|
|
1395 |
|
|
1396 |
void eap_am_stack_symbian_c::set_current_eap_index(const TInt ind)
|
|
1397 |
{
|
|
1398 |
iCurrentEapIndex = ind;
|
|
1399 |
}
|
|
1400 |
|
|
1401 |
//--------------------------------------------------
|
|
1402 |
|
|
1403 |
EAP_FUNC_EXPORT eap_status_e eap_am_stack_symbian_c::get_802_11_authentication_mode(
|
|
1404 |
const eap_am_network_id_c * const receive_network_id,
|
|
1405 |
const eapol_key_authentication_type_e authentication_type)
|
|
1406 |
{
|
|
1407 |
EAP_TRACE_DEBUG(
|
|
1408 |
iTools,
|
|
1409 |
TRACE_FLAGS_DEFAULT,
|
|
1410 |
(EAPL("%s: eap_am_stack_symbian_c::get_802_11_authentication_mode(): %d=%s\n"),
|
|
1411 |
("client"),
|
|
1412 |
authentication_type,
|
|
1413 |
eapol_key_state_string_c::get_eapol_key_authentication_type_string(authentication_type)));
|
|
1414 |
|
|
1415 |
EAP_TRACE_RETURN_STRING(iTools, "returns: eap_am_stack_symbian_c::get_802_11_authentication_mode()");
|
|
1416 |
|
|
1417 |
eap_status_e status(eap_status_ok);
|
|
1418 |
eap_expanded_type_c expandedEAPType(eap_type_none);
|
|
1419 |
u32_t ind_type = 0ul;
|
|
1420 |
|
|
1421 |
m_selected_eapol_key_authentication_type = authentication_type;
|
|
1422 |
|
|
1423 |
// - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
1424 |
|
|
1425 |
status = reset_eap_configuration();
|
|
1426 |
if (status != eap_status_ok)
|
|
1427 |
{
|
|
1428 |
EAP_TRACE_END(iTools, TRACE_FLAGS_DEFAULT);
|
|
1429 |
return EAP_STATUS_RETURN(iTools, status);
|
|
1430 |
}
|
|
1431 |
|
|
1432 |
// - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
1433 |
|
|
1434 |
|
|
1435 |
for (ind_type = 0; ind_type < iEnabledEapMethodsArray.get_object_count(); ++ind_type)
|
|
1436 |
{
|
|
1437 |
const eap_type_value_e * const allowed_eap_method = iEnabledEapMethodsArray.get_object(ind_type);
|
|
1438 |
|
|
1439 |
if (allowed_eap_method != 0
|
|
1440 |
&& allowed_eap_method->get_is_valid() == true)
|
|
1441 |
{
|
|
1442 |
EAP_TRACE_DEBUG(
|
|
1443 |
iTools,
|
|
1444 |
TRACE_FLAGS_DEFAULT,
|
|
1445 |
(EAPL("eap_am_stack_symbian_c::ReadEAPSettingsL(): Enabled expanded EAP type at index=%d, EAP-type=0xfe%06x%08x\n"),
|
|
1446 |
ind_type,
|
|
1447 |
allowed_eap_method->get_vendor_id(),
|
|
1448 |
allowed_eap_method->get_vendor_type()));
|
|
1449 |
|
|
1450 |
if (*allowed_eap_method != eap_type_none)
|
|
1451 |
{
|
|
1452 |
expandedEAPType = *allowed_eap_method;
|
|
1453 |
break;
|
|
1454 |
}
|
|
1455 |
}
|
|
1456 |
} // for()
|
|
1457 |
|
|
1458 |
|
|
1459 |
if (m_selected_eapol_key_authentication_type == eapol_key_authentication_type_WPS)
|
|
1460 |
{
|
|
1461 |
expandedEAPType = eap_expanded_type_simple_config.get_type();
|
|
1462 |
}
|
|
1463 |
else if (ind_type >= iEnabledEapMethodsArray.get_object_count())
|
|
1464 |
{
|
|
1465 |
// No enabled EAP types.
|
|
1466 |
EAP_TRACE_ALWAYS(
|
|
1467 |
iTools,
|
|
1468 |
TRACE_FLAGS_ALWAYS|TRACE_FLAGS_DEFAULT,
|
|
1469 |
(EAPL("ERROR: No enabled EAP types.\n")));
|
|
1470 |
EAP_TRACE_ALWAYS(
|
|
1471 |
iTools,
|
|
1472 |
TRACE_FLAGS_ALWAYS|TRACE_FLAGS_DEFAULT,
|
|
1473 |
(EAPL("ERROR: Indication sent to WLM: eap_status_failed_completely.\n")));
|
|
1474 |
|
|
1475 |
status = iPartner->complete_get_802_11_authentication_mode(
|
|
1476 |
eap_status_illegal_eap_type,
|
|
1477 |
receive_network_id,
|
|
1478 |
eapol_key_802_11_authentication_mode_none);
|
|
1479 |
|
|
1480 |
EAP_TRACE_END(iTools, TRACE_FLAGS_DEFAULT);
|
|
1481 |
return EAP_STATUS_RETURN(iTools, status);
|
|
1482 |
}
|
|
1483 |
|
|
1484 |
eapol_key_802_11_authentication_mode_e a802_11_authentication_mode(eapol_key_802_11_authentication_mode_none);
|
|
1485 |
|
|
1486 |
if (expandedEAPType == eap_type_leap)
|
|
1487 |
{
|
|
1488 |
if (authentication_type == eapol_key_authentication_type_dynamic_WEP)
|
|
1489 |
{
|
|
1490 |
// LEAP uses it's own 802.11 authentication mode when 802.1X (dynamic WEP) is used.
|
|
1491 |
a802_11_authentication_mode = eapol_key_802_11_authentication_mode_leap;
|
|
1492 |
|
|
1493 |
EAP_TRACE_ALWAYS(
|
|
1494 |
iTools,
|
|
1495 |
TRACE_FLAGS_ALWAYS|TRACE_FLAGS_DEFAULT,
|
|
1496 |
(EAPL("start_authentication(): Trying auth mode LEAP (802.1x mode).\n")));
|
|
1497 |
}
|
|
1498 |
else
|
|
1499 |
{
|
|
1500 |
// If security mode is WPA or RSNA then even LEAP uses open authentication!
|
|
1501 |
a802_11_authentication_mode = eapol_key_802_11_authentication_mode_open;
|
|
1502 |
|
|
1503 |
EAP_TRACE_ALWAYS(
|
|
1504 |
iTools,
|
|
1505 |
TRACE_FLAGS_ALWAYS|TRACE_FLAGS_DEFAULT,
|
|
1506 |
(EAPL("start_authentication(): Trying auth mode OPEN (LEAP in WPA mode).\n")));
|
|
1507 |
}
|
|
1508 |
|
|
1509 |
}
|
|
1510 |
else
|
|
1511 |
{
|
|
1512 |
a802_11_authentication_mode = eapol_key_802_11_authentication_mode_open;
|
|
1513 |
|
|
1514 |
EAP_TRACE_ALWAYS(
|
|
1515 |
iTools,
|
|
1516 |
TRACE_FLAGS_ALWAYS|TRACE_FLAGS_DEFAULT,
|
|
1517 |
(EAPL("start_authentication(): Trying auth mode OPEN.\n")));
|
|
1518 |
}
|
|
1519 |
|
|
1520 |
status = iPartner->complete_get_802_11_authentication_mode(
|
|
1521 |
status,
|
|
1522 |
receive_network_id,
|
|
1523 |
a802_11_authentication_mode);
|
|
1524 |
|
|
1525 |
EAP_TRACE_END(iTools, TRACE_FLAGS_DEFAULT);
|
|
1526 |
return EAP_STATUS_RETURN(iTools, status);
|
|
1527 |
}
|
|
1528 |
|
|
1529 |
//--------------------------------------------------
|
|
1530 |
|
|
1531 |
EAP_FUNC_EXPORT eap_am_stack_c * new_eap_am_stack_c(class abs_eap_am_tools_c * tools, bool is_client_when_true)
|
|
1532 |
{
|
|
1533 |
eap_am_stack_symbian_c * am_stack = new eap_am_stack_symbian_c(tools, is_client_when_true);
|
|
1534 |
|
|
1535 |
eap_automatic_variable_c<eap_am_stack_c> automatic_am_stack(
|
|
1536 |
tools,
|
|
1537 |
am_stack);
|
|
1538 |
|
|
1539 |
if (am_stack == 0
|
|
1540 |
|| am_stack->get_is_valid() == false)
|
|
1541 |
{
|
|
1542 |
// ERROR.
|
|
1543 |
if (am_stack != 0)
|
|
1544 |
{
|
|
1545 |
EAP_TRACE_DEBUG(
|
|
1546 |
tools,
|
|
1547 |
TRACE_FLAGS_ALWAYS|TRACE_FLAGS_DEFAULT,
|
|
1548 |
(EAPL("calls: new_eap_am_stack_c(): am_stack->shutdown(): %s.\n"),
|
|
1549 |
(is_client_when_true == true) ? "client": "server"));
|
|
1550 |
|
|
1551 |
am_stack->shutdown();
|
|
1552 |
}
|
|
1553 |
return 0;
|
|
1554 |
}
|
|
1555 |
|
|
1556 |
automatic_am_stack.do_not_free_variable();
|
|
1557 |
|
|
1558 |
return am_stack;
|
|
1559 |
}
|
|
1560 |
|
|
1561 |
//--------------------------------------------------
|
|
1562 |
// end
|
|
1563 |
|