]> git.ipfire.org Git - thirdparty/sarg.git/blob - report.c
Remove any limit on the maximum URL length (bugs remain)
[thirdparty/sarg.git] / report.c
1 /*
2 * SARG Squid Analysis Report Generator http://sarg.sourceforge.net
3 * 1998, 2010
4 *
5 * SARG donations:
6 * please look at http://sarg.sourceforge.net/donations.php
7 * Support:
8 * http://sourceforge.net/projects/sarg/forums/forum/363374
9 * ---------------------------------------------------------------------
10 *
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
15 *
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
20 *
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA.
24 *
25 */
26
27 #include "include/conf.h"
28 #include "include/defs.h"
29
30 static FILE *fp_tt=NULL;
31
32 static void maketmp(const char *user, const char *dirname, int debug, int indexonly);
33 static void maketmp_hour(const char *user, const char *dirname, int indexonly);
34 static void gravatmp_hora(const char *dirname, const char *user, const char *data, const char *hora, long long int elap, long long int accbytes, int indexonly);
35 static void gravatmpf(const char *oldaccuser, const char *dirname, const char *oldurl, long long int nacc, long long int nbytes, const char *oldmsg, long long int nelap, int indexonly, long long int incache, long long int oucache);
36 static void gravaporuser(const char *user, const char *dirname, const char *url, const char *ip, const char *data, const char *hora, long long int tam, long long int elap, int indexonly);
37 static void gravager(FILE *fp_gen, const char *user, long long int nacc, const char *url, long long int nbytes, const char *ip, const char *hora, const char *dia, long long int nelap, long long int incache, long long int oucache);
38 static void grava_SmartFilter(const char *dirname, const char *user, const char *ip, const char *data, const char *hora, const char *url, const char *smart);
39
40 void gerarel(void)
41 {
42
43 FILE *fp_in;
44 FILE *fp_gen;
45
46 char *buf;
47 char accdia[11], acchora[9], accuser[MAXLEN], accip[MAXLEN], *accurl;
48 char oldaccdia[11], oldacchora[9], oldaccip[MAXLEN];
49 char wdirname[MAXLEN], oldaccuser[MAXLEN];
50 char *oldurl=NULL;
51 char olduser[MAXLEN], oldmsg[50], acccode[MAXLEN/2 - 1], oldacccode[MAXLEN/2 - 1], user[MAXLEN];
52 char ipantes[MAXLEN], nameantes[MAXLEN];
53 char accsmart[MAXLEN];
54 char crc2[MAXLEN/2 -1];
55 char siteind[MAX_TRUNCATED_URL];
56 char arqtt[256];
57 char *oldurltt=NULL;
58 char oldaccdiatt[11],oldacchoratt[9];
59 long long int nbytes=0;
60 long long int nelap=0;
61 long long int nacc=0;
62 long long int rtotal=0;
63 long long int incache=0;
64 long long int oucache=0;
65 long long int accbytes, accelap;
66 char *str;
67 DIR *dirp;
68 struct dirent *direntp;
69 const char logext[]=".log";
70 int dlen;
71 int url_len;
72 int ourl_size=0;
73 int ourltt_size=0;
74 struct getwordstruct gwarea;
75 struct longlinestruct line;
76
77 ipantes[0]='\0';
78 nameantes[0]='\0';
79 smartfilter=0;
80
81 sprintf(dirname, "%s%s", outdir, period);
82 vrfydir(period, addr, site, us, email);
83
84 if(debugz){
85 debugaz("dirname",dirname);
86 }
87
88 gperiod(dirname,period);
89
90 if(UserAgentLog[0] != '\0' && email[0] == '\0') useragent();
91
92 sprintf(wdirname,"%s/sarg-general",dirname);
93 if((fp_gen=MY_FOPEN(wdirname,"a"))==NULL){
94 fprintf(stderr, "SARG: (report) %s: %s\n",text[45],wdirname);
95 exit(1);
96 }
97
98 olduser[0]='\0';
99 strncat(tmp,"/sarg",5);
100 fp_tt=NULL;
101
102 dirp = opendir(tmp);
103 while ((direntp = readdir( dirp )) != NULL ) {
104 dlen=strlen(direntp->d_name)-(sizeof(logext)-1);
105 if (dlen<0) continue;
106 if((strcmp(direntp->d_name+dlen,logext) != 0) ||
107 (strncmp(direntp->d_name,"download.log",12) == 0) ||
108 (strncmp(direntp->d_name,"denied.log",10) == 0) ||
109 (strncmp(direntp->d_name,"authfail.log.unsort",19) == 0))
110 continue;
111 if (snprintf(tmp3,sizeof(tmp3),"%s/%s",tmp,direntp->d_name)>=sizeof(tmp3)) {
112 fprintf(stderr, "SARG: (report) directory entry too long: %s/%s\n",tmp,direntp->d_name);
113 exit(1);
114 }
115 if((fp_in=MY_FOPEN(tmp3,"r"))==NULL){
116 fprintf(stderr, "SARG: (report) %s: %s\n",text[45],tmp);
117 exit(1);
118 }
119
120 if (dlen>0) {
121 if (dlen>=sizeof(user)) continue;
122 strncpy(user,direntp->d_name,dlen);
123 user[dlen]=0;
124 } else {
125 user[0]='\0';
126 }
127
128 strcpy(wdirname,dirname);
129 maketmp(user,tmp,debug,indexonly);
130 maketmp_hour(user,tmp,indexonly);
131
132 strcpy(u2,user);
133 if(Ip2Name)
134 ip2name(u2,sizeof(u2));
135 user_find(name,sizeof(name), u2);
136
137 if(dotinuser && strchr(name,'_')) {
138 subs(name,sizeof(name),"_",".");
139 }
140
141 ttopen=0;
142 oldurltt=NULL;
143 ourltt_size=0;
144 memset(oldaccdiatt,0,sizeof(oldaccdiatt));
145 memset(oldacchoratt,0,sizeof(oldacchoratt));
146
147 if (longline_prepare(&line)<0) {
148 debuga(_("Not enough memory to read the downloaded files"));
149 exit(1);
150 }
151
152 while((buf=longline_read(fp_in,&line))!=NULL) {
153 getword_start(&gwarea,buf);
154 if (getword(accdia,sizeof(accdia),&gwarea,'\t')<0 || getword(acchora,sizeof(acchora),&gwarea,'\t')<0 ||
155 getword(accuser,sizeof(accuser),&gwarea,'\t')<0 || getword(accip,sizeof(accip),&gwarea,'\t')<0 ||
156 getword_ptr(buf,&accurl,&gwarea,'\t')<0 || getword_atoll(&accbytes,&gwarea,'\t')<0 ||
157 getword(acccode,sizeof(acccode),&gwarea,'\t')<0) {
158 debuga(_("Maybe you have a broken record or garbage in your %s file (%d)"),tmp3,__LINE__);
159 exit(1);
160 }
161 if(strncmp(acccode,"TCP_DENIED/407",14) == 0) continue;
162 if (getword_atoll(&accelap,&gwarea,'\t')<0 || getword_skip(20000,&gwarea,'\t')<0) {
163 printf("SARG: Maybe you have a broken elapsed time in your %s file (%d).\n",tmp3,__LINE__);
164 exit(1);
165 }
166 if (getword(accsmart,sizeof(accsmart),&gwarea,'"')<0) {
167 printf("SARG: Maybe you have a broken smart info in your %s file (%d).\n",tmp3,__LINE__);
168 exit(1);
169 }
170
171 if(accsmart[0] != '\0') {
172 smartfilter++;
173 strcpy(wdirname,dirname);
174 grava_SmartFilter(wdirname,accuser,accip,accdia,acchora,accurl,accsmart);
175 }
176
177 if(Ip2Name) {
178 if(strcmp(accip,ipantes) != 0) {
179 strcpy(ipantes,accip);
180 ip2name(accip,sizeof(accip));
181 strcpy(nameantes,accip);
182 } else strcpy(accip,nameantes);
183 }
184
185 strcpy(wdirname,dirname);
186 gravatmp_hora(wdirname,accuser,accdia,acchora,accelap,accbytes,indexonly);
187
188 if(iprel){
189 strcpy(wdirname,dirname);
190 gravaporuser(accuser,wdirname,accurl,accip,accdia,acchora,accbytes,accelap,indexonly);
191 }
192
193 if(!rtotal){
194 url_len=strlen(accurl);
195 if (!oldurl || url_len>=ourl_size) {
196 ourl_size=url_len+1;
197 oldurl=realloc(oldurl,ourl_size);
198 if (!oldurl) {
199 debuga(_("Not enough memory to store the url"));
200 exit(1);
201 }
202 }
203 strcpy(oldurl,accurl);
204 strcpy(oldacccode,acccode);
205 strcpy(oldaccuser,accuser);
206 strcpy(oldaccip,accip);
207 strcpy(oldaccdia,accdia);
208 strcpy(oldacchora,acchora);
209 rtotal++;
210 }
211
212 if(site[0] != '\0') {
213 if(strcmp(oldaccuser,accuser) != 0){
214 strcpy(oldmsg,"OK");
215 if(strstr(oldacccode,"DENIED") != 0)
216 sprintf(oldmsg,"%s",text[46]);
217 gravatmp(oldaccuser,oldurl,nacc,nbytes,oldmsg,nelap,indexonly,incache,oucache);
218 gravager(fp_gen,oldaccuser,nacc,oldurl,nbytes,oldaccip,oldacchora,oldaccdia,nelap,incache,oucache);
219 nacc=0;
220 nbytes=0;
221 nelap=0;
222 incache=0;
223 oucache=0;
224 }
225 } else {
226 if(strcmp(oldurl,accurl) != 0 || strcmp(oldaccuser,accuser) != 0){
227 if(strstr(oldacccode,"DENIED") != 0)
228 strcpy(oldmsg,text[46]);
229 else
230 strcpy(oldmsg,"OK");
231 gravatmp(oldaccuser,oldurl,nacc,nbytes,oldmsg,nelap,indexonly,incache,oucache);
232 gravager(fp_gen,oldaccuser,nacc,oldurl,nbytes,oldaccip,oldacchora,oldaccdia,nelap,incache,oucache);
233 nacc=0;
234 nbytes=0;
235 nelap=0;
236 incache=0;
237 oucache=0;
238 if(strcmp(oldaccuser,accuser) != 0)
239 ind2=0;
240 }
241 }
242 nacc++;
243 nbytes+=accbytes;
244 nelap+=accelap;
245
246 if ((ReportType & REPORT_TYPE_SITE_USER_TIME_DATE) != 0 &&
247 (!oldurltt || strcmp(oldurltt,accurl) || strcmp(oldaccdiatt,accdia) || strcmp(oldacchoratt,acchora))) {
248
249 if(!ttopen) {
250 ind2++;
251 url_to_file(accurl,siteind,sizeof(siteind));
252 snprintf(arqtt,sizeof(arqtt),"%s/%s",dirname,accuser);
253 if(access(arqtt, R_OK) != 0)
254 my_mkdir(arqtt);
255 snprintf(arqtt,sizeof(arqtt),"%s/%s/tt%s-%s.html",dirname,accuser,accuser,siteind);
256 if ((fp_tt = fopen(arqtt, "w")) == 0) {
257 fprintf(stderr, "SARG: (report) %s: %s\n",text[45],arqtt);
258 exit(1);
259 }
260 ttopen=1;
261
262 /*
263 if(Privacy)
264 sprintf(httplink,"<font size=%s color=%s><href=http://%s>%s", \
265 FontSize,PrivacyStringColor,PrivacyString,PrivacyString);
266 else
267 sprintf(httplink,"<font size=%s><a href=\"http://%s\">%s</a>",FontSize,accurl,accurl);
268 */
269
270 write_html_header(fp_tt,(IndexTree == INDEX_TREE_DATE) ? 4 : 2,_("Site access report"));
271 fprintf(fp_tt,"<tr><td class=\"header_l\">%s:&nbsp;%s</td></tr>\n",text[89],period);
272 fprintf(fp_tt,"<tr><td class=\"header_l\">%s:&nbsp;%s</td></tr>\n",text[90],name);
273 fprintf(fp_tt,"<tr><td class=\"header_l\">%s:&nbsp;%s, %s</td></tr>\n",text[104],UserSortField,UserSortOrder);
274 fprintf(fp_tt,"<tr><th class=\"header_c\">%s</th></tr>\n",text[32]);
275 close_html_header(fp_tt);
276
277 fputs("<div class=\"report\"><table cellpadding=\"0\" cellspacing=\"2\">\n",fp_tt);
278 fputs("<tr><td></td><td></td></tr>",fp_tt);
279 bzero(tmp4, MAXLEN);
280 strncpy(tmp4,text[110],4);
281 fprintf(fp_tt,"<tr><th class=\"header_l\">%s</th><th class=\"header_l\">%s</th><th class=\"header_l\">%s</th></tr>\n",text[91],tmp4,text[110]+5);
282 }
283
284 fputs("<tr><td class=\"data\">",fp_tt);
285 output_html_string(fp_tt,accurl,100);
286 fprintf(fp_tt,"</td><td class=\"data\">%s</td><td class=\"data\">%s</td></tr>\n",accdia,acchora);
287
288 url_len=strlen(accurl);
289 if (!oldurltt || url_len>=ourltt_size) {
290 ourltt_size=url_len+1;
291 oldurltt=realloc(oldurltt,ourltt_size);
292 if (!oldurltt) {
293 debuga(_("Not enough memory to store the url"));
294 exit(1);
295 }
296 }
297 strcpy(oldurltt,accurl);
298 strcpy(oldaccdiatt,accdia);
299 strcpy(oldacchoratt,acchora);
300 }
301
302 strcpy(crc2,acccode);
303 str=strchr(crc2,'/');
304 if (str) *str='\0';
305 if(strstr(crc2,"MISS") != 0)
306 oucache+=accbytes;
307 else incache+=accbytes;
308
309 if(strcmp(accuser,oldaccuser) != 0) {
310 strcpy(wdirname,dirname);
311 day_totalize(tmp,oldaccuser,indexonly);
312 strcpy(oldaccuser,accuser);
313 }
314
315 strcpy(oldacccode,acccode);
316 strcpy(oldaccip,accip);
317 url_len=strlen(accurl);
318 if (url_len>=ourl_size) {
319 ourl_size=url_len+1;
320 oldurl=realloc(oldurl,ourl_size);
321 if (!oldurl) {
322 debuga(_("Not enough memory to store the url"));
323 exit(1);
324 }
325 }
326 strcpy(oldurl,accurl);
327 strcpy(oldaccdia,accdia);
328 strcpy(oldacchora,acchora);
329
330 }
331 bzero(user,sizeof(user));
332 fclose(fp_in);
333 unlink(tmp3);
334 longline_free(&line);
335 if (oldurltt) free(oldurltt);
336 }
337 closedir(dirp);
338
339 if (oldurl) {
340 if(strstr(oldacccode,"DENIED") != 0)
341 strcpy(oldmsg,text[46]);
342 else
343 strcpy(oldmsg,"OK");
344 strcpy(wdirname,dirname);
345 if(oldaccuser[0] == '\0')
346 strcpy(oldaccuser,accuser);
347 gravatmpf(oldaccuser,wdirname,oldurl,nacc,nbytes,oldmsg,nelap,indexonly,incache,oucache);
348 strcpy(wdirname,dirname);
349 gravager(fp_gen,oldaccuser,nacc,oldurl,nbytes,oldaccip,oldacchora,oldaccdia,nelap,incache,oucache);
350 free(oldurl);
351 }
352 fclose(fp_gen);
353 day_totalize(tmp,oldaccuser,indexonly);
354
355 tmpsort();
356
357 strcpy(wdirname,dirname);
358 totalger(wdirname, debug, outdir);
359
360 if(email[0] == '\0') {
361 if((ReportType & REPORT_TYPE_DOWNLOADS) != 0) download_report();
362
363 if(DansGuardianConf[0] != '\0') {
364 strcpy(wdirname,dirname);
365 dansguardian_log();
366 }
367
368 strcpy(wdirname,dirname);
369 squidguard_log();
370
371 strcpy(wdirname,dirname);
372 topuser();
373
374 if((ReportType & REPORT_TYPE_TOPSITES) != 0) topsites();
375
376 if((ReportType & REPORT_TYPE_SITES_USERS) != 0) siteuser();
377 gen_denied_report();
378
379 strcpy(wdirname,dirname);
380 authfail_report();
381
382 if(smartfilter) smartfilter_report();
383
384 if(DansGuardianConf[0] != '\0') dansguardian_report();
385
386 squidguard_report();
387
388 if((ReportType & REPORT_TYPE_USERS_SITES) != 0) htmlrel();
389
390 make_index();
391
392 if(SuccessfulMsg) fprintf(stderr, "SARG: %s %s\n",text[47],dirname);
393 } else {
394 strcpy(wdirname,dirname);
395 geramail(wdirname, debug, outdir, userip, email, TempDir);
396
397 if((strcmp(email,"stdout") != 0) && SuccessfulMsg)
398 fprintf(stderr, "SARG: %s %s\n",text[48],email);
399 }
400
401 if(indexonly) {
402 strcpy(wdirname,dirname);
403 index_only(wdirname, debug);
404 }
405
406 /*
407 2009-10-13(Frederic) This piece of code is never called so it is commented out for good.
408 if(strlen(email) < 0)
409 removetmp(dirname);
410 */
411
412 return;
413 }
414
415 static void maketmp(const char *user, const char *dirname, int debug, int indexonly)
416 {
417
418 FILE *fp_ou;
419
420 char wdirname[MAXLEN];
421
422 if(indexonly) return;
423 if((ReportType & REPORT_TYPE_USERS_SITES) == 0) return;
424
425 strcpy(wdirname,tmp);
426 strcat(wdirname,"/");
427 strcat(wdirname,user);
428
429 if(debug){
430 debuga("%s: %s",text[49],wdirname);
431 }
432
433 strcat(wdirname,".utmp");
434 if((fp_ou=fopen(wdirname,"w"))==NULL){
435 fprintf(stderr, "SARG: (report) %s: %s\n",text[45],wdirname);
436 exit(1);
437 }
438
439 fclose(fp_ou);
440 return;
441 }
442
443
444 static void maketmp_hour(const char *user, const char *dirname, int indexonly)
445 {
446
447 FILE *fp_ou;
448
449 char wdirname[MAXLEN];
450
451 if(indexonly) return;
452 if((ReportType & REPORT_TYPE_USERS_SITES) == 0) return;
453
454 strcpy(wdirname,tmp);
455 strcat(wdirname,"/");
456 strcat(wdirname,user);
457
458 strcat(wdirname,".htmp");
459 if((fp_ou=fopen(wdirname,"w"))==NULL){
460 fprintf(stderr, "SARG: (report-1) %s: %s - %s\n",text[45],wdirname,strerror(errno));
461 exit(1);
462 }
463
464 fclose(fp_ou);
465 return;
466 }
467
468
469 void gravatmp(const char *oldaccuser, const char *oldurl, long long int nacc, long long int nbytes, const char *oldmsg, long long int nelap, int indexonly, long long int incache, long long int oucache)
470 {
471
472 FILE *fp_ou;
473 char wdirname[MAXLEN];
474
475 if(indexonly) return;
476 if((ReportType & REPORT_TYPE_USERS_SITES) == 0) return;
477
478 if (snprintf(wdirname,sizeof(wdirname),"%s/%s.utmp",tmp,oldaccuser)>=sizeof(wdirname)) {
479 debuga(_("Path too long %s/%s.utmp"),tmp,oldaccuser);
480 exit(1);
481 }
482
483 if((fp_ou=MY_FOPEN(wdirname,"a"))==NULL){
484 fprintf(stderr, "SARG: (report) %s: %s\n",text[45],wdirname);
485 exit(1);
486 }
487
488 fprintf(fp_ou,"%lld\t%lld\t%s\t%s\t%lld\t%lld\t%lld\n",nacc,nbytes,oldurl,oldmsg,nelap,incache,oucache);
489
490 fclose(fp_ou);
491 ttopen=0;
492
493 if(fp_tt) {
494 fputs("</table>\n</div>\n",fp_tt);
495 fputs("</body>\n</html>\n",fp_tt);
496 fclose(fp_tt);
497 fp_tt=NULL;
498 }
499
500 return;
501
502 }
503
504
505 static void gravatmp_hora(const char *dirname, const char *user, const char *data, const char *hora, long long int elap, long long int bytes, int indexonly)
506 {
507
508 FILE *fp_ou;
509 char wdirname[MAXLEN];
510
511 if(indexonly || ((ReportType & REPORT_TYPE_USERS_SITES) == 0)) return;
512
513 if (snprintf(wdirname,sizeof(wdirname),"%s/%s.htmp",tmp,user)>=sizeof(wdirname)) {
514 fprintf(stderr,"SARG: Path too long %s/%s.htmp\n",tmp,user);
515 exit(1);
516 }
517
518 if((fp_ou=MY_FOPEN(wdirname,"a"))==NULL){
519 fprintf(stderr, "SARG: (report-2) %s: %s - %s\n",text[45],wdirname,strerror(errno));
520 exit(1);
521 }
522
523 if(strcmp(datetimeby,"bytes") == 0) fprintf(fp_ou,"%s\t%s\t%lld\n",data,hora,bytes);
524 else fprintf(fp_ou,"%s\t%s\t%lld\n",data,hora,elap);
525
526 fclose(fp_ou);
527
528 return;
529 }
530
531
532 static void gravaporuser(const char *user, const char *dirname, const char *url, const char *ip, const char *data, const char *hora, long long int tam, long long int elap, int indexonly)
533 {
534
535 FILE *fp_ou;
536 char wdirname[MAXLEN];
537
538 if(indexonly || ((ReportType & REPORT_TYPE_USERS_SITES) == 0)) return;
539
540 if (snprintf(wdirname,sizeof(wdirname),"%s/%s.ip",tmp,user)>=sizeof(wdirname)) {
541 fprintf(stderr,"SARG: Path too long %s/%s.ip\n",tmp,user);
542 exit(1);
543 }
544
545 if((fp_ou=MY_FOPEN(wdirname,"a"))==NULL){
546 fprintf(stderr, "SARG: (report) %s: %s\n",text[45],wdirname);
547 exit(1);
548 }
549
550 fprintf(fp_ou,"%s\t%s\t%s\t%s\t%lld\t%lld\n",ip,url,data,hora,tam,elap);
551
552 fclose(fp_ou);
553
554 return;
555
556 }
557
558
559 static void gravatmpf(const char *oldaccuser, const char *dirname, const char *oldurl, long long int nacc, long long int nbytes, const char *oldmsg, long long int nelap, int indexonly, long long int incache, long long int oucache)
560 {
561
562 FILE *fp_ou;
563 char wdirname[MAXLEN];
564
565 if(indexonly || ((ReportType & REPORT_TYPE_USERS_SITES) == 0)) return;
566
567 if (snprintf(wdirname,sizeof(wdirname),"%s/%s.utmp",tmp,oldaccuser)>=sizeof(wdirname)) {
568 fprintf(stderr,"SARG: Path too long %s/%s.utmp\n",tmp,oldaccuser);
569 exit(1);
570 }
571
572 if((fp_ou=MY_FOPEN(wdirname,"a"))==NULL){
573 fprintf(stderr, "SARG: (report) %s: %s\n",text[45],wdirname);
574 exit(1);
575 }
576
577 fprintf(fp_ou,"%lld\t%lld\t%s\t%s\t%lld\t%lld\t%lld\n",nacc,nbytes,oldurl,oldmsg,nelap,incache,oucache);
578
579 fclose(fp_ou);
580 ttopen=0;
581 ind2=0;
582
583 if(fp_tt) {
584 fputs("</table>\n",fp_tt);
585 fputs("</body>\n</html>\n",fp_tt);
586 fclose(fp_tt);
587 fp_tt=NULL;
588 }
589
590 return;
591
592 }
593
594
595 static void gravager(FILE *fp_gen, const char *user, long long int nacc, const char *url, long long int nbytes, const char *ip, const char *hora, const char *dia, long long int nelap, long long int incache, long long int oucache)
596 {
597 fprintf(fp_gen,"%s\t%lld\t%lld\t%s\t%s\t%s\t%s\t%lld\t%lld\t%lld\n",user,nacc,nbytes,url,ip,hora,dia,nelap,incache,oucache);
598 return;
599
600 }
601
602 static void grava_SmartFilter(const char *dirname, const char *user, const char *ip, const char *data, const char *hora, const char *url, const char *smart)
603 {
604
605 FILE *fp_ou;
606 char wdirname[MAXLEN];
607
608 sprintf(wdirname,"%s/smartfilter.unsort",dirname);
609
610 if((fp_ou=MY_FOPEN(wdirname,"a"))==NULL){
611 fprintf(stderr, "SARG: (report) %s: %s\n",text[45],wdirname);
612 exit(1);
613 }
614
615 fprintf(fp_ou,"%s\t%s\t%s\t%s\t%s\t%s\n",user,data,hora,ip,url,smart);
616 fputs("</body>\n</html>\n",fp_tt);
617
618 fclose(fp_ou);
619
620 return;
621
622 }