Xref: utzoo comp.unix.internals:1690 comp.unix.programmer:784 comp.unix.admin:745 Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!bria!mike From: mike@bria.AIX (Mike Stefanik/78125) Newsgroups: comp.unix.internals,comp.unix.programmer,comp.unix.admin Subject: Re: Preventing date rollback Message-ID: <292@bria.AIX> Date: 31 Dec 90 01:21:28 GMT References: Followup-To: poster Distribution: comp Organization: Briareus Corporation, Los Angeles, CA Lines: 28 In article , richard@dataspan.dataspan.UUCP (Richard "Tiger" Melville) writes: > Many of the software products our company sells rely on a licence file which > specifies the duration of time the software is licensed for. The software > then refuses to run when the period has expired. [deleted] > Is there a reliable way to test if the date on a machine has been rolled > back ? (System files which have modified dates in the future might do the > trick.) As portable a solution as possible is desirable, although we mainly > run SunOs 4.0. One method that I have used in the past was to declare a static string with some unique contents in the code (ie: static char *fubar = "UGGA000000000000") and then write the code so that it is self-modifying. I simply had the program determine from whence it came, opened itself, and searched for that string. Obviously the "0000000000" part is the date ala time(). Look at the current time, and if the current time is less than what was in your magic cookie, you know they rolled the clock back. If all is ok, then simply update that string with the current time. Just make sure that that you lock the image when you are doing this. The above is preferable over using inode information such as access time, because that can easily be fudged. Hope that helps. ----------------------------------------------------------------------------- Michael Stefanik, Systems Engineer (JOAT), Briareus Corporation UUCP: ...!uunet!bria!mike "If it was hard to code, it should be harder to use!"