radicle-heartwood-lfs/crates/radicle-node
Lorenz Leutgeb 8a66e4d044 node/systemd: Check that received sockets are AF_UNIX
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.
2025-08-25 17:17:34 +01:00
..
src node/systemd: Check that received sockets are AF_UNIX 2025-08-25 17:17:34 +01:00
Cargo.toml node: Use winpipe for control socket on Windows 2025-08-22 15:45:20 +01:00
build.rs repo: Move workspace crates into `crates` subdirectory 2025-06-09 15:09:21 +02:00