aboutsummaryrefslogtreecommitdiffstats
path: root/src/eap_peer
diff options
context:
space:
mode:
authorJouni Malinen <jouni.malinen@atheros.com>2008-11-07 18:09:44 (GMT)
committerJouni Malinen <j@w1.fi>2008-11-07 18:09:44 (GMT)
commit6982784e20f57618b71e5b2bed46f171b5fe7ce2 (patch)
tree9509d5f8e8ef1ace1e3625ec3205e29996d236a0 /src/eap_peer
parent04a5bad6821b9b306d2a01486d9bc6439725ae44 (diff)
downloadhostap-06-6982784e20f57618b71e5b2bed46f171b5fe7ce2.zip
hostap-06-6982784e20f57618b71e5b2bed46f171b5fe7ce2.tar.gz
hostap-06-6982784e20f57618b71e5b2bed46f171b5fe7ce2.tar.bz2
EAP-SIM/AKA: fixed initialization to verify PIN even if identity is set
Previously, hardcoded identity in the network configuration skipped both IMSI reading and PIN verification. This broke cases where PIN is needed for GSM/UMTS authentication. Now, only IMSI reading is skipped if identity is hardcoded.
Diffstat (limited to 'src/eap_peer')
-rw-r--r--src/eap_peer/eap.c19
1 files changed, 17 insertions, 2 deletions
diff --git a/src/eap_peer/eap.c b/src/eap_peer/eap.c
index 71bb07f..e518ec3 100644
--- a/src/eap_peer/eap.c
+++ b/src/eap_peer/eap.c
@@ -906,8 +906,8 @@ static int eap_sm_imsi_identity(struct eap_sm *sm,
#endif /* PCSC_FUNCS */
-static int eap_sm_get_scard_identity(struct eap_sm *sm,
- struct eap_peer_config *conf)
+static int eap_sm_set_scard_pin(struct eap_sm *sm,
+ struct eap_peer_config *conf)
{
#ifdef PCSC_FUNCS
if (scard_set_pin(sm->scard_ctx, conf->pin)) {
@@ -922,6 +922,18 @@ static int eap_sm_get_scard_identity(struct eap_sm *sm,
eap_sm_request_pin(sm);
return -1;
}
+ return 0;
+#else /* PCSC_FUNCS */
+ return -1;
+#endif /* PCSC_FUNCS */
+}
+
+static int eap_sm_get_scard_identity(struct eap_sm *sm,
+ struct eap_peer_config *conf)
+{
+#ifdef PCSC_FUNCS
+ if (eap_sm_set_scard_pin(sm, conf))
+ return -1;
return eap_sm_imsi_identity(sm, conf);
#else /* PCSC_FUNCS */
@@ -985,6 +997,9 @@ struct wpabuf * eap_sm_buildIdentity(struct eap_sm *sm, int id, int encrypted)
eap_sm_request_identity(sm);
return NULL;
}
+ } else if (config->pcsc) {
+ if (eap_sm_set_scard_pin(sm, config) < 0)
+ return NULL;
}
resp = eap_msg_alloc(EAP_VENDOR_IETF, EAP_TYPE_IDENTITY, identity_len,