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!!)
Ticket 47877 - check_and_add_entry fails for changetype: add and existing entry

Bug Description:  If an ldif file in the updates directory contains
			changetype: add, the add fails if the entry
			already exist

Fix Description:   ignore existing entries also in case of
			explicite changetype

https://fedorahosted.org/389/ticket/47877

Reviewed by: ?
Ticket 47816 -v2- internal syncrepl searches are flagged as unindexed

Bug Description:  if syncrepl is enabled it uses an attribute targetuniqueid
			for internal searches. this is not indexed and
			lot of warnings are logged

Fix Description:   add an equality index to the default indexes
			for exising instances tit will add the index
			to the changelog backend and trigge a reindex

https://fedorahosted.org/389/ticket/47816

Reviewed by: ?
Ticket #47876 - coverity defects in slapd/tools/mmldif.c

Fix Description:
Defect type: CLANG_WARNING
1. ldap/servers/slapd/tools/mmldif.c:1404:5:warning Value stored to 'att' is never read
   Removed unnecessary att initialization.
2. ldap/servers/slapd/tools/mmldif.c:1322:5:warning Value stored to 'rc' is never read
   Removed unnecessary rc assignment.
3. ldap/servers/slapd/tools/mmldif.c:1148:25:warning Access to field 'next' results in a dereference of a null pointer (loaded from variable 'a')
   false positive.
   (cmp < 0) means 'a' is not NULL.
4. ldap/servers/slapd/tools/mmldif.c:522:9:warning Value stored to 'count' is never read
   Removed unused count.
5. ldap/servers/slapd/tools/mmldif.c:518:9:warning Value stored to 'pmask' is never read
   Removed unused pmask.
6. ldap/servers/slapd/tools/mmldif.c:517:9:warning Value stored to 'pindex' is never read
   Removed unused pindex.
7. ldap/servers/slapd/tools/mmldif.c:447:9:warning Value stored to 'pmask' is never read
   Removed unused pmask.
8. ldap/servers/slapd/tools/mmldif.c:446:9:warning Value stored to 'pindex' is never read
   Removed unused pindex.

https://fedorahosted.org/389/ticket/47876

Reviewed by tbordaz@redhat.com (Thank you Thierry!!)
Ticket 47866 - Errors after upgrading related to attribute "dnaremotebindmethod"

Bug Description:  the dnaSharedConfig entries can contain "(null)" values

Fix Description:   check if remoteBindDn and remoteConnProtocol are set, before
                   creating a vaue for teh entries.
                   NOTE: if these values aready have been created they have to be
                   deleted and the server restarted

https://fedorahosted.org/389/ticket/47866

Reviewed by: mark, thanks
Ticket #47879 - coverity defects in plugins/replication/windows_protocol_util.c

Description:
Defect type: CLANG_WARNING
1. ldap/servers/plugins/replication/windows_protocol_util.c:6024:warning – Value stored to 'rc' is never read
   # rc = windows_process_dirsync_entry(prp,e,0);
   # ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   Removed the unnecessary assignment.
2. ldap/servers/plugins/replication/windows_protocol_util.c:1713:warning – Value stored to 'return_value' is never read
   # return_value = windows_conn_send_rename(prp->conn, slapi_sdn_get_dn(remote_dn),
   # ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   Added return_value checking code.
3. ldap/servers/plugins/replication/windows_protocol_util.c:629:warning – Value stored to 'return_value' is never read
   Removed the unnecessary assignment to return_value.

https://fedorahosted.org/389/ticket/47879

Reviewed by mreynolds@redhat.com (Thank you, Mark!!)
Ticket 47871 - 389-ds-base-1.3.2.21-1.fc20 crashed over the weekend

Bug Description:
	Retro-changelog trimming uses a slapi_search_internal_callback_pb to check
	if the oldest record needs to be trim.
	The callback function handle_getchangerecord_search stores the entry
	in the callback structure.
	Later it evaluates the entry to check its changetime.
	This is not valid, as the entry is only valid inside the callback.

Fix Description:
	The callback function 'handle_getchangetime_search' evaluate
	the changetime and returns it in the callback struct.

https://fedorahosted.org/389/ticket/47871

Reviewed by: Noriko Hosoi (Thanks Noriko !)

Platforms tested: F17/F20

Flag Day: no

Doc impact: no
Ticket 47885 - deref plugin should not return references with noc access rights

Bug Description:  deref shows derefernced entries for which th client doesn't
                  have access as dn and empty attribute list

Fix Description:   if client has no accesss to the derferernced entry then
                   omit it from the list in the deref control
                   In general, if no entries are returned don't send an empty control

https://fedorahosted.org/389/ticket/47885

Reviewed by: noriko, thanks
Ticket #47875 - dirsrv not running with old openldap

Description: To check libldif, -lldap$ol_libver needs to be added
to LDFLAGS to compile test conftest.c.
Ticket #47875 - dirsrv not running with old openldap

Description: removed unnecessary checking for -lldif from openldap.m4.
bump version to 1.3.4.a1
Ticket 47893 - should use Sys::Hostname instead Net::Domain

Bug Description: hostfqdn function does not always return the correct fqdn.
                 Sometimes it incorrectly adds ".com" when it should not.

Fix Description: Use Sys::Hostname/hostname() which does return the correct
                 fqdn.

https://fedorahosted.org/389/ticket/47893

Reviewed by: rmeggins(Thanks!)
Ticket #47748 - Simultaneous adding a user and binding as the user could fail in the password policy check

Description: commit 4fc53e1a63222d0ff67c30a59f2cff4b535f90a8 fix for
Ticket #47748 introduced a bug: "Simple bind hangs after enabling
password policy".

In do_bind, slapi_check_account_lock and need_new_pw overwrote the
return code from backend bind which is used later. This patch fixes
it not to override the return code.

https://fedorahosted.org/389/ticket/47748

Reviewed by mreynolds@redhat.com (Thank you, Mark!!)
Ticket #47834 - Tombstone_to_glue: if parents are also converted to glue, the target entry's DN must be adjusted.

Description: Previous fix for the ticket #47834 broke the CI test case
47815.

The fix for 47815 removed the addingentry from the entry cache if
SLAPI_PLUGIN_BE_TXN_POST_ADD_FN failed.  The #47834 patch accidentally
deleted the code.

Instead of adding it back, this patch moves the deletion of the entry
from the entry cache to cover both cases SLAPI_PLUGIN_BE_TXN_POST_ADD
_FN successes or fails.

https://fedorahosted.org/389/ticket/47834

Reviewed by mreynolds@redhat.com (Thank you, Mark!!)
Ticket #47890 - minor memory leaks in utilities

Description:
tools/rsearch/nametable.c - if nt_push fails and the strdup'ed
                            string is not pushed to the table,
                            free the string.
tools/migratecred.c - free strdup'ed strings oldpath, newpath,
                      prefixCred, and pluginpath at the end of
                      the process.

https://fedorahosted.org/389/ticket/47890

Reviewed by mreynolds@redhat.com (Thank you, Mark!!)
fix for 47885 did not always return a response control

reviewd by rich, thanks