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