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