From: Kurt Zeilenga Date: Sat, 19 Dec 1998 01:27:20 +0000 (+0000) Subject: -lldap reentrantancy improvements from Bart Hartgers X-Git-Tag: OPENLDAP_SLAPD_BACK_LDAP~917 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=0024cf2f4b10b0b61c57450aeb27adaea376d259;p=openldap -lldap reentrantancy improvements from Bart Hartgers including use of ctime_r, gethostby*_r, etc.. Also reworked ldap_sort_entries to be reentrant. Need to add code to properly set LDAP_API_FEATURE_THREAD_SAFE. --- diff --git a/build/lib.mk b/build/lib.mk index a56086fb52..d92d72503d 100644 --- a/build/lib.mk +++ b/build/lib.mk @@ -22,7 +22,8 @@ lint5: lint5-local FORCE $(5LINT) $(DEFS) $(DEFINES) $(SRCS) clean-common: FORCE - $(RM) $(LIBRARY) ../$(LIBRARY) $(PROGRAMS) $(XPROGRAMS) $(XSRCS) \ + $(RM) $(LIBRARY) ../$(LIBRARY) $(XLIBRARY) \ + $(PROGRAMS) $(XPROGRAMS) $(XSRCS) \ *.o *.lo a.out core version.c .libs/* depend-common: FORCE diff --git a/configure b/configure index e2ceb6a133..4d4ea06642 100755 --- a/configure +++ b/configure @@ -4940,73 +4940,6 @@ echo "$ac_t""$ol_cv_errno_thread_specific" 1>&6 LTHREAD_LIBS="" fi - save_CPPFLAGS="$CPPFLAGS" - save_LIBS="$LIBS" - LIBS="$LTHREAD_LIBS $LIBS" - for ac_func in \ - strtok_r \ - gmtime_r \ - gethostbyaddr_r gethostbyname_r \ - feof_unlocked unlocked_feof \ - putc_unlocked unlocked_putc \ - flockfile ftrylockfile \ - -do -echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:4957: 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 < -/* 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 $ac_func(); - -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_$ac_func) || defined (__stub___$ac_func) -choke me -#else -$ac_func(); -#endif - -; return 0; } -EOF -if { (eval echo configure:4985: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then - rm -rf conftest* - eval "ac_cv_func_$ac_func=yes" -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_func_$ac_func=no" -fi -rm -f conftest* -fi - -if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then - echo "$ac_t""yes" 1>&6 - ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` - cat >> confdefs.h <&6 -fi -done - - CPPFLAGS="$save_CPPFLAGS" - LIBS="$save_LIBS" fi @@ -5030,13 +4963,13 @@ fi ol_link_ldbm=no if test $ol_with_ldbm_api = auto -o $ol_with_ldbm_api = db2 ; then echo $ac_n "checking for DB2 library""... $ac_c" 1>&6 -echo "configure:5034: checking for DB2 library" >&5 +echo "configure:4967: checking for DB2 library" >&5 if eval "test \"`echo '$''{'ol_cv_lib_db2'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ol_LIBS="$LIBS" echo $ac_n "checking for db_open in -ldb""... $ac_c" 1>&6 -echo "configure:5040: checking for db_open in -ldb" >&5 +echo "configure:4973: checking for db_open in -ldb" >&5 ac_lib_var=`echo db'_'db_open | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -5044,7 +4977,7 @@ else ac_save_LIBS="$LIBS" LIBS="-ldb $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:4992: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -5086,17 +5019,17 @@ for ac_hdr in db.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:5090: checking for $ac_hdr" >&5 +echo "configure:5023: 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:5100: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:5033: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then rm -rf conftest* @@ -5124,13 +5057,13 @@ done if test $ac_cv_header_db_h = yes ; then echo $ac_n "checking if db.h is DB2""... $ac_c" 1>&6 -echo "configure:5128: checking if db.h is DB2" >&5 +echo "configure:5061: checking if db.h is DB2" >&5 if eval "test \"`echo '$''{'ol_cv_header_db2'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < @@ -5162,7 +5095,7 @@ fi echo $ac_n "checking for Berkeley DB2""... $ac_c" 1>&6 -echo "configure:5166: checking for Berkeley DB2" >&5 +echo "configure:5099: checking for Berkeley DB2" >&5 if eval "test \"`echo '$''{'ol_cv_berkeley_db2'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -5208,18 +5141,18 @@ fi if test $ol_with_ldbm_api = auto -o $ol_with_ldbm_api = db ; then echo $ac_n "checking for Berkeley DB library""... $ac_c" 1>&6 -echo "configure:5212: checking for Berkeley DB library" >&5 +echo "configure:5145: checking for Berkeley DB library" >&5 if eval "test \"`echo '$''{'ol_cv_lib_db'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ol_LIBS="$LIBS" echo $ac_n "checking for dbopen""... $ac_c" 1>&6 -echo "configure:5218: checking for dbopen" >&5 +echo "configure:5151: checking for dbopen" >&5 if eval "test \"`echo '$''{'ac_cv_func_dbopen'+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; then +if { (eval echo configure:5179: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_dbopen=yes" else @@ -5261,7 +5194,7 @@ else echo "$ac_t""no" 1>&6 echo $ac_n "checking for dbopen in -ldb""... $ac_c" 1>&6 -echo "configure:5265: checking for dbopen in -ldb" >&5 +echo "configure:5198: checking for dbopen in -ldb" >&5 ac_lib_var=`echo db'_'dbopen | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -5269,7 +5202,7 @@ else ac_save_LIBS="$LIBS" LIBS="-ldb $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:5217: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -5315,17 +5248,17 @@ for ac_hdr in db_185.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:5319: checking for $ac_hdr" >&5 +echo "configure:5252: 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:5329: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:5262: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then rm -rf conftest* @@ -5361,7 +5294,7 @@ fi echo $ac_n "checking for Berkeley DB""... $ac_c" 1>&6 -echo "configure:5365: checking for Berkeley DB" >&5 +echo "configure:5298: checking for Berkeley DB" >&5 if eval "test \"`echo '$''{'ol_cv_berkeley_db'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -5414,17 +5347,17 @@ if test $ol_with_ldbm_api = manual ; then do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:5418: checking for $ac_hdr" >&5 +echo "configure:5351: 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:5428: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:5361: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then rm -rf conftest* @@ -5459,18 +5392,18 @@ fi if test $ol_with_ldbm_api = auto -o $ol_with_ldbm_api = gdbm ; then echo $ac_n "checking for GDBM library""... $ac_c" 1>&6 -echo "configure:5463: checking for GDBM library" >&5 +echo "configure:5396: checking for GDBM library" >&5 if eval "test \"`echo '$''{'ol_cv_lib_gdbm'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ol_LIBS="$LIBS" echo $ac_n "checking for gdbm_open""... $ac_c" 1>&6 -echo "configure:5469: checking for gdbm_open" >&5 +echo "configure:5402: checking for gdbm_open" >&5 if eval "test \"`echo '$''{'ac_cv_func_gdbm_open'+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; then +if { (eval echo configure:5430: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_gdbm_open=yes" else @@ -5512,7 +5445,7 @@ else echo "$ac_t""no" 1>&6 echo $ac_n "checking for gdbm_open in -lgdbm""... $ac_c" 1>&6 -echo "configure:5516: checking for gdbm_open in -lgdbm" >&5 +echo "configure:5449: checking for gdbm_open in -lgdbm" >&5 ac_lib_var=`echo gdbm'_'gdbm_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 @@ -5520,7 +5453,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lgdbm $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:5468: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -5566,17 +5499,17 @@ echo "$ac_t""$ol_cv_lib_gdbm" 1>&6 do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:5570: checking for $ac_hdr" >&5 +echo "configure:5503: 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:5580: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:5513: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then rm -rf conftest* @@ -5603,7 +5536,7 @@ fi done echo $ac_n "checking for db""... $ac_c" 1>&6 -echo "configure:5607: checking for db" >&5 +echo "configure:5540: checking for db" >&5 if eval "test \"`echo '$''{'ol_cv_gdbm'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -5639,18 +5572,18 @@ if test $ol_with_ldbm_api = auto ; then echo "configure: warning: skipping automatic checking for NDBM, must be manually enabled." 1>&2 elif test $ol_with_ldbm_api = ndbm ; then echo $ac_n "checking for NDBM library""... $ac_c" 1>&6 -echo "configure:5643: checking for NDBM library" >&5 +echo "configure:5576: checking for NDBM library" >&5 if eval "test \"`echo '$''{'ol_cv_lib_ndbm'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ol_LIBS="$LIBS" echo $ac_n "checking for dbm_open""... $ac_c" 1>&6 -echo "configure:5649: checking for dbm_open" >&5 +echo "configure:5582: checking for dbm_open" >&5 if eval "test \"`echo '$''{'ac_cv_func_dbm_open'+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; then +if { (eval echo configure:5610: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_dbm_open=yes" else @@ -5692,7 +5625,7 @@ else echo "$ac_t""no" 1>&6 echo $ac_n "checking for dbm_open in -lndbm""... $ac_c" 1>&6 -echo "configure:5696: checking for dbm_open in -lndbm" >&5 +echo "configure:5629: checking for dbm_open in -lndbm" >&5 ac_lib_var=`echo ndbm'_'dbm_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 @@ -5700,7 +5633,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lndbm $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:5648: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -5731,7 +5664,7 @@ else echo "$ac_t""no" 1>&6 echo $ac_n "checking for dbm_open in -ldbm""... $ac_c" 1>&6 -echo "configure:5735: checking for dbm_open in -ldbm" >&5 +echo "configure:5668: checking for dbm_open in -ldbm" >&5 ac_lib_var=`echo dbm'_'dbm_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 @@ -5739,7 +5672,7 @@ else ac_save_LIBS="$LIBS" LIBS="-ldbm $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:5687: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -5787,17 +5720,17 @@ echo "$ac_t""$ol_cv_lib_ndbm" 1>&6 do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:5791: checking for $ac_hdr" >&5 +echo "configure:5724: 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:5801: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:5734: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then rm -rf conftest* @@ -5824,7 +5757,7 @@ fi done echo $ac_n "checking for db""... $ac_c" 1>&6 -echo "configure:5828: checking for db" >&5 +echo "configure:5761: checking for db" >&5 if eval "test \"`echo '$''{'ol_cv_ndbm'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -5868,7 +5801,7 @@ fi if test $ol_enable_wrappers = yes ; then echo $ac_n "checking for main in -lwrap""... $ac_c" 1>&6 -echo "configure:5872: checking for main in -lwrap" >&5 +echo "configure:5805: checking for main in -lwrap" >&5 ac_lib_var=`echo wrap'_'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 @@ -5876,14 +5809,14 @@ else ac_save_LIBS="$LIBS" LIBS="-lwrap $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:5820: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -5929,17 +5862,17 @@ for ac_hdr in termcap.h ncurses.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:5933: checking for $ac_hdr" >&5 +echo "configure:5866: 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:5943: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:5876: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then rm -rf conftest* @@ -5968,7 +5901,7 @@ done if test $ol_link_termcap = no ; then echo $ac_n "checking for tputs in -ltermcap""... $ac_c" 1>&6 -echo "configure:5972: checking for tputs in -ltermcap" >&5 +echo "configure:5905: checking for tputs in -ltermcap" >&5 ac_lib_var=`echo termcap'_'tputs | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -5976,7 +5909,7 @@ else ac_save_LIBS="$LIBS" LIBS="-ltermcap $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:5924: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -6020,7 +5953,7 @@ fi if test $ol_link_termcap = no ; then echo $ac_n "checking for initscr in -lncurses""... $ac_c" 1>&6 -echo "configure:6024: checking for initscr in -lncurses" >&5 +echo "configure:5957: checking for initscr in -lncurses" >&5 ac_lib_var=`echo ncurses'_'initscr | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -6028,7 +5961,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lncurses $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:5976: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -6081,12 +6014,12 @@ fi # FreeBSD (and others) have crypt(3) in -lcrypt if test $ol_enable_crypt != no ; then echo $ac_n "checking for crypt""... $ac_c" 1>&6 -echo "configure:6085: checking for crypt" >&5 +echo "configure:6018: checking for crypt" >&5 if eval "test \"`echo '$''{'ac_cv_func_crypt'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:6046: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_crypt=yes" else @@ -6128,7 +6061,7 @@ else echo "$ac_t""no" 1>&6 echo $ac_n "checking for crypt in -lcrypt""... $ac_c" 1>&6 -echo "configure:6132: checking for crypt in -lcrypt" >&5 +echo "configure:6065: checking for crypt in -lcrypt" >&5 ac_lib_var=`echo crypt'_'crypt | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -6136,7 +6069,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lcrypt $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:6084: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -6191,12 +6124,12 @@ fi # FreeBSD (and others) have setproctitle(3) in -lutil if test $ol_enable_proctitle != no ; then echo $ac_n "checking for setproctitle""... $ac_c" 1>&6 -echo "configure:6195: checking for setproctitle" >&5 +echo "configure:6128: checking for setproctitle" >&5 if eval "test \"`echo '$''{'ac_cv_func_setproctitle'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:6156: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_setproctitle=yes" else @@ -6238,7 +6171,7 @@ else echo "$ac_t""no" 1>&6 echo $ac_n "checking for setproctitle in -lutil""... $ac_c" 1>&6 -echo "configure:6242: checking for setproctitle in -lutil" >&5 +echo "configure:6175: checking for setproctitle in -lutil" >&5 ac_lib_var=`echo util'_'setproctitle | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -6246,7 +6179,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lutil $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:6194: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -6292,12 +6225,12 @@ EOF fi echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6 -echo "configure:6296: checking for ANSI C header files" >&5 +echo "configure:6229: 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 @@ -6305,7 +6238,7 @@ else #include EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:6309: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:6242: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then rm -rf conftest* @@ -6322,7 +6255,7 @@ rm -f conftest* 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 @@ -6340,7 +6273,7 @@ fi 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 @@ -6361,7 +6294,7 @@ if test "$cross_compiling" = yes; then : else cat > conftest.$ac_ext < #define ISLOWER(c) ('a' <= (c) && (c) <= 'z') @@ -6372,7 +6305,7 @@ if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2); exit (0); } EOF -if { (eval echo configure:6376: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +if { (eval echo configure:6309: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null then : else @@ -6405,12 +6338,12 @@ for ac_hdr in dirent.h sys/ndir.h sys/dir.h ndir.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr that defines DIR""... $ac_c" 1>&6 -echo "configure:6409: checking for $ac_hdr that defines DIR" >&5 +echo "configure:6342: checking for $ac_hdr that defines DIR" >&5 if eval "test \"`echo '$''{'ac_cv_header_dirent_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include <$ac_hdr> @@ -6418,7 +6351,7 @@ int main() { DIR *dirp = 0; ; return 0; } EOF -if { (eval echo configure:6422: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:6355: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* eval "ac_cv_header_dirent_$ac_safe=yes" else @@ -6443,7 +6376,7 @@ done # Two versions of opendir et al. are in -ldir and -lx on SCO Xenix. if test $ac_header_dirent = dirent.h; then echo $ac_n "checking for opendir in -ldir""... $ac_c" 1>&6 -echo "configure:6447: checking for opendir in -ldir" >&5 +echo "configure:6380: checking for opendir in -ldir" >&5 ac_lib_var=`echo dir'_'opendir | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -6451,7 +6384,7 @@ else ac_save_LIBS="$LIBS" LIBS="-ldir $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:6399: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -6484,7 +6417,7 @@ fi else echo $ac_n "checking for opendir in -lx""... $ac_c" 1>&6 -echo "configure:6488: checking for opendir in -lx" >&5 +echo "configure:6421: checking for opendir in -lx" >&5 ac_lib_var=`echo x'_'opendir | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -6492,7 +6425,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lx $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:6440: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -6526,12 +6459,12 @@ fi fi echo $ac_n "checking for sys/wait.h that is POSIX.1 compatible""... $ac_c" 1>&6 -echo "configure:6530: checking for sys/wait.h that is POSIX.1 compatible" >&5 +echo "configure:6463: checking for sys/wait.h that is POSIX.1 compatible" >&5 if eval "test \"`echo '$''{'ac_cv_header_sys_wait_h'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -6547,7 +6480,7 @@ wait (&s); s = WIFEXITED (s) ? WEXITSTATUS (s) : 1; ; return 0; } EOF -if { (eval echo configure:6551: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:6484: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_header_sys_wait_h=yes else @@ -6568,12 +6501,12 @@ EOF fi echo $ac_n "checking POSIX termios""... $ac_c" 1>&6 -echo "configure:6572: checking POSIX termios" >&5 +echo "configure:6505: checking POSIX termios" >&5 if eval "test \"`echo '$''{'am_cv_sys_posix_termios'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -6583,7 +6516,7 @@ int main() { tcgetattr(0, 0); ; return 0; } EOF -if { (eval echo configure:6587: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:6520: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* am_cv_sys_posix_termios=yes else @@ -6599,7 +6532,7 @@ echo "$ac_t""$am_cv_sys_posix_termios" 1>&6 echo $ac_n "checking whether use of TIOCGWINSZ requires sys/ioctl.h""... $ac_c" 1>&6 -echo "configure:6603: checking whether use of TIOCGWINSZ requires sys/ioctl.h" >&5 +echo "configure:6536: checking whether use of TIOCGWINSZ requires sys/ioctl.h" >&5 if eval "test \"`echo '$''{'am_cv_sys_tiocgwinsz_needs_sys_ioctl_h'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -6608,7 +6541,7 @@ else gwinsz_in_termios_h=no if test $am_cv_sys_posix_termios = yes; then cat > conftest.$ac_ext < # include @@ -6628,7 +6561,7 @@ rm -f conftest* if test $gwinsz_in_termios_h = no; then cat > conftest.$ac_ext < # include @@ -6698,17 +6631,17 @@ for ac_hdr in \ do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:6702: checking for $ac_hdr" >&5 +echo "configure:6635: 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:6712: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:6645: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then rm -rf conftest* @@ -6736,12 +6669,12 @@ done echo $ac_n "checking for uid_t in sys/types.h""... $ac_c" 1>&6 -echo "configure:6740: checking for uid_t in sys/types.h" >&5 +echo "configure:6673: 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 @@ -6770,7 +6703,7 @@ EOF fi echo $ac_n "checking type of array argument to getgroups""... $ac_c" 1>&6 -echo "configure:6774: checking type of array argument to getgroups" >&5 +echo "configure:6707: checking type of array argument to getgroups" >&5 if eval "test \"`echo '$''{'ac_cv_type_getgroups'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -6778,7 +6711,7 @@ else ac_cv_type_getgroups=cross else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +if { (eval echo configure:6740: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null then ac_cv_type_getgroups=gid_t else @@ -6817,7 +6750,7 @@ fi if test $ac_cv_type_getgroups = cross; then cat > conftest.$ac_ext < EOF @@ -6840,12 +6773,12 @@ cat >> confdefs.h <&6 -echo "configure:6844: checking for mode_t" >&5 +echo "configure:6777: 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 @@ -6873,12 +6806,12 @@ EOF fi echo $ac_n "checking for off_t""... $ac_c" 1>&6 -echo "configure:6877: checking for off_t" >&5 +echo "configure:6810: 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 @@ -6906,12 +6839,12 @@ EOF fi echo $ac_n "checking for pid_t""... $ac_c" 1>&6 -echo "configure:6910: checking for pid_t" >&5 +echo "configure:6843: 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 @@ -6939,19 +6872,19 @@ EOF fi echo $ac_n "checking for ptrdiff_t""... $ac_c" 1>&6 -echo "configure:6943: checking for ptrdiff_t" >&5 +echo "configure:6876: checking for ptrdiff_t" >&5 if eval "test \"`echo '$''{'am_cv_type_ptrdiff_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < int main() { ptrdiff_t p ; return 0; } EOF -if { (eval echo configure:6955: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:6888: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* am_cv_type_ptrdiff_t=yes else @@ -6972,12 +6905,12 @@ EOF fi echo $ac_n "checking return type of signal handlers""... $ac_c" 1>&6 -echo "configure:6976: checking return type of signal handlers" >&5 +echo "configure:6909: 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 @@ -6994,7 +6927,7 @@ int main() { int i; ; return 0; } EOF -if { (eval echo configure:6998: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:6931: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_type_signal=void else @@ -7013,12 +6946,12 @@ EOF echo $ac_n "checking for size_t""... $ac_c" 1>&6 -echo "configure:7017: checking for size_t" >&5 +echo "configure:6950: 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 @@ -7046,12 +6979,12 @@ EOF fi echo $ac_n "checking for st_blksize in struct stat""... $ac_c" 1>&6 -echo "configure:7050: checking for st_blksize in struct stat" >&5 +echo "configure:6983: checking for st_blksize in struct stat" >&5 if eval "test \"`echo '$''{'ac_cv_struct_st_blksize'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -7059,7 +6992,7 @@ int main() { struct stat s; s.st_blksize; ; return 0; } EOF -if { (eval echo configure:7063: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:6996: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_struct_st_blksize=yes else @@ -7080,12 +7013,12 @@ EOF fi echo $ac_n "checking whether time.h and sys/time.h may both be included""... $ac_c" 1>&6 -echo "configure:7084: checking whether time.h and sys/time.h may both be included" >&5 +echo "configure:7017: 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 @@ -7094,7 +7027,7 @@ int main() { struct tm *tp; ; return 0; } EOF -if { (eval echo configure:7098: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:7031: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_header_time=yes else @@ -7115,12 +7048,12 @@ EOF fi echo $ac_n "checking whether struct tm is in sys/time.h or time.h""... $ac_c" 1>&6 -echo "configure:7119: checking whether struct tm is in sys/time.h or time.h" >&5 +echo "configure:7052: checking whether struct tm is in sys/time.h or time.h" >&5 if eval "test \"`echo '$''{'ac_cv_struct_tm'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -7128,7 +7061,7 @@ int main() { struct tm *tp; tp->tm_sec; ; return 0; } EOF -if { (eval echo configure:7132: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:7065: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_struct_tm=time.h else @@ -7151,7 +7084,7 @@ fi echo $ac_n "checking if toupper() requires islower()""... $ac_c" 1>&6 -echo "configure:7155: checking if toupper() requires islower()" >&5 +echo "configure:7088: checking if toupper() requires islower()" >&5 if eval "test \"`echo '$''{'ol_cv_c_upper_lower'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -7160,7 +7093,7 @@ else ol_cv_c_upper_lower=safe else cat > conftest.$ac_ext < @@ -7172,7 +7105,7 @@ main() exit(1); } EOF -if { (eval echo configure:7176: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +if { (eval echo configure:7109: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null then ol_cv_c_upper_lower=no else @@ -7195,12 +7128,12 @@ EOF fi echo $ac_n "checking for working const""... $ac_c" 1>&6 -echo "configure:7199: checking for working const" >&5 +echo "configure:7132: 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:7186: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_c_const=yes else @@ -7277,14 +7210,14 @@ EOF else echo $ac_n "checking whether byte ordering is bigendian""... $ac_c" 1>&6 -echo "configure:7281: checking whether byte ordering is bigendian" >&5 +echo "configure:7214: checking whether byte ordering is bigendian" >&5 if eval "test \"`echo '$''{'ac_cv_c_bigendian'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_cv_c_bigendian=unknown # See if sys/param.h defines the BYTE_ORDER macro. cat > conftest.$ac_ext < #include @@ -7295,11 +7228,11 @@ int main() { #endif ; return 0; } EOF -if { (eval echo configure:7299: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:7232: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* # It does; now see whether it defined to BIG_ENDIAN or not. cat > conftest.$ac_ext < #include @@ -7310,7 +7243,7 @@ int main() { #endif ; return 0; } EOF -if { (eval echo configure:7314: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:7247: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_c_bigendian=yes else @@ -7330,7 +7263,7 @@ 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 <&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +if { (eval echo configure:7280: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null then ac_cv_c_bigendian=no else @@ -7367,7 +7300,7 @@ EOF fi echo $ac_n "checking size of short""... $ac_c" 1>&6 -echo "configure:7371: checking size of short" >&5 +echo "configure:7304: checking size of short" >&5 if eval "test \"`echo '$''{'ac_cv_sizeof_short'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -7375,7 +7308,7 @@ else { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } else cat > conftest.$ac_ext < main() @@ -7386,7 +7319,7 @@ main() exit(0); } EOF -if { (eval echo configure:7390: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +if { (eval echo configure:7323: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null then ac_cv_sizeof_short=`cat conftestval` else @@ -7406,7 +7339,7 @@ EOF echo $ac_n "checking size of int""... $ac_c" 1>&6 -echo "configure:7410: checking size of int" >&5 +echo "configure:7343: checking size of int" >&5 if eval "test \"`echo '$''{'ac_cv_sizeof_int'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -7414,7 +7347,7 @@ else { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } else cat > conftest.$ac_ext < main() @@ -7425,7 +7358,7 @@ main() exit(0); } EOF -if { (eval echo configure:7429: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +if { (eval echo configure:7362: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null then ac_cv_sizeof_int=`cat conftestval` else @@ -7445,7 +7378,7 @@ EOF echo $ac_n "checking size of long""... $ac_c" 1>&6 -echo "configure:7449: checking size of long" >&5 +echo "configure:7382: checking size of long" >&5 if eval "test \"`echo '$''{'ac_cv_sizeof_long'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -7453,7 +7386,7 @@ else { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } else cat > conftest.$ac_ext < main() @@ -7464,7 +7397,7 @@ main() exit(0); } EOF -if { (eval echo configure:7468: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +if { (eval echo configure:7401: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null then ac_cv_sizeof_long=`cat conftestval` else @@ -7486,7 +7419,7 @@ EOF fi echo $ac_n "checking for 8-bit clean memcmp""... $ac_c" 1>&6 -echo "configure:7490: checking for 8-bit clean memcmp" >&5 +echo "configure:7423: checking for 8-bit clean memcmp" >&5 if eval "test \"`echo '$''{'ac_cv_func_memcmp_clean'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -7494,7 +7427,7 @@ else ac_cv_func_memcmp_clean=no else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +if { (eval echo configure:7441: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null then ac_cv_func_memcmp_clean=yes else @@ -7522,12 +7455,12 @@ echo "$ac_t""$ac_cv_func_memcmp_clean" 1>&6 test $ac_cv_func_memcmp_clean = no && LIBOBJS="$LIBOBJS memcmp.o" echo $ac_n "checking for strftime""... $ac_c" 1>&6 -echo "configure:7526: checking for strftime" >&5 +echo "configure:7459: checking for strftime" >&5 if eval "test \"`echo '$''{'ac_cv_func_strftime'+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; then +if { (eval echo configure:7487: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_strftime=yes" else @@ -7572,7 +7505,7 @@ else echo "$ac_t""no" 1>&6 # strftime is in -lintl on SCO UNIX. echo $ac_n "checking for strftime in -lintl""... $ac_c" 1>&6 -echo "configure:7576: checking for strftime in -lintl" >&5 +echo "configure:7509: checking for strftime in -lintl" >&5 ac_lib_var=`echo intl'_'strftime | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -7580,7 +7513,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lintl $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:7528: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -7618,12 +7551,12 @@ fi fi echo $ac_n "checking for vprintf""... $ac_c" 1>&6 -echo "configure:7622: checking for vprintf" >&5 +echo "configure:7555: checking for vprintf" >&5 if eval "test \"`echo '$''{'ac_cv_func_vprintf'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:7583: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_vprintf=yes" else @@ -7670,12 +7603,12 @@ fi if test "$ac_cv_func_vprintf" != yes; then echo $ac_n "checking for _doprnt""... $ac_c" 1>&6 -echo "configure:7674: checking for _doprnt" >&5 +echo "configure:7607: checking for _doprnt" >&5 if eval "test \"`echo '$''{'ac_cv_func__doprnt'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:7635: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func__doprnt=yes" else @@ -7727,12 +7660,12 @@ if test $ac_cv_func_vprintf = yes ; then for ac_func in vsnprintf do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:7731: checking for $ac_func" >&5 +echo "configure:7664: 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; then +if { (eval echo configure:7692: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -7782,7 +7715,7 @@ done fi echo $ac_n "checking for wait3 that fills in rusage""... $ac_c" 1>&6 -echo "configure:7786: checking for wait3 that fills in rusage" >&5 +echo "configure:7719: checking for wait3 that fills in rusage" >&5 if eval "test \"`echo '$''{'ac_cv_func_wait3_rusage'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -7790,7 +7723,7 @@ else ac_cv_func_wait3_rusage=no else cat > conftest.$ac_ext < #include @@ -7821,7 +7754,7 @@ main() { } } EOF -if { (eval echo configure:7825: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +if { (eval echo configure:7758: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null then ac_cv_func_wait3_rusage=yes else @@ -7846,9 +7779,11 @@ fi for ac_func in \ bcopy \ + ctime_r \ flock \ getdtablesize \ gethostname \ + gethostbyaddr_r gethostbyname_r \ getpwuid \ gettimeofday \ lockf \ @@ -7869,6 +7804,7 @@ for ac_func in \ strsep \ strstr \ strtok \ + strtok_r \ strtol \ strtoul \ sysconf \ @@ -7876,12 +7812,12 @@ for ac_func in \ do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:7880: checking for $ac_func" >&5 +echo "configure:7816: 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; then +if { (eval echo configure:7844: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -7932,12 +7868,12 @@ done for ac_func in getopt strdup tempnam do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:7936: checking for $ac_func" >&5 +echo "configure:7872: 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; then +if { (eval echo configure:7900: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -7990,13 +7926,13 @@ done # Check Configuration echo $ac_n "checking declaration of sys_errlist""... $ac_c" 1>&6 -echo "configure:7994: checking declaration of sys_errlist" >&5 +echo "configure:7930: checking declaration of sys_errlist" >&5 if eval "test \"`echo '$''{'ol_cv_dcl_sys_errlist'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < @@ -8006,7 +7942,7 @@ int main() { char *c = (char *) *sys_errlist ; return 0; } EOF -if { (eval echo configure:8010: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:7946: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ol_cv_dcl_sys_errlist=yes else @@ -8027,20 +7963,20 @@ if test $ol_cv_dcl_sys_errlist = no ; then EOF echo $ac_n "checking existence of sys_errlist""... $ac_c" 1>&6 -echo "configure:8031: checking existence of sys_errlist" >&5 +echo "configure:7967: checking existence of sys_errlist" >&5 if eval "test \"`echo '$''{'ol_cv_have_sys_errlist'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < int main() { char *c = (char *) *sys_errlist ; return 0; } EOF -if { (eval echo configure:8044: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:7980: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* ol_cv_have_sys_errlist=yes else diff --git a/configure.in b/configure.in index 46dd667bcd..5ebcf71b85 100644 --- a/configure.in +++ b/configure.in @@ -803,24 +803,37 @@ int x = errno; LTHREAD_LIBS="" fi - dnl check for reentrant/threadsafe functions - dnl - dnl note: these should only be used when linking - dnl with $LTHREAD_LIBS - dnl - save_CPPFLAGS="$CPPFLAGS" - save_LIBS="$LIBS" - LIBS="$LTHREAD_LIBS $LIBS" - AC_CHECK_FUNCS( \ - strtok_r \ - gmtime_r \ - gethostbyaddr_r gethostbyname_r \ - feof_unlocked unlocked_feof \ - putc_unlocked unlocked_putc \ - flockfile ftrylockfile \ - ) - CPPFLAGS="$save_CPPFLAGS" - LIBS="$save_LIBS" +dnl When in thread environment, use +dnl #if defined( HAVE_REENTRANT_FUNCTIONS ) \ +dnl || defined( HAVE_FUNC_R ) +dnl func_r(...); +dnl #else +dnl func(...); +dnl #endif +dnl +dnl HAVE_REENTRANT_FUNCTIONS is derived from: +dnl _POSIX_REENTRANT_FUNCTIONS +dnl _POSIX_THREAD_SAFE_FUNCTIONS +dnl _POSIX_THREADSAFE_FUNCTIONS +dnl +dnl dnl check for reentrant/threadsafe functions +dnl dnl +dnl dnl note: these should only be used when linking +dnl dnl with $LTHREAD_LIBS +dnl dnl +dnl save_CPPFLAGS="$CPPFLAGS" +dnl save_LIBS="$LIBS" +dnl LIBS="$LTHREAD_LIBS $LIBS" +dnl AC_CHECK_FUNCS( \ +dnl strtok_r \ +dnl gmtime_r \ +dnl gethostbyaddr_r gethostbyname_r \ +dnl feof_unlocked unlocked_feof \ +dnl putc_unlocked unlocked_putc \ +dnl flockfile ftrylockfile \ +dnl ) +dnl CPPFLAGS="$save_CPPFLAGS" +dnl LIBS="$save_LIBS" fi dnl ---------------------------------------------------------------- @@ -1103,9 +1116,11 @@ AC_FUNC_WAIT3 AC_CHECK_FUNCS( \ bcopy \ + ctime_r \ flock \ getdtablesize \ gethostname \ + gethostbyaddr_r gethostbyname_r \ getpwuid \ gettimeofday \ lockf \ @@ -1126,6 +1141,7 @@ AC_CHECK_FUNCS( \ strsep \ strstr \ strtok \ + strtok_r \ strtol \ strtoul \ sysconf \ diff --git a/include/portable.h.in b/include/portable.h.in index 4501493731..f4785d5f91 100644 --- a/include/portable.h.in +++ b/include/portable.h.in @@ -279,18 +279,12 @@ is provided ``as is'' without express or implied warranty. /* Define if you have the bcopy function. */ #undef HAVE_BCOPY -/* Define if you have the feof_unlocked function. */ -#undef HAVE_FEOF_UNLOCKED +/* Define if you have the ctime_r function. */ +#undef HAVE_CTIME_R /* Define if you have the flock function. */ #undef HAVE_FLOCK -/* Define if you have the flockfile function. */ -#undef HAVE_FLOCKFILE - -/* Define if you have the ftrylockfile function. */ -#undef HAVE_FTRYLOCKFILE - /* Define if you have the getdtablesize function. */ #undef HAVE_GETDTABLESIZE @@ -312,9 +306,6 @@ is provided ``as is'' without express or implied warranty. /* Define if you have the gettimeofday function. */ #undef HAVE_GETTIMEOFDAY -/* Define if you have the gmtime_r function. */ -#undef HAVE_GMTIME_R - /* Define if you have the lockf function. */ #undef HAVE_LOCKF @@ -354,9 +345,6 @@ is provided ``as is'' without express or implied warranty. /* Define if you have the pthread_yield function. */ #undef HAVE_PTHREAD_YIELD -/* Define if you have the putc_unlocked function. */ -#undef HAVE_PUTC_UNLOCKED - /* Define if you have the res_search function. */ #undef HAVE_RES_SEARCH @@ -423,12 +411,6 @@ is provided ``as is'' without express or implied warranty. /* Define if you have the thr_setconcurrency function. */ #undef HAVE_THR_SETCONCURRENCY -/* Define if you have the unlocked_feof function. */ -#undef HAVE_UNLOCKED_FEOF - -/* Define if you have the unlocked_putc function. */ -#undef HAVE_UNLOCKED_PUTC - /* Define if you have the vsnprintf function. */ #undef HAVE_VSNPRINTF diff --git a/libraries/liblber/Makefile.in b/libraries/liblber/Makefile.in index 4d6754ee94..1c0bfcb79b 100644 --- a/libraries/liblber/Makefile.in +++ b/libraries/liblber/Makefile.in @@ -3,6 +3,7 @@ ## LIBRARY = liblber.la +XLIBRARY = ../liblber.a SRCS= decode.c encode.c io.c bprint.c OBJS= decode.lo encode.lo io.lo bprint.lo diff --git a/libraries/libldap/Makefile.in b/libraries/libldap/Makefile.in index 484a8f3f70..013b2e4976 100644 --- a/libraries/libldap/Makefile.in +++ b/libraries/libldap/Makefile.in @@ -2,6 +2,8 @@ ## Makefile.in for LDAP -lldap ## LIBRARY = libldap.la +XLIBRARY = ../libldap.a + PROGRAMS = apitest ltest ttest SRCS = bind.c open.c result.c error.c compare.c search.c \ @@ -10,14 +12,14 @@ SRCS = bind.c open.c result.c error.c compare.c search.c \ free.c disptmpl.c srchpref.c dsparse.c tmplout.c sort.c \ getdn.c getentry.c getattr.c getvalues.c addentry.c \ request.c getdxbyname.c os-ip.c url.c charset.c \ - init.c options.c strdup.c + init.c options.c strdup.c util-int.c OBJS = bind.lo open.lo result.lo error.lo compare.lo search.lo \ modify.lo add.lo modrdn.lo delete.lo abandon.lo ufn.lo cache.lo \ getfilter.lo sbind.lo kbind.lo unbind.lo friendly.lo cldap.lo \ free.lo disptmpl.lo srchpref.lo dsparse.lo tmplout.lo sort.lo \ getdn.lo getentry.lo getattr.lo getvalues.lo addentry.lo \ request.lo getdxbyname.lo os-ip.lo url.lo charset.lo \ - init.lo options.lo strdup.lo + init.lo options.lo strdup.lo util-int.lo LDAP_INCDIR= ../../include LDAP_LIBDIR= ../../libraries diff --git a/libraries/libldap/cldap.c b/libraries/libldap/cldap.c index 5ae4c6a663..1ed8693a15 100644 --- a/libraries/libldap/cldap.c +++ b/libraries/libldap/cldap.c @@ -64,6 +64,13 @@ cldap_open( char *host, int port ) char *p; int i; + /* buffers for ldap_int_gethostbyname_a ... */ + struct hostent he_buf; + int local_h_errno; + char *ha_buf=NULL; + +#define DO_RETURN(x) if (ha_buf) free(ha_buf); return (x); + Debug( LDAP_DEBUG_TRACE, "ldap_open\n", 0, 0, 0 ); if ( (s = socket( AF_INET, SOCK_DGRAM, 0 )) < 0 ) { @@ -110,9 +117,11 @@ cldap_open( char *host, int port ) /* This was just a test for -1 until OSF1 let inet_addr return unsigned int, which is narrower than 'unsigned long address' */ if ( address == 0xffffffff || address == (unsigned long) -1 ) { - if ( (hp = gethostbyname( host )) == NULL ) { - errno = EHOSTUNREACH; - continue; + if ((ldap_int_gethostbyname_a( host, &he_buf, &ha_buf, + &hp,&local_h_errno)<0) || + (hp==NULL)) { + errno = EHOSTUNREACH; + continue; } for ( i = 0; hp->h_addr_list[ i ] != 0; ++i ) { @@ -121,7 +130,7 @@ cldap_open( char *host, int port ) sizeof(sock.sin_addr.s_addr)); if ( add_addr( ld, (struct sockaddr *)&sock ) < 0 ) { ldap_ld_free( ld, 1 ); - return( NULL ); + DO_RETURN( NULL ); } } @@ -129,7 +138,7 @@ cldap_open( char *host, int port ) sock.sin_addr.s_addr = address; if ( add_addr( ld, (struct sockaddr *)&sock ) < 0 ) { ldap_ld_free( ld, 1 ); - return( NULL ); + DO_RETURN( NULL ); } } @@ -137,13 +146,12 @@ cldap_open( char *host, int port ) ld->ld_host = ldap_strdup( host ); } } - } else { address = INADDR_LOOPBACK; sock.sin_addr.s_addr = htonl( address ); if ( add_addr( ld, (struct sockaddr *)&sock ) < 0 ) { ldap_ld_free( ld, 1 ); - return( NULL ); + DO_RETURN( NULL ); } } @@ -153,7 +161,7 @@ cldap_open( char *host, int port ) #endif /* LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS */ ) { ldap_ld_free( ld, 0 ); - return( NULL ); + DO_RETURN( NULL ); } ld->ld_sb.sb_useaddr = ld->ld_sb.sb_addrs[ 0 ]; @@ -168,10 +176,10 @@ cldap_open( char *host, int port ) } #endif - return( ld ); + DO_RETURN( ld ); } - +#undef DO_RETURN void cldap_close( LDAP *ld ) diff --git a/libraries/libldap/getdn.c b/libraries/libldap/getdn.c index 1142c88364..c50b4813ea 100644 --- a/libraries/libldap/getdn.c +++ b/libraries/libldap/getdn.c @@ -124,6 +124,7 @@ ldap_explode_dns( char *dn ) int ncomps, maxcomps; char *s; char **rdns; + char *tok_r; if ( (rdns = (char **) malloc( 8 * sizeof(char *) )) == NULL ) { return( NULL ); @@ -131,7 +132,8 @@ ldap_explode_dns( char *dn ) maxcomps = 8; ncomps = 0; - for ( s = strtok( dn, "@." ); s != NULL; s = strtok( NULL, "@." ) ) { + for ( s = ldap_int_strtok( dn, "@.", &tok_r ); s != NULL; + s = ldap_int_strtok( NULL, "@.", &tok_r ) ) { if ( ncomps == maxcomps ) { maxcomps *= 2; if ( (rdns = (char **) realloc( rdns, maxcomps * diff --git a/libraries/libldap/getfilter.c b/libraries/libldap/getfilter.c index e466adc243..f5b9ff0d26 100644 --- a/libraries/libldap/getfilter.c +++ b/libraries/libldap/getfilter.c @@ -405,14 +405,15 @@ break_into_words( char *str, char *delims, char ***wordsp ) { char *word, **words; int count; - + char *tok_r; + if (( words = (char **)calloc( 1, sizeof( char * ))) == NULL ) { return( -1 ); } count = 0; words[ count ] = NULL; - word = strtok( str, delims ); + word = ldap_int_strtok( str, delims, &tok_r ); while ( word != NULL ) { if (( words = (char **)realloc( words, ( count + 2 ) * sizeof( char * ))) == NULL ) { @@ -421,7 +422,7 @@ break_into_words( char *str, char *delims, char ***wordsp ) words[ count ] = word; words[ ++count ] = NULL; - word = strtok( NULL, delims ); + word = ldap_int_strtok( NULL, delims, &tok_r ); } *wordsp = words; diff --git a/libraries/libldap/ldap-int.h b/libraries/libldap/ldap-int.h index 4b95a75f4f..68c8c5b245 100644 --- a/libraries/libldap/ldap-int.h +++ b/libraries/libldap/ldap-int.h @@ -11,6 +11,8 @@ #include "../liblber/lber-int.h" #include "ldap_log.h" #include "ldap.h" +#include +#include LDAP_BEGIN_DECL @@ -273,6 +275,28 @@ int ldap_8859_to_t61( char **bufp, unsigned long *buflenp, int free_input ); #endif /* LDAP_CHARSET_8859 == LDAP_DEFAULT_CHARSET */ #endif /* STR_TRANSLATION && LDAP_DEFAULT_CHARSET */ +/* + * in util_r.c + * + */ + +extern char *ldap_int_strtok( char *str, const char *delim, char **pos ); +extern char *ldap_int_ctime( const time_t *tp, char *buf ); +extern int ldap_int_gethostbyname_a( + const char *name, + struct hostent *resbuf, + char **buf, + struct hostent **result, + int *herrno_ptr ); +extern int ldap_int_gethostbyaddr_a( + const char *addr, + int len, + int type, + struct hostent *resbuf, + char **buf, + struct hostent **result, + int *herrno_ptr ); + LDAP_END_DECL #endif /* _LDAP_INT_H */ diff --git a/libraries/libldap/os-ip.c b/libraries/libldap/os-ip.c index 1b22917a46..46ab3a6d5a 100644 --- a/libraries/libldap/os-ip.c +++ b/libraries/libldap/os-ip.c @@ -48,7 +48,13 @@ ldap_connect_to_host( Sockbuf *sb, char *host, unsigned long address, int status; /* for ioctl call */ #endif /* LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS */ #endif /* notyet */ - + + /* buffers for ldap_int_gethostbyname_a */ + struct hostent he_buf; + int local_h_errno; + char *ha_buf=NULL; +#define DO_RETURN(x) if (ha_buf) free(ha_buf); return (x); + Debug( LDAP_DEBUG_TRACE, "ldap_connect_to_host: %s:%d\n", ( host == NULL ) ? "(by address)" : host, (int) ntohs( (short) port ), 0 ); @@ -59,13 +65,15 @@ ldap_connect_to_host( Sockbuf *sb, char *host, unsigned long address, /* This was just a test for -1 until OSF1 let inet_addr return unsigned int, which is narrower than 'unsigned long address' */ if ( address == 0xffffffff || address == (unsigned long) -1 ) { - if ( (hp = gethostbyname( host )) == NULL ) { + if ( ( ldap_int_gethostbyname_a( host, &he_buf, &ha_buf, + &hp, &local_h_errno) < 0) || (hp==NULL)) + { #ifdef HAVE_WINSOCK errno = WSAGetLastError(); #else errno = EHOSTUNREACH; /* not exactly right, but... */ #endif - return( -1 ); + DO_RETURN( -1 ); } use_hp = 1; } @@ -74,7 +82,7 @@ ldap_connect_to_host( Sockbuf *sb, char *host, unsigned long address, rc = -1; for ( i = 0; !use_hp || ( hp->h_addr_list[ i ] != 0 ); i++ ) { if (( s = socket( AF_INET, SOCK_STREAM, 0 )) < 0 ) { - return( -1 ); + DO_RETURN( -1 ); } #ifdef notyet #ifdef LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS @@ -99,7 +107,7 @@ ldap_connect_to_host( Sockbuf *sb, char *host, unsigned long address, break; } else { #ifdef HAVE_WINSOCK - errno = WSAGetLastError(); + errno = WSAGetLastError(); #endif #ifdef notyet #ifdef LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS @@ -145,8 +153,12 @@ ldap_connect_to_host( Sockbuf *sb, char *host, unsigned long address, s, (char *) inet_ntoa( sin.sin_addr ), 0 ); } - return( rc ); + DO_RETURN( rc ); + + } + +#undef DO_RETURN void @@ -165,6 +177,12 @@ ldap_host_connected_to( Sockbuf *sb ) int len; struct sockaddr_in sin; + /* buffers for gethostbyaddr_r */ + struct hostent he_buf; + int local_h_errno; + char *ha_buf=NULL; +#define DO_RETURN(x) if (ha_buf) free(ha_buf); return (x); + (void)memset( (char *)&sin, 0, sizeof( struct sockaddr_in )); len = sizeof( sin ); if ( getpeername( sb->sb_sd, (struct sockaddr *)&sin, &len ) == -1 ) { @@ -176,15 +194,20 @@ ldap_host_connected_to( Sockbuf *sb ) * this is necessary for kerberos to work right, since the official * hostname is used as the kerberos instance. */ - if (( hp = gethostbyaddr( (char *) &sin.sin_addr, - sizeof( sin.sin_addr ), AF_INET )) != NULL ) { + if ((ldap_int_gethostbyaddr_a( (char *) &sin.sin_addr, + sizeof( sin.sin_addr ), + AF_INET, &he_buf, &ha_buf, + &hp,&local_h_errno ) ==0 ) && (hp != NULL) ) + { if ( hp->h_name != NULL ) { - return( ldap_strdup( hp->h_name )); + DO_RETURN( ldap_strdup( hp->h_name )); } } - return( NULL ); + DO_RETURN( NULL ); } +#undef DO_RETURN + #endif /* HAVE_KERBEROS */ diff --git a/libraries/libldap/request.c b/libraries/libldap/request.c index f2d290e876..245c73b948 100644 --- a/libraries/libldap/request.c +++ b/libraries/libldap/request.c @@ -442,6 +442,7 @@ void ldap_dump_connection( LDAP *ld, LDAPConn *lconns, int all ) { LDAPConn *lc; + char timebuf[32]; fprintf( stderr, "** Connection%s:\n", all ? "s" : "" ); for ( lc = lconns; lc != NULL; lc = lc->lconn_next ) { @@ -457,7 +458,7 @@ ldap_dump_connection( LDAP *ld, LDAPConn *lconns, int all ) "NeedSocket" : ( lc->lconn_status == LDAP_CONNST_CONNECTING ) ? "Connecting" : "Connected" ); fprintf( stderr, " last used: %s\n", - ctime( &lc->lconn_lastused )); + ldap_int_ctime( &lc->lconn_lastused, timebuf )); if ( !all ) { break; } diff --git a/libraries/libldap/sort.c b/libraries/libldap/sort.c index 831947019d..6738fba022 100644 --- a/libraries/libldap/sort.c +++ b/libraries/libldap/sort.c @@ -27,9 +27,9 @@ struct entrything { char **et_vals; LDAPMessage *et_msg; + int (*et_cmp_fn) LDAP_P((const char *a, const char *b)); }; -static int (*et_cmp_fn) LDAP_P(( const char *a, const char *b )); static int et_cmp LDAP_P(( const void *aa, const void *bb)); @@ -60,8 +60,7 @@ et_cmp( return( 1 ); for ( i = 0; a->et_vals[i] && b->et_vals[i]; i++ ) { - if ( (rc = (*et_cmp_fn)( a->et_vals[i], b->et_vals[i] )) - != 0 ) { + if ( (rc = a->et_cmp_fn( a->et_vals[i], b->et_vals[i] )) != 0 ) { return( rc ); } } @@ -96,6 +95,7 @@ ldap_sort_entries( e = *chain; for ( i = 0; i < count; i++ ) { + et[i].et_cmp_fn = cmp; et[i].et_msg = e; if ( attr == NULL ) { char *dn; @@ -111,7 +111,6 @@ ldap_sort_entries( } last = e; - et_cmp_fn = cmp; qsort( et, count, sizeof(struct entrything), et_cmp ); ep = chain; diff --git a/libraries/libldap/tmplout.c b/libraries/libldap/tmplout.c index 372f427f25..94cc00c139 100644 --- a/libraries/libldap/tmplout.c +++ b/libraries/libldap/tmplout.c @@ -874,6 +874,7 @@ time2text( char *ldtimestr, int dateonly ) struct tm t; char *p, *timestr, zone, *fmterr = "badly formatted time"; time_t gmttime; + char timebuf[32]; memset( (char *)&t, 0, sizeof( struct tm )); if ( (int) strlen( ldtimestr ) < 13 ) { @@ -899,8 +900,9 @@ time2text( char *ldtimestr, int dateonly ) } gmttime = gtime( &t ); - timestr = ctime( &gmttime ); + timestr = ldap_int_ctime( &gmttime, timebuf ); + timestr[ strlen( timestr ) - 1 ] = zone; /* replace trailing newline */ if ( dateonly ) { strcpy( timestr + 11, timestr + 20 ); diff --git a/libraries/libldap/util-int.c b/libraries/libldap/util-int.c new file mode 100644 index 0000000000..cdf99790c3 --- /dev/null +++ b/libraries/libldap/util-int.c @@ -0,0 +1,141 @@ +/* + * util-int.c Various functions to replace missing threadsafe ones. + * Without the real *_r funcs, things will work, but won't be + * threadsafe. + * + * Written by Bart Hartgers. + * + * Copyright 1998, A. Hartgers, All rights reserved. + * This software is not subject to any license of Eindhoven University of + * Technology, since it was written in my spare time. + * + * Redistribution and use in source and binary forms are permitted only + * as authorized by the OpenLDAP Public License. A copy of this + * license is available at http://www.OpenLDAP.org/license.html or + * in file LICENSE in the top-level directory of the distribution. + */ + +#include "portable.h" + +#include + +#include +#include +#include +#include + +#include "ldap-int.h" + +char *ldap_int_strtok( char *str, const char *delim, char **pos ) +{ +#ifdef HAVE_STRTOK_R + return strtok_r(str, delim, pos); +#else + return strtok(str, delim); +#endif +} + +char *ldap_int_ctime( const time_t *tp, char *buf ) +{ +#ifdef HAVE_CTIME_R + return ctime_r(tp,buf); +#else + return ctime(tp); +#endif +} + +#define BUFSTART 1024 +#define BUFMAX (32*1024) + +static char *safe_realloc( char **buf, int len ) +{ + char *tmpbuf; + tmpbuf = realloc( *buf, len ); + if (tmpbuf) { + *buf=tmpbuf; + } + return tmpbuf; +} + +int ldap_int_gethostbyname_a( + const char *name, + struct hostent *resbuf, + char **buf, + struct hostent **result, + int *herrno_ptr ) +{ +#ifdef HAVE_GETHOSTBYNAME_R + int r; + int buflen=BUFSTART; + + if (safe_realloc( buf, buflen)) { + for(;buflen