From: Frédéric Marchal Date: Sat, 8 Jan 2011 20:35:55 +0000 (+0000) Subject: Take the time into account when parsing sarg and isa logs X-Git-Tag: v2.3.2~100 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=3be2705a12ad7ccdfe7a9e9b187df09a25e6f0bd;p=thirdparty%2Fsarg.git Take the time into account when parsing sarg and isa logs The time was ignored when parsing the sarg and isa logs. The result was that all the access times were reported as occuring at 00:00. Thanks to kodemi for reporting this bug. --- diff --git a/log.c b/log.c index c93f795..c1565bc 100644 --- a/log.c +++ b/log.c @@ -1110,6 +1110,11 @@ int main(int argc,char *argv[]) } 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; } if (ilf==ILF_Isa) { @@ -1221,6 +1226,13 @@ int main(int argc,char *argv[]) idata=builddia(iday,imonth,iyear); computedate(iyear,imonth,iday,&tt); + if (isa_cols[ISACOL_Time]>=0) { + 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; } if (t==NULL) {