Commit 9118cfda authored by Howard Chu's avatar Howard Chu
Browse files

ITS#5087 fix tool_id2entry_get

parent 43c1d191
......@@ -228,19 +228,22 @@ int bdb_tool_id2entry_get(
Entry **e
)
{
int rc = bdb_id2entry( be, NULL, 0, id, e );
if ( rc == DB_NOTFOUND && id == 0 ) {
Entry *dummy = ch_calloc( 1, sizeof(Entry) );
struct berval gluebv = BER_BVC("glue");
dummy->e_name.bv_val = ch_strdup( "" );
dummy->e_nname.bv_val = ch_strdup( "" );
attr_merge_one( dummy, slap_schema.si_ad_objectClass, &gluebv, NULL );
attr_merge_one( dummy, slap_schema.si_ad_structuralObjectClass,
&gluebv, NULL );
*e = dummy;
rc = LDAP_SUCCESS;
int rc;
ID nid;
BDB_ID2DISK( id, &nid );
key.ulen = key.size = sizeof(ID);
key.flags = DB_DBT_USERMEM;
key.data = &nid;
rc = cursor->c_get( cursor, &key, &data, DB_SET );
if ( rc == 0 ) {
*e = bdb_tool_entry_get( be, id );
if ( *e == NULL )
rc = LDAP_OTHER;
}
key.data = NULL;
return rc;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment