Ticket 47729 - Directory Server crashes if shutdown during a replication initialization

Bug Description:  When a shutdown was detected we marked that the total update was done
                  prematurely(prp->stopped).  This allowed the replication plugin to close
                  while the total update was still in progress. Other plugins continued to
                  be shutdown (e.g. ldbm database), while the total update was using shared
                  resources - which lead to a crash.

Fix Description:  Only mark the total update protocol as stopped, after it is finished using
                  shared resources.

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

Reviewed by: nhosoi(Thanks!)
(cherry picked from commit e7f7e9127717c1d432b10493b626fed334cc595f)
Ticket #47731 - A tombstone entry is deleted by ldapdelete

Description: A tombstone deletion by ldapdelete op from client is
supposed to fail.  The failure from SLAPI_PLUGIN_BETXNPOSTOPERATION
was ignored in 389-ds-base-1.2.11 plugin_call_func and it was not
passed to the backend to abort.  This patch added the check in the
same way as in 389-ds-base-1.3.1 and newer.

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

Reviewed by rmeggins@redhat.com (Thank you, Rich!)
Ticket #47735 - e_uniqueid fails to set if an entry is a conflict entry

Bug Description:
When an entry is turned to be a conflict entry, its nsUniqueId has
a mdcsn info as a subtype like this:
 nsUniqueId;mdcsn-5319136f000200010000: c5e0d787-a58f11e3-b7f9dfd1-acc3d5e4
In this case, the attribute type is assigned to the berval "type"
as follows:
 type.bv_val = "nsUniqueId;mdcsn-5319136f000200010000"
 type.bv_len = 37
The subtyped stateinfo is processed in str2entry_state_information_from_type,
which modifies type.bv_val to "nsUniqueId", but type.bv_len remains 37.
str2entry_fast has this logic to set e_uniqueid, where the nsUniqueId
with stateinfo fails to set the value to e_uniqueid.
 if ( type.bv_len == 10 &&
      PL_strncasecmp (type.bv_val, "nsUniqueId", type.bv_len) == 0 ){

Fix Description: This patch resets the length of the type with the
basetype length 10 before the if expression is called for setting
e_uniqueid.

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

Reviewed by rmeggins@redhat.com (Thank you, Rich!!)
(cherry picked from commit a02f94191f38f46eff4f777083b5a50624d46a89)
(cherry picked from commit 6153865313beaff49bde969d71d72fa0e80c3c1f)
Ticket #47737 - Under heavy stress, failure of turning a tombstone into glue makes the server hung

Description: Turning a tombstone entry to a glue entry is done in a
while loop (create_glue_entry:urp_glue.c) Unless the transformation
is successful (or LDAP_NO_SUCH_OBJECT), it cannot exit from the loop.
But under a stress, there could be a tombstone and a conflict entry
coexist, and do_create_glue_entry keeps returning LDAP_ALREADY_EXISTS.
In such a case, we need to give up creating a glue.

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

Reviewed by rmeggins@redhat.com (Thank you, Rich!)
(cherry picked from commit a84dab5923de59cfda9bd4e78813d0c22bab35ae)
(cherry picked from commit 97fa6d25159bcdbc6701c4696d675683bed34761)
(cherry picked from commit b92eb1ad96039df4bea35f6e318912adf0d63014)
Ticket 47704 - invalid sizelimits in aci group evaluation

Bug Description:  aci group evaluation fails because of sizelimit exceeded
			but it is exceeded because it is -1476887876 or another
			negative integer becasue operation parameter are a union
			based on operation types and so for otehr than search
			the value is dependent on the operation params

Fix Description:   treat any negative integer like -1 (unlimited). A better fix
			would be to introduce a specific configuration param or
			to abondon the limit in group evaluation at all. But this
			could introduce backward compatibility problems and
			will be handled in ticket 47703 for newer versions

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

Reviewed by: Rich, thanks
(cherry picked from commit 377266ebb2ff488aa3cc4b96990c002db7e6103e)
Ticket #47739 - directory server is insecurely misinterpreting authzid on a SASL/GSSAPI bind

Description: SASL_CB_PROXY_POLICY callback is not needed since we
don't support the case authid and authzid do not match.  This patch
gets rid of the callback function ids_sasl_proxy_policy.

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

Reviewed by nkinder@redhat.com (Thank you, Nathan!!)
(cherry picked from commit 76acff12a86110d4165f94e2cba13ef5c7ebc38a)
(cherry picked from commit 9bc2b46b7c7ee4c975d04b041f73a5992906b07c)
(cherry picked from commit d2063c889feeba122e12f152e2e2c98aed4eb442)
bump version to 1.2.11.26
Ticket 47722 - rsearch filter error on any search filter

Bug Description:  A NULL gets incorrectly added to the search filter, which
                  creates an invalid filter.

Fix Description:  Do not add a NULL character to the search filter.

Original fix submitted by nkinder(Thanks!)

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

Reviewed by: nhoosi(Thanks!)
(cherry picked from commit 8afcf90b0d9d6599144bb1666ca79cef9e91b3ef)
Ticket47722 - Fixed filter not correctly identified

Bug Description:  Due to an improper table initialization, fixed filters
                  were not correctly identifed, which lead to incorrect
                  code execution.

Fix Description:  Correct the table initialization.  Also, removed all the
                  fixed buffers for user supplied values.  Also increased
                  the maximum string length to handle a 64bit unsigned integer.

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

Reviewed by: richm(Thanks!)
(cherry picked from commit e118eabf705e7cab724814fb0f5cffa09e6ac8ce)
Ticket #47734 - Change made in resolving ticket #346 fails on Debian SPARC64

Description: The following change is not generic beyond x86 and
x86_64 architecture.  Putting the change into "#if (defined(CPU_x86)
|| defined(CPU_x86_64))".
 commit c0151f78509c35250095da6e2785842337963008
 Trac Ticket #346 - Slow ldapmodify operation time for large
                    quantities of multi-valued attribute values
 3) In slapi_has8thBit, instead of checking the 8th bit one byte
 by one byte, check 4 bytes at one time.

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

