X-Git-Url: http://git.pond.sub.org/?p=empserver;a=blobdiff_plain;f=src%2Fclient%2Fgetpass.c;h=b04ec7e504cf66b6e3b81de123e162347bc8d46f;hp=6e151f41e023551d748cbeb7ccb13df7862f41d5;hb=53b2271d1dba59ca9fbe470e1349ecc85692bd78;hpb=ea762c1f08981310cba20ac0242e156b40b2d7d0 diff --git a/src/client/getpass.c b/src/client/getpass.c index 6e151f41e..b04ec7e50 100644 --- a/src/client/getpass.c +++ b/src/client/getpass.c @@ -38,6 +38,8 @@ #include #ifdef _WIN32 #include +#else +#include #endif #endif #include "misc.h" @@ -62,7 +64,19 @@ set_echo_if_tty(int on) return -1; return 1; #else - return 0; + struct termios tcattr; + + if (tcgetattr(0, &tcattr) < 0) + return 0; + + if (on) + tcattr.c_lflag |= ECHO; + else + tcattr.c_lflag &= ~ECHO; + + if (tcsetattr(0, TCSAFLUSH, &tcattr) < 0) + return -1; + return 1; #endif } #endif /* !HAVE_GETPASS */