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