[Fedora-directory-commits] ldapserver/ldap/servers/slapd abandon.c, 1.8, 1.9 add.c, 1.15, 1.16 auth.c, 1.12, 1.13 bind.c, 1.18, 1.19 compare.c, 1.9, 1.10 config.c, 1.12, 1.13 connection.c, 1.22, 1.23 conntable.c, 1.11, 1.12 daemon.c, 1.22, 1.23 delete.c, 1.10, 1.11 entry.c, 1.19, 1.20 extendop.c, 1.9, 1.10 libglobs.c, 1.33, 1.34 modify.c, 1.19, 1.20 modrdn.c, 1.11, 1.12 monitor.c, 1.8, 1.9 opshared.c, 1.13, 1.14 psearch.c, 1.10, 1.11 result.c, 1.17, 1.18 sasl_io.c, 1.17, 1.18 search.c, 1.11, 1.12 slap.h, 1.42, 1.43 slapi-plugin.h, 1.35, 1.36 snmp_collator.c, 1.17, 1.18 ssl.c, 1.20, 1.21 unbind.c, 1.6, 1.7 util.c, 1.20, 1.21

Richard Allen Megginson rmeggins at fedoraproject.org
Fri Dec 5 22:41:55 UTC 2008


Author: rmeggins

Update of /cvs/dirsec/ldapserver/ldap/servers/slapd
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv13701/ldapserver/ldap/servers/slapd

Modified Files:
	abandon.c add.c auth.c bind.c compare.c config.c connection.c 
	conntable.c daemon.c delete.c entry.c extendop.c libglobs.c 
	modify.c modrdn.c monitor.c opshared.c psearch.c result.c 
	sasl_io.c search.c slap.h slapi-plugin.h snmp_collator.c ssl.c 
	unbind.c util.c 
Log Message:
Resolves: bug 454030
Bug Description: Need to address 64-bit compiler warnings - again
Reviewed by: nhosoi (Thanks!)
Fix Description: This patch cleans up most of the other remaining compiler warnings.  I compiled the directory server code with these flags on RHEL5 x86_64: -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic
I also enabled argument/format match checking for most of the commonly used varadic functions.  Most of the problems I found fell into these categories:
1) Too many or not enough arguments e.g. most everything that uses or did use LDAPDebug had extra 0,0 arguments.  If they had been switched to use slapi_log_error, I removed the extra arguments - for those places still using LDAPDebug, I introduced more macros to handle the number of arguments, since C macros cannot be varadic.
2) When using NSPR formatting functions, we have to use %llu or %lld for 64-bit values, even on 64-bit systems.  However, for regular system formatting functions, we have to use %ld or %lu.  I introduced two new macros NSPRIu64 and NSPRI64 to handle cases where we are passing explicit 64-bit values to NSPR formatting functions, so that we can use the regular PRIu64 and PRI64 macros for regular system formatting functions.  I also made sure we used NSPRI* only with NSPR functions, and used PRI* only with system functions.
3) use %lu for size_t and %ld for time_t
I did find a few "real" errors, places that the code was doing something definitely not right:
https://bugzilla.redhat.com/attachment.cgi?id=325774&action=diff#ldapserver/ldap/servers/plugins/acl/aclinit.c_sec4
https://bugzilla.redhat.com/attachment.cgi?id=325774&action=diff#ldapserver/ldap/servers/plugins/acl/acllas.c_sec17
https://bugzilla.redhat.com/attachment.cgi?id=325774&action=diff#ldapserver/ldap/servers/plugins/http/http_impl.c_sec1
https://bugzilla.redhat.com/attachment.cgi?id=325774&action=diff#ldapserver/ldap/servers/plugins/memberof/memberof.c_sec1
https://bugzilla.redhat.com/attachment.cgi?id=325774&action=diff#ldapserver/ldap/servers/plugins/pam_passthru/pam_ptimpl.c_sec1
https://bugzilla.redhat.com/attachment.cgi?id=325774&action=diff#ldapserver/ldap/servers/plugins/replication/cl5_api.c_sec5
https://bugzilla.redhat.com/attachment.cgi?id=325774&action=diff#ldapserver/ldap/servers/plugins/replication/cl5_clcache.c_sec2
https://bugzilla.redhat.com/attachment.cgi?id=325774&action=diff#ldapserver/ldap/servers/plugins/replication/replutil.c_sec1
https://bugzilla.redhat.com/attachment.cgi?id=325774&action=diff#ldapserver/ldap/servers/slapd/libglobs.c_sec1
https://bugzilla.redhat.com/attachment.cgi?id=325774&action=diff#ldapserver/ldap/servers/slapd/back-ldbm/dbverify.c_sec2
https://bugzilla.redhat.com/attachment.cgi?id=325774&action=diff#ldapserver/ldap/servers/slapd/back-ldbm/ldif2ldbm.c_sec3
This is why it's important to use this compiler checking, and why it's important to fix compiler warnings, if for no other reason than the sheer noise from so many warnings can mask real errors.
Platforms tested: RHEL5
Flag Day: no
Doc impact: no



