浏览代码

Related: 207457
Summary: Add support for 64-bit counters (phase 1).

Nathan Kinder 17 年之前
父节点
当前提交
567be2b658
共有 57 个文件被更改,包括 2161 次插入920 次删除
  1. 5 0
      Makefile.am
  2. 263 187
      Makefile.in
  3. 299 162
      aclocal.m4
  4. 50 13
      config.guess
  5. 1 1
      config.h.in
  6. 68 31
      config.sub
  7. 663 146
      configure
  8. 59 5
      depcomp
  9. 266 82
      install-sh
  10. 6 6
      ldap/servers/plugins/acl/acl.c
  11. 16 0
      ldap/servers/plugins/acl/acl.h
  12. 2 2
      ldap/servers/plugins/acl/acl_ext.c
  13. 2 2
      ldap/servers/plugins/acl/aclanom.c
  14. 9 0
      ldap/servers/plugins/dna/dna.c
  15. 16 0
      ldap/servers/plugins/replication/repl.h
  16. 2 2
      ldap/servers/plugins/replication/repl5.h
  17. 3 2
      ldap/servers/plugins/replication/repl5_init.c
  18. 6 6
      ldap/servers/plugins/replication/repl5_replica.c
  19. 5 5
      ldap/servers/plugins/replication/repl5_total.c
  20. 2 2
      ldap/servers/plugins/replication/repl_connext.c
  21. 14 14
      ldap/servers/plugins/replication/repl_extop.c
  22. 46 14
      ldap/servers/plugins/replication/replutil.c
  23. 3 3
      ldap/servers/slapd/abandon.c
  24. 2 2
      ldap/servers/slapd/add.c
  25. 8 8
      ldap/servers/slapd/auth.c
  26. 16 0
      ldap/servers/slapd/back-ldbm/back-ldbm.h
  27. 2 2
      ldap/servers/slapd/back-ldbm/ldbm_delete.c
  28. 2 2
      ldap/servers/slapd/back-ldbm/ldbm_modrdn.c
  29. 2 2
      ldap/servers/slapd/back-ldbm/misc.c
  30. 4 4
      ldap/servers/slapd/bind.c
  31. 1 1
      ldap/servers/slapd/compare.c
  32. 44 46
      ldap/servers/slapd/connection.c
  33. 1 3
      ldap/servers/slapd/conntable.c
  34. 2 2
      ldap/servers/slapd/daemon.c
  35. 1 1
      ldap/servers/slapd/delete.c
  36. 2 2
      ldap/servers/slapd/extendop.c
  37. 1 2
      ldap/servers/slapd/fe.h
  38. 2 2
      ldap/servers/slapd/globals.c
  39. 5 2
      ldap/servers/slapd/init.c
  40. 4 4
      ldap/servers/slapd/modify.c
  41. 3 3
      ldap/servers/slapd/modrdn.c
  42. 2 2
      ldap/servers/slapd/opshared.c
  43. 2 2
      ldap/servers/slapd/pblock.c
  44. 1 1
      ldap/servers/slapd/plugin_internal_op.c
  45. 3 3
      ldap/servers/slapd/proto-slap.h
  46. 5 5
      ldap/servers/slapd/psearch.c
  47. 5 5
      ldap/servers/slapd/result.c
  48. 9 9
      ldap/servers/slapd/sasl_io.c
  49. 1 1
      ldap/servers/slapd/search.c
  50. 20 3
      ldap/servers/slapd/slap.h
  51. 12 0
      ldap/servers/slapd/slapi-plugin.h
  52. 3 0
      ldap/servers/slapd/snmp_collator.c
  53. 1 1
      ldap/servers/slapd/stubrepl.c
  54. 3 3
      ldap/servers/slapd/unbind.c
  55. 2 2
      ldap/servers/slapd/value.c
  56. 150 83
      ltmain.sh
  57. 34 27
      missing

+ 5 - 0
Makefile.am

@@ -516,6 +516,7 @@ libslapd_la_SOURCES = ldap/servers/slapd/add.c \
 	ldap/servers/slapd/schemaparse.c \
 	ldap/servers/slapd/security_wrappers.c \
 	ldap/servers/slapd/slapd_plhash.c \
+	ldap/servers/slapd/slapi_counter.c \
 	ldap/servers/slapd/slapi2nspr.c \
 	ldap/servers/slapd/snmp_collator.c \
 	ldap/servers/slapd/ssl.c \
@@ -533,6 +534,10 @@ libslapd_la_SOURCES = ldap/servers/slapd/add.c \
 	ldap/servers/slapd/vattr.c \
 	$(libavl_a_SOURCES)
 
+if SOLARIS
+libslapd_la_SOURCES += ldap/servers/slapd/slapi_counter_sunos_sparcv9.il
+endif
+
 libslapd_la_CPPFLAGS = $(PLUGIN_CPPFLAGS) @db_inc@ @svrcore_inc@
 libslapd_la_LIBADD = $(LDAPSDK_LINK) $(SASL_LINK) $(SVRCORE_LINK) $(NSS_LINK) $(NSPR_LINK)
 

文件差异内容过多而无法显示
+ 263 - 187
Makefile.in


文件差异内容过多而无法显示
+ 299 - 162
aclocal.m4


+ 50 - 13
config.guess

@@ -1,9 +1,10 @@
 #! /bin/sh
 # Attempt to guess a canonical system name.
 #   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
-#   2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
+#   2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation,
+#   Inc.
 
-timestamp='2005-07-08'
+timestamp='2006-07-02'
 
 # This file is free software; you can redistribute it and/or modify it
 # under the terms of the GNU General Public License as published by
@@ -106,7 +107,7 @@ set_cc_for_build='
 trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ;
 trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ;
 : ${TMPDIR=/tmp} ;
- { tmp=`(umask 077 && mktemp -d -q "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } ||
+ { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } ||
  { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } ||
  { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } ||
  { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ;
@@ -206,8 +207,11 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
     *:ekkoBSD:*:*)
 	echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE}
 	exit ;;
+    *:SolidBSD:*:*)
+	echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE}
+	exit ;;
     macppc:MirBSD:*:*)
-	echo powerppc-unknown-mirbsd${UNAME_RELEASE}
+	echo powerpc-unknown-mirbsd${UNAME_RELEASE}
 	exit ;;
     *:MirBSD:*:*)
 	echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE}
@@ -764,7 +768,14 @@ EOF
 	echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
 	exit ;;
     *:FreeBSD:*:*)
-	echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
+	case ${UNAME_MACHINE} in
+	    pc98)
+		echo i386-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
+	    amd64)
+		echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
+	    *)
+		echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
+	esac
 	exit ;;
     i*:CYGWIN*:*)
 	echo ${UNAME_MACHINE}-pc-cygwin
@@ -779,8 +790,11 @@ EOF
     i*:PW*:*)
 	echo ${UNAME_MACHINE}-pc-pw32
 	exit ;;
-    x86:Interix*:[34]*)
-	echo i586-pc-interix${UNAME_RELEASE}|sed -e 's/\..*//'
+    x86:Interix*:[3456]*)
+	echo i586-pc-interix${UNAME_RELEASE}
+	exit ;;
+    EM64T:Interix*:[3456]*)
+	echo x86_64-unknown-interix${UNAME_RELEASE}
 	exit ;;
     [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*)
 	echo i${UNAME_MACHINE}-pc-mks
@@ -794,7 +808,7 @@ EOF
     i*:UWIN*:*)
 	echo ${UNAME_MACHINE}-pc-uwin
 	exit ;;
-    amd64:CYGWIN*:*:*)
+    amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*)
 	echo x86_64-unknown-cygwin
 	exit ;;
     p*:CYGWIN*:*)
@@ -817,6 +831,9 @@ EOF
     arm*:Linux:*:*)
 	echo ${UNAME_MACHINE}-unknown-linux-gnu
 	exit ;;
+    avr32*:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	exit ;;
     cris:Linux:*:*)
 	echo cris-axis-linux-gnu
 	exit ;;
@@ -851,7 +868,11 @@ EOF
 	#endif
 	#endif
 EOF
-	eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=`
+	eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '
+	    /^CPU/{
+		s: ::g
+		p
+	    }'`"
 	test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
 	;;
     mips64:Linux:*:*)
@@ -870,9 +891,16 @@ EOF
 	#endif
 	#endif
 EOF
-	eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=`
+	eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '
+	    /^CPU/{
+		s: ::g
+		p
+	    }'`"
 	test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
 	;;
+    or32:Linux:*:*)
+	echo or32-unknown-linux-gnu
+	exit ;;
     ppc:Linux:*:*)
 	echo powerpc-unknown-linux-gnu
 	exit ;;
@@ -916,6 +944,9 @@ EOF
     sparc:Linux:*:* | sparc64:Linux:*:*)
 	echo ${UNAME_MACHINE}-unknown-linux-gnu
 	exit ;;
+    vax:Linux:*:*)
+	echo ${UNAME_MACHINE}-dec-linux-gnu
+	exit ;;
     x86_64:Linux:*:*)
 	echo x86_64-unknown-linux-gnu
 	exit ;;
@@ -961,7 +992,7 @@ EOF
 	LIBC=gnulibc1
 	# endif
 	#else
-	#ifdef __INTEL_COMPILER
+	#if defined(__INTEL_COMPILER) || defined(__PGI) || defined(__SUNPRO_C) || defined(__SUNPRO_CC)
 	LIBC=gnu
 	#else
 	LIBC=gnuaout
@@ -971,7 +1002,11 @@ EOF
 	LIBC=dietlibc
 	#endif
 EOF
-	eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=`
+	eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '
+	    /^LIBC/{
+		s: ::g
+		p
+	    }'`"
 	test x"${LIBC}" != x && {
 		echo "${UNAME_MACHINE}-pc-linux-${LIBC}"
 		exit
@@ -1182,7 +1217,6 @@ EOF
     *:Darwin:*:*)
 	UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown
 	case $UNAME_PROCESSOR in
-	    *86) UNAME_PROCESSOR=i686 ;;
 	    unknown) UNAME_PROCESSOR=powerpc ;;
 	esac
 	echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE}
@@ -1261,6 +1295,9 @@ EOF
     i*86:skyos:*:*)
 	echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//'
 	exit ;;
+    i*86:rdos:*:*)
+	echo ${UNAME_MACHINE}-pc-rdos
+	exit ;;
 esac
 
 #echo '(No uname command or uname output not recognized.)' 1>&2

+ 1 - 1
config.h.in

@@ -377,7 +377,7 @@
 /* Define to `int' if <sys/types.h> does not define. */
 #undef pid_t
 
-/* Define to `unsigned' if <sys/types.h> does not define. */
+/* Define to `unsigned int' if <sys/types.h> does not define. */
 #undef size_t
 
 /* SunOS5 */

+ 68 - 31
config.sub

@@ -1,9 +1,10 @@
 #! /bin/sh
 # Configuration validation subroutine script.
 #   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
-#   2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
+#   2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation,
+#   Inc.
 
-timestamp='2005-07-08'
+timestamp='2006-09-20'
 
 # This file is (in principle) common to ALL GNU software.
 # The presence of a machine in this file suggests that SOME GNU software
@@ -119,8 +120,9 @@ esac
 # Here we must recognize all the valid KERNEL-OS combinations.
 maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
 case $maybe_os in
-  nto-qnx* | linux-gnu* | linux-dietlibc | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | \
-  kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | storm-chaos* | os2-emx* | rtmk-nova*)
+  nto-qnx* | linux-gnu* | linux-dietlibc | linux-newlib* | linux-uclibc* | \
+  uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | \
+  storm-chaos* | os2-emx* | rtmk-nova*)
     os=-$maybe_os
     basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
     ;;
@@ -171,6 +173,10 @@ case $os in
 	-hiux*)
 		os=-hiuxwe2
 		;;
+	-sco6)
+		os=-sco5v6
+		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+		;;
 	-sco5)
 		os=-sco3.2v5
 		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
@@ -187,6 +193,10 @@ case $os in
 		# Don't forget version if it is 3.2v4 or newer.
 		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
 		;;
+	-sco5v6*)
+		# Don't forget version if it is 3.2v4 or newer.
+		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+		;;
 	-sco*)
 		os=-sco3.2v2
 		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
@@ -231,7 +241,7 @@ case $basic_machine in
 	| alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \
 	| alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \
 	| am33_2.0 \
-	| arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr \
+	| arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \
 	| bfin \
 	| c4x | clipper \
 	| d10v | d30v | dlx | dsp16xx \
@@ -239,7 +249,8 @@ case $basic_machine in
 	| h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
 	| i370 | i860 | i960 | ia64 \
 	| ip2k | iq2000 \
-	| m32r | m32rle | m68000 | m68k | m88k | maxq | mcore \
+	| m32c | m32r | m32rle | m68000 | m68k | m88k \
+	| maxq | mb | microblaze | mcore \
 	| mips | mipsbe | mipseb | mipsel | mipsle \
 	| mips16 \
 	| mips64 | mips64el \
@@ -257,28 +268,27 @@ case $basic_machine in
 	| mipsisa64sr71k | mipsisa64sr71kel \
 	| mipstx39 | mipstx39el \
 	| mn10200 | mn10300 \
-	| ms1 \
+	| mt \
 	| msp430 \
+	| nios | nios2 \
 	| ns16k | ns32k \
 	| or32 \
 	| pdp10 | pdp11 | pj | pjl \
 	| powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \
 	| pyramid \
-	| sh | sh[1234] | sh[24]a | sh[23]e | sh[34]eb | shbe | shle | sh[1234]le | sh3ele \
+	| score \
+	| sh | sh[1234] | sh[24]a | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \
 	| sh64 | sh64le \
-	| sparc | sparc64 | sparc64b | sparc86x | sparclet | sparclite \
-	| sparcv8 | sparcv9 | sparcv9b \
-	| strongarm \
+	| sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \
+	| sparcv8 | sparcv9 | sparcv9b | sparcv9v \
+	| spu | strongarm \
 	| tahoe | thumb | tic4x | tic80 | tron \
 	| v850 | v850e \
 	| we32k \
-	| x86 | xscale | xscalee[bl] | xstormy16 | xtensa \
+	| x86 | xc16x | xscale | xscalee[bl] | xstormy16 | xtensa \
 	| z8k)
 		basic_machine=$basic_machine-unknown
 		;;
-	m32c)
-		basic_machine=$basic_machine-unknown
-		;;
 	m6811 | m68hc11 | m6812 | m68hc12)
 		# Motorola 68HC11/12.
 		basic_machine=$basic_machine-unknown
@@ -286,6 +296,9 @@ case $basic_machine in
 		;;
 	m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k)
 		;;
+	ms1)
+		basic_machine=mt-unknown
+		;;
 
 	# We use `pc' rather than `unknown'
 	# because (1) that's what they normally are, and
@@ -305,7 +318,7 @@ case $basic_machine in
 	| alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \
 	| alphapca5[67]-* | alpha64pca5[67]-* | arc-* \
 	| arm-*  | armbe-* | armle-* | armeb-* | armv*-* \
-	| avr-* \
+	| avr-* | avr32-* \
 	| bfin-* | bs2000-* \
 	| c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \
 	| clipper-* | craynv-* | cydra-* \
@@ -316,7 +329,7 @@ case $basic_machine in
 	| hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
 	| i*86-* | i860-* | i960-* | ia64-* \
 	| ip2k-* | iq2000-* \
-	| m32r-* | m32rle-* \
+	| m32c-* | m32r-* | m32rle-* \
 	| m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
 	| m88110-* | m88k-* | maxq-* | mcore-* \
 	| mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \
@@ -336,31 +349,30 @@ case $basic_machine in
 	| mipsisa64sr71k-* | mipsisa64sr71kel-* \
 	| mipstx39-* | mipstx39el-* \
 	| mmix-* \
-	| ms1-* \
+	| mt-* \
 	| msp430-* \
+	| nios-* | nios2-* \
 	| none-* | np1-* | ns16k-* | ns32k-* \
 	| orion-* \
 	| pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
 	| powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \
 	| pyramid-* \
 	| romp-* | rs6000-* \
-	| sh-* | sh[1234]-* | sh[24]a-* | sh[23]e-* | sh[34]eb-* | shbe-* \
+	| sh-* | sh[1234]-* | sh[24]a-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \
 	| shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
-	| sparc-* | sparc64-* | sparc64b-* | sparc86x-* | sparclet-* \
+	| sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \
 	| sparclite-* \
-	| sparcv8-* | sparcv9-* | sparcv9b-* | strongarm-* | sv1-* | sx?-* \
+	| sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | strongarm-* | sv1-* | sx?-* \
 	| tahoe-* | thumb-* \
 	| tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \
 	| tron-* \
 	| v850-* | v850e-* | vax-* \
 	| we32k-* \
-	| x86-* | x86_64-* | xps100-* | xscale-* | xscalee[bl]-* \
+	| x86-* | x86_64-* | xc16x-* | xps100-* | xscale-* | xscalee[bl]-* \
 	| xstormy16-* | xtensa-* \
 	| ymp-* \
 	| z8k-*)
 		;;
-	m32c-*)
-		;;
 	# Recognize the various machine names and aliases which stand
 	# for a CPU type and a company and sometimes even an OS.
 	386bsd)
@@ -696,6 +708,9 @@ case $basic_machine in
 		basic_machine=i386-pc
 		os=-msdos
 		;;
+	ms1-*)
+		basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'`
+		;;
 	mvs)
 		basic_machine=i370-ibm
 		os=-mvs
@@ -803,6 +818,12 @@ case $basic_machine in
 	pc532 | pc532-*)
 		basic_machine=ns32k-pc532
 		;;
+	pc98)
+		basic_machine=i386-pc
+		;;
+	pc98-*)
+		basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
 	pentium | p5 | k5 | k6 | nexgen | viac3)
 		basic_machine=i586-pc
 		;;
@@ -859,6 +880,10 @@ case $basic_machine in
 		basic_machine=i586-unknown
 		os=-pw32
 		;;
+	rdos)
+		basic_machine=i386-pc
+		os=-rdos
+		;;
 	rom68k)
 		basic_machine=m68k-rom68k
 		os=-coff
@@ -885,6 +910,10 @@ case $basic_machine in
 	sb1el)
 		basic_machine=mipsisa64sb1el-unknown
 		;;
+	sde)
+		basic_machine=mipsisa32-sde
+		os=-elf
+		;;
 	sei)
 		basic_machine=mips-sei
 		os=-seiux
@@ -1101,7 +1130,7 @@ case $basic_machine in
 	sh[1234] | sh[24]a | sh[34]eb | sh[1234]le | sh[23]ele)
 		basic_machine=sh-unknown
 		;;
-	sparc | sparcv8 | sparcv9 | sparcv9b)
+	sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v)
 		basic_machine=sparc-sun
 		;;
 	cydra)
@@ -1174,21 +1203,23 @@ case $os in
 	      | -aos* \
 	      | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
 	      | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
-	      | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* | -openbsd* \
+	      | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \
+	      | -openbsd* | -solidbsd* \
 	      | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \
 	      | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
 	      | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
 	      | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
 	      | -chorusos* | -chorusrdb* \
 	      | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
-	      | -mingw32* | -linux-gnu* | -linux-uclibc* | -uxpv* | -beos* | -mpeix* | -udk* \
+	      | -mingw32* | -linux-gnu* | -linux-newlib* | -linux-uclibc* \
+	      | -uxpv* | -beos* | -mpeix* | -udk* \
 	      | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \
 	      | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
 	      | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \
 	      | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
 	      | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \
 	      | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \
-	      | -skyos* | -haiku*)
+	      | -skyos* | -haiku* | -rdos* | -toppers*)
 	# Remember, each alternative MUST END IN *, to match a version number.
 		;;
 	-qnx*)
@@ -1340,6 +1371,12 @@ else
 # system, and we'll never get to this point.
 
 case $basic_machine in
+        score-*)
+		os=-elf
+		;;
+        spu-*)
+		os=-elf
+		;;
 	*-acorn)
 		os=-riscix1.2
 		;;
@@ -1349,9 +1386,9 @@ case $basic_machine in
 	arm*-semi)
 		os=-aout
 		;;
-    c4x-* | tic4x-*)
-        os=-coff
-        ;;
+        c4x-* | tic4x-*)
+        	os=-coff
+		;;
 	# This must come before the *-dec entry.
 	pdp10-*)
 		os=-tops20

文件差异内容过多而无法显示
+ 663 - 146
configure


+ 59 - 5
depcomp

@@ -1,9 +1,10 @@
 #! /bin/sh
 # depcomp - compile a program generating dependencies as side-effects
 
-scriptversion=2005-07-09.11
+scriptversion=2006-10-15.18
 
-# Copyright (C) 1999, 2000, 2003, 2004, 2005 Free Software Foundation, Inc.
+# Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006 Free Software
+# Foundation, Inc.
 
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -91,7 +92,20 @@ gcc3)
 ## gcc 3 implements dependency tracking that does exactly what
 ## we want.  Yay!  Note: for some reason libtool 1.4 doesn't like
 ## it if -MD -MP comes after the -MF stuff.  Hmm.
