summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/command.c28
-rw-r--r--lib/command.h4
2 files changed, 16 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;
diff --git a/lib/command.h b/lib/command.h
index 9ba53e0907..8d9c39b0ea 100644
--- a/lib/command.h
+++ b/lib/command.h
@@ -376,6 +376,10 @@ struct cmd_node {
#define CONF_BACKUP_EXT ".sav"
+/* Command warnings. */
+#define NO_PASSWD_CMD_WARNING \
+ "Please be aware that removing the password is a security risk and you should think twice about this command.\n"
+
/* IPv4 only machine should not accept IPv6 address for peer's IP
address. So we replace VTY command string like below. */
#define NEIGHBOR_ADDR_STR "Neighbor address\nIPv6 address\n"