9098fc7 Bug 631862 - crash - delete entries not in cache + referint

Authored and Committed by nhosoi 13 years ago
    Bug 631862 - crash - delete entries not in cache + referint
    
    https://bugzilla.redhat.com/show_bug.cgi?id=631862
    Resolves: bug 631862
    Bug Description: crash - delete entries not in cache + referint
    Reviewed by: rmeggins and nhosoi
    Branch: master
    Fix Description: When deleting an entry, the referential integrity (referint)
    plugin does an internal search to find references to this entry (e.g. in
    group entries) and removes them.  The search code wants to ensure that the
    entrydn attribute is present in the entry when using entryrdn (subtree
    rename).  The search code sets a flag to tell the id2entry code to add the
    entrydn attribute if it is not present.  However, it was doing this to an
    entry in the cache, which may be in use by another thread.  The solution is
    to add the entrydn attribute before adding the entry to the cache.  In the
    id2entry code, this is after the entry has been read from the id2entry db
    successfully, but before the entry is added to the cache.  In the LDAP ADD
    code, this is done when the other computed operational attributes are added
    to the new entry.
    In addition to the above fix by rmeggins@redhat.com, following changes are
    made:
    1) entrydn attribute is always added to the entry in memory before putting
       it in the entry cache, and the attribute is removed before writing the
       entry to the database.
    2) eliminating id2entry_ext, which was introduced to pass flags, but it is
       no longer needed since only a flag ID2ENTRY_ADD_ENTRYDN was removed.
       Platforms tested: RHEL5 x86_64
       Flag Day: no
       Doc impact: no