]> git.puffer.fish Git - matthieu/frr.git/commitdiff
lib: added `no password` command
authorJuergen Werner <pogojotz@gmx.net>
Wed, 22 Nov 2017 23:59:48 +0000 (00:59 +0100)
committerDonald Sharp <sharpd@cumulusnetworks.com>
Wed, 13 Dec 2017 12:38:24 +0000 (07:38 -0500)
Fixes: #1432
Signed-off-by: Juergen Werner <pogojotz@gmx.net>
doc/basic.texi
lib/command.c
vtysh/vtysh.c

index 05d72bc80f6e26155c8cb002acc7393528e8d3ee..54cad2555f72d83fd6f873f1d92ceb9159a26cd2 100644 (file)
@@ -72,7 +72,8 @@ Set hostname of the router.
 @end deffn
 
 @deffn Command {password @var{password}} {}
-Set password for vty interface.  If there is no password, a vty won't
+@deffnx Command {no password} {}
+Set/delete password for vty interface.  If there is no password, a vty won't
 accept connections.
 @end deffn
 
index 686795c10a21ec247bc0ffebc8449371151001f2..b857bb0e622ceacdd5011f81aa7c6f1c44c60a92 100644 (file)
@@ -1876,7 +1876,7 @@ DEFUN (config_no_hostname,
 DEFUN (config_password,
        password_cmd,
        "password [(8-8)] WORD",
-       "Assign the terminal connection password\n"
+       "Modify the terminal connection password\n"
        "Specifies a HIDDEN password will follow\n"
        "The password string\n")
 {
@@ -1916,6 +1916,23 @@ DEFUN (config_password,
        return CMD_SUCCESS;
 }
 
+/* VTY interface password delete. */
+DEFUN (no_config_password,
+       no_password_cmd,
+       "no password",
+       NO_STR
+       "Modify the terminal connection password\n")
+{
+       if (host.password)
+               XFREE(MTYPE_HOST, host.password);
+       host.password = NULL;
+       if (host.password_encrypt)
+               XFREE(MTYPE_HOST, host.password_encrypt);
+       host.password_encrypt = NULL;
+
+       return CMD_SUCCESS;
+}
+
 /* VTY enable password set. */
 DEFUN (config_enable_password,
        enable_password_cmd,
@@ -2647,6 +2664,7 @@ void cmd_init(int terminal)
 
        if (terminal > 0) {
                install_element(CONFIG_NODE, &password_cmd);
+               install_element(CONFIG_NODE, &no_password_cmd);
                install_element(CONFIG_NODE, &enable_password_cmd);
                install_element(CONFIG_NODE, &no_enable_password_cmd);
 
index d849d30e72f0d58abeed4baf836a09f828a22a05..e1af6fde9a855a41d72f3d3f30e310689699a272 100644 (file)
@@ -1905,7 +1905,7 @@ DEFUNSH(VTYSH_ALL, no_vtysh_service_password_encrypt,
 
 DEFUNSH(VTYSH_ALL, vtysh_config_password, vtysh_password_cmd,
        "password (8-8) WORD",
-       "Assign the terminal connection password\n"
+       "Modify the terminal connection password\n"
        "Specifies a HIDDEN password will follow\n"
        "dummy string \n"
        "The HIDDEN line password string\n")
@@ -1915,12 +1915,19 @@ DEFUNSH(VTYSH_ALL, vtysh_config_password, vtysh_password_cmd,
 
 DEFUNSH(VTYSH_ALL, vtysh_password_text, vtysh_password_text_cmd,
        "password LINE",
-       "Assign the terminal connection password\n"
+       "Modify the terminal connection password\n"
        "The UNENCRYPTED (cleartext) line password\n")
 {
        return CMD_SUCCESS;
 }
 
+DEFUNSH(VTYSH_ALL, no_vtysh_config_password, no_vtysh_password_cmd,
+       "no password", NO_STR
+       "Modify the terminal connection password\n")
+{
+       return CMD_SUCCESS;
+}
+
 DEFUNSH(VTYSH_ALL, vtysh_config_enable_password, vtysh_enable_password_cmd,
        "enable password (8-8) WORD",
        "Modify enable password parameters\n"
@@ -2987,6 +2994,7 @@ void vtysh_init_vty(void)
        install_element(CONFIG_NODE, &no_vtysh_service_password_encrypt_cmd);
 
        install_element(CONFIG_NODE, &vtysh_password_cmd);
+       install_element(CONFIG_NODE, &no_vtysh_password_cmd);
        install_element(CONFIG_NODE, &vtysh_password_text_cmd);
        install_element(CONFIG_NODE, &vtysh_enable_password_cmd);
        install_element(CONFIG_NODE, &vtysh_enable_password_text_cmd);