use_pty option is broken

Radovan Sroka <[email protected]> Wed, 06 Sep 2017 14:42:15 +0000
Newsgroups gmane.comp.tools.sudo.devel
Message-ID <CAD_08=--8Rj6QiiNh+Ze0tdq8ryq5OqZmoWB4eYC_ddnw7WEWQ@mail.gmail.com>
Hi Todd,

it seems like use_pty option is broken here.

After some investigation I discovered that exec_pty() and pty_setup() is
called.
I can see "std{in,out,err} not a tty, not logging" in debug log but tty was
created in pty_setup().

I guess that is something wrong with this condition:

if (io_fds[SFD_STDOUT] == -1 || !isatty(STDOUT_FILENO)) {
         if (!interpose[STDOUT_FILENO]) {

This behavior was correct until 1.8.19p2.

*************************************************

Defaults !require_tty
Defaults use_pty

Run:
# ssh root@localhost sudo forker 2>&1     #it prints output but it shouldn't

*************************************************

Defaults !require_tty
Defaults !use_pty

Run:
# ssh root@localhost sudo forker 2>&1    #it prints output and it should

*************************************************

forker.sh
#!/bin/bash
for i in `seq 1 10`; do
    ( ping -c 10 -q www.redhat.com & )
done

-- 
--
---------------------------------------------------------

Radovan Sroka
Associate Software Engineer | Security Technologies | Red hat, Inc.
____________________________________________________________
sudo-workers mailing list <[email protected]>
For list information, options, or to unsubscribe, visit:
https://www.sudo.ws/mailman/listinfo/sudo-workers