Hi Jeff,

Thanks for the patch, our development version is not on the master branch,
but on branch labeled remotes/trunk. On this development branch this issue
was address by replacing the windows function with a define, although It still
demands runtime tests. Here goes the link to the commit:


The build was tested with VS 2011, 2012 (32 and 64b) on Windows 7, 8 and 8.1.
If you are interested in the windows development, have a look on this branch. 
Lot of changes related to the windows build process.

To download the remotes/trunk branch, try:

git clone https://github.com/SpiderLabs/ModSecurity.git
git checkout origin/remotes/trunk -b trunk


On Nov 25, 2013, at 9:10 PM, Jeff Trawick <trawick@gmail.com> wrote:

Vista and higher have inet_pton().

msc_util.h has this trick to void declaring inet_pton() when building for Win >= Vista:

int DSOLOCAL inet_pton(int family, const char *src, void *dst);

I understand that this resolved a declaration problem, but with Visual Studio 2012 64-bit on Win 2008 R2 I get this link-time error for multiply defined symbols:

CL -MD -I. -I..  -Ifoopath/stage/install\include -Ifoopath/stage/install  -Ifoopath/stage/install\include\libxml2  -Ifoopath/stage/install\include /nologo /O2 /LD /W3 /wd4244 /wd4018 -DWIN32 -DWINNT -Dinline=APR_INLINE -Dfooversion /Zi  -LD mod_security2.obj apache2_config.obj apache2_io.obj apache2_util.obj  re.obj re_operators.obj re_actions.obj re_tfns.obj re_variables.obj  msc_logging.obj msc_xml.obj msc_multipart.obj modsecurity.obj  msc_parsers.obj msc_util.obj msc_pcre.obj persist_dbm.obj  msc_reqbody.obj msc_geo.obj msc_gsb.obj msc_crypt.obj msc_tree.obj msc_unicode.obj acmp.obj msc_lua.obj  msc_release.obj libinjection\libinjection_sqli.obj -Femod_security2.so foopath/stage/install\lib\libhttpd.lib  foopath/stage/install\lib\libapr-1.lib  foopath/stage/install\lib\libaprutil-1.lib  foopath/stage/install\lib\pcre.lib  foopath/stage/install\lib\libxml2.lib  Ws2_32.lib /link
Ws2_32.lib(WS2_32.dll) : error LNK2005: inet_pton already defined in msc_util.obj
   Creating library mod_security2.lib and object mod_security2.exp
mod_security2.so : fatal error LNK1169: one or more multiply defined symbols found

I'm using this patch to hide the implementation in the same manner that the prototype is hidden:

--- mod_security.orig/apache2/msc_util.c        2013-07-27 21:58:50.000000000 -0600
+++ mod_security/apache2/msc_util.c     2013-11-25 16:40:09.599279200 -0700
@@ -835,7 +835,7 @@
     return ((char *)haystack);

-#ifdef WIN32
+#if defined(WIN32) && !(NTDDI_VERSION >= NTDDI_VISTA)
 int inet_pton(int family, const char *src, void *dst)   {
     struct addrinfo addr;
     struct sockaddr_in *in = NULL;

(Only tested with mod_security for Apache building for Vista with VS 2012)

Born in Roswell... married an alien...
Shape the Mobile Experience: Free Subscription
Software experts and developers: Be at the forefront of tech innovation.
Intel(R) Software Adrenaline delivers strategic insight and game-changing
conversations that shape the rapidly evolving mobile landscape. Sign up now.
mod-security-developers mailing list
ModSecurity Services from Trustwave's SpiderLabs:

This transmission may contain information that is privileged, confidential, and/or exempt from disclosure under applicable law. If you are not the intended recipient, you are hereby notified that any disclosure, copying, distribution, or use of the information contained herein (including any reliance thereon) is strictly prohibited. If you received this transmission in error, please immediately contact the sender and destroy the material in its entirety, whether in electronic or hard copy format.