[sudo-workers] io_callback function

Todd C. Miller Todd.Miller at courtesan.com
Wed Jul 8 10:21:06 MDT 2015

On Wed, 08 Jul 2015 05:04:22 -0400, Radovan Sroka wrote:

> I'm testing your code and I encounter a problem. "What" parameter can be "SUD
> O_EV_READ" or "SUDO_EV_WRITE" which are represented as second or third bit of
>  integer. If "what" parameter will be  "SUDO_EV_READ" and "SUDO_EV_WRITE" at 
> the same time than in IF(what, SUDO_EV_READ) fd will close and in IF(what, SU
> DO_EV_WRITE) is called "write" function with invalid file descriptor.

I think it is best to check for SUDO_EV_WRITE first and clear
SUDO_EV_READ if write() fails due to EPIPE, ENXIO, EIO or EBADF.

See http://www.sudo.ws/repos/sudo/rev/167548fd8af2

 - todd

More information about the sudo-workers mailing list