1 /* @(#) $Id: ./src/os_execd/config.c, 2011/09/08 dcid Exp $
4 /* Copyright (C) 2009 Trend Micro Inc.
7 * This program is a free software; you can redistribute it
8 * and/or modify it under the terms of the GNU General Public
9 * License (version 2) as published by the FSF - Free Software
18 /* ExecdConfig v0.1, 2006/03/24
19 * Read the config file
21 int ExecdConfig(char * cfgfile)
23 extern int repeated_offenders_timeout[];
29 char *(xmlf[]) = {"ossec_config", "active-response", "disabled", NULL};
30 char *(blocks[]) = {"ossec_config", "active-response", "repeated_offenders", NULL};
38 /* Reading XML file */
39 if(OS_ReadXML(cfgfile,&xml) < 0)
41 ErrorExit(XML_ERROR, ARGV0, cfgfile, xml.err, xml.err_line);
44 /* We do not validate the xml in here. It is done by other processes */
45 disable_entry = OS_GetOneContentforElement(&xml, xmlf);
48 if(strcmp(disable_entry, "yes") == 0)
52 else if(strcmp(disable_entry, "no") == 0)
58 merror(XML_VALUEERR, ARGV0,
65 repeated_t = OS_GetOneContentforElement(&xml, blocks);
70 repeated_a = OS_StrBreak(',', repeated_t, 5);
73 merror(XML_VALUEERR, ARGV0,
79 while(repeated_a[i] != NULL)
81 char *tmpt = repeated_a[i];
84 if(*tmpt == ' ' || *tmpt == '\t')
96 repeated_offenders_timeout[j] = atoi(tmpt);
97 verbose("%s: INFO: Adding offenders timeout: %d (for #%d)",
98 ARGV0, repeated_offenders_timeout[j], j+1);
100 repeated_offenders_timeout[j] = 0;