]> git.sur5r.net Git - openldap/commitdiff
first (mostly blind) round
authorPierangelo Masarati <ando@openldap.org>
Mon, 31 Mar 2003 19:21:19 +0000 (19:21 +0000)
committerPierangelo Masarati <ando@openldap.org>
Mon, 31 Mar 2003 19:21:19 +0000 (19:21 +0000)
servers/slapd/back-monitor/compare.c
servers/slapd/back-monitor/operational.c
servers/slapd/back-monitor/search.c

index dd929a5cf77633a13f3e8ec34ccce759596717a2..370afd3c326f5003d643d6604f2408427e477d69 100644 (file)
 #include "back-monitor.h"
 
 int
-monitor_back_compare(
-       Backend                 *be,
-       Connection              *conn,
-       Operation               *op,
-       struct berval           *dn,
-       struct berval           *ndn,
-       AttributeAssertion      *ava
-)
+monitor_back_compare( struct slap_op *op, struct slap_rep *rs)
 {
-       struct monitorinfo      *mi = (struct monitorinfo *) be->be_private;            int             rc;
+       struct monitorinfo      *mi = 
+               (struct monitorinfo *) op->o_bd->be_private;
        Entry           *e, *matched = NULL;
        Attribute       *a;
 
        /* get entry with reader lock */
-       monitor_cache_dn2entry( mi, ndn, &e, &matched );
+       monitor_cache_dn2entry( mi, &op->o_req_ndn, &e, &matched );
        if ( e == NULL ) {
-               send_ldap_result( conn, op, LDAP_NO_SUCH_OBJECT,
-                               matched ? matched->e_dn : NULL,
-                               NULL, NULL, NULL );
                if ( matched ) {
+                       rs->sr_matched = ch_strdup( matched->e_dn );
                        monitor_cache_release( mi, matched );
                }
+               rs->sr_err = LDAP_NO_SUCH_OBJECT;
+
+               send_ldap_result( op, rs );
+
+               rs->sr_matched = NULL;
 
                return( 0 );
        }
 
-       rc = access_allowed( be, conn, op, e, ava->aa_desc, 
-                       &ava->aa_value, ACL_COMPARE, NULL );
-       if ( !rc ) {
-               send_ldap_result( conn, op, LDAP_INSUFFICIENT_ACCESS,
-                               NULL, NULL, NULL, NULL );
-               rc = 1;
+       rs->sr_err = access_allowed( op, e, op->oq_compare.rs_ava->aa_desc,
+                       &op->oq_compare.rs_ava->aa_value, ACL_COMPARE, NULL );
+       if ( !rs->sr_err ) {
+               rs->sr_err = LDAP_INSUFFICIENT_ACCESS;
                goto return_results;
        }
 
-       rc = LDAP_NO_SUCH_ATTRIBUTE;
+       rs->sr_err = LDAP_NO_SUCH_ATTRIBUTE;
 
-       for ( a = attrs_find( e->e_attrs, ava->aa_desc );
+       for ( a = attrs_find( e->e_attrs, op->oq_compare.rs_ava->aa_desc );
                        a != NULL;
-                       a = attrs_find( a->a_next, ava->aa_desc )) {
-               rc = LDAP_COMPARE_FALSE;
+                       a = attrs_find( a->a_next, op->oq_compare.rs_ava->aa_desc )) {
+               rs->sr_err = LDAP_COMPARE_FALSE;
 
 #ifdef SLAP_NVALUES
-               if ( value_find_ex( ava->aa_desc,
-                       SLAP_MR_ATTRIBUTE_VALUE_NORMALIZED_MATCH,
-                       a->a_nvals, &ava->aa_value ) == 0 )
+               if ( value_find_ex( op->oq_compare.rs_ava->aa_desc,
+                       SLAP_MR_ATTRIBUTE_VALUE_NORMALIZED_MATCH |
+                               SLAP_MR_ASSERTED_VALUE_NORMALIZED_MATCH,
+                       a->a_nvals, &op->oq_compare.rs_ava->aa_value ) == 0 )
 #else
-               if ( value_find( ava->aa_desc, a->a_vals, &ava->aa_value ) == 0 )
+               if ( value_find( ava->aa_desc, a->a_vals,
+                       &op->oq_compare.rs_ava->aa_value ) == 0 )
 #endif
                {
-                       rc = LDAP_COMPARE_TRUE;
+                       rs->sr_err = LDAP_COMPARE_TRUE;
                        break;
                }
        }
 
-       send_ldap_result( conn, op, rc, NULL, NULL, NULL, NULL );
-
-       if( rc != LDAP_NO_SUCH_ATTRIBUTE ) {
-               rc = 0;
-       }
-       
 return_results:;
+       send_ldap_result( op, rs );
+       if ( rs->sr_err == LDAP_COMPARE_FALSE
+                       || rs->sr_err == LDAP_COMPARE_TRUE ) {
+               rs->sr_err = LDAP_SUCCESS;
+       }
+
        monitor_cache_release( mi, e );
 
-       return( rc );
+       return( rs->sr_err );
 }
 
index fcab8f811bfb6050983ff80b9e55c07e6f60f483..d41fe0219fee06705024bc37750b8f86386f5f23 100644 (file)
 
 int
 monitor_back_operational(
-       BackendDB       *be,
-       Connection      *conn, 
        Operation       *op,
-       Entry           *e,
-       AttributeName   *attrs,
+       SlapReply       *rs,
        int             opattrs,
        Attribute       **a )
 {
        Attribute       **aa = a;
 
-       assert( e );
+       assert( rs->sr_entry );
 
-       if ( opattrs || ad_inlist( slap_schema.si_ad_hasSubordinates, attrs ) ) {
+       if ( opattrs || ad_inlist( slap_schema.si_ad_hasSubordinates,
+                               rs->sr_attrs ) ) {
                int                     hs;
                struct monitorentrypriv *mp;
 
-               mp = ( struct monitorentrypriv * )e->e_private;
+               mp = ( struct monitorentrypriv * )rs->sr_entry->e_private;
 
                assert( mp );
 
index 99133e90816f12acd3dcac10106d9e6c6d5bd0aa..eba79b7bbcc4a7eaee3f6f31b81c1d31d0e7af1d 100644 (file)
@@ -135,7 +135,8 @@ monitor_send_children(
 }
 
 int
-monitor_back_search(
+monitor_back_search( Operation *op, SlapReply *rs )
+       /*
        Backend         *be,
        Connection      *conn,
        Operation       *op,
@@ -148,10 +149,11 @@ monitor_back_search(
        Filter          *filter,
        struct berval   *filterstr,
        AttributeName   *attrs,
-       int             attrsonly 
-)
+       int             attrsonly
+       */
 {
-       struct monitorinfo      *mi = (struct monitorinfo *) be->be_private;
+       struct monitorinfo      *mi
+               = (struct monitorinfo *) op->o_bd->be_private;
        int             rc = LDAP_SUCCESS;
        Entry           *e, *matched = NULL;
        int             nentries = 0;
@@ -165,16 +167,18 @@ monitor_back_search(
 
 
        /* get entry with reader lock */
-       monitor_cache_dn2entry( mi, nbase, &e, &matched );
+       monitor_cache_dn2entry( mi, &op->o_req_ndn, &e, &matched );
        if ( e == NULL ) {
-               send_ldap_result( conn, op, LDAP_NO_SUCH_OBJECT,
-                       matched ? matched->e_dn : NULL, 
-                       NULL, NULL, NULL );
+               rs->sr_err = LDAP_NO_SUCH_OBJECT;
                if ( matched ) {
+                       rs->sr_matched = ch_strdup( matched->e_dn );
                        monitor_cache_release( mi, matched );
                }
 
-               return( rc );
+               send_ldap_result( op, rs );
+               rs->sr_matched = NULL;
+
+               return( 0 );
        }
 
        nentries = 0;