summaryrefslogtreecommitdiffstats
path: root/unix
diff options
context:
space:
mode:
authorPierre Ossman <ossman@cendio.se>2018-10-26 16:40:41 +0200
committerPierre Ossman <ossman@cendio.se>2018-10-26 16:40:41 +0200
commit23a4213d8af7aca2be43ac13412dd7d6eea073a4 (patch)
treea7f8102d2dd055ff7dbd4a37a6d48002c3f86713 /unix
parent7a062ef510ae654bc7b5a97fdc53a9838a49e813 (diff)
parent4a4453fc69cf56f9991a13a62023969dcf5b8a4f (diff)
downloadtigervnc-23a4213d8af7aca2be43ac13412dd7d6eea073a4.tar.gz
tigervnc-23a4213d8af7aca2be43ac13412dd7d6eea073a4.zip
Merge branch 'nojava' of https://github.com/CendioOssman/tigervnc
Diffstat (limited to 'unix')
-rwxr-xr-xunix/vncserver8
-rw-r--r--unix/xserver/hw/vnc/XserverDesktop.cc127
-rw-r--r--unix/xserver/hw/vnc/XserverDesktop.h9
-rw-r--r--unix/xserver/hw/vnc/Xvnc.man13
-rw-r--r--unix/xserver/hw/vnc/vncExtInit.cc21
-rw-r--r--unix/xserver/hw/vnc/vncExtInit.h7
6 files changed, 1 insertions, 184 deletions
diff --git a/unix/vncserver b/unix/vncserver
index 9e7a6ac5..bb4f2feb 100755
--- a/unix/vncserver
+++ b/unix/vncserver
@@ -33,8 +33,6 @@ if($slashndx>=0) {
$exedir = substr($0, 0, $slashndx+1);
}
-$vncClasses = "";
-
&SanityCheck();
#
@@ -44,9 +42,6 @@ $vncClasses = "";
$geometry = "1024x768";
#$depth = 16;
-$vncJavaFiles = (((-d "$vncClasses") && "$vncClasses") ||
- ((-d "/usr/share/vnc/classes") && "/usr/share/vnc/classes") ||
- ((-d "/usr/local/vnc/classes") && "/usr/local/vnc/classes"));
$vncUserDir = "$ENV{HOME}/.vnc";
$vncUserConfig = "$vncUserDir/config";
@@ -206,7 +201,6 @@ my %config;
# We set some reasonable defaults. Config file settings
# override these where present.
$default_opts{desktop} = &quotedString($desktopName);
-$default_opts{httpd} = $vncJavaFiles if ($vncJavaFiles);
$default_opts{auth} = &quotedString($xauthorityFile);
$default_opts{geometry} = $geometry if ($geometry);
$default_opts{depth} = $depth if ($depth);
@@ -848,7 +842,6 @@ sub SanityCheck
foreach $cmd ("Xvnc","vncpasswd") {
for (split(/:/,$ENV{PATH})) {
if (-x "$_/$cmd") {
- $vncClasses = "$_/../vnc/classes";
next cmd2;
}
}
@@ -860,7 +853,6 @@ sub SanityCheck
foreach $cmd ($exedir."Xvnc",$exedir."vncpasswd") {
for (split(/:/,$ENV{PATH})) {
if (-x "$cmd") {
- $vncClasses = $exedir."../vnc/classes";
next cmd3;
}
}
diff --git a/unix/xserver/hw/vnc/XserverDesktop.cc b/unix/xserver/hw/vnc/XserverDesktop.cc
index 7eaf3f91..04107dcb 100644
--- a/unix/xserver/hw/vnc/XserverDesktop.cc
+++ b/unix/xserver/hw/vnc/XserverDesktop.cc
@@ -35,7 +35,6 @@
#include <network/Socket.h>
#include <rfb/Exception.h>
#include <rfb/VNCServerST.h>
-#include <rfb/HTTPServer.h>
#include <rfb/LogWriter.h>
#include <rfb/Configuration.h>
#include <rfb/ServerCore.h>
@@ -67,54 +66,14 @@ IntParameter queryConnectTimeout("QueryConnectTimeout",
"rejecting the connection",
10);
-class FileHTTPServer : public rfb::HTTPServer {
-public:
- FileHTTPServer(XserverDesktop* d) : desktop(d) {}
- virtual ~FileHTTPServer() {}
-
- virtual rdr::InStream* getFile(const char* name, const char** contentType,
- int* contentLength, time_t* lastModified)
- {
- if (name[0] != '/' || strstr(name, "..") != 0) {
- vlog.info("http request was for invalid file name");
- return 0;
- }
-
- if (strcmp(name, "/") == 0) name = "/index.vnc";
-
- CharArray httpDirStr(httpDir.getData());
- CharArray fname(strlen(httpDirStr.buf)+strlen(name)+1);
- sprintf(fname.buf, "%s%s", httpDirStr.buf, name);
- int fd = open(fname.buf, O_RDONLY);
- if (fd < 0) return 0;
- rdr::InStream* is = new rdr::FdInStream(fd, -1, 0, true);
- *contentType = guessContentType(name, *contentType);
- if (strlen(name) > 4 && strcasecmp(&name[strlen(name)-4], ".vnc") == 0) {
- is = new rdr::SubstitutingInStream(is, desktop, 20);
- *contentType = "text/html";
- } else {
- struct stat st;
- if (fstat(fd, &st) == 0) {
- *contentLength = st.st_size;
- *lastModified = st.st_mtime;
- }
- }
- return is;
- }
-
- XserverDesktop* desktop;
-};
-
XserverDesktop::XserverDesktop(int screenIndex_,
std::list<network::SocketListener*> listeners_,
- std::list<network::SocketListener*> httpListeners_,
const char* name, const rfb::PixelFormat &pf,
int width, int height,
void* fbptr, int stride)
: screenIndex(screenIndex_),
- server(0), httpServer(0),
- listeners(listeners_), httpListeners(httpListeners_),
+ server(0), listeners(listeners_),
directFbptr(true),
queryConnectId(0), queryConnectTimer(this)
{
@@ -124,20 +83,11 @@ XserverDesktop::XserverDesktop(int screenIndex_,
setFramebuffer(width, height, fbptr, stride);
server->setQueryConnectionHandler(this);
- if (!httpListeners.empty ())
- httpServer = new FileHTTPServer(this);
-
for (std::list<SocketListener*>::iterator i = listeners.begin();
i != listeners.end();
i++) {
vncSetNotifyFd((*i)->getFd(), screenIndex, true, false);
}
-
- for (std::list<SocketListener*>::iterator i = httpListeners.begin();
- i != httpListeners.end();
- i++) {
- vncSetNotifyFd((*i)->getFd(), screenIndex, true, false);
- }
}
XserverDesktop::~XserverDesktop()
@@ -147,14 +97,8 @@ XserverDesktop::~XserverDesktop()
delete listeners.back();
listeners.pop_back();
}
- while (!httpListeners.empty()) {
- vncRemoveNotifyFd(listeners.back()->getFd());
- delete httpListeners.back();
- httpListeners.pop_back();
- }
if (!directFbptr)
delete [] data;
- delete httpServer;
delete server;
}
@@ -201,56 +145,6 @@ void XserverDesktop::refreshScreenLayout()
server->setScreenLayout(::computeScreenLayout(&outputIdMap));
}
-char* XserverDesktop::substitute(const char* varName)
-{
- if (strcmp(varName, "$$") == 0) {
- return rfb::strDup("$");
- }
- if (strcmp(varName, "$PORT") == 0) {
- char* str = new char[10];
- sprintf(str, "%d", listeners.empty () ? 0 : (*listeners.begin ())->getMyPort());
- return str;
- }
- if (strcmp(varName, "$WIDTH") == 0) {
- char* str = new char[10];
- sprintf(str, "%d", width());
- return str;
- }
- if (strcmp(varName, "$HEIGHT") == 0) {
- char* str = new char[10];
- sprintf(str, "%d", height());
- return str;
- }
- if (strcmp(varName, "$APPLETWIDTH") == 0) {
- char* str = new char[10];
- sprintf(str, "%d", width());
- return str;
- }
- if (strcmp(varName, "$APPLETHEIGHT") == 0) {
- char* str = new char[10];
- sprintf(str, "%d", height());
- return str;
- }
- if (strcmp(varName, "$DESKTOP") == 0) {
- return rfb::strDup(server->getName());
- }
- if (strcmp(varName, "$DISPLAY") == 0) {
- struct utsname uts;
- uname(&uts);
- char* str = new char[256];
- strncpy(str, uts.nodename, 240);
- str[239] = '\0'; /* Ensure string is zero-terminated */
- strcat(str, ":");
- strncat(str, vncGetDisplay(), 10);
- return str;
- }
- if (strcmp(varName, "$USER") == 0) {
- struct passwd* user = getpwuid(getuid());
- return rfb::strDup(user ? user->pw_name : "?");
- }
- return 0;
-}
-
rfb::VNCServerST::queryResult
XserverDesktop::queryConnection(network::Socket* sock,
const char* userName,
@@ -370,14 +264,10 @@ void XserverDesktop::handleSocketEvent(int fd, bool read, bool write)
if (read) {
if (handleListenerEvent(fd, &listeners, server))
return;
- if (handleListenerEvent(fd, &httpListeners, httpServer))
- return;
}
if (handleSocketEvent(fd, server, read, write))
return;
- if (handleSocketEvent(fd, httpServer, read, write))
- return;
vlog.error("Cannot find file descriptor for socket event");
} catch (rdr::Exception& e) {
@@ -458,21 +348,6 @@ void XserverDesktop::blockHandler(int* timeout)
vncSetNotifyFd(fd, screenIndex, true, (*i)->outStream().bufferUsage() > 0);
}
}
- if (httpServer) {
- httpServer->getSockets(&sockets);
- for (i = sockets.begin(); i != sockets.end(); i++) {
- int fd = (*i)->getFd();
- if ((*i)->isShutdown()) {
- vlog.debug("http client gone, sock %d",fd);
- vncRemoveNotifyFd(fd);
- httpServer->removeSocket(*i);
- delete (*i);
- } else {
- /* Update existing NotifyFD to listen for write (or not) */
- vncSetNotifyFd(fd, screenIndex, true, (*i)->outStream().bufferUsage() > 0);
- }
- }
- }
// We are responsible for propagating mouse movement between clients
int cursorX, cursorY;
diff --git a/unix/xserver/hw/vnc/XserverDesktop.h b/unix/xserver/hw/vnc/XserverDesktop.h
index f866a4cc..014fcb5f 100644
--- a/unix/xserver/hw/vnc/XserverDesktop.h
+++ b/unix/xserver/hw/vnc/XserverDesktop.h
@@ -32,11 +32,9 @@
#include <stdint.h>
#include <rfb/SDesktop.h>
-#include <rfb/HTTPServer.h>
#include <rfb/PixelBuffer.h>
#include <rfb/Configuration.h>
#include <rfb/VNCServerST.h>
-#include <rdr/SubstitutingInStream.h>
#include <unixcommon.h>
#include "Input.h"
@@ -47,14 +45,12 @@ namespace rfb {
namespace network { class SocketListener; class Socket; class SocketServer; }
class XserverDesktop : public rfb::SDesktop, public rfb::FullFramePixelBuffer,
- public rdr::Substitutor,
public rfb::VNCServerST::QueryConnectionHandler,
public rfb::Timer::Callback {
public:
XserverDesktop(int screenIndex,
std::list<network::SocketListener*> listeners_,
- std::list<network::SocketListener*> httpListeners_,
const char* name, const rfb::PixelFormat &pf,
int width, int height, void* fbptr, int stride);
virtual ~XserverDesktop();
@@ -99,9 +95,6 @@ public:
// rfb::PixelBuffer callbacks
virtual void grabRegion(const rfb::Region& r);
- // rdr::Substitutor callback
- virtual char* substitute(const char* varName);
-
// rfb::VNCServerST::QueryConnectionHandler callback
virtual rfb::VNCServerST::queryResult queryConnection(network::Socket* sock,
const char* userName,
@@ -121,9 +114,7 @@ private:
int screenIndex;
rfb::VNCServerST* server;
- rfb::HTTPServer* httpServer;
std::list<network::SocketListener*> listeners;
- std::list<network::SocketListener*> httpListeners;
bool directFbptr;
uint32_t queryConnectId;
diff --git a/unix/xserver/hw/vnc/Xvnc.man b/unix/xserver/hw/vnc/Xvnc.man
index 224aeba3..99916501 100644
--- a/unix/xserver/hw/vnc/Xvnc.man
+++ b/unix/xserver/hw/vnc/Xvnc.man
@@ -107,19 +107,6 @@ viewer has finished sending or receiving a message - note that this does not
mean an update will be aborted after this time. Default is 20000 (20 seconds).
.
.TP
-.B \-httpd \fIdirectory\fP
-Run a mini-HTTP server which serves files from the given directory. Normally
-the directory will contain the classes for the Java viewer. In addition, files
-with a .vnc extension will have certain substitutions made so that a single
-installation of the Java VNC viewer can be served by separate instances of
-Xvnc.
-.
-.TP
-.B \-httpPort \fIport\fP
-Specifies the port on which the mini-HTTP server runs. Default is 5800 plus
-the display number.
-.
-.TP
.B \-rfbauth \fIpasswd-file\fP, \-PasswordFile \fIpasswd-file\fP
Password file for VNC authentication. There is no default, you should
specify the password file explicitly. Password file should be created with
diff --git a/unix/xserver/hw/vnc/vncExtInit.cc b/unix/xserver/hw/vnc/vncExtInit.cc
index d6f6b742..286a04f6 100644
--- a/unix/xserver/hw/vnc/vncExtInit.cc
+++ b/unix/xserver/hw/vnc/vncExtInit.cc
@@ -73,10 +73,6 @@ struct CaseInsensitiveCompare {
typedef std::set<std::string, CaseInsensitiveCompare> ParamSet;
static ParamSet allowOverrideSet;
-rfb::StringParameter httpDir("httpd",
- "Directory containing files to serve via HTTP",
- "");
-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);
@@ -177,7 +173,6 @@ void vncExtensionInit(void)
if (!desktop[scr]) {
std::list<network::SocketListener*> listeners;
- std::list<network::SocketListener*> httpListeners;
if (scr == 0 && vncInetdSock != -1) {
if (network::isSocketListening(vncInetdSock))
{
@@ -214,21 +209,6 @@ void vncExtensionInit(void)
vlog.info("Listening for VNC connections on %s interface(s), port %d",
localhostOnly ? "local" : (const char*)interface,
port);
-
- CharArray httpDirStr(httpDir.getData());
- if (httpDirStr.buf[0]) {
- port = httpPort;
- if (port == 0) port = 5800 + atoi(vncGetDisplay());
- port += 1000 * scr;
- if (localhostOnly)
- network::createLocalTcpListeners(&httpListeners, port);
- else
- network::createTcpListeners(&httpListeners, addr, port);
-
- vlog.info("Listening for HTTP connections on %s interface(s), port %d",
- localhostOnly ? "local" : (const char*)interface,
- port);
- }
}
CharArray desktopNameStr(desktopName.getData());
@@ -237,7 +217,6 @@ void vncExtensionInit(void)
vncSetGlueContext(scr);
desktop[scr] = new XserverDesktop(scr,
listeners,
- httpListeners,
desktopNameStr.buf,
pf,
vncGetScreenWidth(),
diff --git a/unix/xserver/hw/vnc/vncExtInit.h b/unix/xserver/hw/vnc/vncExtInit.h
index 9414723f..5f97f96d 100644
--- a/unix/xserver/hw/vnc/vncExtInit.h
+++ b/unix/xserver/hw/vnc/vncExtInit.h
@@ -23,13 +23,6 @@
#include <stddef.h>
#include <sys/select.h>
-// Only from C++
-#ifdef __cplusplus
-namespace rfb { class StringParameter; };
-
-extern rfb::StringParameter httpDir;
-#endif
-
#ifdef __cplusplus
extern "C" {
#endif