/*
* SARG Squid Analysis Report Generator http://sarg.sourceforge.net
- * 1998, 2013
+ * 1998, 2015
*
* SARG donations:
* please look at http://sarg.sourceforge.net/donations.php
snprintf(dansguardian_in,sizeof(dansguardian_in),"%s/dansguardian.int_log",tmp);
if(!dansguardian_count) {
if (!KeepTempLog && unlink(dansguardian_in))
- debuga(_("Cannot delete \"%s\": %s\n"),dansguardian_in,strerror(errno));
- if (debugz>=LogLevel_Process) debugaz(_("Dansguardian report not generated because it is empty\n"));
+ debuga(__FILE__,__LINE__,_("Cannot delete \"%s\": %s\n"),dansguardian_in,strerror(errno));
+ if (debugz>=LogLevel_Process) debugaz(__FILE__,__LINE__,_("Dansguardian report not generated because it is empty\n"));
return;
}
sprintf(report,"%s/dansguardian.html",outdirname);
if((fp_in=MY_FOPEN(dansguardian_in,"r"))==NULL) {
- debuga(_("(dansguardian_report) Cannot open log file %s: %s\n"),dansguardian_in,strerror(errno));
+ debuga(__FILE__,__LINE__,_("Cannot open file \"%s\": %s\n"),dansguardian_in,strerror(errno));
exit(EXIT_FAILURE);
}
if((fp_ou=MY_FOPEN(report,"w"))==NULL) {
- debuga(_("(dansguardian_report) Cannot open log file %s: %s\n"),report,strerror(errno));
+ debuga(__FILE__,__LINE__,_("Cannot open file \"%s\": %s\n"),report,strerror(errno));
exit(EXIT_FAILURE);
}
getword_start(&gwarea,buf);
if (getword(user,sizeof(user),&gwarea,'\t')<0 || getword(date2,sizeof(date2),&gwarea,'\t')<0 ||
getword(hour,sizeof(hour),&gwarea,'\t')<0 || getword(ip,sizeof(ip),&gwarea,'\t')<0) {
- debuga(_("Maybe you have a broken record or garbage in your %s file\n"),dansguardian_in);
+ debuga(__FILE__,__LINE__,_("Invalid record in file \"%s\"\n"),dansguardian_in);
exit(EXIT_FAILURE);
}
if (getword_ptr(buf,&url,&gwarea,'\t')<0) {
- debuga(_("Maybe you have a broken url in your %s file\n"),dansguardian_in);
+ debuga(__FILE__,__LINE__,_("Invalid url in file \"%s\"\n"),dansguardian_in);
exit(EXIT_FAILURE);
}
if (getword(rule,sizeof(rule),&gwarea,'\n')<0) {
- debuga(_("Maybe you have a broken rule in your %s file\n"),dansguardian_in);
+ debuga(__FILE__,__LINE__,_("Invalid rule in file \"%s\"\n"),dansguardian_in);
exit(EXIT_FAILURE);
}
if(UserIp)
strcpy(user,ip);
- bzero(date, 15);
+ memset(date,0,sizeof(date));
if (df!='u') {
strncpy(date,date2+6,2);
strcat(date,"/");
output_html_link(fp_ou,url,100);
fprintf(fp_ou,"</td><td class=\"data2\">%s</td></tr>\n",rule);
}
- fclose(fp_in);
+ if (fclose(fp_in)==EOF) {
+ debuga(__FILE__,__LINE__,_("Read error in \"%s\": %s\n"),dansguardian_in,strerror(errno));
+ exit(EXIT_FAILURE);
+ }
if(count>DansGuardianReportLimit && DansGuardianReportLimit>0)
show_ignored_dansguardian(fp_ou,count-DansGuardianReportLimit);
fputs("</table></div>\n",fp_ou);
- if (write_html_trailer(fp_ou)<0)
- debuga(_("Write error in file %s\n"),report);
+ write_html_trailer(fp_ou);
if (fclose(fp_ou)==EOF) {
- debuga(_("Write error in %s: %s\n"),report,strerror(errno));
+ debuga(__FILE__,__LINE__,_("Write error in \"%s\": %s\n"),report,strerror(errno));
exit(EXIT_FAILURE);
}
if (!KeepTempLog && unlink(dansguardian_in)) {
- debuga(_("Cannot delete \"%s\": %s\n"),dansguardian_in,strerror(errno));
+ debuga(__FILE__,__LINE__,_("Cannot delete \"%s\": %s\n"),dansguardian_in,strerror(errno));
exit(EXIT_FAILURE);
}