]> git.sur5r.net Git - openldap/commitdiff
Glueing code changes for replica promotion scenario
authorJong Hyuk Choi <jongchoi@openldap.org>
Sat, 28 Jun 2003 00:52:40 +0000 (00:52 +0000)
committerJong Hyuk Choi <jongchoi@openldap.org>
Sat, 28 Jun 2003 00:52:40 +0000 (00:52 +0000)
servers/slapd/back-bdb/delete.c
servers/slapd/back-bdb/modify.c
servers/slapd/back-bdb/modrdn.c
servers/slapd/back-bdb/passwd.c
servers/slapd/schema_check.c

index bc2185311f6b506054309fbd07887ad844f7941b..824de2e67d1dffd025adfed571bf533948bedd07 100644 (file)
@@ -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;
index 0d267f63bcf358f8b13a35d783a0dd5b8461d263..7844ce02614ef11e028d764e1c94248c281f0a6d 100644 (file)
@@ -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;
index d45eb96f2733bbdbeb8bbef41b6a60b3664e38d3..3e2f2a86c3b511f0762359c6909936e54b48d75d 100644 (file)
@@ -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;
index a3c0ebf408ccd3a65d4fcb88461905b93561aaeb..1c96ace4286a30a86d529a4f489787f1518ad6ab 100644 (file)
@@ -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;
index 7efd21f6af1226552d87a0d8263c342abd85b6b1..446202e86c640dc183249ddfe1d308651943c0a8 100644 (file)
@@ -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