summaryrefslogtreecommitdiff
path: root/lib/command.c
diff options
context:
space:
mode:
authorQuentin Young <qlyoung@users.noreply.github.com>2018-05-14 11:01:19 -0400
committerGitHub <noreply@github.com>2018-05-14 11:01:19 -0400
commit62362d70aac9f70a2563ae7e5d4448b05c38d2da (patch)
treef4347321beabd402c87f4c6bd0558d4277a1a871 /lib/command.c
parentc02bcc728b9ffde5b23a484399e4e64d86fdb32f (diff)
parent4911ca9cab5d75b5031edb83b52423ed47798324 (diff)
Merge pull request #2223 from ppmathis/fix/no-password-warnings
lib: Improved warnings for 'no (enable) password'
Diffstat (limited to 'lib/command.c')
-rw-r--r--lib/command.c28
1 files changed, 12 insertions, 16 deletions
diff --git a/lib/command.c b/lib/command.c
index 69e301fcfa..0fa6bde334 100644
--- a/lib/command.c
+++ b/lib/command.c
@@ -1960,19 +1960,17 @@ DEFUN (no_config_password,
bool warned = false;
if (host.password) {
- vty_out(vty,
- "Please be aware that removing the password is a security risk and "
- "you should think twice about this command\n");
- warned = true;
+ if (!vty_shell_serv(vty)) {
+ vty_out(vty, NO_PASSWD_CMD_WARNING);
+ warned = true;
+ }
XFREE(MTYPE_HOST, host.password);
}
host.password = NULL;
if (host.password_encrypt) {
- if (!warned)
- vty_out(vty,
- "Please be aware that removing the password is a security risk "
- "and you should think twice about this command\n");
+ if (!warned && !vty_shell_serv(vty))
+ vty_out(vty, NO_PASSWD_CMD_WARNING);
XFREE(MTYPE_HOST, host.password_encrypt);
}
host.password_encrypt = NULL;
@@ -2044,19 +2042,17 @@ DEFUN (no_config_enable_password,
bool warned = false;
if (host.enable) {
- vty_out(vty,
- "Please be aware that removing the password is a security risk and "
- "you should think twice about this command\n");
- warned = true;
+ if (!vty_shell_serv(vty)) {
+ vty_out(vty, NO_PASSWD_CMD_WARNING);
+ warned = true;
+ }
XFREE(MTYPE_HOST, host.enable);
}
host.enable = NULL;
if (host.enable_encrypt) {
- if (!warned)
- vty_out(vty,
- "Please be aware that removing the password is a security risk "
- "and you should think twice about this command\n");
+ if (!warned && !vty_shell_serv(vty))
+ vty_out(vty, NO_PASSWD_CMD_WARNING);
XFREE(MTYPE_HOST, host.enable_encrypt);
}
host.enable_encrypt = NULL;