[MERGED] osmo-hlr[master]: refactor db_get_auth_data return val

Neels Hofmeyr gerrit-no-reply at lists.osmocom.org
Wed Oct 11 22:02:35 UTC 2017


Neels Hofmeyr has submitted this change and it was merged.

Change subject: refactor db_get_auth_data return val
......................................................................


refactor db_get_auth_data return val

Adopt the error handling of the other db functions: return -ENOENT on unknown
subscriber and -EIO on SQL failure. Return 0 for no error, instead of the
number of rows modified.

Adjust the single caller: db_get_auc()
(and db_test.c).

Change-Id: I006f471962bdad95d00a3a4c41a28ebbc9740884
---
M src/db_auc.c
M tests/db/db_test.c
M tests/db/db_test.err
3 files changed, 67 insertions(+), 66 deletions(-)

Approvals:
  Harald Welte: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/src/db_auc.c b/src/db_auc.c
index 71c7262..10c1816 100644
--- a/src/db_auc.c
+++ b/src/db_auc.c
@@ -19,6 +19,7 @@
 
 #include <string.h>
 #include <inttypes.h>
+#include <errno.h>
 
 #include <osmocom/core/utils.h>
 #include <osmocom/crypt/auth.h>
@@ -91,7 +92,7 @@
 				SQLITE_STATIC);
 	if (rc != SQLITE_OK) {
 		LOGAUC(imsi, LOGL_ERROR, "Error binding IMSI: %d\n", rc);
-		ret = -1;
+		ret = -EIO;
 		goto out;
 	}
 
@@ -99,11 +100,11 @@
 	rc = sqlite3_step(stmt);
 	if (rc == SQLITE_DONE) {
 		LOGAUC(imsi, LOGL_INFO, "No such subscriber\n");
-		ret = 0;
+		ret = -ENOENT;
 		goto out;
 	} else if (rc != SQLITE_ROW) {
 		LOGAUC(imsi, LOGL_ERROR, "Error executing SQL: %d\n", rc);
-		ret = -1;
+		ret = -EIO;
 		goto out;
 	}
 
@@ -139,6 +140,7 @@
 		k = sqlite3_column_text(stmt, 4);
 		if (!k) {
 			LOGAUC(imsi, LOGL_ERROR, "Error reading K: %d\n", rc);
+			ret = -EIO;
 			goto out;
 		}
 		osmo_hexparse((void*)k, (void*)&aud3g->u.umts.k, sizeof(aud3g->u.umts.k));
