Date: Sat, 26 Sep 1998 18:03:49 +0900 From: Kazutaka YOKOTA <yokota@zodiac.mech.utsunomiya-u.ac.jp> To: Martin Cracauer <cracauer@cons.org> Cc: "Brian W. Buchanan" <brian@smarter.than.nu>, Mike Smith <mike@smith.net.au>, hackers@FreeBSD.ORG, yokota@zodiac.mech.utsunomiya-u.ac.jp Subject: Re: vty lock Message-ID: <199809260903.SAA19912@zodiac.mech.utsunomiya-u.ac.jp> In-Reply-To: Your message of "Wed, 23 Sep 1998 12:42:32 %2B0200." <19980923124232.A20756@cons.org> References: <199809220806.BAA00624@word.smith.net.au> <Pine.BSF.4.02A.9809220751220.298-100000@smarter.than.nu> <19980923124232.A20756@cons.org>
next in thread | previous in thread | raw e-mail | index | archive | help
>> I have to terminate or shell out of whatever I'm running at the moment on
>> each vty and run it, then enter my password 9 or 10 times when I return to
>> the console.
>>
>> Linux's vlock lets you specify -a to instantly lock ALL vtys, which is the
>> functionality I'm mainly looking for.
>
>Then why don't you add that option to our lock? Simplest solution
>would be to prevent the console driver from switching consoles, which
>could be done with a simple ioctl for syscons and pcvt.
>
>Martin
Linux has the ioctls VT_LOCKSWITCH and VT_UNLOCKSWITCH, which our
syscons and pcvt don't have.
However, if all you want to do is to prevent the user from switching
away from the current vty, you can make `lock' use the ioctl VT_SEMODE
to set the switching mode to VT_PROCESS and refuse vty switching until
the user types the correct password (or until timeout expires).
This technique should work with both syscons and pcvt.
#include <machine/console.h>
...
int fd;
void
relase(int arg)
{
/* always refuse to release our vty */
ioctl(fd, VT_RELDISP, VT_FALSE);
}
void
acquire(int arg)
{
ioctl(fd, VT_RELDISP, VT_ACKACQ);
}
main()
{
struct vt_mode mode;
fd = fileno(stdin);
signal(SIGUSR1, release)
signal(SIGUSR2, acquire);
mode.mode = VT_PROCESSS;
mode.relsig = SIGUSR1;
mode.acqsig = SIGUSR2;
mode.frsig = SIGUSR1; /* not used */
ioctl(fd, VT_SETMODE, &mode);
...
/* clean up before quiting */
mode.mode = VT_AUTO;
ioctl(fd, VT_SETMODE, &mode);
}
Kazu
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199809260903.SAA19912>
