Skip to content

Commit fc45a3f

Browse files
committed
Fixed compilation issue under Windows when APR ipv6 is disabled
1 parent bd3cb0c commit fc45a3f

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

apache2/msc_util.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -834,7 +834,9 @@ char *m_strcasestr(const char *haystack, const char *needle) {
834834
int inet_pton(int family, const char *src, void *dst) {
835835
struct addrinfo addr;
836836
struct sockaddr_in *in = NULL;
837+
#if APR_HAVE_IPV6
837838
struct sockaddr_in6 *in6 = NULL;
839+
#endif
838840
struct addrinfo *addr_info = NULL;
839841

840842
memset(&addr, 0, sizeof(struct addrinfo));
@@ -849,11 +851,13 @@ int inet_pton(int family, const char *src, void *dst) {
849851
if(in != NULL)
850852
memcpy(dst, &in->sin_addr, 4);
851853
}
854+
#if APR_HAVE_IPV6
852855
else if (addr_info->ai_family == AF_INET6) {
853856
in6 = (struct sockaddr_in6*)addr_info->ai_addr;
854857
if(in6 != NULL)
855858
memcpy(dst, &in6->sin6_addr, 16);
856859
}
860+
#endif
857861
else {
858862
freeaddrinfo(addr_info);
859863
return -1;

apache2/re_operators.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,9 @@ static int msre_op_ipmatchFromFile_param_init(msre_rule *rule, char **error_msg)
305305
static int msre_op_ipmatchFromFile_execute(modsec_rec *msr, msre_rule *rule, msre_var *var, char **error_msg) {
306306
TreeRoot *rtree = rule->op_param_data;
307307
struct in_addr in;
308+
#if APR_HAVE_IPV6
308309
struct in6_addr in6;
310+
#endif
309311

310312
if (error_msg == NULL)
311313
return -1;
@@ -336,6 +338,7 @@ static int msre_op_ipmatchFromFile_execute(modsec_rec *msr, msre_rule *rule, msr
336338
return 1;
337339
}
338340
}
341+
#if APR_HAVE_IPV6
339342
else {
340343
if (inet_pton(AF_INET6, var->value, &in6) <= 0) {
341344
if (msr->txcfg->debuglog_level >= 9) {
@@ -350,6 +353,7 @@ static int msre_op_ipmatchFromFile_execute(modsec_rec *msr, msre_rule *rule, msr
350353
return 1;
351354
}
352355
}
356+
#endif
353357

354358
return 0;
355359
}

0 commit comments

Comments
 (0)