[uClibc]getpass() prints password after hitting enter

Jason Luther jason at airwave.com
Fri Apr 5 00:08:54 UTC 2002


Using the patch below does stop the password echo, but I still can't log in
when I upgrade from uClibc 0.9.9 to today's snapshot. I'm using shadow
passwords. It doesn't sound like anyone else is having this problem...

Any idea what I might have misconfigured?

-jason

From: "Axel Barnitzke" <barney at xkontor.com>
> Hi Eric,
>
> the following patch solves the problem for me:
>
> --- getpass.c   11 Jan 2001 11:42:17 -0000      1.2
> +++ getpass.c   4 Apr 2002 10:16:46 -0000
> @@ -45,7 +45,7 @@ getpass (prompt)
>     /* Try to write to and read from the terminal if we can.
>        If we can't open the terminal, use stderr and stdin.  */
>
> -  in = fopen ("/dev/tty", "w+");
> +  in = fopen ("/dev/tty", "r+");
>     if (in == NULL)
>       {
>         in = stdin;
> @@ -61,7 +61,7 @@ getpass (prompt)
>         /* Save the old one. */
>         s = t;
>         /* Tricky, tricky. */
> -      t.c_lflag &= ~(ECHO|ISIG);
> +      t.c_lflag &= ~(ECHO|ICANON|ISIG);
>         tty_changed = (tcsetattr (fileno (in), TCSAFLUSH|TCSASOFT, &t)
> == 0);
>       }
>     else
>
>
> Erik Andersen wrote:
>
> > On Thu Apr 04, 2002 at 11:05:55AM +0200, Axel Barnitzke wrote:
> >
> >>Hi Eric,
> >>
> >>try this and you will see the problem:
> >>
> >>#include <stdlib.h>
> >>#include <unistd.h>
> >>int main(void)
> >>{
> >> char *foo, *bar;
> >> foo=getpass( "Please enter a password:");
> >> bar=getpass( "Re-enter new password:");
> >> exit(EXIT_SUCCESS);
> >>}
> >>
> >>I guess the TCSAFLUSH attribute in tcsetattr in combination
> >>with the new stdio design is the bad guy in this case but
> >>I don't know much about terminal settings.
> >>
> >
> > Ok, yes I see it now.  Thanks!
> >
> >  -Erik
> >
> > --
> > Erik B. Andersen             http://codepoet-consulting.com/
> > --This message was written using 73% post-consumer electrons--
> >
> >
> >
> >
> >
>
>
> --
>     -- Barney
>
> --------------------------------------
> ++ axel (barney) barnitzke
> ++ it consultant
> ++ xkontor IT solutions
>
> fon   :: +49 40 4100959-0
> email :: mailto:barney at xkontor.com
>
>
> _______________________________________________
> uClibc mailing list
> uClibc at uclibc.org
> http://uclibc.org/mailman/listinfo/uclibc
>
>




More information about the uClibc mailing list