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>
This commit is contained in:
parent
77d334ac4d
commit
70881b7e8a
|
@ -605,6 +605,8 @@ struct gsm_auth_info {
|
||||||
};
|
};
|
||||||
|
|
||||||
struct gsm_auth_tuple {
|
struct gsm_auth_tuple {
|
||||||
|
int use_count;
|
||||||
|
int key_seq;
|
||||||
u_int8_t rand[16];
|
u_int8_t rand[16];
|
||||||
u_int8_t sres[8];
|
u_int8_t sres[8];
|
||||||
u_int8_t kc[8];
|
u_int8_t kc[8];
|
||||||
|
|
|
@ -133,9 +133,12 @@ static char *create_stmts[] = {
|
||||||
"CREATE TABLE IF NOT EXISTS AuthTuples ("
|
"CREATE TABLE IF NOT EXISTS AuthTuples ("
|
||||||
"id INTEGER PRIMARY KEY AUTOINCREMENT, "
|
"id INTEGER PRIMARY KEY AUTOINCREMENT, "
|
||||||
"subscriber_id NUMERIC UNIQUE NOT NULL, "
|
"subscriber_id NUMERIC UNIQUE NOT NULL, "
|
||||||
"rand BLOB, "
|
"issued TIMESTAMP NOT NULL, "
|
||||||
"sres BLOB, "
|
"use_count INTEGER NOT NULL DEFAULT 0, "
|
||||||
"kc BLOB "
|
"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));
|
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");
|
len = dbi_result_get_field_length(result, "rand");
|
||||||
if (len != sizeof(atuple->rand))
|
if (len != sizeof(atuple->rand))
|
||||||
goto err_size;
|
goto err_size;
|
||||||
|
|
Loading…
Reference in New Issue