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 2) 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 char *xml_log_geoip = "use_geoip";
35 Config = (_Config *)configp;
42 merror(XML_ELEMNULL, ARGV0);
45 else if(!node[i]->content)
47 merror(XML_VALUENULL, ARGV0, node[i]->element);
50 /* Mail notification */
51 else if(strcmp(node[i]->element, xml_email_level) == 0)
53 if(!OS_StrIsNum(node[i]->content))
55 merror(XML_VALUEERR,ARGV0,node[i]->element,node[i]->content);
59 Config->mailbylevel = atoi(node[i]->content);
62 else if(strcmp(node[i]->element, xml_log_level) == 0)
64 if(!OS_StrIsNum(node[i]->content))
66 merror(XML_VALUEERR,ARGV0,node[i]->element,node[i]->content);
69 Config->logbylevel = atoi(node[i]->content);
73 else if(strcmp(node[i]->element, xml_log_geoip) == 0)
75 if(strcmp(node[i]->content, "yes") == 0)
76 { if(Config) Config->loggeoip = 1;}
77 else if(strcmp(node[i]->content, "no") == 0)
78 {if(Config) Config->loggeoip = 0;}
81 merror(XML_VALUEERR,ARGV0,node[i]->element,node[i]->content);
89 merror(XML_INVELEM, ARGV0, node[i]->element);