static: Don't use unportable trim() function on login page

Also refactor a bit to avoid code duplication.

Closes #1125
Reviewed-by: Marius Vollmer <marius.vollmer@redhat.com>
tools: Suppress more glib leaks in glib.supp

Leaks found with glib 2.38.2

Closes #1120
Reviewed-by: Marius Vollmer <marius.vollmer@redhat.com>
daemon: Added BlockdevMonitor

Reviewed-by: Stef Walter <stefw@redhat.com>
shell: Always do a coldplug for any change on #storage

This is more robust.  For example, get_block_devices_for_drive might
not return all block devices yet when a drive object is added, which
becomes important when we want to monitor I/O for drives.

In order to avoid excessive churning during initialization, multiple
change events in the same event loop iteration are collapsed.

Reviewed-by: Stef Walter <stefw@redhat.com>
shell: Show I/O graphs for drives on #storage page

We don't include mdraid or lvm in the graphs since we show their I/O
already via the drives for their physical volumes.

Reviewed-by: Stef Walter <stefw@redhat.com>
shell: Show I/O numerically in the storage drive rows

Reviewed-by: Stef Walter <stefw@redhat.com>
shell: Go to #storage from Disk I/O graph on #server

And remove the #disk_io_status page.

Fixes #847
Closes #1068
Reviewed-by: Stef Walter <stefw@redhat.com>
shell: Rewrite 'block_get_desc' to avoid HTML parsing

Reviewed-by: Stef Walter <stefw@redhat.com>
shell: Link from physical volumes to their volume group or mdraid.

Reviewed-by: Stef Walter <stefw@redhat.com>
shell: Link from volume groups and mdraids to their physical volumes.

Closes #1073
Reviewed-by: Stef Walter <stefw@redhat.com>
shell: Use a selectpicker for Storage dialogs.

Fixes #1115
Closes #1121
Reviewed-by: Stef Walter <stefw@redhat.com>
session: Clear environment when running cockpit-session setuid

Environment variables can affect all sorts of things like LD_PRELOAD,
PAM module behavior, and so on. When cockpit-session is running as
a setuid process, clear the environment completely.

This means that for debugging using G_DEBUG or G_MESSAGES_DEBUG
cockpit-ws must be running as root. Update HACKING.md to reflect this.

Closes #1123
Reviewed-by: Marius Vollmer <marius.vollmer@redhat.com>
shell: Disable chunk size for RAID 1

Disable the selectpicker for RAID 1
Show the text "0 KB" for RAID 1
Set the chunk size to 0 when creating RAID devices

Fixes #1071
Closes #1089
Reviewed-by: Marius Vollmer <marius.vollmer@redhat.com>
 * Hide the chunk row, don't dig into selectpicker internals.
ws: Only one code path for starting local cockpit-session process

Don't automatically launch local cockpit-session processes when
opening channels. The only way to get one is via a /login.

This simplifies the authentication code, but more importantly
once GSSAPI is implemented, we won't necessarily have the credentials
to just launch a cockpit-session whenever we want.

Reviewed-by: Marius Vollmer <marius.vollmer@redhat.com>
ws: Log the user out when the primary session goes away

If the primary session goes away (eg: via a kill command or crash)
then log the user out of the web service all together.

Reviewed-by: Marius Vollmer <marius.vollmer@redhat.com>
ws: Move cockpit-session code to src/ws/ directory

It's really part of the webservice code rather than the agent, and the
API that cockpit-ws and cockpit-session talk is pretty tightly bound.

Reviewed-by: Marius Vollmer <marius.vollmer@redhat.com>
common: When JSON data to parse is empty, raise an error

Explicitly raise an error when JSON data to parse is empty.
This was causing issues when empty data would come from cockpit-session.

Reviewed-by: Marius Vollmer <marius.vollmer@redhat.com>
ws: In preparation for GSSAPI move authentication to headers

Use the standard Authorization header and Basic auth for authenticating
via passwords.

We parse the authorization header in cockpit-session, similarly to how
we'll be doing for the GSSAPI (ie: kerberos auth)

Reviewed-by: Marius Vollmer <marius.vollmer@redhat.com>
ws: Pass headers to CockpitAuth login_finish() virtual method

In our GSSAPI authentication we'll be adding custom headers from
the implementations of this virtual method.

Reviewed-by: Marius Vollmer <marius.vollmer@redhat.com>
ws: Remove support from CockpitWebServer for handling POST reqs

This is no longer used or needed. Conceptually we should never be
handling POST requests because we have no CSRF protection, or anything like
that anyway.

Anything that changes state should go through thet WebSocket.

Closes #1114
Reviewed-by: Marius Vollmer <marius.vollmer@redhat.com>