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