1 /* compare.c - ldbm backend compare routine */
6 #include <sys/socket.h>
9 #include "proto-back-ldbm.h"
11 extern Attribute *attr_find();
15 /* return 0 IFF edn is a value in uniqueMember attribute
16 * of entry with bdn AND that entry has an objectClass
17 * value of groupOfUniqueNames
26 struct ldbminfo *li = (struct ldbminfo *) be->be_private;
29 Attribute *objectClass;
30 Attribute *uniqueMember;
33 Debug( LDAP_DEBUG_TRACE, "=> ldbm_back_group: bdn: %s\n", bdn, 0, 0 );
34 Debug( LDAP_DEBUG_TRACE, "=> ldbm_back_group: edn: %s\n", edn, 0, 0 );
36 /* can we find bdn entry with reader lock */
37 if ((e = dn2entry_r(be, bdn, &matched )) == NULL) {
38 Debug( LDAP_DEBUG_TRACE, "=> ldbm_back_group: cannot find bdn: %s matched: %x\n", bdn, matched, 0 );
43 Debug( LDAP_DEBUG_ARGS, "=> ldbm_back_group: found bdn: %s matched: %x\n", bdn, matched, 0 );
45 /* check for deleted */
47 /* find it's objectClass and uniqueMember attribute values
48 * make sure this is a group entry
49 * finally test if we can find edn in the uniqueMember attribute value list *
53 if ((objectClass = attr_find(e->e_attrs, "objectclass")) == NULL) {
54 Debug( LDAP_DEBUG_TRACE, "<= ldbm_back_group: failed to find objectClass\n", 0, 0, 0 );
56 else if ((uniqueMember = attr_find(e->e_attrs, "uniquemember")) == NULL) {
57 Debug( LDAP_DEBUG_TRACE, "<= ldbm_back_group: failed to find uniqueMember\n", 0, 0, 0 );
60 struct berval bvObjectClass;
61 struct berval bvUniqueMembers;
63 Debug( LDAP_DEBUG_ARGS, "<= ldbm_back_group: found objectClass and uniqueMembers\n", 0, 0, 0 );
65 bvObjectClass.bv_val = "groupofuniquenames";
66 bvObjectClass.bv_len = strlen( bvObjectClass.bv_val );
67 bvUniqueMembers.bv_val = edn;
68 bvUniqueMembers.bv_len = strlen( edn );
70 if (value_find(objectClass->a_vals, &bvObjectClass, SYNTAX_CIS, 1) != 0) {
71 Debug( LDAP_DEBUG_TRACE, "<= ldbm_back_group: failed to find objectClass in groupOfUniqueNames\n",
74 else if (value_find(uniqueMember->a_vals, &bvUniqueMembers, SYNTAX_CIS, 1) != 0) {
75 Debug( LDAP_DEBUG_ACL, "<= ldbm_back_group: %s not in %s: groupOfUniqueNames\n",
79 Debug( LDAP_DEBUG_ACL, "<= ldbm_back_group: %s is in %s: groupOfUniqueNames\n",
85 /* free entry and reader lock */
86 cache_return_entry_r( &li->li_cache, e );
87 Debug( LDAP_DEBUG_ARGS, "ldbm_back_group: rc: %d\n", rc, 0, 0 );