Use a prompt reflecting password or smart card pin

This commit is contained in:
Henrik Andersson 2017-08-15 10:48:35 +02:00
parent 8586cfc8cb
commit c07bfffabf

View File

@ -424,11 +424,22 @@ read_password(char *password, int size)
struct termios tios; struct termios tios;
RD_BOOL ret = False; RD_BOOL ret = False;
int istty = 0; int istty = 0;
const char *prompt;
char *p; char *p;
if (g_use_password_as_pin)
{
prompt = "Smart card PIN: ";
}
else
{
prompt = "Password: ";
}
if (tcgetattr(STDIN_FILENO, &tios) == 0) if (tcgetattr(STDIN_FILENO, &tios) == 0)
{ {
fprintf(stderr, "Password: "); fprintf(stderr, prompt);
tios.c_lflag &= ~ECHO; tios.c_lflag &= ~ECHO;
tcsetattr(STDIN_FILENO, TCSANOW, &tios); tcsetattr(STDIN_FILENO, TCSANOW, &tios);
istty = 1; istty = 1;