fish: Use UNIX_PATH_MAX instead of hard-coded value for max length of socket buf.

(cherry picked from commit 9f1bcbca55661632176dea4e1dadc4dea0ca7f21)
(cherry picked from commit e42a6e5e54197aaebcdb18e21dcc2e22c7edf5f1)
fish: CVE-2013-4419: Fix insecure temporary directory handling for remote guestfish (RHBZ#1016960).

When using the guestfish --remote or guestfish --listen options,
guestfish would create a socket in a known location
(/tmp/.guestfish-$UID/socket-$PID).

The location has to be a known one in order for both ends to
communicate.  However no checking was done that the containing
directory (/tmp/.guestfish-$UID) is owned by the user.  Thus another
user could create this directory and potentially modify sockets owned
by another user's guestfish client or server.

This commit fixes the issue by creating the directory unconditionally,
and then checking that the directory has the correct owner and
permissions, thus preventing another user from creating the directory
first.

If guestfish sees a suspicious socket directory it will print an error
like this and exit with an error status:

  guestfish: '/tmp/.guestfish-1000' is not a directory or has insecure owner or permissions

Thanks: Michael Scherer for discovering this issue.

Version 2:
 - Add assigned CVE number.
 - Update documentation.

Signed-off-by: Richard W.M. Jones <rjones@redhat.com>
(cherry picked from commit 54fb09e052d8cad50397f1085c1bdd346a13e659)
(cherry picked from commit b23fca294e2e27efea12aeac0e0de1744b176639)
daemon: Fix xfs_info parser because of new format.

The old parser had several problems: firstly it called the error path
sometimes without calling reply_with_error causing a protocol hang.
More seriously it had hard-coded line numbers, and since Fedora 21 the
output of xfs_info has changed, moving lines around.

Change the parser to be more robust against added fields by using the
first name on the line as the section name, thus 'bsize=' is
interpreted differently depending on whether it appears in the "data"
section or the "naming" section.

Ensure also that we don't call the error path without calling
reply_with_error, which is a side-effect of the above change.

(cherry picked from commit 8abd0a83b3a94e4adbd0926df818686be982cdb8)
(cherry picked from commit adcdc440042d08e1e471d4d922a03113c530e74f)
Version 1.20.12.