Commit 2d291714 authored by Quanah Gibson-Mount's avatar Quanah Gibson-Mount
Browse files

ITS#5850

parent 7663ef44
......@@ -4,6 +4,7 @@ OpenLDAP 2.4.14 Engineering
Fixed libldap peer cert memory leak (ITS#5849)
Fixed libldap_r deref building (ITS#5768)
Fixed slapd syncrepl rename handling (ITS#5809)
Fixed slapd syncrepl MMR when adding new server (ITS#5850)
Build Environment
Fixed test049,test050 to work on windows (ITS#5842)
......
......@@ -3069,7 +3069,16 @@ config_shadow( ConfigArgs *c, int flag )
return 1;
}
SLAP_DBFLAGS(c->be) |= (SLAP_DBFLAG_SHADOW | SLAP_DBFLAG_SINGLE_SHADOW | flag);
if ( SLAP_SHADOW(c->be) ) {
/* if already shadow, only check consistency */
if ( ( SLAP_DBFLAGS(c->be) & flag ) != flag ) {
Debug( LDAP_DEBUG_ANY, "%s: inconsistent shadow flag 0x%x.\n", c->log, flag, 0 );
return 1;
}
} else {
SLAP_DBFLAGS(c->be) |= (SLAP_DBFLAG_SHADOW | SLAP_DBFLAG_SINGLE_SHADOW | flag);
}
return 0;
}
......
......@@ -1791,6 +1791,7 @@ struct BackendDB {
#define SLAP_DBFLAG_SINGLE_SHADOW 0x4000U /* a single-master shadow */
#define SLAP_DBFLAG_SYNC_SHADOW 0x1000U /* a sync shadow */
#define SLAP_DBFLAG_SLURP_SHADOW 0x2000U /* a slurp shadow */
#define SLAP_DBFLAG_SHADOW_MASK (SLAP_DBFLAG_SHADOW|SLAP_DBFLAG_SINGLE_SHADOW|SLAP_DBFLAG_SYNC_SHADOW|SLAP_DBFLAG_SLURP_SHADOW)
#define SLAP_DBFLAG_CLEAN 0x10000U /* was cleanly shutdown */
#define SLAP_DBFLAG_ACL_ADD 0x20000U /* check attr ACLs on adds */
slap_mask_t be_flags;
......
......@@ -723,7 +723,6 @@ do_syncrep2(
syncinfo_t *si )
{
LDAPControl **rctrls = NULL;
LDAPControl *rctrlp;
BerElementBuffer berbuf;
BerElement *ber = (BerElement *)&berbuf;
......@@ -780,6 +779,8 @@ do_syncrep2(
while ( ( rc = ldap_result( si->si_ld, si->si_msgid, LDAP_MSG_ONE,
tout_p, &msg ) ) > 0 )
{
LDAPControl *rctrlp = NULL;
if ( slapd_shutdown ) {
rc = -2;
goto done;
......@@ -788,18 +789,22 @@ do_syncrep2(
case LDAP_RES_SEARCH_ENTRY:
ldap_get_entry_controls( si->si_ld, msg, &rctrls );
/* we can't work without the control */
rctrlp = NULL;
if ( rctrls ) {
LDAPControl **next;
/* NOTE: make sure we use the right one;
* a better approach would be to run thru
* the whole list and take care of all */
/* NOTE: since we issue the search request,
* we should know what controls to expect,
* and there should be none apart from the
* sync-related control */
rctrlp = ldap_control_find( LDAP_CONTROL_SYNC_STATE, rctrls, &next );
if ( next && ldap_control_find( LDAP_CONTROL_SYNC_STATE, next, NULL ) )
{
Debug( LDAP_DEBUG_ANY, "do_syncrep2: %s "
"got search entry with multiple "
"Sync State control\n", si->si_ridtxt, 0, 0 );
ldap_controls_free( rctrls );
rc = -1;
goto done;
}
......@@ -920,7 +925,26 @@ do_syncrep2(
si->si_ridtxt, err, ldap_err2string( err ) );
}
if ( rctrls ) {
rctrlp = *rctrls;
LDAPControl **next;
/* NOTE: make sure we use the right one;
* a better approach would be to run thru
* the whole list and take care of all */
/* NOTE: since we issue the search request,
* we should know what controls to expect,
* and there should be none apart from the
* sync-related control */
rctrlp = ldap_control_find( LDAP_CONTROL_SYNC_DONE, rctrls, &next );
if ( next && ldap_control_find( LDAP_CONTROL_SYNC_DONE, next, NULL ) )
{
Debug( LDAP_DEBUG_ANY, "do_syncrep2: %s "
"got search result with multiple "
"Sync State control\n", si->si_ridtxt, 0, 0 );
ldap_controls_free( rctrls );
rc = -1;
goto done;
}
}
if ( rctrlp ) {
ber_init2( ber, &rctrlp->ldctl_value, LBER_USE_DER );
ber_scanf( ber, "{" /*"}"*/);
......@@ -4446,7 +4470,7 @@ syncrepl_config( ConfigArgs *c )
}
}
if ( !c->be->be_syncinfo ) {
SLAP_DBFLAGS( c->be ) &= ~(SLAP_DBFLAG_SHADOW|SLAP_DBFLAG_SYNC_SHADOW);
SLAP_DBFLAGS( c->be ) &= ~SLAP_DBFLAG_SHADOW_MASK;
if ( cs ) {
ber_bvarray_free( cs->cs_vals );
ldap_pvt_thread_mutex_destroy( &cs->cs_mutex );
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment