bug-cfengine
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

*time filters always succeed - fix included (2.0.1)


From: Thorn Roby
Subject: *time filters always succeed - fix included (2.0.1)
Date: Wed, 24 Apr 2002 17:25:56 -0600

The mtime,ctime,atime filter always returns success. The problem appears to
be in FilterTimeMatch in filters.c, which appears to be comparing the start
and end limits of the filter to the current time, rather than to the file
modification time.

I changed the first argument to be the appropriate value from the stat
structure, depending on which time is of interest, and replaced the
comparison to "now" with a comparison to this value. E.g.:

 if
(FilterTimeMatch(lstatptr->st_atime,crit[filterfromatime],crit[filtertoatime
]))
      {
      PrependItem(attr,"Atime","");
      }

int FilterTimeMatch(lstattime,from,to)
char *from,*to;
time_t lstattime;
{ time_t fromtime,totime, now = CFSTARTTIME;
fromtime = Date2Number(from,now);
totime = Date2Number(to,now);
/* return ((fromtime < now) && (now < totime)); */
return ((fromtime < lstattime) && (lstattime < totime));
}

Thorn Roby, Senior Systems Engineer
Cavion Technologies, 6446 South Kenton St
Englewood CO  80111   (720) 875 1949





reply via email to

[Prev in Thread] Current Thread [Next in Thread]