BackendDB *be,
DB_TXN *txn,
const char *dn,
- ID id
-)
+ ID id )
{
int rc;
DBT key, data;
/* fetch it */
rc = db->get( db, txn, &key, &data, 0 );
- Debug( LDAP_DEBUG_TRACE, "<= bdb_dn2id: id=0x%08lx: %s (%d)\n",
- *id, db_strerror( rc ), rc );
+ if( rc != 0 ) {
+ Debug( LDAP_DEBUG_TRACE, "<= bdb_dn2id: get failed: %s (%d)\n",
+ db_strerror( rc ), rc, 0 );
+ } else {
+ Debug( LDAP_DEBUG_TRACE, "<= bdb_dn2id: got id=0x%08lx\n",
+ *id, 0, 0 );
+ }
ch_free( key.data );
return rc;
new_ndn, 0, 0 );
rc = bdb_dn2id ( be, ltid, new_ndn, &id );
- if( rc != 0 ) {
- switch( rc ) {
- case DB_LOCK_DEADLOCK:
- case DB_LOCK_NOTGRANTED:
- goto retry;
- default:
- rc = LDAP_OTHER;
- text = "internal error";
- }
-
+ switch( rc ) {
+ case DB_LOCK_DEADLOCK:
+ case DB_LOCK_NOTGRANTED:
+ goto retry;
+ case DB_NOTFOUND:
+ break;
+ case 0:
+ rc = LDAP_ALREADY_EXISTS;
+ goto return_results;
+ default:
+ rc = LDAP_OTHER;
+ text = "internal error";
goto return_results;
}