;; IPv6 patch for cyrus-imapd-2.1.16 ;; Nov 21, 2003 by Hajimu UMEMOTO ;; ;; This patch should work under Linux, too. ;; Thanks to Jochen Friedrich ;; Index: acconfig.h =================================================================== RCS file: /usr/home/ume/ncvs/src/cyrus-imapd2/acconfig.h,v retrieving revision 1.1.1.9 retrieving revision 1.10 diff -u -r1.1.1.9 -r1.10 --- acconfig.h 18 Aug 2003 17:43:37 -0000 1.1.1.9 +++ acconfig.h 18 Aug 2003 18:36:22 -0000 1.10 @@ -163,6 +163,15 @@ #undef HAVE_GETADDRINFO #undef HAVE_GETNAMEINFO +/* define if your system has struct sockaddr_storage */ +#undef HAVE_STRUCT_SOCKADDR_STORAGE + +/* Define if you have ss_family in struct sockaddr_storage. */ +#undef HAVE_SS_FAMILY + +/* Define if you have sa_len in struct sockaddr. */ +#undef HAVE_SOCKADDR_SA_LEN + @BOTTOM@ /* This allows us to work even when we don't have an fdatasync */ @@ -190,7 +199,7 @@ #endif #ifndef HAVE_SOCKLEN_T -typedef int socklen_t; +typedef unsigned int socklen_t; #endif #ifndef HAVE_RLIM_T @@ -210,6 +219,28 @@ #include #include #include +#include + +#ifndef HAVE_STRUCT_SOCKADDR_STORAGE +#define _SS_MAXSIZE 128 /* Implementation specific max size */ +#define _SS_PADSIZE (_SS_MAXSIZE - sizeof (struct sockaddr)) + +struct sockaddr_storage { + struct sockaddr ss_sa; + char __ss_pad2[_SS_PADSIZE]; +}; +# define ss_family ss_sa.sa_family +# define HAVE_SS_FAMILY +#endif /* !HAVE_STRUCT_SOCKADDR_STORAGE */ + +#ifndef HAVE_SS_FAMILY +#define ss_family __ss_family +#endif + +#ifndef AF_INET6 +/* Define it to something that should never appear */ +#define AF_INET6 AF_MAX +#endif #ifndef HAVE_GETADDRINFO #define getaddrinfo sasl_getaddrinfo Index: aclocal.m4 =================================================================== RCS file: /usr/home/ume/ncvs/src/cyrus-imapd2/aclocal.m4,v retrieving revision 1.1.1.12 retrieving revision 1.12 diff -u -r1.1.1.12 -r1.12 Index: config.h.in =================================================================== RCS file: /usr/home/ume/ncvs/src/cyrus-imapd2/config.h.in,v retrieving revision 1.1.1.11 retrieving revision 1.12 diff -u -r1.1.1.11 -r1.12 --- config.h.in 20 Nov 2003 17:14:17 -0000 1.1.1.11 +++ config.h.in 20 Nov 2003 17:26:11 -0000 1.12 @@ -159,6 +159,15 @@ #undef HAVE_GETADDRINFO #undef HAVE_GETNAMEINFO +/* define if your system has struct sockaddr_storage */ +#undef HAVE_STRUCT_SOCKADDR_STORAGE + +/* Define if you have ss_family in struct sockaddr_storage. */ +#undef HAVE_SS_FAMILY + +/* Define if you have sa_len in struct sockaddr. */ +#undef HAVE_SOCKADDR_SA_LEN + /* Define if you have the daemon function. */ #undef HAVE_DAEMON @@ -293,7 +302,7 @@ #endif #ifndef HAVE_SOCKLEN_T -typedef int socklen_t; +typedef unsigned int socklen_t; #endif #ifndef HAVE_RLIM_T @@ -313,15 +322,27 @@ #include #include #include +#include -#ifndef HAVE_GETADDRINFO -#define getaddrinfo sasl_getaddrinfo -#define freeaddrinfo sasl_freeaddrinfo -#define gai_strerror sasl_gai_strerror -#endif - -#ifndef HAVE_GETNAMEINFO -#define getnameinfo sasl_getnameinfo +#ifndef HAVE_STRUCT_SOCKADDR_STORAGE +#define _SS_MAXSIZE 128 /* Implementation specific max size */ +#define _SS_PADSIZE (_SS_MAXSIZE - sizeof (struct sockaddr)) + +struct sockaddr_storage { + struct sockaddr ss_sa; + char __ss_pad2[_SS_PADSIZE]; +}; +# define ss_family ss_sa.sa_family +# define HAVE_SS_FAMILY +#endif /* !HAVE_STRUCT_SOCKADDR_STORAGE */ + +#ifndef HAVE_SS_FAMILY +#define ss_family __ss_family +#endif + +#ifndef AF_INET6 +/* Define it to something that should never appear */ +#define AF_INET6 AF_MAX #endif #if !defined(HAVE_GETADDRINFO) || !defined(HAVE_GETNAMEINFO) Index: configure =================================================================== RCS file: /usr/home/ume/ncvs/src/cyrus-imapd2/configure,v retrieving revision 1.1.1.14 retrieving revision 1.15 diff -u -r1.1.1.14 -r1.15 --- configure 20 Nov 2003 17:14:18 -0000 1.1.1.14 +++ configure 20 Nov 2003 17:26:11 -0000 1.15 @@ -119,6 +119,7 @@ program_transform_name=s,x,x, silent= site= +sitefile= srcdir= target=NONE verbose= @@ -233,6 +234,7 @@ --help print this message --no-create do not create output files --quiet, --silent do not print \`checking...' messages + --site-file=FILE use FILE as the site file --version print the version of autoconf that created configure Directory and file names: --prefix=PREFIX install architecture-independent files in PREFIX @@ -403,6 +405,11 @@ -site=* | --site=* | --sit=*) site="$ac_optarg" ;; + -site-file | --site-file | --site-fil | --site-fi | --site-f) + ac_prev=sitefile ;; + -site-file=* | --site-file=* | --site-fil=* | --site-fi=* | --site-f=*) + sitefile="$ac_optarg" ;; + -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) ac_prev=srcdir ;; -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) @@ -568,12 +575,16 @@ srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'` # Prefer explicitly selected file to automatically selected ones. -if test -z "$CONFIG_SITE"; then - if test "x$prefix" != xNONE; then - CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" - else - CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" +if test -z "$sitefile"; then + if test -z "$CONFIG_SITE"; then + if test "x$prefix" != xNONE; then + CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" + else + CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" + fi fi +else + CONFIG_SITE="$sitefile" fi for ac_site_file in $CONFIG_SITE; do if test -r "$ac_site_file"; then @@ -639,7 +650,7 @@ fi echo $ac_n "checking host system type""... $ac_c" 1>&6 -echo "configure:643: checking host system type" >&5 +echo "configure:654: checking host system type" >&5 host_alias=$host case "$host_alias" in @@ -673,7 +684,7 @@ # Extract the first word of "makedepend", so it can be a program name with args. set dummy makedepend; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:677: checking for $ac_word" >&5 +echo "configure:688: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_MAKEDEPEND'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -763,7 +774,7 @@ # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:767: checking for $ac_word" >&5 +echo "configure:778: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -793,7 +804,7 @@ # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:797: checking for $ac_word" >&5 +echo "configure:808: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -844,7 +855,7 @@ # Extract the first word of "cl", so it can be a program name with args. set dummy cl; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:848: checking for $ac_word" >&5 +echo "configure:859: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -876,7 +887,7 @@ fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 -echo "configure:880: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 +echo "configure:891: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 ac_ext=c # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. @@ -887,12 +898,12 @@ cat > conftest.$ac_ext << EOF -#line 891 "configure" +#line 902 "configure" #include "confdefs.h" main(){return(0);} EOF -if { (eval echo configure:896: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:907: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then ac_cv_prog_cc_works=yes # If we can't run a trivial program, we are probably using a cross compiler. if (./conftest; exit) 2>/dev/null; then @@ -918,12 +929,12 @@ { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; } fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 -echo "configure:922: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 +echo "configure:933: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6 cross_compiling=$ac_cv_prog_cc_cross echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 -echo "configure:927: checking whether we are using GNU C" >&5 +echo "configure:938: checking whether we are using GNU C" >&5 if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -932,7 +943,7 @@ yes; #endif EOF -if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:936: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then +if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:947: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then ac_cv_prog_gcc=yes else ac_cv_prog_gcc=no @@ -951,7 +962,7 @@ ac_save_CFLAGS="$CFLAGS" CFLAGS= echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 -echo "configure:955: checking whether ${CC-cc} accepts -g" >&5 +echo "configure:966: checking whether ${CC-cc} accepts -g" >&5 if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -985,7 +996,7 @@ # Extract the first word of "ranlib", so it can be a program name with args. set dummy ranlib; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:989: checking for $ac_word" >&5 +echo "configure:1000: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1013,7 +1024,7 @@ fi echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6 -echo "configure:1017: checking whether ${MAKE-make} sets \${MAKE}" >&5 +echo "configure:1028: checking whether ${MAKE-make} sets \${MAKE}" >&5 set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1051,7 +1062,7 @@ # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # ./install, which can be erroneously created by make from ./install.sh. echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6 -echo "configure:1055: checking for a BSD compatible install" >&5 +echo "configure:1066: checking for a BSD compatible install" >&5 if test -z "$INSTALL"; then if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1104,7 +1115,7 @@ test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6 -echo "configure:1108: checking how to run the C preprocessor" >&5 +echo "configure:1119: checking how to run the C preprocessor" >&5 # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= @@ -1119,13 +1130,13 @@ # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1129: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1140: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : @@ -1136,13 +1147,13 @@ rm -rf conftest* CPP="${CC-cc} -E -traditional-cpp" cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1146: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1157: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : @@ -1153,13 +1164,13 @@ rm -rf conftest* CPP="${CC-cc} -nologo -E" cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1163: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1174: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : @@ -1184,9 +1195,9 @@ echo "$ac_t""$CPP" 1>&6 echo $ac_n "checking for AIX""... $ac_c" 1>&6 -echo "configure:1188: checking for AIX" >&5 +echo "configure:1199: checking for AIX" >&5 cat > conftest.$ac_ext <&6 -echo "configure:1213: checking for strerror in -lcposix" >&5 +echo "configure:1224: checking for strerror in -lcposix" >&5 ac_lib_var=`echo cposix'_'strerror | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1217,7 +1228,7 @@ ac_save_LIBS="$LIBS" LIBS="-lcposix $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1243: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -1255,7 +1266,7 @@ # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1259: checking for $ac_word" >&5 +echo "configure:1270: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_AWK'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1285,12 +1296,12 @@ done echo $ac_n "checking for working const""... $ac_c" 1>&6 -echo "configure:1289: checking for working const" >&5 +echo "configure:1300: checking for working const" >&5 if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1354: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_c_const=yes else @@ -1360,7 +1371,7 @@ fi echo $ac_n "checking for long file names""... $ac_c" 1>&6 -echo "configure:1364: checking for long file names" >&5 +echo "configure:1375: checking for long file names" >&5 if eval "test \"`echo '$''{'ac_cv_sys_long_file_names'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1409,13 +1420,13 @@ echo $ac_n "checking for __attribute__""... $ac_c" 1>&6 -echo "configure:1413: checking for __attribute__" >&5 +echo "configure:1424: checking for __attribute__" >&5 if eval "test \"`echo '$''{'ac_cv___attribute__'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < @@ -1432,7 +1443,7 @@ ; return 0; } EOF -if { (eval echo configure:1436: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1447: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv___attribute__=yes else @@ -1454,7 +1465,7 @@ echo $ac_n "checking if compiler supports -fPIC""... $ac_c" 1>&6 -echo "configure:1458: checking if compiler supports -fPIC" >&5 +echo "configure:1469: checking if compiler supports -fPIC" >&5 if eval "test \"`echo '$''{'ac_cv_fpic'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1462,7 +1473,7 @@ save_CFLAGS=$CFLAGS CFLAGS="${CFLAGS} -fPIC" cat > conftest.$ac_ext < @@ -1477,7 +1488,7 @@ ; return 0; } EOF -if { (eval echo configure:1481: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1492: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_fpic=yes else @@ -1502,7 +1513,7 @@ # CMU GUESS RUNPATH SWITCH echo $ac_n "checking for runpath switch""... $ac_c" 1>&6 -echo "configure:1506: checking for runpath switch" >&5 +echo "configure:1517: checking for runpath switch" >&5 if eval "test \"`echo '$''{'andrew_runpath_switch'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1511,14 +1522,14 @@ SAVE_LDFLAGS="${LDFLAGS}" LDFLAGS="-R /usr/lib" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1533: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* andrew_runpath_switch="-R" else @@ -1528,14 +1539,14 @@ LDFLAGS="-Wl,-rpath,/usr/lib" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1550: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* andrew_runpath_switch="-Wl,-rpath," else @@ -1576,17 +1587,17 @@ do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:1580: checking for $ac_hdr" >&5 +echo "configure:1591: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1590: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1601: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -1615,12 +1626,12 @@ for ac_func in memmove strcasecmp ftruncate strerror do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:1619: checking for $ac_func" >&5 +echo "configure:1630: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1658: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -1672,12 +1683,12 @@ for ac_func in strlcat strlcpy do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:1676: checking for $ac_func" >&5 +echo "configure:1687: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1715: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -1729,12 +1740,12 @@ do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr that defines DIR""... $ac_c" 1>&6 -echo "configure:1733: checking for $ac_hdr that defines DIR" >&5 +echo "configure:1744: checking for $ac_hdr that defines DIR" >&5 if eval "test \"`echo '$''{'ac_cv_header_dirent_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include <$ac_hdr> @@ -1742,7 +1753,7 @@ DIR *dirp = 0; ; return 0; } EOF -if { (eval echo configure:1746: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1757: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* eval "ac_cv_header_dirent_$ac_safe=yes" else @@ -1767,7 +1778,7 @@ # Two versions of opendir et al. are in -ldir and -lx on SCO Xenix. if test $ac_header_dirent = dirent.h; then echo $ac_n "checking for opendir in -ldir""... $ac_c" 1>&6 -echo "configure:1771: checking for opendir in -ldir" >&5 +echo "configure:1782: checking for opendir in -ldir" >&5 ac_lib_var=`echo dir'_'opendir | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1775,7 +1786,7 @@ ac_save_LIBS="$LIBS" LIBS="-ldir $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1801: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -1808,7 +1819,7 @@ else echo $ac_n "checking for opendir in -lx""... $ac_c" 1>&6 -echo "configure:1812: checking for opendir in -lx" >&5 +echo "configure:1823: checking for opendir in -lx" >&5 ac_lib_var=`echo x'_'opendir | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1816,7 +1827,7 @@ ac_save_LIBS="$LIBS" LIBS="-lx $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1842: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -1854,12 +1865,12 @@ save_LIBS="$LIBS" LIB_SOCKET="" echo $ac_n "checking for connect""... $ac_c" 1>&6 -echo "configure:1858: checking for connect" >&5 +echo "configure:1869: checking for connect" >&5 if eval "test \"`echo '$''{'ac_cv_func_connect'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1897: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_connect=yes" else @@ -1900,7 +1911,7 @@ else echo "$ac_t""no" 1>&6 echo $ac_n "checking for gethostbyname in -lnsl""... $ac_c" 1>&6 -echo "configure:1904: checking for gethostbyname in -lnsl" >&5 +echo "configure:1915: checking for gethostbyname in -lnsl" >&5 ac_lib_var=`echo nsl'_'gethostbyname | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1908,7 +1919,7 @@ ac_save_LIBS="$LIBS" LIBS="-lnsl $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1934: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -1940,7 +1951,7 @@ fi echo $ac_n "checking for connect in -lsocket""... $ac_c" 1>&6 -echo "configure:1944: checking for connect in -lsocket" >&5 +echo "configure:1955: checking for connect in -lsocket" >&5 ac_lib_var=`echo socket'_'connect | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1948,7 +1959,7 @@ ac_save_LIBS="$LIBS" LIBS="-lsocket $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1974: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -1984,12 +1995,12 @@ LIBS="$LIB_SOCKET $save_LIBS" echo $ac_n "checking for res_search""... $ac_c" 1>&6 -echo "configure:1988: checking for res_search" >&5 +echo "configure:1999: checking for res_search" >&5 if eval "test \"`echo '$''{'ac_cv_func_res_search'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2027: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_res_search=yes" else @@ -2030,7 +2041,7 @@ else echo "$ac_t""no" 1>&6 echo $ac_n "checking for res_search in -lresolv""... $ac_c" 1>&6 -echo "configure:2034: checking for res_search in -lresolv" >&5 +echo "configure:2045: checking for res_search in -lresolv" >&5 ac_lib_var=`echo resolv'_'res_search | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -2038,7 +2049,7 @@ ac_save_LIBS="$LIBS" LIBS="-lresolv $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2064: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -2076,12 +2087,12 @@ for ac_func in dn_expand dns_lookup do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:2080: checking for $ac_func" >&5 +echo "configure:2091: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2119: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -2133,15 +2144,15 @@ LIBS="$LIBS ${LIB_SOCKET}" -cyrus_cv_getaddrinfo=yes +cyrus_cv_getaddrinfo=no echo $ac_n "checking for getaddrinfo""... $ac_c" 1>&6 -echo "configure:2140: checking for getaddrinfo" >&5 +echo "configure:2151: checking for getaddrinfo" >&5 if eval "test \"`echo '$''{'ac_cv_func_getaddrinfo'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2179: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_getaddrinfo=yes" else @@ -2184,7 +2195,7 @@ else echo "$ac_t""no" 1>&6 echo $ac_n "checking for getaddrinfo in -lsocket""... $ac_c" 1>&6 -echo "configure:2188: checking for getaddrinfo in -lsocket" >&5 +echo "configure:2199: checking for getaddrinfo in -lsocket" >&5 ac_lib_var=`echo socket'_'getaddrinfo | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -2192,7 +2203,7 @@ ac_save_LIBS="$LIBS" LIBS="-lsocket $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2218: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -2224,7 +2235,7 @@ else echo "$ac_t""no" 1>&6 echo $ac_n "checking whether your system has IPv6 directory""... $ac_c" 1>&6 -echo "configure:2228: checking whether your system has IPv6 directory" >&5 +echo "configure:2239: checking whether your system has IPv6 directory" >&5 if eval "test \"`echo '$''{'ipv6_cv_dir'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2244,7 +2255,7 @@ LDFLAGS="$LDFLAGS -L$ipv6_cv_dir/lib" fi echo $ac_n "checking for getaddrinfo in -linet6""... $ac_c" 1>&6 -echo "configure:2248: checking for getaddrinfo in -linet6" >&5 +echo "configure:2259: checking for getaddrinfo in -linet6" >&5 ac_lib_var=`echo inet6'_'getaddrinfo | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -2252,7 +2263,7 @@ ac_save_LIBS="$LIBS" LIBS="-linet6 $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2278: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -2302,7 +2313,7 @@ if test getaddrinfo = getaddrinfo; then for ipv6_cv_pfx in o n; do cat > conftest.$ac_ext < EOF @@ -2310,12 +2321,12 @@ egrep "${ipv6_cv_pfx}getaddrinfo" >/dev/null 2>&1; then rm -rf conftest* echo $ac_n "checking for ${ipv6_cv_pfx}getaddrinfo""... $ac_c" 1>&6 -echo "configure:2314: checking for ${ipv6_cv_pfx}getaddrinfo" >&5 +echo "configure:2325: checking for ${ipv6_cv_pfx}getaddrinfo" >&5 if eval "test \"`echo '$''{'ac_cv_func_${ipv6_cv_pfx}getaddrinfo'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2353: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_${ipv6_cv_pfx}getaddrinfo=yes" else @@ -2372,266 +2383,25 @@ fi fi if test $ipv6_cv_getaddrinfo = yes; then - -echo $ac_n "checking for gai_strerror""... $ac_c" 1>&6 -echo "configure:2378: checking for gai_strerror" >&5 -if eval "test \"`echo '$''{'ac_cv_func_gai_strerror'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext < -/* Override any gcc2 internal prototype to avoid an error. */ -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char gai_strerror(); - -int main() { - -/* The GNU C library defines this for functions which it implements - to always fail with ENOSYS. Some functions are actually named - something starting with __ and the normal name is an alias. */ -#if defined (__stub_gai_strerror) || defined (__stub___gai_strerror) -choke me -#else -gai_strerror(); -#endif - -; return 0; } -EOF -if { (eval echo configure:2406: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - eval "ac_cv_func_gai_strerror=yes" -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_func_gai_strerror=no" -fi -rm -f conftest* -fi - -if eval "test \"`echo '$ac_cv_func_'gai_strerror`\" = yes"; then - echo "$ac_t""yes" 1>&6 - ac_cv_lib_socket_gai_strerror=no - ac_cv_lib_inet6_gai_strerror=no - -else - echo "$ac_t""no" 1>&6 - echo $ac_n "checking for gai_strerror in -lsocket""... $ac_c" 1>&6 -echo "configure:2426: checking for gai_strerror in -lsocket" >&5 -ac_lib_var=`echo socket'_'gai_strerror | sed 'y%./+-%__p_%'` -if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - ac_save_LIBS="$LIBS" -LIBS="-lsocket $LIBS" -cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - eval "ac_cv_lib_$ac_lib_var=yes" -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_lib_$ac_lib_var=no" -fi -rm -f conftest* -LIBS="$ac_save_LIBS" - -fi -if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then - echo "$ac_t""yes" 1>&6 - LIBS="$LIBS -lsocket" - ac_cv_lib_inet6_gai_strerror=no - -else - echo "$ac_t""no" 1>&6 - echo $ac_n "checking whether your system has IPv6 directory""... $ac_c" 1>&6 -echo "configure:2466: checking whether your system has IPv6 directory" >&5 - if eval "test \"`echo '$''{'ipv6_cv_dir'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - for ipv6_cv_dir in /usr/local/v6 /usr/inet6 no; do - if test $ipv6_cv_dir = no -o -d $ipv6_cv_dir; then - break - fi - done -fi - echo "$ac_t""$ipv6_cv_dir" 1>&6 - if test $ipv6_cv_dir = no; then - ac_cv_lib_inet6_gai_strerror=no - else - if test x$ipv6_libinet6 = x; then - ipv6_libinet6=no - SAVELDFLAGS="$LDFLAGS" - LDFLAGS="$LDFLAGS -L$ipv6_cv_dir/lib" - fi - echo $ac_n "checking for gai_strerror in -linet6""... $ac_c" 1>&6 -echo "configure:2486: checking for gai_strerror in -linet6" >&5 -ac_lib_var=`echo inet6'_'gai_strerror | sed 'y%./+-%__p_%'` -if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - ac_save_LIBS="$LIBS" -LIBS="-linet6 $LIBS" -cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - eval "ac_cv_lib_$ac_lib_var=yes" -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_lib_$ac_lib_var=no" -fi -rm -f conftest* -LIBS="$ac_save_LIBS" - -fi -if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then - echo "$ac_t""yes" 1>&6 - if test $ipv6_libinet6 = no; then - ipv6_libinet6=yes - LIBS="$LIBS -linet6" - fi -else - echo "$ac_t""no" 1>&6 -fi - if test $ipv6_libinet6 = no; then - LDFLAGS="$SAVELDFLAGS" - fi - fi -fi - -fi -ipv6_cv_gai_strerror=no -if test $ac_cv_func_gai_strerror = yes -o $ac_cv_lib_socket_gai_strerror = yes \ - -o $ac_cv_lib_inet6_gai_strerror = yes -then - ipv6_cv_gai_strerror=yes -fi -if test $ipv6_cv_gai_strerror = no; then - if test gai_strerror = getaddrinfo; then - for ipv6_cv_pfx in o n; do - cat > conftest.$ac_ext < -EOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - egrep "${ipv6_cv_pfx}gai_strerror" >/dev/null 2>&1; then - rm -rf conftest* - echo $ac_n "checking for ${ipv6_cv_pfx}gai_strerror""... $ac_c" 1>&6 -echo "configure:2552: checking for ${ipv6_cv_pfx}gai_strerror" >&5 -if eval "test \"`echo '$''{'ac_cv_func_${ipv6_cv_pfx}gai_strerror'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext < -/* Override any gcc2 internal prototype to avoid an error. */ -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char ${ipv6_cv_pfx}gai_strerror(); - -int main() { - -/* The GNU C library defines this for functions which it implements - to always fail with ENOSYS. Some functions are actually named - something starting with __ and the normal name is an alias. */ -#if defined (__stub_${ipv6_cv_pfx}gai_strerror) || defined (__stub___${ipv6_cv_pfx}gai_strerror) -choke me -#else -${ipv6_cv_pfx}gai_strerror(); -#endif - -; return 0; } -EOF -if { (eval echo configure:2580: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - eval "ac_cv_func_${ipv6_cv_pfx}gai_strerror=yes" -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_func_${ipv6_cv_pfx}gai_strerror=no" -fi -rm -f conftest* -fi - -if eval "test \"`echo '$ac_cv_func_'${ipv6_cv_pfx}gai_strerror`\" = yes"; then - echo "$ac_t""yes" 1>&6 - : -else - echo "$ac_t""no" 1>&6 -fi - -fi -rm -f conftest* - - if eval test X\$ac_cv_func_${ipv6_cv_pfx}gai_strerror = Xyes; then - cat >> confdefs.h <<\EOF -#define HAVE_GETADDRINFO 1 -EOF - - ipv6_cv_gai_strerror=yes - break - fi - done - fi -fi -if test $ipv6_cv_gai_strerror = yes; then - - cat >> confdefs.h <<\EOF + cat >> confdefs.h <<\EOF #define HAVE_GETADDRINFO 1 EOF - cyrus_cv_getaddrinfo=no else - : + cyrus_cv_getaddrinfo=yes fi -else - : +if test $cyrus_cv_getaddrinfo = yes; then + LIBOBJS="$LIBOBJS getaddrinfo.o" fi - -cyrus_cv_getnameinfo=yes +cyrus_cv_getnameinfo=no echo $ac_n "checking for getnameinfo""... $ac_c" 1>&6 -echo "configure:2630: checking for getnameinfo" >&5 +echo "configure:2400: checking for getnameinfo" >&5 if eval "test \"`echo '$''{'ac_cv_func_getnameinfo'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2428: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_getnameinfo=yes" else @@ -2674,7 +2444,7 @@ else echo "$ac_t""no" 1>&6 echo $ac_n "checking for getnameinfo in -lsocket""... $ac_c" 1>&6 -echo "configure:2678: checking for getnameinfo in -lsocket" >&5 +echo "configure:2448: checking for getnameinfo in -lsocket" >&5 ac_lib_var=`echo socket'_'getnameinfo | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -2682,7 +2452,7 @@ ac_save_LIBS="$LIBS" LIBS="-lsocket $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2467: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -2714,7 +2484,7 @@ else echo "$ac_t""no" 1>&6 echo $ac_n "checking whether your system has IPv6 directory""... $ac_c" 1>&6 -echo "configure:2718: checking whether your system has IPv6 directory" >&5 +echo "configure:2488: checking whether your system has IPv6 directory" >&5 if eval "test \"`echo '$''{'ipv6_cv_dir'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2734,7 +2504,7 @@ LDFLAGS="$LDFLAGS -L$ipv6_cv_dir/lib" fi echo $ac_n "checking for getnameinfo in -linet6""... $ac_c" 1>&6 -echo "configure:2738: checking for getnameinfo in -linet6" >&5 +echo "configure:2508: checking for getnameinfo in -linet6" >&5 ac_lib_var=`echo inet6'_'getnameinfo | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -2742,7 +2512,7 @@ ac_save_LIBS="$LIBS" LIBS="-linet6 $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2527: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -2792,7 +2562,7 @@ if test getnameinfo = getaddrinfo; then for ipv6_cv_pfx in o n; do cat > conftest.$ac_ext < EOF @@ -2800,12 +2570,12 @@ egrep "${ipv6_cv_pfx}getnameinfo" >/dev/null 2>&1; then rm -rf conftest* echo $ac_n "checking for ${ipv6_cv_pfx}getnameinfo""... $ac_c" 1>&6 -echo "configure:2804: checking for ${ipv6_cv_pfx}getnameinfo" >&5 +echo "configure:2574: checking for ${ipv6_cv_pfx}getnameinfo" >&5 if eval "test \"`echo '$''{'ac_cv_func_${ipv6_cv_pfx}getnameinfo'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2602: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_${ipv6_cv_pfx}getnameinfo=yes" else @@ -2867,17 +2637,91 @@ EOF else - cyrus_cv_getnameinfo=no + cyrus_cv_getnameinfo=yes +fi +if test $cyrus_cv_getnameinfo = yes; then + LIBOBJS="$LIBOBJS getnameinfo.o" fi +echo $ac_n "checking whether you have ss_family in struct sockaddr_storage""... $ac_c" 1>&6 +echo "configure:2649: checking whether you have ss_family in struct sockaddr_storage" >&5 +if eval "test \"`echo '$''{'ipv6_cv_ss_family'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +#include +int main() { +struct sockaddr_storage ss; int i = ss.ss_family; +; return 0; } +EOF +if { (eval echo configure:2662: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + ipv6_cv_ss_family=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ipv6_cv_ss_family=no +fi +rm -f conftest* +fi +if test $ipv6_cv_ss_family = yes; then + cat >> confdefs.h <<\EOF +#define HAVE_SS_FAMILY 1 +EOF + +else + : +fi +echo "$ac_t""$ipv6_cv_ss_family" 1>&6 + +echo $ac_n "checking whether you have sa_len in struct sockaddr""... $ac_c" 1>&6 +echo "configure:2684: checking whether you have sa_len in struct sockaddr" >&5 +if eval "test \"`echo '$''{'ipv6_cv_sa_len'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +#include +int main() { +struct sockaddr sa; int i = sa.sa_len; +; return 0; } +EOF +if { (eval echo configure:2697: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + ipv6_cv_sa_len=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ipv6_cv_sa_len=no +fi +rm -f conftest* +fi +if test $ipv6_cv_sa_len = yes; then + cat >> confdefs.h <<\EOF +#define HAVE_SOCKADDR_SA_LEN 1 +EOF + +else + : +fi +echo "$ac_t""$ipv6_cv_sa_len" 1>&6 + + echo $ac_n "checking whether struct tm is in sys/time.h or time.h""... $ac_c" 1>&6 -echo "configure:2876: checking whether struct tm is in sys/time.h or time.h" >&5 +echo "configure:2720: checking whether struct tm is in sys/time.h or time.h" >&5 if eval "test \"`echo '$''{'ac_cv_struct_tm'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -2885,7 +2729,7 @@ struct tm *tp; tp->tm_sec; ; return 0; } EOF -if { (eval echo configure:2889: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2733: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_struct_tm=time.h else @@ -2906,12 +2750,12 @@ fi echo $ac_n "checking for tm_zone in struct tm""... $ac_c" 1>&6 -echo "configure:2910: checking for tm_zone in struct tm" >&5 +echo "configure:2754: checking for tm_zone in struct tm" >&5 if eval "test \"`echo '$''{'ac_cv_struct_tm_zone'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include <$ac_cv_struct_tm> @@ -2919,7 +2763,7 @@ struct tm tm; tm.tm_zone; ; return 0; } EOF -if { (eval echo configure:2923: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2767: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_struct_tm_zone=yes else @@ -2939,12 +2783,12 @@ else echo $ac_n "checking for tzname""... $ac_c" 1>&6 -echo "configure:2943: checking for tzname" >&5 +echo "configure:2787: checking for tzname" >&5 if eval "test \"`echo '$''{'ac_cv_var_tzname'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #ifndef tzname /* For SGI. */ @@ -2954,7 +2798,7 @@ atoi(*tzname); ; return 0; } EOF -if { (eval echo configure:2958: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2802: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_cv_var_tzname=yes else @@ -2982,12 +2826,12 @@ echo $ac_n "checking for vprintf""... $ac_c" 1>&6 -echo "configure:2986: checking for vprintf" >&5 +echo "configure:2830: checking for vprintf" >&5 if eval "test \"`echo '$''{'ac_cv_func_vprintf'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2858: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_vprintf=yes" else @@ -3034,12 +2878,12 @@ if test "$ac_cv_func_vprintf" != yes; then echo $ac_n "checking for _doprnt""... $ac_c" 1>&6 -echo "configure:3038: checking for _doprnt" >&5 +echo "configure:2882: checking for _doprnt" >&5 if eval "test \"`echo '$''{'ac_cv_func__doprnt'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2910: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func__doprnt=yes" else @@ -3129,17 +2973,17 @@ ac_safe=`echo "db.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for db.h""... $ac_c" 1>&6 -echo "configure:3133: checking for db.h" >&5 +echo "configure:2977: checking for db.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:3143: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:2987: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -3182,7 +3026,7 @@ for dbname in db-4.1 db4.1 db41 db-4.0 db4.0 db-4 db40 db4 db-3.3 db3.3 db33 db-3.2 db3.2 db32 db-3.1 db3.1 db31 db-3 db30 db3 db do echo $ac_n "checking for db_create in -l$dbname""... $ac_c" 1>&6 -echo "configure:3186: checking for db_create in -l$dbname" >&5 +echo "configure:3030: checking for db_create in -l$dbname" >&5 ac_lib_var=`echo $dbname'_'db_create | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -3190,7 +3034,7 @@ ac_save_LIBS="$LIBS" LIBS="-l$dbname $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3049: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -3226,7 +3070,7 @@ done if test "$dblib" = "no"; then echo $ac_n "checking for db_open in -ldb""... $ac_c" 1>&6 -echo "configure:3230: checking for db_open in -ldb" >&5 +echo "configure:3074: checking for db_open in -ldb" >&5 ac_lib_var=`echo db'_'db_open | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -3234,7 +3078,7 @@ ac_save_LIBS="$LIBS" LIBS="-ldb $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3093: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -3313,7 +3157,7 @@ echo $ac_n "checking "duplicate db" database backend""... $ac_c" 1>&6 -echo "configure:3317: checking "duplicate db" database backend" >&5 +echo "configure:3161: checking "duplicate db" database backend" >&5 if test "$DB" = "flat"; then { echo "configure: error: this database requires a backend capable of binary data" 1>&2; exit 1; } fi @@ -3340,7 +3184,7 @@ echo $ac_n "checking "mboxlist" database backend""... $ac_c" 1>&6 -echo "configure:3344: checking "mboxlist" database backend" >&5 +echo "configure:3188: checking "mboxlist" database backend" >&5 if test "$DB" != "db3" -a \ "$DB" != "db3_nosync" -a \ "$DB" != "flat" -a \ @@ -3365,7 +3209,7 @@ echo $ac_n "checking "seen state" database backend""... $ac_c" 1>&6 -echo "configure:3369: checking "seen state" database backend" >&5 +echo "configure:3213: checking "seen state" database backend" >&5 if test "$DB" != "db3" -a \ "$DB" != "db3_nosync" -a \ "$DB" != "flat" -a \ @@ -3390,7 +3234,7 @@ echo $ac_n "checking "subscription" database backend""... $ac_c" 1>&6 -echo "configure:3394: checking "subscription" database backend" >&5 +echo "configure:3238: checking "subscription" database backend" >&5 if test "$DB" != "db3" -a \ "$DB" != "db3_nosync" -a \ "$DB" != "flat" -a \ @@ -3415,7 +3259,7 @@ echo $ac_n "checking "TLS cache" database backend""... $ac_c" 1>&6 -echo "configure:3419: checking "TLS cache" database backend" >&5 +echo "configure:3263: checking "TLS cache" database backend" >&5 if test "$DB" = "flat"; then { echo "configure: error: this database requires a backend capable of binary data" 1>&2; exit 1; } fi @@ -3457,7 +3301,7 @@ # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3461: checking for $ac_word" >&5 +echo "configure:3305: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_YACC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3490,7 +3334,7 @@ # Extract the first word of "flex", so it can be a program name with args. set dummy flex; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3494: checking for $ac_word" >&5 +echo "configure:3338: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_LEX'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3524,7 +3368,7 @@ *) ac_lib=l ;; esac echo $ac_n "checking for yywrap in -l$ac_lib""... $ac_c" 1>&6 -echo "configure:3528: checking for yywrap in -l$ac_lib" >&5 +echo "configure:3372: checking for yywrap in -l$ac_lib" >&5 ac_lib_var=`echo $ac_lib'_'yywrap | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -3532,7 +3376,7 @@ ac_save_LIBS="$LIBS" LIBS="-l$ac_lib $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3391: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -3566,7 +3410,7 @@ fi echo $ac_n "checking for main in -lfl""... $ac_c" 1>&6 -echo "configure:3570: checking for main in -lfl" >&5 +echo "configure:3414: checking for main in -lfl" >&5 ac_lib_var=`echo fl'_'main | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -3574,14 +3418,14 @@ ac_save_LIBS="$LIBS" LIBS="-lfl $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3429: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -3611,14 +3455,14 @@ echo $ac_n "checking for library containing regcomp""... $ac_c" 1>&6 -echo "configure:3615: checking for library containing regcomp" >&5 +echo "configure:3459: checking for library containing regcomp" >&5 if eval "test \"`echo '$''{'ac_cv_search_regcomp'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_func_search_save_LIBS="$LIBS" ac_cv_search_regcomp="no" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3477: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_cv_search_regcomp="none required" else @@ -3640,7 +3484,7 @@ test "$ac_cv_search_regcomp" = "no" && for i in rx regex; do LIBS="-l$i $ac_func_search_save_LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3499: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_cv_search_regcomp="-l$i" break @@ -3674,17 +3518,17 @@ ac_safe=`echo "rxposix.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for rxposix.h""... $ac_c" 1>&6 -echo "configure:3678: checking for rxposix.h" >&5 +echo "configure:3522: checking for rxposix.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:3688: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:3532: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -3718,12 +3562,12 @@ fi echo $ac_n "checking for strerror""... $ac_c" 1>&6 -echo "configure:3722: checking for strerror" >&5 +echo "configure:3566: checking for strerror" >&5 if eval "test \"`echo '$''{'ac_cv_func_strerror'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3594: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_strerror=yes" else @@ -3777,17 +3621,17 @@ do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:3781: checking for $ac_hdr" >&5 +echo "configure:3625: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:3791: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:3635: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -3816,12 +3660,12 @@ for ac_func in setrlimit do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:3820: checking for $ac_func" >&5 +echo "configure:3664: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3692: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -3871,12 +3715,12 @@ for ac_func in getrlimit do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:3875: checking for $ac_func" >&5 +echo "configure:3719: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3747: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -3927,12 +3771,12 @@ for ac_func in daemon setsid do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:3931: checking for $ac_func" >&5 +echo "configure:3775: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3803: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -3983,12 +3827,12 @@ for ac_func in shutdown do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:3987: checking for $ac_func" >&5 +echo "configure:3831: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3859: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -4037,7 +3881,7 @@ cat > conftest.$ac_ext < EOF @@ -4052,7 +3896,22 @@ rm -f conftest* cat > conftest.$ac_ext < +EOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "sockaddr_storage" >/dev/null 2>&1; then + rm -rf conftest* + cat >> confdefs.h <<\EOF +#define HAVE_STRUCT_SOCKADDR_STORAGE 1 +EOF + +fi +rm -f conftest* + +cat > conftest.$ac_ext < EOF @@ -4069,12 +3928,12 @@ spt_type="" echo $ac_n "checking for setproctitle""... $ac_c" 1>&6 -echo "configure:4073: checking for setproctitle" >&5 +echo "configure:3932: checking for setproctitle" >&5 if eval "test \"`echo '$''{'ac_cv_func_setproctitle'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3960: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_setproctitle=yes" else @@ -4118,7 +3977,7 @@ if test "$spt_type" = ""; then echo $ac_n "checking for setproctitle in -lutil""... $ac_c" 1>&6 -echo "configure:4122: checking for setproctitle in -lutil" >&5 +echo "configure:3981: checking for setproctitle in -lutil" >&5 ac_lib_var=`echo util'_'setproctitle | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -4126,7 +3985,7 @@ ac_save_LIBS="$LIBS" LIBS="-lutil $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4000: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -4162,17 +4021,17 @@ if test "$spt_type" = ""; then ac_safe=`echo "sys/pstat.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for sys/pstat.h""... $ac_c" 1>&6 -echo "configure:4166: checking for sys/pstat.h" >&5 +echo "configure:4025: checking for sys/pstat.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:4176: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:4035: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -4197,17 +4056,17 @@ if test "$spt_type" = ""; then ac_safe=`echo "sys/sysnews.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for sys/sysnews.h""... $ac_c" 1>&6 -echo "configure:4201: checking for sys/sysnews.h" >&5 +echo "configure:4060: checking for sys/sysnews.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:4211: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:4070: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -4231,12 +4090,12 @@ fi if test "$spt_type" = ""; then echo $ac_n "checking for PS_STRINGS""... $ac_c" 1>&6 -echo "configure:4235: checking for PS_STRINGS" >&5 +echo "configure:4094: checking for PS_STRINGS" >&5 if eval "test \"`echo '$''{'cyrus_cv_sys_psstrings'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < @@ -4246,7 +4105,7 @@ #endif EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:4250: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:4109: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -4268,12 +4127,12 @@ fi if test "$spt_type" = ""; then echo $ac_n "checking for SCO""... $ac_c" 1>&6 -echo "configure:4272: checking for SCO" >&5 +echo "configure:4131: checking for SCO" >&5 if eval "test \"`echo '$''{'cyrus_cv_sys_sco'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:4144: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -4303,12 +4162,12 @@ fi if test "$spt_type" = ""; then echo $ac_n "checking for setproctitle usability""... $ac_c" 1>&6 -echo "configure:4307: checking for setproctitle usability" >&5 +echo "configure:4166: checking for setproctitle usability" >&5 if eval "test \"`echo '$''{'cyrus_cv_sys_setproctitle'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:4179: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -4344,12 +4203,12 @@ fi echo $ac_n "checking nonblocking method""... $ac_c" 1>&6 -echo "configure:4348: checking nonblocking method" >&5 +echo "configure:4207: checking nonblocking method" >&5 if eval "test \"`echo '$''{'cyrus_cv_sys_nonblock'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -4361,7 +4220,7 @@ fcntl(0, F_GETFL, 0)&FNDELAY ; return 0; } EOF -if { (eval echo configure:4365: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4224: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* cyrus_cv_sys_nonblock=fcntl else @@ -4378,12 +4237,12 @@ echo "$ac_t""$WITH_NONBLOCK" 1>&6 echo $ac_n "checking timezone GMT offset method""... $ac_c" 1>&6 -echo "configure:4382: checking timezone GMT offset method" >&5 +echo "configure:4241: checking timezone GMT offset method" >&5 if eval "test \"`echo '$''{'cyrus_cv_struct_sys_gmtoff'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < @@ -4393,7 +4252,7 @@ ; return 0; } EOF -if { (eval echo configure:4397: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:4256: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* cyrus_cv_struct_sys_gmtoff=tm else @@ -4409,7 +4268,7 @@ echo "$ac_t""$WITH_GMTOFF" 1>&6 echo $ac_n "checking for shared mmap""... $ac_c" 1>&6 -echo "configure:4413: checking for shared mmap" >&5 +echo "configure:4272: checking for shared mmap" >&5 if eval "test \"`echo '$''{'cyrus_cv_func_mmap_shared'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4417,7 +4276,7 @@ cyrus_cv_func_mmap_shared=no else cat > conftest.$ac_ext < @@ -4445,7 +4304,7 @@ exit(0);} EOF -if { (eval echo configure:4449: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:4308: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then cyrus_cv_func_mmap_shared=yes else @@ -4464,7 +4323,7 @@ WITH_MAP="shared" else echo $ac_n "checking for stupid shared mmap""... $ac_c" 1>&6 -echo "configure:4468: checking for stupid shared mmap" >&5 +echo "configure:4327: checking for stupid shared mmap" >&5 if eval "test \"`echo '$''{'cyrus_cv_func_mmap_stupidshared'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4472,7 +4331,7 @@ cyrus_cv_func_mmap_stupidshared=no else cat > conftest.$ac_ext < @@ -4501,7 +4360,7 @@ exit(0);} EOF -if { (eval echo configure:4505: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:4364: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then cyrus_cv_func_mmap_stupidshared=yes else @@ -4533,12 +4392,12 @@ else echo $ac_n "checking for fcntl""... $ac_c" 1>&6 -echo "configure:4537: checking for fcntl" >&5 +echo "configure:4396: checking for fcntl" >&5 if eval "test \"`echo '$''{'ac_cv_func_fcntl'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4424: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_fcntl=yes" else @@ -4580,12 +4439,12 @@ echo "$ac_t""no" 1>&6 echo $ac_n "checking for flock""... $ac_c" 1>&6 -echo "configure:4584: checking for flock" >&5 +echo "configure:4443: checking for flock" >&5 if eval "test \"`echo '$''{'ac_cv_func_flock'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4471: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_flock=yes" else @@ -4641,12 +4500,12 @@ LIB_RT="" echo $ac_n "checking for fdatasync""... $ac_c" 1>&6 -echo "configure:4645: checking for fdatasync" >&5 +echo "configure:4504: checking for fdatasync" >&5 if eval "test \"`echo '$''{'ac_cv_func_fdatasync'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4532: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_fdatasync=yes" else @@ -4691,7 +4550,7 @@ echo "$ac_t""no" 1>&6 echo $ac_n "checking for fdatasync in -lrt""... $ac_c" 1>&6 -echo "configure:4695: checking for fdatasync in -lrt" >&5 +echo "configure:4554: checking for fdatasync in -lrt" >&5 ac_lib_var=`echo rt'_'fdatasync | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -4699,7 +4558,7 @@ ac_save_LIBS="$LIBS" LIBS="-lrt $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4573: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -4746,12 +4605,12 @@ else echo $ac_n "checking for sigvec""... $ac_c" 1>&6 -echo "configure:4750: checking for sigvec" >&5 +echo "configure:4609: checking for sigvec" >&5 if eval "test \"`echo '$''{'ac_cv_func_sigvec'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4637: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_sigvec=yes" else @@ -4795,7 +4654,7 @@ echo "$ac_t""no" 1>&6 echo $ac_n "checking for sigvec in -lBSD""... $ac_c" 1>&6 -echo "configure:4799: checking for sigvec in -lBSD" >&5 +echo "configure:4658: checking for sigvec in -lBSD" >&5 ac_lib_var=`echo BSD'_'sigvec | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -4803,7 +4662,7 @@ ac_save_LIBS="$LIBS" LIBS="-lBSD $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4677: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -4836,7 +4695,7 @@ SAVE_LDFLAGS="$LDFLAGS" LDFLAGS="-L/usr/ucblib -R/usr/ucblib $LDFLAGS" echo $ac_n "checking for sigvec in -lucb""... $ac_c" 1>&6 -echo "configure:4840: checking for sigvec in -lucb" >&5 +echo "configure:4699: checking for sigvec in -lucb" >&5 ac_lib_var=`echo ucb'_'sigvec | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -4844,7 +4703,7 @@ ac_save_LIBS="$LIBS" LIBS="-lucb $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4718: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -4940,16 +4799,16 @@ SAVE_LIBS="$LIBS" LIBS="$AFS_LIBS" echo $ac_n "checking if AFS libraries have pr_End""... $ac_c" 1>&6 -echo "configure:4944: checking if AFS libraries have pr_End" >&5 +echo "configure:4803: checking if AFS libraries have pr_End" >&5 cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4812: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* echo "$ac_t""yes" 1>&6 @@ -4982,16 +4841,16 @@ SAVE_LIBS="$LIBS" LIBS="${with_afs}/lib/liblwp.a" echo $ac_n "checking if AFS libraries need sigvec""... $ac_c" 1>&6 -echo "configure:4986: checking if AFS libraries need sigvec" >&5 +echo "configure:4845: checking if AFS libraries need sigvec" >&5 cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4854: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* echo "$ac_t""no" 1>&6 @@ -5056,7 +4915,7 @@ if test "$WITH_AUTH" = "krb" -o "$WITH_AUTH" = "krb_pts" ; then echo $ac_n "checking for res_search in -lresolv""... $ac_c" 1>&6 -echo "configure:5060: checking for res_search in -lresolv" >&5 +echo "configure:4919: checking for res_search in -lresolv" >&5 ac_lib_var=`echo resolv'_'res_search | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -5064,7 +4923,7 @@ ac_save_LIBS="$LIBS" LIBS="-lresolv $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4938: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -5108,7 +4967,7 @@ fi echo $ac_n "checking for des_ecb_encrypt in -ldes""... $ac_c" 1>&6 -echo "configure:5112: checking for des_ecb_encrypt in -ldes" >&5 +echo "configure:4971: checking for des_ecb_encrypt in -ldes" >&5 ac_lib_var=`echo des'_'des_ecb_encrypt | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -5116,7 +4975,7 @@ ac_save_LIBS="$LIBS" LIBS="-ldes $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4990: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -5155,7 +5014,7 @@ if test -d ${with_krb}; then echo $ac_n "checking for Kerberos includes""... $ac_c" 1>&6 -echo "configure:5159: checking for Kerberos includes" >&5 +echo "configure:5018: checking for Kerberos includes" >&5 if eval "test \"`echo '$''{'cyrus_krbinclude'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -5188,17 +5047,17 @@ if test "$with_des" != no; then ac_safe=`echo "krb.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for krb.h""... $ac_c" 1>&6 -echo "configure:5192: checking for krb.h" >&5 +echo "configure:5051: checking for krb.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:5202: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:5061: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -5215,7 +5074,7 @@ if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then echo "$ac_t""yes" 1>&6 echo $ac_n "checking for krb_mk_priv in -lkrb""... $ac_c" 1>&6 -echo "configure:5219: checking for krb_mk_priv in -lkrb" >&5 +echo "configure:5078: checking for krb_mk_priv in -lkrb" >&5 ac_lib_var=`echo krb'_'krb_mk_priv | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -5223,7 +5082,7 @@ ac_save_LIBS="$LIBS" LIBS="-lkrb $KRB_LIBS $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5097: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -5296,7 +5155,7 @@ ""|yes) LIB_RSAREF="" echo $ac_n "checking for RSAPublicEncrypt in -lrsaref""... $ac_c" 1>&6 -echo "configure:5300: checking for RSAPublicEncrypt in -lrsaref" >&5 +echo "configure:5159: checking for RSAPublicEncrypt in -lrsaref" >&5 ac_lib_var=`echo rsaref'_'RSAPublicEncrypt | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -5304,7 +5163,7 @@ ac_save_LIBS="$LIBS" LIBS="-lrsaref $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5178: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -5339,7 +5198,7 @@ with_openssl="yes" echo $ac_n "checking for BIO_accept in -lcrypto""... $ac_c" 1>&6 -echo "configure:5343: checking for BIO_accept in -lcrypto" >&5 +echo "configure:5202: checking for BIO_accept in -lcrypto" >&5 ac_lib_var=`echo crypto'_'BIO_accept | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -5347,7 +5206,7 @@ ac_save_LIBS="$LIBS" LIBS="-lcrypto $LIB_RSAREF $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5221: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -5380,7 +5239,7 @@ fi echo $ac_n "checking for SSL_CTX_new in -lssl""... $ac_c" 1>&6 -echo "configure:5384: checking for SSL_CTX_new in -lssl" >&5 +echo "configure:5243: checking for SSL_CTX_new in -lssl" >&5 ac_lib_var=`echo ssl'_'SSL_CTX_new | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -5388,7 +5247,7 @@ ac_save_LIBS="$LIBS" LIBS="-lssl -lcrypto $LIB_RSAREF $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5262: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -5446,7 +5305,7 @@ esac echo $ac_n "checking for openssl""... $ac_c" 1>&6 -echo "configure:5450: checking for openssl" >&5 +echo "configure:5309: checking for openssl" >&5 echo "$ac_t""$with_openssl" 1>&6 if test "$with_openssl" != "no"; then @@ -5491,7 +5350,7 @@ case "$with_zephyr" in no) true;; ""|yes) echo $ac_n "checking for ZInitialize in -lzephyr""... $ac_c" 1>&6 -echo "configure:5495: checking for ZInitialize in -lzephyr" >&5 +echo "configure:5354: checking for ZInitialize in -lzephyr" >&5 ac_lib_var=`echo zephyr'_'ZInitialize | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -5499,7 +5358,7 @@ ac_save_LIBS="$LIBS" LIBS="-lzephyr $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5373: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -5594,17 +5453,17 @@ if test -z "$with_com_err"; then ac_safe=`echo "com_err.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for com_err.h""... $ac_c" 1>&6 -echo "configure:5598: checking for com_err.h" >&5 +echo "configure:5457: checking for com_err.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:5608: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:5467: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -5623,7 +5482,7 @@ # no value supplied echo $ac_n "checking for com_err in -lcom_err""... $ac_c" 1>&6 -echo "configure:5627: checking for com_err in -lcom_err" >&5 +echo "configure:5486: checking for com_err in -lcom_err" >&5 ac_lib_var=`echo com_err'_'com_err | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -5631,7 +5490,7 @@ ac_save_LIBS="$LIBS" LIBS="-lcom_err $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5505: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -5665,7 +5524,7 @@ # Extract the first word of "compile_et", so it can be a program name with args. set dummy compile_et; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:5669: checking for $ac_word" >&5 +echo "configure:5528: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_COMPILE_ET'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -5707,7 +5566,7 @@ # Extract the first word of "/usr/local/bin/compile_et", so it can be a program name with args. set dummy /usr/local/bin/compile_et; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:5711: checking for $ac_word" >&5 +echo "configure:5570: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_COMPILE_ET'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -5800,12 +5659,12 @@ echo $ac_n "checking for modern syslog""... $ac_c" 1>&6 -echo "configure:5804: checking for modern syslog" >&5 +echo "configure:5663: checking for modern syslog" >&5 if eval "test \"`echo '$''{'cyrus_cv_lib_syslog'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #ifndef LOG_LOCAL6 @@ -5813,7 +5672,7 @@ #endif EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:5817: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:5676: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -5839,12 +5698,12 @@ for ac_func in getdtablesize do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:5843: checking for $ac_func" >&5 +echo "configure:5702: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5730: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -5916,7 +5775,7 @@ echo $ac_n "checking to use old sieve service name""... $ac_c" 1>&6 -echo "configure:5920: checking to use old sieve service name" >&5 +echo "configure:5779: checking to use old sieve service name" >&5 # Check whether --enable-oldsievename or --disable-oldsievename was given. if test "${enable_oldsievename+set}" = set; then enableval="$enable_oldsievename" @@ -5971,12 +5830,12 @@ echo $ac_n "checking for dlopen""... $ac_c" 1>&6 -echo "configure:5975: checking for dlopen" >&5 +echo "configure:5834: checking for dlopen" >&5 if eval "test \"`echo '$''{'ac_cv_func_dlopen'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5862: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_dlopen=yes" else @@ -6017,7 +5876,7 @@ else echo "$ac_t""no" 1>&6 echo $ac_n "checking for dlopen in -ldl""... $ac_c" 1>&6 -echo "configure:6021: checking for dlopen in -ldl" >&5 +echo "configure:5880: checking for dlopen in -ldl" >&5 ac_lib_var=`echo dl'_'dlopen | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -6025,7 +5884,7 @@ ac_save_LIBS="$LIBS" LIBS="-ldl $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5899: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -6067,12 +5926,12 @@ echo $ac_n "checking for crypt""... $ac_c" 1>&6 -echo "configure:6071: checking for crypt" >&5 +echo "configure:5930: checking for crypt" >&5 if eval "test \"`echo '$''{'ac_cv_func_crypt'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5958: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_crypt=yes" else @@ -6114,7 +5973,7 @@ echo "$ac_t""no" 1>&6 echo $ac_n "checking for crypt in -lcrypt""... $ac_c" 1>&6 -echo "configure:6118: checking for crypt in -lcrypt" >&5 +echo "configure:5977: checking for crypt in -lcrypt" >&5 ac_lib_var=`echo crypt'_'crypt | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -6122,7 +5981,7 @@ ac_save_LIBS="$LIBS" LIBS="-lcrypt $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5996: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -6202,17 +6061,17 @@ ac_safe=`echo "sasl/sasl.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for sasl/sasl.h""... $ac_c" 1>&6 -echo "configure:6206: checking for sasl/sasl.h" >&5 +echo "configure:6065: checking for sasl/sasl.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:6216: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:6075: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -6231,17 +6090,17 @@ ac_safe=`echo "sasl/saslutil.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for sasl/saslutil.h""... $ac_c" 1>&6 -echo "configure:6235: checking for sasl/saslutil.h" >&5 +echo "configure:6094: checking for sasl/saslutil.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:6245: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:6104: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -6261,11 +6120,11 @@ if test -r ${with_staticsasl}/lib/libsasl2.a; then ac_cv_found_sasl=yes echo $ac_n "checking for static libsasl""... $ac_c" 1>&6 -echo "configure:6265: checking for static libsasl" >&5 +echo "configure:6124: checking for static libsasl" >&5 LIB_SASL="$LIB_SASL ${with_staticsasl}/lib/libsasl2.a" else echo $ac_n "checking for static libsasl""... $ac_c" 1>&6 -echo "configure:6269: checking for static libsasl" >&5 +echo "configure:6128: checking for static libsasl" >&5 { echo "configure: error: Could not find ${with_staticsasl}/lib/libsasl2.a" 1>&2; exit 1; } fi @@ -6299,17 +6158,17 @@ fi ac_safe=`echo "gssapi.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for gssapi.h""... $ac_c" 1>&6 -echo "configure:6303: checking for gssapi.h" >&5 +echo "configure:6162: checking for gssapi.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:6313: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:6172: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -6334,17 +6193,17 @@ ac_safe=`echo "gssapi/gssapi.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for gssapi/gssapi.h""... $ac_c" 1>&6 -echo "configure:6338: checking for gssapi/gssapi.h" >&5 +echo "configure:6197: checking for gssapi/gssapi.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:6348: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:6207: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -6372,7 +6231,7 @@ if test "$gssapi" != no; then echo $ac_n "checking for db_open in -ldb""... $ac_c" 1>&6 -echo "configure:6376: checking for db_open in -ldb" >&5 +echo "configure:6235: checking for db_open in -ldb" >&5 ac_lib_var=`echo db'_'db_open | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -6380,7 +6239,7 @@ ac_save_LIBS="$LIBS" LIBS="-ldb $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:6254: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -6421,7 +6280,7 @@ gss_impl="no"; echo $ac_n "checking for res_search in -lresolv""... $ac_c" 1>&6 -echo "configure:6425: checking for res_search in -lresolv" >&5 +echo "configure:6284: checking for res_search in -lresolv" >&5 ac_lib_var=`echo resolv'_'res_search | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -6429,7 +6288,7 @@ ac_save_LIBS="$LIBS" LIBS="-lresolv $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:6303: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -6484,7 +6343,7 @@ # If this fails, check a full link against the MIT libraries. # If this fails, check a full link against the Solaris 8 and up libgss. echo $ac_n "checking for gss_unwrap in -lgssapi""... $ac_c" 1>&6 -echo "configure:6488: checking for gss_unwrap in -lgssapi" >&5 +echo "configure:6347: checking for gss_unwrap in -lgssapi" >&5 ac_lib_var=`echo gssapi'_'gss_unwrap | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -6492,7 +6351,7 @@ ac_save_LIBS="$LIBS" LIBS="-lgssapi $GSSAPIBASE_LIBS -lgssapi -lkrb5 -lasn1 -lroken ${LIB_CRYPT} ${LIB_DES} -lcom_err ${LIB_SOCKET} $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:6366: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -6526,7 +6385,7 @@ if test "$gss_impl" = "no"; then echo $ac_n "checking for gss_unwrap in -lgssapi_krb5""... $ac_c" 1>&6 -echo "configure:6530: checking for gss_unwrap in -lgssapi_krb5" >&5 +echo "configure:6389: checking for gss_unwrap in -lgssapi_krb5" >&5 ac_lib_var=`echo gssapi_krb5'_'gss_unwrap | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -6534,7 +6393,7 @@ ac_save_LIBS="$LIBS" LIBS="-lgssapi_krb5 $GSSAPIBASE_LIBS -lgssapi_krb5 -lkrb5 -lk5crypto -lcom_err ${LIB_SOCKET} $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:6408: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -6569,7 +6428,7 @@ if test "$gss_impl" = "no"; then echo $ac_n "checking for gss_unwrap in -lgss""... $ac_c" 1>&6 -echo "configure:6573: checking for gss_unwrap in -lgss" >&5 +echo "configure:6432: checking for gss_unwrap in -lgss" >&5 ac_lib_var=`echo gss'_'gss_unwrap | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -6577,7 +6436,7 @@ ac_save_LIBS="$LIBS" LIBS="-lgss -lgss $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:6451: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -6628,7 +6487,7 @@ if test "$ac_cv_header_gssapi_h" = "yes"; then cat > conftest.$ac_ext < EOF @@ -6644,7 +6503,7 @@ elif test "$ac_cv_header_gssapi_gssapi_h"; then cat > conftest.$ac_ext < EOF @@ -6662,7 +6521,7 @@ if test "$ac_cv_header_gssapi_h" = "yes"; then cat > conftest.$ac_ext < EOF @@ -6678,7 +6537,7 @@ elif test "$ac_cv_header_gssapi_gssapi_h"; then cat > conftest.$ac_ext < EOF @@ -6696,11 +6555,11 @@ GSSAPI_LIBS="" echo $ac_n "checking GSSAPI""... $ac_c" 1>&6 -echo "configure:6700: checking GSSAPI" >&5 +echo "configure:6559: checking GSSAPI" >&5 if test "$gssapi" != no; then echo "$ac_t""with implementation ${gss_impl}" 1>&6 echo $ac_n "checking for res_search in -lresolv""... $ac_c" 1>&6 -echo "configure:6704: checking for res_search in -lresolv" >&5 +echo "configure:6563: checking for res_search in -lresolv" >&5 ac_lib_var=`echo resolv'_'res_search | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -6708,7 +6567,7 @@ ac_save_LIBS="$LIBS" LIBS="-lresolv $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:6582: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -6747,12 +6606,12 @@ for ac_func in gsskrb5_register_acceptor_identity do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:6751: checking for $ac_func" >&5 +echo "configure:6610: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:6638: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -6832,17 +6691,17 @@ ac_safe=`echo "sasl/sasl.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for sasl/sasl.h""... $ac_c" 1>&6 -echo "configure:6836: checking for sasl/sasl.h" >&5 +echo "configure:6695: checking for sasl/sasl.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:6846: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:6705: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -6861,17 +6720,17 @@ ac_safe=`echo "sasl/saslutil.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for sasl/saslutil.h""... $ac_c" 1>&6 -echo "configure:6865: checking for sasl/saslutil.h" >&5 +echo "configure:6724: checking for sasl/saslutil.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:6875: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:6734: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -6889,7 +6748,7 @@ echo "$ac_t""yes" 1>&6 echo $ac_n "checking for prop_get in -lsasl2""... $ac_c" 1>&6 -echo "configure:6893: checking for prop_get in -lsasl2" >&5 +echo "configure:6752: checking for prop_get in -lsasl2" >&5 ac_lib_var=`echo sasl2'_'prop_get | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -6897,7 +6756,7 @@ ac_save_LIBS="$LIBS" LIBS="-lsasl2 $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:6771: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -6984,7 +6843,7 @@ LDFLAGS="$LDFLAGS $LIB_SASL" echo $ac_n "checking for sasl_checkapop in -lsasl2""... $ac_c" 1>&6 -echo "configure:6988: checking for sasl_checkapop in -lsasl2" >&5 +echo "configure:6847: checking for sasl_checkapop in -lsasl2" >&5 ac_lib_var=`echo sasl2'_'sasl_checkapop | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -6992,7 +6851,7 @@ ac_save_LIBS="$LIBS" LIBS="-lsasl2 $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:6866: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -7053,7 +6912,7 @@ # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:7057: checking for $ac_word" >&5 +echo "configure:6916: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_PERL'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -7105,12 +6964,12 @@ fi echo $ac_n "checking for MD5Init""... $ac_c" 1>&6 -echo "configure:7109: checking for MD5Init" >&5 +echo "configure:6968: checking for MD5Init" >&5 if eval "test \"`echo '$''{'ac_cv_func_MD5Init'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:6996: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_MD5Init=yes" else @@ -7151,7 +7010,7 @@ else echo "$ac_t""no" 1>&6 echo $ac_n "checking for MD5Init in -lmd""... $ac_c" 1>&6 -echo "configure:7155: checking for MD5Init in -lmd" >&5 +echo "configure:7014: checking for MD5Init in -lmd" >&5 ac_lib_var=`echo md'_'MD5Init | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -7159,7 +7018,7 @@ ac_save_LIBS="$LIBS" LIBS="-lmd $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:7033: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -7215,7 +7074,7 @@ fi cmu_save_LIBS="$LIBS" echo $ac_n "checking for request_init in -lwrap""... $ac_c" 1>&6 -echo "configure:7219: checking for request_init in -lwrap" >&5 +echo "configure:7078: checking for request_init in -lwrap" >&5 ac_lib_var=`echo wrap'_'request_init | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -7223,7 +7082,7 @@ ac_save_LIBS="$LIBS" LIBS="-lwrap ${LIB_SOCKET} $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:7097: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -7252,17 +7111,17 @@ ac_safe=`echo "tcpd.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for tcpd.h""... $ac_c" 1>&6 -echo "configure:7256: checking for tcpd.h" >&5 +echo "configure:7115: checking for tcpd.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:7266: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:7125: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -7292,7 +7151,7 @@ LIBS="$cmu_save_LIBS" fi echo $ac_n "checking libwrap support""... $ac_c" 1>&6 -echo "configure:7296: checking libwrap support" >&5 +echo "configure:7155: checking libwrap support" >&5 echo "$ac_t""$with_libwrap" 1>&6 LIB_WRAP="" if test "$with_libwrap" != no; then @@ -7302,7 +7161,7 @@ LIB_WRAP="-lwrap" echo $ac_n "checking for yp_get_default_domain in -lnsl""... $ac_c" 1>&6 -echo "configure:7306: checking for yp_get_default_domain in -lnsl" >&5 +echo "configure:7165: checking for yp_get_default_domain in -lnsl" >&5 ac_lib_var=`echo nsl'_'yp_get_default_domain | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -7310,7 +7169,7 @@ ac_save_LIBS="$LIBS" LIBS="-lnsl $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:7184: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -7361,7 +7220,7 @@ fi cmu_save_LIBS="$LIBS" echo $ac_n "checking for sprint_objid in -lsnmp""... $ac_c" 1>&6 -echo "configure:7365: checking for sprint_objid in -lsnmp" >&5 +echo "configure:7224: checking for sprint_objid in -lsnmp" >&5 ac_lib_var=`echo snmp'_'sprint_objid | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -7369,7 +7228,7 @@ ac_save_LIBS="$LIBS" LIBS="-lsnmp ${LIB_SOCKET} $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:7243: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -7398,17 +7257,17 @@ ac_safe=`echo "ucd-snmp/version.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for ucd-snmp/version.h""... $ac_c" 1>&6 -echo "configure:7402: checking for ucd-snmp/version.h" >&5 +echo "configure:7261: checking for ucd-snmp/version.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:7412: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:7271: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -7438,7 +7297,7 @@ LIBS="$cmu_save_LIBS" fi echo $ac_n "checking UCD SNMP libraries""... $ac_c" 1>&6 -echo "configure:7442: checking UCD SNMP libraries" >&5 +echo "configure:7301: checking UCD SNMP libraries" >&5 echo "$ac_t""$with_ucdsnmp" 1>&6 LIB_UCDSNMP="" if test "$with_ucdsnmp" != no; then @@ -7448,7 +7307,7 @@ LIB_UCDSNMP="-lucdagent -lucdmibs -lsnmp" echo $ac_n "checking for rpmdbOpen in -lrpm""... $ac_c" 1>&6 -echo "configure:7452: checking for rpmdbOpen in -lrpm" >&5 +echo "configure:7311: checking for rpmdbOpen in -lrpm" >&5 ac_lib_var=`echo rpm'_'rpmdbOpen | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -7456,7 +7315,7 @@ ac_save_LIBS="$LIBS" LIBS="-lrpm -lpopt $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:7330: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else Index: configure.in =================================================================== RCS file: /usr/home/ume/ncvs/src/cyrus-imapd2/configure.in,v retrieving revision 1.1.1.12 retrieving revision 1.13 diff -u -r1.1.1.12 -r1.13 --- configure.in 3 Jul 2003 05:56:26 -0000 1.1.1.12 +++ configure.in 18 Aug 2003 18:36:22 -0000 1.13 @@ -118,16 +118,21 @@ CMU_SOCKETS LIBS="$LIBS ${LIB_SOCKET}" -dnl check for IPv6 functions (fall back to sasl's if we don't have them) -cyrus_cv_getaddrinfo=yes -IPv6_CHECK_FUNC(getaddrinfo, [IPv6_CHECK_FUNC(gai_strerror,[ - AC_DEFINE(HAVE_GETADDRINFO) - cyrus_cv_getaddrinfo=no])]) - -cyrus_cv_getnameinfo=yes +cyrus_cv_getaddrinfo=no +IPv6_CHECK_FUNC(getaddrinfo, + [AC_DEFINE(HAVE_GETADDRINFO)], [cyrus_cv_getaddrinfo=yes]) +if test $cyrus_cv_getaddrinfo = yes; then + LIBOBJS="$LIBOBJS getaddrinfo.o" +fi +cyrus_cv_getnameinfo=no IPv6_CHECK_FUNC(getnameinfo, - AC_DEFINE(HAVE_GETNAMEINFO), - cyrus_cv_getnameinfo=no) + [AC_DEFINE(HAVE_GETNAMEINFO)], [cyrus_cv_getnameinfo=yes]) +if test $cyrus_cv_getnameinfo = yes; then + LIBOBJS="$LIBOBJS getnameinfo.o" +fi + +IPv6_CHECK_SS_FAMILY() +IPv6_CHECK_SA_LEN() dnl this is to check for time things for sieve @@ -267,6 +272,8 @@ AC_CHECK_FUNCS(shutdown) AC_EGREP_HEADER(socklen_t, sys/socket.h, AC_DEFINE(HAVE_SOCKLEN_T)) +AC_EGREP_HEADER(sockaddr_storage, sys/socket.h, + AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE)) AC_EGREP_HEADER(rlim_t, sys/resource.h, AC_DEFINE(HAVE_RLIM_T)) dnl Bunch of setproctitle stuff Index: acap/acap.c =================================================================== RCS file: /usr/home/ume/ncvs/src/cyrus-imapd2/acap/acap.c,v retrieving revision 1.1.1.3 retrieving revision 1.4 diff -u -r1.1.1.3 -r1.4 --- acap/acap.c 2 May 2003 17:03:10 -0000 1.1.1.3 +++ acap/acap.c 2 May 2003 17:59:20 -0000 1.4 @@ -248,32 +248,30 @@ static int acap_conn_do_connect(acap_conn_t *conn, char *host, char *port) { - struct sockaddr_in addr; - struct hostent *hp; - struct servent *service; - int sock; - - if ((hp = gethostbyname(host)) == NULL) { - return ACAP_NO_CONNECTION; - } - conn->host = strdup(hp->h_name); - - if ((sock = socket(AF_INET, SOCK_STREAM, 0)) < 0) { - return ACAP_NO_CONNECTION; + struct addrinfo hints, *res0 = NULL, *res; + int err; + int sock = -1; + + memset(&hints, 0, sizeof(hints)); + hints.ai_family = PF_UNSPEC; + hints.ai_socktype = SOCK_STREAM; + hints.ai_flags = AI_CANONNAME; + if ((err = getaddrinfo(host, port, &hints, &res0)) != 0) { + return ACAP_NO_CONNECTION; + } + conn->host = strdup(res0->ai_canonname ? res0->ai_canonname : host); + + for (res = res0; res; res = res->ai_next) { + sock = socket(res->ai_family, res->ai_socktype, res->ai_protocol); + if (sock < 0) + continue; + if (connect(sock, res->ai_addr, res->ai_addrlen) >= 0) + break; + close(sock); + sock = -1; } - - addr.sin_family = AF_INET; - memcpy(&addr.sin_addr, hp->h_addr, hp->h_length); - service = getservbyname(port, "tcp"); - if (service == NULL) { - int p = atoi(port); - if (p == 0) p = ACAP_DEFAULT_PORT; - addr.sin_port = htons(p); - } else { - addr.sin_port = service->s_port; - } - - if (connect(sock, (struct sockaddr *) &addr, sizeof(addr)) < 0) { + freeaddrinfo(res0); + if (sock < 0) { return ACAP_NO_CONNECTION; } @@ -410,7 +408,7 @@ const char *mechs, sasl_callback_t *cb) { - struct sockaddr_in saddr_l, saddr_r; + struct sockaddr_storage saddr_l, saddr_r; char localip[60], remoteip[60]; sasl_security_properties_t *secprops=NULL; const char *mech; @@ -476,12 +474,10 @@ return ACAP_NO_CONNECTION; } - if(iptostring((struct sockaddr *)&saddr_l, sizeof(struct sockaddr_in), - localip, 60)) + if(iptostring((struct sockaddr *)&saddr_l, salen, localip, 60)) return ACAP_NO_CONNECTION; - if(iptostring((struct sockaddr *)&saddr_r, sizeof(struct sockaddr_in), - remoteip, 60)) + if(iptostring((struct sockaddr *)&saddr_r, salen, remoteip, 60)) return ACAP_NO_CONNECTION; r = sasl_client_new("acap", conn->host, Index: imap/backend.c =================================================================== RCS file: /usr/home/ume/ncvs/src/cyrus-imapd2/imap/backend.c,v retrieving revision 1.1.1.4 retrieving revision 1.5 diff -u -r1.1.1.4 -r1.5 --- imap/backend.c 2 May 2003 17:03:34 -0000 1.1.1.4 +++ imap/backend.c 2 May 2003 17:59:24 -0000 1.5 @@ -226,7 +226,7 @@ { int r; sasl_security_properties_t *secprops = NULL; - struct sockaddr_in saddr_l, saddr_r; + struct sockaddr_storage saddr_l, saddr_r; char remoteip[60], localip[60]; socklen_t addrsize; sasl_callback_t *cb; @@ -251,18 +251,16 @@ pass); /* set the IP addresses */ - addrsize=sizeof(struct sockaddr_in); + addrsize=sizeof(struct sockaddr_storage); if (getpeername(s->sock, (struct sockaddr *)&saddr_r, &addrsize) != 0) return SASL_FAIL; - if(iptostring((struct sockaddr *)&saddr_r, sizeof(struct sockaddr_in), - remoteip, 60) != 0) + if(iptostring((struct sockaddr *)&saddr_r, addrsize, remoteip, 60) != 0) return SASL_FAIL; - addrsize=sizeof(struct sockaddr_in); + addrsize=sizeof(struct sockaddr_storage); if (getsockname(s->sock, (struct sockaddr *)&saddr_l, &addrsize)!=0) return SASL_FAIL; - if(iptostring((struct sockaddr *)&saddr_l, sizeof(struct sockaddr_in), - localip, 60) != 0) + if(iptostring((struct sockaddr *)&saddr_l, addrsize, localip, 60) != 0) return SASL_FAIL; /* Require proxying if we have an "interesting" userid (authzid) */ @@ -354,39 +352,45 @@ const char *userid) { /* need to (re)establish connection to server or create one */ - int sock; + int sock = -1; int r; + int err; + struct addrinfo hints, *res0 = NULL, *res; if (!ret) { - struct hostent *hp; - ret = xmalloc(sizeof(struct backend)); memset(ret, 0, sizeof(struct backend)); strlcpy(ret->hostname, server, sizeof(ret->hostname)); - if ((hp = gethostbyname(server)) == NULL) { - syslog(LOG_ERR, "gethostbyname(%s) failed: %m", server); - free(ret); - return NULL; - } - ret->addr.sin_family = AF_INET; - memcpy(&ret->addr.sin_addr, hp->h_addr, hp->h_length); - ret->addr.sin_port = htons(143); - ret->timeout = NULL; } - if ((sock = socket(AF_INET, SOCK_STREAM, 0)) < 0) { - syslog(LOG_ERR, "socket() failed: %m"); + memset(&hints, 0, sizeof(hints)); + hints.ai_family = PF_UNSPEC; + hints.ai_socktype = SOCK_STREAM; + err = getaddrinfo(server, "143", &hints, &res0); + if (err) { + syslog(LOG_ERR, "getaddrinfo(%s) failed: %s", + server, gai_strerror(err)); free(ret); return NULL; } - if (connect(sock, (struct sockaddr *) &ret->addr, - sizeof(ret->addr)) < 0) { + for (res = res0; res; res = res->ai_next) { + sock = socket(res->ai_family, res->ai_socktype, res->ai_protocol); + if (sock < 0) + continue; + if (connect(sock, res->ai_addr, res->ai_addrlen) >= 0) + break; + close(sock); + sock = -1; + } + if (sock < 0) { + freeaddrinfo(res0); syslog(LOG_ERR, "connect(%s) failed: %m", server); - close(sock); free(ret); return NULL; } + memcpy(&ret->addr, res->ai_addr, res->ai_addrlen); + freeaddrinfo(res0); ret->in = prot_new(sock, 0); ret->out = prot_new(sock, 1); Index: imap/backend.h =================================================================== RCS file: /usr/home/ume/ncvs/src/cyrus-imapd2/imap/backend.h,v retrieving revision 1.1.1.3 retrieving revision 1.4 diff -u -r1.1.1.3 -r1.4 --- imap/backend.h 2 May 2003 17:03:34 -0000 1.1.1.3 +++ imap/backend.h 2 May 2003 17:59:24 -0000 1.4 @@ -53,7 +53,7 @@ struct backend { char hostname[MAX_PARTITION_LEN]; - struct sockaddr_in addr; + struct sockaddr_storage addr; int sock; /* only used by proxyd */ Index: imap/fud.c =================================================================== RCS file: /usr/home/ume/ncvs/src/cyrus-imapd2/imap/fud.c,v retrieving revision 1.1.1.9 retrieving revision 1.13 diff -u -r1.1.1.9 -r1.13 --- imap/fud.c 20 Nov 2003 17:14:28 -0000 1.1.1.9 +++ imap/fud.c 20 Nov 2003 17:43:23 -0000 1.13 @@ -88,10 +88,10 @@ extern void setproctitle_init(int argc, char **argv, char **envp); int handle_request(const char *who, const char *name, - struct sockaddr_in sfrom); + struct sockaddr_storage sfrom, socklen_t sfromsiz); -void send_reply(struct sockaddr_in sfrom, int status, - const char *user, const char *mbox, +void send_reply(struct sockaddr_storage sfrom, socklen_t sfromsiz, int status, + const char *user, const char *mbox, int numrecent, time_t lastread, time_t lastarrived); int soc = 0; /* inetd (master) has handed us the port as stdin */ @@ -102,7 +102,7 @@ int begin_handling(void) { - struct sockaddr_in sfrom; + struct sockaddr_storage sfrom; socklen_t sfromsiz = sizeof(sfrom); int r; char buf[MAXLOGNAME + MAX_MAILBOX_NAME + 1]; @@ -135,7 +135,7 @@ q = buf + off + 1; strlcpy(mbox, q, sizeof(mbox)); - handle_request(username,mbox,sfrom); + handle_request(username,mbox,sfrom,sfromsiz); } /* never reached */ @@ -228,65 +228,101 @@ /* Send a proxy request to the backend, send their reply to sfrom */ int do_proxy_request(const char *who, const char *name, const char *backend_host, - struct sockaddr_in sfrom) + struct sockaddr_storage sfrom, socklen_t sfromsiz) { char tmpbuf[1024]; - int x, rc; + int rc; int csoc = -1; - struct sockaddr_in cin, cout; - struct hostent *hp; - static int backend_port = 0; /* fud port in NETWORK BYTE ORDER */ + int error; + struct sockaddr_storage cin, cout; + struct addrinfo hints, *res0, *res; + socklen_t cinsiz, coutsiz; + static char *backend_port = NULL; /* fud port */ /* Open a UDP socket to the Cyrus mail server */ - if(!backend_port) { - struct servent *sp = getservbyname("fud", "udp"); - backend_port = sp ? sp->s_port : htons(4201); /* default fud port */ + memset(&hints, 0, sizeof(hints)); + hints.ai_family = PF_UNSPEC; + hints.ai_socktype = SOCK_DGRAM; + if (!backend_port) { + backend_port = "fud"; + error = getaddrinfo(backend_host, backend_port, &hints, &res0); + if (error == EAI_SERVICE) { + backend_port = "4201"; /* default fud port */ + error = getaddrinfo(backend_host, backend_port, &hints, &res0); + } + } else + error = getaddrinfo(backend_host, backend_port, &hints, &res0); + if (error != 0) { + send_reply(sfrom, sfromsiz, REQ_UNK, who, name, 0, 0, 0); + rc = IMAP_SERVER_UNAVAILABLE; + goto done; } - - hp = gethostbyname (backend_host); - if (!hp) { - send_reply(sfrom, REQ_UNK, who, name, 0, 0, 0); + /* + * XXX: Since UDP is used, we cannot use an IPv6->IPv4 fallback + * strategy, here. So, when we can use same address family with + * incoming packet, just try it. When same address family is not + * found in DNS, we try another one. + */ + csoc = -1; + for (res = res0; res; res = res->ai_next) { + if (res->ai_family == sfrom.ss_family) { + csoc = socket(res->ai_family, res->ai_socktype, res->ai_protocol); + break; + } + } + if (csoc < 0) { + for (res = res0; res; res = res->ai_next) { + if (res->ai_family != sfrom.ss_family && + (res->ai_family == AF_INET || res->ai_family == AF_INET6)) { + csoc = socket(res->ai_family, res->ai_socktype, + res->ai_protocol); + break; + } + } + } + if (csoc < 0) { + send_reply(sfrom, sfromsiz, REQ_UNK, who, name, 0, 0, 0); rc = IMAP_SERVER_UNAVAILABLE; + freeaddrinfo(res0); goto done; } - - csoc = socket (PF_INET, SOCK_DGRAM, 0); - memcpy (&cin.sin_addr.s_addr, hp->h_addr, hp->h_length); - cin.sin_family = AF_INET; - cin.sin_port = backend_port; + memcpy(&cin, res->ai_addr, res->ai_addrlen); + cinsiz = res->ai_addrlen; + freeaddrinfo(res0); /* Write a Cyrus query into *tmpbuf */ memset (tmpbuf, '\0', sizeof(tmpbuf)); snprintf (tmpbuf, sizeof(tmpbuf), "%s|%s", who, name); - x = sizeof (cin); /* Send the query and wait for a reply */ - sendto (csoc, tmpbuf, strlen (tmpbuf), 0, (struct sockaddr *) &cin, x); + sendto (csoc, tmpbuf, strlen (tmpbuf), 0, + (struct sockaddr *) &cin, cinsiz); memset (tmpbuf, '\0', strlen (tmpbuf)); if(setsigalrm(1) < 0) { rc = IMAP_SERVER_UNAVAILABLE; - send_reply(sfrom, REQ_UNK, who, name, 0, 0, 0); + send_reply(sfrom, sfromsiz, REQ_UNK, who, name, 0, 0, 0); goto done; } rc = 0; + coutsiz = sizeof (cout); alarm (1); rc = recvfrom (csoc, tmpbuf, sizeof(tmpbuf), 0, - (struct sockaddr *) &cout, &x); + (struct sockaddr *) &cout, &coutsiz); alarm (0); setsigalrm(0); /* Failure isn't really terrible here */ if (rc < 1) { rc = IMAP_SERVER_UNAVAILABLE; - send_reply(sfrom, REQ_UNK, who, name, 0, 0, 0); + send_reply(sfrom, sfromsiz, REQ_UNK, who, name, 0, 0, 0); goto done; } /* Send reply back */ /* rc is size */ - sendto(soc,tmpbuf,rc,0,(struct sockaddr *) &sfrom, sizeof(sfrom)); + sendto(soc, tmpbuf, rc, 0, (struct sockaddr *) &sfrom, sfromsiz); rc = 0; done: @@ -295,7 +331,7 @@ } int handle_request(const char *who, const char *name, - struct sockaddr_in sfrom) + struct sockaddr_storage sfrom, socklen_t sfromsiz) { int r; struct mailbox mailbox; @@ -318,7 +354,7 @@ r = mboxlist_detail(mboxname, &mbflag, &location, NULL, &acl, NULL); if(r || mbflag & MBTYPE_RESERVE) { - send_reply(sfrom, REQ_UNK, who, name, 0, 0, 0); + send_reply(sfrom, sfromsiz, REQ_UNK, who, name, 0, 0, 0); return r; } @@ -335,11 +371,11 @@ if(cyrus_acl_myrights(mystate, acl) & ACL_USER0) { /* We want to proxy this one */ auth_freestate(mystate); - return do_proxy_request(who, name, location, sfrom); + return do_proxy_request(who, name, location, sfrom, sfromsiz); } else { /* Permission Denied */ auth_freestate(mystate); - send_reply(sfrom, REQ_DENY, who, name, 0, 0, 0); + send_reply(sfrom, sfromsiz, REQ_DENY, who, name, 0, 0, 0); return 0; } } @@ -349,20 +385,20 @@ */ r = mailbox_open_header(mboxname, NULL, &mailbox); if (r) { - send_reply(sfrom, REQ_UNK, who, name, 0, 0, 0); + send_reply(sfrom, sfromsiz, REQ_UNK, who, name, 0, 0, 0); return r; } r = mailbox_open_index(&mailbox); if (r) { mailbox_close(&mailbox); - send_reply(sfrom, REQ_UNK, who, name, 0, 0, 0); + send_reply(sfrom, sfromsiz, REQ_UNK, who, name, 0, 0, 0); return r; } if(!(strncmp(mboxname,"user.",5)) && !(mailbox.myrights & ACL_USER0)) { mailbox_close(&mailbox); - send_reply(sfrom, REQ_DENY, who, name, 0, 0, 0); + send_reply(sfrom, sfromsiz, REQ_DENY, who, name, 0, 0, 0); return 0; } @@ -370,7 +406,7 @@ /* mailbox_close(&mailbox); - send_reply(sfrom, REQ_UNK, who, name, 0, 0, 0); + send_reply(sfrom, sfromsiz, REQ_UNK, who, name, 0, 0, 0); return r; } */ @@ -382,7 +418,7 @@ seen_close(seendb); if (r) { mailbox_close(&mailbox); - send_reply(sfrom, REQ_UNK, who, name, 0, 0, 0); + send_reply(sfrom, sfromsiz, REQ_UNK, who, name, 0, 0, 0); return r; } } else { @@ -415,13 +451,14 @@ mailbox_close(&mailbox); - send_reply(sfrom, REQ_OK, who, name, numrecent, lastread, lastarrived); + send_reply(sfrom, sfromsiz, REQ_OK, who, name, + numrecent, lastread, lastarrived); return(0); } void -send_reply(struct sockaddr_in sfrom, int status, +send_reply(struct sockaddr_storage sfrom, socklen_t sfromsiz, int status, const char *user, const char *mbox, int numrecent, time_t lastread, time_t lastarrived) { @@ -430,14 +467,14 @@ switch(status) { case REQ_DENY: - sendto(soc,"PERMDENY",9,0,(struct sockaddr *) &sfrom, sizeof(sfrom)); + sendto(soc,"PERMDENY",9,0,(struct sockaddr *) &sfrom, sfromsiz); break; case REQ_OK: siz = snprintf(buf, sizeof(buf), "%s|%s|%d|%d|%d",user,mbox,numrecent,(int) lastread,(int) lastarrived); - sendto(soc,buf,siz,0,(struct sockaddr *) &sfrom, sizeof(sfrom)); + sendto(soc,buf,siz,0,(struct sockaddr *) &sfrom, sfromsiz); break; case REQ_UNK: - sendto(soc,"UNKNOWN",8,0,(struct sockaddr *) &sfrom, sizeof(sfrom)); + sendto(soc,"UNKNOWN",8,0,(struct sockaddr *) &sfrom, sfromsiz); break; } } Index: imap/imapd.c =================================================================== RCS file: /usr/home/ume/ncvs/src/cyrus-imapd2/imap/imapd.c,v retrieving revision 1.1.1.14 retrieving revision 1.15 diff -u -r1.1.1.14 -r1.15 --- imap/imapd.c 20 Nov 2003 17:14:28 -0000 1.1.1.14 +++ imap/imapd.c 20 Nov 2003 17:26:13 -0000 1.15 @@ -107,7 +107,7 @@ /* per-user/session state */ struct protstream *imapd_out = NULL; struct protstream *imapd_in = NULL; -static char imapd_clienthost[250] = "[local]"; +static char imapd_clienthost[NI_MAXHOST*2+1] = "[local]"; static int imapd_logfd = -1; char *imapd_userid; struct auth_state *imapd_authstate = 0; @@ -597,11 +597,11 @@ #endif { socklen_t salen; - struct hostent *hp; int timeout; sasl_security_properties_t *secprops = NULL; - struct sockaddr_in imapd_localaddr, imapd_remoteaddr; + struct sockaddr_storage imapd_localaddr, imapd_remoteaddr; char localip[60], remoteip[60]; + char hbuf[NI_MAXHOST]; int imapd_haveaddr = 0; signals_poll(); @@ -617,26 +617,25 @@ /* Find out name of client host */ salen = sizeof(imapd_remoteaddr); if (getpeername(0, (struct sockaddr *)&imapd_remoteaddr, &salen) == 0 && - imapd_remoteaddr.sin_family == AF_INET) { - hp = gethostbyaddr((char *)&imapd_remoteaddr.sin_addr, - sizeof(imapd_remoteaddr.sin_addr), AF_INET); - if (hp != NULL) { - strncpy(imapd_clienthost, hp->h_name, sizeof(imapd_clienthost)-30); - imapd_clienthost[sizeof(imapd_clienthost)-30] = '\0'; - } else { + (imapd_remoteaddr.ss_family == AF_INET || + imapd_remoteaddr.ss_family == AF_INET6)) { + if (getnameinfo((struct sockaddr *)&imapd_remoteaddr, salen, + hbuf, sizeof(hbuf), NULL, 0, NI_NAMEREQD) == 0) { + strncpy(imapd_clienthost, hbuf, sizeof(hbuf)); + } + else { imapd_clienthost[0] = '\0'; } + getnameinfo((struct sockaddr *)&imapd_remoteaddr, salen, hbuf, + sizeof(hbuf), NULL, 0, NI_NUMERICHOST | NI_WITHSCOPEID); strlcat(imapd_clienthost, "[", sizeof(imapd_clienthost)); - strlcat(imapd_clienthost, inet_ntoa(imapd_remoteaddr.sin_addr), - sizeof(imapd_clienthost)); + strlcat(imapd_clienthost, hbuf, sizeof(imapd_clienthost)); strlcat(imapd_clienthost, "]", sizeof(imapd_clienthost)); salen = sizeof(imapd_localaddr); if (getsockname(0, (struct sockaddr *)&imapd_localaddr, &salen) == 0) { - if(iptostring((struct sockaddr *)&imapd_remoteaddr, - sizeof(struct sockaddr_in), + if(iptostring((struct sockaddr *)&imapd_remoteaddr, salen, remoteip, sizeof(remoteip)) == 0 - && iptostring((struct sockaddr *)&imapd_localaddr, - sizeof(struct sockaddr_in), + && iptostring((struct sockaddr *)&imapd_localaddr, salen, localip, sizeof(localip)) == 0) { imapd_haveaddr = 1; } Index: imap/lmtpengine.c =================================================================== RCS file: /usr/home/ume/ncvs/src/cyrus-imapd2/imap/lmtpengine.c,v retrieving revision 1.1.1.12 retrieving revision 1.13 diff -u -r1.1.1.12 -r1.13 --- imap/lmtpengine.c 20 Nov 2003 17:14:29 -0000 1.1.1.12 +++ imap/lmtpengine.c 20 Nov 2003 17:26:13 -0000 1.13 @@ -1223,10 +1223,11 @@ int r; struct clientdata cd; - struct sockaddr_in localaddr, remoteaddr; + struct sockaddr_storage localaddr, remoteaddr; int havelocal = 0, haveremote = 0; char localip[60], remoteip[60]; socklen_t salen; + char hbuf[NI_MAXHOST]; sasl_ssf_t ssf; char *auth_id; @@ -1270,34 +1271,29 @@ /* determine who we're talking to */ salen = sizeof(remoteaddr); r = getpeername(fd, (struct sockaddr *)&remoteaddr, &salen); - if (!r && remoteaddr.sin_family == AF_INET) { + if (!r && + (remoteaddr.ss_family == AF_INET || remoteaddr.ss_family == AF_INET6) + ) { /* connected to an internet socket */ - struct hostent *hp; - hp = gethostbyaddr((char *)&remoteaddr.sin_addr, - sizeof(remoteaddr.sin_addr), AF_INET); - if (hp != NULL) { - strlcpy(cd.clienthost, hp->h_name, sizeof(cd.clienthost) - 30); - } else { - strlcpy(cd.clienthost, inet_ntoa(remoteaddr.sin_addr), - sizeof(cd.clienthost) - 30); - } + getnameinfo((struct sockaddr *)&remoteaddr, salen, hbuf, sizeof(hbuf), + NULL, 0, NI_WITHSCOPEID); + strlcpy(cd.clienthost, hbuf, sizeof(cd.clienthost) - 30); strlcat(cd.clienthost, " [", sizeof(cd.clienthost)); - strlcat(cd.clienthost, inet_ntoa(remoteaddr.sin_addr), - sizeof(cd.clienthost)); + getnameinfo((struct sockaddr *)&remoteaddr, salen, hbuf, sizeof(hbuf), + NULL, 0, NI_NUMERICHOST | NI_WITHSCOPEID); + strlcat(cd.clienthost, hbuf, sizeof(cd.clienthost)); strlcat(cd.clienthost, "]", sizeof(cd.clienthost)); salen = sizeof(localaddr); if (!getsockname(fd, (struct sockaddr *)&localaddr, &salen)) { /* set the ip addresses here */ - if(iptostring((struct sockaddr *)&localaddr, - sizeof(struct sockaddr_in), - localip, sizeof(localip)) == 0) { + if(iptostring((struct sockaddr *)&localaddr, salen, + localip, sizeof(localip)) == 0) { havelocal = 1; saslprops.iplocalport = xstrdup(localip); } - if(iptostring((struct sockaddr *)&remoteaddr, - sizeof(struct sockaddr_in), - remoteip, sizeof(remoteip)) == 0) { + if(iptostring((struct sockaddr *)&remoteaddr, salen, + remoteip, sizeof(remoteip)) == 0) { haveremote = 1; saslprops.ipremoteport = xstrdup(remoteip); } @@ -1443,12 +1439,15 @@ else { sleep(3); + if (remoteaddr.ss_family == AF_INET || + remoteaddr.ss_family == AF_INET6) + getnameinfo((struct sockaddr *)&remoteaddr, + salen, hbuf, sizeof(hbuf), NULL, 0, + NI_NUMERICHOST | NI_WITHSCOPEID); + else + strlcpy(hbuf, "[unix socket]", sizeof(hbuf)); syslog(LOG_ERR, "badlogin: %s %s %s", - remoteaddr.sin_family == AF_INET ? - inet_ntoa(remoteaddr.sin_addr) : - "[unix socket]", - mech, - sasl_errdetail(cd.conn)); + hbuf, mech, sasl_errdetail(cd.conn)); snmp_increment_args(AUTHENTICATION_NO, 1, VARIABLE_AUTH, hash_simple(mech), @@ -2054,8 +2053,8 @@ int r; const int AUTH_ERROR = 420, AUTH_OK = 250; sasl_security_properties_t *secprops = NULL; - struct sockaddr_in saddr_l; - struct sockaddr_in saddr_r; + struct sockaddr_storage saddr_l; + struct sockaddr_storage saddr_r; socklen_t addrsize; char buf[2048]; char *in; @@ -2075,14 +2074,14 @@ } /* set the IP addresses */ - addrsize=sizeof(struct sockaddr_in); + addrsize=sizeof(struct sockaddr_storage); if (getpeername(conn->sock, (struct sockaddr *)&saddr_r, &addrsize) != 0) { syslog(LOG_ERR, "lmtpengine do_auth: getpeername() failed"); return AUTH_ERROR; } - addrsize=sizeof(struct sockaddr_in); + addrsize=sizeof(struct sockaddr_storage); if (getsockname(conn->sock, (struct sockaddr *)&saddr_l,&addrsize)!=0) { syslog(LOG_ERR, "lmtpengine do_auth: getsockname() failed"); @@ -2091,16 +2090,14 @@ if (iptostring((struct sockaddr *)&saddr_r, - sizeof(struct sockaddr_in), - remoteip, sizeof(remoteip)) != 0) { + addrsize, remoteip, sizeof(remoteip)) != 0) { syslog(LOG_ERR, "lmtpengine do_auth: iptostring() (remote) failed"); return AUTH_ERROR; } if (iptostring((struct sockaddr *)&saddr_l, - sizeof(struct sockaddr_in), - localip, sizeof(localip)) != 0) { + addrsize, localip, sizeof(localip)) != 0) { syslog(LOG_ERR, "lmtpengine do_auth: iptostring() (local) failed"); return AUTH_ERROR; @@ -2229,47 +2226,47 @@ free(host); host = xstrdup(config_servername); } else { - struct hostent *hp; - struct sockaddr_in addr; - struct servent *service; + struct addrinfo hints, *res0 = NULL, *res; + int err; char *p; - p = strchr(host, ':'); + if (*host == '[' && (p = strchr(host + 1, ']')) != NULL && + (*++p == '\0' || *p == ':')) { + host++; + *(p - 1) = '\0'; + if (*p != ':') + p = NULL; + } else + p = strchr(host, ':'); if (p) { *p++ = '\0'; } else { p = "lmtp"; } - if ((hp = gethostbyname(host)) == NULL) { - syslog(LOG_ERR, "gethostbyname(%s) failed", host); - goto errsock; - } - - /* open inet socket */ - if ((sock = socket(AF_INET, SOCK_STREAM, 0)) < 0) { - syslog(LOG_ERR, "socket() failed: %m"); + memset(&hints, 0, sizeof(hints)); + hints.ai_family = PF_UNSPEC; + hints.ai_socktype = SOCK_STREAM; + err = getaddrinfo(host, p, &hints, &res0); + if (err) { + syslog(LOG_ERR, "getaddrinfo(%s, %s) failed: %s", + host, p, gai_strerror(err)); goto errsock; } - - addr.sin_family = AF_INET; - memcpy(&addr.sin_addr, hp->h_addr, hp->h_length); - service = getservbyname(p, "tcp"); - if (service) { - addr.sin_port = service->s_port; - } else { - int pn = atoi(p); - if (pn == 0) { - syslog(LOG_ERR, "couldn't find valid lmtp port"); - goto errsock; - } - addr.sin_port = htons(pn); + for (res = res0; res; res = res->ai_next) { + sock = socket(res->ai_family, res->ai_socktype, res->ai_protocol); + if (sock < 0) + continue; + if (connect(sock, res->ai_addr, res->ai_addrlen) >= 0) + break; + close(sock); + sock = -1; } - - if (connect(sock, (struct sockaddr *) &addr, sizeof(addr)) < 0) { + freeaddrinfo(res0); + if (sock < 0) { syslog(LOG_ERR, "connect(%s:%s) failed: %m", host, p); goto errsock; - } + } } conn = xmalloc(sizeof(struct lmtp_conn)); Index: imap/mupdate-client.c =================================================================== RCS file: /usr/home/ume/ncvs/src/cyrus-imapd2/imap/mupdate-client.c,v retrieving revision 1.1.1.8 retrieving revision 1.9 diff -u -r1.1.1.8 -r1.9 --- imap/mupdate-client.c 3 Jul 2003 05:56:39 -0000 1.1.1.8 +++ imap/mupdate-client.c 18 Aug 2003 19:42:21 -0000 1.9 @@ -100,8 +100,8 @@ int saslresult; sasl_security_properties_t *secprops=NULL; socklen_t addrsize; - struct sockaddr_in saddr_l; - struct sockaddr_in saddr_r; + struct sockaddr_storage saddr_l; + struct sockaddr_storage saddr_r; char localip[60], remoteip[60]; const char *out; unsigned int outlen; @@ -121,19 +121,19 @@ if(saslresult != SASL_OK) return 1; free(secprops); - addrsize=sizeof(struct sockaddr_in); + addrsize=sizeof(struct sockaddr_storage); if (getpeername(h->sock,(struct sockaddr *)&saddr_r,&addrsize)!=0) return 1; - addrsize=sizeof(struct sockaddr_in); + addrsize=sizeof(struct sockaddr_storage); if (getsockname(h->sock,(struct sockaddr *)&saddr_l,&addrsize)!=0) return 1; - if(iptostring((const struct sockaddr *)&saddr_l, sizeof(struct sockaddr_in), + if(iptostring((const struct sockaddr *)&saddr_l, addrsize, localip, 60) != 0) return 1; - if(iptostring((const struct sockaddr *)&saddr_r, sizeof(struct sockaddr_in), + if(iptostring((const struct sockaddr *)&saddr_r, addrsize, remoteip, 60) != 0) return 1; @@ -240,10 +240,9 @@ sasl_callback_t *cbs) { mupdate_handle *h = NULL; + struct addrinfo hints, *res0, *res; + int err; int local_cbs = 0; - struct hostent *hp; - struct servent *sp; - struct sockaddr_in addr; int s, saslresult; char buf[4096]; char *mechlist = NULL; @@ -262,37 +261,32 @@ port = config_getstring("mupdate_port",NULL); } - hp = gethostbyname(server); - if (!hp) { - syslog(LOG_ERR, "mupdate-client: gethostbyname %s failed: %m", server); + memset(&hints, 0, sizeof(hints)); + hints.ai_family = PF_UNSPEC; + hints.ai_socktype = SOCK_STREAM; + err = getaddrinfo(server, port, &hints, &res0); + if (err == EAI_SERVICE) { + err = getaddrinfo(server, "mupdate", &hints, &res0); + if (err == EAI_SERVICE) + err = getaddrinfo(server, "2004", &hints, &res0); + } + if (err) { + syslog(LOG_ERR, "mupdate-client: getaddrinfo(%s, %s) failed: %s", + server, port, gai_strerror(err)); return MUPDATE_NOCONN; } - - s = socket(AF_INET, SOCK_STREAM, 0); - if (s == -1) { - syslog(LOG_ERR, "mupdate-client: socket(): %m"); - return MUPDATE_NOCONN; - } - - addr.sin_family = AF_INET; - memcpy(&addr.sin_addr, hp->h_addr, sizeof(addr.sin_addr)); - - if (port && imparse_isnumber(port)) { - addr.sin_port = htons(atoi(port)); - } else if (port) { - sp = getservbyname(port, "tcp"); - if (!sp) { - syslog(LOG_ERR, "mupdate-client: getservbyname(tcp, %s): %m", - port); - } - addr.sin_port = sp->s_port; - } else if((sp = getservbyname("mupdate", "tcp")) != NULL) { - addr.sin_port = sp->s_port; - } else { - addr.sin_port = htons(2004); + s = -1; + for (res = res0; res; res = res->ai_next) { + s = socket(res->ai_family, res->ai_socktype, res->ai_protocol); + if (s < 0) + continue; + if (connect(s, res->ai_addr, res->ai_addrlen) >= 0) + break; + close(s); + s = -1; } - - if (connect(s, (struct sockaddr *)&addr, sizeof(addr)) == -1) { + freeaddrinfo(res0); + if (s < 0) { syslog(LOG_ERR, "mupdate-client: connect(%s): %m", server); return MUPDATE_NOCONN; } Index: imap/mupdate.c =================================================================== RCS file: /usr/home/ume/ncvs/src/cyrus-imapd2/imap/mupdate.c,v retrieving revision 1.1.1.10 retrieving revision 1.11 diff -u -r1.1.1.10 -r1.11 --- imap/mupdate.c 18 Aug 2003 17:43:52 -0000 1.1.1.10 +++ imap/mupdate.c 18 Aug 2003 19:23:34 -0000 1.11 @@ -675,14 +675,14 @@ void *start(void *rock) { struct conn *c = (struct conn *) rock; - struct sockaddr_in localaddr, remoteaddr; + struct sockaddr_storage localaddr, remoteaddr; int haveaddr = 0; int salen; int secflags, plaintext_result; sasl_security_properties_t *secprops = NULL; char localip[60], remoteip[60]; char clienthost[250]; - struct hostent *hp; + char hbuf[NI_MAXHOST]; pthread_mutex_lock(&ready_for_connections_mutex); /* are we ready to take connections? */ @@ -702,25 +702,22 @@ /* Find out name of client host */ salen = sizeof(remoteaddr); if (getpeername(c->fd, (struct sockaddr *)&remoteaddr, &salen) == 0 && - remoteaddr.sin_family == AF_INET) { - hp = gethostbyaddr((char *)&remoteaddr.sin_addr, - sizeof(remoteaddr.sin_addr), AF_INET); - if (hp != NULL) { - strncpy(clienthost, hp->h_name, sizeof(clienthost)-30); - clienthost[sizeof(clienthost)-30] = '\0'; - } else { - clienthost[0] = '\0'; - } - strlcat(clienthost, "[", sizeof(clienthost)); - strlcat(clienthost, inet_ntoa(remoteaddr.sin_addr), - sizeof(clienthost)); + (remoteaddr.ss_family == AF_INET || remoteaddr.ss_family == AF_INET6) + ) { + getnameinfo((struct sockaddr *)&remoteaddr, salen, hbuf, sizeof(hbuf), + NULL, 0, NI_WITHSCOPEID); + strlcpy(clienthost, hbuf, sizeof(clienthost)-30); + strlcat(clienthost, " [", sizeof(clienthost)); + getnameinfo((struct sockaddr *)&remoteaddr, salen, hbuf, sizeof(hbuf), + NULL, 0, NI_NUMERICHOST | NI_WITHSCOPEID); + strlcat(clienthost, hbuf, sizeof(clienthost)); strlcat(clienthost, "]", sizeof(clienthost)); salen = sizeof(localaddr); if (getsockname(c->fd, (struct sockaddr *)&localaddr, &salen) == 0 && iptostring((struct sockaddr *)&remoteaddr, - sizeof(struct sockaddr_in), remoteip, 60) == 0 + salen, remoteip, 60) == 0 && iptostring((struct sockaddr *)&localaddr, - sizeof(struct sockaddr_in), localip, 60) == 0) { + salen, localip, 60) == 0) { haveaddr = 1; } } Index: imap/pop3d.c =================================================================== RCS file: /usr/home/ume/ncvs/src/cyrus-imapd2/imap/pop3d.c,v retrieving revision 1.1.1.12 retrieving revision 1.14 diff -u -r1.1.1.12 -r1.14 --- imap/pop3d.c 20 Nov 2003 17:14:30 -0000 1.1.1.12 +++ imap/pop3d.c 20 Nov 2003 17:26:13 -0000 1.14 @@ -110,9 +110,9 @@ char *popd_userid = 0; struct mailbox *popd_mailbox = 0; -struct sockaddr_in popd_localaddr, popd_remoteaddr; +struct sockaddr_storage popd_localaddr, popd_remoteaddr; int popd_haveaddr = 0; -char popd_clienthost[250] = "[local]"; +char popd_clienthost[NI_MAXHOST*2+1] = "[local]"; struct protstream *popd_out = NULL; struct protstream *popd_in = NULL; unsigned popd_exists = 0; @@ -321,7 +321,7 @@ int service_main(int argc, char **argv, char **envp) { socklen_t salen; - struct hostent *hp; + char hbuf[NI_MAXHOST]; char localip[60], remoteip[60]; int timeout; sasl_security_properties_t *secprops=NULL; @@ -334,17 +334,19 @@ /* Find out name of client host */ salen = sizeof(popd_remoteaddr); if (getpeername(0, (struct sockaddr *)&popd_remoteaddr, &salen) == 0 && - popd_remoteaddr.sin_family == AF_INET) { - hp = gethostbyaddr((char *)&popd_remoteaddr.sin_addr, - sizeof(popd_remoteaddr.sin_addr), AF_INET); - if (hp != NULL) { - strncpy(popd_clienthost, hp->h_name, sizeof(popd_clienthost)-30); - popd_clienthost[sizeof(popd_clienthost)-30] = '\0'; - } else { + (popd_remoteaddr.ss_family == AF_INET || + popd_remoteaddr.ss_family == AF_INET6)) { + if (getnameinfo((struct sockaddr *)&popd_remoteaddr, salen, + hbuf, sizeof(hbuf), NULL, 0, NI_NAMEREQD) == 0) { + strncpy(popd_clienthost, hbuf, sizeof(hbuf)); + } + else { popd_clienthost[0] = '\0'; } + getnameinfo((struct sockaddr *)&popd_remoteaddr, salen, hbuf, + sizeof(hbuf), NULL, 0, NI_NUMERICHOST | NI_WITHSCOPEID); strcat(popd_clienthost, "["); - strcat(popd_clienthost, inet_ntoa(popd_remoteaddr.sin_addr)); + strcat(popd_clienthost, hbuf); strcat(popd_clienthost, "]"); salen = sizeof(popd_localaddr); if (getsockname(0, (struct sockaddr *)&popd_localaddr, &salen) == 0) { @@ -361,14 +363,14 @@ secprops = mysasl_secprops(SASL_SEC_NOPLAINTEXT); sasl_setprop(popd_saslconn, SASL_SEC_PROPS, secprops); - if(iptostring((struct sockaddr *)&popd_localaddr, - sizeof(struct sockaddr_in), localip, 60) == 0) { + if(iptostring((struct sockaddr *)&popd_localaddr, salen, + localip, 60) == 0) { sasl_setprop(popd_saslconn, SASL_IPLOCALPORT, localip); saslprops.iplocalport = xstrdup(localip); } - if(iptostring((struct sockaddr *)&popd_remoteaddr, - sizeof(struct sockaddr_in), remoteip, 60) == 0) { + if(iptostring((struct sockaddr *)&popd_remoteaddr, salen, + remoteip, 60) == 0) { sasl_setprop(popd_saslconn, SASL_IPREMOTEPORT, remoteip); saslprops.ipremoteport = xstrdup(remoteip); } @@ -471,6 +473,40 @@ } #ifdef HAVE_KRB +/* translate IPv4 mapped IPv6 address to IPv4 address */ +#ifdef IN6_IS_ADDR_V4MAPPED +static void sockaddr_unmapped(struct sockaddr *sa, socklen_t *len) +{ + struct sockaddr_in6 *sin6; + struct sockaddr_in *sin4; + uint32_t addr; + int port; + + if (sa->sa_family != AF_INET6) + return; + sin6 = (struct sockaddr_in6 *)sa; + if (!IN6_IS_ADDR_V4MAPPED((&sin6->sin6_addr))) + return; + sin4 = (struct sockaddr_in *)sa; + addr = *(uint32_t *)&sin6->sin6_addr.s6_addr[12]; + port = sin6->sin6_port; + memset(sin4, 0, sizeof(struct sockaddr_in)); + sin4->sin_addr.s_addr = addr; + sin4->sin_port = port; + sin4->sin_family = AF_INET; +#ifdef HAVE_SOCKADDR_SA_LEN + sin4->sin_len = sizeof(struct sockaddr_in); +#endif + *len = sizeof(struct sockaddr_in); +} +#else +static void sockaddr_unmapped(struct sockaddr *sa __attribute__((unused)), + socklen_t *len __attribute__((unused))) +{ + return; +} +#endif + /* * MIT's kludge of a kpop protocol * Client does a krb_sendauth() first thing @@ -483,6 +519,7 @@ char version[9]; const char *srvtab; int r; + socklen_t len; if (!popd_haveaddr) { fatal("Cannot get client's IP address", EC_OSERR); @@ -490,9 +527,18 @@ srvtab = config_getstring("srvtab", ""); + sockaddr_unmapped((struct sockaddr *)&popd_remoteaddr, &len); + if (popd_remoteaddr.ss_family != AF_INET) { + prot_printf(popd_out, + "-ERR [AUTH] Kerberos authentication failure: %s\r\n", + "not an IPv4 connection"); + shut_down(0); + } + strcpy(instance, "*"); r = krb_recvauth(0L, 0, &ticket, "pop", instance, - &popd_remoteaddr, (struct sockaddr_in *) NULL, + (struct sockaddr_in *) &popd_remoteaddr, + (struct sockaddr_in *) NULL, &kdata, (char*) srvtab, schedule, version); if (r) { Index: imap/pop3proxyd.c =================================================================== RCS file: /usr/home/ume/ncvs/src/cyrus-imapd2/imap/pop3proxyd.c,v retrieving revision 1.1.1.11 retrieving revision 1.13 diff -u -r1.1.1.11 -r1.13 --- imap/pop3proxyd.c 18 Aug 2003 17:43:52 -0000 1.1.1.11 +++ imap/pop3proxyd.c 18 Aug 2003 19:23:34 -0000 1.13 @@ -107,9 +107,9 @@ sasl_conn_t *popd_saslconn; /* the sasl connection context */ char *popd_userid = 0; -struct sockaddr_in popd_localaddr, popd_remoteaddr; +struct sockaddr_storage popd_localaddr, popd_remoteaddr; int popd_haveaddr = 0; -char popd_clienthost[250] = "[local]"; +char popd_clienthost[NI_MAXHOST*2+1] = "[local]"; static int popd_logfd = -1; struct protstream *popd_out = NULL; struct protstream *popd_in = NULL; @@ -223,7 +223,7 @@ int pop3s = 0; int opt; socklen_t salen; - struct hostent *hp; + char hbuf[NI_MAXHOST]; char localip[60], remoteip[60]; int timeout; sasl_security_properties_t *secprops=NULL; @@ -254,17 +254,19 @@ /* Find out name of client host */ salen = sizeof(popd_remoteaddr); if (getpeername(0, (struct sockaddr *)&popd_remoteaddr, &salen) == 0 && - popd_remoteaddr.sin_family == AF_INET) { - hp = gethostbyaddr((char *)&popd_remoteaddr.sin_addr, - sizeof(popd_remoteaddr.sin_addr), AF_INET); - if (hp != NULL) { - strncpy(popd_clienthost, hp->h_name, sizeof(popd_clienthost)-30); - popd_clienthost[sizeof(popd_clienthost)-30] = '\0'; - } else { + (popd_remoteaddr.ss_family == AF_INET || + popd_remoteaddr.ss_family == AF_INET6)) { + if (getnameinfo((struct sockaddr *)&popd_remoteaddr, salen, + hbuf, sizeof(hbuf), NULL, 0, NI_NAMEREQD) == 0) { + strncpy(popd_clienthost, hbuf, sizeof(hbuf)); + } + else { popd_clienthost[0] = '\0'; } + getnameinfo((struct sockaddr *)&popd_remoteaddr, salen, hbuf, + sizeof(hbuf), NULL, 0, NI_NUMERICHOST | NI_WITHSCOPEID); strcat(popd_clienthost, "["); - strcat(popd_clienthost, inet_ntoa(popd_remoteaddr.sin_addr)); + strcat(popd_clienthost, hbuf); strcat(popd_clienthost, "]"); salen = sizeof(popd_localaddr); if (getsockname(0, (struct sockaddr *)&popd_localaddr, &salen) == 0) { @@ -281,13 +283,13 @@ secprops = mysasl_secprops(SASL_SEC_NOPLAINTEXT); sasl_setprop(popd_saslconn, SASL_SEC_PROPS, secprops); - if(iptostring((struct sockaddr *)&popd_localaddr, - sizeof(struct sockaddr_in), localip, 60) == 0) { + if(iptostring((struct sockaddr *)&popd_localaddr, salen, + localip, 60) == 0) { sasl_setprop(popd_saslconn, SASL_IPLOCALPORT, localip); saslprops.iplocalport = xstrdup(localip); } - if(iptostring((struct sockaddr *)&popd_remoteaddr, - sizeof(struct sockaddr_in), remoteip, 60) == 0) { + if(iptostring((struct sockaddr *)&popd_remoteaddr, salen, + remoteip, 60) == 0) { sasl_setprop(popd_saslconn, SASL_IPREMOTEPORT, remoteip); saslprops.ipremoteport = xstrdup(remoteip); } @@ -414,6 +416,40 @@ } #ifdef HAVE_KRB +/* translate IPv4 mapped IPv6 address to IPv4 address */ +#ifdef IN6_IS_ADDR_V4MAPPED +static void sockaddr_unmapped(struct sockaddr *sa, socklen_t *len) +{ + struct sockaddr_in6 *sin6; + struct sockaddr_in *sin4; + uint32_t addr; + int port; + + if (sa->sa_family != AF_INET6) + return; + sin6 = (struct sockaddr_in6 *)sa; + if (!IN6_IS_ADDR_V4MAPPED((&sin6->sin6_addr))) + return; + sin4 = (struct sockaddr_in *)sa; + addr = *(uint32_t *)&sin6->sin6_addr.s6_addr[12]; + port = sin6->sin6_port; + memset(sin4, 0, sizeof(struct sockaddr_in)); + sin4->sin_addr.s_addr = addr; + sin4->sin_port = port; + sin4->sin_family = AF_INET; +#ifdef HAVE_SOCKADDR_SA_LEN + sin4->sin_len = sizeof(struct sockaddr_in); +#endif + *len = sizeof(struct sockaddr_in); +} +#else +static void sockaddr_unmapped(struct sockaddr *sa __attribute__((unused)), + socklen_t *len __attribute__((unused))) +{ + return; +} +#endif + /* * MIT's kludge of a kpop protocol * Client does a krb_sendauth() first thing @@ -426,6 +462,7 @@ char version[9]; const char *srvtab; int r; + socklen_t len; if (!popd_haveaddr) { fatal("Cannot get client's IP address", EC_OSERR); @@ -433,9 +470,18 @@ srvtab = config_getstring("srvtab", ""); + sockaddr_unmapped((struct sockaddr *)&popd_remoteaddr, &len); + if (popd_remoteaddr.ss_family != AF_INET) { + prot_printf(popd_out, + "-ERR [AUTH] Kerberos authentication failure: %s\r\n", + "not an IPv4 connection"); + shut_down(0); + } + strcpy(instance, "*"); r = krb_recvauth(0L, 0, &ticket, "pop", instance, - &popd_remoteaddr, (struct sockaddr_in *) NULL, + (struct sockaddr_in *) &popd_remoteaddr, + (struct sockaddr_in *) NULL, &kdata, (char*) srvtab, schedule, version); if (r) { @@ -1099,8 +1145,8 @@ { int r; sasl_security_properties_t *secprops = NULL; - struct sockaddr_in saddr_l; - struct sockaddr_in saddr_r; + struct sockaddr_storage saddr_l; + struct sockaddr_storage saddr_r; socklen_t addrsize; sasl_callback_t *cb; char buf[2048]; @@ -1136,18 +1182,18 @@ } /* set the IP addresses */ - addrsize=sizeof(struct sockaddr_in); + addrsize=sizeof(struct sockaddr_storage); if (getpeername(backend_sock, (struct sockaddr *)&saddr_r, &addrsize) != 0) return SASL_FAIL; - addrsize=sizeof(struct sockaddr_in); + addrsize=sizeof(struct sockaddr_storage); if (getsockname(backend_sock, (struct sockaddr *)&saddr_l,&addrsize)!=0) return SASL_FAIL; - if (iptostring((struct sockaddr *)&saddr_r, - sizeof(struct sockaddr_in), remoteip, 60) != 0) + if (iptostring((struct sockaddr *)&saddr_r, addrsize, + remoteip, 60) != 0) return SASL_FAIL; - if (iptostring((struct sockaddr *)&saddr_l, - sizeof(struct sockaddr_in), localip, 60) != 0) + if (iptostring((struct sockaddr *)&saddr_l, addrsize, + localip, 60) != 0) return SASL_FAIL; r = sasl_setprop(backend_saslconn, SASL_IPLOCALPORT, localip); @@ -1214,8 +1260,7 @@ static void openproxy(void) { - struct hostent *hp; - struct sockaddr_in sin; + struct addrinfo hints, *res0 = NULL, *res; char inboxname[MAX_MAILBOX_PATH]; int r; char *server = NULL; @@ -1239,17 +1284,23 @@ if(c) *c = '\0'; } - hp = gethostbyname(server); - if (!hp) fatal("gethostbyname failed", EC_CONFIG); - sin.sin_family = AF_INET; - memcpy(&sin.sin_addr, hp->h_addr, hp->h_length); - sin.sin_port = htons(110); - - if ((backend_sock = socket(AF_INET, SOCK_STREAM, 0)) < 0) { - syslog(LOG_ERR, "socket() failed: %m"); - fatal("socket failed", EC_CONFIG); + memset(&hints, 0, sizeof(hints)); + hints.ai_family = PF_UNSPEC; + hints.ai_socktype = SOCK_STREAM; + if (getaddrinfo(server, "110", &hints, &res0)) + fatal("getaddrinfo failed", EC_CONFIG); + for (res = res0; res; res = res->ai_next) { + backend_sock = socket(res->ai_family, res->ai_socktype, + res->ai_protocol); + if (backend_sock < 0) + continue; + if (connect(backend_sock, res->ai_addr, res->ai_addrlen) >= 0) + break; + close(backend_sock); + backend_sock = -1; } - if (connect(backend_sock, (struct sockaddr *) &sin, sizeof(sin)) < 0) { + freeaddrinfo(res0); + if (backend_sock < 0) { syslog(LOG_ERR, "connect() failed: %m"); fatal("connect failed", 1); } Index: imap/proxyd.c =================================================================== RCS file: /usr/home/ume/ncvs/src/cyrus-imapd2/imap/proxyd.c,v retrieving revision 1.1.1.14 retrieving revision 1.15 diff -u -r1.1.1.14 -r1.15 --- imap/proxyd.c 20 Nov 2003 17:14:32 -0000 1.1.1.14 +++ imap/proxyd.c 20 Nov 2003 17:26:13 -0000 1.15 @@ -134,7 +134,7 @@ /* per-user session state */ struct protstream *proxyd_out = NULL; struct protstream *proxyd_in = NULL; -static char proxyd_clienthost[250] = "[local]"; +static char proxyd_clienthost[NI_MAXHOST*2+1] = "[local]"; static int proxyd_logfd = -1; time_t proxyd_logtime; char *proxyd_userid = NULL; @@ -1212,8 +1212,8 @@ int service_main(int argc, char **argv, char **envp) { socklen_t salen; - struct hostent *hp; - struct sockaddr_in proxyd_localaddr, proxyd_remoteaddr; + char hbuf[NI_MAXHOST]; + struct sockaddr_storage proxyd_localaddr, proxyd_remoteaddr; char localip[60], remoteip[60]; int timeout; int proxyd_haveaddr = 0; @@ -1232,25 +1232,27 @@ /* Find out name of client host */ salen = sizeof(proxyd_remoteaddr); if (getpeername(0, (struct sockaddr *)&proxyd_remoteaddr, &salen) == 0 && - proxyd_remoteaddr.sin_family == AF_INET) { - hp = gethostbyaddr((char *)&proxyd_remoteaddr.sin_addr, - sizeof(proxyd_remoteaddr.sin_addr), AF_INET); - if (hp != NULL) { - strncpy(proxyd_clienthost,hp->h_name,sizeof(proxyd_clienthost)-30); - proxyd_clienthost[sizeof(proxyd_clienthost)-30] = '\0'; - } else { + (proxyd_remoteaddr.ss_family == AF_INET || + proxyd_remoteaddr.ss_family == AF_INET6)) { + if (getnameinfo((struct sockaddr *)&proxyd_remoteaddr, salen, + hbuf, sizeof(hbuf), NULL, 0, NI_NAMEREQD) == 0) { + strncpy(proxyd_clienthost, hbuf, sizeof(hbuf)); + } + else { proxyd_clienthost[0] = '\0'; } + getnameinfo((struct sockaddr *)&proxyd_remoteaddr, salen, hbuf, + sizeof(hbuf), NULL, 0, NI_NUMERICHOST | NI_WITHSCOPEID); strcat(proxyd_clienthost, "["); - strcat(proxyd_clienthost, inet_ntoa(proxyd_remoteaddr.sin_addr)); + strcat(proxyd_clienthost, hbuf); strcat(proxyd_clienthost, "]"); salen = sizeof(proxyd_localaddr); if (getsockname(0, (struct sockaddr *)&proxyd_localaddr, &salen) == 0) { - if(iptostring((struct sockaddr *)&proxyd_remoteaddr, - sizeof(struct sockaddr_in), remoteip, 60) == 0 - && iptostring((struct sockaddr *)&proxyd_localaddr, - sizeof(struct sockaddr_in), localip, 60) == 0) { + if(iptostring((struct sockaddr *)&proxyd_remoteaddr, salen, + remoteip, 60) == 0 + && iptostring((struct sockaddr *)&proxyd_localaddr, salen, + localip, 60) == 0) { proxyd_haveaddr = 1; } } Index: imtest/imtest.c =================================================================== RCS file: /usr/home/ume/ncvs/src/cyrus-imapd2/imtest/imtest.c,v retrieving revision 1.1.1.8 retrieving revision 1.10 diff -u -r1.1.1.8 -r1.10 --- imtest/imtest.c 3 Jul 2003 05:56:41 -0000 1.1.1.8 +++ imtest/imtest.c 18 Aug 2003 19:42:23 -0000 1.10 @@ -750,23 +750,21 @@ sasl_security_properties_t *secprops=NULL; socklen_t addrsize; char localip[60], remoteip[60]; - struct sockaddr_in saddr_l; - struct sockaddr_in saddr_r; + struct sockaddr_storage saddr_l; + struct sockaddr_storage saddr_r; - addrsize=sizeof(struct sockaddr_in); + addrsize=sizeof(struct sockaddr_storage); if (getpeername(sock,(struct sockaddr *)&saddr_r,&addrsize)!=0) return IMTEST_FAIL; - addrsize=sizeof(struct sockaddr_in); + addrsize=sizeof(struct sockaddr_storage); if (getsockname(sock,(struct sockaddr *)&saddr_l,&addrsize)!=0) return IMTEST_FAIL; - if(iptostring((struct sockaddr *)&saddr_l, sizeof(struct sockaddr_in), - localip, 60)) + if(iptostring((struct sockaddr *)&saddr_l, addrsize, localip, 60)) return IMTEST_FAIL; - if(iptostring((struct sockaddr *)&saddr_r, sizeof(struct sockaddr_in), - remoteip, 60)) + if(iptostring((struct sockaddr *)&saddr_r, addrsize, remoteip, 60)) return IMTEST_FAIL; @@ -1108,27 +1106,32 @@ } /* initialize the network */ -static int init_net(char *serverFQDN, int port) +static int init_net(char *serverFQDN, char *port) { - struct sockaddr_in addr; - struct hostent *hp; + struct addrinfo hints, *res0 = NULL, *res; + int err; - if ((hp = gethostbyname(serverFQDN)) == NULL) { - perror("gethostbyname"); + memset(&hints, 0, sizeof(hints)); + hints.ai_family = PF_UNSPEC; + hints.ai_socktype = SOCK_STREAM; + hints.ai_flags = AI_CANONNAME; + if ((err = getaddrinfo(serverFQDN, port, &hints, &res0)) != 0) { + fprintf(stderr, "getaddrinfo: %s\n", gai_strerror(err)); return IMTEST_FAIL; } - strncpy(serverFQDN, hp->h_name, 1023); - - if ((sock = socket(AF_INET, SOCK_STREAM, 0)) < 0) { - perror("socket"); - return IMTEST_FAIL; + if (res0->ai_canonname) + strncpy(serverFQDN, res0->ai_canonname, 1023); + for (res = res0; res; res = res->ai_next) { + sock = socket(res->ai_family, res->ai_socktype, res->ai_protocol); + if (sock < 0) + continue; + if (connect(sock, res->ai_addr, res->ai_addrlen) >= 0) + break; + close(sock); + sock = -1; } - - addr.sin_family = AF_INET; - memcpy(&addr.sin_addr, hp->h_addr, hp->h_length); - addr.sin_port = htons(port); - - if (connect(sock, (struct sockaddr *) &addr, sizeof (addr)) < 0) { + freeaddrinfo(res0); + if (sock < 0) { perror("connect"); return IMTEST_FAIL; } @@ -2145,8 +2148,6 @@ char *prog; char *tls_keyfile=""; char *port = "", *prot = ""; - struct servent *serv; - int servport; int run_stress_test=0; int dotls=0, dossl=0; int server_supports_tls; @@ -2307,14 +2308,6 @@ /* last arg is server name */ strncpy(servername, argv[optind], 1023); - /* map port -> num */ - serv = getservbyname(port, "tcp"); - if (serv == NULL) { - servport = atoi(port); - } else { - servport = ntohs(serv->s_port); - } - if(pidfile) { FILE *pf; pf = fopen(pidfile, "w"); @@ -2347,7 +2340,7 @@ sasl_dispose(&conn); } - if (init_net(servername, servport) != IMTEST_OK) { + if (init_net(servername, port) != IMTEST_OK) { imtest_fatal("Network initialization"); } Index: lib/gai.h =================================================================== RCS file: /usr/home/ume/ncvs/src/cyrus-imapd2/lib/gai.h,v retrieving revision 1.1.1.3 retrieving revision 1.4 diff -u -r1.1.1.3 -r1.4 --- lib/gai.h 18 Aug 2003 17:43:46 -0000 1.1.1.3 +++ lib/gai.h 18 Aug 2003 18:23:48 -0000 1.4 @@ -62,10 +62,10 @@ #endif /* for old netdb.h */ -#ifndef EAI_NODATA -#define EAI_NODATA 1 +#ifndef EAI_SERVICE #define EAI_MEMORY 2 #define EAI_FAMILY 5 /* ai_family not supported */ +#define EAI_NONAME 8 /* hostname nor servname provided, or not known */ #define EAI_SERVICE 9 /* servname not supported for ai_socktype */ #endif Index: lib/getaddrinfo.c =================================================================== RCS file: /usr/home/ume/ncvs/src/cyrus-imapd2/lib/getaddrinfo.c,v retrieving revision 1.1.1.3 retrieving revision 1.3 diff -u -r1.1.1.3 -r1.3 --- lib/getaddrinfo.c 2 May 2003 17:03:21 -0000 1.1.1.3 +++ lib/getaddrinfo.c 2 May 2003 17:59:29 -0000 1.3 @@ -97,12 +97,12 @@ gai_strerror(int ecode) { switch (ecode) { - case EAI_NODATA: - return "no address associated with hostname."; case EAI_MEMORY: return "memory allocation failure."; case EAI_FAMILY: return "ai_family not supported."; + case EAI_NONAME: + return "hostname nor servname provided, or not known."; case EAI_SERVICE: return "servname not supported for ai_socktype."; default: @@ -193,7 +193,7 @@ return EAI_MEMORY; } if (hints && hints->ai_flags & AI_NUMERICHOST) - return EAI_NODATA; + return EAI_NONAME; #ifndef macintosh if ((hp = gethostbyname(hostname)) && hp->h_name && hp->h_name[0] && hp->h_addr_list[0]) { @@ -221,5 +221,5 @@ return 0; } #endif - return EAI_NODATA; + return EAI_NONAME; } Index: lib/getnameinfo.c =================================================================== RCS file: /usr/home/ume/ncvs/src/cyrus-imapd2/lib/getnameinfo.c,v retrieving revision 1.1.1.3 retrieving revision 1.3 diff -u -r1.1.1.3 -r1.3 --- lib/getnameinfo.c 2 May 2003 17:03:21 -0000 1.1.1.3 +++ lib/getnameinfo.c 2 May 2003 17:59:29 -0000 1.3 @@ -80,6 +80,8 @@ } if (host) { if (flags & NI_NUMERICHOST) { + if (flags & NI_NAMEREQD) + return EAI_NONAME; if (strlen(inet_ntoa(sin->sin_addr)) >= hostlen) return EAI_MEMORY; else { @@ -96,8 +98,14 @@ strcpy(host, hp->h_name); return 0; } - else - return EAI_NODATA; + else if (flags & NI_NAMEREQD) + return EAI_NONAME; + else if (strlen(inet_ntoa(sin->sin_addr)) >= hostlen) + return EAI_MEMORY; + else { + strcpy(host, inet_ntoa(sin->sin_addr)); + return 0; + } } } Index: lib/imclient.c =================================================================== RCS file: /usr/home/ume/ncvs/src/cyrus-imapd2/lib/imclient.c,v retrieving revision 1.1.1.9 retrieving revision 1.11 diff -u -r1.1.1.9 -r1.11 --- lib/imclient.c 3 Jul 2003 05:56:43 -0000 1.1.1.9 +++ lib/imclient.c 18 Aug 2003 19:42:24 -0000 1.11 @@ -223,46 +223,41 @@ const char *port, sasl_callback_t *cbs) { - int s; - struct hostent *hp; - struct servent *sp; - struct sockaddr_in addr; + int s = -1; + struct addrinfo hints, *res0 = NULL, *res; int saslresult; static int didinit; assert(imclient); assert(host); - hp = gethostbyname(host); - if (!hp) return -1; - - addr.sin_family = AF_INET; - memcpy(&addr.sin_addr, hp->h_addr, sizeof(addr.sin_addr)); - if (port && imparse_isnumber(port)) { - addr.sin_port = htons(atoi(port)); - } - else if (port) { - sp = getservbyname(port, "tcp"); - if (!sp) return -2; - addr.sin_port = sp->s_port; - } - else { - addr.sin_port = htons(143); - } - - s = socket(AF_INET, SOCK_STREAM, 0); - if (s == -1) return errno; - - if (connect(s, (struct sockaddr *)&addr, sizeof(addr)) == -1) { + if (!port) + port = "143"; + memset(&hints, 0, sizeof(hints)); + hints.ai_family = PF_UNSPEC; + hints.ai_socktype = SOCK_STREAM; + hints.ai_flags = AI_CANONNAME; + if (getaddrinfo(host, port, &hints, &res0)) + return -1; + for (res = res0; res; res = res->ai_next) { + s = socket(res->ai_family, res->ai_socktype, res->ai_protocol); + if (s < 0) + continue; + if (connect(s, res->ai_addr, res->ai_addrlen) >= 0) + break; close(s); - return errno; + s = -1; } + if (s < 0) + return errno; /* nonblock(s, 1); */ *imclient = (struct imclient *)xzmalloc(sizeof(struct imclient)); (*imclient)->fd = s; (*imclient)->saslconn = NULL; (*imclient)->saslcompleted = 0; - (*imclient)->servername = xstrdup(hp->h_name); + (*imclient)->servername = xstrdup(res0->ai_canonname ? + res0->ai_canonname : host); + freeaddrinfo(res0); (*imclient)->outptr = (*imclient)->outstart = (*imclient)->outbuf; (*imclient)->outleft = (*imclient)->maxplain = sizeof((*imclient)->outbuf); (*imclient)->interact_results = NULL; @@ -1236,8 +1231,8 @@ int saslresult; sasl_security_properties_t *secprops=NULL; socklen_t addrsize; - struct sockaddr_in saddr_l; - struct sockaddr_in saddr_r; + struct sockaddr_storage saddr_l; + struct sockaddr_storage saddr_r; char localip[60], remoteip[60]; sasl_interact_t *client_interact=NULL; const char *out; @@ -1258,19 +1253,19 @@ if (saslresult!=SASL_OK) return 1; free(secprops); - addrsize=sizeof(struct sockaddr_in); + addrsize=sizeof(struct sockaddr_storage); if (getpeername(imclient->fd,(struct sockaddr *)&saddr_r,&addrsize)!=0) return 1; - addrsize=sizeof(struct sockaddr_in); + addrsize=sizeof(struct sockaddr_storage); if (getsockname(imclient->fd,(struct sockaddr *)&saddr_l,&addrsize)!=0) return 1; - if(iptostring((const struct sockaddr *)&saddr_l, sizeof(struct sockaddr_in), + if(iptostring((const struct sockaddr *)&saddr_l, addrsize, localip, sizeof(localip)) != 0) return 1; - if(iptostring((const struct sockaddr *)&saddr_r, sizeof(struct sockaddr_in), + if(iptostring((const struct sockaddr *)&saddr_r, addrsize, remoteip, sizeof(remoteip)) != 0) return 1; Index: master/Makefile.in =================================================================== RCS file: /usr/home/ume/ncvs/src/cyrus-imapd2/master/Makefile.in,v retrieving revision 1.1.1.3 retrieving revision 1.4 diff -u -r1.1.1.3 -r1.4 --- master/Makefile.in 20 Nov 2003 17:14:41 -0000 1.1.1.3 +++ master/Makefile.in 20 Nov 2003 17:26:15 -0000 1.4 @@ -54,7 +54,7 @@ DEFS = @DEFS@ @LOCALDEFS@ CPPFLAGS = -I. -I.. -I$(srcdir) -I$(srcdir)/../lib @CPPFLAGS@ @COM_ERR_CPPFLAGS@ -DEPLIBS = @DEPLIBS@ +DEPLIBS = ../lib/libcyrus.a @DEPLIBS@ CFLAGS = @CFLAGS@ LDFLAGS = @LDFLAGS@ @COM_ERR_LDFLAGS@ Index: master/master.c =================================================================== RCS file: /usr/home/ume/ncvs/src/cyrus-imapd2/master/master.c,v retrieving revision 1.1.1.10 retrieving revision 1.15 diff -u -r1.1.1.10 -r1.15 --- master/master.c 20 Nov 2003 17:14:42 -0000 1.1.1.10 +++ master/master.c 20 Nov 2003 17:26:15 -0000 1.15 @@ -81,6 +81,10 @@ #define INADDR_ANY 0x00000000 #endif +#if !defined(IPV6_V6ONLY) && defined(IPV6_BINDV6ONLY) +#define IPV6_V6ONLY IPV6_BINDV6ONLY +#endif + #ifdef HAVE_UCDSNMP #include #include @@ -270,30 +274,8 @@ return port; } -/* set sin_port accordingly. return of 0 indicates failure. */ -int resolve_port(char *port, struct service *s, struct sockaddr_in *sin) -{ - struct servent *serv; - - serv = getservbyname(port, s->proto); - if (serv) { - sin->sin_port = serv->s_port; - } else { - sin->sin_port = htons(atoi(port)); - if (sin->sin_port == 0) { - syslog(LOG_INFO, "no service '%s' in /etc/services, " - "disabling %s", port, s->name); - s->exec = NULL; - return 0; - } - } - return 1; -} - -/* set sin_addr accordingly. return of 0 indicates failure. */ -int resolve_host(char *listen, struct sockaddr_in *sin) +char *parse_host(char *listen) { - struct hostent *hp; char *cp; /* do we have a hostname, or IP number? */ @@ -304,24 +286,7 @@ *cp = '\0'; } } - sin->sin_addr.s_addr = inet_addr(listen); - if ((sin->sin_addr.s_addr == INADDR_NONE) || (sin->sin_addr.s_addr == 0)) { - /* looks like it isn't an IP address, so look up the host */ - if ((hp = gethostbyname(listen)) == 0) { - syslog(LOG_INFO, "host not found: %s", listen); - return 0; - } - if (hp->h_addrtype != AF_INET) { - syslog(LOG_INFO, "unexpected address family: %d", hp->h_addrtype); - return 0; - } - if (hp->h_length != sizeof(sin->sin_addr)) { - syslog(LOG_INFO, "unexpected address length %d", hp->h_length); - return 0; - } - memcpy((char *) &sin->sin_addr, hp->h_addr, hp->h_length); - } - return 1; + return listen; } int verify_service_file(char *const *filename) @@ -337,32 +302,69 @@ void service_create(struct service *s) { - struct sockaddr_in sin; + struct service service0, service; + struct addrinfo hints, *res0, *res; + int error, nsocket = 0; struct sockaddr_un sunsock; - struct sockaddr *sa; mode_t oldumask; - int on = 1, salen; + int on = 1; int r; - memset(&sin, 0, sizeof(sin)); + if (s->associate > 0) + return; /* service is already activated */ if (s->listen[0] == '/') { /* unix socket */ - sunsock.sun_family = AF_UNIX; - strcpy(sunsock.sun_path, s->listen); - unlink(s->listen); - sa = (struct sockaddr *) &sunsock; - salen = sizeof(sunsock.sun_family) + strlen(sunsock.sun_path) + 1; - + res0 = (struct addrinfo *)malloc(sizeof(struct addrinfo)); + if (!res0) + fatal("out of memory", EX_UNAVAILABLE); + memset(res0, 0, sizeof(struct addrinfo)); + res0->ai_flags = AI_PASSIVE; + res0->ai_family = PF_UNIX; if(!strcmp(s->proto, "tcp")) { - s->socket = socket(AF_UNIX, SOCK_STREAM, 0); + res0->ai_socktype = SOCK_STREAM; } else { /* udp */ - s->socket = socket(AF_UNIX, SOCK_DGRAM, 0); + res0->ai_socktype = SOCK_DGRAM; } + res0->ai_addr = (struct sockaddr *)&sunsock; + res0->ai_addrlen = sizeof(sunsock.sun_family) + strlen(s->listen) + 1; +#ifdef SIN6_LEN + res0->ai_addrlen += sizeof(sunsock.sun_len); + sunsock.sun_len = res0->ai_addrlen; +#endif + sunsock.sun_family = AF_UNIX; + strcpy(sunsock.sun_path, s->listen); + unlink(s->listen); } else { /* inet socket */ char *listen, *port; + char *listen_addr; - sin.sin_family = AF_INET; + memset(&hints, 0, sizeof(hints)); + hints.ai_flags = AI_PASSIVE; + if (!strcmp(s->proto, "tcp")) { + hints.ai_family = PF_UNSPEC; + hints.ai_socktype = SOCK_STREAM; + } else if (!strcmp(s->proto, "tcp4")) { + hints.ai_family = PF_INET; + hints.ai_socktype = SOCK_STREAM; + } else if (!strcmp(s->proto, "tcp6")) { + hints.ai_family = PF_INET6; + hints.ai_socktype = SOCK_STREAM; + } else if (!strcmp(s->proto, "udp")) { + hints.ai_family = PF_UNSPEC; + hints.ai_socktype = SOCK_DGRAM; + } else if (!strcmp(s->proto, "udp4")) { + hints.ai_family = PF_INET; + hints.ai_socktype = SOCK_DGRAM; + } else if (!strcmp(s->proto, "udp6")) { + hints.ai_family = PF_INET6; + hints.ai_socktype = SOCK_DGRAM; + } else { + syslog(LOG_INFO, "invalid proto '%s', disabling %s", + s->proto, s->name); + s->exec = NULL; + return; + } /* parse_listen() and resolve_host() are destructive, * so make a work copy of s->listen @@ -371,78 +373,107 @@ if ((port = parse_listen(listen)) == NULL) { /* listen IS the port */ - if (!resolve_port(listen, s, &sin)) { - free(listen); - return; - } - sin.sin_addr.s_addr = INADDR_ANY; + port = listen; + listen_addr = NULL; + } else { - /* listen is now just the address */ - if (!resolve_port(port, s, &sin)) { - free(listen); - return; - } - if (!resolve_host(listen, &sin)) { - s->exec = NULL; - free(listen); - return; - } + /* s->listen is now just the address */ + listen_addr = parse_host(listen); + if (*listen_addr == '\0') + listen_addr = NULL; } - sa = (struct sockaddr *) &sin; - salen = sizeof(sin); + error = getaddrinfo(listen_addr, port, &hints, &res0); - if(!strcmp(s->proto, "tcp")) { - s->socket = socket(AF_INET, SOCK_STREAM, 0); - } else { - /* udp */ - s->socket = socket(AF_INET, SOCK_DGRAM, 0); - } - free(listen); - } - if (s->socket < 0) { - syslog(LOG_ERR, "unable to create %s listener socket: %m", s->name); - s->exec = NULL; - return; + if (error) { + syslog(LOG_INFO, "%s, disabling %s", gai_strerror(error), s->name); + s->exec = NULL; + return; + } } - /* allow reuse of address */ - r = setsockopt(s->socket, SOL_SOCKET, SO_REUSEADDR, - (void *) &on, sizeof(on)); - if (r < 0) { - syslog(LOG_ERR, "unable to setsocketopt(SO_REUSEADDR): %m"); - } + memcpy(&service0, s, sizeof(struct service)); - oldumask = umask((mode_t) 0); /* for linux */ - r = bind(s->socket, sa, salen); - umask(oldumask); - if (r < 0) { - syslog(LOG_ERR, "unable to bind socket for service %s: %m", s->name); - close(s->socket); - s->socket = 0; - s->exec = NULL; - return; - } + for (res = res0; res; res = res->ai_next) { + if (s->socket > 0) { + memcpy(&service, &service0, sizeof(struct service)); + s = &service; + } - if (s->listen[0] == '/') { /* unix socket */ - /* for DUX, where this isn't the default. - (harmlessly fails on some systems) */ - chmod(s->listen, (mode_t) 0777); - } + s->socket = socket(res->ai_family, res->ai_socktype, res->ai_protocol); + if (s->socket < 0) { + s->socket = 0; + if (verbose > 2) + syslog(LOG_ERR, "unable to open %s socket: %m", s->name); + continue; + } + + /* allow reuse of address */ + r = setsockopt(s->socket, SOL_SOCKET, SO_REUSEADDR, + (void *) &on, sizeof(on)); + if (r < 0) { + syslog(LOG_ERR, "unable to setsocketopt(SO_REUSEADDR): %m"); + } + +#if defined(IPV6_V6ONLY) && !(defined(__FreeBSD__) && __FreeBSD__ < 3) + if (res->ai_family == AF_INET6) { + r = setsockopt(s->socket, IPPROTO_IPV6, IPV6_V6ONLY, + (void *) &on, sizeof(on)); + if (r < 0) { + syslog(LOG_ERR, "unable to setsocketopt(IPV6_V6ONLY): %m"); + } + } +#endif - if (!strcmp(s->proto, "tcp") - && listen(s->socket, listen_queue_backlog) < 0) { - syslog(LOG_ERR, "unable to listen to %s socket: %m", s->name); - close(s->socket); - s->socket = 0; + oldumask = umask((mode_t) 0); /* for linux */ + r = bind(s->socket, res->ai_addr, res->ai_addrlen); + umask(oldumask); + if (r < 0) { + syslog(LOG_ERR, "unable to bind socket for service %s: %m", + s->name); + close(s->socket); + s->socket = 0; + continue; + } + + if (s->listen[0] == '/') { /* unix socket */ + /* for DUX, where this isn't the default. + (harmlessly fails on some systems) */ + chmod(s->listen, (mode_t) 0777); + } + + if ((!strcmp(s->proto, "tcp") || !strcmp(s->proto, "tcp4") + || !strcmp(s->proto, "tcp6")) + && listen(s->socket, listen_queue_backlog) < 0) { + syslog(LOG_ERR, "unable to listen to %s socket: %m", s->name); + close(s->socket); + s->socket = 0; + continue; + } + + s->ready_workers = 0; + s->associate = nsocket; + + get_statsock(s->stat); + + if (s == &service) { + if (nservices == allocservices) { + Services = realloc(Services, + (allocservices+=5) * sizeof(struct service)); + if (!Services) fatal("out of memory", EX_UNAVAILABLE); + } + memcpy(&Services[nservices++], s, sizeof(struct service)); + } + nsocket++; + } + if (res0) + freeaddrinfo(res0); + if (nsocket <= 0) { + syslog(LOG_ERR, "unable to create %s listener socket: %m", s->name); s->exec = NULL; return; } - - s->ready_workers = 0; - - get_statsock(s->stat); } void run_startup(char **cmd) @@ -510,7 +541,7 @@ pid_t p; int i; char path[PATH_MAX]; - static char name_env[100]; + static char name_env[100], name_env2[100]; struct centry *c; time_t now = time(NULL); int msg; @@ -595,6 +626,8 @@ /* add service name to environment */ snprintf(name_env, sizeof(name_env), "CYRUS_SERVICE=%s", s->name); putenv(name_env); + snprintf(name_env2, sizeof(name_env2), "CYRUS_ID=%d", s->associate); + putenv(name_env2); execv(path, s->exec); syslog(LOG_ERR, "couldn't exec %s: %m", path); @@ -941,7 +974,7 @@ char *proto = mystrdup(masterconf_getstring(e, "proto", "tcp")); char *max = mystrdup(masterconf_getstring(e, "maxchild", "-1")); rlim_t maxfds = (rlim_t) masterconf_getint(e, "maxfds", 256); - int i; + int i, j; if(babysit && prefork == 0) prefork = 1; if(babysit && maxforkrate == 0) maxforkrate = 10; /* reasonable safety */ @@ -961,6 +994,8 @@ /* see if we have an existing entry for this service */ for (i = 0; i < nservices; i++) { + if (Services[i].associate > 0) + continue; if (Services[i].name && !strcmp(Services[i].name, name)) break; } @@ -998,7 +1033,9 @@ Services[i].maxforkrate = maxforkrate; Services[i].maxfds = maxfds; - if (!strcmp(Services[i].proto, "tcp")) { + if (!strcmp(Services[i].proto, "tcp") || + !strcmp(Services[i].proto, "tcp4") || + !strcmp(Services[i].proto, "tcp6")) { Services[i].desired_workers = prefork; Services[i].babysit = babysit; Services[i].max_workers = atoi(max); @@ -1012,6 +1049,17 @@ Services[i].max_workers = 1; } + for (j = 0; j < nservices; j++) { + if (Services[j].associate > 0 && + Services[j].name && !strcmp(Services[j].name, name)) { + Services[j].maxforkrate = Services[i].maxforkrate; + Services[j].exec = Services[i].exec; + Services[j].desired_workers = Services[i].desired_workers; + Services[j].babysit = Services[i].babysit; + Services[j].max_workers = Services[i].max_workers; + } + } + if (verbose > 2) syslog(LOG_DEBUG, "reconfig: service '%s' (%s, %s:%s, %d, %d)", Services[i].name, cmd, @@ -1051,10 +1099,11 @@ Services[nservices].ready_workers = 0; Services[nservices].maxforkrate = maxforkrate; - Services[nservices].maxfds = maxfds; - if(!strcmp(Services[nservices].proto, "tcp")) { + if(!strcmp(Services[nservices].proto, "tcp") || + !strcmp(Services[nservices].proto, "tcp4") || + !strcmp(Services[nservices].proto, "tcp6")) { Services[nservices].desired_workers = prefork; Services[nservices].babysit = babysit; Services[nservices].max_workers = atoi(max); @@ -1077,6 +1126,8 @@ Services[nservices].nactive = 0; Services[nservices].nconnections = 0; + Services[nservices].associate = 0; + if (verbose > 2) syslog(LOG_DEBUG, "add: service '%s' (%s, %s:%s, %d, %d, %d)", Services[nservices].name, cmd, @@ -1206,16 +1257,22 @@ syslog(LOG_DEBUG, "disable: service %s socket %d pipe %d %d", Services[i].name, Services[i].socket, Services[i].stat[0], Services[i].stat[1]); - free(Services[i].name); Services[i].name = NULL; - free(Services[i].listen); - free(Services[i].proto); + if (Services[i].associate == 0) { + free(Services[i].name); + free(Services[i].listen); + free(Services[i].proto); + } + Services[i].name = NULL; Services[i].desired_workers = 0; Services[i].nforks = 0; Services[i].nactive = 0; Services[i].nconnections = 0; /* close all listeners */ - if (Services[i].socket > 0) close(Services[i].socket); + if (Services[i].socket > 0) { + shutdown(Services[i].socket, SHUT_RDWR); + close(Services[i].socket); + } Services[i].socket = 0; Services[i].saddr = NULL; Index: master/master.h =================================================================== RCS file: /usr/home/ume/ncvs/src/cyrus-imapd2/master/master.h,v retrieving revision 1.1.1.4 retrieving revision 1.5 diff -u -r1.1.1.4 -r1.5 --- master/master.h 2 May 2003 17:03:16 -0000 1.1.1.4 +++ master/master.h 2 May 2003 17:59:31 -0000 1.5 @@ -34,6 +34,8 @@ unsigned int forkrate; + int associate; + /* limits */ rlim_t maxfds; }; Index: master/service-thread.c =================================================================== RCS file: /usr/home/ume/ncvs/src/cyrus-imapd2/master/service-thread.c,v retrieving revision 1.1.1.7 retrieving revision 1.7 diff -u -r1.1.1.7 -r1.7 --- master/service-thread.c 20 Nov 2003 17:14:42 -0000 1.1.1.7 +++ master/service-thread.c 20 Nov 2003 17:26:15 -0000 1.7 @@ -96,12 +96,12 @@ static int libwrap_ask(struct request_info *r, int fd) { int a; - struct sockaddr_in sin; + struct sockaddr_storage sin; socklen_t len = sizeof(sin); /* is this a connection from the local host? */ if (getpeername(fd, (struct sockaddr *) &sin, &len) == 0) { - if (sin.sin_family == AF_UNIX) { + if (((struct sockaddr *)&sin)->sa_family == AF_UNIX) { return 1; } } Index: master/service.c =================================================================== RCS file: /usr/home/ume/ncvs/src/cyrus-imapd2/master/service.c,v retrieving revision 1.1.1.8 retrieving revision 1.10 diff -u -r1.1.1.8 -r1.10 --- master/service.c 3 Jul 2003 05:56:49 -0000 1.1.1.8 +++ master/service.c 18 Aug 2003 19:42:26 -0000 1.10 @@ -99,12 +99,12 @@ static int libwrap_ask(struct request_info *r, int fd) { int a; - struct sockaddr_in sin; + struct sockaddr_storage sin; socklen_t len = sizeof(sin); /* is this a connection from the local host? */ if (getpeername(fd, (struct sockaddr *) &sin, &len) == 0) { - if (sin.sin_family == AF_UNIX) { + if (((struct sockaddr *)&sin)->sa_family == AF_UNIX) { return 1; } } @@ -141,13 +141,13 @@ extern const char *config_getstring(const char *key, const char *def); extern const char *config_dir; -static int getlockfd(char *service) +static int getlockfd(char *service, int id) { char lockfile[1024]; int fd; - snprintf(lockfile, sizeof(lockfile), "%s/socket/%s.lock", - config_dir, service); + snprintf(lockfile, sizeof(lockfile), "%s/socket/%s-%d.lock", + config_dir, service, id); fd = open(lockfile, O_CREAT | O_RDWR, 0600); if (fd < 0) { syslog(LOG_ERR, @@ -267,6 +267,7 @@ int typelen = sizeof(soctype); int newargc = 0; char **newargv = (char **) malloc(ARGV_GROW * sizeof(char *)); + int id; opterr = 0; /* disable error reporting, since we don't know about service-specific options */ @@ -340,6 +341,12 @@ syslog(LOG_ERR, "couldn't strdup() service: %m"); exit(EX_OSERR); } + p = getenv("CYRUS_ID"); + if (p == NULL) { + syslog(LOG_ERR, "could not getenv(CYRUS_ID); exiting"); + exit(EX_SOFTWARE); + } + id = atoi(p); config_init(alt_config, service); if (call_debugger) { @@ -387,7 +394,7 @@ return 1; } - getlockfd(service); + getlockfd(service, id); for (;;) { /* ok, listen to this socket until someone talks to us */ @@ -434,7 +441,7 @@ } } else { /* udp */ - struct sockaddr_in from; + struct sockaddr_storage from; socklen_t fromlen; char ch; int r; Index: perl/sieve/lib/isieve.c =================================================================== RCS file: /usr/home/ume/ncvs/src/cyrus-imapd2/perl/sieve/lib/isieve.c,v retrieving revision 1.1.1.6 retrieving revision 1.7 diff -u -r1.1.1.6 -r1.7 --- perl/sieve/lib/isieve.c 2 May 2003 17:03:13 -0000 1.1.1.6 +++ perl/sieve/lib/isieve.c 2 May 2003 17:59:32 -0000 1.7 @@ -104,25 +104,30 @@ /* initialize the network */ int init_net(char *serverFQDN, int port, isieve_t **obj) { - struct sockaddr_in addr; - struct hostent *hp; + struct addrinfo hints, *res0, *res; + int err; + char portstr[6]; int sock; - if ((hp = gethostbyname(serverFQDN)) == NULL) { - perror("gethostbyname"); + snprintf(portstr, sizeof(portstr), "%d", port); + memset(&hints, 0, sizeof(hints)); + hints.ai_family = PF_UNSPEC; + hints.ai_socktype = SOCK_STREAM; + if ((err = getaddrinfo(serverFQDN, portstr, &hints, &res0)) != 0) { + fprintf(stderr, "getaddrinfo: %s\n", gai_strerror(err)); return -1; } - - if ((sock = socket(AF_INET, SOCK_STREAM, 0)) < 0) { - perror("socket"); - return -1; + for (res = res0; res; res = res->ai_next) { + sock = socket(res->ai_family, res->ai_socktype, res->ai_protocol); + if (sock < 0) + continue; + if (connect(sock, res->ai_addr, res->ai_addrlen) >= 0) + break; + close(sock); + sock = -1; } - - addr.sin_family = AF_INET; - memcpy(&addr.sin_addr, hp->h_addr, hp->h_length); - addr.sin_port = htons(port); - - if (connect(sock, (struct sockaddr *) &addr, sizeof (addr)) < 0) { + freeaddrinfo(res0); + if (sock < 0) { perror("connect"); return -1; } @@ -170,8 +175,8 @@ static int sasl_started = 0; int saslresult = SASL_OK; sasl_security_properties_t *secprops=NULL; - socklen_t addrsize=sizeof(struct sockaddr_in); - struct sockaddr_in saddr_l, saddr_r; + socklen_t addrsize=sizeof(struct sockaddr_storage); + struct sockaddr_storage saddr_l, saddr_r; char localip[60], remoteip[60]; /* attempt to start sasl */ @@ -186,23 +191,21 @@ if (saslresult!=SASL_OK) return -1; - addrsize=sizeof(struct sockaddr_in); + addrsize=sizeof(struct sockaddr_storage); if (getpeername(obj->sock,(struct sockaddr *)&saddr_r,&addrsize)!=0) return -1; - addrsize=sizeof(struct sockaddr_in); + addrsize=sizeof(struct sockaddr_storage); if (getsockname(obj->sock,(struct sockaddr *)&saddr_l,&addrsize)!=0) return -1; /* set the port manually since getsockname is stupid and doesn't */ - saddr_l.sin_port = htons(obj->port); + ((struct sockaddr_in *)&saddr_l)->sin_port = htons(obj->port); - if (iptostring((struct sockaddr *)&saddr_r, - sizeof(struct sockaddr_in), remoteip, 60)) + if (iptostring((struct sockaddr *)&saddr_r, addrsize, remoteip, 60)) return -1; - if (iptostring((struct sockaddr *)&saddr_l, - sizeof(struct sockaddr_in), localip, 60)) + if (iptostring((struct sockaddr *)&saddr_l, addrsize, localip, 60)) return -1; if(obj->conn) sasl_dispose(&obj->conn); Index: sieve/md5.c =================================================================== RCS file: /usr/home/ume/ncvs/src/cyrus-imapd2/sieve/md5.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- sieve/md5.c 16 Feb 2002 14:23:44 -0000 1.1.1.1 +++ sieve/md5.c 16 Feb 2002 14:25:16 -0000 1.2 @@ -31,7 +31,7 @@ #include "md5global.h" #include "md5.h" -#include "hmac-md5.h" +#include "sasl/hmac-md5.h" /* Constants for MD5Transform routine. */ Index: timsieved/timsieved.c =================================================================== RCS file: /usr/home/ume/ncvs/src/cyrus-imapd2/timsieved/timsieved.c,v retrieving revision 1.1.1.8 retrieving revision 1.10 diff -u -r1.1.1.8 -r1.10 --- timsieved/timsieved.c 3 Jul 2003 05:56:53 -0000 1.1.1.8 +++ timsieved/timsieved.c 18 Aug 2003 19:23:40 -0000 1.10 @@ -95,8 +95,8 @@ struct auth_state *sieved_authstate = 0; -struct sockaddr_in sieved_localaddr; -struct sockaddr_in sieved_remoteaddr; +struct sockaddr_storage sieved_localaddr; +struct sockaddr_storage sieved_remoteaddr; struct protstream *sieved_out; struct protstream *sieved_in; @@ -104,7 +104,7 @@ int sieved_logfd = -1; int sieved_haveaddr = 0; -char sieved_clienthost[250] = "[local]"; +char sieved_clienthost[NI_MAXHOST*2+1] = "[local]"; int sieved_userisadmin; @@ -201,11 +201,11 @@ int service_main(int argc, char **argv, char **envp) { socklen_t salen; - struct hostent *hp; int timeout; int secflags = 0; char remoteip[60], localip[60]; sasl_security_properties_t *secprops = NULL; + char hbuf[NI_MAXHOST]; /* set up the prot streams */ sieved_in = prot_new(0, 0); @@ -224,21 +224,22 @@ /* Find out name of client host */ salen = sizeof(sieved_remoteaddr); if (getpeername(0, (struct sockaddr *)&sieved_remoteaddr, &salen) == 0 && - sieved_remoteaddr.sin_family == AF_INET) { - if ((hp = gethostbyaddr((char *)&sieved_remoteaddr.sin_addr, - sizeof(sieved_remoteaddr.sin_addr), AF_INET))!=NULL) { - strncpy(sieved_clienthost, hp->h_name, sizeof(sieved_clienthost)-30); - sieved_clienthost[sizeof(sieved_clienthost)-30] = '\0'; + (sieved_remoteaddr.ss_family == AF_INET || + sieved_remoteaddr.ss_family == AF_INET6)) { + if (getnameinfo((struct sockaddr *)&sieved_remoteaddr, salen, + hbuf, sizeof(hbuf), NULL, 0, NI_NAMEREQD) == 0) { + strncpy(sieved_clienthost, hbuf, sizeof(hbuf)); } else { sieved_clienthost[0] = '\0'; } + getnameinfo((struct sockaddr *)&sieved_remoteaddr, salen, hbuf, + sizeof(hbuf), NULL, 0, NI_NUMERICHOST | NI_WITHSCOPEID); strcat(sieved_clienthost, "["); - strcat(sieved_clienthost, inet_ntoa(sieved_remoteaddr.sin_addr)); + strcat(sieved_clienthost, hbuf); strcat(sieved_clienthost, "]"); salen = sizeof(sieved_localaddr); - if (getsockname(0, (struct sockaddr *)&sieved_localaddr, &salen) == 0) - { + if (getsockname(0, (struct sockaddr *)&sieved_localaddr, &salen) == 0) { sieved_haveaddr = 1; } } @@ -260,12 +261,12 @@ fatal("SASL failed initializing: sasl_server_new()", -1); if(iptostring((struct sockaddr *)&sieved_remoteaddr, - sizeof(struct sockaddr_in), remoteip, 60) == 0) { + salen, remoteip, 60) == 0) { sasl_setprop(sieved_saslconn, SASL_IPREMOTEPORT, remoteip); saslprops.ipremoteport = xstrdup(remoteip); } if(iptostring((struct sockaddr *)&sieved_localaddr, - sizeof(struct sockaddr_in), localip, 60) == 0) { + salen, localip, 60) == 0) { sasl_setprop(sieved_saslconn, SASL_IPLOCALPORT, localip); saslprops.iplocalport = xstrdup(localip); }