]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/back-ldap/group.c
Add start of discussion of strings in LDAP/X.500 and OpenLDAP.
[openldap] / servers / slapd / back-ldap / group.c
index 53283ebc7943ae1aad27deae7ebbe0e44258051c..5581cdfc642a30418a4f41da49316140748ce830 100644 (file)
@@ -1,7 +1,7 @@
 /* group.c - ldap backend acl group routine */
 /* $OpenLDAP$ */
 /*
- * Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved.
+ * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
  */
 
@@ -14,7 +14,7 @@
 
 #include "slap.h"
 #include "back-ldap.h"
-
+#include "lutil.h"
 
 /* return 0 IFF op_dn is a value in group_at (member) attribute
  * of entry with gr_dn AND that entry has an objectClass
@@ -54,8 +54,7 @@ ldap_back_group(
        if (group_oc_name.bv_val)
                group_oc_name.bv_len = strlen(group_oc_name.bv_val);
 
-       if (target != NULL && target->e_nname.bv_len == gr_ndn->bv_len &&
-               strcmp(target->e_nname.bv_val, gr_ndn->bv_val) == 0) {
+       if (target != NULL && dn_match( &target->e_nname, gr_ndn ) ) {
                /* we already have a copy of the entry */
                /* attribute and objectclass mapping has already been done */
 
@@ -69,7 +68,7 @@ ldap_back_group(
                        /*
                         * Now we can check for the group objectClass value
                         */
-                       if( !is_entry_objectclass( target, group_oc ) ) {
+                       if( !is_entry_objectclass( target, group_oc, 0 ) ) {
                                return(1);
                        }
 
@@ -101,9 +100,9 @@ ldap_back_group(
                        mop_ndn = *op_ndn;
                }
 #ifdef NEW_LOGGING
-               LDAP_LOG(( "backend", LDAP_LEVEL_DETAIL1,
-                               "[rw] bindDn (op ndn in group):"
-                               " \"%s\" -> \"%s\"\n", op_ndn->bv_val, mop_ndn.bv_val ));
+               LDAP_LOG( BACK_LDAP, DETAIL1, 
+                       "[rw] bindDn (op ndn in group): \"%s\" -> \"%s\"\n", 
+                       op_ndn->bv_val, mop_ndn.bv_val, 0 );
 #else /* !NEW_LOGGING */
                Debug( LDAP_DEBUG_ARGS,
                        "rw> bindDn (op ndn in group): \"%s\" -> \"%s\"\n%s",
@@ -127,9 +126,9 @@ ldap_back_group(
                        mgr_ndn = *gr_ndn;
                }
 #ifdef NEW_LOGGING
-               LDAP_LOG(( "backend", LDAP_LEVEL_DETAIL1,
-                               "[rw] searchBase (gr ndn in group):"
-                               " \"%s\" -> \"%s\"\n%s", gr_ndn->bv_val, mgr_ndn.bv_val ));
+               LDAP_LOG( BACK_LDAP, DETAIL1, 
+                       "[rw] searchBase (gr ndn in group): \"%s\" -> \"%s\"\n%s", 
+                       gr_ndn->bv_val, mgr_ndn.bv_val, "" );
 #else /* !NEW_LOGGING */
                Debug( LDAP_DEBUG_ARGS,
                        "rw> searchBase (gr ndn in group):"
@@ -177,12 +176,12 @@ ldap_back_group(
                goto cleanup;
        }
 
-       ptr = slap_strcopy(filter, "(&(objectclass=");
-       ptr = slap_strcopy(ptr, group_oc_name.bv_val);
-       ptr = slap_strcopy(ptr, ")(");
-       ptr = slap_strcopy(ptr, group_at_name.bv_val);
-       ptr = slap_strcopy(ptr, "=");
-       ptr = slap_strcopy(ptr, mop_ndn.bv_val);
+       ptr = lutil_strcopy(filter, "(&(objectclass=");
+       ptr = lutil_strcopy(ptr, group_oc_name.bv_val);
+       ptr = lutil_strcopy(ptr, ")(");
+       ptr = lutil_strcopy(ptr, group_at_name.bv_val);
+       ptr = lutil_strcopy(ptr, "=");
+       ptr = lutil_strcopy(ptr, mop_ndn.bv_val);
        strcpy(ptr, "))");
 
        gattr[0] = "objectclass";