From: Ondřej Kuzník Date: Wed, 8 Dec 2021 17:12:57 +0000 (+0000) Subject: ITS#9762 slapo-dyngroup: Maintain values in order of insertion X-Git-Tag: OPENLDAP_REL_ENG_2_6_1~39 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=d4f51403364694d9aba5e5232df1cb0eec8a5589;p=thirdparty%2Fopenldap.git ITS#9762 slapo-dyngroup: Maintain values in order of insertion --- diff --git a/servers/slapd/overlays/dyngroup.c b/servers/slapd/overlays/dyngroup.c index ecaf588bac..5d890d6650 100644 --- a/servers/slapd/overlays/dyngroup.c +++ b/servers/slapd/overlays/dyngroup.c @@ -90,7 +90,7 @@ static int dgroup_cf( ConfigArgs *c ) case SLAP_CONFIG_ADD: case LDAP_MOD_ADD: { - adpair ap = { NULL, NULL, NULL }, *a2; + adpair ap = { NULL, NULL, NULL }, **app, *a2; const char *text; if ( slap_str2ad( c->argv[1], &ap.ap_mem, &text ) ) { snprintf( c->cr_msg, sizeof( c->cr_msg ), "%s attribute description unknown: \"%s\"", @@ -110,10 +110,14 @@ static int dgroup_cf( ConfigArgs *c ) * anything this instance of the overlay needs. */ a2 = ch_malloc( sizeof(adpair) ); - a2->ap_next = on->on_bi.bi_private; + + for ( app = &on->on_bi.bi_private; *app; app = &(*app)->ap_next ) + /* Get to the end */ ; + a2->ap_mem = ap.ap_mem; a2->ap_uri = ap.ap_uri; - on->on_bi.bi_private = a2; + a2->ap_next = *app; + *app = a2; rc = 0; } }