[Date Prev][Date Next]
[Chronological]
[Thread]
[Top]
Curious "missing parent" check in mdb_idscopes(), how may this occur?
- To: openldap-devel@openldap.org
- Subject: Curious "missing parent" check in mdb_idscopes(), how may this occur?
- From: Konstantin Andreev <andreev@swemel.ru>
- Date: Mon, 28 Oct 2019 15:03:22 +0300
- Dkim-signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=swemel.ru; s=17022016; h=Subject:Content-Transfer-Encoding:Content-Type:To:MIME-Version :From:Date:Message-ID; bh=4pMW0dOMOkFD1HqY2yD7G9DQ8uWNmHmbN+l9n+1/YQI=; b=QxG 6ilA8jkstAAhDpG+rdMcBP+BuAYgS92TvF1bEddEZCFUiMHKNv7qO7jPZ6uiwV1KXQQqs82ZR49ZQ uD0oNtRTxKUlmt9NoQb7vA/0a4IjeRIC9NTHa6ROJSbgAVK1kJMHMks+nv+ZS2WseksoCC/yYE5PU SdNYLRmb52S/Wo=;
- Organization: Swemel JSC
- User-agent: Mozilla/5.0 (X11; SunOS i86pc; rv:31.0) Gecko/20100101 Thunderbird/31.6.0
Hi,
I am contemplating the mdb search mechanics, and puzzled by "missing parent" check in mdb_idscopes():
| /* If we didn't advance, some parent is missing */
| if ( id == prev )
| return MDB_NOTFOUND;
where "id" and "prev" are parent and child ids that come from the same "UP" ( child -> parent ) record of "dn2id" table. Here is a source code approximation for easier reading:
| MDB_val key = { sizeof(ID), & id }, data;
| mdb_cursor_get( "dn2id", key, data, MDB_SET );
| // reading last sizeof(ID) bytes of data.mv_data
| ID prev = *(ID *)(data.mv_data + data.mv_size - sizeof(ID));
IIUC, there is no records in "dn2id" where parent and child ids are the same. There is no by construction, except "super-root", where both ids are zeros, but zero id doesn't follow this execution path.
So, how may [id == prev] occur? Could you, please, explain?
The check came from 5a08b661 and 437f21b commits (ITS#7705,#7800 fix ...), I have read both, but they haven't helped either.
Regard, Konstantin.