This issue presents itself in x11vnc, but is caused by a deviation between this project and 0.9.13 of the original project.
Specifically, running x11vnc -display :0 -rfbport 0 -unixsock /tmp/sock launches without a problem, but every attempt to connect using a client is rejected with the following error:
check_access: denying empty host IP address string.
denying client: does not match (null)
The relevant code is in rfbNewTCPOrUDPClient. Specifically, after
the following code appears instead:
if(isUDP) {
rfbLog(" accepted UDP client\n");
} else {
struct sockaddr_in addr;
socklen_t addrlen = sizeof(addr);
memset(&addr, 0, sizeof(addr));
if (getpeername(sock, (struct sockaddr *)&addr, &addrlen) < 0) {
cl->host = strdup("NON_SOCKET");
} else if (addr.sin_family == AF_UNIX) {
struct sockaddr_un uaddr;
addrlen = sizeof(uaddr);
memset(&uaddr, 0, sizeof(uaddr));
if (getsockname(sock, (struct sockaddr *)&uaddr, &addrlen) < 0) {
cl->host = strdup("NAMEFAIL_AF_UNIX");
} else if (!strcmp(uaddr.sun_path, "")) {
cl->host = strdup("UNNAMED_AF_UNIX");
} else {
cl->host = strdup(uaddr.sun_path);
}
} else if (addr.sin_family == AF_INET) {
if (!rfbSetTcpNoDelay(sock)) {
close(sock);
return NULL;
}
cl->host = strdup(inet_ntoa(addr.sin_addr));
} else {
cl->host = strdup("UNKNOWN_AF");
}
The specific feature difference of this code is that it always sets cl->host so some value (except in the case of isUDP, not sure what the path is supposed to be there?). This is important because the callback cl->screen->newClientHook(cl) later in this same method does the access check that fails as shown above.
Curiously there is a bit of code in the x11vnc project under check_unix_sock() which updates the value of cl->host but this occurs only after the check_access method has already failed, and I cannot see any historical version of this project where that would have ever worked.
This issue presents itself in x11vnc, but is caused by a deviation between this project and 0.9.13 of the original project.
Specifically, running
x11vnc -display :0 -rfbport 0 -unixsock /tmp/socklaunches without a problem, but every attempt to connect using a client is rejected with the following error:The relevant code is in
rfbNewTCPOrUDPClient. Specifically, afterlibvncserver/libvncserver/rfbserver.c
Line 334 in 2499602
The specific feature difference of this code is that it always sets
cl->hostso some value (except in the case ofisUDP, not sure what the path is supposed to be there?). This is important because the callbackcl->screen->newClientHook(cl)later in this same method does the access check that fails as shown above.Curiously there is a bit of code in the x11vnc project under
check_unix_sock()which updates the value ofcl->hostbut this occurs only after thecheck_accessmethod has already failed, and I cannot see any historical version of this project where that would have ever worked.