check for null Promise *pp before dereferencing
Fix for 1804

At creation time we were always assigning 0600 as mode to the new file.
This fix stats the source file first and assigns the same mode as the
original file.
Acceptance tests are updated too.
Merge pull request #332 from cduclos/master

Fix for 1804
Unsilent error when lsdir() is not able to read the directory
Rename update.cf bundle names to fit internal naming schema.
Change BufferNew signature:

int BufferNew(Buffer **buffer) -> Buffer* BufferNew(void)

Since BufferNew uses xmalloc internally, checking its return value seems redundant.
Buffer initialization can be done in a single line now. Semantics similar to Map, Set and other data structures.
Merge pull request #337 from awsiv/master

Change BufferNew Signature
Remove dead stuff from ReadPromises

Move SetAuditVersion into ReadPromises
Rename variable ok -> policy_check_ok in generic_agent:ReadPromises
Pull REQUIRE_COMMENTS logic out of generic_agent:VerifyPromises

There's no verification in this.
Fix formatting in CheckConstraint
Remove global BODYPARTS, introduce PolicyCheckRunnable

Previously, referenced bodies from bundles where appended to the global
BODYPARTS list when calling CheckConstraint from the parser. These were
subsequently accounted for in generic_agent:VerifyPromises.

Now, PolicyCheck is split into PolicyCheckPartial and PolicyCheckRunnable.
PolicyCheckPartial verifies a partial policy, while PolicyCheckRunnable
verifies the integrity of a runnable policy. The latter now checks for
undefined bodies from the policy DOM alone.
Remove global SUBBUNDLES, use PolicyCheckRunnable
Merge pull request #338 from sigurdteigen/cleanup/runnable-policy-checks

Cleanup/runnable policy checks
Merge pull request #334 from estenberg/bugfix/lsdir-report

Unsilent error when lsdir() is not able to read the directory
Define failsafe_fallback class on main policy error, useful for special handling in failsafe.cf and reporting
Remove global REQUIRE_COMMENTS, use PolicyCheckRunnable
Remove unused variable freport_html in OpenCompilationReportFiles
Add explicit check for body common control to PolicyCheckRunnable
Add --full-check flag to cf-promises

Previously, cf-promises did full validation checks requiring a
runnable policy (with body common control) as input. It also did
certain checks to see that bundle/body references were accounted for.

Now, cf-promises will validate a partial policy file if this is given.
If it is given a runnable policy file, it will additionally validate
the integrity as before.

To enforce integrity checks, use the new --full-check flag. This is
also being used by other agents when running cf-promises for validation.

The new lighter partial checks makes it possible to use cf-promises as
a tool operating on incomplete policies.