[Pkg-shadow-devel] 4.1.5: su: problem when there is no controlling term

Nicolas François nicolas.francois at centraliens.net
Sun May 20 16:14:07 UTC 2012


Hello,

Thanks for your report.

On Mon, Feb 20, 2012 at 12:45:59PM +0100, balducci at units.it wrote:
> 
[...]
>
> Now: if su has not a controlling terminal, it should simply go on
> without worrying about dropping it, no?
> 
> As a matter of fact, this patch fixes everything for me:
[...]

I have applied a different version with the same intent:

--- src/su.c
+++ src/su.c
@@ -1092,6 +1092,9 @@
 		if (fd >= 0) {
 			err = ioctl (fd, TIOCNOTTY, (char *) 0);
 			(void) close (fd);
+		} else if (ENXIO == errno) {
+			/* There are no controlling terminal already */
+			err = 0;
 		}
 #endif				/* USE_PAM */

(i.e. do not fail if open fails to open /dev/tty because the terminal does
not exist)

In case of PAM, setsid is used, and behaves correctly in such case.

Best Regards,
-- 
Nekral



More information about the Pkg-shadow-devel mailing list