sarg  2.4.0
About: SARG ia a Squid Analysis Report Generator.
  Fossies Dox: sarg-2.4.0.tar.gz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

getconf.c
Go to the documentation of this file.
1 /*
2  * SARG Squid Analysis Report Generator http://sarg.sourceforge.net
3  * 1998, 2015
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 #include "include/filelist.h"
30 
31 #define SET_LIST(list) list,sizeof(list)/sizeof(list[0])
32 
35 
37 static int IncludeLevel=0;
38 
39 extern int hours[24], weekdays[7];
41 extern int PerUserLimitsNumber;
44 extern char ImageDir[MAXLEN];
46 extern bool UserAgentFromCmdLine;
47 extern char StripUserSuffix[MAX_USER_LEN];
48 extern int StripSuffixLen;
49 
50 struct param_list
51 {
53  const char *name;
55  unsigned long int value;
57  unsigned long int exclude;
58 };
59 
60 struct sort_list
61 {
63  const char *name;
65  unsigned long int value;
66 };
67 
69 {
71  const char *name;
73  int value;
74 };
75 
77 {
78  {"users_sites",REPORT_TYPE_USERS_SITES,0},
79  {"topusers",REPORT_TYPE_TOPUSERS,0},
80  {"topsites",REPORT_TYPE_TOPSITES,0},
81  {"sites_users",REPORT_TYPE_SITES_USERS,0},
82  {"date_time",REPORT_TYPE_DATE_TIME,0},
83  {"denied",REPORT_TYPE_DENIED,0},
84  {"auth_failures",REPORT_TYPE_AUTH_FAILURES,0},
85  {"site_user_time_date",REPORT_TYPE_SITE_USER_TIME_DATE,0},
86  {"downloads",REPORT_TYPE_DOWNLOADS,0},
87  {"user_agent",REPORT_TYPE_USERAGENT,0},
88 };
89 
90 static struct param_list data_field_values[]=
91 {
92  {"user",DATA_FIELD_USER,0},
93  {"date",DATA_FIELD_DATE,0},
94  {"time",DATA_FIELD_TIME,0},
95  {"url",DATA_FIELD_URL,0},
96  {"connect",DATA_FIELD_CONNECT,0},
97  {"bytes",DATA_FIELD_BYTES,0},
98  {"in_cache",DATA_FIELD_IN_CACHE,0},
99  {"out_cache",DATA_FIELD_OUT_CACHE,0},
100  {"elapsed",DATA_FIELD_ELAPSED,0},
101 };
102 
104 {
105  {"NUM",TOPUSERFIELDS_NUM,0},
106  {"DATE_TIME",TOPUSERFIELDS_DATE_TIME,0},
107  {"USERID",TOPUSERFIELDS_USERID,0},
108  {"USERIP",TOPUSERFIELDS_USERIP,0},
109  {"CONNECT",TOPUSERFIELDS_CONNECT,0},
110  {"BYTES",TOPUSERFIELDS_BYTES,0},
111  {"%BYTES",TOPUSERFIELDS_SETYB,0},
112  {"SETYB",TOPUSERFIELDS_SETYB,0},
113  {"IN-CACHE-OUT",TOPUSERFIELDS_IN_CACHE_OUT,0},
114  {"USED_TIME",TOPUSERFIELDS_USED_TIME,0},
115  {"MILISEC",TOPUSERFIELDS_MILISEC,0},
116  {"%TIME",TOPUSERFIELDS_PTIME,0},
117  {"TOTAL",TOPUSERFIELDS_TOTAL,0},
118  {"AVERAGE",TOPUSERFIELDS_AVERAGE,0},
119 };
120 
122 {
123  {"CONNECT",USERREPORTFIELDS_CONNECT,0},
124  {"BYTES",USERREPORTFIELDS_BYTES,0},
125  {"%BYTES",USERREPORTFIELDS_SETYB,0},
126  {"SETYB",USERREPORTFIELDS_SETYB,0},
127  {"IN-CACHE-OUT",USERREPORTFIELDS_IN_CACHE_OUT,0},
128  {"USED_TIME",USERREPORTFIELDS_USED_TIME,0},
129  {"MILISEC",USERREPORTFIELDS_MILISEC,0},
130  {"%TIME",USERREPORTFIELDS_PTIME,0},
131  {"TOTAL",USERREPORTFIELDS_TOTAL,0},
132  {"AVERAGE",USERREPORTFIELDS_AVERAGE,0},
133 };
134 
135 static struct param_list index_values[]=
136 {
137  {"yes",INDEX_YES,~INDEX_YES},
138  {"no",INDEX_NO,~INDEX_NO},
139  {"only",INDEX_ONLY,~INDEX_ONLY},
140 };
141 
143 {
146 };
147 
149 {
150  {"DIRSIZE",INDEXFIELDS_DIRSIZE,0},
151 };
152 
154 {
156  {"domainname+username",NTLMUSERFORMAT_DOMAINUSER,~NTLMUSERFORMAT_DOMAINUSER},
157 };
158 
159 static struct param_list recnouser_values[]=
160 {
164 };
165 
167 {
170 };
171 
173 {
174  {"bytes",DISPLAY_BYTES,~DISPLAY_BYTES},
175  {"abbreviation",DISPLAY_ABBREV,~DISPLAY_ABBREV},
176 };
177 
178 static struct param_list datetime_values[]=
179 {
180  {"elap",DATETIME_ELAP,0},
181  {"bytes",DATETIME_BYTE,0},
182 };
183 
185 {
188 };
189 
191 {
192  {"BYTES",TOPUSER_SORT_BYTES},
193  {"USER",TOPUSER_SORT_USER},
194  {"CONNECT",TOPUSER_SORT_CONNECT},
195  {"TIME",TOPUSER_SORT_TIME},
196 };
197 
199 {
200  {"BYTES",TOPSITE_SORT_BYTES},
201  {"CONNECT",TOPSITE_SORT_CONNECT},
202  {"TIME",TOPSITE_SORT_TIME},
203  {"USER",TOPSITE_SORT_USER},
204 };
205 
207 {
208  {"BYTES",USER_SORT_BYTES},
209  {"SITE",USER_SORT_SITE},
210  {"CONNECT",USER_SORT_CONNECT},
211  {"TIME",USER_SORT_TIME},
212 };
213 
215 {
216  {"always",PUFC_Always}, //always create an empty file
217  {"as_required",PUFC_AsRequired}, //create the file if necessary (no empty file is created)
218 };
219 
220 static int is_param(const char *param,const char *buf)
221 {
222  int plen;
223 
224  plen=strlen(param);
225  if (strncmp(buf,param,plen) != 0) return(0);
226  buf+=plen;
227  if ((unsigned char)*buf>' ') return(0);
228  return(1);
229 }
230 
231 static int getparam_string(const char *param,char *buf,char *value,int value_size)
232 {
233  int plen;
234 
235  plen=strlen(param);
236  if (strncmp(buf,param,plen) != 0) return(0);
237  buf+=plen;
238  if ((unsigned char)*buf>' ') return(0);
239  while (*buf && (unsigned char)*buf<=' ') buf++;
240 
241  if (strlen(buf)>=value_size) {
242  debuga(__FILE__,__LINE__,_("The string value of parameter \"%s\" is too long\n"),param);
243  exit(EXIT_FAILURE);
244  }
245  strcpy(value,buf);
246  fixnone(value);
247  return(1);
248 }
249 
262 static char *getparam_stringptr(const char *param,char *buf)
263 {
264  int plen;
265 
266  plen=strlen(param);
267  if (strncmp(buf,param,plen) != 0) return(NULL);
268  buf+=plen;
269  if ((unsigned char)*buf>' ') return(NULL);
270  while (*buf && (unsigned char)*buf<=' ') buf++;
271 
272  return(buf);
273 }
274 
275 static int getparam_quoted(const char *param,char *buf,char *value,int value_size)
276 {
277  int plen;
278  int i;
279 
280  plen=strlen(param);
281  if (strncmp(buf,param,plen) != 0) return(0);
282  buf+=plen;
283  if ((unsigned char)*buf>' ') return(0);
284  while (*buf && (unsigned char)*buf<=' ') buf++;
285 
286  if (*buf != '\"') {
287  debuga(__FILE__,__LINE__,_("Missing double quote after parameter \"%s\"\n"),param);
288  exit(EXIT_FAILURE);
289  }
290  buf++;
291 
292  value_size--;
293  for (i=0 ; i<value_size && *buf && *buf!='\"' ; i++) {
294  value[i]=*buf++;
295  }
296  value[i]='\0';
297 
298  if (*buf != '\"') {
299  debuga(__FILE__,__LINE__,_("Missing double quote after parameter \"%s\" or value is more than %d bytes long\n"),param,value_size);
300  exit(EXIT_FAILURE);
301  }
302  fixnone(value);
303  return(1);
304 }
305 
306 static int getparam_2words(const char *param,char *buf,char *word1,int word1_size,char *word2,int word2_size)
307 {
308  int plen;
309  int i;
310 
311  plen=strlen(param);
312  if (strncmp(buf,param,plen) != 0) return(0);
313  buf+=plen;
314  if ((unsigned char)*buf>' ') return(0);
315  while (*buf && (unsigned char)*buf<=' ') buf++;
316 
317  for (i=0 ; i<word1_size && *buf && (unsigned char)*buf>' ' ; i++)
318  word1[i]=*buf++;
319  if (i>=word1_size) {
320  debuga(__FILE__,__LINE__,_("The first word of parameter \"%s\" is more than %d bytes long\n"),param,word1_size-1);
321  exit(EXIT_FAILURE);
322  }
323  if (*buf!=' ') {
324  debuga(__FILE__,__LINE__,_("Missing second word for parameter \"%s\"\n"),param);
325  exit(EXIT_FAILURE);
326  }
327  word1[i]=0;
328 
329  while (*buf && (unsigned char)*buf<=' ') buf++;
330 
331  for (i=0 ; i<word2_size && *buf && (unsigned char)*buf>' ' ; i++)
332  word2[i]=*buf++;
333  if (i>=word2_size) {
334  debuga(__FILE__,__LINE__,_("The second word of parameter \"%s\" is more than %d bytes long\n"),param,word2_size-1);
335  exit(EXIT_FAILURE);
336  }
337  word2[i]=0;
338 
339  fixnone(word1);
340  fixnone(word2);
341  return(1);
342 }
343 
344 static int getparam_int(const char *param,char *buf,int *value)
345 {
346  int plen;
347  int next;
348 
349  plen=strlen(param);
350  if (strncmp(buf,param,plen) != 0) return(0);
351  buf+=plen;
352  if ((unsigned char)*buf>' ') return(0);
353  while (*buf && (unsigned char)*buf<=' ') buf++;
354 
355  next=0;
356  if (sscanf(buf,"%d%n",value,&next) != 1 || (unsigned char)buf[next] > ' ') {
357  debuga(__FILE__,__LINE__,_("The integer value of parameter \"%s\" is invalid\n"),param);
358  exit(EXIT_FAILURE);
359  }
360  return(1);
361 }
362 
363 static int getparam_bool(const char *param,char *buf,bool *value)
364 {
365  int plen;
366  int i;
367  const char *bool_str="yes,true,on,1";
368 
369  plen=strlen(param);
370  if (strncmp(buf,param,plen) != 0) return(0);
371  buf+=plen;
372  if ((unsigned char)*buf>' ') return(0);
373  while (*buf && (unsigned char)*buf<=' ') buf++;
374 
375  *value=false;
376  for ( ; *bool_str ; bool_str+=i) {
377  for (i=0 ; bool_str[i] && bool_str[i]!=',' ; i++);
378  if (strncasecmp(bool_str,buf,i)==0) {
379  *value=true;
380  break;
381  }
382  if (bool_str[i]==',') i++;
383  }
384  return(1);
385 }
386 
387 static int getparam_list(const char *param,struct param_list *options,int noptions,char *buf,unsigned long int *value)
388 {
389  int plen;
390  char *str;
391  int i;
392 
393  plen=strlen(param);
394  if (strncmp(buf,param,plen) != 0) return(0);
395  buf+=plen;
396  if ((unsigned char)*buf>' ') return(0);
397  while (*buf && (unsigned char)*buf<=' ') buf++;
398 
399  *value=0UL;
400  while (*buf) {
401  str=buf;
402  while (*str && (unsigned char)*str>' ' && *str!=';') str++;
403  if (*str) {
404  *str++='\0';
405  while (*str && ((unsigned char)*str<=' ' || *str==';')) str++;
406  }
407  for (i=0 ; i<noptions && strcasecmp(buf,options[i].name) ; i++);
408  if (i>=noptions) {
409  debuga(__FILE__,__LINE__,_("Unknown value \"%s\" for parameter \"%s\"\n"),buf,param);
410  exit(EXIT_FAILURE);
411  }
412  if ((*value & options[i].exclude)!=0) {
413  debuga(__FILE__,__LINE__,_("Value \"%s\" conflicts with other selected values for parameter \"%s\"\n"),buf,param);
414  exit(EXIT_FAILURE);
415  }
416  *value|=options[i].value;
417  buf=str;
418  }
419  return(1);
420 }
421 
422 static int getparam_sort(const char *param,struct sort_list *options,int noptions,char *buf,unsigned long int *value)
423 {
424  int plen;
425  char *str, *order;
426  int i;
427 
428  plen=strlen(param);
429  if (strncmp(buf,param,plen) != 0) return(0);
430  buf+=plen;
431  if ((unsigned char)*buf>' ') return(0);
432  while (*buf && (unsigned char)*buf<=' ') buf++;
433 
434  str=buf;
435  order=NULL;
436  while (*str && (unsigned char)*str>' ') str++;
437  if (*str) {
438  *str++='\0';
439  while (*str && (unsigned char)*str<=' ') str++;
440  order=str;
441  }
442  for (i=0 ; i<noptions && strcasecmp(buf,options[i].name) ; i++);
443  if (i>=noptions) {
444  debuga(__FILE__,__LINE__,_("Unknown sort criterion \"%s\" for parameter \"%s\"\n"),buf,param);
445  exit(EXIT_FAILURE);
446  }
447  *value=options[i].value;
448 
449  if (order) {
450  str=order;
451  while (*str && (unsigned char)*str>' ') str++;
452  if (*str) {
453  *str++='\0';
454  while (*str && (unsigned char)*str<=' ') str++;
455  }
456  if (strcasecmp(order,"reverse")==0 || strcasecmp(order,"D")==0) {
458  } else if (strcasecmp(order,"normal")!=0 && strcasecmp(order,"A")!=0) {
459  debuga(__FILE__,__LINE__,_("Unknown sort order \"%s\" for parameter \"%s\"\n"),order,param);
460  exit(EXIT_FAILURE);
461  }
462  }
463 
464  buf=str;
465  return(1);
466 }
467 
468 static int getparam_select(const char *param,struct select_list *options,int noptions,char *buf,int *value)
469 {
470  int plen;
471  char *str;
472  int i;
473 
474  plen=strlen(param);
475  if (strncmp(buf,param,plen) != 0) return(0);
476  buf+=plen;
477  if ((unsigned char)*buf>' ') return(0);
478  while (*buf && (unsigned char)*buf<=' ') buf++;
479 
480  str=buf;
481  while (*buf && (unsigned char)*buf>' ' && *buf!=';') buf++;
482  *buf='\0';
483  for (i=0 ; i<noptions && strcasecmp(str,options[i].name) ; i++);
484  if (i>=noptions) {
485  debuga(__FILE__,__LINE__,_("Unknown value \"%s\" for parameter \"%s\"\n"),str,param);
486  exit(EXIT_FAILURE);
487  }
488  *value=options[i].value;
489  return(1);
490 }
491 
492 static int getparam_userlimit(const char *param,char *buf)
493 {
494  int plen;
495  char *file_begin,*file_end;
496  int limit;
497  int digit;
498  char *str;
499  int i;
500  enum PerUserOutputEnum output;
501  const struct
502  {
503  const char *name;
505  } output_types[]=
506  {
507  {"id",PUOE_UserId},
508  {"ip",PUOE_UserIp},
509  };
510 
511  plen=strlen(param);
512  if (strncmp(buf,param,plen) != 0) return(0);
513  buf+=plen;
514  if ((unsigned char)*buf>' ') return(0);
515  while (*buf && (unsigned char)*buf<=' ') buf++;
516 
517  /*
518  options are made of a file name, an integer limit and an optional
519  integer flag. The file name may contain spaces. We keep searching
520  until a valid number is found after a space.
521  */
522  file_begin=buf;
523  do {
524  while (*buf && (unsigned char)*buf>' ') buf++;
525  if (*buf!=' ') {
526  debuga(__FILE__,__LINE__,_("Missing limit in per_user_limit\n"));
527  exit(EXIT_FAILURE);
528  }
529  file_end=buf;
530  while (*buf && (unsigned char)*buf<=' ') buf++;
531  limit=0;
532  while (*buf && isdigit(*buf)) {
533  digit=*buf-'0';
534  if (limit>=(INT_MAX-digit)/10) break;
535  limit=limit*10+digit;
536  buf++;
537  }
538  } while (*buf && *buf!=' ');
539 
540  output=PUOE_UserId;
541  if (*buf==' ') {
542  while (*buf && (unsigned char)*buf<=' ') buf++;
543  str=buf;
544  while (*buf && (unsigned char)*buf>' ') buf++;
545  *buf='\0';
546  for (i=sizeof(output_types)/sizeof(output_types[0])-1 ; i>=0 ; i--)
547  if (strcasecmp(output_types[i].name,str)==0) {
548  output=output_types[i].value;
549  break;
550  }
551  if (i<0) {
552  debuga(__FILE__,__LINE__,_("Invalid output type in per_user_limit\n"));
553  exit(EXIT_FAILURE);
554  }
555  }
556 
558  debuga(__FILE__,__LINE__,_("Too many per_user_limit\n"));
559  exit(EXIT_FAILURE);
560  }
561  *file_end='\0';
566 
567  return(1);
568 }
569 
570 static void ccharset(char *CharSet)
571 {
572  if (strcmp(CharSet,"Latin2") == 0) strcpy(CharSet,"ISO-8859-2");
573  else if (strcmp(CharSet,"Latin3") == 0) strcpy(CharSet,"ISO-8859-3");
574  else if (strcmp(CharSet,"Latin4") == 0) strcpy(CharSet,"ISO-8859-4");
575  else if (strcmp(CharSet,"Cyrillic") == 0) strcpy(CharSet,"ISO-8859-5");
576  else if (strcmp(CharSet,"Arabic") == 0) strcpy(CharSet,"ISO-8859-6");
577  else if (strcmp(CharSet,"Greek") == 0) strcpy(CharSet,"ISO-8859-7");
578  else if (strcmp(CharSet,"Hebrew") == 0) strcpy(CharSet,"ISO-8859-8");
579  else if (strcmp(CharSet,"Latin5") == 0) strcpy(CharSet,"ISO-8859-9");
580  else if (strcmp(CharSet,"Latin6") == 0) strcpy(CharSet,"ISO-8859-10");
581  else if (strcmp(CharSet,"Japan") == 0) strcpy(CharSet,"EUC-JP");
582  else if (strcmp(CharSet,"Koi8-r") == 0) strcpy(CharSet,"KOI8-R");
583  /*
584  * Any other encoding name is left unchanged.
585  */
586  return;
587 }
588 
589 static void parmtest(char *buf,const char *File)
590 {
591  char wbuf[2048];
592  struct getwordstruct gwarea;
593  int iVal;
594 
595  while (*buf && (unsigned char)*buf<=' ') buf++;
596 
597  if (*buf == '#' || *buf == '\0')
598  return;
599 
601  printf(_("SARG: TAG: %s\n"),buf);
602 
603  if (getparam_string("background_color",buf,BgColor,sizeof(BgColor))>0) return;
604 
605  if (getparam_string("text_color",buf,TxColor,sizeof(TxColor))>0) return;
606 
607  if (getparam_string("text_bgcolor",buf,TxBgColor,sizeof(TxBgColor))>0) return;
608 
609  if (getparam_string("title_color",buf,TiColor,sizeof(TiColor))>0) return;
610 
611  if (getparam_string("logo_image",buf,LogoImage,sizeof(LogoImage))>0) return;
612 
613  if (getparam_quoted("logo_text",buf,LogoText,sizeof(LogoText))>0) return;
614 
615  if (getparam_string("logo_text_color",buf,LogoTextColor,sizeof(LogoTextColor))>0) return;
616 
617  if (getparam_string("background_image",buf,BgImage,sizeof(BgImage))>0) return;
618 
619  if (getparam_bool("show_sarg_info",buf,&ShowSargInfo)>0) return;
620 
621  if (getparam_bool("show_sarg_logo",buf,&ShowSargLogo)>0) return;
622 
623  if (getparam_string("font_face",buf,FontFace,sizeof(FontFace))>0) return;
624 
625  if (getparam_string("header_color",buf,HeaderColor,sizeof(HeaderColor))>0) return;
626 
627  if (getparam_string("header_bgcolor",buf,HeaderBgColor,sizeof(HeaderBgColor))>0) return;
628 
629  if (getparam_string("font_size",buf,FontSize,sizeof(FontSize))>0) return;
630 
631  if (getparam_string("header_font_size",buf,HeaderFontSize,sizeof(HeaderFontSize))>0) return;
632 
633  if (getparam_string("title_font_size",buf,TitleFontSize,sizeof(TitleFontSize))>0) return;
634 
635  if (getparam_2words("image_size",buf,Width,sizeof(Width),Height,sizeof(Height))>0) return;
636 
637  if (getparam_quoted("title",buf,Title,sizeof(Title))>0) return;
638 
639  if (strncasecmp(buf,"resolve_ip",10)==0) {
640  if (ip2name_config(buf+10)>0) return;
641  }
642 
643  if (getparam_bool("user_ip",buf,&UserIp)>0) return;
644 
645  if (getparam_string("max_elapsed",buf,MaxElapsed,sizeof(MaxElapsed))>0) return;
646 
647  if (is_param("date_format",buf)) {
648  getword_start(&gwarea,buf);
649  if (getword_multisep(wbuf,sizeof(wbuf),&gwarea,' ')<0) {
650  debuga(__FILE__,__LINE__,_("Invalid record in \"date_format\" parameter\n"));
651  exit(EXIT_FAILURE);
652  }
653  DateFormat=gwarea.current[0];
654  return;
655  }
656 
657  if (is_param("hours",buf)) {
658  getnumlist("hours", buf, hours, 24);
659  }
660 
661  if (is_param("weekdays",buf)) {
662  getnumlist("weekdays", buf, weekdays, 7);
663  }
664 
665  if (getparam_sort("topuser_sort_field",SET_LIST(topuser_sort),buf,&TopuserSort)>0) return;
666 
667  if (getparam_sort("user_sort_field",SET_LIST(user_sort),buf,&UserSort)>0) return;
668 
669  if (is_param("access_log",buf)>0) {
670  if (AccessLogFromCmdLine==0) {
671  char *FileName=getparam_stringptr("access_log",buf);
672  if (!AccessLog)
674  if (!FileList_AddFile(AccessLog,FileName)) {
675  debuga(__FILE__,__LINE__,_("Not enough memory to store the input log file names\n"));
676  exit(EXIT_FAILURE);
677  }
678  }
679  return;
680  }
681 
682  if (is_param("redirector_log",buf)>0) {
683  if (RedirectorLogFromCmdLine==0) {
685  debuga(__FILE__,__LINE__,_("Too many redirector log files in configuration file\n"));
686  exit(EXIT_FAILURE);
687  }
689  NRedirectorLogs++;
690  }
691  return;
692  }
693 
694  if (is_param("useragent_log",buf)>0) {
695  if (!UserAgentFromCmdLine) {
696  if (!UserAgentLog)
698  char *FileName=getparam_stringptr("useragent_log",buf);
699  if (!FileList_AddFile(UserAgentLog,FileName)) {
700  debuga(__FILE__,__LINE__,_("Not enough memory to store a user agent file name\n"));
701  exit(EXIT_FAILURE);
702  }
703  }
704  return;
705  }
706 
707  if (getparam_string("exclude_hosts",buf,ExcludeHosts,sizeof(ExcludeHosts))>0) return;
708 
709  if (getparam_string("exclude_codes",buf,ExcludeCodes,sizeof(ExcludeCodes))>0) return;
710 
711  if (getparam_string("exclude_users",buf,ExcludeUsers,sizeof(ExcludeUsers))>0) return;
712 
713  if (getparam_string("password",buf,PasswdFile,sizeof(PasswdFile))>0) return;
714 
715  if (getparam_string("temporary_dir",buf,TempDir,sizeof(TempDir))>0) return;
716 
717  if (getparam_string("temporary_dir_path",buf,TempDirPath,sizeof(TempDirPath))>0) return;
718 
719  if (getparam_list("report_type",SET_LIST(report_type_values),buf,&ReportType)>0) return;
720 
721  if (getparam_string("output_dir",buf,OutputDir,sizeof(OutputDir))>0) return;
722 
723  if (getparam_bool("anonymous_output_files",buf,&AnonymousOutputFiles)>0) return;
724 
725  if (getparam_string("output_email",buf,OutputEmail,sizeof(OutputEmail))>0) return;
726 
727  if (getparam_userlimit("per_user_limit",buf)>0) return;
728 
729  if (getparam_select("per_user_limit_file_create",SET_LIST(per_user_limit_create_file),buf,&iVal)>0) {
731  return;
732  }
733 
734  if (getparam_int("lastlog",buf,&LastLog)>0) return;
735 
736  if (getparam_bool("remove_temp_files",buf,&RemoveTempFiles)>0) return;
737 
738  if (getparam_string("replace_index",buf,ReplaceIndex,sizeof(ReplaceIndex))>0) return;
739 
740  if (getparam_list("index_tree",SET_LIST(index_tree_values),buf,&IndexTree)>0) return;
741 
742  if (getparam_list("index",SET_LIST(index_values),buf,&Index)>0) return;
743 
744  if (getparam_list("index_fields",SET_LIST(indexfields_values),buf,&IndexFields)>0) return;
745 
746  if (getparam_bool("overwrite_report",buf,&OverwriteReport)>0) return;
747 
748  if (getparam_list("records_without_userid",SET_LIST(recnouser_values),buf,&RecordsWithoutUser)>0) return;
749 
750  if (getparam_bool("use_comma",buf,&UseComma)>0) return;
751 
752  if (getparam_string("mail_utility",buf,MailUtility,sizeof(MailUtility))>0) return;
753 
754  if (getparam_int("topsites_num",buf,&TopSitesNum)>0) return;
755 
756  if (getparam_int("topuser_num",buf,&TopUsersNum)>0) return;
757 
758  if (getparam_string("usertab",buf,UserTabFile,sizeof(UserTabFile))>0) return;
759 
760  if (getparam_string("index_sort_order",buf,IndexSortOrder,sizeof(IndexSortOrder))>0) return;
761 
762  if (getparam_sort("topsites_sort_order",SET_LIST(topsite_sort),buf,&TopsitesSort)>0) return;
763 
764  if (getparam_bool("long_url",buf,&LongUrl)>0) return;
765 
766  if (getparam_string("dansguardian_conf",buf,DansGuardianConf,sizeof(DansGuardianConf))>0) return;
767 
768  if (getparam_string("squidguard_conf",buf,SquidGuardConf,sizeof(SquidGuardConf))>0) return;
769 
770  if (getparam_list("date_time_by",SET_LIST(datetime_values),buf,&datetimeby)>0) return;
771 
772  if (getparam_string("charset",buf,CharSet,sizeof(CharSet))>0) {
773  ccharset(CharSet);
774  return;
775  }
776 
777  if (getparam_quoted("user_invalid_char",buf,UserInvalidChar,sizeof(UserInvalidChar))>0) return;
778 
779  if (getparam_quoted("include_users",buf,IncludeUsers+1,sizeof(IncludeUsers)-2)>0) {
780  IncludeUsers[0]=':';
781  strcat(IncludeUsers,":");
782  return;
783  }
784 
785  if (getparam_quoted("exclude_string",buf,ExcludeString,sizeof(ExcludeString))>0) return;
786 
787  if (getparam_bool("privacy",buf,&Privacy)>0) return;
788 
789  if (getparam_quoted("privacy_string",buf,PrivacyString,sizeof(PrivacyString))>0) return;
790 
791  if (getparam_string("privacy_string_color",buf,PrivacyStringColor,sizeof(PrivacyStringColor))>0) return;
792 
793  if (getparam_bool("show_successful_message",buf,&SuccessfulMsg)>0) return;
794 
795  if (getparam_bool("show_read_statistics",buf,&ShowReadStatistics)>0) return;
796 
797  if (getparam_bool("show_read_percent",buf,&ShowReadPercent)>0) return;
798 
799  if (getparam_list("topuser_fields",SET_LIST(topuserfields_values),buf,&TopUserFields)>0) return;
800 
801  if (getparam_bool("bytes_in_sites_users_report",buf,&BytesInSitesUsersReport)>0) return;
802 
803  if (getparam_list("user_report_fields",SET_LIST(userreportfields_values),buf,&UserReportFields)>0) return;
804 
805  if (getparam_string("datafile",buf,DataFile,sizeof(DataFile))>0) return;
806 
807  if (getparam_quoted("datafile_delimiter",buf,DataFileDelimiter,sizeof(DataFileDelimiter))>0) return;
808 
809  if (getparam_list("datafile_fields",SET_LIST(data_field_values),buf,&DataFileFields)>0) return;
810 
811  if (getparam_list("datafile_url",SET_LIST(datafileurl_values),buf,&DataFileUrl)>0) return;
812 
813  if (getparam_string("parsed_output_log",buf,ParsedOutputLog,sizeof(ParsedOutputLog))>0) return;
814 
815  if (getparam_string("parsed_output_log_compress",buf,ParsedOutputLogCompress,sizeof(ParsedOutputLogCompress))>0) return;
816 
817  if (getparam_list("displayed_values",SET_LIST(displayvalue_values),buf,&DisplayedValues)>0) return;
818 
819  if (getparam_int("authfail_report_limit",buf,&AuthfailReportLimit)>0) return;
820 
821  if (getparam_int("denied_report_limit",buf,&DeniedReportLimit)>0) return;
822 
823  if (getparam_int("siteusers_report_limit",buf,&SiteUsersReportLimit)>0) return;
824 
825  if (getparam_int("dansguardian_report_limit",buf,&DansGuardianReportLimit)>0) return;
826 
827  if (getparam_int("squidguard_report_limit",buf,&SquidGuardReportLimit)>0) return;
828 
829  if (getparam_int("user_report_limit",buf,&UserReportLimit)>0) return;
830 
831  if (getparam_int("download_report_limit",buf,&DownloadReportLimit)>0) return;
832 
833  if (getparam_string("www_document_root",buf,wwwDocumentRoot,sizeof(wwwDocumentRoot))>0) return;
834 
835  if (getparam_string("block_it",buf,BlockIt,sizeof(BlockIt))>0) return;
836 
837  if (getparam_string("external_css_file",buf,ExternalCSSFile,sizeof(ExternalCSSFile))>0) return;
838 
839  if (getparam_bool("user_authentication",buf,&UserAuthentication)>0) return;
840 
841  if (getparam_string("AuthUserTemplateFile",buf,wbuf,sizeof(wbuf))>0) {
842  if (is_absolute(wbuf)) {
843  if (strlen(wbuf)>=sizeof(AuthUserTemplateFile)) {
844  debuga(__FILE__,__LINE__,_("Template file name is too long in parameter \"AuthUserTemplateFile\"\n"));
845  exit(EXIT_FAILURE);
846  }
848  } else {
849  char dir[MAXLEN];
850 
851  safe_strcpy(dir,File,sizeof(dir));
852  if (snprintf(AuthUserTemplateFile,sizeof(AuthUserTemplateFile),"%s/%s",dirname(dir),wbuf)>=sizeof(AuthUserTemplateFile)) {
853  debuga(__FILE__,__LINE__,_("Template file name is too long in parameter \"AuthUserTemplateFile\"\n"));
854  exit(EXIT_FAILURE);
855  }
856  }
857  return;
858  }
859 
860  if (is_param("download_suffix",buf)) {
861  char warea[MAXLEN];
862 
863  getparam_quoted("download_suffix",buf,warea,sizeof(warea));
865  return;
866  }
867 
868  if (getparam_bool("graphs",buf,&Graphs)>0) {
869 #ifndef HAVE_GD
870  if (Graphs)
871  debugaz(__FILE__,__LINE__,_("No graphs available as sarg was not compiled with libgd. Set \"graphs\" to \"no\" in %s to disable this warning\n"),
872  File);
873 #endif
875  return;
876  }
877 
878  if (getparam_string("graph_days_bytes_bar_color",buf,GraphDaysBytesBarColor,sizeof(GraphDaysBytesBarColor))>0) return;
879 
880  if (getparam_string("redirector_log_format",buf,RedirectorLogFormat,sizeof(RedirectorLogFormat))>0) return;
881  if (getparam_string("squidguard_log_format",buf,RedirectorLogFormat,sizeof(RedirectorLogFormat))>0) {
882  debuga(__FILE__,__LINE__,_("squidguard_log_format is deprecated and has been replaced by redirector_log_format. Please update your configuration file.\n"));
883  return;
884  }
885 
886  if (getparam_bool("redirector_filter_out_date",buf,&RedirectorFilterOutDate)>0) return;
887  if (getparam_bool("redirector_ignore_date",buf,&RedirectorFilterOutDate)>0) {
888  /*
889  Due to an old bug in sarg before version 2.3, the option was having the opposite action than implied by the name.
890  */
891  debuga(__FILE__,__LINE__,_("redirector_ignore_date is deprecated and has been replaced by redirector_filter_out_date that does the action implied by its name as opposed to redirector_ignore_date. Please update your configuration file.\n"));
893  return;
894  }
895  if (getparam_bool("squidguard_ignore_date",buf,&RedirectorFilterOutDate)>0) {
896  debuga(__FILE__,__LINE__,_("squidguard_ignore_date is deprecated and has been replaced by redirector_filter_out_date that does the action implied by its name as opposed to squidguard_ignore_date. Please update your configuration file.\n"));
898  return;
899  }
900 
901  if (getparam_bool("dansguardian_filter_out_date",buf,&DansguardianFilterOutDate)>0) return;
902  if (getparam_bool("dansguardian_ignore_date",buf,&DansguardianFilterOutDate)>0) {
903  debuga(__FILE__,__LINE__,_("dansguardian_ignore_date is deprecated and has been replaced by dansguardian_filter_out_date that does the action implied by its name as opposed to dansguardian_ignore_date. Please update your configuration file.\n"));
905  return;
906  }
907 
908  if (getparam_string("ulimit",buf,Ulimit,sizeof(Ulimit))>0) return;
909 
910  if (getparam_list("ntlm_user_format",SET_LIST(ntml_userformat_values),buf,&NtlmUserFormat)>0) return;
911 
912  if (getparam_string("strip_user_suffix",buf,StripUserSuffix,sizeof(StripUserSuffix))>0) {
914  return;
915  }
916 
917  if (getparam_string("realtime_types",buf,RealtimeTypes,sizeof(RealtimeTypes))>0) return;
918 
919  if (getparam_list("realtime_unauthenticated_records",SET_LIST(realtime_unauth_values),buf,&RealtimeUnauthRec)>0) return;
920 
921  if (getparam_int("realtime_refresh_time",buf,&realtime_refresh)>0) return;
922 
923  if (getparam_int("realtime_access_log_lines",buf,&realtime_access_log_lines)>0) return;
924 
925  if (getparam_string("LDAPHost",buf,LDAPHost,sizeof(LDAPHost))>0) return;
926 
927  if (getparam_int("LDAPPort",buf,&LDAPPort)>0) return;
928 
929  if (getparam_int("LDAPProtocolVersion",buf,&LDAPProtocolVersion)>0) return;
930 
931  if (getparam_string("LDAPBindDN",buf,LDAPBindDN,sizeof(LDAPBindDN))>0) return;
932 
933  if (getparam_string("LDAPBindPW",buf,LDAPBindPW,sizeof(LDAPBindPW))>0) return;
934 
935  if (getparam_string("LDAPBaseSearch",buf,LDAPBaseSearch,sizeof(LDAPBaseSearch))>0) return;
936 
937  if (getparam_string("LDAPFilterSearch",buf,LDAPFilterSearch,sizeof(LDAPFilterSearch))>0) return;
938 
939  if (getparam_string("LDAPTargetAttr",buf,LDAPTargetAttr,sizeof(LDAPTargetAttr))>0) return;
940 
941  if (getparam_string("LDAPNativeCharset",buf,LDAPNativeCharset,sizeof(LDAPNativeCharset))>0) return;
942 
943  if (getparam_string("graph_font",buf,GraphFont,sizeof(GraphFont))>0) return;
944 
945  if (getparam_string("sorttable",buf,SortTableJs,sizeof(SortTableJs))>0) return;
946 
947  if (getparam_string("hostalias",buf,HostAliasFile,sizeof(HostAliasFile))>0) return;
948 
949  if (getparam_string("useralias",buf,UserAliasFile,sizeof(UserAliasFile))>0) return;
950 
951  if (getparam_bool("keep_temp_log",buf,&KeepTempLog)>0) return;
952 
953  if (getparam_int("max_successive_log_errors",buf,&NumLogSuccessiveErrors)>0) return;
954 
955  if (getparam_int("max_total_log_errors",buf,&NumLogTotalErrors)>0) return;
956 
957  if (strstr(buf,"squid24") != 0) {
958  squid24=true;
959  return;
960  }
961 
962  if (strstr(buf,"byte_cost") != 0) {
963  getword_start(&gwarea,buf);
964  if (getword_multisep(wbuf,sizeof(wbuf),&gwarea,' ')<0) {
965  debuga(__FILE__,__LINE__,_("The \"byte_cost\" parameter of the configuration file is invalid\n"));
966  exit(EXIT_FAILURE);
967  }
968  cost=atol(gwarea.current);
969  if (getword_multisep(wbuf,sizeof(wbuf),&gwarea,' ')<0) {
970  debuga(__FILE__,__LINE__,_("The \"byte_cost\" parameter of the configuration file is invalid\n"));
971  exit(EXIT_FAILURE);
972  }
973  nocost=my_atoll(gwarea.current);
974  return;
975  }
976 
977  if (getparam_string("image_dir",buf,ImageDir,sizeof(ImageDir))>0) return;
978 
979  printf(_("SARG: Unknown option %s\n"),buf);
980 }
981 
982 void getconf(const char *File)
983 {
984  FILE *fp_in;
985  char buf[MAXLEN];
986  char IncludeFile[MAXLEN];
987 
988  IncludeLevel++;
989  if (debug) {
990  if (IncludeLevel<=1)
991  debuga(__FILE__,__LINE__,_("Loading configuration file \"%s\"\n"),File);
992  else
993  debuga(__FILE__,__LINE__,_("Including configuration file \"%s\"\n"),File);
994  }
995 
996  // stop if include files are producing a loop
997  if (IncludeLevel>5) {
998  debuga(__FILE__,__LINE__,_("Too many nested configuration files included in \"%s\""),ConfigFile);
999  exit(EXIT_FAILURE);
1000  }
1001 
1002  if ((fp_in = fopen(File, "r")) == NULL) {
1003  debuga(__FILE__,__LINE__,_("Cannot open file \"%s\": %s\n"),File,strerror(errno));
1004  exit(EXIT_FAILURE);
1005  }
1006 
1007  while (fgets(buf, sizeof(buf), fp_in) != NULL) {
1008  fixendofline(buf);
1009 
1010  if (getparam_string("include",buf,IncludeFile,sizeof(IncludeFile))>0) {
1011  getconf(IncludeFile);
1012  continue;
1013  }
1014 
1015  if (debugz>=LogLevel_Data)
1016  printf("SYSCONFDIR %s\n",buf);
1017 
1018  parmtest(buf,File);
1019  }
1020 
1021  if (fclose(fp_in)==EOF) {
1022  debuga(__FILE__,__LINE__,_("Read error in \"%s\": %s\n"),File,strerror(errno));
1023  exit(EXIT_FAILURE);
1024  }
1025  IncludeLevel--;
1026 }
ExcludeUsers
char ExcludeUsers[255]
Definition: conf.h:363
DATA_FIELD_USER
#define DATA_FIELD_USER
Definition: conf.h:202
REPORT_TYPE_USERS_SITES
#define REPORT_TYPE_USERS_SITES
Definition: conf.h:191
USERREPORTFIELDS_MILISEC
#define USERREPORTFIELDS_MILISEC
Definition: conf.h:231
LogLevel_Data
@ LogLevel_Data
Display data about what is processed.
Definition: defs.h:21
MAX_REDIRECTOR_FILELEN
#define MAX_REDIRECTOR_FILELEN
Definition: conf.h:184
TitleFontSize
char TitleFontSize[5]
Definition: conf.h:410
AccessLog
FileListObject AccessLog
List of the input log files to process.
Definition: log.c:43
RECORDWITHOUTUSER_IGNORE
#define RECORDWITHOUTUSER_IGNORE
Definition: conf.h:249
LogoImage
char LogoImage[20000]
Definition: conf.h:345
AnonymousOutputFiles
bool AnonymousOutputFiles
True to use anonymous file and directory names in the report.
Definition: conf.h:422
USERREPORTFIELDS_TOTAL
#define USERREPORTFIELDS_TOTAL
Definition: conf.h:233
TOPUSERFIELDS_MILISEC
#define TOPUSERFIELDS_MILISEC
Definition: conf.h:220
LDAPProtocolVersion
int LDAPProtocolVersion
Definition: conf.h:449
cost
float cost
Definition: conf.h:508
MaxElapsed
char MaxElapsed[255]
Definition: conf.h:366
TOPUSERFIELDS_USED_TIME
#define TOPUSERFIELDS_USED_TIME
Definition: conf.h:219
userreportfields_values
static struct param_list userreportfields_values[]
Definition: getconf.c:121
param_list::exclude
unsigned long int exclude
The value is invalid if any bit of this mask is set in the parameter.
Definition: getconf.c:57
data_field_values
static struct param_list data_field_values[]
Definition: getconf.c:90
TopsitesSort
unsigned long int TopsitesSort
Definition: conf.h:331
DataFile
char DataFile[20000]
Definition: conf.h:380
getword_start
void getword_start(struct getwordstruct *gwarea, const char *line)
Definition: util.c:74
Ulimit
char Ulimit[6]
Definition: conf.h:440
debuga
void debuga(const char *File, int Line, const char *msg,...)
Definition: util.c:601
USERREPORTFIELDS_SETYB
#define USERREPORTFIELDS_SETYB
Definition: conf.h:228
ShowReadPercent
bool ShowReadPercent
Definition: conf.h:392
RemoveTempFiles
bool RemoveTempFiles
Definition: conf.h:321
IndexSortOrder
char IndexSortOrder[5]
Definition: conf.h:393
SET_LIST
#define SET_LIST(list)
Definition: getconf.c:31
HostAliasFile
char HostAliasFile[512]
The name of the file containing the host names to replace by an alias in the report.
Definition: conf.h:459
Index
unsigned long int Index
Definition: conf.h:323
TempDir
char TempDir[20000]
Definition: conf.h:355
LDAPNativeCharset
char LDAPNativeCharset[20]
Character set to convert the LDAP returned string to.
Definition: conf.h:454
StripSuffixLen
int StripSuffixLen
Length of the suffix to strip from the user name.
Definition: readlog.c:95
ntml_userformat_values
static struct param_list ntml_userformat_values[]
Definition: getconf.c:153
getparam_bool
static int getparam_bool(const char *param, char *buf, bool *value)
Definition: getconf.c:363
DansguardianFilterOutDate
bool DansguardianFilterOutDate
Definition: conf.h:395
PasswdFile
char PasswdFile[20000]
Definition: conf.h:354
UserInvalidChar
char UserInvalidChar[255]
Definition: conf.h:369
UserTabFile
char UserTabFile[255]
Definition: conf.h:333
FontFace
char FontFace[20000]
Definition: conf.h:350
NumLogTotalErrors
int NumLogTotalErrors
Definition: conf.h:469
HeaderFontSize
char HeaderFontSize[5]
Definition: conf.h:409
USERREPORTFIELDS_USED_TIME
#define USERREPORTFIELDS_USED_TIME
Definition: conf.h:230
REALTIME_UNAUTH_REC_SHOW
#define REALTIME_UNAUTH_REC_SHOW
Definition: conf.h:261
RedirectorFilterOutDate
bool RedirectorFilterOutDate
Definition: conf.h:402
TOPUSERFIELDS_USERID
#define TOPUSERFIELDS_USERID
Definition: conf.h:214
TOPUSERFIELDS_IN_CACHE_OUT
#define TOPUSERFIELDS_IN_CACHE_OUT
Definition: conf.h:218
AuthfailReportLimit
int AuthfailReportLimit
Definition: conf.h:491
TOPUSERFIELDS_SETYB
#define TOPUSERFIELDS_SETYB
Definition: conf.h:217
FileList_AddFile
bool FileList_AddFile(FileListObject FObj, const char *FileName)
Definition: filelist.c:294
PUFC_Always
@ PUFC_Always
Purge the file if it exists or create an empty file.
Definition: defs.h:159
LDAPFilterSearch
char LDAPFilterSearch[512]
Definition: conf.h:451
LastLog
int LastLog
Definition: conf.h:320
DeniedReportLimit
int DeniedReportLimit
Definition: conf.h:492
RedirectorLogFormat
char RedirectorLogFormat[4096]
Definition: conf.h:398
per_user_limit_create_file
static struct select_list per_user_limit_create_file[]
Definition: getconf.c:214
KeepTempLog
bool KeepTempLog
True to keep the temporary files for inspection.
Definition: conf.h:505
select_list::name
const char * name
The name of the value of the parameter.
Definition: getconf.c:71
AccessLogFromCmdLine
int AccessLogFromCmdLine
Definition: conf.h:338
UserAgentFromCmdLine
bool UserAgentFromCmdLine
Set to true if a useragent log is provided on the command line.
Definition: log.c:47
DATETIME_BYTE
#define DATETIME_BYTE
Definition: conf.h:259
NRedirectorLogs
int NRedirectorLogs
Definition: conf.h:399
OutputDir
char OutputDir[20000]
Definition: conf.h:357
LDAPHost
char LDAPHost[255]
Definition: conf.h:445
USERREPORTFIELDS_AVERAGE
#define USERREPORTFIELDS_AVERAGE
Definition: conf.h:234
DATAFILEURL_IP
#define DATAFILEURL_IP
Definition: conf.h:252
select_list
Definition: getconf.c:68
ParsedOutputLog
char ParsedOutputLog[20000]
Definition: conf.h:406
PUOE_UserIp
@ PUOE_UserIp
Definition: defs.h:170
HeaderBgColor
char HeaderBgColor[20000]
Definition: conf.h:352
_
#define _(String)
Definition: conf.h:155
topsite_sort
struct sort_list topsite_sort[]
Definition: getconf.c:198
ReplaceIndex
char ReplaceIndex[256]
Definition: conf.h:322
REPORT_TYPE_DATE_TIME
#define REPORT_TYPE_DATE_TIME
Definition: conf.h:196
MAXLEN
#define MAXLEN
Definition: conf.h:176
REPORT_TYPE_TOPUSERS
#define REPORT_TYPE_TOPUSERS
Definition: conf.h:193
TempDirPath
char TempDirPath[20000]
Definition: conf.h:356
INDEX_TREE_FILE
#define INDEX_TREE_FILE
Definition: conf.h:241
TxColor
char TxColor[20000]
Definition: conf.h:342
PerUserLimitStruct::Output
enum PerUserOutputEnum Output
What to write into the file.
Definition: defs.h:183
param_list::value
unsigned long int value
The bit to set if the value is found.
Definition: getconf.c:55
TOPUSER_SORT_TIME
#define TOPUSER_SORT_TIME
Definition: conf.h:270
SquidGuardReportLimit
int SquidGuardReportLimit
Definition: conf.h:496
BgColor
char BgColor[20000]
Definition: conf.h:340
weekdays
int weekdays[7]
Definition: getconf.c:39
select_list::value
int value
The value to assign when the name is selected.
Definition: getconf.c:73
user_sort
struct sort_list user_sort[]
Definition: getconf.c:206
INDEX_NO
#define INDEX_NO
Definition: conf.h:237
Width
char Width[20000]
Definition: conf.h:348
getparam_string
static int getparam_string(const char *param, char *buf, char *value, int value_size)
Definition: getconf.c:231
INDEX_TREE_DATE
#define INDEX_TREE_DATE
Definition: conf.h:240
MAX_USER_LEN
#define MAX_USER_LEN
Definition: conf.h:179
OutputEmail
char OutputEmail[20000]
Definition: conf.h:358
DATA_FIELD_ELAPSED
#define DATA_FIELD_ELAPSED
Definition: conf.h:210
LDAPPort
int LDAPPort
Definition: conf.h:448
USERREPORTFIELDS_BYTES
#define USERREPORTFIELDS_BYTES
Definition: conf.h:227
getparam_sort
static int getparam_sort(const char *param, struct sort_list *options, int noptions, char *buf, unsigned long int *value)
Definition: getconf.c:422
getparam_list
static int getparam_list(const char *param, struct param_list *options, int noptions, char *buf, unsigned long int *value)
Definition: getconf.c:387
DataFileFields
unsigned long int DataFileFields
Definition: conf.h:382
UserAgentLog
FileListObject UserAgentLog
Definition: useragent.c:31
LogoTextColor
char LogoTextColor[20000]
Definition: conf.h:347
report_type_values
static struct param_list report_type_values[]
Definition: getconf.c:76
warea
char warea[20000]
Definition: conf.h:334
name
char name[20000]
Definition: conf.h:335
getparam_select
static int getparam_select(const char *param, struct select_list *options, int noptions, char *buf, int *value)
Definition: getconf.c:468
StripUserSuffix
char StripUserSuffix[256]
Domain suffix to strip from the user name.
Definition: readlog.c:93
datetime_values
static struct param_list datetime_values[]
Definition: getconf.c:178
PerUserLimits
struct PerUserLimitStruct PerUserLimits[16]
Log user's who downloaded more than the limit.
Definition: html.c:33
DATETIME_ELAP
#define DATETIME_ELAP
Definition: conf.h:258
ConfigFile
char ConfigFile[20000]
Definition: conf.h:318
DISPLAY_ABBREV
#define DISPLAY_ABBREV
Definition: conf.h:256
parmtest
static void parmtest(char *buf, const char *File)
Definition: getconf.c:589
sort_list
Definition: getconf.c:60
DansGuardianConf
char DansGuardianConf[20000]
Definition: conf.h:394
UserAuthentication
bool UserAuthentication
Definition: conf.h:419
DisplayedValues
unsigned long int DisplayedValues
Definition: conf.h:408
BgImage
char BgImage[20000]
Definition: conf.h:341
is_absolute
int is_absolute(const char *path)
Definition: util.c:394
TOPUSERFIELDS_PTIME
#define TOPUSERFIELDS_PTIME
Definition: conf.h:221
DATA_FIELD_URL
#define DATA_FIELD_URL
Definition: conf.h:205
index_values
static struct param_list index_values[]
Definition: getconf.c:135
GraphDaysBytesBarColor
char GraphDaysBytesBarColor[255]
Definition: conf.h:371
ccharset
static void ccharset(char *CharSet)
Definition: getconf.c:570
DateFormat
char DateFormat
Definition: conf.h:364
DATA_FIELD_BYTES
#define DATA_FIELD_BYTES
Definition: conf.h:207
PUOE_UserId
@ PUOE_UserId
Definition: defs.h:169
sort_list::value
unsigned long int value
The bit to set if the value is found.
Definition: getconf.c:65
UserSort
unsigned long int UserSort
Definition: conf.h:360
INDEXFIELDS_DIRSIZE
#define INDEXFIELDS_DIRSIZE
Definition: conf.h:243
HeaderColor
char HeaderColor[20000]
Definition: conf.h:351
FileListStruct
List of files.
Definition: filelist.c:52
TOPUSERFIELDS_USERIP
#define TOPUSERFIELDS_USERIP
Definition: conf.h:224
indexfields_values
static struct param_list indexfields_values[]
Definition: getconf.c:148
IndexFields
unsigned long int IndexFields
The columns to show in the index of the reports.
Definition: conf.h:418
USER_SORT_CONNECT
#define USER_SORT_CONNECT
Definition: conf.h:281
NTLMUSERFORMAT_DOMAINUSER
#define NTLMUSERFORMAT_DOMAINUSER
Definition: conf.h:246
wwwDocumentRoot
char wwwDocumentRoot[20000]
Definition: conf.h:411
ReportType
unsigned long int ReportType
Definition: conf.h:332
TOPUSERFIELDS_DATE_TIME
#define TOPUSERFIELDS_DATE_TIME
Definition: conf.h:213
REALTIME_UNAUTH_REC_IGNORE
#define REALTIME_UNAUTH_REC_IGNORE
Definition: conf.h:262
FileList_Create
FileListObject FileList_Create(void)
Definition: filelist.c:106
PerUserLimitsNumber
int PerUserLimitsNumber
Number of limits.
Definition: html.c:31
TOPUSERFIELDS_TOTAL
#define TOPUSERFIELDS_TOTAL
Definition: conf.h:222
SortTableJs
char SortTableJs[256]
The full path to sorttable.js if the table in the reports must be dynamicaly sorted.
Definition: conf.h:457
IncludeLevel
static int IncludeLevel
How many include directives were followed.
Definition: getconf.c:37
DATAFILEURL_NAME
#define DATAFILEURL_NAME
Definition: conf.h:253
IndexTree
unsigned long int IndexTree
How to display the index of the reports.
Definition: conf.h:416
UserReportLimit
int UserReportLimit
Definition: conf.h:497
TOPUSERFIELDS_CONNECT
#define TOPUSERFIELDS_CONNECT
Definition: conf.h:215
DATA_FIELD_OUT_CACHE
#define DATA_FIELD_OUT_CACHE
Definition: conf.h:209
set_download_suffix
void set_download_suffix(const char *list)
Definition: download.c:345
TOPSITE_SORT_CONNECT
#define TOPSITE_SORT_CONNECT
Definition: conf.h:274
TOPUSER_SORT_BYTES
#define TOPUSER_SORT_BYTES
Definition: conf.h:267
TopUsersNum
int TopUsersNum
Definition: conf.h:329
USERREPORTFIELDS_PTIME
#define USERREPORTFIELDS_PTIME
Definition: conf.h:232
datetimeby
unsigned long int datetimeby
Definition: conf.h:367
DATA_FIELD_CONNECT
#define DATA_FIELD_CONNECT
Definition: conf.h:206
TopUserFields
unsigned long int TopUserFields
Definition: conf.h:378
conf.h
Include headers and define global variables. */.
nocost
long long int nocost
Definition: conf.h:507
UserAliasFile
char UserAliasFile[512]
The name of the file containing the user names to replace by an alias in the report.
Definition: conf.h:461
ParsedOutputLogCompress
char ParsedOutputLogCompress[512]
Definition: conf.h:407
filelist.h
INDEX_ONLY
#define INDEX_ONLY
Definition: conf.h:238
hours
int hours[24]
Definition: readlog.c:91
TOPUSER_SORT_USER
#define TOPUSER_SORT_USER
Definition: conf.h:268
RealtimeUnauthRec
unsigned long int RealtimeUnauthRec
Definition: conf.h:444
topuser_sort
struct sort_list topuser_sort[]
Definition: getconf.c:190
INDEX_YES
#define INDEX_YES
Definition: conf.h:236
ExcludeString
char ExcludeString[20000]
Definition: conf.h:376
recnouser_values
static struct param_list recnouser_values[]
Definition: getconf.c:159
BytesInSitesUsersReport
bool BytesInSitesUsersReport
Definition: conf.h:404
ip2name_config
int ip2name_config(const char *param)
Definition: ip2name.c:153
USERREPORTFIELDS_CONNECT
#define USERREPORTFIELDS_CONNECT
Definition: conf.h:226
USERREPORTFIELDS_IN_CACHE_OUT
#define USERREPORTFIELDS_IN_CACHE_OUT
Definition: conf.h:229
is_param
static int is_param(const char *param, const char *buf)
Definition: getconf.c:220
SuccessfulMsg
bool SuccessfulMsg
Definition: conf.h:377
DATA_FIELD_DATE
#define DATA_FIELD_DATE
Definition: conf.h:203
PerUserFileCreation
enum PerUserFileCreationEnum PerUserFileCreation
How to create a per user file.
Definition: html.c:35
ExternalCSSFile
char ExternalCSSFile[20000]
Definition: conf.h:412
GraphConfigFile
char GraphConfigFile[20000]
The configuration file from which the graph option was loaded.
Definition: getconf.c:34
getconf
void getconf(const char *File)
Definition: getconf.c:982
fixnone
void fixnone(char *str)
Definition: util.c:1900
RedirectorLogFromCmdLine
int RedirectorLogFromCmdLine
Definition: conf.h:401
DownloadReportLimit
int DownloadReportLimit
Definition: conf.h:493
REPORT_TYPE_DENIED
#define REPORT_TYPE_DENIED
Definition: conf.h:197
REPORT_TYPE_USERAGENT
#define REPORT_TYPE_USERAGENT
Definition: conf.h:200
Height
char Height[20000]
Definition: conf.h:349
TOPSITE_SORT_USER
#define TOPSITE_SORT_USER
Definition: conf.h:276
ExcludeCodes
char ExcludeCodes[256]
Definition: conf.h:330
TOPSITE_SORT_BYTES
#define TOPSITE_SORT_BYTES
Definition: conf.h:273
PerUserFileCreationEnum
PerUserFileCreationEnum
How to handle the per_user_limit file creation.
Definition: defs.h:156
NTLMUSERFORMAT_USER
#define NTLMUSERFORMAT_USER
Definition: conf.h:245
getparam_stringptr
static char * getparam_stringptr(const char *param, char *buf)
Definition: getconf.c:262
PUFC_AsRequired
@ PUFC_AsRequired
Delete old files and don't create a new file unless necessary.
Definition: defs.h:161
TOPUSER_SORT_CONNECT
#define TOPUSER_SORT_CONNECT
Definition: conf.h:269
NtlmUserFormat
unsigned long int NtlmUserFormat
Definition: conf.h:414
SiteUsersReportLimit
int SiteUsersReportLimit
Definition: conf.h:494
LDAPTargetAttr
char LDAPTargetAttr[64]
Definition: conf.h:452
UserReportFields
unsigned long int UserReportFields
Definition: conf.h:379
Privacy
bool Privacy
Definition: conf.h:372
squid24
bool squid24
Definition: conf.h:503
IncludeUsers
char IncludeUsers[20000]
Definition: conf.h:375
TOPUSERFIELDS_NUM
#define TOPUSERFIELDS_NUM
Definition: conf.h:212
getword_multisep
int getword_multisep(char *word, int limit, struct getwordstruct *gwarea, char stop)
Definition: util.c:134
LDAPBaseSearch
char LDAPBaseSearch[255]
Definition: conf.h:450
getwordstruct
Definition: defs.h:26
realtime_refresh
int realtime_refresh
Definition: conf.h:498
ShowSargInfo
bool ShowSargInfo
Definition: conf.h:403
TiColor
char TiColor[20000]
Definition: conf.h:344
REPORT_TYPE_DOWNLOADS
#define REPORT_TYPE_DOWNLOADS
Definition: conf.h:199
PrivacyString
char PrivacyString[255]
Definition: conf.h:373
getparam_int
static int getparam_int(const char *param, char *buf, int *value)
Definition: getconf.c:344
AuthUserTemplateFile
char AuthUserTemplateFile[1024]
Definition: conf.h:420
getwordstruct::current
const char * current
Definition: defs.h:28
ShowSargLogo
bool ShowSargLogo
Definition: conf.h:405
USER_SORT_SITE
#define USER_SORT_SITE
Definition: conf.h:280
FontSize
char FontSize[20000]
Definition: conf.h:353
param_list
Definition: getconf.c:50
REPORT_TYPE_AUTH_FAILURES
#define REPORT_TYPE_AUTH_FAILURES
Definition: conf.h:198
TOPUSERFIELDS_BYTES
#define TOPUSERFIELDS_BYTES
Definition: conf.h:216
sort_list::name
const char * name
The name of the value of the parameter.
Definition: getconf.c:63
getparam_quoted
static int getparam_quoted(const char *param, char *buf, char *value, int value_size)
Definition: getconf.c:275
displayvalue_values
static struct param_list displayvalue_values[]
Definition: getconf.c:172
DISPLAY_BYTES
#define DISPLAY_BYTES
Definition: conf.h:255
debugaz
void debugaz(const char *File, int Line, const char *msg,...)
Definition: util.c:646
MAX_USER_LIMITS
#define MAX_USER_LIMITS
Maximum number of limit files that can be stored.
Definition: conf.h:293
safe_strcpy
void safe_strcpy(char *dest, const char *src, int length)
Definition: util.c:1550
getparam_userlimit
static int getparam_userlimit(const char *param, char *buf)
Definition: getconf.c:492
LDAPBindPW
char LDAPBindPW[255]
Definition: conf.h:447
NumLogSuccessiveErrors
int NumLogSuccessiveErrors
The number of consecutive errors allowed in an input log file before the process is interrupted.
Definition: conf.h:463
TOPSITE_SORT_TIME
#define TOPSITE_SORT_TIME
Definition: conf.h:275
SquidGuardConf
char SquidGuardConf[20000]
Definition: conf.h:396
PrivacyStringColor
char PrivacyStringColor[30]
Definition: conf.h:374
RealtimeTypes
char RealtimeTypes[1024]
Definition: conf.h:441
datafileurl_values
static struct param_list datafileurl_values[]
Definition: getconf.c:166
ImageDir
char ImageDir[20000]
Directory where the images are stored.
Definition: util.c:50
USER_SORT_BYTES
#define USER_SORT_BYTES
Definition: conf.h:279
getnumlist
void getnumlist(const char *paramname, const char *buffer, int *list, int maxvalue)
Definition: util.c:1998
TopuserSort
unsigned long int TopuserSort
Definition: conf.h:359
topuserfields_values
static struct param_list topuserfields_values[]
Definition: getconf.c:103
defs.h
Declaration of the structures and functions.
CharSet
char CharSet[255]
Definition: conf.h:368
MAX_REDIRECTOR_LOGS
#define MAX_REDIRECTOR_LOGS
Definition: conf.h:183
LogoText
char LogoText[20000]
Definition: conf.h:346
LDAPBindDN
char LDAPBindDN[512]
Definition: conf.h:446
PerUserOutputEnum
PerUserOutputEnum
What to write into the per_user_limit file.
Definition: defs.h:167
REPORT_TYPE_SITES_USERS
#define REPORT_TYPE_SITES_USERS
Definition: conf.h:195
REPORT_TYPE_TOPSITES
#define REPORT_TYPE_TOPSITES
Definition: conf.h:194
DataFileDelimiter
char DataFileDelimiter[3]
Definition: conf.h:381
BlockIt
char BlockIt[255]
Definition: conf.h:413
RecordsWithoutUser
unsigned long int RecordsWithoutUser
Definition: conf.h:325
RedirectorLogs
char RedirectorLogs[64][1024]
Definition: conf.h:400
DansGuardianReportLimit
int DansGuardianReportLimit
Definition: conf.h:495
PerUserLimitStruct
How to log every user crossing the download limit.
Definition: defs.h:176
param_list::name
const char * name
The name of the value of the parameter.
Definition: getconf.c:53
debugz
int debugz
Definition: conf.h:490
ExcludeHosts
char ExcludeHosts[255]
Definition: conf.h:362
TopSitesNum
int TopSitesNum
Definition: conf.h:328
realtime_access_log_lines
int realtime_access_log_lines
Definition: conf.h:499
DataFileUrl
unsigned long int DataFileUrl
Definition: conf.h:383
Title
char Title[20000]
Definition: conf.h:339
MailUtility
char MailUtility[PATH_MAX]
Definition: conf.h:327
index_tree_values
static struct param_list index_tree_values[]
Definition: getconf.c:142
ShowReadStatistics
bool ShowReadStatistics
if true, show the number of lines read from the input log file during the reading of the file.
Definition: conf.h:385
TOPUSERFIELDS_AVERAGE
#define TOPUSERFIELDS_AVERAGE
Definition: conf.h:223
RECORDWITHOUTUSER_IP
#define RECORDWITHOUTUSER_IP
Definition: conf.h:248
SORT_REVERSE
#define SORT_REVERSE
Definition: conf.h:264
PerUserLimitStruct::Limit
int Limit
Limit above which the user is reported.
Definition: defs.h:181
UserIp
bool UserIp
Definition: conf.h:365
LongUrl
bool LongUrl
Definition: conf.h:336
fixendofline
void fixendofline(char *str)
Definition: util.c:1911
OverwriteReport
bool OverwriteReport
Definition: conf.h:324
REPORT_TYPE_SITE_USER_TIME_DATE
#define REPORT_TYPE_SITE_USER_TIME_DATE
Definition: conf.h:192
debug
int debug
Definition: conf.h:489
TxBgColor
char TxBgColor[20000]
Definition: conf.h:343
DATA_FIELD_IN_CACHE
#define DATA_FIELD_IN_CACHE
Definition: conf.h:208
DATA_FIELD_TIME
#define DATA_FIELD_TIME
Definition: conf.h:204
my_atoll
long long int my_atoll(const char *nptr)
Definition: util.c:372
UseComma
bool UseComma
Definition: conf.h:326
RECORDWITHOUTUSER_EVERYBODY
#define RECORDWITHOUTUSER_EVERYBODY
Definition: conf.h:250
USER_SORT_TIME
#define USER_SORT_TIME
Definition: conf.h:282
getparam_2words
static int getparam_2words(const char *param, char *buf, char *word1, int word1_size, char *word2, int word2_size)
Definition: getconf.c:306
realtime_unauth_values
static struct param_list realtime_unauth_values[]
Definition: getconf.c:184
Graphs
bool Graphs
Definition: conf.h:370
LogLevel_Process
@ LogLevel_Process
Process informational messages.
Definition: defs.h:15
GraphFont
char GraphFont[20000]
Definition: conf.h:455