X-Git-Url: http://ftp.carnet.hr/carnet-debian/scm?p=ossec-hids.git;a=blobdiff_plain;f=src%2Fconfig%2Fremote-config.c;h=e85d625f0683addc2db0c4c3ae66753f0bc19a57;hp=6627813997b8599d18b6c58db5475e7b2d9bfae8;hb=6ef2f786c6c8ead94841b5f93baf9f43421f08c8;hpb=301048b51990573e58a30dc4a5bb4ec285cad554 diff --git a/src/config/remote-config.c b/src/config/remote-config.c index 6627813..e85d625 100755 --- a/src/config/remote-config.c +++ b/src/config/remote-config.c @@ -34,6 +34,7 @@ int Read_Remote(XML_NODE node, void *d1, void *d2) /* Remote options */ char *xml_remote_port = "port"; char *xml_remote_proto = "protocol"; + char *xml_remote_ipv6 = "ipv6"; char *xml_remote_connection = "connection"; char *xml_remote_lip = "local_ip"; @@ -52,8 +53,8 @@ int Read_Remote(XML_NODE node, void *d1, void *d2) while(logr->denyips[deny_size -1]) deny_size++; } - - + + /* conn and port must not be null */ if(!logr->conn) { @@ -70,13 +71,18 @@ int Read_Remote(XML_NODE node, void *d1, void *d2) os_calloc(1, sizeof(int), logr->proto); logr->proto[0] = 0; } + if(!logr->ipv6) + { + os_calloc(1, sizeof(int), logr->ipv6); + logr->ipv6[0] = 0; + } if(!logr->lip) { os_calloc(1, sizeof(char *), logr->lip); logr->lip[0] = NULL; } - - + + /* Cleaning */ while(logr->conn[pl] != 0) pl++; @@ -86,22 +92,25 @@ int Read_Remote(XML_NODE node, void *d1, void *d2) logr->port = realloc(logr->port, sizeof(int)*(pl +2)); logr->conn = realloc(logr->conn, sizeof(int)*(pl +2)); logr->proto = realloc(logr->proto, sizeof(int)*(pl +2)); + logr->ipv6 = realloc(logr->ipv6, sizeof(int)*(pl +2)); logr->lip = realloc(logr->lip, sizeof(char *)*(pl +2)); if(!logr->port || !logr->conn || !logr->proto || !logr->lip) { merror(MEM_ERROR, ARGV0); } - + logr->port[pl] = 0; logr->conn[pl] = 0; logr->proto[pl] = 0; + logr->ipv6[pl] = 0; logr->lip[pl] = NULL; - + logr->port[pl +1] = 0; logr->conn[pl +1] = 0; logr->proto[pl +1] = 0; + logr->ipv6[pl +1] = 0; logr->lip[pl +1] = NULL; - + while(node[i]) { if(!node[i]->element) @@ -162,6 +171,13 @@ int Read_Remote(XML_NODE node, void *d1, void *d2) return(OS_INVALID); } } + else if(strcasecmp(node[i]->element,xml_remote_ipv6) == 0) + { + if(strcasecmp(node[i]->content, "yes") == 0) + { + logr->ipv6[pl] = 1; + } + } else if(strcasecmp(node[i]->element,xml_remote_lip) == 0) { os_strdup(node[i]->content,logr->lip[pl]); @@ -183,7 +199,7 @@ int Read_Remote(XML_NODE node, void *d1, void *d2) os_calloc(1, sizeof(os_ip), logr->allowips[allow_size -2]); logr->allowips[allow_size -1] = NULL; - + if(!OS_IsValidIP(node[i]->content,logr->allowips[allow_size -2])) { merror(INVALID_IP, ARGV0, node[i]->content); @@ -194,7 +210,7 @@ int Read_Remote(XML_NODE node, void *d1, void *d2) { deny_size++; logr->denyips = realloc(logr->denyips,sizeof(os_ip *)*deny_size); - if(!logr->denyips) + if(!logr->denyips) { merror(MEM_ERROR, ARGV0); return(OS_INVALID); @@ -222,14 +238,14 @@ int Read_Remote(XML_NODE node, void *d1, void *d2) merror(CONN_ERROR, ARGV0); return(OS_INVALID); } - + /* Set port in here */ if(logr->port[pl] == 0) { if(logr->conn[pl] == SECURE_CONN) logr->port[pl] = DEFAULT_SECURE; else - logr->port[pl] = DEFAULT_SYSLOG; + logr->port[pl] = DEFAULT_SYSLOG; } /* set default protocol */ @@ -243,7 +259,7 @@ int Read_Remote(XML_NODE node, void *d1, void *d2) { logr->proto[pl] = UDP_PROTO; } - + return(0); }