From e87569f983ef751057c3a80eba3e30a2e14907a2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ond=C5=99ej=20Kuzn=C3=ADk?= <ondra@mistotebe.net>
Date: Wed, 8 Dec 2021 17:14:50 +0000
Subject: [PATCH] ITS#9763 Maintain values in order of insertion

---
 servers/slapd/overlays/refint.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/servers/slapd/overlays/refint.c b/servers/slapd/overlays/refint.c
index 20f9ef1e9..2e49a94be 100644
--- a/servers/slapd/overlays/refint.c
+++ b/servers/slapd/overlays/refint.c
@@ -249,8 +249,11 @@ refint_cf_gen(ConfigArgs *c)
 					ip = ch_malloc (
 						sizeof ( refint_attrs ) );
 					ip->attr = ad;
-					ip->next = dd->attrs;
-					dd->attrs = ip;
+
+					for ( pipp = &dd->attrs; *pipp; pipp = &(*pipp)->next )
+						/* Get to the end */ ;
+					ip->next = *pipp;
+					*pipp = ip;
 				} else {
 					snprintf( c->cr_msg, sizeof( c->cr_msg ),
 						"%s <%s>: %s", c->argv[0], c->argv[i], text );
-- 
2.33.0

