[MERGED] openbsc[master]: Add VTY command to immediately expire user (set expire_lu to...

Keith Whyte gerrit-no-reply at lists.osmocom.org
Mon Jan 23 20:34:59 UTC 2017


Keith Whyte has submitted this change and it was merged.

Change subject: Add VTY command to immediately expire user (set expire_lu to now)
......................................................................


Add VTY command to immediately expire user (set expire_lu to now)

Change-Id: I676c84350a7afc963bc6bb4c46c60e5ac3eee67e
---
M openbsc/src/libmsc/vty_interface_layer3.c
1 file changed, 24 insertions(+), 0 deletions(-)

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



diff --git a/openbsc/src/libmsc/vty_interface_layer3.c b/openbsc/src/libmsc/vty_interface_layer3.c
index 490d794..11d9022 100644
--- a/openbsc/src/libmsc/vty_interface_layer3.c
+++ b/openbsc/src/libmsc/vty_interface_layer3.c
@@ -512,6 +512,29 @@
 	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 @@
 	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);

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I676c84350a7afc963bc6bb4c46c60e5ac3eee67e
Gerrit-PatchSet: 2
Gerrit-Project: openbsc
Gerrit-Branch: master
Gerrit-Owner: Keith Whyte <keith at rhizomatica.org>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Keith Whyte <keith at rhizomatica.org>
Gerrit-Reviewer: Neels Hofmeyr <nhofmeyr at sysmocom.de>


More information about the gerrit-log mailing list