On Thu, Jun 28, 2001 at 02:32:02PM -0600, Barak Pearlmutter wrote: > PS If you want to patch xlassie to popen("ssh-askpass") under suitable > conditions, with a fallback, or to at least turn off echo, I'll > gladly incorporate the changes.
Patch below (requires the patch for #716520 to be applied as well). Best,
--- xlassie-1.8.orig/xlassie.c +++ xlassie-1.8/xlassie.c @@ -28,6 +28,7 @@ #include <pwd.h> #include <stdarg.h> #include <errno.h> +#include <termios.h> #include <X11/Xlib.h> #include <X11/Xutil.h> #include <X11/Xos.h> @@ -435,13 +436,25 @@ void usage(void) void ask_password() { - int i; + size_t i; + struct termios saved; + int got = tcgetattr(0, &saved); + if (got != -1) { + struct termios noecho = saved; + noecho.c_lflag &= ~ECHO; + tcsetattr(0, TCSADRAIN, &noecho); + } printf("Mail account password: "); - fgets(optList[PASSWORD].value, sizeof(opt_password), stdin); - i = strlen(optList[PASSWORD].value)-1; - if(optList[PASSWORD].value[i] == '\n') - optList[PASSWORD].value[i] = '\0'; + fflush(stdout); + i = getline(&optList[PASSWORD].value, &i, stdin); + if(optList[PASSWORD].value[i - 1] == '\n') { + putchar('\n'); + optList[PASSWORD].value[i - 1] = '\0'; + } + + if (got != -1) + tcsetattr(0, TCSADRAIN, &saved); } void parse_cmdline(int argc, char *argv[])
signature.asc
Description: PGP signature