;; IPv6 patch for pidentd-3.0.16 ;; Feb 27, 2004 by Hajimu UMEMOTO ;; Index: configure.in diff -u configure.in.orig configure.in --- configure.in.orig Mon Nov 25 16:36:00 2002 +++ configure.in Fri Feb 27 23:18:46 2004 @@ -120,6 +120,13 @@ *-aix4.2* | *-aix4.3*) host_os=aix42 ;; + *-freebsd2* | *-freebsd3*) + host_os=freebsd2 + ;; + *-freebsd4* | *-freebsd5* | *-freebsd6*) + host_os=freebsd2 + CPPFLAGS="$CPPFLAGS -DHAVE_IPV6=1" + ;; *-irix4*) host_os=irix4 AC_DEFINE(_PATH_UNIX,"/unix") Index: configure diff -u configure.orig configure --- configure.orig Mon Nov 25 16:36:11 2002 +++ configure Fri Feb 27 23:19:37 2004 @@ -38,6 +38,7 @@ program_transform_name=s,x,x, silent= site= +sitefile= srcdir= target=NONE verbose= @@ -152,6 +153,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 @@ -322,6 +324,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=*) @@ -487,12 +494,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 @@ -581,7 +592,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:585: checking for $ac_word" >&5 +echo "configure:596: 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 @@ -611,7 +622,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:615: checking for $ac_word" >&5 +echo "configure:626: 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 @@ -662,7 +673,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:666: checking for $ac_word" >&5 +echo "configure:677: 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 @@ -694,7 +705,7 @@ fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 -echo "configure:698: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 +echo "configure:709: 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. @@ -705,12 +716,12 @@ cat > conftest.$ac_ext << EOF -#line 709 "configure" +#line 720 "configure" #include "confdefs.h" main(){return(0);} EOF -if { (eval echo configure:714: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:725: \"$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 @@ -736,12 +747,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:740: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 +echo "configure:751: 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:745: checking whether we are using GNU C" >&5 +echo "configure:756: 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 @@ -750,7 +761,7 @@ yes; #endif EOF -if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:754: \"$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:765: \"$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 @@ -769,7 +780,7 @@ ac_save_CFLAGS="$CFLAGS" CFLAGS= echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 -echo "configure:773: checking whether ${CC-cc} accepts -g" >&5 +echo "configure:784: 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 @@ -849,7 +860,7 @@ fi echo $ac_n "checking host system type""... $ac_c" 1>&6 -echo "configure:853: checking host system type" >&5 +echo "configure:864: checking host system type" >&5 host_alias=$host case "$host_alias" in @@ -879,6 +890,13 @@ *-aix4.2* | *-aix4.3*) host_os=aix42 ;; + *-freebsd2* | *-freebsd3*) + host_os=freebsd2 + ;; + *-freebsd4* | *-freebsd5* | *-freebsd6*) + host_os=freebsd2 + CPPFLAGS="$CPPFLAGS -DHAVE_IPV6=1" + ;; *-irix4*) host_os=irix4 cat >> confdefs.h <<\EOF @@ -1008,7 +1026,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:1012: checking for a BSD compatible install" >&5 +echo "configure:1030: 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 @@ -1061,7 +1079,7 @@ test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6 -echo "configure:1065: checking whether ${MAKE-make} sets \${MAKE}" >&5 +echo "configure:1083: 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 @@ -1089,7 +1107,7 @@ echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6 -echo "configure:1093: checking how to run the C preprocessor" >&5 +echo "configure:1111: checking how to run the C preprocessor" >&5 # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= @@ -1104,13 +1122,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:1114: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1132: \"$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 : @@ -1121,13 +1139,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:1131: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1149: \"$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 : @@ -1138,13 +1156,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:1148: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1166: \"$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 : @@ -1169,12 +1187,12 @@ echo "$ac_t""$CPP" 1>&6 echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6 -echo "configure:1173: checking for ANSI C header files" >&5 +echo "configure:1191: 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 @@ -1182,7 +1200,7 @@ #include EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1186: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1204: \"$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* @@ -1199,7 +1217,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 @@ -1217,7 +1235,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 @@ -1238,7 +1256,7 @@ : else cat > conftest.$ac_ext < #define ISLOWER(c) ('a' <= (c) && (c) <= 'z') @@ -1249,7 +1267,7 @@ exit (0); } EOF -if { (eval echo configure:1253: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:1271: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then : else @@ -1276,17 +1294,17 @@ do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:1280: checking for $ac_hdr" >&5 +echo "configure:1298: 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:1290: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1308: \"$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* @@ -1314,12 +1332,12 @@ echo $ac_n "checking for pid_t""... $ac_c" 1>&6 -echo "configure:1318: checking for pid_t" >&5 +echo "configure:1336: 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 @@ -1347,12 +1365,12 @@ fi echo $ac_n "checking for uid_t in sys/types.h""... $ac_c" 1>&6 -echo "configure:1351: checking for uid_t in sys/types.h" >&5 +echo "configure:1369: 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 @@ -1381,12 +1399,12 @@ fi echo $ac_n "checking for mode_t""... $ac_c" 1>&6 -echo "configure:1385: checking for mode_t" >&5 +echo "configure:1403: 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 @@ -1414,12 +1432,12 @@ fi echo $ac_n "checking for size_t""... $ac_c" 1>&6 -echo "configure:1418: checking for size_t" >&5 +echo "configure:1436: 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 @@ -1447,12 +1465,12 @@ fi echo $ac_n "checking return type of signal handlers""... $ac_c" 1>&6 -echo "configure:1451: checking return type of signal handlers" >&5 +echo "configure:1469: checking return type of signal handlers" >&5 if eval "test \"`echo '$''{'ac_cv_type_signal'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -1469,7 +1487,7 @@ int i; ; return 0; } EOF -if { (eval echo configure:1473: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1491: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_type_signal=void else @@ -1488,12 +1506,12 @@ echo $ac_n "checking for socklen_t in sys/socket.h""... $ac_c" 1>&6 -echo "configure:1492: checking for socklen_t in sys/socket.h" >&5 +echo "configure:1510: checking for socklen_t in sys/socket.h" >&5 if eval "test \"`echo '$''{'ac_cv_type_socklen_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF @@ -1512,9 +1530,9 @@ echo "$ac_t""$ac_cv_type_socklen_t" 1>&6 if test $ac_cv_type_socklen_t = no; then echo $ac_n "checking for AIX""... $ac_c" 1>&6 -echo "configure:1516: checking for AIX" >&5 +echo "configure:1534: checking for AIX" >&5 cat > conftest.$ac_ext <&6 -echo "configure:1551: checking for off_t" >&5 +echo "configure:1569: 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 @@ -1581,12 +1599,12 @@ echo $ac_n "checking for ssize_t""... $ac_c" 1>&6 -echo "configure:1585: checking for ssize_t" >&5 +echo "configure:1603: checking for ssize_t" >&5 if eval "test \"`echo '$''{'ac_cv_type_ssize_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #if STDC_HEADERS @@ -1614,12 +1632,12 @@ fi echo $ac_n "checking for uint32_t""... $ac_c" 1>&6 -echo "configure:1618: checking for uint32_t" >&5 +echo "configure:1636: checking for uint32_t" >&5 if eval "test \"`echo '$''{'ac_cv_type_uint32_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #if STDC_HEADERS @@ -1647,12 +1665,12 @@ fi echo $ac_n "checking for uint16_t""... $ac_c" 1>&6 -echo "configure:1651: checking for uint16_t" >&5 +echo "configure:1669: checking for uint16_t" >&5 if eval "test \"`echo '$''{'ac_cv_type_uint16_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #if STDC_HEADERS @@ -1680,12 +1698,12 @@ fi echo $ac_n "checking for uint8_t""... $ac_c" 1>&6 -echo "configure:1684: checking for uint8_t" >&5 +echo "configure:1702: checking for uint8_t" >&5 if eval "test \"`echo '$''{'ac_cv_type_uint8_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #if STDC_HEADERS @@ -1715,17 +1733,17 @@ ac_safe=`echo "nlist.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for nlist.h""... $ac_c" 1>&6 -echo "configure:1719: checking for nlist.h" >&5 +echo "configure:1737: checking for nlist.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1729: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1747: \"$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* @@ -1746,19 +1764,19 @@ EOF echo $ac_n "checking for n_un in struct nlist""... $ac_c" 1>&6 -echo "configure:1750: checking for n_un in struct nlist" >&5 +echo "configure:1768: checking for n_un in struct nlist" >&5 if eval "test \"`echo '$''{'ac_cv_struct_nlist_n_un'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < int main() { struct nlist n; n.n_un.n_name = 0; ; return 0; } EOF -if { (eval echo configure:1762: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1780: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_struct_nlist_n_un=yes else @@ -1787,12 +1805,12 @@ for ac_func in snprintf vsnprintf do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:1791: checking for $ac_func" >&5 +echo "configure:1809: 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:1837: \"$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 @@ -1841,13 +1859,13 @@ echo $ac_n "checking for sprintf() returning 'char *'""... $ac_c" 1>&6 -echo "configure:1845: checking for sprintf() returning 'char *'" >&5 +echo "configure:1863: checking for sprintf() returning 'char *'" >&5 if eval "test \"`echo '$''{'ac_cv_sprintf_retval_pointer'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < @@ -1859,7 +1877,7 @@ ; return 0; } EOF -if { (eval echo configure:1863: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1881: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_sprintf_retval_pointer=yes else @@ -1883,12 +1901,12 @@ for ac_func in memcpy uname do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:1887: checking for $ac_func" >&5 +echo "configure:1905: 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:1933: \"$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 @@ -1938,12 +1956,12 @@ for ac_func in random srandom do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:1942: checking for $ac_func" >&5 +echo "configure:1960: 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:1988: \"$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 @@ -1993,12 +2011,12 @@ for ac_func in setsid ftruncate do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:1997: checking for $ac_func" >&5 +echo "configure:2015: 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:2043: \"$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 @@ -2049,12 +2067,12 @@ for ac_func in socket do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:2053: checking for $ac_func" >&5 +echo "configure:2071: 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:2099: \"$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 @@ -2103,7 +2121,7 @@ if test "$ac_cv_func_socket" = "no"; then echo $ac_n "checking for socket in -lsocket""... $ac_c" 1>&6 -echo "configure:2107: checking for socket in -lsocket" >&5 +echo "configure:2125: 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 @@ -2111,7 +2129,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:2144: \"$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 @@ -2158,12 +2176,12 @@ for ac_func in gethostbyname do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:2162: checking for $ac_func" >&5 +echo "configure:2180: 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:2208: \"$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 @@ -2212,7 +2230,7 @@ if test "$ac_cv_func_gethostbyname" = "no"; then echo $ac_n "checking for gethostbyname in -lnsl""... $ac_c" 1>&6 -echo "configure:2216: checking for gethostbyname in -lnsl" >&5 +echo "configure:2234: 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 @@ -2220,7 +2238,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:2253: \"$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 @@ -2273,12 +2291,12 @@ for ac_func in nlist do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:2277: checking for $ac_func" >&5 +echo "configure:2295: 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:2323: \"$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 @@ -2327,7 +2345,7 @@ if test "$ac_cv_func_nlist" = "no"; then echo $ac_n "checking for nlist in -lelf""... $ac_c" 1>&6 -echo "configure:2331: checking for nlist in -lelf" >&5 +echo "configure:2349: checking for nlist in -lelf" >&5 ac_lib_var=`echo elf'_'nlist | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -2335,7 +2353,7 @@ ac_save_LIBS="$LIBS" LIBS="-lelf $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2368: \"$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 @@ -2380,7 +2398,7 @@ else echo $ac_n "checking for nlist in -lmld""... $ac_c" 1>&6 -echo "configure:2384: checking for nlist in -lmld" >&5 +echo "configure:2402: checking for nlist in -lmld" >&5 ac_lib_var=`echo mld'_'nlist | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -2388,7 +2406,7 @@ ac_save_LIBS="$LIBS" LIBS="-lmld $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2421: \"$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 @@ -2438,12 +2456,12 @@ for ac_func in kvm_open do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:2442: checking for $ac_func" >&5 +echo "configure:2460: 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:2488: \"$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 @@ -2492,7 +2510,7 @@ if test "$ac_cv_func_kvm_open" = "no"; then echo $ac_n "checking for kvm_open in -lkvm""... $ac_c" 1>&6 -echo "configure:2496: checking for kvm_open in -lkvm" >&5 +echo "configure:2514: checking for kvm_open in -lkvm" >&5 ac_lib_var=`echo kvm'_'kvm_open | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -2500,7 +2518,7 @@ ac_save_LIBS="$LIBS" LIBS="-lkvm $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2533: \"$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 @@ -2555,17 +2573,17 @@ do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:2559: checking for $ac_hdr" >&5 +echo "configure:2577: 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:2569: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:2587: \"$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* @@ -2595,17 +2613,17 @@ do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:2599: checking for $ac_hdr" >&5 +echo "configure:2617: 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:2609: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:2627: \"$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* @@ -2635,17 +2653,17 @@ do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:2639: checking for $ac_hdr" >&5 +echo "configure:2657: 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:2649: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:2667: \"$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* @@ -2675,17 +2693,17 @@ do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:2679: checking for $ac_hdr" >&5 +echo "configure:2697: 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:2689: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:2707: \"$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* @@ -2712,7 +2730,7 @@ done echo $ac_n "checking for RAND_bytes in -lcrypto""... $ac_c" 1>&6 -echo "configure:2716: checking for RAND_bytes in -lcrypto" >&5 +echo "configure:2734: checking for RAND_bytes in -lcrypto" >&5 ac_lib_var=`echo crypto'_'RAND_bytes | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -2720,7 +2738,7 @@ 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:2753: \"$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 @@ -2771,7 +2789,7 @@ CRYPTO_OBJS="pdes.o" else echo $ac_n "checking for des_set_key in -ldes""... $ac_c" 1>&6 -echo "configure:2775: checking for des_set_key in -ldes" >&5 +echo "configure:2793: checking for des_set_key in -ldes" >&5 ac_lib_var=`echo des'_'des_set_key | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -2779,7 +2797,7 @@ ac_save_LIBS="$LIBS" LIBS="-ldes $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2812: \"$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 @@ -2819,7 +2837,7 @@ if test "$ac_cv_lib_des_des_set_key" = "yes"; then echo $ac_n "checking for /dev/random""... $ac_c" 1>&6 -echo "configure:2823: checking for /dev/random" >&5 +echo "configure:2841: checking for /dev/random" >&5 if test -r /dev/random; then cat >> confdefs.h <<\EOF #define HAVE_DEV_RANDOM 1 @@ -2841,17 +2859,17 @@ do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:2845: checking for $ac_hdr" >&5 +echo "configure:2863: 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:2855: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:2873: \"$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* @@ -2881,7 +2899,7 @@ if test "$with_threads" = "yes" || test "$with_threads" = "posix"; then echo $ac_n "checking for pthread_attr_init in -lpthread""... $ac_c" 1>&6 -echo "configure:2885: checking for pthread_attr_init in -lpthread" >&5 +echo "configure:2903: checking for pthread_attr_init in -lpthread" >&5 ac_lib_var=`echo pthread'_'pthread_attr_init | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -2889,7 +2907,7 @@ ac_save_LIBS="$LIBS" LIBS="-lpthread $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2922: \"$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 @@ -2934,7 +2952,7 @@ if test "$with_threads" = "yes" || test "$with_threads" = "posix"; then echo $ac_n "checking for pthread_attr_init in -lpthreads""... $ac_c" 1>&6 -echo "configure:2938: checking for pthread_attr_init in -lpthreads" >&5 +echo "configure:2956: checking for pthread_attr_init in -lpthreads" >&5 ac_lib_var=`echo pthreads'_'pthread_attr_init | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -2942,7 +2960,7 @@ ac_save_LIBS="$LIBS" LIBS="-lpthreads $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2975: \"$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 @@ -2989,7 +3007,7 @@ if test "$with_threads" = "yes" || test "$with_threads" = "ui"; then echo $ac_n "checking for thr_create in -lthread""... $ac_c" 1>&6 -echo "configure:2993: checking for thr_create in -lthread" >&5 +echo "configure:3011: checking for thr_create in -lthread" >&5 ac_lib_var=`echo thread'_'thr_create | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -2997,7 +3015,7 @@ ac_save_LIBS="$LIBS" LIBS="-lthread $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3030: \"$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 @@ -3044,7 +3062,7 @@ if test "$with_threads" = "yes" || test "$with_threads" = "dce"; then echo $ac_n "checking for pthread_attr_create in -lcma""... $ac_c" 1>&6 -echo "configure:3048: checking for pthread_attr_create in -lcma" >&5 +echo "configure:3066: checking for pthread_attr_create in -lcma" >&5 ac_lib_var=`echo cma'_'pthread_attr_create | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -3052,7 +3070,7 @@ ac_save_LIBS="$LIBS" LIBS="-lcma $OS_LIBS $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3085: \"$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 @@ -3143,12 +3161,12 @@ for ac_func in getpwnam_r getpwuid_r do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:3147: checking for $ac_func" >&5 +echo "configure:3165: 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:3193: \"$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 @@ -3199,12 +3217,12 @@ for ac_func in thr_setconcurrency do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:3203: checking for $ac_func" >&5 +echo "configure:3221: 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:3249: \"$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 @@ -3258,7 +3276,7 @@ if test "$ac_cv_func_getpwuid_r" != "yes"; then echo $ac_n "checking for getpwuid in -lsun""... $ac_c" 1>&6 -echo "configure:3262: checking for getpwuid in -lsun" >&5 +echo "configure:3280: checking for getpwuid in -lsun" >&5 ac_lib_var=`echo sun'_'getpwuid | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -3266,7 +3284,7 @@ ac_save_LIBS="$LIBS" LIBS="-lsun $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3299: \"$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 @@ -3309,9 +3327,9 @@ echo $ac_n "checking for Posix-style getpw..._r""... $ac_c" 1>&6 -echo "configure:3313: checking for Posix-style getpw..._r" >&5 +echo "configure:3331: checking for Posix-style getpw..._r" >&5 cat > conftest.$ac_ext < @@ -3326,7 +3344,7 @@ ; return 0; } EOF -if { (eval echo configure:3330: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3348: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* echo "$ac_t""yes" 1>&6 @@ -3344,9 +3362,9 @@ echo $ac_n "checking for UI-style getpw..._r""... $ac_c" 1>&6 -echo "configure:3348: checking for UI-style getpw..._r" >&5 +echo "configure:3366: checking for UI-style getpw..._r" >&5 cat > conftest.$ac_ext < @@ -3360,7 +3378,7 @@ ; return 0; } EOF -if { (eval echo configure:3364: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3382: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* echo "$ac_t""yes" 1>&6 @@ -3378,9 +3396,9 @@ echo $ac_n "checking for DCE-style getpw..._r""... $ac_c" 1>&6 -echo "configure:3382: checking for DCE-style getpw..._r" >&5 +echo "configure:3400: checking for DCE-style getpw..._r" >&5 cat > conftest.$ac_ext < @@ -3395,7 +3413,7 @@ ; return 0; } EOF -if { (eval echo configure:3399: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3417: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* echo "$ac_t""yes" 1>&6 Index: src/conf.c diff -u -p src/conf.c.orig src/conf.c --- src/conf.c.orig Thu Jan 21 09:00:33 1999 +++ src/conf.c Fri Feb 27 17:01:17 2004 @@ -115,15 +115,13 @@ conf_parse(const char *path, path, line, arg); } -#if 0 /* Enable when we have a str2addr() */ else if (strcasecmp(cp, "server:address") == 0) { - if (str2addr(arg, &listen_address) < 0) + if (str2addr(arg, &listen_addr) < 0) syslog(LOG_ERR, "%s: %d: invalid address: %s", path, line, arg); } -#endif - + else if (strcasecmp(cp, "server:user") == 0) { if (str2uid(arg, &server_uid, &server_gid) < 0) Index: src/idecrypt.c diff -u -p src/idecrypt.c.orig src/idecrypt.c --- src/idecrypt.c.orig Tue Apr 24 05:40:15 2001 +++ src/idecrypt.c Wed Feb 25 18:34:57 2004 @@ -90,14 +90,14 @@ to_bin[] = static char * -decrypt_packet(unsigned char *packet) +decrypt_packet(unsigned char *packet, int len) { union data r; - int i, j; + int i, j, count; time_t date_in_sec; char *date_in_ascii; char keybuf[1024+1]; - char buf1[32], buf2[32]; + char buf1[40], buf2[40]; struct sockaddr_gen ip_local, ip_remote; int keyfile_fd; des_cblock key_bin; @@ -120,32 +120,29 @@ decrypt_packet(unsigned char *packet) keybuf[sizeof(keybuf)-1] = '\0'; des_string_to_key(keybuf, &key_bin); des_set_key(&key_bin, sched); - - - for (i = 0, j = 0; i < 24; i += 3, j += 4) + + count = (len == 32) ? 24 : 48; + for (i = 0, j = 0; i < count; i += 3, j += 4) { r.chars[i ] = (to_bin[packet[j ]] << 2) + (to_bin[packet[j+1]] >> 4); r.chars[i+1] = (to_bin[packet[j+1]] << 4) + (to_bin[packet[j+2]] >> 2); r.chars[i+2] = (to_bin[packet[j+2]] << 6) + (to_bin[packet[j+3]]); } - - des_ecb_encrypt((des_cblock *)&(r.longs[4]), - (des_cblock *)&(r.longs[4]), - sched, DES_DECRYPT); - r.longs[4] ^= r.longs[2]; - r.longs[5] ^= r.longs[3]; - - des_ecb_encrypt((des_cblock *)&(r.longs[2]), - (des_cblock *)&(r.longs[2]), - sched, DES_DECRYPT); - - r.longs[2] ^= r.longs[0]; - r.longs[3] ^= r.longs[1]; + + count = (len == 32) ? 2 : 8; + for (i = count; i >= 0; i -= 2) { + des_ecb_encrypt((des_cblock *)&(r.longs[i+2]), + (des_cblock *)&(r.longs[i+2]), + sched, DES_DECRYPT); + r.longs[i+2] ^= r.longs[i ]; + r.longs[i+3] ^= r.longs[i+1]; + } des_ecb_encrypt((des_cblock *)&(r.longs[0]), (des_cblock *)&(r.longs[0]), sched, DES_DECRYPT); - for (i = 1; i < 6; i++) + count = (len == 32) ? 6 : 12; + for (i = 1; i < count; i++) { r.longs[0] ^= r.longs[i]; } @@ -159,9 +156,37 @@ decrypt_packet(unsigned char *packet) GoodKey: date_in_sec = ntohl(r.fields.date); date_in_ascii = ctime(&date_in_sec); - + +#ifdef HAVE_IPV6 + if (len ==32) { + ip_local.sg_family = ip_remote.sg_family = AF_INET; +#ifdef SIN6_LEN + ip_local.sg_sa.sa_len = sizeof(struct sockaddr_in); + ip_remote.sg_sa.sa_len = sizeof(struct sockaddr_in); +#endif + ip_local.sg_sin.sin_addr.s_addr = r.fields.ip_local; + ip_remote.sg_sin.sin_addr.s_addr = r.fields.ip_remote; + ip_local.sg_sin.sin_port = r.fields.port_local; + ip_remote.sg_sin.sin_port = r.fields.port_remote; + } else { + ip_local.sg_family = ip_remote.sg_family = AF_INET6; +#ifdef SIN6_LEN + ip_local.sg_sa.sa_len = sizeof(struct sockaddr_in6); + ip_remote.sg_sa.sa_len = sizeof(struct sockaddr_in6); +#endif + memcpy(&ip_local.sg_sin6.sin6_addr, &r.fields6.ip_local, + sizeof(struct in6_addr)); + memcpy(&ip_remote.sg_sin6.sin6_addr, &r.fields6.ip_remote, + sizeof(struct in6_addr)); + ip_local.sg_sin6.sin6_port = r.fields6.port_local; + ip_remote.sg_sin6.sin6_port = r.fields6.port_remote; + } +#else memcpy(SGADDRP(ip_local), &(r.fields.ip_local), sizeof(ip_local)); memcpy(SGADDRP(ip_remote), &(r.fields.ip_remote), sizeof(ip_remote)); + SGPORT(ip_local) = r.fields.port_local; + SGPORT(ip_remote) = r.fields.port_remote; +#endif /* FIXME: uid_t isn't necessarily short. */ #ifdef HAVE_SNPRINTF @@ -173,10 +198,10 @@ decrypt_packet(unsigned char *packet) date_in_ascii, ntohs(r.fields.uid), s_inet_ntox(&ip_local, buf1, sizeof(buf1)), - (unsigned) ntohs(r.fields.port_local), + (unsigned) ntohs(SGPORT(ip_local)), s_inet_ntox(&ip_remote, buf2, sizeof(buf2)), - (unsigned) ntohs(r.fields.port_remote)); - + (unsigned) ntohs(SGPORT(ip_remote))); + close(keyfile_fd); return readable; } @@ -187,7 +212,7 @@ decrypt_file(FILE *f) { int c; int i; - char buf[32]; + char buf[64]; char *result; @@ -204,32 +229,38 @@ decrypt_file(FILE *f) putchar(c); continue; } - - for (i = 0; i < 32; i++) + + for (i = 0; i < 64; i++) { c = getc(f); if (c == EOF || c < 0 || c > 255) break; +#ifdef HAVE_IPV6 + if (i == 32 && c == ']') /* `]' is not base64 char */ + break; +#else + if (i == 32) + break; +#endif if (!is_base_64[c]) break; buf[i] = c; } - - if (i == 32) + + if (i == 64) c = getc(f); - - if (i < 32 || c != ']') + + if ((i != 32 && i != 64) || c != ']') { putchar('['); fwrite(buf, 1, i, stdout); goto Same; } - - - if ((result = decrypt_packet((unsigned char *) buf)) == NULL) + + if ((result = decrypt_packet((unsigned char *) buf, i)) == NULL) { putchar('['); - fwrite(buf, 1, 32, stdout); + fwrite(buf, 1, i, stdout); putchar(']'); } else Index: src/k_freebsd2.c diff -u -p /dev/null src/k_freebsd2.c --- /dev/null Fri Feb 27 23:11:03 2004 +++ src/k_freebsd2.c Fri Feb 27 18:54:43 2004 @@ -0,0 +1,287 @@ +/* +** freebsd2.c - FreeBSD kernel access functions. +** +** Copyright (c) 1997 Peter Eriksson +** Copyright (c) 2000-2004 Hajimu UMEMOTO +** +** This program is free software; you can redistribute it and/or +** modify it as you wish - as long as you don't claim that you wrote +** it. +** +** This program is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +*/ + +#include "config.h" + +#include +#include +#include +#include +#include +#define _KERNEL +#include +#undef _KERNEL +#include +#include +#include +#include +#include +#include +#include + +#include "pidentd.h" + +struct kainfo { + kvm_t *kd; + int nfile; + struct nlist nl[3]; +}; + +static int getbuf(struct kainfo *, u_long, char *, u_int, char *); +static struct socket *getlist(struct kainfo *, struct inpcbhead *, + struct sockaddr_gen *, struct sockaddr_gen *); + +int +ka_init(void) +{ + return 0; +} + +int +ka_open(void **misc) +{ + struct kainfo *kp = s_malloc(sizeof(struct kainfo)); + + /* + ** Open the kernel memory device + */ + kp->kd = (kvm_t *)kvm_openfiles(NULL, NULL, NULL, O_RDONLY, NULL); + if (kp->kd == NULL) + { + syslog(LOG_ERR, "kvm_open: %m"); + s_free(kp); + return -1; + } + +#define N_TCB 0 +#define N_BTEXT 1 + kp->nl[N_TCB].n_name = "_tcb"; + kp->nl[N_BTEXT].n_name = "_btext"; + kp->nl[2].n_name = ""; + /* + ** Extract offsets to the needed variables in the kernel + */ + if (kvm_nlist(kp->kd, kp->nl) < 0) + { + syslog(LOG_ERR, "kvm_nlist: %m"); + kvm_close(kp->kd); + s_free(kp); + return -1; + } + + *misc = (void *)kp; + return 0; +} + +/* +** Get a piece of kernel memory with error handling. +** Returns 1 if call succeeded, else 0 (zero). +*/ +static int +getbuf(struct kainfo *kp, unsigned long addr, char *buf, unsigned int len, + char *what) +{ + if (addr < kp->nl[N_BTEXT].n_value || /* Overkill.. */ + addr >= (unsigned long)0xFFC00000 || + (addr + len) < kp->nl[N_BTEXT].n_value || + (addr + len) >= (unsigned long)0xffc00000) + { + syslog(LOG_ERR, + "getbuf: bad address (%08x not in %08x-0xFFC00000) - %s", + addr, kp->nl[N_BTEXT].n_value, what); + return 0; + } + + if (kvm_read(kp->kd, addr, buf, len) < 0) + { + syslog(LOG_ERR, "getbuf: kvm_read(%08x, %d) - %s : %m", + addr, len, what); + return 0; + } + + return 1; +} + +/* +** Traverse the inpcb list until a match is found. +** Returns NULL if no match. +*/ +static struct socket * +getlist(struct kainfo *kp, struct inpcbhead *pcbhead, + struct sockaddr_gen *remote, struct sockaddr_gen *local) +{ + struct inpcb *head, pcbp; + struct sockaddr_gen fsg, lsg; + int fam, fport, lport, alen; + char *faddr, *laddr, *paddr; + +#ifdef HAVE_IPV6 + if (SGFAM(*remote) == AF_INET6 && + IN6_IS_ADDR_V4MAPPED(&remote->sg_sin6.sin6_addr)) + { + memset(&fsg, 0, sizeof(fsg)); + fsg.sg_family = AF_INET; + fsg.sg_sin.sin_port = remote->sg_sin6.sin6_port; + memcpy(&fsg.sg_sin.sin_addr, &remote->sg_sin6.sin6_addr.s6_addr[12], + sizeof(fsg.sg_sin.sin_addr)); + remote = &fsg; + } + if (SGFAM(*local) == AF_INET6 && + IN6_IS_ADDR_V4MAPPED(&local->sg_sin6.sin6_addr)) + { + memset(&lsg, 0, sizeof(fsg)); + lsg.sg_family = AF_INET; + lsg.sg_sin.sin_port = local->sg_sin6.sin6_port; + memcpy(&lsg.sg_sin.sin_addr, &local->sg_sin6.sin6_addr.s6_addr[12], + sizeof(lsg.sg_sin.sin_addr)); + local = &lsg; + } + if ((fam = SGFAM(*remote)) != SGFAM(*local)) + return NULL; +#endif + faddr = (char *)SGADDRP(*remote); + laddr = (char *)SGADDRP(*local); + fport = SGPORT(*remote); + lport = SGPORT(*local); + + for (head = pcbhead->lh_first; head != NULL; + head = pcbp.inp_list.le_next) + { + if (!getbuf(kp, (u_long)head, (char *)&pcbp, sizeof(struct inpcb), + "tcblist")) + break; +#ifdef HAVE_IPV6 + if (pcbp.inp_vflag & INP_IPV4) + { + if (fam != AF_INET) + continue; + paddr = (char *)&pcbp.inp_faddr; + alen = sizeof(struct in_addr); + } + else if (pcbp.inp_vflag & INP_IPV6) + { + if (fam != AF_INET6) + continue; + paddr = (char *)&pcbp.in6p_faddr; + alen = sizeof(struct in6_addr); + } + else + continue; +#else + paddr = (char *)&pcbp.inp_faddr; + alen = sizeof(struct in_addr); +#endif + if (memcmp(paddr, faddr, alen) == 0 && pcbp.inp_fport == fport && + pcbp.inp_lport == lport) + return pcbp.inp_socket; + } + + return NULL; +} + +#if __FreeBSD_version < 500000 +#define ki_fd kp_proc.p_fd +#define ki_ruid kp_eproc.e_pcred.p_ruid +#define ki_uid kp_eproc.e_ucred.cr_uid +#endif + +/* +** Return the user number for the connection owner +*/ +int +ka_lookup(void *vp, struct kernel *kp) +{ + struct inpcbhead tcb; + struct socket *sockp; + struct kinfo_proc *kgp; + int i, nentries; + struct kainfo *kip = vp; + + kgp = kvm_getprocs(kip->kd, KERN_PROC_ALL, 0, &nentries); + if (kgp == NULL) + { + syslog(LOG_ERR, "kvm_getprocs: %m"); + return -1; + } + + /* -------------------- TCP PCB LIST -------------------- */ + if (!getbuf(kip, kip->nl[N_TCB].n_value, (char*)&tcb, sizeof(tcb), "tcb")) + return -1; + + if ((sockp = getlist(kip, &tcb, &kp->remote, &kp->local)) == NULL) + return 0; + + /* + ** Locate the file descriptor that has the socket in question + ** open so that we can get the 'ucred' information + */ + for (i = 0; i < nentries; i++) + { + if (kgp[i].ki_fd != NULL) + { + struct filedesc pfd; + struct file **ofiles, ofile; + int j; + + if (!getbuf(kip, (u_long)kgp[i].ki_fd, (char *)&pfd, sizeof(pfd), + "pfd")) + return -1; + + ofiles = (struct file **)s_malloc(pfd.fd_nfiles * + sizeof(struct file *)); + if (!ofiles) + { + syslog(LOG_ERR, "s_malloc failed"); + return -1; + } + + if (!getbuf(kip, (u_long)pfd.fd_ofiles, (char *)ofiles, + pfd.fd_nfiles * sizeof(struct file *), "ofiles")) + { + s_free(ofiles); + return -1; + } + + for (j = 0; j < pfd.fd_nfiles; j++) + { + if (!ofiles[j]) /* might be sparse */ + continue; + + if (!getbuf(kip, (u_long)ofiles[j], (char *)&ofile, + sizeof(struct file), "ofile")) + { + s_free(ofiles); + return -1; + } + + if (ofile.f_count == 0) + continue; + + if (ofile.f_type == DTYPE_SOCKET && + (struct socket *)ofile.f_data == sockp) + { + kp->ruid = kgp[i].ki_ruid; + kp->euid = kgp[i].ki_uid; + s_free(ofiles); + return 1; + } + } + + s_free(ofiles); + } + } + + return -1; +} Index: src/kernel.c diff -u -p src/kernel.c.orig src/kernel.c --- src/kernel.c.orig Thu May 11 05:25:10 2000 +++ src/kernel.c Wed Feb 25 23:41:14 2004 @@ -77,7 +77,7 @@ kernel_thread(void *vp) { struct kernel *kp; int attempt; - char buf1[32]; + char buf1[40]; if (debug) Index: src/main.c diff -u -p src/main.c.orig src/main.c --- src/main.c.orig Fri Aug 31 17:20:34 2001 +++ src/main.c Fri Feb 27 17:06:35 2004 @@ -130,6 +130,8 @@ main(int argc, char *argv[]) int log_header = 0; + SGINIT(listen_addr); + if (argv[0] != NULL) { char *cp; @@ -163,7 +165,7 @@ main(int argc, char *argv[]) conf_parse(PATH_CFGFILE, 1); - while ((c = getopt(argc, argv, "lNVEdhbwiIemnop:u:g:t:C:P:K:L:")) != -1) + while ((c = getopt(argc, argv, "lNVEdhbwiIemnop:a:u:g:t:C:P:K:L:")) != -1) switch (c) { #ifdef HAVE_LIBDES @@ -228,6 +230,13 @@ main(int argc, char *argv[]) } break; + case 'a': + if (str2addr(optarg, &listen_addr) < 0) + return EXIT_FAILURE; + if (SGPORT(listen_addr) != 0) + listen_port = ntohs(SGPORT(listen_addr)); + break; + case 't': if (str2int(optarg, &request_timeout) < 0) { @@ -321,6 +330,9 @@ main(int argc, char *argv[]) return EXIT_FAILURE; } + + if (SGFAM(listen_addr) != AF_UNSPEC) + SGPORT(listen_addr) = htons(listen_port); if (debug) program_header(stderr); Index: src/pdes.c diff -u -p src/pdes.c.orig src/pdes.c --- src/pdes.c.orig Mon May 22 04:07:05 2000 +++ src/pdes.c Wed Feb 25 18:29:31 2004 @@ -109,13 +109,14 @@ pdes_init(char *keyfile) int -pdes_encrypt(struct kernel *kp, - char result[33]) +pdes_encrypt(struct kernel *kp, char result[PDES_BUFSIZ]) { union data r; int i, j; time_t bt; - + int family = AF_INET; + int count; + r.fields.random = s_random(); /* FIXME: uid_t isn't necessarily short. */ @@ -126,39 +127,62 @@ pdes_encrypt(struct kernel *kp, time(&bt); r.fields.date = htonl(bt); - + +#ifdef HAVE_IPV6 + if (SGFAM(kp->remote) == AF_INET) { + r.fields.ip_local = kp->local.sg_sin.sin_addr.s_addr; + r.fields.ip_remote = kp->remote.sg_sin.sin_addr.s_addr; + r.fields.port_local = kp->local.sg_sin.sin_port; + r.fields.port_remote = kp->remote.sg_sin.sin_port; + } else if (IN6_IS_ADDR_V4MAPPED(&kp->remote.sg_sin6.sin6_addr)) { + memcpy(&r.fields.ip_local, &kp->local.sg_sin6.sin6_addr.s6_addr[12], + sizeof(r.fields.ip_local)); + memcpy(&r.fields.ip_remote, &kp->remote.sg_sin6.sin6_addr.s6_addr[12], + sizeof(r.fields.ip_remote)); + r.fields.port_local = kp->local.sg_sin6.sin6_port; + r.fields.port_remote = kp->remote.sg_sin6.sin6_port; + } else { + family = AF_INET6; + memcpy(r.fields6.ip_local, &kp->local.sg_sin6.sin6_addr, + sizeof(r.fields6.ip_local)); + memcpy(r.fields6.ip_remote, &kp->remote.sg_sin6.sin6_addr, + sizeof(r.fields6.ip_remote)); + r.fields6.port_local = kp->local.sg_sin6.sin6_port; + r.fields6.port_remote = kp->remote.sg_sin6.sin6_port; + } +#else r.fields.ip_local = kp->local.sin_addr.s_addr; r.fields.ip_remote = kp->remote.sin_addr.s_addr; r.fields.port_local = kp->local.sin_port; r.fields.port_remote = kp->remote.sin_port; +#endif r.fields.checksum = 0; - for (i = 1; i < 6; i++) + count = (family == AF_INET) ? 6 : 12; + for (i = 1; i < count; i++) r.longs[0] ^= r.longs[i]; des_ecb_encrypt((des_cblock *)&(r.longs[0]), (des_cblock *)&(r.longs[0]), sched, DES_ENCRYPT); - - r.longs[2] ^= r.longs[0]; - r.longs[3] ^= r.longs[1]; - - des_ecb_encrypt((des_cblock *)&(r.longs[2]), (des_cblock *)&(r.longs[2]), - sched, DES_ENCRYPT); - - r.longs[4] ^= r.longs[2]; - r.longs[5] ^= r.longs[3]; - - des_ecb_encrypt((des_cblock *)&(r.longs[4]), (des_cblock *)&(r.longs[4]), - sched, DES_ENCRYPT); - for (i = 0, j = 0; i < 24; i+=3, j+=4) + count = (family == AF_INET) ? 4 : 10; + for (i = 0; i < count; i += 2) { + r.longs[i+2] ^= r.longs[i ]; + r.longs[i+3] ^= r.longs[i+1]; + + des_ecb_encrypt((des_cblock *)&(r.longs[i+2]), + (des_cblock *)&(r.longs[i+2]), sched, DES_ENCRYPT); + } + + count = (family == AF_INET) ? 24 : 48; + for (i = 0, j = 0; i < count; i+=3, j+=4) { result[j ] = to_asc[63 & (r.chars[i ] >> 2)]; result[j+1] = to_asc[63 & ((r.chars[i ] << 4) + (r.chars[i+1] >> 4))]; result[j+2] = to_asc[63 & ((r.chars[i+1] << 2) + (r.chars[i+2] >> 6))]; result[j+3] = to_asc[63 & (r.chars[i+2])]; } - result[32] = '\0'; + result[(family == AF_INET) ? 32 : 64] = '\0'; return 0; } Index: src/pdes.h diff -u src/pdes.h.orig src/pdes.h --- src/pdes.h.orig Thu Jan 21 08:59:26 1999 +++ src/pdes.h Tue Feb 24 21:26:21 2004 @@ -28,17 +28,44 @@ uint16_t port_remote; }; +#ifdef HAVE_IPV6 +struct info6 +{ + uint32_t checksum; + uint16_t random; + /* FIXME: uid_t isn't necessarily short. */ + uint16_t uid; + uint32_t date; + uint32_t ip_local[4]; + uint32_t ip_remote[4]; + uint16_t port_local; + uint16_t port_remote; +}; +#endif + typedef union data { struct info fields; +#ifdef HAVE_IPV6 + struct info6 fields6; + uint32_t longs[12]; + unsigned char chars[48]; +#else uint32_t longs[6]; unsigned char chars[24]; +#endif } data; +#ifdef HAVE_IPV6 +#define PDES_BUFSIZ 65 +#else +#define PDES_BUFSIZ 33 +#endif + struct kernel; extern int pdes_init(char *keyfile); -extern int pdes_encrypt(struct kernel *kp, char buffer[33]); +extern int pdes_encrypt(struct kernel *kp, char buffer[PDES_BUFSIZ]); extern int pdes_decrypt(void); #endif Index: src/send.c diff -u -p src/send.c.orig src/send.c --- src/send.c.orig Mon Nov 25 16:46:11 2002 +++ src/send.c Wed Feb 25 23:42:44 2004 @@ -67,7 +67,7 @@ send_error(int fd, struct sockaddr_gen *remote_addr) { char buf[1024]; - char buf2[32]; + char buf2[40]; s_snprintf(buf, sizeof(buf), @@ -86,7 +86,7 @@ void send_result(int fd, struct kernel *kp) { - char buf[2048], pbuf[2048], buf2[32]; + char buf[2048], pbuf[2048], buf2[40]; struct passwd pwb, *pp = NULL; uid_t uid; @@ -118,7 +118,7 @@ send_result(int fd, #ifdef HAVE_LIBDES if (encrypt_flag) { - char buffer[33]; + char buffer[PDES_BUFSIZ]; pdes_encrypt(kp, buffer); s_snprintf(buf, sizeof(buf), @@ -167,7 +167,7 @@ void send_version(int fd, struct sockaddr_gen *remote_addr) { - char buf[1024], buf2[32]; + char buf[1024], buf2[40]; s_snprintf(buf, sizeof(buf), "0 , 0 : X-VERSION : pidentd %s for %s (%s %s)\r\n", Index: src/server.c diff -u -p src/server.c.orig src/server.c --- src/server.c.orig Sat Mar 23 06:42:33 2002 +++ src/server.c Fri Feb 27 19:30:13 2004 @@ -25,11 +25,13 @@ -int listen_sock = -1; +int listen_sock; int listen_port = IPPORT_IDENT; -int listen_addr = INADDR_ANY; +struct sockaddr_gen listen_addr; int listen_backlog = 256; +static int listen_fd[2] = { -1, -1 }; +static int listen_nfds = 0; static int unlimit_nofile(void) @@ -58,14 +60,49 @@ unlimit_nofile(void) } +static int +server_socket(void) +{ + static int one = 1; + + + listen_fd[listen_nfds] = socket(SGFAM(listen_addr), SOCK_STREAM, 0); + if (listen_fd[listen_nfds] < 0) + { + syslog(LOG_DEBUG, "socket(AF_INET, SOCK_STREAM) failed: %m"); + return -1; + } + + (void) setsockopt(listen_fd[listen_nfds], SOL_SOCKET, SO_REUSEADDR, + (void *) &one, sizeof(one)); +#ifdef IPV6_V6ONLY + if (SGFAM(listen_addr) == AF_INET6) + (void) setsockopt(listen_fd[listen_nfds], IPPROTO_IPV6, IPV6_V6ONLY, + (void *) &one, sizeof(one)); +#endif + + if (bind(listen_fd[listen_nfds], (struct sockaddr *) &listen_addr, + SGSOCKSIZE(listen_addr)) < 0) + { + syslog(LOG_DEBUG, "bind(port=%d) failed: %m", + ntohs(SGPORT(listen_addr))); + s_close(listen_fd[listen_nfds]); + listen_fd[listen_nfds] = -1; + return -1; + } + + listen_nfds++; + + return 0; +} + + int server_init(void) { - static int one = 1; - int nofile; - struct sockaddr_in sin; - - + int nofile, i, err = 1; + + /* ** Increase the number of available file descriptors ** to the maximum possible. @@ -77,34 +114,49 @@ server_init(void) if (listen_sock < 0) { - listen_sock = socket(AF_INET, SOCK_STREAM, 0); - if (listen_sock < 0) + if (SGFAM(listen_addr) == AF_UNSPEC) { - syslog(LOG_ERR, "socket(AF_INET, SOCK_STREAM) failed: %m"); - return -1; +#ifdef HAVE_IPV6 + SGFAM(listen_addr) = AF_INET6; + SGPORT(listen_addr) = htons(listen_port); + SGSETLEN(listen_addr); + err = (server_socket() < 0); + SGINIT(listen_addr); +#endif + SGFAM(listen_addr) = AF_INET; + SGPORT(listen_addr) = htons(listen_port); + SGSETLEN(listen_addr); + err = (server_socket() < 0 && err); } - - (void) setsockopt(listen_sock, SOL_SOCKET, SO_REUSEADDR, - (void *) &one, sizeof(one)); - - memset(&sin, 0, sizeof(sin)); - sin.sin_family = AF_INET; - sin.sin_addr.s_addr = htonl(listen_addr); - sin.sin_port = htons(listen_port); - - if (bind(listen_sock, (struct sockaddr *) &sin, sizeof(sin)) < 0) - { - syslog(LOG_ERR, "bind(port=%d) failed: %m", - listen_port); + else + err = (server_socket() < 0); + if (err) { + syslog(LOG_ERR, "server_init: no socket is available"); return -1; } } + else + { + listen_fd[0] = listen_sock; + listen_nfds++; + } /* We do this outside of the 'if' statement to support some broken 'inetd' daemons... */ - if (listen(listen_sock, listen_backlog) < 0) + err = 1; + for (i = 0; i < listen_nfds; i++) { - syslog(LOG_ERR, "listen(backlog=%d) failed: %m", listen_backlog); + if (listen(listen_fd[i], listen_backlog) < 0) + { + syslog(LOG_DEBUG, "listen(backlog=%d) failed: %m", listen_backlog); + s_close(listen_fd[i]); + listen_fd[i] = -1; + } + else + err = 0; + } + if (err) { + syslog(LOG_ERR, "server_init: failed to listen socket"); return -1; } @@ -115,28 +167,54 @@ server_init(void) int server_run(void) { - int fd; - + fd_set readfds; + int fd, nfds, maxfd = -1, i; + + for (i = 0; i < listen_nfds; i++) + if (listen_fd[i] >= 0) + if (maxfd < listen_fd[i]) + maxfd = listen_fd[i]; + if (maxfd < 0) + return -1; + while (1) { - fd = s_accept(listen_sock, NULL, NULL); - if (fd < 0) - { - syslog(LOG_ERR, "accept() failed: %m"); - - switch (errno) - { - case EBADF: - case EMFILE: - case ENODEV: - case ENOMEM: - case ENOTSOCK: - case EOPNOTSUPP: - case EWOULDBLOCK: + FD_ZERO(&readfds); + for (i = 0; i < listen_nfds; i++) + if (listen_fd[i] >= 0) + FD_SET(listen_fd[i], &readfds); + if (maxfd < 0) + return -1; + nfds = select(maxfd + 1, &readfds, NULL, NULL, NULL); + if (listen_nfds <= 0) { + if (nfds < 0 && errno != EINTR) { + syslog(LOG_ERR, "select() failed: %m"); return -1; } + continue; } + for (i = 0; i < listen_nfds; i++) { + if (FD_ISSET(listen_fd[i], &readfds)) { + fd = s_accept(listen_fd[i], NULL, NULL); + if (fd < 0) + { + syslog(LOG_ERR, "accept() failed: %m"); + + switch (errno) + { + case EBADF: + case EMFILE: + case ENODEV: + case ENOMEM: + case ENOTSOCK: + case EOPNOTSUPP: + case EWOULDBLOCK: + return -1; + } + } - request_run(fd, 0); + request_run(fd, 0); + } + } } } Index: src/server.h diff -u src/server.h.orig src/server.h --- src/server.h.orig Thu Jan 21 08:59:27 1999 +++ src/server.h Fri Feb 27 16:28:10 2004 @@ -17,7 +17,7 @@ extern int listen_sock; extern int listen_port; -extern int listen_addr; +extern struct sockaddr_gen listen_addr; extern int listen_backlog; Index: src/sockaddr.h diff -u src/sockaddr.h.orig src/sockaddr.h --- src/sockaddr.h.orig Sat Jan 15 07:46:31 2000 +++ src/sockaddr.h Fri Feb 27 16:01:16 2004 @@ -48,6 +48,14 @@ #define SGADDRP(sag) ((SGFAM(sag) == AF_INET6 ? \ (char *) &(sag).sg_sin6.sin6_addr : \ (char *) &(sag).sg_sin.sin_addr)) + +#define SGINIT(sag) (memset(&(sag), 0, sizeof((sag))), \ + ((sag).sg_family = AF_UNSPEC)) +#ifdef SIN6_LEN +#define SGSETLEN(sag) ((sag).sg_sa.sa_len = SGSOCKSIZE(sag)) +#else +#define SGSETLEN(sag) +#endif #else /* !HAVE_IPV6 */ #define sockaddr_gen sockaddr_in @@ -56,6 +64,10 @@ #define SGSOCKSIZE(sag) sizeof(struct sockaddr_in) #define SGPORT(sag) ((sag).sin_port) #define SGADDRP(sag) ((char *) &(sag).sin_addr) + +#define SGINIT(sag) (memset(&(sag), 0, sizeof((sag))), \ + ((sag).sin_family = AF_INET)) +#define SGSETLEN(sag) #endif /* HAVE_IPV6 */ #endif Index: src/str2.c diff -u -p src/str2.c.orig src/str2.c --- src/str2.c.orig Thu Jan 21 08:59:26 1999 +++ src/str2.c Fri Feb 27 17:17:36 2004 @@ -155,6 +155,75 @@ str2port(const char *str, int *out) +/* XXX: Todo: Support hostnames and not just numbers */ +int +str2addr(const char *str, + struct sockaddr_gen *sg) +{ + char *buf, *cp, *pp = NULL; + + + SGINIT(*sg); + + buf = s_strdup(str); + cp = buf; + +#ifdef HAVE_IPV6 + if (*cp == '[') + { + /* IPv6 ala RFC 2732 */ + + ++cp; + pp = strchr(cp, ']'); + if (pp == NULL) + return -1; + + *pp++ = '\0'; + if (*pp == ':') + ++pp; + else + pp = NULL; + + SGFAM(*sg) = AF_INET6; + } + else + { + /* IPv4 */ + pp = strrchr(cp, ':'); + if (pp) + *pp++ = '\0'; + + SGFAM(*sg) = AF_INET; + } + + if (inet_pton(SGFAM(*sg), cp, SGADDRP(*sg)) != 1) + { + s_free(buf); + return -1; + } + +#else + + /* Locate port part */ + pp = strrchr(cp, ':'); + if (pp) + *pp++ = '\0'; + + SGFAM(*sg) = AF_INET; + *(unsigned long *) SGADDRP(*sg) = inet_addr(cp); + +#endif + + if (pp) + SGPORT(*sg) = htons(atoi(pp)); + SGSETLEN(*sg); + + s_free(buf); + return 0; +} + + + int str2gid(const char *str, gid_t *out) { Index: src/str2.h diff -u src/str2.h.orig src/str2.h --- src/str2.h.orig Thu Jan 21 08:59:26 1999 +++ src/str2.h Fri Feb 27 18:51:09 2004 @@ -21,6 +21,7 @@ extern int str2str(char *buf, char **out); extern int str2bool(const char *buf, int *out); extern int str2port(const char *str, int *out); +extern int str2addr(const char *str, struct sockaddr_gen *sg); extern int str2gid(const char *str, gid_t *out); extern int str2uid(const char *str, uid_t *uid, gid_t *gid);