add optionally libdjbdns

This commit is contained in:
whottgen 2004-10-14 09:07:22 +00:00
parent 8a16d6e8f9
commit d7322c983a
9 changed files with 279 additions and 58 deletions

View File

@ -33,6 +33,9 @@
/* Define to 1 if you have the <inttypes.h> header file. */ /* Define to 1 if you have the <inttypes.h> header file. */
#undef HAVE_INTTYPES_H #undef HAVE_INTTYPES_H
/* Define to 1 if you have the `djbdns' library (-ldjbdns). */
#undef HAVE_LIBDJBDNS
/* Define to 1 if you have the `dl' library (-ldl). */ /* Define to 1 if you have the `dl' library (-ldl). */
#undef HAVE_LIBDL #undef HAVE_LIBDL

168
smmapdfw/configure vendored
View File

@ -1041,6 +1041,8 @@ Optional Packages:
--without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)
--with-bdb-lib-dir Directory for Berkeley DB library files --with-bdb-lib-dir Directory for Berkeley DB library files
--with-bdb-inc-dir Directory for Berkeley include files --with-bdb-inc-dir Directory for Berkeley include files
--with-djbdns-lib-dir Directory for Bernstein's djbdns library files
--with-djbdns-inc-dir Directory for Bernstein's djbdns include files
--with-gnu-ld assume the C compiler uses GNU ld [default=no] --with-gnu-ld assume the C compiler uses GNU ld [default=no]
--with-pic try to use only PIC/non-PIC objects [default=use --with-pic try to use only PIC/non-PIC objects [default=use
both] both]
@ -1880,6 +1882,41 @@ echo "$as_me: error: Need bdb-inc-dir" >&2;}
fi; fi;
WITHOUT_DJBDNS=0
# Check whether --with-djbdns-lib-dir or --without-djbdns-lib-dir was given.
if test "${with_djbdns_lib_dir+set}" = set; then
withval="$with_djbdns_lib_dir"
case "$withval" in
no)
WITHOUT_DJBDNS=1
;;
yes)
;;
*)
LDFLAGS="$LDFLAGS -L$withval -R$withval"
;;
esac
fi;
# Check whether --with-djbdns-inc-dir or --without-djbdns-inc-dir was given.
if test "${with_djbdns_inc_dir+set}" = set; then
withval="$with_djbdns_inc_dir"
case "$withval" in
no)
WITHOUT_DJBDNS=1
;;
yes)
;;
*)
CPPFLAGS="$CPPFLAGS -I$withval"
;;
esac
fi;
ENABLE_VERIFY_CACHE=1 ENABLE_VERIFY_CACHE=1
@ -3412,7 +3449,7 @@ ia64-*-hpux*)
;; ;;
*-*-irix6*) *-*-irix6*)
# Find out which ABI we are using. # Find out which ABI we are using.
echo '#line 3415 "configure"' > conftest.$ac_ext echo '#line 3452 "configure"' > conftest.$ac_ext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>&5 (eval $ac_compile) 2>&5
ac_status=$? ac_status=$?
@ -4867,7 +4904,7 @@ fi
# Provide some information about the compiler. # Provide some information about the compiler.
echo "$as_me:4870:" \ echo "$as_me:4907:" \
"checking for Fortran 77 compiler version" >&5 "checking for Fortran 77 compiler version" >&5
ac_compiler=`set X $ac_compile; echo $2` ac_compiler=`set X $ac_compile; echo $2`
{ (eval echo "$as_me:$LINENO: \"$ac_compiler --version </dev/null >&5\"") >&5 { (eval echo "$as_me:$LINENO: \"$ac_compiler --version </dev/null >&5\"") >&5
@ -5899,11 +5936,11 @@ else
-e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'` -e 's:$: $lt_compiler_flag:'`
(eval echo "\"\$as_me:5902: $lt_compile\"" >&5) (eval echo "\"\$as_me:5939: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err) (eval "$lt_compile" 2>conftest.err)
ac_status=$? ac_status=$?
cat conftest.err >&5 cat conftest.err >&5
echo "$as_me:5906: \$? = $ac_status" >&5 echo "$as_me:5943: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized # The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings # So say no if there are warnings
@ -6132,11 +6169,11 @@ else
-e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'` -e 's:$: $lt_compiler_flag:'`
(eval echo "\"\$as_me:6135: $lt_compile\"" >&5) (eval echo "\"\$as_me:6172: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err) (eval "$lt_compile" 2>conftest.err)
ac_status=$? ac_status=$?
cat conftest.err >&5 cat conftest.err >&5
echo "$as_me:6139: \$? = $ac_status" >&5 echo "$as_me:6176: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized # The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings # So say no if there are warnings
@ -6192,11 +6229,11 @@ else
-e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'` -e 's:$: $lt_compiler_flag:'`
(eval echo "\"\$as_me:6195: $lt_compile\"" >&5) (eval echo "\"\$as_me:6232: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err) (eval "$lt_compile" 2>out/conftest.err)
ac_status=$? ac_status=$?
cat out/conftest.err >&5 cat out/conftest.err >&5
echo "$as_me:6199: \$? = $ac_status" >&5 echo "$as_me:6236: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext if (exit $ac_status) && test -s out/conftest2.$ac_objext
then then
# The compiler can only warn and ignore the option if not recognized # The compiler can only warn and ignore the option if not recognized
@ -8380,7 +8417,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<EOF cat > conftest.$ac_ext <<EOF
#line 8383 "configure" #line 8420 "configure"
#include "confdefs.h" #include "confdefs.h"
#if HAVE_DLFCN_H #if HAVE_DLFCN_H
@ -8478,7 +8515,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<EOF cat > conftest.$ac_ext <<EOF
#line 8481 "configure" #line 8518 "configure"
#include "confdefs.h" #include "confdefs.h"
#if HAVE_DLFCN_H #if HAVE_DLFCN_H
@ -10655,11 +10692,11 @@ else
-e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'` -e 's:$: $lt_compiler_flag:'`
(eval echo "\"\$as_me:10658: $lt_compile\"" >&5) (eval echo "\"\$as_me:10695: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err) (eval "$lt_compile" 2>conftest.err)
ac_status=$? ac_status=$?
cat conftest.err >&5 cat conftest.err >&5
echo "$as_me:10662: \$? = $ac_status" >&5 echo "$as_me:10699: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized # The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings # So say no if there are warnings
@ -10715,11 +10752,11 @@ else
-e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'` -e 's:$: $lt_compiler_flag:'`
(eval echo "\"\$as_me:10718: $lt_compile\"" >&5) (eval echo "\"\$as_me:10755: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err) (eval "$lt_compile" 2>out/conftest.err)
ac_status=$? ac_status=$?
cat out/conftest.err >&5 cat out/conftest.err >&5
echo "$as_me:10722: \$? = $ac_status" >&5 echo "$as_me:10759: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext if (exit $ac_status) && test -s out/conftest2.$ac_objext
then then
# The compiler can only warn and ignore the option if not recognized # The compiler can only warn and ignore the option if not recognized
@ -12084,7 +12121,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<EOF cat > conftest.$ac_ext <<EOF
#line 12087 "configure" #line 12124 "configure"
#include "confdefs.h" #include "confdefs.h"
#if HAVE_DLFCN_H #if HAVE_DLFCN_H
@ -12182,7 +12219,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<EOF cat > conftest.$ac_ext <<EOF
#line 12185 "configure" #line 12222 "configure"
#include "confdefs.h" #include "confdefs.h"
#if HAVE_DLFCN_H #if HAVE_DLFCN_H
@ -13009,11 +13046,11 @@ else
-e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'` -e 's:$: $lt_compiler_flag:'`
(eval echo "\"\$as_me:13012: $lt_compile\"" >&5) (eval echo "\"\$as_me:13049: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err) (eval "$lt_compile" 2>conftest.err)
ac_status=$? ac_status=$?
cat conftest.err >&5 cat conftest.err >&5
echo "$as_me:13016: \$? = $ac_status" >&5 echo "$as_me:13053: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized # The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings # So say no if there are warnings
@ -13069,11 +13106,11 @@ else
-e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'` -e 's:$: $lt_compiler_flag:'`
(eval echo "\"\$as_me:13072: $lt_compile\"" >&5) (eval echo "\"\$as_me:13109: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err) (eval "$lt_compile" 2>out/conftest.err)
ac_status=$? ac_status=$?
cat out/conftest.err >&5 cat out/conftest.err >&5
echo "$as_me:13076: \$? = $ac_status" >&5 echo "$as_me:13113: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext if (exit $ac_status) && test -s out/conftest2.$ac_objext
then then
# The compiler can only warn and ignore the option if not recognized # The compiler can only warn and ignore the option if not recognized
@ -15114,11 +15151,11 @@ else
-e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'` -e 's:$: $lt_compiler_flag:'`
(eval echo "\"\$as_me:15117: $lt_compile\"" >&5) (eval echo "\"\$as_me:15154: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err) (eval "$lt_compile" 2>conftest.err)
ac_status=$? ac_status=$?
cat conftest.err >&5 cat conftest.err >&5
echo "$as_me:15121: \$? = $ac_status" >&5 echo "$as_me:15158: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized # The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings # So say no if there are warnings
@ -15347,11 +15384,11 @@ else
-e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'` -e 's:$: $lt_compiler_flag:'`
(eval echo "\"\$as_me:15350: $lt_compile\"" >&5) (eval echo "\"\$as_me:15387: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err) (eval "$lt_compile" 2>conftest.err)
ac_status=$? ac_status=$?
cat conftest.err >&5 cat conftest.err >&5
echo "$as_me:15354: \$? = $ac_status" >&5 echo "$as_me:15391: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized # The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings # So say no if there are warnings
@ -15407,11 +15444,11 @@ else
-e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'` -e 's:$: $lt_compiler_flag:'`
(eval echo "\"\$as_me:15410: $lt_compile\"" >&5) (eval echo "\"\$as_me:15447: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err) (eval "$lt_compile" 2>out/conftest.err)
ac_status=$? ac_status=$?
cat out/conftest.err >&5 cat out/conftest.err >&5
echo "$as_me:15414: \$? = $ac_status" >&5 echo "$as_me:15451: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext if (exit $ac_status) && test -s out/conftest2.$ac_objext
then then
# The compiler can only warn and ignore the option if not recognized # The compiler can only warn and ignore the option if not recognized
@ -17595,7 +17632,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<EOF cat > conftest.$ac_ext <<EOF
#line 17598 "configure" #line 17635 "configure"
#include "confdefs.h" #include "confdefs.h"
#if HAVE_DLFCN_H #if HAVE_DLFCN_H
@ -17693,7 +17730,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<EOF cat > conftest.$ac_ext <<EOF
#line 17696 "configure" #line 17733 "configure"
#include "confdefs.h" #include "confdefs.h"
#if HAVE_DLFCN_H #if HAVE_DLFCN_H
@ -19101,6 +19138,81 @@ fi
fi fi
if test "x$WITHOUT_DJBDNS" = "x0"; then
echo "$as_me:$LINENO: checking for dns_transmit_start in -ldjbdns" >&5
echo $ECHO_N "checking for dns_transmit_start in -ldjbdns... $ECHO_C" >&6
if test "${ac_cv_lib_djbdns_dns_transmit_start+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
ac_check_lib_save_LIBS=$LIBS
LIBS="-ldjbdns $LIBS"
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
/* Override any gcc2 internal prototype to avoid an error. */
#ifdef __cplusplus
extern "C"
#endif
/* We use char because int might match the return type of a gcc2
builtin and then its argument prototype would still apply. */
char dns_transmit_start ();
int
main ()
{
dns_transmit_start ();
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext conftest$ac_exeext
if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
(eval $ac_link) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest$ac_exeext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
ac_cv_lib_djbdns_dns_transmit_start=yes
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ac_cv_lib_djbdns_dns_transmit_start=no
fi
rm -f conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
echo "$as_me:$LINENO: result: $ac_cv_lib_djbdns_dns_transmit_start" >&5
echo "${ECHO_T}$ac_cv_lib_djbdns_dns_transmit_start" >&6
if test $ac_cv_lib_djbdns_dns_transmit_start = yes; then
cat >>confdefs.h <<_ACEOF
#define HAVE_LIBDJBDNS 1
_ACEOF
LIBS="-ldjbdns $LIBS"
fi
fi
echo "$as_me:$LINENO: checking for inet_aton in -lresolv" >&5 echo "$as_me:$LINENO: checking for inet_aton in -lresolv" >&5

View File

@ -44,6 +44,37 @@ AC_ARG_WITH(bdb-inc-dir,
esac ] esac ]
) )
WITHOUT_DJBDNS=0
AC_ARG_WITH(djbdns-lib-dir,
[AC_HELP_STRING(--with-djbdns-lib-dir, [
Directory for Bernstein's djbdns library files])],
[ case "$withval" in
no)
WITHOUT_DJBDNS=1
;;
yes)
;;
*)
LDFLAGS="$LDFLAGS -L$withval -R$withval"
;;
esac ]
)
AC_ARG_WITH(djbdns-inc-dir,
[AC_HELP_STRING(--with-djbdns-inc-dir, [
Directory for Bernstein's djbdns include files])],
[ case "$withval" in
no)
WITHOUT_DJBDNS=1
;;
yes)
;;
*)
CPPFLAGS="$CPPFLAGS -I$withval"
;;
esac ]
)
ENABLE_VERIFY_CACHE=1 ENABLE_VERIFY_CACHE=1
dnl AC_ARG_ENABLE(verify-cache, dnl AC_ARG_ENABLE(verify-cache,
@ -100,6 +131,9 @@ AC_CHECK_LIB(pthread, pthread_create,
) )
) )
if test "x$WITHOUT_DJBDNS" = "x0"; then
AC_CHECK_LIB([djbdns], [dns_transmit_start])
fi
AC_CHECK_LIB([resolv], [inet_aton]) AC_CHECK_LIB([resolv], [inet_aton])
AC_CHECK_LIB([socket], [connect]) AC_CHECK_LIB([socket], [connect])

View File

@ -26,7 +26,7 @@
#include "smmapd.h" #include "smmapd.h"
#include "smtp.h" #include "smtp.h"
#include "dns.h" #include "htdns.h"
#define SMM_LOCAL_PERM_NOK 101 #define SMM_LOCAL_PERM_NOK 101
#define SMM_LOCAL_TEMP_NOK 102 #define SMM_LOCAL_TEMP_NOK 102

View File

@ -1,5 +1,5 @@
include_HEADERS=containers_public.h queue.h smtp.h cfg.h count.h safe_write.h sunos_comp.h dns.h smmapd.h include_HEADERS=containers_public.h queue.h smtp.h cfg.h count.h safe_write.h sunos_comp.h htdns.h smmapd.h
lib_LTLIBRARIES = libsmmapdfw.la lib_LTLIBRARIES = libsmmapdfw.la
libsmmapdfw_la_SOURCES = cfg.c queue.c count.c safe_write.c config_public.c dns.c smtp.c libsmmapdfw_la_SOURCES = cfg.c queue.c count.c safe_write.c config_public.c htdns.c smtp.c

View File

@ -87,9 +87,9 @@ RC = @RC@
STRIP = @STRIP@ STRIP = @STRIP@
VERSION = @VERSION@ VERSION = @VERSION@
include_HEADERS = containers_public.h queue.h smtp.h cfg.h count.h safe_write.h sunos_comp.h dns.h smmapd.h include_HEADERS = containers_public.h queue.h smtp.h cfg.h count.h safe_write.h sunos_comp.h htdns.h smmapd.h
lib_LTLIBRARIES = libsmmapdfw.la lib_LTLIBRARIES = libsmmapdfw.la
libsmmapdfw_la_SOURCES = cfg.c queue.c count.c safe_write.c config_public.c dns.c smtp.c libsmmapdfw_la_SOURCES = cfg.c queue.c count.c safe_write.c config_public.c htdns.c smtp.c
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_HEADER = ../config.h CONFIG_HEADER = ../config.h
CONFIG_CLEAN_FILES = CONFIG_CLEAN_FILES =
@ -103,7 +103,7 @@ LIBS = @LIBS@
libsmmapdfw_la_LDFLAGS = libsmmapdfw_la_LDFLAGS =
libsmmapdfw_la_LIBADD = libsmmapdfw_la_LIBADD =
libsmmapdfw_la_OBJECTS = cfg.lo queue.lo count.lo safe_write.lo \ libsmmapdfw_la_OBJECTS = cfg.lo queue.lo count.lo safe_write.lo \
config_public.lo dns.lo smtp.lo config_public.lo htdns.lo smtp.lo
CFLAGS = @CFLAGS@ CFLAGS = @CFLAGS@
COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
@ -118,8 +118,8 @@ DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
TAR = tar TAR = tar
GZIP_ENV = --best GZIP_ENV = --best
DEP_FILES = .deps/cfg.P .deps/config_public.P .deps/count.P .deps/dns.P \ DEP_FILES = .deps/cfg.P .deps/config_public.P .deps/count.P \
.deps/queue.P .deps/safe_write.P .deps/smtp.P .deps/htdns.P .deps/queue.P .deps/safe_write.P .deps/smtp.P
SOURCES = $(libsmmapdfw_la_SOURCES) SOURCES = $(libsmmapdfw_la_SOURCES)
OBJECTS = $(libsmmapdfw_la_OBJECTS) OBJECTS = $(libsmmapdfw_la_OBJECTS)

View File

@ -23,7 +23,6 @@
#include <sys/types.h> #include <sys/types.h>
#include <netinet/in.h> #include <netinet/in.h>
#include <arpa/nameser.h> #include <arpa/nameser.h>
#include <resolv.h>
#include <stdlib.h> #include <stdlib.h>
#include <syslog.h> #include <syslog.h>
#include <stdio.h> #include <stdio.h>
@ -32,10 +31,18 @@
#include <errno.h> #include <errno.h>
#include <assert.h> #include <assert.h>
#include "dns.h" #if HAVE_LIBDJBDNS
#include <dns.h>
#else
#include <resolv.h>
#endif
#include "htdns.h"
#if ! HAVE_LIBDJBDNS
extern int h_errno; extern int h_errno;
/* extern struct state _res; */ /* extern struct state _res; */
#endif
union answer_u { union answer_u {
HEADER hdr; HEADER hdr;
@ -183,54 +190,119 @@ void free_rrs(void **resp) {
static void** get_rrs(char *domain, int qtype) { static void** get_rrs(char *domain, int qtype) {
unsigned int res, i, cnt, len, offset, x, y, rdlength; unsigned int res, i, cnt, len, offset, x, y, rdlength;
answer_t answer; answer_t *answer;
unsigned int class, type, ttl; unsigned int class, type, ttl;
char *name; char *name;
void **rdata, **rdata2; void **rdata, **rdata2;
#if HAVE_LIBDJBDNS
struct dns_transmit dt = {0};
#endif
syslog(LOG_DEBUG, "get_rrs: looking up domain %s, qtype %d", domain, qtype); syslog(LOG_DEBUG, "get_rrs: looking up domain %s, qtype %d", domain, qtype);
res = res_search(domain, C_IN, qtype, (u_char*) &answer, sizeof(answer_t));
if (-1 == res) {
syslog(LOG_ERR, "get_rrs: error in res_search: h_errno=%d, errno=%d, (%s)",
h_errno, errno, strerror(errno));
return NULL;
}
#if HAVE_LIBDJBDNS
{
char s[64];
int flagrecursive = 0;
char *q = NULL;
char t[2];
char localip[4] = "\0\0\0\0";
iopause_fd x[1];
struct taia deadline;
struct taia stamp;
t[0] = '\0';
t[1] = type;
if (dns_resolvconfip(s) == -1) {
syslog(LOG_ERR, "failure in dns_resolvconfip: %d, %s\n",
errno, strerror(errno));
return NULL;
}
dns_domain_fromdot(&q, domain, strlen(domain));
if (dns_transmit_start(&dt, s, flagrecursive, q, t, localip) == -1) {
syslog(LOG_ERR, "failure in dns_transmit_start: %d, %s\n",
errno, strerror(errno));
return NULL;
}
for (;;) {
int r;
taia_now(&stamp);
taia_uint(&deadline,120);
taia_add(&deadline, &deadline, &stamp);
dns_transmit_io(&dt, x, &deadline);
iopause(x, 1, &deadline, &stamp);
r = dns_transmit_get(&dt, x, &stamp);
if (-1 == r) {
syslog(LOG_ERR, "failure in dns_transmit_get: %d, %s\n",
errno, strerror(errno));
dns_transmit_free(&dt);
return NULL;
}
if (1 == r)
break;
}
answer = (answer_t*) dt.packet;
}
#else
{
answer_t lanswer;
res = res_search(domain, C_IN, qtype, (u_char*) &lanswer, sizeof(answer_t));
if (-1 == res) {
syslog(LOG_ERR, "get_rrs: error in res_search: h_errno=%d, errno=%d, (%s)",
h_errno, errno, strerror(errno));
return NULL;
}
answer = &lanswer;
}
#endif
cnt = sizeof(HEADER); cnt = sizeof(HEADER);
/* query section */ /* query section */
for (y = 0; y < ntohs(answer.hdr.qdcount); y++) { for (y = 0; y < ntohs(answer->hdr.qdcount); y++) {
cnt = get_domain_name(&answer, cnt, NULL); cnt = get_domain_name(answer, cnt, NULL);
type = get16(answer.buf, cnt); type = get16(answer->buf, cnt);
cnt += 2; cnt += 2;
class = get16(answer.buf, cnt); class = get16(answer->buf, cnt);
cnt += 2; cnt += 2;
} }
/* answer section */ /* answer section */
rdata = (void**)malloc(sizeof(void*) * (ntohs(answer.hdr.ancount)+1)); rdata = (void**)malloc(sizeof(void*) * (ntohs(answer->hdr.ancount)+1));
for (y = 0; y < ntohs(answer.hdr.ancount); y++) { for (y = 0; y < ntohs(answer->hdr.ancount); y++) {
cnt = get_domain_name(&answer, cnt, NULL); cnt = get_domain_name(answer, cnt, NULL);
type = get16(answer.buf, cnt); type = get16(answer->buf, cnt);
syslog(LOG_DEBUG, "get_rrs: answer type %d", type); syslog(LOG_DEBUG, "get_rrs: answer type %d", type);
/* assert(type==qtype); */ /* assert(type==qtype); */
cnt += 2; cnt += 2;
class = get16(answer.buf, cnt); class = get16(answer->buf, cnt);
cnt += 2; cnt += 2;
ttl = get32(answer.buf, cnt); ttl = get32(answer->buf, cnt);
cnt += 4; cnt += 4;
rdlength = get16(answer.buf, cnt); rdlength = get16(answer->buf, cnt);
cnt += 2; cnt += 2;
rdata2 = rdata+y; rdata2 = rdata+y;
get_rdata(&answer, type, cnt, rdlength, rdata2); get_rdata(answer, type, cnt, rdlength, rdata2);
cnt += rdlength; cnt += rdlength;
} }
rdata2 = rdata+y; rdata2 = rdata+y;
*((void**)rdata2) = NULL; *((void**)rdata2) = NULL;
#if HAVE_LIBDJBDNS
dns_transmit_free(&dt);
#endif
return rdata; return rdata;
} }

View File

@ -43,7 +43,7 @@
#include "containers_public.h" #include "containers_public.h"
#include "smmapd.h" #include "smmapd.h"
#include "dns.h" #include "htdns.h"
#include "queue.h" #include "queue.h"
#include "smtp.h" #include "smtp.h"