diff --git a/servers/slapd/backend.c b/servers/slapd/backend.c index b003354219..1032008353 100644 --- a/servers/slapd/backend.c +++ b/servers/slapd/backend.c @@ -762,7 +762,7 @@ be_shadow_update( Operation *op ) /* This assumes that all internal ops (connid <= -1000) on a syncrepl * database are syncrepl operations. */ - return (( SLAP_SYNC_SHADOW( op->o_bd ) && op->o_connid <= -1000 ) || + return ( ( SLAP_SYNC_SHADOW( op->o_bd ) && SLAPD_SYNC_IS_SYNCCONN( op->o_connid ) ) || ( SLAP_SHADOW( op->o_bd ) && be_isupdate_dn( op->o_bd, &op->o_ndn ) ) ); } diff --git a/servers/slapd/slap.h b/servers/slapd/slap.h index 6015dbf837..bc31eea45e 100644 --- a/servers/slapd/slap.h +++ b/servers/slapd/slap.h @@ -1701,6 +1701,11 @@ 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 */ #define SLAP_SYNCUUID_SET_SIZE 256 diff --git a/servers/slapd/syncrepl.c b/servers/slapd/syncrepl.c index 414ab32506..a9b3d7150b 100644 --- a/servers/slapd/syncrepl.c +++ b/servers/slapd/syncrepl.c @@ -1354,7 +1354,7 @@ do_syncrepl( connection_fake_init( &conn, &opbuf, ctx ); op = &opbuf.ob_op; /* o_connids must be unique for slap_graduate_commit_csn */ - op->o_connid = -1000 - si->si_rid; + op->o_connid = SLAPD_SYNC_RID2SYNCCONN(si->si_rid); op->o_managedsait = SLAP_CONTROL_NONCRITICAL; be = si->si_be;