]> git.ipfire.org Git - thirdparty/openldap.git/commitdiff
ITS#9770 slapo-constraint: Maintain values in order of insertion
authorOndřej Kuzník <ondra@mistotebe.net>
Fri, 10 Dec 2021 11:46:50 +0000 (11:46 +0000)
committerQuanah Gibson-Mount <quanah@openldap.org>
Thu, 6 Jan 2022 16:28:52 +0000 (16:28 +0000)
servers/slapd/overlays/constraint.c

index 246769f67736cd7cb3030f9bc1e87de5245922ff..c4ae8fffc5cf7263d0c36e85c9a9d3c8422bd05f 100644 (file)
@@ -537,8 +537,8 @@ constraint_cf_gen( ConfigArgs *c )
 
 done:;
                        if ( rc == LDAP_SUCCESS ) {
-                               constraint *a2 = ch_calloc( sizeof(constraint), 1 );
-                               a2->ap_next = on->on_bi.bi_private;
+                               constraint **app, *a2 = ch_calloc( sizeof(constraint), 1 );
+
                                a2->ap = ap.ap;
                                a2->type = ap.type;
                                a2->re = ap.re;
@@ -556,7 +556,12 @@ done:;
                                a2->restrict_ndn = ap.restrict_ndn;
                                a2->restrict_filter = ap.restrict_filter;
                                a2->restrict_val = ap.restrict_val;
-                               on->on_bi.bi_private = a2;
+
+                               for ( app = &on->on_bi.bi_private; *app; app = &(*app)->ap_next )
+                                       /* Get to the end */ ;
+
+                               a2->ap_next = *app;
+                               *app = a2;
 
                        } else {
                                Debug( LDAP_DEBUG_CONFIG|LDAP_DEBUG_NONE,