localhost option for x0vncserver

Hein Roehrig realvnc-list "at" hein.roehrig.name
Mon Oct 25 06:22:01 2004


Dear *,

the following simple patch (against the Debian vnc4 package) makes
x0vncserver behave more like vncserver in that it accepts the
-localhost option to bind the VNC port to localhost. This is nice to
have when tunneling a x0vncserver session over SSH.

Thanks,
Hein



--- x0vncserver.cxx.~1~	2004-10-23 10:59:42.000000000 -0600
+++ x0vncserver.cxx	2004-10-23 11:48:41.000000000 -0600
@@ -47,6 +47,9 @@
 StringParameter displayname("display", "The X display", "");
 IntParameter rfbport("rfbport", "TCP port to listen for RFB protocol",5900);
 VncAuthPasswdFileParameter vncAuthPasswdFile;
+BoolParameter localhostOnly("localhost",
+                            "Only allow connections from localhost",
+                            false);
 
 static void CleanupSignalHandler(int sig)
 {
@@ -230,7 +233,7 @@
     desktop.setVNCServer(&server);
 
     TcpSocket::initTcpSockets();
-    TcpListener listener((int)rfbport);
+    TcpListener listener((int)rfbport, localhostOnly);
     vlog.info("Listening on port %d", (int)rfbport);
 
     while (true) {