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.
This commit is contained in:
@@ -37,6 +37,12 @@ increased the applications' startup timeout.
|
|||||||
</para>
|
</para>
|
||||||
</change>
|
</change>
|
||||||
|
|
||||||
|
<change type="change">
|
||||||
|
<para>
|
||||||
|
disallowed abstract Unix domain socket syntax in non-Linux systems.
|
||||||
|
</para>
|
||||||
|
</change>
|
||||||
|
|
||||||
<change type="feature">
|
<change type="feature">
|
||||||
<para>
|
<para>
|
||||||
supporting abstract UNIX sockets.
|
supporting abstract UNIX sockets.
|
||||||
|
|||||||
@@ -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;
|
socklen = offsetof(struct sockaddr_un, sun_path) + length + 1;
|
||||||
|
|
||||||
#if (NXT_LINUX)
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Linux unix(7):
|
* Linux unix(7):
|
||||||
*
|
*
|
||||||
@@ -615,9 +613,12 @@ nxt_sockaddr_unix_parse(nxt_mp_t *mp, nxt_str_t *addr)
|
|||||||
if (path[0] == '@') {
|
if (path[0] == '@') {
|
||||||
path[0] = '\0';
|
path[0] = '\0';
|
||||||
socklen--;
|
socklen--;
|
||||||
}
|
#if !(NXT_LINUX)
|
||||||
|
nxt_thread_log_error(NXT_LOG_ERR,
|
||||||
|
"abstract unix domain sockets are not supported");
|
||||||
|
return NULL;
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
sa = nxt_sockaddr_alloc(mp, socklen, addr->length);
|
sa = nxt_sockaddr_alloc(mp, socklen, addr->length);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user