Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

usersys.c:_cupsGetPassword() on various sysV systems AIX,HPUX.. not doing single char IO for password prompts #4750

Closed
michaelrsweet opened this issue Jan 2, 2016 · 4 comments
Milestone

Comments

@michaelrsweet
Copy link
Collaborator

Version: 2.1-current
CUPS.org User: gcscups

This applies to all versions of cups. When prompting for password its using 4 chars before accepting input instead of single char IO. Its wrong for at least AIX, HPUX and Solaris SunOS

I have a fix for this

@michaelrsweet
Copy link
Collaborator Author

CUPS.org User: gcscups

mark@zed> cat 0001-MG20160102-fix-getpass-for-hpux-aix-sun.patch
From 4613e0c59f5af46d05066d1e9b6bdffba3bea1af Mon Sep 17 00:00:00 2001
From: Mark Garrett mark.garrett@optus.com.au
Date: Sat, 2 Jan 2016 20:17:50 +1100
Subject: [PATCH] MG20160102 fix getpass for hpux,aix,sun


cups/usersys.c | 37 +++++++++++++++++++++++++++++++++++++
1 file changed, 37 insertions(+)

diff --git a/cups/usersys.c b/cups/usersys.c
index acf82db..b55415a 100644
--- a/cups/usersys.c
+++ b/cups/usersys.c
@@ -711,6 +711,43 @@ _cupsGetPassword(const char prompt) / I - Prompt string */
noecho = original;
noecho.c_lflag &= (tcflag_t)~(ICANON | ECHO | ECHOE | ISIG);

  • noecho.c_cc[VMIN] = 1;
  • noecho.c_cc[VTIME] = 0;
  • /* MacOSX and Linux have these set as 1,0 from get getattr above but for some OS which seem to be the sysV guys
  • * these are defaulted to various other values
  • * AIX 6.1.0.0
  • * ./getpass_aix
  • * original.c_cc[VMIN(4)]=4 original.c_cc[VTIME(5)]=255
  • * noecho.c_cc[VMIN(4)]=4 noecho.c_cc[VTIME(5)]=255
  • * MacOSX 10.9.1
  • * ./getpass_aix
  • * original.c_cc[VMIN(16)]=1 original.c_cc[VTIME(17)]=0
  • * noecho.c_cc[VMIN(16)]=1 noecho.c_cc[VTIME(17)]=0
  • * Password please:
  • * HP-UX 11i v3
  • * ./getpass_aix
  • * original.c_cc[VMIN(11)]=4 original.c_cc[VTIME(12)]=0
  • * noecho.c_cc[VMIN(11)]=4 noecho.c_cc[VTIME(12)]=0
  • * CentOS release 6.4
  • * ./getpass_aix
  • * original.c_cc[VMIN(6)]=1 original.c_cc[VTIME(5)]=0
  • * noecho.c_cc[VMIN(6)]=1 noecho.c_cc[VTIME(5)]=0
  • * Solaris SunOS vboxsol00 5.11 11.1 i86pc i386 i86pc
  • * ./getpass_aix
  • * original.c_cc[VMIN(4)]=4 original.c_cc[VTIME(5)]=255
  • * noecho.c_cc[VMIN(4)]=4 noecho.c_cc[VTIME(5)]=255
  • * Interesting Solaris is bug compatible with AIX ;), HPUX is half bug compatible ;)
  • * so just force them to 1,0 even when they are already correct its just not worth the if
  • */

if (tcsetattr(tty, TCSAFLUSH, &noecho))
{
close(tty);

2.5.4 (Apple Git-61)

@michaelrsweet
Copy link
Collaborator Author

CUPS.org User: mike

Confirmed, though strange that these OS's default to a VMIN > 1.

@michaelrsweet
Copy link
Collaborator Author

"str4750.patch":

Index: cups/usersys.c

--- cups/usersys.c (revision 13026)
+++ cups/usersys.c (working copy)
@@ -710,6 +710,8 @@

noecho = original;
noecho.c_lflag &= (tcflag_t)~(ICANON | ECHO | ECHOE | ISIG);

  • noecho.c_cc[VMIN] = 1;
  • noecho.c_cc[VTIME] = 0;

if (tcsetattr(tty, TCSAFLUSH, &noecho))
{
@@ -1234,7 +1236,7 @@

for (start = temp; *start; start = end)
{

  • /*
  • /*
  • Find end of keyword...
    */

@michaelrsweet
Copy link
Collaborator Author

CUPS.org User: mike

Fixed in Subversion repository.

@michaelrsweet michaelrsweet added this to the Stable milestone Mar 17, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant