When loading an entry from the backend it is known to be well formed and str2entry_fast() could be used, but always str2entry_dupcheck() is called. The reason is that id2entry() sets the flag SLAPI_STR2ENTRY_NO_ENTRYDN and this flag is not contained in the set of flags known to be handled by str2entry_fast() although it does have code for this flag
A good catch, Ludwig. It's a bug. Thank you for finding it out!
git patch file (master) 0001-Trac-Ticket-531-loading-an-entry-from-the-database-s.patch
Fix Description: This patch is adding flags SLAPI_STR2ENTRY_ NO_ENTRYDN and SLAPI_STR2ENTRY_DN_NORMALIZED to the local macro SLAPI_STRENTRY_FLAGS_HANDLED_IN_SLAPI_STR2ENTRY, which is used to determine the string formatted entry can be processed by str2entry_fast or not. Also, this patch defines a macro str2entry_can_use_fast to increase the code readability.
Reviewed by Mark (Thank you!!!).
Pushed to master: commit 7af4fc1
Would prefer that macros are in ALL CAPS to distinguish them from regular functions.
Also, the logic looks strange: {{{ + if (str2entry_can_use_fast(flags)) + { e= str2entry_dupcheck( NULL/dn/, s, flags, read_stateinfo ); - } - else - { + } + else + { e= str2entry_fast( NULL/dn/, s, flags, read_stateinfo ); - } }}}
It looks like if (str2entry_can_use_fast(flags)) then do not call str2entry_fast, call str2entry_dupcheck instead - is this as intended?
additinal git patch file (master) 0001-Trac-Ticket-531-loading-an-entry-from-the-database-s.2.patch
Description: Based upon the comments by Rich Megginson (Thanks!!), changing the newly introduced macro to all upper case. Plus, it was pointed out that the meaning of the macro name was opposite. Fixing these 2 issues, this patch replaces the macro str2entry_ can_use_fast with STR2ENTRY_CANNOT_USE_FAST.
Thanks!
Thanks to Rich for his reviews and comments!!
Pushed to master: commit b3a0ab7
Rich Megginson wrote:
And if we know that all teh entries will be read from disk, we should ensure that their version is not exposed to #531 and str2entry_fast is used. I don't think that fix is in 1.2.11 - I suppose we could consider a backport to 6.5
This patch is in 1.3.0 and newer, but not in 1.2.11.
I set 1.2.11.22 to milestone.
Pushed to 389-ds-base-1.2.11: commit b5dc3db
Note: 389-ds-base-1.3.0 was branched after this patch is pushed to master. Thus, 389-ds-base-1.3.0 as well as 1.3.1 include this fix.
Ticket has been cloned to Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=958522
Metadata Update from @rmeggins: - Issue assigned to nhosoi - Issue set to the milestone: 1.2.11.22
389-ds-base is moving from Pagure to Github. This means that new issues and pull requests will be accepted only in 389-ds-base's github repository.
This issue has been cloned to Github and is available here: - https://github.com/389ds/389-ds-base/issues/531
If you want to receive further updates on the issue, please navigate to the github issue and click on subscribe button.
subscribe
Thank you for understanding. We apologize for all inconvenience.
Metadata Update from @spichugi: - Issue close_status updated to: wontfix (was: Fixed)
Login to comment on this ticket.