aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc/src/db.c
diff options
context:
space:
mode:
authorSylvain Munaut <tnt@246tNt.com>2009-12-27 15:41:59 +0100
committerHarald Welte <laforge@netfilter.org>2010-01-03 10:17:35 +0100
commit70881b7e8acf5ef6cdd57a084a99055d7decc1c2 (patch)
tree98afcad5ad9b3f728f0185b4316b7a5b601703b2 /openbsc/src/db.c
parent77d334ac4d64fec8a0708160fc2753c6354eb869 (diff)
db: Add issued/use_count/key_seq fields to AuthTuples
Theses will be useful to know if we can reuse the tuples or if we should renew. The 'issued' is currently purely informative. Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
Diffstat (limited to 'openbsc/src/db.c')
-rw-r--r--openbsc/src/db.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/openbsc/src/db.c b/openbsc/src/db.c
index bfc7d9310..5ad951ac1 100644
--- a/openbsc/src/db.c
+++ b/openbsc/src/db.c
@@ -133,9 +133,12 @@ static char *create_stmts[] = {
"CREATE TABLE IF NOT EXISTS AuthTuples ("
"id INTEGER PRIMARY KEY AUTOINCREMENT, "
"subscriber_id NUMERIC UNIQUE NOT NULL, "
- "rand BLOB, "
- "sres BLOB, "
- "kc BLOB "
+ "issued TIMESTAMP NOT NULL, "
+ "use_count INTEGER NOT NULL DEFAULT 0, "
+ "key_seq INTEGER NOT NULL, "
+ "rand BLOB NOT NULL, "
+ "sres BLOB NOT NULL, "
+ "kc BLOB NOT NULL "
")",
};
@@ -383,6 +386,9 @@ int get_authtuple_by_subscr(struct gsm_auth_tuple *atuple,
memset(atuple, 0, sizeof(atuple));
+ atuple->use_count = dbi_result_get_ulonglong(result, "use_count");
+ atuple->key_seq = dbi_result_get_ulonglong(result, "key_seq");
+
len = dbi_result_get_field_length(result, "rand");
if (len != sizeof(atuple->rand))
goto err_size;