-  "$@" -MT "$object" -MD -MP -MF "$tmpdepfile"
+## Unfortunately, FreeBSD c89 acceptance of flags depends upon
+## the command line argument order; so add the flags where they
+## appear in depend2.am.  Note that the slowdown incurred here
+## affects only configure: in makefiles, %FASTDEP% shortcuts this.
+  for arg
+  do
+    case $arg in
+    -c) set fnord "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" "$arg" ;;
+    *)  set fnord "$@" "$arg" ;;
+    esac
+    shift # fnord
+    shift # $arg
+  done
+  "$@"
   stat=$?
   if test $stat -eq 0; then :
   else
@@ -276,6 +290,46 @@ icc)
   rm -f "$tmpdepfile"
   ;;
 
+hp2)
+  # The "hp" stanza above does not work with aCC (C++) and HP's ia64
+  # compilers, which have integrated preprocessors.  The correct option
+  # to use with these is +Maked; it writes dependencies to a file named
+  # 'foo.d', which lands next to the object file, wherever that
+  # happens to be.
+  # Much of this is similar to the tru64 case; see comments there.
+  dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
+  test "x$dir" = "x$object" && dir=
+  base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
+  if test "$libtool" = yes; then
+    tmpdepfile1=$dir$base.d
+    tmpdepfile2=$dir.libs/$base.d
+    "$@" -Wc,+Maked
+  else
+    tmpdepfile1=$dir$base.d
+    tmpdepfile2=$dir$base.d
+    "$@" +Maked
+  fi
+  stat=$?
+  if test $stat -eq 0; then :
+  else
+     rm -f "$tmpdepfile1" "$tmpdepfile2"
+     exit $stat
+  fi
+
+  for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2"
+  do
+    test -f "$tmpdepfile" && break
+  done
+  if test -f "$tmpdepfile"; then
+    sed -e "s,^.*\.[a-z]*:,$object:," "$tmpdepfile" > "$depfile"
+    # Add `dependent.h:' lines.
+    sed -ne '2,${; s/^ *//; s/ \\*$//; s/$/:/; p;}' "$tmpdepfile" >> "$depfile"
+  else
+    echo "#dummy" > "$depfile"
+  fi
+  rm -f "$tmpdepfile" "$tmpdepfile2"
+  ;;
+
 tru64)
    # The Tru64 compiler uses -MD to generate dependencies as a side
    # effect.  `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'.
@@ -288,13 +342,13 @@ tru64)
 
    if test "$libtool" = yes; then
       # With Tru64 cc, shared objects can also be used to make a
-      # static library.  This mecanism is used in libtool 1.4 series to
+      # static library.  This mechanism is used in libtool 1.4 series to
       # handle both shared and static libraries in a single compilation.
       # With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d.
       #
       # With libtool 1.5 this exception was removed, and libtool now
       # generates 2 separate objects for the 2 libraries.  These two
-      # compilations output dependencies in in $dir.libs/$base.o.d and
+      # compilations output dependencies in $dir.libs/$base.o.d and
       # in $dir$base.o.d.  We have to check for both files, because
       # one of the two compilations can be disabled.  We should prefer
       # $dir$base.o.d over $dir.libs/$base.o.d because the latter is

+ 266 - 82
install-sh

@@ -1,7 +1,7 @@
 #!/bin/sh
 # install - install a program, script, or datafile
 
-scriptversion=2005-05-14.22
+scriptversion=2006-10-14.15
 
 # This originates from X11R5 (mit/util/scripts/install.sh), which was
 # later released in X11R6 (xc/config/util/install.sh) with the
@@ -39,15 +39,24 @@ scriptversion=2005-05-14.22
 # when there is no Makefile.
 #
 # This script is compatible with the BSD install script, but was written
-# from scratch.  It can only install one file at a time, a restriction
-# shared with many OS's install programs.
+# from scratch.
+
+nl='
+'
+IFS=" ""	$nl"
 
 # set DOITPROG to echo to test this script
 
 # Don't use :- since 4.3BSD and earlier shells don't like it.
 doit="${DOITPROG-}"
+if test -z "$doit"; then
+  doit_exec=exec
+else
+  doit_exec=$doit
+fi
 
-# put in absolute paths if you don't have them in your path; or use env. vars.
+# Put in absolute file names if you don't have them in your path;
+# or use environment vars.
 
 mvprog="${MVPROG-mv}"
 cpprog="${CPPROG-cp}"
@@ -58,7 +67,13 @@ stripprog="${STRIPPROG-strip}"
 rmprog="${RMPROG-rm}"
 mkdirprog="${MKDIRPROG-mkdir}"
 
-chmodcmd="$chmodprog 0755"
+posix_glob=
+posix_mkdir=
+
+# Desired mode of installed file.
+mode=0755
+
+chmodcmd=$chmodprog
 chowncmd=
 chgrpcmd=
 stripcmd=
@@ -95,7 +110,7 @@ Environment variables override the default commands:
   CHGRPPROG CHMODPROG CHOWNPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG
 "
 
-while test -n "$1"; do
+while test $# -ne 0; do
   case $1 in
     -c) shift
         continue;;
@@ -111,9 +126,15 @@ while test -n "$1"; do
 
     --help) echo "$usage"; exit $?;;
 
-    -m) chmodcmd="$chmodprog $2"
+    -m) mode=$2
         shift
         shift
+	case $mode in
+	  *' '* | *'	'* | *'
+'*	  | *'*'* | *'?'* | *'['*)
+	    echo "$0: invalid mode: $mode" >&2
+	    exit 1;;
+	esac
         continue;;
 
     -o) chowncmd="$chownprog $2"
@@ -136,25 +157,33 @@ while test -n "$1"; do
 
     --version) echo "$0 $scriptversion"; exit $?;;
 
-    *)  # When -d is used, all remaining arguments are directories to create.
-	# When -t is used, the destination is already specified.
-	test -n "$dir_arg$dstarg" && break
-        # Otherwise, the last argument is the destination.  Remove it from $@.
-	for arg
-	do
-          if test -n "$dstarg"; then
-	    # $@ is not empty: it contains at least $arg.
-	    set fnord "$@" "$dstarg"
-	    shift # fnord
-	  fi
-	  shift # arg
-	  dstarg=$arg
-	done
+    --)	shift
 	break;;
+
+    -*)	echo "$0: invalid option: $1" >&2
+	exit 1;;
+
+    *)  break;;
   esac
 done
 
-if test -z "$1"; then
+if test $# -ne 0 && test -z "$dir_arg$dstarg"; then
+  # When -d is used, all remaining arguments are directories to create.
+  # When -t is used, the destination is already specified.
+  # Otherwise, the last argument is the destination.  Remove it from $@.
+  for arg
+  do
+    if test -n "$dstarg"; then
+      # $@ is not empty: it contains at least $arg.
+      set fnord "$@" "$dstarg"
+      shift # fnord
+    fi
+    shift # arg
+    dstarg=$arg
+  done
+fi
+
+if test $# -eq 0; then
   if test -z "$dir_arg"; then
     echo "$0: no input file specified." >&2
     exit 1
@@ -164,6 +193,33 @@ if test -z "$1"; then
   exit 0
 fi
 
+if test -z "$dir_arg"; then
+  trap '(exit $?); exit' 1 2 13 15
+
+  # Set umask so as not to create temps with too-generous modes.
+  # However, 'strip' requires both read and write access to temps.
+  case $mode in
+    # Optimize common cases.
+    *644) cp_umask=133;;
+    *755) cp_umask=22;;
+
+    *[0-7])
+      if test -z "$stripcmd"; then
+	u_plus_rw=
+      else
+	u_plus_rw='% 200'
+      fi
+      cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;;
+    *)
+      if test -z "$stripcmd"; then
+	u_plus_rw=
+      else
+	u_plus_rw=,u+rw
+      fi
+      cp_umask=$mode$u_plus_rw;;
+  esac
+fi
+
 for src
 do
   # Protect names starting with `-'.
@@ -173,15 +229,11 @@ do
 
   if test -n "$dir_arg"; then
     dst=$src
-    src=
-
-    if test -d "$dst"; then
-      mkdircmd=:
-      chmodcmd=
-    else
-      mkdircmd=$mkdirprog
-    fi
+    dstdir=$dst
+    test -d "$dstdir"
+    dstdir_status=$?
   else
+
     # Waiting for this to be detected by the "$cpprog $src $dsttmp" command
     # might cause directories to be created, which would be especially bad
     # if $src (and thus $dsttmp) contains '*'.
@@ -208,53 +260,188 @@ do
 	echo "$0: $dstarg: Is a directory" >&2
 	exit 1
       fi
-      dst=$dst/`basename "$src"`
+      dstdir=$dst
+      dst=$dstdir/`basename "$src"`
+      dstdir_status=0
+    else
+      # Prefer dirname, but fall back on a substitute if dirname fails.
+      dstdir=`
+	(dirname "$dst") 2>/dev/null ||
+	expr X"$dst" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+	     X"$dst" : 'X\(//\)[^/]' \| \
+	     X"$dst" : 'X\(//\)$' \| \
+	     X"$dst" : 'X\(/\)' \| . 2>/dev/null ||
+	echo X"$dst" |
+	    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+		   s//\1/
+		   q
+		 }
+		 /^X\(\/\/\)[^/].*/{
+		   s//\1/
+		   q
+		 }
+		 /^X\(\/\/\)$/{
+		   s//\1/
+		   q
+		 }
+		 /^X\(\/\).*/{
+		   s//\1/
+		   q
+		 }
+		 s/.*/./; q'
+      `
+
+      test -d "$dstdir"
+      dstdir_status=$?
     fi
   fi
 
-  # This sed command emulates the dirname command.
-  dstdir=`echo "$dst" | sed -e 's,/*$,,;s,[^/]*$,,;s,/*$,,;s,^$,.,'`
-
-  # Make sure that the destination directory exists.
-
-  # Skip lots of stat calls in the usual case.
-  if test ! -d "$dstdir"; then
-    defaultIFS='
-	 '
-    IFS="${IFS-$defaultIFS}"
-
-    oIFS=$IFS
-    # Some sh's can't handle IFS=/ for some reason.
-    IFS='%'
-    set x `echo "$dstdir" | sed -e 's@/@%@g' -e 's@^%@/@'`
-    shift
-    IFS=$oIFS
+  obsolete_mkdir_used=false
+
+  if test $dstdir_status != 0; then
+    case $posix_mkdir in
+      '')
+	# Create intermediate dirs using mode 755 as modified by the umask.
+	# This is like FreeBSD 'install' as of 1997-10-28.
+	umask=`umask`
+	case $stripcmd.$umask in
+	  # Optimize common cases.
+	  *[2367][2367]) mkdir_umask=$umask;;
+	  .*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;;
+
+	  *[0-7])
+	    mkdir_umask=`expr $umask + 22 \
+	      - $umask % 100 % 40 + $umask % 20 \
+	      - $umask % 10 % 4 + $umask % 2
+	    `;;
+	  *) mkdir_umask=$umask,go-w;;
+	esac
+
+	# With -d, create the new directory with the user-specified mode.
+	# Otherwise, rely on $mkdir_umask.
+	if test -n "$dir_arg"; then
+	  mkdir_mode=-m$mode
+	else
+	  mkdir_mode=
+	fi
+
+	posix_mkdir=false
+	case $umask in
+	  *[123567][0-7][0-7])
+	    # POSIX mkdir -p sets u+wx bits regardless of umask, which
+	    # is incompatible with FreeBSD 'install' when (umask & 300) != 0.
+	    ;;
+	  *)
+	    tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$
+	    trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0
+
+	    if (umask $mkdir_umask &&
+		exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1
+	    then
+	      if test -z "$dir_arg" || {
+		   # Check for POSIX incompatibilities with -m.
+		   # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or
+		   # other-writeable bit of parent directory when it shouldn't.
+		   # FreeBSD 6.1 mkdir -m -p sets mode of existing directory.
+		   ls_ld_tmpdir=`ls -ld "$tmpdir"`
+		   case $ls_ld_tmpdir in
+		     d????-?r-*) different_mode=700;;
+		     d????-?--*) different_mode=755;;
+		     *) false;;
+		   esac &&
+		   $mkdirprog -m$different_mode -p -- "$tmpdir" && {
+		     ls_ld_tmpdir_1=`ls -ld "$tmpdir"`
+		     test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1"
+		   }
+		 }
+	      then posix_mkdir=:
+	      fi
+	      rmdir "$tmpdir/d" "$tmpdir"
+	    else
+	      # Remove any dirs left behind by ancient mkdir implementations.
+	      rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null
+	    fi
+	    trap '' 0;;
+	esac;;
+    esac
 
-    pathcomp=
+    if
+      $posix_mkdir && (
+	umask $mkdir_umask &&
+	$doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir"
+      )
+    then :
+    else
 
-    while test $# -ne 0 ; do
-      pathcomp=$pathcomp$1
+      # The umask is ridiculous, or mkdir does not conform to POSIX,
+      # or it failed possibly due to a race condition.  Create the
+      # directory the slow way, step by step, checking for races as we go.
+
+      case $dstdir in
+	/*) prefix=/ ;;
+	-*) prefix=./ ;;
+	*)  prefix= ;;
+      esac
+
+      case $posix_glob in
+        '')
+	  if (set -f) 2>/dev/null; then
+	    posix_glob=true
+	  else
+	    posix_glob=false
+	  fi ;;
+      esac
+
+      oIFS=$IFS
+      IFS=/
+      $posix_glob && set -f
+      set fnord $dstdir
       shift
-      if test ! -d "$pathcomp"; then
-        $mkdirprog "$pathcomp"
-	# mkdir can fail with a `File exist' error in case several
-	# install-sh are creating the directory concurrently.  This
-	# is OK.
-	test -d "$pathcomp" || exit
+      $posix_glob && set +f
+      IFS=$oIFS
+
+      prefixes=
+
+      for d
+      do
+	test -z "$d" && continue
+
+	prefix=$prefix$d
+	if test -d "$prefix"; then
+	  prefixes=
+	else
+	  if $posix_mkdir; then
+	    (umask=$mkdir_umask &&
+	     $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break
+	    # Don't fail if two instances are running concurrently.
+	    test -d "$prefix" || exit 1
+	  else
+	    case $prefix in
+	      *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;;
+	      *) qprefix=$prefix;;
+	    esac
+	    prefixes="$prefixes '$qprefix'"
+	  fi
+	fi
+	prefix=$prefix/
+      done
+
+      if test -n "$prefixes"; then
+	# Don't fail if two instances are running concurrently.
+	(umask $mkdir_umask &&
+	 eval "\$doit_exec \$mkdirprog $prefixes") ||
+	  test -d "$dstdir" || exit 1
+	obsolete_mkdir_used=true
       fi
-      pathcomp=$pathcomp/
-    done
+    fi
   fi
 
   if test -n "$dir_arg"; then
-    $doit $mkdircmd "$dst" \
-      && { test -z "$chowncmd" || $doit $chowncmd "$dst"; } \
-      && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } \
-      && { test -z "$stripcmd" || $doit $stripcmd "$dst"; } \
-      && { test -z "$chmodcmd" || $doit $chmodcmd "$dst"; }
-
+    { test -z "$chowncmd" || $doit $chowncmd "$dst"; } &&
+    { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } &&
+    { test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false ||
+      test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1
   else
-    dstfile=`basename "$dst"`
 
     # Make a couple of temp file names in the proper directory.
     dsttmp=$dstdir/_inst.$$_
@@ -262,10 +449,9 @@ do
 
     # Trap to clean up those temp files at exit.
     trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0
-    trap '(exit $?); exit' 1 2 13 15
 
     # Copy the file name to the temp name.
-    $doit $cpprog "$src" "$dsttmp" &&
+    (umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") &&
 
     # and set any options; do chmod last to preserve setuid bits.
     #
@@ -276,10 +462,10 @@ do
     { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } \
       && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } \
       && { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } \
-      && { test -z "$chmodcmd" || $doit $chmodcmd "$dsttmp"; } &&
+      && { test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } &&
 
     # Now rename the file to the real destination.
-    { $doit $mvcmd -f "$dsttmp" "$dstdir/$dstfile" 2>/dev/null \
+    { $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null \
       || {
 	   # The rename failed, perhaps because mv can't rename something else
 	   # to itself, or perhaps because mv is so ancient that it does not
@@ -291,11 +477,12 @@ do
 	   # reasons.  In this case, the final cleanup might fail but the new
 	   # file should still install successfully.
 	   {
-	     if test -f "$dstdir/$dstfile"; then
-	       $doit $rmcmd -f "$dstdir/$dstfile" 2>/dev/null \
-	       || $doit $mvcmd -f "$dstdir/$dstfile" "$rmtmp" 2>/dev/null \
+	     if test -f "$dst"; then
+	       $doit $rmcmd -f "$dst" 2>/dev/null \
+	       || { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null \
+		     && { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; }; }\
 	       || {
-		 echo "$0: cannot unlink or rename $dstdir/$dstfile" >&2
+		 echo "$0: cannot unlink or rename $dst" >&2
 		 (exit 1); exit 1
 	       }
 	     else
@@ -304,16 +491,13 @@ do
 	   } &&
 
 	   # Now rename the file to the real destination.
-	   $doit $mvcmd "$dsttmp" "$dstdir/$dstfile"
+	   $doit $mvcmd "$dsttmp" "$dst"
 	 }
-    }
-  fi || { (exit 1); exit 1; }
-done
+    } || exit 1
 
-# The final little trick to "correctly" pass the exit status to the exit trap.
-{
-  (exit 0); exit 0
-}
+    trap '' 0
+  fi
+done
 
 # Local variables:
 # eval: (add-hook 'write-file-hooks 'time-stamp)

+ 6 - 6
ldap/servers/plugins/acl/acl.c

@@ -297,7 +297,7 @@ acl_access_allowed(
 
 		 if (  !privateBackend && (be_readonly ||  slapi_config_get_readonly () )){
 			slapi_log_error	(loglevel, plugin_name,
-				"conn=%d op=%d (main): Deny %s on entry(%s)"
+				"conn=%" PRIu64 " op=%d (main): Deny %s on entry(%s)"
 				": readonly backend\n",
 				 op->o_connid, op->o_opid,
 				acl_access2str(access),
@@ -310,7 +310,7 @@ acl_access_allowed(
 	TNF_PROBE_0_DEBUG(acl_skipaccess_start,"ACL","");
 	if (  acl_skip_access_check ( pb, e )) {
 		slapi_log_error	(loglevel,	plugin_name,
-				"conn=%d op=%d (main): Allow %s on entry(%s)"
+				"conn=%" PRIu64 " op=%d (main): Allow %s on entry(%s)"
 				": root user\n",
 				op->o_connid, op->o_opid,
 				acl_access2str(access),
@@ -438,7 +438,7 @@ acl_access_allowed(
 		TNF_PROBE_0_DEBUG(acl_entry_first_touch_start,"ACL","");
 
 		slapi_log_error(loglevel, plugin_name,
-			"#### conn=%d op=%d binddn=\"%s\"\n",
+			"#### conn=%" PRIu64 " op=%d binddn=\"%s\"\n",
 			op->o_connid, op->o_opid, clientDn);
 		aclpb->aclpb_stat_total_entries++;
 
@@ -755,7 +755,7 @@ static void print_access_control_summary( char *source, int ret_val, char *clien
 										null_user);
 
 				slapi_log_error(loglevel, plugin_name, 
-		"conn=%d op=%d (%s): %s %s on entry(%s).attr(%s) to proxy (%s)"
+		"conn=%" PRIu64 " op=%d (%s): %s %s on entry(%s).attr(%s) to proxy (%s)"
 		": %s\n",
 				op->o_connid, op->o_opid,
 				source,
@@ -768,7 +768,7 @@ static void print_access_control_summary( char *source, int ret_val, char *clien
 		} else {
 					proxy_user = null_user;
 					slapi_log_error(loglevel, plugin_name, 
-		"conn=%d op=%d (%s): %s %s on entry(%s).attr(%s) to proxy (%s)"
+		"conn=%" PRIu64 " op=%d (%s): %s %s on entry(%s).attr(%s) to proxy (%s)"
 		": %s\n",
 				op->o_connid, op->o_opid,
 				source,
@@ -781,7 +781,7 @@ static void print_access_control_summary( char *source, int ret_val, char *clien
 		}
 	} else{
 		slapi_log_error(loglevel, plugin_name, 
-			"conn=%d op=%d (%s): %s %s on entry(%s).attr(%s) to %s"
+			"conn=%" PRIu64 " op=%d (%s): %s %s on entry(%s).attr(%s) to %s"
 			": %s\n",
 				op->o_connid, op->o_opid,
 				source,

+ 16 - 0
ldap/servers/plugins/acl/acl.h

@@ -49,6 +49,22 @@
 #ifndef _ACL_H_
 #define _ACL_H_
 
+/* Required to get portable printf/scanf format macros */
+#ifdef HAVE_INTTYPES_H
+#include <inttypes.h>
+
+/* NSPR uses the print macros a bit differently than ANSI C.  We
+ * need to use ll for a 64-bit integer, even when a long is 64-bit.
+ */
+#undef PRIu64
+#define PRIu64  "llu"
+#undef PRI64
+#define PRI64   "ll"
+
+#else
+#error Need to define portable format macros such as PRIu64
+#endif /* HAVE_INTTYPES_H */
+
 #include 	<stdio.h>
 #include 	<string.h>
 #include 	<sys/types.h>

