rpms/cups/FC-6 cups-getpass.patch,1.1,1.2

fedora-cvs-commits at redhat.com fedora-cvs-commits at redhat.com
Mon Nov 13 16:26:37 UTC 2006


Author: twaugh

Update of /cvs/dist/rpms/cups/FC-6
In directory cvs.devel.redhat.com:/tmp/cvs-serv25834

Modified Files:
	cups-getpass.patch 
Log Message:
Better getpass patch.

cups-getpass.patch:
 usersys.c |   26 +++++++++++++++++++++++++-
 1 files changed, 25 insertions(+), 1 deletion(-)

Index: cups-getpass.patch
===================================================================
RCS file: /cvs/dist/rpms/cups/FC-6/cups-getpass.patch,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- cups-getpass.patch	13 Nov 2006 16:00:29 -0000	1.1
+++ cups-getpass.patch	13 Nov 2006 16:26:35 -0000	1.2
@@ -1,30 +1,37 @@
 --- cups-1.2.6/cups/usersys.c.getpass	2006-08-29 16:51:19.000000000 +0100
-+++ cups-1.2.6/cups/usersys.c	2006-11-13 15:57:18.000000000 +0000
-@@ -46,6 +46,7 @@
++++ cups-1.2.6/cups/usersys.c	2006-11-13 16:19:32.000000000 +0000
+@@ -46,6 +46,8 @@
  #include "globals.h"
  #include <stdlib.h>
  #include <sys/stat.h>
 +#include <termios.h>
++#include <signal.h>
  #ifdef WIN32
  #  include <windows.h>
  #endif /* WIN32 */
-@@ -455,7 +456,23 @@
+@@ -455,7 +457,29 @@
  const char *				/* O - Password */
  _cupsGetPassword(const char *prompt)	/* I - Prompt string */
  {
 -  return (getpass(prompt));
 +  static char password[100];
-+  struct termios old, new;
++  struct termios oldtio, newtio;
++  sigset_t oldset, newset;
 +  int nread;
-+  tcgetattr (STDIN_FILENO, &old);
-+  new = old;
-+  new.c_lflag &= ~ECHO;
-+  tcsetattr (STDIN_FILENO, TCSAFLUSH, &new);
++  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, &old);
++  tcsetattr (STDIN_FILENO, TCSAFLUSH, &oldtio);
 +  fputc ('\n', stdout);
++  sigprocmask (SIG_SETMASK, &oldset, NULL);
 +  if (nread > 0)
 +    password[nread - 1] = '\0';
 +  else




More information about the fedora-cvs-commits mailing list