FreeBSD Bugzilla – Attachment 7117 Details for
Bug 15663
patch for lock (1) adding capability to lock all ttys
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
file.diff
file.diff (text/plain), 4.18 KB, created by
acid
on 1999-12-24 11:10:01 UTC
(
hide
)
Description:
file.diff
Filename:
MIME Type:
Creator:
acid
Created:
1999-12-24 11:10:01 UTC
Size:
4.18 KB
patch
obsolete
>diff -c -r lock.orig/lock.1 lock/lock.1 >*** lock.orig/lock.1 Sat Sep 14 12:00:48 1996 >--- lock/lock.1 Fri Dec 24 12:58:32 1999 >*************** >*** 54,59 **** >--- 54,63 ---- > Options: > .Pp > .Bl -tag -width Fl >+ .It Fl a >+ Lock all ttys. To use this feature, you must be root or >+ .Nm lock >+ must be installed setuid to root. > .It Fl n > Don't use a timeout value. Terminal will be locked forever. > .It Fl p >diff -c -r lock.orig/lock.c lock/lock.c >*** lock.orig/lock.c Sun Aug 29 18:29:56 1999 >--- lock/lock.c Fri Dec 24 12:15:44 1999 >*************** >*** 68,84 **** > #include <stdlib.h> > #include <string.h> > #include <unistd.h> > > #define TIMEOUT 15 > >! void quit(), bye(), hi(); > static void usage __P((void)); > > struct timeval timeout; > struct timeval zerotime; > struct sgttyb tty, ntty; > long nexttime; /* keep the timeout time */ >! int no_timeout; /* lock terminal forever */ > > /*ARGSUSED*/ > int >--- 68,88 ---- > #include <stdlib.h> > #include <string.h> > #include <unistd.h> >+ #include <machine/console.h> > > #define TIMEOUT 15 > >! void quit(), bye(), hi(), release(), acquire(); > static void usage __P((void)); > > struct timeval timeout; > struct timeval zerotime; > struct sgttyb tty, ntty; > long nexttime; /* keep the timeout time */ >! int no_timeout, /* lock terminal forever */ >! fd, >! lock_all; /* lock all ttys */ >! > > /*ARGSUSED*/ > int >*************** >*** 86,91 **** >--- 90,96 ---- > int argc; > char **argv; > { >+ struct vt_mode mode; > struct passwd *pw; > struct timeval timval; > time_t timval_sec; >*************** >*** 100,106 **** > mypw = NULL; > usemine = 0; > no_timeout = 0; >! while ((ch = getopt(argc, argv, "npt:")) != -1) > switch((char)ch) { > case 't': > if ((sectimeout = atoi(optarg)) <= 0) >--- 105,113 ---- > mypw = NULL; > usemine = 0; > no_timeout = 0; >! lock_all = 0; >! fd = fileno(stdin); >! while ((ch = getopt(argc, argv, "anpt:")) != -1) > switch((char)ch) { > case 't': > if ((sectimeout = atoi(optarg)) <= 0) >*************** >*** 115,121 **** > case 'n': > no_timeout = 1; > break; >! case '?': > default: > usage(); > } >--- 122,131 ---- > case 'n': > no_timeout = 1; > break; >! case 'a': >! lock_all = 1; >! break; >! case '?': > default: > usage(); > } >*************** >*** 167,172 **** >--- 177,193 ---- > (void)signal(SIGQUIT, hi); > (void)signal(SIGTSTP, hi); > (void)signal(SIGALRM, bye); >+ if (lock_all) >+ { >+ (void)signal(SIGUSR1, release); >+ (void)signal(SIGUSR2, acquire); >+ >+ mode.mode = VT_PROCESS; >+ mode.relsig = SIGUSR1; >+ mode.acqsig = SIGUSR2; >+ mode.frsig = SIGUSR1; /* not used */ >+ ioctl(fd, VT_SETMODE, &mode); >+ } > > ntimer.it_interval = zerotime; > ntimer.it_value = timeout; >*************** >*** 198,205 **** > break; > (void)printf("\07\n"); > if (ioctl(0, TIOCGETP, &ntty)) >! exit(1); >! } > quit(); > return(0); /* not reached */ > } >--- 219,232 ---- > break; > (void)printf("\07\n"); > if (ioctl(0, TIOCGETP, &ntty)) >! exit(1); } >! if (lock_all) { >! /* clean up before quiting */ >! mode.mode = VT_AUTO; >! ioctl(fd, VT_SETMODE, &mode); >! >! >! } > quit(); > return(0); /* not reached */ > } >*************** >*** 208,214 **** > static void > usage() > { >! (void)fprintf(stderr, "usage: lock [-n] [-p] [-t timeout]\n"); > exit(1); > } > >--- 235,241 ---- > static void > usage() > { >! (void)fprintf(stderr, "usage: lock [-a] [-n] [-p] [-t timeout]\n"); > exit(1); > } > >*************** >*** 246,248 **** >--- 273,287 ---- > exit(1); > } > } >+ void >+ release(int arg) >+ { >+ /* always refuse to release our vty */ >+ ioctl(fd, VT_RELDISP, VT_FALSE); >+ } >+ >+ void >+ acquire(int arg) >+ { >+ ioctl(fd, VT_RELDISP, VT_ACKACQ); >+ }
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 15663
: 7117