@@ -148,6 +150,7 @@
 			opc = sqlite3_column_text(stmt, 6);
 			if (!opc) {
 				LOGAUC(imsi, LOGL_ERROR, "Error reading OPC: %d\n", rc);
+				ret = -EIO;
 				goto out;
 			}
 			osmo_hexparse((void*)opc, (void*)&aud3g->u.umts.opc,
@@ -166,9 +169,7 @@
 		LOGAUC(imsi, LOGL_DEBUG, "No 3G Auth Data\n");
 
 	if (aud2g->type == 0 && aud3g->type == 0)
-		ret = -1;
-	else
-		ret = 1;
+		ret = -ENOENT;
 
 out:
 	/* remove bindings and reset statement to be re-executed */
@@ -197,7 +198,7 @@
 	int rc;
 
 	rc = db_get_auth_data(dbc, imsi, &aud2g, &aud3g, &subscr_id);
-	if (rc <= 0)
+	if (rc)
 		return rc;
 
 	aud3g.u.umts.ind = auc_3g_ind;
diff --git a/tests/db/db_test.c b/tests/db/db_test.c
index 0442dbe..1bdabdb 100644
--- a/tests/db/db_test.c
+++ b/tests/db/db_test.c
@@ -75,7 +75,7 @@
 		g_aud3g = (struct osmo_sub_auth_data){}; \
 		g_id = 0; \
 		ASSERT_RC(db_get_auth_data(dbc, imsi, &g_aud2g, &g_aud3g, &g_id), expect_rc); \
-		if (g_rc == 1) { \
+		if (!g_rc) { \
 			dump_aud("2G", &g_aud2g); \
 			dump_aud("3G", &g_aud3g); \
 		}\
@@ -443,7 +443,7 @@
 	comment_start();
 
 	comment("Get auth data for non-existent subscriber");
-	ASSERT_SEL_AUD(unknown_imsi, 0, 0);
+	ASSERT_SEL_AUD(unknown_imsi, -ENOENT, 0);
 
 	comment("Create subscriber");
 
@@ -451,7 +451,7 @@
 	ASSERT_SEL(imsi, imsi0, 0);
 
 	id = g_subscr.id;
-	ASSERT_SEL_AUD(imsi0, -1, id);
+	ASSERT_SEL_AUD(imsi0, -ENOENT, id);
 
 
 	comment("Set auth data, 2G only");
@@ -459,35 +459,35 @@
 	ASSERT_RC(db_subscr_update_aud_by_id(dbc, id,
 		mk_aud_2g(OSMO_AUTH_ALG_COMP128v1, "0123456789abcdef0123456789abcdef")),
 		0);
-	ASSERT_SEL_AUD(imsi0, 1, id);
+	ASSERT_SEL_AUD(imsi0, 0, id);
 
 	/* same again */
 	ASSERT_RC(db_subscr_update_aud_by_id(dbc, id,
 		mk_aud_2g(OSMO_AUTH_ALG_COMP128v1, "0123456789abcdef0123456789abcdef")),
 		0);
-	ASSERT_SEL_AUD(imsi0, 1, id);
+	ASSERT_SEL_AUD(imsi0, 0, id);
 
 	ASSERT_RC(db_subscr_update_aud_by_id(dbc, id,
 		mk_aud_2g(OSMO_AUTH_ALG_COMP128v2, "BeadedBeeAced1EbbedDefacedFacade")),
 		0);
-	ASSERT_SEL_AUD(imsi0, 1, id);
+	ASSERT_SEL_AUD(imsi0, 0, id);
 
 	ASSERT_RC(db_subscr_update_aud_by_id(dbc, id,
 		mk_aud_2g(OSMO_AUTH_ALG_COMP128v3, "DeafBeddedBabeAcceededFadedDecaf")),
 		0);
-	ASSERT_SEL_AUD(imsi0, 1, id);
+	ASSERT_SEL_AUD(imsi0, 0, id);
 
 	ASSERT_RC(db_subscr_update_aud_by_id(dbc, id,
 		mk_aud_2g(OSMO_AUTH_ALG_XOR, "CededEffacedAceFacedBadFadedBeef")),
 		0);
-	ASSERT_SEL_AUD(imsi0, 1, id);
+	ASSERT_SEL_AUD(imsi0, 0, id);
 
 	comment("Remove 2G auth data");
 
 	ASSERT_RC(db_subscr_update_aud_by_id(dbc, id,
 		mk_aud_2g(OSMO_AUTH_ALG_NONE, NULL)),
 		0);
-	ASSERT_SEL_AUD(imsi0, -1, id);
+	ASSERT_SEL_AUD(imsi0, -ENOENT, id);
 
 	/* Removing nothing results in -ENOENT */
 	ASSERT_RC(db_subscr_update_aud_by_id(dbc, id,
@@ -497,12 +497,12 @@
 	ASSERT_RC(db_subscr_update_aud_by_id(dbc, id,
 		mk_aud_2g(OSMO_AUTH_ALG_XOR, "CededEffacedAceFacedBadFadedBeef")),
 		0);
-	ASSERT_SEL_AUD(imsi0, 1, id);
+	ASSERT_SEL_AUD(imsi0, 0, id);
 
 	ASSERT_RC(db_subscr_update_aud_by_id(dbc, id,
 		mk_aud_2g(OSMO_AUTH_ALG_NONE, "f000000000000f00000000000f000000")),
 		0);
-	ASSERT_SEL_AUD(imsi0, -1, id);
+	ASSERT_SEL_AUD(imsi0, -ENOENT, id);
 
 
 	comment("Set auth data, 3G only");
@@ -512,7 +512,7 @@
 			  "BeefedCafeFaceAcedAddedDecadeFee", true,
 			  "C01ffedC1cadaeAc1d1f1edAcac1aB0a", 5)),
 		0);
-	ASSERT_SEL_AUD(imsi0, 1, id);
+	ASSERT_SEL_AUD(imsi0, 0, id);
 
 	/* same again */
 	ASSERT_RC(db_subscr_update_aud_by_id(dbc, id,
@@ -520,14 +520,14 @@
 			  "BeefedCafeFaceAcedAddedDecadeFee", true,
 			  "C01ffedC1cadaeAc1d1f1edAcac1aB0a", 5)),
 		0);
