1 /* compare.c - ldbm backend compare routine */
11 #include "back-ldbm.h"
12 #include "proto-back-ldbm.h"
15 #ifdef SLAPD_ACLGROUPS
16 /* return 0 IFF edn is a value in member attribute
17 * of entry with bdn AND that entry has an objectClass
18 * value of groupOfNames
25 char *objectclassValue,
29 struct ldbminfo *li = (struct ldbminfo *) be->be_private;
32 Attribute *objectClass;
36 Debug( LDAP_DEBUG_TRACE, "=> ldbm_back_group: bdn: %s\n", bdn, 0, 0 );
37 Debug( LDAP_DEBUG_TRACE, "=> ldbm_back_group: edn: %s\n", edn, 0, 0 );
38 Debug( LDAP_DEBUG_TRACE, "=> ldbm_back_group: objectClass: %s attrName: %s\n",
39 objectclassValue, groupattrName, 0 );
41 /* can we find bdn entry with reader lock */
42 if ((e = dn2entry_r(be, bdn, &matched )) == NULL) {
43 Debug( LDAP_DEBUG_TRACE, "=> ldbm_back_group: cannot find bdn: %s matched: %s\n", bdn, (matched ? matched : ""), 0 );
49 Debug( LDAP_DEBUG_ARGS, "=> ldbm_back_group: found bdn: %s\n", bdn, 0, 0 );
51 /* check for deleted */
53 /* find it's objectClass and member attribute values
54 * make sure this is a group entry
55 * finally test if we can find edn in the member attribute value list *
59 if ((objectClass = attr_find(e->e_attrs, "objectclass")) == NULL) {
60 Debug( LDAP_DEBUG_TRACE, "<= ldbm_back_group: failed to find objectClass\n", 0, 0, 0 );
62 else if ((member = attr_find(e->e_attrs, groupattrName)) == NULL) {
63 Debug( LDAP_DEBUG_TRACE, "<= ldbm_back_group: failed to find %s\n", groupattrName, 0, 0 );
66 struct berval bvObjectClass;
67 struct berval bvMembers;
69 Debug( LDAP_DEBUG_ARGS, "<= ldbm_back_group: found objectClass and %s\n", groupattrName, 0, 0 );
71 bvObjectClass.bv_val = objectclassValue;
72 bvObjectClass.bv_len = strlen( bvObjectClass.bv_val );
74 bvMembers.bv_val = edn;
75 bvMembers.bv_len = strlen( edn );
77 if (value_find(objectClass->a_vals, &bvObjectClass, SYNTAX_CIS, 1) != 0) {
78 Debug( LDAP_DEBUG_TRACE,
79 "<= ldbm_back_group: failed to find %s in objectClass\n",
80 objectclassValue, 0, 0 );
82 else if (value_find(member->a_vals, &bvMembers, SYNTAX_CIS, 1) != 0) {
83 Debug( LDAP_DEBUG_ACL, "<= ldbm_back_group: %s not in %s: %s\n",
84 edn, bdn, groupattrName );
87 Debug( LDAP_DEBUG_ACL, "<= ldbm_back_group: %s is in %s: %s\n",
88 edn, bdn, groupattrName );
93 /* free entry and reader lock */
94 cache_return_entry_r( &li->li_cache, e );
95 Debug( LDAP_DEBUG_ARGS, "ldbm_back_group: rc: %d\n", rc, 0, 0 );
98 #endif /* SLAPD_ACLGROUPS */