Reviewed by rmeggins@redhat.com (Thank you, Rich!!)
(cherry picked from commit 1e00913312e165ead2f3a25b6d70f7839115007e)
(cherry picked from commit ba9248d02447dc693114961d9296ecb742a75add)
(cherry picked from commit 450607a75d23984da12c83e785a2e1cfbf49964d)
Ticket 47740 - Coverity Fixes (Mark - part 1)

Fixed these issues:

12510 - resource leak in lib/libutil/certmap.c
12509 - resource leak in ldap/servers/plugins/chainingdb/cb_bind.c
12508 - resource leak in ldap/servers/plugins/replication/repl5_replica_config.c
12507 - resource leak in ldap/servers/plugins/replication/repl5_replica_config.c
12506 - resource leak in ldap/servers/plugins/chainingdb/cb_config.c
12505 - resource leak in ldap/servers/plugins/posix-winsync/posix-winsync.c
12500 - resource leak in ldap/servers/plugins/chainingdb/cb_instance.c

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

Reviewed by: nhosoi(Thanks!)
(cherry picked from commit d3ed247b7ed59eac8776ea9e73ee21ec8bcd2011)
Ticket 47538 - RFE: repl-monitor.pl plain text output, cmdline config options

RFE Description:  Request option to print report in plain text(instead of HTML), and
                  be able to add the configfuration file directives as command line
                  options.

Fix Description:  Add a new option "-s" for displaying plain text report.

                  Added new options for the config file directives:

                      -c "connection value"
                      -a "alias value"
                      -k "color value"

                  Added a new option (-W, --prompt) to prompt for passwords.

                  Added "long names" to the commandline options.
                  Updated to use:  GetOpts::Long, strict, warnings

                  Cleaned up some HTML code/colors, and indentation.

                  Update man page.

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

Reviewed by: nhosoi, nkinder, and rmeggins(Thanks!!!)
(cherry picked from commit 76abd736d3bf763cc0e7bc1987fe76c27159db6f)
Ticket 47640 - Fix coverity issues - part 3

12504 - resource leak - /ldap/servers/slapd/back-ldbm/import-threads.c
12499 - resource leak - /ldap/servers/slapd/passwd_extop.c
12497 - resource leak - /ldap/servers/slapd/mapping_tree.c
12496 - resource leak - /ldap/servers/slapd/mapping_tree.c
12495 - resource leak - /ldap/servers/plugins/replication/legacy_consumer.c
12493 - resource leak - /ldap/servers/slapd/tools/rsearch/sdattable.c
12492 - resource leak - /ldap/servers/slapd/tools/pwenc.c
12491 - resource leak - /ldap/servers/slapd/tools/mmldif.c

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

Reviewed by: rmeggins(Thanks!)
(cherry picked from commit ff78177452f1ac3da6039640815cc2eaf55b0b40)
(cherry picked from commit 2b9788b7d282b055b6f1945eb3f3b5c784d779fc)
Ticket 47740 - Fix coverity erorrs - Part 4

12498 - resource leak - /ldap/servers/plugins/chainingdn/cb_instance.c
12490 - resource leak - /ldap/servers/plugins/chainingdn/cb_controls.c
12489 - resource leak - /ldap/servers/plugins/replication/repl5_replica_config.c
12488 - resource leak - /ldap/servers/slapd/main.c
12485 - resource leak - /ldap/servers/plugins/replication/repl5_replica_config.c
12484 - resource leak - /ldap/servers/plugins/replication/repl5_replica_config.c
12483 - resource leak - /ldap/servers/slapd/back-ldbm/upgrade.c
12482 - resource leak - /ldap/servers/plugins/replication/repl5_replica.c
12481 - resource leak - /ldap/servers/plugins/acl/aclplugin.c
12476 - resource leak - /ldap/servers/slapd/back-ldbm/upgrade.c
12475 - resource leak - /ldap/servers/slapd/back-ldbm/upgrade.c

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

Reviewed by: nhosoi(Thanks!)