]> git.sur5r.net Git - openldap/commitdiff
Move search, modify, and modrdn APIs to struct berval DNs.
authorKurt Zeilenga <kurt@openldap.org>
Wed, 26 Dec 2001 19:50:40 +0000 (19:50 +0000)
committerKurt Zeilenga <kurt@openldap.org>
Wed, 26 Dec 2001 19:50:40 +0000 (19:50 +0000)
Much clean up is needed.

13 files changed:
servers/slapd/back-bdb/modify.c
servers/slapd/back-bdb/modrdn.c
servers/slapd/back-bdb/search.c
servers/slapd/back-ldbm/modify.c
servers/slapd/back-ldbm/modrdn.c
servers/slapd/back-ldbm/search.c
servers/slapd/back-monitor/modify.c
servers/slapd/back-monitor/search.c
servers/slapd/backglue.c
servers/slapd/modify.c
servers/slapd/modrdn.c
servers/slapd/search.c
servers/slapd/slap.h

index e4695f968d87f142f5b6ba830be32c704c455a03..d475840d5614d72c71cf3abdf9cc9a15582f5318 100644 (file)
@@ -156,8 +156,8 @@ bdb_modify(
        BackendDB       *be,
        Connection      *conn,
        Operation       *op,
-       const char      *dn,
-       const char      *ndn,
+       struct berval   *dn,
+       struct berval   *ndn,
        Modifications   *modlist )
 {
        struct bdb_info *bdb = (struct bdb_info *) be->be_private;
@@ -208,7 +208,7 @@ retry:      /* transaction retry */
        op->o_private = &opinfo;
 
        /* get entry */
-       rc = bdb_dn2entry( be, ltid, ndn, &e, &matched, 0 );
+       rc = bdb_dn2entry( be, ltid, ndn->bv_val, &e, &matched, 0 );
 
        if ( rc != 0 ) {
                Debug( LDAP_DEBUG_TRACE,
@@ -236,14 +236,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, rc = LDAP_REFERRAL,
@@ -259,7 +259,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_modify: entry is referral\n",
index b92c60c7edb2abe13de3a8f28af8fa5878601d53..a356ba437b062c14777c3be0b9ad3f37d8c8d84e 100644 (file)
 
 int
 bdb_modrdn(
-       Backend *be,
-       Connection      *conn,
-       Operation       *op,
-       const char      *dn,
-       const char      *ndn,
-       const char      *newrdn,
-       int             deleteoldrdn,
-       const char      *newSuperior
+    Backend    *be,
+    Connection *conn,
+    Operation  *op,
+    struct berval      *dn,
+    struct berval      *ndn,
+    struct berval      *newrdn,
+    struct berval      *nnewrdn,
+    int                deleteoldrdn,
+    struct berval      *newSuperior,
+    struct berval      *nnewSuperior
 )
 {
        struct bdb_info *bdb = (struct bdb_info *) be->be_private;
@@ -58,7 +60,8 @@ bdb_modrdn(
        int             manageDSAit = get_manageDSAit( op );
 
        Debug( LDAP_DEBUG_TRACE, "==>bdb_modrdn(%s,%s,%s)\n",
-               dn, newrdn, (newSuperior ? newSuperior : "NULL") );
+               dn->bv_val, newrdn->bv_val,
+               newSuperior ? newSuperior->bv_val : "NULL" );
 
 #if 0
        if( newSuperior != NULL ) {
@@ -102,7 +105,7 @@ retry:      /* transaction retry */
        op->o_private = &opinfo;
 
        /* get entry */
-       rc = bdb_dn2entry( be, ltid, ndn, &e, &matched, 0 );
+       rc = bdb_dn2entry( be, ltid, ndn->bv_val, &e, &matched, 0 );
 
        switch( rc ) {
        case 0:
@@ -125,14 +128,14 @@ retry:    /* transaction retry */
                        matched_dn = 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,
@@ -148,7 +151,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_modrdn: entry %s is referral\n",
                        e->e_dn, 0, 0 );
@@ -261,10 +264,10 @@ retry:    /* transaction retry */
        if ( newSuperior != NULL ) {
                Debug( LDAP_DEBUG_TRACE, 
                        "bdb_modrdn: new parent \"%s\" requested...\n",
-                       newSuperior, 0, 0 );
+                       newSuperior->bv_val, 0, 0 );
 
-               if ( newSuperior[ 0 ] != '\0' ) {
-                       np_dn = ch_strdup( newSuperior );
+               if ( newSuperior->bv_len ) {
+                       np_dn = ch_strdup( newSuperior->bv_val );
                        np_ndn = ch_strdup( np_dn );
                        (void) dn_normalize( np_ndn );
 
@@ -382,9 +385,9 @@ retry:      /* transaction retry */
        }
        
        /* Build target dn and make sure target entry doesn't exist already. */
-       build_new_dn( &new_dn, e->e_dn, new_parent_dn, newrdn ); 
+       build_new_dn( &new_dn, e->e_dn, new_parent_dn, newrdn->bv_val ); 
 
-       new_ndn = ch_strdup(new_dn);
+       new_ndn = ch_strdup( new_dn );
        (void) dn_normalize( new_ndn );
 
        Debug( LDAP_DEBUG_TRACE, "bdb_modrdn: new ndn=%s\n",
@@ -414,7 +417,7 @@ retry:      /* transaction retry */
         * need to add that to our new entry
         */
 
-       if ( rdn_attrs( newrdn, &new_rdn_types, &new_rdn_vals ) ) {
+       if ( rdn_attrs( newrdn->bv_val, &new_rdn_types, &new_rdn_vals ) ) {
                Debug( LDAP_DEBUG_TRACE,
                        "bdb_modrdn: can't figure out type(s)/values(s) "
                        "of newrdn\n", 0, 0, 0 );
@@ -425,10 +428,10 @@ retry:    /* transaction retry */
 
        Debug( LDAP_DEBUG_TRACE,
                "bdb_modrdn: new_rdn_val=\"%s\", new_rdn_type=\"%s\"\n",
-               new_rdn_vals[ 0 ], new_rdn_types[ 0 ], 0 );
+               new_rdn_vals[0], new_rdn_types[0], 0 );
 
        /* Retrieve the old rdn from the entry's dn */
-       if ( ( old_rdn = dn_rdn( be, dn ) ) == NULL ) {
+       if ( ( old_rdn = dn_rdn( be, dn->bv_val ) ) == NULL ) {
                Debug( LDAP_DEBUG_TRACE,
                        "bdb_modrdn: can't figure out old_rdn from dn\n",
                        0, 0, 0 );
index de33175dad0ffd7f8079fdebdd7a61cecf388c5e..d3a5bb02133847d1c84e55e6c688b2c10003f1dd 100644 (file)
@@ -32,8 +32,8 @@ bdb_search(
        BackendDB       *be,
        Connection      *conn,
        Operation       *op,
-       const char      *base,
-       const char      *nbase,
+       struct berval   *base,
+       struct berval   *nbase,
        int             scope,
        int             deref,
        int             slimit,
@@ -65,7 +65,7 @@ bdb_search(
 
        manageDSAit = get_manageDSAit( op );
 
-       if ( *nbase == '\0' ) {
+       if ( nbase->bv_len == 0 ) {
                /* DIT root special case */
                e = (Entry *) &slap_entry_root;
                rc = 0;
@@ -73,12 +73,12 @@ bdb_search(
 #ifdef BDB_ALIASES
        /* get entry with reader lock */
        if ( deref & LDAP_DEREF_FINDING ) {
-               e = deref_dn_r( be, nbase, &err, &matched, &text );
+               e = deref_dn_r( be, nbase->bv_val, &err, &matched, &text );
 
        } else
 #endif
        {
-               rc = bdb_dn2entry( be, NULL, nbase, &e, &matched, 0 );
+               rc = bdb_dn2entry( be, NULL, nbase->bv_val, &e, &matched, 0 );
        }
 
        switch(rc) {
@@ -101,7 +101,7 @@ bdb_search(
 
                        erefs = is_entry_referral( matched )
                                ? get_entry_referrals( be, conn, op, matched,
-                                       base, scope )
+                                       base->bv_val, scope )
                                : NULL;
 
                        bdb_entry_return( be, matched );
@@ -109,13 +109,13 @@ bdb_search(
 
                        if( erefs ) {
                                refs = referral_rewrite( erefs, matched_dn,
-                                       base, scope );
+                                       base->bv_val, scope );
                                ber_bvecfree( erefs );
                        }
 
                } else {
                        refs = referral_rewrite( default_referral,
-                               NULL, base, scope );
+                               NULL, base->bv_val, scope );
                }
 
                send_ldap_result( conn, op,     rc=LDAP_REFERRAL ,
@@ -131,7 +131,7 @@ bdb_search(
                /* entry is a referral, don't allow add */
                char *matched_dn = ch_strdup( e->e_dn );
                struct berval **erefs = get_entry_referrals( be,
-                       conn, op, e, base, scope );
+                       conn, op, e, base->bv_val, scope );
                struct berval **refs = NULL;
 
                bdb_entry_return( be, e );
@@ -139,7 +139,7 @@ bdb_search(
 
                if( erefs ) {
                        refs = referral_rewrite( erefs, matched_dn,
-                               base, scope );
+                               base->bv_val, scope );
                        ber_bvecfree( erefs );
                }
 
index 7f2bbc76758616ec7e22869557401f215b3f767c..5cda33e37c1a614b933192e72c1d2dc22256a4ce 100644 (file)
@@ -245,8 +245,8 @@ ldbm_back_modify(
     Backend    *be,
     Connection *conn,
     Operation  *op,
-    const char *dn,
-    const char *ndn,
+    struct berval      *dn,
+    struct berval      *ndn,
     Modifications      *modlist
 )
 {
@@ -268,7 +268,7 @@ ldbm_back_modify(
 
 
        /* acquire and lock entry */
-       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;
 
@@ -276,12 +276,12 @@ ldbm_back_modify(
                        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,
@@ -297,11 +297,11 @@ ldbm_back_modify(
                /* 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_modify: entry (%s) is referral\n", ndn ));
+                          "ldbm_back_modify: entry (%s) is referral\n", ndn->bv_val ));
 #else
                Debug( LDAP_DEBUG_TRACE, "entry is referral\n", 0,
                    0, 0 );
@@ -317,7 +317,7 @@ ldbm_back_modify(
        }
        
        /* Modify the entry */
-       rc = ldbm_modify_internal( be, conn, op, ndn, modlist, e,
+       rc = ldbm_modify_internal( be, conn, op, ndn->bv_val, modlist, e,
                &text, textbuf, textlen );
 
        if( rc != LDAP_SUCCESS ) {
index 151a032b4e2ab60b663b8f74e9b5e8c8dc4b99f4..d7ab87d50678739ceba97ad27975b932d11c9cc1 100644 (file)
@@ -37,11 +37,13 @@ ldbm_back_modrdn(
     Backend    *be,
     Connection *conn,
     Operation  *op,
-    const char *dn,
-    const char *ndn,
-    const char *newrdn,
+    struct berval      *dn,
+    struct berval      *ndn,
+    struct berval      *newrdn,
+    struct berval      *nnewrdn,
     int                deleteoldrdn,
-    const char *newSuperior
+    struct berval      *newSuperior,
+    struct berval      *nnewSuperior
 )
 {
        AttributeDescription *children = slap_schema.si_ad_children;
@@ -79,15 +81,17 @@ ldbm_back_modrdn(
 #ifdef NEW_LOGGING
        LDAP_LOG(( "backend", LDAP_LEVEL_ENTRY,
                "ldbm_back_modrdn: dn: %s newSuperior=%s\n", 
-               dn ? dn : "NULL", newSuperior ? newSuperior : "NULL" ));
+               dn->bv_len ? dn->bv_val : "NULL",
+               newSuperior->bv_len ? newSuperior->bv_val : "NULL" ));
 #else
-       Debug( LDAP_DEBUG_TRACE, "==>ldbm_back_modrdn(newSuperior=%s)\n",
-           (newSuperior ? newSuperior : "NULL"),
-           0, 0 );
+       Debug( LDAP_DEBUG_TRACE,
+               "==>ldbm_back_modrdn: dn: %s newSuperior=%s\n", 
+               dn->bv_len ? dn->bv_val : "NULL",
+               newSuperior->bv_len ? newSuperior->bv_val : "NULL", 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;
 
@@ -95,12 +99,12 @@ ldbm_back_modrdn(
                        matched_dn = 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,
@@ -116,7 +120,7 @@ ldbm_back_modrdn(
                /* 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,
@@ -276,7 +280,7 @@ ldbm_back_modrdn(
                        newSuperior, 0, 0 );
 #endif
 
-               np_dn = ch_strdup( newSuperior );
+               np_dn = ch_strdup( newSuperior->bv_val );
                np_ndn = ch_strdup( np_dn );
                (void) dn_normalize( np_ndn );
 
@@ -300,8 +304,7 @@ ldbm_back_modrdn(
                /* newSuperior == entry being moved?, if so ==> ERROR */
                /* Get Entry with dn=newSuperior. Does newSuperior exist? */
 
-               if ( newSuperior[ 0 ] != '\0' ) {
-
+               if ( nnewSuperior->bv_len ) {
                        if( (np = dn2entry_w( be, np_ndn, NULL )) == NULL) {
 #ifdef NEW_LOGGING
                                LDAP_LOG(( "backend", LDAP_LEVEL_ERR,
@@ -444,9 +447,9 @@ ldbm_back_modrdn(
        }
        
        /* Build target dn and make sure target entry doesn't exist already. */
-       build_new_dn( &new_dn, e->e_dn, new_parent_dn, newrdn ); 
+       build_new_dn( &new_dn, e->e_dn, new_parent_dn, newrdn->bv_val ); 
 
-       new_ndn = ch_strdup(new_dn);
+       new_ndn = ch_strdup( new_dn );
        (void) dn_normalize( new_ndn );
 
 #ifdef NEW_LOGGING
@@ -475,25 +478,25 @@ ldbm_back_modrdn(
 
 #ifdef NEW_LOGGING
        LDAP_LOG(( "backend", LDAP_LEVEL_INFO,
-                  "ldbm_back_modrdn: new ndn (%s) does not exist\n", new_ndn ));
+               "ldbm_back_modrdn: new ndn (%s) does not exist\n", new_ndn ));
 #else
        Debug( LDAP_DEBUG_TRACE,
-              "ldbm_back_modrdn: new ndn=%s does not exist\n",
-              new_ndn, 0, 0 );
+           "ldbm_back_modrdn: new ndn=%s does not exist\n",
+           new_ndn, 0, 0 );
 #endif
 
 
        /* Get attribute types and values of our new rdn, we will
         * need to add that to our new entry
         */
-       if ( rdn_attrs( newrdn, &new_rdn_types, &new_rdn_vals ) ) {
+       if ( rdn_attrs( newrdn->bv_val, &new_rdn_types, &new_rdn_vals ) ) {
 #ifdef NEW_LOGGING
                LDAP_LOG(( "backend", LDAP_LEVEL_INFO,
-                          "ldbm_back_modrdn: can't figure out type(s)/value(s) of newrdn\n" ));
+                       "ldbm_back_modrdn: can't figure out type(s)/value(s) of newrdn\n" ));
 #else
                Debug( LDAP_DEBUG_TRACE,
-                      "ldbm_back_modrdn: can't figure out type(s)/value(s) of newrdn\n",
-                      0, 0, 0 );
+                   "ldbm_back_modrdn: can't figure out type(s)/value(s) of newrdn\n",
+                   0, 0, 0 );
 #endif
 
                send_ldap_result( conn, op, LDAP_OPERATIONS_ERROR,
@@ -512,11 +515,11 @@ ldbm_back_modrdn(
 #endif
 
        /* Retrieve the old rdn from the entry's dn */
-       if ( (old_rdn = dn_rdn( be, dn )) == NULL ) {
+       if ( (old_rdn = dn_rdn( be, dn->bv_val )) == NULL ) {
 #ifdef NEW_LOGGING
                LDAP_LOG(( "backend", LDAP_LEVEL_INFO,
                           "ldbm_back_modrdn: can't figure out old_rdn from dn (%s)\n",
-                          dn ));
+                          dn->bv_val ));
 #else
                Debug( LDAP_DEBUG_TRACE,
                       "ldbm_back_modrdn: can't figure out old_rdn from dn\n",
@@ -750,7 +753,7 @@ ldbm_back_modrdn(
        }
 
        /* modify memory copy of entry */
-       rc = ldbm_modify_internal( be, conn, op, dn, &mod[0], e,
+       rc = ldbm_modify_internal( be, conn, op, dn->bv_val, &mod[0], e,
                &text, textbuf, textlen );
 
        if( rc != LDAP_SUCCESS ) {
index bc5e67989c27158f2550073f9d04359e05a0a6fc..753477a8e1e0d3295d304d47cace992f76013813 100644 (file)
@@ -29,8 +29,8 @@ ldbm_back_search(
     Backend    *be,
     Connection *conn,
     Operation  *op,
-    const char *base,
-    const char *nbase,
+    struct berval      *base,
+    struct berval      *nbase,
     int                scope,
     int                deref,
     int                slimit,
@@ -59,13 +59,13 @@ ldbm_back_search(
                
 #ifdef NEW_LOGGING
        LDAP_LOG(( "backend", LDAP_LEVEL_ENTRY,
-                  "ldbm_back_search: enter\n" ));
+               "ldbm_back_search: enter\n" ));
 #else
        Debug(LDAP_DEBUG_TRACE, "=> ldbm_back_search\n", 0, 0, 0);
 #endif
 
 
-       if ( *nbase == '\0' ) {
+       if ( nbase->bv_len == 0 ) {
                /* DIT root special case */
                e = (Entry *) &slap_entry_root;
 
@@ -79,13 +79,13 @@ ldbm_back_search(
                
        } else if ( deref & LDAP_DEREF_FINDING ) {
                /* deref dn and get entry with reader lock */
-               e = deref_dn_r( be, nbase, &err, &matched, &text );
+               e = deref_dn_r( be, nbase->bv_val, &err, &matched, &text );
 
                if( err == LDAP_NO_SUCH_OBJECT ) err = LDAP_REFERRAL;
 
        } else {
                /* get entry with reader lock */
-               e = dn2entry_r( be, nbase, &matched );
+               e = dn2entry_r( be, nbase->bv_val, &matched );
                err = e != NULL ? LDAP_SUCCESS : LDAP_REFERRAL;
                text = NULL;
        }
@@ -100,21 +100,21 @@ ldbm_back_search(
 
                        erefs = is_entry_referral( matched )
                                ? get_entry_referrals( be, conn, op, matched,
-                                       base, scope )
+                                       base->bv_val, scope )
                                : NULL;
 
                        cache_return_entry_r( &li->li_cache, matched );
 
                        if( erefs ) {
                                refs = referral_rewrite( erefs, matched_dn,
-                                       base, scope );
+                                       base->bv_val, scope );
 
                                ber_bvecfree( erefs );
                        }
 
                } else {
                        refs = referral_rewrite( default_referral,
-                               NULL, base, scope );
+                               NULL, base->bv_val, scope );
                }
 
                send_ldap_result( conn, op, err,
@@ -129,7 +129,7 @@ ldbm_back_search(
                /* entry is a referral, don't allow add */
                char *matched_dn = ch_strdup( e->e_dn );
                struct berval **erefs = get_entry_referrals( be,
-                       conn, op, e, base, scope );
+                       conn, op, e, base->bv_val, scope );
                struct berval **refs = NULL;
 
                cache_return_entry_r( &li->li_cache, e );
@@ -146,7 +146,7 @@ ldbm_back_search(
 
                if( erefs ) {
                        refs = referral_rewrite( erefs, matched_dn,
-                               base, scope );
+                               base->bv_val, scope );
 
                        ber_bvecfree( erefs );
                }
index 54ba7b3e85e5c34c7ffb49e6467542f68842694b..faf38b73fd8b46ec3e776cb1691085b6cbe9616f 100644 (file)
@@ -50,8 +50,8 @@ monitor_back_modify(
     Backend    *be,
     Connection *conn,
     Operation  *op,
-    const char *dn,
-    const char *ndn,
+    struct berval      *dn,
+    struct berval      *ndn,
     Modifications      *modlist
 )
 {
@@ -68,7 +68,7 @@ monitor_back_modify(
 #endif
 
        /* acquire and lock entry */
-       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,
index 5ccceb907c855061e7976865c0688a2efe8525ed..57d7fa5d0a58f3b789bfea4ec6bb43b3a808565e 100644 (file)
@@ -139,18 +139,18 @@ monitor_send_children(
 int
 monitor_back_search(
        Backend         *be,
-       Connection      *conn,
-       Operation       *op,
-       const char      *base,
-       const char      *nbase,
-       int             scope,
-       int             deref,
-       int             slimit,
-       int             tlimit,
-       Filter          *filter,
-       const char      *filterstr,
-       struct berval           **attrs,
-       int             attrsonly 
+       Connection      *conn,
+       Operation       *op,
+       struct berval   *base,
+       struct berval   *nbase,
+       int             scope,
+       int             deref,
+       int             slimit,
+       int             tlimit,
+       Filter          *filter,
+       const char      *filterstr,
+       struct berval           **attrs,
+       int             attrsonly 
 )
 {
        struct monitorinfo      *mi = (struct monitorinfo *) be->be_private;
@@ -167,7 +167,7 @@ monitor_back_search(
 
 
        /* get entry with reader lock */
-       monitor_cache_dn2entry( mi, nbase, &e, &matched );
+       monitor_cache_dn2entry( mi, nbase->bv_val, &e, &matched );
        if ( e == NULL ) {
                send_ldap_result( conn, op, LDAP_NO_SUCH_OBJECT,
                        matched ? matched->e_dn : NULL, 
index cd773ba8168dcfd83dfda940b89baf9543485409..e331ca85ec2d64025f26e20bbb7077ab07cefd55 100644 (file)
@@ -252,8 +252,8 @@ glue_back_search (
        BackendDB *b0,
        Connection *conn,
        Operation *op,
-       const char *dn,
-       const char *ndn,
+       struct berval *dn,
+       struct berval *ndn,
        int scope,
        int deref,
        int slimit,
@@ -272,12 +272,13 @@ glue_back_search (
        struct berval bv;
 
 
-       if (tlimit)
+       if (tlimit) {
                stoptime = slap_get_time () + tlimit;
+       }
 
        switch (scope) {
        case LDAP_SCOPE_BASE:
-               be = glue_back_select (b0, ndn);
+               be = glue_back_select (b0, ndn->bv_val);
 
                if (be && be->be_search) {
                        rc = be->be_search (be, conn, op, dn, ndn, scope,
@@ -295,8 +296,6 @@ glue_back_search (
                op->o_glue = &gs;
                op->o_sresult = glue_back_sresult;
                op->o_response = glue_back_response;
-               bv.bv_len = strlen(ndn);
-               bv.bv_val = (char *) ndn;
 
                /*
                 * Execute in reverse order, most general first 
@@ -326,26 +325,26 @@ glue_back_search (
                        }
                        be = gi->n[i].be;
                        if (scope == LDAP_SCOPE_ONELEVEL && 
-                               !strcmp (gi->n[i].pdn, ndn)) {
+                               !strcmp (gi->n[i].pdn, ndn->bv_val)) {
                                rc = be->be_search (be, conn, op,
-                                                   be->be_suffix[0]->bv_val,
-                                                   be->be_nsuffix[0]->bv_val,
-                                                   LDAP_SCOPE_BASE, deref,
+                                       be->be_suffix[0], be->be_nsuffix[0],
+                                       LDAP_SCOPE_BASE, deref,
                                        s2limit, t2limit, filter, filterstr,
-                                                   attrs, attrsonly);
+                                       attrs, attrsonly);
+
                        } else if (scope == LDAP_SCOPE_SUBTREE &&
-                               dnIsSuffix(be->be_nsuffix[0], &bv)) {
+                               dnIsSuffix(be->be_nsuffix[0], ndn)) {
                                rc = be->be_search (be, conn, op,
-                                                   be->be_suffix[0]->bv_val,
-                                                   be->be_nsuffix[0]->bv_val,
-                                                   scope, deref,
+                                       be->be_suffix[0], be->be_nsuffix[0],
+                                       scope, deref,
                                        s2limit, t2limit, filter, filterstr,
-                                                   attrs, attrsonly);
+                                       attrs, attrsonly);
+
                        } else if (dnIsSuffix(&bv, be->be_nsuffix[0])) {
-                               rc = be->be_search (be, conn, op,
-                                                   dn, ndn, scope, deref,
+                               rc = be->be_search (be, conn, op, dn, ndn,
+                                       scope, deref,
                                        s2limit, t2limit, filter, filterstr,
-                                                   attrs, attrsonly);
+                                       attrs, attrsonly);
                        }
                }
                break;
@@ -354,8 +353,9 @@ glue_back_search (
        op->o_response = NULL;
        op->o_glue = NULL;
 
-       send_search_result (conn, op, gs.err, gs.matched, NULL, gs.refs,
-                           NULL, gs.nentries);
+       send_search_result (conn, op, gs.err, gs.matched, NULL,
+               gs.refs, NULL, gs.nentries);
+
 done:
        if (gs.matched)
                free (gs.matched);
@@ -422,22 +422,22 @@ glue_back_modify (
        BackendDB *b0,
        Connection *conn,
        Operation *op,
-       const char *dn,
-       const char *ndn,
+       struct berval *dn,
+       struct berval *ndn,
        Modifications *mod
 )
 {
        BackendDB *be;
        int rc;
 
-       be = glue_back_select (b0, ndn);
+       be = glue_back_select (b0, ndn->bv_val);
 
        if (be && be->be_modify) {
                rc = be->be_modify (be, conn, op, dn, ndn, mod);
        } else {
                rc = LDAP_UNWILLING_TO_PERFORM;
-               send_ldap_result (conn, op, rc, NULL, "No modify target found",
-                                 NULL, NULL);
+               send_ldap_result (conn, op, rc, NULL,
+                       "No modify target found", NULL, NULL);
        }
        return rc;
 }
@@ -447,24 +447,27 @@ glue_back_modrdn (
        BackendDB *b0,
        Connection *conn,
        Operation *op,
-       const char *dn,
-       const char *ndn,
-       const char *newrdn,
+       struct berval *dn,
+       struct berval *ndn,
+       struct berval *newrdn,
+       struct berval *nnewrdn,
        int del,
-       const char *newsup
+       struct berval *newsup,
+       struct berval *nnewsup
 )
 {
        BackendDB *be;
        int rc;
 
-       be = glue_back_select (b0, ndn);
+       be = glue_back_select (b0, ndn->bv_val);
 
        if (be && be->be_modrdn) {
-               rc = be->be_modrdn (be, conn, op, dn, ndn, newrdn, del, newsup);
+               rc = be->be_modrdn (be, conn, op, dn, ndn,
+                       newrdn, nnewrdn, del, newsup, nnewsup );
        } else {
                rc = LDAP_UNWILLING_TO_PERFORM;
-               send_ldap_result (conn, op, rc, NULL, "No modrdn target found",
-                                 NULL, NULL);
+               send_ldap_result (conn, op, rc, NULL,
+                       "No modrdn target found", NULL, NULL);
        }
        return rc;
 }
index a1316fc983c4432cfec7fa30a9a545485434d102..1f283932e0611963e39979e773db5dc0b8825f35 100644 (file)
@@ -376,7 +376,7 @@ do_modify(
                                }
                        }
 
-                       if ( (*be->be_modify)( be, conn, op, pdn->bv_val, ndn->bv_val, mods ) == 0
+                       if ( (*be->be_modify)( be, conn, op, pdn, ndn, mods ) == 0
 #ifdef SLAPD_MULTIMASTER
                                && !repl_user
 #endif
index b28bae6c107ccd66ab142f55557ad68d14893782..d07242eb40b0942495e644b44599bc4367842718 100644 (file)
@@ -384,9 +384,9 @@ do_modrdn(
                if ( !be->be_update_ndn.bv_len || repl_user )
 #endif
                {
-                       if ( (*be->be_modrdn)( be, conn, op, pdn->bv_val, ndn->bv_val,
-                               pnewrdn->bv_val, deloldrdn,
-                               pnewSuperior ? pnewSuperior->bv_val : NULL ) == 0
+                       if ( (*be->be_modrdn)( be, conn, op, pdn, ndn,
+                               pnewrdn, nnewrdn, deloldrdn,
+                               pnewSuperior, nnewSuperior ) == 0
 #ifdef SLAPD_MULTIMASTER
                                && ( !be->be_update_ndn.bv_len || !repl_user )
 #endif
index 39f50d5c0be527a38dc1236d4edab5b1a130d763..c365d4131e80e6b067e9341ea686df6a93ae2fc2 100644 (file)
@@ -327,7 +327,7 @@ do_search(
 
        /* actually do the search and send the result(s) */
        if ( be->be_search ) {
-               (*be->be_search)( be, conn, op, pbase->bv_val, nbase->bv_val,
+               (*be->be_search)( be, conn, op, pbase, nbase,
                        scope, deref, sizelimit,
                    timelimit, filter, fstr.bv_val, attrs, attrsonly );
        } else {
index 75695c76cf89a3e238d38f189aef46d4d12d68a7..fdddcc287098063c906e0f94eed1746036234aa0 100644 (file)
@@ -1020,15 +1020,17 @@ struct slap_op;
 
 /* Backend function typedefs */
 typedef int (BI_init) LDAP_P((BackendInfo *bi));
-typedef int (BI_config) LDAP_P((BackendInfo *bi, const char *fname,
-       int lineno, int argc, char **argv));
+typedef int (BI_config) LDAP_P((BackendInfo *bi,
+       const char *fname, int lineno,
+       int argc, char **argv));
 typedef int (BI_open) LDAP_P((BackendInfo *bi));
 typedef int (BI_close) LDAP_P((BackendInfo *bi));
 typedef int (BI_destroy) LDAP_P((BackendInfo *bi));
 
 typedef int (BI_db_init) LDAP_P((Backend *bd));
-typedef int (BI_db_config) LDAP_P((Backend *bd, const char *fname,
-       int lineno, int argc, char **argv));
+typedef int (BI_db_config) LDAP_P((Backend *bd,
+       const char *fname, int lineno,
+       int argc, char **argv));
 typedef int (BI_db_open) LDAP_P((Backend *bd));
 typedef int (BI_db_close) LDAP_P((Backend *bd));
 typedef int (BI_db_destroy) LDAP_P((Backend *bd));
@@ -1041,7 +1043,7 @@ typedef int (BI_op_unbind) LDAP_P((BackendDB *bd,
                struct slap_conn *c, struct slap_op *o ));
 typedef int (BI_op_search) LDAP_P((BackendDB *bd,
                struct slap_conn *c, struct slap_op *o,
-               const char *base, const char *nbase,
+               struct berval *base, struct berval *nbase,
                int scope, int deref,
                int slimit, int tlimit,
                Filter *f, const char *filterstr,
@@ -1052,12 +1054,14 @@ typedef int (BI_op_compare)LDAP_P((BackendDB *bd,
                AttributeAssertion *ava));
 typedef int (BI_op_modify) LDAP_P((BackendDB *bd,
                struct slap_conn *c, struct slap_op *o,
-               const char *dn, const char *ndn, Modifications *m));
+               struct berval *dn, struct berval *ndn,
+               Modifications *m));
 typedef int (BI_op_modrdn) LDAP_P((BackendDB *bd,
                struct slap_conn *c, struct slap_op *o,
-               const char *dn, const char *ndn,
-               const char *newrdn, int deleteoldrdn,
-               const char *newSuperior));
+               struct berval *dn, struct berval *ndn,
+               struct berval *newrdn, struct berval *nnewrdn,
+               int deleteoldrdn,
+               struct berval *newSup, struct berval *nnewSup ));
 typedef int (BI_op_add)    LDAP_P((BackendDB *bd,
                struct slap_conn *c, struct slap_op *o,
                Entry *e));
@@ -1241,13 +1245,14 @@ struct slap_backend_info {
 struct slap_op;
 struct slap_conn;
 
-typedef void (slap_response)(struct slap_conn *, struct slap_op *, ber_tag_t,
-       ber_int_t, ber_int_t, const char *, const char *, struct berval **,
-       const char *, struct berval *, struct berval *, LDAPControl **);
+typedef void (slap_response)( struct slap_conn *, struct slap_op *,
+       ber_tag_t, ber_int_t, ber_int_t, const char *, const char *,
+       struct berval **, const char *, struct berval *,
+       struct berval *, LDAPControl ** );
 
-typedef void (slap_sresult)(struct slap_conn *, struct slap_op *, ber_int_t,
-       const char *, const char *, struct berval **, LDAPControl **,
-       int nentries);
+typedef void (slap_sresult)( struct slap_conn *, struct slap_op *,
+       ber_int_t, const char *, const char *, struct berval **,
+       LDAPControl **, int nentries);
 
 /*
  * represents an operation pending from an ldap client