summaryrefslogtreecommitdiffstats
path: root/ldap/servers
diff options
context:
space:
mode:
Diffstat (limited to 'ldap/servers')
-rw-r--r--ldap/servers/plugins/acl/acl.c12
-rw-r--r--ldap/servers/plugins/acl/acl.h16
-rw-r--r--ldap/servers/plugins/acl/acl_ext.c4
-rw-r--r--ldap/servers/plugins/acl/aclanom.c4
-rw-r--r--ldap/servers/plugins/dna/dna.c9
-rw-r--r--ldap/servers/plugins/replication/repl.h16
-rw-r--r--ldap/servers/plugins/replication/repl5.h4
-rw-r--r--ldap/servers/plugins/replication/repl5_init.c5
-rw-r--r--ldap/servers/plugins/replication/repl5_replica.c12
-rw-r--r--ldap/servers/plugins/replication/repl5_total.c10
-rw-r--r--ldap/servers/plugins/replication/repl_connext.c4
-rw-r--r--ldap/servers/plugins/replication/repl_extop.c28
-rw-r--r--ldap/servers/plugins/replication/replutil.c60
-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/back-ldbm.h16
-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/misc.c4
-rw-r--r--ldap/servers/slapd/bind.c8
-rw-r--r--ldap/servers/slapd/compare.c2
-rw-r--r--ldap/servers/slapd/connection.c90
-rw-r--r--ldap/servers/slapd/conntable.c4
-rw-r--r--ldap/servers/slapd/daemon.c4
-rw-r--r--ldap/servers/slapd/delete.c2
-rw-r--r--ldap/servers/slapd/extendop.c4
-rw-r--r--ldap/servers/slapd/fe.h3
-rw-r--r--ldap/servers/slapd/globals.c4
-rw-r--r--ldap/servers/slapd/init.c7
-rw-r--r--ldap/servers/slapd/modify.c8
-rw-r--r--ldap/servers/slapd/modrdn.c6
-rw-r--r--ldap/servers/slapd/opshared.c4
-rw-r--r--ldap/servers/slapd/pblock.c4
-rw-r--r--ldap/servers/slapd/plugin_internal_op.c2
-rw-r--r--ldap/servers/slapd/proto-slap.h6
-rw-r--r--ldap/servers/slapd/psearch.c10
-rw-r--r--ldap/servers/slapd/result.c10
-rw-r--r--ldap/servers/slapd/sasl_io.c18
-rw-r--r--ldap/servers/slapd/search.c2
-rw-r--r--ldap/servers/slapd/slap.h23
-rw-r--r--ldap/servers/slapd/slapi-plugin.h12
-rw-r--r--ldap/servers/slapd/snmp_collator.c3
-rw-r--r--ldap/servers/slapd/stubrepl.c2
-rw-r--r--ldap/servers/slapd/unbind.c6
-rw-r--r--ldap/servers/slapd/value.c4
46 files changed, 303 insertions, 183 deletions
diff --git a/ldap/servers/plugins/acl/acl.c b/ldap/servers/plugins/acl/acl.c
index 5262ca3e..77b95f17 100644
--- a/ldap/servers/plugins/acl/acl.c
+++ b/ldap/servers/plugins/acl/acl.c
@@ -297,7 +297,7 @@ acl_access_allowed(
if ( !privateBackend && (be_readonly || slapi_config_get_readonly () )){
slapi_log_error (loglevel, plugin_name,
- "conn=%d op=%d (main): Deny %s on entry(%s)"
+ "conn=%" PRIu64 " op=%d (main): Deny %s on entry(%s)"
": readonly backend\n",
op->o_connid, op->o_opid,
acl_access2str(access),
@@ -310,7 +310,7 @@ acl_access_allowed(
TNF_PROBE_0_DEBUG(acl_skipaccess_start,"ACL","");
if ( acl_skip_access_check ( pb, e )) {
slapi_log_error (loglevel, plugin_name,
- "conn=%d op=%d (main): Allow %s on entry(%s)"
+ "conn=%" PRIu64 " op=%d (main): Allow %s on entry(%s)"
": root user\n",
op->o_connid, op->o_opid,
acl_access2str(access),
@@ -438,7 +438,7 @@ acl_access_allowed(
TNF_PROBE_0_DEBUG(acl_entry_first_touch_start,"ACL","");
slapi_log_error(loglevel, plugin_name,
- "#### conn=%d op=%d binddn=\"%s\"\n",
+ "#### conn=%" PRIu64 " op=%d binddn=\"%s\"\n",
op->o_connid, op->o_opid, clientDn);
aclpb->aclpb_stat_total_entries++;
@@ -755,7 +755,7 @@ static void print_access_control_summary( char *source, int ret_val, char *clien
null_user);
slapi_log_error(loglevel, plugin_name,
- "conn=%d op=%d (%s): %s %s on entry(%s).attr(%s) to proxy (%s)"
+ "conn=%" PRIu64 " op=%d (%s): %s %s on entry(%s).attr(%s) to proxy (%s)"
": %s\n",
op->o_connid, op->o_opid,
source,
@@ -768,7 +768,7 @@ static void print_access_control_summary( char *source, int ret_val, char *clien
} else {
proxy_user = null_user;
slapi_log_error(loglevel, plugin_name,
- "conn=%d op=%d (%s): %s %s on entry(%s).attr(%s) to proxy (%s)"
+ "conn=%" PRIu64 " op=%d (%s): %s %s on entry(%s).attr(%s) to proxy (%s)"
": %s\n",
op->o_connid, op->o_opid,
source,
@@ -781,7 +781,7 @@ static void print_access_control_summary( char *source, int ret_val, char *clien
}
} else{
slapi_log_error(loglevel, plugin_name,
- "conn=%d op=%d (%s): %s %s on entry(%s).attr(%s) to %s"
+ "conn=%" PRIu64 " op=%d (%s): %s %s on entry(%s).attr(%s) to %s"
": %s\n",
op->o_connid, op->o_opid,
source,
diff --git a/ldap/servers/plugins/acl/acl.h b/ldap/servers/plugins/acl/acl.h
index f1153b21..bccf4c54 100644
--- a/ldap/servers/plugins/acl/acl.h
+++ b/ldap/servers/plugins/acl/acl.h
@@ -49,6 +49,22 @@
#ifndef _ACL_H_
#define _ACL_H_
+/* Required to get portable printf/scanf format macros */
+#ifdef HAVE_INTTYPES_H
+#include <inttypes.h>
+
+/* NSPR uses the print macros a bit differently than ANSI C. We
+ * need to use ll for a 64-bit integer, even when a long is 64-bit.
+ */
+#undef PRIu64
+#define PRIu64 "llu"
+#undef PRI64
+#define PRI64 "ll"
+
+#else
+#error Need to define portable format macros such as PRIu64
+#endif /* HAVE_INTTYPES_H */
+
#include <stdio.h>
#include <string.h>
#include <sys/types.h>
diff --git a/ldap/servers/plugins/acl/acl_ext.c b/ldap/servers/plugins/acl/acl_ext.c
index de041017..4bb20e7e 100644
--- a/ldap/servers/plugins/acl/acl_ext.c
+++ b/ldap/servers/plugins/acl/acl_ext.c
@@ -973,7 +973,7 @@ acl__get_aclpb_type ( Acl_PBlock *aclpb )
static void
acl__dump_stats ( struct acl_pblock *aclpb , const char *block_type)
{
- int connid = 0;
+ PRUint64 connid = 0;
int opid = 0;
Slapi_PBlock *pb = NULL;
@@ -985,7 +985,7 @@ acl__dump_stats ( struct acl_pblock *aclpb , const char *block_type)
/* DUMP STAT INFO */
slapi_log_error( SLAPI_LOG_ACL, plugin_name,
- "**** ACL OPERATION STAT BEGIN ( aclpb:%p Block type: %s): Conn:%d Operation:%d *******\n",
+ "**** ACL OPERATION STAT BEGIN ( aclpb:%p Block type: %s): Conn:%" PRIu64 " Operation:%d *******\n",
aclpb, block_type, connid, opid );
slapi_log_error( SLAPI_LOG_ACL, plugin_name, "\tNumber of entries scanned: %d\n",
aclpb->aclpb_stat_total_entries);
diff --git a/ldap/servers/plugins/acl/aclanom.c b/ldap/servers/plugins/acl/aclanom.c
index e783c54d..c7621963 100644
--- a/ldap/servers/plugins/acl/aclanom.c
+++ b/ldap/servers/plugins/acl/aclanom.c
@@ -543,14 +543,14 @@ aclanom_match_profile (Slapi_PBlock *pb, struct acl_pblock *aclpb, Slapi_Entry *
aci_ndn = slapi_sdn_get_ndn (acl_anom_profile->anom_targetinfo[i].anom_target);
slapi_log_error(loglevel, plugin_name,
- "conn=%d op=%d: Allow access on entry(%s).attr(%s) to anonymous: acidn=\"%s\"\n",
+ "conn=%" PRIu64 " op=%d: Allow access on entry(%s).attr(%s) to anonymous: acidn=\"%s\"\n",
op->o_connid, op->o_opid,
escape_string_with_punctuation(ndn, ebuf),
attr ? attr:"NULL",
escape_string_with_punctuation(aci_ndn, ebuf));
} else {
slapi_log_error(loglevel, plugin_name,
- "conn=%d op=%d: Deny access on entry(%s).attr(%s) to anonymous\n",
+ "conn=%" PRIu64 " op=%d: Deny access on entry(%s).attr(%s) to anonymous\n",
op->o_connid, op->o_opid,
escape_string_with_punctuation(ndn, ebuf), attr ? attr:"NULL" );
}
diff --git a/ldap/servers/plugins/dna/dna.c b/ldap/servers/plugins/dna/dna.c
index e96d090e..264d73a3 100644
--- a/ldap/servers/plugins/dna/dna.c
+++ b/ldap/servers/plugins/dna/dna.c
@@ -58,6 +58,15 @@
/* Required to get portable printf/scanf format macros */
#ifdef HAVE_INTTYPES_H
#include <inttypes.h>
+
+/* NSPR uses the print macros a bit differently than ANSI C. We
+ * need to use ll for a 64-bit integer, even when a long is 64-bit.
+ */
+#undef PRIu64
+#define PRIu64 "llu"
+#undef PRI64
+#define PRI64 "ll"
+
#else
#error Need to define portable format macros such as PRIu64
#endif /* HAVE_INTTYPES_H */
diff --git a/ldap/servers/plugins/replication/repl.h b/ldap/servers/plugins/replication/repl.h
index 05ea0929..ca0fe05b 100644
--- a/ldap/servers/plugins/replication/repl.h
+++ b/ldap/servers/plugins/replication/repl.h
@@ -44,6 +44,22 @@
#ifndef _REPL_H_
#define _REPL_H_
+/* Required to get portable printf/scanf format macros */
+#ifdef HAVE_INTTYPES_H
+#include <inttypes.h>
+
+/* NSPR uses the print macros a bit differently than ANSI C. We
+ * need to use ll for a 64-bit integer, even when a long is 64-bit.
+ */
+#undef PRIu64
+#define PRIu64 "llu"
+#undef PRI64
+#define PRI64 "ll"
+
+#else
+#error Need to define portable format macros such as PRIu64
+#endif /* HAVE_INTTYPES_H */
+
#include <limits.h>
#include <time.h>
#include <stdio.h>
diff --git a/ldap/servers/plugins/replication/repl5.h b/ldap/servers/plugins/replication/repl5.h
index 4a7f0db9..86834e8b 100644
--- a/ldap/servers/plugins/replication/repl5.h
+++ b/ldap/servers/plugins/replication/repl5.h
@@ -443,10 +443,10 @@ Replica *windows_replica_new(const Slapi_DN *root);
during addition of the replica over LDAP */
Replica *replica_new_from_entry (Slapi_Entry *e, char *errortext, PRBool is_add_operation);
void replica_destroy(void **arg);
-PRBool replica_get_exclusive_access(Replica *r, PRBool *isInc, int connid, int opid,
+PRBool replica_get_exclusive_access(Replica *r, PRBool *isInc, PRUint64 connid, int opid,
const char *locking_purl,
char **current_purl);
-void replica_relinquish_exclusive_access(Replica *r, int connid, int opid);
+void replica_relinquish_exclusive_access(Replica *r, PRUint64 connid, int opid);
PRBool replica_get_tombstone_reap_active(const Replica *r);
const Slapi_DN *replica_get_root(const Replica *r);
const char *replica_get_name(const Replica *r);
diff --git a/ldap/servers/plugins/replication/repl5_init.c b/ldap/servers/plugins/replication/repl5_init.c
index 36af798b..b6d7de22 100644
--- a/ldap/servers/plugins/replication/repl5_init.c
+++ b/ldap/servers/plugins/replication/repl5_init.c
@@ -178,7 +178,8 @@ set_thread_private_cache ( void *buf )
char*
get_repl_session_id (Slapi_PBlock *pb, char *idstr, CSN **csn)
{
- int connid=-1, opid=-1;
+ int opid=-1;
+ PRUint64 connid = 0;
CSN *opcsn;
char opcsnstr[CSN_STRSIZE];
@@ -192,7 +193,7 @@ get_repl_session_id (Slapi_PBlock *pb, char *idstr, CSN **csn)
/* Avoid "Connection is NULL and hence cannot access SLAPI_CONN_ID" */
if (opid) {
slapi_pblock_get (pb, SLAPI_CONN_ID, &connid);
- PR_snprintf (idstr, REPL_SESSION_ID_SIZE, "conn=%d op=%d", connid, opid);
+ PR_snprintf (idstr, REPL_SESSION_ID_SIZE, "conn=%" PRIu64 " op=%d", connid, opid);
}
slapi_pblock_get ( pb, SLAPI_OPERATION, &op );
diff --git a/ldap/servers/plugins/replication/repl5_replica.c b/ldap/servers/plugins/replication/repl5_replica.c
index 69a44673..16c22325 100644
--- a/ldap/servers/plugins/replication/repl5_replica.c
+++ b/ldap/servers/plugins/replication/repl5_replica.c
@@ -405,7 +405,7 @@ replica_destroy(void **arg)
* current_purl is the supplier who already has access, if any
*/
PRBool
-replica_get_exclusive_access(Replica *r, PRBool *isInc, int connid, int opid,
+replica_get_exclusive_access(Replica *r, PRBool *isInc, PRUint64 connid, int opid,
const char *locking_purl,
char **current_purl)
{
@@ -421,7 +421,7 @@ replica_get_exclusive_access(Replica *r, PRBool *isInc, int connid, int opid,
*isInc = (r->repl_state_flags & REPLICA_INCREMENTAL_IN_PROGRESS);
slapi_log_error(SLAPI_LOG_REPL, repl_plugin_name,
- "conn=%d op=%d repl=\"%s\": "
+ "conn=%" PRIu64 " op=%d repl=\"%s\": "
"Replica in use locking_purl=%s\n",
connid, opid,
escape_string(slapi_sdn_get_dn(r->repl_root),ebuf),
@@ -435,7 +435,7 @@ replica_get_exclusive_access(Replica *r, PRBool *isInc, int connid, int opid,
else
{
slapi_log_error(SLAPI_LOG_REPL, repl_plugin_name,
- "conn=%d op=%d repl=\"%s\": Acquired replica\n",
+ "conn=%" PRIu64 " op=%d repl=\"%s\": Acquired replica\n",
connid, opid,
escape_string(slapi_sdn_get_dn(r->repl_root),ebuf));
r->repl_state_flags |= REPLICA_IN_USE;
@@ -463,7 +463,7 @@ replica_get_exclusive_access(Replica *r, PRBool *isInc, int connid, int opid,
* Relinquish exclusive access to the replica
*/
void
-replica_relinquish_exclusive_access(Replica *r, int connid, int opid)
+replica_relinquish_exclusive_access(Replica *r, PRUint64 connid, int opid)
{
char ebuf[BUFSIZ];
PRBool isInc;
@@ -476,13 +476,13 @@ replica_relinquish_exclusive_access(Replica *r, int connid, int opid)
if (!(r->repl_state_flags & REPLICA_IN_USE))
{
slapi_log_error(SLAPI_LOG_REPL, repl_plugin_name,
- "conn=%d op=%d repl=\"%s\": "
+ "conn=%" PRIu64 " op=%d repl=\"%s\": "
"Replica not in use\n",
connid, opid,
escape_string(slapi_sdn_get_dn(r->repl_root),ebuf));
} else {
slapi_log_error(SLAPI_LOG_REPL, repl_plugin_name,
- "conn=%d op=%d repl=\"%s\": "
+ "conn=%" PRIu64 " op=%d repl=\"%s\": "
"Released replica\n",
connid, opid,
escape_string(slapi_sdn_get_dn(r->repl_root),ebuf));
diff --git a/ldap/servers/plugins/replication/repl5_total.c b/ldap/servers/plugins/replication/repl5_total.c
index 0a858dbf..7c3fcc3c 100644
--- a/ldap/servers/plugins/replication/repl5_total.c
+++ b/ldap/servers/plugins/replication/repl5_total.c
@@ -76,6 +76,7 @@
}
*/
+#include "repl.h"
#include "repl5.h"
#define CSN_TYPE_VALUE_UPDATED_ON_WIRE 1
@@ -848,11 +849,10 @@ multimaster_extop_NSDS50ReplicationEntry(Slapi_PBlock *pb)
int rc;
Slapi_Entry *e = NULL;
Slapi_Connection *conn = NULL;
- int connid, opid;
+ PRUint64 connid = 0;
+ int opid = 0;
- connid = 0;
slapi_pblock_get(pb, SLAPI_CONN_ID, &connid);
- opid = 0;
slapi_pblock_get(pb, SLAPI_OPERATION_ID, &opid);
/* Decode the extended operation */
@@ -881,7 +881,7 @@ multimaster_extop_NSDS50ReplicationEntry(Slapi_PBlock *pb)
const char *dn = slapi_entry_get_dn_const(e);
slapi_log_error(SLAPI_LOG_REPL, repl_plugin_name,
"Error %d: could not import entry dn %s "
- "for total update operation conn=%d op=%d\n",
+ "for total update operation conn=%" PRIu64 " op=%d\n",
rc, dn, connid, opid);
rc = -1;
}
@@ -891,7 +891,7 @@ multimaster_extop_NSDS50ReplicationEntry(Slapi_PBlock *pb)
{
slapi_log_error(SLAPI_LOG_REPL, repl_plugin_name,
"Error %d: could not decode the total update extop "
- "for total update operation conn=%d op=%d\n",
+ "for total update operation conn=%" PRIu64 " op=%d\n",
rc, connid, opid);
}
diff --git a/ldap/servers/plugins/replication/repl_connext.c b/ldap/servers/plugins/replication/repl_connext.c
index 3b216b65..14151f58 100644
--- a/ldap/servers/plugins/replication/repl_connext.c
+++ b/ldap/servers/plugins/replication/repl_connext.c
@@ -78,7 +78,7 @@ void* consumer_connection_extension_constructor (void *object, void *parent)
/* consumer connection extension destructor */
void consumer_connection_extension_destructor (void *ext, void *object, void *parent)
{
- int connid = 0;
+ PRUint64 connid = 0;
if (ext)
{
/* Check to see if this replication session has acquired
@@ -101,7 +101,7 @@ void consumer_connection_extension_destructor (void *ext, void *object, void *pa
slapi_pblock_get(pb, SLAPI_CONN_ID, &connid);
slapi_log_error(SLAPI_LOG_REPL, repl_plugin_name,
"Aborting total update in progress for replicated "
- "area %s connid=%d\n", slapi_sdn_get_dn(repl_root_sdn),
+ "area %s connid=%" PRIu64 "\n", slapi_sdn_get_dn(repl_root_sdn),
connid);
slapi_stop_bulk_import(pb);
}
diff --git a/ldap/servers/plugins/replication/repl_extop.c b/ldap/servers/plugins/replication/repl_extop.c
index 0cdba759..b286f209 100644
--- a/ldap/servers/plugins/replication/repl_extop.c
+++ b/ldap/servers/plugins/replication/repl_extop.c
@@ -562,7 +562,8 @@ multimaster_extop_StartNSDS50ReplicationRequest(Slapi_PBlock *pb)
char *bind_dn = NULL;
Object *ruv_object = NULL;
RUV *supplier_ruv = NULL;
- int connid, opid;
+ PRUint64 connid = 0;
+ int opid = 0;
PRBool isInc = PR_FALSE; /* true if incremental update */
char *locking_purl = NULL; /* the supplier contacting us */
char *current_purl = NULL; /* the supplier which already has exclusive access */
@@ -581,9 +582,7 @@ multimaster_extop_StartNSDS50ReplicationRequest(Slapi_PBlock *pb)
goto send_response;
}
- connid = 0;
slapi_pblock_get(pb, SLAPI_CONN_ID, &connid);
- opid = 0;
slapi_pblock_get(pb, SLAPI_OPERATION_ID, &opid);
/*
@@ -606,7 +605,7 @@ multimaster_extop_StartNSDS50ReplicationRequest(Slapi_PBlock *pb)
/* Stash info that this is an incremental update session */
connext->repl_protocol_version = REPL_PROTOCOL_50_INCREMENTAL;
slapi_log_error(SLAPI_LOG_REPL, repl_plugin_name,
- "conn=%d op=%d repl=\"%s\": Begin incremental protocol\n",
+ "conn=%" PRIu64 " op=%d repl=\"%s\": Begin incremental protocol\n",
connid, opid, repl_root);
isInc = PR_TRUE;
}
@@ -618,7 +617,7 @@ multimaster_extop_StartNSDS50ReplicationRequest(Slapi_PBlock *pb)
connext->repl_protocol_version = REPL_PROTOCOL_50_TOTALUPDATE;
}
slapi_log_error(SLAPI_LOG_REPL, repl_plugin_name,
- "conn=%d op=%d repl=\"%s\": Begin total protocol\n",
+ "conn=%" PRIu64 " op=%d repl=\"%s\": Begin total protocol\n",
connid, opid, repl_root);
isInc = PR_FALSE;
}
@@ -627,7 +626,7 @@ multimaster_extop_StartNSDS50ReplicationRequest(Slapi_PBlock *pb)
/* Stash info that this is an incremental update session */
connext->repl_protocol_version = REPL_PROTOCOL_50_INCREMENTAL;
slapi_log_error(SLAPI_LOG_REPL, repl_plugin_name,
- "conn=%d op=%d repl=\"%s\": Begin 7.1 incremental protocol\n",
+ "conn=%" PRIu64 " op=%d repl=\"%s\": Begin 7.1 incremental protocol\n",
connid, opid, repl_root);
isInc = PR_TRUE;
}
@@ -639,7 +638,7 @@ multimaster_extop_StartNSDS50ReplicationRequest(Slapi_PBlock *pb)
connext->repl_protocol_version = REPL_PROTOCOL_71_TOTALUPDATE;
}
slapi_log_error(SLAPI_LOG_REPL, repl_plugin_name,
- "conn=%d op=%d repl=\"%s\": Begin 7.1 total protocol\n",
+ "conn=%" PRIu64 " op=%d repl=\"%s\": Begin 7.1 total protocol\n",
connid, opid, repl_root);
isInc = PR_FALSE;
}
@@ -661,7 +660,7 @@ multimaster_extop_StartNSDS50ReplicationRequest(Slapi_PBlock *pb)
if (replica_is_being_configured(repl_root))
{
slapi_log_error(SLAPI_LOG_REPL, repl_plugin_name,
- "conn=%d op=%d replica=\"%s\": "
+ "conn=%" PRIu64 " op=%d replica=\"%s\": "
"Replica is being configured: try again later\n",
connid, opid, repl_root);
response = NSDS50_REPL_REPLICA_BUSY;
@@ -714,7 +713,7 @@ multimaster_extop_StartNSDS50ReplicationRequest(Slapi_PBlock *pb)
{
response = NSDS50_REPL_EXCESSIVE_CLOCK_SKEW;
slapi_log_error(SLAPI_LOG_FATAL, repl_plugin_name,
- "conn=%d op=%d repl=\"%s\": "
+ "conn=%" PRIu64 " op=%d repl=\"%s\": "
"Excessive clock skew from supplier RUV\n",
connid, opid, repl_root);
goto send_response;
@@ -750,7 +749,7 @@ multimaster_extop_StartNSDS50ReplicationRequest(Slapi_PBlock *pb)
if (check_replica_id_uniqueness(replica, supplier_ruv) != 0){
slapi_log_error(SLAPI_LOG_REPL, repl_plugin_name,
- "conn=%d op=%d repl=\"%s\": "
+ "conn=%" PRIu64 " op=%d repl=\"%s\": "
"Replica has same replicaID %d as supplier\n",
connid, opid, repl_root, replica_get_rid(replica));
response = NSDS50_REPL_REPLICAID_ERROR;
@@ -763,7 +762,7 @@ multimaster_extop_StartNSDS50ReplicationRequest(Slapi_PBlock *pb)
* the session's conn id and op id to identify the the supplier.
*/
/* junkrc = ruv_get_first_id_and_purl(supplier_ruv, &junkrid, &locking_purl); */
- PR_snprintf(locking_session, sizeof(locking_session), "conn=%d id=%d", connid, opid);
+ PR_snprintf(locking_session, sizeof(locking_session), "conn=%" PRIu64 " id=%d", connid, opid);
locking_purl = &locking_session[0];
if (replica_get_exclusive_access(replica, &isInc, connid, opid,
locking_purl,
@@ -877,7 +876,7 @@ send_response:
}
slapi_log_error (resp_log_level, repl_plugin_name,
- "conn=%d op=%d replica=\"%s\": "
+ "conn=%" PRIu64 " op=%d replica=\"%s\": "
"Unable to acquire replica: error: %s%s\n",
connid, opid,
(replica ? slapi_sdn_get_dn(replica_get_root(replica)) : "unknown"),
@@ -901,7 +900,7 @@ send_response:
slapi_pblock_set(pb, SLAPI_EXT_OP_RET_OID, REPL_NSDS50_REPLICATION_RESPONSE_OID);
slapi_pblock_set(pb, SLAPI_EXT_OP_RET_VALUE, resp_bval);
slapi_log_error(SLAPI_LOG_REPL, repl_plugin_name,
- "conn=%d op=%d repl=\"%s\": "
+ "conn=%" PRIu64 " op=%d repl=\"%s\": "
"StartNSDS50ReplicationRequest: response=%d rc=%d\n",
connid, opid, repl_root,
response, rc);
@@ -1008,7 +1007,8 @@ multimaster_extop_EndNSDS50ReplicationRequest(Slapi_PBlock *pb)
ber_int_t response;
void *conn;
consumer_connection_extension *connext = NULL;
- int connid=-1, opid=-1;
+ PRUint64 connid = 0;
+ int opid=-1;
/* Decode the extended operation */
if (decode_endrepl_extop(pb, &repl_root) == -1)
diff --git a/ldap/servers/plugins/replication/replutil.c b/ldap/servers/plugins/replication/replutil.c
index 8b457a11..544ac116 100644
--- a/ldap/servers/plugins/replication/replutil.c
+++ b/ldap/servers/plugins/replication/replutil.c
@@ -817,16 +817,17 @@ repl_chain_on_update(Slapi_PBlock *pb, Slapi_DN * target_dn,
int repl_op = 0;
int local_backend = -1; /* index of local backend */
int chaining_backend = -1; /* index of chain backend */
+ int is_internal = 0;
PRBool local_online = PR_FALSE; /* true if the local db is online */
int ii;
int opid;
#ifdef DEBUG_CHAIN_ON_UPDATE
- int connid;
+ PRUint64 connid = 0;
#endif
slapi_pblock_get(pb, SLAPI_OPERATION, &op);
#ifdef DEBUG_CHAIN_ON_UPDATE
if (operation_is_flag_set(op, OP_FLAG_INTERNAL)) {
- connid=-1; /* -1: internal op in a log msg */
+ is_internal = 1;
} else {
slapi_pblock_get(pb, SLAPI_CONN_ID, &connid);
}
@@ -853,11 +854,18 @@ repl_chain_on_update(Slapi_PBlock *pb, Slapi_DN * target_dn,
}
}
#ifdef DEBUG_CHAIN_ON_UPDATE
- slapi_log_error(SLAPI_LOG_REPL, repl_plugin_name, "repl_chain_on_update: conn=%d op=%d be "
- "%s is the %s backend and is %s\n",
- connid, opid,
- mtn_be_names[ii], (chaining_backend == ii) ? "chaining" : "local",
- (mtn_be_states[ii] == SLAPI_BE_STATE_ON) ? "online" : "offline");
+ if (is_internal) {
+ slapi_log_error(SLAPI_LOG_REPL, repl_plugin_name, "repl_chain_on_update: conn=-1 op=%d be "
+ "%s is the %s backend and is %s\n", opid,
+ mtn_be_names[ii], (chaining_backend == ii) ? "chaining" : "local",
+ (mtn_be_states[ii] == SLAPI_BE_STATE_ON) ? "online" : "offline");
+ } else {
+ slapi_log_error(SLAPI_LOG_REPL, repl_plugin_name, "repl_chain_on_update: conn=%" PRIu64 " op=%d be "
+ "%s is the %s backend and is %s\n", connid, opid,
+ mtn_be_names[ii], (chaining_backend == ii) ? "chaining" : "local",
+ (mtn_be_states[ii] == SLAPI_BE_STATE_ON) ? "online" : "offline");
+
+ }
#endif
}
@@ -880,9 +888,13 @@ repl_chain_on_update(Slapi_PBlock *pb, Slapi_DN * target_dn,
(op_type == SLAPI_OPERATION_UNBIND) ||
(op_type == SLAPI_OPERATION_COMPARE))) {
#ifdef DEBUG_CHAIN_ON_UPDATE
- slapi_log_error(SLAPI_LOG_REPL, repl_plugin_name, "repl_chain_on_update: conn=%d op=%d op is "
- "%d: using local backend\n",
- connid, opid, op_type);
+ if (is_internal) {
+ slapi_log_error(SLAPI_LOG_REPL, repl_plugin_name, "repl_chain_on_update: conn=-1 op=%d op is "
+ "%d: using local backend\n", opid, op_type);
+ } else {
+ slapi_log_error(SLAPI_LOG_REPL, repl_plugin_name, "repl_chain_on_update: conn=%" PRIu64 " op=%d op is "
+ "%d: using local backend\n", connid, opid, op_type);
+ }
#endif
return local_backend;
}
@@ -899,8 +911,13 @@ repl_chain_on_update(Slapi_PBlock *pb, Slapi_DN * target_dn,
slapi_pblock_get(pb, SLAPI_REQUESTOR_DN, &requestor_dn);
if (slapi_dn_isroot(requestor_dn)) {
#ifdef DEBUG_CHAIN_ON_UPDATE
- slapi_log_error(SLAPI_LOG_REPL, repl_plugin_name, "repl_chain_on_update: conn=%d op=%d requestor "
+ if (is_internal) {
+ slapi_log_error(SLAPI_LOG_REPL, repl_plugin_name, "repl_chain_on_update: conn=-1 op=%d requestor "
+ "is root: using local backend\n", opid);
+ } else {
+ slapi_log_error(SLAPI_LOG_REPL, repl_plugin_name, "repl_chain_on_update: conn=%" PRIu64 " op=%d requestor "
"is root: using local backend\n", connid, opid);
+ }
#endif
return local_backend;
}
@@ -911,8 +928,13 @@ repl_chain_on_update(Slapi_PBlock *pb, Slapi_DN * target_dn,
slapi_pblock_get(pb, SLAPI_IS_REPLICATED_OPERATION, &repl_op);
if (repl_op) {
#ifdef DEBUG_CHAIN_ON_UPDATE
- slapi_log_error(SLAPI_LOG_REPL, repl_plugin_name, "repl_chain_on_update: conn=%d op=%d op is "
+ if (is_internal) {
+ slapi_log_error(SLAPI_LOG_REPL, repl_plugin_name, "repl_chain_on_update: conn=-1 op=%d op is "
+ "replicated: using local backend\n", opid);
+ } else {
+ slapi_log_error(SLAPI_LOG_REPL, repl_plugin_name, "repl_chain_on_update: conn=%" PRIu64 " op=%d op is "
"replicated: using local backend\n", connid, opid);
+ }
#endif
return local_backend;
}
@@ -923,8 +945,13 @@ repl_chain_on_update(Slapi_PBlock *pb, Slapi_DN * target_dn,
extern int config_get_pw_is_global_policy();
if (!config_get_pw_is_global_policy()) {
#ifdef DEBUG_CHAIN_ON_UPDATE
- slapi_log_error(SLAPI_LOG_REPL, repl_plugin_name, "repl_chain_on_update: conn=%d op=%d using "
+ if (is_internal) {
+ slapi_log_error(SLAPI_LOG_REPL, repl_plugin_name, "repl_chain_on_update: conn=-1 op=%d using "
+ "local backend for local password policy\n", opid);
+ } else {
+ slapi_log_error(SLAPI_LOG_REPL, repl_plugin_name, "repl_chain_on_update: conn=%" PRIu64 " op=%d using "
"local backend for local password policy\n", connid, opid);
+ }
#endif
return local_backend;
}
@@ -935,8 +962,13 @@ repl_chain_on_update(Slapi_PBlock *pb, Slapi_DN * target_dn,
* use the chaining backend
*/
#ifdef DEBUG_CHAIN_ON_UPDATE
- slapi_log_error(SLAPI_LOG_REPL, repl_plugin_name, "repl_chain_on_update: conn=%d op=%d using "
+ if (is_internal) {
+ slapi_log_error(SLAPI_LOG_REPL, repl_plugin_name, "repl_chain_on_update: conn=-1 op=%d using "
+ "chaining backend\n", opid);
+ } else {
+ slapi_log_error(SLAPI_LOG_REPL, repl_plugin_name, "repl_chain_on_update: conn=%" PRIu64 " op=%d using "
"chaining backend\n", connid, opid);
+ }
#endif
return chaining_backend;
}
diff --git a/ldap/servers/slapd/abandon.c b/ldap/servers/slapd/abandon.c
index 4ceb54f7..57b67127 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=%d op=%d ABANDON"
+ slapi_log_access( LDAP_DEBUG_STATS, "conn=%" PRIu64 " op=%d ABANDON"
" targetop=NOTFOUND msgid=%d\n",
pb->pb_conn->c_connid, pb->pb_op->o_opid, id );
} else if ( suppressed_by_plugin ) {
- slapi_log_access( LDAP_DEBUG_STATS, "conn=%d op=%d ABANDON"
+ slapi_log_access( LDAP_DEBUG_STATS, "conn=%" PRIu64" op=%d ABANDON"
" targetop=SUPPRESSED-BY-PLUGIN msgid=%d\n",
pb->pb_conn->c_connid, pb->pb_op->o_opid, id );
} else {
- slapi_log_access( LDAP_DEBUG_STATS, "conn=%d op=%d ABANDON"
+ slapi_log_access( LDAP_DEBUG_STATS, "conn=%" PRIu64 " op=%d ABANDON"
" targetop=%d msgid=%d nentries=%d etime=%ld\n",
pb->pb_conn->c_connid, pb->pb_op->o_opid, o->o_opid, id,
o->o_results.r.r_search.nentries, current_time() - o->o_time );
diff --git a/ldap/servers/slapd/add.c b/ldap/servers/slapd/add.c
index bdd6998d..0e2cc9b4 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=%d op=%d ADD dn=\"%s\", add values for type %s failed\n",
+ "conn=%" PRIu64 " op=%d ADD dn=\"%s\", add values for type %s failed\n",
pb->pb_conn->c_connid, operation->o_opid,
escape_string( slapi_entry_get_dn_const(e), ebuf ), normtype );
send_ldap_result( pb, rc, NULL, NULL, 0, NULL );
@@ -432,7 +432,7 @@ static void op_shared_add (Slapi_PBlock *pb)
{
if ( !internal_op )
{
- slapi_log_access(LDAP_DEBUG_STATS, "conn=%d op=%d ADD dn=\"%s\"\n",
+ slapi_log_access(LDAP_DEBUG_STATS, "conn=%" PRIu64 " op=%d ADD dn=\"%s\"\n",
pb->pb_conn->c_connid,
operation->o_opid,
escape_string(slapi_entry_get_dn_const(e), ebuf));
diff --git a/ldap/servers/slapd/auth.c b/ldap/servers/slapd/auth.c
index 0b68a688..cb3c41e8 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=%d " SLAPI_COMPONENT_NAME_NSPR " error %i (%s); unauthenticated client %s; issuer %s\n",
+ "conn=%" PRIu64 " " SLAPI_COMPONENT_NAME_NSPR " error %i (%s); unauthenticated client %s; issuer %s\n",
conn->c_connid, errorCode, slapd_pr_strerror(errorCode),
subject ? escape_string( subject, sbuf ) : "NULL",
issuer ? escape_string( issuer, ibuf ) : "NULL" );
@@ -425,7 +425,7 @@ handle_handshake_done (PRFileDesc *prfd, void* clientData)
if ( (slapd_ssl_getChannelInfo (prfd, &channelInfo, sizeof(channelInfo))) != SECSuccess ) {
PRErrorCode errorCode = PR_GetError();
slapi_log_access (LDAP_DEBUG_STATS,
- "conn=%d SSL failed to obtain channel info; "
+ "conn=%" PRIu64 " SSL failed to obtain channel info; "
SLAPI_COMPONENT_NAME_NSPR " error %i (%s)\n",
conn->c_connid, errorCode, slapd_pr_strerror(errorCode));
return;
@@ -434,7 +434,7 @@ handle_handshake_done (PRFileDesc *prfd, void* clientData)
!= SECSuccess) {
PRErrorCode errorCode = PR_GetError();
slapi_log_access (LDAP_DEBUG_STATS,
- "conn=%d SSL failed to obtain cipher info; "
+ "conn=%" PRIu64 " SSL failed to obtain cipher info; "
SLAPI_COMPONENT_NAME_NSPR " error %i (%s)\n",
conn->c_connid, errorCode, slapd_pr_strerror(errorCode));
return;
@@ -455,13 +455,13 @@ handle_handshake_done (PRFileDesc *prfd, void* clientData)
}
if (config_get_SSLclientAuth() == SLAPD_SSLCLIENTAUTH_OFF ) {
- slapi_log_access (LDAP_DEBUG_STATS, "conn=%d SSL %i-bit %s\n",
+ slapi_log_access (LDAP_DEBUG_STATS, "conn=%" PRIu64 " SSL %i-bit %s\n",
conn->c_connid, keySize, cipher ? cipher : "NULL" );
slapi_ch_free_string(&cipher);
return;
}
if (clientCert == NULL) {
- slapi_log_access (LDAP_DEBUG_STATS, "conn=%d SSL %i-bit %s\n",
+ slapi_log_access (LDAP_DEBUG_STATS, "conn=%" PRIu64 " SSL %i-bit %s\n",
conn->c_connid, keySize, cipher ? cipher : "NULL" );
} else {
char* subject = subject_of (clientCert);
@@ -469,7 +469,7 @@ handle_handshake_done (PRFileDesc *prfd, void* clientData)
char* issuer = issuer_of (clientCert);
char sbuf[ BUFSIZ ], ibuf[ BUFSIZ ];
slapi_log_access( LDAP_DEBUG_STATS,
- "conn=%d SSL %i-bit %s; client %s; issuer %s\n",
+ "conn=%" PRIu64 " SSL %i-bit %s; client %s; issuer %s\n",
conn->c_connid, keySize, cipher ? cipher : "NULL",
subject ? escape_string( subject, sbuf ) : "NULL",
issuer ? escape_string( issuer, ibuf ) : "NULL");
@@ -507,11 +507,11 @@ handle_handshake_done (PRFileDesc *prfd, void* clientData)
if (clientDN != NULL) {
char ebuf[ BUFSIZ ];
- slapi_log_access (LDAP_DEBUG_STATS, "conn=%d SSL client bound as %s\n",
+ slapi_log_access (LDAP_DEBUG_STATS, "conn=%" PRIu64 " SSL client bound as %s\n",
conn->c_connid, escape_string( clientDN, ebuf ));
} else if (clientCert != NULL) {
slapi_log_access (LDAP_DEBUG_STATS,
- "conn=%d SSL failed to map client certificate to LDAP DN (%s)\n",
+ "conn=%" PRIu64 " SSL failed to map client certificate to LDAP DN (%s)\n",
conn->c_connid, extraErrorMsg );
}
diff --git a/ldap/servers/slapd/back-ldbm/back-ldbm.h b/ldap/servers/slapd/back-ldbm/back-ldbm.h
index c916f093..4c002991 100644
--- a/ldap/servers/slapd/back-ldbm/back-ldbm.h
+++ b/ldap/servers/slapd/back-ldbm/back-ldbm.h
@@ -59,6 +59,22 @@
#endif
#endif
+/* Required to get portable printf/scanf format macros */
+#ifdef HAVE_INTTYPES_H
+#include <inttypes.h>
+
+/* NSPR uses the print macros a bit differently than ANSI C. We
+ * need to use ll for a 64-bit integer, even when a long is 64-bit.
+ */
+#undef PRIu64
+#define PRIu64 "llu"
+#undef PRI64
+#define PRI64 "ll"
+
+#else
+#error Need to define portable format macros such as PRIu64
+#endif /* HAVE_INTTYPES_H */
+
/* A bunch of random system headers taken from all the source files, no source file should #include
any system headers now */
#include <stdio.h>
diff --git a/ldap/servers/slapd/back-ldbm/ldbm_delete.c b/ldap/servers/slapd/back-ldbm/ldbm_delete.c
index 6e6ecea2..a0af8d78 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=%d op=%d\n", pb->pb_conn->c_connid, operation->o_opid);
+ slapi_log_error (SLAPI_LOG_TRACE, "ldbm_back_delete", "enter conn=%" PRIu64 " op=%d\n", pb->pb_conn->c_connid, operation->o_opid);
}
is_fixup_operation = operation_is_flag_set(operation, OP_FLAG_REPL_FIXUP);
@@ -666,7 +666,7 @@ diskfull_return:
slapi_ch_free_string(&e_uniqueid);
if (pb->pb_conn)
{
- slapi_log_error (SLAPI_LOG_TRACE, "ldbm_back_delete", "leave conn=%d op=%d\n", pb->pb_conn->c_connid, operation->o_opid);
+ slapi_log_error (SLAPI_LOG_TRACE, "ldbm_back_delete", "leave conn=%" PRIu64 " op=%d\n", pb->pb_conn->c_connid, operation->o_opid);
}
return rc;
}
diff --git a/ldap/servers/slapd/back-ldbm/ldbm_modrdn.c b/ldap/servers/slapd/back-ldbm/ldbm_modrdn.c
index ca65c5fe..e92ddc5a 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=%d op=%d\n", pb->pb_conn->c_connid, operation->o_opid);
+ slapi_log_error (SLAPI_LOG_TRACE, "ldbm_back_modrdn", "enter conn=%" PRIu64 " op=%d\n", pb->pb_conn->c_connid, operation->o_opid);
}
inst = (ldbm_instance *) be->be_instance_info;
@@ -862,7 +862,7 @@ common_return:
slapi_pblock_set( pb, SLAPI_ENTRY_POST_OP, postentry );
if (pb->pb_conn)
{
- slapi_log_error (SLAPI_LOG_TRACE, "ldbm_back_modrdn", "leave conn=%d op=%d\n", pb->pb_conn->c_connid, operation->o_opid);
+ slapi_log_error (SLAPI_LOG_TRACE, "ldbm_back_modrdn", "leave conn=%" PRIu64 " op=%d\n", pb->pb_conn->c_connid, operation->o_opid);
}
return retval;
}
diff --git a/ldap/servers/slapd/back-ldbm/misc.c b/ldap/servers/slapd/back-ldbm/misc.c
index 3d637d2d..2e3b9777 100644
--- a/ldap/servers/slapd/back-ldbm/misc.c
+++ b/ldap/servers/slapd/back-ldbm/misc.c
@@ -68,7 +68,7 @@ void ldbm_nasty(const char* str, int c, int err)
void ldbm_log_access_message(Slapi_PBlock *pblock,char *string)
{
int ret = 0;
- int connection_id = 0;
+ PRUint64 connection_id = 0;
int operation_id = 0;
Operation *operation = NULL; /* DBDB this is sneaky---opid should be covered by the API directly */
@@ -81,7 +81,7 @@ void ldbm_log_access_message(Slapi_PBlock *pblock,char *string)
return;
}
operation_id = operation->o_opid;
- slapi_log_access( LDAP_DEBUG_STATS, "conn=%d op=%d %s\n",connection_id, operation_id,string);
+ slapi_log_access( LDAP_DEBUG_STATS, "conn=%" PRIu64 " op=%d %s\n",connection_id, operation_id,string);
}
int return_on_disk_full(struct ldbminfo *li)
diff --git a/ldap/servers/slapd/bind.c b/ldap/servers/slapd/bind.c
index 5ae89720..ccf172bd 100644
--- a/ldap/servers/slapd/bind.c
+++ b/ldap/servers/slapd/bind.c
@@ -686,25 +686,25 @@ log_bind_access (
if (method == LDAP_AUTH_SASL && saslmech && msg) {
slapi_log_access( LDAP_DEBUG_STATS,
- "conn=%d op=%d BIND dn=\"%s\" "
+ "conn=%" PRIu64 " op=%d BIND dn=\"%s\" "
"method=sasl version=%d mech=%s, %s\n",
pb->pb_conn->c_connid, pb->pb_op->o_opid, edn,
version, saslmech, msg );
} else if (method == LDAP_AUTH_SASL && saslmech) {
slapi_log_access( LDAP_DEBUG_STATS,
- "conn=%d op=%d BIND dn=\"%s\" "
+ "conn=%" PRIu64 " op=%d BIND dn=\"%s\" "
"method=sasl version=%d mech=%s\n",
pb->pb_conn->c_connid, pb->pb_op->o_opid, edn,
version, saslmech );
} else if (msg) {
slapi_log_access( LDAP_DEBUG_STATS,
- "conn=%d op=%d BIND dn=\"%s\" "
+ "conn=%" PRIu64 " op=%d BIND dn=\"%s\" "
"method=%d version=%d, %s\n",
pb->pb_conn->c_connid, pb->pb_op->o_opid, edn,
method, version, msg );
} else {
slapi_log_access( LDAP_DEBUG_STATS,
- "conn=%d op=%d BIND dn=\"%s\" "
+ "conn=%" PRIu64 " op=%d BIND dn=\"%s\" "
"method=%d version=%d\n",
pb->pb_conn->c_connid, pb->pb_op->o_opid, edn,
method, version );
diff --git a/ldap/servers/slapd/compare.c b/ldap/servers/slapd/compare.c
index 7f899341..90f6afc8 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=%d op=%d CMP dn=\"%s\" attr=\"%s\"\n",
+ "conn=%" PRIu64 " op=%d CMP dn=\"%s\" attr=\"%s\"\n",
pb->pb_conn->c_connid, pb->pb_op->o_opid,
escape_string( dn, ebuf ), ava.ava_type );
diff --git a/ldap/servers/slapd/connection.c b/ldap/servers/slapd/connection.c
index 58495436..6584eb86 100644
--- a/ldap/servers/slapd/connection.c
+++ b/ldap/servers/slapd/connection.c
@@ -147,14 +147,14 @@ connection_cleanup(Connection *conn)
if (conn->c_prfd && (conn->c_flags & CONN_FLAG_SSL))
{
LDAPDebug( LDAP_DEBUG_CONNS,
- "conn=%d fd=%d closed now\n",
+ "conn=%" PRIu64 " fd=%d closed now\n",
conn->c_connid, conn->c_sd,0);
PR_Close(conn->c_prfd);
}
else if (conn->c_sd)
{
LDAPDebug( LDAP_DEBUG_CONNS,
- "conn=%d fd=%d closed now\n",
+ "conn=%" PRIu64 " fd=%d closed now\n",
conn->c_connid, conn->c_sd,0);
closesocket(conn->c_sd);
}
@@ -217,9 +217,7 @@ connection_reset(Connection* conn, int ns, PRNetAddr * from, int fromLen, int is
LDAPDebug( LDAP_DEBUG_CONNS, "new %sconnection on %d\n", pTmp, conn->c_sd, 0 );
/* bump our count of connections and update SNMP stats */
- PR_Lock( num_conns_mutex );
- conn->c_connid = num_conns++;
- PR_Unlock( num_conns_mutex );
+ conn->c_connid = slapi_counter_increment(num_conns);
if (! in_referral_mode) {
snmp_increment_counter(g_get_global_snmp_vars()->ops_tbl.dsConnectionSeq);
@@ -354,7 +352,7 @@ connection_reset(Connection* conn, int ns, PRNetAddr * from, int fromLen, int is
/* log useful stuff to our access log */
slapi_log_access( LDAP_DEBUG_STATS,
- "conn=%d fd=%d slot=%d %sconnection from %s to %s\n",
+ "conn=%" PRIu64 " fd=%d slot=%d %sconnection from %s to %s\n",
conn->c_connid, conn->c_sd, ns, pTmp, str_ip, str_destip );
/* initialize the remaining connection fields */
@@ -454,7 +452,7 @@ connection_need_new_password(const Connection *conn, const Operation *op, Slapi_
op->o_tag != LDAP_REQ_ABANDON )
{
slapi_add_pwd_control ( pb, LDAP_CONTROL_PWEXPIRED, 0);
- slapi_log_access( LDAP_DEBUG_STATS, "conn=%d op=%d %s\n",
+ slapi_log_access( LDAP_DEBUG_STATS, "conn=%" PRIu64 " op=%d %s\n",
pb->pb_conn->c_connid, pb->pb_op->o_opid,
"need new password" );
send_ldap_result( pb, LDAP_UNWILLING_TO_PERFORM,
@@ -524,7 +522,7 @@ connection_dispatch_operation(Connection *conn, Operation *op, Slapi_PBlock *pb)
{
ret = setsockopt(conn->c_sd,IPPROTO_TCP,TCP_CORK,&i,sizeof(i));
if (ret < 0) {
- LDAPDebug(LDAP_DEBUG_ANY, "Failed to set TCP_CORK on connection %d\n",conn->c_connid, 0, 0);
+ LDAPDebug(LDAP_DEBUG_ANY, "Failed to set TCP_CORK on connection %" PRIu64 "\n",conn->c_connid, 0, 0);
}
}
#endif
@@ -538,7 +536,7 @@ connection_dispatch_operation(Connection *conn, Operation *op, Slapi_PBlock *pb)
{
ret = setsockopt(conn->c_sd,IPPROTO_TCP,TCP_CORK,&i,sizeof(i));
if (ret < 0) {
- LDAPDebug(LDAP_DEBUG_ANY, "Failed to clear TCP_CORK on connection %d\n",conn->c_connid, 0, 0);
+ LDAPDebug(LDAP_DEBUG_ANY, "Failed to clear TCP_CORK on connection %" PRIu64 "\n",conn->c_connid, 0, 0);
}
}
}
@@ -564,7 +562,7 @@ connection_dispatch_operation(Connection *conn, Operation *op, Slapi_PBlock *pb)
default:
LDAPDebug( LDAP_DEBUG_ANY,
- "ignoring unknown LDAP request (conn=%d, tag=0x%lx)\n",
+ "ignoring unknown LDAP request (conn=%" PRIu64 ", tag=0x%lx)\n",
conn->c_connid, op->o_tag, 0 );
break;
}
@@ -576,7 +574,7 @@ int connection_release_nolock (Connection *conn)
if (conn->c_refcnt <= 0)
{
slapi_log_error(SLAPI_LOG_FATAL, "connection",
- "conn=%d fd=%d Attempt to release connection that is not aquired\n",
+ "conn=%" PRIu64 " fd=%d Attempt to release connection that is not aquired\n",
conn->c_connid, conn->c_sd);
PR_ASSERT (PR_FALSE);
return -1;
@@ -597,7 +595,7 @@ int connection_acquire_nolock (Connection *conn)
{
/* This may happen while other threads are still working on this connection */
slapi_log_error(SLAPI_LOG_FATAL, "connection",
- "conn=%d fd=%d Attempt to acquire connection in the closing state\n",
+ "conn=%" PRIu64 " fd=%d Attempt to acquire connection in the closing state\n",
conn->c_connid, conn->c_sd);
return -1;
}
@@ -775,7 +773,7 @@ static int handle_read_data(Connection *conn,Operation **op,
/* if connection is closing */
if (return_value != 0) {
LDAPDebug(LDAP_DEBUG_CONNS,
- "handle_read_data returns as conn %d closing, fd=%d\n",
+ "handle_read_data returns as conn %" PRIu64 " closing, fd=%d\n",
conn->c_connid,conn->c_sd,0);
return return_value;
}
@@ -838,7 +836,7 @@ static int process_operation(Connection *conn, Operation *op)
!= LDAP_TAG_MSGID ) {
/* log, close and send error */
LDAPDebug( LDAP_DEBUG_ANY,
- "conn=%d unable to read tag for incoming request\n", conn->c_connid, 0, 0 );
+ "conn=%" PRIu64 " unable to read tag for incoming request\n", conn->c_connid, 0, 0 );
return_value = -1;
goto done;
}
@@ -850,7 +848,7 @@ static int process_operation(Connection *conn, Operation *op)
case LDAP_TAG_LDAPDN: /* optional username, for CLDAP */
/* log, close and send error */
LDAPDebug( LDAP_DEBUG_ANY,
- "conn=%d ber_peek_tag returns 0x%lx\n", conn->c_connid, tag, 0 );
+ "conn=%" PRIu64 " ber_peek_tag returns 0x%lx\n", conn->c_connid, tag, 0 );
return_value = -1;
goto done;
default:
@@ -981,7 +979,7 @@ static int connection_operation_new(Connection *conn, Operation **ppOp)
PR_Lock( conn->c_mutex );
if (connection_is_active_nolock(conn) == 0) {
LDAPDebug(LDAP_DEBUG_CONNS,
- "not creating a new operation when conn %d closing\n",
+ "not creating a new operation when conn %" PRIu64 " closing\n",
conn->c_connid,0,0);
PR_Unlock( conn->c_mutex );
return -1;
@@ -1073,7 +1071,7 @@ static int read_the_data(Connection *conn, int *process_op, int *defer_io, int *
So, we toss it away ! */
if (LBER_OVERFLOW == tag) {
slapi_log_error( SLAPI_LOG_FATAL, "connection",
- "conn=%d fd=%d The length of BER Element was too long.\n",
+ "conn=%" PRIu64 " fd=%d The length of BER Element was too long.\n",
conn->c_connid, conn->c_sd );
}
PR_Lock( conn->c_mutex );
@@ -1110,7 +1108,7 @@ static int read_the_data(Connection *conn, int *process_op, int *defer_io, int *
* We received a non-LDAP message. Log and close connection.
*/
LDAPDebug( LDAP_DEBUG_ANY,
- "conn=%d received a non-LDAP message"
+ "conn=%" PRIu64 " received a non-LDAP message"
" (tag 0x%lx, expected 0x%lx)\n",
conn->c_connid, tag, LDAP_TAG_MESSAGE );
PR_Lock( conn->c_mutex );
@@ -1128,7 +1126,7 @@ static int read_the_data(Connection *conn, int *process_op, int *defer_io, int *
if (Bytes_Scanned != Bytes_Read) {
if (connection_increment_reference(conn) == -1) {
LDAPDebug(LDAP_DEBUG_CONNS,
- "could not acquire lock in issue_new_read as conn %d closing fd=%d\n",
+ "could not acquire lock in issue_new_read as conn %" PRIu64 " closing fd=%d\n",
conn->c_connid,conn->c_sd,0);
/* XXX how to handle this error? */
/* MAB: 25 Jan 01: let's try like this and pray this won't leak... */
@@ -1150,7 +1148,7 @@ static int read_the_data(Connection *conn, int *process_op, int *defer_io, int *
*/
connection_decrement_reference(conn);
LDAPDebug(LDAP_DEBUG_CONNS,
- "push_back_data failed: closing conn %d fd=%d\n",
+ "push_back_data failed: closing conn %" PRIu64 " fd=%d\n",
conn->c_connid,conn->c_sd,0);
}
} else {
@@ -1248,7 +1246,7 @@ int issue_new_read(Connection *conn)
if (connection_increment_reference(conn) == -1) {
LDAPDebug(LDAP_DEBUG_CONNS,
- "could not acquire lock in issue_new_read as conn %d closing fd=%d\n",
+ "could not acquire lock in issue_new_read as conn %" PRIu64 " closing fd=%d\n",
conn->c_connid,conn->c_sd,0);
/* This means that the connection is closing */
return -1;
@@ -1410,7 +1408,7 @@ int connection_activity(Connection *conn)
be decremented in wait_for_new_work(). */
if (connection_acquire_nolock (conn) == -1) {
LDAPDebug(LDAP_DEBUG_CONNS,
- "could not acquire lock in connection_activity as conn %d closing fd=%d\n",
+ "could not acquire lock in connection_activity as conn %" PRIu64 " closing fd=%d\n",
conn->c_connid,conn->c_sd,0);
/* XXX how to handle this error? */
/* MAB: 25 Jan 01: let's return on error and pray this won't leak */
@@ -1646,7 +1644,7 @@ get_next_from_buffer( void *buffer, size_t buffer_size, ber_len_t *lenp,
syserr = errno;
/* Bad stuff happened, like the client sent us some junk */
LDAPDebug( LDAP_DEBUG_CONNS,
- "ber_get_next failed for connection %d\n", conn->c_connid, 0, 0 );
+ "ber_get_next failed for connection %" PRIu64 "\n", conn->c_connid, 0, 0 );
/* reset private buffer */
conn->c_private->c_buffer_bytes = conn->c_private->c_buffer_offset = 0;
@@ -1715,7 +1713,7 @@ int connection_read_operation(Connection *conn, Operation *op, ber_tag_t *tag, i
ret = sasl_io_setup(conn);
if (ret) {
LDAPDebug( LDAP_DEBUG_ANY,
- "conn=%d unable to enable SASL I/O\n", conn->c_connid, 0, 0 );
+ "conn=%" PRIu64 " unable to enable SASL I/O\n", conn->c_connid, 0, 0 );
disconnect_server( conn, conn->c_connid, -1, SLAPD_DISCONNECT_BAD_BER_TAG, EPROTO );
return CONN_DONE;
}
@@ -1776,7 +1774,7 @@ int connection_read_operation(Connection *conn, Operation *op, ber_tag_t *tag, i
} else {
/* Otherwise we loop, unless we exceeded the ioblock timeout */
if (waits_done > ioblocktimeout_waits) {
- LDAPDebug( LDAP_DEBUG_CONNS,"ioblock timeout expired on connection %d\n", conn->c_connid, 0, 0 );
+ LDAPDebug( LDAP_DEBUG_CONNS,"ioblock timeout expired on connection %" PRIu64 "\n", conn->c_connid, 0, 0 );
disconnect_server( conn, conn->c_connid, -1,
SLAPD_DISCONNECT_IO_TIMEOUT, 0 );
return CONN_DONE;
@@ -1796,7 +1794,7 @@ int connection_read_operation(Connection *conn, Operation *op, ber_tag_t *tag, i
err = PR_GetError();
syserr = PR_GetOSError();
LDAPDebug( LDAP_DEBUG_ANY,
- "PR_Poll for connection %d returns %d (%s)\n", conn->c_connid, err, slapd_pr_strerror( err ) );
+ "PR_Poll for connection %" PRIu64 " returns %d (%s)\n", conn->c_connid, err, slapd_pr_strerror( err ) );
/* If this happens we should close the connection */
disconnect_server( conn, conn->c_connid, -1, err, syserr );
return CONN_DONE;
@@ -1805,7 +1803,7 @@ int connection_read_operation(Connection *conn, Operation *op, ber_tag_t *tag, i
/* Some other error, typically meaning bad stuff */
syserr = PR_GetOSError();
LDAPDebug( LDAP_DEBUG_CONNS,
- "PR_Recv for connection %d returns %d (%s)\n", conn->c_connid, err, slapd_pr_strerror( err ) );
+ "PR_Recv for connection %" PRIu64 " returns %d (%s)\n", conn->c_connid, err, slapd_pr_strerror( err ) );
/* If this happens we should close the connection */
disconnect_server( conn, conn->c_connid, -1, err, syserr );
return CONN_DONE;
@@ -1837,7 +1835,7 @@ int connection_read_operation(Connection *conn, Operation *op, ber_tag_t *tag, i
* We received a non-LDAP message. Log and close connection.
*/
LDAPDebug( LDAP_DEBUG_ANY,
- "conn=%d received a non-LDAP message (tag 0x%lx, expected 0x%lx)\n",
+ "conn=%" PRIu64 " received a non-LDAP message (tag 0x%lx, expected 0x%lx)\n",
conn->c_connid, *tag, LDAP_TAG_MESSAGE );
disconnect_server( conn, conn->c_connid, -1,
SLAPD_DISCONNECT_BAD_BER_TAG, EPROTO );
@@ -1848,7 +1846,7 @@ int connection_read_operation(Connection *conn, Operation *op, ber_tag_t *tag, i
!= LDAP_TAG_MSGID ) {
/* log, close and send error */
LDAPDebug( LDAP_DEBUG_ANY,
- "conn=%d unable to read tag for incoming request\n", conn->c_connid, 0, 0 );
+ "conn=%" PRIu64 " unable to read tag for incoming request\n", conn->c_connid, 0, 0 );
disconnect_server( conn, conn->c_connid, -1, SLAPD_DISCONNECT_BAD_BER_TAG, EPROTO );
return CONN_DONE;
}
@@ -1865,7 +1863,7 @@ int connection_read_operation(Connection *conn, Operation *op, ber_tag_t *tag, i
case LDAP_TAG_LDAPDN: /* optional username, for CLDAP */
/* log, close and send error */
LDAPDebug( LDAP_DEBUG_ANY,
- "conn=%d ber_peek_tag returns 0x%lx\n", conn->c_connid, *tag, 0 );
+ "conn=%" PRIu64 " ber_peek_tag returns 0x%lx\n", conn->c_connid, *tag, 0 );
disconnect_server( conn, conn->c_connid, -1, SLAPD_DISCONNECT_BER_PEEK, EPROTO );
return CONN_DONE;
default:
@@ -1902,7 +1900,7 @@ void connection_check_activity_level(Connection *conn)
/* update the last checked time */
conn->c_private->previous_count_check_time = current_time();
PR_Unlock( conn->c_mutex );
- LDAPDebug(LDAP_DEBUG_CONNS,"conn %d activity level = %d\n",conn->c_connid,delta_count,0);
+ LDAPDebug(LDAP_DEBUG_CONNS,"conn %" PRIu64 " activity level = %d\n",conn->c_connid,delta_count,0);
}
typedef struct table_iterate_info_struct {
@@ -1957,7 +1955,7 @@ void connection_enter_leave_turbo(Connection *conn, int *new_turbo_flag)
} else {
double activet = 0.0;
connection_find_our_rank(conn,&connection_count, &our_rank);
- LDAPDebug(LDAP_DEBUG_CONNS,"conn %d turbo rank = %d out of %d conns\n",conn->c_connid,our_rank,connection_count);
+ LDAPDebug(LDAP_DEBUG_CONNS,"conn %" PRIu64 " turbo rank = %d out of %d conns\n",conn->c_connid,our_rank,connection_count);
activet = (double)g_get_active_threadcnt();
threshold_rank = (int)(activet * ((double)CONN_TURBO_PERCENTILE / 100.0));
@@ -1999,9 +1997,9 @@ void connection_enter_leave_turbo(Connection *conn, int *new_turbo_flag)
PR_Unlock(conn->c_mutex);
if (current_mode != new_mode) {
if (current_mode) {
- LDAPDebug(LDAP_DEBUG_CONNS,"conn %d leaving turbo mode\n",conn->c_connid,0,0);
+ LDAPDebug(LDAP_DEBUG_CONNS,"conn %" PRIu64 " leaving turbo mode\n",conn->c_connid,0,0);
} else {
- LDAPDebug(LDAP_DEBUG_CONNS,"conn %d entering turbo mode\n",conn->c_connid,0,0);
+ LDAPDebug(LDAP_DEBUG_CONNS,"conn %" PRIu64 " entering turbo mode\n",conn->c_connid,0,0);
}
}
*new_turbo_flag = new_mode;
@@ -2092,7 +2090,7 @@ connection_threadmain()
/* turn off turbo mode immediately if any pb waiting in global queue */
if (thread_turbo_flag && (counter > 0)) {
thread_turbo_flag = 0;
- LDAPDebug(LDAP_DEBUG_CONNS,"conn %d leaving turbo mode\n",conn->c_connid,0,0);
+ LDAPDebug(LDAP_DEBUG_CONNS,"conn %" PRIu64 " leaving turbo mode\n",conn->c_connid,0,0);
}
#endif
@@ -2235,7 +2233,7 @@ connection_activity(Connection *conn)
if (connection_acquire_nolock (conn) == -1) {
LDAPDebug(LDAP_DEBUG_CONNS,
- "could not acquire lock in connection_activity as conn %d closing fd=%d\n",
+ "could not acquire lock in connection_activity as conn %" PRIu64 " closing fd=%d\n",
conn->c_connid,conn->c_sd,0);
/* XXX how to handle this error? */
/* MAB: 25 Jan 01: let's return on error and pray this won't leak */
@@ -2355,9 +2353,9 @@ op_thread_cleanup()
static void
connection_add_operation(Connection* conn,Operation* op)
{
- Operation **olist= &conn->c_ops;
- int id= conn->c_opsinitiated++;
- int connid= conn->c_connid;
+ Operation **olist= &conn->c_ops;
+ int id= conn->c_opsinitiated++;
+ PRUint64 connid = conn->c_connid;
Operation **tmp;
/* slapi_ch_stop_recording(); */
@@ -2387,7 +2385,7 @@ connection_remove_operation( Connection *conn, Operation *op )
if ( *tmp == NULL )
{
- LDAPDebug( LDAP_DEBUG_ANY, "connection_remove_operation: can't find op %d for conn %d\n",
+ LDAPDebug( LDAP_DEBUG_ANY, "connection_remove_operation: can't find op %d for conn %" PRIu64 "\n",
(int)op->o_msgid, conn->c_connid, 0 );
}
else
@@ -2498,13 +2496,13 @@ log_ber_too_big_error(const Connection *conn, ber_len_t ber_len,
}
if (0 == ber_len) {
slapi_log_error( SLAPI_LOG_FATAL, "connection",
- "conn=%d fd=%d Incoming BER Element was too long, max allowable"
+ "conn=%" PRIu64 " fd=%d Incoming BER Element was too long, max allowable"
" is %u bytes. Change the nsslapd-maxbersize attribute in"
" cn=config to increase.\n",
conn->c_connid, conn->c_sd, maxbersize );
} else {
slapi_log_error( SLAPI_LOG_FATAL, "connection",
- "conn=%d fd=%d Incoming BER Element was %u bytes, max allowable"
+ "conn=%" PRIu64 " fd=%d Incoming BER Element was %u bytes, max allowable"
" is %u bytes. Change the nsslapd-maxbersize attribute in"
" cn=config to increase.\n",
conn->c_connid, conn->c_sd, ber_len, maxbersize );
@@ -2513,7 +2511,7 @@ log_ber_too_big_error(const Connection *conn, ber_len_t ber_len,
void
-disconnect_server( Connection *conn, int opconnid, int opid, PRErrorCode reason, PRInt32 error )
+disconnect_server( Connection *conn, PRUint64 opconnid, int opid, PRErrorCode reason, PRInt32 error )
{
PR_Lock( conn->c_mutex );
disconnect_server_nomutex( conn, opconnid, opid, reason, error );
@@ -2530,7 +2528,7 @@ static ps_wakeup_all_fn_ptr ps_wakeup_all_fn = NULL;
*/
void
-disconnect_server_nomutex( Connection *conn, int opconnid, int opid, PRErrorCode reason, PRInt32 error )
+disconnect_server_nomutex( Connection *conn, PRUint64 opconnid, int opid, PRErrorCode reason, PRInt32 error )
{
if ( ( conn->c_sd != SLAPD_INVALID_SOCKET &&
conn->c_connid == opconnid ) && !(conn->c_flags & CONN_FLAG_CLOSING) ) {
@@ -2557,13 +2555,13 @@ disconnect_server_nomutex( Connection *conn, int opconnid, int opid, PRErrorCode
*/
if (error && (EPIPE != error) ) {
slapi_log_access( LDAP_DEBUG_STATS,
- "conn=%d op=%d fd=%d closed error %d (%s) - %s\n",
+ "conn=%" PRIu64 " op=%d fd=%d closed error %d (%s) - %s\n",
conn->c_connid, opid, conn->c_sd, error,
slapd_system_strerror(error),
slapd_pr_strerror(reason));
} else {
slapi_log_access( LDAP_DEBUG_STATS,
- "conn=%d op=%d fd=%d closed - %s\n",
+ "conn=%" PRIu64 " op=%d fd=%d closed - %s\n",
conn->c_connid, opid, conn->c_sd,
slapd_pr_strerror(reason));
}
diff --git a/ldap/servers/slapd/conntable.c b/ldap/servers/slapd/conntable.c
index 42cb7c6b..08cc0c89 100644
--- a/ldap/servers/slapd/conntable.c
+++ b/ldap/servers/slapd/conntable.c
@@ -449,9 +449,7 @@ connection_table_as_entry(Connection_Table *ct, Slapi_Entry *e)
val.bv_len = strlen( buf );
attrlist_replace( &e->e_attrs, "currentconnections", vals );
- PR_Lock( num_conns_mutex );
- sprintf( buf, "%d", num_conns );
- PR_Unlock( num_conns_mutex );
+ sprintf( buf, "%" PRIu64, slapi_counter_get_value(num_conns));
val.bv_val = buf;
val.bv_len = strlen( buf );
attrlist_replace( &e->e_attrs, "totalconnections", vals );
diff --git a/ldap/servers/slapd/daemon.c b/ldap/servers/slapd/daemon.c
index 7bf89491..cd1f6ecb 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 %d as fd=%d is already closing\n",
+ "connection_activity: abandoning conn %" PRIu64 " as fd=%d is already closing\n",
c->c_connid,c->c_sd,0);
/* The call disconnect_server should do nothing,
* as the connection c should be already set to CLOSING */
@@ -2216,7 +2216,7 @@ bail:
if(conn->c_dn)
{
/* log the auto bind */
- slapi_log_access(LDAP_DEBUG_STATS, "conn=%d AUTOBIND dn=\"%s\"\n", conn->c_connid, conn->c_dn);
+ slapi_log_access(LDAP_DEBUG_STATS, "conn=%" PRIu64 " AUTOBIND dn=\"%s\"\n", conn->c_connid, conn->c_dn);
}
return ret;
diff --git a/ldap/servers/slapd/delete.c b/ldap/servers/slapd/delete.c
index b442df5a..39096d79 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=%d op=%d DEL dn=\"%s\"\n",
+ slapi_log_access(LDAP_DEBUG_STATS, "conn=%" PRIu64 " op=%d DEL dn=\"%s\"\n",
pb->pb_conn->c_connid,
pb->pb_op->o_opid,
escape_string(dn, ebuf));
diff --git a/ldap/servers/slapd/extendop.c b/ldap/servers/slapd/extendop.c
index b95bf405..442ba69e 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=%d op=%d EXT oid=\"%s\"\n",
+ slapi_log_access( LDAP_DEBUG_STATS, "conn=%" PRIu64 " op=%d EXT oid=\"%s\"\n",
pb->pb_conn->c_connid, pb->pb_op->o_opid, extoid );
} else {
LDAPDebug( LDAP_DEBUG_ARGS, "do_extended: oid (%s-%s)\n",
extoid, name, 0 );
slapi_log_access( LDAP_DEBUG_STATS,
- "conn=%d op=%d EXT oid=\"%s\" name=\"%s\"\n",
+ "conn=%" PRIu64 " op=%d EXT oid=\"%s\" name=\"%s\"\n",
pb->pb_conn->c_connid, pb->pb_op->o_opid, extoid, name );
}
diff --git a/ldap/servers/slapd/fe.h b/ldap/servers/slapd/fe.h
index be46c004..b3e62961 100644
--- a/ldap/servers/slapd/fe.h
+++ b/ldap/servers/slapd/fe.h
@@ -61,8 +61,7 @@ extern PRInt32 ops_completed;
extern PRLock *ops_mutex;
extern PRThread *listener_tid;
extern PRThread *listener_tid;
-extern int num_conns;
-extern PRLock *num_conns_mutex;
+extern Slapi_Counter *num_conns;
extern char *pid_file;
extern char *start_pid_file;
extern int should_detach;
diff --git a/ldap/servers/slapd/globals.c b/ldap/servers/slapd/globals.c
index 02f19238..c57a89ca 100644
--- a/ldap/servers/slapd/globals.c
+++ b/ldap/servers/slapd/globals.c
@@ -91,8 +91,8 @@ Slapi_PBlock *repl_pb = NULL;
PRInt32 ops_initiated;
PRInt32 ops_completed;
PRLock *ops_mutex;
-int num_conns;
-PRLock *num_conns_mutex;
+Slapi_Counter *num_conns;
+
/*
DEC/COMPAQ has released a patch for 4.0d (e?) which will speed up
diff --git a/ldap/servers/slapd/init.c b/ldap/servers/slapd/init.c
index bfe51ed4..0fa2e11c 100644
--- a/ldap/servers/slapd/init.c
+++ b/ldap/servers/slapd/init.c
@@ -70,14 +70,17 @@ slapd_init()
}
#endif /* _WIN32 */
+ /* We don't worry about free'ing this stuff
+ * since the only time we want to do that is when
+ * the process is exiting. */
ops_mutex = PR_NewLock();
- num_conns_mutex = PR_NewLock();
+ num_conns = slapi_counter_new();
g_set_num_sent_mutex( PR_NewLock() );
g_set_current_conn_count_mutex( PR_NewLock() );
+
slapd_re_init();
if ( ops_mutex == NULL ||
- num_conns_mutex == NULL ||
g_get_num_sent_mutex() == NULL ||
g_get_current_conn_count_mutex() == NULL )
{
diff --git a/ldap/servers/slapd/modify.c b/ldap/servers/slapd/modify.c
index 14a182b9..9bcce536 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=%d op=%d MOD dn=\"%s\"\n",
+ slapi_log_access(LDAP_DEBUG_STATS, "conn=%" PRIu64 " op=%d MOD dn=\"%s\"\n",
pb->pb_conn->c_connid,
pb->pb_op->o_opid,
escape_string(slapi_sdn_get_dn(&sdn), ebuf));
@@ -956,7 +956,7 @@ static int op_shared_allow_pw_change (Slapi_PBlock *pb, LDAPMod *mod, char **old
if (operation_is_flag_set(operation,OP_FLAG_ACTION_LOG_ACCESS))
{
- slapi_log_access(LDAP_DEBUG_STATS, "conn=%d op=%d MOD dn=\"%s\", %s\n",
+ slapi_log_access(LDAP_DEBUG_STATS, "conn=%" PRIu64 " op=%d MOD dn=\"%s\", %s\n",
pb->pb_conn->c_connid, pb->pb_op->o_opid,
escape_string(slapi_sdn_get_dn(&sdn), ebuf),
"user is not allowed to change password");
@@ -976,7 +976,7 @@ static int op_shared_allow_pw_change (Slapi_PBlock *pb, LDAPMod *mod, char **old
{
if ( !internal_op )
{
- slapi_log_access(LDAP_DEBUG_STATS, "conn=%d op=%d MOD dn=\"%s\", %s\n",
+ slapi_log_access(LDAP_DEBUG_STATS, "conn=%" PRIu64 " op=%d MOD dn=\"%s\", %s\n",
pb->pb_conn->c_connid,
pb->pb_op->o_opid,
escape_string(slapi_sdn_get_dn(&sdn), ebuf),
@@ -1011,7 +1011,7 @@ static int op_shared_allow_pw_change (Slapi_PBlock *pb, LDAPMod *mod, char **old
{
if ( !internal_op )
{
- slapi_log_access(LDAP_DEBUG_STATS, "conn=%d op=%d MOD dn=\"%s\", %s\n",
+ slapi_log_access(LDAP_DEBUG_STATS, "conn=%" PRIu64 " op=%d MOD dn=\"%s\", %s\n",
pb->pb_conn->c_connid,
pb->pb_op->o_opid,
escape_string(slapi_sdn_get_dn(&sdn), ebuf), "invalid password syntax");
diff --git a/ldap/servers/slapd/modrdn.c b/ldap/servers/slapd/modrdn.c
index dfc7edf9..2872ab1d 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=%d op=%d MODRDN dn=\"%s\" newrdn=\"%s\" newsuperior=\"%s\"\n",
+ "conn=%" PRIu64 " op=%d MODRDN dn=\"%s\" newrdn=\"%s\" newsuperior=\"%s\"\n",
pb->pb_conn->c_connid,
pb->pb_op->o_opid,
escape_string(dn, dnbuf),
@@ -374,7 +374,7 @@ op_shared_rename(Slapi_PBlock *pb, int passin_args)
if ((rdns = ldap_explode_rdn(newrdn, 0)) == NULL)
{
slapi_log_error(SLAPI_LOG_FATAL, NULL,
- "conn=%d op=%d MODRDN invalid new RDN (\"%s\")\n",
+ "conn=%" PRIu64 " op=%d MODRDN invalid new RDN (\"%s\")\n",
pb->pb_conn->c_connid,
pb->pb_op->o_opid,
(NULL == newrdn) ? "(null)" : newrdn);
@@ -391,7 +391,7 @@ op_shared_rename(Slapi_PBlock *pb, int passin_args)
{
LDAPDebug(LDAP_DEBUG_ARGS, "ldap_explode_dn of newSuperior failed\n", 0, 0, 0);
slapi_log_error(SLAPI_LOG_FATAL, NULL,
- "conn=%d op=%d MODRDN invalid new superior (\"%s\")",
+ "conn=%" PRIu64 " op=%d MODRDN invalid new superior (\"%s\")",
pb->pb_conn->c_connid,
pb->pb_op->o_opid,
(NULL == newsuperior) ? "(null)" : newsuperiorbuf);
diff --git a/ldap/servers/slapd/opshared.c b/ldap/servers/slapd/opshared.c
index 6c81b5c2..70c02222 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=%d op=%d SRCH base=\"%s\" scope=%d "
+#define SLAPD_SEARCH_FMTSTR_BASE "conn=%" PRIu64 " op=%d SRCH base=\"%s\" scope=%d "
#define SLAPD_SEARCH_FMTSTR_BASE_INT "conn=%s op=%d SRCH base=\"%s\" scope=%d "
#define SLAPD_SEARCH_FMTSTR_REMAINDER " attrs=%s%s\n"
@@ -1329,7 +1329,7 @@ static int send_results (Slapi_PBlock *pb, int send_result, int * nentries)
void op_shared_log_error_access (Slapi_PBlock *pb, const char *type, const char *dn, const char *msg)
{
char ebuf[BUFSIZ];
- slapi_log_access( LDAP_DEBUG_STATS, "conn=%d op=%d %s dn=\"%s\", %s\n",
+ slapi_log_access( LDAP_DEBUG_STATS, "conn=%" PRIu64 " op=%d %s dn=\"%s\", %s\n",
( pb->pb_conn ? pb->pb_conn->c_connid : 0),
( pb->pb_op ? pb->pb_op->o_opid : 0),
type,
diff --git a/ldap/servers/slapd/pblock.c b/ldap/servers/slapd/pblock.c
index 42bf77e0..6ac6aa8e 100644
--- a/ldap/servers/slapd/pblock.c
+++ b/ldap/servers/slapd/pblock.c
@@ -188,7 +188,7 @@ slapi_pblock_get( Slapi_PBlock *pblock, int arg, void *value )
"Connection is NULL and hence cannot access SLAPI_CONN_ID \n", 0, 0, 0 );
return (-1);
}
- (*(int *)value) = pblock->pb_conn->c_connid;
+ (*(PRUint64 *)value) = pblock->pb_conn->c_connid;
break;
case SLAPI_CONN_DN:
/*
@@ -1665,7 +1665,7 @@ slapi_pblock_set( Slapi_PBlock *pblock, int arg, void *value )
"Connection is NULL and hence cannot access SLAPI_CONN_ID \n", 0, 0, 0 );
return (-1);
}
- pblock->pb_conn->c_connid = *((int *) value);
+ pblock->pb_conn->c_connid = *((PRUint64 *) value);
break;
case SLAPI_CONN_DN:
/*
diff --git a/ldap/servers/slapd/plugin_internal_op.c b/ldap/servers/slapd/plugin_internal_op.c
index f3e001dd..4b36ede4 100644
--- a/ldap/servers/slapd/plugin_internal_op.c
+++ b/ldap/servers/slapd/plugin_internal_op.c
@@ -188,7 +188,7 @@ slapi_disconnect_server(Slapi_Connection *conn)
static get_disconnect_server_fn_ptr disconnect_server_fn = NULL;
void
-do_disconnect_server(Connection *conn, int opconnid, int opid)
+do_disconnect_server(Connection *conn, PRUint64 opconnid, int opid)
{
if (NULL == disconnect_server_fn) {
if (get_entry_point(ENTRY_POINT_DISCONNECT_SERVER, (caddr_t *)(&disconnect_server_fn)) < 0) {
diff --git a/ldap/servers/slapd/proto-slap.h b/ldap/servers/slapd/proto-slap.h
index 881667e6..528ebadd 100644
--- a/ldap/servers/slapd/proto-slap.h
+++ b/ldap/servers/slapd/proto-slap.h
@@ -825,7 +825,7 @@ void g_set_num_sent_mutex( PRLock *plock );
void g_set_default_referral( struct berval **ldap_url );
struct berval **g_get_default_referral();
PRLock *g_get_num_sent_mutex();
-void disconnect_server( Connection *conn, int opconnid, int opid, PRErrorCode reason, PRInt32 error );
+void disconnect_server( Connection *conn, PRUint64 opconnid, int opid, PRErrorCode reason, PRInt32 error );
int send_ldap_search_entry( Slapi_PBlock *pb, Slapi_Entry *e, LDAPControl **ectrls,
char **attrs, int attrsonly );
void send_ldap_result( Slapi_PBlock *pb, int err, char *matched, char *text,
@@ -839,7 +839,7 @@ int send_ldap_referral( Slapi_PBlock *pb, Slapi_Entry *e, struct berval **refs,
struct berval ***urls );
int send_ldapv3_referral( Slapi_PBlock *pb, struct berval **urls );
int set_db_default_result_handlers(Slapi_PBlock *pb);
-void disconnect_server_nomutex( Connection *conn, int opconnid, int opid, PRErrorCode reason, PRInt32 error );
+void disconnect_server_nomutex( Connection *conn, PRUint64 opconnid, int opid, PRErrorCode reason, PRInt32 error );
long g_get_current_conn_count();
void g_increment_current_conn_count();
void g_decrement_current_conn_count();
@@ -1075,7 +1075,7 @@ Slapi_Backend *defbackend_get_backend( void );
/*
* plugin_internal_op.c
*/
-void do_disconnect_server( Connection *conn, int opconnid, int opid );
+void do_disconnect_server( Connection *conn, PRUint64 opconnid, int opid );
/*
* regex.c
diff --git a/ldap/servers/slapd/psearch.c b/ldap/servers/slapd/psearch.c
index cc5b1265..f667900f 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=%d op=%d Could not acquire the connection - psearch aborted\n",
+ "conn=%" PRIu64 " op=%d Could not acquire the connection - psearch aborted\n",
ps->ps_pblock->pb_conn->c_connid, ps->ps_pblock->pb_op->o_opid);
}
@@ -315,7 +315,7 @@ ps_send_results( void *arg )
/* Check for an abandoned operation */
if ( ps->ps_pblock->pb_op == NULL || slapi_op_abandoned( ps->ps_pblock ) ) {
slapi_log_error(SLAPI_LOG_CONNS, "Persistent Search",
- "conn=%d op=%d The operation has been abandoned\n",
+ "conn=%" PRIu64 " op=%d The operation has been abandoned\n",
ps->ps_pblock->pb_conn->c_connid, ps->ps_pblock->pb_op->o_opid);
break;
}
@@ -373,7 +373,7 @@ ps_send_results( void *arg )
ectrls, attrs, attrsonly );
if (rc) {
slapi_log_error(SLAPI_LOG_CONNS, "Persistent Search",
- "conn=%d op=%d Error %d sending entry %s with op status %d\n",
+ "conn=%" PRIu64 " op=%d Error %d sending entry %s with op status %d\n",
ps->ps_pblock->pb_conn->c_connid, ps->ps_pblock->pb_op->o_opid,
rc, slapi_entry_get_dn_const(ec), ps->ps_pblock->pb_op->o_status);
}
@@ -421,7 +421,7 @@ ps_send_results( void *arg )
PR_Lock( ps->ps_pblock->pb_conn->c_mutex );
slapi_log_error(SLAPI_LOG_CONNS, "Persistent Search",
- "conn=%d op=%d Releasing the connection and operation\n",
+ "conn=%" PRIu64 " op=%d Releasing the connection and operation\n",
ps->ps_pblock->pb_conn->c_connid, ps->ps_pblock->pb_op->o_opid);
/* Delete this op from the connection's list */
connection_remove_operation( ps->ps_pblock->pb_conn, ps->ps_pblock->pb_op );
@@ -557,7 +557,7 @@ ps_service_persistent_searches( Slapi_Entry *e, Slapi_Entry *eprev, ber_int_t ch
}
slapi_log_error(SLAPI_LOG_CONNS, "Persistent Search",
- "conn=%d op=%d entry %s with chgtype %d "
+ "conn=%" PRIu64 " op=%d entry %s with chgtype %d "
"matches the ps changetype %d\n",
ps->ps_pblock->pb_conn->c_connid, ps->ps_pblock->pb_op->o_opid,
edn, chgtype, ps->ps_changetypes);
diff --git a/ldap/servers/slapd/result.c b/ldap/servers/slapd/result.c
index 49331dce..f9213352 100644
--- a/ldap/servers/slapd/result.c
+++ b/ldap/servers/slapd/result.c
@@ -1689,7 +1689,7 @@ log_result( Slapi_PBlock *pb, Operation *op, int err, ber_tag_t tag,
if ( !internal_op )
{
slapi_log_access( LDAP_DEBUG_STATS,
- "conn=%d op=%d RESULT err=%d"
+ "conn=%" PRIu64 " op=%d RESULT err=%d"
" tag=%u nentries=%d etime=%s%s%s"
", SASL bind in progress\n",
op->o_connid,
@@ -1721,7 +1721,7 @@ log_result( Slapi_PBlock *pb, Operation *op, int err, ber_tag_t tag,
if ( !internal_op )
{
slapi_log_access( LDAP_DEBUG_STATS,
- "conn=%d op=%d RESULT err=%d"
+ "conn=%" PRIu64 " op=%d RESULT err=%d"
" tag=%u nentries=%d etime=%s%s%s"
" dn=\"%s\"\n",
op->o_connid,
@@ -1747,7 +1747,7 @@ log_result( Slapi_PBlock *pb, Operation *op, int err, ber_tag_t tag,
if ( !internal_op )
{
slapi_log_access( LDAP_DEBUG_STATS,
- "conn=%d op=%d RESULT err=%d"
+ "conn=%" PRIu64 " op=%d RESULT err=%d"
" tag=%u nentries=%d etime=%s%s%s\n",
op->o_connid,
op->o_opid,
@@ -1780,7 +1780,7 @@ log_entry( Operation *op, Slapi_Entry *e )
if ( !internal_op )
{
- slapi_log_access( LDAP_DEBUG_STATS2, "conn=%d op=%d ENTRY dn=\"%s\"\n",
+ slapi_log_access( LDAP_DEBUG_STATS2, "conn=%" PRIu64 " op=%d ENTRY dn=\"%s\"\n",
op->o_connid, op->o_opid,
escape_string( slapi_entry_get_dn_const(e), ebuf ));
}
@@ -1805,7 +1805,7 @@ log_referral( Operation *op )
if ( !internal_op )
{
- slapi_log_access( LDAP_DEBUG_STATS2, "conn=%d op=%d REFERRAL\n",
+ slapi_log_access( LDAP_DEBUG_STATS2, "conn=%" PRIu64 " op=%d REFERRAL\n",
op->o_connid, op->o_opid );
}
else
diff --git a/ldap/servers/slapd/sasl_io.c b/ldap/servers/slapd/sasl_io.c
index 26eac8bf..7a63fcb4 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 %d\n", c->c_connid, 0, 0 );
+ "sasl_io_enable for connection %" PRIu64 "\n", c->c_connid, 0, 0 );
/* Flag that we should enable SASL I/O for the next read operation on this connection */
c->c_enable_sasl_io = 1;
@@ -108,7 +108,7 @@ sasl_io_setup(Connection *c)
sasl_io_private *sp = (sasl_io_private*) slapi_ch_calloc(1, sizeof(sasl_io_private));
LDAPDebug( LDAP_DEBUG_CONNS,
- "sasl_io_setup for connection %d\n", c->c_connid, 0, 0 );
+ "sasl_io_setup for connection %" PRIu64 "\n", c->c_connid, 0, 0 );
/* Get the current functions and store them for later */
real_iofns->lbextiofn_size = LBER_X_EXTIO_FNS_SIZE;
ber_sockbuf_get_option( c->c_sb, LBER_SOCKBUF_OPT_EXT_IO_FNS, real_iofns );
@@ -142,7 +142,7 @@ sasl_io_cleanup(Connection *c)
sasl_io_private *sp = c->c_sasl_io_private;
if (sp) {
LDAPDebug( LDAP_DEBUG_CONNS,
- "sasl_io_cleanup for connection %d\n", c->c_connid, 0, 0 );
+ "sasl_io_cleanup for connection %" PRIu64 "\n", c->c_connid, 0, 0 );
/* Free the buffers */
slapi_ch_free((void**)&(sp->encrypted_buffer));
slapi_ch_free((void**)&(sp->decrypted_buffer));
@@ -203,7 +203,7 @@ sasl_io_start_packet(Connection *c, PRInt32 *err)
}
if (ret != 0 && ret < sizeof(buffer)) {
LDAPDebug( LDAP_DEBUG_ANY,
- "failed to read sasl packet length on connection %d\n", c->c_connid, 0, 0 );
+ "failed to read sasl packet length on connection %" PRIu64 "\n", c->c_connid, 0, 0 );
return -1;
}
@@ -214,7 +214,7 @@ sasl_io_start_packet(Connection *c, PRInt32 *err)
packet_length += 4;
LDAPDebug( LDAP_DEBUG_CONNS,
- "read sasl packet length %ld on connection %d\n", packet_length, c->c_connid, 0 );
+ "read sasl packet length %ld on connection %" PRIu64 "\n", packet_length, c->c_connid, 0 );
sasl_io_resize_encrypted_buffer(c->c_sasl_io_private, packet_length);
/* Cyrus SASL implementation expects to have the length at the first
4 bytes */
@@ -257,7 +257,7 @@ sasl_recv_connection(Connection *c, char *buffer, size_t count,PRInt32 *err)
*err = 0;
LDAPDebug( LDAP_DEBUG_CONNS,
- "sasl_recv_connection for connection %d\n", c->c_connid, 0, 0 );
+ "sasl_recv_connection for connection %" PRIu64 "\n", c->c_connid, 0, 0 );
/* Do we have decrypted data buffered from 'before' ? */
bytes_in_buffer = sp->decrypted_buffer_count - sp->decrypted_buffer_offset;
if (0 == bytes_in_buffer) {
@@ -284,12 +284,12 @@ sasl_recv_connection(Connection *c, char *buffer, size_t count,PRInt32 *err)
const char *output_buffer = NULL;
unsigned int output_length = 0;
LDAPDebug( LDAP_DEBUG_CONNS,
- "sasl_recv_connection finished reading packet for connection %d\n", c->c_connid, 0, 0 );
+ "sasl_recv_connection finished reading packet for connection %" PRIu64 "\n", c->c_connid, 0, 0 );
/* Now decode it */
ret = sasl_decode(c->c_sasl_conn,sp->encrypted_buffer,sp->encrypted_buffer_count,&output_buffer,&output_length);
if (SASL_OK == ret) {
LDAPDebug( LDAP_DEBUG_CONNS,
- "sasl_recv_connection decoded packet length %d for connection %d\n", output_length, c->c_connid, 0 );
+ "sasl_recv_connection decoded packet length %d for connection %" PRIu64 "\n", output_length, c->c_connid, 0 );
if (output_length) {
sasl_io_resize_decrypted_buffer(sp,output_length);
memcpy(sp->decrypted_buffer,output_buffer,output_length);
@@ -300,7 +300,7 @@ sasl_recv_connection(Connection *c, char *buffer, size_t count,PRInt32 *err)
}
} else {
LDAPDebug( LDAP_DEBUG_ANY,
- "sasl_recv_connection failed to decode packet for connection %d\n", c->c_connid, 0, 0 );
+ "sasl_recv_connection failed to decode packet for connection %" PRIu64 "\n", c->c_connid, 0, 0 );
}
}
}
diff --git a/ldap/servers/slapd/search.c b/ldap/servers/slapd/search.c
index c3d1c80d..6ffe08e4 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=%d op=%d SRCH base=\"%s\" scope=%d filter=\"%s\", %s\n",
+ "conn=%" PRIu64 " op=%d SRCH base=\"%s\" scope=%d filter=\"%s\", %s\n",
pb->pb_conn->c_connid, pb->pb_op->o_opid,
escape_string(base, ebuf), scope, fstr, msg ? msg : "");
diff --git a/ldap/servers/slapd/slap.h b/ldap/servers/slapd/slap.h
index abccf3ad..e850bef4 100644
--- a/ldap/servers/slapd/slap.h
+++ b/ldap/servers/slapd/slap.h
@@ -97,6 +97,7 @@ void *dlsym(void *a, char *b);
#include <errno.h>
#if defined(SOLARIS)
#include <limits.h> /* for LONG_MAX */
+
#endif
/* there's a bug in the dbm code we import (from where?) -- FIXME */
@@ -116,6 +117,22 @@ void *dlsym(void *a, char *b);
#define LDAP_IOCP
#endif
+/* Required to get portable printf/scanf format macros */
+#ifdef HAVE_INTTYPES_H
+#include <inttypes.h>
+
+/* NSPR uses the print macros a bit differently than ANSI C. We
+ * need to use ll for a 64-bit integer, even when a long is 64-bit.
+ */
+#undef PRIu64
+#define PRIu64 "llu"
+#undef PRI64
+#define PRI64 "ll"
+
+#else
+#error Need to define portable format macros such as PRIu64
+#endif /* HAVE_INTTYPES_H */
+
#define LOG_INTERNAL_OP_CON_ID "Internal"
#define LOG_INTERNAL_OP_OP_ID -1
@@ -1164,7 +1181,7 @@ typedef struct op {
Slapi_DN o_sdn; /* dn bound when op was initiated */
char *o_authtype; /* auth method used to bind dn */
int o_opid; /* id of this operation */
- int o_connid; /* id of conn initiating this op; for logging only */
+ PRUint64 o_connid; /* id of conn initiating this op; for logging only */
void *o_handler_data;
result_handler o_result_handler;
search_entry_handler o_search_entry_handler;
@@ -1223,7 +1240,7 @@ typedef struct conn {
int c_gettingber; /* in the middle of ber_get_next */
BerElement *c_currentber; /* ber we're getting */
time_t c_starttime; /* when the connection was opened */
- int c_connid; /* id of this connection for stats*/
+ PRUint64 c_connid; /* id of this connection for stats*/
int c_opsinitiated; /* # ops initiated/next op id */
PRInt32 c_opscompleted; /* # ops completed */
PRInt32 c_threadnumber; /* # threads used in this conn */
@@ -1582,7 +1599,7 @@ struct snmp_vars_t{
typedef void (*ps_wakeup_all_fn_ptr)( void );
typedef void (*ps_service_fn_ptr)(Slapi_Entry *, Slapi_Entry *, int, int );
typedef char *(*get_config_dn_fn_ptr)();
-typedef void (*get_disconnect_server_fn_ptr)(Connection *conn, int opconnid, int opid, PRErrorCode reason, PRInt32 error );
+typedef void (*get_disconnect_server_fn_ptr)(Connection *conn, PRUint64 opconnid, int opid, PRErrorCode reason, PRInt32 error );
typedef int (*slapd_SSL_client_init_fn_ptr)( void );
typedef int (*modify_config_dse_fn_ptr)( Slapi_PBlock *pb );
typedef int (*slapd_ssl_init_fn_ptr)( void );
diff --git a/ldap/servers/slapd/slapi-plugin.h b/ldap/servers/slapd/slapi-plugin.h
index 8cfc51c0..43e783db 100644
--- a/ldap/servers/slapd/slapi-plugin.h
+++ b/ldap/servers/slapd/slapi-plugin.h
@@ -152,6 +152,7 @@ typedef struct slapi_rdn Slapi_RDN;
typedef struct slapi_mod Slapi_Mod;
typedef struct slapi_mods Slapi_Mods;
typedef struct slapi_componentid Slapi_ComponentId;
+typedef struct slapi_counter Slapi_Counter;
/* Online tasks interface (to support import, export, etc) */
#define SLAPI_TASK_PUBLIC 1 /* tell old plugins that the task api is now public */
@@ -1340,6 +1341,17 @@ Slapi_Task *slapi_new_task(const char *dn);
void slapi_destroy_task(void *arg);
/* End of interface to support online tasks **********************************/
+/* Slapi_Counter Interface */
+Slapi_Counter *slapi_counter_new();
+void slapi_counter_init(Slapi_Counter *counter);
+void slapi_counter_destroy(Slapi_Counter **counter);
+PRUint64 slapi_counter_increment(Slapi_Counter *counter);
+PRUint64 slapi_counter_decrement(Slapi_Counter *counter);
+PRUint64 slapi_counter_add(Slapi_Counter *counter, PRUint64 addvalue);
+PRUint64 slapi_counter_subtract(Slapi_Counter *counter, PRUint64 subvalue);
+PRUint64 slapi_counter_set_value(Slapi_Counter *counter, PRUint64 newvalue);
+PRUint64 slapi_counter_get_value(Slapi_Counter *counter);
+
/* Binder-based (connection centric) resource limits */
/*
* Valid values for `type' parameter to slapi_reslimit_register().
diff --git a/ldap/servers/slapd/snmp_collator.c b/ldap/servers/slapd/snmp_collator.c
index 3827d304..1fd5d0c5 100644
--- a/ldap/servers/slapd/snmp_collator.c
+++ b/ldap/servers/slapd/snmp_collator.c
@@ -611,6 +611,9 @@ snmp_collator_update(time_t start_time, void *arg)
}
}
+/* NGK - We should not be using a plain int here. All of these counters
+ * are PRUint32 types for now, but they will be PRUint64 once converted
+ * to use Slapi_Counter. */
static void
add_counter_to_value(Slapi_Entry *e, const char *type, int countervalue)
{
diff --git a/ldap/servers/slapd/stubrepl.c b/ldap/servers/slapd/stubrepl.c
index c7145b62..ff015ac6 100644
--- a/ldap/servers/slapd/stubrepl.c
+++ b/ldap/servers/slapd/stubrepl.c
@@ -74,6 +74,6 @@ connection_abandon_operations( Connection *conn )
}
void
-disconnect_server( Connection *conn, int opconnid, int opid, PRErrorCode reason, PRInt32 error )
+disconnect_server( Connection *conn, PRUint64 opconnid, int opid, PRErrorCode reason, PRInt32 error )
{
}
diff --git a/ldap/servers/slapd/unbind.c b/ldap/servers/slapd/unbind.c
index dec6af5c..d4f3aedf 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=%d op=%d UNBIND,"
+ slapi_log_access( LDAP_DEBUG_STATS, "conn=%" PRIu64 " op=%d UNBIND,"
" decoding error: UnBindRequest not null\n",
pb->pb_conn->c_connid, operation->o_opid );
/* LDAPv3 does not allow a response to an unbind... so just return. */
@@ -92,7 +92,7 @@ do_unbind( Slapi_PBlock *pb )
* pass them to the backend.
*/
if ( (err = get_ldapmessage_controls( pb, ber, NULL )) != 0 ) {
- slapi_log_access( LDAP_DEBUG_STATS, "conn=%d op=%d UNBIND,"
+ slapi_log_access( LDAP_DEBUG_STATS, "conn=%" PRIu64 " op=%d UNBIND,"
" error processing controls - error %d (%s)\n",
pb->pb_conn->c_connid, operation->o_opid,
err, ldap_err2string( err ));
@@ -107,7 +107,7 @@ do_unbind( Slapi_PBlock *pb )
/* ONREPL - plugins should be called and passed bind dn and, possibly, other data */
- slapi_log_access( LDAP_DEBUG_STATS, "conn=%d op=%d UNBIND\n",
+ slapi_log_access( LDAP_DEBUG_STATS, "conn=%" PRIu64 " op=%d UNBIND\n",
pb->pb_conn->c_connid, operation->o_opid );
/* pass the unbind to all backends */
diff --git a/ldap/servers/slapd/value.c b/ldap/servers/slapd/value.c
index fd95bc92..72f94b93 100644
--- a/ldap/servers/slapd/value.c
+++ b/ldap/servers/slapd/value.c
@@ -487,7 +487,7 @@ slapi_value_get_longlong(const Slapi_Value *value)
p = slapi_ch_malloc(value->bv.bv_len + 1);
memcpy (p, value->bv.bv_val, value->bv.bv_len);
p [value->bv.bv_len] = '\0';
- r = atoll(p);
+ r = strtoll(p, (char **)NULL, 0);
slapi_ch_free((void **)&p);
}
return r;
@@ -503,7 +503,7 @@ slapi_value_get_ulonglong(const Slapi_Value *value)
p = slapi_ch_malloc(value->bv.bv_len + 1);
memcpy (p, value->bv.bv_val, value->bv.bv_len);
p [value->bv.bv_len] = '\0';
- r = (unsigned long long)atoll(p);
+ r = strtoull(p, (char **)NULL, 0);
slapi_ch_free((void **)&p);
}
return r;