]>
Commit | Line | Data |
---|---|---|
b3695c67 | 1 | #include "config.h" |
25697a35 GS |
2 | #include "info.h" |
3 | ||
b3695c67 FM |
4 | #ifdef HAVE_WINDOWS_H |
5 | #include <windows.h> | |
6 | #endif | |
7 | #ifdef HAVE_STDIO_H | |
25697a35 GS |
8 | #include <stdio.h> |
9 | #endif | |
b3695c67 | 10 | #ifdef HAVE_STDLIB_H |
25697a35 GS |
11 | #include <stdlib.h> |
12 | #endif | |
b3695c67 | 13 | #ifdef HAVE_STRING_H |
25697a35 GS |
14 | #include <string.h> |
15 | #endif | |
b3695c67 | 16 | #ifdef HAVE_STRINGS_H |
25697a35 GS |
17 | #include <strings.h> |
18 | #endif | |
b3695c67 | 19 | #ifdef HAVE_SYS_TIME_H |
25697a35 GS |
20 | #include <sys/time.h> |
21 | #endif | |
b3695c67 | 22 | #ifdef HAVE_TIME_H |
25697a35 GS |
23 | #include <time.h> |
24 | #endif | |
b3695c67 | 25 | #ifdef HAVE_SYS_RESOURCE_H |
25697a35 GS |
26 | #include <sys/resource.h> |
27 | #endif | |
b3695c67 | 28 | #ifdef HAVE_UNISTD_H |
25697a35 GS |
29 | #include <unistd.h> |
30 | #endif | |
b3695c67 | 31 | #if defined(HAVE_SYS_DIRENT_H) && !defined(HAVE_DIRENT_H) |
25697a35 GS |
32 | #include <sys/dirent.h> |
33 | #endif | |
b3695c67 | 34 | #ifdef HAVE_DIRENT_H |
25697a35 GS |
35 | #include <dirent.h> |
36 | #endif | |
b3695c67 | 37 | #ifdef HAVE_SYS_SOCKET_H |
25697a35 GS |
38 | #include <sys/socket.h> |
39 | #endif | |
b3695c67 | 40 | #ifdef HAVE_NETDB_H |
25697a35 GS |
41 | #include <netdb.h> |
42 | #endif | |
b3695c67 | 43 | #ifdef HAVE_TYPES_H |
25697a35 GS |
44 | #include <types.h> |
45 | #endif | |
b3695c67 | 46 | #ifdef HAVE_NETINET_IN_H |
25697a35 GS |
47 | #include <netinet/in.h> |
48 | #endif | |
b3695c67 | 49 | #ifdef HAVE_ARPA_INET_H |
25697a35 GS |
50 | #include <arpa/inet.h> |
51 | #endif | |
b3695c67 | 52 | #ifdef HAVE_SYS_STAT_H |
25697a35 GS |
53 | #include <sys/stat.h> |
54 | #endif | |
b3695c67 | 55 | #ifdef HAVE_CTYPE_H |
25697a35 GS |
56 | #include <ctype.h> |
57 | #endif | |
b3695c67 | 58 | #ifdef HAVE_ERRNO_H |
25697a35 GS |
59 | #include <errno.h> |
60 | #endif | |
b3695c67 | 61 | #ifdef HAVE_SYS_WAIT_H |
d96e3ba6 FM |
62 | #include <sys/wait.h> |
63 | #endif | |
b3695c67 | 64 | #ifdef HAVE_GD_H |
25697a35 GS |
65 | #include <gd.h> |
66 | #define HAVE_GD | |
67 | gdImagePtr im; | |
68 | gdPoint points[4]; | |
69 | #endif | |
b3695c67 | 70 | #ifdef HAVE_GDFONTL_H |
25697a35 GS |
71 | #include <gdfontl.h> |
72 | #endif | |
b3695c67 | 73 | #ifdef HAVE_GDFONTT_H |
25697a35 GS |
74 | #include <gdfontt.h> |
75 | #endif | |
b3695c67 | 76 | #ifdef HAVE_GDFONTS_H |
25697a35 GS |
77 | #include <gdfonts.h> |
78 | #endif | |
b3695c67 | 79 | #ifdef HAVE_GDFONTMB_H |
25697a35 GS |
80 | #include <gdfontmb.h> |
81 | #endif | |
b3695c67 | 82 | #ifdef HAVE_GDFONTG_H |
25697a35 GS |
83 | #include <gdfontg.h> |
84 | #endif | |
b3695c67 | 85 | #ifdef HAVE_STDARG_H |
d2fe0c32 FM |
86 | #include <stdarg.h> |
87 | #endif | |
b3695c67 | 88 | #ifdef HAVE_INTTYPES_H |
2357ef77 FM |
89 | #include <inttypes.h> |
90 | #endif | |
b3695c67 | 91 | #ifdef HAVE_LIMITS_H |
4af2f8ff FM |
92 | #include <limits.h> |
93 | #endif | |
b3695c67 FM |
94 | #ifdef HAVE_WINSOCK_H |
95 | #include <winsock.h> | |
96 | #endif | |
a1de61fe FM |
97 | #ifdef HAVE_LOCALE_H |
98 | #include <locale.h> | |
99 | #endif | |
e6414a9d FM |
100 | #ifdef HAVE_EXECINFO_H |
101 | #include <execinfo.h> | |
102 | #endif | |
25697a35 | 103 | |
b3695c67 | 104 | #if defined(HAVE_FOPEN64) |
25697a35 | 105 | #define _FILE_OFFSET_BITS 64 |
936c9905 | 106 | #define MY_FOPEN fopen64 |
25697a35 GS |
107 | #else |
108 | #define MY_FOPEN fopen | |
109 | #endif | |
110 | ||
b3695c67 FM |
111 | #if !defined(HAVE_BZERO) |
112 | #define bzero(mem,size) memset(mem,0,size) | |
113 | #endif | |
114 | ||
115 | #if defined(IBERTY_LIB) && !defined(HAVE_MKSTEMP) | |
116 | int mkstemps(char *template, int suffixlen); | |
117 | #define mkstemp(template) mkstemps(template,0) | |
118 | #endif | |
119 | ||
120 | #if defined(__MINGW32__) | |
121 | #define mkdir(p,m) _mkdir(p) | |
122 | ||
123 | #ifndef WIFEXITED | |
124 | #define WIFEXITED(S) 1 | |
125 | #endif | |
126 | ||
127 | #ifndef WEXITSTATUS | |
128 | #define WEXITSTATUS(S) (S) | |
129 | #endif | |
130 | ||
131 | #endif /*__MINGW32__*/ | |
25697a35 GS |
132 | |
133 | #define MAXLEN 20000 | |
0a4e18e1 FM |
134 | #define MAXLOGS 255 |
135 | ||
2357ef77 | 136 | FILE *fp_tt; |
25697a35 GS |
137 | |
138 | char outdir[MAXLEN]; | |
139 | char dirname[MAXLEN]; | |
140 | char buf[MAXLEN]; | |
141 | char url[MAXLEN]; | |
142 | char urly[MAXLEN]; | |
143 | char user[MAXLEN]; | |
d6e703cc | 144 | char period[MAXLEN]; |
25697a35 GS |
145 | char msg[1024]; |
146 | char per_hour[128]; | |
d6e703cc FM |
147 | char code[MAXLEN]; |
148 | char code2[MAXLEN]; | |
25697a35 | 149 | char tmp[MAXLEN]; |
25697a35 GS |
150 | char tmp3[MAXLEN]; |
151 | char tmp4[MAXLEN]; | |
152 | char tmp5[MAXLEN]; | |
153 | char tmp6[MAXLEN]; | |
d6e703cc | 154 | char tmp7[MAXLEN]; |
25697a35 GS |
155 | char parse_out[MAXLEN]; |
156 | char arqtt[MAXLEN]; | |
157 | char html[MAXLEN]; | |
158 | char datestimes[MAXLEN]; | |
159 | char ConfigFile[MAXLEN]; | |
160 | char href[MAXLEN]; | |
161 | char href2[MAXLEN]; | |
162 | char href3[MAXLEN]; | |
163 | char df[20]; | |
491b862f | 164 | char day[3], month[4], year[5]; |
25697a35 GS |
165 | char ltext110[50]; |
166 | char cdfrom[30]; | |
167 | char cduntil[30]; | |
0511cf2d | 168 | int LastLog; |
e6414a9d | 169 | int RemoveTempFiles; |
25697a35 | 170 | char ReplaceIndex[256]; |
491b862f | 171 | char Index[20]; |
e6414a9d | 172 | int OverwriteReport; |
d6e703cc | 173 | char u2[255]; |
25697a35 | 174 | char RecordsWithoutUser[20]; |
e6414a9d | 175 | int UseComma; |
4af2f8ff | 176 | char MailUtility[PATH_MAX]; |
491b862f | 177 | char TopSitesNum[20]; |
fb7c5f27 | 178 | int TopUsersNum; |
25697a35 GS |
179 | char ExcludeCodes[256]; |
180 | char TopsitesSortField[15]; | |
491b862f | 181 | char TopsitesSortType[20]; |
25697a35 GS |
182 | char ReportType[255]; |
183 | char UserTabFile[255]; | |
184 | char warea[MAXLEN]; | |
185 | char name[MAXLEN]; | |
246c8489 FM |
186 | int LongUrl; |
187 | int Ip2Name; | |
25697a35 | 188 | char language[255]; |
d6e703cc | 189 | char bufy[MAXLEN]; |
0a4e18e1 FM |
190 | int NAccessLog; |
191 | char AccessLog[MAXLOGS][MAXLEN]; | |
192 | int AccessLogFromCmdLine; | |
25697a35 GS |
193 | char Title[MAXLEN]; |
194 | char BgColor[MAXLEN]; | |
195 | char BgImage[MAXLEN]; | |
196 | char TxColor[MAXLEN]; | |
197 | char TxBgColor[MAXLEN]; | |
198 | char TiColor[MAXLEN]; | |
199 | char LogoImage[MAXLEN]; | |
200 | char LogoText[MAXLEN]; | |
201 | char LogoTextColor[MAXLEN]; | |
202 | char Width[MAXLEN]; | |
203 | char Height[MAXLEN]; | |
204 | char FontFace[MAXLEN]; | |
205 | char HeaderColor[MAXLEN]; | |
206 | char HeaderBgColor[MAXLEN]; | |
207 | char FontSize[MAXLEN]; | |
208 | char PasswdFile[MAXLEN]; | |
209 | char TempDir[MAXLEN]; | |
210 | char OutputDir[MAXLEN]; | |
211 | char OutputEmail[MAXLEN]; | |
212 | char TopuserSortField[30]; | |
213 | char UserSortField[30]; | |
214 | char TopuserSortOrder[10]; | |
215 | char UserSortOrder[10]; | |
216 | char UserAgentLog[255]; | |
217 | char module[255]; | |
218 | char ExcludeHosts[255]; | |
219 | char ExcludeUsers[255]; | |
220 | char DateFormat[2]; | |
221 | char PerUserLimitFile[255]; | |
e6414a9d | 222 | int PerUserLimit; |
246c8489 | 223 | int UserIp; |
25697a35 GS |
224 | char MaxElapsed[255]; |
225 | char datetimeby[10]; | |
226 | char csort[255]; | |
227 | char CharSet[255]; | |
228 | char UserInvalidChar[255]; | |
e6414a9d | 229 | int Graphs; |
25697a35 | 230 | char GraphDaysBytesBarColor[255]; |
e6414a9d | 231 | int Privacy; |
25697a35 GS |
232 | char PrivacyString[255]; |
233 | char PrivacyStringColor[30]; | |
234 | char IncludeUsers[MAXLEN]; | |
235 | char ExcludeString[MAXLEN]; | |
e6414a9d | 236 | int SuccessfulMsg; |
25697a35 GS |
237 | char TopUserFields[255]; |
238 | char UserReportFields[255]; | |
239 | char DataFile[MAXLEN]; | |
240 | char DataFileDelimiter[3]; | |
241 | char DataFileFields[MAXLEN]; | |
491b862f | 242 | char DataFileUrl[20]; |
25697a35 | 243 | char SiteUserTimeDateType[10]; |
e6414a9d | 244 | int ShowReadStatistics; |
25697a35 GS |
245 | char IndexSortOrder[5]; |
246 | char DansGuardianConf[MAXLEN]; | |
e6414a9d | 247 | int DansguardianIgnoreDate; |
25697a35 GS |
248 | char SquidGuardConf[MAXLEN]; |
249 | char SquidGuarddbHome[255]; | |
250 | char SquidGuardLogFormat[MAXLEN]; | |
491b862f | 251 | char SquidGuardLogAlternate[MAXLEN]; |
e6414a9d FM |
252 | int SquidguardIgnoreDate; |
253 | int ShowSargInfo; | |
254 | int BytesInSitesUsersReport; | |
255 | int ShowSargLogo; | |
25697a35 GS |
256 | char ParsedOutputLog[MAXLEN]; |
257 | char ParsedOutputLogCompress[255]; | |
258 | char DisplayedValues[20]; | |
933aca19 | 259 | char HeaderFontSize[5]; |
491b862f | 260 | char TitleFontSize[5]; |
25697a35 GS |
261 | char wwwDocumentRoot[MAXLEN]; |
262 | char ExternalCSSFile[MAXLEN]; | |
263 | char BlockIt[255]; | |
264 | char BlockImage[512]; | |
265 | char NtlmUserFormat[30]; | |
266 | char hbc1[30]; | |
267 | char hbc2[255]; | |
268 | char hbc3[30]; | |
269 | char hbc4[30]; | |
270 | char hbc5[30]; | |
271 | char hbc6[30]; | |
272 | char hbc7[30]; | |
273 | char hbc8[30]; | |
274 | char hbc9[30]; | |
275 | char hbc10[30]; | |
491b862f | 276 | char IndexTree[10]; |
e6414a9d | 277 | int UserAuthentication; |
25697a35 GS |
278 | char AuthUserFile[255]; |
279 | char AuthName[512]; | |
280 | char AuthType[255]; | |
281 | char Require[512]; | |
25697a35 GS |
282 | char *userfile; |
283 | char *str; | |
284 | char *str2; | |
285 | char text[200][255]; | |
286 | char val1[MAXLEN]; | |
287 | char val2[MAXLEN]; | |
288 | char val3[MAXLEN]; | |
289 | char val4[MAXLEN]; | |
290 | char val5[MAXLEN]; | |
291 | char val6[MAXLEN]; | |
292 | char val7[MAXLEN]; | |
293 | char val8[MAXLEN]; | |
294 | char val9[MAXLEN]; | |
295 | char val10[MAXLEN]; | |
296 | char val11[MAXLEN]; | |
297 | char wwork1[MAXLEN]; | |
298 | char wwork2[MAXLEN]; | |
299 | char wwork3[MAXLEN]; | |
25697a35 GS |
300 | char mask[MAXLEN]; |
301 | char httplink[MAXLEN]; | |
302 | char html_old[MAXLEN]; | |
25697a35 GS |
303 | char site[MAXLEN]; |
304 | char us[50]; | |
305 | char email[MAXLEN]; | |
306 | char test[1]; | |
307 | char ouser2[255]; | |
308 | char user2[MAXLEN]; | |
309 | char wentp[512]; | |
310 | char addr[MAXLEN]; | |
491b862f GS |
311 | char Ulimit[6]; |
312 | char RealtimeTypes[1024]; | |
25697a35 | 313 | char cmd[255]; |
491b862f GS |
314 | char ImageFile[255]; |
315 | char tbuf[128]; | |
316 | char ip[25]; | |
317 | char RealtimeUnauthRec[15]; | |
318 | ||
25697a35 GS |
319 | int idate; |
320 | int smartfilter; | |
321 | int denied_count; | |
322 | int download_count; | |
323 | int authfail_count; | |
324 | int dansguardian_count; | |
325 | int squidguard_count; | |
326 | int limit_flag; | |
327 | int color1; | |
328 | int color2; | |
329 | int color3; | |
330 | int z1, z2, z3; | |
331 | int ttopen; | |
332 | int ind2; | |
333 | int sarglog; | |
334 | int isalog; | |
2357ef77 | 335 | int dfrom; |
25697a35 GS |
336 | int duntil; |
337 | int dataonly; | |
338 | int indexonly; | |
339 | int iprel; | |
340 | int userip; | |
341 | int langcode; | |
342 | int debug; | |
343 | int debugz; | |
344 | int debugm; | |
345 | int AuthfailReportLimit; | |
346 | int DeniedReportLimit; | |
94ff9470 | 347 | int DownloadReportLimit; |
25697a35 GS |
348 | int SiteUsersReportLimit; |
349 | int DansGuardianReportLimit; | |
350 | int SquidGuardReportLimit; | |
351 | int UserReportLimit; | |
94ff9470 | 352 | int dotinuser; |
491b862f GS |
353 | int realtime_refresh; |
354 | int realtime_access_log_lines; | |
355 | int realt; | |
491b862f | 356 | int rc; |
d6e703cc FM |
357 | int ntopsites; |
358 | int nsitesusers; | |
359 | int nrepday; | |
360 | int ndownload; | |
361 | int ntopuser; | |
362 | int squid24; | |
25697a35 GS |
363 | float perc; |
364 | ||
491b862f GS |
365 | long long int nocost; |
366 | float cost; | |
25697a35 GS |
367 | |
368 | typedef struct | |
369 | { int list[ 24 ]; | |
370 | int len; | |
371 | } numlist; | |
372 | ||
373 | DIR *dirp; | |
374 | struct dirent *direntp; |