diff options
author | Pablo Neira Ayuso <pablo@gnumonks.org> | 2011-05-03 22:44:39 +0200 |
---|---|---|
committer | Harald Welte <laforge@gnumonks.org> | 2011-05-04 11:03:55 +0200 |
commit | ef1e5870082d4e4f671c7a6db75345b364ad2cc3 (patch) | |
tree | a0c2c879a20406c434ada77cd6014c3e7b14e80d /openbsc/src/libmsc | |
parent | 6860c440719f0a2cde89ea18a43e495bfe9177e6 (diff) |
msc: bail out if subscriber VTY command fails
This patch adds several messages that would be displayed if:
* the Ki argument is missing.
* you pass an invalid Ki.
* the database fails to perform the operation (add/delete/update).
Before this patch, no messages were spotted on this errors.
I noticed this while adding Ki to the existing subscribers in the
nanoBTS setup: I introduced a wrong Ki but the VTY command line did
not report any error. A quick look at the database via sqlite
command confirmed that the new authkey information was not added.
Diffstat (limited to 'openbsc/src/libmsc')
-rw-r--r-- | openbsc/src/libmsc/vty_interface_layer3.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/openbsc/src/libmsc/vty_interface_layer3.c b/openbsc/src/libmsc/vty_interface_layer3.c index 2d3dd146b..6ac2c65c3 100644 --- a/openbsc/src/libmsc/vty_interface_layer3.c +++ b/openbsc/src/libmsc/vty_interface_layer3.c @@ -575,6 +575,8 @@ DEFUN(ena_subscr_a3a8, } else { /* Unknown method */ subscr_put(subscr); + vty_out(vty, "%% Unknown auth method %s%s", + alg_str, VTY_NEWLINE); return CMD_WARNING; } @@ -582,6 +584,8 @@ DEFUN(ena_subscr_a3a8, rc = hexparse(ki_str, ainfo.a3a8_ki, sizeof(ainfo.a3a8_ki)); if ((rc > maxlen) || (rc < minlen)) { subscr_put(subscr); + vty_out(vty, "%% Wrong Ki `%s'%s", + ki_str, VTY_NEWLINE); return CMD_WARNING; } ainfo.a3a8_ki_len = rc; @@ -589,6 +593,7 @@ DEFUN(ena_subscr_a3a8, ainfo.a3a8_ki_len = 0; if (minlen) { subscr_put(subscr); + vty_out(vty, "%% Missing Ki argument%s", VTY_NEWLINE); return CMD_WARNING; } } @@ -601,7 +606,11 @@ DEFUN(ena_subscr_a3a8, db_sync_lastauthtuple_for_subscr(NULL, subscr); subscr_put(subscr); - return rc ? CMD_WARNING : CMD_SUCCESS; + if (rc) { + vty_out(vty, "%% Operation has failed%s", VTY_NEWLINE); + return CMD_WARNING; + } + return CMD_SUCCESS; } DEFUN(subscriber_purge, |