+ 2 - 2
ldap/servers/plugins/acl/acl_ext.c

@@ -973,7 +973,7 @@ acl__get_aclpb_type ( Acl_PBlock *aclpb )
 static void
 acl__dump_stats ( struct acl_pblock *aclpb , const char *block_type)
 {
-	int 			connid = 0;
+	PRUint64 			connid = 0;
 	int				opid = 0;
 	Slapi_PBlock  	*pb = NULL;
 
@@ -985,7 +985,7 @@ acl__dump_stats ( struct acl_pblock *aclpb , const char *block_type)
 
 	/* DUMP STAT INFO */
 	slapi_log_error( SLAPI_LOG_ACL, plugin_name, 
-			"**** ACL OPERATION STAT BEGIN ( aclpb:%p Block type: %s): Conn:%d Operation:%d  *******\n",
+			"**** ACL OPERATION STAT BEGIN ( aclpb:%p Block type: %s): Conn:%" PRIu64 " Operation:%d  *******\n",
 			aclpb, block_type, connid, opid );
 	slapi_log_error( SLAPI_LOG_ACL, plugin_name, "\tNumber of entries scanned: %d\n",
 					aclpb->aclpb_stat_total_entries);

+ 2 - 2
ldap/servers/plugins/acl/aclanom.c

@@ -543,14 +543,14 @@ aclanom_match_profile (Slapi_PBlock *pb, struct acl_pblock *aclpb, Slapi_Entry *
 			aci_ndn = slapi_sdn_get_ndn (acl_anom_profile->anom_targetinfo[i].anom_target);
 
 			slapi_log_error(loglevel, plugin_name, 
-				"conn=%d op=%d: Allow access on entry(%s).attr(%s) to anonymous: acidn=\"%s\"\n",
+				"conn=%" PRIu64 " op=%d: Allow access on entry(%s).attr(%s) to anonymous: acidn=\"%s\"\n",
 				op->o_connid, op->o_opid,
 				escape_string_with_punctuation(ndn, ebuf),
 				attr ? attr:"NULL",
 				escape_string_with_punctuation(aci_ndn, ebuf));
 		} else {
 			slapi_log_error(loglevel, plugin_name,
-				"conn=%d op=%d: Deny access on entry(%s).attr(%s) to anonymous\n",
+				"conn=%" PRIu64 " op=%d: Deny access on entry(%s).attr(%s) to anonymous\n",
 		op->o_connid, op->o_opid,
                 escape_string_with_punctuation(ndn, ebuf), attr ? attr:"NULL" );
 		}

+ 9 - 0
ldap/servers/plugins/dna/dna.c

@@ -58,6 +58,15 @@
 /* Required to get portable printf/scanf format macros */
 #ifdef HAVE_INTTYPES_H
 #include <inttypes.h>
+
+/* NSPR uses the print macros a bit differently than ANSI C.  We
+ * need to use ll for a 64-bit integer, even when a long is 64-bit.
+ */
+#undef PRIu64
+#define PRIu64  "llu"
+#undef PRI64
+#define PRI64   "ll"
+
 #else
 #error Need to define portable format macros such as PRIu64
 #endif /* HAVE_INTTYPES_H */

+ 16 - 0
ldap/servers/plugins/replication/repl.h

@@ -44,6 +44,22 @@
 #ifndef _REPL_H_
 #define _REPL_H_
 
+/* Required to get portable printf/scanf format macros */
+#ifdef HAVE_INTTYPES_H
+#include <inttypes.h>
+
+/* NSPR uses the print macros a bit differently than ANSI C.  We
+ * need to use ll for a 64-bit integer, even when a long is 64-bit.
+ */
+#undef PRIu64
+#define PRIu64  "llu"
+#undef PRI64
+#define PRI64   "ll"
+
+#else
+#error Need to define portable format macros such as PRIu64
+#endif /* HAVE_INTTYPES_H */
+
 #include <limits.h>
 #include <time.h>
 #include <stdio.h>

+ 2 - 2
ldap/servers/plugins/replication/repl5.h

@@ -443,10 +443,10 @@ Replica *windows_replica_new(const Slapi_DN *root);
    during addition of the replica over LDAP */
 Replica *replica_new_from_entry (Slapi_Entry *e, char *errortext, PRBool is_add_operation);
 void replica_destroy(void **arg);
-PRBool replica_get_exclusive_access(Replica *r, PRBool *isInc, int connid, int opid,
+PRBool replica_get_exclusive_access(Replica *r, PRBool *isInc, PRUint64 connid, int opid,
 									const char *locking_purl,
 									char **current_purl);
-void replica_relinquish_exclusive_access(Replica *r, int connid, int opid);
+void replica_relinquish_exclusive_access(Replica *r, PRUint64 connid, int opid);
 PRBool replica_get_tombstone_reap_active(const Replica *r);
 const Slapi_DN *replica_get_root(const Replica *r);
 const char *replica_get_name(const Replica *r);

+ 3 - 2
ldap/servers/plugins/replication/repl5_init.c

@@ -178,7 +178,8 @@ set_thread_private_cache ( void *buf )
 char*
 get_repl_session_id (Slapi_PBlock *pb, char *idstr, CSN **csn)
 {
-	int connid=-1, opid=-1;
+	int opid=-1;
+	PRUint64 connid = 0;
 	CSN *opcsn;
 	char opcsnstr[CSN_STRSIZE];
 
@@ -192,7 +193,7 @@ get_repl_session_id (Slapi_PBlock *pb, char *idstr, CSN **csn)
 		/* Avoid "Connection is NULL and hence cannot access SLAPI_CONN_ID" */
 		if (opid) {
 			slapi_pblock_get (pb, SLAPI_CONN_ID, &connid);
-			PR_snprintf (idstr, REPL_SESSION_ID_SIZE, "conn=%d op=%d", connid, opid);
+			PR_snprintf (idstr, REPL_SESSION_ID_SIZE, "conn=%" PRIu64 " op=%d", connid, opid);
 		}
 
 		slapi_pblock_get ( pb, SLAPI_OPERATION, &op );

+ 6 - 6
ldap/servers/plugins/replication/repl5_replica.c

@@ -405,7 +405,7 @@ replica_destroy(void **arg)
  * current_purl is the supplier who already has access, if any
  */
 PRBool
-replica_get_exclusive_access(Replica *r, PRBool *isInc, int connid, int opid,
+replica_get_exclusive_access(Replica *r, PRBool *isInc, PRUint64 connid, int opid,
 							 const char *locking_purl,
 							 char **current_purl)
 {
@@ -421,7 +421,7 @@ replica_get_exclusive_access(Replica *r, PRBool *isInc, int connid, int opid,
 			*isInc = (r->repl_state_flags & REPLICA_INCREMENTAL_IN_PROGRESS);
 
 		slapi_log_error(SLAPI_LOG_REPL, repl_plugin_name,
-				"conn=%d op=%d repl=\"%s\": "
+				"conn=%" PRIu64 " op=%d repl=\"%s\": "
 				"Replica in use locking_purl=%s\n",
 				connid, opid,
 				escape_string(slapi_sdn_get_dn(r->repl_root),ebuf),
@@ -435,7 +435,7 @@ replica_get_exclusive_access(Replica *r, PRBool *isInc, int connid, int opid,
 	else
 	{
         slapi_log_error(SLAPI_LOG_REPL, repl_plugin_name, 
-						"conn=%d op=%d repl=\"%s\": Acquired replica\n",
+						"conn=%" PRIu64 " op=%d repl=\"%s\": Acquired replica\n",
 						connid, opid,
 						escape_string(slapi_sdn_get_dn(r->repl_root),ebuf));
 		r->repl_state_flags |= REPLICA_IN_USE;
@@ -463,7 +463,7 @@ replica_get_exclusive_access(Replica *r, PRBool *isInc, int connid, int opid,
  * Relinquish exclusive access to the replica 
  */
 void
-replica_relinquish_exclusive_access(Replica *r, int connid, int opid)
+replica_relinquish_exclusive_access(Replica *r, PRUint64 connid, int opid)
 {
 	char ebuf[BUFSIZ];
 	PRBool isInc;
@@ -476,13 +476,13 @@ replica_relinquish_exclusive_access(Replica *r, int connid, int opid)
 	if (!(r->repl_state_flags & REPLICA_IN_USE))
 	{
         slapi_log_error(SLAPI_LOG_REPL, repl_plugin_name, 
-					"conn=%d op=%d repl=\"%s\": "
+					"conn=%" PRIu64 " op=%d repl=\"%s\": "
 					"Replica not in use\n",
 					connid, opid,
 					escape_string(slapi_sdn_get_dn(r->repl_root),ebuf));
 	} else {
 		slapi_log_error(SLAPI_LOG_REPL, repl_plugin_name, 
-					"conn=%d op=%d repl=\"%s\": "
+					"conn=%" PRIu64 " op=%d repl=\"%s\": "
 					"Released replica\n",
 					connid, opid,
 					escape_string(slapi_sdn_get_dn(r->repl_root),ebuf));

+ 5 - 5
ldap/servers/plugins/replication/repl5_total.c

@@ -76,6 +76,7 @@
     }
 */
 
+#include "repl.h"
 #include "repl5.h"
 
 #define CSN_TYPE_VALUE_UPDATED_ON_WIRE 1
@@ -848,11 +849,10 @@ multimaster_extop_NSDS50ReplicationEntry(Slapi_PBlock  *pb)
 	int rc;
 	Slapi_Entry *e = NULL;
     Slapi_Connection *conn = NULL;
-	int connid, opid;
+	PRUint64 connid = 0;
+	int opid = 0;
 	
-	connid = 0;
 	slapi_pblock_get(pb, SLAPI_CONN_ID, &connid);
-	opid = 0;
 	slapi_pblock_get(pb, SLAPI_OPERATION_ID, &opid);
 
 	/* Decode the extended operation */
@@ -881,7 +881,7 @@ multimaster_extop_NSDS50ReplicationEntry(Slapi_PBlock  *pb)
 		   const char *dn = slapi_entry_get_dn_const(e);
 		   slapi_log_error(SLAPI_LOG_REPL, repl_plugin_name,
 						   "Error %d: could not import entry dn %s "
-						   "for total update operation conn=%d op=%d\n",
+						   "for total update operation conn=%" PRIu64 " op=%d\n",
 						   rc, dn, connid, opid);
 		   rc = -1;
 	   }
@@ -891,7 +891,7 @@ multimaster_extop_NSDS50ReplicationEntry(Slapi_PBlock  *pb)
 	{
 		slapi_log_error(SLAPI_LOG_REPL, repl_plugin_name,
 						"Error %d: could not decode the total update extop "
-						"for total update operation conn=%d op=%d\n",
+						"for total update operation conn=%" PRIu64 " op=%d\n",
 						rc, connid, opid);
 	}
    

+ 2 - 2
ldap/servers/plugins/replication/repl_connext.c

@@ -78,7 +78,7 @@ void* consumer_connection_extension_constructor (void *object, void *parent)
 /* consumer connection extension destructor */
 void consumer_connection_extension_destructor (void *ext, void *object, void *parent)
 {
-	int connid = 0;
+	PRUint64 connid = 0;
 	if (ext)
 	{
 		/* Check to see if this replication session has acquired
@@ -101,7 +101,7 @@ void consumer_connection_extension_destructor (void *ext, void *object, void *pa
 					slapi_pblock_get(pb, SLAPI_CONN_ID, &connid);
 					slapi_log_error(SLAPI_LOG_REPL, repl_plugin_name,
 									"Aborting total update in progress for replicated "
-									"area %s connid=%d\n", slapi_sdn_get_dn(repl_root_sdn),
+									"area %s connid=%" PRIu64 "\n", slapi_sdn_get_dn(repl_root_sdn),
 									connid);
 					slapi_stop_bulk_import(pb);
 				}

+ 14 - 14
ldap/servers/plugins/replication/repl_extop.c

@@ -562,7 +562,8 @@ multimaster_extop_StartNSDS50ReplicationRequest(Slapi_PBlock *pb)
 	char *bind_dn = NULL;
 	Object *ruv_object = NULL;
     RUV *supplier_ruv = NULL;
-	int connid, opid;
+	PRUint64 connid = 0;
+	int opid = 0;
 	PRBool isInc = PR_FALSE; /* true if incremental update */
 	char *locking_purl = NULL; /* the supplier contacting us */
 	char *current_purl = NULL; /* the supplier which already has exclusive access */
@@ -581,9 +582,7 @@ multimaster_extop_StartNSDS50ReplicationRequest(Slapi_PBlock *pb)
 		goto send_response;
 	}
 
-	connid = 0;
 	slapi_pblock_get(pb, SLAPI_CONN_ID, &connid);
-	opid = 0;
 	slapi_pblock_get(pb, SLAPI_OPERATION_ID, &opid);
 
 	/*
@@ -606,7 +605,7 @@ multimaster_extop_StartNSDS50ReplicationRequest(Slapi_PBlock *pb)
 		/* Stash info that this is an incremental update session */
 		connext->repl_protocol_version = REPL_PROTOCOL_50_INCREMENTAL;
 		slapi_log_error(SLAPI_LOG_REPL, repl_plugin_name,
-			"conn=%d op=%d repl=\"%s\": Begin incremental protocol\n",
+			"conn=%" PRIu64 " op=%d repl=\"%s\": Begin incremental protocol\n",
 			connid, opid, repl_root);
 		isInc = PR_TRUE;
 	}
@@ -618,7 +617,7 @@ multimaster_extop_StartNSDS50ReplicationRequest(Slapi_PBlock *pb)
 			connext->repl_protocol_version = REPL_PROTOCOL_50_TOTALUPDATE;
 		}
 		slapi_log_error(SLAPI_LOG_REPL, repl_plugin_name,
-				"conn=%d op=%d repl=\"%s\": Begin total protocol\n",
+				"conn=%" PRIu64 " op=%d repl=\"%s\": Begin total protocol\n",
 				connid, opid, repl_root);
 		isInc = PR_FALSE;
 	}
@@ -627,7 +626,7 @@ multimaster_extop_StartNSDS50ReplicationRequest(Slapi_PBlock *pb)
 		/* Stash info that this is an incremental update session */
 		connext->repl_protocol_version = REPL_PROTOCOL_50_INCREMENTAL;
 		slapi_log_error(SLAPI_LOG_REPL, repl_plugin_name,
-			"conn=%d op=%d repl=\"%s\": Begin 7.1 incremental protocol\n",
+			"conn=%" PRIu64 " op=%d repl=\"%s\": Begin 7.1 incremental protocol\n",
 			connid, opid, repl_root);
 		isInc = PR_TRUE;
 	}
@@ -639,7 +638,7 @@ multimaster_extop_StartNSDS50ReplicationRequest(Slapi_PBlock *pb)
 			connext->repl_protocol_version = REPL_PROTOCOL_71_TOTALUPDATE;
 		}
 		slapi_log_error(SLAPI_LOG_REPL, repl_plugin_name,
-				"conn=%d op=%d repl=\"%s\": Begin 7.1 total protocol\n",
+				"conn=%" PRIu64 " op=%d repl=\"%s\": Begin 7.1 total protocol\n",
 				connid, opid, repl_root);
 		isInc = PR_FALSE;
 	}
@@ -661,7 +660,7 @@ multimaster_extop_StartNSDS50ReplicationRequest(Slapi_PBlock *pb)
 	if (replica_is_being_configured(repl_root))
 	{
         slapi_log_error(SLAPI_LOG_REPL, repl_plugin_name,
-				"conn=%d op=%d replica=\"%s\": "
+				"conn=%" PRIu64 " op=%d replica=\"%s\": "
 				"Replica is being configured: try again later\n",
 				connid, opid, repl_root);
 		response = NSDS50_REPL_REPLICA_BUSY;
@@ -714,7 +713,7 @@ multimaster_extop_StartNSDS50ReplicationRequest(Slapi_PBlock *pb)
 				{
 					response = NSDS50_REPL_EXCESSIVE_CLOCK_SKEW;
 					slapi_log_error(SLAPI_LOG_FATAL, repl_plugin_name,
-									"conn=%d op=%d repl=\"%s\": "
+									"conn=%" PRIu64 " op=%d repl=\"%s\": "
 									"Excessive clock skew from supplier RUV\n",
 									connid, opid, repl_root);
 					goto send_response;
@@ -750,7 +749,7 @@ multimaster_extop_StartNSDS50ReplicationRequest(Slapi_PBlock *pb)
 
 	if (check_replica_id_uniqueness(replica, supplier_ruv) != 0){
         slapi_log_error(SLAPI_LOG_REPL, repl_plugin_name,
-				"conn=%d op=%d repl=\"%s\": "
+				"conn=%" PRIu64 " op=%d repl=\"%s\": "
 				"Replica has same replicaID %d as supplier\n",
 				connid, opid, repl_root, replica_get_rid(replica));
 		response = NSDS50_REPL_REPLICAID_ERROR;
@@ -763,7 +762,7 @@ multimaster_extop_StartNSDS50ReplicationRequest(Slapi_PBlock *pb)
 	 * the session's conn id and op id to identify the the supplier.
 	 */
 	/* junkrc = ruv_get_first_id_and_purl(supplier_ruv, &junkrid, &locking_purl); */
-	PR_snprintf(locking_session, sizeof(locking_session), "conn=%d id=%d", connid, opid);
+	PR_snprintf(locking_session, sizeof(locking_session), "conn=%" PRIu64 " id=%d", connid, opid);
 	locking_purl = &locking_session[0];
 	if (replica_get_exclusive_access(replica, &isInc, connid, opid,
 									 locking_purl,
@@ -877,7 +876,7 @@ send_response:
 		}
 
         slapi_log_error (resp_log_level, repl_plugin_name,
-			"conn=%d op=%d replica=\"%s\": "
+			"conn=%" PRIu64 " op=%d replica=\"%s\": "
 			"Unable to acquire replica: error: %s%s\n",
 			connid, opid,
 			(replica ? slapi_sdn_get_dn(replica_get_root(replica)) : "unknown"),
@@ -901,7 +900,7 @@ send_response:
 	slapi_pblock_set(pb, SLAPI_EXT_OP_RET_OID, REPL_NSDS50_REPLICATION_RESPONSE_OID);
 	slapi_pblock_set(pb, SLAPI_EXT_OP_RET_VALUE, resp_bval);
 	slapi_log_error(SLAPI_LOG_REPL, repl_plugin_name,
-					"conn=%d op=%d repl=\"%s\": "
+					"conn=%" PRIu64 " op=%d repl=\"%s\": "
 					"StartNSDS50ReplicationRequest: response=%d rc=%d\n",
 					connid, opid, repl_root,
 					response, rc);
@@ -1008,7 +1007,8 @@ multimaster_extop_EndNSDS50ReplicationRequest(Slapi_PBlock *pb)
 	ber_int_t response;
 	void *conn;
 	consumer_connection_extension *connext = NULL;
-	int connid=-1, opid=-1;
+	PRUint64 connid = 0;
+	int opid=-1;
 
 	/* Decode the extended operation */
 	if (decode_endrepl_extop(pb, &repl_root) == -1)

+ 46 - 14
ldap/servers/plugins/replication/replutil.c

@@ -817,16 +817,17 @@ repl_chain_on_update(Slapi_PBlock *pb, Slapi_DN * target_dn,
 	int repl_op = 0;
 	int local_backend = -1; /* index of local backend */
 	int chaining_backend = -1; /* index of chain backend */
+	int is_internal = 0;
 	PRBool local_online = PR_FALSE; /* true if the local db is online */
 	int ii;
 	int opid;
 #ifdef DEBUG_CHAIN_ON_UPDATE
-	int connid;
+	PRUint64 connid = 0;
 #endif
 	slapi_pblock_get(pb, SLAPI_OPERATION, &op);
 #ifdef DEBUG_CHAIN_ON_UPDATE
 	if (operation_is_flag_set(op, OP_FLAG_INTERNAL)) {
-		connid=-1;  /* -1: internal op in a log msg */
+		is_internal = 1;
 	} else {
 		slapi_pblock_get(pb, SLAPI_CONN_ID, &connid);
 	}
@@ -853,11 +854,18 @@ repl_chain_on_update(Slapi_PBlock *pb, Slapi_DN * target_dn,
 			}
 		}
 #ifdef DEBUG_CHAIN_ON_UPDATE
-		slapi_log_error(SLAPI_LOG_REPL, repl_plugin_name, "repl_chain_on_update: conn=%d op=%d be "
-			"%s is the %s backend and is %s\n",
-			connid, opid,
-			mtn_be_names[ii], (chaining_backend == ii) ? "chaining" : "local",
-			(mtn_be_states[ii] == SLAPI_BE_STATE_ON) ? "online" : "offline");
+		if (is_internal) {
+			slapi_log_error(SLAPI_LOG_REPL, repl_plugin_name, "repl_chain_on_update: conn=-1 op=%d be "
+				"%s is the %s backend and is %s\n", opid,
+				mtn_be_names[ii], (chaining_backend == ii) ? "chaining" : "local",
+				(mtn_be_states[ii] == SLAPI_BE_STATE_ON) ? "online" : "offline");
+		} else {
+			slapi_log_error(SLAPI_LOG_REPL, repl_plugin_name, "repl_chain_on_update: conn=%" PRIu64 " op=%d be "
+				"%s is the %s backend and is %s\n", connid, opid,
+				mtn_be_names[ii], (chaining_backend == ii) ? "chaining" : "local",
+				(mtn_be_states[ii] == SLAPI_BE_STATE_ON) ? "online" : "offline");
+
+		}
 #endif
 	}
 
@@ -880,9 +888,13 @@ repl_chain_on_update(Slapi_PBlock *pb, Slapi_DN * target_dn,
 	    (op_type == SLAPI_OPERATION_UNBIND) ||
 	    (op_type == SLAPI_OPERATION_COMPARE))) {
 #ifdef DEBUG_CHAIN_ON_UPDATE
-		slapi_log_error(SLAPI_LOG_REPL, repl_plugin_name, "repl_chain_on_update: conn=%d op=%d op is "
-						"%d: using local backend\n",
-						connid, opid, op_type);
+		if (is_internal) {
+			slapi_log_error(SLAPI_LOG_REPL, repl_plugin_name, "repl_chain_on_update: conn=-1 op=%d op is "
+						"%d: using local backend\n", opid, op_type);
+		} else {
+			slapi_log_error(SLAPI_LOG_REPL, repl_plugin_name, "repl_chain_on_update: conn=%" PRIu64 " op=%d op is "
+						"%d: using local backend\n", connid, opid, op_type);
+		}
 #endif
 		return local_backend;
 	}
@@ -899,8 +911,13 @@ repl_chain_on_update(Slapi_PBlock *pb, Slapi_DN * target_dn,
 	slapi_pblock_get(pb, SLAPI_REQUESTOR_DN, &requestor_dn);
 	if (slapi_dn_isroot(requestor_dn)) {
 #ifdef DEBUG_CHAIN_ON_UPDATE
-		slapi_log_error(SLAPI_LOG_REPL, repl_plugin_name, "repl_chain_on_update: conn=%d op=%d requestor "
+		if (is_internal) {
+			slapi_log_error(SLAPI_LOG_REPL, repl_plugin_name, "repl_chain_on_update: conn=-1 op=%d requestor "
+						"is root: using local backend\n", opid);
+		} else {
+			slapi_log_error(SLAPI_LOG_REPL, repl_plugin_name, "repl_chain_on_update: conn=%" PRIu64 " op=%d requestor "
 						"is root: using local backend\n", connid, opid);
+		}
 #endif
 		return local_backend;
 	}
@@ -911,8 +928,13 @@ repl_chain_on_update(Slapi_PBlock *pb, Slapi_DN * target_dn,
 	slapi_pblock_get(pb, SLAPI_IS_REPLICATED_OPERATION, &repl_op);
 	if (repl_op) {
 #ifdef DEBUG_CHAIN_ON_UPDATE
-		slapi_log_error(SLAPI_LOG_REPL, repl_plugin_name, "repl_chain_on_update: conn=%d op=%d op is "
+		if (is_internal) {
+			slapi_log_error(SLAPI_LOG_REPL, repl_plugin_name, "repl_chain_on_update: conn=-1 op=%d op is "
+						"replicated: using local backend\n", opid);
+		} else {
+			slapi_log_error(SLAPI_LOG_REPL, repl_plugin_name, "repl_chain_on_update: conn=%" PRIu64 " op=%d op is "
 						"replicated: using local backend\n", connid, opid);
+		}
 #endif
 		return local_backend;
 	}
@@ -923,8 +945,13 @@ repl_chain_on_update(Slapi_PBlock *pb, Slapi_DN * target_dn,
         extern int config_get_pw_is_global_policy();
         if (!config_get_pw_is_global_policy()) {
 #ifdef DEBUG_CHAIN_ON_UPDATE
-            slapi_log_error(SLAPI_LOG_REPL, repl_plugin_name, "repl_chain_on_update: conn=%d op=%d using "
+            if (is_internal) {
+                slapi_log_error(SLAPI_LOG_REPL, repl_plugin_name, "repl_chain_on_update: conn=-1 op=%d using "
+                            "local backend for local password policy\n", opid);
+            } else {
+                slapi_log_error(SLAPI_LOG_REPL, repl_plugin_name, "repl_chain_on_update: conn=%" PRIu64 " op=%d using "
                             "local backend for local password policy\n", connid, opid);
+            }
 #endif
             return local_backend;
         }
@@ -935,8 +962,13 @@ repl_chain_on_update(Slapi_PBlock *pb, Slapi_DN * target_dn,
 	 * use the chaining backend 
 	 */
 #ifdef DEBUG_CHAIN_ON_UPDATE
-	slapi_log_error(SLAPI_LOG_REPL, repl_plugin_name, "repl_chain_on_update: conn=%d op=%d using "
+	if (is_internal) {
+		slapi_log_error(SLAPI_LOG_REPL, repl_plugin_name, "repl_chain_on_update: conn=-1 op=%d using "
+					"chaining backend\n", opid);
+	} else {
+		slapi_log_error(SLAPI_LOG_REPL, repl_plugin_name, "repl_chain_on_update: conn=%" PRIu64 " op=%d using "
 					"chaining backend\n", connid, opid);
+	}
 #endif
 	return chaining_backend;
 }

+ 3 - 3
ldap/servers/slapd/abandon.c

@@ -153,15 +153,15 @@ do_abandon( Slapi_PBlock *pb )
 	}
 
 	if ( NULL == o ) {
-		slapi_log_access( LDAP_DEBUG_STATS, "conn=%d op=%d ABANDON"
+		slapi_log_access( LDAP_DEBUG_STATS, "conn=%" PRIu64 " op=%d ABANDON"
 			" targetop=NOTFOUND msgid=%d\n",
 			pb->pb_conn->c_connid, pb->pb_op->o_opid, id );
 	} else if ( suppressed_by_plugin ) {
-		slapi_log_access( LDAP_DEBUG_STATS, "conn=%d op=%d ABANDON"
+		slapi_log_access( LDAP_DEBUG_STATS, "conn=%" PRIu64"  op=%d ABANDON"
 			" targetop=SUPPRESSED-BY-PLUGIN msgid=%d\n",
 			pb->pb_conn->c_connid, pb->pb_op->o_opid, id );
 	} else {
-		slapi_log_access( LDAP_DEBUG_STATS, "conn=%d op=%d ABANDON"
+		slapi_log_access( LDAP_DEBUG_STATS, "conn=%" PRIu64 " op=%d ABANDON"
 			" targetop=%d msgid=%d nentries=%d etime=%ld\n",
 			pb->pb_conn->c_connid, pb->pb_op->o_opid, o->o_opid, id,
 			o->o_results.r.r_search.nentries, current_time() - o->o_time );

+ 2 - 2
ldap/servers/slapd/add.c

@@ -166,7 +166,7 @@ do_add( Slapi_PBlock *pb )
 			if (( rc = slapi_entry_add_values( e, normtype, vals ))
 				!= LDAP_SUCCESS ) {
 				slapi_log_access( LDAP_DEBUG_STATS, 
-					"conn=%d op=%d ADD dn=\"%s\", add values for type %s failed\n",
+					"conn=%" PRIu64 " op=%d ADD dn=\"%s\", add values for type %s failed\n",
 					pb->pb_conn->c_connid, operation->o_opid, 
 					escape_string( slapi_entry_get_dn_const(e), ebuf ), normtype );
 				send_ldap_result( pb, rc, NULL, NULL, 0, NULL );
@@ -432,7 +432,7 @@ static void op_shared_add (Slapi_PBlock *pb)
 	{
 		if ( !internal_op )
 		{
-			slapi_log_access(LDAP_DEBUG_STATS, "conn=%d op=%d ADD dn=\"%s\"\n",
+			slapi_log_access(LDAP_DEBUG_STATS, "conn=%" PRIu64 " op=%d ADD dn=\"%s\"\n",
 							 pb->pb_conn->c_connid, 
 							 operation->o_opid,
 							 escape_string(slapi_entry_get_dn_const(e), ebuf));

+ 8 - 8
ldap/servers/slapd/auth.c

@@ -391,7 +391,7 @@ handle_bad_certificate (void* clientData, PRFileDesc *prfd)
     char* subject = subject_of (clientCert);
     char* issuer  = issuer_of  (clientCert);
     slapi_log_access( LDAP_DEBUG_STATS,
-	       "conn=%d " SLAPI_COMPONENT_NAME_NSPR " error %i (%s); unauthenticated client %s; issuer %s\n",
+	       "conn=%" PRIu64 " " SLAPI_COMPONENT_NAME_NSPR " error %i (%s); unauthenticated client %s; issuer %s\n",
 	       conn->c_connid, errorCode, slapd_pr_strerror(errorCode),
 	       subject ? escape_string( subject, sbuf ) : "NULL",
 	       issuer  ? escape_string( issuer,  ibuf ) : "NULL" );
@@ -425,7 +425,7 @@ handle_handshake_done (PRFileDesc *prfd, void* clientData)
 	if ( (slapd_ssl_getChannelInfo (prfd, &channelInfo, sizeof(channelInfo))) != SECSuccess ) {
 		PRErrorCode errorCode = PR_GetError();
 		slapi_log_access (LDAP_DEBUG_STATS,
-			"conn=%d SSL failed to obtain channel info; "
+			"conn=%" PRIu64 " SSL failed to obtain channel info; "
 			SLAPI_COMPONENT_NAME_NSPR " error %i (%s)\n",
 			conn->c_connid, errorCode, slapd_pr_strerror(errorCode));
 		return;
@@ -434,7 +434,7 @@ handle_handshake_done (PRFileDesc *prfd, void* clientData)
 			!= SECSuccess) {
 		PRErrorCode errorCode = PR_GetError();
 		slapi_log_access (LDAP_DEBUG_STATS,
-			"conn=%d SSL failed to obtain cipher info; "
+			"conn=%" PRIu64 " SSL failed to obtain cipher info; "
 			SLAPI_COMPONENT_NAME_NSPR " error %i (%s)\n",
 			conn->c_connid, errorCode, slapd_pr_strerror(errorCode));
 		return;
@@ -455,13 +455,13 @@ handle_handshake_done (PRFileDesc *prfd, void* clientData)
     }
 
     if (config_get_SSLclientAuth() == SLAPD_SSLCLIENTAUTH_OFF ) {
-		slapi_log_access (LDAP_DEBUG_STATS, "conn=%d SSL %i-bit %s\n",
+		slapi_log_access (LDAP_DEBUG_STATS, "conn=%" PRIu64 " SSL %i-bit %s\n",
 		   		conn->c_connid, keySize, cipher ? cipher : "NULL" );
 		slapi_ch_free_string(&cipher);
 		return;
     } 
     if (clientCert == NULL) {
-	slapi_log_access (LDAP_DEBUG_STATS, "conn=%d SSL %i-bit %s\n",
+	slapi_log_access (LDAP_DEBUG_STATS, "conn=%" PRIu64 " SSL %i-bit %s\n",
 		   conn->c_connid, keySize, cipher ? cipher : "NULL" );
     } else {
 	char* subject = subject_of (clientCert);
@@ -469,7 +469,7 @@ handle_handshake_done (PRFileDesc *prfd, void* clientData)
 	    char* issuer  = issuer_of (clientCert);
 	    char sbuf[ BUFSIZ ], ibuf[ BUFSIZ ];
 	    slapi_log_access( LDAP_DEBUG_STATS,
-		       "conn=%d SSL %i-bit %s; client %s; issuer %s\n",
+		       "conn=%" PRIu64 " SSL %i-bit %s; client %s; issuer %s\n",
 		       conn->c_connid, keySize, cipher ? cipher : "NULL",
 		       subject ? escape_string( subject, sbuf ) : "NULL",
 		       issuer  ? escape_string( issuer,  ibuf ) : "NULL");
@@ -507,11 +507,11 @@ handle_handshake_done (PRFileDesc *prfd, void* clientData)
 
     if (clientDN != NULL) {
         char ebuf[ BUFSIZ ];
-        slapi_log_access (LDAP_DEBUG_STATS, "conn=%d SSL client bound as %s\n",
+        slapi_log_access (LDAP_DEBUG_STATS, "conn=%" PRIu64 " SSL client bound as %s\n",
     	       conn->c_connid, escape_string( clientDN, ebuf ));
     } else if (clientCert != NULL) {
         slapi_log_access (LDAP_DEBUG_STATS,
-		"conn=%d SSL failed to map client certificate to LDAP DN (%s)\n",
+		"conn=%" PRIu64 " SSL failed to map client certificate to LDAP DN (%s)\n",
     	       conn->c_connid, extraErrorMsg );
     }
 

+ 16 - 0
ldap/servers/slapd/back-ldbm/back-ldbm.h

@@ -59,6 +59,22 @@
 #endif
 #endif
 
+/* Required to get portable printf/scanf format macros */
+#ifdef HAVE_INTTYPES_H
+#include <inttypes.h>
+
+/* NSPR uses the print macros a bit differently than ANSI C.  We
+ * need to use ll for a 64-bit integer, even when a long is 64-bit.
+ */
+#undef PRIu64
+#define PRIu64  "llu"
+#undef PRI64
+#define PRI64   "ll"
+
+#else
+#error Need to define portable format macros such as PRIu64
+#endif /* HAVE_INTTYPES_H */
+
 /* A bunch of random system headers taken from all the source files, no source file should #include
    any system headers now */
 #include <stdio.h>

+ 2 - 2
ldap/servers/slapd/back-ldbm/ldbm_delete.c

@@ -93,7 +93,7 @@ ldbm_back_delete( Slapi_PBlock *pb )
 	
 	if (pb->pb_conn)
 	{
-		slapi_log_error (SLAPI_LOG_TRACE, "ldbm_back_delete", "enter conn=%d op=%d\n", pb->pb_conn->c_connid, operation->o_opid);
+		slapi_log_error (SLAPI_LOG_TRACE, "ldbm_back_delete", "enter conn=%" PRIu64 " op=%d\n", pb->pb_conn->c_connid, operation->o_opid);
 	}
 
 	is_fixup_operation = operation_is_flag_set(operation, OP_FLAG_REPL_FIXUP);
@@ -666,7 +666,7 @@ diskfull_return:
 	slapi_ch_free_string(&e_uniqueid);
 	if (pb->pb_conn)
 	{
-		slapi_log_error (SLAPI_LOG_TRACE, "ldbm_back_delete", "leave conn=%d op=%d\n", pb->pb_conn->c_connid, operation->o_opid);
+		slapi_log_error (SLAPI_LOG_TRACE, "ldbm_back_delete", "leave conn=%" PRIu64 " op=%d\n", pb->pb_conn->c_connid, operation->o_opid);
 	}
 	return rc;
 }

+ 2 - 2
ldap/servers/slapd/back-ldbm/ldbm_modrdn.c

@@ -117,7 +117,7 @@ ldbm_back_modrdn( Slapi_PBlock *pb )
 
 	if (pb->pb_conn)
 	{
-		slapi_log_error (SLAPI_LOG_TRACE, "ldbm_back_modrdn", "enter conn=%d op=%d\n", pb->pb_conn->c_connid, operation->o_opid);
+		slapi_log_error (SLAPI_LOG_TRACE, "ldbm_back_modrdn", "enter conn=%" PRIu64 " op=%d\n", pb->pb_conn->c_connid, operation->o_opid);
 	}
 
 	inst = (ldbm_instance *) be->be_instance_info;
@@ -862,7 +862,7 @@ common_return:
     slapi_pblock_set( pb, SLAPI_ENTRY_POST_OP, postentry );
 	if (pb->pb_conn)
 	{
-		slapi_log_error (SLAPI_LOG_TRACE, "ldbm_back_modrdn", "leave conn=%d op=%d\n", pb->pb_conn->c_connid, operation->o_opid);
+		slapi_log_error (SLAPI_LOG_TRACE, "ldbm_back_modrdn", "leave conn=%" PRIu64 " op=%d\n", pb->pb_conn->c_connid, operation->o_opid);
 	}
 	return retval;
 }

+ 2 - 2
ldap/servers/slapd/back-ldbm/misc.c

@@ -68,7 +68,7 @@ void ldbm_nasty(const char* str, int c, int err)
 void ldbm_log_access_message(Slapi_PBlock *pblock,char *string)
 {
     int ret = 0;
-    int connection_id = 0;
+    PRUint64 connection_id = 0;
     int operation_id = 0;
     Operation *operation = NULL; /* DBDB this is sneaky---opid should be covered by the API directly */
 
@@ -81,7 +81,7 @@ void ldbm_log_access_message(Slapi_PBlock *pblock,char *string)
         return;
     }
     operation_id = operation->o_opid;
-    slapi_log_access( LDAP_DEBUG_STATS, "conn=%d op=%d %s\n",connection_id, operation_id,string);
+    slapi_log_access( LDAP_DEBUG_STATS, "conn=%" PRIu64 " op=%d %s\n",connection_id, operation_id,string);
 }
 
 int return_on_disk_full(struct ldbminfo  *li)

+ 4 - 4
ldap/servers/slapd/bind.c

@@ -686,25 +686,25 @@ log_bind_access (
 
     if (method == LDAP_AUTH_SASL && saslmech && msg) {
         slapi_log_access( LDAP_DEBUG_STATS, 
-                          "conn=%d op=%d BIND dn=\"%s\" "
+                          "conn=%" PRIu64 " op=%d BIND dn=\"%s\" "
                           "method=sasl version=%d mech=%s, %s\n",
                           pb->pb_conn->c_connid, pb->pb_op->o_opid, edn, 
                           version, saslmech, msg );
     } else if (method == LDAP_AUTH_SASL && saslmech) {
         slapi_log_access( LDAP_DEBUG_STATS, 
-                          "conn=%d op=%d BIND dn=\"%s\" "
+                          "conn=%" PRIu64 " op=%d BIND dn=\"%s\" "
                           "method=sasl version=%d mech=%s\n",
                           pb->pb_conn->c_connid, pb->pb_op->o_opid, edn, 
                           version, saslmech );
     } else if (msg) {
         slapi_log_access( LDAP_DEBUG_STATS, 
-                          "conn=%d op=%d BIND dn=\"%s\" "
+                          "conn=%" PRIu64 " op=%d BIND dn=\"%s\" "
                           "method=%d version=%d, %s\n",
                           pb->pb_conn->c_connid, pb->pb_op->o_opid, edn, 
                           method, version, msg );
     } else {
         slapi_log_access( LDAP_DEBUG_STATS, 
-                          "conn=%d op=%d BIND dn=\"%s\" "
+                          "conn=%" PRIu64 " op=%d BIND dn=\"%s\" "
                           "method=%d version=%d\n",
                           pb->pb_conn->c_connid, pb->pb_op->o_opid, edn, 
                           method, version );

+ 1 - 1
ldap/servers/slapd/compare.c

@@ -122,7 +122,7 @@ do_compare( Slapi_PBlock *pb )
 	    dn, ava.ava_type, 0 );
 
 	slapi_log_access( LDAP_DEBUG_STATS,
-	    "conn=%d op=%d CMP dn=\"%s\" attr=\"%s\"\n",
+	    "conn=%" PRIu64 " op=%d CMP dn=\"%s\" attr=\"%s\"\n",
 	    pb->pb_conn->c_connid, pb->pb_op->o_opid,
 	    escape_string( dn, ebuf ), ava.ava_type );
 

+ 44 - 46
ldap/servers/slapd/connection.c

@@ -147,14 +147,14 @@ connection_cleanup(Connection *conn)
 	if (conn->c_prfd && (conn->c_flags & CONN_FLAG_SSL))
 	{
 		LDAPDebug( LDAP_DEBUG_CONNS,
-		  "conn=%d fd=%d closed now\n",
+		  "conn=%" PRIu64 " fd=%d closed now\n",
 		  conn->c_connid, conn->c_sd,0);
 		PR_Close(conn->c_prfd);
 	}
 	else if (conn->c_sd)
 	{
 		LDAPDebug( LDAP_DEBUG_CONNS,
-		  "conn=%d fd=%d closed now\n",
+		  "conn=%" PRIu64 " fd=%d closed now\n",
 		  conn->c_connid, conn->c_sd,0);
 		closesocket(conn->c_sd);
 	}
@@ -217,9 +217,7 @@ connection_reset(Connection* conn, int ns, PRNetAddr * from, int fromLen, int is
     LDAPDebug( LDAP_DEBUG_CONNS, "new %sconnection on %d\n", pTmp, conn->c_sd, 0 );
 
     /* bump our count of connections and update SNMP stats */
-    PR_Lock( num_conns_mutex );
-    conn->c_connid = num_conns++;
-    PR_Unlock( num_conns_mutex );
+    conn->c_connid = slapi_counter_increment(num_conns);
 
     if (! in_referral_mode) {
 	snmp_increment_counter(g_get_global_snmp_vars()->ops_tbl.dsConnectionSeq);
@@ -354,7 +352,7 @@ connection_reset(Connection* conn, int ns, PRNetAddr * from, int fromLen, int is
 
     /* log useful stuff to our access log */
     slapi_log_access( LDAP_DEBUG_STATS,
-	    "conn=%d fd=%d slot=%d %sconnection from %s to %s\n",
+	    "conn=%" PRIu64 " fd=%d slot=%d %sconnection from %s to %s\n",
 	    conn->c_connid, conn->c_sd, ns, pTmp, str_ip, str_destip );
 
     /* initialize the remaining connection fields */
@@ -454,7 +452,7 @@ connection_need_new_password(const Connection *conn, const Operation *op, Slapi_
 		op->o_tag != LDAP_REQ_ABANDON )
 	{
 		slapi_add_pwd_control ( pb, LDAP_CONTROL_PWEXPIRED, 0);	
-		slapi_log_access( LDAP_DEBUG_STATS, "conn=%d op=%d %s\n",
+		slapi_log_access( LDAP_DEBUG_STATS, "conn=%" PRIu64 " op=%d %s\n",
            	pb->pb_conn->c_connid, pb->pb_op->o_opid, 
 			"need new password" );
 		send_ldap_result( pb, LDAP_UNWILLING_TO_PERFORM, 
@@ -524,7 +522,7 @@ connection_dispatch_operation(Connection *conn, Operation *op, Slapi_PBlock *pb)
 		{
 			ret = setsockopt(conn->c_sd,IPPROTO_TCP,TCP_CORK,&i,sizeof(i));
 			if (ret < 0) {
-				LDAPDebug(LDAP_DEBUG_ANY, "Failed to set TCP_CORK on connection %d\n",conn->c_connid, 0, 0);
+				LDAPDebug(LDAP_DEBUG_ANY, "Failed to set TCP_CORK on connection %" PRIu64 "\n",conn->c_connid, 0, 0);
 			}
 		}
 #endif
@@ -538,7 +536,7 @@ connection_dispatch_operation(Connection *conn, Operation *op, Slapi_PBlock *pb)
 		{
 			ret = setsockopt(conn->c_sd,IPPROTO_TCP,TCP_CORK,&i,sizeof(i));
 			if (ret < 0) {
-				LDAPDebug(LDAP_DEBUG_ANY, "Failed to clear TCP_CORK on connection %d\n",conn->c_connid, 0, 0);
+				LDAPDebug(LDAP_DEBUG_ANY, "Failed to clear TCP_CORK on connection %" PRIu64 "\n",conn->c_connid, 0, 0);
 			}
 		}
 	}
@@ -564,7 +562,7 @@ connection_dispatch_operation(Connection *conn, Operation *op, Slapi_PBlock *pb)
 
 	default:
 		LDAPDebug( LDAP_DEBUG_ANY,
-		    "ignoring unknown LDAP request (conn=%d, tag=0x%lx)\n",
+		    "ignoring unknown LDAP request (conn=%" PRIu64 ", tag=0x%lx)\n",
 		    conn->c_connid, op->o_tag, 0 );
 		break;
 	}
@@ -576,7 +574,7 @@ int connection_release_nolock (Connection *conn)
     if (conn->c_refcnt <= 0)
     {
         slapi_log_error(SLAPI_LOG_FATAL, "connection",
-		                "conn=%d fd=%d Attempt to release connection that is not aquired\n",
+		                "conn=%" PRIu64 " fd=%d Attempt to release connection that is not aquired\n",
 			            conn->c_connid, conn->c_sd);
         PR_ASSERT (PR_FALSE);
         return -1;
@@ -597,7 +595,7 @@ int connection_acquire_nolock (Connection *conn)
     {
 	/* This may happen while other threads are still working on this connection */
         slapi_log_error(SLAPI_LOG_FATAL, "connection",
-		                "conn=%d fd=%d Attempt to acquire connection in the closing state\n",
+		                "conn=%" PRIu64 " fd=%d Attempt to acquire connection in the closing state\n",
 			            conn->c_connid, conn->c_sd);
         return -1;
     }
@@ -775,7 +773,7 @@ static int handle_read_data(Connection *conn,Operation **op,
 	/* if connection is closing */
 	if (return_value != 0) {
 	    LDAPDebug(LDAP_DEBUG_CONNS,
-		      "handle_read_data returns as conn %d closing, fd=%d\n",
+		      "handle_read_data returns as conn %" PRIu64 " closing, fd=%d\n",
 		      conn->c_connid,conn->c_sd,0);
 	    return return_value;
 	}
@@ -838,7 +836,7 @@ static int process_operation(Connection *conn, Operation *op)
 		!= LDAP_TAG_MSGID ) {
 		/* log, close and send error */
 		LDAPDebug( LDAP_DEBUG_ANY,
-			"conn=%d unable to read tag for incoming request\n", conn->c_connid, 0, 0 );
+			"conn=%" PRIu64 " unable to read tag for incoming request\n", conn->c_connid, 0, 0 );
 		return_value = -1;
 		goto done;
 	}
@@ -850,7 +848,7 @@ static int process_operation(Connection *conn, Operation *op)
 	  case LDAP_TAG_LDAPDN: /* optional username, for CLDAP */
 		/* log, close and send error */
 		LDAPDebug( LDAP_DEBUG_ANY,
-			"conn=%d ber_peek_tag returns 0x%lx\n", conn->c_connid, tag, 0 );
+			"conn=%" PRIu64 " ber_peek_tag returns 0x%lx\n", conn->c_connid, tag, 0 );
 		return_value = -1;
 		goto done;
 	  default:
@@ -981,7 +979,7 @@ static int connection_operation_new(Connection *conn, Operation **ppOp)
 	PR_Lock( conn->c_mutex );
 	if (connection_is_active_nolock(conn) == 0) {
 	    LDAPDebug(LDAP_DEBUG_CONNS,
-		      "not creating a new operation when conn %d closing\n",
+		      "not creating a new operation when conn %" PRIu64 " closing\n",
 		      conn->c_connid,0,0);
 	    PR_Unlock( conn->c_mutex );
 	    return -1;
@@ -1073,7 +1071,7 @@ static int read_the_data(Connection *conn, int *process_op, int *defer_io, int *
 				So, we toss it away ! */
 				if (LBER_OVERFLOW == tag) {
 					slapi_log_error( SLAPI_LOG_FATAL, "connection",
-						"conn=%d fd=%d The length of BER Element was too long.\n",
+						"conn=%" PRIu64 " fd=%d The length of BER Element was too long.\n",
 						conn->c_connid, conn->c_sd );
 				}
 				PR_Lock( conn->c_mutex );
@@ -1110,7 +1108,7 @@ static int read_the_data(Connection *conn, int *process_op, int *defer_io, int *
 				 * We received a non-LDAP message.  Log and close connection.
 				 */
 				LDAPDebug( LDAP_DEBUG_ANY,
-					"conn=%d received a non-LDAP message"
+					"conn=%" PRIu64 " received a non-LDAP message"
 					" (tag 0x%lx, expected 0x%lx)\n",
 					conn->c_connid, tag, LDAP_TAG_MESSAGE );
 				PR_Lock( conn->c_mutex );
@@ -1128,7 +1126,7 @@ static int read_the_data(Connection *conn, int *process_op, int *defer_io, int *
 		if (Bytes_Scanned != Bytes_Read) {
 		        if (connection_increment_reference(conn) == -1) {
 			    LDAPDebug(LDAP_DEBUG_CONNS,
-				      "could not acquire lock in issue_new_read as conn %d closing fd=%d\n",
+				      "could not acquire lock in issue_new_read as conn %" PRIu64 " closing fd=%d\n",
 				      conn->c_connid,conn->c_sd,0); 
 			    /* XXX how to handle this error? */
 			    /* MAB: 25 Jan 01: let's try like this and pray this won't leak... */
@@ -1150,7 +1148,7 @@ static int read_the_data(Connection *conn, int *process_op, int *defer_io, int *
 					 */
 					connection_decrement_reference(conn);
 					LDAPDebug(LDAP_DEBUG_CONNS,
-						  "push_back_data failed: closing conn %d fd=%d\n",
+						  "push_back_data failed: closing conn %" PRIu64 " fd=%d\n",
 						  conn->c_connid,conn->c_sd,0); 
 				}
 			} else {
@@ -1248,7 +1246,7 @@ int issue_new_read(Connection *conn)
 
 	if (connection_increment_reference(conn) == -1) {
 	    LDAPDebug(LDAP_DEBUG_CONNS,
-		      "could not acquire lock in issue_new_read as conn %d closing fd=%d\n",
+		      "could not acquire lock in issue_new_read as conn %" PRIu64 " closing fd=%d\n",
 		      conn->c_connid,conn->c_sd,0); 
 	    /* This means that the connection is closing */
 	    return -1;
@@ -1410,7 +1408,7 @@ int connection_activity(Connection *conn)
 	   be decremented in wait_for_new_work(). */
 	if (connection_acquire_nolock (conn) == -1) {
 	    LDAPDebug(LDAP_DEBUG_CONNS,
-		      "could not acquire lock in connection_activity as conn %d closing fd=%d\n",
+		      "could not acquire lock in connection_activity as conn %" PRIu64 " closing fd=%d\n",
 		      conn->c_connid,conn->c_sd,0); 
 	    /* XXX how to handle this error? */
 	    /* MAB: 25 Jan 01: let's return on error and pray this won't leak */
@@ -1646,7 +1644,7 @@ get_next_from_buffer( void *buffer, size_t buffer_size, ber_len_t *lenp,
 		syserr = errno;
 		/* Bad stuff happened, like the client sent us some junk */
 		LDAPDebug( LDAP_DEBUG_CONNS,
-			"ber_get_next failed for connection %d\n", conn->c_connid, 0, 0 );
+			"ber_get_next failed for connection %" PRIu64 "\n", conn->c_connid, 0, 0 );
 		/* reset private buffer */
 		conn->c_private->c_buffer_bytes = conn->c_private->c_buffer_offset = 0;
 
@@ -1715,7 +1713,7 @@ int connection_read_operation(Connection *conn, Operation *op, ber_tag_t *tag, i
 		ret = sasl_io_setup(conn);
 		if (ret) {
 			LDAPDebug( LDAP_DEBUG_ANY,
-				"conn=%d unable to enable SASL I/O\n", conn->c_connid, 0, 0 );
+				"conn=%" PRIu64 " unable to enable SASL I/O\n", conn->c_connid, 0, 0 );
 				disconnect_server( conn, conn->c_connid, -1, SLAPD_DISCONNECT_BAD_BER_TAG, EPROTO );
 			return CONN_DONE;
 		}
@@ -1776,7 +1774,7 @@ int connection_read_operation(Connection *conn, Operation *op, ber_tag_t *tag, i
 					} else {
 						/* Otherwise we loop, unless we exceeded the ioblock timeout */
 						if (waits_done > ioblocktimeout_waits) {
-							LDAPDebug( LDAP_DEBUG_CONNS,"ioblock timeout expired on connection %d\n", conn->c_connid, 0, 0 );
+							LDAPDebug( LDAP_DEBUG_CONNS,"ioblock timeout expired on connection %" PRIu64 "\n", conn->c_connid, 0, 0 );
 							disconnect_server( conn, conn->c_connid, -1,
 									SLAPD_DISCONNECT_IO_TIMEOUT, 0 );
 							return CONN_DONE;
@@ -1796,7 +1794,7 @@ int connection_read_operation(Connection *conn, Operation *op, ber_tag_t *tag, i
 					err = PR_GetError();
 					syserr = PR_GetOSError();
 					LDAPDebug( LDAP_DEBUG_ANY,
-						"PR_Poll for connection %d returns %d (%s)\n", conn->c_connid, err, slapd_pr_strerror( err ) );
+						"PR_Poll for connection %" PRIu64 " returns %d (%s)\n", conn->c_connid, err, slapd_pr_strerror( err ) );
 					/* If this happens we should close the connection */
 					disconnect_server( conn, conn->c_connid, -1, err, syserr );
 					return CONN_DONE;
@@ -1805,7 +1803,7 @@ int connection_read_operation(Connection *conn, Operation *op, ber_tag_t *tag, i
 				/* Some other error, typically meaning bad stuff */
 					syserr = PR_GetOSError();
 					LDAPDebug( LDAP_DEBUG_CONNS,
-						"PR_Recv for connection %d returns %d (%s)\n", conn->c_connid, err, slapd_pr_strerror( err ) );
+						"PR_Recv for connection %" PRIu64 " returns %d (%s)\n", conn->c_connid, err, slapd_pr_strerror( err ) );
 					/* If this happens we should close the connection */
 					disconnect_server( conn, conn->c_connid, -1, err, syserr );
 					return CONN_DONE;
@@ -1837,7 +1835,7 @@ int connection_read_operation(Connection *conn, Operation *op, ber_tag_t *tag, i
 		 * We received a non-LDAP message.  Log and close connection.
 		 */
 		LDAPDebug( LDAP_DEBUG_ANY,
-			"conn=%d received a non-LDAP message (tag 0x%lx, expected 0x%lx)\n",
+			"conn=%" PRIu64 " received a non-LDAP message (tag 0x%lx, expected 0x%lx)\n",
 			conn->c_connid, *tag, LDAP_TAG_MESSAGE );
 		disconnect_server( conn, conn->c_connid, -1,
 			SLAPD_DISCONNECT_BAD_BER_TAG, EPROTO );
@@ -1848,7 +1846,7 @@ int connection_read_operation(Connection *conn, Operation *op, ber_tag_t *tag, i
 		!= LDAP_TAG_MSGID ) {
 		/* log, close and send error */
 		LDAPDebug( LDAP_DEBUG_ANY,
-			"conn=%d unable to read tag for incoming request\n", conn->c_connid, 0, 0 );
+			"conn=%" PRIu64 " unable to read tag for incoming request\n", conn->c_connid, 0, 0 );
 		disconnect_server( conn, conn->c_connid, -1, SLAPD_DISCONNECT_BAD_BER_TAG, EPROTO );
 		return CONN_DONE;
 	}
@@ -1865,7 +1863,7 @@ int connection_read_operation(Connection *conn, Operation *op, ber_tag_t *tag, i
 	  case LDAP_TAG_LDAPDN: /* optional username, for CLDAP */
 		/* log, close and send error */
 		LDAPDebug( LDAP_DEBUG_ANY,
-			"conn=%d ber_peek_tag returns 0x%lx\n", conn->c_connid, *tag, 0 );
+			"conn=%" PRIu64 " ber_peek_tag returns 0x%lx\n", conn->c_connid, *tag, 0 );
 		disconnect_server( conn, conn->c_connid, -1, SLAPD_DISCONNECT_BER_PEEK, EPROTO );
 		return CONN_DONE;
 	  default:
@@ -1902,7 +1900,7 @@ void connection_check_activity_level(Connection *conn)
 	/* update the last checked time */
 	conn->c_private->previous_count_check_time = current_time();
 	PR_Unlock( conn->c_mutex );
-	LDAPDebug(LDAP_DEBUG_CONNS,"conn %d activity level = %d\n",conn->c_connid,delta_count,0); 
+	LDAPDebug(LDAP_DEBUG_CONNS,"conn %" PRIu64 " activity level = %d\n",conn->c_connid,delta_count,0); 
 }
 
 typedef struct table_iterate_info_struct {
@@ -1957,7 +1955,7 @@ void connection_enter_leave_turbo(Connection *conn, int *new_turbo_flag)
 	} else {
 	  double activet = 0.0;
 	  connection_find_our_rank(conn,&connection_count, &our_rank);
-	  LDAPDebug(LDAP_DEBUG_CONNS,"conn %d turbo rank = %d out of %d conns\n",conn->c_connid,our_rank,connection_count); 
+	  LDAPDebug(LDAP_DEBUG_CONNS,"conn %" PRIu64 " turbo rank = %d out of %d conns\n",conn->c_connid,our_rank,connection_count); 
 	  activet = (double)g_get_active_threadcnt();
 	  threshold_rank = (int)(activet * ((double)CONN_TURBO_PERCENTILE / 100.0));
 
@@ -1999,9 +1997,9 @@ void connection_enter_leave_turbo(Connection *conn, int *new_turbo_flag)
 	PR_Unlock(conn->c_mutex);
 	if (current_mode != new_mode) {
 		if (current_mode) {
-			LDAPDebug(LDAP_DEBUG_CONNS,"conn %d leaving turbo mode\n",conn->c_connid,0,0); 
+			LDAPDebug(LDAP_DEBUG_CONNS,"conn %" PRIu64 " leaving turbo mode\n",conn->c_connid,0,0); 
 		} else {
-			LDAPDebug(LDAP_DEBUG_CONNS,"conn %d entering turbo mode\n",conn->c_connid,0,0); 
+			LDAPDebug(LDAP_DEBUG_CONNS,"conn %" PRIu64 " entering turbo mode\n",conn->c_connid,0,0); 
 		}
 	}
 	*new_turbo_flag = new_mode;
@@ -2092,7 +2090,7 @@ connection_threadmain()
 		/* turn off turbo mode immediately if any pb waiting in global queue */
 		if (thread_turbo_flag && (counter > 0)) {
 			thread_turbo_flag = 0;
-			LDAPDebug(LDAP_DEBUG_CONNS,"conn %d leaving turbo mode\n",conn->c_connid,0,0); 
+			LDAPDebug(LDAP_DEBUG_CONNS,"conn %" PRIu64 " leaving turbo mode\n",conn->c_connid,0,0); 
 		}
 #endif
 		
@@ -2235,7 +2233,7 @@ connection_activity(Connection *conn)
 
 	if (connection_acquire_nolock (conn) == -1) {
 	    LDAPDebug(LDAP_DEBUG_CONNS,
-		      "could not acquire lock in connection_activity as conn %d closing fd=%d\n",
+		      "could not acquire lock in connection_activity as conn %" PRIu64 " closing fd=%d\n",
 		      conn->c_connid,conn->c_sd,0); 
 	    /* XXX how to handle this error? */
 	    /* MAB: 25 Jan 01: let's return on error and pray this won't leak */
@@ -2355,9 +2353,9 @@ op_thread_cleanup()
 static void
 connection_add_operation(Connection* conn,Operation* op)
 {
-    Operation **olist= &conn->c_ops;
-    int	id= conn->c_opsinitiated++;
-    int connid= conn->c_connid;
+	Operation **olist= &conn->c_ops;
+	int	id= conn->c_opsinitiated++;
+	PRUint64 connid = conn->c_connid;
 	Operation **tmp;
 
 	/* slapi_ch_stop_recording(); */
@@ -2387,7 +2385,7 @@ connection_remove_operation( Connection *conn, Operation *op )
 
 	if ( *tmp == NULL )
 	{
-		LDAPDebug( LDAP_DEBUG_ANY, "connection_remove_operation: can't find op %d for conn %d\n",
+		LDAPDebug( LDAP_DEBUG_ANY, "connection_remove_operation: can't find op %d for conn %" PRIu64 "\n",
 		    (int)op->o_msgid, conn->c_connid, 0 );
 	}
 	else
@@ -2498,13 +2496,13 @@ log_ber_too_big_error(const Connection *conn, ber_len_t ber_len,
 	}
 	if (0 == ber_len) {
 		slapi_log_error( SLAPI_LOG_FATAL, "connection",
-			"conn=%d fd=%d Incoming BER Element was too long, max allowable"
+			"conn=%" PRIu64 " fd=%d Incoming BER Element was too long, max allowable"
 			" is %u bytes. Change the nsslapd-maxbersize attribute in"
 			" cn=config to increase.\n",
 			conn->c_connid, conn->c_sd, maxbersize );
 	} else {
 		slapi_log_error( SLAPI_LOG_FATAL, "connection",
-			"conn=%d fd=%d Incoming BER Element was %u bytes, max allowable"
+			"conn=%" PRIu64 " fd=%d Incoming BER Element was %u bytes, max allowable"
 			" is %u bytes. Change the nsslapd-maxbersize attribute in"
 			" cn=config to increase.\n",
 			conn->c_connid, conn->c_sd, ber_len, maxbersize );
@@ -2513,7 +2511,7 @@ log_ber_too_big_error(const Connection *conn, ber_len_t ber_len,
 
 
 void
-disconnect_server( Connection *conn, int opconnid, int opid, PRErrorCode reason, PRInt32 error )
+disconnect_server( Connection *conn, PRUint64 opconnid, int opid, PRErrorCode reason, PRInt32 error )
 {
 	PR_Lock( conn->c_mutex );
 	disconnect_server_nomutex( conn, opconnid, opid, reason, error );
@@ -2530,7 +2528,7 @@ static ps_wakeup_all_fn_ptr ps_wakeup_all_fn = NULL;
  */
 
 void
-disconnect_server_nomutex( Connection *conn, int opconnid, int opid, PRErrorCode reason, PRInt32 error )
+disconnect_server_nomutex( Connection *conn, PRUint64 opconnid, int opid, PRErrorCode reason, PRInt32 error )
 {
     if ( ( conn->c_sd != SLAPD_INVALID_SOCKET &&
 	conn->c_connid == opconnid ) && !(conn->c_flags & CONN_FLAG_CLOSING) ) { 
@@ -2557,13 +2555,13 @@ disconnect_server_nomutex( Connection *conn, int opconnid, int opid, PRErrorCode
 	 */
 	if (error && (EPIPE != error) ) {
 	    slapi_log_access( LDAP_DEBUG_STATS,
-		  "conn=%d op=%d fd=%d closed error %d (%s) - %s\n",
+		  "conn=%" PRIu64 " op=%d fd=%d closed error %d (%s) - %s\n",
 		  conn->c_connid, opid, conn->c_sd, error,
 		  slapd_system_strerror(error),
 		  slapd_pr_strerror(reason));
 	} else {
 	    slapi_log_access( LDAP_DEBUG_STATS,
-		  "conn=%d op=%d fd=%d closed - %s\n",
+		  "conn=%" PRIu64 " op=%d fd=%d closed - %s\n",
 		  conn->c_connid, opid, conn->c_sd,
 		  slapd_pr_strerror(reason));
 	}

+ 1 - 3
ldap/servers/slapd/conntable.c

@@ -449,9 +449,7 @@ connection_table_as_entry(Connection_Table *ct, Slapi_Entry *e)
 	val.bv_len = strlen( buf );
 	attrlist_replace( &e->e_attrs, "currentconnections", vals );
 
-	PR_Lock( num_conns_mutex );
-	sprintf( buf, "%d", num_conns );
-	PR_Unlock( num_conns_mutex );
+	sprintf( buf, "%" PRIu64, slapi_counter_get_value(num_conns));
 	val.bv_val = buf;
 	val.bv_len = strlen( buf );
 	attrlist_replace( &e->e_attrs, "totalconnections", vals );

+ 2 - 2
ldap/servers/slapd/daemon.c

@@ -1496,7 +1496,7 @@ handle_pr_read_ready(Connection_Table *ct, PRIntn num_poll)
 						 * trying to acquire a closing connection
 						 */
 						LDAPDebug (LDAP_DEBUG_ANY,
-							"connection_activity: abandoning conn %d as fd=%d is already closing\n",
+							"connection_activity: abandoning conn %" PRIu64 " as fd=%d is already closing\n",
 							c->c_connid,c->c_sd,0); 
 						/* The call disconnect_server should do nothing,
 						 * as the connection c should be already set to CLOSING */
@@ -2216,7 +2216,7 @@ bail:
 	if(conn->c_dn)
 	{
 		/* log the auto bind */
-		slapi_log_access(LDAP_DEBUG_STATS, "conn=%d AUTOBIND dn=\"%s\"\n", conn->c_connid, conn->c_dn);
+		slapi_log_access(LDAP_DEBUG_STATS, "conn=%" PRIu64 " AUTOBIND dn=\"%s\"\n", conn->c_connid, conn->c_dn);
 	}
 
 	return ret;

+ 1 - 1
ldap/servers/slapd/delete.c

@@ -257,7 +257,7 @@ static void op_shared_delete (Slapi_PBlock *pb)
 	{
 		if (!internal_op )
 		{
-			slapi_log_access(LDAP_DEBUG_STATS, "conn=%d op=%d DEL dn=\"%s\"\n",
+			slapi_log_access(LDAP_DEBUG_STATS, "conn=%" PRIu64 " op=%d DEL dn=\"%s\"\n",
 							pb->pb_conn->c_connid, 
 							pb->pb_op->o_opid,
 							escape_string(dn, ebuf));

+ 2 - 2
ldap/servers/slapd/extendop.c

@@ -267,14 +267,14 @@ do_extended( Slapi_PBlock *pb )
 	if ( NULL == ( name = extended_op_oid2string( extoid ))) {
 		LDAPDebug( LDAP_DEBUG_ARGS, "do_extended: oid (%s)\n", extoid, 0, 0 );
 
-		slapi_log_access( LDAP_DEBUG_STATS, "conn=%d op=%d EXT oid=\"%s\"\n",
+		slapi_log_access( LDAP_DEBUG_STATS, "conn=%" PRIu64 " op=%d EXT oid=\"%s\"\n",
 				pb->pb_conn->c_connid, pb->pb_op->o_opid, extoid );
 	} else {
 		LDAPDebug( LDAP_DEBUG_ARGS, "do_extended: oid (%s-%s)\n",
 				extoid, name, 0 );
 
 		slapi_log_access( LDAP_DEBUG_STATS,
-			"conn=%d op=%d EXT oid=\"%s\" name=\"%s\"\n",
+			"conn=%" PRIu64 " op=%d EXT oid=\"%s\" name=\"%s\"\n",
 			pb->pb_conn->c_connid, pb->pb_op->o_opid, extoid, name );
 	}
 

+ 1 - 2
ldap/servers/slapd/fe.h

@@ -61,8 +61,7 @@ extern PRInt32 ops_completed;
 extern PRLock *ops_mutex;
 extern PRThread *listener_tid;
 extern PRThread *listener_tid;
-extern int num_conns;
-extern PRLock *num_conns_mutex;
+extern Slapi_Counter *num_conns;
 extern char *pid_file;
 extern char *start_pid_file;
 extern int should_detach;

+ 2 - 2
ldap/servers/slapd/globals.c

@@ -91,8 +91,8 @@ Slapi_PBlock	*repl_pb = NULL;
 PRInt32		ops_initiated;
 PRInt32		ops_completed;
 PRLock		*ops_mutex;
-int		num_conns;
-PRLock		*num_conns_mutex;
+Slapi_Counter	*num_conns;
+
 
 /*
   DEC/COMPAQ has released a patch for 4.0d (e?) which will speed up

+ 5 - 2
ldap/servers/slapd/init.c

@@ -70,14 +70,17 @@ slapd_init()
 	}
 #endif /* _WIN32 */
 
+	/* We don't worry about free'ing this stuff
+         * since the only time we want to do that is when
+         * the process is exiting. */
 	ops_mutex = PR_NewLock();
-	num_conns_mutex = PR_NewLock();
+	num_conns = slapi_counter_new();
 	g_set_num_sent_mutex( PR_NewLock() );
 	g_set_current_conn_count_mutex( PR_NewLock() );
+
 	slapd_re_init();
 
 	if ( ops_mutex == NULL ||
-	    num_conns_mutex == NULL ||
 	    g_get_num_sent_mutex() == NULL ||
 	    g_get_current_conn_count_mutex() == NULL )
 	{

+ 4 - 4
ldap/servers/slapd/modify.c

@@ -575,7 +575,7 @@ static void op_shared_modify (Slapi_PBlock *pb, int pw_change, char *old_pw)
 	{ 
 		if ( !internal_op )
 		{
-			slapi_log_access(LDAP_DEBUG_STATS, "conn=%d op=%d MOD dn=\"%s\"\n",
+			slapi_log_access(LDAP_DEBUG_STATS, "conn=%" PRIu64 " op=%d MOD dn=\"%s\"\n",
 							 pb->pb_conn->c_connid, 
 							 pb->pb_op->o_opid,
 							 escape_string(slapi_sdn_get_dn(&sdn), ebuf));
@@ -956,7 +956,7 @@ static int op_shared_allow_pw_change (Slapi_PBlock *pb, LDAPMod *mod, char **old
 
 			if (operation_is_flag_set(operation,OP_FLAG_ACTION_LOG_ACCESS))
 			{
-				slapi_log_access(LDAP_DEBUG_STATS, "conn=%d op=%d MOD dn=\"%s\", %s\n",
+				slapi_log_access(LDAP_DEBUG_STATS, "conn=%" PRIu64 " op=%d MOD dn=\"%s\", %s\n",
 	    						 pb->pb_conn->c_connid, pb->pb_op->o_opid,
 	    						 escape_string(slapi_sdn_get_dn(&sdn), ebuf), 
 								 "user is not allowed to change password");
@@ -976,7 +976,7 @@ static int op_shared_allow_pw_change (Slapi_PBlock *pb, LDAPMod *mod, char **old
 		{
 			if ( !internal_op )
 			{
-				slapi_log_access(LDAP_DEBUG_STATS, "conn=%d op=%d MOD dn=\"%s\", %s\n",
+				slapi_log_access(LDAP_DEBUG_STATS, "conn=%" PRIu64 " op=%d MOD dn=\"%s\", %s\n",
 								 pb->pb_conn->c_connid, 
 								 pb->pb_op->o_opid,
 								 escape_string(slapi_sdn_get_dn(&sdn), ebuf), 
@@ -1011,7 +1011,7 @@ static int op_shared_allow_pw_change (Slapi_PBlock *pb, LDAPMod *mod, char **old
 				{
 					if ( !internal_op )
 					{
-						slapi_log_access(LDAP_DEBUG_STATS, "conn=%d op=%d MOD dn=\"%s\", %s\n",
+						slapi_log_access(LDAP_DEBUG_STATS, "conn=%" PRIu64 " op=%d MOD dn=\"%s\", %s\n",
 										 pb->pb_conn->c_connid, 
 										 pb->pb_op->o_opid,
 										 escape_string(slapi_sdn_get_dn(&sdn), ebuf), "invalid password syntax");

+ 3 - 3
ldap/servers/slapd/modrdn.c

@@ -351,7 +351,7 @@ op_shared_rename(Slapi_PBlock *pb, int passin_args)
 		if ( !internal_op )
 		{
 			slapi_log_access(LDAP_DEBUG_STATS,
-					 "conn=%d op=%d MODRDN dn=\"%s\" newrdn=\"%s\" newsuperior=\"%s\"\n",
+					 "conn=%" PRIu64 " op=%d MODRDN dn=\"%s\" newrdn=\"%s\" newsuperior=\"%s\"\n",
 					 pb->pb_conn->c_connid, 
 					 pb->pb_op->o_opid,
 					 escape_string(dn, dnbuf),
@@ -374,7 +374,7 @@ op_shared_rename(Slapi_PBlock *pb, int passin_args)
 	if ((rdns = ldap_explode_rdn(newrdn, 0)) == NULL) 
 	{
 		slapi_log_error(SLAPI_LOG_FATAL, NULL, 
-				 "conn=%d op=%d MODRDN invalid new RDN (\"%s\")\n",
+				 "conn=%" PRIu64 " op=%d MODRDN invalid new RDN (\"%s\")\n",
 				 pb->pb_conn->c_connid,
 				 pb->pb_op->o_opid,
 				 (NULL == newrdn) ? "(null)" : newrdn);
@@ -391,7 +391,7 @@ op_shared_rename(Slapi_PBlock *pb, int passin_args)
 	{
 		LDAPDebug(LDAP_DEBUG_ARGS, "ldap_explode_dn of newSuperior failed\n", 0, 0, 0);
 		slapi_log_error(SLAPI_LOG_FATAL, NULL,
-				 "conn=%d op=%d MODRDN invalid new superior (\"%s\")",
+				 "conn=%" PRIu64 " op=%d MODRDN invalid new superior (\"%s\")",
 				 pb->pb_conn->c_connid,
 				 pb->pb_op->o_opid,
 				 (NULL == newsuperior) ? "(null)" : newsuperiorbuf);

+ 2 - 2
ldap/servers/slapd/opshared.c

@@ -230,7 +230,7 @@ op_shared_search (Slapi_PBlock *pb, int send_result)
   {
       char *fmtstr;
         
-#define SLAPD_SEARCH_FMTSTR_BASE "conn=%d op=%d SRCH base=\"%s\" scope=%d "
+#define SLAPD_SEARCH_FMTSTR_BASE "conn=%" PRIu64 " op=%d SRCH base=\"%s\" scope=%d "
 #define SLAPD_SEARCH_FMTSTR_BASE_INT "conn=%s op=%d SRCH base=\"%s\" scope=%d "
 #define SLAPD_SEARCH_FMTSTR_REMAINDER " attrs=%s%s\n"
 
@@ -1329,7 +1329,7 @@ static int  send_results (Slapi_PBlock *pb, int send_result, int * nentries)
 void op_shared_log_error_access (Slapi_PBlock *pb, const char *type, const char *dn, const char *msg)
 {
 	char ebuf[BUFSIZ];
-	slapi_log_access( LDAP_DEBUG_STATS, "conn=%d op=%d %s dn=\"%s\", %s\n",
+	slapi_log_access( LDAP_DEBUG_STATS, "conn=%" PRIu64 " op=%d %s dn=\"%s\", %s\n",
 		              ( pb->pb_conn ? pb->pb_conn->c_connid : 0), 
 					  ( pb->pb_op ? pb->pb_op->o_opid : 0), 
 					  type, 

+ 2 - 2
ldap/servers/slapd/pblock.c

@@ -188,7 +188,7 @@ slapi_pblock_get( Slapi_PBlock *pblock, int arg, void *value )
 		          "Connection is NULL and hence cannot access SLAPI_CONN_ID \n", 0, 0, 0 );
 			return (-1);
 		}
-		(*(int *)value) = pblock->pb_conn->c_connid;
+		(*(PRUint64 *)value) = pblock->pb_conn->c_connid;
 		break;
 	case SLAPI_CONN_DN:
 		/*
@@ -1665,7 +1665,7 @@ slapi_pblock_set( Slapi_PBlock *pblock, int arg, void *value )
 		          "Connection is NULL and hence cannot access SLAPI_CONN_ID \n", 0, 0, 0 );
 			return (-1);
 		}
-		pblock->pb_conn->c_connid = *((int *) value);
+		pblock->pb_conn->c_connid = *((PRUint64 *) value);
 		break;
 	case SLAPI_CONN_DN:
             /*

+ 1 - 1
ldap/servers/slapd/plugin_internal_op.c

@@ -188,7 +188,7 @@ slapi_disconnect_server(Slapi_Connection *conn)
 static get_disconnect_server_fn_ptr disconnect_server_fn = NULL;
 
 void
-do_disconnect_server(Connection *conn, int opconnid, int opid)
+do_disconnect_server(Connection *conn, PRUint64 opconnid, int opid)
 {
     if (NULL == disconnect_server_fn) {
         if (get_entry_point(ENTRY_POINT_DISCONNECT_SERVER, (caddr_t *)(&disconnect_server_fn)) < 0) {

+ 3 - 3
ldap/servers/slapd/proto-slap.h

@@ -825,7 +825,7 @@ void g_set_num_sent_mutex( PRLock *plock );
 void g_set_default_referral( struct berval **ldap_url );
 struct berval	**g_get_default_referral();
 PRLock *g_get_num_sent_mutex();
-void disconnect_server( Connection *conn, int opconnid, int opid, PRErrorCode reason, PRInt32 error );
+void disconnect_server( Connection *conn, PRUint64 opconnid, int opid, PRErrorCode reason, PRInt32 error );
 int send_ldap_search_entry( Slapi_PBlock *pb, Slapi_Entry *e, LDAPControl **ectrls,
 	char **attrs, int attrsonly );
 void send_ldap_result( Slapi_PBlock *pb, int err, char *matched, char *text,
@@ -839,7 +839,7 @@ int send_ldap_referral( Slapi_PBlock *pb, Slapi_Entry *e, struct berval **refs,
 	struct berval ***urls );
 int send_ldapv3_referral( Slapi_PBlock *pb, struct berval **urls );
 int set_db_default_result_handlers(Slapi_PBlock *pb);
-void disconnect_server_nomutex( Connection *conn, int opconnid, int opid, PRErrorCode reason, PRInt32 error );
+void disconnect_server_nomutex( Connection *conn, PRUint64 opconnid, int opid, PRErrorCode reason, PRInt32 error );
 long g_get_current_conn_count();
 void g_increment_current_conn_count();
 void g_decrement_current_conn_count();
@@ -1075,7 +1075,7 @@ Slapi_Backend *defbackend_get_backend( void );
 /*
  * plugin_internal_op.c
  */
-void do_disconnect_server( Connection *conn, int opconnid, int opid );
+void do_disconnect_server( Connection *conn, PRUint64 opconnid, int opid );
 
 /*
  * regex.c

+ 5 - 5
ldap/servers/slapd/psearch.c

@@ -305,7 +305,7 @@ ps_send_results( void *arg )
 
 	if (conn_acq_flag) {
 		slapi_log_error(SLAPI_LOG_CONNS, "Persistent Search",
-						"conn=%d op=%d Could not acquire the connection - psearch aborted\n",
+						"conn=%" PRIu64 " op=%d Could not acquire the connection - psearch aborted\n",
 						ps->ps_pblock->pb_conn->c_connid, ps->ps_pblock->pb_op->o_opid);
 	}
 
@@ -315,7 +315,7 @@ ps_send_results( void *arg )
 	/* Check for an abandoned operation */
 	if ( ps->ps_pblock->pb_op == NULL || slapi_op_abandoned( ps->ps_pblock ) ) {
 		slapi_log_error(SLAPI_LOG_CONNS, "Persistent Search",
-						"conn=%d op=%d The operation has been abandoned\n",
+						"conn=%" PRIu64 " op=%d The operation has been abandoned\n",
 						ps->ps_pblock->pb_conn->c_connid, ps->ps_pblock->pb_op->o_opid);
 	    break;
 	}
@@ -373,7 +373,7 @@ ps_send_results( void *arg )
 										 ectrls, attrs, attrsonly );
 			if (rc) {
 				slapi_log_error(SLAPI_LOG_CONNS, "Persistent Search",
-								"conn=%d op=%d Error %d sending entry %s with op status %d\n",
+								"conn=%" PRIu64 " op=%d Error %d sending entry %s with op status %d\n",
 								ps->ps_pblock->pb_conn->c_connid, ps->ps_pblock->pb_op->o_opid,
 								rc, slapi_entry_get_dn_const(ec), ps->ps_pblock->pb_op->o_status);
 			}
@@ -421,7 +421,7 @@ ps_send_results( void *arg )
     PR_Lock( ps->ps_pblock->pb_conn->c_mutex );
 
 	slapi_log_error(SLAPI_LOG_CONNS, "Persistent Search",
-					"conn=%d op=%d Releasing the connection and operation\n",
+					"conn=%" PRIu64 " op=%d Releasing the connection and operation\n",
 					ps->ps_pblock->pb_conn->c_connid, ps->ps_pblock->pb_op->o_opid);
     /* Delete this op from the connection's list */
     connection_remove_operation( ps->ps_pblock->pb_conn, ps->ps_pblock->pb_op );
@@ -557,7 +557,7 @@ ps_service_persistent_searches( Slapi_Entry *e, Slapi_Entry *eprev, ber_int_t ch
 		}
 
 		slapi_log_error(SLAPI_LOG_CONNS, "Persistent Search",
-						"conn=%d op=%d entry %s with chgtype %d "
+						"conn=%" PRIu64 " op=%d entry %s with chgtype %d "
 						"matches the ps changetype %d\n",
 						ps->ps_pblock->pb_conn->c_connid, ps->ps_pblock->pb_op->o_opid,
 						edn, chgtype, ps->ps_changetypes);

+ 5 - 5
ldap/servers/slapd/result.c

@@ -1689,7 +1689,7 @@ log_result( Slapi_PBlock *pb, Operation *op, int err, ber_tag_t tag,
 			if ( !internal_op )
 			{
 				slapi_log_access( LDAP_DEBUG_STATS,
-								  "conn=%d op=%d RESULT err=%d"
+								  "conn=%" PRIu64 " op=%d RESULT err=%d"
 								  " tag=%u nentries=%d etime=%s%s%s"
 								  ", SASL bind in progress\n",
 								  op->o_connid, 
@@ -1721,7 +1721,7 @@ log_result( Slapi_PBlock *pb, Operation *op, int err, ber_tag_t tag,
 			if ( !internal_op )
 			{
 				slapi_log_access( LDAP_DEBUG_STATS,
-								  "conn=%d op=%d RESULT err=%d"
+								  "conn=%" PRIu64 " op=%d RESULT err=%d"
 								  " tag=%u nentries=%d etime=%s%s%s"
 								  " dn=\"%s\"\n",
 								  op->o_connid, 
@@ -1747,7 +1747,7 @@ log_result( Slapi_PBlock *pb, Operation *op, int err, ber_tag_t tag,
 			if ( !internal_op )
 			{
 				slapi_log_access( LDAP_DEBUG_STATS,
-								  "conn=%d op=%d RESULT err=%d"
+								  "conn=%" PRIu64 " op=%d RESULT err=%d"
 								  " tag=%u nentries=%d etime=%s%s%s\n",
 								  op->o_connid, 
 								  op->o_opid,
@@ -1780,7 +1780,7 @@ log_entry( Operation *op, Slapi_Entry *e )
 
 	if ( !internal_op )
 	{
-		slapi_log_access( LDAP_DEBUG_STATS2, "conn=%d op=%d ENTRY dn=\"%s\"\n",
+		slapi_log_access( LDAP_DEBUG_STATS2, "conn=%" PRIu64 " op=%d ENTRY dn=\"%s\"\n",
 			op->o_connid, op->o_opid,
 			escape_string( slapi_entry_get_dn_const(e), ebuf ));
 	}
@@ -1805,7 +1805,7 @@ log_referral( Operation *op )
 
 	if ( !internal_op )
 	{
-		slapi_log_access( LDAP_DEBUG_STATS2, "conn=%d op=%d REFERRAL\n",
+		slapi_log_access( LDAP_DEBUG_STATS2, "conn=%" PRIu64 " op=%d REFERRAL\n",
 			op->o_connid, op->o_opid );
 	}
 	else

+ 9 - 9
ldap/servers/slapd/sasl_io.c

@@ -82,7 +82,7 @@ sasl_io_enable(Connection *c)
     int ret = 0;
 
     LDAPDebug( LDAP_DEBUG_CONNS,
-                "sasl_io_enable for connection %d\n", c->c_connid, 0, 0 );
+                "sasl_io_enable for connection %" PRIu64 "\n", c->c_connid, 0, 0 );
     /* Flag that we should enable SASL I/O for the next read operation on this connection */
     c->c_enable_sasl_io = 1;
     
@@ -108,7 +108,7 @@ sasl_io_setup(Connection *c)
     sasl_io_private *sp = (sasl_io_private*) slapi_ch_calloc(1, sizeof(sasl_io_private));
 
     LDAPDebug( LDAP_DEBUG_CONNS,
-                "sasl_io_setup for connection %d\n", c->c_connid, 0, 0 );
+                "sasl_io_setup for connection %" PRIu64 "\n", c->c_connid, 0, 0 );
     /* Get the current functions and store them for later */
     real_iofns->lbextiofn_size = LBER_X_EXTIO_FNS_SIZE;
     ber_sockbuf_get_option( c->c_sb, LBER_SOCKBUF_OPT_EXT_IO_FNS, real_iofns );
@@ -142,7 +142,7 @@ sasl_io_cleanup(Connection *c)
     sasl_io_private *sp = c->c_sasl_io_private;
     if (sp) {
         LDAPDebug( LDAP_DEBUG_CONNS,
-                "sasl_io_cleanup for connection %d\n", c->c_connid, 0, 0 );
+                "sasl_io_cleanup for connection %" PRIu64 "\n", c->c_connid, 0, 0 );
         /* Free the buffers */
         slapi_ch_free((void**)&(sp->encrypted_buffer));
         slapi_ch_free((void**)&(sp->decrypted_buffer));
@@ -203,7 +203,7 @@ sasl_io_start_packet(Connection *c, PRInt32 *err)
     }
     if (ret != 0 && ret < sizeof(buffer)) {
         LDAPDebug( LDAP_DEBUG_ANY,
-            "failed to read sasl packet length on connection %d\n", c->c_connid, 0, 0 );
+            "failed to read sasl packet length on connection %" PRIu64 "\n", c->c_connid, 0, 0 );
         return -1;
         
     }
@@ -214,7 +214,7 @@ sasl_io_start_packet(Connection *c, PRInt32 *err)
         packet_length += 4;
 
         LDAPDebug( LDAP_DEBUG_CONNS,
-            "read sasl packet length %ld on connection %d\n", packet_length, c->c_connid, 0 );
+            "read sasl packet length %ld on connection %" PRIu64 "\n", packet_length, c->c_connid, 0 );
         sasl_io_resize_encrypted_buffer(c->c_sasl_io_private, packet_length);
         /* Cyrus SASL implementation expects to have the length at the first 
            4 bytes */
@@ -257,7 +257,7 @@ sasl_recv_connection(Connection *c, char *buffer, size_t count,PRInt32 *err)
 
     *err = 0;
     LDAPDebug( LDAP_DEBUG_CONNS,
-                "sasl_recv_connection for connection %d\n", c->c_connid, 0, 0 );
+                "sasl_recv_connection for connection %" PRIu64 "\n", c->c_connid, 0, 0 );
     /* Do we have decrypted data buffered from 'before' ? */
     bytes_in_buffer = sp->decrypted_buffer_count - sp->decrypted_buffer_offset;
     if (0 == bytes_in_buffer) {
@@ -284,12 +284,12 @@ sasl_recv_connection(Connection *c, char *buffer, size_t count,PRInt32 *err)
             const char *output_buffer = NULL;
             unsigned int output_length = 0;
             LDAPDebug( LDAP_DEBUG_CONNS,
-            "sasl_recv_connection finished reading packet for connection %d\n", c->c_connid, 0, 0 );
+            "sasl_recv_connection finished reading packet for connection %" PRIu64 "\n", c->c_connid, 0, 0 );
             /* Now decode it */
             ret = sasl_decode(c->c_sasl_conn,sp->encrypted_buffer,sp->encrypted_buffer_count,&output_buffer,&output_length);
             if (SASL_OK == ret) {
                 LDAPDebug( LDAP_DEBUG_CONNS,
-                "sasl_recv_connection decoded packet length %d for connection %d\n", output_length, c->c_connid, 0 );
+                "sasl_recv_connection decoded packet length %d for connection %" PRIu64 "\n", output_length, c->c_connid, 0 );
                 if (output_length) {
                     sasl_io_resize_decrypted_buffer(sp,output_length);
                     memcpy(sp->decrypted_buffer,output_buffer,output_length);
@@ -300,7 +300,7 @@ sasl_recv_connection(Connection *c, char *buffer, size_t count,PRInt32 *err)
                 }
             } else {
                 LDAPDebug( LDAP_DEBUG_ANY,
-                "sasl_recv_connection failed to decode packet for connection %d\n", c->c_connid, 0, 0 );
+                "sasl_recv_connection failed to decode packet for connection %" PRIu64 "\n", c->c_connid, 0, 0 );
             }
         }
     }

+ 1 - 1
ldap/servers/slapd/search.c

@@ -384,7 +384,7 @@ static void log_search_access (Slapi_PBlock *pb, const char *base, int scope, co
 {
 	char ebuf[BUFSIZ];
 	slapi_log_access(LDAP_DEBUG_STATS,
-					 "conn=%d op=%d SRCH base=\"%s\" scope=%d filter=\"%s\", %s\n",
+					 "conn=%" PRIu64 " op=%d SRCH base=\"%s\" scope=%d filter=\"%s\", %s\n",
 					 pb->pb_conn->c_connid, pb->pb_op->o_opid, 
 					 escape_string(base, ebuf), scope, fstr, msg ? msg : "");
 

+ 20 - 3
ldap/servers/slapd/slap.h

@@ -97,6 +97,7 @@ void *dlsym(void *a, char *b);
 #include <errno.h>
 #if defined(SOLARIS)
 #include <limits.h> /* for LONG_MAX */
+
 #endif
 
 /* there's a bug in the dbm code we import (from where?) -- FIXME */
@@ -116,6 +117,22 @@ void *dlsym(void *a, char *b);
 #define LDAP_IOCP
 #endif
 
+/* Required to get portable printf/scanf format macros */
+#ifdef HAVE_INTTYPES_H
+#include <inttypes.h>
+
+/* NSPR uses the print macros a bit differently than ANSI C.  We
+ * need to use ll for a 64-bit integer, even when a long is 64-bit.
+ */
+#undef PRIu64
+#define PRIu64	"llu"
+#undef PRI64
+#define PRI64	"ll"
+
+#else
+#error Need to define portable format macros such as PRIu64
+#endif /* HAVE_INTTYPES_H */
+
 #define LOG_INTERNAL_OP_CON_ID      "Internal"
 #define LOG_INTERNAL_OP_OP_ID       -1
 
@@ -1164,7 +1181,7 @@ typedef struct op {
 	Slapi_DN	o_sdn;		/* dn bound when op was initiated */
 	char		*o_authtype;	/* auth method used to bind dn	  */
 	int		o_opid;		/* id of this operation		  */
-	int		o_connid;	/* id of conn initiating this op; for logging only */
+	PRUint64	o_connid;	/* id of conn initiating this op; for logging only */
 	void		*o_handler_data;
 	result_handler		o_result_handler;
 	search_entry_handler	o_search_entry_handler;
@@ -1223,7 +1240,7 @@ typedef struct conn {
 	int				c_gettingber;	/* in the middle of ber_get_next  */
 	BerElement		*c_currentber;	/* ber we're getting              */
 	time_t			c_starttime;	/* when the connection was opened */
-	int				c_connid;	/* id of this connection for stats*/
+	PRUint64	c_connid;	/* id of this connection for stats*/
 	int				c_opsinitiated;	/* # ops initiated/next op id	  */
 	PRInt32			c_opscompleted;	/* # ops completed		  */
 	PRInt32			c_threadnumber; /* # threads used in this conn    */
@@ -1582,7 +1599,7 @@ struct snmp_vars_t{
 typedef void (*ps_wakeup_all_fn_ptr)( void );
 typedef void (*ps_service_fn_ptr)(Slapi_Entry *, Slapi_Entry *, int, int );
 typedef char *(*get_config_dn_fn_ptr)();
-typedef void (*get_disconnect_server_fn_ptr)(Connection *conn, int opconnid, int opid, PRErrorCode reason, PRInt32 error );
+typedef void (*get_disconnect_server_fn_ptr)(Connection *conn, PRUint64 opconnid, int opid, PRErrorCode reason, PRInt32 error );
 typedef int (*slapd_SSL_client_init_fn_ptr)( void );
 typedef int (*modify_config_dse_fn_ptr)( Slapi_PBlock *pb );
 typedef int (*slapd_ssl_init_fn_ptr)( void );

+ 12 - 0
ldap/servers/slapd/slapi-plugin.h

@@ -152,6 +152,7 @@ typedef struct slapi_rdn		Slapi_RDN;
 typedef struct slapi_mod		Slapi_Mod;
 typedef struct slapi_mods		Slapi_Mods;
 typedef struct slapi_componentid	Slapi_ComponentId;
+typedef struct slapi_counter		Slapi_Counter;
 
 /* Online tasks interface (to support import, export, etc) */
 #define SLAPI_TASK_PUBLIC 1 /* tell old plugins that the task api is now public */
@@ -1340,6 +1341,17 @@ Slapi_Task *slapi_new_task(const char *dn);
 void slapi_destroy_task(void *arg);
 /* End of interface to support online tasks **********************************/
 
+/* Slapi_Counter Interface */
+Slapi_Counter *slapi_counter_new();
+void slapi_counter_init(Slapi_Counter *counter);
+void slapi_counter_destroy(Slapi_Counter **counter);
+PRUint64 slapi_counter_increment(Slapi_Counter *counter);
+PRUint64 slapi_counter_decrement(Slapi_Counter *counter);
+PRUint64 slapi_counter_add(Slapi_Counter *counter, PRUint64 addvalue);
+PRUint64 slapi_counter_subtract(Slapi_Counter *counter, PRUint64 subvalue);
+PRUint64 slapi_counter_set_value(Slapi_Counter *counter, PRUint64 newvalue);
+PRUint64 slapi_counter_get_value(Slapi_Counter *counter);
+
 /* Binder-based (connection centric) resource limits */
 /*
  * Valid values for `type' parameter to slapi_reslimit_register().

+ 3 - 0
ldap/servers/slapd/snmp_collator.c

@@ -611,6 +611,9 @@ snmp_collator_update(time_t start_time, void *arg)
     }
 }
 
+/* NGK - We should not be using a plain int here.  All of these counters
+ * are PRUint32 types for now, but they will be PRUint64 once converted
+ * to use Slapi_Counter. */
 static void
 add_counter_to_value(Slapi_Entry *e, const char *type, int countervalue)
 {

+ 1 - 1
ldap/servers/slapd/stubrepl.c

@@ -74,6 +74,6 @@ connection_abandon_operations( Connection *conn )
 }
 
 void
-disconnect_server( Connection *conn, int opconnid, int opid, PRErrorCode reason, PRInt32 error )
+disconnect_server( Connection *conn, PRUint64 opconnid, int opid, PRErrorCode reason, PRInt32 error )
 {
 }

+ 3 - 3
ldap/servers/slapd/unbind.c

@@ -79,7 +79,7 @@ do_unbind( Slapi_PBlock *pb )
 	 *	UnBindRequest ::= NULL
 	 */
 	if ( ber_get_null( ber ) == LBER_ERROR ) {
-		slapi_log_access( LDAP_DEBUG_STATS, "conn=%d op=%d UNBIND,"
+		slapi_log_access( LDAP_DEBUG_STATS, "conn=%" PRIu64 " op=%d UNBIND,"
 				" decoding error: UnBindRequest not null\n",
 				pb->pb_conn->c_connid, operation->o_opid );
 		/* LDAPv3 does not allow a response to an unbind... so just return. */
@@ -92,7 +92,7 @@ do_unbind( Slapi_PBlock *pb )
 	 * pass them to the backend.
 	 */
 	if ( (err = get_ldapmessage_controls( pb, ber, NULL )) != 0 ) {
-		slapi_log_access( LDAP_DEBUG_STATS, "conn=%d op=%d UNBIND,"
+		slapi_log_access( LDAP_DEBUG_STATS, "conn=%" PRIu64 " op=%d UNBIND,"
 				" error processing controls - error %d (%s)\n",
 				pb->pb_conn->c_connid, operation->o_opid,
 				err, ldap_err2string( err ));
@@ -107,7 +107,7 @@ do_unbind( Slapi_PBlock *pb )
 
 	/* ONREPL - plugins should be called and passed bind dn and, possibly, other data */
 
-	slapi_log_access( LDAP_DEBUG_STATS, "conn=%d op=%d UNBIND\n",
+	slapi_log_access( LDAP_DEBUG_STATS, "conn=%" PRIu64 " op=%d UNBIND\n",
 	    pb->pb_conn->c_connid, operation->o_opid );
 
 	/* pass the unbind to all backends */

+ 2 - 2
ldap/servers/slapd/value.c

@@ -487,7 +487,7 @@ slapi_value_get_longlong(const Slapi_Value *value)
             p = slapi_ch_malloc(value->bv.bv_len + 1);
             memcpy (p, value->bv.bv_val, value->bv.bv_len);
             p [value->bv.bv_len] = '\0';
-            r = atoll(p);
+            r = strtoll(p, (char **)NULL, 0);
             slapi_ch_free((void **)&p);
         }
         return r;
@@ -503,7 +503,7 @@ slapi_value_get_ulonglong(const Slapi_Value *value)
             p = slapi_ch_malloc(value->bv.bv_len + 1);
             memcpy (p, value->bv.bv_val, value->bv.bv_len);
             p [value->bv.bv_len] = '\0';
-            r = (unsigned long long)atoll(p);
+            r = strtoull(p, (char **)NULL, 0);
             slapi_ch_free((void **)&p);
         }
         return r;

+ 150 - 83
ltmain.sh

@@ -1,8 +1,8 @@
 # ltmain.sh - Provide generalized library-building support services.
 # NOTE: Changing this file will not affect anything until you rerun configure.
 #
-# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005
-# Free Software Foundation, Inc.
+# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006,
+# 2007  Free Software Foundation, Inc.
 # Originally by Gordon Matzigkeit <[email protected]>, 1996
 #
 # This program is free software; you can redistribute it and/or modify
@@ -43,14 +43,22 @@ EXIT_FAILURE=1
 
 PROGRAM=ltmain.sh
 PACKAGE=libtool
-VERSION=1.5.22
-TIMESTAMP=" (1.1220.2.365 2005/12/18 22:14:06)"
-
-# See if we are running on zsh, and set the options which allow our
-# commands through without removal of \ escapes.
-if test -n "${ZSH_VERSION+set}" ; then
+VERSION=1.5.24
+TIMESTAMP=" (1.1220.2.456 2007/06/24 02:25:32)"
+
+# Be Bourne compatible (taken from Autoconf:_AS_BOURNE_COMPATIBLE).
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
+  emulate sh
+  NULLCMD=:
+  # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
+  # is contrary to our usage.  Disable this feature.
+  alias -g '${1+"$@"}'='"$@"'
   setopt NO_GLOB_SUBST
+else
+  case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac
 fi
+BIN_SH=xpg4; export BIN_SH # for Tru64
+DUALCASE=1; export DUALCASE # for MKS sh
 
 # Check that we have a working $echo.
 if test "X$1" = X--no-reexec; then
@@ -105,12 +113,14 @@ esac
 # These must not be set unconditionally because not all systems understand
 # e.g. LANG=C (notably SCO).
 # We save the old values to restore during execute mode.
-if test "${LC_ALL+set}" = set; then
-  save_LC_ALL="$LC_ALL"; LC_ALL=C; export LC_ALL
-fi
-if test "${LANG+set}" = set; then
-  save_LANG="$LANG"; LANG=C; export LANG
-fi
+for lt_var in LANG LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
+do
+  eval "if test \"\${$lt_var+set}\" = set; then
+	  save_$lt_var=\$$lt_var
+	  $lt_var=C
+	  export $lt_var
+	fi"
+done
 
 # Make sure IFS has a sensible default
 lt_nl='
@@ -136,6 +146,8 @@ duplicate_deps=no
 preserve_args=
 lo2o="s/\\.lo\$/.${objext}/"
 o2lo="s/\\.${objext}\$/.lo/"
+extracted_archives=
+extracted_serial=0
 
 #####################################
 # Shell function definitions:
@@ -196,7 +208,13 @@ func_win32_libid ()
     if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | \
       $EGREP -e 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then
       win32_nmres=`eval $NM -f posix -A $1 | \
-	$SED -n -e '1,100{/ I /{s,.*,import,;p;q;};}'`
+	$SED -n -e '1,100{
+		/ I /{
+			s,.*,import,
+			p
+			q
+			}
+		}'`
       case $win32_nmres in
       import*)  win32_libid_type="x86 archive import";;
       *)        win32_libid_type="x86 archive static";;
@@ -327,7 +345,17 @@ func_extract_archives ()
 	*) my_xabs=`pwd`"/$my_xlib" ;;
       esac
       my_xlib=`$echo "X$my_xlib" | $Xsed -e 's%^.*/%%'`
-      my_xdir="$my_gentop/$my_xlib"
+      my_xlib_u=$my_xlib
+      while :; do
+        case " $extracted_archives " in
+	*" $my_xlib_u "*)
+	  extracted_serial=`expr $extracted_serial + 1`
+	  my_xlib_u=lt$extracted_serial-$my_xlib ;;
+	*) break ;;
+	esac
+      done
+      extracted_archives="$extracted_archives $my_xlib_u"
+      my_xdir="$my_gentop/$my_xlib_u"
 
       $show "${rm}r $my_xdir"
       $run ${rm}r "$my_xdir"
@@ -454,11 +482,12 @@ do
     ;;
 
   --version)
-    $echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP"
-    $echo
-    $echo "Copyright (C) 2005  Free Software Foundation, Inc."
-    $echo "This is free software; see the source for copying conditions.  There is NO"
-    $echo "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
+    echo "\
+$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP
+
+Copyright (C) 2007  Free Software Foundation, Inc.
+This is free software; see the source for copying conditions.  There is NO
+warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
     exit $?
     ;;
 
@@ -755,9 +784,10 @@ if test -z "$show_help"; then
     *.class) xform=class ;;
     *.cpp) xform=cpp ;;
     *.cxx) xform=cxx ;;
-    *.f90) xform=f90 ;;
+    *.[fF][09]?) xform=[fF][09]. ;;
     *.for) xform=for ;;
     *.java) xform=java ;;
+    *.obj) xform=obj ;;
     esac
 
     libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"`
@@ -1138,8 +1168,9 @@ EOF
     for arg
     do
       case $arg in
-      -all-static | -static)
-	if test "X$arg" = "X-all-static"; then
+      -all-static | -static | -static-libtool-libs)
+	case $arg in
+	-all-static)
 	  if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
 	    $echo "$modename: warning: complete static linking is impossible in this configuration" 1>&2
 	  fi
@@ -1147,12 +1178,20 @@ EOF
 	    dlopen_self=$dlopen_self_static
 	  fi
 	  prefer_static_libs=yes
-	else
+	  ;;
+	-static)
 	  if test -z "$pic_flag" && test -n "$link_static_flag"; then
 	    dlopen_self=$dlopen_self_static
 	  fi
 	  prefer_static_libs=built
-	fi
+	  ;;
+	-static-libtool-libs)
+	  if test -z "$pic_flag" && test -n "$link_static_flag"; then
+	    dlopen_self=$dlopen_self_static
+	  fi
+	  prefer_static_libs=yes
+	  ;;
+	esac
 	build_libtool_libs=no
 	build_old_libs=yes
 	break
@@ -1600,7 +1639,7 @@ EOF
 	continue
 	;;
 
-     -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe)
+     -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads)
 	compiler_flags="$compiler_flags $arg"
 	compile_command="$compile_command $arg"
 	finalize_command="$finalize_command $arg"
@@ -1620,10 +1659,11 @@ EOF
       # -m* pass through architecture-specific compiler args for GCC
       # -m*, -t[45]*, -txscale* pass through architecture-specific
       # compiler args for GCC
-      # -pg pass through profiling flag for GCC
+      # -p, -pg, --coverage, -fprofile-* pass through profiling flag for GCC
+      # -F/path gives path to uninstalled frameworks, gcc on darwin
       # @file GCC response files
-      -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*|-pg| \
-      -t[45]*|-txscale*|@*)
+      -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \
+      -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*)
 
 	# Unknown arguments in both finalize_command and compile_command need
 	# to be aesthetically quoted because they are evaled later.
@@ -1651,9 +1691,9 @@ EOF
 
       -no-install)
 	case $host in
-	*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
+	*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin*)
 	  # The PATH hackery in wrapper scripts is required on Windows
-	  # in order for the loader to find any dlls it needs.
+	  # and Darwin in order for the loader to find any dlls it needs.
 	  $echo "$modename: warning: \`-no-install' is ignored for $host" 1>&2
 	  $echo "$modename: warning: assuming \`-no-fast-install' instead" 1>&2
 	  fast_install=no
@@ -1712,7 +1752,7 @@ EOF
 	continue
 	;;
 
-      -static)
+      -static | -static-libtool-libs)
 	# The effects of -static are defined in a previous loop.
 	# We used to do the same as -all-static on platforms that
 	# didn't have a PIC flag, but the assumption that the effects
@@ -2094,7 +2134,7 @@ EOF
 	lib=
 	found=no
 	case $deplib in
-	-mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe)
+	-mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads)
 	  if test "$linkmode,$pass" = "prog,link"; then
 	    compile_deplibs="$deplib $compile_deplibs"
 	    finalize_deplibs="$deplib $finalize_deplibs"
@@ -2490,7 +2530,9 @@ EOF
 
 	if test "$linkmode,$pass" = "prog,link"; then
 	  if test -n "$library_names" &&
-	     { test "$prefer_static_libs" = no || test -z "$old_library"; }; then
+	     { { test "$prefer_static_libs" = no ||
+		 test "$prefer_static_libs,$installed" = "built,yes"; } ||
+	       test -z "$old_library"; }; then
 	    # We need to hardcode the library path
 	    if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then
 	      # Make sure the rpath contains only unique directories.
@@ -3186,7 +3228,7 @@ EOF
 	  # which has an extra 1 added just for fun
 	  #
 	  case $version_type in
-	  darwin|linux|osf|windows)
+	  darwin|linux|osf|windows|none)
 	    current=`expr $number_major + $number_minor`
 	    age="$number_minor"
 	    revision="$number_revision"
@@ -3197,9 +3239,10 @@ EOF
 	    age="0"
 	    ;;
 	  irix|nonstopux)
-	    current=`expr $number_major + $number_minor - 1`
+	    current=`expr $number_major + $number_minor`
 	    age="$number_minor"
 	    revision="$number_minor"
+	    lt_irix_increment=no
 	    ;;
 	  esac
 	  ;;
@@ -3258,7 +3301,8 @@ EOF
 	  versuffix="$major.$age.$revision"
 	  # Darwin ld doesn't like 0 for these options...
 	  minor_current=`expr $current + 1`
-	  verstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision"
+	  xlcverstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision"
+	  verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
 	  ;;
 
 	freebsd-aout)
@@ -3272,8 +3316,11 @@ EOF
 	  ;;
 
 	irix | nonstopux)
-	  major=`expr $current - $age + 1`
-
+	  if test "X$lt_irix_increment" = "Xno"; then
+	    major=`expr $current - $age`
+	  else
+	    major=`expr $current - $age + 1`
+	  fi
 	  case $version_type in
 	    nonstopux) verstring_prefix=nonstopux ;;
 	    *)         verstring_prefix=sgi ;;
@@ -3410,11 +3457,11 @@ EOF
       fi
 
       # Eliminate all temporary directories.
-      for path in $notinst_path; do
-	lib_search_path=`$echo "$lib_search_path " | ${SED} -e "s% $path % %g"`
-	deplibs=`$echo "$deplibs " | ${SED} -e "s% -L$path % %g"`
-	dependency_libs=`$echo "$dependency_libs " | ${SED} -e "s% -L$path % %g"`
-      done
+      #for path in $notinst_path; do
+      #	lib_search_path=`$echo "$lib_search_path " | ${SED} -e "s% $path % %g"`
+      #	deplibs=`$echo "$deplibs " | ${SED} -e "s% -L$path % %g"`
+      #	dependency_libs=`$echo "$dependency_libs " | ${SED} -e "s% -L$path % %g"`
+      #done
 
       if test -n "$xrpath"; then
 	# If the user specified any rpath flags, then add them.
@@ -3515,13 +3562,12 @@ EOF
 	  int main() { return 0; }
 EOF
 	  $rm conftest
-	  $LTCC $LTCFLAGS -o conftest conftest.c $deplibs
-	  if test "$?" -eq 0 ; then
+	  if $LTCC $LTCFLAGS -o conftest conftest.c $deplibs; then
 	    ldd_output=`ldd conftest`
 	    for i in $deplibs; do
 	      name=`expr $i : '-l\(.*\)'`
 	      # If $name is empty we are operating on a -L argument.
-              if test "$name" != "" && test "$name" -ne "0"; then
+              if test "$name" != "" && test "$name" != "0"; then
 		if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
 		  case " $predeps $postdeps " in
 		  *" $i "*)
@@ -3560,9 +3606,7 @@ EOF
 	      # If $name is empty we are operating on a -L argument.
               if test "$name" != "" && test "$name" != "0"; then
 		$rm conftest
-		$LTCC $LTCFLAGS -o conftest conftest.c $i
-		# Did it work?
-		if test "$?" -eq 0 ; then
+		if $LTCC $LTCFLAGS -o conftest conftest.c $i; then
 		  ldd_output=`ldd conftest`
 		  if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
 		    case " $predeps $postdeps " in
@@ -3594,7 +3638,7 @@ EOF
 		  droppeddeps=yes
 		  $echo
 		  $echo "*** Warning!  Library $i is needed by this library but I was not able to"
-		  $echo "***  make it link in!  You will probably need to install it or some"
+		  $echo "*** make it link in!  You will probably need to install it or some"
 		  $echo "*** library that it depends on before this library will be fully"
 		  $echo "*** functional.  Installing it before continuing would be even better."
 		fi
@@ -3880,7 +3924,10 @@ EOF
 	     test -n "$hardcode_libdirs"; then
 	    libdir="$hardcode_libdirs"
 	    if test -n "$hardcode_libdir_flag_spec_ld"; then
-	      eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\"
+	      case $archive_cmds in
+	      *\$LD*) eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\" ;;
+	      *)      eval dep_rpath=\"$hardcode_libdir_flag_spec\" ;;
+	      esac
 	    else
 	      eval dep_rpath=\"$hardcode_libdir_flag_spec\"
 	    fi
@@ -4239,12 +4286,14 @@ EOF
       reload_conv_objs=
       gentop=
       # reload_cmds runs $LD directly, so let us get rid of
-      # -Wl from whole_archive_flag_spec
+      # -Wl from whole_archive_flag_spec and hope we can get by with
+      # turning comma into space..
       wl=
 
       if test -n "$convenience"; then
 	if test -n "$whole_archive_flag_spec"; then
-	  eval reload_conv_objs=\"\$reload_objs $whole_archive_flag_spec\"
+	  eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\"
+	  reload_conv_objs=$reload_objs\ `$echo "X$tmp_whole_archive_flags" | $Xsed -e 's|,| |g'`
 	else
 	  gentop="$output_objdir/${obj}x"
 	  generated="$generated $gentop"
@@ -4692,16 +4741,16 @@ static const void *lt_preloaded_setup() {
           case $host in
           *cygwin* | *mingw* )
             if test -f "$output_objdir/${outputname}.def" ; then
-              compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%"`
-              finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%"`
+              compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%" | $NL2SP`
+              finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%" | $NL2SP`
             else
-              compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
-              finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
+              compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP`
+              finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP`
              fi
             ;;
           * )
-            compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
-            finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
+            compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP`
+            finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP`
             ;;
           esac
 	  ;;
@@ -4716,13 +4765,13 @@ static const void *lt_preloaded_setup() {
 	# really was required.
 
 	# Nullify the symbol file.
-	compile_command=`$echo "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"`
-	finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"`
+	compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s% @SYMFILE@%%" | $NL2SP`
+	finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s% @SYMFILE@%%" | $NL2SP`
       fi
 
       if test "$need_relink" = no || test "$build_libtool_libs" != yes; then
 	# Replace the output file specification.
-	compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
+	compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e 's%@OUTPUT@%'"$output"'%g' | $NL2SP`
 	link_command="$compile_command$compile_rpath"
 
 	# We have no uninstalled library dependencies, so finalize right now.
@@ -4809,7 +4858,7 @@ static const void *lt_preloaded_setup() {
 	if test "$fast_install" != no; then
 	  link_command="$finalize_var$compile_command$finalize_rpath"
 	  if test "$fast_install" = yes; then
-	    relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'`
+	    relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $SP2NL | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g' | $NL2SP`
 	  else
 	    # fast_install is set to needless
 	    relink_command=
@@ -4846,7 +4895,7 @@ static const void *lt_preloaded_setup() {
 	  fi
 	done
 	relink_command="(cd `pwd`; $relink_command)"
-	relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
+	relink_command=`$echo "X$relink_command" | $SP2NL | $Xsed -e "$sed_quote_subst" | $NL2SP`
       fi
 
       # Quote $echo for shipping.
@@ -5253,6 +5302,20 @@ EOF
 Xsed='${SED} -e 1s/^X//'
 sed_quote_subst='$sed_quote_subst'
 
+# Be Bourne compatible (taken from Autoconf:_AS_BOURNE_COMPATIBLE).
+if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then
+  emulate sh
+  NULLCMD=:
+  # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which
+  # is contrary to our usage.  Disable this feature.
+  alias -g '\${1+\"\$@\"}'='\"\$@\"'
+  setopt NO_GLOB_SUBST
+else
+  case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac
+fi
+BIN_SH=xpg4; export BIN_SH # for Tru64
+DUALCASE=1; export DUALCASE # for MKS sh
+
 # The HP-UX ksh and POSIX shell print the target directory to stdout
 # if CDPATH is set.
 (unset CDPATH) >/dev/null 2>&1 && unset CDPATH
@@ -5395,7 +5458,7 @@ else
 	  ;;
 	esac
 	$echo >> $output "\
-      \$echo \"\$0: cannot exec \$program \${1+\"\$@\"}\"
+      \$echo \"\$0: cannot exec \$program \$*\"
       exit $EXIT_FAILURE
     fi
   else
@@ -5581,7 +5644,7 @@ fi\
       done
       # Quote the link command for shipping.
       relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)"
-      relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
+      relink_command=`$echo "X$relink_command" | $SP2NL | $Xsed -e "$sed_quote_subst" | $NL2SP`
       if test "$hardcode_automatic" = yes ; then
 	relink_command=
       fi
@@ -5926,9 +5989,9 @@ relink_command=\"$relink_command\""
 
 	  if test -n "$inst_prefix_dir"; then
 	    # Stick the inst_prefix_dir data into the link command.
-	    relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"`
+	    relink_command=`$echo "$relink_command" | $SP2NL | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%" | $NL2SP`
 	  else
-	    relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%%"`
+	    relink_command=`$echo "$relink_command" | $SP2NL | $SED "s%@inst_prefix_dir@%%" | $NL2SP`
 	  fi
 
 	  $echo "$modename: warning: relinking \`$file'" 1>&2
@@ -6137,7 +6200,7 @@ relink_command=\"$relink_command\""
 	      file=`$echo "X$file$stripped_ext" | $Xsed -e 's%^.*/%%'`
 	      outputname="$tmpdir/$file"
 	      # Replace the output file specification.
-	      relink_command=`$echo "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'`
+	      relink_command=`$echo "X$relink_command" | $SP2NL | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g' | $NL2SP`
 
 	      $show "$relink_command"
 	      if $run eval "$relink_command"; then :
@@ -6348,8 +6411,10 @@ relink_command=\"$relink_command\""
 	if test -f "$dir/$objdir/$dlname"; then
 	  dir="$dir/$objdir"
 	else
-	  $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2
-	  exit $EXIT_FAILURE
+	  if test ! -f "$dir/$dlname"; then
+	    $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2
+	    exit $EXIT_FAILURE
+	  fi
 	fi
 	;;
 
@@ -6413,12 +6478,12 @@ relink_command=\"$relink_command\""
       fi
 
       # Restore saved environment variables
-      if test "${save_LC_ALL+set}" = set; then
-	LC_ALL="$save_LC_ALL"; export LC_ALL
-      fi
-      if test "${save_LANG+set}" = set; then
-	LANG="$save_LANG"; export LANG
-      fi
+      for lt_var in LANG LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
+      do
+	eval "if test \"\${save_$lt_var+set}\" = set; then
+		$lt_var=\$save_$lt_var; export $lt_var
+	      fi"
+      done
 
       # Now prepare to actually exec the command.
       exec_cmd="\$cmd$args"
@@ -6775,9 +6840,9 @@ The following components of LINK-COMMAND are treated specially:
   -dlpreopen FILE   link in FILE and add its symbols to lt_preloaded_symbols
   -export-dynamic   allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
   -export-symbols SYMFILE
-		    try to export only the symbols listed in SYMFILE
+                    try to export only the symbols listed in SYMFILE
   -export-symbols-regex REGEX
-		    try to export only the symbols matching REGEX
+                    try to export only the symbols matching REGEX
   -LLIBDIR          search LIBDIR for required installed libraries
   -lNAME            OUTPUT-FILE requires the installed library libNAME
   -module           build a library that can dlopened
@@ -6791,9 +6856,11 @@ The following components of LINK-COMMAND are treated specially:
   -release RELEASE  specify package release information
   -rpath LIBDIR     the created library will eventually be installed in LIBDIR
   -R[ ]LIBDIR       add LIBDIR to the runtime path of programs and libraries
-  -static           do not do any dynamic linking of libtool libraries
+  -static           do not do any dynamic linking of uninstalled libtool libraries
+  -static-libtool-libs
+                    do not do any dynamic linking of libtool libraries
   -version-info CURRENT[:REVISION[:AGE]]
-		    specify library version info [each variable defaults to 0]
+                    specify library version info [each variable defaults to 0]
 
 All other options (arguments beginning with \`-') are ignored.
 

+ 34 - 27
missing

@@ -1,9 +1,9 @@
 #! /bin/sh
 # Common stub for a few missing GNU programs while installing.
 
-scriptversion=2005-06-08.21
+scriptversion=2006-05-10.23
 
-# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005
+# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006
 #   Free Software Foundation, Inc.
 # Originally by Fran,cois Pinard <[email protected]>, 1996.
 
@@ -33,6 +33,8 @@ if test $# -eq 0; then
 fi
 
 run=:
+sed_output='s/.* --output[ =]\([^ ]*\).*/\1/p'
+sed_minuso='s/.* -o \([^ ]*\).*/\1/p'
 
 # In the cases where this matters, `missing' is being run in the
 # srcdir already.
@@ -44,7 +46,7 @@ fi
 
 msg="missing on your system"
 
-case "$1" in
+case $1 in
 --run)
   # Try to run requested program, and just exit if it succeeds.
   run=
@@ -77,6 +79,7 @@ Supported PROGRAM values:
   aclocal      touch file \`aclocal.m4'
   autoconf     touch file \`configure'
   autoheader   touch file \`config.h.in'
+  autom4te     touch the output file, or create a stub one
   automake     touch all \`Makefile.in' files
   bison        create \`y.tab.[ch]', if possible, from existing .[ch]
   flex         create \`lex.yy.c', if possible, from existing .c
@@ -106,7 +109,7 @@ esac
 # Now exit if we have it, but it failed.  Also exit now if we
 # don't have it and --version was passed (most likely to detect
 # the program).
-case "$1" in
+case $1 in
   lex|yacc)
     # Not GNU programs, they don't have --version.
     ;;
@@ -135,7 +138,7 @@ esac
 
 # If it does not exist, or fails to run (possibly an outdated version),
 # try to emulate it.
-case "$1" in
+case $1 in
   aclocal*)
     echo 1>&2 "\
 WARNING: \`$1' is $msg.  You should only need it if
@@ -164,7 +167,7 @@ WARNING: \`$1' is $msg.  You should only need it if
     test -z "$files" && files="config.h"
     touch_files=
     for f in $files; do
-      case "$f" in
+      case $f in
       *:*) touch_files="$touch_files "`echo "$f" |
 				       sed -e 's/^[^:]*://' -e 's/:.*//'`;;
       *) touch_files="$touch_files $f.in";;
@@ -192,8 +195,8 @@ WARNING: \`$1' is needed, but is $msg.
          You can get \`$1' as part of \`Autoconf' from any GNU
          archive site."
 
-    file=`echo "$*" | sed -n 's/.*--output[ =]*\([^ ]*\).*/\1/p'`
-    test -z "$file" && file=`echo "$*" | sed -n 's/.*-o[ ]*\([^ ]*\).*/\1/p'`
+    file=`echo "$*" | sed -n "$sed_output"`
+    test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
     if test -f "$file"; then
 	touch $file
     else
@@ -214,25 +217,25 @@ WARNING: \`$1' $msg.  You should only need it if
          in order for those modifications to take effect.  You can get
          \`Bison' from any GNU archive site."
     rm -f y.tab.c y.tab.h
-    if [ $# -ne 1 ]; then
+    if test $# -ne 1; then
         eval LASTARG="\${$#}"
-	case "$LASTARG" in
+	case $LASTARG in
 	*.y)
 	    SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'`
-	    if [ -f "$SRCFILE" ]; then
+	    if test -f "$SRCFILE"; then
 	         cp "$SRCFILE" y.tab.c
 	    fi
 	    SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'`
-	    if [ -f "$SRCFILE" ]; then
+	    if test -f "$SRCFILE"; then
 	         cp "$SRCFILE" y.tab.h
 	    fi
 	  ;;
 	esac
     fi
-    if [ ! -f y.tab.h ]; then
+    if test ! -f y.tab.h; then
 	echo >y.tab.h
     fi
-    if [ ! -f y.tab.c ]; then
+    if test ! -f y.tab.c; then
 	echo 'main() { return 0; }' >y.tab.c
     fi
     ;;
@@ -244,18 +247,18 @@ WARNING: \`$1' is $msg.  You should only need it if
          in order for those modifications to take effect.  You can get
          \`Flex' from any GNU archive site."
     rm -f lex.yy.c
-    if [ $# -ne 1 ]; then
+    if test $# -ne 1; then
         eval LASTARG="\${$#}"
-	case "$LASTARG" in
+	case $LASTARG in
 	*.l)
 	    SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'`
-	    if [ -f "$SRCFILE" ]; then
+	    if test -f "$SRCFILE"; then
 	         cp "$SRCFILE" lex.yy.c
 	    fi
 	  ;;
 	esac
     fi
-    if [ ! -f lex.yy.c ]; then
+    if test ! -f lex.yy.c; then
 	echo 'main() { return 0; }' >lex.yy.c
     fi
     ;;
@@ -267,11 +270,9 @@ WARNING: \`$1' is $msg.  You should only need it if
 	 \`Help2man' package in order for those modifications to take
 	 effect.  You can get \`Help2man' from any GNU archive site."
 
-    file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'`
-    if test -z "$file"; then
-	file=`echo "$*" | sed -n 's/.*--output=\([^ ]*\).*/\1/p'`
-    fi
-    if [ -f "$file" ]; then
+    file=`echo "$*" | sed -n "$sed_output"`
+    test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
+    if test -f "$file"; then
 	touch $file
     else
 	test -z "$file" || exec >$file
@@ -289,11 +290,17 @@ WARNING: \`$1' is $msg.  You should only need it if
          DU, IRIX).  You might want to install the \`Texinfo' package or
          the \`GNU make' package.  Grab either from any GNU archive site."
     # The file to touch is that specified with -o ...
-    file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'`
+    file=`echo "$*" | sed -n "$sed_output"`
+    test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
     if test -z "$file"; then
       # ... or it is the one specified with @setfilename ...
       infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'`
-      file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $infile`
+      file=`sed -n '
+	/^@setfilename/{
+	  s/.* \([^ ]*\) *$/\1/
+	  p
+	  q
+	}' $infile`
       # ... or it is derived from the source name (dir/f.texi becomes f.info)
       test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info
     fi
@@ -317,13 +324,13 @@ WARNING: \`$1' is $msg.  You should only need it if
     fi
     firstarg="$1"
     if shift; then
-	case "$firstarg" in
+	case $firstarg in
 	*o*)
 	    firstarg=`echo "$firstarg" | sed s/o//`
 	    tar "$firstarg" "$@" && exit 0
 	    ;;
 	esac
-	case "$firstarg" in
+	case $firstarg in
 	*h*)
 	    firstarg=`echo "$firstarg" | sed s/h//`
 	    tar "$firstarg" "$@" && exit 0

部分文件因为文件数量过多而无法显示