aboutsummaryrefslogtreecommitdiffstats
path: root/hostapd/hlr_auc_gw.c
diff options
context:
space:
mode:
authorJouni Malinen <j@w1.fi>2012-09-02 08:24:59 (GMT)
committerJouni Malinen <j@w1.fi>2012-09-02 08:24:59 (GMT)
commit4309ca51b45619e194d618ac7cb43809c057b564 (patch)
tree71c28a5a87c3fa68ff9917a5e53115a4ed7e6524 /hostapd/hlr_auc_gw.c
parentf585c6a6d62998f256495b5775da33551ab17016 (diff)
downloadhostap-4309ca51b45619e194d618ac7cb43809c057b564.zip
hostap-4309ca51b45619e194d618ac7cb43809c057b564.tar.gz
hostap-4309ca51b45619e194d618ac7cb43809c057b564.tar.bz2
hlr_auc_gw: Fix unknown-IMSI determination with SQLite
Need to explicitly check that the SQL query returns a match before returning values. Signed-hostap: Jouni Malinen <j@w1.fi>
Diffstat (limited to 'hostapd/hlr_auc_gw.c')
-rw-r--r--hostapd/hlr_auc_gw.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/hostapd/hlr_auc_gw.c b/hostapd/hlr_auc_gw.c
index e27ddab..e04e2e9 100644
--- a/hostapd/hlr_auc_gw.c
+++ b/hostapd/hlr_auc_gw.c
@@ -78,6 +78,7 @@ struct milenage_parameters {
u8 opc[16];
u8 amf[2];
u8 sqn[6];
+ int set;
};
static struct milenage_parameters *milenage_db = NULL;
@@ -155,6 +156,8 @@ static int get_milenage_cb(void *ctx, int argc, char *argv[], char *col[])
struct milenage_parameters *m = ctx;
int i;
+ m->set = 1;
+
for (i = 0; i < argc; i++) {
if (os_strcmp(col[i], "ki") == 0 && argv[i] &&
hexstr2bin(argv[i], m->ki, sizeof(m->ki))) {
@@ -201,6 +204,8 @@ static struct milenage_parameters * db_get_milenage(const char *imsi_txt)
NULL) != SQLITE_OK)
return NULL;
+ if (!db_tmp_milenage.set)
+ return NULL;
return &db_tmp_milenage;
}