1 /* compare.c - ldbm backend compare routine */
6 #include <sys/socket.h>
10 extern Entry *dn2entry();
11 extern Attribute *attr_find();
22 struct ldbminfo *li = (struct ldbminfo *) be->be_private;
28 if ( (e = dn2entry( be, dn, &matched )) == NULL ) {
29 send_ldap_result( conn, op, LDAP_NO_SUCH_OBJECT, matched, "" );
33 if ( ! access_allowed( be, conn, op, e, ava->ava_type, &ava->ava_value,
34 op->o_dn, ACL_COMPARE ) ) {
35 send_ldap_result( conn, op, LDAP_INSUFFICIENT_ACCESS, "", "" );
36 cache_return_entry( &li->li_cache, e );
40 if ( (a = attr_find( e->e_attrs, ava->ava_type )) == NULL ) {
41 send_ldap_result( conn, op, LDAP_NO_SUCH_ATTRIBUTE, "", "" );
42 cache_return_entry( &li->li_cache, e );
46 if ( value_find( a->a_vals, &ava->ava_value, a->a_syntax, 1 ) == 0 ) {
47 send_ldap_result( conn, op, LDAP_COMPARE_TRUE, "", "" );
48 cache_return_entry( &li->li_cache, e );
52 send_ldap_result( conn, op, LDAP_COMPARE_FALSE, "", "" );
53 cache_return_entry( &li->li_cache, e );