Re: su password prompt to stdout instead of /dev/tty

[ Available lists | Index of freebsd-standards | Month of Jan 2010 | Week of 29 Jan 2010 | Raw email | View thread | Wrap long lines | Reply | Tag ]
From
Jeremy Chadwick <freebsd@jdc.parodius.com>
Date
29 Jan 2010 09:17:09
Subject
Re: su password prompt to stdout instead of /dev/tty
Message-ID
20100129090357.GA38872@icarus.home.lan


[ Hide this part ]
On Fri, Jan 29, 2010 at 09:02:09AM +0100, Oliver Fromme wrote:
> Cyrille Lefevre wrote:
> > found it, the guilty is prompt() in
> > src/contrib/openpam/lib/openpam_ttyconv.c and not getpass() as usual...
>
> Are you sure this affects su(1) only?
>
> > => fputs(msg, stdout);
> >
> > which should be, IMHO, something like :
> >
> > FILE *ttyp;
> > ttyp = fopen("/dev/tty", "w")
> > if (!stdtty)
> > ttyp = isatty(fileno(stderr)) ? stderr : stdout;
> > fputs(msg, ttyp);
> >
> > or, at least :
> >
> > fputs(msg, stderr);
>
> As long as it's still possible to easily redirect the prompt
> on the command line, it's fine with me.
> Right now I can do this in a script:
>
> echo -n "$myprompt: " ; su $somerole >/dev/null ...
>
> If that doesn't work anymore, I'll complain. ;-)

OpenPAM is des@'s responsibility. Has anyone brought this up to him?

--
| Jeremy Chadwick jdc@parodius.com |
| Parodius Networking http://www.parodius.com/ |
| UNIX Systems Administrator Mountain View, CA, USA |
| Making life hard for others since 1977. PGP: 4BD6C0CB |


Elapsed time: 0.298 seconds