1 /* Copyright (C) 2009 Trend Micro Inc.
4 * This program is a free software; you can redistribute it
5 * and/or modify it under the terms of the GNU General Public
6 * License (version 2) as published by the FSF - Free Software
14 /* Read the config file */
15 int ExecdConfig(const char *cfgfile)
22 const char *(xmlf[]) = {"ossec_config", "active-response", "disabled", NULL};
23 const char *(blocks[]) = {"ossec_config", "active-response", "repeated_offenders", NULL};
31 if (OS_ReadXML(cfgfile, &xml) < 0) {
32 ErrorExit(XML_ERROR, ARGV0, cfgfile, xml.err, xml.err_line);
35 /* We do not validate the xml in here. It is done by other processes. */
36 disable_entry = OS_GetOneContentforElement(&xml, xmlf);
38 if (strcmp(disable_entry, "yes") == 0) {
40 } else if (strcmp(disable_entry, "no") == 0) {
43 merror(XML_VALUEERR, ARGV0,
50 repeated_t = OS_GetOneContentforElement(&xml, blocks);
54 repeated_a = OS_StrBreak(',', repeated_t, 5);
56 merror(XML_VALUEERR, ARGV0,
62 while (repeated_a[i] != NULL) {
63 char *tmpt = repeated_a[i];
64 while (*tmpt != '\0') {
65 if (*tmpt == ' ' || *tmpt == '\t') {
77 repeated_offenders_timeout[j] = atoi(tmpt);
78 verbose("%s: INFO: Adding offenders timeout: %d (for #%d)",
79 ARGV0, repeated_offenders_timeout[j], j + 1);
81 repeated_offenders_timeout[j] = 0;