]> git.ipfire.org Git - thirdparty/sarg.git/blobdiff - include/conf.h
Protect a few buffers against overflows
[thirdparty/sarg.git] / include / conf.h
index b4b2b8c6b4dd63d6f53f239241c2471621ad22ac..3e8582c70b5a4b9d210ba5f6d44c61c303f8ba0a 100755 (executable)
@@ -170,6 +170,14 @@ int mkstemps(char *template, int suffixlen);
 #define MAX_IP_LEN 64
 #define MAX_DATETIME_LEN 32
 #define MAXLOGS 255
+#define MAX_LOG_FILELEN 1024
+#define MAX_REDIRECTOR_LOGS 64
+#define MAX_REDIRECTOR_FILELEN 1024
+/*!
+Arbitrary limit on the number of days that are accepted in the selected range of the log file.
+Sarg will complain that there are too many days in the files if this limit is overrun.
+*/
+#define MAX_DATETIME_DAYS 1000
 
 #define REPORT_TYPE_USERS_SITES         0x0001UL
 #define REPORT_TYPE_SITE_USER_TIME_DATE 0x0002UL
@@ -221,6 +229,8 @@ int mkstemps(char *template, int suffixlen);
 #define INDEX_TREE_DATE 0x0001UL
 #define INDEX_TREE_FILE 0x0002UL
 
+#define INDEXFIELDS_DIRSIZE 0x0001UL
+
 #define NTLMUSERFORMAT_USER       0x0001UL
 #define NTLMUSERFORMAT_DOMAINUSER 0x0002UL
 
@@ -234,6 +244,39 @@ int mkstemps(char *template, int suffixlen);
 #define DISPLAY_BYTES 0x0001UL
 #define DISPLAY_ABBREV 0x0002UL
 
