]> git.sur5r.net Git - openldap/commitdiff
Changed dnParent to void instead of int. (It always returned success...)
authorHoward Chu <hyc@openldap.org>
Sat, 26 Jan 2002 08:44:59 +0000 (08:44 +0000)
committerHoward Chu <hyc@openldap.org>
Sat, 26 Jan 2002 08:44:59 +0000 (08:44 +0000)
12 files changed:
servers/slapd/back-bdb/add.c
servers/slapd/back-bdb/delete.c
servers/slapd/back-bdb/dn2id.c
servers/slapd/back-bdb/modrdn.c
servers/slapd/back-bdb/search.c
servers/slapd/back-bdb/tools.c
servers/slapd/back-ldbm/add.c
servers/slapd/back-ldbm/delete.c
servers/slapd/back-ldbm/dn2id.c
servers/slapd/backglue.c
servers/slapd/dn.c
servers/slapd/proto-slap.h

index af4f37a46a41b1d8fac7682914e3bbddabf37a09..1a8a66acc50139537a8266acfe7e74b86f128f26 100644 (file)
@@ -107,11 +107,7 @@ retry:          /* transaction retry */
        if ( be_issuffix( be, &e->e_nname ) ) {
                pdn = slap_empty_bv;
        } else {
-               rc = dnParent( &e->e_nname, &pdn );
-               if ( rc != LDAP_SUCCESS ) {
-                       text = "internal error";
-                       goto return_results;
-               }
+               dnParent( &e->e_nname, &pdn );
        }
 
        if( pdn.bv_len != 0 ) {
index 7658c84fc1bedf24e41f14bf76119ae7fc16c16f..1e38499fdfedf0bcb87034978320c81f26874d8b 100644 (file)
@@ -82,11 +82,7 @@ retry:       /* transaction retry */
        op->o_private = &opinfo;
 
        if ( !be_issuffix( be, ndn ) ) {
-               rc = dnParent( ndn, &pdn );
-               if ( rc != LDAP_SUCCESS ) {
-                       text = "internal error";
-                       goto return_results;
-               }
+               dnParent( ndn, &pdn );
        }
 
        if( pdn.bv_len != 0 ) {
index 33fb362256a3b81177429a33ae8922e3d884508a..b0bef02a1da63cc72b7be709601cdcf6c8a9d7bc 100644 (file)
@@ -64,13 +64,7 @@ bdb_dn2id_add(
                        goto done;
                }
                
-               rc = dnParent( &ptr, &pdn );
-               if ( rc != LDAP_SUCCESS ) {
-                       Debug( LDAP_DEBUG_ANY,
-                               "=> bdb_dn2id_add: dnParent(\"%s\") failed\n",
-                               ptr.bv_val, 0, 0 );
-                       goto done;
-               }
+               dnParent( &ptr, &pdn );
        
                key.size = pdn.bv_len + 2;
                pdn.bv_val[-1] = DN_ONE_PREFIX;
@@ -98,13 +92,7 @@ bdb_dn2id_add(
                                        ptr.bv_val, rc, 0 );
                        break;
                }
-               rc = dnParent( &ptr, &pdn );
-               if ( rc != LDAP_SUCCESS ) {
-                       Debug( LDAP_DEBUG_ANY,
-                               "=> bdb_dn2id_add: dnParent(\"%s\") failed\n",
-                               ptr.bv_val, 0, 0 );
-                       goto done;
-               }
+               dnParent( &ptr, &pdn );
 
                key.size = pdn.bv_len + 2;
                key.data = pdn.bv_val - 1;
@@ -163,13 +151,7 @@ bdb_dn2id_delete(
                        goto done;
                }
 
-               rc = dnParent( &ptr, &pdn );
-               if ( rc != LDAP_SUCCESS ) {
-                       Debug( LDAP_DEBUG_ANY,
-                               "=> bdb_dn2id_delete: dnParent(\"%s\") failed\n",
-                               ptr.bv_val, 0, 0 );
-                       goto done;
-               }
+               dnParent( &ptr, &pdn );
 
                key.size = pdn.bv_len + 2;
                pdn.bv_val[-1] = DN_ONE_PREFIX;
@@ -196,13 +178,7 @@ bdb_dn2id_delete(
                                ptr.bv_val, rc, 0 );
                        goto done;
                }
