mirror of
https://git.openldap.org/openldap/openldap.git
synced 2026-01-04 14:10:39 -05:00
first (mostly blind) round
This commit is contained in:
parent
fc4d4e2f95
commit
a0ee0b21b1
3 changed files with 50 additions and 51 deletions
|
|
@ -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 );
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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 );
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Reference in a new issue