mirror of
https://github.com/owasp-modsecurity/ModSecurity.git
synced 2025-09-30 03:34:29 +03:00
Fixed compilation issue under Windows when APR ipv6 is disabled
This commit is contained in:
@@ -834,7 +834,9 @@ char *m_strcasestr(const char *haystack, const char *needle) {
|
|||||||
int inet_pton(int family, const char *src, void *dst) {
|
int inet_pton(int family, const char *src, void *dst) {
|
||||||
struct addrinfo addr;
|
struct addrinfo addr;
|
||||||
struct sockaddr_in *in = NULL;
|
struct sockaddr_in *in = NULL;
|
||||||
|
#if APR_HAVE_IPV6
|
||||||
struct sockaddr_in6 *in6 = NULL;
|
struct sockaddr_in6 *in6 = NULL;
|
||||||
|
#endif
|
||||||
struct addrinfo *addr_info = NULL;
|
struct addrinfo *addr_info = NULL;
|
||||||
|
|
||||||
memset(&addr, 0, sizeof(struct addrinfo));
|
memset(&addr, 0, sizeof(struct addrinfo));
|
||||||
@@ -849,11 +851,13 @@ int inet_pton(int family, const char *src, void *dst) {
|
|||||||
if(in != NULL)
|
if(in != NULL)
|
||||||
memcpy(dst, &in->sin_addr, 4);
|
memcpy(dst, &in->sin_addr, 4);
|
||||||
}
|
}
|
||||||
|
#if APR_HAVE_IPV6
|
||||||
else if (addr_info->ai_family == AF_INET6) {
|
else if (addr_info->ai_family == AF_INET6) {
|
||||||
in6 = (struct sockaddr_in6*)addr_info->ai_addr;
|
in6 = (struct sockaddr_in6*)addr_info->ai_addr;
|
||||||
if(in6 != NULL)
|
if(in6 != NULL)
|
||||||
memcpy(dst, &in6->sin6_addr, 16);
|
memcpy(dst, &in6->sin6_addr, 16);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
else {
|
else {
|
||||||
freeaddrinfo(addr_info);
|
freeaddrinfo(addr_info);
|
||||||
return -1;
|
return -1;
|
||||||
|
@@ -305,7 +305,9 @@ static int msre_op_ipmatchFromFile_param_init(msre_rule *rule, char **error_msg)
|
|||||||
static int msre_op_ipmatchFromFile_execute(modsec_rec *msr, msre_rule *rule, msre_var *var, char **error_msg) {
|
static int msre_op_ipmatchFromFile_execute(modsec_rec *msr, msre_rule *rule, msre_var *var, char **error_msg) {
|
||||||
TreeRoot *rtree = rule->op_param_data;
|
TreeRoot *rtree = rule->op_param_data;
|
||||||
struct in_addr in;
|
struct in_addr in;
|
||||||
|
#if APR_HAVE_IPV6
|
||||||
struct in6_addr in6;
|
struct in6_addr in6;
|
||||||
|
#endif
|
||||||
|
|
||||||
if (error_msg == NULL)
|
if (error_msg == NULL)
|
||||||
return -1;
|
return -1;
|
||||||
@@ -336,6 +338,7 @@ static int msre_op_ipmatchFromFile_execute(modsec_rec *msr, msre_rule *rule, msr
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#if APR_HAVE_IPV6
|
||||||
else {
|
else {
|
||||||
if (inet_pton(AF_INET6, var->value, &in6) <= 0) {
|
if (inet_pton(AF_INET6, var->value, &in6) <= 0) {
|
||||||
if (msr->txcfg->debuglog_level >= 9) {
|
if (msr->txcfg->debuglog_level >= 9) {
|
||||||
@@ -350,6 +353,7 @@ static int msre_op_ipmatchFromFile_execute(modsec_rec *msr, msre_rule *rule, msr
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user