diff options
author | Frediano Ziglio <freddy77@gmail.com> | 2021-05-11 05:12:59 +0100 |
---|---|---|
committer | Frediano Ziglio <freddy77@gmail.com> | 2021-05-24 08:37:11 +0100 |
commit | 3de587a76c165262dea9af30c0fbe9bcbbde9cf4 (patch) | |
tree | f68fc4afe9df8003544994837e070e808a27eed3 | |
parent | 9376d5ed301da5d74d680cddf783293e47d826e1 (diff) |
red-stream: Fix issue with SASL and no-Glibc
Using Unix sockets and no-Glibc C libraries (like Musl) getnameinfo
will fail causing SASL code to fail initialization.
Replicate Glibc behavior and report "localhost" as host and an
empty port string.
This fixes https://gitlab.freedesktop.org/spice/spice/-/issues/58.
Signed-off-by: Frediano Ziglio <freddy77@gmail.com>
-rw-r--r-- | server/red-stream.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/server/red-stream.cpp b/server/red-stream.cpp index e27a0ef3..4b11cd17 100644 --- a/server/red-stream.cpp +++ b/server/red-stream.cpp @@ -754,6 +754,11 @@ static char *addr_to_string(const char *format, char serv[NI_MAXSERV]; int err; + // makes it work on no-glibc avoiding getnameinfo returning error + if (sa->ss_family == AF_UNIX) { + return g_strdup("localhost;"); + } + if ((err = getnameinfo((struct sockaddr *)sa, salen, host, sizeof(host), serv, sizeof(serv), |