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

keith gerrit-no-reply at lists.osmocom.org
Wed Jan 18 16:10:04 UTC 2017


Review at  https://gerrit.osmocom.org/1623

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(-)


  git pull ssh://gerrit.osmocom.org:29418/openbsc refs/changes/23/1623/1

diff --git a/openbsc/src/libmsc/vty_interface_layer3.c b/openbsc/src/libmsc/vty_interface_layer3.c
index edece51..15909db 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)",
@@ -1144,6 +1167,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: newchange
Gerrit-Change-Id: I676c84350a7afc963bc6bb4c46c60e5ac3eee67e
Gerrit-PatchSet: 1
Gerrit-Project: openbsc
Gerrit-Branch: master
Gerrit-Owner: keith <keith at rhizomatica.org>


More information about the gerrit-log mailing list