Special thanks to Andrey Ivanov for the discussion. It was very
helpful. I revised the patch to adjust the parent DN if it's different
from the existing one in DB.
Description: Code for supporting entrydn (added for Bug 578296)
contained a bug. If an entry was found in the entry cache,
id2entry_ext returned it without adding the entrydn attribute
value. This patch fixes the problem.
In addition, if the parent DN in the to-be-added entry is not
identical to the real parent DN (e.g., dc=eXAmple vs. dc=example),
replace the string with the real parent DN. This check& replace
is done only when the parent entry is in the entry cache not to
sacrifice the performance.
And sorry to dear Reviewers, I could not resist fixing 3 indentations...