summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKeith <keith@rhizomatica.org>2017-01-18 17:09:33 +0100
committerKeith Whyte <keith@rhizomatica.org>2017-01-23 20:34:58 +0000
commitd32b6d13ed9dcd171b9ff723d1389dacaff98903 (patch)
treed4c7f2de4cbcd22630734a18a65518d03d290b68
parente610e700da088ba1c4e5f0478317040f236aaebb (diff)
Add VTY command to immediately expire user (set expire_lu to now)
-rw-r--r--openbsc/src/libmsc/vty_interface_layer3.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/openbsc/src/libmsc/vty_interface_layer3.c b/openbsc/src/libmsc/vty_interface_layer3.c
index 490d7946b..11d902226 100644
--- a/openbsc/src/libmsc/vty_interface_layer3.c
+++ b/openbsc/src/libmsc/vty_interface_layer3.c
@@ -512,6 +512,29 @@ DEFUN(ena_subscr_delete,
return CMD_SUCCESS;
}
+DEFUN(ena_subscr_expire,
+ ena_subscr_expire_cmd,
+ "subscriber " SUBSCR_TYPES " ID expire",
+ SUBSCR_HELP "Expire the subscriber Now\n")
+{
+ int rc;
+ struct gsm_network *gsmnet = gsmnet_from_vty(vty);
+ struct gsm_subscriber *subscr =
+ get_subscr_by_argv(gsmnet, argv[0], argv[1]);
+
+ if (!subscr) {
+ vty_out(vty, "%% No subscriber found for %s %s%s",
+ argv[0], argv[1], VTY_NEWLINE);
+ return CMD_WARNING;
+ }
+
+ subscr->expire_lu = time(0);
+ db_sync_subscriber(subscr);
+ subscr_put(subscr);
+
+ return CMD_SUCCESS;
+}
+
DEFUN(ena_subscr_authorized,
ena_subscr_authorized_cmd,
"subscriber " SUBSCR_TYPES " ID authorized (0|1)",
@@ -1143,6 +1166,7 @@ int bsc_vty_init_extra(void)
install_element_ve(&logging_fltr_imsi_cmd);
install_element(ENABLE_NODE, &ena_subscr_delete_cmd);
+ install_element(ENABLE_NODE, &ena_subscr_expire_cmd);
install_element(ENABLE_NODE, &ena_subscr_name_cmd);
install_element(ENABLE_NODE, &ena_subscr_extension_cmd);
install_element(ENABLE_NODE, &ena_subscr_authorized_cmd);