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