From e9b11154ee6526d8b1b56004f8ec9a4b82a333fe Mon Sep 17 00:00:00 2001
From: Howard Chu <hyc@openldap.org>
Date: Tue, 15 Mar 2022 16:46:09 +0000
Subject: [PATCH] ITS#9802 slapd-meta: fix rewrite config ordering

---
 servers/slapd/back-meta/config.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/servers/slapd/back-meta/config.c b/servers/slapd/back-meta/config.c
index ad7fbce44..0f876e77f 100644
--- a/servers/slapd/back-meta/config.c
+++ b/servers/slapd/back-meta/config.c
@@ -2718,7 +2718,7 @@ idassert-authzFrom	"dn:<rootdn>"
 			/* move it to the right slot */
 			if ( ix < cnt ) {
 				for ( i=cnt; i>ix; i-- )
-					mt->mt_rwmap.rwm_bva_rewrite[i+1] = mt->mt_rwmap.rwm_bva_rewrite[i];
+					mt->mt_rwmap.rwm_bva_rewrite[i] = mt->mt_rwmap.rwm_bva_rewrite[i-1];
 				mt->mt_rwmap.rwm_bva_rewrite[i] = bv;
 
 				/* destroy old rules */
-- 
2.33.0

