summaryrefslogtreecommitdiffstats
path: root/ldap/servers/slapd
diff options
context:
space:
mode:
authorRich Megginson <rmeggins@redhat.com>2008-12-05 22:41:53 +0000
committerRich Megginson <rmeggins@redhat.com>2008-12-05 22:41:53 +0000
commit0253cf3cca45f65caaeabfe886a41da5de916bdc (patch)
treefaab17e1bf51b7ff1b147c6c648bbb6075b2a359 /ldap/servers/slapd
parent458a42a89182a23408e0db6482c59736936410d4 (diff)
downloadds-0253cf3cca45f65caaeabfe886a41da5de916bdc.tar.gz
ds-0253cf3cca45f65caaeabfe886a41da5de916bdc.tar.xz
ds-0253cf3cca45f65caaeabfe886a41da5de916bdc.zip
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
Diffstat (limited to 'ldap/servers/slapd')
-rw-r--r--ldap/servers/slapd/abandon.c6
-rw-r--r--ldap/servers/slapd/add.c4
-rw-r--r--ldap/servers/slapd/auth.c16
-rw-r--r--ldap/servers/slapd/back-ldbm/dbverify.c6
-rw-r--r--ldap/servers/slapd/back-ldbm/ldbm_delete.c4
-rw-r--r--ldap/servers/slapd/back-ldbm/ldbm_modrdn.c4
-rw-r--r--ldap/servers/slapd/back-ldbm/ldif2ldbm.c8
-rw-r--r--ldap/servers/slapd/back-ldbm/misc.c2
-rw-r--r--ldap/servers/slapd/bind.c8
-rw-r--r--ldap/servers/slapd/compare.c2
-rw-r--r--ldap/servers/slapd/config.c2
-rw-r--r--ldap/servers/slapd/connection.c72
-rw-r--r--ldap/servers/slapd/conntable.c8
-rw-r--r--ldap/servers/slapd/daemon.c2
-rw-r--r--ldap/servers/slapd/delete.c2
-rw-r--r--ldap/servers/slapd/entry.c2
-rw-r--r--ldap/servers/slapd/extendop.c4
-rw-r--r--ldap/servers/slapd/libglobs.c2
-rw-r--r--ldap/servers/slapd/modify.c8
-rw-r--r--ldap/servers/slapd/modrdn.c6
-rw-r--r--ldap/servers/slapd/monitor.c22
-rw-r--r--ldap/servers/slapd/opshared.c4
-rw-r--r--ldap/servers/slapd/psearch.c10
-rw-r--r--ldap/servers/slapd/result.c12
-rw-r--r--ldap/servers/slapd/sasl_io.c18
-rw-r--r--ldap/servers/slapd/search.c2
-rw-r--r--ldap/servers/slapd/slap.h8
-rw-r--r--ldap/servers/slapd/slapi-plugin.h39
-rw-r--r--ldap/servers/slapd/snmp_collator.c2
-rw-r--r--ldap/servers/slapd/ssl.c2
-rw-r--r--ldap/servers/slapd/unbind.c6
-rw-r--r--ldap/servers/slapd/util.c2
32 files changed, 158 insertions, 137 deletions
diff --git a/ldap/servers/slapd/abandon.c b/ldap/servers/slapd/abandon.c
index 57b67127..4e87a71c 100644
--- a/ldap/servers/slapd/abandon.c
+++ b/ldap/servers/slapd/abandon.c
@@ -153,15 +153,15 @@ do_abandon( Slapi_PBlock *pb )
}
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 );
diff --git a/ldap/servers/slapd/add.c b/ldap/servers/slapd/add.c
index fb162cfe..0e5675be 100644
--- a/ldap/servers/slapd/add.c
+++ b/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=%" 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 @@ static void op_shared_add (Slapi_PBlock *pb)
{
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));
diff --git a/ldap/servers/slapd/auth.c b/ldap/servers/slapd/auth.c
index cb3c41e8..064b3318 100644
--- a/ldap/servers/slapd/auth.c
+++ b/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=%" 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 @@ 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=%" 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 @@ handle_handshake_done (PRFileDesc *prfd, void* clientData)
!= 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 @@ handle_handshake_done (PRFileDesc *prfd, void* clientData)
}
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 @@ handle_handshake_done (PRFileDesc *prfd, void* clientData)
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 @@ handle_handshake_done (PRFileDesc *prfd, void* clientData)
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 );
}
diff --git a/ldap/servers/slapd/back-ldbm/dbverify.c b/ldap/servers/slapd/back-ldbm/dbverify.c
index 992bc2fc..94ffd6be 100644
--- a/ldap/servers/slapd/back-ldbm/dbverify.c
+++ b/ldap/servers/slapd/back-ldbm/dbverify.c
@@ -66,7 +66,7 @@ dbverify_ext( ldbm_instance *inst, int verbose )
{
slapi_log_error(SLAPI_LOG_FATAL, "DB verify",
"db path too long: %s/%s\n",
- inst->inst_parent_dir_name, inst->inst_dir_name, 0);
+ inst->inst_parent_dir_name, inst->inst_dir_name);
return 1;
}
tmplen = strlen(dbdir);
@@ -99,8 +99,8 @@ dbverify_ext( ldbm_instance *inst, int verbose )
if (sizeof(direntry->name) + 2 > filelen)
{
slapi_log_error(SLAPI_LOG_FATAL, "DB verify",
- "db path too long: %s/%s%s\n",
- dbdir, direntry->name, 0);
+ "db path too long: %s/%s\n",
+ dbdir, direntry->name);
continue;
}
PR_snprintf(filep, filelen, "/%s", direntry->name);
diff --git a/ldap/servers/slapd/back-ldbm/ldbm_delete.c b/ldap/servers/slapd/back-ldbm/ldbm_delete.c
index a0af8d78..fe02b207 100644
--- a/ldap/servers/slapd/back-ldbm/ldbm_delete.c
+++ b/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=%" PRIu64 " op=%d\n", pb->pb_conn->c_connid, operation->o_opid);
+ slapi_log_error (SLAPI_LOG_TRACE, "ldbm_back_delete", "enter conn=%" NSPRIu64 " 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=%" PRIu64 " op=%d\n", pb->pb_conn->c_connid, operation->o_opid);
+ slapi_log_error (SLAPI_LOG_TRACE, "ldbm_back_delete", "leave conn=%" NSPRIu64 " op=%d\n", pb->pb_conn->c_connid, operation->o_opid);
}
return rc;
}
diff --git a/ldap/servers/slapd/back-ldbm/ldbm_modrdn.c b/ldap/servers/slapd/back-ldbm/ldbm_modrdn.c
index c08dc405..1cb35ab8 100644
--- a/ldap/servers/slapd/back-ldbm/ldbm_modrdn.c
+++ b/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=%" PRIu64 " op=%d\n", pb->pb_conn->c_connid, operation->o_opid);
+ slapi_log_error (SLAPI_LOG_TRACE, "ldbm_back_modrdn", "enter conn=%" NSPRIu64 " 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=%" PRIu64 " op=%d\n", pb->pb_conn->c_connid, operation->o_opid);
+ slapi_log_error (SLAPI_LOG_TRACE, "ldbm_back_modrdn", "leave conn=%" NSPRIu64 " op=%d\n", pb->pb_conn->c_connid, operation->o_opid);
}
return retval;
}
diff --git a/ldap/servers/slapd/back-ldbm/ldif2ldbm.c b/ldap/servers/slapd/back-ldbm/ldif2ldbm.c
index f2981210..279cef54 100644
--- a/ldap/servers/slapd/back-ldbm/ldif2ldbm.c
+++ b/ldap/servers/slapd/back-ldbm/ldif2ldbm.c
@@ -679,7 +679,7 @@ static IDList *ldbm_fetch_subtrees(backend *be, char **include, int *err)
/* for each subtree spec... */
for (i = 0; include[i]; i++) {
IDList *idl = NULL;
- char *suffix = slapi_sdn_get_ndn(*be->be_suffix);
+ const char *suffix = slapi_sdn_get_ndn(*be->be_suffix);
char *parentdn = slapi_ch_strdup(suffix);
char *nextdn = NULL;
int matched = 0;
@@ -695,7 +695,7 @@ static IDList *ldbm_fetch_subtrees(backend *be, char **include, int *err)
while (NULL != parentdn &&
NULL != (nextdn = slapi_dn_parent( parentdn ))) {
slapi_ch_free_string( &parentdn );
- if (0 == slapi_utf8casecmp(nextdn, include[i])) {
+ if (0 == slapi_UTF8CASECMP(nextdn, include[i])) {
issubsuffix = 1; /* suffix of be is a subsuffix of include[i] */
break;
}
@@ -719,7 +719,7 @@ static IDList *ldbm_fetch_subtrees(backend *be, char **include, int *err)
while (NULL != parentdn &&
NULL != (nextdn = slapi_dn_parent( parentdn ))) {
slapi_ch_free_string( &parentdn );
- if (0 == slapi_utf8casecmp(nextdn, suffix)) {
+ if (0 == slapi_UTF8CASECMP(nextdn, (char *)suffix)) {
matched = 1;
break;
}
@@ -2458,7 +2458,7 @@ int upgradedb_delete_indices_4cmd(ldbm_instance *inst)
inst_dir, MAXPATHLEN);
slapi_log_error(SLAPI_LOG_TRACE, "upgrade DB",
- "upgradedb_delete_indices_4cmd: %s\n");
+ "upgradedb_delete_indices_4cmd: %s\n", inst_dir);
dirhandle = PR_OpenDir(inst_dirp);
if (!dirhandle)
{
diff --git a/ldap/servers/slapd/back-ldbm/misc.c b/ldap/servers/slapd/back-ldbm/misc.c
index 2e3b9777..b4c7942f 100644
--- a/ldap/servers/slapd/back-ldbm/misc.c
+++ b/ldap/servers/slapd/back-ldbm/misc.c
@@ -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=%" PRIu64 " op=%d %s\n",connection_id, operation_id,string);
+ slapi_log_access( LDAP_DEBUG_STATS, "conn=%" NSPRIu64 " op=%d %s\n",connection_id, operation_id,string);
}
int return_on_disk_full(struct ldbminfo *li)
diff --git a/ldap/servers/slapd/bind.c b/ldap/servers/slapd/bind.c
index f52830f7..fbf9a19b 100644
--- a/ldap/servers/slapd/bind.c
+++ b/ldap/servers/slapd/bind.c
@@ -694,25 +694,25 @@ log_bind_access (
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 );
diff --git a/ldap/servers/slapd/compare.c b/ldap/servers/slapd/compare.c
index f33d27af..5a0256ba 100644
--- a/ldap/servers/slapd/compare.c
+++ b/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=%" 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 );
diff --git a/ldap/servers/slapd/config.c b/ldap/servers/slapd/config.c
index 8c0c67eb..9cf56ddd 100644
--- a/ldap/servers/slapd/config.c
+++ b/ldap/servers/slapd/config.c
@@ -126,7 +126,7 @@ entry_has_attr_and_value(Slapi_Entry *e, const char *attrname,
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 */
}
diff --git a/ldap/servers/slapd/connection.c b/ldap/servers/slapd/connection.c
index 5ea4f778..00571c1b 100644
--- a/ldap/servers/slapd/connection.c
+++ b/ldap/servers/slapd/connection.c
@@ -352,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=%" 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 @@ 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=%" 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 @@ 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 %" 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 @@ 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 %" 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 @@ connection_dispatch_operation(Connection *conn, Operation *op, Slapi_PBlock *pb)
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 @@ int connection_release_nolock (Connection *conn)
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 @@ 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=%" 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 @@ 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 %" 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 @@ static int process_operation(Connection *conn, Operation *op)
!= 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 @@ 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=%" 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 @@ 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 %" 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 @@ 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=%" 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 @@ 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=%" 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 @@ 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 %" 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 @@ 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 %" 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 @@ 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 %" 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 @@ 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 %" 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 @@ 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 %" 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 @@ 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=%" 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 @@ 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 %" 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 @@ 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 %" 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 @@ 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 %" 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 @@ 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=%" 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 @@ 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=%" 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 @@ 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=%" 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 @@ 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 %" 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 @@ 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 %" 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 @@ 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 %" 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 @@ 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 %" 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 @@ connection_activity(Connection *conn)
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 @@ connection_remove_operation( Connection *conn, Operation *op )
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 @@ 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=%" 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 @@ disconnect_server_nomutex( Connection *conn, PRUint64 opconnid, int opid, PRErro
*/
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));
}
diff --git a/ldap/servers/slapd/conntable.c b/ldap/servers/slapd/conntable.c
index 08cc0c89..3a0a86ce 100644
--- a/ldap/servers/slapd/conntable.c
+++ b/ldap/servers/slapd/conntable.c
@@ -444,22 +444,22 @@ connection_table_as_entry(Connection_Table *ct, Slapi_Entry *e)
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 );
diff --git a/ldap/servers/slapd/daemon.c b/ldap/servers/slapd/daemon.c
index 32c7688c..3e91c124 100644
--- a/ldap/servers/slapd/daemon.c
+++ b/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 %" 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 */
diff --git a/ldap/servers/slapd/delete.c b/ldap/servers/slapd/delete.c
index 3db5f552..c17b669a 100644
--- a/ldap/servers/slapd/delete.c
+++ b/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=%" 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));
diff --git a/ldap/servers/slapd/entry.c b/ldap/servers/slapd/entry.c
index e3d2795e..01d45b26 100644
--- a/ldap/servers/slapd/entry.c
+++ b/ldap/servers/slapd/entry.c
@@ -1360,7 +1360,7 @@ entry2str_internal( Slapi_Entry *e, int *len, int entry2str_ctrl )
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));
}
diff --git a/ldap/servers/slapd/extendop.c b/ldap/servers/slapd/extendop.c
index 442ba69e..366a7328 100644
--- a/ldap/servers/slapd/extendop.c
+++ b/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=%" 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 );
}
diff --git a/ldap/servers/slapd/libglobs.c b/ldap/servers/slapd/libglobs.c
index 84d3a95c..bd2529c0 100644
--- a/ldap/servers/slapd/libglobs.c
+++ b/ldap/servers/slapd/libglobs.c
@@ -2793,7 +2793,7 @@ config_set_conntablesize( const char *attrname, char *value, char *errorbuf, int
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;
diff --git a/ldap/servers/slapd/modify.c b/ldap/servers/slapd/modify.c
index a3d803ec..4fd2a8b2 100644
--- a/ldap/servers/slapd/modify.c
+++ b/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=%" 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 @@ 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=%" 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 @@ static int op_shared_allow_pw_change (Slapi_PBlock *pb, LDAPMod *mod, char **old
{
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 @@ static int op_shared_allow_pw_change (Slapi_PBlock *pb, LDAPMod *mod, char **old
{
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");
diff --git a/ldap/servers/slapd/modrdn.c b/ldap/servers/slapd/modrdn.c
index 823f2dd0..68949696 100644
--- a/ldap/servers/slapd/modrdn.c
+++ b/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=%" 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 @@ 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=%" 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 @@ 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=%" 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);
diff --git a/ldap/servers/slapd/monitor.c b/ldap/servers/slapd/monitor.c
index 571e0fd4..2c15c39e 100644
--- a/ldap/servers/slapd/monitor.c
+++ b/ldap/servers/slapd/monitor.c
@@ -75,7 +75,6 @@ monitor_info(Slapi_PBlock *pb, Slapi_Entry* e, Slapi_Entry* entryAfter, int *ret
struct tm utm;
Slapi_Backend *be;
char *cookie;
- PRUint32 len;
vals[0] = &val;
vals[1] = NULL;
@@ -86,31 +85,26 @@ monitor_info(Slapi_PBlock *pb, Slapi_Entry* e, Slapi_Entry* entryAfter, int *ret
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 @@ monitor_info(Slapi_PBlock *pb, Slapi_Entry* e, Slapi_Entry* entryAfter, int *ret
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
diff --git a/ldap/servers/slapd/opshared.c b/ldap/servers/slapd/opshared.c
index 70c02222..8fc24126 100644
--- a/ldap/servers/slapd/opshared.c
+++ b/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=%" 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 @@ 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=%" 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,
diff --git a/ldap/servers/slapd/psearch.c b/ldap/servers/slapd/psearch.c
index f667900f..5925f44a 100644
--- a/ldap/servers/slapd/psearch.c
+++ b/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=%" 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 @@ 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=%" 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 @@ ps_send_results( void *arg )
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 @@ ps_send_results( void *arg )
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 @@ ps_service_persistent_searches( Slapi_Entry *e, Slapi_Entry *eprev, ber_int_t ch
}
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);
diff --git a/ldap/servers/slapd/result.c b/ldap/servers/slapd/result.c
index 32b88f5e..749361f1 100644
--- a/ldap/servers/slapd/result.c
+++ b/ldap/servers/slapd/result.c
@@ -1641,7 +1641,7 @@ log_result( Slapi_PBlock *pb, Operation *op, int err, ber_tag_t tag,
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 @@ log_result( Slapi_PBlock *pb, Operation *op, int err, ber_tag_t tag,
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 @@ log_result( Slapi_PBlock *pb, Operation *op, int err, ber_tag_t tag,
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 @@ log_result( Slapi_PBlock *pb, Operation *op, int err, ber_tag_t tag,
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 @@ log_entry( Operation *op, Slapi_Entry *e )
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 @@ log_referral( Operation *op )
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
diff --git a/ldap/servers/slapd/sasl_io.c b/ldap/servers/slapd/sasl_io.c
index 3c19a0d2..e65e60b3 100644
--- a/ldap/servers/slapd/sasl_io.c
+++ b/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 %" 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_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 %" 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_cleanup(Connection *c)
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 @@ 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 %" 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 @@ sasl_io_start_packet(Connection *c, PRInt32 *err)
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 @@ sasl_recv_connection(Connection *c, char *buffer, size_t count,PRInt32 *err)
*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 @@ 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 %" 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 @@ 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 %" PRIu64 "\n", c->c_connid, 0, 0 );
+ "sasl_recv_connection failed to decode packet for connection %" NSPRIu64 "\n", c->c_connid, 0, 0 );
}
}
}
diff --git a/ldap/servers/slapd/search.c b/ldap/servers/slapd/search.c
index 280bf2a3..fc3000cf 100644
--- a/ldap/servers/slapd/search.c
+++ b/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=%" 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 : "");
diff --git a/ldap/servers/slapd/slap.h b/ldap/servers/slapd/slap.h
index 7a4cb2e0..62a13f96 100644
--- a/ldap/servers/slapd/slap.h
+++ b/ldap/servers/slapd/slap.h
@@ -121,14 +121,6 @@ void *dlsym(void *a, char *b);
#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 */
diff --git a/ldap/servers/slapd/slapi-plugin.h b/ldap/servers/slapd/slapi-plugin.h
index 4131bae5..5ffb8608 100644
--- a/ldap/servers/slapd/slapi-plugin.h
+++ b/ldap/servers/slapd/slapi-plugin.h
@@ -52,6 +52,37 @@ extern "C" {
#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 @@ int slapi_register_plugin( const char *plugintype, int enabled,
/*
* 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
diff --git a/ldap/servers/slapd/snmp_collator.c b/ldap/servers/slapd/snmp_collator.c
index e67ca4af..e4a2d545 100644
--- a/ldap/servers/slapd/snmp_collator.c
+++ b/ldap/servers/slapd/snmp_collator.c
@@ -765,7 +765,7 @@ static void
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);
}
diff --git a/ldap/servers/slapd/ssl.c b/ldap/servers/slapd/ssl.c
index 0b895987..22a2c5b1 100644
--- a/ldap/servers/slapd/ssl.c
+++ b/ldap/servers/slapd/ssl.c
@@ -166,7 +166,7 @@ char ** getSupportedCiphers()
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;
}
diff --git a/ldap/servers/slapd/unbind.c b/ldap/servers/slapd/unbind.c
index d4f3aedf..2eb4a0fd 100644
--- a/ldap/servers/slapd/unbind.c
+++ b/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=%" 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 @@ 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=%" 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 @@ 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=%" 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 */
diff --git a/ldap/servers/slapd/util.c b/ldap/servers/slapd/util.c
index aaf27d07..64877506 100644
--- a/ldap/servers/slapd/util.c
+++ b/ldap/servers/slapd/util.c
@@ -1161,7 +1161,7 @@ slapi_ldap_bind(
} 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,