From: Pierangelo Masarati Date: Mon, 31 Mar 2003 19:21:19 +0000 (+0000) Subject: first (mostly blind) round X-Git-Tag: AUTOCONF_2_57~136 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=a0ee0b21b1b4ccf5176068e1f21d4e52ef006fec;p=openldap first (mostly blind) round --- diff --git a/servers/slapd/back-monitor/compare.c b/servers/slapd/back-monitor/compare.c index dd929a5cf7..370afd3c32 100644 --- a/servers/slapd/back-monitor/compare.c +++ b/servers/slapd/back-monitor/compare.c @@ -39,70 +39,67 @@ #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 ); } diff --git a/servers/slapd/back-monitor/operational.c b/servers/slapd/back-monitor/operational.c index fcab8f811b..d41fe0219f 100644 --- a/servers/slapd/back-monitor/operational.c +++ b/servers/slapd/back-monitor/operational.c @@ -21,23 +21,21 @@ 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 ); diff --git a/servers/slapd/back-monitor/search.c b/servers/slapd/back-monitor/search.c index 99133e9081..eba79b7bbc 100644 --- a/servers/slapd/back-monitor/search.c +++ b/servers/slapd/back-monitor/search.c @@ -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;