1 /* $OSSEC, alerts-config.c, v0.1, 2005/04/02, Daniel B. Cid$ */
3 /* Copyright (C) 2009 Trend Micro Inc.
6 * This program is a free software; you can redistribute it
7 * and/or modify it under the terms of the GNU General Public
8 * License (version 3) as published by the FSF - Free Software
12 /* Functions to handle the configuration files
17 #include "global-config.h"
20 int Read_Alerts(XML_NODE node, void *configp, void *mailp)
25 char *xml_email_level = "email_alert_level";
26 char *xml_log_level = "log_alert_level";
30 Config = (_Config *)configp;
37 merror(XML_ELEMNULL, ARGV0);
40 else if(!node[i]->content)
42 merror(XML_VALUENULL, ARGV0, node[i]->element);
45 /* Mail notification */
46 else if(strcmp(node[i]->element, xml_email_level) == 0)
48 if(!OS_StrIsNum(node[i]->content))
50 merror(XML_VALUEERR,ARGV0,node[i]->element,node[i]->content);
54 Config->mailbylevel = atoi(node[i]->content);
57 else if(strcmp(node[i]->element, xml_log_level) == 0)
59 if(!OS_StrIsNum(node[i]->content))
61 merror(XML_VALUEERR,ARGV0,node[i]->element,node[i]->content);
64 Config->logbylevel = atoi(node[i]->content);
68 merror(XML_INVELEM, ARGV0, node[i]->element);