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 ) {
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 ) {
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;
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;
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;
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;
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",
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 ) {
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,
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 ) ) {
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 ) {
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 ) {
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 ) {
}
/* 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,
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 );
}
}
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;
(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 )) {
(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;
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;
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) {
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;
* 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 )
/* one-level dn */
if ( p == NULL ) {
*pdn = slap_empty_bv;
- return LDAP_SUCCESS;
+ return;
}
assert( DN_SEPARATOR( p[ 0 ] ) );
pdn->bv_val = p;
pdn->bv_len = dn->bv_len - (p - dn->bv_val);
- return LDAP_SUCCESS;
+ return;
}
#ifdef SLAP_DN_MIGRATION
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