Imported Upstream version 2.7
[ossec-hids.git] / src / config / client-config.c
index 3eddfc3..5721755 100755 (executable)
 #include "os_net/os_net.h"
 
 
-int Read_Client(XML_NODE node, void *d1, void *d2) 
+int Read_Client(XML_NODE node, void *d1, void *d2)
 {
     int i = 0;
-    
+
     /* XML definitions */
     char *xml_client_ip = "server-ip";
     char *xml_client_hostname = "server-hostname";
     char *xml_local_ip = "local_ip";
     char *xml_client_port = "port";
     char *xml_ar_disabled = "disable-active-response";
+    /* cmoraes */
+    char *xml_profile_name = "config-profile";
 
     agent *logr;
 
@@ -70,7 +72,7 @@ int Read_Client(XML_NODE node, void *d1, void *d2)
             os_realloc(logr->rip, (ip_id + 2) * sizeof(char*), logr->rip);
             logr->rip[ip_id] = NULL;
             logr->rip[ip_id +1] = NULL;
-            
+
             os_strdup(node[i]->content, logr->rip[ip_id]);
             if(OS_IsValidIP(logr->rip[ip_id], NULL) != 1)
             {
@@ -98,7 +100,7 @@ int Read_Client(XML_NODE node, void *d1, void *d2)
             os_realloc(logr->rip, (ip_id + 2) * sizeof(char*),
                        logr->rip);
 
-            
+
             s_ip = OS_GetHost(node[i]->content, 5);
             if(!s_ip)
             {
@@ -108,7 +110,7 @@ int Read_Client(XML_NODE node, void *d1, void *d2)
 
                 os_strdup("invalid_ip", s_ip);
             }
-            
+
 
             f_ip[127] = '\0';
             snprintf(f_ip, 127, "%s/%s", node[i]->content, s_ip);
@@ -147,6 +149,12 @@ int Read_Client(XML_NODE node, void *d1, void *d2)
                 return(OS_INVALID);
             }
         }
+        /* cmoraes */
+        else if(strcmp(node[i]->element,xml_profile_name) == 0)
+        {
+            /* profile name can be anything hence no validation */
+            os_strdup(node[i]->content, logr->profile);
+        }
         else
         {
             merror(XML_INVELEM, ARGV0, node[i]->element);