Index: ncftp3/README.v6 diff -u /dev/null ncftp3/README.v6:1.1 --- /dev/null Sun Aug 6 12:33:33 2006 +++ ncftp3/README.v6 Tue Aug 6 14:06:35 2002 @@ -0,0 +1,2 @@ +If you have problem/trouble/suggestion for IPv6 related code, +Please contact to core@kame.net Index: ncftp3/config.h.in diff -u ncftp3/config.h.in:1.1.1.12 ncftp3/config.h.in:1.14 --- ncftp3/config.h.in:1.1.1.12 Sun Aug 6 12:30:29 2006 +++ ncftp3/config.h.in Sun Aug 6 12:33:17 2006 @@ -244,6 +244,9 @@ /* Define if you have the doupdate function. */ #undef HAVE_DOUPDATE +/* Define if you have the getaddrinfo function. */ +#undef HAVE_GETADDRINFO + /* Define if you have the fstat64 function. */ #undef HAVE_FSTAT64 @@ -265,6 +268,9 @@ /* Define if you have the gethostname function. */ #undef HAVE_GETHOSTNAME +/* Define if you have the getaddrname function. */ +#undef HAVE_GETNAMEINFO + /* Define if you have the getlogin_r function. */ #undef HAVE_GETLOGIN_R @@ -367,6 +373,9 @@ /* Define if you have the snprintf function. */ #undef HAVE_SNPRINTF +/* Define if sockaddr has sa_len member */ +#undef HAVE_SOCKADDR_SA_LEN + /* Define if you have the stat64 function. */ #undef HAVE_STAT64 @@ -519,3 +528,19 @@ /* Define if you have the socket library (-lsocket). */ #undef HAVE_LIBSOCKET + +/* Define if you have the socks5 library (-lsocks5). */ +#undef HAVE_LIBSOCKS5 + +/* Define if you want IPv6 support. */ +#undef ENABLE_IPV6 + +/* Define if sockaddr has sa_len member */ +#undef HAVE_SOCKADDR_SA_LEN + +/* Define if sockaddr_storage has ss_family member */ +#undef HAVE_SOCKADDR_STORAGE_SS_FAMILY + +/* Define if sockaddr_storage has __ss_family member */ +#undef HAVE_SOCKADDR_STORAGE___SS_FAMILY + Index: ncftp3/configure diff -u ncftp3/configure:1.1.1.17 ncftp3/configure:1.30 --- ncftp3/configure:1.1.1.17 Sun Aug 6 12:30:20 2006 +++ ncftp3/configure Sun Aug 6 12:33:17 2006 @@ -23,6 +23,9 @@ --disable-precomp disable use of precompiled header files" ac_help="$ac_help --with-socks5 try to find and use the SOCKS5 library" +ac_help="$ac_help + --enable-ipv6 Enable ipv6 (with ipv4) support + --disable-ipv6 Disable ipv6 support" # Initialize some variables set by options. # The variables have the same names as the options, with @@ -40,6 +43,7 @@ program_transform_name=s,x,x, silent= site= +sitefile= srcdir= target=NONE verbose= @@ -154,6 +158,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 @@ -324,6 +329,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=*) @@ -489,12 +499,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 @@ -607,30 +621,28 @@ - - echo $ac_n "checking if you set and exported the environment variable CC""... $ac_c" 1>&6 -echo "configure:614: checking if you set and exported the environment variable CC" >&5 +echo "configure:626: checking if you set and exported the environment variable CC" >&5 if test "x$CC" = x ; then echo "$ac_t""no (you may want to do that since configure scripts look for gcc first)" 1>&6 else echo "$ac_t""$CC" 1>&6 fi echo $ac_n "checking for environment variable CFLAGS""... $ac_c" 1>&6 -echo "configure:621: checking for environment variable CFLAGS" >&5 +echo "configure:633: checking for environment variable CFLAGS" >&5 if test "x$CFLAGS" = x ; then echo "$ac_t""no (we will choose a default set for you)" 1>&6 else echo "$ac_t""$CFLAGS" 1>&6 fi echo $ac_n "checking for environment variable CPPFLAGS""... $ac_c" 1>&6 -echo "configure:628: checking for environment variable CPPFLAGS" >&5 +echo "configure:640: checking for environment variable CPPFLAGS" >&5 echo "$ac_t""${CPPFLAGS-no}" 1>&6 echo $ac_n "checking for environment variable LDFLAGS""... $ac_c" 1>&6 -echo "configure:631: checking for environment variable LDFLAGS" >&5 +echo "configure:643: checking for environment variable LDFLAGS" >&5 echo "$ac_t""${LDFLAGS-no}" 1>&6 echo $ac_n "checking for environment variable LIBS""... $ac_c" 1>&6 -echo "configure:634: checking for environment variable LIBS" >&5 +echo "configure:646: checking for environment variable LIBS" >&5 echo "$ac_t""${LIBS-no}" 1>&6 @@ -1093,7 +1105,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:1097: checking for $ac_word" >&5 +echo "configure:1109: 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 @@ -1123,7 +1135,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:1127: checking for $ac_word" >&5 +echo "configure:1139: 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 @@ -1174,7 +1186,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:1178: checking for $ac_word" >&5 +echo "configure:1190: 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 @@ -1206,7 +1218,7 @@ fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 -echo "configure:1210: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 +echo "configure:1222: 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. @@ -1217,12 +1229,12 @@ cat > conftest.$ac_ext << EOF -#line 1221 "configure" +#line 1233 "configure" #include "confdefs.h" main(){return(0);} EOF -if { (eval echo configure:1226: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1238: \"$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 @@ -1248,12 +1260,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:1252: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 +echo "configure:1264: 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:1257: checking whether we are using GNU C" >&5 +echo "configure:1269: 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 @@ -1262,7 +1274,7 @@ yes; #endif EOF -if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:1266: \"$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:1278: \"$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 @@ -1281,7 +1293,7 @@ ac_save_CFLAGS="$CFLAGS" CFLAGS= echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 -echo "configure:1285: checking whether ${CC-cc} accepts -g" >&5 +echo "configure:1297: 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 @@ -1314,7 +1326,7 @@ echo $ac_n "checking if the C compiler can use precompiled headers""... $ac_c" 1>&6 -echo "configure:1318: checking if the C compiler can use precompiled headers" >&5 +echo "configure:1330: checking if the C compiler can use precompiled headers" >&5 if eval "test \"`echo '$''{'wi_cv_cc_precomp'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1354,14 +1366,14 @@ # echo "Successfully compiled pchtest.h into the precompiled header file pchtest.h.gch." >&5 cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1377: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* result="yes" ; wi_cv_cc_precomp_type="gcc_gch_files" else @@ -1380,14 +1392,14 @@ ${CC-cc} $CPPFLAGS -precomp pchtest.h -o pchtest.p >&5 2>&5 if test -s pchtest.p ; then cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1403: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* result="yes" ; wi_cv_cc_precomp_type="gcc_dash_precomp" else @@ -1465,7 +1477,7 @@ wi_request_no_y2k_warnings=yes echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6 -echo "configure:1469: checking how to run the C preprocessor" >&5 +echo "configure:1481: checking how to run the C preprocessor" >&5 # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= @@ -1480,13 +1492,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:1490: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1502: \"$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 : @@ -1497,13 +1509,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:1507: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1519: \"$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 : @@ -1514,13 +1526,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:1524: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1536: \"$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 : @@ -1551,7 +1563,7 @@ if test "$GCC" = yes ; then echo $ac_n "checking the version of GCC""... $ac_c" 1>&6 -echo "configure:1555: checking the version of GCC" >&5 +echo "configure:1567: checking the version of GCC" >&5 if eval "test \"`echo '$''{'wi_cv_gcc_version'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1574,7 +1586,7 @@ wi_cv_sunwspro_cc_version2="0" else echo $ac_n "checking if the C compiler is Sun WorkShop C""... $ac_c" 1>&6 -echo "configure:1578: checking if the C compiler is Sun WorkShop C" >&5 +echo "configure:1590: checking if the C compiler is Sun WorkShop C" >&5 if eval "test \"`echo '$''{'wi_cv_cc_is_sunwspro_cc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1608,14 +1620,14 @@ echo "$ac_t""$wi_cv_cc_is_sunwspro_cc" 1>&6 if test "$wi_cv_cc_is_sunwspro_cc" = yes ; then echo $ac_n "checking output of "cc -V" to determine version of Sun WorkShop C""... $ac_c" 1>&6 -echo "configure:1612: checking output of "cc -V" to determine version of Sun WorkShop C" >&5 +echo "configure:1624: checking output of "cc -V" to determine version of Sun WorkShop C" >&5 echo "$ac_t"""version $wi_cv_sunwspro_cc_version"" 1>&6 fi fi echo $ac_n "checking if we should customize your CFLAGS environment variable""... $ac_c" 1>&6 -echo "configure:1619: checking if we should customize your CFLAGS environment variable" >&5 +echo "configure:1631: checking if we should customize your CFLAGS environment variable" >&5 wi_replace_O_with_g="no" case "$wi_orig_CFLAGS" in "") @@ -1821,14 +1833,14 @@ # accepts this flag... # cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1844: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then : else echo "configure: failed program was:" >&5 @@ -1846,7 +1858,7 @@ echo $ac_n "checking for ldd""... $ac_c" 1>&6 -echo "configure:1850: checking for ldd" >&5 +echo "configure:1862: checking for ldd" >&5 if eval "test \"`echo '$''{'wi_cv_prog_ldd'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1871,7 +1883,7 @@ echo $ac_n "checking if compiled programs use a shared library version of libgcc""... $ac_c" 1>&6 -echo "configure:1875: checking if compiled programs use a shared library version of libgcc" >&5 +echo "configure:1887: checking if compiled programs use a shared library version of libgcc" >&5 if eval "test \"`echo '$''{'wi_cv_shared_libgcc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1910,14 +1922,14 @@ # accepts this flag... # cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1933: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then : else echo "configure: failed program was:" >&5 @@ -1948,14 +1960,14 @@ # accepts this flag... # cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1971: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then : else echo "configure: failed program was:" >&5 @@ -1995,7 +2007,7 @@ # Was it ./configure --enable-debug ? # echo $ac_n "checking if this is a debug build""... $ac_c" 1>&6 -echo "configure:1999: checking if this is a debug build" >&5 +echo "configure:2011: checking if this is a debug build" >&5 if test "$DEBUGBUILD" = yes ; then echo "$ac_t""yes" 1>&6 CFLAGS="$DEBUGCFLAGS" @@ -2003,20 +2015,20 @@ echo "$ac_t""no" 1>&6 fi echo $ac_n "checking NOOPTCFLAGS""... $ac_c" 1>&6 -echo "configure:2007: checking NOOPTCFLAGS" >&5 +echo "configure:2019: checking NOOPTCFLAGS" >&5 echo "$ac_t""$NOOPTCFLAGS" 1>&6 echo $ac_n "checking DEBUGCFLAGS""... $ac_c" 1>&6 -echo "configure:2010: checking DEBUGCFLAGS" >&5 +echo "configure:2022: checking DEBUGCFLAGS" >&5 echo "$ac_t""$DEBUGCFLAGS" 1>&6 echo $ac_n "checking CFLAGS""... $ac_c" 1>&6 -echo "configure:2013: checking CFLAGS" >&5 +echo "configure:2025: checking CFLAGS" >&5 echo "$ac_t""$CFLAGS" 1>&6 if test "os_${os}_gcc_${GCC}" = os_hp-ux_gcc_yes ; then CFLAGS=`echo "$CFLAGS" | sed s/-D__STDC_EXT__//g` echo $ac_n "checking if -D__STDC_EXT__ is needed with GCC on HP-UX""... $ac_c" 1>&6 -echo "configure:2020: checking if -D__STDC_EXT__ is needed with GCC on HP-UX" >&5 +echo "configure:2032: checking if -D__STDC_EXT__ is needed with GCC on HP-UX" >&5 if test "$cross_compiling" = yes; then # action if cross-compiling, guess @@ -2025,7 +2037,7 @@ else cat > conftest.$ac_ext < @@ -2041,7 +2053,7 @@ #endif } EOF -if { (eval echo configure:2045: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:2057: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then # action if true @@ -2080,7 +2092,7 @@ ;; esac echo $ac_n "checking if we should add to CFLAGS for LFS64 support""... $ac_c" 1>&6 -echo "configure:2084: checking if we should add to CFLAGS for LFS64 support" >&5 +echo "configure:2096: checking if we should add to CFLAGS for LFS64 support" >&5 echo "$ac_t""$CFLAGS" 1>&6 @@ -2092,12 +2104,12 @@ ;; esac echo $ac_n "checking if we should add -D_REENTRANT to CFLAGS""... $ac_c" 1>&6 -echo "configure:2096: checking if we should add -D_REENTRANT to CFLAGS" >&5 +echo "configure:2108: checking if we should add -D_REENTRANT to CFLAGS" >&5 echo "$ac_t""$CFLAGS" 1>&6 echo $ac_n "checking for strip""... $ac_c" 1>&6 -echo "configure:2101: checking for strip" >&5 +echo "configure:2113: checking for strip" >&5 STRIP="strip" if [ "x$cross_compiling" = "xyes" ] ; then machine=`${CC-gcc} -dumpmachine 2>/dev/null` @@ -2151,13 +2163,13 @@ STRIPFLAG="$SFLAG" echo $ac_n "checking for object suffix""... $ac_c" 1>&6 -echo "configure:2155: checking for object suffix" >&5 +echo "configure:2167: checking for object suffix" >&5 if eval "test \"`echo '$''{'ac_cv_objext'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else rm -f conftest* echo 'int i = 1;' > conftest.$ac_ext -if { (eval echo configure:2161: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2173: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then for ac_file in conftest.*; do case $ac_file in *.c) ;; @@ -2175,12 +2187,12 @@ ac_objext=$ac_cv_objext echo $ac_n "checking for Cygwin environment""... $ac_c" 1>&6 -echo "configure:2179: checking for Cygwin environment" >&5 +echo "configure:2191: checking for Cygwin environment" >&5 if eval "test \"`echo '$''{'ac_cv_cygwin'+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:2207: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_cygwin=yes else @@ -2208,19 +2220,19 @@ CYGWIN= test "$ac_cv_cygwin" = yes && CYGWIN=yes echo $ac_n "checking for mingw32 environment""... $ac_c" 1>&6 -echo "configure:2212: checking for mingw32 environment" >&5 +echo "configure:2224: checking for mingw32 environment" >&5 if eval "test \"`echo '$''{'ac_cv_mingw32'+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:2236: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_mingw32=yes else @@ -2239,7 +2251,7 @@ echo $ac_n "checking for executable suffix""... $ac_c" 1>&6 -echo "configure:2243: checking for executable suffix" >&5 +echo "configure:2255: checking for executable suffix" >&5 if eval "test \"`echo '$''{'ac_cv_exeext'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2249,10 +2261,10 @@ rm -f conftest* echo 'int main () { return 0; }' > conftest.$ac_ext ac_cv_exeext= - if { (eval echo configure:2253: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then + if { (eval echo configure:2265: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then for file in conftest.*; do case $file in - *.c | *.o | *.obj) ;; + *.c | *.C | *.o | *.obj | *.ilk | *.pdb) ;; *) ac_cv_exeext=`echo $file | sed -e s/conftest//` ;; esac done @@ -2283,7 +2295,7 @@ if test "${SYS-sunos}" = sunos ; then echo $ac_n "checking for System V compatibility directories""... $ac_c" 1>&6 -echo "configure:2287: checking for System V compatibility directories" >&5 +echo "configure:2299: checking for System V compatibility directories" >&5 echo "$ac_t""" 1>&6 incdir=""/usr/5include"" @@ -2326,12 +2338,12 @@ echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6 -echo "configure:2330: checking for ANSI C header files" >&5 +echo "configure:2342: checking for ANSI C header files" >&5 if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -2339,7 +2351,7 @@ #include EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2343: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:2355: \"$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* @@ -2356,7 +2368,7 @@ if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat > conftest.$ac_ext < EOF @@ -2374,7 +2386,7 @@ if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat > conftest.$ac_ext < EOF @@ -2395,7 +2407,7 @@ : else cat > conftest.$ac_ext < #define ISLOWER(c) ('a' <= (c) && (c) <= 'z') @@ -2406,7 +2418,7 @@ exit (0); } EOF -if { (eval echo configure:2410: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:2422: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then : else @@ -2433,17 +2445,17 @@ do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:2437: checking for $ac_hdr" >&5 +echo "configure:2449: 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:2447: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:2459: \"$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* @@ -2470,12 +2482,12 @@ done echo $ac_n "checking whether time.h and sys/time.h may both be included""... $ac_c" 1>&6 -echo "configure:2474: checking whether time.h and sys/time.h may both be included" >&5 +echo "configure:2486: checking whether time.h and sys/time.h may both be included" >&5 if eval "test \"`echo '$''{'ac_cv_header_time'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -2484,7 +2496,7 @@ struct tm *tp; ; return 0; } EOF -if { (eval echo configure:2488: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2500: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_header_time=yes else @@ -2516,17 +2528,17 @@ do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:2520: checking for $ac_hdr" >&5 +echo "configure:2532: 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:2530: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:2542: \"$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* @@ -2553,7 +2565,7 @@ done echo $ac_n "checking for UNIX domain sockets""... $ac_c" 1>&6 -echo "configure:2557: checking for UNIX domain sockets" >&5 +echo "configure:2569: checking for UNIX domain sockets" >&5 if eval "test \"`echo '$''{'wi_cv_unix_domain_sockets'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2566,7 +2578,7 @@ else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:2608: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then # action if true @@ -2626,13 +2638,13 @@ fi echo $ac_n "checking for sun_len field in struct sockaddr_un""... $ac_c" 1>&6 -echo "configure:2630: checking for sun_len field in struct sockaddr_un" >&5 +echo "configure:2642: checking for sun_len field in struct sockaddr_un" >&5 if eval "test \"`echo '$''{'wi_cv_sockaddr_un_sun_len'+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:2667: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* wi_cv_sockaddr_un_sun_len=yes @@ -2693,12 +2705,12 @@ # Mostly for SunOS 4 -- needs to come first because other libs depend on it echo $ac_n "checking for strerror""... $ac_c" 1>&6 -echo "configure:2697: checking for strerror" >&5 +echo "configure:2709: 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:2737: \"$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 @@ -2744,7 +2756,7 @@ if test "$a" = no ; then # Not in libc, try lib44bsd. echo $ac_n "checking for strerror in -l44bsd""... $ac_c" 1>&6 -echo "configure:2748: checking for strerror in -l44bsd" >&5 +echo "configure:2760: checking for strerror in -l44bsd" >&5 ac_lib_var=`echo 44bsd'_'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 @@ -2752,7 +2764,7 @@ ac_save_LIBS="$LIBS" LIBS="-l44bsd $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2779: \"$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 @@ -2795,12 +2807,12 @@ echo $ac_n "checking for socket""... $ac_c" 1>&6 -echo "configure:2799: checking for socket" >&5 +echo "configure:2811: checking for socket" >&5 if eval "test \"`echo '$''{'ac_cv_func_socket'+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:2839: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_socket=yes" else @@ -2846,7 +2858,7 @@ if test "$a" = no ; then # Not in libc, try libsocket. echo $ac_n "checking for socket in -lsocket""... $ac_c" 1>&6 -echo "configure:2850: checking for socket in -lsocket" >&5 +echo "configure:2862: checking for socket in -lsocket" >&5 ac_lib_var=`echo socket'_'socket | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -2854,7 +2866,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:2881: \"$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 @@ -2900,7 +2912,7 @@ unixware2*) # So far, only UnixWare needs this. echo $ac_n "checking for syslog in -lgen""... $ac_c" 1>&6 -echo "configure:2904: checking for syslog in -lgen" >&5 +echo "configure:2916: checking for syslog in -lgen" >&5 ac_lib_var=`echo gen'_'syslog | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -2908,7 +2920,7 @@ ac_save_LIBS="$LIBS" LIBS="-lgen $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2935: \"$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 @@ -2966,12 +2978,12 @@ # AC_CHECK_FUNC(socket,[a=yes],[a=no]) # echo $ac_n "checking for socket""... $ac_c" 1>&6 -echo "configure:2970: checking for socket" >&5 +echo "configure:2982: checking for socket" >&5 if eval "test \"`echo '$''{'ac_cv_func_socket'+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:3010: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_socket=yes" else @@ -3027,7 +3039,7 @@ hpux1123456789*) # HP-UX 11 uses NSL for YP services echo $ac_n "checking for getpwent in -lnsl""... $ac_c" 1>&6 -echo "configure:3031: checking for getpwent in -lnsl" >&5 +echo "configure:3043: checking for getpwent in -lnsl" >&5 ac_lib_var=`echo nsl'_'getpwent | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -3035,7 +3047,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:3062: \"$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 @@ -3077,12 +3089,12 @@ *) echo $ac_n "checking for gethostbyname""... $ac_c" 1>&6 -echo "configure:3081: checking for gethostbyname" >&5 +echo "configure:3093: checking for gethostbyname" >&5 if eval "test \"`echo '$''{'ac_cv_func_gethostbyname'+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:3121: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_gethostbyname=yes" else @@ -3128,7 +3140,7 @@ if test "$a" = no ; then # Not in libc, try libnsl. echo $ac_n "checking for gethostbyname in -lnsl""... $ac_c" 1>&6 -echo "configure:3132: checking for gethostbyname in -lnsl" >&5 +echo "configure:3144: 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 @@ -3136,7 +3148,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:3163: \"$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 @@ -3183,7 +3195,7 @@ # See if we could access two well-known sites without help of any special # libraries, like resolv. echo $ac_n "checking if we need to look for a separate DNS resolver library""... $ac_c" 1>&6 -echo "configure:3187: checking if we need to look for a separate DNS resolver library" >&5 +echo "configure:3199: checking if we need to look for a separate DNS resolver library" >&5 if eval "test \"`echo '$''{'wi_cv_look_for_resolv'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3201,7 +3213,7 @@ else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:3244: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then # action if true @@ -3256,7 +3268,7 @@ if test "$wi_cv_look_for_resolv" = yes ; then echo $ac_n "checking for main in -lresolv""... $ac_c" 1>&6 -echo "configure:3260: checking for main in -lresolv" >&5 +echo "configure:3272: checking for main in -lresolv" >&5 ac_lib_var=`echo resolv'_'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 @@ -3264,14 +3276,14 @@ 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:3287: \"$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 @@ -3322,7 +3334,7 @@ # if test "x$ac_cv_lib_db_main" = "x" ; then echo $ac_n "checking for main in -ldb""... $ac_c" 1>&6 -echo "configure:3326: checking for main in -ldb" >&5 +echo "configure:3338: checking for main in -ldb" >&5 ac_lib_var=`echo db'_'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 @@ -3330,14 +3342,14 @@ 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:3353: \"$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 @@ -3360,7 +3372,7 @@ fi if test "x$ac_cv_lib_isode_main" = "x" ; then echo $ac_n "checking for main in -lisode""... $ac_c" 1>&6 -echo "configure:3364: checking for main in -lisode" >&5 +echo "configure:3376: checking for main in -lisode" >&5 ac_lib_var=`echo isode'_'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 @@ -3368,14 +3380,14 @@ ac_save_LIBS="$LIBS" LIBS="-lisode $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 @@ -3398,7 +3410,7 @@ fi if test "x$ac_cv_lib_com_err_main" = "x" ; then echo $ac_n "checking for main in -lcom_err""... $ac_c" 1>&6 -echo "configure:3402: checking for main in -lcom_err" >&5 +echo "configure:3414: checking for main in -lcom_err" >&5 ac_lib_var=`echo com_err'_'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 @@ -3406,14 +3418,14 @@ 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: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 @@ -3436,7 +3448,7 @@ fi if test "x$ac_cv_lib_crypto_main" = "x" ; then echo $ac_n "checking for main in -lcrypto""... $ac_c" 1>&6 -echo "configure:3440: checking for main in -lcrypto" >&5 +echo "configure:3452: checking for main in -lcrypto" >&5 ac_lib_var=`echo crypto'_'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 @@ -3444,14 +3456,14 @@ ac_save_LIBS="$LIBS" LIBS="-lcrypto $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3467: \"$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 @@ -3474,7 +3486,7 @@ fi if test "x$ac_cv_lib_krb5_main" = "x" ; then echo $ac_n "checking for main in -lkrb5""... $ac_c" 1>&6 -echo "configure:3478: checking for main in -lkrb5" >&5 +echo "configure:3490: checking for main in -lkrb5" >&5 ac_lib_var=`echo krb5'_'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 @@ -3482,14 +3494,14 @@ ac_save_LIBS="$LIBS" LIBS="-lkrb5 $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3505: \"$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 @@ -3512,7 +3524,7 @@ fi if test "x$ac_cv_lib_gssapi_krb5_main" = "x" ; then echo $ac_n "checking for main in -lgssapi_krb5""... $ac_c" 1>&6 -echo "configure:3516: checking for main in -lgssapi_krb5" >&5 +echo "configure:3528: checking for main in -lgssapi_krb5" >&5 ac_lib_var=`echo gssapi_krb5'_'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 @@ -3520,14 +3532,14 @@ ac_save_LIBS="$LIBS" LIBS="-lgssapi_krb5 $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3543: \"$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 @@ -3550,7 +3562,7 @@ fi echo $ac_n "checking for SOCKSinit in -lsocks5""... $ac_c" 1>&6 -echo "configure:3554: checking for SOCKSinit in -lsocks5" >&5 +echo "configure:3566: checking for SOCKSinit in -lsocks5" >&5 ac_lib_var=`echo socks5'_'SOCKSinit | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -3558,7 +3570,7 @@ ac_save_LIBS="$LIBS" LIBS="-lsocks5 $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3585: \"$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 @@ -3593,17 +3605,17 @@ do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:3597: checking for $ac_hdr" >&5 +echo "configure:3609: 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:3607: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:3619: \"$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* @@ -3642,7 +3654,7 @@ fi fi echo $ac_n "checking if SOCKS5 will be used""... $ac_c" 1>&6 -echo "configure:3646: checking if SOCKS5 will be used" >&5 +echo "configure:3658: checking if SOCKS5 will be used" >&5 echo "$ac_t""$ac_cv_lib_socks5_SOCKSinit" 1>&6 @@ -3651,23 +3663,23 @@ echo $ac_n "checking for curses library headers""... $ac_c" 1>&6 -echo "configure:3655: checking for curses library headers" >&5 +echo "configure:3667: checking for curses library headers" >&5 if test "$wi_cv_ncurses" != "no" ; then for ac_hdr in ncurses.h curses.h termios.h termio.h sgtty.h sys/ioctl.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:3661: checking for $ac_hdr" >&5 +echo "configure:3673: 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:3671: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:3683: \"$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* @@ -3698,17 +3710,17 @@ do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:3702: checking for $ac_hdr" >&5 +echo "configure:3714: 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:3712: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:3724: \"$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* @@ -3746,7 +3758,7 @@ fi echo $ac_n "checking for curses library""... $ac_c" 1>&6 -echo "configure:3750: checking for curses library" >&5 +echo "configure:3762: checking for curses library" >&5 wi_cv_lib_curses=no wi_cv_lib_curses_result=no @@ -3759,7 +3771,7 @@ fi LIBS="$ac_save_LIBS $LIBCURSES" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3797: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* linked_with_LIBCURSES=yes @@ -3805,7 +3817,7 @@ else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:3846: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then # action if true @@ -3897,12 +3909,12 @@ echo $ac_n "checking for working const""... $ac_c" 1>&6 -echo "configure:3901: checking for working const" >&5 +echo "configure:3913: 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:3967: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_c_const=yes else @@ -3972,12 +3984,12 @@ fi echo $ac_n "checking for size_t""... $ac_c" 1>&6 -echo "configure:3976: checking for size_t" >&5 +echo "configure:3988: checking for size_t" >&5 if eval "test \"`echo '$''{'ac_cv_type_size_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #if STDC_HEADERS @@ -4005,12 +4017,12 @@ fi echo $ac_n "checking for off_t""... $ac_c" 1>&6 -echo "configure:4009: checking for off_t" >&5 +echo "configure:4021: checking for off_t" >&5 if eval "test \"`echo '$''{'ac_cv_type_off_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #if STDC_HEADERS @@ -4038,12 +4050,12 @@ fi echo $ac_n "checking for mode_t""... $ac_c" 1>&6 -echo "configure:4042: checking for mode_t" >&5 +echo "configure:4054: checking for mode_t" >&5 if eval "test \"`echo '$''{'ac_cv_type_mode_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #if STDC_HEADERS @@ -4071,12 +4083,12 @@ fi echo $ac_n "checking for pid_t""... $ac_c" 1>&6 -echo "configure:4075: checking for pid_t" >&5 +echo "configure:4087: checking for pid_t" >&5 if eval "test \"`echo '$''{'ac_cv_type_pid_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #if STDC_HEADERS @@ -4104,12 +4116,12 @@ fi echo $ac_n "checking for uid_t in sys/types.h""... $ac_c" 1>&6 -echo "configure:4108: checking for uid_t in sys/types.h" >&5 +echo "configure:4120: checking for uid_t in sys/types.h" >&5 if eval "test \"`echo '$''{'ac_cv_type_uid_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF @@ -4139,7 +4151,7 @@ echo $ac_n "checking what type main() should return""... $ac_c" 1>&6 -echo "configure:4143: checking what type main() should return" >&5 +echo "configure:4155: checking what type main() should return" >&5 if eval "test \"`echo '$''{'wi_cv_main_void_return_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4166,7 +4178,7 @@ fi echo $ac_n "checking for 64-bit integral type: long long""... $ac_c" 1>&6 -echo "configure:4170: checking for 64-bit integral type: long long" >&5 +echo "configure:4182: checking for 64-bit integral type: long long" >&5 LONGEST_INT="long" if test "$cross_compiling" = yes; then @@ -4177,7 +4189,7 @@ else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:4221: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then # action if true @@ -4231,7 +4243,7 @@ if test "$wi_cv_type_long_long" = yes ; then echo $ac_n "checking how to print a 64-bit integral type""... $ac_c" 1>&6 -echo "configure:4235: checking how to print a 64-bit integral type" >&5 +echo "configure:4247: checking how to print a 64-bit integral type" >&5 wi_cv_printf_long_long=fail if test "$cross_compiling" = yes; then @@ -4242,7 +4254,7 @@ else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:4287: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then # action if true @@ -4301,7 +4313,7 @@ else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:4346: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then # action if true @@ -4360,7 +4372,7 @@ echo $ac_n "checking how to scan a 64-bit integral type""... $ac_c" 1>&6 -echo "configure:4364: checking how to scan a 64-bit integral type" >&5 +echo "configure:4376: checking how to scan a 64-bit integral type" >&5 wi_cv_scanf_long_long=fail if test "$cross_compiling" = yes; then @@ -4371,7 +4383,7 @@ else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:4419: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then # action if true @@ -4433,7 +4445,7 @@ else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:4481: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then # action if true @@ -4496,7 +4508,7 @@ fi echo $ac_n "checking if everything was available to use the 64-bit integral type""... $ac_c" 1>&6 -echo "configure:4500: checking if everything was available to use the 64-bit integral type" >&5 +echo "configure:4512: checking if everything was available to use the 64-bit integral type" >&5 if test "$wi_cv_type_long_long" = no ; then wi_cv_use_long_long_msg_result="no (long long type not available)" @@ -4575,7 +4587,7 @@ wi_struct_timeval_field_checks="cached" echo $ac_n "checking what type the tv_sec field of struct timeval is""... $ac_c" 1>&6 -echo "configure:4579: checking what type the tv_sec field of struct timeval is" >&5 +echo "configure:4591: checking what type the tv_sec field of struct timeval is" >&5 if eval "test \"`echo '$''{'wi_cv_struct_timeval_tv_sec'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4596,7 +4608,7 @@ else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:4692: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then # action if true @@ -4710,12 +4722,12 @@ if test "$wi_struct_timeval_field_checks" = "uncached" ; then guess="$guess2" echo $ac_n "checking what type the tv_usec field of struct timeval is""... $ac_c" 1>&6 -echo "configure:4714: checking what type the tv_usec field of struct timeval is" >&5 +echo "configure:4726: checking what type the tv_usec field of struct timeval is" >&5 echo "$ac_t""$guess$wi_cv_struct_timeval_tv_usec" 1>&6 else guess="$guess2" echo $ac_n "checking what type the tv_usec field of struct timeval is""... $ac_c" 1>&6 -echo "configure:4719: checking what type the tv_usec field of struct timeval is" >&5 +echo "configure:4731: checking what type the tv_usec field of struct timeval is" >&5 if eval "test \"`echo '$''{'wi_cv_struct_timeval_tv_usec'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4739,7 +4751,7 @@ # Extract the first word of ""perl"", so it can be a program name with args. set dummy "perl"; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4743: checking for $ac_word" >&5 +echo "configure:4755: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_PERL'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4777,7 +4789,7 @@ # Extract the first word of ""mktemp"", so it can be a program name with args. set dummy "mktemp"; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4781: checking for $ac_word" >&5 +echo "configure:4793: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_MKTEMP'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4822,7 +4834,7 @@ fi echo $ac_n "checking for return type from write""... $ac_c" 1>&6 -echo "configure:4826: checking for return type from write" >&5 +echo "configure:4838: checking for return type from write" >&5 if eval "test \"`echo '$''{'wi_cv_write_return_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -5133,35 +5145,35 @@ echo "$ac_t""$wi_cv_write_return_t" 1>&6 if test "x$used_cache_for_wi_unistd_fpt" = "xno" ; then echo $ac_n "checking for size parameter to write""... $ac_c" 1>&6 -echo "configure:5137: checking for size parameter to write" >&5 +echo "configure:5149: checking for size parameter to write" >&5 echo "$ac_t""$wi_cv_write_size_t" 1>&6 echo $ac_n "checking for return type from send""... $ac_c" 1>&6 -echo "configure:5140: checking for return type from send" >&5 +echo "configure:5152: checking for return type from send" >&5 echo "$ac_t""$wi_cv_send_return_t" 1>&6 echo $ac_n "checking for size parameter to send""... $ac_c" 1>&6 -echo "configure:5143: checking for size parameter to send" >&5 +echo "configure:5155: checking for size parameter to send" >&5 echo "$ac_t""$wi_cv_send_size_t" 1>&6 echo $ac_n "checking for size parameter to connect""... $ac_c" 1>&6 -echo "configure:5146: checking for size parameter to connect" >&5 +echo "configure:5158: checking for size parameter to connect" >&5 echo "$ac_t""$wi_cv_sockaddr_size_t" 1>&6 echo $ac_n "checking for size parameter to setsockopt""... $ac_c" 1>&6 -echo "configure:5149: checking for size parameter to setsockopt" >&5 +echo "configure:5161: checking for size parameter to setsockopt" >&5 echo "$ac_t""$wi_cv_sockopt_size_t" 1>&6 echo $ac_n "checking for backlog parameter to listen""... $ac_c" 1>&6 -echo "configure:5152: checking for backlog parameter to listen" >&5 +echo "configure:5164: checking for backlog parameter to listen" >&5 echo "$ac_t""$wi_cv_listen_backlog_t" 1>&6 echo $ac_n "checking for seconds parameter to alarm""... $ac_c" 1>&6 -echo "configure:5155: checking for seconds parameter to alarm" >&5 +echo "configure:5167: checking for seconds parameter to alarm" >&5 echo "$ac_t""$wi_cv_alarm_time_t" 1>&6 echo $ac_n "checking for address parameter to gethostbyaddr""... $ac_c" 1>&6 -echo "configure:5158: checking for address parameter to gethostbyaddr" >&5 +echo "configure:5170: checking for address parameter to gethostbyaddr" >&5 echo "$ac_t""$wi_cv_gethost_addrptr_t" 1>&6 echo $ac_n "checking for size parameter to gethostname""... $ac_c" 1>&6 -echo "configure:5161: checking for size parameter to gethostname" >&5 +echo "configure:5173: checking for size parameter to gethostname" >&5 echo "$ac_t""$wi_cv_gethostname_size_t" 1>&6 else echo $ac_n "checking for size parameter to write""... $ac_c" 1>&6 -echo "configure:5165: checking for size parameter to write" >&5 +echo "configure:5177: checking for size parameter to write" >&5 if eval "test \"`echo '$''{'wi_cv_write_size_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -5170,7 +5182,7 @@ echo "$ac_t""$wi_cv_write_size_t" 1>&6 echo $ac_n "checking for return type from send""... $ac_c" 1>&6 -echo "configure:5174: checking for return type from send" >&5 +echo "configure:5186: checking for return type from send" >&5 if eval "test \"`echo '$''{'wi_cv_send_return_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -5179,7 +5191,7 @@ echo "$ac_t""$wi_cv_send_return_t" 1>&6 echo $ac_n "checking for size parameter to send""... $ac_c" 1>&6 -echo "configure:5183: checking for size parameter to send" >&5 +echo "configure:5195: checking for size parameter to send" >&5 if eval "test \"`echo '$''{'wi_cv_send_size_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -5188,7 +5200,7 @@ echo "$ac_t""$wi_cv_send_size_t" 1>&6 echo $ac_n "checking for size parameter to connect""... $ac_c" 1>&6 -echo "configure:5192: checking for size parameter to connect" >&5 +echo "configure:5204: checking for size parameter to connect" >&5 if eval "test \"`echo '$''{'wi_cv_sockaddr_size_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -5197,7 +5209,7 @@ echo "$ac_t""$wi_cv_sockaddr_size_t" 1>&6 echo $ac_n "checking for size parameter to setsockopt""... $ac_c" 1>&6 -echo "configure:5201: checking for size parameter to setsockopt" >&5 +echo "configure:5213: checking for size parameter to setsockopt" >&5 if eval "test \"`echo '$''{'wi_cv_sockopt_size_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -5206,7 +5218,7 @@ echo "$ac_t""$wi_cv_sockopt_size_t" 1>&6 echo $ac_n "checking for backlog parameter to listen""... $ac_c" 1>&6 -echo "configure:5210: checking for backlog parameter to listen" >&5 +echo "configure:5222: checking for backlog parameter to listen" >&5 if eval "test \"`echo '$''{'wi_cv_listen_backlog_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -5215,7 +5227,7 @@ echo "$ac_t""$wi_cv_listen_backlog_t" 1>&6 echo $ac_n "checking for seconds parameter to alarm""... $ac_c" 1>&6 -echo "configure:5219: checking for seconds parameter to alarm" >&5 +echo "configure:5231: checking for seconds parameter to alarm" >&5 if eval "test \"`echo '$''{'wi_cv_alarm_time_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -5224,7 +5236,7 @@ echo "$ac_t""$wi_cv_alarm_time_t" 1>&6 echo $ac_n "checking for address parameter to gethostbyaddr""... $ac_c" 1>&6 -echo "configure:5228: checking for address parameter to gethostbyaddr" >&5 +echo "configure:5240: checking for address parameter to gethostbyaddr" >&5 if eval "test \"`echo '$''{'wi_cv_gethost_addrptr_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -5233,7 +5245,7 @@ echo "$ac_t""$wi_cv_gethost_addrptr_t" 1>&6 echo $ac_n "checking for size parameter to gethostname""... $ac_c" 1>&6 -echo "configure:5237: checking for size parameter to gethostname" >&5 +echo "configure:5249: checking for size parameter to gethostname" >&5 if eval "test \"`echo '$''{'wi_cv_gethostname_size_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -5307,7 +5319,7 @@ fi echo $ac_n "checking types of arguments for select()""... $ac_c" 1>&6 -echo "configure:5311: checking types of arguments for select()" >&5 +echo "configure:5323: checking types of arguments for select()" >&5 if eval "test \"`echo '$''{'ac_cv_func_select_arg234'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -5321,7 +5333,7 @@ for ac_cv_func_select_arg1 in 'int' 'size_t' 'unsigned long' 'unsigned'; do for ac_cv_func_select_arg5 in 'struct timeval *' 'const struct timeval *'; do cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5356: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_not_found=no ; break 3 else @@ -5380,9 +5392,9 @@ echo $ac_n "checking for struct stat64""... $ac_c" 1>&6 -echo "configure:5384: checking for struct stat64" >&5 +echo "configure:5396: checking for struct stat64" >&5 cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5415: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* wi_cv_struct_stat64=yes @@ -5426,9 +5438,9 @@ fi echo $ac_n "checking for sig_atomic_t""... $ac_c" 1>&6 -echo "configure:5430: checking for sig_atomic_t" >&5 +echo "configure:5442: checking for sig_atomic_t" >&5 cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5469: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_cv_type_sig_atomic_t=yes @@ -5477,7 +5489,7 @@ echo $ac_n "checking how to access getopt() global variables""... $ac_c" 1>&6 -echo "configure:5481: checking how to access getopt() global variables" >&5 +echo "configure:5493: checking how to access getopt() global variables" >&5 if eval "test \"`echo '$''{'wi_cv_getopt_decl'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -5488,7 +5500,7 @@ fi cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5523: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* wi_cv_getopt_decl="automatic" else @@ -5522,7 +5534,7 @@ if test "$wi_cv_getopt_decl" = unknown ; then cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5558: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* # @@ -5580,9 +5592,9 @@ echo $ac_n "checking for useable _res global variable""... $ac_c" 1>&6 -echo "configure:5584: checking for useable _res global variable" >&5 +echo "configure:5596: checking for useable _res global variable" >&5 cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5625: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* wi_cv__res_defdname=yes @@ -5630,13 +5642,13 @@ echo "$ac_t""$wi_cv__res_defdname" 1>&6 echo $ac_n "checking for struct cmsghdr""... $ac_c" 1>&6 -echo "configure:5634: checking for struct cmsghdr" >&5 +echo "configure:5646: checking for struct cmsghdr" >&5 if eval "test \"`echo '$''{'wi_cv_struct_cmsghdr'+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:5673: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* wi_cv_struct_cmsghdr=yes @@ -5683,13 +5695,13 @@ fi echo $ac_n "checking for msg_control field in struct msghdr""... $ac_c" 1>&6 -echo "configure:5687: checking for msg_control field in struct msghdr" >&5 +echo "configure:5699: checking for msg_control field in struct msghdr" >&5 if eval "test \"`echo '$''{'wi_cv_msghdr_control'+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:5725: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* wi_cv_msghdr_control=yes @@ -5735,13 +5747,13 @@ fi echo $ac_n "checking for msg_accrights field in struct msghdr""... $ac_c" 1>&6 -echo "configure:5739: checking for msg_accrights field in struct msghdr" >&5 +echo "configure:5751: checking for msg_accrights field in struct msghdr" >&5 if eval "test \"`echo '$''{'wi_cv_msghdr_accrights'+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:5777: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* wi_cv_msghdr_accrights=yes @@ -5801,17 +5813,17 @@ do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:5805: checking for $ac_hdr" >&5 +echo "configure:5817: 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:5815: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:5827: \"$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,11 +5851,11 @@ if test "$ac_cv_header_sys_select_h" = yes ; then echo $ac_n "checking if is compatible with ""... $ac_c" 1>&6 -echo "configure:5843: checking if is compatible with " >&5 +echo "configure:5855: checking if is compatible with " >&5 selecth=yes if test "$ac_cv_header_sys_time_h" = yes ; then cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5879: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* selecth=yes else @@ -5884,6 +5896,354 @@ fi +echo $ac_n "checking whether to enable ipv6""... $ac_c" 1>&6 +echo "configure:5901: checking whether to enable ipv6" >&5 +# Check whether --enable-ipv6 or --disable-ipv6 was given. +if test "${enable_ipv6+set}" = set; then + enableval="$enable_ipv6" + case "$enableval" in + no) + echo "$ac_t""no" 1>&6 + ipv6=no + ;; + *) echo "$ac_t""yes" 1>&6 + cat >> confdefs.h <<\EOF +#define ENABLE_IPV6 1 +EOF + + ipv6=yes + ;; + esac +else + if test "$cross_compiling" = yes; then + echo "$ac_t""no" 1>&6 + ipv6=no + +else + cat > conftest.$ac_ext < +#include +main() +{ + if (socket(AF_INET6, SOCK_STREAM, 0) < 0) + exit(1); + else + exit(0); +} + +EOF +if { (eval echo configure:5940: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +then + echo "$ac_t""yes" 1>&6 + cat >> confdefs.h <<\EOF +#define ENABLE_IPV6 1 +EOF + + ipv6=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -fr conftest* + echo "$ac_t""no" 1>&6 + ipv6=no +fi +rm -fr conftest* +fi + +fi + + +echo $ac_n "checking for getnameinfo""... $ac_c" 1>&6 +echo "configure:5962: 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 < +/* 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 getnameinfo(); + +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_getnameinfo) || defined (__stub___getnameinfo) +choke me +#else +getnameinfo(); +#endif + +; return 0; } +EOF +if { (eval echo configure:5990: \"$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 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_func_getnameinfo=no" +fi +rm -f conftest* +fi + +if eval "test \"`echo '$ac_cv_func_'getnameinfo`\" = yes"; then + echo "$ac_t""yes" 1>&6 + + cat >> confdefs.h <<\EOF +#define HAVE_GETNAMEINFO 1 +EOF + +else + echo "$ac_t""no" 1>&6 + + LIBOBJS="$LIBOBJS getnameinfo.o" + LIBSOBJS="$LIBSOBJS getnameinfo.so" + +fi + + +echo $ac_n "checking for getaddrinfo""... $ac_c" 1>&6 +echo "configure:6019: 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 < +/* 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 getaddrinfo(); + +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_getaddrinfo) || defined (__stub___getaddrinfo) +choke me +#else +getaddrinfo(); +#endif + +; return 0; } +EOF +if { (eval echo configure:6047: \"$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 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_func_getaddrinfo=no" +fi +rm -f conftest* +fi + +if eval "test \"`echo '$ac_cv_func_'getaddrinfo`\" = yes"; then + echo "$ac_t""yes" 1>&6 + +echo $ac_n "checking getaddrinfo bug""... $ac_c" 1>&6 +echo "configure:6063: checking getaddrinfo bug" >&5 +if test "$cross_compiling" = yes; then + { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } +else + cat > conftest.$ac_ext < +#include +#include +#include +#include + +main() +{ + int passive, gaierr, inet4 = 0, inet6 = 0; + struct addrinfo hints, *ai, *aitop; + char straddr[INET6_ADDRSTRLEN], strport[16]; + + for (passive = 0; passive <= 1; passive++) { + memset(&hints, 0, sizeof(hints)); + hints.ai_family = AF_UNSPEC; + hints.ai_flags = passive ? AI_PASSIVE : 0; + hints.ai_socktype = SOCK_STREAM; + if ((gaierr = getaddrinfo(NULL, "54321", &hints, &aitop)) != 0) { + (void)gai_strerror(gaierr); + goto bad; + } + for (ai = aitop; ai; ai = ai->ai_next) { + if (ai->ai_addr == NULL || + ai->ai_addrlen == 0 || + getnameinfo(ai->ai_addr, ai->ai_addrlen, + straddr, sizeof(straddr), strport, sizeof(strport), + NI_NUMERICHOST|NI_NUMERICSERV) != 0) { + goto bad; + } + switch (ai->ai_family) { + case AF_INET: + if (strcmp(strport, "54321") != 0) { + goto bad; + } + if (passive) { + if (strcmp(straddr, "0.0.0.0") != 0) { + goto bad; + } + } else { + if (strcmp(straddr, "127.0.0.1") != 0) { + goto bad; + } + } + inet4++; + break; + case AF_INET6: + if (strcmp(strport, "54321") != 0) { + goto bad; + } + if (passive) { + if (strcmp(straddr, "::") != 0) { + goto bad; + } + } else { + if (strcmp(straddr, "::1") != 0) { + goto bad; + } + } + inet6++; + break; + case AF_UNSPEC: + goto bad; + break; + default: + /* another family support? */ + break; + } + } + } + + if (!(inet4 == 0 || inet4 == 2)) + goto bad; + if (!(inet6 == 0 || inet6 == 2)) + goto bad; + + if (aitop) + freeaddrinfo(aitop); + exit(0); + + bad: + if (aitop) + freeaddrinfo(aitop); + exit(1); +} + +EOF +if { (eval echo configure:6157: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +then + + echo "$ac_t""good" 1>&6 + cat >> confdefs.h <<\EOF +#define HAVE_GETADDRINFO 1 +EOF + +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -fr conftest* + + echo "$ac_t""buggy" 1>&6 + LIBOBJS="$LIBOBJS getaddrinfo.o" + LIBSOBJS="$LIBSOBJS getaddrinfo.so" +fi +rm -fr conftest* +fi + +else + echo "$ac_t""no" 1>&6 + + LIBOBJS="$LIBOBJS getaddrinfo.o" + LIBSOBJS="$LIBSOBJS getaddrinfo.so" + +fi + + +# check if sockaddr has sa_len member +echo $ac_n "checking if sockaddr has sa_len member""... $ac_c" 1>&6 +echo "configure:6188: checking if sockaddr has sa_len member" >&5 +cat > conftest.$ac_ext < +#include +int main() { +struct sockaddr x; +x.sa_len = 0; +; return 0; } +EOF +if { (eval echo configure:6199: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + echo "$ac_t""yes" 1>&6 + cat >> confdefs.h <<\EOF +#define HAVE_SOCKADDR_SA_LEN 1 +EOF + +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + echo "$ac_t""no" 1>&6 +fi +rm -f conftest* + +# check if sockaddr_storage has ss_family member +echo $ac_n "checking if sockaddr_storage has ss_family member""... $ac_c" 1>&6 +echo "configure:6216: checking if sockaddr_storage has ss_family member" >&5 +cat > conftest.$ac_ext < +#include +int main() { +struct sockaddr_storage x; +x.__ss_family = 0; +; return 0; } +EOF +if { (eval echo configure:6227: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + echo "$ac_t""yes" 1>&6 + cat >> confdefs.h <<\EOF +#define HAVE_SOCKADDR_STORAGE_SS_FAMILY 1 +EOF + +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + echo "$ac_t""no" 1>&6 + cat >> confdefs.h <<\EOF +#define HAVE_SOCKADDR_STORAGE___SS_FAMILY 1 +EOF + + CPPFLAGS="$CPPFLAGS -D__ss_family=ss_family -D__ss_len=ss_len" +fi +rm -f conftest* + +CPPFLAGS="-I$MAINDIR $CPPFLAGS" if test "${SYS}" = sunos ; then @@ -5892,12 +6252,12 @@ for ac_func in getwd do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:5896: checking for $ac_func" >&5 +echo "configure:6256: 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:6284: \"$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 @@ -5948,12 +6308,12 @@ for ac_func in getcwd getwd do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:5952: checking for $ac_func" >&5 +echo "configure:6312: 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:6340: \"$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 @@ -6014,12 +6374,12 @@ for ac_func in fstat64 getdomainname gethostname getpass getpassphrase gnu_get_libc_release gnu_get_libc_version inet_aton inet_ntop llseek lseek64 lstat64 memmove mktime open64 pathconf readlink res_init setlocale setpgid setpgrp setsid setvbuf sigaction sigsetjmp stat64 strcasecmp strcoll strdup strerror strncoll strstr strtoq symlink sysconf sysctl sysinfo syslog tcgetattr uname waitpid do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:6018: checking for $ac_func" >&5 +echo "configure:6378: 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:6406: \"$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 @@ -6069,12 +6429,12 @@ for ac_func in gethostbyaddr_r gethostbyname_r gethostbyname2_r getlogin_r getpwnam_r _posix_getpwnam_r getpwuid_r _posix_getpwuid_r getservbyname_r getservbyport_r gmtime_r localtime_r readdir_r do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:6073: checking for $ac_func" >&5 +echo "configure:6433: 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:6461: \"$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 @@ -6128,12 +6488,12 @@ for ac_func in snprintf vsnprintf do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:6132: checking for $ac_func" >&5 +echo "configure:6492: 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:6520: \"$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 @@ -6184,7 +6544,7 @@ if test "$ac_cv_func_snprintf" != "no" ; then echo $ac_n "checking if snprintf works correctly""... $ac_c" 1>&6 -echo "configure:6188: checking if snprintf works correctly" >&5 +echo "configure:6548: checking if snprintf works correctly" >&5 if test "x$ac_cv_header_unistd_h" = x ; then { echo "configure: error: Script needs to check for before calling wi_SNPRINTF_TERMINATES." 1>&2; exit 1; } @@ -6203,7 +6563,7 @@ else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:6605: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then # action if true @@ -6272,7 +6632,7 @@ echo $ac_n "checking what snprintf() returns""... $ac_c" 1>&6 -echo "configure:6276: checking what snprintf() returns" >&5 +echo "configure:6636: checking what snprintf() returns" >&5 if test "$cross_compiling" = yes; then # action if cross compiling @@ -6282,7 +6642,7 @@ else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:6679: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then # action if true @@ -6346,7 +6706,7 @@ if [ "$ac_cv_func_snprintf" = "no" ] || [ "$wi_cv_snprintf_terminates" = "no" ] || [ "$wi_cv_snprintf_returns_ptr" = "yes" ] ; then echo $ac_n "checking for snprintf in -lsnprintf""... $ac_c" 1>&6 -echo "configure:6350: checking for snprintf in -lsnprintf" >&5 +echo "configure:6710: checking for snprintf in -lsnprintf" >&5 ac_lib_var=`echo snprintf'_'snprintf | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -6354,7 +6714,7 @@ ac_save_LIBS="$LIBS" LIBS="-lsnprintf $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:6729: \"$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 @@ -6398,17 +6758,17 @@ do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:6402: checking for $ac_hdr" >&5 +echo "configure:6762: 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:6412: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:6772: \"$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* @@ -6437,12 +6797,12 @@ for ac_func in snprintf vsnprintf do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:6441: checking for $ac_func" >&5 +echo "configure:6801: 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:6829: \"$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 @@ -6496,7 +6856,7 @@ if [ "$ac_cv_func_snprintf" = "no" ] || [ "$wi_cv_snprintf_terminates" = "no" ] || [ "$wi_cv_snprintf_returns_ptr" = "yes" ] ; then echo $ac_n "checking for snprintf in -lsnprintf""... $ac_c" 1>&6 -echo "configure:6500: checking for snprintf in -lsnprintf" >&5 +echo "configure:6860: checking for snprintf in -lsnprintf" >&5 ac_lib_var=`echo snprintf'_'snprintf | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -6504,7 +6864,7 @@ ac_save_LIBS="$LIBS" LIBS="-lsnprintf $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:6879: \"$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 @@ -6548,17 +6908,17 @@ do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:6552: checking for $ac_hdr" >&5 +echo "configure:6912: 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:6562: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:6922: \"$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* @@ -6587,12 +6947,12 @@ for ac_func in snprintf vsnprintf do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:6591: checking for $ac_func" >&5 +echo "configure:6951: 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:6979: \"$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 @@ -6645,7 +7005,7 @@ if test "$ac_cv_func_snprintf" != "no" ; then echo $ac_n "checking if snprintf works correctly""... $ac_c" 1>&6 -echo "configure:6649: checking if snprintf works correctly" >&5 +echo "configure:7009: checking if snprintf works correctly" >&5 if test "x$ac_cv_header_unistd_h" = x ; then { echo "configure: error: Script needs to check for before calling wi_SNPRINTF_TERMINATES." 1>&2; exit 1; } @@ -6664,7 +7024,7 @@ else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:7066: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then # action if true @@ -6733,7 +7093,7 @@ echo $ac_n "checking what snprintf() returns""... $ac_c" 1>&6 -echo "configure:6737: checking what snprintf() returns" >&5 +echo "configure:7097: checking what snprintf() returns" >&5 if test "$cross_compiling" = yes; then # action if cross compiling @@ -6743,7 +7103,7 @@ else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:7140: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then # action if true @@ -6813,14 +7173,14 @@ fi echo $ac_n "checking for sigsetjmp and siglongjmp""... $ac_c" 1>&6 -echo "configure:6817: checking for sigsetjmp and siglongjmp" >&5 +echo "configure:7177: checking for sigsetjmp and siglongjmp" >&5 if eval "test \"`echo '$''{'wi_cv_func_sigsetjmp'+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:7207: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* wi_cv_func_sigsetjmp=yes @@ -6873,12 +7233,12 @@ for ac_func in setpgid setpgrp do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:6877: checking for $ac_func" >&5 +echo "configure:7237: 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:7265: \"$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 @@ -6927,7 +7287,7 @@ fi echo $ac_n "checking if setpgrp behavior needs to be checked""... $ac_c" 1>&6 -echo "configure:6931: checking if setpgrp behavior needs to be checked" >&5 +echo "configure:7291: checking if setpgrp behavior needs to be checked" >&5 if test "x$ac_cv_func_setpgid" = "xyes" ; then # OK, we will be using setpgid instead of setpgrp then... echo "$ac_t""no" 1>&6 @@ -6935,7 +7295,7 @@ elif test "x$cross_compiling" = "xyes" ; then echo "$ac_t""yes" 1>&6 echo $ac_n "checking whether setpgrp takes no argument""... $ac_c" 1>&6 -echo "configure:6939: checking whether setpgrp takes no argument" >&5 +echo "configure:7299: checking whether setpgrp takes no argument" >&5 case "`uname -a`" in *BSD*|*bsd*) ac_cv_func_setpgrp_void="no" @@ -6953,7 +7313,7 @@ # We're not cross compiling, so we can try this check echo "$ac_t""yes" 1>&6 echo $ac_n "checking whether setpgrp takes no argument""... $ac_c" 1>&6 -echo "configure:6957: checking whether setpgrp takes no argument" >&5 +echo "configure:7317: checking whether setpgrp takes no argument" >&5 if eval "test \"`echo '$''{'ac_cv_func_setpgrp_void'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -6961,7 +7321,7 @@ { echo "configure: error: cannot check setpgrp if cross compiling" 1>&2; exit 1; } else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:7345: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_func_setpgrp_void=no else @@ -7008,13 +7368,13 @@ echo $ac_n "checking whether setvbuf behavior can be checked""... $ac_c" 1>&6 -echo "configure:7012: checking whether setvbuf behavior can be checked" >&5 +echo "configure:7372: checking whether setvbuf behavior can be checked" >&5 if test "x$cross_compiling" = "xyes" ; then echo "$ac_t""no" 1>&6 else echo "$ac_t""yes" 1>&6 echo $ac_n "checking whether setvbuf arguments are reversed""... $ac_c" 1>&6 -echo "configure:7018: checking whether setvbuf arguments are reversed" >&5 +echo "configure:7378: checking whether setvbuf arguments are reversed" >&5 if eval "test \"`echo '$''{'ac_cv_func_setvbuf_reversed'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -7022,7 +7382,7 @@ ac_cv_func_setvbuf_reversed=no else cat > conftest.$ac_ext < /* If setvbuf has the reversed format, exit 0. */ @@ -7036,7 +7396,7 @@ exit(0); /* Non-reversed systems segv here. */ } EOF -if { (eval echo configure:7040: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:7400: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_func_setvbuf_reversed=yes else @@ -7063,19 +7423,19 @@ # The Ultrix 4.2 mips builtin alloca declared by alloca.h only works # for constant arguments. Useless! echo $ac_n "checking for working alloca.h""... $ac_c" 1>&6 -echo "configure:7067: checking for working alloca.h" >&5 +echo "configure:7427: checking for working alloca.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_alloca_h'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < int main() { char *p = alloca(2 * sizeof(int)); ; return 0; } EOF -if { (eval echo configure:7079: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:7439: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_cv_header_alloca_h=yes else @@ -7096,12 +7456,12 @@ fi echo $ac_n "checking for alloca""... $ac_c" 1>&6 -echo "configure:7100: checking for alloca" >&5 +echo "configure:7460: checking for alloca" >&5 if eval "test \"`echo '$''{'ac_cv_func_alloca_works'+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:7493: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_cv_func_alloca_works=yes else @@ -7161,12 +7521,12 @@ echo $ac_n "checking whether alloca needs Cray hooks""... $ac_c" 1>&6 -echo "configure:7165: checking whether alloca needs Cray hooks" >&5 +echo "configure:7525: checking whether alloca needs Cray hooks" >&5 if eval "test \"`echo '$''{'ac_cv_os_cray'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&6 -echo "configure:7195: checking for $ac_func" >&5 +echo "configure:7555: 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:7583: \"$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 @@ -7246,7 +7606,7 @@ fi echo $ac_n "checking stack direction for C alloca""... $ac_c" 1>&6 -echo "configure:7250: checking stack direction for C alloca" >&5 +echo "configure:7610: checking stack direction for C alloca" >&5 if eval "test \"`echo '$''{'ac_cv_c_stack_direction'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -7254,7 +7614,7 @@ ac_cv_c_stack_direction=0 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:7637: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_c_stack_direction=1 else @@ -7314,7 +7674,7 @@ fi echo $ac_n "checking string parameter to waddstr""... $ac_c" 1>&6 -echo "configure:7318: checking string parameter to waddstr" >&5 +echo "configure:7678: checking string parameter to waddstr" >&5 if eval "test \"`echo '$''{'wi_cv_waddstr_str_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -7517,9 +7877,9 @@ # maxx or _maxx echo $ac_n "checking whether curses structure has maxx or _maxx field""... $ac_c" 1>&6 -echo "configure:7521: checking whether curses structure has maxx or _maxx field" >&5 +echo "configure:7881: checking whether curses structure has maxx or _maxx field" >&5 cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:7913: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* echo "$ac_t""maxx" 1>&6 @@ -7572,12 +7932,12 @@ for ac_func in __getcurx __getcury __getmaxx __getmaxy __getbegx __getbegy do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:7576: checking for $ac_func" >&5 +echo "configure:7936: 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:7964: \"$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 @@ -7628,9 +7988,9 @@ # getcurx echo $ac_n "checking for getcurx() functionality in curses library""... $ac_c" 1>&6 -echo "configure:7632: checking for getcurx() functionality in curses library" >&5 +echo "configure:7992: checking for getcurx() functionality in curses library" >&5 cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:8024: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* cat >> confdefs.h <<\EOF @@ -7681,9 +8041,9 @@ # getyx echo $ac_n "checking for getyx() functionality in curses library""... $ac_c" 1>&6 -echo "configure:7685: checking for getyx() functionality in curses library" >&5 +echo "configure:8045: checking for getyx() functionality in curses library" >&5 cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:8077: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* cat >> confdefs.h <<\EOF @@ -7734,9 +8094,9 @@ # getmaxx echo $ac_n "checking for getmaxx() functionality in curses library""... $ac_c" 1>&6 -echo "configure:7738: checking for getmaxx() functionality in curses library" >&5 +echo "configure:8098: checking for getmaxx() functionality in curses library" >&5 cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:8129: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* cat >> confdefs.h <<\EOF @@ -7786,9 +8146,9 @@ # getmaxyx echo $ac_n "checking for getmaxyx() functionality in curses library""... $ac_c" 1>&6 -echo "configure:7790: checking for getmaxyx() functionality in curses library" >&5 +echo "configure:8150: checking for getmaxyx() functionality in curses library" >&5 cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:8181: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* cat >> confdefs.h <<\EOF @@ -7838,9 +8198,9 @@ # getbegx echo $ac_n "checking for getbegx() functionality in curses library""... $ac_c" 1>&6 -echo "configure:7842: checking for getbegx() functionality in curses library" >&5 +echo "configure:8202: checking for getbegx() functionality in curses library" >&5 cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:8234: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* cat >> confdefs.h <<\EOF @@ -7891,9 +8251,9 @@ # getbegyx echo $ac_n "checking for getbegyx() functionality in curses library""... $ac_c" 1>&6 -echo "configure:7895: checking for getbegyx() functionality in curses library" >&5 +echo "configure:8255: checking for getbegyx() functionality in curses library" >&5 cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:8286: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* cat >> confdefs.h <<\EOF @@ -7943,9 +8303,9 @@ # touchwin echo $ac_n "checking for touchwin() functionality in curses library""... $ac_c" 1>&6 -echo "configure:7947: checking for touchwin() functionality in curses library" >&5 +echo "configure:8307: checking for touchwin() functionality in curses library" >&5 cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:8336: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* cat >> confdefs.h <<\EOF @@ -7993,9 +8353,9 @@ # beep echo $ac_n "checking for beep() functionality in curses library""... $ac_c" 1>&6 -echo "configure:7997: checking for beep() functionality in curses library" >&5 +echo "configure:8357: checking for beep() functionality in curses library" >&5 cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:8385: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* cat >> confdefs.h <<\EOF @@ -8043,12 +8403,12 @@ for ac_func in keypad nodelay curs_set doupdate wnoutrefresh do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:8047: checking for $ac_func" >&5 +echo "configure:8407: 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:8435: \"$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 @@ -8108,7 +8468,7 @@ echo $ac_n "checking for long file names""... $ac_c" 1>&6 -echo "configure:8112: checking for long file names" >&5 +echo "configure:8472: 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 @@ -8152,7 +8512,7 @@ fi echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6 -echo "configure:8156: checking whether ${MAKE-make} sets \${MAKE}" >&5 +echo "configure:8516: 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 @@ -8182,7 +8542,7 @@ # Extract the first word of ""gtar"", so it can be a program name with args. set dummy "gtar"; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:8186: checking for $ac_word" >&5 +echo "configure:8546: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_TAR'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -8221,7 +8581,7 @@ # Extract the first word of ""tar"", so it can be a program name with args. set dummy "tar"; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:8225: checking for $ac_word" >&5 +echo "configure:8585: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_TAR'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -8269,7 +8629,7 @@ echo $ac_n "checking how to create TAR files""... $ac_c" 1>&6 -echo "configure:8273: checking how to create TAR files" >&5 +echo "configure:8633: checking how to create TAR files" >&5 x="" if [ -x /usr/bin/what ] ; then x=`/usr/bin/what "$TAR" 2>&1 | sed -n 's/.*pax.*/pax/g;/pax/p'` @@ -8327,7 +8687,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:8331: checking for $ac_word" >&5 +echo "configure:8691: 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 @@ -8357,7 +8717,7 @@ echo $ac_n "checking for ar""... $ac_c" 1>&6 -echo "configure:8361: checking for ar" >&5 +echo "configure:8721: checking for ar" >&5 AR="ar" if [ "x$cross_compiling" = "xyes" ] ; then machine=`${CC-gcc} -dumpmachine 2>/dev/null` @@ -8388,7 +8748,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:8392: checking for a BSD compatible install" >&5 +echo "configure:8752: 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 @@ -8444,7 +8804,7 @@ # Extract the first word of ""pwd"", so it can be a program name with args. set dummy "pwd"; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:8448: checking for $ac_word" >&5 +echo "configure:8808: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_wi_PWD'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -8481,13 +8841,13 @@ if test "x$use_ccdv" = "xno" ; then echo $ac_n "checking for ccdv""... $ac_c" 1>&6 -echo "configure:8485: checking for ccdv" >&5 +echo "configure:8845: checking for ccdv" >&5 echo "$ac_t""(disabled)" 1>&6 else unset wi_cv_path_ccdv # can't use cache if it was a temp prog last time wi_used_cache_path_ccdv="yes" echo $ac_n "checking for ccdv""... $ac_c" 1>&6 -echo "configure:8491: checking for ccdv" >&5 +echo "configure:8851: checking for ccdv" >&5 if eval "test \"`echo '$''{'wi_cv_path_ccdv'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -8997,7 +9357,7 @@ echo $ac_n "checking if shell can test for symlinks""... $ac_c" 1>&6 -echo "configure:9001: checking if shell can test for symlinks" >&5 +echo "configure:9361: checking if shell can test for symlinks" >&5 if eval "test \"`echo '$''{'wi_cv_shell_test_symlinks'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -9505,6 +9865,8 @@ + + trap '' 1 2 15 cat > confcache <<\EOF # This file is a shell script that caches the results of configure @@ -9674,6 +10036,8 @@ s%@Z30@%$Z30%g s%@Z31@%$Z31%g s%@LIBSET@%$LIBSET%g +s%@LIBOBJS@%$LIBOBJS%g +s%@LIBSOBJS@%$LIBSOBJS%g s%@MAINDIR@%$MAINDIR%g s%@NCFTP_VERSION@%$NCFTP_VERSION%g s%@LIBNCFTP_VERSION@%$LIBNCFTP_VERSION%g Index: ncftp3/configure.in diff -u ncftp3/configure.in:1.1.1.13 ncftp3/configure.in:1.22 --- ncftp3/configure.in:1.1.1.13 Sun Aug 6 12:30:10 2006 +++ ncftp3/configure.in Sun Aug 6 12:33:18 2006 @@ -11,8 +11,6 @@ dnl AC_ARG_WITH(readline,[ --without-readline do not try to find and use the readline library],nc_cv_readline=$withval,nc_cv_readline=yes) wi_ARG_WITH_SOCKS5 - - dnl --------------------------------------------------------------------------- dnl Environment and compiler settings. dnl --------------------------------------------------------------------------- @@ -106,6 +104,172 @@ wi_HEADER_SYS_SELECT_H dnl # sio +dnl --------------------------------------------------------------------------- +dnl Checks for IPv6. +dnl --------------------------------------------------------------------------- +dnl +AC_MSG_CHECKING([whether to enable ipv6]) +AC_ARG_ENABLE(ipv6, +[ --enable-ipv6 Enable ipv6 (with ipv4) support + --disable-ipv6 Disable ipv6 support], +[ case "$enableval" in + no) + AC_MSG_RESULT(no) + ipv6=no + ;; + *) AC_MSG_RESULT(yes) + AC_DEFINE(ENABLE_IPV6) + ipv6=yes + ;; + esac ], + + AC_TRY_RUN([ /* AF_INET6 avalable check */ +#define INET6 +#include +#include +main() +{ + if (socket(AF_INET6, SOCK_STREAM, 0) < 0) + exit(1); + else + exit(0); +} +], + AC_MSG_RESULT(yes) + AC_DEFINE(ENABLE_IPV6) + ipv6=yes, + AC_MSG_RESULT(no) + ipv6=no, + AC_MSG_RESULT(no) + ipv6=no +)) + +AC_CHECK_FUNC(getnameinfo, [ + AC_DEFINE(HAVE_GETNAMEINFO)], [ + LIBOBJS="$LIBOBJS getnameinfo.o" + LIBSOBJS="$LIBSOBJS getnameinfo.so" +]) + +AC_CHECK_FUNC(getaddrinfo, [ +AC_MSG_CHECKING(getaddrinfo bug) +AC_TRY_RUN([ +#include +#include +#include +#include +#include + +main() +{ + int passive, gaierr, inet4 = 0, inet6 = 0; + struct addrinfo hints, *ai, *aitop; + char straddr[INET6_ADDRSTRLEN], strport[16]; + + for (passive = 0; passive <= 1; passive++) { + memset(&hints, 0, sizeof(hints)); + hints.ai_family = AF_UNSPEC; + hints.ai_flags = passive ? AI_PASSIVE : 0; + hints.ai_socktype = SOCK_STREAM; + if ((gaierr = getaddrinfo(NULL, "54321", &hints, &aitop)) != 0) { + (void)gai_strerror(gaierr); + goto bad; + } + for (ai = aitop; ai; ai = ai->ai_next) { + if (ai->ai_addr == NULL || + ai->ai_addrlen == 0 || + getnameinfo(ai->ai_addr, ai->ai_addrlen, + straddr, sizeof(straddr), strport, sizeof(strport), + NI_NUMERICHOST|NI_NUMERICSERV) != 0) { + goto bad; + } + switch (ai->ai_family) { + case AF_INET: + if (strcmp(strport, "54321") != 0) { + goto bad; + } + if (passive) { + if (strcmp(straddr, "0.0.0.0") != 0) { + goto bad; + } + } else { + if (strcmp(straddr, "127.0.0.1") != 0) { + goto bad; + } + } + inet4++; + break; + case AF_INET6: + if (strcmp(strport, "54321") != 0) { + goto bad; + } + if (passive) { + if (strcmp(straddr, "::") != 0) { + goto bad; + } + } else { + if (strcmp(straddr, "::1") != 0) { + goto bad; + } + } + inet6++; + break; + case AF_UNSPEC: + goto bad; + break; + default: + /* another family support? */ + break; + } + } + } + + if (!(inet4 == 0 || inet4 == 2)) + goto bad; + if (!(inet6 == 0 || inet6 == 2)) + goto bad; + + if (aitop) + freeaddrinfo(aitop); + exit(0); + + bad: + if (aitop) + freeaddrinfo(aitop); + exit(1); +} +], [ + AC_MSG_RESULT(good) + AC_DEFINE(HAVE_GETADDRINFO)], [ + AC_MSG_RESULT(buggy) + LIBOBJS="$LIBOBJS getaddrinfo.o" + LIBSOBJS="$LIBSOBJS getaddrinfo.so"])], [ + LIBOBJS="$LIBOBJS getaddrinfo.o" + LIBSOBJS="$LIBSOBJS getaddrinfo.so" +]) + +# check if sockaddr has sa_len member +AC_MSG_CHECKING(if sockaddr has sa_len member) +AC_TRY_COMPILE([#include +#include ], +[struct sockaddr x; +x.sa_len = 0;], + AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_SOCKADDR_SA_LEN), + AC_MSG_RESULT(no)) + +# check if sockaddr_storage has ss_family member +AC_MSG_CHECKING(if sockaddr_storage has ss_family member) +AC_TRY_COMPILE([#include +#include ], +[struct sockaddr_storage x; +x.__ss_family = 0;], + AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_SOCKADDR_STORAGE_SS_FAMILY), + AC_MSG_RESULT(no) + AC_DEFINE(HAVE_SOCKADDR_STORAGE___SS_FAMILY) + CPPFLAGS="$CPPFLAGS -D__ss_family=ss_family -D__ss_len=ss_len") + +CPPFLAGS="-I$MAINDIR $CPPFLAGS" dnl --------------------------------------------------------------------------- dnl Checks for library functions. @@ -244,6 +408,8 @@ AC_SUBST(Z30) AC_SUBST(Z31) AC_SUBST(LIBSET) +AC_SUBST(LIBOBJS) +AC_SUBST(LIBSOBJS) AC_SUBST(MAINDIR) AC_SUBST(NCFTP_VERSION) AC_SUBST(LIBNCFTP_VERSION) Index: ncftp3/Strn/tester Index: ncftp3/autoconf/acconfig.h diff -u ncftp3/autoconf/acconfig.h:1.1.1.11 ncftp3/autoconf/acconfig.h:1.8 --- ncftp3/autoconf/acconfig.h:1.1.1.11 Sun Aug 6 12:30:33 2006 +++ ncftp3/autoconf/acconfig.h Sun Aug 6 12:33:18 2006 @@ -230,6 +230,24 @@ /* Define if you have the wait3 system call. */ #undef HAVE_WAIT3 +/* Define if you have the getaddrinfo function. */ +#undef HAVE_GETADDRINFO + +/* Define if you have the getaddrname function. */ +#undef HAVE_GETNAMEINFO + +/* Define if sockaddr has sa_len member */ +#undef HAVE_SOCKADDR_SA_LEN + +/* Define if sockaddr_storage has ss_family member */ +#undef HAVE_SOCKADDR_STORAGE_SS_FAMILY + +/* Define if sockaddr_storage has __ss_family member */ +#undef HAVE_SOCKADDR_STORAGE___SS_FAMILY + +/* Define if you want IPv6 support. */ +#undef ENABLE_IPV6 + /* Define as __inline if that's what the C compiler calls it. */ #undef inline Index: ncftp3/libncftp/addrinfo.h diff -u /dev/null ncftp3/libncftp/addrinfo.h:1.2 --- /dev/null Sun Aug 6 12:33:35 2006 +++ ncftp3/libncftp/addrinfo.h Tue Nov 20 02:53:11 2001 @@ -0,0 +1,104 @@ +/* + * Copyright (C) 1995, 1996, 1997, 1998, and 1999 WIDE Project. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the project nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#ifndef HAVE_GETADDRINFO + +/* + * Error return codes from getaddrinfo() + */ +#define EAI_ADDRFAMILY 1 /* address family for hostname not supported */ +#define EAI_AGAIN 2 /* temporary failure in name resolution */ +#define EAI_BADFLAGS 3 /* invalid value for ai_flags */ +#define EAI_FAIL 4 /* non-recoverable failure in name resolution */ +#define EAI_FAMILY 5 /* ai_family not supported */ +#define EAI_MEMORY 6 /* memory allocation failure */ +#define EAI_NODATA 7 /* no address associated with hostname */ +#define EAI_NONAME 8 /* hostname nor servname provided, or not known */ +#define EAI_SERVICE 9 /* servname not supported for ai_socktype */ +#define EAI_SOCKTYPE 10 /* ai_socktype not supported */ +#define EAI_SYSTEM 11 /* system error returned in errno */ +#define EAI_BADHINTS 12 +#define EAI_PROTOCOL 13 +#define EAI_MAX 14 + +/* + * Flag values for getaddrinfo() + */ +#define AI_PASSIVE 0x00000001 /* get address to use bind() */ +#define AI_CANONNAME 0x00000002 /* fill ai_canonname */ +#define AI_NUMERICHOST 0x00000004 /* prevent name resolution */ +/* valid flags for addrinfo */ +#define AI_MASK (AI_PASSIVE | AI_CANONNAME | AI_NUMERICHOST) + +#define AI_ALL 0x00000100 /* IPv6 and IPv4-mapped (with AI_V4MAPPED) */ +#define AI_V4MAPPED_CFG 0x00000200 /* accept IPv4-mapped if kernel supports */ +#define AI_ADDRCONFIG 0x00000400 /* only if any address is assigned */ +#define AI_V4MAPPED 0x00000800 /* accept IPv4-mapped IPv6 address */ +/* special recommended flags for getipnodebyname */ +#define AI_DEFAULT (AI_V4MAPPED_CFG | AI_ADDRCONFIG) + +/* + * Constants for getnameinfo() + */ +#define NI_MAXHOST 1025 +#define NI_MAXSERV 32 + +/* + * Flag values for getnameinfo() + */ +#define NI_NOFQDN 0x00000001 +#define NI_NUMERICHOST 0x00000002 +#define NI_NAMEREQD 0x00000004 +#define NI_NUMERICSERV 0x00000008 +#define NI_DGRAM 0x00000010 + +struct addrinfo { + int ai_flags; /* AI_PASSIVE, AI_CANONNAME */ + int ai_family; /* PF_xxx */ + int ai_socktype; /* SOCK_xxx */ + int ai_protocol; /* 0 or IPPROTO_xxx for IPv4 and IPv6 */ + size_t ai_addrlen; /* length of ai_addr */ + char *ai_canonname; /* canonical name for hostname */ + struct sockaddr *ai_addr; /* binary address */ + struct addrinfo *ai_next; /* next structure in linked list */ +}; + +struct sockaddr_storage { +#ifdef HAVE_SOCKADDR_SA_LEN + u_int8_t ss_len; /* address length */ + u_int8_t ss_family; /* address family */ +#else + u_int16_t ss_family; +#endif + u_int8_t fill[126]; +}; + +extern void freehostent __P((struct hostent *)); +extern char *gai_strerror __P((int)); +#endif Index: ncftp3/libncftp/ftp.c diff -u ncftp3/libncftp/ftp.c:1.1.1.17 ncftp3/libncftp/ftp.c:1.52 --- ncftp3/libncftp/ftp.c:1.1.1.17 Tue Apr 19 19:24:05 2005 +++ ncftp3/libncftp/ftp.c Tue Apr 19 19:51:26 2005 @@ -48,6 +48,17 @@ # define DisposeSocket(a) close(a) #endif +#ifndef HAVE_SOCKADDR_SA_LEN +#ifndef SA_LEN +#ifdef ENABLE_IPV6 +#define SA_LEN(x) (((x)->sa_family == AF_INET6) ? sizeof(struct sockaddr_in6) \ + : (((x)->sa_family == AF_INET) ? sizeof(struct sockaddr_in) \ + : -1)) +#else /* ENABLE_IPV6 */ +#define SA_LEN(x) (((x)->sa_family == AF_INET) ? sizeof(struct sockaddr_in) : -1) +#endif /* ENABLE_IPV6 */ +#endif /* SA_LEN */ +#endif /* HAVE_SOCKADDR_SA_LEN */ void FTPCloseControlConnection(const FTPCIPtr cip) @@ -75,9 +86,9 @@ static int -GetSocketAddress(const FTPCIPtr cip, int sockfd, struct sockaddr_in *saddr) +GetSocketAddress(const FTPCIPtr cip, int sockfd, struct sockaddr *saddr) { - sockaddr_size_t len = (sockaddr_size_t) sizeof (struct sockaddr_in); + sockaddr_size_t len = (sockaddr_size_t) sizeof (struct sockaddr_storage); int result = 0; if (getsockname(sockfd, (struct sockaddr *)saddr, &len) < 0) { @@ -111,16 +122,16 @@ int OpenControlConnection(const FTPCIPtr cip, char *host, unsigned int port) { - struct in_addr ip_address; int err = 0; int result; int oerrno; volatile int sockfd = -1; volatile int sock2fd = -1; ResponsePtr rp = NULL; - char **volatile curaddr; - int hpok; - struct hostent hp; + struct addrinfo hints; + struct addrinfo *res, *res0; + int error; + char buf[NI_MAXHOST]; char *volatile fhost; unsigned int fport; #ifndef NO_SIGNALS @@ -154,27 +165,17 @@ cip->cin = NULL; cip->cout = NULL; - /* Make sure we use network byte-order. */ - fport = (unsigned int) htons((unsigned short) fport); - - cip->servCtlAddr.sin_port = (unsigned short) fport; - - if (GetHostEntry(&hp, fhost, &ip_address, cip->buf, cip->bufSize) != 0) { - hpok = 0; - /* Okay, no Host entry, but maybe we have a numeric address - * in ip_address we can try. - */ - if (ip_address.s_addr == INADDR_NONE) { - FTPLogError(cip, kDontPerror, "%s: unknown host.\n", fhost); - cip->errNo = kErrHostUnknown; - return (kErrHostUnknown); - } - cip->servCtlAddr.sin_family = AF_INET; - cip->servCtlAddr.sin_addr.s_addr = ip_address.s_addr; - } else { - hpok = 1; - cip->servCtlAddr.sin_family = hp.h_addrtype; - /* We'll fill in the rest of the structure below. */ + memset(&hints, 0, sizeof(hints)); + hints.ai_flags = AI_CANONNAME; + hints.ai_family = PF_UNSPEC; + hints.ai_socktype = SOCK_STREAM; + hints.ai_protocol = IPPROTO_TCP; + sprintf(buf, "%d\0", fport); + error = getaddrinfo(fhost, buf, &hints, &res0); + if (error) { + FTPLogError(cip, kDontPerror, "%s: %s.\n", fhost, gai_strerror(error)); + cip->errNo = kErrHostUnknown; + return (kErrHostUnknown); } /* After obtaining a socket, try to connect it to a remote @@ -183,13 +184,14 @@ * every address in the list from the host entry. */ - if (hpok == 0) { - /* Since we're given a single raw address, and not a host entry, - * we can only try this one address and not any other addresses - * that could be present for a site with a host entry. - */ - - if ((sockfd = socket(cip->servCtlAddr.sin_family, SOCK_STREAM, 0)) < 0) { + /* We can try each address in the list. We'll quit when we + * run out of addresses to try or get a successful connection. + */ + for (res = res0; res; res = res->ai_next) { + (void) memcpy(&cip->servCtlAddr, res->ai_addr, (size_t)res->ai_addrlen); + if ((sockfd = socket(cip->servCtlAddr.ss_family, SOCK_STREAM, 0)) < 0) { + if (res0->ai_next) + continue; FTPLogError(cip, kDoPerror, "Could not get a socket.\n"); cip->errNo = kErrNewStreamSocket; return (kErrNewStreamSocket); @@ -203,14 +205,14 @@ (void) SetSocketBufSize(sockfd, cip->ctrlSocketRBufSize, cip->ctrlSocketSBufSize); #ifdef NO_SIGNALS - err = SConnect(sockfd, &cip->servCtlAddr, (int) cip->connTimeout); + err = SConnect(sockfd, (struct sockaddr *)&cip->servCtlAddr, (int) cip->connTimeout); - if (err < 0) { - oerrno = errno; - (void) SClose(sockfd, 3); - errno = oerrno; - sockfd = -1; - } + if (err == 0) + break; + oerrno = errno; + (void) SClose(sockfd, 3); + errno = oerrno; + sockfd = -1; #else /* NO_SIGNALS */ osigint = (volatile FTPSigProc) signal(SIGINT, CancelConnect); if (cip->connTimeout > 0) { @@ -239,6 +241,8 @@ Error(vcip, kDontPerror, "Connection attempt canceled.\n"); (void) kill(getpid(), SIGINT); } else if (gGotSig == SIGALRM) { + if (res0->ai_next) + continue; result = vcip->errNo = kErrConnectRetryableErr; Error(vcip, kDontPerror, "Connection attempt timed-out.\n"); (void) kill(getpid(), SIGALRM); @@ -247,9 +251,14 @@ Error(vcip, kDontPerror, "Connection attempt failed due to an unexpected signal (%d).\n", gGotSig); } return (result); - } else { + } else { err = connect(sockfd, (struct sockaddr *) &cip->servCtlAddr, - (int) sizeof (cip->servCtlAddr)); +#ifdef HAVE_SOCKADDR_SA_LEN + cip->servCtlAddr.ss_len +#else + SA_LEN((struct sockaddr *)&cip->servCtlAddr) +#endif + ); if (cip->connTimeout > 0) { (void) alarm(0); (void) signal(SIGALRM, (FTPSigProc) osigalrm); @@ -257,99 +266,13 @@ (void) signal(SIGINT, (FTPSigProc) osigint); } - if (err < 0) { - oerrno = errno; - (void) DisposeSocket(sockfd); - errno = oerrno; - sockfd = -1; - } -#endif /* NO_SIGNALS */ - } else { - /* We can try each address in the list. We'll quit when we - * run out of addresses to try or get a successful connection. - */ - for (curaddr = hp.h_addr_list; *curaddr != NULL; curaddr++) { - if ((sockfd = socket(cip->servCtlAddr.sin_family, SOCK_STREAM, 0)) < 0) { - FTPLogError(cip, kDoPerror, "Could not get a socket.\n"); - cip->errNo = kErrNewStreamSocket; - return (kErrNewStreamSocket); - } - /* This could overwrite the address field in the structure, - * but this is okay because the structure has a junk field - * just for this purpose. - */ - (void) memcpy(&cip->servCtlAddr.sin_addr, *curaddr, (size_t) hp.h_length); - - /* This doesn't do anything if you left these - * at their defaults (zero). Otherwise it - * tries to set the buffer size to the - * size specified. - */ - (void) SetSocketBufSize(sockfd, cip->ctrlSocketRBufSize, cip->ctrlSocketSBufSize); - -#ifdef NO_SIGNALS - err = SConnect(sockfd, &cip->servCtlAddr, (int) cip->connTimeout); - - if (err == 0) - break; - oerrno = errno; - (void) SClose(sockfd, 3); - errno = oerrno; - sockfd = -1; -#else /* NO_SIGNALS */ - - osigint = (volatile FTPSigProc) signal(SIGINT, CancelConnect); - if (cip->connTimeout > 0) { - osigalrm = (volatile FTPSigProc) signal(SIGALRM, CancelConnect); - (void) alarm(cip->connTimeout); - } - - vcip = cip; -#ifdef HAVE_SIGSETJMP - sj = sigsetjmp(gCancelConnectJmp, 1); -#else - sj = setjmp(gCancelConnectJmp); -#endif /* HAVE_SIGSETJMP */ - - if (sj != 0) { - /* Interrupted by a signal. */ - (void) DisposeSocket(sockfd); - (void) signal(SIGINT, (FTPSigProc) osigint); - if (vcip->connTimeout > 0) { - (void) alarm(0); - (void) signal(SIGALRM, (FTPSigProc) osigalrm); - } - if (gGotSig == SIGINT) { - result = vcip->errNo = kErrConnectMiscErr; - Error(vcip, kDontPerror, "Connection attempt canceled.\n"); - (void) kill(getpid(), SIGINT); - } else if (gGotSig == SIGALRM) { - result = vcip->errNo = kErrConnectRetryableErr; - Error(vcip, kDontPerror, "Connection attempt timed-out.\n"); - (void) kill(getpid(), SIGALRM); - } else { - result = vcip->errNo = kErrConnectMiscErr; - Error(vcip, kDontPerror, "Connection attempt failed due to an unexpected signal (%d).\n", gGotSig); - } - return (result); - } else { - err = connect(sockfd, (struct sockaddr *) &cip->servCtlAddr, - (int) sizeof (cip->servCtlAddr)); - if (cip->connTimeout > 0) { - (void) alarm(0); - (void) signal(SIGALRM, (FTPSigProc) osigalrm); - } - (void) signal(SIGINT, (FTPSigProc) osigint); - } - - if (err == 0) - break; - oerrno = errno; - (void) DisposeSocket(sockfd); - errno = oerrno; - sockfd = -1; + if (err == 0) + break; + oerrno = errno; + (void) DisposeSocket(sockfd); + errno = oerrno; + sockfd = -1; #endif /* NO_SIGNALS */ - } } if (err < 0) { @@ -408,7 +331,7 @@ } /* Get our end of the socket address for later use. */ - if ((result = GetSocketAddress(cip, sockfd, &cip->ourCtlAddr)) < 0) + if ((result = GetSocketAddress(cip, sockfd, (struct sockaddr *)&cip->ourCtlAddr)) < 0) goto fatal; /* We want Out-of-band data to appear in the regular stream, @@ -479,11 +402,20 @@ #endif #endif /* NO_SIGNALS */ - InetNtoA(cip->ip, &cip->servCtlAddr.sin_addr, sizeof(cip->ip)); - if ((hpok == 0) || (hp.h_name == NULL)) + getnameinfo((struct sockaddr*)&cip->servCtlAddr, +#ifdef HAVE_SOCKADDR_SA_LEN + cip->servCtlAddr.ss_len, +#else + SA_LEN((struct sockaddr *)&cip->servCtlAddr), +#endif + buf, sizeof(buf), NULL, 0, NI_NUMERICHOST); + (void) STRNCPY(cip->ip, buf); + if ((res0 == NULL) || (res0->ai_canonname == NULL)) (void) STRNCPY(cip->actualHost, fhost); else - (void) STRNCPY(cip->actualHost, (char *) hp.h_name); + (void) STRNCPY(cip->actualHost, (char *) res0->ai_canonname); + freeaddrinfo(res0); + res0 = NULL; /* Read the startup message from the server. */ rp = InitResponse(); @@ -587,6 +519,10 @@ CloseFile(&cip->cout); cip->ctrlSocketR = kClosedFileDescriptor; cip->ctrlSocketW = kClosedFileDescriptor; + if (res0) { + freeaddrinfo(res0); + res0 = NULL; + } return (result); } /* OpenControlConnection */ @@ -680,11 +616,15 @@ int -FTPSendPort(const FTPCIPtr cip, struct sockaddr_in *saddr) +FTPSendPort(const FTPCIPtr cip, struct sockaddr *saddr) { char *a, *p; int result; ResponsePtr rp; + struct sockaddr_in *saddr4; +#ifdef ENABLE_IPV6 + struct sockaddr_in6 *saddr6; +#endif rp = InitResponse(); if (rp == NULL) { @@ -693,16 +633,46 @@ return (cip->errNo); } - /* These will point to data in network byte order. */ - a = (char *) &saddr->sin_addr; - p = (char *) &saddr->sin_port; #define UC(x) (int) (((int) x) & 0xff) +#ifdef ENABLE_IPV6 + if (saddr->sa_family == AF_INET6) { + char host[NI_MAXHOST]; + char port[NI_MAXSERV]; + + getnameinfo(saddr, sizeof(struct sockaddr_in6), host, sizeof(host), + port, sizeof(port), NI_NUMERICHOST | NI_NUMERICSERV); + + saddr6 = (struct sockaddr_in6 *)saddr; + /* These will point to data in network byte order. */ + a = (char *) &saddr6->sin6_addr; + p = (char *) &saddr6->sin6_port; + /* Need to tell the other side which host (the address) and + * which process (port) on that host to send data to. + */ + result = RCmd(cip, rp, "EPRT |2|%s|%s|", host, port); + if (result != 2) { + result = RCmd(cip, rp, "LPRT 6,16,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,2,%d,%d", + UC(a[ 0]), UC(a[ 1]), UC(a[ 2]), UC(a[ 3]), + UC(a[ 4]), UC(a[ 5]), UC(a[ 6]), UC(a[ 7]), + UC(a[ 8]), UC(a[ 9]), UC(a[10]), UC(a[11]), + UC(a[12]), UC(a[13]), UC(a[14]), UC(a[15]), + UC(p[0]), UC(p[1])); + } + } else { +#endif + saddr4 = (struct sockaddr_in *)saddr; + /* These will point to data in network byte order. */ + a = (char *) &saddr4->sin_addr; + p = (char *) &saddr4->sin_port; - /* Need to tell the other side which host (the address) and - * which process (port) on that host to send data to. - */ - result = RCmd(cip, rp, "PORT %d,%d,%d,%d,%d,%d", - UC(a[0]), UC(a[1]), UC(a[2]), UC(a[3]), UC(p[0]), UC(p[1])); + /* Need to tell the other side which host (the address) and + * which process (port) on that host to send data to. + */ + result = RCmd(cip, rp, "PORT %d,%d,%d,%d,%d,%d", + UC(a[0]), UC(a[1]), UC(a[2]), UC(a[3]), UC(p[0]), UC(p[1])); +#ifdef ENABLE_IPV6 + } +#endif DoneWithResponse(cip, rp); if (result < 0) { @@ -719,13 +689,18 @@ int -FTPSendPassive(const FTPCIPtr cip, struct sockaddr_in *saddr, int *weird) +FTPSendPassive(const FTPCIPtr cip, struct sockaddr *saddr, int *weird) { ResponsePtr rp; - int i[6], j; - unsigned char n[6]; + int i[18], j; + unsigned char n[18]; char *cp; int result; + struct sockaddr_in *saddr4 = (struct sockaddr_in *)saddr; +#ifdef ENABLE_IPV6 + struct sockaddr_in6 *saddr6 = (struct sockaddr_in6 *)saddr; +#endif + unsigned short port; rp = InitResponse(); if (rp == NULL) { @@ -734,56 +709,162 @@ return (cip->errNo); } - result = RCmd(cip, rp, "PASV"); - if (result < 0) - goto done; - - if (rp->codeType != 2) { - /* Didn't understand or didn't want passive port selection. */ - cip->errNo = result = kErrPASVFailed; - goto done; - } - - /* The other side returns a specification in the form of - * an internet address as the first four integers (each - * integer stands for 8-bits of the real 32-bit address), - * and two more integers for the port (16-bit port). - * - * It should give us something like: - * "Entering Passive Mode (129,93,33,1,10,187)", so look for - * digits with sscanf() starting 24 characters down the string. - */ + result = RCmd(cip, rp, "EPSV"); + if (result != 2) + goto next; + + if (rp->codeType != 2) + goto next; + for (cp = rp->msg.first->line; ; cp++) { if (*cp == '\0') { - FTPLogError(cip, kDontPerror, "Cannot parse PASV response: %s\n", rp->msg.first->line); - goto done; + FTPLogError(cip, kDontPerror, "Cannot parse EPSV response: %s\n", rp->msg.first->line); + goto next; } if (isdigit((int) *cp)) break; } + if (sscanf(cp, "%hd|", &port) != 1) { + FTPLogError(cip, kDontPerror, "Cannot parse EPSV response: %s\n", rp->msg.first->line); + goto next; + } + - if (sscanf(cp, "%d,%d,%d,%d,%d,%d", - &i[0], &i[1], &i[2], &i[3], &i[4], &i[5]) != 6) { - FTPLogError(cip, kDontPerror, "Cannot parse PASV response: %s\n", rp->msg.first->line); - goto done; +#ifdef ENABLE_IPV6 + if (saddr->sa_family == AF_INET6) { + saddr6->sin6_addr = + ((struct sockaddr_in6 *)&cip->servCtlAddr)->sin6_addr; + saddr6->sin6_port = htons(port); + } else { +#endif + saddr4->sin_addr = + ((struct sockaddr_in *)&cip->servCtlAddr)->sin_addr; + saddr4->sin_port = htons(port); +#ifdef ENABLE_IPV6 } +#endif + goto done; - if (weird != (int *) 0) - *weird = 0; - - for (j=0; j<6; j++) { - /* Some ftp servers return bogus port octets, such as - * boombox.micro.umn.edu. Let the caller know if we got a - * weird looking octet. - */ - if (((i[j] < 0) || (i[j] > 255)) && (weird != (int *) 0)) - *weird = *weird + 1; - n[j] = (unsigned char) (i[j] & 0xff); + next: + rp = InitResponse(); + if (rp == NULL) { + FTPLogError(cip, kDontPerror, "Malloc failed.\n"); + cip->errNo = kErrMallocFailed; + return (cip->errNo); } - (void) memcpy(&saddr->sin_addr, &n[0], (size_t) 4); - (void) memcpy(&saddr->sin_port, &n[4], (size_t) 2); +#ifdef ENABLE_IPV6 + if (saddr->sa_family == AF_INET6) { + int af, hal, pal; + + result = RCmd(cip, rp, "LPSV"); + if (result < 0) + goto done; + + if (rp->codeType != 2) { + /* Didn't understand or didn't want passive port selection. */ + cip->errNo = result = kErrPASVFailed; + goto done; + } + + /* The other side returns a specification in the form of + * an internet address as the first four integers (each + * integer stands for 8-bits of the real 32-bit address), + * and two more integers for the port (16-bit port). + * + * It should give us something like: + * "Entering Passive Mode (129,93,33,1,10,187)", so look for + * digits with sscanf() starting 24 characters down the string. + */ + for (cp = rp->msg.first->line; ; cp++) { + if (*cp == '\0') { + FTPLogError(cip, kDontPerror, "Cannot parse LPSV response: %s\n", rp->msg.first->line); + goto done; + } + if (isdigit((int) *cp)) + break; + } + + if (sscanf(cp, "%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d", + &af, &hal, + &i[ 0], &i[ 1], &i[ 2], &i[ 3], + &i[ 4], &i[ 5], &i[ 6], &i[ 7], + &i[ 8], &i[ 9], &i[10], &i[11], + &i[12], &i[13], &i[14], &i[15], + &pal, + &i[16], &i[17]) != 21) { + FTPLogError(cip, kDontPerror, "Cannot parse LPSV response: %s\n", rp->msg.first->line); + goto done; + } + if (af != 6 || hal != 16 || pal != 2) { + FTPLogError(cip, kDontPerror, "Cannot parse LPSV response: %s\n", rp->msg.first->line); + goto done; + } + + for (j=0, *weird = 0; j<18; j++) { + /* Some ftp servers return bogus port octets, such as + * boombox.micro.umn.edu. Let the caller know if we got a + * weird looking octet. + */ + if ((i[j] < 0) || (i[j] > 255)) + *weird = *weird + 1; + n[j] = (unsigned char) (i[j] & 0xff); + } + (void) memcpy(&saddr6->sin6_addr, &n[ 0], (size_t) 16); + (void) memcpy(&saddr6->sin6_port, &n[16], (size_t) 2); + } else { +#endif + result = RCmd(cip, rp, "PASV"); + if (result < 0) + goto done; + + if (rp->codeType != 2) { + /* Didn't understand or didn't want passive port selection. */ + cip->errNo = result = kErrPASVFailed; + goto done; + } + + /* The other side returns a specification in the form of + * an internet address as the first four integers (each + * integer stands for 8-bits of the real 32-bit address), + * and two more integers for the port (16-bit port). + * + * It should give us something like: + * "Entering Passive Mode (129,93,33,1,10,187)", so look for + * digits with sscanf() starting 24 characters down the string. + */ + for (cp = rp->msg.first->line; ; cp++) { + if (*cp == '\0') { + FTPLogError(cip, kDontPerror, "Cannot parse PASV response: %s\n", rp->msg.first->line); + goto done; + } + if (isdigit((int) *cp)) + break; + } + if (sscanf(cp, "%d,%d,%d,%d,%d,%d", + &i[0], &i[1], &i[2], &i[3], &i[4], &i[5]) != 6) { + FTPLogError(cip, kDontPerror, "Cannot parse PASV response: %s\n", rp->msg.first->line); + goto done; + } + + if (weird != (int *) 0) + *weird = 0; + + for (j=0; j<6; j++) { + /* Some ftp servers return bogus port octets, such as + * boombox.micro.umn.edu. Let the caller know if we got a + * weird looking octet. + */ + if (((i[j] < 0) || (i[j] > 255)) && (weird != (int *) 0)) + *weird = *weird + 1; + n[j] = (unsigned char) (i[j] & 0xff); + } + (void) memcpy(&saddr4->sin_addr, &n[0], (size_t) 4); + (void) memcpy(&saddr4->sin_port, &n[4], (size_t) 2); +#ifdef ENABLE_IPV6 + } +#endif result = kNoErr; done: DoneWithResponse(cip, rp); @@ -794,30 +875,45 @@ static int -BindToEphemeralPortNumber(int sockfd, struct sockaddr_in *addrp, int ephemLo, int ephemHi) +BindToEphemeralPortNumber(int sockfd, struct sockaddr *addrp, int ephemLo, int ephemHi) { int i; int result; int rangesize; unsigned short port; - addrp->sin_family = AF_INET; if (((int) ephemLo == 0) || ((int) ephemLo >= (int) ephemHi)) { /* Do it the normal way. System will * pick one, typically in the range * of 1024-4999. */ - addrp->sin_port = 0; /* Let system pick one. */ - - result = bind(sockfd, (struct sockaddr *) addrp, sizeof(struct sockaddr_in)); +#ifdef ENABLE_IPV6 + if (addrp->sa_family == AF_INET6) + ((struct sockaddr_in6 *)addrp)->sin6_port = 0; /* Let system pick one. */ + else +#endif + ((struct sockaddr_in *)addrp)->sin_port = 0; /* Let system pick one. */ +#ifdef HAVE_SOCKADDR_SA_LEN + result = bind(sockfd, addrp, addrp->sa_len); +#else + result = bind(sockfd, addrp, SA_LEN(addrp)); +#endif } else { rangesize = (int) ((int) ephemHi - (int) ephemLo); result = 0; for (i=0; i<10; i++) { port = (unsigned short) (((int) rand() % rangesize) + (int) ephemLo); - addrp->sin_port = htons(port); - - result = bind(sockfd, (struct sockaddr *) addrp, sizeof(struct sockaddr_in)); +#ifdef ENABLE_IPV6 + if (addrp->sa_family == AF_INET6) + ((struct sockaddr_in6 *)addrp)->sin6_port = htons(port); + else +#endif + ((struct sockaddr_in *)addrp)->sin_port = htons(port); +#ifdef HAVE_SOCKADDR_SA_LEN + result = bind(sockfd, addrp, addrp->sa_len); +#else + result = bind(sockfd, addrp, SA_LEN(addrp)); +#endif if (result == 0) break; if ((errno != 999) @@ -854,7 +950,11 @@ result = 0; CloseDataConnection(cip); /* In case we didn't before... */ +#ifdef ENABLE_IPV6 + dataSocket = socket(cip->ourCtlAddr.ss_family, SOCK_STREAM, 0); +#else dataSocket = socket(AF_INET, SOCK_STREAM, 0); +#endif if (dataSocket < 0) { FTPLogError(cip, kDoPerror, "Could not get a data socket.\n"); result = kErrNewStreamSocket; @@ -885,7 +985,6 @@ if ((cip->hasPASV == kCommandNotAvailable) || (mode == kSendPortMode)) { tryPort: cip->ourDataAddr = cip->ourCtlAddr; - cip->ourDataAddr.sin_family = AF_INET; #ifdef HAVE_LIBSOCKS cip->ourDataAddr.sin_port = 0; @@ -893,7 +992,7 @@ (int) sizeof (cip->ourDataAddr), cip->servCtlAddr.sin_addr.s_addr) < 0) #else - if (BindToEphemeralPortNumber(dataSocket, &cip->ourDataAddr, (int) cip->ephemLo, (int) cip->ephemHi) < 0) + if (BindToEphemeralPortNumber(dataSocket, (struct sockaddr *)&cip->ourDataAddr, (int) cip->ephemLo, (int) cip->ephemHi) < 0) #endif { FTPLogError(cip, kDoPerror, "Could not bind the data socket"); @@ -905,7 +1004,7 @@ /* Need to do this so we can figure out which port the system * gave to us. */ - if ((result = GetSocketAddress(cip, dataSocket, &cip->ourDataAddr)) < 0) + if ((result = GetSocketAddress(cip, dataSocket, (struct sockaddr *)&cip->ourDataAddr)) < 0) goto bad; if (listen(dataSocket, 1) < 0) { @@ -915,7 +1014,7 @@ goto bad; } - if ((result = FTPSendPort(cip, &cip->ourDataAddr)) < 0) + if ((result = FTPSendPort(cip, (struct sockaddr *)&cip->ourDataAddr)) < 0) goto bad; cip->dataPortMode = kSendPortMode; @@ -923,11 +1022,9 @@ /* Passive mode. Let the other side decide where to send. */ cip->servDataAddr = cip->servCtlAddr; - cip->servDataAddr.sin_family = AF_INET; cip->ourDataAddr = cip->ourCtlAddr; - cip->ourDataAddr.sin_family = AF_INET; - if (FTPSendPassive(cip, &cip->servDataAddr, &weirdPort) < 0) { + if (FTPSendPassive(cip, (struct sockaddr *)&cip->servDataAddr, &weirdPort) < 0) { FTPLogError(cip, kDontPerror, "Passive mode refused.\n"); cip->hasPASV = kCommandNotAvailable; @@ -951,7 +1048,7 @@ (int) sizeof (cip->ourDataAddr), cip->servCtlAddr.sin_addr.s_addr) < 0) #else - if (BindToEphemeralPortNumber(dataSocket, &cip->ourDataAddr, (int) cip->ephemLo, (int) cip->ephemHi) < 0) + if (BindToEphemeralPortNumber(dataSocket, (struct sockaddr *)&cip->ourDataAddr, (int) cip->ephemLo, (int) cip->ephemHi) < 0) #endif { FTPLogError(cip, kDoPerror, "Could not bind the data socket"); @@ -959,14 +1056,25 @@ cip->errNo = kErrBindDataSocket; goto bad; } + + /* Need to do this so we can figure out which port the system + * gave to us. + */ + if ((result = GetSocketAddress(cip, dataSocket, (struct sockaddr *)&cip->ourDataAddr)) < 0) + goto bad; #ifdef NO_SIGNALS - result = SConnect(dataSocket, &cip->servDataAddr, (int) cip->connTimeout); + result = SConnect(dataSocket, (struct sockaddr *)&cip->servDataAddr, (int) cip->connTimeout); #else /* NO_SIGNALS */ if (cip->connTimeout > 0) (void) alarm(cip->connTimeout); - - result = connect(dataSocket, (struct sockaddr *) &cip->servDataAddr, (int) sizeof(cip->servDataAddr)); + result = connect(dataSocket, (struct sockaddr *) &cip->servDataAddr, +#ifdef HAVE_SOCKADDR_SA_LEN + cip->servDataAddr.ss_len +#else + SA_LEN((struct sockaddr*)&cip->servDataAddr) +#endif + ); if (cip->connTimeout > 0) (void) alarm(0); #endif /* NO_SIGNALS */ @@ -1018,7 +1126,7 @@ /* Need to do this so we can figure out which port the system * gave to us. */ - if ((result = GetSocketAddress(cip, dataSocket, &cip->ourDataAddr)) < 0) + if ((result = GetSocketAddress(cip, dataSocket, (struct sockaddr *) &cip->ourDataAddr)) < 0) goto bad; cip->dataPortMode = kPassiveMode; @@ -1064,9 +1172,9 @@ memset(&cip->servDataAddr, 0, sizeof(cip->servDataAddr)); #ifdef NO_SIGNALS - newSocket = SAccept(cip->dataSocket, &cip->servDataAddr, (int) cip->connTimeout); + newSocket = SAccept(cip->dataSocket, (struct sockaddr *)&cip->servDataAddr, (int) cip->connTimeout); #else /* NO_SIGNALS */ - len = (int) sizeof(cip->servDataAddr); + len = (int) sizeof(struct sockaddr_storage); if (cip->connTimeout > 0) (void) alarm(cip->connTimeout); newSocket = accept(cip->dataSocket, (struct sockaddr *) &cip->servDataAddr, &len); @@ -1081,11 +1189,10 @@ cip->errNo = kErrAcceptDataSocket; return (kErrAcceptDataSocket); } - if (cip->allowProxyForPORT == 0) { - if (memcmp(&cip->servDataAddr.sin_addr.s_addr, &cip->servCtlAddr.sin_addr.s_addr, sizeof(cip->servDataAddr.sin_addr.s_addr)) != 0) { - AddrToAddrStr(ctrlAddrStr, sizeof(ctrlAddrStr), &cip->servCtlAddr, 0, NULL); - AddrToAddrStr(dataAddrStr, sizeof(dataAddrStr), &cip->servDataAddr, 0, NULL); + AddrToAddrStr(ctrlAddrStr, sizeof(ctrlAddrStr), (struct sockaddr *)&cip->servCtlAddr, 0, "%h"); + AddrToAddrStr(dataAddrStr, sizeof(dataAddrStr), (struct sockaddr *)&cip->servDataAddr, 0, "%h"); + if (strcmp(ctrlAddrStr, dataAddrStr) != 0) { FTPLogError(cip, kDontPerror, "Data connection from %s did not originate from remote server %s!\n", dataAddrStr, ctrlAddrStr); (void) DisposeSocket(newSocket); cip->dataSocket = kClosedFileDescriptor; @@ -1093,21 +1200,57 @@ return (kErrProxyDataConnectionsDisabled); } } - if (cip->require20 != 0) { - remoteDataPort = ntohs(cip->servDataAddr.sin_port); - remoteCtrlPort = ntohs(cip->servCtlAddr.sin_port); - if ((int) remoteDataPort != ((int) remoteCtrlPort - 1)) { - FTPLogError(cip, kDontPerror, "Data connection did not originate on correct port (expecting %d, got %d)!\n", (int) remoteCtrlPort - 1, (int) remoteDataPort); - (void) DisposeSocket(newSocket); - cip->dataSocket = kClosedFileDescriptor; - cip->errNo = kErrDataConnOriginatedFromBadPort; - return (kErrDataConnOriginatedFromBadPort); +#ifdef ENABLE_IPV6 + if (cip->servDataAddr.ss_family == AF_INET6) { + struct sockaddr_in6 *servDataAddr = + (struct sockaddr_in6 *) &cip->servDataAddr; + struct sockaddr_in6 *servCtlAddr = + (struct sockaddr_in6 *) &cip->servCtlAddr; + + remoteDataPort = ntohs(servDataAddr->sin6_port); + remoteCtrlPort = ntohs(servCtlAddr->sin6_port); + if ((int) remoteDataPort != ((int) remoteCtrlPort - 1)) { + FTPLogError(cip, kDontPerror, "Data connection did not originate on correct port!\n"); + (void) DisposeSocket(newSocket); + cip->dataSocket = kClosedFileDescriptor; + cip->errNo = kErrAcceptDataSocket; + return (kErrAcceptDataSocket); + } else if (memcmp(&servDataAddr->sin6_addr, &servCtlAddr->sin6_addr, sizeof(servDataAddr->sin6_addr)) != 0) { + FTPLogError(cip, kDontPerror, "Data connection did not originate from remote server!\n"); + (void) DisposeSocket(newSocket); + cip->dataSocket = kClosedFileDescriptor; + cip->errNo = kErrAcceptDataSocket; + return (kErrAcceptDataSocket); + } + } else { +#endif + struct sockaddr_in *servDataAddr = + (struct sockaddr_in *) &cip->servDataAddr; + struct sockaddr_in *servCtlAddr = + (struct sockaddr_in *) &cip->servCtlAddr; + + remoteDataPort = ntohs(servDataAddr->sin_port); + remoteCtrlPort = ntohs(servCtlAddr->sin_port); + if ((int) remoteDataPort != ((int) remoteCtrlPort - 1)) { + FTPLogError(cip, kDontPerror, "Data connection did not originate on correct port!\n"); + (void) DisposeSocket(newSocket); + cip->dataSocket = kClosedFileDescriptor; + cip->errNo = kErrAcceptDataSocket; + return (kErrAcceptDataSocket); + } else if (memcmp(&servDataAddr->sin_addr.s_addr, &servCtlAddr->sin_addr.s_addr, sizeof(servDataAddr->sin_addr.s_addr)) != 0) { + FTPLogError(cip, kDontPerror, "Data connection did not originate on correct port (expecting %d, got %d)!\n", (int) remoteCtrlPort - 1, (int) remoteDataPort); + (void) DisposeSocket(newSocket); + cip->errNo = kErrDataConnOriginatedFromBadPort; + cip->errNo = kErrAcceptDataSocket; + return (kErrDataConnOriginatedFromBadPort); + } +#ifdef ENABLE_IPV6 } +#endif } cip->dataSocket = newSocket; } - return (0); } /* AcceptDataConnection */ Index: ncftp3/libncftp/getaddrinfo.c diff -u /dev/null ncftp3/libncftp/getaddrinfo.c:1.1 --- /dev/null Sun Aug 6 12:33:35 2006 +++ ncftp3/libncftp/getaddrinfo.c Tue Nov 6 23:50:46 2001 @@ -0,0 +1,607 @@ +/* + * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the project nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/* + * "#ifdef FAITH" part is local hack for supporting IPv4-v6 translator. + * + * Issues to be discussed: + * - Thread safe-ness must be checked. + * - Return values. There are nonstandard return values defined and used + * in the source code. This is because RFC2133 is silent about which error + * code must be returned for which situation. + * - PF_UNSPEC case would be handled in getipnodebyname() with the AI_ALL flag. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "addrinfo.h" + +#if defined(__KAME__) && defined(INET6) +# define FAITH +#endif + +#define SUCCESS 0 +#define ANY 0 +#define YES 1 +#define NO 0 + +#ifdef FAITH +static int translate = NO; +static struct in6_addr faith_prefix = IN6ADDR_ANY_INIT; +#endif + +static const char in_addrany[] = { 0, 0, 0, 0 }; +static const char in6_addrany[] = { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 +}; +static const char in_loopback[] = { 127, 0, 0, 1 }; +static const char in6_loopback[] = { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1 +}; + +struct sockinet { + u_char si_len; + u_char si_family; + u_short si_port; +}; + +static struct afd { + int a_af; + int a_addrlen; + int a_socklen; + int a_off; + const char *a_addrany; + const char *a_loopback; +} afdl [] = { +#ifdef INET6 +#define N_INET6 0 + {PF_INET6, sizeof(struct in6_addr), + sizeof(struct sockaddr_in6), + offsetof(struct sockaddr_in6, sin6_addr), + in6_addrany, in6_loopback}, +#define N_INET 1 +#else +#define N_INET 0 +#endif + {PF_INET, sizeof(struct in_addr), + sizeof(struct sockaddr_in), + offsetof(struct sockaddr_in, sin_addr), + in_addrany, in_loopback}, + {0, 0, 0, 0, NULL, NULL}, +}; + +#ifdef INET6 +#define PTON_MAX 16 +#else +#define PTON_MAX 4 +#endif + + +static int get_name __P((const char *, struct afd *, + struct addrinfo **, char *, struct addrinfo *, + int)); +static int get_addr __P((const char *, int, struct addrinfo **, + struct addrinfo *, int)); +static int str_isnumber __P((const char *)); + +static char *ai_errlist[] = { + "success.", + "address family for hostname not supported.", /* EAI_ADDRFAMILY */ + "temporary failure in name resolution.", /* EAI_AGAIN */ + "invalid value for ai_flags.", /* EAI_BADFLAGS */ + "non-recoverable failure in name resolution.", /* EAI_FAIL */ + "ai_family not supported.", /* EAI_FAMILY */ + "memory allocation failure.", /* EAI_MEMORY */ + "no address associated with hostname.", /* EAI_NODATA */ + "hostname nor servname provided, or not known.",/* EAI_NONAME */ + "servname not supported for ai_socktype.", /* EAI_SERVICE */ + "ai_socktype not supported.", /* EAI_SOCKTYPE */ + "system error returned in errno.", /* EAI_SYSTEM */ + "invalid value for hints.", /* EAI_BADHINTS */ + "resolved protocol is unknown.", /* EAI_PROTOCOL */ + "unknown error.", /* EAI_MAX */ +}; + +#define GET_CANONNAME(ai, str) \ +if (pai->ai_flags & AI_CANONNAME) {\ + if (((ai)->ai_canonname = (char *)malloc(strlen(str) + 1)) != NULL) {\ + strcpy((ai)->ai_canonname, (str));\ + } else {\ + error = EAI_MEMORY;\ + goto free;\ + }\ +} + +#define GET_AI(ai, afd, addr, port) {\ + char *p;\ + if (((ai) = (struct addrinfo *)malloc(sizeof(struct addrinfo) +\ + ((afd)->a_socklen)))\ + == NULL) goto free;\ + memcpy(ai, pai, sizeof(struct addrinfo));\ + (ai)->ai_addr = (struct sockaddr *)((ai) + 1);\ + memset((ai)->ai_addr, 0, (afd)->a_socklen);\ + (ai)->ai_addr->sa_len = (ai)->ai_addrlen = (afd)->a_socklen;\ + (ai)->ai_addr->sa_family = (ai)->ai_family = (afd)->a_af;\ + ((struct sockinet *)(ai)->ai_addr)->si_port = port;\ + p = (char *)((ai)->ai_addr);\ + memcpy(p + (afd)->a_off, (addr), (afd)->a_addrlen);\ +} + +#define ERR(err) { error = (err); goto bad; } + +char * +gai_strerror(ecode) + int ecode; +{ + if (ecode < 0 || ecode > EAI_MAX) + ecode = EAI_MAX; + return ai_errlist[ecode]; +} + +void +freeaddrinfo(ai) + struct addrinfo *ai; +{ + struct addrinfo *next; + + do { + next = ai->ai_next; + if (ai->ai_canonname) + free(ai->ai_canonname); + /* no need to free(ai->ai_addr) */ + free(ai); + } while ((ai = next) != NULL); +} + +static int +str_isnumber(p) + const char *p; +{ + char *q = (char *)p; + while (*q) { + if (! isdigit(*q)) + return NO; + q++; + } + return YES; +} + +int +getaddrinfo(hostname, servname, hints, res) + const char *hostname, *servname; + const struct addrinfo *hints; + struct addrinfo **res; +{ + struct addrinfo sentinel; + struct addrinfo *top = NULL; + struct addrinfo *cur; + int i, error = 0; + char pton[PTON_MAX]; + struct addrinfo ai; + struct addrinfo *pai; + u_short port; + +#ifdef FAITH + static int firsttime = 1; + + if (firsttime) { + /* translator hack */ + { + char *q = getenv("GAI"); + if (q && inet_pton(AF_INET6, q, &faith_prefix) == 1) + translate = YES; + } + firsttime = 0; + } +#endif + + /* initialize file static vars */ + sentinel.ai_next = NULL; + cur = &sentinel; + pai = &ai; + pai->ai_flags = 0; + pai->ai_family = PF_UNSPEC; + pai->ai_socktype = ANY; + pai->ai_protocol = ANY; + pai->ai_addrlen = 0; + pai->ai_canonname = NULL; + pai->ai_addr = NULL; + pai->ai_next = NULL; + port = ANY; + + if (hostname == NULL && servname == NULL) + return EAI_NONAME; + if (hints) { + /* error check for hints */ + if (hints->ai_addrlen || hints->ai_canonname || + hints->ai_addr || hints->ai_next) + ERR(EAI_BADHINTS); /* xxx */ + if (hints->ai_flags & ~AI_MASK) + ERR(EAI_BADFLAGS); + switch (hints->ai_family) { + case PF_UNSPEC: + case PF_INET: +#ifdef INET6 + case PF_INET6: +#endif + break; + default: + ERR(EAI_FAMILY); + } + memcpy(pai, hints, sizeof(*pai)); + switch (pai->ai_socktype) { + case ANY: + switch (pai->ai_protocol) { + case ANY: + break; + case IPPROTO_UDP: + pai->ai_socktype = SOCK_DGRAM; + break; + case IPPROTO_TCP: + pai->ai_socktype = SOCK_STREAM; + break; + default: + pai->ai_socktype = SOCK_RAW; + break; + } + break; + case SOCK_RAW: + break; + case SOCK_DGRAM: + if (pai->ai_protocol != IPPROTO_UDP && + pai->ai_protocol != ANY) + ERR(EAI_BADHINTS); /*xxx*/ + pai->ai_protocol = IPPROTO_UDP; + break; + case SOCK_STREAM: + if (pai->ai_protocol != IPPROTO_TCP && + pai->ai_protocol != ANY) + ERR(EAI_BADHINTS); /*xxx*/ + pai->ai_protocol = IPPROTO_TCP; + break; + default: + ERR(EAI_SOCKTYPE); + break; + } + } + + /* + * service port + */ + if (servname) { + if (str_isnumber(servname)) { + if (pai->ai_socktype == ANY) { + /* caller accept *ANY* socktype */ + pai->ai_socktype = SOCK_DGRAM; + pai->ai_protocol = IPPROTO_UDP; + } + port = htons(atoi(servname)); + } else { + struct servent *sp; + char *proto; + + proto = NULL; + switch (pai->ai_socktype) { + case ANY: + proto = NULL; + break; + case SOCK_DGRAM: + proto = "udp"; + break; + case SOCK_STREAM: + proto = "tcp"; + break; + default: + fprintf(stderr, "panic!\n"); + break; + } + if ((sp = getservbyname(servname, proto)) == NULL) + ERR(EAI_SERVICE); + port = sp->s_port; + if (pai->ai_socktype == ANY) + if (strcmp(sp->s_proto, "udp") == 0) { + pai->ai_socktype = SOCK_DGRAM; + pai->ai_protocol = IPPROTO_UDP; + } else if (strcmp(sp->s_proto, "tcp") == 0) { + pai->ai_socktype = SOCK_STREAM; + pai->ai_protocol = IPPROTO_TCP; + } else + ERR(EAI_PROTOCOL); /*xxx*/ + } + } + + /* + * hostname == NULL. + * passive socket -> anyaddr (0.0.0.0 or ::) + * non-passive socket -> localhost (127.0.0.1 or ::1) + */ + if (hostname == NULL) { + struct afd *afd; + + for (afd = &afdl[0]; afd->a_af; afd++) { + if (!(pai->ai_family == PF_UNSPEC + || pai->ai_family == afd->a_af)) { + continue; + } + + if (pai->ai_flags & AI_PASSIVE) { + GET_AI(cur->ai_next, afd, afd->a_addrany, port); + /* xxx meaningless? + * GET_CANONNAME(cur->ai_next, "anyaddr"); + */ + } else { + GET_AI(cur->ai_next, afd, afd->a_loopback, + port); + /* xxx meaningless? + * GET_CANONNAME(cur->ai_next, "localhost"); + */ + } + cur = cur->ai_next; + } + top = sentinel.ai_next; + if (top) + goto good; + else + ERR(EAI_FAMILY); + } + + /* hostname as numeric name */ + for (i = 0; afdl[i].a_af; i++) { + if (inet_pton(afdl[i].a_af, hostname, pton)) { + u_long v4a; + u_char pfx; + + switch (afdl[i].a_af) { + case AF_INET: + v4a = ((struct in_addr *)pton)->s_addr; + if (IN_MULTICAST(v4a) || IN_EXPERIMENTAL(v4a)) + pai->ai_flags &= ~AI_CANONNAME; + v4a >>= IN_CLASSA_NSHIFT; + if (v4a == 0 || v4a == IN_LOOPBACKNET) + pai->ai_flags &= ~AI_CANONNAME; + break; +#ifdef INET6 + case AF_INET6: + pfx = ((struct in6_addr *)pton)->s6_addr8[0]; + if (pfx == 0 || pfx == 0xfe || pfx == 0xff) + pai->ai_flags &= ~AI_CANONNAME; + break; +#endif + } + + if (pai->ai_family == afdl[i].a_af || + pai->ai_family == PF_UNSPEC) { + if (! (pai->ai_flags & AI_CANONNAME)) { + GET_AI(top, &afdl[i], pton, port); + goto good; + } + /* + * if AI_CANONNAME and if reverse lookup + * fail, return ai anyway to pacify + * calling application. + * + * XXX getaddrinfo() is a name->address + * translation function, and it looks strange + * that we do addr->name translation here. + */ + get_name(pton, &afdl[i], &top, pton, pai, port); + goto good; + } else + ERR(EAI_FAMILY); /*xxx*/ + } + } + + if (pai->ai_flags & AI_NUMERICHOST) + ERR(EAI_NONAME); + + /* hostname as alphabetical name */ + error = get_addr(hostname, pai->ai_family, &top, pai, port); + if (error == 0) { + if (top) { + good: + *res = top; + return SUCCESS; + } else + error = EAI_FAIL; + } + free: + if (top) + freeaddrinfo(top); + bad: + *res = NULL; + return error; +} + +static int +get_name(addr, afd, res, numaddr, pai, port0) + const char *addr; + struct afd *afd; + struct addrinfo **res; + char *numaddr; + struct addrinfo *pai; + int port0; +{ + u_short port = port0 & 0xffff; + struct hostent *hp; + struct addrinfo *cur; + int error = 0, h_error; + +#ifdef INET6 + hp = getipnodebyaddr(addr, afd->a_addrlen, afd->a_af, &h_error); +#else + hp = gethostbyaddr(addr, afd->a_addrlen, AF_INET); +#endif + if (hp && hp->h_name && hp->h_name[0] && hp->h_addr_list[0]) { + GET_AI(cur, afd, hp->h_addr_list[0], port); + GET_CANONNAME(cur, hp->h_name); + } else + GET_AI(cur, afd, numaddr, port); + +#ifdef INET6 + if (hp) + freehostent(hp); +#endif + *res = cur; + return SUCCESS; + free: + if (cur) + freeaddrinfo(cur); +#ifdef INET6 + if (hp) + freehostent(hp); +#endif + /* bad: */ + *res = NULL; + return error; +} + +static int +get_addr(hostname, af, res, pai, port0) + const char *hostname; + int af; + struct addrinfo **res; + struct addrinfo *pai; + int port0; +{ + u_short port = port0 & 0xffff; + struct addrinfo sentinel; + struct hostent *hp; + struct addrinfo *top, *cur; + struct afd *afd; + int i, error = 0, h_error; + char *ap; +#ifndef INET6 + extern int h_errno; +#endif + + top = NULL; + sentinel.ai_next = NULL; + cur = &sentinel; +#ifdef INET6 + if (af == AF_UNSPEC) { + hp = getipnodebyname(hostname, AF_INET6, + AI_ADDRCONFIG|AI_ALL|AI_V4MAPPED, &h_error); + } else + hp = getipnodebyname(hostname, af, AI_ADDRCONFIG, &h_error); +#else + hp = gethostbyname(hostname); + h_error = h_errno; +#endif + if (hp == NULL) { + switch (h_error) { + case HOST_NOT_FOUND: + case NO_DATA: + error = EAI_NODATA; + break; + case TRY_AGAIN: + error = EAI_AGAIN; + break; + case NO_RECOVERY: + default: + error = EAI_FAIL; + break; + } + goto bad; + } + + if ((hp->h_name == NULL) || (hp->h_name[0] == 0) || + (hp->h_addr_list[0] == NULL)) + ERR(EAI_FAIL); + + for (i = 0; (ap = hp->h_addr_list[i]) != NULL; i++) { + switch (af) { +#ifdef INET6 + case AF_INET6: + afd = &afdl[N_INET6]; + break; +#endif +#ifndef INET6 + default: /* AF_UNSPEC */ +#endif + case AF_INET: + afd = &afdl[N_INET]; + break; +#ifdef INET6 + default: /* AF_UNSPEC */ + if (IN6_IS_ADDR_V4MAPPED((struct in6_addr *)ap)) { + ap += sizeof(struct in6_addr) - + sizeof(struct in_addr); + afd = &afdl[N_INET]; + } else + afd = &afdl[N_INET6]; + break; +#endif + } +#ifdef FAITH + if (translate && afd->a_af == AF_INET) { + struct in6_addr *in6; + + GET_AI(cur->ai_next, &afdl[N_INET6], ap, port); + in6 = &((struct sockaddr_in6 *)cur->ai_next->ai_addr)->sin6_addr; + memcpy(&in6->s6_addr32[0], &faith_prefix, + sizeof(struct in6_addr) - sizeof(struct in_addr)); + memcpy(&in6->s6_addr32[3], ap, sizeof(struct in_addr)); + } else +#endif /* FAITH */ + GET_AI(cur->ai_next, afd, ap, port); + if (cur == &sentinel) { + top = cur->ai_next; + GET_CANONNAME(top, hp->h_name); + } + cur = cur->ai_next; + } +#ifdef INET6 + freehostent(hp); +#endif + *res = top; + return SUCCESS; + free: + if (top) + freeaddrinfo(top); +#ifdef INET6 + if (hp) + freehostent(hp); +#endif + bad: + *res = NULL; + return error; +} Index: ncftp3/libncftp/getnameinfo.c diff -u /dev/null ncftp3/libncftp/getnameinfo.c:1.1 --- /dev/null Sun Aug 6 12:33:35 2006 +++ ncftp3/libncftp/getnameinfo.c Tue Nov 6 23:50:47 2001 @@ -0,0 +1,203 @@ +/* + * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the project nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/* + * Issues to be discussed: + * - Thread safe-ness must be checked + * - Return values. There seems to be no standard for return value (RFC2133) + * but INRIA implementation returns EAI_xxx defined for getaddrinfo(). + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "addrinfo.h" + +#define SUCCESS 0 +#define ANY 0 +#define YES 1 +#define NO 0 + +static struct afd { + int a_af; + int a_addrlen; + int a_socklen; + int a_off; +} afdl [] = { +#ifdef INET6 + {PF_INET6, sizeof(struct in6_addr), sizeof(struct sockaddr_in6), + offsetof(struct sockaddr_in6, sin6_addr)}, +#endif + {PF_INET, sizeof(struct in_addr), sizeof(struct sockaddr_in), + offsetof(struct sockaddr_in, sin_addr)}, + {0, 0, 0}, +}; + +struct sockinet { + u_char si_len; + u_char si_family; + u_short si_port; +}; + +#define ENI_NOSOCKET 0 +#define ENI_NOSERVNAME 1 +#define ENI_NOHOSTNAME 2 +#define ENI_MEMORY 3 +#define ENI_SYSTEM 4 +#define ENI_FAMILY 5 +#define ENI_SALEN 6 + +int +getnameinfo(sa, salen, host, hostlen, serv, servlen, flags) + const struct sockaddr *sa; + size_t salen; + char *host; + size_t hostlen; + char *serv; + size_t servlen; + int flags; +{ + struct afd *afd; + struct servent *sp; + struct hostent *hp; + u_short port; + int family, len, i; + char *addr, *p; + u_long v4a; + u_char pfx; + int h_error; + char numserv[512]; + char numaddr[512]; + + if (sa == NULL) + return ENI_NOSOCKET; + + len = sa->sa_len; + if (len != salen) return ENI_SALEN; + + family = sa->sa_family; + for (i = 0; afdl[i].a_af; i++) + if (afdl[i].a_af == family) { + afd = &afdl[i]; + goto found; + } + return ENI_FAMILY; + + found: + if (len != afd->a_socklen) return ENI_SALEN; + + port = ((struct sockinet *)sa)->si_port; /* network byte order */ + addr = (char *)sa + afd->a_off; + + if (serv == NULL || servlen == 0) { + /* what we should do? */ + } else if (flags & NI_NUMERICSERV) { + snprintf(numserv, sizeof(numserv), "%d", ntohs(port)); + if (strlen(numserv) > servlen) + return ENI_MEMORY; + strcpy(serv, numserv); + } else { + sp = getservbyport(port, (flags & NI_DGRAM) ? "udp" : "tcp"); + if (sp) { + if (strlen(sp->s_name) > servlen) + return ENI_MEMORY; + strcpy(serv, sp->s_name); + } else + return ENI_NOSERVNAME; + } + + switch (sa->sa_family) { + case AF_INET: + v4a = ((struct sockaddr_in *)sa)->sin_addr.s_addr; + if (IN_MULTICAST(v4a) || IN_EXPERIMENTAL(v4a)) + flags |= NI_NUMERICHOST; + v4a >>= IN_CLASSA_NSHIFT; + if (v4a == 0 || v4a == IN_LOOPBACKNET) + flags |= NI_NUMERICHOST; + break; +#ifdef INET6 + case AF_INET6: + pfx = ((struct sockaddr_in6 *)sa)->sin6_addr.s6_addr8[0]; + if (pfx == 0 || pfx == 0xfe || pfx == 0xff) + flags |= NI_NUMERICHOST; + break; +#endif + } + if (host == NULL || hostlen == 0) { + /* what should we do? */ + } else if (flags & NI_NUMERICHOST) { + if (inet_ntop(afd->a_af, addr, numaddr, sizeof(numaddr)) + == NULL) + return ENI_SYSTEM; + if (strlen(numaddr) > hostlen) + return ENI_MEMORY; + strcpy(host, numaddr); + } else { +#ifdef INET6 + hp = getipnodebyaddr(addr, afd->a_addrlen, afd->a_af, &h_error); +#else + hp = gethostbyaddr(addr, afd->a_addrlen, afd->a_af); + h_error = h_errno; +#endif + + if (hp) { + if (flags & NI_NOFQDN) { + p = strchr(hp->h_name, '.'); + if (p) *p = '\0'; + } + if (strlen(hp->h_name) > hostlen) { +#ifdef INET6 + freehostent(hp); +#endif + return ENI_MEMORY; + } + strcpy(host, hp->h_name); +#ifdef INET6 + freehostent(hp); +#endif + } else { + if (flags & NI_NAMEREQD) + return ENI_NOHOSTNAME; + if (inet_ntop(afd->a_af, addr, numaddr, sizeof(numaddr)) + == NULL) + return ENI_NOHOSTNAME; + if (strlen(numaddr) > hostlen) + return ENI_MEMORY; + strcpy(host, numaddr); + } + } + return SUCCESS; +} Index: ncftp3/libncftp/ncftp.h diff -u ncftp3/libncftp/ncftp.h:1.1.1.19 ncftp3/libncftp/ncftp.h:1.24 --- ncftp3/libncftp/ncftp.h:1.1.1.19 Sun Aug 6 12:30:30 2006 +++ ncftp3/libncftp/ncftp.h Sun Aug 6 12:33:18 2006 @@ -376,11 +376,10 @@ int mlsFeatures; /* Do not modify this field. */ int STATfileParamWorks; /* Do not modify this field. */ int NLSTfileParamWorks; /* Do not modify this field. */ - - struct sockaddr_in servCtlAddr; /* Do not modify this field. */ - struct sockaddr_in servDataAddr; /* Do not modify this field. */ - struct sockaddr_in ourCtlAddr; /* Do not modify this field. */ - struct sockaddr_in ourDataAddr; /* Do not modify this field. */ + struct sockaddr_storage servCtlAddr; /* Do not modify this field. */ + struct sockaddr_storage servDataAddr; /* Do not modify this field. */ + struct sockaddr_storage ourCtlAddr; /* Do not modify this field. */ + struct sockaddr_storage ourDataAddr; /* Do not modify this field. */ int netMode; /* Do not use or modify. */ char *buf; /* Do not modify this field. */ size_t bufSize; /* Do not modify this field. */ @@ -756,9 +755,9 @@ /* The following block may be changed by configure script */ #ifndef Stat -#define Stat stat64 -#define Lstat lstat64 -#define Fstat fstat64 +#define Stat stat +#define Lstat lstat +#define Fstat fstat #endif #define kFtwNoAutoGrowButContinue (-1) @@ -980,8 +979,8 @@ /* Everything else below are private routines, or stuff for testing */ int FTPInitConnectionInfo2(const FTPLIPtr lip, const FTPCIPtr cip, char *const buf, size_t bufSize); -int FTPSendPort(const FTPCIPtr cip, struct sockaddr_in *saddr); -int FTPSendPassive(const FTPCIPtr cip, struct sockaddr_in *saddr, int *weird); +int FTPSendPort(const FTPCIPtr cip, struct sockaddr *saddr); +int FTPSendPassive(const FTPCIPtr cip, struct sockaddr *saddr, int *weird); int FTPSetStartOffset(const FTPCIPtr cip, longest_int restartPt); void FTPCloseControlConnection(const FTPCIPtr cip); int FTPSendCommand(const FTPCIPtr cip, const char *const cmdspec, va_list ap) Index: ncftp3/libncftp/syshdrs.h diff -u ncftp3/libncftp/syshdrs.h:1.1.1.12 ncftp3/libncftp/syshdrs.h:1.11 --- ncftp3/libncftp/syshdrs.h:1.1.1.12 Sun Aug 6 12:30:30 2006 +++ ncftp3/libncftp/syshdrs.h Sun Aug 6 12:33:18 2006 @@ -23,6 +23,10 @@ # define _WIN32_WINNT 0x0400 # endif # include /* includes if _WIN32_WINNT >= 0x400 */ +# ifdef ENABLE_IPV6 +# include +# define INET6_ADDRSTRLEN 46 +# endif /* ENABLE_IPV6 */ # include # include # include @@ -161,6 +165,9 @@ # include # endif +# ifndef HAVE_GETADDRINFO +# include "addrinfo.h" +# endif # ifdef CAN_USE_SYS_SELECT_H # include # endif Index: ncftp3/ncftp/cmds.c diff -u ncftp3/ncftp/cmds.c:1.1.1.18 ncftp3/ncftp/cmds.c:1.17 --- ncftp3/ncftp/cmds.c:1.1.1.18 Sun Aug 6 12:30:32 2006 +++ ncftp3/ncftp/cmds.c Sun Aug 6 12:33:18 2006 @@ -2532,8 +2532,7 @@ (void) printf("Unknown host \"%s\".\n", ohost); return (-1); } - (void) STRNCPY(gConn.host, ipstr); - OpenMsg("Connecting to %s...", ipstr); + OpenMsg("Connecting to %s...", gConn.host); } else { OpenMsg("Connecting to %s via %s...", gConn.host, gConn.firewallHost); Trace(0, "Fw: %s Type: %d User: %s Pass: %s Port: %u\n", Index: ncftp3/ncftp/syshdrs.h diff -u ncftp3/ncftp/syshdrs.h:1.1.1.12 ncftp3/ncftp/syshdrs.h:1.10 --- ncftp3/ncftp/syshdrs.h:1.1.1.12 Thu Jan 8 19:51:13 2004 +++ ncftp3/ncftp/syshdrs.h Thu Jan 8 20:09:33 2004 @@ -32,6 +32,9 @@ # define _WIN32_WINNT 0x0400 # endif # include /* includes if _WIN32_WINNT >= 0x400 */ +#ifdef ENABLE_IPV6 +# include +#endif /* ENABLE_IPV6 */ # include # include # include @@ -155,6 +158,9 @@ # include # include # include +# ifndef HAVE_GETADDRINFO +# include "addrinfo.h" +# endif # if defined(HAVE_SYS_IOCTL_H) && defined(HAVE_TERMIOS_H) # include # include Index: ncftp3/ncftp/util.c diff -u ncftp3/ncftp/util.c:1.1.1.15 ncftp3/ncftp/util.c:1.25 --- ncftp3/ncftp/util.c:1.1.1.15 Sun Aug 6 12:30:32 2006 +++ ncftp3/ncftp/util.c Sun Aug 6 12:33:19 2006 @@ -664,44 +664,30 @@ int MyGetHostByName(char *const volatile dst, size_t dsize, const char *const hn, int t) { + struct addrinfo hints; + struct addrinfo *res; + int error; #if (defined(WIN32) || defined(_WINDOWS)) && !defined(__CYGWIN__) - struct hostent *hp; - struct in_addr ina; - if (inet_addr(hn) != (unsigned long) 0xFFFFFFFF) { - /* Address is an IP address string, which is what we want. */ - (void) Strncpy(dst, hn, dsize); - return (0); - } - - hp = gethostbyname(hn); - if (hp != NULL) { - (void) memcpy(&ina.s_addr, hp->h_addr_list[0], (size_t) hp->h_length); - InetNtoA(dst, ((struct in_addr **) hp->h_addr_list)[0], dsize); + memset(&hints, 0, sizeof(hints)); + hints.ai_family = PF_UNSPEC; + hints.ai_socktype = SOCK_STREAM; + error = getaddrinfo(hn, NULL, &hints, &res); + + if (error == 0) { + char buf[NI_MAXHOST]; + + getnameinfo(res->ai_addr, res->ai_addrlen, + buf, sizeof(buf), + NULL, 0, NI_NUMERICHOST); + (void) Strncpy(dst, buf, dsize); + freeaddrinfo(res); return (0); } #else int sj; vsigproc_t osigpipe, osigint, osigalrm; - struct hostent *hp; -#ifdef HAVE_INET_ATON - struct in_addr ina; -#endif - -#ifdef HAVE_INET_ATON - if (inet_aton(hn, &ina) != 0) { - /* Address is an IP address string, which is what we want. */ - (void) Strncpy(dst, hn, dsize); - return (0); - } -#else - if (inet_addr(hn) != (unsigned long) 0xFFFFFFFF) { - /* Address is an IP address string, which is what we want. */ - (void) Strncpy(dst, hn, dsize); - return (0); - } -#endif #ifdef HAVE_SIGSETJMP osigpipe = osigint = osigalrm = (sigproc_t) 0; @@ -726,14 +712,25 @@ osigalrm = NcSignal(SIGALRM, CancelGetHostByName); if (t > 0) (void) alarm((unsigned int) t); - hp = gethostbyname(hn); + memset(&hints, 0, sizeof(hints)); + hints.ai_flags = 0; + hints.ai_family = PF_UNSPEC; + hints.ai_socktype = SOCK_STREAM; + hints.ai_protocol = 0; + error = getaddrinfo(hn, NULL, &hints, &res); if (t > 0) (void) alarm(0); (void) NcSignal(SIGPIPE, osigpipe); (void) NcSignal(SIGINT, osigint); (void) NcSignal(SIGALRM, osigalrm); - if (hp != NULL) { - InetNtoA(dst, ((struct in_addr **) hp->h_addr_list)[0], dsize); + if (error == 0) { + char buf[NI_MAXHOST]; + + getnameinfo(res->ai_addr, res->ai_addrlen, + buf, sizeof(buf), + NULL, 0, NI_NUMERICHOST); + (void) Strncpy(dst, buf, dsize); + freeaddrinfo(res); return (0); } } Index: ncftp3/sh_util/syshdrs.h diff -u ncftp3/sh_util/syshdrs.h:1.1.1.8 ncftp3/sh_util/syshdrs.h:1.8 --- ncftp3/sh_util/syshdrs.h:1.1.1.8 Thu May 30 23:40:49 2002 +++ ncftp3/sh_util/syshdrs.h Thu May 30 23:49:39 2002 @@ -32,6 +32,9 @@ # define _WIN32_WINNT 0x0400 # endif # include /* includes if _WIN32_WINNT >= 0x400 */ +#ifdef ENABLE_IPV6 +# include +#endif /* ENABLE_IPV6 */ # include # include # include @@ -162,6 +165,9 @@ # include # include # include +# ifndef HAVE_GETADDRINFO +# include "addrinfo.h" +# endif # ifdef HAVE_LOCALE_H # include # endif Index: ncftp3/sio/SAccept.c diff -u ncftp3/sio/SAccept.c:1.1.1.1 ncftp3/sio/SAccept.c:1.4 --- ncftp3/sio/SAccept.c:1.1.1.1 Thu Jan 8 19:51:19 2004 +++ ncftp3/sio/SAccept.c Wed Aug 25 21:33:11 2004 @@ -3,8 +3,20 @@ # pragma hdrstop #endif +#ifndef HAVE_SOCKADDR_SA_LEN +#ifndef SA_LEN +#ifdef ENABLE_IPV6 +#define SA_LEN(x) (((x)->sa_family == AF_INET6) ? sizeof(struct sockaddr_in6) \ + : (((x)->sa_family == AF_INET) ? sizeof(struct sockaddr_in) \ + : -1)) +#else /* ENABLE_IPV6 */ +#define SA_LEN(x) (((x)->sa_family == AF_INET) ? sizeof(struct sockaddr_in) : -1) +#endif /* ENABLE_IPV6 */ +#endif /* SA_LEN */ +#endif /* HAVE_SOCKADDR_SA_LEN */ + int -SAccept(int sfd, struct sockaddr_in *const addr, int tlen) +SAccept(int sfd, struct sockaddr *const addr, int tlen) { int result; fd_set ss; @@ -22,7 +34,7 @@ if (tlen <= 0) { errno = 0; for (;;) { - size = (sockaddr_size_t) sizeof(struct sockaddr_in); + size = (sockaddr_size_t) sizeof(struct sockaddr_storage); result = accept(sfd, (struct sockaddr *) addr, &size); if ((result >= 0) || (errno != EINTR)) { RESTORE_SIGPIPE @@ -61,7 +73,7 @@ } do { - size = (sockaddr_size_t) sizeof(struct sockaddr_in); + size = (sockaddr_size_t) sizeof(struct sockaddr_storage); result = accept(sfd, (struct sockaddr *) addr, &size); } while ((result < 0) && (errno == EINTR)); Index: ncftp3/sio/SConnect.c diff -u ncftp3/sio/SConnect.c:1.1.1.8 ncftp3/sio/SConnect.c:1.16 --- ncftp3/sio/SConnect.c:1.1.1.8 Tue Apr 19 19:24:22 2005 +++ ncftp3/sio/SConnect.c Tue Apr 19 19:51:27 2005 @@ -3,14 +3,30 @@ # pragma hdrstop #endif -int _SConnect(const int sfd, const struct sockaddr_in *const addr, const size_t saddrsiz, const int tlen); +int _SConnect(const int sfd, const struct sockaddr *const addr, const size_t saddrsiz, const int tlen); + +#ifndef HAVE_SOCKADDR_SA_LEN +#ifndef SA_LEN +#ifdef ENABLE_IPV6 +#define SA_LEN(x) (((x)->sa_family == AF_INET6) ? sizeof(struct sockaddr_in6) \ + : (((x)->sa_family == AF_INET) ? sizeof(struct sockaddr_in) \ + : -1)) +#else /* ENABLE_IPV6 */ +#define SA_LEN(x) (((x)->sa_family == AF_INET) ? sizeof(struct sockaddr_in) : -1) +#endif /* ENABLE_IPV6 */ +#endif /* SA_LEN */ +#endif /* HAVE_SOCKADDR_SA_LEN */ int -SConnect(int sfd, const struct sockaddr_in *const addr, int tlen) +SConnect(int sfd, const struct sockaddr *const addr, int tlen) { int result; - result = _SConnect(sfd, addr, (size_t) sizeof(struct sockaddr_in), tlen); +#ifdef HAVE_SOCKADDR_SA_LEN + result = _SConnect(sfd, addr, addr->sa_len, tlen); +#else + result = _SConnect(sfd, addr, SA_LEN(addr), tlen); +#endif return (result); } /* SConnect */ @@ -54,7 +70,7 @@ int -_SConnect(const int sfd, const struct sockaddr_in *const addr, const size_t saddrsiz, const int tlen) +_SConnect(const int sfd, const struct sockaddr *const addr, const size_t saddrsiz, const int tlen) { fd_set ss, xx; struct timeval tv; Index: ncftp3/sio/SConnectByName.c diff -u ncftp3/sio/SConnectByName.c:1.1.1.3 ncftp3/sio/SConnectByName.c:1.3 --- ncftp3/sio/SConnectByName.c:1.1.1.3 Thu Jan 8 19:51:16 2004 +++ ncftp3/sio/SConnectByName.c Thu Jan 8 20:09:33 2004 @@ -7,15 +7,15 @@ SConnectByName(int sfd, const char * const addrStr, const int tlen) { int result; - struct sockaddr_in remoteAddr; + struct sockaddr_storage remoteAddr; if (addrStr == NULL) { errno = EINVAL; return (-1); } - if ((result = AddrStrToAddr(addrStr, &remoteAddr, -1)) == 0) { - result = SConnect(sfd, &remoteAddr, tlen); + if ((result = AddrStrToAddr(addrStr, (struct sockaddr *)&remoteAddr, -1)) == 0) { + result = SConnect(sfd, (struct sockaddr *)&remoteAddr, tlen); } return (result); } /* SConnectByName */ Index: ncftp3/sio/SRecvfrom.c diff -u ncftp3/sio/SRecvfrom.c:1.1.1.5 ncftp3/sio/SRecvfrom.c:1.4 --- ncftp3/sio/SRecvfrom.c:1.1.1.5 Thu Jan 8 19:51:18 2004 +++ ncftp3/sio/SRecvfrom.c Thu Jan 8 20:09:33 2004 @@ -4,7 +4,7 @@ #endif int -SRecvfrom(int sfd, char *const buf, size_t size, int fl, struct sockaddr_in *const fromAddr, int tlen) +SRecvfrom(int sfd, char *const buf, size_t size, int fl, struct sockaddr *const fromAddr, int tlen) { recv_return_t nread; int tleft; @@ -56,7 +56,7 @@ IGNORE_SIGPIPE nread = recvfrom(sfd, buf, (recv_size_t) size, fl, - (struct sockaddr *) fromAddr, &alen); + fromAddr, &alen); RESTORE_SIGPIPE if (nread >= 0) Index: ncftp3/sio/SSendto.c diff -u ncftp3/sio/SSendto.c:1.1.1.5 ncftp3/sio/SSendto.c:1.5 --- ncftp3/sio/SSendto.c:1.1.1.5 Thu Jan 8 19:51:18 2004 +++ ncftp3/sio/SSendto.c Thu Jan 8 20:09:33 2004 @@ -3,8 +3,21 @@ # pragma hdrstop #endif +#ifndef HAVE_SOCKADDR_SA_LEN +#ifndef SA_LEN +#ifdef ENABLE_IPV6 +#define SA_LEN(x) (((x)->sa_family == AF_INET6) ? sizeof(struct sockaddr_in6) \ + : (((x)->sa_family == AF_INET) ? sizeof(struct sockaddr_in) \ + : -1)) +#else /* ENABLE_IPV6 */ +#define SA_LEN(x) (((x)->sa_family == AF_INET) ? sizeof(struct sockaddr_in) : -1) +#endif /* ENABLE_IPV6 */ +#endif /* SA_LEN */ +#endif /* HAVE_SOCKADDR_SA_LEN */ + + int -SSendto(int sfd, const char *const buf, size_t size, int fl, const struct sockaddr_in *const toAddr, int tlen) +SSendto(int sfd, const char *const buf, size_t size, int fl, const struct sockaddr *const toAddr, int tlen) { send_return_t nwrote; int tleft; @@ -58,9 +71,15 @@ } IGNORE_SIGPIPE +#ifdef HAVE_SOCKADDR_SA_LEN + nwrote = sendto(sfd, buf, (send_size_t) size, fl, + toAddr, + toAddr->sa_len); +#else nwrote = sendto(sfd, buf, (send_size_t) size, fl, - (const struct sockaddr *) toAddr, - (sockaddr_size_t) sizeof(struct sockaddr_in)); + toAddr, + SA_LEN(toAddr)); +#endif RESTORE_SIGPIPE if (nwrote >= 0) @@ -77,7 +96,7 @@ int -Sendto(int sfd, const char *const buf, size_t size, const struct sockaddr_in *const toAddr) +Sendto(int sfd, const char *const buf, size_t size, const struct sockaddr *toAddr) { int result; DECL_SIGPIPE_VARS @@ -89,9 +108,15 @@ IGNORE_SIGPIPE do { +#ifdef HAVE_SOCKADDR_SA_LEN + result = (int) sendto(sfd, buf, (send_size_t) size, 0, + toAddr, + toAddr->sa_len); +#else result = (int) sendto(sfd, buf, (send_size_t) size, 0, - (const struct sockaddr *) toAddr, - (sockaddr_size_t) sizeof(struct sockaddr_in)); + toAddr, + SA_LEN(toAddr)); +#endif } while ((result < 0) && (errno == EINTR)); RESTORE_SIGPIPE return (result); Index: ncftp3/sio/SSendtoByName.c diff -u ncftp3/sio/SSendtoByName.c:1.1.1.5 ncftp3/sio/SSendtoByName.c:1.4 --- ncftp3/sio/SSendtoByName.c:1.1.1.5 Thu Jan 8 19:51:18 2004 +++ ncftp3/sio/SSendtoByName.c Thu Jan 8 20:09:33 2004 @@ -11,7 +11,7 @@ time_t done, now; fd_set ss; struct timeval tv; - struct sockaddr_in toAddr; + struct sockaddr_storage toAddr; DECL_SIGPIPE_VARS if ((buf == NULL) || (size == 0) || (toAddrStr == NULL) || (toAddrStr[0] == '\0') || (tlen <= 0)) { @@ -19,7 +19,7 @@ return (-1); } - if ((result = AddrStrToAddr(toAddrStr, &toAddr, -1)) < 0) { + if ((result = AddrStrToAddr(toAddrStr, (struct sockaddr *)&toAddr, -1)) < 0) { return (result); } @@ -81,7 +81,7 @@ SendtoByName(int sfd, const char *const buf, size_t size, const char *const toAddrStr) { int result; - struct sockaddr_in toAddr; + struct sockaddr_storage toAddr; DECL_SIGPIPE_VARS if ((buf == NULL) || (size == 0) || (toAddrStr == NULL)) { @@ -89,8 +89,7 @@ return (-1); } - - if ((result = AddrStrToAddr(toAddrStr, &toAddr, -1)) < 0) { + if ((result = AddrStrToAddr(toAddrStr, (struct sockaddr *)&toAddr, -1)) < 0) { return (result); } Index: ncftp3/sio/StrAddr.c diff -u ncftp3/sio/StrAddr.c:1.1.1.5 ncftp3/sio/StrAddr.c:1.8 --- ncftp3/sio/StrAddr.c:1.1.1.5 Sun Jan 12 11:26:09 2003 +++ ncftp3/sio/StrAddr.c Thu Aug 26 00:49:07 2004 @@ -3,6 +3,19 @@ # pragma hdrstop #endif +#ifndef HAVE_SOCKADDR_SA_LEN +#ifndef SA_LEN +#ifdef ENABLE_IPV6 +#define SA_LEN(x) (((x)->sa_family == AF_INET6) ? sizeof(struct sockaddr_in6) \ + : (((x)->sa_family == AF_INET) ? sizeof(struct sockaddr_in) \ + : -1)) +#else /* ENABLE_IPV6 */ +#define SA_LEN(x) (((x)->sa_family == AF_INET) ? sizeof(struct sockaddr_in) : -1) +#endif /* ENABLE_IPV6 */ +#endif /* SA_LEN */ +#endif /* HAVE_SOCKADDR_SA_LEN */ + + #ifndef INADDR_ANY # define INADDR_ANY ((unsigned long int) 0x00000000) #endif @@ -22,14 +35,10 @@ { char str[64]; char *cp; -#if defined(HAVE_GETSERVBYNAME_R) && (defined(AIX) || defined(TRU64UNIX) || defined(DIGITAL_UNIX)) - struct servent *sp; -#elif defined(HAVE_GETSERVBYNAME_R) - struct servent se, *sp; - char spbuf[256]; -#else - struct servent *sp; -#endif + struct addrinfo hints, *res; + int error; + unsigned int port; + strncpy(str, s, sizeof(str) - 1); str[sizeof(str) - 1] = '\0'; cp = str; @@ -46,55 +55,29 @@ } *cp = '\0'; - sp = NULL; -#if defined(HAVE_GETSERVBYNAME_R) && (defined(SOLARIS) || defined(IRIX) || defined(BSDOS)) - if ((sp == NULL) && ((proto == 0) || (proto == 't'))) { - memset(spbuf, 0, sizeof(spbuf)); - sp = getservbyname_r(str, "tcp", &se, spbuf, sizeof(spbuf)); - } - if ((sp == NULL) && ((proto == 0) || (proto == 'u'))) { - memset(spbuf, 0, sizeof(spbuf)); - sp = getservbyname_r(str, "udp", &se, spbuf, sizeof(spbuf)); - } -#elif defined(HAVE_GETSERVBYNAME_R) && defined(LINUX) - if ((sp == NULL) && ((proto == 0) || (proto == 't'))) { - memset(spbuf, 0, sizeof(spbuf)); - if (getservbyname_r(str, "tcp", &se, spbuf, sizeof(spbuf), &sp) != 0) - sp = NULL; - } - if ((sp == NULL) && ((proto == 0) || (proto == 'u'))) { - memset(spbuf, 0, sizeof(spbuf)); - if (getservbyname_r(str, "udp", &se, spbuf, sizeof(spbuf), &sp) != 0) - sp = NULL; - } -#elif defined(HAVE_GETSERVBYNAME_R) && defined(AIX) - { - struct servent_data sed; - if ((sp == NULL) && ((proto == 0) || (proto == 't'))) { - memset(&sed, 0, sizeof(sed)); - if (getservbyname_r(str, "tcp", sp, &sed) != 0) - sp = NULL; - } - if ((sp == NULL) && ((proto == 0) || (proto == 'u'))) { - memset(&sed, 0, sizeof(sed)); - if (getservbyname_r(str, "udp", sp, &sed) != 0) - sp = NULL; - } - } -#else - /* Note: getservbyname is already threadsafe on: HP-UX, Tru64 */ - if ((sp == NULL) && ((proto == 0) || (proto == 't'))) { - sp = getservbyname(str, "tcp"); - } - if ((sp == NULL) && ((proto == 0) || (proto == 'u'))) { - sp = getservbyname(str, "udp"); - } -#endif - - if (sp != NULL) { - return ((unsigned int) ntohs((unsigned short) sp->s_port)); + error = 1; + memset(&hints, 0, sizeof(hints)); + hints.ai_family = PF_UNSPEC; + if ((error != 0) && ((proto == 0) || (proto == 't'))) { + hints.ai_socktype = SOCK_STREAM; + error = getaddrinfo(NULL, str, &hints, &res); + } + if ((error != 0) && ((proto == 0) || (proto == 'u'))) { + hints.ai_socktype = SOCK_DGRAM; + error = getaddrinfo(NULL, str, &hints, &res); + } + if (error != 0) { + return (0); /* error */ + } + if (res->ai_addr->sa_family == AF_INET) { + port = ((struct sockaddr_in *)res->ai_addr)->sin_port; + } else if (res->ai_addr->sa_family == AF_INET6) { + port = ((struct sockaddr_in6 *)res->ai_addr)->sin6_port; + } else { + port = 0; /* error */ } - return (0); /* error */ + freeaddrinfo(res); + return ((unsigned int) ntohs((unsigned short) port)); } /* ServiceNameToPortNumber */ @@ -200,15 +183,13 @@ int -AddrStrToAddr(const char * const s, struct sockaddr_in * const sa, const int defaultport) +AddrStrToAddr(const char * const s, struct sockaddr * const sa, const int defaultport) { - char portstr[128]; - unsigned int ipnum; - unsigned int port; - struct hostent *hp; - char *hostcp, *atsign, *colon, *cp, *p2; + char portstr[128], portstr2[128]; + struct addrinfo hints, *res; + char *hostcp, *atsign, *colon, *cp, *p2, *portp; + int error; - memset(sa, 0, sizeof(struct sockaddr_in)); strncpy(portstr, s, sizeof(portstr)); portstr[sizeof(portstr) - 1] = '\0'; @@ -216,7 +197,6 @@ /* Does it look like a URL? http://host ? */ if ((colon[1] == '/') && (colon[2] == '/')) { *colon = '\0'; - port = 0; hostcp = colon + 3; for (cp = hostcp; *cp != '\0'; cp++) { if ((!ISALNUM(*cp)) && (*cp != '.')) { @@ -227,29 +207,27 @@ while (isdigit((int) *cp)) cp++; *cp = '\0'; - port = atoi(p2); } *cp = '\0'; break; } } - if (port == 0) - port = ServiceNameToPortNumber(portstr, 0); } else { /* Look for host.name.domain:port */ *colon = '\0'; hostcp = portstr; - port = (unsigned int) atoi(colon + 1); } + portp = portstr; } else if ((atsign = strchr(portstr, '@')) != NULL) { /* Look for port@host.name.domain */ *atsign = '\0'; hostcp = atsign + 1; - port = (unsigned int) atoi(portstr); + portp = portstr; } else if (defaultport > 0) { /* Have just host.name.domain, use that w/ default port. */ - port = (unsigned int) defaultport; + sprintf(portstr2, "%d", defaultport); hostcp = portstr; + portp = portstr2; } else { /* If defaultport <= 0, they must supply a port number * in the host/port string. @@ -258,53 +236,49 @@ return (kAddrStrToAddrMiscErr); } - sa->sin_port = htons((short) port); - - ipnum = inet_addr(hostcp); - if (ipnum != INADDR_NONE) { - sa->sin_family = AF_INET; - sa->sin_addr.s_addr = ipnum; - } else { - errno = 0; - hp = gethostbyname(hostcp); - if (hp == NULL) { - if (errno == 0) - errno = ENOENT; - return (kAddrStrToAddrBadHost); - } - sa->sin_family = hp->h_addrtype; - memcpy(&sa->sin_addr.s_addr, hp->h_addr_list[0], - (size_t) hp->h_length); - } + memset(&hints, 0, sizeof(hints)); + hints.ai_family = PF_UNSPEC; + hints.ai_socktype = SOCK_STREAM; + error = getaddrinfo(hostcp, portp, &hints, &res); + if (error != 0) + return (kAddrStrToAddrBadHost); + memcpy(sa, res->ai_addr, res->ai_addrlen); + freeaddrinfo(res); return (0); } /* AddrStrToAddr */ char * -AddrToAddrStr(char *const dst, size_t dsize, struct sockaddr_in * const saddrp, int dns, const char *fmt) +AddrToAddrStr(char *const dst, size_t dsize, struct sockaddr * const saddrp, int dns, const char *fmt) { char addrName[128]; char *addrNamePtr; - struct hostent *hp; - char str[128]; + char portName[128]; + char portNum[128]; char s_name[64]; char *dlim, *dp; const char *cp; - addrNamePtr = NULL; - if (dns == 0) { - InetNtoA(addrName, &saddrp->sin_addr, sizeof(addrName)); - addrNamePtr = addrName; - } else { - hp = gethostbyaddr((gethost_addrptr_t) &saddrp->sin_addr, sizeof(struct in_addr), AF_INET); - if ((hp != NULL) && (hp->h_name != NULL) && (hp->h_name[0] != '\0')) { - addrNamePtr = hp->h_name; - } else { - InetNtoA(addrName, &saddrp->sin_addr, sizeof(addrName)); - addrNamePtr = addrName; - } - } + addrNamePtr = addrName; + if (dns == 0) + dns = NI_NUMERICHOST; + else + dns = 0; + getnameinfo(saddrp, +#ifdef HAVE_SOCKADDR_SA_LEN + saddrp->sa_len, +#else + SA_LEN(saddrp), +#endif + addrName, sizeof(addrName), portName, sizeof(portName), dns); + getnameinfo(saddrp, +#ifdef HAVE_SOCKADDR_SA_LEN + saddrp->sa_len, +#else + SA_LEN(saddrp), +#endif + NULL, 0, portNum, sizeof(portNum), NI_NUMERICSERV); if (fmt == NULL) fmt = "%h:%p"; for (dp = dst, dlim = dp + dsize - 1; ; fmt++) { @@ -316,8 +290,7 @@ if (dp < dlim) *dp++ = '%'; } else if (*fmt == 'p') { - sprintf(str, "%u", (unsigned int) ntohs(saddrp->sin_port)); - for (cp = str; *cp != '\0'; cp++) + for (cp = portNum; *cp != '\0'; cp++) if (dp < dlim) *dp++ = *cp; *dp = '\0'; @@ -332,16 +305,20 @@ *dp++ = *cp; *dp = '\0'; } else if (*fmt == 's') { - cp = s_name; - (void) ServicePortNumberToName(ntohs(saddrp->sin_port), s_name, sizeof(s_name), 0); - for ( ; *cp != '\0'; cp++) + for (cp = portName ; *cp != '\0'; cp++) if (dp < dlim) *dp++ = *cp; /* endservent(); */ *dp = '\0'; } else if ((*fmt == 't') || (*fmt == 'u')) { cp = s_name; - (void) ServicePortNumberToName(ntohs(saddrp->sin_port), s_name, sizeof(s_name), (int) *fmt); + if (saddrp->sa_family == AF_INET) { + (void) ServicePortNumberToName(ntohs(((struct sockaddr_in *)saddrp)->sin_port), s_name, sizeof(s_name), (int) *fmt); + } else if (saddrp->sa_family == AF_INET6) { + (void) ServicePortNumberToName(ntohs(((struct sockaddr_in6 *)saddrp)->sin6_port), s_name, sizeof(s_name), (int) *fmt); + } else { + cp = '\0'; + } for ( ; *cp != '\0'; cp++) if (dp < dlim) *dp++ = *cp; Index: ncftp3/sio/sio.h diff -u ncftp3/sio/sio.h:1.1.1.9 ncftp3/sio/sio.h:1.13 --- ncftp3/sio/sio.h:1.1.1.9 Tue Apr 19 19:24:23 2005 +++ ncftp3/sio/sio.h Tue Apr 19 19:51:27 2005 @@ -197,7 +197,7 @@ int PWrite(int, const char *const, size_t); /* SAccept.c */ -int SAccept(int, struct sockaddr_in *const, int); +int SAccept(int, struct sockaddr *const, int); /* SBind.c */ int SBind(int, const int, const int, const int); @@ -208,7 +208,7 @@ int SClose(int, int); /* SConnect.c */ -int SConnect(int, const struct sockaddr_in *const, int); +int SConnect(int, const struct sockaddr *const, int); /* SConnectByName.c */ int SConnectByName(int, const char *const, const int); @@ -232,7 +232,7 @@ int SRecv(int, char *const, size_t, int, int, int); /* SRecvfrom.c */ -int SRecvfrom(int, char *const, size_t, int, struct sockaddr_in *const, int); +int SRecvfrom(int, char *const, size_t, int, struct sockaddr *const, int); /* SRecvmsg.c */ int SRecvmsg(int, void *const, int, int); @@ -248,8 +248,8 @@ int SSend(int, char *, size_t, int, int); /* SSendto.c */ -int SSendto(int, const char *const, size_t, int, const struct sockaddr_in *const, int); -int Sendto(int, const char *const, size_t, const struct sockaddr_in *const); +int SSendto(int, const char *const, size_t, int, const struct sockaddr *const, int); +int Sendto(int, const char *const, size_t, const struct sockaddr *const); /* SSendtoByName.c */ int SSendtoByName(int, const char *const, size_t, int, const char *const, int); @@ -280,8 +280,8 @@ unsigned int ServiceNameToPortNumber(const char *const s, const int proto); int ServicePortNumberToName(unsigned short port, char *const dst, const size_t dsize, const int proto); void InetNtoA(char *dst, struct in_addr *ia, size_t siz); -int AddrStrToAddr(const char *const, struct sockaddr_in *const, const int); -char *AddrToAddrStr(char *const dst, size_t dsize, struct sockaddr_in * const saddrp, int dns, const char *fmt); +int AddrStrToAddr(const char *const, struct sockaddr *const, const int); +char *AddrToAddrStr(char *const dst, size_t dsize, struct sockaddr * const saddrp, int dns, const char *fmt); /* SError.c */ const char *SError(int e); Index: ncftp3/sio/syshdrs.h diff -u ncftp3/sio/syshdrs.h:1.1.1.8 ncftp3/sio/syshdrs.h:1.9 --- ncftp3/sio/syshdrs.h:1.1.1.8 Tue Apr 19 19:24:22 2005 +++ ncftp3/sio/syshdrs.h Tue Apr 19 19:51:27 2005 @@ -19,6 +19,9 @@ # define WINVER 0x0400 # define _WIN32_WINNT 0x0400 # include /* includes if _WIN32_WINNT >= 0x400 */ +#ifdef ENABLE_IPV6 +# include +#endif /* ENABLE_IPV6 */ # include # include # include Index: ncftp3/vis/syshdrs.h diff -u ncftp3/vis/syshdrs.h:1.1.1.8 ncftp3/vis/syshdrs.h:1.5 --- ncftp3/vis/syshdrs.h:1.1.1.8 Thu Jan 8 19:51:11 2004 +++ ncftp3/vis/syshdrs.h Thu Jan 8 20:09:34 2004 @@ -94,6 +94,9 @@ #include #include #include +#ifndef HAVE_GETADDRINFO +# include "addrinfo.h" +#endif #ifdef HAVE_LOCALE_H # include