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