From: Frédéric Marchal Date: Fri, 15 Apr 2011 11:01:46 +0000 (+0000) Subject: Parse the time from a common access log X-Git-Tag: v2.3.2~62 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=eaa81082b313ea1de9070781989c5af97ed8ef5e;p=thirdparty%2Fsarg.git 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. --- 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; }