From eaa81082b313ea1de9070781989c5af97ed8ef5e Mon Sep 17 00:00:00 2001 From: =?utf8?q?Fr=C3=A9d=C3=A9ric=20Marchal?= Date: Fri, 15 Apr 2011 11:01:46 +0000 Subject: [PATCH] Parse the time from a common access log The time was ignored when parsing a squid log file written with the common logformat. The consequence was that all the accesses were reported as occuring at 00:00. This is a bug introduced in sarg 2.3. Thanks to Richard P Scott for reporting this bug. --- log.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/log.c b/log.c index 28115b1..111d9db 100644 --- a/log.c +++ b/log.c @@ -1010,6 +1010,11 @@ int main(int argc,char *argv[]) imonth=month2num(mes)+1; idata=builddia(iday,imonth,iyear); computedate(iyear,imonth,iday,&tt); + if (sscanf(hora,"%d:%d:%d",&tt.tm_hour,&tt.tm_min,&tt.tm_sec)!=3 || tt.tm_hour<0 || tt.tm_hour>=24 || + tt.tm_min<0 || tt.tm_min>=60 || tt.tm_sec<0 || tt.tm_sec>=60) { + debuga(_("Invalid time found in %s\n"),arq); + exit(EXIT_FAILURE); + } t=&tt; } -- 2.47.2