Skip to content

Issue 6417 - If an entry RDN is identical to the suffix, then Entryrd… - #6418

Merged
tbordaz merged 1 commit into
389ds:mainfrom
tbordaz:issue_6417
Dec 2, 2024
Merged

Issue 6417 - If an entry RDN is identical to the suffix, then Entryrd…#6418
tbordaz merged 1 commit into
389ds:mainfrom
tbordaz:issue_6417

Conversation

@tbordaz

@tbordaz tbordaz commented Nov 22, 2024

Copy link
Copy Markdown
Contributor

…n gets broken during a reindex

Bug description:
During a reindex, the entryrdn index is built at the end from
each entry in the suffix.
If one entry has a RDN that is identical to the suffix DN,
then entryrdn_lookup_dn may erroneously return the suffix DN
as the DN of the entry.

Fix description:
When the lookup entry has no parent (because index is under
work) the loop lookup the entry using the RDN.
If this RDN matches the suffix DN, then it exits from the loop
with the suffix DN.
Before exiting it checks that the original lookup entryID
is equal to suffix entryID. If it does not match
the function fails and then the DN from the entry will be
built from id2enty

fixes: #6417

Reviewed by:

@progier389 progier389 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice finding and nice test case but the test case fails on lmdb 😉
IMHO entryrdn_lookup_dn is not even called in lmdb case ...

I wonder if the bdb fix could not be more simple. Something like:

         if (maybesuffix) {
+            if (id  >= 1) { 
+                rc = -1;
+                goto bail;
+            }

@droideck droideck left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And yep, looks like LMDB wasn't able to reindex... The ds2index output in the LMDB test:

2
  ID: 2; RDN: "ou=my_org"; NRDN: "ou=my_org"
C1
  ID: 2; RDN: "ou=my_org"; NRDN: "ou=my_org"
P2
  ID: 1; RDN: "dc=dup_rdn"; NRDN: "dc=dup_rdn"
dc=dup_rdn
  ID: 1; RDN: "dc=dup_rdn"; NRDN: "dc=dup_rdn"

Comment thread dirsrvtests/tests/suites/indexes/entryrdn_test.py Outdated
@progier389

Copy link
Copy Markdown
Contributor

Looks like last commit generated a serious regression on lmdb
BTW: seems that issue #6386 also induced a regression ...

@tbordaz

tbordaz commented Nov 25, 2024

Copy link
Copy Markdown
Contributor Author

Absolutely... it fixes my original testcase but broke everything else ;)
I am investigating a better fix

@tbordaz
tbordaz force-pushed the issue_6417 branch 2 times, most recently from a70357a to 5c8ee4f Compare November 28, 2024 05:19

@progier389 progier389 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, This time all the tests are PASS except the backup one which is fixed by PR #6423

…n gets broken during a reindex

Bug description:
        During a reindex, the entryrdn index is built at the end from
        each entry in the suffix.
        If one entry has a RDN that is identical to the suffix DN,
        then entryrdn_lookup_dn may erroneously return the suffix DN
        as the DN of the entry.

Fix description:
        When the lookup entry has no parent (because index is under
        work) the loop lookup the entry using the RDN.
        If this RDN matches the suffix DN, then it exits from the loop
        with the suffix DN.
        Before exiting it checks that the original lookup entryID
        is equal to suffix entryID. If it does not match
        the function fails and then the DN from the entry will be
        built from id2enty

fixes: 389ds#6417

Reviewed by: Pierre Rogier, Simon Pichugin (Thanks !!!)

@droideck droideck left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! Ack

