[Snort-users] Snort183 -A unsock -- part deux

Dr. Richard W. Tibbs ccamp at ...4532...
Sun Mar 17 10:27:06 EST 2002


On this issue, I am now inclined to see how a complete snort source 
distrib compiles on Win2k.
I suspect there is some majic that the configure script (win version) 
performs to get the right defines and includes done for snprintf.
What I have tried up to this point is just adding the snprintf source 
(the sendmail version from snort) with my socket prog files, and 
evidently that is not enough, even with everything from the /snort/win32 
directories downloaded and added to my MS vis. studio project.  

The bottom line is that I can get snprintf to compile cleanly with no 
errors or warnings *ONLY* by defining __STDC__, at the expense of all 
other modules failing due to includes of snort.h.  Is snort not a 
"standard" C program under win32?  

I attached the config.h and snprintf.h and .c to this email.
Keep in mind config.h was not generated from a configure script, just 
came straight from the snort site via CVS.
Also: all other modules compile successfully, with perhaps a few 
warnings except for snprintf.c
The errors I am getting from the "most vanilla" situation (just 
commenting out #define HAVE_SNPRINTF) are here (but see my analysis below):
--------------------Configuration: snort - Win32 MSSQL 
Debug--------------------
Compiling...
snprintf.c
c:\cpp_project\oak_snortprj\snprintf.c(83) : error C2061: syntax error : 
identifier 'va_dcl'
c:\cpp_project\oak_snortprj\snprintf.c(112) : error C2065: 'u_char' : 
undeclared identifier
c:\cpp_project\oak_snortprj\snprintf.c(112) : error C2143: syntax error 
: missing ')' before 'constant'
c:\cpp_project\oak_snortprj\snprintf.c(189) : warning C4013: 'va_arg' 
undefined; assuming extern returning int
c:\cpp_project\oak_snortprj\snprintf.c(189) : error C2059: syntax error 
: 'type'
c:\cpp_project\oak_snortprj\snprintf.c(191) : error C2059: syntax error 
: 'type'
c:\cpp_project\oak_snortprj\snprintf.c(200) : error C2059: syntax error 
: 'type'
c:\cpp_project\oak_snortprj\snprintf.c(204) : error C2059: syntax error 
: 'type'
c:\cpp_project\oak_snortprj\snprintf.c(212) : error C2059: syntax error 
: 'type'
c:\cpp_project\oak_snortprj\snprintf.c(216) : error C2059: syntax error 
: 'type'
c:\cpp_project\oak_snortprj\snprintf.c(223) : error C2059: syntax error 
: 'type'
c:\cpp_project\oak_snortprj\snprintf.c(227) : error C2059: syntax error 
: 'type'
c:\cpp_project\oak_snortprj\snprintf.c(233) : error C2059: syntax error 
: 'type'
c:\cpp_project\oak_snortprj\snprintf.c(237) : error C2059: syntax error 
: 'type'
c:\cpp_project\oak_snortprj\snprintf.c(243) : error C2059: syntax error 
: 'type'
c:\cpp_project\oak_snortprj\snprintf.c(247) : error C2059: syntax error 
: 'type'
c:\cpp_project\oak_snortprj\snprintf.c(251) : error C2059: syntax error 
: 'type'
c:\cpp_project\oak_snortprj\snprintf.c(260) : error C2059: syntax error 
: 'type'
Error executing cl.exe.

snprintf.obj - 17 error(s), 1 warning(s)

My Analysis: If I look at the logic in the snprintf.h file, it looks for 
"not" HAVE_SNPRINTF
then for __STDC__ to include stdarg.h  This file has everything except 
va_dcl, which seems only to be defined in varargs.h  

The config.h from the win32 subdirectories does not define __STDC__, but 
if I insert a line to define it then the errors are merely:

--------------------Configuration: snort - Win32 MSSQL 
Debug--------------------
Compiling...
snprintf.c
C:\CPP_project\Oak_snortprj\snprintf.c(112) : error C2065: 'u_char' : 
undeclared identifier
C:\CPP_project\Oak_snortprj\snprintf.c(112) : error C2143: syntax error 
: missing ')' before 'constant'
Error executing cl.exe.

snprintf.obj - 2 error(s), 0 warning(s)

Now, upon a search through the MS vis studio include directory for text 
"u_char" I find only winsock.h and a few others reference and/or define it.

If I include
#include <winsock.h> at the very top of snprintf.h, I get a clean 
compile with no errors or warnings!!
So adding a define for __STDC__ and including winsock seems to solve the 
problem for snprintf.
BUT!!! all other modules fail to compile due to syntax errors in places 
like xdr.h gnuc.h etc when __STC__ is defined !!.  AAAaaaarrrrg!

My conclusion is that snort under win32 is not standard C?
I still have a dilemma here.

 >>>RWT

Fyodor wrote:

>Dr. Richard W. Tibbs <ccamp at ...4532...> spoke:
>
>>
>>Kind people:  Thanks for all the help up to this point.
>>I have a decent compile of the socket code now.
>>I am now having a problem with snprintf.
>>There seems to be no definition of the function on Win2K.
>>If I comment out the
>>#define HAVE_SNPRINTF = 1
>>
>
>
>>line in config.h,
>>then compiling snprintf.c results in all kinds of errors concerning some
>>kind of defines or typedefs named va_dcl, va_alist and such.
>>
>>Any ideas?
>>
>
>
>we ship an implementation of snprintf() which is based on the one
>shipped with sendmail. If your platform doesn't have snprintf() within
>libc configure should figure that out and enable it...
>
>as for building errors, guess there could be some portability problems,
>can we see the errors, maybe we could give you hints as what has to be
>changed...
>

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: snprintf.c
URL: <https://lists.snort.org/pipermail/snort-users/attachments/20020317/de197f1a/attachment.c>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: snprintf.h
URL: <https://lists.snort.org/pipermail/snort-users/attachments/20020317/de197f1a/attachment.h>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: config.h
URL: <https://lists.snort.org/pipermail/snort-users/attachments/20020317/de197f1a/attachment-0001.h>


More information about the Snort-users mailing list