source: trunk/src/sh_readconf.c@ 195

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

Fix for config reload issue with stealth mode (ticket #109).

File size: 35.8 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_("setiolimit"), SH_SECTION_MISC, SH_SECTION_NONE,
895 sh_unix_set_io_limit },
896
897 { N_("versionstring"), SH_SECTION_MISC, SH_SECTION_NONE,
898 sh_hash_version_string },
899
900 { N_("digestalgo"), SH_SECTION_MISC, SH_SECTION_NONE,
901 sh_tiger_hashtype },
902
903 { N_("redefreadonly"), SH_SECTION_MISC, SH_SECTION_NONE,
904 sh_files_redef_readonly },
905
906 { N_("redeflogfiles"), SH_SECTION_MISC, SH_SECTION_NONE,
907 sh_files_redef_logfiles },
908
909 { N_("redefgrowinglogfiles"), SH_SECTION_MISC, SH_SECTION_NONE,
910 sh_files_redef_loggrow },
911
912 { N_("redefattributes"), SH_SECTION_MISC, SH_SECTION_NONE,
913 sh_files_redef_attributes },
914
915 { N_("redefignorenone"), SH_SECTION_MISC, SH_SECTION_NONE,
916 sh_files_redef_noignore },
917
918 { N_("redefignoreall"), SH_SECTION_MISC, SH_SECTION_NONE,
919 sh_files_redef_allignore },
920
921 { N_("redefuser0"), SH_SECTION_MISC, SH_SECTION_NONE,
922 sh_files_redef_user0 },
923
924 { N_("redefuser1"), SH_SECTION_MISC, SH_SECTION_NONE,
925 sh_files_redef_user1 },
926
927 { N_("redefuser2"), SH_SECTION_MISC, SH_SECTION_NONE,
928 sh_files_redef_user2 },
929
930 { N_("redefuser3"), SH_SECTION_MISC, SH_SECTION_NONE,
931 sh_files_redef_user3 },
932
933 { N_("redefuser4"), SH_SECTION_MISC, SH_SECTION_NONE,
934 sh_files_redef_user4 },
935
936 { N_("redefprelink"), SH_SECTION_MISC, SH_SECTION_NONE,
937 sh_files_redef_prelink },
938
939
940 { N_("setprelinkpath"), SH_SECTION_MISC, SH_SECTION_NONE,
941 sh_prelink_set_path },
942 { N_("setprelinkchecksum"), SH_SECTION_MISC, SH_SECTION_NONE,
943 sh_prelink_set_hash },
944
945 /* client or standalone
946 */
947#endif
948
949#ifdef SH_WITH_SERVER
950#ifdef INET_SYSLOG
951 { N_("setudpactive"), SH_SECTION_SRV, SH_SECTION_MISC,
952 set_syslog_active },
953#endif
954 { N_("setusesocket"), SH_SECTION_SRV, SH_SECTION_MISC,
955 sh_socket_use },
956 { N_("setsocketallowuid"), SH_SECTION_SRV, SH_SECTION_MISC,
957 sh_socket_uid },
958 { N_("setsocketpassword"), SH_SECTION_SRV, SH_SECTION_MISC,
959 sh_socket_password },
960 { N_("setstripdomain"), SH_SECTION_SRV, SH_SECTION_MISC,
961 sh_forward_set_strip },
962 { N_("useseparatelogs"), SH_SECTION_SRV, SH_SECTION_MISC,
963 set_flag_sep_log },
964 { N_("setchrootdir"), SH_SECTION_SRV, SH_SECTION_MISC,
965 sh_unix_set_chroot },
966 { N_("setclienttimelimit"), SH_SECTION_SRV, SH_SECTION_MISC,
967 sh_forward_set_time_limit },
968 { N_("useclientseverity"), SH_SECTION_SRV, SH_SECTION_MISC,
969 sh_forward_use_clt_sev },
970 { N_("useclientclass"), SH_SECTION_SRV, SH_SECTION_MISC,
971 sh_forward_use_clt_class },
972 { N_("severitylookup"), SH_SECTION_SRV, SH_SECTION_MISC,
973 sh_forward_lookup_level },
974 { N_("setclientfromaccept"), SH_SECTION_SRV, SH_SECTION_MISC,
975 set_socket_peer },
976 { N_("setserverport"), SH_SECTION_SRV, SH_SECTION_MISC,
977 sh_forward_set_port },
978 { N_("setserverinterface"), SH_SECTION_SRV, SH_SECTION_MISC,
979 sh_forward_set_interface },
980 { N_("client"), SH_SECTION_CLIENTS, SH_SECTION_NONE,
981 sh_forward_register_client },
982#endif
983
984#if defined(SH_WITH_CLIENT) || defined(SH_WITH_SERVER)
985 { N_("exportseverity"), SH_SECTION_LOG, SH_SECTION_NONE,
986 sh_error_setexport },
987 { N_("exportclass"), SH_SECTION_LOG, SH_SECTION_NONE,
988 sh_error_export_mask },
989#if defined(SH_WITH_SERVER)
990 { N_("setlogserver"), SH_SECTION_SRV, SH_SECTION_MISC,
991 sh_forward_setlogserver },
992#else
993 { N_("setlogserver"), SH_SECTION_CLT, SH_SECTION_MISC,
994 sh_forward_setlogserver },
995#endif
996#endif
997 { N_("setfilechecktime"), SH_SECTION_MISC, SH_SECTION_NONE,
998 sh_readconf_setFiletime },
999 { N_("setlooptime"), SH_SECTION_MISC, SH_SECTION_NONE,
1000 sh_util_setlooptime },
1001
1002#ifdef SH_WITH_MAIL
1003 { N_("mailseverity"), SH_SECTION_LOG, SH_SECTION_NONE,
1004 sh_error_setseverity },
1005 { N_("mailclass"), SH_SECTION_LOG, SH_SECTION_NONE,
1006 sh_error_mail_mask },
1007 { N_("setmailtime"), SH_SECTION_MAIL, SH_SECTION_MISC,
1008 sh_readconf_setMailtime },
1009 { N_("setmailnum"), SH_SECTION_MAIL, SH_SECTION_MISC,
1010 sh_mail_setNum },
1011 { N_("setmailaddress"), SH_SECTION_MAIL, SH_SECTION_MISC,
1012 sh_mail_setaddress },
1013 { N_("setmailrelay"), SH_SECTION_MAIL, SH_SECTION_MISC,
1014 sh_mail_set_relay },
1015 { N_("mailsingle"), SH_SECTION_MAIL, SH_SECTION_MISC,
1016 sh_mail_setFlag },
1017 { N_("mailsubject"), SH_SECTION_MAIL, SH_SECTION_MISC,
1018 set_mail_subject },
1019 { N_("setmailsender"), SH_SECTION_MAIL, SH_SECTION_MISC,
1020 sh_mail_set_sender },
1021 { N_("setmailfilternot"), SH_SECTION_MAIL, SH_SECTION_MISC,
1022 sh_mail_add_not },
1023 { N_("setmailfilterand"), SH_SECTION_MAIL, SH_SECTION_MISC,
1024 sh_mail_add_and },
1025 { N_("setmailfilteror"), SH_SECTION_MAIL, SH_SECTION_MISC,
1026 sh_mail_add_or },
1027#endif
1028 { N_("setbindaddress"), SH_SECTION_MISC, SH_SECTION_NONE,
1029 sh_calls_set_bind_addr },
1030 { N_("daemon"), SH_SECTION_MISC, SH_SECTION_NONE,
1031 sh_unix_setdeamon },
1032 { N_("samhainpath"), SH_SECTION_MISC, SH_SECTION_NONE,
1033 sh_unix_self_hash },
1034 { N_("trusteduser"), SH_SECTION_MISC, SH_SECTION_NONE,
1035 tf_add_trusted_user },
1036 { N_("settimeserver"), SH_SECTION_MISC, SH_SECTION_NONE,
1037 sh_unix_settimeserver },
1038
1039 { N_("printseverity"), SH_SECTION_LOG, SH_SECTION_NONE,
1040 sh_error_setprint },
1041 { N_("printclass"), SH_SECTION_LOG, SH_SECTION_NONE,
1042 sh_error_print_mask },
1043
1044 { N_("logseverity"), SH_SECTION_LOG, SH_SECTION_NONE,
1045 sh_error_setlog },
1046 { N_("logclass"), SH_SECTION_LOG, SH_SECTION_NONE,
1047 sh_error_log_mask },
1048
1049 { N_("syslogseverity"), SH_SECTION_LOG, SH_SECTION_NONE,
1050 sh_error_set_syslog },
1051 { N_("syslogclass"), SH_SECTION_LOG, SH_SECTION_NONE,
1052 sh_error_syslog_mask },
1053#ifdef HAVE_LIBPRELUDE
1054 { N_("preludeseverity"), SH_SECTION_LOG, SH_SECTION_NONE,
1055 sh_error_set_prelude },
1056 { N_("preludeclass"), SH_SECTION_LOG, SH_SECTION_NONE,
1057 sh_error_prelude_mask },
1058 { N_("preludeprofile"), SH_SECTION_MISC, SH_SECTION_NONE,
1059 sh_prelude_set_profile },
1060 { N_("preludemaptoinfo"), SH_SECTION_MISC, SH_SECTION_NONE,
1061 sh_prelude_map_info },
1062 { N_("preludemaptolow"), SH_SECTION_MISC, SH_SECTION_NONE,
1063 sh_prelude_map_low },
1064 { N_("preludemaptomedium"), SH_SECTION_MISC, SH_SECTION_NONE,
1065 sh_prelude_map_medium },
1066 { N_("preludemaptohigh"), SH_SECTION_MISC, SH_SECTION_NONE,
1067 sh_prelude_map_high },
1068#endif
1069
1070 { N_("logcalls"), SH_SECTION_LOG, SH_SECTION_NONE,
1071 sh_aud_set_functions },
1072
1073 { N_("messageheader"), SH_SECTION_MISC, SH_SECTION_NONE,
1074 sh_error_ehead },
1075
1076 { N_("setconsole"), SH_SECTION_MISC, SH_SECTION_NONE,
1077 sh_log_set_console },
1078
1079#ifdef WITH_MESSAGE_QUEUE
1080 { N_("messagequeueactive"),SH_SECTION_MISC, SH_SECTION_NONE,
1081 enable_msgq },
1082#endif
1083
1084 { N_("setreverselookup"), SH_SECTION_MISC, SH_SECTION_NONE,
1085 set_reverse_lookup },
1086
1087 { N_("setdatabasepath"), SH_SECTION_MISC, SH_SECTION_NONE,
1088 sh_readconf_set_database_path },
1089
1090 { N_("setlogfilepath"), SH_SECTION_MISC, SH_SECTION_NONE,
1091 sh_readconf_set_logfile_path },
1092
1093 { N_("setlockfilepath"), SH_SECTION_MISC, SH_SECTION_NONE,
1094 sh_readconf_set_lockfile_path },
1095
1096 { N_("hidesetup"), SH_SECTION_MISC, SH_SECTION_NONE,
1097 sh_util_hidesetup },
1098
1099 { N_("syslogfacility"), SH_SECTION_LOG, SH_SECTION_MISC,
1100 sh_log_set_facility },
1101
1102 { N_("mactype"), SH_SECTION_MISC, SH_SECTION_NONE,
1103 sh_util_sigtype },
1104
1105 { NULL, 0, 0, NULL}
1106};
1107
1108
1109
1110
1111static int sh_readconfig_line (char * line)
1112{
1113 char * key;
1114 const char * value;
1115 char * tmp;
1116 int i;
1117 int good_opt = -1;
1118
1119#if defined (SH_WITH_CLIENT) || defined (SH_STANDALONE)
1120 int modnum, modkey;
1121#endif
1122
1123 static const char *dummy = N_("dummy");
1124
1125 static const char *closing[] = {
1126 N_("closecommand"),
1127 N_("logmonendgroup"),
1128 N_("logmonendhost"),
1129 NULL
1130 };
1131
1132 static const char *ident[] = {
1133 N_("severityreadonly"),
1134 N_("severitylogfiles"),
1135 N_("severitygrowinglogs"),
1136 N_("severityignorenone"),
1137 N_("severityignoreall"),
1138 N_("severityattributes"),
1139 N_("severitydirs"),
1140 N_("severityfiles"),
1141 N_("severitynames"),
1142 N_("severityuser0"),
1143 N_("severityuser1"),
1144 N_("severityuser2"),
1145 N_("severityuser3"),
1146 N_("severityuser4"),
1147 N_("severityprelink"),
1148 NULL
1149 };
1150
1151 static int identnum[] = {
1152 SH_ERR_T_RO,
1153 SH_ERR_T_LOGS,
1154 SH_ERR_T_GLOG,
1155 SH_ERR_T_NOIG,
1156 SH_ERR_T_ALLIG,
1157 SH_ERR_T_ATTR,
1158 SH_ERR_T_DIR,
1159 SH_ERR_T_FILE,
1160 SH_ERR_T_NAME,
1161 SH_ERR_T_USER0,
1162 SH_ERR_T_USER1,
1163 SH_ERR_T_USER2,
1164 SH_ERR_T_USER3,
1165 SH_ERR_T_USER4,
1166 SH_ERR_T_PRELINK,
1167 };
1168
1169 SL_ENTER(_("sh_readconf_line"));
1170
1171 /* convert to lowercase */
1172
1173 tmp = line;
1174 while (*tmp != '=' && *tmp != '\0')
1175 {
1176 *tmp = tolower( (int) *tmp);
1177 ++tmp;
1178 }
1179
1180 key = line;
1181
1182 /* interpret line */
1183
1184 value = strchr(line, '=');
1185
1186 if (value == NULL || (*value) == '\0')
1187 {
1188 if (key != NULL)
1189 {
1190 i = 0;
1191 while (closing[i] != NULL)
1192 {
1193 if (sl_strncmp(key,_(closing[i]),sl_strlen(closing[i])-1) == 0)
1194 {
1195 value = dummy;
1196 goto ok_novalue;
1197 }
1198 ++i;
1199 }
1200
1201 TPT(( 0, FIL__, __LINE__, _("msg=<ConfigFile: not key=value: %s>\n"),
1202 line));
1203 }
1204 SL_RETURN(good_opt, _("sh_readconf_line"));
1205 }
1206 else
1207 ++value;
1208
1209 /* skip leading whitespace
1210 */
1211 while ((*value) == ' ' || (*value) == '\t')
1212 ++value;
1213
1214 if ((*value) == '\0') /* no value */
1215 {
1216 if (key != NULL)
1217 {
1218 TPT(( 0, FIL__, __LINE__, _("msg=<ConfigFile: not key=value: %s>\n"),
1219 line));
1220 }
1221 SL_RETURN(good_opt, _("sh_readconf_line"));
1222 }
1223
1224 ok_novalue:
1225
1226 if (!sl_is_suid())
1227 {
1228 TPT(( 0, FIL__, __LINE__, _("msg=<ConfigFile: %s>\n"), line));
1229 }
1230
1231
1232#if defined (SH_WITH_CLIENT) || defined (SH_STANDALONE)
1233 if (read_mode == SH_SECTION_OTHER)
1234 {
1235 for (modnum = 0; modList[modnum].name != NULL; ++modnum)
1236 {
1237 for (modkey = 0; modList[modnum].conf_table[modkey].the_opt != NULL;
1238 ++modkey)
1239 {
1240 if (sl_strncmp (key,
1241 _(modList[modnum].conf_table[modkey].the_opt),
1242 sl_strlen(modList[modnum].conf_table[modkey].the_opt) ) == 0)
1243 {
1244 good_opt = 0;
1245 if (0 != modList[modnum].conf_table[modkey].func(value))
1246 sh_error_handle ((-1), FIL__, __LINE__, 0, MSG_EINVALS,
1247 _(modList[modnum].conf_table[modkey].the_opt), value);
1248 if (!sl_is_suid())
1249 {
1250 TPT(( 0, FIL__, __LINE__,
1251 _("msg=<line = %s, option = %s>\n"), line,
1252 _(modList[modnum].conf_table[modkey].the_opt)));
1253 }
1254 goto outburst;
1255 }
1256 }
1257 }
1258 }
1259 outburst:
1260#endif
1261
1262
1263 if (read_mode == SH_SECTION_THRESHOLD)
1264 {
1265 i = 0;
1266 while (ident[i] != NULL) {
1267 if (sl_strncmp (key, _(ident[i]), sl_strlen(ident[i])-1) == 0)
1268 {
1269 good_opt = 0;
1270 sh_error_set_iv (identnum[i], value);
1271 break;
1272 }
1273 ++i;
1274 }
1275 }
1276 else
1277 {
1278 i = 0;
1279 while (ext_table[i].optname != NULL)
1280 {
1281 if ((ext_table[i].section == read_mode ||
1282 ext_table[i].alt_section == read_mode) &&
1283 sl_strncmp (key, _(ext_table[i].optname),
1284 sl_strlen(ext_table[i].optname)) == 0)
1285 {
1286 good_opt = 0;
1287 if (0 != ext_table[i].func (value))
1288 sh_error_handle ((-1), FIL__, __LINE__, 0, MSG_EINVALS,
1289 _(ext_table[i].optname), value);
1290 break;
1291 }
1292 ++i;
1293 }
1294 }
1295
1296 SL_RETURN(good_opt, _("sh_readconf_line"));
1297}
1298
1299
Note: See TracBrowser for help on using the repository browser.