Allow JsonParse to parse primitives at top level

Also, add JsonPrimitiveTypeToString

cherry-picked from 2c49abaa5d98edee3c053eab73c7fdb7f6223f01
Spelling correction: Commerical -> Commercial

(cherry picked from commit f397661c5b7e6522841e95859f5320fc977fea1e)
Valgrind friendly openssl, if getenv("CFENGINE_TEST_PURIFY_OPENSSL")

Even if you compile your openssl with -DPURIFY and no-asm, valgrind
still outputs a very long list of uninitialised variable warnings. It
turns out that the "blinding" feature of openssl is the culprit.

(cherry picked from commit 6a48977fd8c58753e3382e4b4d6eb67589c4f96c)
Fix package_list_update_ifelapsed having no effect on "apt-get update"

Redmine #3981, #5339.

It is documented as having the described effect, but does not.

The timestamp for the last update is now maintained by a timestamp
file, /var/cfengine/state/software_update_timestamp_<manager>, where
<manager> is the package executable that is being used for the current
promise.
Ideally it should be integrated with the database, but we want the low
risk solution right now, and we plan to replace this code anyway.
Make lmdb recreate a file if it has an invalid format
(cherry picked from commit 5a752e9693d14ae41e051dfc5380c36bd01abe34)
Redmine#5454: use CSV parser in package*matching() and CSV writer in ReportSoftware

(cherry picked from commit aaf6daeed25f242e9f019f27166795de1e063564)
Removing buggy undocumented feature ...

... according to discussion at
https://github.com/jimis/core/commit/d4999f291bf937ef36ee05c28149ca773b172865
Fix selectservers().

See Redmine #5458. Thanks to Bob Ingersoll for spotting it.
Add acceptance test for selectservers().
TryConnect() should return error when select() times out.
Logging in milliseconds is ugly.
Fix socket descriptor leak.
Acceptance test for selectservers() now checks failures as well as successes.

Unfortunately some requests may timeout, which means that the test will
take 30s to complete. In the future we should enable parallel test
harness to avoid waiting.
Selectservers() now logs INFO in case of timeout.
Beautify message.
Use dcs_passif_expected() to check and report all classes are set.
Change timeout so that acceptance test takes only 5 seconds instead of 30.

Does not work for now, should work after redmine #5497 gets fixed.
Merge branch 'jimis/selectservers' into 3.6.x
remove export_zenoss constraint

(cherry picked from commit 77cce88ced75ece45c97f52d6c3ed9f7ce104471)
Leak-fix in FnCallRegExtract().

One of its premature returns neglected to free the arrayname.

(cherry picked from commit 6e753a6dc29dfea6c221072c32f93fc6d7868564)