-               rc = dnParent( &ptr, &pdn );
-               if ( rc != LDAP_SUCCESS ) {
-                       Debug( LDAP_DEBUG_ANY,
-                               "=> bdb_dn2id_delete: dnParent(\"%s\") failed\n",
-                               ptr.bv_val, 0, 0 );
-                       goto done;
-               }
+               dnParent( &ptr, &pdn );
 
                key.size = pdn.bv_len + 2;
                key.data = pdn.bv_val - 1;
@@ -319,13 +295,7 @@ bdb_dn2id_matched(
                        struct berval   pdn;
 
                        if ( ! be_issuffix( be, &dn ) ) {
-                               rc = dnParent( &dn, &pdn );
-                               if ( rc != LDAP_SUCCESS ) {
-                                       Debug( LDAP_DEBUG_TRACE,
-                                               "<= bdb_dn2id_matched: dnParent(\"%s\") failed\n",
-                                               dn.bv_val, 0, 0 );
-                                       break;
-                               }
+                               dnParent( &dn, &pdn );
                        } else {
                                Debug( LDAP_DEBUG_TRACE,
                                        "<= bdb_dn2id_matched: no match\n",
index 45f25b557f9c81cc05ed0c0054e6abb2a794902f..f83fd79e9a69ef67ad2345d05bc396a2b7cc0c56 100644 (file)
@@ -173,11 +173,7 @@ retry:     /* transaction retry */
        if ( be_issuffix( be, &e->e_nname ) ) {
                p_ndn = slap_empty_bv;
        } else {
-               rc = dnParent( &e->e_nname, &p_ndn );
-               if ( rc != LDAP_SUCCESS ) {
-                       text = "internal error";
-                       goto return_results;
-               }
+               dnParent( &e->e_nname, &p_ndn );
        }
        np_ndn = &p_ndn;
        if ( p_ndn.bv_len != 0 ) {
@@ -224,11 +220,7 @@ retry:     /* transaction retry */
                if ( p_ndn.bv_val == slap_empty_bv.bv_val ) {
                        p_dn = slap_empty_bv;
                } else {
-                       rc = dnParent( &e->e_name, &p_dn );
-                       if ( rc != LDAP_SUCCESS ) {
-                               text = "internal error";
-                               goto return_results;
-                       }
+                       dnParent( &e->e_name, &p_dn );
                }
 
                Debug( LDAP_DEBUG_TRACE,
index 239a70de7f5b14b3d1dbfcc4beae0e88083253b8..f4ee315c1b9587107d62d8a19be51271205df8fb 100644 (file)
@@ -354,10 +354,9 @@ bdb_search(
                        if( scope & LDAP_SCOPE_ONELEVEL ) {
                                struct berval   pdn;
                                
-                               if ( dnParent( &e->e_nname, &pdn ) == LDAP_SUCCESS ) {
-                                       if ( ber_bvcmp( pdn, &realbase ) ) {
-                                               goto loop_continue;
-                                       }
+                               dnParent( &e->e_nname, &pdn ):
+                               if ( ber_bvcmp( pdn, &realbase ) ) {
+                                       goto loop_continue;
                                }
 
                        } else if ( dnIsSuffix( &e->e_nname, &realbase ) ) {
index 1612db3b31e65d8f5ed97cfd1ed410d93cc00651..a1323405e13c51c135eba755cd4781351aa840e5 100644 (file)
@@ -158,14 +158,7 @@ ID bdb_tool_entry_put(
        if ( be_issuffix( be, &e->e_nname ) ) {
                pdn = slap_empty_bv;
        } else {
-               rc = dnParent( &e->e_nname, &pdn );
-               if ( rc != LDAP_SUCCESS ) {
-                       Debug( LDAP_DEBUG_ANY, "=> bdb_tool_entry_put: "
-                               "dnParent(\"%s\") failed\n",
-                               e->e_nname.bv_val, 0, 0 );
-                       
-                       goto done;
-               }
+               dnParent( &e->e_nname, &pdn );
        }
        rc = bdb_dn2id_add( be, tid, &pdn, e );
        if( rc != 0 ) {
@@ -273,13 +266,7 @@ int bdb_tool_entry_reindex(
        if ( be_issuffix( be, &e->e_nname ) ) {
                pdn = slap_empty_bv;
        } else {
-               rc = dnParent( &e->e_nname, &pdn );
-               if ( rc != LDAP_SUCCESS ) {
-                       Debug( LDAP_DEBUG_ANY, "=> bdb_tool_entry_reindex: "
-                                       "dnParent(\"%s\") failed\n",
-                                       e->e_nname.bv_val, 0, 0 );
-                       goto done;
-               }
+               dnParent( &e->e_nname, &pdn );
        }
        rc = bdb_dn2id_add( be, tid, &pdn, e );
        if( rc != 0 && rc != DB_KEYEXIST ) {
index d6e4b300eb73c85d577b4509492d7359396cd4f4..997e969f1de3ba5718af6134ea264e45f62dd6f5 100644 (file)
@@ -83,8 +83,7 @@ ldbm_back_add(
        if ( be_issuffix( be, &e->e_nname ) ) {
                pdn = slap_empty_bv;
        } else {
-               rc = dnParent( &e->e_nname, &pdn );
-               /* dnParent always returns success */
+               dnParent( &e->e_nname, &pdn );
        }
 
        if( pdn.bv_len ) {
index adb1ff6b724bf5b4d7f1cd614507185ca94a3630..a3b5ebe902da0c235f43e810acdab39f74f43296 100644 (file)
@@ -115,8 +115,8 @@ ldbm_back_delete(
        }
 
        /* delete from parent's id2children entry */
-       if( !be_issuffix( be, &e->e_nname ) && dnParent( &e->e_nname, &pdn ) == LDAP_SUCCESS
-               && pdn.bv_len ) {
+       if( !be_issuffix( be, &e->e_nname ) && (dnParent( &e->e_nname, &pdn ),
+               pdn.bv_len) ) {
                if( (p = dn2entry_w( be, &pdn, NULL )) == NULL) {
 #ifdef NEW_LOGGING
                        LDAP_LOG(( "backend", LDAP_LEVEL_ERR,
index 64be1196bf6be0ef491e5c0b5d6295b89d1605b9..152ab7a7e3952812d21c20c5fb67af789f7bfb0d 100644 (file)
@@ -74,17 +74,15 @@ dn2id_add(
                ldap_pvt_thread_mutex_unlock( &db->dbc_write_mutex );
 
                if ( rc != -1 ) {
-                       rc = dnParent( &ptr, &pdn );
-
-                       if( rc == LDAP_SUCCESS ) {
-                               pdn.bv_val[-1] = DN_ONE_PREFIX;
-                               key.dsize = pdn.bv_len + 2;
-                               key.dptr = pdn.bv_val - 1;
-                               ptr = pdn;
-                               ldap_pvt_thread_mutex_lock( &db->dbc_write_mutex );
-                               rc = idl_insert_key( be, db, key, id );
-                               ldap_pvt_thread_mutex_unlock( &db->dbc_write_mutex );
-                       }
+                       dnParent( &ptr, &pdn );
+
+                       pdn.bv_val[-1] = DN_ONE_PREFIX;
+                       key.dsize = pdn.bv_len + 2;
+                       key.dptr = pdn.bv_val - 1;
+                       ptr = pdn;
+                       ldap_pvt_thread_mutex_lock( &db->dbc_write_mutex );
+                       rc = idl_insert_key( be, db, key, id );
+                       ldap_pvt_thread_mutex_unlock( &db->dbc_write_mutex );
                }
        }
 
@@ -96,7 +94,7 @@ dn2id_add(
                ldap_pvt_thread_mutex_unlock( &db->dbc_write_mutex );
 
                if( rc != 0 ) break;
-               rc = dnParent( &ptr, &pdn );
+               dnParent( &ptr, &pdn );
                key.dsize = pdn.bv_len + 2;
                key.dptr = pdn.bv_val - 1;
                ptr = pdn;
@@ -314,18 +312,16 @@ dn2id_delete(
                (void) idl_delete_key( be, db, key, id );
                ldap_pvt_thread_mutex_unlock( &db->dbc_write_mutex );
 
-               rc = dnParent( &ptr, &pdn );
+               dnParent( &ptr, &pdn );
 
-               if( rc == LDAP_SUCCESS ) {
-                       pdn.bv_val[-1] = DN_ONE_PREFIX;
-                       key.dsize = pdn.bv_len + 2;
-                       key.dptr = pdn.bv_val - 1;
-                       ptr = pdn;
+               pdn.bv_val[-1] = DN_ONE_PREFIX;
+               key.dsize = pdn.bv_len + 2;
+               key.dptr = pdn.bv_val - 1;
+               ptr = pdn;
 
-                       ldap_pvt_thread_mutex_lock( &db->dbc_write_mutex );
-                       (void) idl_delete_key( be, db, key, id );
-                       ldap_pvt_thread_mutex_unlock( &db->dbc_write_mutex );
-               }
+               ldap_pvt_thread_mutex_lock( &db->dbc_write_mutex );
+               (void) idl_delete_key( be, db, key, id );
+               ldap_pvt_thread_mutex_unlock( &db->dbc_write_mutex );
        }
 
        while ( rc != -1 && !be_issuffix( be, &ptr )) {
@@ -335,7 +331,7 @@ dn2id_delete(
                (void) idl_delete_key( be, db, key, id );
                ldap_pvt_thread_mutex_unlock( &db->dbc_write_mutex );
 
-               rc = dnParent( &ptr, &pdn );
+               dnParent( &ptr, &pdn );
                key.dsize = pdn.bv_len + 2;
                key.dptr = pdn.bv_val - 1;
                ptr = pdn;
@@ -415,8 +411,7 @@ dn2entry_rw(
        if( matched == NULL ) return NULL;
 
        /* entry does not exist - see how much of the dn does exist */
-       if ( !be_issuffix( be, dn ) && dnParent( dn, &pdn ) == LDAP_SUCCESS
-               && pdn.bv_len ) {
+       if ( !be_issuffix( be, dn ) && (dnParent( dn, &pdn ), pdn.bv_len) ) {
                /* get entry with reader lock */
                if ( (e = dn2entry_r( be, &pdn, matched )) != NULL ) {
                        *matched = e;
index e25275e2ddf2ef268bbea48abbbeb164913f60c2..61bdf574d53f9ff4fe0e3abf80dabb9f8ec6255c 100644 (file)
@@ -884,10 +884,7 @@ glue_sub_init( )
                                        gi->nodes * sizeof(gluenode));
                        }
                        gi->n[gi->nodes].be = be;
-                       if ( dnParent( be->be_nsuffix[0], &gi->n[gi->nodes].pdn ) 
-                                       != LDAP_SUCCESS ) {
-                               return -1;
-                       }
+                       dnParent( be->be_nsuffix[0], &gi->n[gi->nodes].pdn ); 
                        gi->nodes++;
                }
                if (gi) {
@@ -895,10 +892,7 @@ glue_sub_init( )
                        gi = (glueinfo *)ch_realloc(gi,
                                sizeof(glueinfo) + gi->nodes * sizeof(gluenode));
                        gi->n[gi->nodes].be = gi->be;
-                       if ( dnParent( b1->be_nsuffix[0], &gi->n[gi->nodes].pdn )
-                                       != LDAP_SUCCESS ) {
-                               return -1;
-                       }
+                       dnParent( b1->be_nsuffix[0], &gi->n[gi->nodes].pdn );
                        gi->nodes++;
                        b1->be_private = gi;
                        b1->bd_info = bi;
index 9fa1b4a746873b1dc4d06fa60ee7448bad1926cc..632b77b1acf3ec36ebdd46a5d08cb336f257f9a2 100644 (file)
@@ -564,7 +564,7 @@ dnMatch(
  * note: the incoming dn is assumed to be normalized/prettyfied,
  * so that escaped rdn/ava separators are in '\'+hexpair form
  */
-int
+void
 dnParent( 
        struct berval   *dn, 
        struct berval   *pdn )
@@ -576,7 +576,7 @@ dnParent(
        /* one-level dn */
        if ( p == NULL ) {
                *pdn = slap_empty_bv;
-               return LDAP_SUCCESS;
+               return;
        }
 
        assert( DN_SEPARATOR( p[ 0 ] ) );
@@ -586,7 +586,7 @@ dnParent(
        pdn->bv_val = p;
        pdn->bv_len = dn->bv_len - (p - dn->bv_val);
 
-       return LDAP_SUCCESS;
+       return;
 }
 
 #ifdef SLAP_DN_MIGRATION
index 7465a0de30363f0f33d218b57e115e66ba94359d..98a880be92f0a1cd143da73b82aed507db029df8 100644 (file)
@@ -404,7 +404,7 @@ LDAP_SLAPD_F (void) build_new_dn LDAP_P((
        struct berval * parent_dn,
        struct berval * newrdn ));
 
-LDAP_SLAPD_F (int) dnParent LDAP_P(( struct berval *dn, struct berval *pdn ));
+LDAP_SLAPD_F (void) dnParent LDAP_P(( struct berval *dn, struct berval *pdn ));
 
 #ifdef HAVE_CYRUS_SASL
 #define SLAP_DN_MIGRATION 1