8399d83
diff -up cups-1.4.4/cups/usersys.c.getpass cups-1.4.4/cups/usersys.c
8399d83
--- cups-1.4.4/cups/usersys.c.getpass	2010-03-30 23:07:33.000000000 +0100
8399d83
+++ cups-1.4.4/cups/usersys.c	2010-06-18 09:38:08.368096897 +0100
8399d83
@@ -41,6 +41,8 @@
cf5e76c
 #include "globals.h"
cf5e76c
 #include <stdlib.h>
cf5e76c
 #include <sys/stat.h>
cf5e76c
+#include <termios.h>
7b0f973
+#include <signal.h>
cf5e76c
 #ifdef WIN32
cf5e76c
 #  include <windows.h>
8399d83
 #else
8399d83
@@ -406,7 +408,29 @@ _cupsGetPassword(const char *prompt)	/* 
8399d83
   * Use the standard getpass function to get a password from the console.
8399d83
   */
8399d83
 
cf5e76c
-  return (getpass(prompt));
cf5e76c
+  static char password[100];
7b0f973
+  struct termios oldtio, newtio;
7b0f973
+  sigset_t oldset, newset;
cf5e76c
+  int nread;
7b0f973
+  sigprocmask (SIG_BLOCK, NULL, &newset);
7b0f973
+  sigaddset (&newset, SIGINT);
7b0f973
+  sigaddset (&newset, SIGTSTP);
7b0f973
+  sigprocmask (SIG_BLOCK, &newset, &oldset);
7b0f973
+  tcgetattr (STDIN_FILENO, &oldtio);
7b0f973
+  newtio = oldtio;
7b0f973
+  newtio.c_lflag &= ~ECHO;
7b0f973
+  tcsetattr (STDIN_FILENO, TCSAFLUSH, &newtio);
cf5e76c
+  fputs (prompt, stdout);
cf5e76c
+  fflush (stdout);
cf5e76c
+  nread = read (STDIN_FILENO, password, sizeof (password));
7b0f973
+  tcsetattr (STDIN_FILENO, TCSAFLUSH, &oldtio);
cf5e76c
+  fputc ('\n', stdout);
7b0f973
+  sigprocmask (SIG_SETMASK, &oldset, NULL);
cf5e76c
+  if (nread > 0)
cf5e76c
+    password[nread - 1] = '\0';
cf5e76c
+  else
cf5e76c
+    password[0] ='\0';
cf5e76c
+  return password;
cf5e76c
 #endif /* WIN32 */
8399d83
 }
cf5e76c