]> git.sur5r.net Git - openldap/commitdiff
ITS#6670 partial fix - ignore member/memberof pointing to same entry
authorHoward Chu <hyc@openldap.org>
Fri, 31 Dec 2010 01:38:24 +0000 (01:38 +0000)
committerHoward Chu <hyc@openldap.org>
Fri, 31 Dec 2010 01:38:24 +0000 (01:38 +0000)
servers/slapd/overlays/memberof.c

index f17d75bb6ca4c9abfe35598b1296f88758dc7c26..1771febb1e6540d2d4e50f0f85bdd101ec796a60 100644 (file)
@@ -534,6 +534,10 @@ memberof_op_add( Operation *op, SlapReply *rs )
                        for ( i = 0; !BER_BVISNULL( &a->a_nvals[ i ] ); i++ ) {
                                Entry           *e = NULL;
 
+                               /* ITS#6670 Ignore member pointing to this entry */
+                               if ( dn_match( &a->a_nvals[i], &save_ndn ))
+                                       continue;
+
                                rc = be_entry_get_rw( op, &a->a_nvals[ i ],
                                                NULL, NULL, 0, &e );
                                if ( rc == LDAP_SUCCESS ) {
@@ -612,6 +616,10 @@ memberof_op_add( Operation *op, SlapReply *rs )
                                send_ldap_result( op, rs );
                                goto done;
                        }
+                       /* ITS#6670 Ignore member pointing to this entry */
+                       if ( dn_match( &a->a_nvals[i], &save_ndn ))
+                               continue;
+
                        rc = be_entry_get_rw( op, &a->a_nvals[ i ],
                                        NULL, NULL, 0, &e );
                        op->o_bd->bd_info = (BackendInfo *)on;
@@ -819,6 +827,10 @@ memberof_op_modify( Operation *op, SlapReply *rs )
                                                int             rc;
                                                Entry           *e;
                
+                                               /* ITS#6670 Ignore member pointing to this entry */
+                                               if ( dn_match( &ml->sml_nvalues[i], &save_ndn ))
+                                                       continue;
+
                                                if ( be_entry_get_rw( op, &ml->sml_nvalues[ i ],
                                                                NULL, NULL, 0, &e ) == LDAP_SUCCESS )
                                                {
@@ -1030,6 +1042,10 @@ memberof_op_modify( Operation *op, SlapReply *rs )
                                        goto done2;
                                }
 
+                               /* ITS#6670 Ignore member pointing to this entry */
+                               if ( dn_match( &ml->sml_nvalues[i], &save_ndn ))
+                                       continue;
+
                                rc = be_entry_get_rw( op, &ml->sml_nvalues[ i ],
                                                NULL, NULL, 0, &e );
                                op->o_bd->bd_info = (BackendInfo *)on;
@@ -1189,6 +1205,10 @@ memberof_res_add( Operation *op, SlapReply *rs )
 
                        for ( i = 0; !BER_BVISNULL( &ma->a_nvals[ i ] ); i++ ) {
                
+                               /* ITS#6670 Ignore member pointing to this entry */
+                               if ( dn_match( &ma->a_nvals[i], &op->o_req_ndn ))
+                                       continue;
+
                                /* the modification is attempted
                                 * with the original identity */
                                memberof_value_modify( op,
@@ -1206,6 +1226,10 @@ memberof_res_add( Operation *op, SlapReply *rs )
                                a = attrs_find( a->a_next, mo->mo_ad_member ) )
                {
                        for ( i = 0; !BER_BVISNULL( &a->a_nvals[ i ] ); i++ ) {
+                               /* ITS#6670 Ignore member pointing to this entry */
+                               if ( dn_match( &a->a_nvals[i], &op->o_req_ndn ))
+                                       continue;
+
                                memberof_value_modify( op,
                                                &a->a_nvals[ i ],
                                                mo->mo_ad_memberof,