[Date Prev][Date Next] [Chronological] [Thread] [Top]

Re: (ITS#7381) Dynamically added chaining configuration stops working after restart



This is a multi-part message in MIME format.
--------------070406020601050207030907
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit

On 06.09.2013. 21:56, hyc@symas.com wrote:
> ian@uns.ac.rs wrote:
>> If a minimal chaining configuration is dynamically added to a consumer server in
>> a provider/consumer pair running delta-syncrepl, it will stop working when the
>> consumer is restarted. The configuration is modelled after the one used in
>> test022 in the OpenLDAP source distribution:
>
> Sorry this report was neglected for so long, and thanks for the excellent test
> case. This is now fixed in git master.

Tested against git master (721e46fe6695077d63a3df6ea2e397920a72308d) with the original
use case and it works, thanks. However, slapd now segfaults if started with cn=config
obtained by converting an existing chaining configuration from slapd.conf. Steps to
reproduce, using the scripts from the archive attached to the original report:

$ make clean-all replica-chaining
$ ./start-replica.sh			# segfault

The crash is in chain_ldadd, and occurs because the first back-ldap instance in the
converted configuration lacks an olcDbURI. I have attached a patch which inserts a
dummy URI in the common parameter structure when it's allocated. This URI
(ldap://0.0.0.0) should never match any actual referral, so the instance can only
serve to initialize common parameters (which happens with the first instance anyway,
if I understood the code correctly.)

-- 
Ivan Nejgebauer
Glavni sistem inženjer CIT-UNS/ARMUNS

Univerzitet u Novom Sadu
Trg Dositeja ObradoviÄ?a 5
21000 Novi Sad 	+381 21 485 2025
ian@uns.ac.rs
www.uns.ac.rs


--------------070406020601050207030907
Content-Type: text/x-patch;
 name="0001-Fix-crash-w-converted-chain-config.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
 filename="0001-Fix-crash-w-converted-chain-config.patch"

>From 49dc118a97cc5b7e0723905faf08480facb78912 Mon Sep 17 00:00:00 2001
From: Ivan Nejgebauer <ian@uns.ac.rs>
Date: Mon, 9 Sep 2013 11:33:02 +0200
Subject: [PATCH] Fix crash w/converted chain config

As a result of the fix for ITS#7381 (4d02a43ec9a4be422d83094e8d39b7ef3bc290c5)
slapd segfaults if started with dynamic configuration after converting
a slapd.conf chaining setup to cn=config. This is because the common
back-ldap parameters, emitted as the first olcDatabase entry, lack an
olcDbURI attribute. This patch adds a dummy LDAP URI which should never
match a real one (ldap://0.0.0.0) to the common parameter structure.
---
 servers/slapd/back-ldap/chain.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/servers/slapd/back-ldap/chain.c b/servers/slapd/back-ldap/chain.c
index a7c53ed..ab71b21 100644
--- a/servers/slapd/back-ldap/chain.c
+++ b/servers/slapd/back-ldap/chain.c
@@ -2019,6 +2019,7 @@ ldap_chain_db_init_common(
 	BackendInfo	*bi = be->bd_info;
 	ldapinfo_t	*li;
 	int		rc;
+	char		*dummy_uri = "ldap://0.0.0.0";;
 
 	be->bd_info = lback;
 	be->be_private = NULL;
@@ -2029,6 +2030,8 @@ ldap_chain_db_init_common(
 	li = (ldapinfo_t *)be->be_private;
 	li->li_urllist_f = NULL;
 	li->li_urllist_p = NULL;
+	li->li_uri = ch_strdup( dummy_uri );
+	li->li_bvuri = ch_calloc( sizeof( struct berval ), 1 );
 
 	be->bd_info = bi;
 
-- 
1.8.1.2


--------------070406020601050207030907--