d9c8b1f Ticket #47834 - Tombstone_to_glue: if parents are also converted to glue, the target entry's DN must be adjusted.

Authored and Committed by nhosoi 9 years ago
    Ticket #47834 - Tombstone_to_glue: if parents are also converted to glue, the target entry's DN must be adjusted.
    
    Bug Description: Test case to verify the problem crashed the server.
    
    Fix Description:
    1. Clean up entry cache related code
    1-1. Changing cache log reentrant to avoid self deadlock.
    1-2. Introducing cache_is_in_cache to get rid of local variables in
         ldap_back_{add,delete,modify,modrdn}.
    2. ldap_back_{add,delete,modify,modrdn}
    2-1. As described in 1-2, removed [a-z]*_in_cache local variables.
    2-2. In the deadlock retry loop, entries were duplicated by backentry_
         dup after CACHE_REMOVE'd and CACHE_RETURN'ed.  At the moment, the
         entry could be already freed.  Changed to create a duplicated
    	 entry before calling CACHE_REMOVE and CACHE_RETURN.
    3. _cl5NewDBFile (replication/cl5_api.c): When a leftover semaphore is
       found, _cl5NewDBFile removes it and creates it, but it rarely fails
       to delete and it causes the server restart fail.  Adding a message
       to remove such a leftover semaphore by ipcrm.
    
    https://fedorahosted.org/389/ticket/47834
    
    Reviewed by mreynolds@redhat.com (Thank you, Mark!!)
    (cherry picked from commit 6333936da2c4287e96b36fecc24a4c62da5a8ea2)