vty: disable password encryption, remove dependency to lcrypt
diff --git a/src/vty/command.c b/src/vty/command.c
index b6fd2ad..f424262 100644
--- a/src/vty/command.c
+++ b/src/vty/command.c
@@ -2705,11 +2705,13 @@
free(host.password);
host.password = NULL;
+#ifdef VTY_CRYPT_PW
if (host.encrypt) {
if (host.password_encrypt)
free(host.password_encrypt);
host.password_encrypt = strdup(zencrypt(argv[0]));
} else
+#endif
host.password = strdup(argv[0]);
return CMD_SUCCESS;
@@ -2764,11 +2766,13 @@
host.enable = NULL;
/* Plain password input. */
+#ifdef VTY_CRYPT_PW
if (host.encrypt) {
if (host.enable_encrypt)
free(host.enable_encrypt);
host.enable_encrypt = strdup(zencrypt(argv[0]));
} else
+#endif
host.enable = strdup(argv[0]);
return CMD_SUCCESS;
@@ -2799,6 +2803,7 @@
return CMD_SUCCESS;
}
+#ifdef VTY_CRYPT_PW
DEFUN(service_password_encrypt,
service_password_encrypt_cmd,
"service password-encryption",
@@ -2843,6 +2848,7 @@
return CMD_SUCCESS;
}
+#endif
DEFUN(config_terminal_length, config_terminal_length_cmd,
"terminal length <0-512>",
@@ -3390,8 +3396,10 @@
install_element(CONFIG_NODE, &enable_password_text_cmd);
install_element(CONFIG_NODE, &no_enable_password_cmd);
+#ifdef VTY_CRYPT_PW
install_element(CONFIG_NODE, &service_password_encrypt_cmd);
install_element(CONFIG_NODE, &no_service_password_encrypt_cmd);
+#endif
install_element(CONFIG_NODE, &banner_motd_default_cmd);
install_element(CONFIG_NODE, &banner_motd_file_cmd);
install_element(CONFIG_NODE, &no_banner_motd_cmd);
diff --git a/src/vty/vty.c b/src/vty/vty.c
index 370d1f7..ca6fff7 100644
--- a/src/vty/vty.c
+++ b/src/vty/vty.c
@@ -75,9 +75,11 @@
switch (vty->node) {
case AUTH_NODE:
+#ifdef VTY_CRYPT_PW
if (host.encrypt)
passwd = host.password_encrypt;
else
+#endif
passwd = host.password;
if (host.advanced)
next_node = host.enable ? VIEW_NODE : ENABLE_NODE;
@@ -85,18 +87,22 @@
next_node = VIEW_NODE;
break;
case AUTH_ENABLE_NODE:
+#ifdef VTY_CRYPT_PW
if (host.encrypt)
passwd = host.enable_encrypt;
else
+#endif
passwd = host.enable;
next_node = ENABLE_NODE;
break;
}
if (passwd) {
+#ifdef VTY_CRYPT_PW
if (host.encrypt)
fail = strcmp(crypt(buf, passwd), passwd);
else
+#endif
fail = strcmp(buf, passwd);
} else
fail = 1;