IsDir2().
Fixed documentation, added TODO.
Promise constification.
Add safeguard when reading timestamp from cf_promises_valid.

If the file contains valid JSON, but is missing the timestamp field,
then the attempted fetch of the value will crash, leaving all daemons
dead in the water.
Separate validated and release_id information into separate files.

The base problem is that only the policy server has enough information
to generate the release_id, most notably because the server will have
a git repository with a tag, whereas each agent will not. Therefore
the agents will generate a different release_id, based on file
contents. Add to the problem that stale files at each agent can also
influence the result, and you have a mess. Therefore only the policy
server should be allowed to generate the release_id.

This is a problem because each agent must be able to generate
cf_promises_validated, so that it can trigger a policy reload in its
daemons.

The problem is solved by separating those two pieces of information
(timestamp in cf_promises_validated, and releaseId in
cf_promises_release_id). All agents generate the former; only the
policy server generates the latter, with other agents downloading it.
Merge pull request #1328 from tzz/feature/3454-text-manipulation-functions-rename

Redmine#3454: rename string functions to string_*
Merge pull request #1047 from tzz/feature/datastate

datastate() function to provide the container used by default templates
examples/datastate.cf: add example of new function
Changed "BAD:" to "BAD: "...

...makes it a bit harder to hit this message in random data and does not
break anything.

Also barely touched, and commented on newly introduced threading
issues. At some point the global connection cache was changed to a
different data structure, and concurrency issues were introduced: With
the old one (RList) we inserted new elements just by pointing them to
the existing list, so the existing list was never touched. Now with Seq
the list is in danger of being modified while being accessed. We must
revisit our global connection cache.
Made a couple of regexes more readable, without octal codes.
Some server access_rules attributes were missing in the RemoteAccess enum.

Changed declaration of some global syntax arrays to include their
size. In the future all should be declared with size, where size is
(MAX_ENUM_VALUE + 1), so that these bugs are warned by the compiler.
This is not a list-head but a list-tail.
Remove legacy stuff from new protocol's main loop.
Introduce realpath() alternative for windows.

Define PATH_MAX using windows' _MAX_PATH if available. Comment a bit
about the awfulness of realpath().
Run enterprise_extension_test only if Makefile has been generated.
Multi-tenancy.

Bundle server access_rules can now accept new constraints for each
entry: "admit_ips", "admit_hostnames", "admit_keys". Previous generic
"admit" constraint is deprecated, and the new ones do not accept generic
regular expression like it used to be the case.

The new thing is mostly in admit_keys. We can restrict specific files to
be accessible to specific hosts, not based on their IP address or
hostname, but based on their RSA key.

If the resource_type is "path" (default) then the promiser can now be a
path containing the special string "$(connection.ip)"
"$(connection.fqdn)" "$(connection.key)". By writing an access rule like
that, we can allow host-specific filenames to be accessible only to the
relevant hosts. Example:

   "/var/cfengine/cmdb/$(connection.key).json"
      shortcut   => "me.json",
      admit_keys => { "$(connection.key)" };

Moreover, notice the new "shortcut" constraint. This allows the agent to
request a file by its shortcut, and expansion is taking place on the
server according to this constraint in bundle server access_rules. This
is only for ease of use, a file can always be requested with its
absolute path.

The server tries to find an expansion for the first part of every
*non-absolute* (a.k.a. relative...) request path.  E.g. the source file
"masterdir/failsafe.cf" will be served by the server, only if you have
defined an ACL entry with shortcut=>"masterdir".

Enable source file in agent copy_from promises to be a relative path.
Delete relevant acceptance test.

All access control checking for the new protocol has been rewritten to
be clearer and more efficient. Old code still exists and is used in the
old protocol.

Old protocol: change DeleteAuthList() to be non-recursive, also add
asserts to verify list's consistency before freeing. Consolidated
repeated Auth list building code into a couple of functions:
GetOrCreateAuth() and AddAccessConstraintsToAuth(). Moved code
specific to the old protocol, to server_classic.c.
Mitigate possible uninitialised buffer read.
Change "struct strlist" to StrList.

Also document this rule in HACKING.md.

I consider it *wrong* to hide types with no obvious reason, especially
when I'm accessing internal fields of the struct all over the place, I
believe typedefs are good, but mostly for defining strict interfaces and
abbreviating extra-long types. Nevertheless I was flamed to death for
this and I need this code merged, so here is the change together with
relevant documentation; No, it was not obvious this was the rule.
Rename IsDir2() to IsDirReal().
Allow malloc() and friends.

This was changed recently, but this commit explains reasoning and comments
on controlled bailing out in case of some malloc() failures in cf-serverd.