aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc/src/db.c
diff options
context:
space:
mode:
authorSylvain Munaut <tnt@246tNt.com>2010-07-03 15:38:35 +0200
committerSylvain Munaut <tnt@246tNt.com>2010-07-03 22:24:13 +0200
commitadea4f1bf81b75111cf244607d15a05f7a419f40 (patch)
tree8499d86bb4e73375b68eb982192aa24822f4b55f /openbsc/src/db.c
parentc48ac4750dda4350d2e0a67b6ecbe3496b483f1a (diff)
db: Use proper %llu for subscriber ID in format string.
This was causing weird crashes when running in 32 bit linux. Thanks to horiz0n for taking the time to debug this with me on IRC. Written-by: horiz0n <cscan@gmx.net> Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
Diffstat (limited to 'openbsc/src/db.c')
-rw-r--r--openbsc/src/db.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/openbsc/src/db.c b/openbsc/src/db.c
index 72e6bd35c..124dfd779 100644
--- a/openbsc/src/db.c
+++ b/openbsc/src/db.c
@@ -355,7 +355,7 @@ int db_get_authinfo_for_subscr(struct gsm_auth_info *ainfo,
const unsigned char *a3a8_ki;
result = dbi_conn_queryf(conn,
- "SELECT * FROM AuthKeys WHERE subscriber_id=%u",
+ "SELECT * FROM AuthKeys WHERE subscriber_id=%llu",
subscr->id);
if (!result)
return -EIO;
@@ -388,7 +388,7 @@ int db_sync_authinfo_for_subscr(struct gsm_auth_info *ainfo,
/* Deletion ? */
if (ainfo == NULL) {
result = dbi_conn_queryf(conn,
- "DELETE FROM AuthKeys WHERE subscriber_id=%u",
+ "DELETE FROM AuthKeys WHERE subscriber_id=%llu",
subscr->id);
if (!result)
@@ -413,13 +413,13 @@ int db_sync_authinfo_for_subscr(struct gsm_auth_info *ainfo,
result = dbi_conn_queryf(conn,
"INSERT INTO AuthKeys "
"(subscriber_id, algorithm_id, a3a8_ki) "
- "VALUES (%u, %u, %s)",
+ "VALUES (%llu, %u, %s)",
subscr->id, ainfo->auth_algo, ki_str);
} else {
result = dbi_conn_queryf(conn,
"UPDATE AuthKeys "
"SET algorithm_id=%u, a3a8_ki=%s "
- "WHERE subscriber_id=%u",
+ "WHERE subscriber_id=%llu",
ainfo->auth_algo, ki_str, subscr->id);
}
@@ -441,7 +441,7 @@ int db_get_lastauthtuple_for_subscr(struct gsm_auth_tuple *atuple,
const unsigned char *blob;
result = dbi_conn_queryf(conn,
- "SELECT * FROM AuthLastTuples WHERE subscriber_id=%u",
+ "SELECT * FROM AuthLastTuples WHERE subscriber_id=%llu",
subscr->id);
if (!result)
return -EIO;
@@ -497,7 +497,7 @@ int db_sync_lastauthtuple_for_subscr(struct gsm_auth_tuple *atuple,
/* Deletion ? */
if (atuple == NULL) {
result = dbi_conn_queryf(conn,
- "DELETE FROM AuthLastTuples WHERE subscriber_id=%u",
+ "DELETE FROM AuthLastTuples WHERE subscriber_id=%llu",
subscr->id);
if (!result)
@@ -527,7 +527,7 @@ int db_sync_lastauthtuple_for_subscr(struct gsm_auth_tuple *atuple,
"INSERT INTO AuthLastTuples "
"(subscriber_id, issued, use_count, "
"key_seq, rand, sres, kc) "
- "VALUES (%u, datetime('now'), %u, "
+ "VALUES (%llu, datetime('now'), %u, "
"%u, %s, %s, %s ) ",
subscr->id, atuple->use_count, atuple->key_seq,
rand_str, sres_str, kc_str);
@@ -538,7 +538,7 @@ int db_sync_lastauthtuple_for_subscr(struct gsm_auth_tuple *atuple,
"UPDATE AuthLastTuples "
"SET issued=%s, use_count=%u, "
"key_seq=%u, rand=%s, sres=%s, kc=%s "
- "WHERE subscriber_id = %u",
+ "WHERE subscriber_id = %llu",
issued, atuple->use_count, atuple->key_seq,
rand_str, sres_str, kc_str, subscr->id);
}