Our implementation for the control socket is based on AF_UNIX, and as
the note (which is removed suggests, we should actually check that the
received socket really is of that domain.
This check was not implemented because it is not exposed via std, and
a bit cumbersome to do via libc.
I did not realize that socket2 which neatly sits between std and
libc in terms of its abstractions and is cross-platform allows us to
do this, and we even already depend on it!
So, add the suggested check.
While at it, refactor the function to return early in cases. Now the progression from a file descriptor to a socket to a listener is nicely captured in the types and not obstructed too much by indentation.
Also log at the error level.
Our implementation for the control socket is based on AF_UNIX, and as
the note (which is removed suggests, we should actually check that the
received socket really is of that domain.
This check was not implemented because it is not exposed via std, and
a bit cumbersome to do via libc.
I did not realize that socket2 which neatly sits between std and
libc in terms of its abstractions and is cross-platform allows us to
do this, and we even already depend on it!
So, add the suggested check.
While at it, refactor the function to return early in cases. Now the progression from a file descriptor to a socket to a listener is nicely captured in the types and not obstructed too much by indentation.
Also log at the error level.
Tiny refactor.
Make error messages consistent, rebase.
Add missed return.
Rebased