diff --git a/CHANGES b/CHANGES index 1dc626fca59fa470e38a234adadfc1f665f1c9c3..7d4c70c7c5c6df5056e1625a84338cbbaae85a5d 100644 --- a/CHANGES +++ b/CHANGES @@ -22,6 +22,7 @@ OpenLDAP 2.4.14 Engineering Fixed slapd connection assert (ITS#5835) Fixed slapd epoll handling (ITS#5886) Fixed slapd frontend/backend options handling (ITS#5857) + Fixed slapd glue with MMR (ITS#5925) Fixed slapd manageDSAit with glue entries (ITS#5921) Fixed slapd syncrepl rename handling (ITS#5809) Fixed slapd syncrepl MMR when adding new server (ITS#5850) diff --git a/servers/slapd/backglue.c b/servers/slapd/backglue.c index 8c98a593009604a9a90b2f2ca26780ee85a686c4..f8df9b2006f42f7bb8ca9ca27b525d6f0ea8388a 100644 --- a/servers/slapd/backglue.c +++ b/servers/slapd/backglue.c @@ -942,6 +942,15 @@ glue_tool_sync ( return 0; } +typedef struct glue_Addrec { + struct glue_Addrec *ga_next; + BackendDB *ga_be; +} glue_Addrec; + +/* List of added subordinates */ +static glue_Addrec *ga_list; +static int ga_adding; + static int glue_db_init( BackendDB *be, @@ -994,6 +1003,9 @@ glue_db_init( SLAP_DBFLAGS( be ) |= SLAP_DBFLAG_GLUE_INSTANCE; + if ( ga_list ) + glue_sub_attach( 1 ); + return 0; } @@ -1068,21 +1080,19 @@ glue_sub_del( BackendDB *b0 ) return rc; } -typedef struct glue_Addrec { - struct glue_Addrec *ga_next; - BackendDB *ga_be; -} glue_Addrec; - -/* List of added subordinates */ -static glue_Addrec *ga_list; /* Attach all the subordinate backends to their superior */ int -glue_sub_attach() +glue_sub_attach( int online ) { glue_Addrec *ga, *gnext = NULL; int rc = 0; + if ( ga_adding ) + return 0; + + ga_adding = 1; + /* For all the subordinate backends */ for ( ga=ga_list; ga != NULL; ga = gnext ) { BackendDB *be; @@ -1122,11 +1132,20 @@ glue_sub_attach() &gi->gi_n[gi->gi_nodes].gn_pdn ); gi->gi_nodes++; on->on_bi.bi_private = gi; + ga->ga_be->be_flags |= SLAP_DBFLAG_GLUE_LINKED; break; } if ( !be ) { Debug( LDAP_DEBUG_ANY, "glue: no superior found for sub %s!\n", ga->ga_be->be_suffix[0].bv_val, 0, 0 ); + /* allow this for now, assume a superior will + * be added later + */ + if ( online ) { + rc = 0; + gnext = ga_list; + break; + } rc = LDAP_NO_SUCH_OBJECT; } ch_free( ga ); @@ -1135,6 +1154,8 @@ glue_sub_attach() ga_list = gnext; + ga_adding = 0; + return rc; } @@ -1160,7 +1181,7 @@ glue_sub_add( BackendDB *be, int advert, int online ) ga_list = ga; if ( online ) - rc = glue_sub_attach(); + rc = glue_sub_attach( online ); return rc; } diff --git a/servers/slapd/main.c b/servers/slapd/main.c index 160b8200fb2568ac6f6ebe07932f8e66d0183d4d..fa008ee2cff64d22bd77aa1d9b08ab38746e3e14 100644 --- a/servers/slapd/main.c +++ b/servers/slapd/main.c @@ -792,7 +792,7 @@ unhandled_option:; } } - if ( glue_sub_attach( ) != 0 ) { + if ( glue_sub_attach( 0 ) != 0 ) { Debug( LDAP_DEBUG_ANY, "subordinate config error\n", 0, 0, 0 ); diff --git a/servers/slapd/proto-slap.h b/servers/slapd/proto-slap.h index 6e8c0fe47c2af8986baf09725a340623539d2c8b..f6a3478c7cb006b97b8f787c0e04bed41afc78e0 100644 --- a/servers/slapd/proto-slap.h +++ b/servers/slapd/proto-slap.h @@ -426,7 +426,7 @@ LDAP_SLAPD_V(BackendInfo) slap_binfo[]; */ LDAP_SLAPD_F (int) glue_sub_init( void ); -LDAP_SLAPD_F (int) glue_sub_attach( void ); +LDAP_SLAPD_F (int) glue_sub_attach( int online ); LDAP_SLAPD_F (int) glue_sub_add( BackendDB *be, int advert, int online ); LDAP_SLAPD_F (int) glue_sub_del( BackendDB *be ); diff --git a/servers/slapd/slapcommon.c b/servers/slapd/slapcommon.c index c29b121144fc1329ebeb5c69c66b2e44582025e4..12856633cd015e578e07abb51e80792679107d67 100644 --- a/servers/slapd/slapcommon.c +++ b/servers/slapd/slapcommon.c @@ -564,7 +564,7 @@ slap_tool_init( } if ( use_glue ) { - rc = glue_sub_attach(); + rc = glue_sub_attach( 0 ); if ( rc != 0 ) { fprintf( stderr,