@tbordaz
tbordaz merged commit 99e6707 into 389ds:main Dec 2, 2024
tbordaz added a commit that referenced this pull request Dec 2, 2024
…n gets broken during a reindex (#6418)

Bug description:
        During a reindex, the entryrdn index is built at the end from
        each entry in the suffix.
        If one entry has a RDN that is identical to the suffix DN,
        then entryrdn_lookup_dn may erroneously return the suffix DN
        as the DN of the entry.

Fix description:
        When the lookup entry has no parent (because index is under
        work) the loop lookup the entry using the RDN.
        If this RDN matches the suffix DN, then it exits from the loop
        with the suffix DN.
        Before exiting it checks that the original lookup entryID
        is equal to suffix entryID. If it does not match
        the function fails and then the DN from the entry will be
        built from id2enty

fixes: #6417

Reviewed by: Pierre Rogier, Simon Pichugin (Thanks !!!)
tbordaz added a commit that referenced this pull request Dec 2, 2024
…n gets broken during a reindex (#6418)

Bug description:
        During a reindex, the entryrdn index is built at the end from
        each entry in the suffix.
        If one entry has a RDN that is identical to the suffix DN,
        then entryrdn_lookup_dn may erroneously return the suffix DN
        as the DN of the entry.

Fix description:
        When the lookup entry has no parent (because index is under
        work) the loop lookup the entry using the RDN.
        If this RDN matches the suffix DN, then it exits from the loop
        with the suffix DN.
        Before exiting it checks that the original lookup entryID
        is equal to suffix entryID. If it does not match
        the function fails and then the DN from the entry will be
        built from id2enty

fixes: #6417

Reviewed by: Pierre Rogier, Simon Pichugin (Thanks !!!)
tbordaz added a commit that referenced this pull request Dec 2, 2024
…n gets broken during a reindex (#6418)

Bug description:
        During a reindex, the entryrdn index is built at the end from
        each entry in the suffix.
        If one entry has a RDN that is identical to the suffix DN,
        then entryrdn_lookup_dn may erroneously return the suffix DN
        as the DN of the entry.

Fix description:
        When the lookup entry has no parent (because index is under
        work) the loop lookup the entry using the RDN.
        If this RDN matches the suffix DN, then it exits from the loop
        with the suffix DN.
        Before exiting it checks that the original lookup entryID
        is equal to suffix entryID. If it does not match
        the function fails and then the DN from the entry will be
        built from id2enty

fixes: #6417

Reviewed by: Pierre Rogier, Simon Pichugin (Thanks !!!)
tbordaz added a commit that referenced this pull request Dec 2, 2024
…n gets broken during a reindex (#6418)

Bug description:
        During a reindex, the entryrdn index is built at the end from
        each entry in the suffix.
        If one entry has a RDN that is identical to the suffix DN,
        then entryrdn_lookup_dn may erroneously return the suffix DN
        as the DN of the entry.

Fix description:
        When the lookup entry has no parent (because index is under
        work) the loop lookup the entry using the RDN.
        If this RDN matches the suffix DN, then it exits from the loop
        with the suffix DN.
        Before exiting it checks that the original lookup entryID
        is equal to suffix entryID. If it does not match
        the function fails and then the DN from the entry will be
        built from id2enty

fixes: #6417

Reviewed by: Pierre Rogier, Simon Pichugin (Thanks !!!)
tbordaz added a commit that referenced this pull request Dec 2, 2024
…n gets broken during a reindex (#6418)

Bug description:
        During a reindex, the entryrdn index is built at the end from
        each entry in the suffix.
        If one entry has a RDN that is identical to the suffix DN,
        then entryrdn_lookup_dn may erroneously return the suffix DN
        as the DN of the entry.

Fix description:
        When the lookup entry has no parent (because index is under
        work) the loop lookup the entry using the RDN.
        If this RDN matches the suffix DN, then it exits from the loop
        with the suffix DN.
        Before exiting it checks that the original lookup entryID
        is equal to suffix entryID. If it does not match
        the function fails and then the DN from the entry will be
        built from id2enty

fixes: #6417

Reviewed by: Pierre Rogier, Simon Pichugin (Thanks !!!)
tbordaz added a commit that referenced this pull request Dec 2, 2024
…n gets broken during a reindex (#6418)

Bug description:
        During a reindex, the entryrdn index is built at the end from
        each entry in the suffix.
        If one entry has a RDN that is identical to the suffix DN,
        then entryrdn_lookup_dn may erroneously return the suffix DN
        as the DN of the entry.

Fix description:
        When the lookup entry has no parent (because index is under
        work) the loop lookup the entry using the RDN.
        If this RDN matches the suffix DN, then it exits from the loop
        with the suffix DN.
        Before exiting it checks that the original lookup entryID
        is equal to suffix entryID. If it does not match
        the function fails and then the DN from the entry will be
        built from id2enty

fixes: #6417

Reviewed by: Pierre Rogier, Simon Pichugin (Thanks !!!)
tbordaz added a commit that referenced this pull request Dec 2, 2024
…n gets broken during a reindex (#6418)

Bug description:
        During a reindex, the entryrdn index is built at the end from
        each entry in the suffix.
        If one entry has a RDN that is identical to the suffix DN,
        then entryrdn_lookup_dn may erroneously return the suffix DN
        as the DN of the entry.

Fix description:
        When the lookup entry has no parent (because index is under
        work) the loop lookup the entry using the RDN.
        If this RDN matches the suffix DN, then it exits from the loop
        with the suffix DN.
        Before exiting it checks that the original lookup entryID
        is equal to suffix entryID. If it does not match
        the function fails and then the DN from the entry will be
        built from id2enty

fixes: #6417

Reviewed by: Pierre Rogier, Simon Pichugin (Thanks !!!)
tbordaz added a commit that referenced this pull request Dec 2, 2024
…n gets broken during a reindex (#6418)

Bug description:
        During a reindex, the entryrdn index is built at the end from
        each entry in the suffix.
        If one entry has a RDN that is identical to the suffix DN,
        then entryrdn_lookup_dn may erroneously return the suffix DN
        as the DN of the entry.

Fix description:
        When the lookup entry has no parent (because index is under
        work) the loop lookup the entry using the RDN.
        If this RDN matches the suffix DN, then it exits from the loop
        with the suffix DN.
        Before exiting it checks that the original lookup entryID
        is equal to suffix entryID. If it does not match
        the function fails and then the DN from the entry will be
        built from id2enty

fixes: #6417

Reviewed by: Pierre Rogier, Simon Pichugin (Thanks !!!)
tbordaz added a commit that referenced this pull request Dec 2, 2024
…n gets broken during a reindex (#6418)

Bug description:
        During a reindex, the entryrdn index is built at the end from
        each entry in the suffix.
        If one entry has a RDN that is identical to the suffix DN,
        then entryrdn_lookup_dn may erroneously return the suffix DN
        as the DN of the entry.

Fix description:
        When the lookup entry has no parent (because index is under
        work) the loop lookup the entry using the RDN.
        If this RDN matches the suffix DN, then it exits from the loop
        with the suffix DN.
        Before exiting it checks that the original lookup entryID
        is equal to suffix entryID. If it does not match
        the function fails and then the DN from the entry will be
        built from id2enty

fixes: #6417

Reviewed by: Pierre Rogier, Simon Pichugin (Thanks !!!)
Firstyear added a commit to Firstyear/389-ds-base that referenced this pull request Sep 25, 2025
… Entryrdn gets broken during a reindex (389ds#6418)"

This reverts commit ccbb8ba.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

If an entry RDN is identical to the suffix, then Entryrdn gets broken during a reindex

3 participants