swrap: Abort if socket wrapper directory is too long to be usable
authorMartin Schwenke <martin@meltin.net>
Wed, 13 May 2020 03:45:02 +0000 (13:45 +1000)
committerStefan Metzmacher <metze@samba.org>
Mon, 22 Jun 2020 14:43:47 +0000 (16:43 +0200)
commitdd428959713998d3f973bcf2762d489ef27d9f13
tree5447e804d96eabf67c297bc48c30afc0415bf3f4
parentfc1e98f8ca51ca4de7551e61b6b9c6c99d183b10
swrap: Abort if socket wrapper directory is too long to be usable

If the socket wrapper directory path is too long to allow reliable
construction of the required Unix domain socket paths then
convert_in_un_alloc() can return ENFILE if paths are truncated in
unfortunate ways.  This can be very hard to debug since, for example,
bind(2) should never return ENFILE.

Instead, abort if the path returned by realpath(3) is unusable.

The code structure is slightly weird but this accommodates an
additional change.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
src/socket_wrapper.c