-	ASSERT_SEL_AUD(imsi0, 1, id);
+	ASSERT_SEL_AUD(imsi0, 0, id);
 
 	ASSERT_RC(db_subscr_update_aud_by_id(dbc, id,
 		mk_aud_3g(OSMO_AUTH_ALG_MILENAGE,
 			  "Deaf0ff1ceD0d0DabbedD1ced1ceF00d", true,
 			  "F1bbed0afD0eF0bD0ffed0ddF1fe0b0e", 0)),
 		0);
-	ASSERT_SEL_AUD(imsi0, 1, id);
+	ASSERT_SEL_AUD(imsi0, 0, id);
 
 	ASSERT_RC(db_subscr_update_aud_by_id(dbc, id,
 		mk_aud_3g(OSMO_AUTH_ALG_MILENAGE,
@@ -535,21 +535,21 @@
 			  "DeafBeddedBabeAcceededFadedDecaf",
 			  OSMO_MILENAGE_IND_BITLEN_MAX)),
 		0);
-	ASSERT_SEL_AUD(imsi0, 1, id);
+	ASSERT_SEL_AUD(imsi0, 0, id);
 
 	ASSERT_RC(db_subscr_update_aud_by_id(dbc, id,
 		mk_aud_3g(OSMO_AUTH_ALG_MILENAGE,
 			  "CededEffacedAceFacedBadFadedBeef", false,
 			  "BeefedCafeFaceAcedAddedDecadeFee", 5)),
 		0);
-	ASSERT_SEL_AUD(imsi0, 1, id);
+	ASSERT_SEL_AUD(imsi0, 0, id);
 
 	comment("Remove 3G auth data");
 
 	ASSERT_RC(db_subscr_update_aud_by_id(dbc, id,
 		mk_aud_3g(OSMO_AUTH_ALG_NONE, NULL, false, NULL, 0)),
 		0);
-	ASSERT_SEL_AUD(imsi0, -1, id);
+	ASSERT_SEL_AUD(imsi0, -ENOENT, id);
 
 	/* Removing nothing results in -ENOENT */
 	ASSERT_RC(db_subscr_update_aud_by_id(dbc, id,
@@ -561,14 +561,14 @@
 			  "CededEffacedAceFacedBadFadedBeef", false,
 			  "BeefedCafeFaceAcedAddedDecadeFee", 5)),
 		0);
-	ASSERT_SEL_AUD(imsi0, 1, id);
+	ASSERT_SEL_AUD(imsi0, 0, id);
 
 	ASSERT_RC(db_subscr_update_aud_by_id(dbc, id,
 		mk_aud_3g(OSMO_AUTH_ALG_NONE,
 			  "asdfasdfasd", false,
 			  "asdfasdfasdf", 99999)),
 		0);
-	ASSERT_SEL_AUD(imsi0, -1, id);
+	ASSERT_SEL_AUD(imsi0, -ENOENT, id);
 
 
 	comment("Set auth data, 2G and 3G");
@@ -581,7 +581,7 @@
 			  "BeefedCafeFaceAcedAddedDecadeFee", false,
 			  "DeafBeddedBabeAcceededFadedDecaf", 5)),
 		0);
-	ASSERT_SEL_AUD(imsi0, 1, id);
+	ASSERT_SEL_AUD(imsi0, 0, id);
 
 
 	comment("Set invalid auth data");
@@ -589,36 +589,36 @@
 	ASSERT_RC(db_subscr_update_aud_by_id(dbc, id,
 		mk_aud_2g(99999, "f000000000000f00000000000f000000")),
 		-EINVAL);
-	ASSERT_SEL_AUD(imsi0, 1, id);
+	ASSERT_SEL_AUD(imsi0, 0, id);
 
 	ASSERT_RC(db_subscr_update_aud_by_id(dbc, id,
 		mk_aud_2g(OSMO_AUTH_ALG_XOR, "f000000000000f00000000000f000000f00000000")),
 		-EINVAL);
-	ASSERT_SEL_AUD(imsi0, 1, id);
+	ASSERT_SEL_AUD(imsi0, 0, id);
 
 	ASSERT_RC(db_subscr_update_aud_by_id(dbc, id,
 		mk_aud_2g(OSMO_AUTH_ALG_XOR, "f00")),
 		-EINVAL);
