aboutsummaryrefslogtreecommitdiffstats
path: root/hostapd/hlr_auc_gw.c
diff options
context:
space:
mode:
authorJouni Malinen <j@w1.fi>2012-08-19 19:08:23 (GMT)
committerJouni Malinen <j@w1.fi>2012-08-19 19:08:23 (GMT)
commite43bd7a1b7e19eeb1135feb1fc529de8c5ccff1e (patch)
treedd26e91ac0d83c20fc03d490514312ac1d712601 /hostapd/hlr_auc_gw.c
parentc13f0a3e000447cacc7fd13f4863b26bdcfa697f (diff)
downloadhostap-e43bd7a1b7e19eeb1135feb1fc529de8c5ccff1e.zip
hostap-e43bd7a1b7e19eeb1135feb1fc529de8c5ccff1e.tar.gz
hostap-e43bd7a1b7e19eeb1135feb1fc529de8c5ccff1e.tar.bz2
hlr_auc_gw: Return FAILURE if IMSI for AKA is not known
Instead of no response, send a FAILURE response as AKA-RESP-AUTH if the requested IMSI is not known. Signed-hostap: Jouni Malinen <j@w1.fi>
Diffstat (limited to 'hostapd/hlr_auc_gw.c')
-rw-r--r--hostapd/hlr_auc_gw.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/hostapd/hlr_auc_gw.c b/hostapd/hlr_auc_gw.c
index 516d859..02a6a59 100644
--- a/hostapd/hlr_auc_gw.c
+++ b/hostapd/hlr_auc_gw.c
@@ -577,6 +577,7 @@ static void aka_req_auth(int s, struct sockaddr_un *from, socklen_t fromlen,
size_t res_len;
int ret;
struct milenage_parameters *m;
+ int failed = 0;
m = get_milenage(imsi);
if (m) {
@@ -601,7 +602,7 @@ static void aka_req_auth(int s, struct sockaddr_un *from, socklen_t fromlen,
memset(res, '2', EAP_AKA_RES_MAX_LEN);
res_len = EAP_AKA_RES_MAX_LEN;
#else /* AKA_USE_FIXED_TEST_VALUES */
- return;
+ failed = 1;
#endif /* AKA_USE_FIXED_TEST_VALUES */
}
@@ -611,6 +612,13 @@ static void aka_req_auth(int s, struct sockaddr_un *from, socklen_t fromlen,
if (ret < 0 || ret >= end - pos)
return;
pos += ret;
+ if (failed) {
+ ret = snprintf(pos, end - pos, "FAILURE");
+ if (ret < 0 || ret >= end - pos)
+ return;
+ pos += ret;
+ goto done;
+ }
pos += wpa_snprintf_hex(pos, end - pos, _rand, EAP_AKA_RAND_LEN);
*pos++ = ' ';
pos += wpa_snprintf_hex(pos, end - pos, autn, EAP_AKA_AUTN_LEN);
@@ -621,6 +629,7 @@ static void aka_req_auth(int s, struct sockaddr_un *from, socklen_t fromlen,
*pos++ = ' ';
pos += wpa_snprintf_hex(pos, end - pos, res, res_len);
+done:
printf("Send: %s\n", reply);
if (sendto(s, reply, pos - reply, 0, (struct sockaddr *) from,