From owner-freebsd-standards@FreeBSD.ORG  Fri Jan 29 00:16:50 2010
Return-Path: <owner-freebsd-standards@FreeBSD.ORG>
Delivered-To: freebsd-standards@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id D8378106566C;
	Fri, 29 Jan 2010 00:16:50 +0000 (UTC)
	(envelope-from cyrille.lefevre-lists@laposte.net)
Received: from out3.laposte.net (out4.laposte.net [193.251.214.121])
	by mx1.freebsd.org (Postfix) with ESMTP id 6D7D58FC0C;
	Fri, 29 Jan 2010 00:16:50 +0000 (UTC)
Received: from meplus.info (localhost [127.0.0.1])
	by mwinf8314.laposte.net (SMTP Server) with ESMTP id 9C07C70013A7;
	Fri, 29 Jan 2010 01:16:48 +0100 (CET)
Received: from [192.168.1.133] (137.228.100-84.rev.gaoland.net
	[84.100.228.137])
	by mwinf8314.laposte.net (SMTP Server) with ESMTP id 37C5970013A6;
	Fri, 29 Jan 2010 01:16:48 +0100 (CET)
X-ME-UUID: 20100129001648228.37C5970013A6@mwinf8314.laposte.net
Message-ID: <4B6228EF.5050400@laposte.net>
Date: Fri, 29 Jan 2010 01:16:47 +0100
From: Cyrille Lefevre <cyrille.lefevre-lists@laposte.net>
Organization: ACME
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; fr;
	rv:1.8.1.3) Gecko/20070326 Thunderbird/2.0.0.0 Mnenhy/0.7.5.666
MIME-Version: 1.0
To: jhell <jhell@DataIX.net>
References: <4B5CEC53.3090402@laposte.net>	<20100125025744.GA94378@orion.hsd1.pa.comcast.net>	<alpine.BSF.2.00.1001242243460.72774@pragry.qngnvk.ybpny>
	<4B60B734.7060803@laposte.net>
In-Reply-To: <4B60B734.7060803@laposte.net>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: quoted-printable
X-me-spamlevel: not-spam
X-me-spamrating: 32.799999
X-me-spamcause: OK,
	(-180)(0000)gggruggvucftvghtrhhoucdtuddrvdeltddrudduucetggdotefuucfrrhhofhhilhgvmecuoehnohhnvgeqnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucdlqddutddtmdenfhhrvggvsghsugefgiculddqfedtmdenfhhrvggvsghsugdgucdlqddutddmneeuufffvdigucdlqddvtddmnehgvghnvghrihgtjdculdeftddmnehtohcutghhrghtucdlhedtmd
Cc: freebsd-standards@freebsd.org, freebsd-stable@freebsd.org,
	Glen Barber <glen.j.barber@gmail.com>
Subject: Re: su password prompt to stdout instead of /dev/tty
X-BeenThere: freebsd-standards@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: Standards compliance <freebsd-standards.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/freebsd-standards>, 
	<mailto:freebsd-standards-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/freebsd-standards>
List-Post: <mailto:freebsd-standards@freebsd.org>
List-Help: <mailto:freebsd-standards-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/freebsd-standards>, 
	<mailto:freebsd-standards-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Fri, 29 Jan 2010 00:16:50 -0000


Cyrille Lefevre a =E9crit :
>=20
>=20
> sorry, repost to -standards w/ an s !
>=20
> jhell a =E9crit :
>> On Sun, 24 Jan 2010 21:57, glen.j.barber@ wrote:
>>>
>>> Cyrille Lefevre wrote:
>>>>
>>>> su password prompt is displayed to *stdout* instead of */dev/tty*.
>>>>
>>>> # su user
>>>> $ su root -c date > /tmp/date 2>&1
>>>> (nothing displayed)
>>>> $ cat /tmp/date
>>>> Password:su: Sorry
>>>> $ uname -a
>>>> FreeBSD freebsd8.my.domain 8.0-RELEASE FreeBSD 8.0-RELEASE #0: Sat N=
ov
>>>> 21 15:48:17 UTC 2009
>>>> root@almeida.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC  i386
>>>>
>>>> I suppose this is a getpass() problem ?
>>>>
>>
>> This is intended operation as su(1) may not always be affiliated with =

>> a TTY. This leaves it open for a script to chat with much like what=20
>> samba does with its passwd chat mechanism.
>=20
> just to feed the debate :
>=20
> aix 5.2 : prompt to tty
> hp-ux : prompt to stderr
> netbsd : prompt to tty
> solaris 9 : prompt to stderr
> solaris 10 : prompt to tty
> openbsd : prompt to tty
> ubuntu : prompt to stderr
>=20
> freebsd is the only one which prompt to stdout !
> IMHO, it should at least prompt to stderr if not tty...
> and report errors to stderr as usually.
>=20
> CC -standards

found it, the guilty is prompt() in=20
src/contrib/openpam/lib/openpam_ttyconv.c and not getpass() as usual...

=3D> fputs(msg, stdout);

which should be, IMHO, something like :

	FILE *ttyp;
	ttyp =3D fopen("/dev/tty", "w")
	if (!stdtty)
		ttyp =3D isatty(fileno(stderr)) ? stderr : stdout;
	fputs(msg, ttyp);

or, at least :

	fputs(msg, stderr);

Regards,

Cyrille Lefevre
--=20
mailto:Cyrille.Lefevre-lists@laposte.net