]> git.sur5r.net Git - openldap/commitdiff
honor RFC4528 assertion control for LDAP add operations (ITS#5861; blind fix)
authorPierangelo Masarati <ando@openldap.org>
Sat, 20 Dec 2008 22:56:03 +0000 (22:56 +0000)
committerPierangelo Masarati <ando@openldap.org>
Sat, 20 Dec 2008 22:56:03 +0000 (22:56 +0000)
servers/slapd/back-sql/add.c

index 8b8100fbc0b6da47ade527b1dd7ad671cdf6eba2..a18e18e82708e097a6fca34231a75754b76577c7 100644 (file)
@@ -975,6 +975,17 @@ backsql_add( Operation *op, SlapReply *rs )
 
        slap_add_opattrs( op, &rs->sr_text, textbuf, textlen, 1 );
 
+       if ( get_assert( op ) &&
+               ( test_filter( op, op->ora_e, get_assertion( op )) != LDAP_COMPARE_TRUE ))
+       {
+               Debug( LDAP_DEBUG_TRACE, "   backsql_add(\"%s\"): "
+                       "assertion control failed -- aborting\n",
+                       op->ora_e->e_name.bv_val, 0, 0 );
+               e = NULL;
+               rs->sr_err = LDAP_ASSERTION_FAILED;
+               goto done;
+       }
+
        /* search structuralObjectClass */
        for ( at = op->ora_e->e_attrs; at != NULL; at = at->a_next ) {
                if ( at->a_desc == slap_schema.si_ad_structuralObjectClass ) {