From: Jong Hyuk Choi Date: Sat, 28 Jun 2003 00:52:40 +0000 (+0000) Subject: Glueing code changes for replica promotion scenario X-Git-Tag: OPENLDAP_REL_ENG_2_1_MP~847 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=ea57395f82d26753183a033fea362aea2920964b;p=openldap Glueing code changes for replica promotion scenario --- diff --git a/servers/slapd/back-bdb/delete.c b/servers/slapd/back-bdb/delete.c index bc2185311f..824de2e67d 100644 --- a/servers/slapd/back-bdb/delete.c +++ b/servers/slapd/back-bdb/delete.c @@ -17,7 +17,7 @@ int bdb_delete( Operation *op, SlapReply *rs ) { struct bdb_info *bdb = (struct bdb_info *) op->o_bd->be_private; - Entry *matched; + Entry *matched = NULL; struct berval pdn = {0, NULL}; Entry *e = 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 ) { +#endif #ifdef NEW_LOGGING LDAP_LOG ( OPERATION, ARGS, "<=- 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); #endif +#ifdef LDAP_SYNCREPL + if ( e == NULL && matched != NULL && !is_entry_glue( matched )) { +#else if ( matched != NULL ) { +#endif rs->sr_matched = ch_strdup( matched->e_dn ); rs->sr_ref = is_entry_referral( matched ) ? get_entry_referrals( op, matched ) @@ -242,8 +250,13 @@ retry: /* transaction retry */ matched = NULL; } else { - rs->sr_ref = referral_rewrite( default_referral, - NULL, &op->o_req_dn, LDAP_SCOPE_DEFAULT ); +#ifdef LDAP_SYNCREPL + 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; @@ -297,8 +310,7 @@ retry: /* transaction retry */ "<=- bdb_delete: entry is referral\n", 0, 0, 0 ); #else Debug( LDAP_DEBUG_TRACE, - "bdb_delete: entry is referral\n", - 0, 0, 0 ); + "bdb_delete: entry is referral\n", 0, 0, 0 ); #endif rs->sr_err = LDAP_REFERRAL; diff --git a/servers/slapd/back-bdb/modify.c b/servers/slapd/back-bdb/modify.c index 0d267f63bc..7844ce0261 100644 --- a/servers/slapd/back-bdb/modify.c +++ b/servers/slapd/back-bdb/modify.c @@ -408,8 +408,14 @@ retry: /* transaction retry */ e = ei->bei_e; /* 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 ( e != NULL ) { +#endif rs->sr_matched = ch_strdup( e->e_dn ); rs->sr_ref = is_entry_referral( e ) ? get_entry_referrals( op, e ) @@ -418,8 +424,13 @@ retry: /* transaction retry */ e = NULL; } else { - rs->sr_ref = referral_rewrite( default_referral, - NULL, &op->o_req_dn, LDAP_SCOPE_DEFAULT ); +#ifdef LDAP_SYNCREPL + 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; diff --git a/servers/slapd/back-bdb/modrdn.c b/servers/slapd/back-bdb/modrdn.c index d45eb96f27..3e2f2a86c3 100644 --- a/servers/slapd/back-bdb/modrdn.c +++ b/servers/slapd/back-bdb/modrdn.c @@ -157,8 +157,14 @@ retry: /* transaction retry */ } 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( e != NULL ) { +#endif rs->sr_matched = ch_strdup( e->e_dn ); rs->sr_ref = is_entry_referral( e ) ? get_entry_referrals( op, e ) @@ -167,8 +173,13 @@ retry: /* transaction retry */ e = NULL; } else { - rs->sr_ref = referral_rewrite( default_referral, - NULL, &op->o_req_dn, LDAP_SCOPE_DEFAULT ); +#ifdef LDAP_SYNCREPL + 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; diff --git a/servers/slapd/back-bdb/passwd.c b/servers/slapd/back-bdb/passwd.c index a3c0ebf408..1c96ace428 100644 --- a/servers/slapd/back-bdb/passwd.c +++ b/servers/slapd/back-bdb/passwd.c @@ -170,7 +170,11 @@ retry: /* transaction retry */ 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"; rc = LDAP_NO_SUCH_OBJECT; goto done; diff --git a/servers/slapd/schema_check.c b/servers/slapd/schema_check.c index 7efd21f6af..446202e86c 100644 --- a/servers/slapd/schema_check.c +++ b/servers/slapd/schema_check.c @@ -214,13 +214,22 @@ entry_schema_check( aoc->a_vals[0].bv_val ); return LDAP_OBJECT_CLASS_VIOLATION; +#ifdef LDAP_SYNCREPL + } else if ( sc != slap_schema.si_oc_glue && sc != oc ) { +#else } else if ( sc != oc ) { +#endif snprintf( textbuf, textlen, "structural object class modification " "from '%s' to '%s' not allowed", asc->a_vals[0].bv_val, nsc.bv_val ); return LDAP_NO_OBJECT_CLASS_MODS; } +#ifdef LDAP_SYNCREPL + else if ( sc == slap_schema.si_oc_glue ) { + sc = oc; + } +#endif /* naming check */ #ifdef LDAP_SYNCREPL