]> git.ipfire.org Git - thirdparty/sarg.git/blame - getconf.c
Moved all the functions declarations from conf.h to defs.h for consistency.
[thirdparty/sarg.git] / getconf.c
CommitLineData
25697a35 1/*
c37945ed
FM
2 * AUTHOR: Pedro Lineu Orso pedro.orso@gmail.com
3 * 1998, 2008
94ff9470 4 * SARG Squid Analysis Report Generator http://sarg.sourceforge.net
25697a35
GS
5 *
6 * SARG donations:
7 * please look at http://sarg.sourceforge.net/donations.php
8 * ---------------------------------------------------------------------
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA.
23 *
24 */
25
26#include "include/conf.h"
5f3cfd1d 27#include "include/defs.h"
25697a35
GS
28
29extern numlist hours, weekdays;
30
31char wbuf[MAXLEN];
32char Msg[255];
33
d6e703cc 34void parmtest(char *buf)
25697a35
GS
35{
36
37 if(strstr(buf,"background_color") != 0) {
4bcb77cf
FM
38 if (getword_multisep(wbuf,sizeof(wbuf),buf,' ')<0) {
39 printf("SARG: Maybe you have a broken record or garbage in background_color parameter.\n");
40 exit(1);
41 }
25697a35
GS
42 strcpy(BgColor,buf);
43 fixnone(BgColor);
44 return;
45 }
46
47 if(strstr(buf,"text_color") != 0) {
48 if(strstr(buf,"logo_text_color") == 0) {
4bcb77cf
FM
49 if (getword_multisep(wbuf,sizeof(wbuf),buf,' ')<0) {
50 printf("SARG: Maybe you have a broken record or garbage in text_color parameter.\n");
51 exit(1);
52 }
25697a35
GS
53 strcpy(TxColor,buf);
54 fixnone(TxColor);
55 return;
56 }
57 }
58
59 if(strstr(buf,"text_bgcolor") != 0) {
4bcb77cf
FM
60 if (getword_multisep(wbuf,sizeof(wbuf),buf,' ')<0) {
61 printf("SARG: Maybe you have a broken record or garbage in text_bgcolor parameter.\n");
62 exit(1);
63 }
25697a35
GS
64 strcpy(TxBgColor,buf);
65 fixnone(TxBgColor);
66 return;
67 }
68
69 if(strstr(buf,"title_color") != 0) {
4bcb77cf
FM
70 if (getword_multisep(wbuf,sizeof(wbuf),buf,' ')<0) {
71 printf("SARG: Maybe you have a broken record or garbage in title_color parameter.\n");
72 exit(1);
73 }
25697a35
GS
74 strcpy(TiColor,buf);
75 fixnone(TiColor);
76 return;
77 }
78
79 if(strstr(buf,"logo_image") != 0) {
4bcb77cf
FM
80 if (getword_multisep(wbuf,sizeof(wbuf),buf,' ')<0) {
81 printf("SARG: Maybe you have a broken record or garbage in logo_image parameter.\n");
82 exit(1);
83 }
25697a35
GS
84 strcpy(LogoImage,buf);
85 fixnone(LogoImage);
86 return;
87 }
88
89 if(strstr(buf,"logo_text") != 0) {
90 if(strstr(buf,"logo_text_color") == 0) {
4bcb77cf
FM
91 if (getword(wbuf,sizeof(wbuf),buf,'"')<0) {
92 printf("SARG: Maybe you have a broken record or garbage in logo_text parameter.\n");
93 exit(1);
94 }
95 if (getword(LogoText,sizeof(LogoText),buf,'"')<0) {
96 printf("SARG: Maybe you have a broken record or garbage in logo_text parameter.\n");
97 exit(1);
98 }
25697a35
GS
99 fixnone(LogoText);
100 return;
101 }
102 }
103
104 if(strstr(buf,"logo_text_color") != 0) {
4bcb77cf
FM
105 if (getword_multisep(wbuf,sizeof(wbuf),buf,' ')<0) {
106 printf("SARG: Maybe you have a broken record or garbage in logo_text_color parameter.\n");
107 exit(1);
108 }
25697a35
GS
109 strcpy(LogoTextColor,buf);
110 fixnone(LogoTextColor);
111 return;
112 }
113
114 if(strstr(buf,"background_image") != 0) {
4bcb77cf
FM
115 if (getword_multisep(wbuf,sizeof(wbuf),buf,' ')<0) {
116 printf("SARG: Maybe you have a broken record or garbage in background_image parameter.\n");
117 exit(1);
118 }
25697a35
GS
119 strcpy(BgImage,buf);
120 fixnone(BgImage);
121 return;
122 }
123
124 if(strstr(buf,"show_sarg_info") != 0) {
4bcb77cf
FM
125 if (getword_multisep(wbuf,sizeof(wbuf),buf,' ')<0) {
126 printf("SARG: Maybe you have a broken record or garbage in show_sarg_info parameter.\n");
127 exit(1);
128 }
25697a35
GS
129 strcpy(ShowSargInfo,buf);
130 fixnone(ShowSargInfo);
131 return;
132 }
133
134 if(strstr(buf,"show_sarg_logo") != 0) {
4bcb77cf
FM
135 if (getword_multisep(wbuf,sizeof(wbuf),buf,' ')<0) {
136 printf("SARG: Maybe you have a broken record or garbage in show_sarg_logo parameter.\n");
137 exit(1);
138 }
25697a35
GS
139 strcpy(ShowSargLogo,buf);
140 fixnone(ShowSargLogo);
141 return;
142 }
143
144 if(strstr(buf,"font_face") != 0) {
4bcb77cf
FM
145 if (getword_multisep(wbuf,sizeof(wbuf),buf,' ')<0) {
146 printf("SARG: Maybe you have a broken record or garbage in font_face parameter.\n");
147 exit(1);
148 }
25697a35
GS
149 strcpy(FontFace,buf);
150 fixnone(FontFace);
151 return;
152 }
153
154 if(strstr(buf,"header_color") != 0) {
4bcb77cf
FM
155 if (getword_multisep(wbuf,sizeof(wbuf),buf,' ')<0) {
156 printf("SARG: Maybe you have a broken record or garbage in header_color parameter.\n");
157 exit(1);
158 }
25697a35
GS
159 strcpy(HeaderColor,buf);
160 fixnone(HeaderColor);
161 return;
162 }
163
164 if(strstr(buf,"header_bgcolor") != 0) {
4bcb77cf
FM
165 if (getword_multisep(wbuf,sizeof(wbuf),buf,' ')<0) {
166 printf("SARG: Maybe you have a broken record or garbage in header_bgcolor parameter.\n");
167 exit(1);
168 }
25697a35
GS
169 strcpy(HeaderBgColor,buf);
170 fixnone(HeaderBgColor);
171 return;
172 }
173
174 if(strstr(buf,"font_size") != 0) {
175 if(strstr(buf,"header_font_size") == 0 && strstr(buf,"title_font_size") == 0) {
4bcb77cf
FM
176 if (getword_multisep(wbuf,sizeof(wbuf),buf,' ')<0) {
177 printf("SARG: Maybe you have a broken record or garbage in font_size parameter.\n");
178 exit(1);
179 }
25697a35
GS
180 strcpy(FontSize,buf);
181 fixnone(FontSize);
182 return;
183 }
184 }
185
186 if(strstr(buf,"header_font_size") != 0) {
4bcb77cf
FM
187 if (getword_multisep(wbuf,sizeof(wbuf),buf,' ')<0) {
188 printf("SARG: Maybe you have a broken record or garbage in header_font_size parameter.\n");
189 exit(1);
190 }
25697a35
GS
191 strcpy(HeaderFontSize,buf);
192 fixnone(HeaderFontSize);
193 return;
194 }
195
196 if(strstr(buf,"title_font_size") != 0) {
4bcb77cf
FM
197 if (getword_multisep(wbuf,sizeof(wbuf),buf,' ')<0) {
198 printf("SARG: Maybe you have a broken record or garbage in title_font_size parameter.\n");
199 exit(1);
200 }
25697a35
GS
201 strcpy(TitleFontSize,buf);
202 fixnone(TitleFontSize);
203 return;
204 }
205
206 if(strstr(buf,"image_size") != 0) {
4bcb77cf
FM
207 if (getword_multisep(wbuf,sizeof(wbuf),buf,' ')<0 || getword_multisep(Width,sizeof(Width),buf,' ')<0 || getword_multisep(Height,sizeof(Height),Height,0)<0) {
208 printf("SARG: Maybe you have a broken record or garbage in image_size parameter.\n");
209 exit(1);
210 }
25697a35
GS
211 fixnone(Width);
212 fixnone(Height);
213 return;
214 }
215
216 if(strstr(buf,"title") != 0) {
4bcb77cf
FM
217 if (getword(wbuf,sizeof(wbuf),buf,'"')<0 || getword(Title,sizeof(Title),buf,'"')<0) {
218 printf("SARG: Maybe you have a broken record or garbage in title parameter.\n");
219 exit(1);
220 }
25697a35
GS
221 fixnone(Title);
222 return;
223 }
224
225 if(strstr(buf,"resolve_ip") != 0) {
4bcb77cf
FM
226 if (getword_multisep(wbuf,sizeof(wbuf),buf,' ')<0) {
227 printf("SARG: Maybe you have a broken record or garbage in resolve_ip parameter.\n");
228 exit(1);
229 }
25697a35
GS
230 strcpy(Ip2Name,buf);
231 fixnone(Ip2Name);
232 return;
233 }
234
235 if(strstr(buf,"user_ip") != 0) {
4bcb77cf
FM
236 if (getword_multisep(wbuf,sizeof(wbuf),buf,' ')<0) {
237 printf("SARG: Maybe you have a broken record or garbage in user_ip parameter.\n");
238 exit(1);
239 }
25697a35
GS
240 strcpy(UserIp,buf);
241 fixnone(UserIp);
242 return;
243 }
244
245 if(strstr(buf,"max_elapsed") != 0) {
4bcb77cf
FM
246 if (getword_multisep(wbuf,sizeof(wbuf),buf,' ')<0) {
247 printf("SARG: Maybe you have a broken record or garbage in max_elapsed parameter.\n");
248 exit(1);
249 }
25697a35
GS
250 strcpy(MaxElapsed,buf);
251 fixnone(MaxElapsed);
252 return;
253 }
254
255 if(strstr(buf,"date_format") != 0) {
4bcb77cf
FM
256 if (getword_multisep(wbuf,sizeof(wbuf),buf,' ')<0) {
257 printf("SARG: Maybe you have a broken record or garbage in date_format parameter.\n");
258 exit(1);
259 }
d6e703cc 260 strncpy(DateFormat,buf,1);
25697a35
GS
261 fixnone(DateFormat);
262 return;
263 }
264
265 if( strstr( buf, "hours" ) != 0 ) {
266 if( getnumlist( buf, &hours, 24, 24 ) ) {
267 fprintf( stderr, "Error: Invalid syntax in hours tag!\n" );
268 exit( 1 );
269 }
270 }
271
272 if( strstr( buf, "weekdays" ) != 0 ) {
273 if( getnumlist( buf, &weekdays, 7, 7 ) ) {
274 fprintf( stderr, "Error: Invalid syntax in weekdays tag!\n" );
275 exit( 1 );
276 }
277 }
278
279 if(strstr(buf,"topuser_sort_field") != 0) {
4bcb77cf
FM
280 if (getword_multisep(wbuf,sizeof(wbuf),buf,' ')<0 || getword_multisep(TopuserSortField,sizeof(TopuserSortField),buf,' ')<0) {
281 printf("SARG: Maybe you have a broken record or garbage in topuser_sort_field parameter.\n");
282 exit(1);
283 }
25697a35
GS
284 strcpy(TopuserSortOrder,buf);
285 fixnone(TopuserSortOrder);
286 return;
287 }
288
289 if(strstr(buf,"user_sort_field") != 0) {
4bcb77cf
FM
290 if (getword_multisep(wbuf,sizeof(wbuf),buf,' ')<0 || getword_multisep(UserSortField,sizeof(UserSortField),buf,' ')<0) {
291 printf("SARG: Maybe you have a broken record or garbage in user_sort_field parameter.\n");
292 exit(1);
293 }
25697a35
GS
294 strcpy(UserSortOrder,buf);
295 fixnone(UserSortOrder);
296 return;
297 }
298
299 if(strstr(buf,"access_log") != 0) {
d6e703cc 300 if(strstr(buf,"realtime_access_log_lines") == 0) {
4bcb77cf
FM
301 if (getword_multisep(wbuf,sizeof(wbuf),buf,' ')<0) {
302 printf("SARG: Maybe you have a broken record or garbage in access_log parameter.\n");
303 exit(1);
304 }
d6e703cc
FM
305 strcpy(AccessLog,buf);
306 fixnone(AccessLog);
307 return;
308 }
25697a35
GS
309 }
310
311 if(strstr(buf,"useragent_log") != 0) {
4bcb77cf
FM
312 if (getword_multisep(wbuf,sizeof(wbuf),buf,' ')<0) {
313 printf("SARG: Maybe you have a broken record or garbage in useragent_log parameter.\n");
314 exit(1);
315 }
25697a35
GS
316 strcpy(UserAgentLog,buf);
317 fixnone(UserAgentLog);
318 return;
319 }
320
321 if(strstr(buf,"exclude_hosts") != 0) {
4bcb77cf
FM
322 if (getword_multisep(wbuf,sizeof(wbuf),buf,' ')<0) {
323 printf("SARG: Maybe you have a broken record or garbage in exclude_hosts parameter.\n");
324 exit(1);
325 }
25697a35
GS
326 strcpy(ExcludeHosts,buf);
327 fixnone(ExcludeHosts);
328 return;
329 }
330
331 if(strstr(buf,"exclude_codes") != 0) {
4bcb77cf
FM
332 if (getword_multisep(wbuf,sizeof(wbuf),buf,' ')<0) {
333 printf("SARG: Maybe you have a broken record or garbage in exclude_codes parameter.\n");
334 exit(1);
335 }
25697a35
GS
336 strcpy(ExcludeCodes,buf);
337 fixnone(ExcludeCodes);
338 return;
339 }
340
341 if(strstr(buf,"exclude_users") != 0) {
4bcb77cf
FM
342 if (getword_multisep(wbuf,sizeof(wbuf),buf,' ')<0) {
343 printf("SARG: Maybe you have a broken record or garbage in exclude_users parameter.\n");
344 exit(1);
345 }
25697a35
GS
346 strcpy(ExcludeUsers,buf);
347 fixnone(ExcludeUsers);
348 return;
349 }
350
351 if(strstr(buf,"password") != 0) {
4bcb77cf
FM
352 if (getword_multisep(wbuf,sizeof(wbuf),buf,' ')<0) {
353 printf("SARG: Maybe you have a broken record or garbage in password parameter.\n");
354 exit(1);
355 }
25697a35
GS
356 strcpy(PasswdFile,buf);
357 fixnone(PasswdFile);
358 return;
359 }
360
361 if(strstr(buf,"temporary_dir") != 0) {
4bcb77cf
FM
362 if (getword_multisep(wbuf,sizeof(wbuf),buf,' ')<0) {
363 printf("SARG: Maybe you have a broken record or garbage in temporary_dir parameter.\n");
364 exit(1);
365 }
25697a35
GS
366 strcpy(TempDir,buf);
367 fixnone(TempDir);
368 return;
369 }
370
371 if(strstr(buf,"report_type") != 0) {
4bcb77cf
FM
372 if (getword_multisep(wbuf,sizeof(wbuf),buf,' ')<0) {
373 printf("SARG: Maybe you have a broken record or garbage in report_type parameter.\n");
374 exit(1);
375 }
25697a35
GS
376 strcpy(ReportType,buf);
377 fixnone(ReportType);
378 return;
379 }
380
381 if(strstr(buf,"output_dir") != 0) {
382 if(strstr(buf,"output_dir_form") == 0) {
4bcb77cf
FM
383 if (getword_multisep(wbuf,sizeof(wbuf),buf,' ')<0) {
384 printf("SARG: Maybe you have a broken record or garbage in output_dir parameter.\n");
385 exit(1);
386 }
25697a35
GS
387 strcpy(OutputDir,buf);
388 fixnone(OutputDir);
389 return;
390 }
391 }
392
393 if(strstr(buf,"output_email") != 0) {
4bcb77cf
FM
394 if (getword_multisep(wbuf,sizeof(wbuf),buf,' ')<0) {
395 printf("SARG: Maybe you have a broken record or garbage in output_email parameter.\n");
396 exit(1);
397 }
25697a35
GS
398 strcpy(OutputEmail,buf);
399 fixnone(OutputEmail);
400 return;
401 }
402
403 if(strstr(buf,"per_user_limit") != 0) {
4bcb77cf
FM
404 if (getword_multisep(wbuf,sizeof(wbuf),buf,' ')<0 || getword_multisep(PerUserLimitFile,sizeof(PerUserLimitFile),buf,' ')<0) {
405 printf("SARG: Maybe you have a broken record or garbage in per_user_limit parameter.\n");
406 exit(1);
407 }
25697a35
GS
408 strcpy(PerUserLimit,buf);
409 fixnone(PerUserLimitFile);
410 fixnone(PerUserLimit);
411 return;
412 }
413
414
415 if(strstr(buf,"lastlog") != 0) {
4bcb77cf
FM
416 if (getword_multisep(wbuf,sizeof(wbuf),buf,' ')<0) {
417 printf("SARG: Maybe you have a broken record or garbage in lastlog parameter.\n");
418 exit(1);
419 }
25697a35
GS
420 strcpy(LastLog,buf);
421 fixnone(LastLog);
422 return;
423 }
424
425 if(strstr(buf,"remove_temp_files") != 0) {
4bcb77cf
FM
426 if (getword_multisep(wbuf,sizeof(wbuf),buf,' ')<0) {
427 printf("SARG: Maybe you have a broken record or garbage in remove_temp_files parameter.\n");
428 exit(1);
429 }
25697a35
GS
430 strcpy(RemoveTempFiles,buf);
431 fixnone(RemoveTempFiles);
432 return;
433 }
434
435 if(strstr(buf,"replace_index") != 0) {
4bcb77cf
FM
436 if (getword_multisep(wbuf,sizeof(wbuf),buf,' ')<0) {
437 printf("SARG: Maybe you have a broken record or garbage in replace_index parameter.\n");
438 exit(1);
439 }
25697a35
GS
440 strcpy(ReplaceIndex,buf);
441 fixnone(ReplaceIndex);
442 return;
443 }
444
491b862f 445 if(strstr(buf,"index_tree") != 0) {
4bcb77cf
FM
446 if (getword_multisep(wbuf,sizeof(wbuf),buf,' ')<0) {
447 printf("SARG: Maybe you have a broken record or garbage in index_tree parameter.\n");
448 exit(1);
449 }
491b862f
GS
450 strcpy(IndexTree,buf);
451 fixnone(IndexTree);
452 return;
453 }
454
25697a35
GS
455 if(strstr(buf,"index") != 0) {
456 if(strstr(buf,"index_sort_order") == 0) {
4bcb77cf
FM
457 if (getword_multisep(wbuf,sizeof(wbuf),buf,' ')<0) {
458 printf("SARG: Maybe you have a broken record or garbage in index parameter.\n");
459 exit(1);
460 }
25697a35
GS
461 strcpy(Index,buf);
462 fixnone(Index);
463 return;
464 }
465 }
466
467 if(strstr(buf,"overwrite_report") != 0) {
4bcb77cf
FM
468 if (getword_multisep(wbuf,sizeof(wbuf),buf,' ')<0) {
469 printf("SARG: Maybe you have a broken record or garbage in overwrite_report parameter.\n");
470 exit(1);
471 }
25697a35
GS
472 strcpy(OverwriteReport,buf);
473 fixnone(OverwriteReport);
474 return;
475 }
476
477 if(strstr(buf,"records_without_userid") != 0) {
4bcb77cf
FM
478 if (getword_multisep(wbuf,sizeof(wbuf),buf,' ')<0) {
479 printf("SARG: Maybe you have a broken record or garbage in records_without_userid parameter.\n");
480 exit(1);
481 }
25697a35
GS
482 strcpy(RecordsWithoutUser,buf);
483 fixnone(RecordsWithoutUser);
484 return;
485 }
486
487 if(strstr(buf,"use_comma") != 0) {
4bcb77cf
FM
488 if (getword_multisep(wbuf,sizeof(wbuf),buf,' ')<0) {
489 printf("SARG: Maybe you have a broken record or garbage in use_comma parameter.\n");
490 exit(1);
491 }
25697a35
GS
492 strcpy(UseComma,buf);
493 fixnone(UseComma);
494 return;
495 }
496
497 if(strstr(buf,"mail_utility") != 0) {
4bcb77cf
FM
498 if (getword_multisep(wbuf,sizeof(wbuf),buf,' ')<0) {
499 printf("SARG: Maybe you have a broken record or garbage in mail_utility parameter.\n");
500 exit(1);
501 }
25697a35
GS
502 strcpy(MailUtility,buf);
503 fixnone(MailUtility);
504 return;
505 }
506
507 if(strstr(buf,"topsites_num") != 0) {
4bcb77cf
FM
508 if (getword_multisep(wbuf,sizeof(wbuf),buf,' ')<0) {
509 printf("SARG: Maybe you have a broken record or garbage in topsites_num parameter.\n");
510 exit(1);
511 }
25697a35
GS
512 strcpy(TopSitesNum,buf);
513 fixnone(TopSitesNum);
514 return;
515 }
516
517 if(strstr(buf,"topuser_num") != 0) {
4bcb77cf
FM
518 if (getword_multisep(wbuf,sizeof(wbuf),buf,' ')<0) {
519 printf("SARG: Maybe you have a broken record or garbage in topuser_num parameter.\n");
520 exit(1);
521 }
25697a35
GS
522 strcpy(TopUsersNum,buf);
523 fixnone(TopUsersNum);
524 return;
525 }
526
527 if(strstr(buf,"usertab") != 0) {
4bcb77cf
FM
528 if (getword_multisep(wbuf,sizeof(wbuf),buf,' ')<0) {
529 printf("SARG: Maybe you have a broken record or garbage in usertab parameter.\n");
530 exit(1);
531 }
25697a35
GS
532 strcpy(UserTabFile,buf);
533 fixnone(UserTabFile);
534 return;
535 }
536
537 if(strstr(buf,"index_sort_order") != 0) {
4bcb77cf
FM
538 if (getword_multisep(wbuf,sizeof(wbuf),buf,' ')<0) {
539 printf("SARG: Maybe you have a broken record or garbage in index_sort_order parameter.\n");
540 exit(1);
541 }
25697a35
GS
542 strcpy(IndexSortOrder,buf);
543 fixnone(IndexSortOrder);
544 return;
545 }
546
547 if(strstr(buf,"topsites_sort_order") != 0) {
4bcb77cf
FM
548 if (getword_multisep(wbuf,sizeof(wbuf),buf,' ')<0 || getword_multisep(TopsitesSortField,sizeof(TopsitesSortField),buf,' ')<0) {
549 printf("SARG: Maybe you have a broken record or garbage in topsites_sort_order parameter.\n");
550 exit(1);
551 }
25697a35
GS
552 strcpy(TopsitesSortType,buf);
553 fixnone(TopsitesSortField);
554 fixnone(TopsitesSortType);
555 return;
556 }
557
558 if(strstr(buf,"long_url") != 0) {
4bcb77cf
FM
559 if (getword_multisep(wbuf,sizeof(wbuf),buf,' ')<0) {
560 printf("SARG: Maybe you have a broken record or garbage in long_url parameter.\n");
561 exit(1);
562 }
25697a35
GS
563 strcpy(LongUrl,buf);
564 fixnone(LongUrl);
565 return;
566 }
567
568 if(strstr(buf,"language") != 0) {
4bcb77cf
FM
569 if (getword_multisep(wbuf,sizeof(wbuf),buf,' ')<0) {
570 printf("SARG: Maybe you have a broken record or garbage in language parameter.\n");
571 exit(1);
572 }
25697a35
GS
573 strcpy(language,buf);
574 fixnone(language);
575 return;
576 }
577
578 if(strstr(buf,"dansguardian_conf") != 0) {
4bcb77cf
FM
579 if (getword_multisep(wbuf,sizeof(wbuf),buf,' ')<0) {
580 printf("SARG: Maybe you have a broken record or garbage in dansguardian_conf parameter.\n");
581 exit(1);
582 }
25697a35
GS
583 strcpy(DansGuardianConf,buf);
584 fixnone(DansGuardianConf);
585 return;
586 }
587
588 if(strstr(buf,"squidguard_conf") != 0) {
4bcb77cf
FM
589 if (getword_multisep(wbuf,sizeof(wbuf),buf,' ')<0) {
590 printf("SARG: Maybe you have a broken record or garbage in squidguard_conf parameter.\n");
591 exit(1);
592 }
25697a35
GS
593 strcpy(SquidGuardConf,buf);
594 fixnone(SquidGuardConf);
595 return;
596 }
597
598 if(strstr(buf,"date_time_by") != 0) {
4bcb77cf
FM
599 if (getword_multisep(wbuf,sizeof(wbuf),buf,' ')<0) {
600 printf("SARG: Maybe you have a broken record or garbage in date_time_by parameter.\n");
601 exit(1);
602 }
25697a35
GS
603 strcpy(datetimeby,buf);
604 fixnone(datetimeby);
605 return;
606 }
607
608 if(strstr(buf,"charset") != 0) {
4bcb77cf
FM
609 if (getword_multisep(wbuf,sizeof(wbuf),buf,' ')<0) {
610 printf("SARG: Maybe you have a broken record or garbage in charset parameter.\n");
611 exit(1);
612 }
25697a35
GS
613 strcpy(CharSet,buf);
614 fixnone(CharSet);
615 ccharset(CharSet);
616 return;
617 }
618
619 if(strstr(buf,"user_invalid_char") != 0) {
4bcb77cf
FM
620 if (getword_multisep(wbuf,sizeof(wbuf),buf,'"')<0 || getword_multisep(UserInvalidChar,sizeof(UserInvalidChar),buf,'"')<0) {
621 printf("SARG: Maybe you have a broken record or garbage in user_invalid_char parameter.\n");
622 exit(1);
623 }
25697a35
GS
624 fixnone(UserInvalidChar);
625 return;
626 }
627
628 if(strstr(buf,"include_users") != 0) {
4bcb77cf
FM
629 if (getword_multisep(wbuf,sizeof(wbuf),buf,'"')<0 || getword_multisep(wbuf,sizeof(wbuf),buf,'"')<0) {
630 printf("SARG: Maybe you have a broken record or garbage in include_users parameter.\n");
631 exit(1);
632 }
25697a35
GS
633 sprintf(IncludeUsers,":%s:",wbuf);
634 fixnone(IncludeUsers);
635 return;
636 }
637
638 if(strstr(buf,"exclude_string") != 0) {
4bcb77cf
FM
639 if (getword_multisep(wbuf,sizeof(wbuf),buf,'"')<0 || getword_multisep(ExcludeString,sizeof(ExcludeString),buf,'"')<0) {
640 printf("SARG: Maybe you have a broken record or garbage in exclude_string parameter.\n");
641 exit(1);
642 }
25697a35
GS
643 fixnone(ExcludeString);
644 return;
645 }
646
647 if(strstr(buf,"privacy") != 0) {
648 if(strstr(buf,"privacy_string") == 0 && \
649 strstr(buf,"privacy_string_color") == 0) {
4bcb77cf
FM
650 if (getword_multisep(wbuf,sizeof(wbuf),buf,' ')<0) {
651 printf("SARG: Maybe you have a broken record or garbage in privacy parameter.\n");
652 exit(1);
653 }
25697a35
GS
654 strcpy(Privacy,buf);
655 fixnone(Privacy);
656 return;
657 }
658 }
659
660 if(strstr(buf,"privacy_string") != 0) {
661 if(strstr(buf,"privacy_string_color") == 0) {
4bcb77cf
FM
662 if (getword_multisep(wbuf,sizeof(wbuf),buf,'"')<0 || getword_multisep(PrivacyString,sizeof(PrivacyString),buf,'"')<0) {
663 printf("SARG: Maybe you have a broken record or garbage in privacy_string parameter.\n");
664 exit(1);
665 }
25697a35
GS
666 fixnone(PrivacyString);
667 return;
668 }
669 }
670
671 if(strstr(buf,"privacy_string_color") != 0) {
4bcb77cf
FM
672 if (getword_multisep(wbuf,sizeof(wbuf),buf,' ')<0) {
673 printf("SARG: Maybe you have a broken record or garbage in privacy_string_color parameter.\n");
674 exit(1);
675 }
25697a35
GS
676 strcpy(PrivacyStringColor,buf);
677 fixnone(PrivacyStringColor);
678 return;
679 }
680
681 if(strstr(buf,"show_successful_message") != 0) {
4bcb77cf
FM
682 if (getword_multisep(wbuf,sizeof(wbuf),buf,' ')<0) {
683 printf("SARG: Maybe you have a broken record or garbage in show_successful_message parameter.\n");
684 exit(1);
685 }
25697a35
GS
686 strcpy(SuccessfulMsg,buf);
687 fixnone(SuccessfulMsg);
688 return;
689 }
690
691 if(strstr(buf,"show_read_statistics") != 0) {
4bcb77cf
FM
692 if (getword_multisep(wbuf,sizeof(wbuf),buf,' ')<0) {
693 printf("SARG: Maybe you have a broken record or garbage in show_read_statistics parameter.\n");
694 exit(1);
695 }
25697a35
GS
696 strcpy(ShowReadStatistics,buf);
697 fixnone(ShowReadStatistics);
698 return;
699 }
700
701 if(strstr(buf,"topuser_fields") != 0) {
4bcb77cf
FM
702 if (getword_multisep(wbuf,sizeof(wbuf),buf,' ')<0) {
703 printf("SARG: Maybe you have a broken record or garbage in topuser_fields parameter.\n");
704 exit(1);
705 }
25697a35
GS
706 strcpy(TopUserFields,buf);
707 fixnone(TopUserFields);
708 return;
709 }
710
d6e703cc 711 if(strstr(buf,"bytes_in_sites_users_report") != 0) {
4bcb77cf
FM
712 if (getword_multisep(wbuf,sizeof(wbuf),buf,' ')<0) {
713 printf("SARG: Maybe you have a broken record or garbage in bytes_in_sites_users_report parameter.\n");
714 exit(1);
715 }
d6e703cc
FM
716 strcpy(BytesInSitesUsersReport,buf);
717 fixnone(BytesInSitesUsersReport);
718 return;
719 }
720
25697a35 721 if(strstr(buf,"user_report_fields") != 0) {
4bcb77cf
FM
722 if (getword_multisep(wbuf,sizeof(wbuf),buf,' ')<0) {
723 printf("SARG: Maybe you have a broken record or garbage in user_report_fields parameter.\n");
724 exit(1);
725 }
25697a35
GS
726 strcpy(UserReportFields,buf);
727 fixnone(UserReportFields);
728 return;
729 }
730
d6e703cc 731 if(strstr(buf,"bytes_in_sites_users_report") != 0) {
4bcb77cf
FM
732 if (getword_multisep(wbuf,sizeof(wbuf),buf,' ')<0) {
733 printf("SARG: Maybe you have a broken record or garbage in site_user_time_date_type parameter.\n");
734 exit(1);
735 }
d6e703cc
FM
736 strcpy(BytesInSitesUsersReport,buf);
737 fixnone(BytesInSitesUsersReport);
25697a35
GS
738 return;
739 }
740
741 if(strstr(buf,"datafile ") != 0) {
4bcb77cf
FM
742 if (getword_multisep(wbuf,sizeof(wbuf),buf,' ')<0) {
743 printf("SARG: Maybe you have a broken record or garbage in datafile parameter.\n");
744 exit(1);
745 }
25697a35
GS
746 strcpy(DataFile,buf);
747 fixnone(DataFile);
748 return;
749 }
750
751 if(strstr(buf,"datafile_delimiter") != 0) {
4bcb77cf
FM
752 if (getword_multisep(wbuf,sizeof(wbuf),buf,' ')<0 || getword(wbuf,sizeof(wbuf),buf,'"')<0 ||
753 getword(DataFileDelimiter,sizeof(DataFileDelimiter),buf,'"')<0) {
754 printf("SARG: Maybe you have a broken record or garbage in datafile_delimiter parameter.\n");
755 exit(1);
756 }
25697a35
GS
757 fixnone(DataFileDelimiter);
758 return;
759 }
760
761 if(strstr(buf,"datafile_fields") != 0) {
4bcb77cf
FM
762 if (getword_multisep(wbuf,sizeof(wbuf),buf,' ')<0) {
763 printf("SARG: Maybe you have a broken record or garbage in datafile_fields parameter.\n");
764 exit(1);
765 }
25697a35
GS
766 strcpy(DataFileFields,buf);
767 fixnone(DataFileFields);
768 return;
769 }
770
491b862f 771 if(strstr(buf,"datafile_url") != 0) {
4bcb77cf
FM
772 if (getword_multisep(wbuf,sizeof(wbuf),buf,' ')<0) {
773 printf("SARG: Maybe you have a broken record or garbage in datafile_url parameter.\n");
774 exit(1);
775 }
491b862f
GS
776 strcpy(DataFileUrl,buf);
777 fixnone(DataFileUrl);
778 return;
779 }
780
25697a35
GS
781 if(strstr(buf,"parsed_output_log") != 0) {
782 if(strstr(buf,"parsed_output_log_compress") == 0) {
4bcb77cf
FM
783 if (getword_multisep(wbuf,sizeof(wbuf),buf,' ')<0) {
784 printf("SARG: Maybe you have a broken record or garbage in parsed_output_log parameter.\n");
785 exit(1);
786 }
25697a35
GS
787 strcpy(ParsedOutputLog,buf);
788 fixnone(ParsedOutputLog);
789 return;
790 }
791 }
792
793 if(strstr(buf,"parsed_output_log_compress") != 0) {
4bcb77cf
FM
794 if (getword_multisep(wbuf,sizeof(wbuf),buf,' ')<0) {
795 printf("SARG: Maybe you have a broken record or garbage in parsed_output_log_compress parameter.\n");
796 exit(1);
797 }
25697a35
GS
798 strcpy(ParsedOutputLogCompress,buf);
799 fixnone(ParsedOutputLogCompress);
800 return;
801 }
802
803 if(strstr(buf,"displayed_values") != 0) {
4bcb77cf
FM
804 if (getword_multisep(wbuf,sizeof(wbuf),buf,' ')<0) {
805 printf("SARG: Maybe you have a broken record or garbage in displayed_values parameter.\n");
806 exit(1);
807 }
25697a35
GS
808 strcpy(DisplayedValues,buf);
809 fixnone(DisplayedValues);
810 return;
811 }
812
813 if(strstr(buf,"authfail_report_limit") != 0) {
4bcb77cf
FM
814 if (getword_multisep(wbuf,sizeof(wbuf),buf,' ')<0) {
815 printf("SARG: Maybe you have a broken record or garbage in authfail_report_limit parameter.\n");
816 exit(1);
817 }
25697a35
GS
818 AuthfailReportLimit=atoi(buf);
819 return;
820 }
821
822 if(strstr(buf,"denied_report_limit") != 0) {
4bcb77cf
FM
823 if (getword_multisep(wbuf,sizeof(wbuf),buf,' ')<0) {
824 printf("SARG: Maybe you have a broken record or garbage in denied_report_limit parameter.\n");
825 exit(1);
826 }
25697a35
GS
827 DeniedReportLimit=atoi(buf);
828 return;
829 }
830
831 if(strstr(buf,"siteusers_report_limit") != 0) {
4bcb77cf
FM
832 if (getword_multisep(wbuf,sizeof(wbuf),buf,' ')<0) {
833 printf("SARG: Maybe you have a broken record or garbage in siteusers_report_limit parameter.\n");
834 exit(1);
835 }
25697a35
GS
836 SiteUsersReportLimit=atoi(buf);
837 return;
838 }
839
840 if(strstr(buf,"dansguardian_report_limit") != 0) {
4bcb77cf
FM
841 if (getword_multisep(wbuf,sizeof(wbuf),buf,' ')<0) {
842 printf("SARG: Maybe you have a broken record or garbage in dansguardian_report_limit parameter.\n");
843 exit(1);
844 }
25697a35
GS
845 DansGuardianReportLimit=atoi(buf);
846 return;
847 }
848
849 if(strstr(buf,"squidguard_report_limit") != 0) {
4bcb77cf
FM
850 if (getword_multisep(wbuf,sizeof(wbuf),buf,' ')<0) {
851 printf("SARG: Maybe you have a broken record or garbage in squidguard_report_limit parameter.\n");
852 exit(1);
853 }
25697a35
GS
854 SquidGuardReportLimit=atoi(buf);
855 return;
856 }
857
858 if(strstr(buf,"user_report_limit") != 0) {
4bcb77cf
FM
859 if (getword_multisep(wbuf,sizeof(wbuf),buf,' ')<0) {
860 printf("SARG: Maybe you have a broken record or garbage in user_report_limit parameter.\n");
861 exit(1);
862 }
25697a35
GS
863 UserReportLimit=atoi(buf);
864 return;
865 }
866
94ff9470 867 if(strstr(buf,"download_report_limit") != 0) {
4bcb77cf
FM
868 if (getword_multisep(wbuf,sizeof(wbuf),buf,' ')<0) {
869 printf("SARG: Maybe you have a broken record or garbage in download_report_limit parameter.\n");
870 exit(1);
871 }
94ff9470
GS
872 DownloadReportLimit=atoi(buf);
873 return;
874 }
875
25697a35 876 if(strstr(buf,"www_document_root") != 0) {
4bcb77cf
FM
877 if (getword_multisep(wbuf,sizeof(wbuf),buf,' ')<0) {
878 printf("SARG: Maybe you have a broken record or garbage in www_document_root parameter.\n");
879 exit(1);
880 }
25697a35
GS
881 strcpy(wwwDocumentRoot,buf);
882 fixnone(wwwDocumentRoot);
883 return;
884 }
885
886 if(strstr(buf,"block_it") != 0) {
4bcb77cf
FM
887 if (getword_multisep(wbuf,sizeof(wbuf),buf,' ')<0) {
888 printf("SARG: Maybe you have a broken record or garbage in block_it parameter.\n");
889 exit(1);
890 }
25697a35
GS
891 strcpy(BlockIt,buf);
892 fixnone(BlockIt);
893 return;
894 }
895
896 if(strstr(buf,"external_css_file") != 0) {
4bcb77cf
FM
897 if (getword_multisep(wbuf,sizeof(wbuf),buf,' ')<0) {
898 printf("SARG: Maybe you have a broken record or garbage in external_css_file parameter.\n");
899 exit(1);
900 }
25697a35
GS
901 strcpy(ExternalCSSFile,buf);
902 fixnone(ExternalCSSFile);
903 return;
904 }
905
906 if(strstr(buf,"user_authentication") != 0) {
4bcb77cf
FM
907 if (getword_multisep(wbuf,sizeof(wbuf),buf,' ')<0) {
908 printf("SARG: Maybe you have a broken record or garbage in user_authentication parameter.\n");
909 exit(1);
910 }
25697a35
GS
911 strcpy(UserAuthentication,buf);
912 fixnone(UserAuthentication);
913 return;
914 }
915
916 if(strstr(buf,"AuthUserFile") != 0) {
4bcb77cf
FM
917 if (getword_multisep(wbuf,sizeof(wbuf),buf,' ')<0) {
918 printf("SARG: Maybe you have a broken record or garbage in AuthUserFile parameter.\n");
919 exit(1);
920 }
25697a35
GS
921 strcpy(AuthUserFile,buf);
922 fixnone(AuthUserFile);
923 return;
924 }
925
926 if(strstr(buf,"AuthName") != 0) {
4bcb77cf
FM
927 if (getword_multisep(wbuf,sizeof(wbuf),buf,' ')<0) {
928 printf("SARG: Maybe you have a broken record or garbage in AuthName parameter.\n");
929 exit(1);
930 }
25697a35
GS
931 strcpy(AuthName,buf);
932 fixnone(AuthName);
933 return;
934 }
935
936 if(strstr(buf,"AuthType") != 0) {
4bcb77cf
FM
937 if (getword_multisep(wbuf,sizeof(wbuf),buf,' ')<0) {
938 printf("SARG: Maybe you have a broken record or garbage in AuthType parameter.\n");
939 exit(1);
940 }
25697a35
GS
941 strcpy(AuthType,buf);
942 fixnone(AuthType);
943 return;
944 }
945
946 if(strstr(buf,"Require") != 0) {
4bcb77cf
FM
947 if (getword_multisep(wbuf,sizeof(wbuf),buf,' ')<0) {
948 printf("SARG: Maybe you have a broken record or garbage in Require parameter.\n");
949 exit(1);
950 }
25697a35
GS
951 strcpy(Require,buf);
952 fixnone(Require);
953 return;
954 }
955
956 if(strstr(buf,"download_suffix") != 0) {
4bcb77cf
FM
957 if (getword_multisep(wbuf,sizeof(wbuf),buf,'"')<0 || getword_multisep(DownloadSuffix,sizeof(DownloadSuffix),buf,'"')<0) {
958 printf("SARG: Maybe you have a broken record or garbage in download_suffix parameter.\n");
959 exit(1);
960 }
25697a35
GS
961 fixnone(DownloadSuffix);
962 return;
963 }
964
965 if(strstr(buf,"graphs") != 0) {
4bcb77cf
FM
966 if (getword_multisep(wbuf,sizeof(wbuf),buf,' ')<0) {
967 printf("SARG: Maybe you have a broken record or garbage in graphs parameter.\n");
968 exit(1);
969 }
25697a35
GS
970 strcpy(Graphs,buf);
971 fixnone(Graphs);
972 return;
973 }
974
975 if(strstr(buf,"graph_days_bytes_bar_color") != 0) {
4bcb77cf
FM
976 if (getword_multisep(wbuf,sizeof(wbuf),buf,' ')<0) {
977 printf("SARG: Maybe you have a broken record or garbage in graph_days_bytes_bar_color parameter.\n");
978 exit(1);
979 }
25697a35
GS
980 strcpy(GraphDaysBytesBarColor,buf);
981 fixnone(GraphDaysBytesBarColor);
982 return;
983 }
984
985 if(strstr(buf,"squidguard_log_format") != 0) {
4bcb77cf
FM
986 if (getword_multisep(wbuf,sizeof(wbuf),buf,' ')<0) {
987 printf("SARG: Maybe you have a broken record or garbage in squidguard_log_format parameter.\n");
988 exit(1);
989 }
25697a35
GS
990 strcpy(SquidGuardLogFormat,buf);
991 fixnone(SquidGuardLogFormat);
992 return;
993 }
994
491b862f 995 if(strstr(buf,"squidguard_ignore_date") != 0) {
4bcb77cf
FM
996 if (getword_multisep(wbuf,sizeof(wbuf),buf,' ')<0) {
997 printf("SARG: Maybe you have a broken record or garbage in squidguard_ignore_date parameter.\n");
998 exit(1);
999 }
491b862f
GS
1000 strcpy(SquidguardIgnoreDate,buf);
1001 fixnone(SquidguardIgnoreDate);
1002 return;
1003 }
1004
1005 if(strstr(buf,"dansguardian_ignore_date") != 0) {
4bcb77cf
FM
1006 if (getword_multisep(wbuf,sizeof(wbuf),buf,' ')<0) {
1007 printf("SARG: Maybe you have a broken record or garbage in dansguardian_ignore_date parameter.\n");
1008 exit(1);
1009 }
491b862f
GS
1010 strcpy(DansguardianIgnoreDate,buf);
1011 fixnone(DansguardianIgnoreDate);
1012 return;
1013 }
1014
25697a35 1015 if(strstr(buf,"ulimit") != 0) {
4bcb77cf
FM
1016 if (getword_multisep(wbuf,sizeof(wbuf),buf,' ')<0) {
1017 printf("SARG: Maybe you have a broken record or garbage in ulimit parameter.\n");
1018 exit(1);
1019 }
25697a35
GS
1020 strcpy(Ulimit,buf);
1021 fixnone(Ulimit);
1022 return;
1023 }
1024
1025 if(strstr(buf,"ntlm_user_format") != 0) {
4bcb77cf
FM
1026 if (getword_multisep(wbuf,sizeof(wbuf),buf,' ')<0) {
1027 printf("SARG: Maybe you have a broken record or garbage in ntlm_user_format parameter.\n");
1028 exit(1);
1029 }
25697a35
GS
1030 strcpy(NtlmUserFormat,buf);
1031 fixnone(NtlmUserFormat);
1032 return;
1033 }
491b862f
GS
1034
1035 if(strstr(buf,"realtime_types") != 0) {
4bcb77cf
FM
1036 if (getword_multisep(wbuf,sizeof(wbuf),buf,' ')<0) {
1037 printf("SARG: Maybe you have a broken record or garbage in realtime_types parameter.\n");
1038 exit(1);
1039 }
491b862f
GS
1040 strcpy(RealtimeTypes,buf);
1041 fixnone(RealtimeTypes);
1042 return;
1043 }
1044
1045 if(strstr(buf,"realtime_unauthenticated_records") != 0) {
4bcb77cf
FM
1046 if (getword_multisep(wbuf,sizeof(wbuf),buf,' ')<0) {
1047 printf("SARG: Maybe you have a broken record or garbage in realtime_unauthenticated_records parameter.\n");
1048 exit(1);
1049 }
491b862f
GS
1050 strcpy(RealtimeUnauthRec,buf);
1051 fixnone(RealtimeUnauthRec);
1052 return;
1053 }
1054
1055 if(strstr(buf,"realtime_refresh_time") != 0) {
4bcb77cf
FM
1056 if (getword_multisep(wbuf,sizeof(wbuf),buf,' ')<0) {
1057 printf("SARG: Maybe you have a broken record or garbage in realtime_refresh_time parameter.\n");
1058 exit(1);
1059 }
491b862f
GS
1060 realtime_refresh=atoi(buf);
1061 return;
1062 }
1063
1064 if(strstr(buf,"realtime_access_log_lines") != 0) {
4bcb77cf
FM
1065 if (getword_multisep(wbuf,sizeof(wbuf),buf,' ')<0) {
1066 printf("SARG: Maybe you have a broken record or garbage in realtime_access_log_lines parameter.\n");
1067 exit(1);
1068 }
491b862f
GS
1069 realtime_access_log_lines=atoi(buf);
1070 return;
1071 }
1072
d6e703cc
FM
1073 if(strstr(buf,"squid24") != 0) {
1074 squid24++;
1075 return;
1076 }
1077
491b862f 1078 if(strstr(buf,"byte_cost") != 0) {
4bcb77cf
FM
1079 if (getword_multisep(wbuf,sizeof(wbuf),buf,' ')<0) {
1080 printf("SARG: Maybe you have a broken record or garbage in byte_cost parameter.\n");
1081 exit(1);
1082 }
491b862f 1083 cost=atol(buf);
4bcb77cf
FM
1084 if (getword_multisep(wbuf,sizeof(wbuf),buf,' ')<0) {
1085 printf("SARG: Maybe you have a broken record or garbage in byte_cost parameter.\n");
1086 exit(1);
1087 }
491b862f
GS
1088 nocost=my_atoll(buf);
1089 return;
1090 }
d6e703cc
FM
1091}
1092
32e71fa4 1093void getconf(void)
d6e703cc
FM
1094{
1095
1096 FILE *fp_in;
1097 char buf[MAXLEN];
1098
1099 if(debug) {
1100 sprintf(Msg,"Loading configuration from: %s",ConfigFile);
1101 debuga(Msg);
1102 }
1103
1104 if ((fp_in = fopen(ConfigFile, "r")) == NULL) {
1105 fprintf(stderr, "SARG: (getconf) Cannot open file: %s\n",ConfigFile);
1106 exit(1);
1107 }
1108
1109 while (fgets(buf, MAXLEN, fp_in) != NULL) {
1110 if(strstr(buf,"\n") != 0)
1111 buf[strlen(buf)-1]='\0';
1112
1113 if(debugm)
1114 printf("SYSCONFDIR %s",buf);
1115
1116 if(strncmp(buf,"#",1) == 0 || strlen(buf) < 1)
1117 continue;
1118
1119 if(debugz)
1120 printf("SARG: TAG: %s\n",buf);
1121
1122 parmtest(buf);
1123
1124 }
1125
1126 fclose(fp_in);
1127 language_load(language);
1128 return;
25697a35 1129}