summaryrefslogtreecommitdiff
path: root/lib/command.c
diff options
context:
space:
mode:
authorPascal Mathis <mail@pascalmathis.com>2018-05-13 19:11:43 +0200
committerPascal Mathis <mail@pascalmathis.com>2018-05-13 19:11:43 +0200
commit4911ca9cab5d75b5031edb83b52423ed47798324 (patch)
tree17eee5c4c06d2dc8be13ac389ec72c469701c9be /lib/command.c
parenteb83f7ce842944518bac726c19eb071257a2ed56 (diff)
lib: Moved no-password warnings into header file
The warning string which appears when the users executes 'no (enable) password' was moved into command.h and declared as a constant named 'NO_PASSWD_CMD_WARNING'. This avoids duplicate code and makes it easy to change the warning message in all places at once. Signed-off-by: Pascal Mathis <mail@pascalmathis.com>
Diffstat (limited to 'lib/command.c')
-rw-r--r--lib/command.c20
1 files changed, 4 insertions, 16 deletions
diff --git a/lib/command.c b/lib/command.c
index 3761f444bc..0fa6bde334 100644
--- a/lib/command.c
+++ b/lib/command.c
@@ -1961,10 +1961,7 @@ DEFUN (no_config_password,
if (host.password) {
if (!vty_shell_serv(vty)) {
- vty_out(vty,
- "Please be aware that removing the password is "
- "a security risk and you should think twice "
- "about this command\n");
+ vty_out(vty, NO_PASSWD_CMD_WARNING);
warned = true;
}
XFREE(MTYPE_HOST, host.password);
@@ -1973,10 +1970,7 @@ DEFUN (no_config_password,
if (host.password_encrypt) {
if (!warned && !vty_shell_serv(vty))
- vty_out(vty,
- "Please be aware that removing the password is "
- "a security risk and you should think twice "
- "about this command\n");
+ vty_out(vty, NO_PASSWD_CMD_WARNING);
XFREE(MTYPE_HOST, host.password_encrypt);
}
host.password_encrypt = NULL;
@@ -2049,10 +2043,7 @@ DEFUN (no_config_enable_password,
if (host.enable) {
if (!vty_shell_serv(vty)) {
- vty_out(vty,
- "Please be aware that removing the password is "
- "a security risk and you should think twice "
- "about this command\n");
+ vty_out(vty, NO_PASSWD_CMD_WARNING);
warned = true;
}
XFREE(MTYPE_HOST, host.enable);
@@ -2061,10 +2052,7 @@ DEFUN (no_config_enable_password,
if (host.enable_encrypt) {
if (!warned && !vty_shell_serv(vty))
- vty_out(vty,
- "Please be aware that removing the password is "
- "a security risk and you should think twice "
- "about this command\n");
+ vty_out(vty, NO_PASSWD_CMD_WARNING);
XFREE(MTYPE_HOST, host.enable_encrypt);
}
host.enable_encrypt = NULL;