From owner-freebsd-current Sun Jan 12 09:02:32 1997 Return-Path: Received: (from root@localhost) by freefall.freebsd.org (8.8.4/8.8.4) id JAA05391 for current-outgoing; Sun, 12 Jan 1997 09:02:32 -0800 (PST) Received: from ns.eu.org (valerian.glou.eu.org [193.56.58.251]) by freefall.freebsd.org (8.8.4/8.8.4) with ESMTP id JAA05386 for ; Sun, 12 Jan 1997 09:02:24 -0800 (PST) Received: (from uucp@localhost) by ns.eu.org (8.7.3/8.7.1/951117) with UUCP id SAA29653 for freebsd-current@freebsd.org; Sun, 12 Jan 1997 18:02:11 +0100 (MET) Received: (from regnauld@localhost) by tetard.glou.eu.org (8.8.4/8.7.3/tetard-uucp-2.7) id RAA25466; Sun, 12 Jan 1997 17:40:44 +0100 (MET) Message-ID: 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) X-Mailer: Mutt 0.55 Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Operating-System: FreeBSD 3.0-CURRENT i386 Sender: owner-current@freebsd.org X-Loop: FreeBSD.org Precedence: bulk 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 #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 ]-