Glueing code changes for replica promotion scenario

This commit is contained in:
Jong Hyuk Choi 2003-06-28 00:52:40 +00:00
parent 3b83a0b0a7
commit ea57395f82
5 changed files with 57 additions and 10 deletions

View File

@ -17,7 +17,7 @@ int
bdb_delete( Operation *op, SlapReply *rs ) bdb_delete( Operation *op, SlapReply *rs )
{ {
struct bdb_info *bdb = (struct bdb_info *) op->o_bd->be_private; struct bdb_info *bdb = (struct bdb_info *) op->o_bd->be_private;
Entry *matched; Entry *matched = NULL;
struct berval pdn = {0, NULL}; struct berval pdn = {0, NULL};
Entry *e = NULL; Entry *e = NULL;
Entry *p = NULL; Entry *p = NULL;
@ -223,7 +223,11 @@ retry: /* transaction retry */
} }
} }
#ifdef LDAP_SYNCREPL
if ( e == NULL || ( !manageDSAit && is_entry_glue( e ))) {
#else
if ( e == NULL ) { if ( e == NULL ) {
#endif
#ifdef NEW_LOGGING #ifdef NEW_LOGGING
LDAP_LOG ( OPERATION, ARGS, LDAP_LOG ( OPERATION, ARGS,
"<=- bdb_delete: no such object %s\n", op->o_req_dn.bv_val, 0, 0); "<=- bdb_delete: no such object %s\n", op->o_req_dn.bv_val, 0, 0);
@ -233,7 +237,11 @@ retry: /* transaction retry */
op->o_req_dn.bv_val, 0, 0); op->o_req_dn.bv_val, 0, 0);
#endif #endif
#ifdef LDAP_SYNCREPL
if ( e == NULL && matched != NULL && !is_entry_glue( matched )) {
#else
if ( matched != NULL ) { if ( matched != NULL ) {
#endif
rs->sr_matched = ch_strdup( matched->e_dn ); rs->sr_matched = ch_strdup( matched->e_dn );
rs->sr_ref = is_entry_referral( matched ) rs->sr_ref = is_entry_referral( matched )
? get_entry_referrals( op, matched ) ? get_entry_referrals( op, matched )
@ -242,8 +250,13 @@ retry: /* transaction retry */
matched = NULL; matched = NULL;
} else { } else {
rs->sr_ref = referral_rewrite( default_referral, #ifdef LDAP_SYNCREPL
NULL, &op->o_req_dn, LDAP_SCOPE_DEFAULT ); BerVarray deref = op->o_bd->syncinfo ?
op->o_bd->syncinfo->masteruri_bv : default_referral;
#else
BerVarray deref = default_referral;
#endif
rs->sr_ref = referral_rewrite( deref, NULL, &op->o_req_dn, LDAP_SCOPE_DEFAULT );
} }
rs->sr_err = LDAP_REFERRAL; rs->sr_err = LDAP_REFERRAL;
@ -297,8 +310,7 @@ retry: /* transaction retry */
"<=- bdb_delete: entry is referral\n", 0, 0, 0 ); "<=- bdb_delete: entry is referral\n", 0, 0, 0 );
#else #else
Debug( LDAP_DEBUG_TRACE, Debug( LDAP_DEBUG_TRACE,
"bdb_delete: entry is referral\n", "bdb_delete: entry is referral\n", 0, 0, 0 );
0, 0, 0 );
#endif #endif
rs->sr_err = LDAP_REFERRAL; rs->sr_err = LDAP_REFERRAL;

View File

