]> git.sur5r.net Git - openldap/commitdiff
ITS#4777 from HEAD
authorHoward Chu <hyc@openldap.org>
Wed, 13 Dec 2006 17:40:52 +0000 (17:40 +0000)
committerHoward Chu <hyc@openldap.org>
Wed, 13 Dec 2006 17:40:52 +0000 (17:40 +0000)
servers/slapd/overlays/translucent.c
tests/data/test-translucent-data.ldif
tests/data/test-translucent-merged.ldif
tests/scripts/test034-translucent

index 4fae3d92bf1b1cbfa754decce049609d492dc19a..7e9b3ced7b266263c637fb52372ef90cdc73f7fa 100644 (file)
@@ -232,7 +232,7 @@ static int translucent_modify(Operation *op, SlapReply *rs) {
        void *private = op->o_bd->be_private;
        Entry ne, *e = NULL, *re = NULL;
        Attribute *a, *ax;
-       Modifications *m, *mm;
+       Modifications *m, **mm;
        int del, rc, erc = 0;
        slap_callback cb = { 0 };
 
@@ -275,10 +275,14 @@ static int translucent_modify(Operation *op, SlapReply *rs) {
 
        if(e && rc == LDAP_SUCCESS) {
                Debug(LDAP_DEBUG_TRACE, "=> translucent_modify: found local entry\n", 0, 0, 0);
-               for(m = op->orm_modlist; m; m = m->sml_next) {
+               for(mm = &op->orm_modlist; *mm; ) {
+                       m = *mm;
                        for(a = e->e_attrs; a; a = a->a_next)
                                if(a->a_desc == m->sml_desc) break;
-                       if(a) continue;         /* found local attr */
+                       if(a) {
+                               mm = &m->sml_next;
+                               continue;               /* found local attr */
+                       }
                        if(m->sml_op == LDAP_MOD_DELETE) {
                                for(a = re->e_attrs; a; a = a->a_next)
                                        if(a->a_desc == m->sml_desc) break;
@@ -294,14 +298,13 @@ static int translucent_modify(Operation *op, SlapReply *rs) {
                                Debug(LDAP_DEBUG_TRACE,
                                        "=> translucent_modify: silently dropping delete: %s\n",
                                        m->sml_desc->ad_cname.bv_val, 0, 0);
-                               for(mm = op->orm_modlist; mm->sml_next != m; mm = mm->sml_next);
-                               mm->sml_next = m->sml_next;
+                               *mm = m->sml_next;
                                m->sml_next = NULL;
                                slap_mods_free(m, 1);
-                               m = mm;
                                continue;
                        }
                        m->sml_op = LDAP_MOD_ADD;
+                       mm = &m->sml_next;
                }
                erc = SLAP_CB_CONTINUE;
 release:
index ee32cbbc74bf9f0320d13ca81da1a2f069eb05b8..2def65c835bfe6538894175017188cc45bc5b08f 100644 (file)
@@ -5,6 +5,7 @@ uid: danger
 sn: warning
 cn: danger
 businessCategory: backend-opaque
+initials: dw
 carLicense: BACK
 departmentNumber: 7341
 displayName: Warning
index 5bb54ec31ab4671fd637b1425e20dea4a95df339..583734a3a3e2213cfb0ec7c07d34ac001ab8c05c 100644 (file)
@@ -4,6 +4,7 @@ uid: danger
 sn: danger
 cn: henry
 businessCategory: frontend-override
+initials: dw
 carLicense: LIVID
 departmentNumber: 9999999
 displayName: Warning
index e0a03f9e2087c7a792de65fb45ef692b9c41dda4..9a2415f0044b4c0c64d2e29bb7fab97a72b72f0c 100755 (executable)
@@ -577,6 +577,24 @@ if test $RC != 16 ; then
        exit 1
 fi
 
+echo "Testing delete: valid local record, remote attribute..."
+
+$LDAPMODIFY -v -D "$TRANSLUCENTROOT" -H $URI2 -w $PASSWD > \
+        $TESTOUT 2>&1 << EOF_MOD8
+version: 1
+dn: uid=danger,ou=users,o=translucent
+changetype: modify
+delete: initials
+EOF_MOD8
+
+RC=$?
+if test $RC != 0 ; then
+       echo "ldapmodify failed ($RC)"
+       grep "$FAILURE" $TESTOUT
+       test $KILLSERVERS != no && kill -HUP $KILLPIDS
+       exit 1
+fi
+
 echo "Testing modify: valid remote record, combination add-modify-delete..."
 
 $LDAPMODIFY -v -D "$TRANSLUCENTROOT" -H $URI2 -w $PASSWD > \