su hanging

Carl M. Fongheiser cmf at obie.cis.pitt.edu
Tue Oct 3 01:31:15 AEST 1989


In article <772 at kl-cs.UUCP> jonathan at cs.keele.ac.uk (Jonathan Knight) writes:
>Su can hang if someone hits ^S on the console.  When su tries to log the
>message 'SU: .....' it hangs waiting for a ^Q on the console.  Very
>irritating, especially if the operators have gone home for the night
>and the machine room is locked up tight....


Well, you could try something like this (WARNING: I haven't tested
this!) :

#include <sys/ioctl.h>

main()
{
    int fd;
    char c;

    fd = open("/dev/console", 1);	/* Open the console */
    if (fd < 0) {
	perror("open");
	exit(1);
    }
    c = 'Q' ^ 0100;			/* A ^Q */
    if (ioctl(fd, TIOCSTI, &c) < 0) {
	perror("ioctl");
	exit(1);
    }
}


Note that you'll need to make this setuid root, otherwise the ioctl
will fail.  In fact, if you set up your system correctly, the open
should fail as well!

				Carl Fongheiser
				cmf at unix.cis.pitt.edu



More information about the Comp.unix.ultrix mailing list