From: Pierangelo Masarati Date: Sat, 21 Nov 2009 21:44:45 +0000 (+0000) Subject: connid is unsigned; offset real conns by maxrid + 1 X-Git-Tag: ACLCHECK_0~76 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=c315ede9d53d0c364e89ddb4b04356a2bb4de5a8;p=openldap connid is unsigned; offset real conns by maxrid + 1 --- diff --git a/servers/slapd/connection.c b/servers/slapd/connection.c index 2f426d6106..7f8331f532 100644 --- a/servers/slapd/connection.c +++ b/servers/slapd/connection.c @@ -48,7 +48,7 @@ static ldap_pvt_thread_mutex_t connections_mutex; static Connection *connections = NULL; static ldap_pvt_thread_mutex_t conn_nextid_mutex; -static unsigned long conn_nextid = 0; +static unsigned long conn_nextid = SLAPD_SYNC_SYNCCONN_OFFSET; static const char conn_lost_str[] = "connection lost"; diff --git a/servers/slapd/slap.h b/servers/slapd/slap.h index bc31eea45e..076b898a5b 100644 --- a/servers/slapd/slap.h +++ b/servers/slapd/slap.h @@ -1701,13 +1701,15 @@ typedef BackendDB Backend; struct syncinfo_s; -/* fake conn connid constructed as SLAPD_SYNC_CONN_OFFSET - rid */ -#define SLAPD_SYNC_SYNCCONN_OFFSET (-1000) -#define SLAPD_SYNC_IS_SYNCCONN(connid) ((connid) <= SLAPD_SYNC_SYNCCONN_OFFSET) -#define SLAPD_SYNC_RID2SYNCCONN(rid) (SLAPD_SYNC_SYNCCONN_OFFSET - (rid)) - #define SLAP_SYNC_RID_MAX 999 #define SLAP_SYNC_SID_MAX 4095 /* based on liblutil/csn.c field width */ + +/* fake conn connid constructed as rid; real connids start + * at SLAPD_SYNC_CONN_OFFSET */ +#define SLAPD_SYNC_SYNCCONN_OFFSET (SLAP_SYNC_RID_MAX + 1) +#define SLAPD_SYNC_IS_SYNCCONN(connid) ((connid) < SLAPD_SYNC_SYNCCONN_OFFSET) +#define SLAPD_SYNC_RID2SYNCCONN(rid) (rid) + #define SLAP_SYNCUUID_SET_SIZE 256 struct sync_cookie {