- eap_fast_state(data, PHASE2_ID);
- eap_fast_phase2_init(sm, data, EAP_TYPE_IDENTITY);
+ if (data->identity) {
+ os_free(sm->identity);
+ sm->identity = data->identity;
+ data->identity = NULL;
+ sm->identity_len = data->identity_len;
+ data->identity_len = 0;
+ if (eap_user_get(sm, sm->identity, sm->identity_len, 1)
+ != 0) {
+ wpa_hexdump_ascii(MSG_DEBUG, "EAP-FAST: "
+ "Phase2 Identity not found "
+ "in the user database",
+ sm->identity,
+ sm->identity_len);
+ next_type = eap_fast_req_failure(sm, data);
+ } else {
+ wpa_printf(MSG_DEBUG, "EAP-FAST: Identity "
+ "already known - skip Phase 2 "
+ "Identity Request");
+ next_type = sm->user->methods[0].method;
+ sm->user_eap_method_index = 1;
+ }
+
+ eap_fast_state(data, PHASE2_METHOD);
+ } else {
+ eap_fast_state(data, PHASE2_ID);
+ next_type = EAP_TYPE_IDENTITY;
+ }
+
+ eap_fast_phase2_init(sm, data, next_type);