aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc/src/libmsc
diff options
context:
space:
mode:
authorNeels Hofmeyr <nhofmeyr@sysmocom.de>2016-03-30 11:22:27 +0200
committerHarald Welte <laforge@gnumonks.org>2016-03-31 11:56:29 +0200
commitf9b212fabd0d5c37dac9639fc9d9ecd73688e3a3 (patch)
tree39b0fe83d18acdb2d643ba0f86552c425c52328d /openbsc/src/libmsc
parentd617c5d3ac65b5090f787da3e2911fb6742f515c (diff)
MM Auth: introduce AUTH_ERROR constant.
Instead of using hardcoded -1 for errors, include -1 in the enum auth_action type; apply its use. In the mm_auth test, the string output changes from '(internal error)' to 'AUTH_ERROR', since now the proper enum value is used in auth_action_names[].
Diffstat (limited to 'openbsc/src/libmsc')
-rw-r--r--openbsc/src/libmsc/auth.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/openbsc/src/libmsc/auth.c b/openbsc/src/libmsc/auth.c
index 85123167b..99e3a243e 100644
--- a/openbsc/src/libmsc/auth.c
+++ b/openbsc/src/libmsc/auth.c
@@ -33,7 +33,7 @@
const struct value_string auth_action_names[] = {
#define AUTH_ACTION_STR(X) { X, #X }
- { -1, "(internal error)" }, /* soon to be fixed with an enum val */
+ AUTH_ACTION_STR(AUTH_ERROR),
AUTH_ACTION_STR(AUTH_NOT_AVAIL),
AUTH_ACTION_STR(AUTH_DO_AUTH_THEN_CIPH),
AUTH_ACTION_STR(AUTH_DO_CIPH),
@@ -93,7 +93,7 @@ int auth_get_tuple_for_subscr(struct gsm_auth_tuple *atuple,
if (rc < 0) {
LOGP(DMM, LOGL_NOTICE,
"No retrievable Ki for subscriber, skipping auth\n");
- return rc == -ENOENT ? AUTH_NOT_AVAIL : -1;
+ return rc == -ENOENT ? AUTH_NOT_AVAIL : AUTH_ERROR;
}
/* If possible, re-use the last tuple and skip auth */
@@ -114,7 +114,7 @@ int auth_get_tuple_for_subscr(struct gsm_auth_tuple *atuple,
if (RAND_bytes(atuple->rand, sizeof(atuple->rand)) != 1) {
LOGP(DMM, LOGL_NOTICE, "RAND_bytes failed, can't generate new auth tuple\n");
- return -1;
+ return AUTH_ERROR;
}
switch (ainfo.auth_algo) {