-	ASSERT_SEL_AUD(imsi0, 1, id);
+	ASSERT_SEL_AUD(imsi0, 0, id);
 
 	ASSERT_RC(db_subscr_update_aud_by_id(dbc, id,
 		mk_aud_2g(OSMO_AUTH_ALG_MILENAGE, "0123456789abcdef0123456789abcdef")),
 		-EINVAL);
-	ASSERT_SEL_AUD(imsi0, 1, id);
+	ASSERT_SEL_AUD(imsi0, 0, id);
 
 	ASSERT_RC(db_subscr_update_aud_by_id(dbc, id,
 		mk_aud_3g(OSMO_AUTH_ALG_MILENAGE,
 			  "0f000000000000f00000000000f000000", false,
 			  "f000000000000f00000000000f000000", 5)),
 		-EINVAL);
-	ASSERT_SEL_AUD(imsi0, 1, id);
+	ASSERT_SEL_AUD(imsi0, 0, id);
 
 	ASSERT_RC(db_subscr_update_aud_by_id(dbc, id,
 		mk_aud_3g(OSMO_AUTH_ALG_MILENAGE,
 			  "f000000000000f00000000000f000000", false,
 			  "000000000000f00000000000f000000", 5)),
 		-EINVAL);
-	ASSERT_SEL_AUD(imsi0, 1, id);
+	ASSERT_SEL_AUD(imsi0, 0, id);
 
 	ASSERT_RC(db_subscr_update_aud_by_id(dbc, id,
 		mk_aud_3g(OSMO_AUTH_ALG_MILENAGE,
@@ -626,21 +626,21 @@
 			  "f000000000000f00000000000f000000",
 			  OSMO_MILENAGE_IND_BITLEN_MAX + 1)),
 		-EINVAL);
-	ASSERT_SEL_AUD(imsi0, 1, id);
+	ASSERT_SEL_AUD(imsi0, 0, id);
 
 	ASSERT_RC(db_subscr_update_aud_by_id(dbc, id,
 		mk_aud_3g(OSMO_AUTH_ALG_MILENAGE,
 			  "X000000000000f00000000000f000000", false,
 			  "f000000000000f00000000000f000000", 5)),
 		-EINVAL);
-	ASSERT_SEL_AUD(imsi0, 1, id);
+	ASSERT_SEL_AUD(imsi0, 0, id);
 
 	ASSERT_RC(db_subscr_update_aud_by_id(dbc, id,
 		mk_aud_3g(OSMO_AUTH_ALG_MILENAGE,
 			  "f000000000000f00000000000f000000", false,
 			  "f000000000000 f00000000000 f000000", 5)),
 		-EINVAL);
-	ASSERT_SEL_AUD(imsi0, 1, id);
+	ASSERT_SEL_AUD(imsi0, 0, id);
 
 	comment("Delete subscriber");
 
@@ -656,7 +656,7 @@
 	/* For this test to work, we want to get the same subscriber ID back,
 	 * and make sure there are no auth data leftovers for this ID. */
 	OSMO_ASSERT(id == g_subscr.id);
-	ASSERT_SEL_AUD(imsi0, -1, id);
+	ASSERT_SEL_AUD(imsi0, -ENOENT, id);
 
 	ASSERT_RC(db_subscr_delete_by_id(dbc, id), 0);
 	ASSERT_SEL(imsi, imsi0, -ENOENT);
diff --git a/tests/db/db_test.err b/tests/db/db_test.err
index 5d3ab5f..4813ea6 100644
--- a/tests/db/db_test.err
+++ b/tests/db/db_test.err
@@ -716,7 +716,7 @@
 
 --- Get auth data for non-existent subscriber
 
-db_get_auth_data(dbc, unknown_imsi, &g_aud2g, &g_aud3g, &g_id) --> 0
+db_get_auth_data(dbc, unknown_imsi, &g_aud2g, &g_aud3g, &g_id) --> -2
 DAUC IMSI='999999999': No such subscriber
 
 
@@ -731,7 +731,7 @@
   .imsi = '123456789000000',
 }
 
-db_get_auth_data(dbc, imsi0, &g_aud2g, &g_aud3g, &g_id) --> -1
+db_get_auth_data(dbc, imsi0, &g_aud2g, &g_aud3g, &g_id) --> -2
 DAUC IMSI='123456789000000': No 2G Auth Data
 DAUC IMSI='123456789000000': No 3G Auth Data
 
