db.c: tmsi may be empty so put it into '' to make that obvoius (Andreas Eversberg)
during attachment, the "tmsi" field of the subscriber may be an empty string, so the string must be quoted in the sql request, or the sql request fails due to incorrect syntax. also i added "extension" field to debug output.
This commit is contained in:
parent
d51524f654
commit
91754473ca
6
src/db.c
6
src/db.c
|
@ -261,8 +261,8 @@ struct gsm_subscriber *db_get_subscriber(enum gsm_subscriber_field field, const
|
|||
|
||||
subscr->lac = dbi_result_get_uint(result, "lac");
|
||||
subscr->authorized = dbi_result_get_uint(result, "authorized");
|
||||
printf("DB: Found Subscriber: ID %llu, IMSI %s, NAME '%s', TMSI %s, LAC %hu, AUTH %u\n",
|
||||
subscr->id, subscr->imsi, subscr->name, subscr->tmsi,
|
||||
printf("DB: Found Subscriber: ID %llu, IMSI %s, NAME '%s', TMSI %s, EXTEN '%s', LAC %hu, AUTH %u\n",
|
||||
subscr->id, subscr->imsi, subscr->name, subscr->tmsi, subscr->extension,
|
||||
subscr->lac, subscr->authorized);
|
||||
dbi_result_free(result);
|
||||
return subscr;
|
||||
|
@ -273,7 +273,7 @@ int db_sync_subscriber(struct gsm_subscriber* subscriber) {
|
|||
result = dbi_conn_queryf(conn,
|
||||
"UPDATE Subscriber "
|
||||
"SET updated = datetime('now'), "
|
||||
"tmsi = %s, "
|
||||
"tmsi = '%s', "
|
||||
"lac = %i, "
|
||||
"authorized = %i "
|
||||
"WHERE imsi = %s ",
|
||||
|
|
Loading…
Reference in New Issue