Redmine#4848: fix peers, peerleader, and peerleaders functions and add tests
RM3979: reworked a test to use putenv() instead of setenv().
Cleanup OpenSSL locking functions.
Error checking mutexes for OpenSSL.
Introduced proper checking and logging of our locking primitives.

ThreadLock(), ThreadUnlock() should now be preferred against
native pthread_mutex_lock().
Use error checking mutexes for our dbm API.
RM #5325 add test for duplicate bundle calls.
Do not treat promiser as regex in insert_lines promises

Close #5270
Redmine#5270: simplify test
Use SaveAsFile for Mustache templates

Close #5292
Optimize, more precompiled regex
Fix incorrect extension stub definition.
Redmine #5337: Fix sporadic deadlock in dlsym().

Apparently dlsym() is not threadsafe, so we need to protect it with a
mutex.
Redmine #5337: Optimize by caching calls to dlsym().

- Introduce static function pointer which we save between calls.

- Thread safety is not needed, since even if two threads try to write
  to the function pointer simultaneously, both will write the same
  value.

- The old stub code is inline, so we cannot use a static variable
  there. Fixed my moving the stub code into the stub macro instead,
  where it doesn't need to be inline.
Redmine#5339: add packageupdatesmatching function
Add test for mustache encountering string instead of list in json data

Also test for different inode after mustache template applied.
Ref: Redmine:5292
Redmine#5292: acceptance test fixups
Redmine#5292: acceptance test fixups for Windows
Merge pull request #1615 from kacfengine/dlsym_thread_safety_fix

Redmine #5337: Dlsym thread safety fix and optimizations.
Merge pull request #1604 from tzz/redmine4848-peers

Redmine#4848: fix peers, peerleader, and peerleaders functions and add tests