@@ -741,7 +741,7 @@
 
 db_subscr_update_aud_by_id(dbc, id, mk_aud_2g(OSMO_AUTH_ALG_COMP128v1, "0123456789abcdef0123456789abcdef")) --> 0
 
-db_get_auth_data(dbc, imsi0, &g_aud2g, &g_aud3g, &g_id) --> 1
+db_get_auth_data(dbc, imsi0, &g_aud2g, &g_aud3g, &g_id) --> 0
 DAUC IMSI='123456789000000': No 3G Auth Data
 
 2G: struct osmo_sub_auth_data {
@@ -753,7 +753,7 @@
 
 db_subscr_update_aud_by_id(dbc, id, mk_aud_2g(OSMO_AUTH_ALG_COMP128v1, "0123456789abcdef0123456789abcdef")) --> 0
 
-db_get_auth_data(dbc, imsi0, &g_aud2g, &g_aud3g, &g_id) --> 1
+db_get_auth_data(dbc, imsi0, &g_aud2g, &g_aud3g, &g_id) --> 0
 DAUC IMSI='123456789000000': No 3G Auth Data
 
 2G: struct osmo_sub_auth_data {
@@ -765,7 +765,7 @@
 
 db_subscr_update_aud_by_id(dbc, id, mk_aud_2g(OSMO_AUTH_ALG_COMP128v2, "BeadedBeeAced1EbbedDefacedFacade")) --> 0
 
-db_get_auth_data(dbc, imsi0, &g_aud2g, &g_aud3g, &g_id) --> 1
+db_get_auth_data(dbc, imsi0, &g_aud2g, &g_aud3g, &g_id) --> 0
 DAUC IMSI='123456789000000': No 3G Auth Data
 
 2G: struct osmo_sub_auth_data {
@@ -777,7 +777,7 @@
 
 db_subscr_update_aud_by_id(dbc, id, mk_aud_2g(OSMO_AUTH_ALG_COMP128v3, "DeafBeddedBabeAcceededFadedDecaf")) --> 0
 
-db_get_auth_data(dbc, imsi0, &g_aud2g, &g_aud3g, &g_id) --> 1
+db_get_auth_data(dbc, imsi0, &g_aud2g, &g_aud3g, &g_id) --> 0
 DAUC IMSI='123456789000000': No 3G Auth Data
 
 2G: struct osmo_sub_auth_data {
@@ -789,7 +789,7 @@
 
 db_subscr_update_aud_by_id(dbc, id, mk_aud_2g(OSMO_AUTH_ALG_XOR, "CededEffacedAceFacedBadFadedBeef")) --> 0
 
-db_get_auth_data(dbc, imsi0, &g_aud2g, &g_aud3g, &g_id) --> 1
+db_get_auth_data(dbc, imsi0, &g_aud2g, &g_aud3g, &g_id) --> 0
 DAUC IMSI='123456789000000': No 3G Auth Data
 
 2G: struct osmo_sub_auth_data {
@@ -804,7 +804,7 @@
 
 db_subscr_update_aud_by_id(dbc, id, mk_aud_2g(OSMO_AUTH_ALG_NONE, NULL)) --> 0
 
-db_get_auth_data(dbc, imsi0, &g_aud2g, &g_aud3g, &g_id) --> -1
+db_get_auth_data(dbc, imsi0, &g_aud2g, &g_aud3g, &g_id) --> -2
 DAUC IMSI='123456789000000': No 2G Auth Data
 DAUC IMSI='123456789000000': No 3G Auth Data
 
@@ -813,7 +813,7 @@
 
 db_subscr_update_aud_by_id(dbc, id, mk_aud_2g(OSMO_AUTH_ALG_XOR, "CededEffacedAceFacedBadFadedBeef")) --> 0
 
-db_get_auth_data(dbc, imsi0, &g_aud2g, &g_aud3g, &g_id) --> 1
+db_get_auth_data(dbc, imsi0, &g_aud2g, &g_aud3g, &g_id) --> 0
 DAUC IMSI='123456789000000': No 3G Auth Data
 
 2G: struct osmo_sub_auth_data {
@@ -825,7 +825,7 @@
 
 db_subscr_update_aud_by_id(dbc, id, mk_aud_2g(OSMO_AUTH_ALG_NONE, "f000000000000f00000000000f000000")) --> 0
 
-db_get_auth_data(dbc, imsi0, &g_aud2g, &g_aud3g, &g_id) --> -1
+db_get_auth_data(dbc, imsi0, &g_aud2g, &g_aud3g, &g_id) --> -2
 DAUC IMSI='123456789000000': No 2G Auth Data
 DAUC IMSI='123456789000000': No 3G Auth Data
 
@@ -835,7 +835,7 @@
 
 db_subscr_update_aud_by_id(dbc, id, mk_aud_3g(OSMO_AUTH_ALG_MILENAGE, "BeefedCafeFaceAcedAddedDecadeFee", true, "C01ffedC1cadaeAc1d1f1edAcac1aB0a", 5)) --> 0
 
-db_get_auth_data(dbc, imsi0, &g_aud2g, &g_aud3g, &g_id) --> 1
+db_get_auth_data(dbc, imsi0, &g_aud2g, &g_aud3g, &g_id) --> 0
 DAUC IMSI='123456789000000': No 2G Auth Data
 
 2G: none
@@ -851,7 +851,7 @@
 
 db_subscr_update_aud_by_id(dbc, id, mk_aud_3g(OSMO_AUTH_ALG_MILENAGE, "BeefedCafeFaceAcedAddedDecadeFee", true, "C01ffedC1cadaeAc1d1f1edAcac1aB0a", 5)) --> 0
 
-db_get_auth_data(dbc, imsi0, &g_aud2g, &g_aud3g, &g_id) --> 1
+db_get_auth_data(dbc, imsi0, &g_aud2g, &g_aud3g, &g_id) --> 0
 DAUC IMSI='123456789000000': No 2G Auth Data
 
 2G: none
@@ -867,7 +867,7 @@
 
 db_subscr_update_aud_by_id(dbc, id, mk_aud_3g(OSMO_AUTH_ALG_MILENAGE, "Deaf0ff1ceD0d0DabbedD1ced1ceF00d", true, "F1bbed0afD0eF0bD0ffed0ddF1fe0b0e", 0)) --> 0
 
-db_get_auth_data(dbc, imsi0, &g_aud2g, &g_aud3g, &g_id) --> 1
+db_get_auth_data(dbc, imsi0, &g_aud2g, &g_aud3g, &g_id) --> 0
 DAUC IMSI='123456789000000': No 2G Auth Data
 
 2G: none
@@ -882,7 +882,7 @@
 
 db_subscr_update_aud_by_id(dbc, id, mk_aud_3g(OSMO_AUTH_ALG_MILENAGE, "BeefedCafeFaceAcedAddedDecadeFee", false, "DeafBeddedBabeAcceededFadedDecaf", OSMO_MILENAGE_IND_BITLEN_MAX)) --> 0
 
-db_get_auth_data(dbc, imsi0, &g_aud2g, &g_aud3g, &g_id) --> 1
+db_get_auth_data(dbc, imsi0, &g_aud2g, &g_aud3g, &g_id) --> 0
 DAUC IMSI='123456789000000': No 2G Auth Data
 
 2G: none
@@ -898,7 +898,7 @@
 
 db_subscr_update_aud_by_id(dbc, id, mk_aud_3g(OSMO_AUTH_ALG_MILENAGE, "CededEffacedAceFacedBadFadedBeef", false, "BeefedCafeFaceAcedAddedDecadeFee", 5)) --> 0
 
-db_get_auth_data(dbc, imsi0, &g_aud2g, &g_aud3g, &g_id) --> 1
+db_get_auth_data(dbc, imsi0, &g_aud2g, &g_aud3g, &g_id) --> 0
 DAUC IMSI='123456789000000': No 2G Auth Data
 
 2G: none
@@ -917,7 +917,7 @@
 
 db_subscr_update_aud_by_id(dbc, id, mk_aud_3g(OSMO_AUTH_ALG_NONE, NULL, false, NULL, 0)) --> 0
 
-db_get_auth_data(dbc, imsi0, &g_aud2g, &g_aud3g, &g_id) --> -1
+db_get_auth_data(dbc, imsi0, &g_aud2g, &g_aud3g, &g_id) --> -2
 DAUC IMSI='123456789000000': No 2G Auth Data
 DAUC IMSI='123456789000000': No 3G Auth Data
 
@@ -926,7 +926,7 @@
 
 db_subscr_update_aud_by_id(dbc, id, mk_aud_3g(OSMO_AUTH_ALG_MILENAGE, "CededEffacedAceFacedBadFadedBeef", false, "BeefedCafeFaceAcedAddedDecadeFee", 5)) --> 0
 
-db_get_auth_data(dbc, imsi0, &g_aud2g, &g_aud3g, &g_id) --> 1
+db_get_auth_data(dbc, imsi0, &g_aud2g, &g_aud3g, &g_id) --> 0
 DAUC IMSI='123456789000000': No 2G Auth Data
 
 2G: none
@@ -942,7 +942,7 @@
 
 db_subscr_update_aud_by_id(dbc, id, mk_aud_3g(OSMO_AUTH_ALG_NONE, "asdfasdfasd", false, "asdfasdfasdf", 99999)) --> 0
 
-db_get_auth_data(dbc, imsi0, &g_aud2g, &g_aud3g, &g_id) --> -1
+db_get_auth_data(dbc, imsi0, &g_aud2g, &g_aud3g, &g_id) --> -2
 DAUC IMSI='123456789000000': No 2G Auth Data
 DAUC IMSI='123456789000000': No 3G Auth Data
 
@@ -954,7 +954,7 @@
 
 db_subscr_update_aud_by_id(dbc, id, mk_aud_3g(OSMO_AUTH_ALG_MILENAGE, "BeefedCafeFaceAcedAddedDecadeFee", false, "DeafBeddedBabeAcceededFadedDecaf", 5)) --> 0
 
-db_get_auth_data(dbc, imsi0, &g_aud2g, &g_aud3g, &g_id) --> 1
+db_get_auth_data(dbc, imsi0, &g_aud2g, &g_aud3g, &g_id) --> 0
 
 2G: struct osmo_sub_auth_data {
   .type = GSM,
@@ -977,7 +977,7 @@
 db_subscr_update_aud_by_id(dbc, id, mk_aud_2g(99999, "f000000000000f00000000000f000000")) --> -EINVAL
 DAUC Cannot update auth tokens: Unknown auth algo: 99999
 
-db_get_auth_data(dbc, imsi0, &g_aud2g, &g_aud3g, &g_id) --> 1
+db_get_auth_data(dbc, imsi0, &g_aud2g, &g_aud3g, &g_id) --> 0
 
 2G: struct osmo_sub_auth_data {
   .type = GSM,
@@ -997,7 +997,7 @@
 db_subscr_update_aud_by_id(dbc, id, mk_aud_2g(OSMO_AUTH_ALG_XOR, "f000000000000f00000000000f000000f00000000")) --> -EINVAL
 DAUC Cannot update auth tokens: Invalid KI: 'f000000000000f00000000000f000000f00000000'
 
-db_get_auth_data(dbc, imsi0, &g_aud2g, &g_aud3g, &g_id) --> 1
+db_get_auth_data(dbc, imsi0, &g_aud2g, &g_aud3g, &g_id) --> 0
 
 2G: struct osmo_sub_auth_data {
   .type = GSM,
@@ -1017,7 +1017,7 @@
 db_subscr_update_aud_by_id(dbc, id, mk_aud_2g(OSMO_AUTH_ALG_XOR, "f00")) --> -EINVAL
 DAUC Cannot update auth tokens: Invalid KI: 'f00'
 
-db_get_auth_data(dbc, imsi0, &g_aud2g, &g_aud3g, &g_id) --> 1
+db_get_auth_data(dbc, imsi0, &g_aud2g, &g_aud3g, &g_id) --> 0
 
 2G: struct osmo_sub_auth_data {
   .type = GSM,
@@ -1037,7 +1037,7 @@
 db_subscr_update_aud_by_id(dbc, id, mk_aud_2g(OSMO_AUTH_ALG_MILENAGE, "0123456789abcdef0123456789abcdef")) --> -EINVAL
 DAUC Cannot update auth tokens: auth algo not suited for 2G: MILENAGE
 
-db_get_auth_data(dbc, imsi0, &g_aud2g, &g_aud3g, &g_id) --> 1
+db_get_auth_data(dbc, imsi0, &g_aud2g, &g_aud3g, &g_id) --> 0
 
 2G: struct osmo_sub_auth_data {
   .type = GSM,
@@ -1057,7 +1057,7 @@
 db_subscr_update_aud_by_id(dbc, id, mk_aud_3g(OSMO_AUTH_ALG_MILENAGE, "0f000000000000f00000000000f000000", false, "f000000000000f00000000000f000000", 5)) --> -EINVAL
 DAUC Cannot update auth tokens: Invalid OP/OPC: '0f000000000000f00000000000f000000'
 
-db_get_auth_data(dbc, imsi0, &g_aud2g, &g_aud3g, &g_id) --> 1
+db_get_auth_data(dbc, imsi0, &g_aud2g, &g_aud3g, &g_id) --> 0
 
 2G: struct osmo_sub_auth_data {
   .type = GSM,
@@ -1077,7 +1077,7 @@
 db_subscr_update_aud_by_id(dbc, id, mk_aud_3g(OSMO_AUTH_ALG_MILENAGE, "f000000000000f00000000000f000000", false, "000000000000f00000000000f000000", 5)) --> -EINVAL
 DAUC Cannot update auth tokens: Invalid K: '000000000000f00000000000f000000'
 
-db_get_auth_data(dbc, imsi0, &g_aud2g, &g_aud3g, &g_id) --> 1
+db_get_auth_data(dbc, imsi0, &g_aud2g, &g_aud3g, &g_id) --> 0
 
 2G: struct osmo_sub_auth_data {
   .type = GSM,
@@ -1097,7 +1097,7 @@
 db_subscr_update_aud_by_id(dbc, id, mk_aud_3g(OSMO_AUTH_ALG_MILENAGE, "f000000000000f00000000000f000000", false, "f000000000000f00000000000f000000", OSMO_MILENAGE_IND_BITLEN_MAX + 1)) --> -EINVAL
 DAUC Cannot update auth tokens: Invalid ind_bitlen: 29
 
-db_get_auth_data(dbc, imsi0, &g_aud2g, &g_aud3g, &g_id) --> 1
+db_get_auth_data(dbc, imsi0, &g_aud2g, &g_aud3g, &g_id) --> 0
 
 2G: struct osmo_sub_auth_data {
   .type = GSM,
@@ -1117,7 +1117,7 @@
 db_subscr_update_aud_by_id(dbc, id, mk_aud_3g(OSMO_AUTH_ALG_MILENAGE, "X000000000000f00000000000f000000", false, "f000000000000f00000000000f000000", 5)) --> -EINVAL
 DAUC Cannot update auth tokens: Invalid OP/OPC: 'X000000000000f00000000000f000000'
 
-db_get_auth_data(dbc, imsi0, &g_aud2g, &g_aud3g, &g_id) --> 1
+db_get_auth_data(dbc, imsi0, &g_aud2g, &g_aud3g, &g_id) --> 0
 
 2G: struct osmo_sub_auth_data {
   .type = GSM,
@@ -1137,7 +1137,7 @@
 db_subscr_update_aud_by_id(dbc, id, mk_aud_3g(OSMO_AUTH_ALG_MILENAGE, "f000000000000f00000000000f000000", false, "f000000000000 f00000000000 f000000", 5)) --> -EINVAL
 DAUC Cannot update auth tokens: Invalid K: 'f000000000000 f00000000000 f000000'
 
-db_get_auth_data(dbc, imsi0, &g_aud2g, &g_aud3g, &g_id) --> 1
+db_get_auth_data(dbc, imsi0, &g_aud2g, &g_aud3g, &g_id) --> 0
 
 2G: struct osmo_sub_auth_data {
   .type = GSM,
@@ -1179,7 +1179,7 @@
   .imsi = '123456789000000',
 }
 
-db_get_auth_data(dbc, imsi0, &g_aud2g, &g_aud3g, &g_id) --> -1
+db_get_auth_data(dbc, imsi0, &g_aud2g, &g_aud3g, &g_id) --> -2
 DAUC IMSI='123456789000000': No 2G Auth Data
 DAUC IMSI='123456789000000': No 3G Auth Data
 

-- 
To view, visit https://gerrit.osmocom.org/4186
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I006f471962bdad95d00a3a4c41a28ebbc9740884
Gerrit-PatchSet: 3
Gerrit-Project: osmo-hlr
Gerrit-Branch: master
Gerrit-Owner: Neels Hofmeyr <nhofmeyr at sysmocom.de>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Neels Hofmeyr <nhofmeyr at sysmocom.de>


More information about the gerrit-log mailing list