From 84fba4c1fc19c8b7f4c7beba51c3d53e82dcc8b4 Mon Sep 17 00:00:00 2001
From: Quanah Gibson-Mount <quanah@openldap.org>
Date: Wed, 3 Sep 2008 02:02:22 +0000
Subject: [PATCH] ITS#5649

---
 CHANGES                  | 1 +
 servers/slapd/backover.c | 6 +++---
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/CHANGES b/CHANGES
index 08835ee6aa..bbf2c9a314 100644
--- a/CHANGES
+++ b/CHANGES
@@ -4,6 +4,7 @@ OpenLDAP 2.4.12 Engineering
 	Fixed liblutil executables on Windows (ITS#5604)
 	Fixed slapd custom attribute inheritance (ITS#5642)
 	Fixed slapd firstComponentMatch normalization (ITS#5634)
+	Fixed slapd overlay control registration (ITS#5649)
 	Fixed slapd socket closing on Windows (ITS#5606)
 	Fixed slapd-ldap,slapd-meta invalid filter behavior (ITS#5614)
 	Fixed slapd-meta quarantine behavior (ITS#5592)
diff --git a/servers/slapd/backover.c b/servers/slapd/backover.c
index 2f23fb0d19..ce69388fa1 100644
--- a/servers/slapd/backover.c
+++ b/servers/slapd/backover.c
@@ -1063,7 +1063,7 @@ overlay_register_control( BackendDB *be, const char *oid )
 		
 		/* add to all backends... */
 		LDAP_STAILQ_FOREACH( bd, &backendDB, be_next ) {
-			if ( be == bd ) {
+			if ( bd == be->bd_self ) {
 				gotit = 1;
 			}
 
@@ -1074,8 +1074,8 @@ overlay_register_control( BackendDB *be, const char *oid )
 	}
 	
 	if ( !gotit ) {
-		be->be_ctrls[ cid ] = 1;
-		be->be_ctrls[ SLAP_MAX_CIDS ] = 1;
+		be->bd_self->be_ctrls[ cid ] = 1;
+		be->bd_self->be_ctrls[ SLAP_MAX_CIDS ] = 1;
 	}
 
 	return 0;
-- 
GitLab