X-Git-Url: http://ftp.carnet.hr/carnet-debian/scm?p=ossec-hids.git;a=blobdiff_plain;f=src%2Fos_execd%2Fconfig.c;h=17c116621bb464cc7bc0b3d608b9bcc8263bff11;hp=f275217f6335d97c7780fb4de5b0b39edf575c28;hb=6ef2f786c6c8ead94841b5f93baf9f43421f08c8;hpb=301048b51990573e58a30dc4a5bb4ec285cad554 diff --git a/src/os_execd/config.c b/src/os_execd/config.c index f275217..17c1166 100755 --- a/src/os_execd/config.c +++ b/src/os_execd/config.c @@ -1,4 +1,5 @@ -/* @(#) $Id$ */ +/* @(#) $Id: ./src/os_execd/config.c, 2011/09/08 dcid Exp $ + */ /* Copyright (C) 2009 Trend Micro Inc. * All right reserved. @@ -10,7 +11,8 @@ */ -#include "shared.h" +#include "shared.h" +#include "execd.h" /* ExecdConfig v0.1, 2006/03/24 @@ -18,13 +20,17 @@ */ int ExecdConfig(char * cfgfile) { + extern int repeated_offenders_timeout[]; #ifdef WIN32 int is_disabled = 1; #else int is_disabled = 0; #endif char *(xmlf[]) = {"ossec_config", "active-response", "disabled", NULL}; + char *(blocks[]) = {"ossec_config", "active-response", "repeated_offenders", NULL}; char *disable_entry; + char *repeated_t; + char **repeated_a; OS_XML xml; @@ -50,12 +56,54 @@ int ExecdConfig(char * cfgfile) else { merror(XML_VALUEERR, ARGV0, - "disabled", - disable_entry); + "disabled", + disable_entry); return(-1); } } - + + repeated_t = OS_GetOneContentforElement(&xml, blocks); + if(repeated_t) + { + int i = 0; + int j = 0; + repeated_a = OS_StrBreak(',', repeated_t, 5); + if(!repeated_a) + { + merror(XML_VALUEERR, ARGV0, + "repeated_offenders", + disable_entry); + return(-1); + } + + while(repeated_a[i] != NULL) + { + char *tmpt = repeated_a[i]; + while(*tmpt != '\0') + { + if(*tmpt == ' ' || *tmpt == '\t') + tmpt++; + else + break; + } + + if(*tmpt == '\0') + { + i++; + continue; + } + + repeated_offenders_timeout[j] = atoi(tmpt); + verbose("%s: INFO: Adding offenders timeout: %d (for #%d)", + ARGV0, repeated_offenders_timeout[j], j+1); + j++; + repeated_offenders_timeout[j] = 0; + if(j >= 6) break; + i++; + } + } + + OS_ClearXML(&xml); return(is_disabled); }