On 08/02/2017 11:49 AM, Ilias Stamatis
wrote:
Since I know that you are tying to work on ticket https://pagure.io/389-ds-base/issue/47567, here is the short answer... This is how you use id2enty and entryrdn together to achieve the desired result... id2entry: id 1 rdn: dc=example,dc=com objectClass: top ... id 3 rdn: ou=Groups ... ... parentid: 1 id 6 rdn: cn=Accounting Managers ... ... parentid: 3 ----> points to ID 3 ("ou=Groups"), then "groups" parent points to ID 1 ("dc=example,dc=com"). Final result "cn=Accounting Managers, ou=Groups, dc=example,dc=com" For the purposes of the ticket listed above you need to recreate the full DN of each entry found in id2entry and then print its LDIF format. So you grab an entry from id2entry, find its parent id, then you recursively keep looking at each parent in entryrdn, building up the DN as you go, until there is no parent id found. [1] Get entry from id2entry and use its ID [2] Look in entryrdn for the parent of the ID [3] Keep looking for parents, building the DN as you go along Example: [1] Get entry from id2entry: ID 6 --> "cn=Accounting Managers" [2] Check entryrdn for "P<ID>". In this case it's "P6" which is "ou=Groups" with ID 3 [3] So find "P3", which is "dc=example,dc=com" with ID 1, and look for "P1". But there is no P1, so we stop the process/loop. Final result "cn=Accounting Managers, ou=Groups, dc=example,dc=com" We just want it to be efficient, and not use a lot of memory. This needs to work on a 100 million entry db without consuming a lot of resources. I hope that helps. Mark
|
_______________________________________________ 389-devel mailing list -- 389-devel@xxxxxxxxxxxxxxxxxxxxxxx To unsubscribe send an email to 389-devel-leave@xxxxxxxxxxxxxxxxxxxxxxx