]> git.ipfire.org Git - thirdparty/sarg.git/commitdiff
Take the time into account when parsing sarg and isa logs
authorFrédéric Marchal <fmarchal@users.sourceforge.net>
Sat, 8 Jan 2011 20:35:55 +0000 (20:35 +0000)
committerFrédéric Marchal <fmarchal@users.sourceforge.net>
Sat, 8 Jan 2011 20:35:55 +0000 (20:35 +0000)
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.

log.c

diff --git a/log.c b/log.c
index c93f7950b3684c8e1027b9c48490c76180c2befc..c1565bc2a7db6b9382657d164f72c3b1b60a1259 100644 (file)
--- 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) {