db: Rename AuthTuples to AuthLastTuples

Ultimately, we'll need to store both the last used tuple by a
subscriber and a list of known tuples (for unknown Ki). What's
currently implemented for AuthTuples is the former behavior, so
reflect that.

The second use case will be added as a separate table with separate
accessors later on.

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
diff --git a/openbsc/src/db.c b/openbsc/src/db.c
index 7f3c221..ad46d98 100644
--- a/openbsc/src/db.c
+++ b/openbsc/src/db.c
@@ -140,7 +140,7 @@
 		"algorithm_id INTEGER NOT NULL, "
 		"a3a8_ki BLOB "
 		")",
-	"CREATE TABLE IF NOT EXISTS AuthTuples ("
+	"CREATE TABLE IF NOT EXISTS AuthLastTuples ("
 		"id INTEGER PRIMARY KEY AUTOINCREMENT, "
 		"subscriber_id NUMERIC UNIQUE NOT NULL, "
 		"issued TIMESTAMP NOT NULL, "
@@ -435,15 +435,15 @@
 	return 0;
 }
 
-int get_authtuple_by_subscr(struct gsm_auth_tuple *atuple,
-			    struct gsm_subscriber *subscr)
+int get_lastauthtuple_by_subscr(struct gsm_auth_tuple *atuple,
+                                struct gsm_subscriber *subscr)
 {
 	dbi_result result;
 	int len;
 	const unsigned char *blob;
 
 	result = dbi_conn_queryf(conn,
-			"SELECT * FROM AuthTuples WHERE subscriber_id=%u",
+			"SELECT * FROM AuthLastTuples WHERE subscriber_id=%u",
 			subscr->id);
 	if (!result)
 		return -EIO;
@@ -488,8 +488,8 @@
 	return -EIO;
 }
 
-int set_authtuple_for_subscr(struct gsm_auth_tuple *atuple,
-			     struct gsm_subscriber *subscr)
+int set_lastauthtuple_for_subscr(struct gsm_auth_tuple *atuple,
+                                 struct gsm_subscriber *subscr)
 {
 	dbi_result result;
 	int rc, upd;
@@ -499,7 +499,7 @@
 	/* Deletion ? */
 	if (atuple == NULL) {
 		result = dbi_conn_queryf(conn,
-			"DELETE FROM AuthTuples WHERE subscriber_id=%u",
+			"DELETE FROM AuthLastTuples WHERE subscriber_id=%u",
 			subscr->id);
 
 		if (!result)
@@ -511,7 +511,7 @@
 	}
 
 	/* Check if already existing */
-	rc = get_authtuple_by_subscr(&atuple_old, subscr);
+	rc = get_lastauthtuple_by_subscr(&atuple_old, subscr);
 	if (rc && rc != -ENOENT)
 		return rc;
 	upd = rc ? 0 : 1;
@@ -526,7 +526,7 @@
 
 	if (!upd) {
 		result = dbi_conn_queryf(conn,
-				"INSERT INTO AuthTuples "
+				"INSERT INTO AuthLastTuples "
 				"(subscriber_id, issued, use_count, "
 				 "key_seq, rand, sres, kc) "
 				"VALUES (%u, datetime('now'), %u, "