cups/cups-getpass.patch
Tim Waugh 8399d834ef - 1.4.4. Fixes several security vulnerabilities (bug #605399):
CVE-2010-0540, CVE-2010-0542, CVE-2010-1748. No longer need str3503,
    str3399, str3505, str3541, str3425p2 or CVE-2010-0302 patches.
- Fix lpd provides.
- Added comments for all sources and patches.
- Reset status after successful ipp job (bug #548219, STR #3460).
- Install udev rules in correct place (bug #530378).
- Removed unapplied gnutls-gcrypt-threads patch. Fixed typos in
    descriptions for lpd and php sub-packages.
- Add an SNMP query for Ricoh's device ID OID (STR #3552).
- Mark DNS-SD Device IDs that have been guessed at with "FZY:1;".
- Add an SNMP query for HP's device ID OID (STR #3552).
2010-06-18 10:42:26 +00:00

44 lines
1.3 KiB
Diff

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 @@
#include "globals.h"
#include <stdlib.h>
#include <sys/stat.h>
+#include <termios.h>
+#include <signal.h>
#ifdef WIN32
# include <windows.h>
#else
@@ -406,7 +408,29 @@ _cupsGetPassword(const char *prompt) /*
* Use the standard getpass function to get a password from the console.
*/
- return (getpass(prompt));
+ 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';
+ else
+ password[0] ='\0';
+ return password;
#endif /* WIN32 */
}