small tcp_wrappers issue (argus-3.0.0.rc.10)

Andreas Östling andreaso at it.su.se
Sun Jun 25 17:56:18 EDT 2006


On Thu, 22 Jun 2006, Carter Bullard wrote:

> Hey Andreas,
> I've included a patch for argus's ./aclocal.m4.  If you could
> apply the patch and then:
...

Thanks, it almost worked. The configure script will now correctly detect 
tcp wrappers but then the real linking fails instead:

gcc -O3 -I. -I/usr/include  -I./../include  -DPACKAGE_NAME=\"\" 
-DPACKAGE_TARNAME=\"\"
-DPACKAGE_VERSION=\"\" -DPACKAGE_STRING=\"\" -DPACKAGE_BUGREPORT=\"\" 
-DHAVE_STRERROR=1 -DHAVE_STRLCPY=1
-DHAVE_VSNPRINTF=1 -DHAVE_SNPRINTF=1 -DHAVE_ETHER_HOSTTON=1 
-DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1
-DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 
-DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1
-DHAVE_INTTYPES_H=1 -DHAVE_UNISTD_H=1 -DHAVE_STRUCT_ETHER_ADDR=1 
-DHAVE_DECL_ETHER_HOSTTON=0
-DHAVE_SYS_SOCKIO_H=1 -DHAVE_STRING_H=1 -DHAVE_FCNTL_H=1 
-DHAVE_SYS_FILE_H=1 -DHAVE_SYSLOG_H=1
-DCONFIG_X86_BSWAP=1 -DSTDC_HEADERS=1  -o ../bin/argus argus.o 
ArgusModeler.o ArgusSource.o ArgusUtil.o
ArgusOutput.o ArgusUdp.o ArgusTcp.o ArgusIcmp.o ArgusIgmp.o ArgusEsp.o 
ArgusArp.o ArgusFrag.o ArgusApp.o
-lwrap   -lpcap  ../lib/argus_common.a -lm
argus.o(.text+0xcfd): In function `main':
: warning: strcpy() is almost always misused, please use strlcpy()
/usr/lib/libwrap.so.4.0: undefined reference to `allow_severity'
/usr/lib/libwrap.so.4.0: undefined reference to `deny_severity'
collect2: ld returned 1 exit status
gmake[1]: *** [../bin/argus] Error 1

It turns out the configure script fails to add -DHAVE_TCP_WRAPPER 
because $1=$libwrap was removed by your patch. Also, $libwrap is set to 
"FAIL" by default and then never updated when the check succeeds. I 
guess AC_CHECK_LIB took care of that before but now we have do it 
ourselves.

I'm not sure how you prefer to fix this but here is a suggested
updated patch. The only difference is that I added libwrap="-lwrap" and 
$1=$libwrap. Tested on OpenBSD and Linux with success, and overriding 
with a local tcp_wrappers directory still works.

--- aclocal.m4.orig     Wed Jun 14 02:26:13 2006
+++ aclocal.m4  Sun Jun 25 21:07:23 2006
@@ -695,16 +695,35 @@
      if test $libwrap = FAIL ; then
         AC_MSG_RESULT(not found)
         AC_MSG_CHECKING(for system tcp_wrappers library)
-       AC_CHECK_LIB(wrap, main, libwrap="-lwrap")
-       if test $libwrap = FAIL ; then
-          AC_MSG_WARN(tcp_wrapper not found)
-       else
-          $1=$libwrap
-          LIBS="$libwrap $LIBS"
-          if test -r /usr/local/include/tcpd.h; then
-          $2="-I/usr/local/include $$2"
+dnl    AC_CHECK_LIB(wrap, main, libwrap="-lwrap")
+dnl    if test $libwrap = FAIL ; then
+          AC_CACHE_VAL(ac_cv_qosient_wrapper,
+             [ac_save_LIBS="$LIBS"
+             LIBS="-lwrap $LIBS"
+             AC_TRY_COMPILE(
+                [int deny_severity = 0, allow_severity = 0;],
+                ,
+                ac_cv_qosient_wrapper=yes,
+                ac_cv_qosient_wrapper=no)
+             LIBS="$ac_save_LIBS"])
+          AC_MSG_RESULT($ac_cv_qosient_wrapper)
+          if test $ac_cv_qosient_wrapper = no ; then
+             AC_MSG_WARN(tcp_wrapper not found)
+          else
+             libwrap="-lwrap"
+             $1=$libwrap
+             LIBS="$libwrap $LIBS"
+             if test -r /usr/local/include/tcpd.h; then
+             $2="-I/usr/local/include $$2"
+             fi
            fi
-       fi
+dnl    else
+dnl       $1=$libwrap
+dnl       LIBS="$libwrap $LIBS"
+dnl       if test -r /usr/local/include/tcpd.h; then
+dnl       $2="-I/usr/local/include $$2"
+dnl       fi
+dnl    fi
      else
         $1=$libwrap
         if test -r $d/tcpd.h; then

/Andreas




More information about the argus mailing list