@ -408,8 +408,14 @@ retry: /* transaction retry */
e = ei->bei_e; e = ei->bei_e;
/* acquire and lock entry */ /* acquire and lock entry */
#ifdef LDAP_SYNCREPL
if ( rs->sr_err == DB_NOTFOUND || !e ||
( !manageDSAit && is_entry_glue( e ))) {
if ( e != NULL && !is_entry_glue( e )) {
#else
if ( rs->sr_err == DB_NOTFOUND ) { if ( rs->sr_err == DB_NOTFOUND ) {
if ( e != NULL ) { if ( e != NULL ) {
#endif
rs->sr_matched = ch_strdup( e->e_dn ); rs->sr_matched = ch_strdup( e->e_dn );
rs->sr_ref = is_entry_referral( e ) rs->sr_ref = is_entry_referral( e )
? get_entry_referrals( op, e ) ? get_entry_referrals( op, e )
@ -418,8 +424,13 @@ retry: /* transaction retry */
e = NULL; e = NULL;
} else { } else {
rs->sr_ref = referral_rewrite( default_referral, #ifdef LDAP_SYNCREPL
NULL, &op->o_req_dn, LDAP_SCOPE_DEFAULT ); BerVarray deref = op->o_bd->syncinfo ?
op->o_bd->syncinfo->masteruri_bv : default_referral;
#else
BerVarray deref = default_referral;
#endif
rs->sr_ref = referral_rewrite( deref, NULL, &op->o_req_dn, LDAP_SCOPE_DEFAULT );
} }
rs->sr_err = LDAP_REFERRAL; rs->sr_err = LDAP_REFERRAL;

View File

@ -157,8 +157,14 @@ retry: /* transaction retry */
} }
e = ei->bei_e; e = ei->bei_e;
#ifdef LDAP_SYNCREPL
if ( rs->sr_err == DB_NOTFOUND || !e ||
( !manageDSAit && is_entry_glue( e ))) {
if( e != NULL && !is_entry_glue( e )) {
#else
if ( rs->sr_err == DB_NOTFOUND ) { if ( rs->sr_err == DB_NOTFOUND ) {
if( e != NULL ) { if( e != NULL ) {
#endif
rs->sr_matched = ch_strdup( e->e_dn ); rs->sr_matched = ch_strdup( e->e_dn );
rs->sr_ref = is_entry_referral( e ) rs->sr_ref = is_entry_referral( e )
? get_entry_referrals( op, e ) ? get_entry_referrals( op, e )
@ -167,8 +173,13 @@ retry: /* transaction retry */
e = NULL; e = NULL;
} else { } else {
rs->sr_ref = referral_rewrite( default_referral, #ifdef LDAP_SYNCREPL
NULL, &op->o_req_dn, LDAP_SCOPE_DEFAULT ); BerVarray deref = op->o_bd->syncinfo ?
op->o_bd->syncinfo->masteruri_bv : default_referral;
#else
BerVarray deref = default_referral;
#endif
rs->sr_ref = referral_rewrite( deref, NULL, &op->o_req_dn, LDAP_SCOPE_DEFAULT );
} }
rs->sr_err = LDAP_REFERRAL; rs->sr_err = LDAP_REFERRAL;

View File

@ -170,7 +170,11 @@ retry: /* transaction retry */
if ( ei ) e = ei->bei_e; if ( ei ) e = ei->bei_e;
if( e == NULL ) { #ifdef LDAP_SYNCREPL
if ( e == NULL || is_entry_glue( e )) {
#else
if ( e == NULL ) {
#endif
rs->sr_text = "could not locate authorization entry"; rs->sr_text = "could not locate authorization entry";
rc = LDAP_NO_SUCH_OBJECT; rc = LDAP_NO_SUCH_OBJECT;
goto done; goto done;

View File

@ -214,13 +214,22 @@ entry_schema_check(
aoc->a_vals[0].bv_val ); aoc->a_vals[0].bv_val );
return LDAP_OBJECT_CLASS_VIOLATION; return LDAP_OBJECT_CLASS_VIOLATION;
#ifdef LDAP_SYNCREPL
} else if ( sc != slap_schema.si_oc_glue && sc != oc ) {
#else
} else if ( sc != oc ) { } else if ( sc != oc ) {
#endif
snprintf( textbuf, textlen, snprintf( textbuf, textlen,
"structural object class modification " "structural object class modification "
"from '%s' to '%s' not allowed", "from '%s' to '%s' not allowed",
asc->a_vals[0].bv_val, nsc.bv_val ); asc->a_vals[0].bv_val, nsc.bv_val );
return LDAP_NO_OBJECT_CLASS_MODS; return LDAP_NO_OBJECT_CLASS_MODS;
} }
#ifdef LDAP_SYNCREPL
else if ( sc == slap_schema.si_oc_glue ) {
sc = oc;
}
#endif
/* naming check */ /* naming check */
#ifdef LDAP_SYNCREPL #ifdef LDAP_SYNCREPL