diff options
author | Alejandro Colomar <alx.manpages@gmail.com> | 2022-07-28 16:10:32 +0200 |
---|---|---|
committer | Alejandro Colomar <alx.manpages@gmail.com> | 2022-08-18 18:58:41 +0200 |
commit | 7e4a8a54221adf00cd3eb45a24b633ce61400570 (patch) | |
tree | f773c813e308030ce73f9f1821b222b1c4466a8f /src/nxt_sockaddr.c | |
parent | e2aec6686a4d2cf1ddc017b50dbb39baefd2d425 (diff) | |
download | unit-7e4a8a54221adf00cd3eb45a24b633ce61400570.tar.gz unit-7e4a8a54221adf00cd3eb45a24b633ce61400570.tar.bz2 |
Disallowed abstract unix socket syntax in non-Linux systems.
The previous commit added/fixed support for abstract Unix domain sockets
on Linux with a leading '@' or '\0'. To be consistent in all platforms,
treat those prefixes as markers for abstract sockets in all platforms,
and fail if abstract sockets are not supported by the platform.
That will avoid mistakes when copying a config file from a Linux system
and using it in non-Linux, which would surprisingly create a normal socket.
Diffstat (limited to '')
-rw-r--r-- | src/nxt_sockaddr.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/nxt_sockaddr.c b/src/nxt_sockaddr.c index 8220590e..86c3335e 100644 --- a/src/nxt_sockaddr.c +++ b/src/nxt_sockaddr.c @@ -601,8 +601,6 @@ nxt_sockaddr_unix_parse(nxt_mp_t *mp, nxt_str_t *addr) socklen = offsetof(struct sockaddr_un, sun_path) + length + 1; -#if (NXT_LINUX) - /* * Linux unix(7): * @@ -615,9 +613,12 @@ nxt_sockaddr_unix_parse(nxt_mp_t *mp, nxt_str_t *addr) if (path[0] == '@') { path[0] = '\0'; socklen--; - } - +#if !(NXT_LINUX) + nxt_thread_log_error(NXT_LOG_ERR, + "abstract unix domain sockets are not supported"); + return NULL; #endif + } sa = nxt_sockaddr_alloc(mp, socklen, addr->length); |