From 65608e0f8bbc0190cc1b7646f653e796c807f02b Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Tue, 27 Dec 2011 16:50:50 +0100 Subject: import cups from F16 --- cups-getpass.patch | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 cups-getpass.patch (limited to 'cups-getpass.patch') diff --git a/cups-getpass.patch b/cups-getpass.patch new file mode 100644 index 0000000..7b089a7 --- /dev/null +++ b/cups-getpass.patch @@ -0,0 +1,50 @@ +diff -up cups-1.5b1/cups/usersys.c.getpass cups-1.5b1/cups/usersys.c +--- cups-1.5b1/cups/usersys.c.getpass 2011-05-20 05:49:49.000000000 +0200 ++++ cups-1.5b1/cups/usersys.c 2011-05-24 15:41:33.000000000 +0200 +@@ -43,6 +43,8 @@ + #include "cups-private.h" + #include + #include ++#include ++#include + #ifdef WIN32 + # include + #else +@@ -501,13 +503,31 @@ _cupsGetPassword(const char *prompt) /* + * empty password is treated as canceling the authentication request. + */ + +- const char *password = getpass(prompt); +- /* Password string */ +- +- if (!password || !password[0]) +- return (NULL); +- else ++ static char password[100]; ++ struct termios oldtio, newtio; ++ sigset_t oldset, newset; ++ int nread; ++ 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); ++ fputs (prompt, stdout); ++ fflush (stdout); ++ nread = read (STDIN_FILENO, password, sizeof (password)); ++ tcsetattr (STDIN_FILENO, TCSAFLUSH, &oldtio); ++ fputc ('\n', stdout); ++ sigprocmask (SIG_SETMASK, &oldset, NULL); ++ if (nread > 0) ++ { ++ password[nread - 1] = '\0'; + return (password); ++ } ++ else ++ return (NULL); + #endif /* WIN32 */ + } + -- cgit