Index: abandon.c
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/slapd/abandon.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- abandon.c	17 Oct 2008 22:12:47 -0000	1.8
+++ abandon.c	5 Dec 2008 22:41:52 -0000	1.9
@@ -153,15 +153,15 @@
 	}
 
 	if ( NULL == o ) {
-		slapi_log_access( LDAP_DEBUG_STATS, "conn=%" PRIu64 " op=%d ABANDON"
+		slapi_log_access( LDAP_DEBUG_STATS, "conn=%" NSPRIu64 " 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=%" PRIu64"  op=%d ABANDON"
+		slapi_log_access( LDAP_DEBUG_STATS, "conn=%" NSPRIu64 " 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=%" PRIu64 " op=%d ABANDON"
+		slapi_log_access( LDAP_DEBUG_STATS, "conn=%" NSPRIu64 " 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 );


Index: add.c
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/slapd/add.c,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- add.c	24 Oct 2008 22:36:58 -0000	1.15
+++ add.c	5 Dec 2008 22:41:52 -0000	1.16
@@ -166,7 +166,7 @@
 			if (( rc = slapi_entry_add_values( e, normtype, vals ))
 				!= LDAP_SUCCESS ) {
 				slapi_log_access( LDAP_DEBUG_STATS, 
-					"conn=%" PRIu64 " op=%d ADD dn=\"%s\", add values for type %s failed\n",
+					"conn=%" NSPRIu64 " 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 @@
 	{
 		if ( !internal_op )
 		{
-			slapi_log_access(LDAP_DEBUG_STATS, "conn=%" PRIu64 " op=%d ADD dn=\"%s\"\n",
+			slapi_log_access(LDAP_DEBUG_STATS, "conn=%" NSPRIu64 " op=%d ADD dn=\"%s\"\n",
 							 pb->pb_conn->c_connid, 
 							 operation->o_opid,
 							 escape_string(slapi_entry_get_dn_const(e), ebuf));


Index: auth.c
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/slapd/auth.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- auth.c	17 Oct 2008 22:12:47 -0000	1.12
+++ auth.c	5 Dec 2008 22:41:52 -0000	1.13
@@ -391,7 +391,7 @@
     char* subject = subject_of (clientCert);
     char* issuer  = issuer_of  (clientCert);
     slapi_log_access( LDAP_DEBUG_STATS,
-	       "conn=%" PRIu64 " " SLAPI_COMPONENT_NAME_NSPR " error %i (%s); unauthenticated client %s; issuer %s\n",
+	       "conn=%" NSPRIu64 " " 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 @@
 	if ( (slapd_ssl_getChannelInfo (prfd, &channelInfo, sizeof(channelInfo))) != SECSuccess ) {
 		PRErrorCode errorCode = PR_GetError();
 		slapi_log_access (LDAP_DEBUG_STATS,
-			"conn=%" PRIu64 " SSL failed to obtain channel info; "
+			"conn=%" NSPRIu64 " 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 @@
 			!= SECSuccess) {
 		PRErrorCode errorCode = PR_GetError();
 		slapi_log_access (LDAP_DEBUG_STATS,
-			"conn=%" PRIu64 " SSL failed to obtain cipher info; "
+			"conn=%" NSPRIu64 " 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 @@
     }
 
     if (config_get_SSLclientAuth() == SLAPD_SSLCLIENTAUTH_OFF ) {
-		slapi_log_access (LDAP_DEBUG_STATS, "conn=%" PRIu64 " SSL %i-bit %s\n",
+		slapi_log_access (LDAP_DEBUG_STATS, "conn=%" NSPRIu64 " 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=%" PRIu64 " SSL %i-bit %s\n",
+	slapi_log_access (LDAP_DEBUG_STATS, "conn=%" NSPRIu64 " SSL %i-bit %s\n",
 		   conn->c_connid, keySize, cipher ? cipher : "NULL" );
     } else {
 	char* subject = subject_of (clientCert);
@@ -469,7 +469,7 @@
 	    char* issuer  = issuer_of (clientCert);
 	    char sbuf[ BUFSIZ ], ibuf[ BUFSIZ ];
 	    slapi_log_access( LDAP_DEBUG_STATS,
-		       "conn=%" PRIu64 " SSL %i-bit %s; client %s; issuer %s\n",
+		       "conn=%" NSPRIu64 " 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 @@
 
     if (clientDN != NULL) {
         char ebuf[ BUFSIZ ];
-        slapi_log_access (LDAP_DEBUG_STATS, "conn=%" PRIu64 " SSL client bound as %s\n",
+        slapi_log_access (LDAP_DEBUG_STATS, "conn=%" NSPRIu64 " SSL client bound as %s\n",
     	       conn->c_connid, escape_string( clientDN, ebuf ));
     } else if (clientCert != NULL) {
         slapi_log_access (LDAP_DEBUG_STATS,
-		"conn=%" PRIu64 " SSL failed to map client certificate to LDAP DN (%s)\n",
+		"conn=%" NSPRIu64 " SSL failed to map client certificate to LDAP DN (%s)\n",
     	       conn->c_connid, extraErrorMsg );
     }
 


Index: bind.c
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/slapd/bind.c,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -r1.18 -r1.19
--- bind.c	7 Nov 2008 22:32:57 -0000	1.18
+++ bind.c	5 Dec 2008 22:41:52 -0000	1.19
@@ -694,25 +694,25 @@
 
     if (method == LDAP_AUTH_SASL && saslmech && msg) {
         slapi_log_access( LDAP_DEBUG_STATS, 
-                          "conn=%" PRIu64 " op=%d BIND dn=\"%s\" "
+                          "conn=%" NSPRIu64 " 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=%" PRIu64 " op=%d BIND dn=\"%s\" "
+                          "conn=%" NSPRIu64 " 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=%" PRIu64 " op=%d BIND dn=\"%s\" "
+                          "conn=%" NSPRIu64 " 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=%" PRIu64 " op=%d BIND dn=\"%s\" "
+                          "conn=%" NSPRIu64 " op=%d BIND dn=\"%s\" "
                           "method=%d version=%d\n",
                           pb->pb_conn->c_connid, pb->pb_op->o_opid, edn, 
                           method, version );


Index: compare.c
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/slapd/compare.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- compare.c	24 Oct 2008 22:36:58 -0000	1.9
+++ compare.c	5 Dec 2008 22:41:52 -0000	1.10
@@ -122,7 +122,7 @@
 	    dn, ava.ava_type, 0 );
 
 	slapi_log_access( LDAP_DEBUG_STATS,
-	    "conn=%" PRIu64 " op=%d CMP dn=\"%s\" attr=\"%s\"\n",
+	    "conn=%" NSPRIu64 " 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 );
 


Index: config.c
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/slapd/config.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- config.c	8 Oct 2008 17:29:03 -0000	1.12
+++ config.c	5 Dec 2008 22:41:52 -0000	1.13
@@ -126,7 +126,7 @@
 						slapi_log_error( SLAPI_LOG_FATAL, "bootstrap config",
 								"Ignoring extremely large value for"
 								" configuration attribute %s"
-								" (length=%d, value=%40.40s...)\n",
+								" (length=%ld, value=%40.40s...)\n",
 								attrname, len, s );
 						retval = 0;	/* value is too large: ignore it */
 					}


Index: connection.c
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/slapd/connection.c,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -r1.22 -r1.23
--- connection.c	24 Oct 2008 22:36:58 -0000	1.22
+++ connection.c	5 Dec 2008 22:41:52 -0000	1.23
@@ -352,7 +352,7 @@
 
     /* log useful stuff to our access log */
     slapi_log_access( LDAP_DEBUG_STATS,
-	    "conn=%" PRIu64 " fd=%d slot=%d %sconnection from %s to %s\n",
+	    "conn=%" NSPRIu64 " 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 */
@@ -452,7 +452,7 @@
 		op->o_tag != LDAP_REQ_ABANDON )
 	{
 		slapi_add_pwd_control ( pb, LDAP_CONTROL_PWEXPIRED, 0);	
-		slapi_log_access( LDAP_DEBUG_STATS, "conn=%" PRIu64 " op=%d %s\n",
+		slapi_log_access( LDAP_DEBUG_STATS, "conn=%" NSPRIu64 " 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, 
@@ -522,7 +522,7 @@
 		{
 			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 %" PRIu64 "\n",conn->c_connid, 0, 0);
+				LDAPDebug(LDAP_DEBUG_ANY, "Failed to set TCP_CORK on connection %" NSPRIu64 "\n",conn->c_connid, 0, 0);
 			}
 		}
 #endif
@@ -536,7 +536,7 @@
 		{
 			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 %" PRIu64 "\n",conn->c_connid, 0, 0);
+				LDAPDebug(LDAP_DEBUG_ANY, "Failed to clear TCP_CORK on connection %" NSPRIu64 "\n",conn->c_connid, 0, 0);
 			}
 		}
 	}
@@ -562,7 +562,7 @@
 
 	default:
 		LDAPDebug( LDAP_DEBUG_ANY,
-		    "ignoring unknown LDAP request (conn=%" PRIu64 ", tag=0x%lx)\n",
+		    "ignoring unknown LDAP request (conn=%" NSPRIu64 ", tag=0x%lx)\n",
 		    conn->c_connid, op->o_tag, 0 );
 		break;
 	}
@@ -574,7 +574,7 @@
     if (conn->c_refcnt <= 0)
     {
         slapi_log_error(SLAPI_LOG_FATAL, "connection",
-		                "conn=%" PRIu64 " fd=%d Attempt to release connection that is not aquired\n",
+		                "conn=%" NSPRIu64 " fd=%d Attempt to release connection that is not aquired\n",
 			            conn->c_connid, conn->c_sd);
         PR_ASSERT (PR_FALSE);
         return -1;
@@ -595,7 +595,7 @@
     {
 	/* This may happen while other threads are still working on this connection */
         slapi_log_error(SLAPI_LOG_FATAL, "connection",
-		                "conn=%" PRIu64 " fd=%d Attempt to acquire connection in the closing state\n",
+		                "conn=%" NSPRIu64 " fd=%d Attempt to acquire connection in the closing state\n",
 			            conn->c_connid, conn->c_sd);
         return -1;
     }
@@ -773,7 +773,7 @@
 	/* if connection is closing */
 	if (return_value != 0) {
 	    LDAPDebug(LDAP_DEBUG_CONNS,
-		      "handle_read_data returns as conn %" PRIu64 " closing, fd=%d\n",
+		      "handle_read_data returns as conn %" NSPRIu64 " closing, fd=%d\n",
 		      conn->c_connid,conn->c_sd,0);
 	    return return_value;
 	}
@@ -836,7 +836,7 @@
 		!= LDAP_TAG_MSGID ) {
 		/* log, close and send error */
 		LDAPDebug( LDAP_DEBUG_ANY,
-			"conn=%" PRIu64 " unable to read tag for incoming request\n", conn->c_connid, 0, 0 );
+			"conn=%" NSPRIu64 " unable to read tag for incoming request\n", conn->c_connid, 0, 0 );
 		return_value = -1;
 		goto done;
 	}
@@ -848,7 +848,7 @@
 	  case LDAP_TAG_LDAPDN: /* optional username, for CLDAP */
 		/* log, close and send error */
 		LDAPDebug( LDAP_DEBUG_ANY,
-			"conn=%" PRIu64 " ber_peek_tag returns 0x%lx\n", conn->c_connid, tag, 0 );
+			"conn=%" NSPRIu64 " ber_peek_tag returns 0x%lx\n", conn->c_connid, tag, 0 );
 		return_value = -1;
 		goto done;
 	  default:
@@ -979,7 +979,7 @@
 	PR_Lock( conn->c_mutex );
 	if (connection_is_active_nolock(conn) == 0) {
 	    LDAPDebug(LDAP_DEBUG_CONNS,
-		      "not creating a new operation when conn %" PRIu64 " closing\n",
+		      "not creating a new operation when conn %" NSPRIu64 " closing\n",
 		      conn->c_connid,0,0);
 	    PR_Unlock( conn->c_mutex );
 	    return -1;
@@ -1071,7 +1071,7 @@
 				So, we toss it away ! */
 				if (LBER_OVERFLOW == tag) {
 					slapi_log_error( SLAPI_LOG_FATAL, "connection",
-						"conn=%" PRIu64 " fd=%d The length of BER Element was too long.\n",
+						"conn=%" NSPRIu64 " fd=%d The length of BER Element was too long.\n",
 						conn->c_connid, conn->c_sd );
 				}
 				PR_Lock( conn->c_mutex );
@@ -1108,7 +1108,7 @@
 				 * We received a non-LDAP message.  Log and close connection.
 				 */
 				LDAPDebug( LDAP_DEBUG_ANY,
-					"conn=%" PRIu64 " received a non-LDAP message"
+					"conn=%" NSPRIu64 " received a non-LDAP message"
 					" (tag 0x%lx, expected 0x%lx)\n",
 					conn->c_connid, tag, LDAP_TAG_MESSAGE );
 				PR_Lock( conn->c_mutex );
@@ -1126,7 +1126,7 @@
 		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 %" PRIu64 " closing fd=%d\n",
+				      "could not acquire lock in issue_new_read as conn %" NSPRIu64 " 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... */
@@ -1148,7 +1148,7 @@
 					 */
 					connection_decrement_reference(conn);
 					LDAPDebug(LDAP_DEBUG_CONNS,
-						  "push_back_data failed: closing conn %" PRIu64 " fd=%d\n",
+						  "push_back_data failed: closing conn %" NSPRIu64 " fd=%d\n",
 						  conn->c_connid,conn->c_sd,0); 
 				}
 			} else {
@@ -1246,7 +1246,7 @@
 
 	if (connection_increment_reference(conn) == -1) {
 	    LDAPDebug(LDAP_DEBUG_CONNS,
-		      "could not acquire lock in issue_new_read as conn %" PRIu64 " closing fd=%d\n",
+		      "could not acquire lock in issue_new_read as conn %" NSPRIu64 " closing fd=%d\n",
 		      conn->c_connid,conn->c_sd,0); 
 	    /* This means that the connection is closing */
 	    return -1;
@@ -1408,7 +1408,7 @@
 	   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 %" PRIu64 " closing fd=%d\n",
+		      "could not acquire lock in connection_activity as conn %" NSPRIu64 " 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 */
@@ -1644,7 +1644,7 @@
 		syserr = errno;
 		/* Bad stuff happened, like the client sent us some junk */
 		LDAPDebug( LDAP_DEBUG_CONNS,
-			"ber_get_next failed for connection %" PRIu64 "\n", conn->c_connid, 0, 0 );
+			"ber_get_next failed for connection %" NSPRIu64 "\n", conn->c_connid, 0, 0 );
 		/* reset private buffer */
 		conn->c_private->c_buffer_bytes = conn->c_private->c_buffer_offset = 0;
 
@@ -1713,7 +1713,7 @@
 		ret = sasl_io_setup(conn);
 		if (ret) {
 			LDAPDebug( LDAP_DEBUG_ANY,
-				"conn=%" PRIu64 " unable to enable SASL I/O\n", conn->c_connid, 0, 0 );
+				"conn=%" NSPRIu64 " 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;
 		}
@@ -1774,7 +1774,7 @@
 					} else {
 						/* Otherwise we loop, unless we exceeded the ioblock timeout */
 						if (waits_done > ioblocktimeout_waits) {
-							LDAPDebug( LDAP_DEBUG_CONNS,"ioblock timeout expired on connection %" PRIu64 "\n", conn->c_connid, 0, 0 );
+							LDAPDebug( LDAP_DEBUG_CONNS,"ioblock timeout expired on connection %" NSPRIu64 "\n", conn->c_connid, 0, 0 );
 							disconnect_server( conn, conn->c_connid, -1,
 									SLAPD_DISCONNECT_IO_TIMEOUT, 0 );
 							return CONN_DONE;
@@ -1794,7 +1794,7 @@
 					err = PR_GetError();
 					syserr = PR_GetOSError();
 					LDAPDebug( LDAP_DEBUG_ANY,
-						"PR_Poll for connection %" PRIu64 " returns %d (%s)\n", conn->c_connid, err, slapd_pr_strerror( err ) );
+						"PR_Poll for connection %" NSPRIu64 " 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;
@@ -1803,7 +1803,7 @@
 				/* Some other error, typically meaning bad stuff */
 					syserr = PR_GetOSError();
 					LDAPDebug( LDAP_DEBUG_CONNS,
-						"PR_Recv for connection %" PRIu64 " returns %d (%s)\n", conn->c_connid, err, slapd_pr_strerror( err ) );
+						"PR_Recv for connection %" NSPRIu64 " 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;
@@ -1835,7 +1835,7 @@
 		 * We received a non-LDAP message.  Log and close connection.
 		 */
 		LDAPDebug( LDAP_DEBUG_ANY,
-			"conn=%" PRIu64 " received a non-LDAP message (tag 0x%lx, expected 0x%lx)\n",
+			"conn=%" NSPRIu64 " 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 );
@@ -1846,7 +1846,7 @@
 		!= LDAP_TAG_MSGID ) {
 		/* log, close and send error */
 		LDAPDebug( LDAP_DEBUG_ANY,
-			"conn=%" PRIu64 " unable to read tag for incoming request\n", conn->c_connid, 0, 0 );
+			"conn=%" NSPRIu64 " 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;
 	}
@@ -1863,7 +1863,7 @@
 	  case LDAP_TAG_LDAPDN: /* optional username, for CLDAP */
 		/* log, close and send error */
 		LDAPDebug( LDAP_DEBUG_ANY,
-			"conn=%" PRIu64 " ber_peek_tag returns 0x%lx\n", conn->c_connid, *tag, 0 );
+			"conn=%" NSPRIu64 " 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:
@@ -1900,7 +1900,7 @@
 	/* update the last checked time */
 	conn->c_private->previous_count_check_time = current_time();
 	PR_Unlock( conn->c_mutex );
-	LDAPDebug(LDAP_DEBUG_CONNS,"conn %" PRIu64 " activity level = %d\n",conn->c_connid,delta_count,0); 
+	LDAPDebug(LDAP_DEBUG_CONNS,"conn %" NSPRIu64 " activity level = %d\n",conn->c_connid,delta_count,0); 
 }
 
 typedef struct table_iterate_info_struct {
@@ -1955,7 +1955,7 @@
 	} else {
 	  double activet = 0.0;
 	  connection_find_our_rank(conn,&connection_count, &our_rank);
-	  LDAPDebug(LDAP_DEBUG_CONNS,"conn %" PRIu64 " turbo rank = %d out of %d conns\n",conn->c_connid,our_rank,connection_count); 
+	  LDAPDebug(LDAP_DEBUG_CONNS,"conn %" NSPRIu64 " 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));
 
@@ -1997,9 +1997,9 @@
 	PR_Unlock(conn->c_mutex);
 	if (current_mode != new_mode) {
 		if (current_mode) {
-			LDAPDebug(LDAP_DEBUG_CONNS,"conn %" PRIu64 " leaving turbo mode\n",conn->c_connid,0,0); 
+			LDAPDebug(LDAP_DEBUG_CONNS,"conn %" NSPRIu64 " leaving turbo mode\n",conn->c_connid,0,0); 
 		} else {
-			LDAPDebug(LDAP_DEBUG_CONNS,"conn %" PRIu64 " entering turbo mode\n",conn->c_connid,0,0); 
+			LDAPDebug(LDAP_DEBUG_CONNS,"conn %" NSPRIu64 " entering turbo mode\n",conn->c_connid,0,0); 
 		}
 	}
 	*new_turbo_flag = new_mode;
@@ -2090,7 +2090,7 @@
 		/* 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 %" PRIu64 " leaving turbo mode\n",conn->c_connid,0,0); 
+			LDAPDebug(LDAP_DEBUG_CONNS,"conn %" NSPRIu64 " leaving turbo mode\n",conn->c_connid,0,0); 
 		}
 #endif
 		
@@ -2233,7 +2233,7 @@
 
 	if (connection_acquire_nolock (conn) == -1) {
 	    LDAPDebug(LDAP_DEBUG_CONNS,
-		      "could not acquire lock in connection_activity as conn %" PRIu64 " closing fd=%d\n",
+		      "could not acquire lock in connection_activity as conn %" NSPRIu64 " 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 */
@@ -2385,7 +2385,7 @@
 
 	if ( *tmp == NULL )
 	{
-		LDAPDebug( LDAP_DEBUG_ANY, "connection_remove_operation: can't find op %d for conn %" PRIu64 "\n",
+		LDAPDebug( LDAP_DEBUG_ANY, "connection_remove_operation: can't find op %d for conn %" NSPRIu64 "\n",
 		    (int)op->o_msgid, conn->c_connid, 0 );
 	}
 	else
@@ -2496,13 +2496,13 @@
 	}
 	if (0 == ber_len) {
 		slapi_log_error( SLAPI_LOG_FATAL, "connection",
-			"conn=%" PRIu64 " fd=%d Incoming BER Element was too long, max allowable"
+			"conn=%" NSPRIu64 " 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=%" PRIu64 " fd=%d Incoming BER Element was %u bytes, max allowable"
+			"conn=%" NSPRIu64 " 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 );
@@ -2555,13 +2555,13 @@
 	 */
 	if (error && (EPIPE != error) ) {
 	    slapi_log_access( LDAP_DEBUG_STATS,
-		  "conn=%" PRIu64 " op=%d fd=%d closed error %d (%s) - %s\n",
+		  "conn=%" NSPRIu64 " 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=%" PRIu64 " op=%d fd=%d closed - %s\n",
+		  "conn=%" NSPRIu64 " op=%d fd=%d closed - %s\n",
 		  conn->c_connid, opid, conn->c_sd,
 		  slapd_pr_strerror(reason));
 	}


Index: conntable.c
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/slapd/conntable.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- conntable.c	17 Oct 2008 22:12:47 -0000	1.11
+++ conntable.c	5 Dec 2008 22:41:52 -0000	1.12
@@ -444,22 +444,22 @@
 		PR_Unlock( ct->c[i].c_mutex );
 	}
 
-	sprintf( buf, "%d", nconns );
+	PR_snprintf( buf, sizeof(buf), "%d", nconns );
 	val.bv_val = buf;
 	val.bv_len = strlen( buf );
 	attrlist_replace( &e->e_attrs, "currentconnections", vals );
 
-	sprintf( buf, "%" PRIu64, slapi_counter_get_value(num_conns));
+	PR_snprintf( buf, sizeof(buf), "%" NSPRIu64, slapi_counter_get_value(num_conns));
 	val.bv_val = buf;
 	val.bv_len = strlen( buf );
 	attrlist_replace( &e->e_attrs, "totalconnections", vals );
 
-	sprintf( buf, "%d", (ct!=NULL?ct->size:0) );
+	PR_snprintf( buf, sizeof(buf), "%d", (ct!=NULL?ct->size:0) );
 	val.bv_val = buf;
 	val.bv_len = strlen( buf );
 	attrlist_replace( &e->e_attrs, "dtablesize", vals );
 
-	sprintf( buf, "%d", nreadwaiters );
+	PR_snprintf( buf, sizeof(buf), "%d", nreadwaiters );
 	val.bv_val = buf;
 	val.bv_len = strlen( buf );
 	attrlist_replace( &e->e_attrs, "readwaiters", vals );


Index: daemon.c
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/slapd/daemon.c,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -r1.22 -r1.23
--- daemon.c	23 Oct 2008 22:42:54 -0000	1.22
+++ daemon.c	5 Dec 2008 22:41:52 -0000	1.23
@@ -1496,7 +1496,7 @@
 						 * trying to acquire a closing connection
 						 */
 						LDAPDebug (LDAP_DEBUG_ANY,
-							"connection_activity: abandoning conn %" PRIu64 " as fd=%d is already closing\n",
+							"connection_activity: abandoning conn %" NSPRIu64 " 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 */


Index: delete.c
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/slapd/delete.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- delete.c	24 Oct 2008 22:36:58 -0000	1.10
+++ delete.c	5 Dec 2008 22:41:52 -0000	1.11
@@ -257,7 +257,7 @@
 	{
 		if (!internal_op )
 		{
-			slapi_log_access(LDAP_DEBUG_STATS, "conn=%" PRIu64 " op=%d DEL dn=\"%s\"\n",
+			slapi_log_access(LDAP_DEBUG_STATS, "conn=%" NSPRIu64 " op=%d DEL dn=\"%s\"\n",
 							pb->pb_conn->c_connid, 
 							pb->pb_op->o_opid,
 							escape_string(dn, ebuf));


Index: entry.c
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/slapd/entry.c,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -r1.19 -r1.20
--- entry.c	15 Oct 2008 06:30:03 -0000	1.19
+++ entry.c	5 Dec 2008 22:41:52 -0000	1.20
@@ -1360,7 +1360,7 @@
     if ( (size_t)(ecur - ebuf + 1) > elen )
     {
         slapi_log_error (SLAPI_LOG_FATAL, NULL,
-            "entry2str_internal: array boundary wrote: bufsize=%d wrote=%d\n",
+            "entry2str_internal: array boundary wrote: bufsize=%ld wrote=%ld\n",
             elen, (ecur - ebuf + 1));
     }
 


Index: extendop.c
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/slapd/extendop.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- extendop.c	17 Oct 2008 22:12:47 -0000	1.9
+++ extendop.c	5 Dec 2008 22:41:52 -0000	1.10
@@ -267,14 +267,14 @@
 	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=%" PRIu64 " op=%d EXT oid=\"%s\"\n",
+		slapi_log_access( LDAP_DEBUG_STATS, "conn=%" NSPRIu64 " 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=%" PRIu64 " op=%d EXT oid=\"%s\" name=\"%s\"\n",
+			"conn=%" NSPRIu64 " op=%d EXT oid=\"%s\" name=\"%s\"\n",
 			pb->pb_conn->c_connid, pb->pb_op->o_opid, extoid, name );
 	}
 


Index: libglobs.c
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/slapd/libglobs.c,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -r1.33 -r1.34
--- libglobs.c	2 Dec 2008 15:29:30 -0000	1.33
+++ libglobs.c	5 Dec 2008 22:41:52 -0000	1.34
@@ -2793,7 +2793,7 @@
   if ( *endp != '\0' || errno == ERANGE || nValue < 1 || nValue > maxVal ) {
 	PR_snprintf ( errorbuf, SLAPI_DSE_RETURNTEXT_SIZE, "%s: invalid value \"%s\", connection table "
 			"size must range from 1 to %d (the current process maxdescriptors limit).  "
-			"Server will use a setting of %d.", attrname, value, maxVal );
+			"Server will use a setting of %d.", attrname, value, maxVal, maxVal );
         if ( nValue > maxVal) {
             nValue = maxVal;
             retVal = LDAP_UNWILLING_TO_PERFORM;


Index: modify.c
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/slapd/modify.c,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -r1.19 -r1.20
--- modify.c	13 Nov 2008 23:08:18 -0000	1.19
+++ modify.c	5 Dec 2008 22:41:52 -0000	1.20
@@ -575,7 +575,7 @@
 	{ 
 		if ( !internal_op )
 		{
-			slapi_log_access(LDAP_DEBUG_STATS, "conn=%" PRIu64 " op=%d MOD dn=\"%s\"\n",
+			slapi_log_access(LDAP_DEBUG_STATS, "conn=%" NSPRIu64 " 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 @@
 
 			if (operation_is_flag_set(operation,OP_FLAG_ACTION_LOG_ACCESS))
 			{
-				slapi_log_access(LDAP_DEBUG_STATS, "conn=%" PRIu64 " op=%d MOD dn=\"%s\", %s\n",
+				slapi_log_access(LDAP_DEBUG_STATS, "conn=%" NSPRIu64 " 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 @@
 		{
 			if ( !internal_op )
 			{
-				slapi_log_access(LDAP_DEBUG_STATS, "conn=%" PRIu64 " op=%d MOD dn=\"%s\", %s\n",
+				slapi_log_access(LDAP_DEBUG_STATS, "conn=%" NSPRIu64 " 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 @@
 				{
 					if ( !internal_op )
 					{
-						slapi_log_access(LDAP_DEBUG_STATS, "conn=%" PRIu64 " op=%d MOD dn=\"%s\", %s\n",
+						slapi_log_access(LDAP_DEBUG_STATS, "conn=%" NSPRIu64 " 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");


Index: modrdn.c
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/slapd/modrdn.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- modrdn.c	24 Oct 2008 22:36:58 -0000	1.11
+++ modrdn.c	5 Dec 2008 22:41:52 -0000	1.12
@@ -351,7 +351,7 @@
 		if ( !internal_op )
 		{
 			slapi_log_access(LDAP_DEBUG_STATS,
-					 "conn=%" PRIu64 " op=%d MODRDN dn=\"%s\" newrdn=\"%s\" newsuperior=\"%s\"\n",
+					 "conn=%" NSPRIu64 " 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 @@
 	if ((rdns = ldap_explode_rdn(newrdn, 0)) == NULL) 
 	{
 		slapi_log_error(SLAPI_LOG_FATAL, NULL, 
-				 "conn=%" PRIu64 " op=%d MODRDN invalid new RDN (\"%s\")\n",
+				 "conn=%" NSPRIu64 " 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 @@
 	{
 		LDAPDebug(LDAP_DEBUG_ARGS, "ldap_explode_dn of newSuperior failed\n", 0, 0, 0);
 		slapi_log_error(SLAPI_LOG_FATAL, NULL,
-				 "conn=%" PRIu64 " op=%d MODRDN invalid new superior (\"%s\")",
+				 "conn=%" NSPRIu64 " op=%d MODRDN invalid new superior (\"%s\")",
 				 pb->pb_conn->c_connid,
 				 pb->pb_op->o_opid,
 				 (NULL == newsuperior) ? "(null)" : newsuperiorbuf);


Index: monitor.c
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/slapd/monitor.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- monitor.c	24 Oct 2008 22:36:58 -0000	1.8
+++ monitor.c	5 Dec 2008 22:41:52 -0000	1.9
@@ -75,7 +75,6 @@
 	struct tm		utm;
 	Slapi_Backend		*be;
 	char			*cookie;
-	PRUint32		len;
 
 	vals[0] = &val;
 	vals[1] = NULL;
@@ -86,31 +85,26 @@
 	attrlist_replace( &e->e_attrs, "version", vals );
 	slapi_ch_free( (void **) &val.bv_val );
 
-	sprintf( buf, "%d", g_get_active_threadcnt() );
+	val.bv_len = PR_snprintf( buf, sizeof(buf), "%d", g_get_active_threadcnt() );
 	val.bv_val = buf;
-	val.bv_len = strlen( buf );
 	attrlist_replace( &e->e_attrs, "threads", vals );
 
 	connection_table_as_entry(the_connection_table, e);
 
-	sprintf( buf, "%" PRIu64, slapi_counter_get_value(ops_initiated) );
+	val.bv_len = PR_snprintf( buf, sizeof(buf), "%" NSPRIu64, slapi_counter_get_value(ops_initiated) );
 	val.bv_val = buf;
-	val.bv_len = strlen( buf );
 	attrlist_replace( &e->e_attrs, "opsinitiated", vals );
 
-	sprintf( buf, "%" PRIu64, slapi_counter_get_value(ops_completed) );
+	val.bv_len = PR_snprintf( buf, sizeof(buf), "%" NSPRIu64, slapi_counter_get_value(ops_completed) );
 	val.bv_val = buf;
-	val.bv_len = strlen( buf );
 	attrlist_replace( &e->e_attrs, "opscompleted", vals );
 
-	len = PR_snprintf ( buf, BUFSIZ, "%" PRIu64, g_get_num_entries_sent() );
+	val.bv_len = PR_snprintf ( buf, sizeof(buf), "%" NSPRIu64, g_get_num_entries_sent() );
 	val.bv_val = buf;
-	val.bv_len = ( unsigned long ) len;
 	attrlist_replace( &e->e_attrs, "entriessent", vals );
 
-	len = PR_snprintf ( buf, BUFSIZ, "%" PRIu64, g_get_num_bytes_sent() );
+	val.bv_len = PR_snprintf ( buf, sizeof(buf), "%" NSPRIu64, g_get_num_bytes_sent() );
 	val.bv_val = buf;
-	val.bv_len = ( unsigned long ) len;
 	attrlist_replace( &e->e_attrs, "bytessent", vals );
 
 #ifdef _WIN32
@@ -141,15 +135,13 @@
 	val.bv_len = strlen( buf );
 	attrlist_replace( &e->e_attrs, "starttime", vals );
 
-	sprintf( buf, "%d", be_nbackends_public() );
+	val.bv_len = PR_snprintf( buf, sizeof(buf), "%d", be_nbackends_public() );
 	val.bv_val = buf;
-	val.bv_len = strlen( buf );
 	attrlist_replace( &e->e_attrs, "nbackends", vals );
 
 #ifdef THREAD_SUNOS5_LWP
-	sprintf( buf, "%d", thr_getconcurrency() );
+	val.bv_len = PR_snprintf( buf, sizeof(buf), "%d", thr_getconcurrency() );
 	val.bv_val = buf;
-	val.bv_len = strlen( buf );
 	attrlist_replace( &e->e_attrs, "concurrency", vals );
 #endif
 


Index: opshared.c
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/slapd/opshared.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- opshared.c	17 Oct 2008 22:12:47 -0000	1.13
+++ opshared.c	5 Dec 2008 22:41:52 -0000	1.14
@@ -230,7 +230,7 @@
   {
       char *fmtstr;
         
-#define SLAPD_SEARCH_FMTSTR_BASE "conn=%" PRIu64 " op=%d SRCH base=\"%s\" scope=%d "
+#define SLAPD_SEARCH_FMTSTR_BASE "conn=%" NSPRIu64 " 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 @@
 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=%" PRIu64 " op=%d %s dn=\"%s\", %s\n",
+	slapi_log_access( LDAP_DEBUG_STATS, "conn=%" NSPRIu64 " 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, 


Index: psearch.c
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/slapd/psearch.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- psearch.c	17 Oct 2008 22:12:47 -0000	1.10
+++ psearch.c	5 Dec 2008 22:41:52 -0000	1.11
@@ -305,7 +305,7 @@
 
 	if (conn_acq_flag) {
 		slapi_log_error(SLAPI_LOG_CONNS, "Persistent Search",
-						"conn=%" PRIu64 " op=%d Could not acquire the connection - psearch aborted\n",
+						"conn=%" NSPRIu64 " 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 @@
 	/* 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=%" PRIu64 " op=%d The operation has been abandoned\n",
+						"conn=%" NSPRIu64 " 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 @@
 										 ectrls, attrs, attrsonly );
 			if (rc) {
 				slapi_log_error(SLAPI_LOG_CONNS, "Persistent Search",
-								"conn=%" PRIu64 " op=%d Error %d sending entry %s with op status %d\n",
+								"conn=%" NSPRIu64 " 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 @@
     PR_Lock( ps->ps_pblock->pb_conn->c_mutex );
 
 	slapi_log_error(SLAPI_LOG_CONNS, "Persistent Search",
-					"conn=%" PRIu64 " op=%d Releasing the connection and operation\n",
+					"conn=%" NSPRIu64 " 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 @@
 		}
 
 		slapi_log_error(SLAPI_LOG_CONNS, "Persistent Search",
-						"conn=%" PRIu64 " op=%d entry %s with chgtype %d "
+						"conn=%" NSPRIu64 " 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);


Index: result.c
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/slapd/result.c,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -r1.17 -r1.18
--- result.c	24 Nov 2008 17:16:55 -0000	1.17
+++ result.c	5 Dec 2008 22:41:52 -0000	1.18
@@ -1641,7 +1641,7 @@
             PR_snprintf(etime, ETIME_BUFSIZ, "%f", 
                         (PRFloat64)delta/PR_TicksPerSecond());
         } else {
-            PR_snprintf(etime, ETIME_BUFSIZ, "%d", current_time() - op->o_time);
+            PR_snprintf(etime, ETIME_BUFSIZ, "%ld", current_time() - op->o_time);
         }
 
 	if ( 0 == pb->pb_operation_notes ) {
@@ -1672,7 +1672,7 @@
 			if ( !internal_op )
 			{
 				slapi_log_access( LDAP_DEBUG_STATS,
-								  "conn=%" PRIu64 " op=%d RESULT err=%d"
+								  "conn=%" NSPRIu64 " op=%d RESULT err=%d"
 								  " tag=%u nentries=%d etime=%s%s%s"
 								  ", SASL bind in progress\n",
 								  op->o_connid, 
@@ -1704,7 +1704,7 @@
 			if ( !internal_op )
 			{
 				slapi_log_access( LDAP_DEBUG_STATS,
-								  "conn=%" PRIu64 " op=%d RESULT err=%d"
+								  "conn=%" NSPRIu64 " op=%d RESULT err=%d"
 								  " tag=%u nentries=%d etime=%s%s%s"
 								  " dn=\"%s\"\n",
 								  op->o_connid, 
@@ -1730,7 +1730,7 @@
 			if ( !internal_op )
 			{
 				slapi_log_access( LDAP_DEBUG_STATS,
-								  "conn=%" PRIu64 " op=%d RESULT err=%d"
+								  "conn=%" NSPRIu64 " op=%d RESULT err=%d"
 								  " tag=%u nentries=%d etime=%s%s%s\n",
 								  op->o_connid, 
 								  op->o_opid,
@@ -1763,7 +1763,7 @@
 
 	if ( !internal_op )
 	{
-		slapi_log_access( LDAP_DEBUG_STATS2, "conn=%" PRIu64 " op=%d ENTRY dn=\"%s\"\n",
+		slapi_log_access( LDAP_DEBUG_STATS2, "conn=%" NSPRIu64 " op=%d ENTRY dn=\"%s\"\n",
 			op->o_connid, op->o_opid,
 			escape_string( slapi_entry_get_dn_const(e), ebuf ));
 	}
@@ -1788,7 +1788,7 @@
 
 	if ( !internal_op )
 	{
-		slapi_log_access( LDAP_DEBUG_STATS2, "conn=%" PRIu64 " op=%d REFERRAL\n",
+		slapi_log_access( LDAP_DEBUG_STATS2, "conn=%" NSPRIu64 " op=%d REFERRAL\n",
 			op->o_connid, op->o_opid );
 	}
 	else


Index: sasl_io.c
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/slapd/sasl_io.c,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -r1.17 -r1.18
--- sasl_io.c	26 Nov 2008 17:32:21 -0000	1.17
+++ sasl_io.c	5 Dec 2008 22:41:52 -0000	1.18
@@ -82,7 +82,7 @@
     int ret = 0;
 
     LDAPDebug( LDAP_DEBUG_CONNS,
-                "sasl_io_enable for connection %" PRIu64 "\n", c->c_connid, 0, 0 );
+                "sasl_io_enable for connection %" NSPRIu64 "\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_private *sp = (sasl_io_private*) slapi_ch_calloc(1, sizeof(sasl_io_private));
 
     LDAPDebug( LDAP_DEBUG_CONNS,
-                "sasl_io_setup for connection %" PRIu64 "\n", c->c_connid, 0, 0 );
+                "sasl_io_setup for connection %" NSPRIu64 "\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_private *sp = c->c_sasl_io_private;
     if (sp) {
         LDAPDebug( LDAP_DEBUG_CONNS,
-                "sasl_io_cleanup for connection %" PRIu64 "\n", c->c_connid, 0, 0 );
+                "sasl_io_cleanup for connection %" NSPRIu64 "\n", c->c_connid, 0, 0 );
         /* Free the buffers */
         slapi_ch_free((void**)&(sp->encrypted_buffer));
         slapi_ch_free((void**)&(sp->decrypted_buffer));
@@ -204,7 +204,7 @@
     }
     if (ret != 0 && ret < sizeof(buffer)) {
         LDAPDebug( LDAP_DEBUG_ANY,
-            "failed to read sasl packet length on connection %" PRIu64 "\n", c->c_connid, 0, 0 );
+            "failed to read sasl packet length on connection %" NSPRIu64 "\n", c->c_connid, 0, 0 );
         return -1;
         
     }
@@ -215,7 +215,7 @@
         packet_length += 4;
 
         LDAPDebug( LDAP_DEBUG_CONNS,
-            "read sasl packet length %ld on connection %" PRIu64 "\n", packet_length, c->c_connid, 0 );
+            "read sasl packet length %ld on connection %" NSPRIu64 "\n", packet_length, c->c_connid, 0 );
 
         /* Check if the packet length is larger than our max allowed.  A
          * setting of -1 means that we allow any size SASL IO packet. */
@@ -270,7 +270,7 @@
 
     *err = 0;
     LDAPDebug( LDAP_DEBUG_CONNS,
-                "sasl_recv_connection for connection %" PRIu64 "\n", c->c_connid, 0, 0 );
+                "sasl_recv_connection for connection %" NSPRIu64 "\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) {
@@ -297,12 +297,12 @@
             const char *output_buffer = NULL;
             unsigned int output_length = 0;
             LDAPDebug( LDAP_DEBUG_CONNS,
-            "sasl_recv_connection finished reading packet for connection %" PRIu64 "\n", c->c_connid, 0, 0 );
+            "sasl_recv_connection finished reading packet for connection %" NSPRIu64 "\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 %" PRIu64 "\n", output_length, c->c_connid, 0 );
+                "sasl_recv_connection decoded packet length %d for connection %" NSPRIu64 "\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);
@@ -313,7 +313,7 @@
                 }
             } else {
                 LDAPDebug( LDAP_DEBUG_ANY,
-                "sasl_recv_connection failed to decode packet for connection %" PRIu64 "\n", c->c_connid, 0, 0 );
+                "sasl_recv_connection failed to decode packet for connection %" NSPRIu64 "\n", c->c_connid, 0, 0 );
             }
         }
     }


Index: search.c
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/slapd/search.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- search.c	24 Oct 2008 22:36:58 -0000	1.11
+++ search.c	5 Dec 2008 22:41:52 -0000	1.12
@@ -384,7 +384,7 @@
 {
 	char ebuf[BUFSIZ];
 	slapi_log_access(LDAP_DEBUG_STATS,
-					 "conn=%" PRIu64 " op=%d SRCH base=\"%s\" scope=%d filter=\"%s\", %s\n",
+					 "conn=%" NSPRIu64 " 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 : "");
 


Index: slap.h
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/slapd/slap.h,v
retrieving revision 1.42
retrieving revision 1.43
diff -u -r1.42 -r1.43
--- slap.h	2 Dec 2008 15:29:30 -0000	1.42
+++ slap.h	5 Dec 2008 22:41:52 -0000	1.43
@@ -121,14 +121,6 @@
 #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 */


Index: slapi-plugin.h
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/slapd/slapi-plugin.h,v
retrieving revision 1.35
retrieving revision 1.36
diff -u -r1.35 -r1.36
--- slapi-plugin.h	13 Nov 2008 23:08:18 -0000	1.35
+++ slapi-plugin.h	5 Dec 2008 22:41:52 -0000	1.36
@@ -52,6 +52,37 @@
 
 #include "prtypes.h"
 #include "ldap.h"
+#include "prprf.h"
+NSPR_API(PRUint32) PR_snprintf(char *out, PRUint32 outlen, const char *fmt, ...)
+#ifdef __GNUC__ 
+        __attribute__ ((format (printf, 3, 4)));
+#else
+        ;
+#endif
+NSPR_API(char*) PR_smprintf(const char *fmt, ...)
+#ifdef __GNUC__ 
+        __attribute__ ((format (printf, 1, 2)));
+#else
+        ;
+#endif
+NSPR_API(char*) PR_sprintf_append(char *last, const char *fmt, ...)
+#ifdef __GNUC__ 
+        __attribute__ ((format (printf, 2, 3)));
+#else
+        ;
+#endif
+NSPR_API(PRUint32) PR_fprintf(struct PRFileDesc* fd, const char *fmt, ...)
+#ifdef __GNUC__ 
+        __attribute__ ((format (printf, 2, 3)));
+#else
+        ;
+#endif
+
+/* 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.
+ */
+#define NSPRIu64	"llu"
+#define NSPRI64	"ll"
 
 /*
  * The slapi_attr_get_flags() routine returns a bitmap that contains one or
@@ -1041,7 +1072,13 @@
 /*
  * logging
  */
-int slapi_log_error( int severity, char *subsystem, char *fmt, ... );
+int slapi_log_error( int severity, char *subsystem, char *fmt, ... )
+#ifdef __GNUC__ 
+        __attribute__ ((format (printf, 3, 4)));
+#else
+        ;
+#endif
+
 /* allowed values for the "severity" parameter */
 #define SLAPI_LOG_FATAL          	0
 #define SLAPI_LOG_TRACE			1


Index: snmp_collator.c
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/slapd/snmp_collator.c,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -r1.17 -r1.18
--- snmp_collator.c	28 Oct 2008 00:18:27 -0000	1.17
+++ snmp_collator.c	5 Dec 2008 22:41:52 -0000	1.18
@@ -765,7 +765,7 @@
 add_counter_to_value(Slapi_Entry *e, const char *type, PRUint64 countervalue)
 {
 	char value[40];
-	sprintf(value,"%" PRIu64, countervalue);
+	PR_snprintf(value,sizeof(value),"%" NSPRIu64, countervalue);
 	slapi_entry_attr_set_charptr( e, type, value);
 }
 


Index: ssl.c
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/slapd/ssl.c,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -r1.20 -r1.21
--- ssl.c	2 Dec 2008 15:29:30 -0000	1.20
+++ ssl.c	5 Dec 2008 22:41:52 -0000	1.21
@@ -166,7 +166,7 @@
 		cipher_names = (char **) slapi_ch_calloc ((number_of_ciphers +1 ) , sizeof(char *));
 		for (i = 0 ; _conf_ciphers[i].name != NULL; i++ ) {
 			SSL_GetCipherSuiteInfo((PRUint16)_conf_ciphers[i].num,&info,sizeof(info));
-			cipher_names[i] = PR_smprintf("%s%s%s%s%s%s%s%s%d\0",_conf_ciphers[i].version,sep,_conf_ciphers[i].name,sep,info.symCipherName,sep,info.macAlgorithmName,sep,info.symKeyBits);
+			cipher_names[i] = PR_smprintf("%s%s%s%s%s%s%s%s%d",_conf_ciphers[i].version,sep,_conf_ciphers[i].name,sep,info.symCipherName,sep,info.macAlgorithmName,sep,info.symKeyBits);
 		}
 		cipher_names[i] = NULL;
 	}


Index: unbind.c
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/slapd/unbind.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- unbind.c	17 Oct 2008 22:12:47 -0000	1.6
+++ unbind.c	5 Dec 2008 22:41:53 -0000	1.7
@@ -79,7 +79,7 @@
 	 *	UnBindRequest ::= NULL
 	 */
 	if ( ber_get_null( ber ) == LBER_ERROR ) {
-		slapi_log_access( LDAP_DEBUG_STATS, "conn=%" PRIu64 " op=%d UNBIND,"
+		slapi_log_access( LDAP_DEBUG_STATS, "conn=%" NSPRIu64 " 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 @@
 	 * pass them to the backend.
 	 */
 	if ( (err = get_ldapmessage_controls( pb, ber, NULL )) != 0 ) {
-		slapi_log_access( LDAP_DEBUG_STATS, "conn=%" PRIu64 " op=%d UNBIND,"
+		slapi_log_access( LDAP_DEBUG_STATS, "conn=%" NSPRIu64 " 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 @@
 
 	/* ONREPL - plugins should be called and passed bind dn and, possibly, other data */
 
-	slapi_log_access( LDAP_DEBUG_STATS, "conn=%" PRIu64 " op=%d UNBIND\n",
+	slapi_log_access( LDAP_DEBUG_STATS, "conn=%" NSPRIu64 " op=%d UNBIND\n",
 	    pb->pb_conn->c_connid, operation->o_opid );
 
 	/* pass the unbind to all backends */


Index: util.c
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/slapd/util.c,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -r1.20 -r1.21
--- util.c	2 Dec 2008 15:29:31 -0000	1.20
+++ util.c	5 Dec 2008 22:41:53 -0000	1.21
@@ -1161,7 +1161,7 @@
 	    } else if (rc == 0) { /* timeout */
 		rc = LDAP_TIMEOUT;
 		slapi_log_error(SLAPI_LOG_FATAL, "slapi_ldap_bind",
-				"Error: timeout after [%d.%d] seconds reading "
+				"Error: timeout after [%ld.%ld] seconds reading "
 				"bind response for [%s] mech [%s]\n",
 				timeout ? timeout->tv_sec : 0,
 				timeout ? timeout->tv_usec : 0,




More information about the Fedora-directory-commits mailing list