From 62f736dd04c3c61223264619749257c90dcad053 Mon Sep 17 00:00:00 2001 From: Jean Trivelly Date: Fri, 28 Mar 2014 14:41:36 +0100 Subject: [PATCH] Interworking: Init scard when a credential requires SIM access When an ANQP fetch is triggered and ANQP_3GPP_CELLULAR_NETWORK info is required, initialize scard to be ready when comparing ANQP and credentials. Signed-off-by: Jean Trivelly --- wpa_supplicant/events.c | 6 +++--- wpa_supplicant/interworking.c | 4 +++- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/wpa_supplicant/events.c b/wpa_supplicant/events.c index e9a4a8c..3a6d427 100644 --- a/wpa_supplicant/events.c +++ b/wpa_supplicant/events.c @@ -303,11 +303,11 @@ int wpa_supplicant_scard_init(struct wpa_supplicant *wpa_s, #ifdef PCSC_FUNCS int aka = 0, sim = 0; - if (ssid->eap.pcsc == NULL || wpa_s->scard != NULL || - wpa_s->conf->external_sim) + if ((ssid != NULL && ssid->eap.pcsc == NULL) || + wpa_s->scard != NULL || wpa_s->conf->external_sim) return 0; - if (ssid->eap.eap_methods == NULL) { + if (ssid == NULL || ssid->eap.eap_methods == NULL) { sim = 1; aka = 1; } else { diff --git a/wpa_supplicant/interworking.c b/wpa_supplicant/interworking.c index 662e729..bb96113 100644 --- a/wpa_supplicant/interworking.c +++ b/wpa_supplicant/interworking.c @@ -260,8 +260,10 @@ static int interworking_anqp_send_req(struct wpa_supplicant *wpa_s, info_ids[num_info_ids++] = ANQP_IP_ADDR_TYPE_AVAILABILITY; if (all || cred_with_nai_realm(wpa_s)) info_ids[num_info_ids++] = ANQP_NAI_REALM; - if (all || cred_with_3gpp(wpa_s)) + if (all || cred_with_3gpp(wpa_s)) { info_ids[num_info_ids++] = ANQP_3GPP_CELLULAR_NETWORK; + wpa_supplicant_scard_init(wpa_s, NULL); + } if (all || cred_with_domain(wpa_s)) info_ids[num_info_ids++] = ANQP_DOMAIN_NAME; wpa_hexdump(MSG_DEBUG, "Interworking: ANQP Query info", -- 2.1.4