su password prompt to stdout instead of /dev/tty

Jeremy Chadwick freebsd at jdc.parodius.com
Fri Jan 29 09:03:59 UTC 2010


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 at parodius.com |
| Parodius Networking                       http://www.parodius.com/ |
| UNIX Systems Administrator                  Mountain View, CA, USA |
| Making life hard for others since 1977.              PGP: 4BD6C0CB |



More information about the freebsd-stable mailing list