aboutsummaryrefslogtreecommitdiffstats
path: root/include/osmocom/vty
diff options
context:
space:
mode:
authorVadim Yanitskiy <vyanitskiy@sysmocom.de>2020-10-25 16:34:57 +0700
committerVadim Yanitskiy <vyanitskiy@sysmocom.de>2020-10-25 16:52:42 +0700
commit0a2d9bdfae78c9bfddc8cc838abaddc508f210f1 (patch)
tree11dd91497559a8f7540d4dca7177c95d340f2280 /include/osmocom/vty
parentf36b76211f8bae3f372f7202827a718e125706f1 (diff)
vty/command: fix: restrict the expert mode to the current session
Having the expert mode flag stored in the global 'host' structure was a bad idea, because this way it applies globally. In other words, if user Bob activates the expert mode in his dedicated session (e.g. a telnet connection), then not only him, but all other users would see the hidden commands in their VTYs. Moreover, if somebody deactivates the expert mode, it would also affect the Bob's VTY session. And finally, terminating a VTY session would not deactivate the expert mode. Let's move that flag from the global 'struct host' to 'struct vty' representing an individual VTY session, so then the expert mode would only affect the session where it was activated. In functions related to the XML VTY reference generation we don't have access to 'struct vty' (there may be no VTY session at all). Add two additional arguments to vty_dump_nodes(), indicating the global flag mask and a matching mode. This would allow to match the VTY commands in many different ways, e.g. one can dump hidden commands only, or all commands except the library specific ones. Change-Id: Iba13f0949061e3dadf9cf92829d15e97074fe4ad Related: SYS#4910
Diffstat (limited to 'include/osmocom/vty')
-rw-r--r--include/osmocom/vty/command.h3
-rw-r--r--include/osmocom/vty/vty.h3
2 files changed, 3 insertions, 3 deletions
diff --git a/include/osmocom/vty/command.h b/include/osmocom/vty/command.h
index eb7ee35e..b6088482 100644
--- a/include/osmocom/vty/command.h
+++ b/include/osmocom/vty/command.h
@@ -67,9 +67,6 @@ struct host {
/*! VTY application information */
const struct vty_app_info *app_info;
-
- /*! Whether the expert mode is enabled. */
- bool expert_mode;
};
/*! There are some command levels which called from command node. */
diff --git a/include/osmocom/vty/vty.h b/include/osmocom/vty/vty.h
index 6a82d7e3..d34433fa 100644
--- a/include/osmocom/vty/vty.h
+++ b/include/osmocom/vty/vty.h
@@ -165,6 +165,9 @@ struct vty {
/*! When reading from a config file, these are the indenting characters expected for children of
* the current VTY node. */
char *indent;
+
+ /*! Whether the expert mode is enabled. */
+ bool expert_mode;
};
/* Small macro to determine newline is newline only or linefeed needed. */