]> git.sur5r.net Git - openldap/commitdiff
move compare and delete to struct berval DNs
authorKurt Zeilenga <kurt@openldap.org>
Wed, 26 Dec 2001 19:05:26 +0000 (19:05 +0000)
committerKurt Zeilenga <kurt@openldap.org>
Wed, 26 Dec 2001 19:05:26 +0000 (19:05 +0000)
servers/slapd/back-bdb/compare.c
servers/slapd/back-bdb/delete.c
servers/slapd/back-ldbm/compare.c
servers/slapd/back-ldbm/delete.c
servers/slapd/back-monitor/compare.c
servers/slapd/backglue.c
servers/slapd/compare.c
servers/slapd/delete.c
servers/slapd/slap.h

index 35e150830497b6c1e955be103468effdc71804c3..71b072ae3b68e0e7d48c79a6759e51608f037aad 100644 (file)
@@ -18,8 +18,8 @@ bdb_compare(
        BackendDB       *be,
        Connection      *conn,
        Operation       *op,
-       const char      *dn,
-       const char      *ndn,
+       struct berval   *dn,
+       struct berval   *ndn,
        AttributeAssertion *ava
 )
 {
@@ -32,7 +32,7 @@ bdb_compare(
        int             manageDSAit = get_manageDSAit( op );
 
        /* get entry */
-       rc = bdb_dn2entry( be, NULL, ndn, &e, &matched, 0 );
+       rc = bdb_dn2entry( be, NULL, ndn->bv_val, &e, &matched, 0 );
 
        switch( rc ) {
        case DB_NOTFOUND:
@@ -52,14 +52,14 @@ bdb_compare(
                        matched_dn = ch_strdup( matched->e_dn );
                        refs = is_entry_referral( matched )
                                ? get_entry_referrals( be, conn, op, matched,
-                                       dn, LDAP_SCOPE_DEFAULT )
+                                       dn->bv_val, LDAP_SCOPE_DEFAULT )
                                : NULL;
                        bdb_entry_return( be, matched );
                        matched = NULL;
 
                } else {
                        refs = referral_rewrite( default_referral,
-                               NULL, dn, LDAP_SCOPE_DEFAULT );
+                               NULL, dn->bv_val, LDAP_SCOPE_DEFAULT );
                }
 
                send_ldap_result( conn, op, rc = LDAP_REFERRAL,
@@ -74,7 +74,7 @@ bdb_compare(
        if (!manageDSAit && is_entry_referral( e ) ) {
                /* entry is a referral, don't allow add */
                struct berval **refs = get_entry_referrals( be,
-                       conn, op, e, dn, LDAP_SCOPE_DEFAULT );
+                       conn, op, e, dn->bv_val, LDAP_SCOPE_DEFAULT );
 
                Debug( LDAP_DEBUG_TRACE, "entry is referral\n", 0,
                        0, 0 );
index 9822076ef37b56a3efce4ae116f259242da0ce4c..30e2bc63506f7042aadb54fed2763b2e5a3213d3 100644 (file)
@@ -18,8 +18,8 @@ bdb_delete(
        BackendDB       *be,
        Connection      *conn,
        Operation       *op,
-       const char      *dn,
-       const char      *ndn
+       struct berval   *dn,
+       struct berval   *ndn
 )
 {
        struct bdb_info *bdb = (struct bdb_info *) be->be_private;
@@ -33,11 +33,13 @@ bdb_delete(
        DB_TXN          *ltid = NULL;
        struct bdb_op_info opinfo;
 
-       Debug( LDAP_DEBUG_ARGS, "==> bdb_delete: %s\n", dn, 0, 0 );
+       Debug( LDAP_DEBUG_ARGS, "==> bdb_delete: %s\n",
+               dn->bv_val, 0, 0 );
 
        if( 0 ) {
 retry: /* transaction retry */
-               Debug( LDAP_DEBUG_TRACE, "==> bdb_delete: retrying...\n", 0, 0, 0 );
+               Debug( LDAP_DEBUG_TRACE, "==> bdb_delete: retrying...\n",
+                       0, 0, 0 );
                rc = txn_abort( ltid );
                ltid = NULL;
                op->o_private = NULL;
@@ -69,7 +71,7 @@ retry:        /* transaction retry */
        op->o_private = &opinfo;
 
        /* get entry for read/modify/write */
-       rc = bdb_dn2entry( be, ltid, ndn, &e, &matched, DB_RMW );
+       rc = bdb_dn2entry( be, ltid, ndn->bv_val, &e, &matched, DB_RMW );
 
        switch( rc ) {
        case 0:
@@ -96,14 +98,14 @@ retry:      /* transaction retry */
                        matched_dn = ch_strdup( matched->e_dn );
                        refs = is_entry_referral( matched )
                                ? get_entry_referrals( be, conn, op, matched,
-                                       dn, LDAP_SCOPE_DEFAULT )
+                                       dn->bv_val, LDAP_SCOPE_DEFAULT )
                                : NULL;
                        bdb_entry_return( be, matched );
                        matched = NULL;
 
                } else {
                        refs = referral_rewrite( default_referral,
-                               NULL, dn, LDAP_SCOPE_DEFAULT );
+                               NULL, dn->bv_val, LDAP_SCOPE_DEFAULT );
                }
 
                send_ldap_result( conn, op, LDAP_REFERRAL,
@@ -116,7 +118,7 @@ retry:      /* transaction retry */
                goto done;
        }
 
-       pdn = dn_parent( be, ndn );
+       pdn = dn_parent( be, ndn->bv_val );
 
        if( pdn != NULL && *pdn != '\0' ) {
                /* get parent */
@@ -192,7 +194,7 @@ retry:      /* transaction retry */
                /* parent is a referral, don't allow add */
                /* parent is an alias, don't allow add */
                struct berval **refs = get_entry_referrals( be,
-                       conn, op, e, dn, LDAP_SCOPE_DEFAULT );
+                       conn, op, e, dn->bv_val, LDAP_SCOPE_DEFAULT );
 
                Debug( LDAP_DEBUG_TRACE,
                        "bdb_delete: entry is referral\n",
index 3a7245ec7ece48944aafb70affc949b5a1b107ff..a1b49111a6fb6942f4e9a0fe22537a62346ee2e3 100644 (file)
@@ -21,8 +21,8 @@ ldbm_back_compare(
     Backend    *be,
     Connection *conn,
     Operation  *op,
-    const char *dn,
-    const char *ndn,
+    struct berval      *dn,
+    struct berval      *ndn,
        AttributeAssertion *ava
 )
 {
@@ -34,7 +34,7 @@ ldbm_back_compare(
        int             manageDSAit = get_manageDSAit( op );
 
        /* get entry with reader lock */
-       if ( (e = dn2entry_r( be, ndn, &matched )) == NULL ) {
+       if ( (e = dn2entry_r( be, ndn->bv_val, &matched )) == NULL ) {
                char *matched_dn = NULL;
                struct berval **refs = NULL;
 
@@ -42,12 +42,12 @@ ldbm_back_compare(
                        matched_dn = ch_strdup( matched->e_dn );
                        refs = is_entry_referral( matched )
                                ? get_entry_referrals( be, conn, op, matched,
-                                       dn, LDAP_SCOPE_DEFAULT )
+                                       dn->bv_val, LDAP_SCOPE_DEFAULT )
                                : NULL;
                        cache_return_entry_r( &li->li_cache, matched );
                } else {
                        refs = referral_rewrite( default_referral,
-                               NULL, dn, LDAP_SCOPE_DEFAULT );
+                               NULL, dn->bv_val, LDAP_SCOPE_DEFAULT );
                }
 
                send_ldap_result( conn, op, LDAP_REFERRAL,
@@ -62,11 +62,11 @@ ldbm_back_compare(
        if (!manageDSAit && is_entry_referral( e ) ) {
                /* entry is a referral, don't allow add */
                struct berval **refs = get_entry_referrals( be,
-                       conn, op, e, dn, LDAP_SCOPE_DEFAULT );
+                       conn, op, e, dn->bv_val, LDAP_SCOPE_DEFAULT );
 
 #ifdef NEW_LOGGING
                LDAP_LOG(( "backend", LDAP_LEVEL_INFO,
-                          "ldbm_back_compare: entry (%s) is a referral.\n", e->e_dn ));
+                       "ldbm_back_compare: entry (%s) is a referral.\n", e->e_dn ));
 #else
                Debug( LDAP_DEBUG_TRACE, "entry is referral\n", 0,
                    0, 0 );
index f92bd24a4de8b94ebd479e5467e6bf0005b8489c..c1d619841de67e7f99048d47f133e39f8b9915c9 100644 (file)
@@ -21,8 +21,8 @@ ldbm_back_delete(
     Backend    *be,
     Connection *conn,
     Operation  *op,
-    const char *dn,
-    const char *ndn
+    struct berval      *dn,
+    struct berval      *ndn
 )
 {
        struct ldbminfo *li = (struct ldbminfo *) be->be_private;
@@ -36,35 +36,35 @@ ldbm_back_delete(
 
 #ifdef NEW_LOGGING
        LDAP_LOG(( "backend", LDAP_LEVEL_ENTRY,
-               "ldbm_back_delete: %s\n", dn ));
+               "ldbm_back_delete: %s\n", dn->bv_val ));
 #else
-       Debug(LDAP_DEBUG_ARGS, "==> ldbm_back_delete: %s\n", dn, 0, 0);
+       Debug(LDAP_DEBUG_ARGS, "==> ldbm_back_delete: %s\n", dn->bv_val, 0, 0);
 #endif
 
        /* get entry with writer lock */
-       if ( (e = dn2entry_w( be, ndn, &matched )) == NULL ) {
+       if ( (e = dn2entry_w( be, ndn->bv_val, &matched )) == NULL ) {
                char *matched_dn = NULL;
                struct berval **refs;
 
 #ifdef NEW_LOGGING
                LDAP_LOG(( "backend", LDAP_LEVEL_INFO,
-                       "ldbm_back_delete: no such object %s\n", dn ));
+                       "ldbm_back_delete: no such object %s\n", dn->bv_val ));
 #else
                Debug(LDAP_DEBUG_ARGS, "<=- ldbm_back_delete: no such object %s\n",
-                       dn, 0, 0);
+                       dn->bv_val, 0, 0);
 #endif
 
                if ( matched != NULL ) {
                        matched_dn = ch_strdup( matched->e_dn );
                        refs = is_entry_referral( matched )
                                ? get_entry_referrals( be, conn, op, matched,
-                                       dn, LDAP_SCOPE_DEFAULT )
+                                       dn->bv_val, LDAP_SCOPE_DEFAULT )
                                : NULL;
                        cache_return_entry_r( &li->li_cache, matched );
 
                } else {
                        refs = referral_rewrite( default_referral,
-                               NULL, dn, LDAP_SCOPE_DEFAULT );
+                               NULL, dn->bv_val, LDAP_SCOPE_DEFAULT );
                }
 
                send_ldap_result( conn, op, LDAP_REFERRAL,
@@ -80,12 +80,12 @@ ldbm_back_delete(
                /* parent is a referral, don't allow add */
                /* parent is an alias, don't allow add */
                struct berval **refs = get_entry_referrals( be,
-                       conn, op, e, dn, LDAP_SCOPE_DEFAULT );
+                       conn, op, e, dn->bv_val, LDAP_SCOPE_DEFAULT );
 
 #ifdef NEW_LOGGING
                LDAP_LOG(( "backend", LDAP_LEVEL_INFO,
-                          "ldbm_back_delete: entry (%s) is a referral.\n",
-                          e->e_dn ));
+                       "ldbm_back_delete: entry (%s) is a referral.\n",
+                       e->e_dn ));
 #else
                Debug( LDAP_DEBUG_TRACE, "entry is referral\n", 0,
                    0, 0 );
@@ -121,7 +121,7 @@ ldbm_back_delete(
                if( (p = dn2entry_w( be, pdn, NULL )) == NULL) {
 #ifdef NEW_LOGGING
                        LDAP_LOG(( "backend", LDAP_LEVEL_ERR,
-                                  "ldbm_back_delete: parent of (%s) does not exist\n", dn ));
+                               "ldbm_back_delete: parent of (%s) does not exist\n", dn ));
 #else
                        Debug( LDAP_DEBUG_TRACE,
                                "<=- ldbm_back_delete: parent does not exist\n",
@@ -139,7 +139,8 @@ ldbm_back_delete(
                {
 #ifdef NEW_LOGGING
                        LDAP_LOG(( "backend", LDAP_LEVEL_ERR,
-                                  "ldbm_back_delete: no access to parent of (%s)\n", dn ));
+                               "ldbm_back_delete: no access to parent of (%s)\n",
+                               dn->bv_val ));
 #else
                        Debug( LDAP_DEBUG_TRACE,
                                "<=- ldbm_back_delete: no access to parent\n", 0,
@@ -158,7 +159,7 @@ ldbm_back_delete(
                                p = (Entry *)&slap_entry_root;
                                
                                rc = access_allowed( be, conn, op, p,
-                                               children, NULL, ACL_WRITE );
+                                       children, NULL, ACL_WRITE );
                                p = NULL;
                                                                
                                /* check parent for "children" acl */
@@ -182,8 +183,8 @@ ldbm_back_delete(
                        } else {
 #ifdef NEW_LOGGING
                                LDAP_LOG(( "backend", LDAP_LEVEL_ERR,
-                                          "ldbm_back_delete: (%s) has no "
-                                          "parent & not a root.\n", dn ));
+                                       "ldbm_back_delete: (%s) has no "
+                                       "parent & not a root.\n", dn ));
 #else
                                Debug( LDAP_DEBUG_TRACE,
                                        "<=- ldbm_back_delete: no parent & "
@@ -205,11 +206,12 @@ ldbm_back_delete(
        if ( dn2id_delete( be, e->e_ndn, e->e_id ) != 0 ) {
 #ifdef NEW_LOGGING
                LDAP_LOG(( "backend", LDAP_LEVEL_ERR,
-                          "ldbm_back_delete: (%s) operations error\n", dn ));
+                       "ldbm_back_delete: (%s) operations error\n",
+                       dn->bv_val ));
 #else
                Debug(LDAP_DEBUG_ARGS,
                        "<=- ldbm_back_delete: operations error %s\n",
-                       dn, 0, 0);
+                       dn->bv_val, 0, 0);
 #endif
 
                send_ldap_result( conn, op, LDAP_OTHER,
@@ -221,12 +223,12 @@ ldbm_back_delete(
        if ( id2entry_delete( be, e ) != 0 ) {
 #ifdef NEW_LOGGING
                LDAP_LOG(( "backend", LDAP_LEVEL_ERR,
-                          "ldbm_back_delete: (%s) operations error\n",
-                          dn ));
+                       "ldbm_back_delete: (%s) operations error\n",
+                       dn->bv_val ));
 #else
                Debug(LDAP_DEBUG_ARGS,
                        "<=- ldbm_back_delete: operations error %s\n",
-                       dn, 0, 0);
+                       dn->bv_val, 0, 0);
 #endif
 
                send_ldap_result( conn, op, LDAP_OTHER,
index acaf766bcbb6b2d22bcbd9ad5d4927c19a1beb4e..9e82f0c33b25cd37d3c2efcb7c6f24d6c3e66c95 100644 (file)
 int
 monitor_back_compare(
        Backend                 *be,
-       Connection              *conn,
-       Operation               *op,
-       const char              *dn,
-       const char              *ndn,
+       Connection              *conn,
+       Operation               *op,
+       struct berval           *dn,
+       struct berval           *ndn,
        AttributeAssertion      *ava
 )
 {
@@ -56,7 +56,7 @@ monitor_back_compare(
        Attribute       *a;
 
        /* get entry with reader lock */
-       monitor_cache_dn2entry( mi, ndn, &e, &matched );
+       monitor_cache_dn2entry( mi, ndn->bv_val, &e, &matched );
        if ( e == NULL ) {
                send_ldap_result( conn, op, LDAP_NO_SUCH_OBJECT,
                                matched ? matched->e_dn : NULL,
@@ -64,7 +64,7 @@ monitor_back_compare(
                if ( matched ) {
                        monitor_cache_release( mi, matched );
                }
-               
+
                return( 0 );
        }
 
@@ -78,21 +78,20 @@ monitor_back_compare(
        }
 
        rc = LDAP_NO_SUCH_ATTRIBUTE;
-       
+
        for ( a = attrs_find( e->e_attrs, ava->aa_desc );
                        a != NULL;
                        a = attrs_find( a->a_next, ava->aa_desc )) {
                rc = LDAP_COMPARE_FALSE;
-               
+
                if ( value_find( ava->aa_desc, a->a_vals, ava->aa_value ) == 0 ) {
-                                                                       
                        rc = LDAP_COMPARE_TRUE;
                        break;
                }
        }
-       
+
        send_ldap_result( conn, op, rc, NULL, NULL, NULL, NULL );
-       
+
        if( rc != LDAP_NO_SUCH_ATTRIBUTE ) {
                rc = 0;
        }
index e03fbfcee89326c8566ea17bcbb99c41be31928b..cd773ba8168dcfd83dfda940b89baf9543485409 100644 (file)
@@ -397,22 +397,22 @@ glue_back_compare (
        BackendDB *b0,
        Connection *conn,
        Operation *op,
-       const char *dn,
-       const char *ndn,
+       struct berval *dn,
+       struct berval *ndn,
        AttributeAssertion *ava
 )
 {
        BackendDB *be;
        int rc;
 
-       be = glue_back_select (b0, ndn);
+       be = glue_back_select (b0, ndn->bv_val);
 
        if (be && be->be_compare) {
                rc = be->be_compare (be, conn, op, dn, ndn, ava);
        } else {
                rc = LDAP_UNWILLING_TO_PERFORM;
                send_ldap_result (conn, op, rc, NULL, "No compare target found",
-                                 NULL, NULL);
+                       NULL, NULL);
        }
        return rc;
 }
@@ -497,14 +497,14 @@ glue_back_delete (
        BackendDB *b0,
        Connection *conn,
        Operation *op,
-       const char *dn,
-       const char *ndn
+       struct berval *dn,
+       struct berval *ndn
 )
 {
        BackendDB *be;
        int rc;
 
-       be = glue_back_select (b0, ndn);
+       be = glue_back_select (b0, ndn->bv_val);
 
        if (be && be->be_delete) {
                rc = be->be_delete (be, conn, op, dn, ndn);
index 58cbe2a32d2bc8e9efad8f87658b958f89231526..fafdd815b1cbe4b92d731a46d8b6947b8784303c 100644 (file)
@@ -284,7 +284,7 @@ do_compare(
        suffix_alias( be, ndn );
 
        if ( be->be_compare ) {
-               (*be->be_compare)( be, conn, op, pdn->bv_val, ndn->bv_val, &ava );
+               (*be->be_compare)( be, conn, op, pdn, ndn, &ava );
        } else {
                send_ldap_result( conn, op, rc = LDAP_UNWILLING_TO_PERFORM,
                        NULL, "operation not supported within namingContext",
index e579d983714b7d146ecfb60d6ec0c0d48c1925a1..dc5393c596791f1fd9da9e5eaabd360bfb89d8a4 100644 (file)
@@ -184,7 +184,7 @@ do_delete(
                if ( !be->be_update_ndn.bv_len || repl_user )
 #endif
                {
-                       if ( (*be->be_delete)( be, conn, op, pdn->bv_val, ndn->bv_val ) == 0 ) {
+                       if ( (*be->be_delete)( be, conn, op, pdn, ndn ) == 0 ) {
 #ifdef SLAPD_MULTIMASTER
                                if ( !be->be_update_ndn.bv_len || !repl_user )
 #endif
index 51f5106bd1770d4086fdd6bc6d8d5e9dceafc35f..75695c76cf89a3e238d38f189aef46d4d12d68a7 100644 (file)
@@ -1048,7 +1048,7 @@ typedef int (BI_op_search) LDAP_P((BackendDB *bd,
                struct berval **attrs, int attrsonly));
 typedef int (BI_op_compare)LDAP_P((BackendDB *bd,
                struct slap_conn *c, struct slap_op *o,
-               const char *dn, const char *ndn,
+               struct berval *dn, struct berval *ndn,
                AttributeAssertion *ava));
 typedef int (BI_op_modify) LDAP_P((BackendDB *bd,
                struct slap_conn *c, struct slap_op *o,
@@ -1063,7 +1063,7 @@ typedef int (BI_op_add)    LDAP_P((BackendDB *bd,
                Entry *e));
 typedef int (BI_op_delete) LDAP_P((BackendDB *bd,
                struct slap_conn *c, struct slap_op *o,
-               const char *dn, const char *ndn));
+               struct berval *dn, struct berval *ndn));
 typedef int (BI_op_abandon) LDAP_P((BackendDB *bd,
                struct slap_conn *c, struct slap_op *o,
                ber_int_t msgid));
@@ -1094,6 +1094,7 @@ typedef int (BI_acl_group)  LDAP_P((Backend *bd,
                Entry *e, const char *bdn, const char *edn,
                ObjectClass *group_oc,
                AttributeDescription *group_at ));
+
 typedef int (BI_acl_attribute)  LDAP_P((Backend *bd,
                struct slap_conn *c, struct slap_op *o,
                Entry *e, const char *edn,