summaryrefslogtreecommitdiffstats
path: root/unix
diff options
context:
space:
mode:
authorPierre Ossman <ossman@cendio.se>2018-05-03 14:04:38 +0200
committerPierre Ossman <ossman@cendio.se>2018-05-29 14:38:25 +0200
commit5d05546fe48512f8f2294b85aa09fa7c8cc1933c (patch)
tree28e66ae1856c86e0a6a26633b02548b9ba6b1316 /unix
parente3a2be69c48893ef086110b8d92f1fadd004a997 (diff)
downloadtigervnc-5d05546fe48512f8f2294b85aa09fa7c8cc1933c.tar.gz
tigervnc-5d05546fe48512f8f2294b85aa09fa7c8cc1933c.zip
Add support for Unix sockets
Patch originally by Dag-Erling Smørgrav for University of Oslo.
Diffstat (limited to 'unix')
-rw-r--r--unix/xserver/hw/vnc/Xvnc.man9
-rw-r--r--unix/xserver/hw/vnc/vncExtInit.cc18
2 files changed, 27 insertions, 0 deletions
diff --git a/unix/xserver/hw/vnc/Xvnc.man b/unix/xserver/hw/vnc/Xvnc.man
index 80b78781..269be9af 100644
--- a/unix/xserver/hw/vnc/Xvnc.man
+++ b/unix/xserver/hw/vnc/Xvnc.man
@@ -91,6 +91,15 @@ Use IPv4 for incoming and outgoing connections. Default is on.
Use IPv6 for incoming and outgoing connections. Default is on.
.
.TP
+.B \-rfbunixpath \fIpath\fP
+Specifies the path of a Unix domain socket on which Xvnc listens for
+connections from viewers, instead of listening on a TCP port.
+.
+.TP
+.B \-rfbunixmode \fImode\fP
+Specifies the mode of the Unix domain socket. The default is 0600.
+.
+.TP
.B \-rfbwait \fItime\fP, \-ClientWaitTimeMillis \fItime\fP
Time in milliseconds to wait for a viewer which is blocking the server. This is
necessary because the server is single-threaded and sometimes blocks until the
diff --git a/unix/xserver/hw/vnc/vncExtInit.cc b/unix/xserver/hw/vnc/vncExtInit.cc
index f2674511..4d96ca0d 100644
--- a/unix/xserver/hw/vnc/vncExtInit.cc
+++ b/unix/xserver/hw/vnc/vncExtInit.cc
@@ -34,6 +34,7 @@
#include <rfb/Region.h>
#include <rfb/ledStates.h>
#include <network/TcpSocket.h>
+#include <network/UnixSocket.h>
#include "XserverDesktop.h"
#include "vncExtInit.h"
@@ -79,6 +80,8 @@ rfb::IntParameter httpPort("httpPort", "TCP port to listen for HTTP",0);
rfb::AliasParameter rfbwait("rfbwait", "Alias for ClientWaitTimeMillis",
&rfb::Server::clientWaitTimeMillis);
rfb::IntParameter rfbport("rfbport", "TCP port to listen for RFB protocol",0);
+rfb::StringParameter rfbunixpath("rfbunixpath", "Unix socket to listen for RFB protocol", "");
+rfb::IntParameter rfbunixmode("rfbunixmode", "Unix socket access mode", 0600);
rfb::StringParameter desktopName("desktop", "Name of VNC desktop","x11");
rfb::BoolParameter localhostOnly("localhost",
"Only allow connections from localhost",
@@ -181,6 +184,21 @@ void vncExtensionInit(void)
listeners.push_back(new network::TcpListener(vncInetdSock));
vlog.info("inetd wait");
}
+ } else if (rfbunixpath.getValueStr()[0] != '\0') {
+ char path[PATH_MAX];
+ int mode = (int)rfbunixmode;
+
+ if (scr == 0)
+ strncpy(path, rfbunixpath, sizeof(path));
+ else
+ snprintf(path, sizeof(path), "%s.%d",
+ rfbunixpath.getValueStr(), scr);
+ path[sizeof(path)-1] = '\0';
+
+ listeners.push_back(new network::UnixListener(path, mode));
+
+ vlog.info("Listening for VNC connections on %s (mode %04o)",
+ path, mode);
} else {
const char *addr = interface;
int port = rfbport;