char *pdn;
Entry *p = NULL;
int rootlock = 0;
- int rc;
+ int rc, rc_id;
const char *text = NULL;
AttributeDescription *children = slap_schema.si_ad_children;
char textbuf[SLAP_TEXT_BUFLEN];
/* nobody else can add until we lock our parent */
ldap_pvt_thread_mutex_lock(&li->li_add_mutex);
- if ( ( dn2id( be, e->e_ndn ) ) != NOID ) {
+ if ( ( dn2id( be, e->e_ndn, &rc_id ) ) != NOID || rc_id ) {
+ /* if (rc_id) something bad happened to ldbm cache */
ldap_pvt_thread_mutex_unlock(&li->li_add_mutex);
- send_ldap_result( conn, op, LDAP_ALREADY_EXISTS,
+ send_ldap_result( conn, op,
+ rc_id ? LDAP_OPERATIONS_ERROR : LDAP_ALREADY_EXISTS,
NULL, NULL, NULL, NULL );
return( -1 );
}
ID
dn2id(
Backend *be,
- const char *dn
+ const char *dn,
+ int *rc
)
{
struct ldbminfo *li = (struct ldbminfo *) be->be_private;
ID id;
Datum key, data;
+ *rc = 0;
+
#ifdef NEW_LOGGING
LDAP_LOG(( "backend", LDAP_LEVEL_ENTRY,
"dn2id: (%s)\n", dn ));
Debug( LDAP_DEBUG_ANY, "<= dn2id could not open dn2id%s\n",
LDBM_SUFFIX, 0, 0 );
#endif
-
+ /*
+ * return code !0 if ldbm cache open failed;
+ * callers should handle this
+ */
+ *rc = -1;
return( NOID );
}
ID id;
Entry *e = NULL;
char *pdn;
+ int rc_id = 0;
#ifdef NEW_LOGGING
LDAP_LOG(( "backend", LDAP_LEVEL_ENTRY,
*matched = NULL;
}
- if ( (id = dn2id( be, dn )) != NOID &&
+ if ( (id = dn2id( be, dn, &rc_id )) != NOID &&
(e = id2entry_rw( be, id, rw )) != NULL )
{
return( e );
/* must have been deleted from underneath us */
/* treat as if NOID was found */
+ } else if ( rc_id ) {
+ /* something bad happened to ldbm cache */
+ return NULL;
}
/* caller doesn't care about match */
if ( idl == NULL ) {
#ifdef NEW_LOGGING
LDAP_LOG(( "cache", LDAP_LEVEL_INFO,
- "idl_freee: called with NULL pointer\n" ));
+ "idl_free: called with NULL pointer\n" ));
#else
Debug( LDAP_DEBUG_TRACE,
"idl_free: called with NULL pointer\n",
Entry *e, *p = NULL;
Entry *matched;
int rootlock = 0;
- int rc = -1;
+ int rc = -1, rc_id = 0;
const char *text = NULL;
char textbuf[SLAP_TEXT_BUFLEN];
size_t textlen = sizeof textbuf;
}
ldap_pvt_thread_mutex_unlock( &op->o_abandonmutex );
- if (dn2id ( be, new_ndn ) != NOID) {
- send_ldap_result( conn, op, LDAP_ALREADY_EXISTS,
+ if (dn2id ( be, new_ndn, &rc_id ) != NOID || rc_id ) {
+ /* if (rc_id) something bad happened to ldbm cache */
+ send_ldap_result( conn, op,
+ rc_id ? LDAP_OPERATIONS_ERROR : LDAP_ALREADY_EXISTS,
NULL, NULL, NULL, NULL );
goto return_results;
}
*/
int dn2id_add LDAP_P(( Backend *be, const char *dn, ID id ));
-ID dn2id LDAP_P(( Backend *be, const char *dn ));
+ID dn2id LDAP_P(( Backend *be, const char *dn, int *rc ));
ID_BLOCK *dn2idl LDAP_P(( Backend *be, const char *dn, int prefix ));
int dn2id_delete LDAP_P(( Backend *be, const char *dn, ID id ));
{
struct ldbminfo *li = (struct ldbminfo *) be->be_private;
Datum key, data;
- int rc, len;
+ int rc, len, rc_id;
ID id;
assert( slapMode & SLAP_TOOL_MODE );
e->e_id, e->e_dn, 0 );
#endif
- id = dn2id( be, e->e_ndn );
+ id = dn2id( be, e->e_ndn, &rc_id );
if( id != NOID ) {
#ifdef NEW_LOGGING
LDAP_LOG(( "backend", LDAP_LEVEL_ENTRY,
e->e_ndn, id, 0 );
#endif
return NOID;
+ } else if ( rc_id ) {
+ /* something bad happened to ldbm cache */
+ return NOID;
}
-
rc = index_entry_add( be, e, e->e_attrs );
if( rc != 0 ) {
return NOID;