From owner-freebsd-bugs Wed Jan 12 6: 0: 4 2000 Delivered-To: freebsd-bugs@freebsd.org Received: from freefall.freebsd.org (freefall.FreeBSD.ORG [204.216.27.21]) by hub.freebsd.org (Postfix) with ESMTP id 267681546E for ; Wed, 12 Jan 2000 06:00:03 -0800 (PST) (envelope-from gnats@FreeBSD.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.9.3/8.9.2) id GAA32215; Wed, 12 Jan 2000 06:00:02 -0800 (PST) (envelope-from gnats@FreeBSD.org) Date: Wed, 12 Jan 2000 06:00:02 -0800 (PST) Message-Id: <200001121400.GAA32215@freefall.freebsd.org> To: freebsd-bugs@FreeBSD.org Cc: From: Peter Wemm Subject: Re: bin/4238 - chpass time delay sensitivity [PATCH] Reply-To: Peter Wemm Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org The following reply was made to PR bin/4238; it has been noted by GNATS. From: Peter Wemm To: Daniel Hagan Cc: freebsd-gnats-submit@FreeBSD.org Subject: Re: bin/4238 - chpass time delay sensitivity [PATCH] Date: Wed, 12 Jan 2000 21:57:28 +0800 Daniel Hagan wrote: [..] > I would vote for the disgusting hack category myself :). I was > complaining to John Baldwin (jhb) about it, and he mentioned the > work-around (I never would have thought of it, being too tied to my > anti-disgusting-hack philosophy). It seems harmless enough in this > special case, but I won't take it personally if someone cans the patch. Just as a by-the-way, this won't work on a system with a raised securelevel which will prevent the time being set backwards. So don't make it a fatal error if the time cannot be set. Or, if it fails to set back, sleep for a second instead... Or even do a while loop waiting for the current time to tick over to the next second and be later than the time on the file (again using usleep or something for a 1/10th of a second sleep interval). The sure-fire way to detect an edit is to do a md5 of the file. There's quite a few examples of code to do this sort of thing around the tree (ie: taking the md5 checksum). Then compare a before-and-after checksum. Cheers, -Peter To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message