daemon: Replace snprintf() with g_strdup_printf() in journal code

To avoid holding formatting strings in stack buffers

Fixes #666
Closes #693

Reviewed-by: Stef Walter <stefw@redhat.com>
ws: Freed memory leak of cockpit_getpwnam_a()

Fixed #668
Closes #692

Reviewed-by: Stef Walter <stefw@redhat.com>
ws: Wait for child process to exit in mock-sshd

Hopefully this will fix races where we don't get terminate signals
or exit codes correctly during our tests.

Closes #694
Reviewed-by: Marius Vollmer <marius.vollmer@redhat.com>
ws: Better debug logging when removing a channel from session
agent: Split out MockTransport into its own file

And move some tests to start using it.
common: Add cockpit_assert_bytes_eq() and cockpit_assert_data_eq()

These functions are used in tests to check if memory matches expected
and gives informative output if it doesn't match. This output could
be further enhanced to show a diff or some such, but for now it's just
a simple escaped listing.
agent: Add cockpit_channel_close_obj_option() function

This allows adding full JSON objects to channel close messages.
agent: Implement agent support for modules and resource1 payload

This adds support to cockpit-agent for listing and loading module
resources.

See doc/modules.md for information about how modules are laid
out on the system.

doc/protocol.md contains information about the resource1 payload
ws: Add cockpit_web_response_abort() to stop streaming response

When we are streaming a web response, and half-way an error occurs
and we cannot get the remaining data to stream, we need to terminate
the web response.

cockpit_web_response_abort() does this by just disconnecting the
web response. The caller should be able to tell whether the data
is incomplete based on length header or chunking.
ws: cockpit_web_response_get_state() and expose web response state

Allow others to see what state a web response is currently in.
This helps prevent callers from having to carry around the identical
state.
ws: Strip query string when handing HTTP requests

We never use a query string, and some callers like jQuery add one
automatically in certain cases.
ws: Change how CockpitWebServer handle-resource signal detail works

To match subtrees, connect using detail handle-resource::/component/, to
match actual to level paths use detail handle-resource::/component
ws: Expose resources from remote hosts via HTTP

The resources are under the /cache and /res paths. See doc/urls.md
for more information.

We stream these from cockpit-agent using channels with payload
type resource1.

We also track when the web service requests checksum and module
listing information, and keep track of which host has which checksums
so we can send requests appropriately later.