]> git.sur5r.net Git - openldap/commitdiff
if referential integrity is broken, things could go wrong; don't assert
authorPierangelo Masarati <ando@openldap.org>
Thu, 27 Dec 2007 20:57:42 +0000 (20:57 +0000)
committerPierangelo Masarati <ando@openldap.org>
Thu, 27 Dec 2007 20:57:42 +0000 (20:57 +0000)
servers/slapd/overlays/memberof.c

index 9ca4c8685671928203f19cf321078ed6334dcbc3..45c388650d4f8ac67dae28b47df751bd651709f6 100644 (file)
@@ -264,6 +264,7 @@ memberof_saveMember_cb( Operation *op, SlapReply *rs )
        if ( rs->sr_type == REP_SEARCH ) {
                memberof_cookie_t       *mc;
                Attribute               *a;
+               BerVarray               vals = NULL;
 
                mc = (memberof_cookie_t *)op->o_callback->sc_private;
                mc->foundit = 1;
@@ -272,12 +273,13 @@ memberof_saveMember_cb( Operation *op, SlapReply *rs )
                assert( rs->sr_entry->e_attrs != NULL );
 
                a = attr_find( rs->sr_entry->e_attrs, mc->ad );
+               if ( a != NULL ) {
+                       vals = a->a_nvals;
+               }
 
-               assert( a != NULL );
-
-               memberof_saved_member_set( op, mc->key, a->a_nvals );
+               memberof_saved_member_set( op, mc->key, vals );
 
-               if ( attr_find( a->a_next, mc->ad ) != NULL ) {
+               if ( a && attr_find( a->a_next, mc->ad ) != NULL ) {
                        Debug( LDAP_DEBUG_ANY,
                                "%s: memberof_saveMember_cb(\"%s\"): "
                                "more than one occurrence of \"%s\" "