From: Frédéric Marchal Date: Sun, 30 Oct 2011 14:41:46 +0000 (+0000) Subject: Decouple the denied and authentication failure reports X-Git-Tag: v2.3.2~21 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1bd73f70cd3d0379586082683205b63442968fd0;p=thirdparty%2Fsarg.git Decouple the denied and authentication failure reports Both reports were produced if only one of them was requested in the report_type option and there were enough material to produce the other report. --- diff --git a/log.c b/log.c index 8b353da..f8b551a 100644 --- a/log.c +++ b/log.c @@ -1513,11 +1513,13 @@ int main(int argc,char *argv[]) fprintf(fp_Download_Unsort,"%s\t%s\t%s\t%s\t%s\n",dia,hora,user,ip,download_url); } - if((ReportType & REPORT_TYPE_DENIED) != 0 || (ReportType & REPORT_TYPE_AUTH_FAILURES) != 0) { + if((ReportType & REPORT_TYPE_DENIED) != 0) { if(fp_denied && strstr(code,"DENIED/403") != 0) { fprintf(fp_denied, "%s\t%s\t%s\t%s\t%s\n",dia,hora,user,ip,urly); denied_count++; } + } + if((ReportType & REPORT_TYPE_AUTH_FAILURES) != 0) { if(fp_authfail && (strstr(code,"DENIED/401") != 0 || strstr(code,"DENIED/407") != 0)) { fprintf(fp_authfail, "%s\t%s\t%s\t%s\t%s\n",dia,hora,user,ip,urly); authfail_count++; diff --git a/report.c b/report.c index 8dcc838..c54bdc6 100644 --- a/report.c +++ b/report.c @@ -368,9 +368,12 @@ void gerarel(void) if((ReportType & REPORT_TYPE_TOPSITES) != 0) topsites(); if((ReportType & REPORT_TYPE_SITES_USERS) != 0) siteuser(); - gen_denied_report(); + + if ((ReportType & REPORT_TYPE_DENIED) != 0) + gen_denied_report(); - authfail_report(); + if ((ReportType & REPORT_TYPE_AUTH_FAILURES) != 0) + authfail_report(); if(smartfilter) smartfilter_report();