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>
This commit is contained in:
parent
c13f0a3e00
commit
e43bd7a1b7
1 changed files with 10 additions and 1 deletions
|
@ -577,6 +577,7 @@ static void aka_req_auth(int s, struct sockaddr_un *from, socklen_t fromlen,
|
||||||
size_t res_len;
|
size_t res_len;
|
||||||
int ret;
|
int ret;
|
||||||
struct milenage_parameters *m;
|
struct milenage_parameters *m;
|
||||||
|
int failed = 0;
|
||||||
|
|
||||||
m = get_milenage(imsi);
|
m = get_milenage(imsi);
|
||||||
if (m) {
|
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);
|
memset(res, '2', EAP_AKA_RES_MAX_LEN);
|
||||||
res_len = EAP_AKA_RES_MAX_LEN;
|
res_len = EAP_AKA_RES_MAX_LEN;
|
||||||
#else /* AKA_USE_FIXED_TEST_VALUES */
|
#else /* AKA_USE_FIXED_TEST_VALUES */
|
||||||
return;
|
failed = 1;
|
||||||
#endif /* AKA_USE_FIXED_TEST_VALUES */
|
#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)
|
if (ret < 0 || ret >= end - pos)
|
||||||
return;
|
return;
|
||||||
pos += ret;
|
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 += wpa_snprintf_hex(pos, end - pos, _rand, EAP_AKA_RAND_LEN);
|
||||||
*pos++ = ' ';
|
*pos++ = ' ';
|
||||||
pos += wpa_snprintf_hex(pos, end - pos, autn, EAP_AKA_AUTN_LEN);
|
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++ = ' ';
|
||||||
pos += wpa_snprintf_hex(pos, end - pos, res, res_len);
|
pos += wpa_snprintf_hex(pos, end - pos, res, res_len);
|
||||||
|
|
||||||
|
done:
|
||||||
printf("Send: %s\n", reply);
|
printf("Send: %s\n", reply);
|
||||||
|
|
||||||
if (sendto(s, reply, pos - reply, 0, (struct sockaddr *) from,
|
if (sendto(s, reply, pos - reply, 0, (struct sockaddr *) from,
|
||||||
|
|
Loading…
Reference in a new issue