session server BUGFIX get path from AF_UNIX socket
After this correction, the correct sun_path is written to the host pointer and not garbage.
@@ -458,6 +458,8 @@ nc_sock_accept_binds(struct nc_bind *binds, uint16_t bind_count, int timeout, ch
ERRMEM;
}
} else if (saddr.ss_family == AF_UNIX) {
+ saddr_len = sizeof(saddr);
+ if (getsockname(ret, (struct sockaddr *)&saddr, &saddr_len) == 0) {
*host = strdup(((struct sockaddr_un *)&saddr)->sun_path);
if (*host) {
if (port) {
@@ -466,6 +468,10 @@ nc_sock_accept_binds(struct nc_bind *binds, uint16_t bind_count, int timeout, ch
} else {
ERRMEM;
}
+ } else {
+ ERR("getsockname failed (%s).", strerror(errno));
+ }
+
} else {
ERR("Source host of an unknown protocol family.");
}
