eap_proxy: Confirm eap_proxy initialization before reading SIM info

Trying to access the SIM card details without checking if the eap_proxy
layer has been initialized can results in a crash. Address this by
sending the request for the IMSI through eapol_supp_sm.c which can
verify that eap_proxy has been initialized.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
This commit is contained in:
Naresh Jayaram 2013-10-23 19:17:14 +03:00 committed by Jouni Malinen
parent 47d986e6ff
commit 07041c6f99
3 changed files with 15 additions and 1 deletions

View file

@ -2051,3 +2051,15 @@ int eapol_sm_failed(struct eapol_sm *sm)
return 0;
return !sm->eapSuccess && sm->eapFail;
}
int eapol_sm_get_eap_proxy_imsi(struct eapol_sm *sm, char *imsi, size_t *len)
{
#ifdef CONFIG_EAP_PROXY
if (sm->eap_proxy == NULL)
return -1;
return eap_proxy_get_imsi(imsi, len);
#else /* CONFIG_EAP_PROXY */
return -1;
#endif /* CONFIG_EAP_PROXY */
}

View file

@ -292,6 +292,7 @@ const char * eapol_sm_get_method_name(struct eapol_sm *sm);
void eapol_sm_set_ext_pw_ctx(struct eapol_sm *sm,
struct ext_password_data *ext);
int eapol_sm_failed(struct eapol_sm *sm);
int eapol_sm_get_eap_proxy_imsi(struct eapol_sm *sm, char *imsi, size_t *len);
#else /* IEEE8021X_EAPOL */
static inline struct eapol_sm *eapol_sm_init(struct eapol_ctx *ctx)
{

View file

@ -3064,7 +3064,8 @@ next_driver:
#ifdef CONFIG_EAP_PROXY
{
size_t len;
wpa_s->mnc_len = eap_proxy_get_imsi(wpa_s->imsi, &len);
wpa_s->mnc_len = eapol_sm_get_eap_proxy_imsi(wpa_s->eapol, wpa_s->imsi,
&len);
if (wpa_s->mnc_len > 0) {
wpa_s->imsi[len] = '\0';
wpa_printf(MSG_DEBUG, "eap_proxy: IMSI %s (MNC length %d)",