]> git.ipfire.org Git - thirdparty/sarg.git/commitdiff
Properly limit the redirector log to the date range covered by the access log
authorFrederic Marchal <fmarchal@users.sourceforge.net>
Tue, 14 Jul 2015 18:25:59 +0000 (20:25 +0200)
committerFrederic Marchal <fmarchal@users.sourceforge.net>
Tue, 14 Jul 2015 18:25:59 +0000 (20:25 +0200)
If no date range are provided on the command line, the redirector log would
contain the whole content of the blocked log.

This patch limit the content of the redirector log to the date range found
in the access.log.

redirector.c

index 4a606298afefc363f15bd317d92cebca915632f0..d52f4ba624555198119048c776914895fc22e358 100644 (file)
@@ -35,7 +35,7 @@ static int RedirectorErrors=0;
 //! The file containing the sorted entries.
 static char redirector_sorted[MAXLEN]="";
 
-static void parse_log(FILE *fp_ou,char *buf)
+static void parse_log(FILE *fp_ou,char *buf,int dfrom,int duntil)
 {
        char leks[5], sep[2], res[MAXLEN];
        char hour[15];
@@ -180,7 +180,7 @@ static void parse_log(FILE *fp_ou,char *buf)
 
        //sprintf(warea,"%04d%02d%02d",year,mon,day);
 
-       if (RedirectorFilterOutDate && (dfrom!=0 || duntil!=0)) {
+       if (RedirectorFilterOutDate) {
                idata = year*10000+mon*100+day;
                if(idata < dfrom || idata > duntil)
                        return;
@@ -275,7 +275,7 @@ static void read_log(const char *wentp, FILE *fp_ou,int dfrom,int duntil)
        }
 
        while ((buf=longline_read(fp_in,line)) != NULL) {
-               parse_log(fp_ou,buf);
+               parse_log(fp_ou,buf,dfrom,duntil);
        }
        if (FileObject_Close(fp_in)) {
                debuga(__FILE__,__LINE__,_("Read error in \"%s\": %s\n"),wentp,FileObject_GetLastCloseError());