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
11 #include "global-config.h"
15 int Read_Alerts(XML_NODE node, void *configp, __attribute__((unused)) void *mailp)
20 const char *xml_email_level = "email_alert_level";
21 const char *xml_log_level = "log_alert_level";
23 #ifdef LIBGEOIP_ENABLED
25 const char *xml_log_geoip = "use_geoip";
29 Config = (_Config *)configp;
32 merror("%s: ERROR: Configuration handle is NULL.", __local_name);
37 if (!node[i]->element) {
38 merror(XML_ELEMNULL, __local_name);
40 } else if (!node[i]->content) {
41 merror(XML_VALUENULL, __local_name, node[i]->element);
44 /* Mail notification */
45 else if (strcmp(node[i]->element, xml_email_level) == 0) {
46 if (!OS_StrIsNum(node[i]->content)) {
47 merror(XML_VALUEERR, __local_name, node[i]->element, node[i]->content);
51 Config->mailbylevel = (u_int8_t) atoi(node[i]->content);
54 else if (strcmp(node[i]->element, xml_log_level) == 0) {
55 if (!OS_StrIsNum(node[i]->content)) {
56 merror(XML_VALUEERR, __local_name, node[i]->element, node[i]->content);
59 Config->logbylevel = (u_int8_t) atoi(node[i]->content);
61 #ifdef LIBGEOIP_ENABLED
63 else if (strcmp(node[i]->element, xml_log_geoip) == 0) {
64 if (strcmp(node[i]->content, "yes") == 0) {
66 } else if (strcmp(node[i]->content, "no") == 0) {
69 merror(XML_VALUEERR, __local_name, node[i]->element, node[i]->content);
76 merror(XML_INVELEM, __local_name, node[i]->element);