diff --git a/aclocal.m4 b/aclocal.m4 index f033b4c5a6..73203f1438 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -506,193 +506,3 @@ AC_DEFUN(AM_TYPE_PTRDIFF_T, fi ]) -#serial 4 - -dnl From Jim Meyering. -dnl FIXME: this should migrate into libit. - -AC_DEFUN(AM_FUNC_MKTIME, -[AC_REQUIRE([AC_HEADER_TIME])dnl - AC_CHECK_HEADERS(sys/time.h unistd.h) - AC_CHECK_FUNCS(alarm) - AC_CACHE_CHECK([for working mktime], am_cv_func_working_mktime, - [AC_TRY_RUN( -changequote(<<, >>)dnl -< -# include -#else -# if HAVE_SYS_TIME_H -# include -# else -# include -# endif -#endif - -#if HAVE_UNISTD_H -# include -#endif - -#if !HAVE_ALARM -# define alarm(X) /* empty */ -#endif - -/* Work around redefinition to rpl_putenv by other config tests. */ -#undef putenv - -static time_t time_t_max; - -/* Values we'll use to set the TZ environment variable. */ -static const char *const tz_strings[] = { - (const char *) 0, "GMT0", "JST-9", - "EST+3EDT+2,M10.1.0/00:00:00,M2.3.0/00:00:00" -}; -#define N_STRINGS (sizeof (tz_strings) / sizeof (tz_strings[0])) - -static void -mktime_test (now) - time_t now; -{ - struct tm *lt; - if ((lt = localtime (&now)) && mktime (lt) != now) - exit (1); - now = time_t_max - now; - if ((lt = localtime (&now)) && mktime (lt) != now) - exit (1); -} - -static void -irix_6_4_bug () -{ - /* Based on code from Ariel Faigon. */ - struct tm tm; - tm.tm_year = 96; - tm.tm_mon = 3; - tm.tm_mday = 0; - tm.tm_hour = 0; - tm.tm_min = 0; - tm.tm_sec = 0; - tm.tm_isdst = -1; - mktime (&tm); - if (tm.tm_mon != 2 || tm.tm_mday != 31) - exit (1); -} - -static void -bigtime_test (j) - int j; -{ - struct tm tm; - time_t now; - tm.tm_year = tm.tm_mon = tm.tm_mday = tm.tm_hour = tm.tm_min = tm.tm_sec = j; - /* This test makes some buggy mktime implementations loop. - Give up after 10 seconds. */ - alarm (10); - now = mktime (&tm); - alarm (0); - if (now != (time_t) -1) - { - struct tm *lt = localtime (&now); - if (! (lt - && lt->tm_year == tm.tm_year - && lt->tm_mon == tm.tm_mon - && lt->tm_mday == tm.tm_mday - && lt->tm_hour == tm.tm_hour - && lt->tm_min == tm.tm_min - && lt->tm_sec == tm.tm_sec - && lt->tm_yday == tm.tm_yday - && lt->tm_wday == tm.tm_wday - && ((lt->tm_isdst < 0 ? -1 : 0 < lt->tm_isdst) - == (tm.tm_isdst < 0 ? -1 : 0 < tm.tm_isdst)))) - exit (1); - } -} - -int -main () -{ - time_t t, delta; - int i, j; - - for (time_t_max = 1; 0 < time_t_max; time_t_max *= 2) - continue; - time_t_max--; - delta = time_t_max / 997; /* a suitable prime number */ - for (i = 0; i < N_STRINGS; i++) - { - if (tz_strings[i]) - putenv (tz_strings[i]); - - for (t = 0; t <= time_t_max - delta; t += delta) - mktime_test (t); - mktime_test ((time_t) 60 * 60); - mktime_test ((time_t) 60 * 60 * 24); - - for (j = 1; 0 < j; j *= 2) - bigtime_test (j); - bigtime_test (j - 1); - } - irix_6_4_bug (); - exit (0); -} - >>, -changequote([, ])dnl - am_cv_func_working_mktime=yes, am_cv_func_working_mktime=no, - dnl When crosscompiling, assume mktime is missing or broken. - am_cv_func_working_mktime=no) - ]) - if test $am_cv_func_working_mktime = no; then - LIBOBJS="$LIBOBJS mktime.o" - fi -]) - - - - - - - - -AC_DEFUN(AM_FUNC_STRTOD, -[AC_CACHE_CHECK(for working strtod, am_cv_func_strtod, -[AC_TRY_RUN([ -double strtod (); -int -main() -{ - { - /* Some versions of Linux strtod mis-parse strings with leading '+'. */ - char *string = " +69"; - char *term; - double value; - value = strtod (string, &term); - if (value != 69 || term != (string + 4)) - exit (1); - } - - { - /* Under Solaris 2.4, strtod returns the wrong value for the - terminating character under some conditions. */ - char *string = "NaN"; - char *term; - strtod (string, &term); - if (term != string && *(term - 1) == 0) - exit (1); - } - exit (0); -} -], am_cv_func_strtod=yes, am_cv_func_strtod=no, am_cv_func_strtod=no)]) -test $am_cv_func_strtod = no && LIBOBJS="$LIBOBJS strtod.o" -AC_SUBST(LIBOBJS)dnl -am_cv_func_strtod_needs_libm=no -if test $am_cv_func_strtod = no; then - AC_CHECK_FUNCS(pow) - if test $ac_cv_func_pow = no; then - AC_CHECK_LIB(m, pow, [am_cv_func_strtod_needs_libm=yes], - [AC_MSG_WARN(can't find library containing definition of pow)]) - fi -fi -]) - diff --git a/clients/ud/util.c b/clients/ud/util.c index 184cfc8fcc..32e21619c5 100644 --- a/clients/ud/util.c +++ b/clients/ud/util.c @@ -281,7 +281,7 @@ format( char *str, int width, int lead ) */ s = original = strdup(str); for (;;) { - if ((strlen(s) + lead) < width) { + if (((int) strlen(s) + lead) < width) { printf("%s%s\n", leader, s); Free(leader); Free(original); @@ -352,7 +352,7 @@ format2( i = ""; /* now do the first line */ - if ((strlen(s) + strlen(first_tag) + first_indent) < width) { + if (((int) strlen(s) + (int) strlen(first_tag) + first_indent) < width) { printf("%s%s%s\n", fi, first_tag, s); Free(fi); Free(i); @@ -391,7 +391,7 @@ format2( /* now do all of the other lines */ for (;;) { - if ((strlen(s) + strlen(tag) + indent) < width) { + if (((int) strlen(s) + (int) strlen(tag) + indent) < width) { printf("%s%s%s\n", i, tag, s); Free(fi); Free(i); diff --git a/configure b/configure index c88b431173..ea09bc41a1 100755 --- a/configure +++ b/configure @@ -756,7 +756,7 @@ fi PACKAGE=OpenLDAP -VERSION=2.0-devel +VERSION=1.1-alpha3 if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then { echo "configure: error: source directory already configured; run "make distclean" there first" 1>&2; exit 1; } @@ -6497,24 +6497,26 @@ for ac_hdr in \ sys/resource.h \ sys/socket.h \ sys/syslog.h \ + sys/time.h \ sys/types.h \ syslog.h \ termios.h \ + unistd.h \ do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:6508: checking for $ac_hdr" >&5 +echo "configure:6510: 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:6518: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:6520: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then rm -rf conftest* @@ -6542,12 +6544,12 @@ done echo $ac_n "checking for uid_t in sys/types.h""... $ac_c" 1>&6 -echo "configure:6546: checking for uid_t in sys/types.h" >&5 +echo "configure:6548: 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 @@ -6576,7 +6578,7 @@ EOF fi echo $ac_n "checking type of array argument to getgroups""... $ac_c" 1>&6 -echo "configure:6580: checking type of array argument to getgroups" >&5 +echo "configure:6582: 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 @@ -6584,7 +6586,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:6615: \"$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 @@ -6623,7 +6625,7 @@ fi if test $ac_cv_type_getgroups = cross; then cat > conftest.$ac_ext < EOF @@ -6646,12 +6648,12 @@ cat >> confdefs.h <&6 -echo "configure:6650: checking for mode_t" >&5 +echo "configure:6652: 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 @@ -6679,12 +6681,12 @@ EOF fi echo $ac_n "checking for off_t""... $ac_c" 1>&6 -echo "configure:6683: checking for off_t" >&5 +echo "configure:6685: 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 @@ -6712,12 +6714,12 @@ EOF fi echo $ac_n "checking for pid_t""... $ac_c" 1>&6 -echo "configure:6716: checking for pid_t" >&5 +echo "configure:6718: 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 @@ -6745,19 +6747,19 @@ EOF fi echo $ac_n "checking for ptrdiff_t""... $ac_c" 1>&6 -echo "configure:6749: checking for ptrdiff_t" >&5 +echo "configure:6751: 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:6761: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:6763: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* am_cv_type_ptrdiff_t=yes else @@ -6778,12 +6780,12 @@ EOF fi echo $ac_n "checking return type of signal handlers""... $ac_c" 1>&6 -echo "configure:6782: checking return type of signal handlers" >&5 +echo "configure:6784: 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 @@ -6800,7 +6802,7 @@ int main() { int i; ; return 0; } EOF -if { (eval echo configure:6804: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:6806: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_type_signal=void else @@ -6819,12 +6821,12 @@ EOF echo $ac_n "checking for size_t""... $ac_c" 1>&6 -echo "configure:6823: checking for size_t" >&5 +echo "configure:6825: 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 @@ -6852,12 +6854,12 @@ EOF fi echo $ac_n "checking for st_blksize in struct stat""... $ac_c" 1>&6 -echo "configure:6856: checking for st_blksize in struct stat" >&5 +echo "configure:6858: 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 @@ -6865,7 +6867,7 @@ int main() { struct stat s; s.st_blksize; ; return 0; } EOF -if { (eval echo configure:6869: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:6871: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_struct_st_blksize=yes else @@ -6886,12 +6888,12 @@ EOF fi echo $ac_n "checking whether time.h and sys/time.h may both be included""... $ac_c" 1>&6 -echo "configure:6890: checking whether time.h and sys/time.h may both be included" >&5 +echo "configure:6892: 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 @@ -6900,7 +6902,7 @@ int main() { struct tm *tp; ; return 0; } EOF -if { (eval echo configure:6904: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:6906: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_header_time=yes else @@ -6921,12 +6923,12 @@ EOF fi echo $ac_n "checking whether struct tm is in sys/time.h or time.h""... $ac_c" 1>&6 -echo "configure:6925: checking whether struct tm is in sys/time.h or time.h" >&5 +echo "configure:6927: 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 @@ -6934,7 +6936,7 @@ int main() { struct tm *tp; tp->tm_sec; ; return 0; } EOF -if { (eval echo configure:6938: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:6940: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_struct_tm=time.h else @@ -6957,7 +6959,7 @@ fi echo $ac_n "checking if toupper() requires islower()""... $ac_c" 1>&6 -echo "configure:6961: checking if toupper() requires islower()" >&5 +echo "configure:6963: 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 @@ -6966,7 +6968,7 @@ else ol_cv_c_upper_lower=safe else cat > conftest.$ac_ext < @@ -6978,7 +6980,7 @@ main() exit(1); } EOF -if { (eval echo configure:6982: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +if { (eval echo configure:6984: \"$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 @@ -7001,12 +7003,12 @@ EOF fi echo $ac_n "checking for working const""... $ac_c" 1>&6 -echo "configure:7005: checking for working const" >&5 +echo "configure:7007: 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:7061: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_c_const=yes else @@ -7083,14 +7085,14 @@ EOF else echo $ac_n "checking whether byte ordering is bigendian""... $ac_c" 1>&6 -echo "configure:7087: checking whether byte ordering is bigendian" >&5 +echo "configure:7089: 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 @@ -7101,11 +7103,11 @@ int main() { #endif ; return 0; } EOF -if { (eval echo configure:7105: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:7107: \"$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 @@ -7116,7 +7118,7 @@ int main() { #endif ; return 0; } EOF -if { (eval echo configure:7120: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:7122: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_c_bigendian=yes else @@ -7136,7 +7138,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:7155: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null then ac_cv_c_bigendian=no else @@ -7173,7 +7175,7 @@ EOF fi echo $ac_n "checking size of short""... $ac_c" 1>&6 -echo "configure:7177: checking size of short" >&5 +echo "configure:7179: 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 @@ -7181,7 +7183,7 @@ else { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } else cat > conftest.$ac_ext < main() @@ -7192,7 +7194,7 @@ main() exit(0); } EOF -if { (eval echo configure:7196: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +if { (eval echo configure:7198: \"$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 @@ -7212,7 +7214,7 @@ EOF echo $ac_n "checking size of int""... $ac_c" 1>&6 -echo "configure:7216: checking size of int" >&5 +echo "configure:7218: 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 @@ -7220,7 +7222,7 @@ else { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } else cat > conftest.$ac_ext < main() @@ -7231,7 +7233,7 @@ main() exit(0); } EOF -if { (eval echo configure:7235: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +if { (eval echo configure:7237: \"$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 @@ -7251,7 +7253,7 @@ EOF echo $ac_n "checking size of long""... $ac_c" 1>&6 -echo "configure:7255: checking size of long" >&5 +echo "configure:7257: 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 @@ -7259,7 +7261,7 @@ else { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } else cat > conftest.$ac_ext < main() @@ -7270,7 +7272,7 @@ main() exit(0); } EOF -if { (eval echo configure:7274: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +if { (eval echo configure:7276: \"$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 @@ -7292,7 +7294,7 @@ EOF fi echo $ac_n "checking for 8-bit clean memcmp""... $ac_c" 1>&6 -echo "configure:7296: checking for 8-bit clean memcmp" >&5 +echo "configure:7298: 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 @@ -7300,7 +7302,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:7316: \"$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 @@ -7327,259 +7329,13 @@ fi echo "$ac_t""$ac_cv_func_memcmp_clean" 1>&6 test $ac_cv_func_memcmp_clean = no && LIBOBJS="$LIBOBJS memcmp.o" - for ac_hdr in sys/time.h unistd.h -do -ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` -echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:7335: 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:7345: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out` -if test -z "$ac_err"; then - rm -rf conftest* - eval "ac_cv_header_$ac_safe=yes" -else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_header_$ac_safe=no" -fi -rm -f conftest* -fi -if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then - echo "$ac_t""yes" 1>&6 - ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` - cat >> confdefs.h <&6 -fi -done - - for ac_func in alarm -do -echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:7374: 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:7402: \"$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 - - echo $ac_n "checking for working mktime""... $ac_c" 1>&6 -echo "configure:7427: checking for working mktime" >&5 -if eval "test \"`echo '$''{'am_cv_func_working_mktime'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - if test "$cross_compiling" = yes; then - am_cv_func_working_mktime=no -else - cat > conftest.$ac_ext < -# include -#else -# if HAVE_SYS_TIME_H -# include -# else -# include -# endif -#endif - -#if HAVE_UNISTD_H -# include -#endif - -#if !HAVE_ALARM -# define alarm(X) /* empty */ -#endif - -/* Work around redefinition to rpl_putenv by other config tests. */ -#undef putenv - -static time_t time_t_max; - -/* Values we'll use to set the TZ environment variable. */ -static const char *const tz_strings[] = { - (const char *) 0, "GMT0", "JST-9", - "EST+3EDT+2,M10.1.0/00:00:00,M2.3.0/00:00:00" -}; -#define N_STRINGS (sizeof (tz_strings) / sizeof (tz_strings[0])) - -static void -mktime_test (now) - time_t now; -{ - struct tm *lt; - if ((lt = localtime (&now)) && mktime (lt) != now) - exit (1); - now = time_t_max - now; - if ((lt = localtime (&now)) && mktime (lt) != now) - exit (1); -} - -static void -irix_6_4_bug () -{ - /* Based on code from Ariel Faigon. */ - struct tm tm; - tm.tm_year = 96; - tm.tm_mon = 3; - tm.tm_mday = 0; - tm.tm_hour = 0; - tm.tm_min = 0; - tm.tm_sec = 0; - tm.tm_isdst = -1; - mktime (&tm); - if (tm.tm_mon != 2 || tm.tm_mday != 31) - exit (1); -} - -static void -bigtime_test (j) - int j; -{ - struct tm tm; - time_t now; - tm.tm_year = tm.tm_mon = tm.tm_mday = tm.tm_hour = tm.tm_min = tm.tm_sec = j; - /* This test makes some buggy mktime implementations loop. - Give up after 10 seconds. */ - alarm (10); - now = mktime (&tm); - alarm (0); - if (now != (time_t) -1) - { - struct tm *lt = localtime (&now); - if (! (lt - && lt->tm_year == tm.tm_year - && lt->tm_mon == tm.tm_mon - && lt->tm_mday == tm.tm_mday - && lt->tm_hour == tm.tm_hour - && lt->tm_min == tm.tm_min - && lt->tm_sec == tm.tm_sec - && lt->tm_yday == tm.tm_yday - && lt->tm_wday == tm.tm_wday - && ((lt->tm_isdst < 0 ? -1 : 0 < lt->tm_isdst) - == (tm.tm_isdst < 0 ? -1 : 0 < tm.tm_isdst)))) - exit (1); - } -} - -int -main () -{ - time_t t, delta; - int i, j; - - for (time_t_max = 1; 0 < time_t_max; time_t_max *= 2) - continue; - time_t_max--; - delta = time_t_max / 997; /* a suitable prime number */ - for (i = 0; i < N_STRINGS; i++) - { - if (tz_strings[i]) - putenv (tz_strings[i]); - - for (t = 0; t <= time_t_max - delta; t += delta) - mktime_test (t); - mktime_test ((time_t) 60 * 60); - mktime_test ((time_t) 60 * 60 * 24); - - for (j = 1; 0 < j; j *= 2) - bigtime_test (j); - bigtime_test (j - 1); - } - irix_6_4_bug (); - exit (0); -} - -EOF -if { (eval echo configure:7558: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null -then - am_cv_func_working_mktime=yes -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -fr conftest* - am_cv_func_working_mktime=no -fi -rm -fr conftest* -fi - - -fi - -echo "$ac_t""$am_cv_func_working_mktime" 1>&6 - if test $am_cv_func_working_mktime = no; then - LIBOBJS="$LIBOBJS mktime.o" - fi - echo $ac_n "checking for strftime""... $ac_c" 1>&6 -echo "configure:7578: checking for strftime" >&5 +echo $ac_n "checking for strftime""... $ac_c" 1>&6 +echo "configure:7334: 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:7362: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_strftime=yes" else @@ -7624,7 +7380,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:7628: checking for strftime in -lintl" >&5 +echo "configure:7384: 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 @@ -7632,7 +7388,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:7403: \"$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 @@ -7669,170 +7425,13 @@ fi fi -echo $ac_n "checking for working strtod""... $ac_c" 1>&6 -echo "configure:7674: checking for working strtod" >&5 -if eval "test \"`echo '$''{'am_cv_func_strtod'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - if test "$cross_compiling" = yes; then - am_cv_func_strtod=no -else - cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null -then - am_cv_func_strtod=yes -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -fr conftest* - am_cv_func_strtod=no -fi -rm -fr conftest* -fi - -fi - -echo "$ac_t""$am_cv_func_strtod" 1>&6 -test $am_cv_func_strtod = no && LIBOBJS="$LIBOBJS strtod.o" -am_cv_func_strtod_needs_libm=no -if test $am_cv_func_strtod = no; then - for ac_func in pow -do -echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:7733: 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:7761: \"$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 - - if test $ac_cv_func_pow = no; then - echo $ac_n "checking for pow in -lm""... $ac_c" 1>&6 -echo "configure:7787: checking for pow in -lm" >&5 -ac_lib_var=`echo m'_'pow | sed 'y%./+-%__p_%'` -if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - ac_save_LIBS="$LIBS" -LIBS="-lm $LIBS" -cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then - rm -rf conftest* - eval "ac_cv_lib_$ac_lib_var=yes" -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_lib_$ac_lib_var=no" -fi -rm -f conftest* -LIBS="$ac_save_LIBS" - -fi -if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then - echo "$ac_t""yes" 1>&6 - am_cv_func_strtod_needs_libm=yes -else - echo "$ac_t""no" 1>&6 -echo "configure: warning: can't find library containing definition of pow" 1>&2 -fi - - fi -fi - echo $ac_n "checking for vprintf""... $ac_c" 1>&6 -echo "configure:7831: checking for vprintf" >&5 +echo "configure:7430: 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:7458: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_vprintf=yes" else @@ -7879,12 +7478,12 @@ fi if test "$ac_cv_func_vprintf" != yes; then echo $ac_n "checking for _doprnt""... $ac_c" 1>&6 -echo "configure:7883: checking for _doprnt" >&5 +echo "configure:7482: 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:7510: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func__doprnt=yes" else @@ -7936,12 +7535,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:7940: checking for $ac_func" >&5 +echo "configure:7539: 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:7567: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -7991,7 +7590,7 @@ done fi echo $ac_n "checking for wait3 that fills in rusage""... $ac_c" 1>&6 -echo "configure:7995: checking for wait3 that fills in rusage" >&5 +echo "configure:7594: 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 @@ -7999,7 +7598,7 @@ else ac_cv_func_wait3_rusage=no else cat > conftest.$ac_ext < #include @@ -8030,7 +7629,7 @@ main() { } } EOF -if { (eval echo configure:8034: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +if { (eval echo configure:7633: \"$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 @@ -8085,12 +7684,12 @@ for ac_func in \ do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:8089: checking for $ac_func" >&5 +echo "configure:7688: 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:7716: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -8141,12 +7740,12 @@ done for ac_func in getopt strdup tempnam do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:8145: checking for $ac_func" >&5 +echo "configure:7744: 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:7772: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -8199,13 +7798,13 @@ done # Check Configuration echo $ac_n "checking declaration of sys_errlist""... $ac_c" 1>&6 -echo "configure:8203: checking declaration of sys_errlist" >&5 +echo "configure:7802: 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 < @@ -8215,7 +7814,7 @@ int main() { char *c = (char *) *sys_errlist ; return 0; } EOF -if { (eval echo configure:8219: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:7818: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ol_cv_dcl_sys_errlist=yes else @@ -8236,20 +7835,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:8240: checking existence of sys_errlist" >&5 +echo "configure:7839: 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:8253: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:7852: \"$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 a1bbfe9b8b..1d33ab5c5d 100644 --- a/configure.in +++ b/configure.in @@ -966,9 +966,11 @@ AC_CHECK_HEADERS( \ sys/resource.h \ sys/socket.h \ sys/syslog.h \ + sys/time.h \ sys/types.h \ syslog.h \ termios.h \ + unistd.h \ ) dnl ---------------------------------------------------------------- @@ -999,9 +1001,9 @@ fi dnl ---------------------------------------------------------------- dnl Checks for library functions. AC_FUNC_MEMCMP -AM_FUNC_MKTIME dnl checks for sys/time.h and unistd.h +dnl AM_FUNC_MKTIME dnl checks for sys/time.h and unistd.h AC_FUNC_STRFTIME -AM_FUNC_STRTOD +dnl AM_FUNC_STRTOD AC_FUNC_VPRINTF if test $ac_cv_func_vprintf = yes ; then diff --git a/doc/devel/todo b/doc/devel/todo index cac3e5bafb..28a31dd4d2 100644 --- a/doc/devel/todo +++ b/doc/devel/todo @@ -18,18 +18,20 @@ Larger than life projects LDAPv3 support LDAP C API (draft-ietf-ldapext-ldap-c-api-xx) support Schema Repository -Modify -lldap to be operation-level multithreaded Large projects -------------- redesign slapd threading autoconf support Modify -lldap to be session-level multithreaded +Port slapd (incl back-ldbm & tools) to NT Medium projects --------------- Modify -lldap to be reentrant/threadsafe +Modify -llthread to have private interface +Port slurpd to NT Small projects diff --git a/include/ac/string.h b/include/ac/string.h index 2b407e7eb3..6a64074e6f 100644 --- a/include/ac/string.h +++ b/include/ac/string.h @@ -28,8 +28,8 @@ # endif # ifndef HAVE_MEMCPY -# define memcpy(d, s, n) bcopy ((s), (d), (n)) -# define memmove(d, s, n) bcopy ((s), (d), (n)) +# define memcpy(d, s, n) ((void) bcopy ((s), (d), (n))) +# define memmove(d, s, n) ((void) bcopy ((s), (d), (n))) # endif #endif @@ -37,13 +37,13 @@ /* strdup() is missing, declare our own version */ extern char *strdup( const char *s ); #else - /* some systems fail to declare strdup altogether */ + /* some systems have strdup, but fail to declare it */ extern char *strdup(); #endif /* * some systems fail to declare strcasecmp() and strncasecmp() - * we need them defined so we obtain pointers to them + * we need them declared so we can obtain pointers to them */ extern int strcasecmp(), strncasecmp(); diff --git a/include/ac/unistd.h b/include/ac/unistd.h index ac061fc775..0e2f40acd2 100644 --- a/include/ac/unistd.h +++ b/include/ac/unistd.h @@ -14,6 +14,8 @@ /* crypt() may be defined in a separate include file */ #if HAVE_CRYPT_H # include +#else + extern char *crypt(); #endif /* getopt() defines may be in separate include file */ diff --git a/include/lthread.h b/include/lthread.h index f6242faf86..b97398dd08 100644 --- a/include/lthread.h +++ b/include/lthread.h @@ -119,8 +119,6 @@ typedef void *(*VFP)(); #define PTHREAD_SHARE_PRIVATE USYNC_THREAD #define PTHREAD_SHARE_PROCESS USYNC_PROCESS - -#if !defined(__SunOS_5_6) /* thread attributes and thread type */ typedef int pthread_attr_t; typedef thread_t pthread_t; @@ -132,7 +130,6 @@ typedef mutex_t pthread_mutex_t; /* condition variable attributes and condition variable type */ typedef int pthread_condattr_t; typedef cond_t pthread_cond_t; -#endif /* ! sunos56 */ LDAP_END_DECL diff --git a/include/portable.h.in b/include/portable.h.in index 30b1dbf8cc..92423c05a2 100644 --- a/include/portable.h.in +++ b/include/portable.h.in @@ -278,9 +278,6 @@ is provided ``as is'' without express or implied warranty. /* The number of bytes in a short. */ #undef SIZEOF_SHORT -/* Define if you have the alarm function. */ -#undef HAVE_ALARM - /* Define if you have the bcopy function. */ #undef HAVE_BCOPY @@ -314,9 +311,6 @@ is provided ``as is'' without express or implied warranty. /* Define if you have the mkstemp function. */ #undef HAVE_MKSTEMP -/* Define if you have the pow function. */ -#undef HAVE_POW - /* Define if you have the pthread_attr_create function. */ #undef HAVE_PTHREAD_ATTR_CREATE diff --git a/libraries/liblber/dtest.c b/libraries/liblber/dtest.c index 48d8823489..6c9a33727f 100644 --- a/libraries/liblber/dtest.c +++ b/libraries/liblber/dtest.c @@ -59,7 +59,7 @@ main( int argc, char **argv ) fprintf( stderr, "ber_scanf returns -1\n" ); exit( 1 ); } - printf( "got int %d\n", i ); + printf( "got int %ld\n", i ); return( 0 ); } diff --git a/libraries/libldap/result.c b/libraries/libldap/result.c index f8b0f31a2f..e5b4baaee5 100644 --- a/libraries/libldap/result.c +++ b/libraries/libldap/result.c @@ -151,7 +151,7 @@ wait4msg( LDAP *ld, int msgid, int all, struct timeval *timeout, 0, 0, 0 ); } else { Debug( LDAP_DEBUG_TRACE, "wait4msg (timeout %ld sec, %ld usec)\n", - timeout->tv_sec, timeout->tv_usec, 0 ); + (long) timeout->tv_sec, (long) timeout->tv_usec, 0 ); } #endif /* LDAP_DEBUG */ @@ -246,7 +246,7 @@ wait4msg( LDAP *ld, int msgid, int all, struct timeval *timeout, } Debug( LDAP_DEBUG_TRACE, "wait4msg: %ld secs to go\n", - tv.tv_sec, 0, 0 ); + (long) tv.tv_sec, 0, 0 ); start_time = tmp_time; } } diff --git a/libraries/liblutil/passwd.c b/libraries/liblutil/passwd.c index 89b45b92c3..869b56a345 100644 --- a/libraries/liblutil/passwd.c +++ b/libraries/liblutil/passwd.c @@ -44,7 +44,7 @@ lutil_passwd( ldap_MD5Init(&MD5context); ldap_MD5Update(&MD5context, - cred, strlen(cred)); + (const unsigned char *)cred, strlen(cred)); ldap_MD5Final(MD5digest, &MD5context); if ( b64_ntop(MD5digest, sizeof(MD5digest), @@ -63,7 +63,7 @@ lutil_passwd( ldap_SHA1Init(&SHA1context); ldap_SHA1Update(&SHA1context, - (unsigned char *) cred, strlen(cred)); + (const unsigned char *) cred, strlen(cred)); ldap_SHA1Final(SHA1digest, &SHA1context); if (b64_ntop(SHA1digest, sizeof(SHA1digest), diff --git a/libraries/liblutil/setproctitle.c b/libraries/liblutil/setproctitle.c index 0d7f04f881..2c26d10a12 100644 --- a/libraries/liblutil/setproctitle.c +++ b/libraries/liblutil/setproctitle.c @@ -6,13 +6,9 @@ #include #include -#if defined( HAVE_STDARG_H ) && __STDC__ -#include -#else -#include -#endif - #include +#include +#include /* * Copyright (c) 1990,1991 Regents of the University of Michigan. @@ -36,7 +32,7 @@ int Argc; /* original argc */ /* VARARGS */ void setproctitle -#if defined( HAVE_STDARG_H ) && __STDC__ +#if defined( HAVE_STDARG ) ( const char *fmt, ... ) #else ( fmt, va_alist ) @@ -50,7 +46,7 @@ va_dcl char buf[ 1024 ]; va_list ap; -#if defined( HAVE_STDARG_H ) && __STDC__ +#if defined( HAVE_STDARG ) va_start(ap, fmt); #else va_start(ap); diff --git a/servers/slapd/acl.c b/servers/slapd/acl.c index 5bb093fea9..7c922782fc 100644 --- a/servers/slapd/acl.c +++ b/servers/slapd/acl.c @@ -72,8 +72,8 @@ access_allowed( if (a) { for (i = 0; i < MAXREMATCHES && matches[i].rm_so > 0; i++) { - Debug( LDAP_DEBUG_ARGS, "=> match[%d]: %d %d ", - i, matches[i].rm_so, matches[i].rm_eo ); + Debug( LDAP_DEBUG_ARGS, "=> match[%d]: %d %d ", i, + (int)matches[i].rm_so, (int)matches[i].rm_eo ); if( matches[i].rm_so <= matches[0].rm_eo ) { for ( n = matches[i].rm_so; n < matches[i].rm_eo; n++) { @@ -129,7 +129,7 @@ acl_get_applicable( for ( i = 1, a = be->be_acl; a != NULL; a = a->acl_next, i++ ) { if (a->acl_dnpat != NULL) { Debug( LDAP_DEBUG_TRACE, "=> dnpat: [%d] %s nsub: %d\n", - i, a->acl_dnpat, a->acl_dnre.re_nsub); + i, a->acl_dnpat, (int) a->acl_dnre.re_nsub); if (regexec(&a->acl_dnre, edn, nmatch, matches, 0)) continue; @@ -160,7 +160,7 @@ acl_get_applicable( for ( i = 1, a = global_acl; a != NULL; a = a->acl_next, i++ ) { if (a->acl_dnpat != NULL) { Debug( LDAP_DEBUG_TRACE, "=> dnpat: [%d] %s nsub: %d\n", - i, a->acl_dnpat, a->acl_dnre.re_nsub); + i, a->acl_dnpat, (int) a->acl_dnre.re_nsub); if (regexec(&a->acl_dnre, edn, nmatch, matches, 0)) { continue; @@ -478,7 +478,7 @@ string_expand( newbuf[0] = '\0'; flag = 0; - for ( dp = newbuf, sp = pat; size < 512 && *sp ; sp++) { + for ( dp = newbuf, sp = pat; size < bufsiz && *sp ; sp++) { /* did we previously see a $ */ if (flag) { if (*sp == '$') { diff --git a/servers/slapd/back-ldbm/add.c b/servers/slapd/back-ldbm/add.c index 75dd12b1b2..77c92d220a 100644 --- a/servers/slapd/back-ldbm/add.c +++ b/servers/slapd/back-ldbm/add.c @@ -82,7 +82,6 @@ ldbm_back_add( if ( (pdn = dn_parent( be, dn )) != NULL ) { char *matched; /* no parent */ - matched = NULL; /* get entry with reader lock */ if ( (p = dn2entry_r( be, pdn, &matched )) == NULL ) { @@ -90,6 +89,7 @@ ldbm_back_add( 0, 0 ); send_ldap_result( conn, op, LDAP_NO_SUCH_OBJECT, matched, "" ); + if ( matched != NULL ) { free( matched ); } @@ -97,9 +97,6 @@ ldbm_back_add( rc = -1; goto return_results; } - if ( matched != NULL ) { - free( matched ); - } if ( ! access_allowed( be, conn, op, p, "children", NULL, op->o_dn, ACL_WRITE ) ) { diff --git a/servers/slapd/back-ldbm/alias.c b/servers/slapd/back-ldbm/alias.c index b7fbcf5328..92eca6c6df 100644 --- a/servers/slapd/back-ldbm/alias.c +++ b/servers/slapd/back-ldbm/alias.c @@ -113,7 +113,7 @@ char *derefDN ( Backend *be, { struct ldbminfo *li = (struct ldbminfo *) be->be_private; char *matched; - char *newDN; + char *newDN = NULL; int depth; Entry *eMatched; Entry *eDeref; @@ -135,7 +135,7 @@ char *derefDN ( Backend *be, /* free reader lock */ cache_return_entry_r(&li->li_cache, eMatched); - if (*matched) { + if ((matched != NULL) && *matched) { char *submatch; /* @@ -155,7 +155,9 @@ char *derefDN ( Backend *be, if ((eNew = derefAlias_r( be, conn, op, eMatched )) == NULL) { free (matched); + matched = NULL; free (newDN); + newDN = NULL; free (remainder); break; /* no associated entry, dont deref */ } @@ -166,7 +168,9 @@ char *derefDN ( Backend *be, if (!strcasecmp (matched, eNew->e_dn)) { /* newDN same as old so not an alias, no need to go further */ free (newDN); + newDN = NULL; free (matched); + matched = NULL; free (remainder); break; } @@ -176,13 +180,13 @@ char *derefDN ( Backend *be, * the new dn together */ free (newDN); - free (matched); - newDN = ch_malloc (strlen(eMatched->e_dn) + rlen + 1); strcpy (newDN, remainder); strcat (newDN, eMatched->e_dn); Debug( LDAP_DEBUG_TRACE, "<= expanded to %s\n", newDN, 0, 0 ); + free (matched); + matched = NULL; free (remainder); /* free reader lock */ @@ -226,10 +230,13 @@ char *derefDN ( Backend *be, send_ldap_result( conn, op, LDAP_ALIAS_PROBLEM, "", "Maximum alias dereference depth exceeded for base" ); } + + if (newDN == NULL) { + newDN = strdup ( dn ); + } Debug( LDAP_DEBUG_TRACE, "<= returning deref DN of %s\n", newDN, 0, 0 ); - - free(matched); + if (matched != NULL) free(matched); return newDN; } diff --git a/servers/slapd/back-ldbm/bind.c b/servers/slapd/back-ldbm/bind.c index 591e488c9c..cb59ab0349 100644 --- a/servers/slapd/back-ldbm/bind.c +++ b/servers/slapd/back-ldbm/bind.c @@ -126,7 +126,7 @@ ldbm_back_bind( Entry *e; Attribute *a; int rc; - char *matched = NULL; + char *matched; #ifdef HAVE_KERBEROS char krbname[MAX_K_NAME_SZ + 1]; AUTH_DAT ad; diff --git a/servers/slapd/back-ldbm/compare.c b/servers/slapd/back-ldbm/compare.c index d17c5da88a..29f654751c 100644 --- a/servers/slapd/back-ldbm/compare.c +++ b/servers/slapd/back-ldbm/compare.c @@ -29,6 +29,8 @@ ldbm_back_compare( /* get entry with reader lock */ if ( (e = dn2entry_r( be, dn, &matched )) == NULL ) { send_ldap_result( conn, op, LDAP_NO_SUCH_OBJECT, matched, "" ); + + if(matched == NULL) free(matched); return( 1 ); } diff --git a/servers/slapd/back-ldbm/delete.c b/servers/slapd/back-ldbm/delete.c index 7e0008ba80..64723229f9 100644 --- a/servers/slapd/back-ldbm/delete.c +++ b/servers/slapd/back-ldbm/delete.c @@ -20,7 +20,7 @@ ldbm_back_delete( ) { struct ldbminfo *li = (struct ldbminfo *) be->be_private; - char *matched = NULL; + char *matched; char *pdn = NULL; Entry *e, *p; @@ -66,7 +66,6 @@ ldbm_back_delete( /* XXX delete from parent's id2children entry XXX */ pdn = dn_parent( be, dn ); - matched = NULL; p = dn2entry_r( be, pdn, &matched ); if ( id2children_remove( be, p, e ) != 0 ) { send_ldap_result( conn, op, LDAP_OPERATIONS_ERROR, "","" ); @@ -93,9 +92,11 @@ ldbm_back_delete( /* free entry and writer lock */ cache_return_entry_w( &li->li_cache, e ); - if ( p ) + if ( p != NULL ) cache_return_entry_r( &li->li_cache, p ); + if ( matched != NULL ) free(matched); + send_ldap_result( conn, op, LDAP_SUCCESS, "", "" ); return( 0 ); @@ -104,8 +105,10 @@ error_return:; /* free entry and writer lock */ cache_return_entry_w( &li->li_cache, e ); - if( p ) + if( p != NULL ) cache_return_entry_r( &li->li_cache, p ); + if ( matched != NULL ) free(matched); + return( -1 ); } diff --git a/servers/slapd/back-ldbm/dn2id.c b/servers/slapd/back-ldbm/dn2id.c index 593107cc2c..ae0f62d8dd 100644 --- a/servers/slapd/back-ldbm/dn2id.c +++ b/servers/slapd/back-ldbm/dn2id.c @@ -166,18 +166,19 @@ dn2entry( { struct ldbminfo *li = (struct ldbminfo *) be->be_private; ID id; - Entry *e; + Entry *e = NULL; char *pdn; Debug(LDAP_DEBUG_TRACE, "dn2entry_%s: dn: %s\n", rw ? "w" : "r", dn, 0); + *matched = NULL; + if ( (id = dn2id( be, dn )) != NOID && (e = id2entry( be, id, rw )) != NULL ) { return( e ); } - *matched = NULL; /* stop when we get to the suffix */ if ( be_issuffix( be, dn ) ) { @@ -199,19 +200,6 @@ dn2entry( return( NULL ); } -#if 0 - if (e->e_state == ENTRY_STATE_DELETED) - continue; - - if (strcmp(dn, e->e_dn) != 0) - continue; - - /* return locked entry entry */ - return(e); - } -} -#endif - Entry * dn2entry_r( Backend *be, diff --git a/servers/slapd/back-ldbm/group.c b/servers/slapd/back-ldbm/group.c index 7def923a4d..a889041c25 100644 --- a/servers/slapd/back-ldbm/group.c +++ b/servers/slapd/back-ldbm/group.c @@ -45,7 +45,8 @@ ldbm_back_group( free(matched); return( 1 ); } - Debug( LDAP_DEBUG_ARGS, "=> ldbm_back_group: found bdn: %s matched: %s\n", bdn, (matched ? matched : ""), 0 ); + + Debug( LDAP_DEBUG_ARGS, "=> ldbm_back_group: found bdn: %s\n", bdn, 0, 0 ); /* check for deleted */ diff --git a/servers/slapd/back-ldbm/modify.c b/servers/slapd/back-ldbm/modify.c index 7b0d141d0f..2f74c108f1 100644 --- a/servers/slapd/back-ldbm/modify.c +++ b/servers/slapd/back-ldbm/modify.c @@ -25,7 +25,7 @@ ldbm_back_modify( ) { struct ldbminfo *li = (struct ldbminfo *) be->be_private; - char *matched = NULL; + char *matched; Entry *e; int i, err; LDAPMod *mod; diff --git a/servers/slapd/back-ldbm/search.c b/servers/slapd/back-ldbm/search.c index 4b25fe66cd..65d78af635 100644 --- a/servers/slapd/back-ldbm/search.c +++ b/servers/slapd/back-ldbm/search.c @@ -49,7 +49,7 @@ ldbm_back_search( ID id; Entry *e; Attribute *ref; - char *matched = NULL; + char *matched; int rmaxsize, nrefs; char *rbuf, *rcur, *r; int nentries = 0; diff --git a/servers/slapd/connection.c b/servers/slapd/connection.c index 36fca0b705..2d630f4168 100644 --- a/servers/slapd/connection.c +++ b/servers/slapd/connection.c @@ -129,8 +129,8 @@ connection_activity( "ber_get_next on fd %d failed errno %d (%s)\n", conn->c_sb.sb_sd, errno, errno > -1 && errno < sys_nerr ? sys_errlist[errno] : "unknown" ); - Debug( LDAP_DEBUG_TRACE, "*** got %d of %lu so far\n", - conn->c_currentber->ber_rwptr - conn->c_currentber->ber_buf, + Debug( LDAP_DEBUG_TRACE, "*** got %ld of %lu so far\n", + (long)(conn->c_currentber->ber_rwptr - conn->c_currentber->ber_buf), conn->c_currentber->ber_len, 0 ); if ( errno != EWOULDBLOCK && errno != EAGAIN ) { diff --git a/servers/slapd/repl.c b/servers/slapd/repl.c index 4f46ec114d..ecea75af7a 100644 --- a/servers/slapd/repl.c +++ b/servers/slapd/repl.c @@ -44,7 +44,7 @@ replog( i++ ) { fprintf( fp, "replica: %s\n", be->be_replica[i] ); } - fprintf( fp, "time: %ld\n", currenttime ); + fprintf( fp, "time: %ld\n", (long) currenttime ); fprintf( fp, "dn: %s\n", dn ); switch ( optype ) { diff --git a/servers/slapd/schemaparse.c b/servers/slapd/schemaparse.c index 96e01f09b0..08640bda5e 100644 --- a/servers/slapd/schemaparse.c +++ b/servers/slapd/schemaparse.c @@ -36,9 +36,10 @@ parse_oc( do { i++; if ( i < argc ) { + char **s = str2charray( argv[i], "," ); last = argv[i][strlen( argv[i] ) - 1]; - charray_merge( &oc->oc_required, - str2charray( argv[i], "," ) ); + charray_merge( &oc->oc_required, s ); + charray_free( s ); } } while ( i < argc && last == ',' ); @@ -47,9 +48,11 @@ parse_oc( do { i++; if ( i < argc ) { + char **s = str2charray( argv[i], "," ); last = argv[i][strlen( argv[i] ) - 1]; - charray_merge( &oc->oc_allowed, - str2charray( argv[i], "," ) ); + + charray_merge( &oc->oc_allowed, s ); + charray_free( s ); } } while ( i < argc && last == ',' ); diff --git a/servers/slapd/tools/ldif2id2children.c b/servers/slapd/tools/ldif2id2children.c index 4c802e1f44..5e709dc9bc 100644 --- a/servers/slapd/tools/ldif2id2children.c +++ b/servers/slapd/tools/ldif2id2children.c @@ -270,6 +270,7 @@ main( int argc, char **argv ) data = ldbm_fetch( db->dbc_db, key ); + free( dn ); if ( data.dptr == NULL ) { dn_normalize( val ); if ( ! be_issuffix( be, diff --git a/servers/slapd/tools/sizecount.c b/servers/slapd/tools/sizecount.c index b21ddbce64..535243f330 100644 --- a/servers/slapd/tools/sizecount.c +++ b/servers/slapd/tools/sizecount.c @@ -3,7 +3,7 @@ #include #include #include -#include /* get unlink() */ +#include #include #include