From e5b88e1ac1c52c6945e4552321122b8d7acad064 Mon Sep 17 00:00:00 2001
From: Quanah Gibson-Mount <quanah@openldap.org>
Date: Sun, 22 Nov 2009 17:31:25 +0000
Subject: [PATCH] ITS#6394 rid is decimal not hex

---
 CHANGES                     | 1 +
 doc/man/man5/slapd-config.5 | 2 +-
 doc/man/man5/slapd.conf.5   | 4 ++--
 servers/slapd/syncrepl.c    | 6 +++---
 4 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/CHANGES b/CHANGES
index 43d3281196..2a7338bf62 100644
--- a/CHANGES
+++ b/CHANGES
@@ -20,6 +20,7 @@ OpenLDAP 2.4.20 Engineering
 	Fixed slapd inclusion of ac/unistd.h (ITS#6342)
 	Fixed slapd invalid dn log message (ITS#6309)
 	Fixed slapd lockup on shutdown (ITS#6372)
+	Fixed slapd RID range to be decimal only (ITS#6394)
 	Fixed slapd sl_free to better reclaim memory (ITS#6380)
 	Fixed slapd syncrepl deletes in MirrorMode (ITS#6368)
 	Fixed slapd syncrepl to use correct SID (ITS#6367)
diff --git a/doc/man/man5/slapd-config.5 b/doc/man/man5/slapd-config.5
index 8ec7a52744..24d00bb490 100644
--- a/doc/man/man5/slapd-config.5
+++ b/doc/man/man5/slapd-config.5
@@ -1676,7 +1676,7 @@ replication engine.
 identifies the current
 .B syncrepl
 directive within the replication consumer site.
-It is a non-negative integer having no more than three digits.
+It is a non-negative integer having no more than three decimal digits.
 
 .B provider
 specifies the replication provider site containing the master content
diff --git a/doc/man/man5/slapd.conf.5 b/doc/man/man5/slapd.conf.5
index 8d0e3c88cc..ff4242e19d 100644
--- a/doc/man/man5/slapd.conf.5
+++ b/doc/man/man5/slapd.conf.5
@@ -1663,8 +1663,8 @@ replication engine.
 identifies the current
 .B syncrepl
 directive within the replication consumer site.
-It is a non-negative integer not greater than 4095 (limited
-to three hexadecimal digits).
+It is a non-negative integer not greater than 999 (limited
+to three decimal digits).
 
 .B provider
 specifies the replication provider site containing the master content
diff --git a/servers/slapd/syncrepl.c b/servers/slapd/syncrepl.c
index a9b3d7150b..703fe25a6b 100644
--- a/servers/slapd/syncrepl.c
+++ b/servers/slapd/syncrepl.c
@@ -4027,10 +4027,10 @@ parse_syncrepl_line(
 				Debug( LDAP_DEBUG_ANY, "%s: %s.\n", c->log, c->cr_msg, 0 );
 				return -1;
 			}
-			if ( tmp > SLAP_SYNC_SID_MAX || tmp < 0 ) {
+			if ( tmp > SLAP_SYNC_RID_MAX || tmp < 0 ) {
 				snprintf( c->cr_msg, sizeof( c->cr_msg ),
 					"Error: parse_syncrepl_line: "
-					"syncrepl id %d is out of range [0..4095]", tmp );
+					"syncrepl id %d is out of range [0..%d]", tmp, SLAP_SYNC_RID_MAX );
 				Debug( LDAP_DEBUG_ANY, "%s: %s.\n", c->log, c->cr_msg, 0 );
 				return -1;
 			}
@@ -4555,7 +4555,7 @@ syncrepl_unparse( syncinfo_t *si, struct berval *bv )
 	si->si_bindconf.sb_version = LDAP_VERSION3;
 
 	ptr = buf;
-	assert( si->si_rid >= 0 && si->si_rid <= SLAP_SYNC_SID_MAX );
+	assert( si->si_rid >= 0 && si->si_rid <= SLAP_SYNC_RID_MAX );
 	len = snprintf( ptr, WHATSLEFT, IDSTR "=%03d " PROVIDERSTR "=%s",
 		si->si_rid, si->si_bindconf.sb_uri.bv_val );
 	if ( len >= sizeof( buf ) ) return;
-- 
GitLab