Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 12 Jan 1997 17:40:43 +0100
From:      regnauld@tetard.glou.eu.org (Philippe Regnauld)
To:        freebsd-current@freebsd.org
Subject:   patch to lock(1)
Message-ID:  <Mutt.19970112174043.regnauld@tetard.glou.eu.org>

next in thread | raw e-mail | index | archive | help
I got sick of people locking terminals for 3 hours and not coming back :-) 

I made two simple   patches to lock(1) so  that  the user cannot  lock  the
terminal more than 1 hour unless he's root. 

--- lock.c.orig	Sun Sep 22 00:49:20 1996
+++ lock.c	Sun Sep 22 00:49:33 1996
@@ -63,6 +63,7 @@
 #include <string.h>
 
 #define	TIMEOUT	15
+#define MAXLOCK 60
 
 void quit(), bye(), hi();
 
@@ -95,7 +96,8 @@
        while ((ch = getopt(argc, argv, "npt:")) != EOF)
 		switch((char)ch) {
 		case 't':
-			if ((sectimeout = atoi(optarg)) <= 0) {
+			if (((sectimeout = atoi(optarg)) <= 0) ||
+				((getuid()!=0) && (atoi(optarg) > MAXLOCK))) {
 				(void)fprintf(stderr,
 				    "lock: illegal timeout value.\n");
 				exit(1);

--- lock.1.orig	Sun Sep 22 00:49:20 1996
+++ lock.1	Sun Sep 22 00:49:33 1996
@@ -62,7 +62,8 @@
 .It Fl t Ar timeout 
 The time limit (default 15 minutes) is changed to
 .Ar timeout
-minutes.
+minutes.  Note that if the user is not root (uid 0), then the maximum
+timeout is fixed to 60 minutes.
 .El
 .Sh HISTORY
 The

-- 
							-- Phil

-[ Philippe Regnauld / regnauld@eu.org / +55.4N +11.3E @ Sol3 / +45 31241690 ]-
-[ "To kårve or nøt to kårve, that is the qvestion..."          -- My sister ]-



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Mutt.19970112174043.regnauld>