mirror of
https://git.openldap.org/openldap/openldap.git
synced 2025-03-13 14:27:59 +08:00
Changed dnParent to void instead of int. (It always returned success...)
This commit is contained in:
parent
309870fa9c
commit
6bac96b0bd
@ -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 ) {
|
||||
|
@ -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 ) {
|
||||
|
@ -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",
|
||||
|
@ -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,
|
||||
|
@ -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 ) ) {
|
||||
|
@ -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 ) {
|
||||
|
@ -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 ) {
|
||||
|
@ -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,
|
||||
|
@ -74,17 +74,15 @@ dn2id_add(
|
||||
ldap_pvt_thread_mutex_unlock( &db->dbc_write_mutex );
|
||||
|
||||
if ( rc != -1 ) {
|
||||
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;
|
||||
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 );
|
||||
}
|
||||
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;
|
||||
|
@ -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;
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user