source: trunk/src/sh_readconf.c@ 196

Last change on this file since 196 was 196, checked in by katerina, 16 years ago

New option SetDropCache ([false]/true) to drop checksummed files from file cache.

File size: 35.9 KB
Line 
1/* SAMHAIN file system integrity testing */
2/* Copyright (C) 1999, 2000 Rainer Wichmann */
3/* */
4/* This program is free software; you can redistribute it */
5/* and/or modify */
6/* it under the terms of the GNU General Public License as */
7/* published by */
8/* the Free Software Foundation; either version 2 of the License, or */
9/* (at your option) any later version. */
10/* */
11/* This program is distributed in the hope that it will be useful, */
12/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
13/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
14/* GNU General Public License for more details. */
15/* */
16/* You should have received a copy of the GNU General Public License */
17/* along with this program; if not, write to the Free Software */
18/* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
19
20#include "config_xor.h"
21
22
23#include <stdlib.h>
24#include <stdio.h>
25#include <string.h>
26#include <ctype.h>
27
28
29#include "samhain.h"
30#include "sh_error.h"
31#include "sh_database.h"
32#include "sh_unix.h"
33#include "sh_utils.h"
34#include "sh_files.h"
35#include "sh_mail.h"
36#include "sh_calls.h"
37#include "sh_tiger.h"
38#include "sh_forward.h"
39#include "sh_modules.h"
40#include "sh_gpg.h"
41#include "sh_hash.h"
42#include "sh_ignore.h"
43#include "sh_prelink.h"
44#include "sh_extern.h"
45
46#ifdef WITH_DATABASE
47#include "sh_database.h"
48#endif
49
50#ifdef HAVE_LIBPRELUDE
51#include "sh_prelude.h"
52#endif
53
54extern int set_reverse_lookup (const char * c);
55
56#undef FIL__
57#define FIL__ _("sh_readconf.c")
58
59typedef enum {
60 SH_SECTION_NONE,
61 SH_SECTION_LOG,
62 SH_SECTION_MISC,
63 SH_SECTION_ATTRIBUTES,
64 SH_SECTION_READONLY,
65 SH_SECTION_LOGFILES,
66 SH_SECTION_LOGGROW,
67 SH_SECTION_NOIGNORE,
68 SH_SECTION_ALLIGNORE,
69 SH_SECTION_USER0,
70 SH_SECTION_USER1,
71 SH_SECTION_USER2,
72 SH_SECTION_USER3,
73 SH_SECTION_USER4,
74 SH_SECTION_PRELINK,
75#if defined (SH_WITH_MAIL)
76 SH_SECTION_MAIL,
77#endif
78#if defined (SH_WITH_CLIENT)
79 SH_SECTION_CLT,
80#endif
81#ifdef WITH_EXTERNAL
82 SH_SECTION_EXTERNAL,
83#endif
84#ifdef WITH_DATABASE
85 SH_SECTION_DATABASE,
86#endif
87#if defined (SH_WITH_CLIENT) || defined (SH_STANDALONE)
88 SH_SECTION_OTHER,
89#endif
90#ifdef SH_WITH_SERVER
91 SH_SECTION_CLIENTS,
92 SH_SECTION_SRV,
93#endif
94 SH_SECTION_THRESHOLD
95} ShSectionType;
96
97typedef struct str_ListSections {
98 const char * name;
99 int type;
100} sh_str_ListSections;
101
102struct str_ListSections tab_ListSections[] = {
103 { N_("[Log]"), SH_SECTION_LOG},
104 { N_("[Misc]"), SH_SECTION_MISC},
105 { N_("[Attributes]"), SH_SECTION_ATTRIBUTES},
106 { N_("[ReadOnly]"), SH_SECTION_READONLY},
107 { N_("[LogFiles]"), SH_SECTION_LOGFILES},
108 { N_("[GrowingLogFiles]"), SH_SECTION_LOGGROW},
109 { N_("[IgnoreAll]"), SH_SECTION_ALLIGNORE},
110 { N_("[IgnoreNone]"), SH_SECTION_NOIGNORE},
111 { N_("[User0]"), SH_SECTION_USER0},
112 { N_("[User1]"), SH_SECTION_USER1},
113 { N_("[User2]"), SH_SECTION_USER2},
114 { N_("[User3]"), SH_SECTION_USER3},
115 { N_("[User4]"), SH_SECTION_USER4},
116 { N_("[Prelink]"), SH_SECTION_PRELINK},
117#ifdef WITH_EXTERNAL
118 { N_("[External]"), SH_SECTION_EXTERNAL},
119#endif
120#ifdef WITH_DATABASE
121 { N_("[Database]"), SH_SECTION_DATABASE},
122#endif
123 { N_("[EventSeverity]"), SH_SECTION_THRESHOLD},
124#ifdef SH_WITH_SERVER
125 { N_("[Clients]"), SH_SECTION_CLIENTS},
126 { N_("[Server]"), SH_SECTION_SRV},
127#endif
128#if defined (SH_WITH_CLIENT)
129 { N_("[Client]"), SH_SECTION_CLT},
130#endif
131#if defined (SH_WITH_MAIL)
132 { N_("[Mail]"), SH_SECTION_MAIL},
133#endif
134 { NULL, SH_SECTION_NONE}
135};
136
137
138static int sh_readconfig_line (char * line);
139
140static ShSectionType read_mode = SH_SECTION_NONE;
141
142static int conf_line = 0;
143
144/* --- Read the configuration file. ---
145 */
146int sh_readconf_read (void)
147{
148#if defined (SH_WITH_CLIENT) || defined (SH_STANDALONE)
149 /* This is for modules.
150 */
151 int modnum;
152#endif
153
154 int i;
155
156 SL_TICKET fd = -1;
157#if defined(SH_STEALTH) && !defined(SH_STEALTH_MICRO)
158 SL_TICKET fdTmp = -1;
159 SL_TICKET open_tmp (void);
160#endif
161 char * tmp;
162 char * lptr;
163
164 char line_in[512+2];
165 char * line;
166 int line_int;
167
168 char myident[3*SH_MINIBUF+3];
169
170 /* This is for nested conditionals.
171 */
172 int some_other_host[16] = { 0 };
173 int some_other_system[16] = { 0 };
174 int seen_host = 0;
175 int seen_system = 0;
176 int host_int = 0;
177 int sys_int = 0;
178
179 int invert = 0;
180 int length = sl_strlen(sh.host.name);
181
182 int local_file = 1;
183 char local_flag = 'R';
184
185#if defined(WITH_GPG) || defined(WITH_PGP)
186 int signed_content = S_FALSE;
187 int true_content = S_FALSE;
188#endif
189#if defined(SH_STEALTH) && !defined(SH_STEALTH_MICRO)
190 int hidden_count = 0;
191#endif
192 uid_t euid;
193 char hashbuf[KEYBUF_SIZE];
194
195 SL_ENTER(_("sh_readconf_read"));
196
197 /* --- Open config file, exit on failure. ---
198 */
199#if defined(SH_WITH_CLIENT)
200 if (0 == sl_strcmp(file_path('C', 'R'), _("REQ_FROM_SERVER")))
201 {
202 sh_error_handle ((-1), FIL__, __LINE__, 0, MSG_D_START);
203
204 fd = sh_forward_req_file(_("CONF"));
205
206 if (!SL_ISERROR(fd))
207 local_file = 0;
208 else if (sh.flag.checkSum != SH_CHECK_INIT)
209 aud_exit (FIL__, __LINE__, EXIT_FAILURE);
210 else
211 {
212 sh_error_handle ((-1), FIL__, __LINE__, fd, MSG_D_FAIL);
213 local_file = 1;
214 local_flag = 'I';
215 }
216 }
217#endif
218
219 /* Use a local configuration file.
220 */
221 if (local_file == 1)
222 {
223 if (0 != tf_trust_check (file_path('C', local_flag), SL_YESPRIV))
224 {
225 sl_get_euid(&euid);
226 dlog(1, FIL__, __LINE__,
227 _("The configuration file: %s is untrusted, i.e. an\nuntrusted user owns or can write to some directory in the path.\n"),
228 ( (NULL == file_path('C', local_flag))
229 ? _("(null)") : file_path('C', local_flag) ));
230 sh_error_handle ((-1), FIL__, __LINE__, EACCES, MSG_TRUST,
231 (long) euid,
232 ( (NULL == file_path('C', local_flag))
233 ? _("(null)") : file_path('C', local_flag) )
234 );
235 aud_exit (FIL__, __LINE__, EXIT_FAILURE);
236 }
237 if (SL_ISERROR(fd = sl_open_read(file_path('C',local_flag),SL_YESPRIV)))
238 {
239 sl_get_euid(&euid);
240 dlog(1, FIL__, __LINE__,
241 _("Could not open the local configuration file for reading because\nof the following error: %s (errnum = %ld)\nIf this is a permission problem, you need to change file permissions\nto make the file readable for the effective UID: %d\n"),
242 sl_get_errmsg(), fd, (int) euid);
243 sh_error_handle ((-1), FIL__, __LINE__, fd, MSG_NOACCESS,
244 (long) euid,
245 ( (NULL == file_path('C', local_flag))
246 ? _("(null)") : file_path('C', local_flag) )
247 );
248 aud_exit (FIL__, __LINE__, EXIT_FAILURE);
249 }
250 }
251
252 /* Compute the checksum of the open file.
253 */
254 sl_strlcpy(sh.conf.hash,
255 sh_tiger_hash(file_path('C',local_flag), fd, TIGER_NOLIM, hashbuf, sizeof(hashbuf)),
256 KEY_LEN+1);
257 sl_rewind (fd);
258
259#if defined(SH_STEALTH) && !defined(SH_STEALTH_MICRO)
260 /* extract the data and copy to temporary file
261 */
262 fdTmp = open_tmp();
263
264 sh_unix_getline_stealth (0, NULL, 0); /* initialize */
265
266 while ( sh_unix_getline_stealth (fd, line_in, 512) > 0) {
267 hidden_count++;
268 if (line_in[0] == '\n')
269 {
270 sl_write(fdTmp, line_in, 1);
271 }
272 else
273 {
274 sl_write_line(fdTmp, line_in, sl_strlen(line_in));
275 }
276#if defined(WITH_GPG) || defined(WITH_PGP)
277 if (0 == sl_strncmp(line_in, _("-----END PGP SIGNATURE-----"), 25))
278 break;
279#else
280 if (0 == sl_strncmp(line_in, _("[EOF]"), 5))
281 break;
282#endif
283 if (hidden_count > 4096) /* arbitrary safeguard */
284 break;
285 }
286 sl_close(fd);
287 fd = fdTmp;
288 sl_rewind (fd);
289#endif
290
291 /* The system type, release, and machine.
292 */
293 sl_snprintf(myident, sizeof(myident), _("%s:%s:%s"),
294 sh.host.system, /* flawfinder: ignore */
295 sh.host.release, sh.host.machine);
296
297
298 /* --- Start reading lines. ---
299 */
300 conf_line = 0;
301
302 while ( sh_unix_getline (fd, line_in, 512) > 0) {
303
304 ++conf_line;
305
306 line = &(line_in[0]);
307
308 /* fprintf(stderr, "<%s>\n", line); */
309
310 /* Sun May 27 18:40:05 CEST 2001
311 */
312#if defined(WITH_GPG) || defined(WITH_PGP)
313 if (signed_content == S_FALSE)
314 {
315 if (0 == sl_strcmp(line, _("-----BEGIN PGP SIGNED MESSAGE-----")))
316 signed_content = S_TRUE;
317 else
318 continue;
319 }
320 else if (true_content == S_FALSE)
321 {
322 if (line[0] == '\n')
323 true_content = S_TRUE;
324 else
325 continue;
326 }
327 else if (signed_content == S_TRUE)
328 {
329 if (0 == sl_strcmp(line, _("-----BEGIN PGP SIGNATURE-----")))
330 break;
331 else if (0 == sl_strcmp(line, _("-----BEGIN PGP SIGNED MESSAGE-----")))
332 {
333 sh_error_handle((-1), FIL__, __LINE__, 0, MSG_E_SUBGEN,
334 _("second signed message in file"),
335 _("sh_readconf_read"));
336 dlog(1, FIL__, __LINE__,
337 _("There seems to be more than one signed message in the configuration\nfile. Please make sure there is only one signed message.\n"));
338 sh_error_handle ((-1), FIL__, __LINE__, 0, MSG_EXIT_ABORT1,
339 sh.prg_name);
340 aud_exit (FIL__, __LINE__,EXIT_FAILURE);
341 }
342 }
343#endif
344
345 /* Skip leading white space.
346 */
347 while (*line)
348 {
349 line_int = *line;
350 if (!isspace(line_int))
351 break;
352 ++line;
353 }
354
355 /* Skip header etc.
356 */
357 if (line[0] == '#' || line[0] == '\0' || line[0] == ';' ||
358 (line[0] == '/' && line[1] == '/'))
359 continue;
360
361 /* Clip off trailing white space.
362 */
363 tmp = line + sl_strlen( line ); --tmp;
364 while( isspace((int) *tmp ) && tmp >= line ) *tmp-- = '\0';
365
366
367 /* ------- starts a section ------------ */
368
369 if (line[0] == '[' &&
370 some_other_host[seen_host] == 0 &&
371 some_other_system[seen_system] == 0)
372 {
373 read_mode = SH_SECTION_NONE;
374
375 if (sl_strncmp (line, _("[EOF]"),
376 5) == 0)
377 {
378 goto nopel;
379 }
380
381 i = 0;
382
383 while (tab_ListSections[i].name != 0)
384 {
385 if (sl_strncmp (line, _(tab_ListSections[i].name),
386 sl_strlen(tab_ListSections[i].name)) == 0)
387 {
388 read_mode = tab_ListSections[i].type;
389 break;
390 }
391 ++i;
392 }
393
394#if defined (SH_WITH_CLIENT) || defined (SH_STANDALONE)
395 if (read_mode == SH_SECTION_NONE)
396 {
397 for (modnum = 0; modList[modnum].name != NULL; ++modnum)
398 {
399 if (0 == sl_strncmp (line, _(modList[modnum].conf_section),
400 sl_strlen(modList[modnum].conf_section)) )
401 read_mode = SH_SECTION_OTHER;
402 }
403 }
404#endif
405 if (read_mode == SH_SECTION_NONE)
406 {
407 sh_error_handle ((-1), FIL__, __LINE__, 0, MSG_EINVALHEAD,
408 (long) conf_line);
409 }
410 }
411
412 /* --- an @host directive -------------- */
413
414 else if (line[0] == '@' || (line[0] == '!' && line[1] == '@'))
415 {
416 if (line[0] == '!')
417 {
418 lptr = &line[2];
419 invert = 1;
420 }
421 else
422 {
423 lptr = &line[1];
424 invert = 0;
425 }
426
427 if (sl_strncmp (lptr, _("end"), 3) == 0)
428 {
429 if (0 == seen_host)
430 sh_error_handle ((-1), FIL__, __LINE__, 0, MSG_EINVALD,
431 _("config file"),
432 (long) conf_line);
433
434 else if (host_int == 0)
435 {
436 /* end of an @host directive
437 */
438 some_other_host[seen_host] = 0;
439 --seen_host;
440 seen_host = (seen_host < 0) ? 0 : seen_host;
441 }
442
443 else
444 {
445 --host_int;
446 host_int = (host_int < 0) ? 0 : host_int;
447 }
448 }
449 else if (some_other_host[seen_host] == 0 &&
450 some_other_system[seen_system] == 0 &&
451 seen_host < 15)
452 {
453 if (sl_strncmp (lptr, sh.host.name, length) == 0
454#ifdef HAVE_REGEX_H
455 || sh_util_regcmp (lptr, sh.host.name) == 0
456#endif
457 )
458 {
459 /* if match and '@', set some_other_host = 0;
460 * if match and '!@', set some_other_host = 1;
461 */
462 ++seen_host;
463 some_other_host[seen_host] = invert;
464 }
465 else
466 {
467 /* if no match and '@', set some_other_host = 1;
468 * if no match and '!@', set some_other_host = 0;
469 */
470 ++seen_host;
471 some_other_host[seen_host] = (invert == 0) ? 1 : 0;
472 }
473 }
474 else
475 ++host_int;
476 }
477
478 /* --- an %schedule directive ------------ */
479
480 else if (line[0] == '%' || (line[0] == '!' && line[1] == '%'))
481 {
482#if defined (SH_WITH_CLIENT) || defined (SH_STANDALONE)
483 if (line[0] == '!' && 0 == sl_strcmp(&(line[2]), _("SCHEDULE_TWO")))
484 set_dirList(1);
485 else if (0 == sl_strcmp(&(line[1]), _("SCHEDULE_TWO")))
486 set_dirList(2);
487#else
488 ;
489#endif
490 }
491
492 /* --- an $system directive -------------- */
493
494 else if (line[0] == '$' || (line[0] == '!' && line[1] == '$'))
495 {
496 if (line[0] == '!')
497 {
498 lptr = &line[2];
499 invert = 1;
500 }
501 else
502 {
503 lptr = &line[1];
504 invert = 0;
505 }
506
507 if (sl_strncmp (lptr, _("end"), 3) == 0)
508 {
509 if (0 == seen_system)
510 sh_error_handle ((-1), FIL__, __LINE__, 0, MSG_EINVALD,
511 _("config file"),
512 (long) conf_line);
513
514 else if (sys_int == 0)
515 {
516 /* end of an $system directive
517 */
518 some_other_system[seen_system] = 0;
519 --seen_system;
520 seen_system = (seen_system < 0) ? 0 : seen_system;
521 }
522 else
523 {
524 --sys_int;
525 sys_int = (sys_int < 0) ? 0 : sys_int;
526 }
527 }
528 else if (some_other_host[seen_host] == 0 &&
529 some_other_system[seen_system] == 0 &&
530 seen_system < 15)
531 {
532 if (sl_strncmp (lptr, myident, sl_strlen(myident)) == 0
533#ifdef HAVE_REGEX_H
534 || sh_util_regcmp (lptr, myident) == 0
535#endif
536 )
537 {
538 ++seen_system;
539 some_other_system[seen_system] = invert;
540 }
541 else
542 {
543 ++seen_system;
544 some_other_system[seen_system] = (invert == 0) ? 1 : 0;
545 }
546 }
547 else
548 ++sys_int;
549 }
550
551 /* ------ no new section -------------- */
552
553
554 else if (some_other_host[seen_host] == 0 &&
555 some_other_system[seen_system] == 0 &&
556 read_mode != SH_SECTION_NONE)
557 {
558 if (0 != sh_readconfig_line (line))
559 {
560 sh_error_handle ((-1), FIL__, __LINE__, 0, MSG_EINVALCONF,
561 (long) conf_line);
562 }
563 }
564
565 }
566
567 nopel:
568
569 if (0 != seen_host || 0 != seen_system)
570 sh_error_handle ((-1), FIL__, __LINE__, 0, MSG_EINVALDD,
571 _("config file"),
572 (long) conf_line);
573
574#if defined(WITH_GPG) || defined(WITH_PGP)
575 /* Validate signature of open file.
576 */
577 sl_rewind (fd);
578 if (0 != sh_gpg_check_sign (fd, 0, 1))
579 aud_exit (FIL__, __LINE__, EXIT_FAILURE);
580#endif
581
582 sl_close (fd);
583
584 sh_error_fixup();
585
586 read_mode = SH_SECTION_NONE; /* reset b/o sighup reload */
587
588 SL_RETURN( 0, _("sh_readconf_read"));
589}
590
591int sh_readconf_set_path (char * which, const char * what)
592{
593 int len;
594 SL_ENTER( _("sh_readconf_set_path"));
595
596 if (which == NULL || what == NULL)
597 {
598 TPT((0, FIL__, __LINE__ , _("msg=<Input error>\n")));
599 SL_RETURN( -1, _("sh_readconf_set_path"));
600 }
601
602 if (0 == sl_strcmp(what, _("AUTO")))
603 {
604 len = sl_strlen(which);
605 if ( (len + sl_strlen(sh.host.name) + 2) > SH_PATHBUF)
606 {
607 TPT((0, FIL__, __LINE__ , _("msg=<Path too large: %s:%s>\n"),
608 which, sh.host.name));
609 SL_RETURN( -1, _("sh_readconf_set_path"));
610 }
611 else
612 {
613 which[len] = ':'; which[len+1] = '\0';
614 sl_strlcat(which, sh.host.name, SH_PATHBUF);
615 }
616 }
617 else /* not auto */
618 {
619 if (sl_strlen(what) > (SH_PATHBUF-1))
620 {
621 TPT((0, FIL__, __LINE__ , _("msg=<Path too large: %s>\n"), what));
622 SL_RETURN( -1, _("sh_readconf_set_path"));
623 }
624 else
625 {
626 sl_strlcpy(which, what, SH_PATHBUF);
627 }
628 }
629 SL_RETURN( 0, _("sh_readconf_set_path"));
630}
631
632int sh_readconf_set_database_path (const char * what)
633{
634 return (sh_readconf_set_path(sh.data.path, what));
635}
636
637int sh_readconf_set_logfile_path (const char * what)
638{
639 return (sh_readconf_set_path(sh.srvlog.name, what));
640}
641
642int sh_readconf_set_lockfile_path (const char * what)
643{
644 return( sh_readconf_set_path(sh.srvlog.alt, what));
645}
646
647
648
649
650typedef enum {
651 SET_MAILTIME,
652 SET_FILETIME
653} ShTimerItem;
654
655
656int sh_readconf_setTime (const char * str, ShTimerItem what)
657{
658 unsigned long i = atoi (str);
659
660 SL_ENTER( _("sh_readconf_setTime"));
661
662 if (i < LONG_MAX)
663 {
664 if (what == SET_MAILTIME)
665 {
666 TPT((0, FIL__, __LINE__, _("msg=<Set mail timer to %ld>\n"), i));
667 sh.mailTime.alarm_interval = i;
668 }
669 else if (what == SET_FILETIME)
670 {
671 TPT((0, FIL__, __LINE__, _("msg=<Set filecheck timer to %ld>\n"),i));
672 sh.fileCheck.alarm_interval = i;
673 }
674
675 SL_RETURN( 0, _("sh_readconf_setTime"));
676 }
677 else
678 {
679 sh_error_handle ((-1), FIL__, __LINE__, 0, MSG_EINVALL,
680 _("set timer"), (long) i);
681 SL_RETURN( (-1), _("sh_readconf_setTime"));
682 }
683}
684
685int sh_readconf_setMailtime (const char * c)
686{
687 return sh_readconf_setTime (c, SET_MAILTIME);
688}
689
690int sh_readconf_setFiletime (const char * c)
691{
692 return sh_readconf_setTime (c, SET_FILETIME);
693}
694
695int sh_readconf_set_nice (const char * c)
696{
697 long val;
698
699 SL_ENTER(_("sh_readconf_set_nice"));
700
701 val = strtol (c, (char **)NULL, 10);
702 if (val < -20 || val > 20)
703 {
704 SL_RETURN((-1), _("sh_readconf_set_nice"));
705 }
706
707 val = (val < -19 ? -19 : val);
708 val = (val > 19 ? 19 : val);
709
710 sh.flag.nice = val;
711 SL_RETURN((0), _("sh_readconf_set_nice"));
712}
713
714#ifdef FANCY_LIBCAP
715int sh_readconf_setCaps(const char * c)
716{
717 int i;
718 SL_ENTER(_("sh_readconf_setCaps"));
719
720 i = sh_util_flagval(c, &sl_useCaps);
721 SL_RETURN((i), _("sh_readconf_setCaps"));
722}
723#endif
724
725typedef struct _cfg_options {
726 const char * optname;
727 ShSectionType section;
728 ShSectionType alt_section;
729 int (*func)(const char * opt);
730} cfg_options;
731
732#if defined (SH_WITH_CLIENT) || defined (SH_STANDALONE)
733extern int sh_set_schedule_one(const char * str);
734extern int sh_set_schedule_two(const char * str);
735#endif
736#if defined (SH_WITH_SERVER)
737extern int sh_socket_use (const char * c);
738extern int sh_socket_uid (const char * c);
739extern int sh_socket_password (const char * c);
740#endif
741
742cfg_options ext_table[] = {
743#if defined(WITH_EXTERNAL)
744 { N_("opencommand"), SH_SECTION_EXTERNAL, SH_SECTION_NONE,
745 sh_ext_setcommand },
746 { N_("closecommand"), SH_SECTION_EXTERNAL, SH_SECTION_NONE,
747 sh_ext_close_command },
748 { N_("setcommandline"), SH_SECTION_EXTERNAL, SH_SECTION_NONE,
749 sh_ext_add_argv },
750 { N_("setchecksum"), SH_SECTION_EXTERNAL, SH_SECTION_NONE,
751 sh_ext_checksum },
752 { N_("setdefault"), SH_SECTION_EXTERNAL, SH_SECTION_NONE,
753 sh_ext_add_default },
754 { N_("setenviron"), SH_SECTION_EXTERNAL, SH_SECTION_NONE,
755 sh_ext_add_environ },
756 { N_("setdeadtime"), SH_SECTION_EXTERNAL, SH_SECTION_NONE,
757 sh_ext_deadtime },
758 { N_("settype"), SH_SECTION_EXTERNAL, SH_SECTION_NONE,
759 sh_ext_type },
760 { N_("setcredentials"), SH_SECTION_EXTERNAL, SH_SECTION_NONE,
761 sh_ext_priv },
762 { N_("setfilternot"), SH_SECTION_EXTERNAL, SH_SECTION_NONE,
763 sh_ext_add_not },
764 { N_("setfilterand"), SH_SECTION_EXTERNAL, SH_SECTION_NONE,
765 sh_ext_add_and },
766 { N_("setfilteror"), SH_SECTION_EXTERNAL, SH_SECTION_NONE,
767 sh_ext_add_or },
768 { N_("externalseverity"),SH_SECTION_LOG, SH_SECTION_EXTERNAL,
769 sh_error_set_external },
770 { N_("externalclass"), SH_SECTION_LOG, SH_SECTION_EXTERNAL,
771 sh_error_external_mask },
772#endif
773
774#if defined(WITH_DATABASE)
775 { N_("usepersistent"), SH_SECTION_DATABASE, SH_SECTION_NONE,
776 sh_database_use_persistent },
777 { N_("setdbname"), SH_SECTION_DATABASE, SH_SECTION_NONE,
778 sh_database_set_database },
779 { N_("setdbtable"), SH_SECTION_DATABASE, SH_SECTION_NONE,
780 sh_database_set_table },
781 { N_("setdbhost"), SH_SECTION_DATABASE, SH_SECTION_NONE,
782 sh_database_set_host },
783 { N_("setdbuser"), SH_SECTION_DATABASE, SH_SECTION_NONE,
784 sh_database_set_user },
785 { N_("setdbpassword"), SH_SECTION_DATABASE, SH_SECTION_NONE,
786 sh_database_set_password },
787 { N_("addtodbhash"), SH_SECTION_DATABASE, SH_SECTION_NONE,
788 sh_database_add_to_hash },
789 { N_("databaseseverity"),SH_SECTION_LOG, SH_SECTION_DATABASE,
790 sh_error_set_database },
791 { N_("databaseclass"), SH_SECTION_LOG, SH_SECTION_DATABASE,
792 sh_error_database_mask },
793 { N_("setdbservertstamp"), SH_SECTION_DATABASE, SH_SECTION_NONE,
794 set_enter_wrapper },
795#endif
796
797
798#if defined (SH_WITH_CLIENT) || defined (SH_STANDALONE)
799 { N_("dir"), SH_SECTION_ATTRIBUTES, SH_SECTION_NONE,
800 sh_files_pushdir_attr },
801 { N_("file"), SH_SECTION_ATTRIBUTES, SH_SECTION_NONE,
802 sh_files_pushfile_attr },
803 { N_("dir"), SH_SECTION_READONLY, SH_SECTION_NONE,
804 sh_files_pushdir_ro },
805 { N_("file"), SH_SECTION_READONLY, SH_SECTION_NONE,
806 sh_files_pushfile_ro },
807 { N_("dir"), SH_SECTION_LOGFILES, SH_SECTION_NONE,
808 sh_files_pushdir_log },
809 { N_("file"), SH_SECTION_LOGFILES, SH_SECTION_NONE,
810 sh_files_pushfile_log },
811 { N_("dir"), SH_SECTION_LOGGROW, SH_SECTION_NONE,
812 sh_files_pushdir_glog },
813 { N_("file"), SH_SECTION_LOGGROW, SH_SECTION_NONE,
814 sh_files_pushfile_glog },
815 { N_("dir"), SH_SECTION_NOIGNORE, SH_SECTION_NONE,
816 sh_files_pushdir_noig },
817 { N_("file"), SH_SECTION_NOIGNORE, SH_SECTION_NONE,
818 sh_files_pushfile_noig },
819 { N_("dir"), SH_SECTION_ALLIGNORE, SH_SECTION_NONE,
820 sh_files_pushdir_allig },
821 { N_("file"), SH_SECTION_ALLIGNORE, SH_SECTION_NONE,
822 sh_files_pushfile_allig },
823
824 { N_("dir"), SH_SECTION_USER0, SH_SECTION_NONE,
825 sh_files_pushdir_user0 },
826 { N_("file"), SH_SECTION_USER0, SH_SECTION_NONE,
827 sh_files_pushfile_user0 },
828 { N_("dir"), SH_SECTION_USER1, SH_SECTION_NONE,
829 sh_files_pushdir_user1 },
830 { N_("file"), SH_SECTION_USER1, SH_SECTION_NONE,
831 sh_files_pushfile_user1 },
832 { N_("dir"), SH_SECTION_USER2, SH_SECTION_NONE,
833 sh_files_pushdir_user2 },
834 { N_("file"), SH_SECTION_USER2, SH_SECTION_NONE,
835 sh_files_pushfile_user2 },
836 { N_("dir"), SH_SECTION_USER3, SH_SECTION_NONE,
837 sh_files_pushdir_user3 },
838 { N_("file"), SH_SECTION_USER3, SH_SECTION_NONE,
839 sh_files_pushfile_user3 },
840 { N_("dir"), SH_SECTION_USER4, SH_SECTION_NONE,
841 sh_files_pushdir_user4 },
842 { N_("file"), SH_SECTION_USER4, SH_SECTION_NONE,
843 sh_files_pushfile_user4 },
844 { N_("dir"), SH_SECTION_PRELINK, SH_SECTION_NONE,
845 sh_files_pushdir_prelink },
846 { N_("file"), SH_SECTION_PRELINK, SH_SECTION_NONE,
847 sh_files_pushfile_prelink },
848
849 { N_("ignoreadded"), SH_SECTION_MISC, SH_SECTION_NONE,
850 sh_ignore_add_new },
851 { N_("ignoremissing"), SH_SECTION_MISC, SH_SECTION_NONE,
852 sh_ignore_add_del },
853
854 { N_("filecheckscheduleone"), SH_SECTION_MISC, SH_SECTION_NONE,
855 sh_set_schedule_one },
856 { N_("filecheckscheduletwo"), SH_SECTION_MISC, SH_SECTION_NONE,
857 sh_set_schedule_two },
858
859 { N_("usehardlinkcheck"), SH_SECTION_MISC, SH_SECTION_NONE,
860 sh_files_check_hardlinks },
861 { N_("hardlinkoffset"), SH_SECTION_MISC, SH_SECTION_NONE,
862 sh_files_hle_reg },
863#if defined(USE_XATTR)
864 { N_("useselinuxcheck"), SH_SECTION_MISC, SH_SECTION_NONE,
865 sh_unix_setcheckselinux },
866#endif
867#if defined(USE_ACL)
868 { N_("useaclcheck"), SH_SECTION_MISC, SH_SECTION_NONE,
869 sh_unix_setcheckacl },
870#endif
871 { N_("addokchars"), SH_SECTION_MISC, SH_SECTION_NONE,
872 sh_util_obscure_ok },
873 { N_("filenamesareutf8"), SH_SECTION_MISC, SH_SECTION_NONE,
874 sh_util_obscure_utf8 },
875 { N_("setrecursionlevel"), SH_SECTION_MISC, SH_SECTION_NONE,
876 sh_files_setrecursion },
877 { N_("checksumtest"), SH_SECTION_MISC, SH_SECTION_NONE,
878 sh_util_setchecksum },
879 { N_("reportonlyonce"), SH_SECTION_MISC, SH_SECTION_NONE,
880 sh_files_reportonce },
881 { N_("reportfulldetail"), SH_SECTION_MISC, SH_SECTION_NONE,
882 sh_files_fulldetail },
883 { N_("uselocaltime"), SH_SECTION_MISC, SH_SECTION_NONE,
884 sh_unix_uselocaltime },
885
886 { N_("setnicelevel"), SH_SECTION_MISC, SH_SECTION_NONE,
887 sh_readconf_set_nice },
888
889#if defined(FANCY_LIBCAP)
890 { N_("usecaps"), SH_SECTION_MISC, SH_SECTION_NONE,
891 sh_readconf_setCaps },
892#endif
893
894 { N_("setdropcache"), SH_SECTION_MISC, SH_SECTION_NONE,
895 sl_set_drop_cache },
896
897 { N_("setiolimit"), SH_SECTION_MISC, SH_SECTION_NONE,
898 sh_unix_set_io_limit },
899
900 { N_("versionstring"), SH_SECTION_MISC, SH_SECTION_NONE,
901 sh_hash_version_string },
902
903 { N_("digestalgo"), SH_SECTION_MISC, SH_SECTION_NONE,
904 sh_tiger_hashtype },
905
906 { N_("redefreadonly"), SH_SECTION_MISC, SH_SECTION_NONE,
907 sh_files_redef_readonly },
908
909 { N_("redeflogfiles"), SH_SECTION_MISC, SH_SECTION_NONE,
910 sh_files_redef_logfiles },
911
912 { N_("redefgrowinglogfiles"), SH_SECTION_MISC, SH_SECTION_NONE,
913 sh_files_redef_loggrow },
914
915 { N_("redefattributes"), SH_SECTION_MISC, SH_SECTION_NONE,
916 sh_files_redef_attributes },
917
918 { N_("redefignorenone"), SH_SECTION_MISC, SH_SECTION_NONE,
919 sh_files_redef_noignore },
920
921 { N_("redefignoreall"), SH_SECTION_MISC, SH_SECTION_NONE,
922 sh_files_redef_allignore },
923
924 { N_("redefuser0"), SH_SECTION_MISC, SH_SECTION_NONE,
925 sh_files_redef_user0 },
926
927 { N_("redefuser1"), SH_SECTION_MISC, SH_SECTION_NONE,
928 sh_files_redef_user1 },
929
930 { N_("redefuser2"), SH_SECTION_MISC, SH_SECTION_NONE,
931 sh_files_redef_user2 },
932
933 { N_("redefuser3"), SH_SECTION_MISC, SH_SECTION_NONE,
934 sh_files_redef_user3 },
935
936 { N_("redefuser4"), SH_SECTION_MISC, SH_SECTION_NONE,
937 sh_files_redef_user4 },
938
939 { N_("redefprelink"), SH_SECTION_MISC, SH_SECTION_NONE,
940 sh_files_redef_prelink },
941
942
943 { N_("setprelinkpath"), SH_SECTION_MISC, SH_SECTION_NONE,
944 sh_prelink_set_path },
945 { N_("setprelinkchecksum"), SH_SECTION_MISC, SH_SECTION_NONE,
946 sh_prelink_set_hash },
947
948 /* client or standalone
949 */
950#endif
951
952#ifdef SH_WITH_SERVER
953#ifdef INET_SYSLOG
954 { N_("setudpactive"), SH_SECTION_SRV, SH_SECTION_MISC,
955 set_syslog_active },
956#endif
957 { N_("setusesocket"), SH_SECTION_SRV, SH_SECTION_MISC,
958 sh_socket_use },
959 { N_("setsocketallowuid"), SH_SECTION_SRV, SH_SECTION_MISC,
960 sh_socket_uid },
961 { N_("setsocketpassword"), SH_SECTION_SRV, SH_SECTION_MISC,
962 sh_socket_password },
963 { N_("setstripdomain"), SH_SECTION_SRV, SH_SECTION_MISC,
964 sh_forward_set_strip },
965 { N_("useseparatelogs"), SH_SECTION_SRV, SH_SECTION_MISC,
966 set_flag_sep_log },
967 { N_("setchrootdir"), SH_SECTION_SRV, SH_SECTION_MISC,
968 sh_unix_set_chroot },
969 { N_("setclienttimelimit"), SH_SECTION_SRV, SH_SECTION_MISC,
970 sh_forward_set_time_limit },
971 { N_("useclientseverity"), SH_SECTION_SRV, SH_SECTION_MISC,
972 sh_forward_use_clt_sev },
973 { N_("useclientclass"), SH_SECTION_SRV, SH_SECTION_MISC,
974 sh_forward_use_clt_class },
975 { N_("severitylookup"), SH_SECTION_SRV, SH_SECTION_MISC,
976 sh_forward_lookup_level },
977 { N_("setclientfromaccept"), SH_SECTION_SRV, SH_SECTION_MISC,
978 set_socket_peer },
979 { N_("setserverport"), SH_SECTION_SRV, SH_SECTION_MISC,
980 sh_forward_set_port },
981 { N_("setserverinterface"), SH_SECTION_SRV, SH_SECTION_MISC,
982 sh_forward_set_interface },
983 { N_("client"), SH_SECTION_CLIENTS, SH_SECTION_NONE,
984 sh_forward_register_client },
985#endif
986
987#if defined(SH_WITH_CLIENT) || defined(SH_WITH_SERVER)
988 { N_("exportseverity"), SH_SECTION_LOG, SH_SECTION_NONE,
989 sh_error_setexport },
990 { N_("exportclass"), SH_SECTION_LOG, SH_SECTION_NONE,
991 sh_error_export_mask },
992#if defined(SH_WITH_SERVER)
993 { N_("setlogserver"), SH_SECTION_SRV, SH_SECTION_MISC,
994 sh_forward_setlogserver },
995#else
996 { N_("setlogserver"), SH_SECTION_CLT, SH_SECTION_MISC,
997 sh_forward_setlogserver },
998#endif
999#endif
1000 { N_("setfilechecktime"), SH_SECTION_MISC, SH_SECTION_NONE,
1001 sh_readconf_setFiletime },
1002 { N_("setlooptime"), SH_SECTION_MISC, SH_SECTION_NONE,
1003 sh_util_setlooptime },
1004
1005#ifdef SH_WITH_MAIL
1006 { N_("mailseverity"), SH_SECTION_LOG, SH_SECTION_NONE,
1007 sh_error_setseverity },
1008 { N_("mailclass"), SH_SECTION_LOG, SH_SECTION_NONE,
1009 sh_error_mail_mask },
1010 { N_("setmailtime"), SH_SECTION_MAIL, SH_SECTION_MISC,
1011 sh_readconf_setMailtime },
1012 { N_("setmailnum"), SH_SECTION_MAIL, SH_SECTION_MISC,
1013 sh_mail_setNum },
1014 { N_("setmailaddress"), SH_SECTION_MAIL, SH_SECTION_MISC,
1015 sh_mail_setaddress },
1016 { N_("setmailrelay"), SH_SECTION_MAIL, SH_SECTION_MISC,
1017 sh_mail_set_relay },
1018 { N_("mailsingle"), SH_SECTION_MAIL, SH_SECTION_MISC,
1019 sh_mail_setFlag },
1020 { N_("mailsubject"), SH_SECTION_MAIL, SH_SECTION_MISC,
1021 set_mail_subject },
1022 { N_("setmailsender"), SH_SECTION_MAIL, SH_SECTION_MISC,
1023 sh_mail_set_sender },
1024 { N_("setmailfilternot"), SH_SECTION_MAIL, SH_SECTION_MISC,
1025 sh_mail_add_not },
1026 { N_("setmailfilterand"), SH_SECTION_MAIL, SH_SECTION_MISC,
1027 sh_mail_add_and },
1028 { N_("setmailfilteror"), SH_SECTION_MAIL, SH_SECTION_MISC,
1029 sh_mail_add_or },
1030#endif
1031 { N_("setbindaddress"), SH_SECTION_MISC, SH_SECTION_NONE,
1032 sh_calls_set_bind_addr },
1033 { N_("daemon"), SH_SECTION_MISC, SH_SECTION_NONE,
1034 sh_unix_setdeamon },
1035 { N_("samhainpath"), SH_SECTION_MISC, SH_SECTION_NONE,
1036 sh_unix_self_hash },
1037 { N_("trusteduser"), SH_SECTION_MISC, SH_SECTION_NONE,
1038 tf_add_trusted_user },
1039 { N_("settimeserver"), SH_SECTION_MISC, SH_SECTION_NONE,
1040 sh_unix_settimeserver },
1041
1042 { N_("printseverity"), SH_SECTION_LOG, SH_SECTION_NONE,
1043 sh_error_setprint },
1044 { N_("printclass"), SH_SECTION_LOG, SH_SECTION_NONE,
1045 sh_error_print_mask },
1046
1047 { N_("logseverity"), SH_SECTION_LOG, SH_SECTION_NONE,
1048 sh_error_setlog },
1049 { N_("logclass"), SH_SECTION_LOG, SH_SECTION_NONE,
1050 sh_error_log_mask },
1051
1052 { N_("syslogseverity"), SH_SECTION_LOG, SH_SECTION_NONE,
1053 sh_error_set_syslog },
1054 { N_("syslogclass"), SH_SECTION_LOG, SH_SECTION_NONE,
1055 sh_error_syslog_mask },
1056#ifdef HAVE_LIBPRELUDE
1057 { N_("preludeseverity"), SH_SECTION_LOG, SH_SECTION_NONE,
1058 sh_error_set_prelude },
1059 { N_("preludeclass"), SH_SECTION_LOG, SH_SECTION_NONE,
1060 sh_error_prelude_mask },
1061 { N_("preludeprofile"), SH_SECTION_MISC, SH_SECTION_NONE,
1062 sh_prelude_set_profile },
1063 { N_("preludemaptoinfo"), SH_SECTION_MISC, SH_SECTION_NONE,
1064 sh_prelude_map_info },
1065 { N_("preludemaptolow"), SH_SECTION_MISC, SH_SECTION_NONE,
1066 sh_prelude_map_low },
1067 { N_("preludemaptomedium"), SH_SECTION_MISC, SH_SECTION_NONE,
1068 sh_prelude_map_medium },
1069 { N_("preludemaptohigh"), SH_SECTION_MISC, SH_SECTION_NONE,
1070 sh_prelude_map_high },
1071#endif
1072
1073 { N_("logcalls"), SH_SECTION_LOG, SH_SECTION_NONE,
1074 sh_aud_set_functions },
1075
1076 { N_("messageheader"), SH_SECTION_MISC, SH_SECTION_NONE,
1077 sh_error_ehead },
1078
1079 { N_("setconsole"), SH_SECTION_MISC, SH_SECTION_NONE,
1080 sh_log_set_console },
1081
1082#ifdef WITH_MESSAGE_QUEUE
1083 { N_("messagequeueactive"),SH_SECTION_MISC, SH_SECTION_NONE,
1084 enable_msgq },
1085#endif
1086
1087 { N_("setreverselookup"), SH_SECTION_MISC, SH_SECTION_NONE,
1088 set_reverse_lookup },
1089
1090 { N_("setdatabasepath"), SH_SECTION_MISC, SH_SECTION_NONE,
1091 sh_readconf_set_database_path },
1092
1093 { N_("setlogfilepath"), SH_SECTION_MISC, SH_SECTION_NONE,
1094 sh_readconf_set_logfile_path },
1095
1096 { N_("setlockfilepath"), SH_SECTION_MISC, SH_SECTION_NONE,
1097 sh_readconf_set_lockfile_path },
1098
1099 { N_("hidesetup"), SH_SECTION_MISC, SH_SECTION_NONE,
1100 sh_util_hidesetup },
1101
1102 { N_("syslogfacility"), SH_SECTION_LOG, SH_SECTION_MISC,
1103 sh_log_set_facility },
1104
1105 { N_("mactype"), SH_SECTION_MISC, SH_SECTION_NONE,
1106 sh_util_sigtype },
1107
1108 { NULL, 0, 0, NULL}
1109};
1110
1111
1112
1113
1114static int sh_readconfig_line (char * line)
1115{
1116 char * key;
1117 const char * value;
1118 char * tmp;
1119 int i;
1120 int good_opt = -1;
1121
1122#if defined (SH_WITH_CLIENT) || defined (SH_STANDALONE)
1123 int modnum, modkey;
1124#endif
1125
1126 static const char *dummy = N_("dummy");
1127
1128 static const char *closing[] = {
1129 N_("closecommand"),
1130 N_("logmonendgroup"),
1131 N_("logmonendhost"),
1132 NULL
1133 };
1134
1135 static const char *ident[] = {
1136 N_("severityreadonly"),
1137 N_("severitylogfiles"),
1138 N_("severitygrowinglogs"),
1139 N_("severityignorenone"),
1140 N_("severityignoreall"),
1141 N_("severityattributes"),
1142 N_("severitydirs"),
1143 N_("severityfiles"),
1144 N_("severitynames"),
1145 N_("severityuser0"),
1146 N_("severityuser1"),
1147 N_("severityuser2"),
1148 N_("severityuser3"),
1149 N_("severityuser4"),
1150 N_("severityprelink"),
1151 NULL
1152 };
1153
1154 static int identnum[] = {
1155 SH_ERR_T_RO,
1156 SH_ERR_T_LOGS,
1157 SH_ERR_T_GLOG,
1158 SH_ERR_T_NOIG,
1159 SH_ERR_T_ALLIG,
1160 SH_ERR_T_ATTR,
1161 SH_ERR_T_DIR,
1162 SH_ERR_T_FILE,
1163 SH_ERR_T_NAME,
1164 SH_ERR_T_USER0,
1165 SH_ERR_T_USER1,
1166 SH_ERR_T_USER2,
1167 SH_ERR_T_USER3,
1168 SH_ERR_T_USER4,
1169 SH_ERR_T_PRELINK,
1170 };
1171
1172 SL_ENTER(_("sh_readconf_line"));
1173
1174 /* convert to lowercase */
1175
1176 tmp = line;
1177 while (*tmp != '=' && *tmp != '\0')
1178 {
1179 *tmp = tolower( (int) *tmp);
1180 ++tmp;
1181 }
1182
1183 key = line;
1184
1185 /* interpret line */
1186
1187 value = strchr(line, '=');
1188
1189 if (value == NULL || (*value) == '\0')
1190 {
1191 if (key != NULL)
1192 {
1193 i = 0;
1194 while (closing[i] != NULL)
1195 {
1196 if (sl_strncmp(key,_(closing[i]),sl_strlen(closing[i])-1) == 0)
1197 {
1198 value = dummy;
1199 goto ok_novalue;
1200 }
1201 ++i;
1202 }
1203
1204 TPT(( 0, FIL__, __LINE__, _("msg=<ConfigFile: not key=value: %s>\n"),
1205 line));
1206 }
1207 SL_RETURN(good_opt, _("sh_readconf_line"));
1208 }
1209 else
1210 ++value;
1211
1212 /* skip leading whitespace
1213 */
1214 while ((*value) == ' ' || (*value) == '\t')
1215 ++value;
1216
1217 if ((*value) == '\0') /* no value */
1218 {
1219 if (key != NULL)
1220 {
1221 TPT(( 0, FIL__, __LINE__, _("msg=<ConfigFile: not key=value: %s>\n"),
1222 line));
1223 }
1224 SL_RETURN(good_opt, _("sh_readconf_line"));
1225 }
1226
1227 ok_novalue:
1228
1229 if (!sl_is_suid())
1230 {
1231 TPT(( 0, FIL__, __LINE__, _("msg=<ConfigFile: %s>\n"), line));
1232 }
1233
1234
1235#if defined (SH_WITH_CLIENT) || defined (SH_STANDALONE)
1236 if (read_mode == SH_SECTION_OTHER)
1237 {
1238 for (modnum = 0; modList[modnum].name != NULL; ++modnum)
1239 {
1240 for (modkey = 0; modList[modnum].conf_table[modkey].the_opt != NULL;
1241 ++modkey)
1242 {
1243 if (sl_strncmp (key,
1244 _(modList[modnum].conf_table[modkey].the_opt),
1245 sl_strlen(modList[modnum].conf_table[modkey].the_opt) ) == 0)
1246 {
1247 good_opt = 0;
1248 if (0 != modList[modnum].conf_table[modkey].func(value))
1249 sh_error_handle ((-1), FIL__, __LINE__, 0, MSG_EINVALS,
1250 _(modList[modnum].conf_table[modkey].the_opt), value);
1251 if (!sl_is_suid())
1252 {
1253 TPT(( 0, FIL__, __LINE__,
1254 _("msg=<line = %s, option = %s>\n"), line,
1255 _(modList[modnum].conf_table[modkey].the_opt)));
1256 }
1257 goto outburst;
1258 }
1259 }
1260 }
1261 }
1262 outburst:
1263#endif
1264
1265
1266 if (read_mode == SH_SECTION_THRESHOLD)
1267 {
1268 i = 0;
1269 while (ident[i] != NULL) {
1270 if (sl_strncmp (key, _(ident[i]), sl_strlen(ident[i])-1) == 0)
1271 {
1272 good_opt = 0;
1273 sh_error_set_iv (identnum[i], value);
1274 break;
1275 }
1276 ++i;
1277 }
1278 }
1279 else
1280 {
1281 i = 0;
1282 while (ext_table[i].optname != NULL)
1283 {
1284 if ((ext_table[i].section == read_mode ||
1285 ext_table[i].alt_section == read_mode) &&
1286 sl_strncmp (key, _(ext_table[i].optname),
1287 sl_strlen(ext_table[i].optname)) == 0)
1288 {
1289 good_opt = 0;
1290 if (0 != ext_table[i].func (value))
1291 sh_error_handle ((-1), FIL__, __LINE__, 0, MSG_EINVALS,
1292 _(ext_table[i].optname), value);
1293 break;
1294 }
1295 ++i;
1296 }
1297 }
1298
1299 SL_RETURN(good_opt, _("sh_readconf_line"));
1300}
1301
1302
Note: See TracBrowser for help on using the repository browser.