+#define DATETIME_ELAP 0x0001UL
+#define DATETIME_BYTE 0x0002UL
+
+#define REALTIME_UNAUTH_REC_SHOW   0x0001UL
+#define REALTIME_UNAUTH_REC_IGNORE 0x0002UL
+
+#define SORT_REVERSE 0x0001
+
+#define TOPUSER_SORT_REVERSE SORT_REVERSE
+#define TOPUSER_SORT_BYTES   0x0002UL
+#define TOPUSER_SORT_USER    0x0004UL
+#define TOPUSER_SORT_CONNECT 0x0008UL
+#define TOPUSER_SORT_TIME    0x0010UL
+
+#define TOPSITE_SORT_REVERSE SORT_REVERSE
+#define TOPSITE_SORT_BYTES   0x0002UL
+#define TOPSITE_SORT_CONNECT 0x0004UL
+#define TOPSITE_SORT_TIME    0x0008UL
+
+#define USER_SORT_REVERSE SORT_REVERSE
+#define USER_SORT_BYTES   0x0002UL
+#define USER_SORT_SITE    0x0004UL
+#define USER_SORT_CONNECT 0x0008UL
+#define USER_SORT_TIME    0x0010UL
+
+//! Value to exclude all the javascripts from the html page.
+#define HTML_JS_NONE 0x0000
+//! Bit to include sorttable.js in the html plage.
+#define HTML_JS_SORTTABLE 0x0001
+
+//! The character prefixed in front of the host names that are aliased.
+#define ALIAS_PREFIX '*'
+
 struct periodstruct
 {
    //! The first date of the period.
@@ -268,8 +311,7 @@ char MailUtility[PATH_MAX];
 int TopSitesNum;
 int TopUsersNum;
 char ExcludeCodes[256];
-char TopsitesSortField[15];
-char TopsitesSortType[20];
+unsigned long int TopsitesSort;
 unsigned long int ReportType;
 char UserTabFile[255];
 char warea[MAXLEN];
@@ -277,7 +319,7 @@ char name[MAXLEN];
 bool LongUrl;
 bool Ip2Name;
 int NAccessLog;
-char AccessLog[MAXLOGS][MAXLEN];
+char AccessLog[MAXLOGS][MAX_LOG_FILELEN];
 int AccessLogFromCmdLine;
 char Title[MAXLEN];
 char BgColor[MAXLEN];
@@ -298,10 +340,8 @@ char PasswdFile[MAXLEN];
 char TempDir[MAXLEN];
 char OutputDir[MAXLEN];
 char OutputEmail[MAXLEN];
-char TopuserSortField[30];
-char UserSortField[30];
-char TopuserSortOrder[10];
-char UserSortOrder[10];
+unsigned long int TopuserSort;
+unsigned long int UserSort;
 char UserAgentLog[255];
 char module[255];
 char ExcludeHosts[255];
@@ -311,7 +351,7 @@ char PerUserLimitFile[255];
 int PerUserLimit;
 bool UserIp;
 char MaxElapsed[255];
-char datetimeby[10];
+unsigned long int datetimeby;
 char CharSet[255];
 char UserInvalidChar[255];
 bool Graphs;
@@ -331,12 +371,14 @@ unsigned long int DataFileUrl;
 bool ShowReadStatistics;
 char IndexSortOrder[5];
 char DansGuardianConf[MAXLEN];
-bool DansguardianIgnoreDate;
+bool DansguardianFilterOutDate;
 char SquidGuardConf[MAXLEN];
 char SquidGuarddbHome[255];
-char SquidGuardLogFormat[MAXLEN];
-char SquidGuardLogAlternate[MAXLEN];
-bool SquidguardIgnoreDate;
+char RedirectorLogFormat[4096];
+int NRedirectorLogs;
+char RedirectorLogs[MAX_REDIRECTOR_LOGS][MAX_REDIRECTOR_FILELEN];
+int RedirectorLogFromCmdLine;
+bool RedirectorFilterOutDate;
 bool ShowSargInfo;
 bool BytesInSitesUsersReport;
 bool ShowSargLogo;
@@ -349,13 +391,16 @@ char wwwDocumentRoot[MAXLEN];
 char ExternalCSSFile[MAXLEN];
 char BlockIt[255];
 unsigned long int NtlmUserFormat;
+//! How to display the index of the reports.
 unsigned long int IndexTree;
+//! The columns to show in the index of the reports.
+unsigned long int IndexFields;
 bool UserAuthentication;
 char AuthUserTemplateFile[1024];
+//! \c True to use anonymous file and directory names in the report.
+bool AnonymousOutputFiles;
 char val1[MAXLEN];
-char val2[MAXLEN];
 char val3[MAXLEN];
-char val4[MAXLEN];
 char val5[MAXLEN];
 char val6[MAXLEN];
 char val7[MAXLEN];
@@ -363,9 +408,6 @@ char val8[MAXLEN];
 char val9[MAXLEN];
 char val10[MAXLEN];
 char val11[MAXLEN];
-char wwork1[MAXLEN];
-char wwork2[MAXLEN];
-char wwork3[MAXLEN];
 char mask[MAXLEN];
 char site[MAXLEN];
 char us[50];
@@ -378,7 +420,7 @@ char Ulimit[6];
 char RealtimeTypes[1024];
 char cmd[255];
 char ImageFile[255];
-char RealtimeUnauthRec[15];
+unsigned long int RealtimeUnauthRec;
 char LDAPHost[255];
 char LDAPBindDN[512];
 char LDAPBindPW[255];
@@ -388,6 +430,10 @@ char LDAPBaseSearch[255];
 char LDAPFilterSearch[512];
 char LDAPTargetAttr[64];
 char GraphFont[MAXLEN];
+//! The full path to sorttable.js if the table in the reports must be dynamicaly sorted.
+char SortTableJs[256];
+//! The name of the file containing the host names to replace by an alias in the report.
+char HostAliasFile[512];
 
 int  idate;
 int  smartfilter;
@@ -395,7 +441,7 @@ int  denied_count;
 int  download_count;
 int  authfail_count;
 int  dansguardian_count;
-int  squidguard_count;
+int  redirector_count;
 int  useragent_count;
 int  limit_flag;
 int  z1, z2, z3;
@@ -405,7 +451,7 @@ int  isalog;
 int  dfrom;
 int  duntil;
 int  dataonly;
-int  indexonly;
+bool  indexonly;
 bool  iprel;
 int  langcode;
 int  debug;
@@ -435,6 +481,3 @@ typedef struct
 { int list[ 24 ];
   int len;
 } numlist;
-
-DIR *dirp;
-struct dirent *direntp;