diff options
Diffstat (limited to 'unix/xserver/hw/vnc/vncExtInit.cc')
-rw-r--r-- | unix/xserver/hw/vnc/vncExtInit.cc | 44 |
1 files changed, 12 insertions, 32 deletions
diff --git a/unix/xserver/hw/vnc/vncExtInit.cc b/unix/xserver/hw/vnc/vncExtInit.cc index b64c14d3..e9924d70 100644 --- a/unix/xserver/hw/vnc/vncExtInit.cc +++ b/unix/xserver/hw/vnc/vncExtInit.cc @@ -27,7 +27,6 @@ #include <sys/types.h> #include <pwd.h> -#include <set> #include <string> #include <core/Configuration.h> @@ -68,24 +67,17 @@ int vncFbstride[MAXSCREENS]; int vncInetdSock = -1; -struct CaseInsensitiveCompare { - bool operator() (const std::string &a, const std::string &b) const { - return strcasecmp(a.c_str(), b.c_str()) < 0; - } -}; - -typedef std::set<std::string, CaseInsensitiveCompare> ParamSet; -static ParamSet allowOverrideSet; - static const char* defaultDesktopName(); core::IntParameter - rfbport("rfbport", "TCP port to listen for RFB protocol", 0); + rfbport("rfbport", + "TCP port to listen for RFB protocol", 0, -1, 65535); core::StringParameter rfbunixpath("rfbunixpath", "Unix socket to listen for RFB protocol", ""); core::IntParameter - rfbunixmode("rfbunixmode", "Unix socket access mode", 0600); + rfbunixmode("rfbunixmode", + "Unix socket access mode", 0600, 0000, 0777); core::StringParameter desktopName("desktop", "Name of VNC desktop", defaultDesktopName()); core::BoolParameter @@ -98,12 +90,12 @@ core::BoolParameter avoidShiftNumLock("AvoidShiftNumLock", "Avoid fake Shift presses for keys affected by " "NumLock.", true); -core::StringParameter +core::StringListParameter allowOverride("AllowOverride", "Comma separated list of parameters that can be " "modified using VNC extension.", - "desktop,AcceptPointerEvents,SendCutText,AcceptCutText," - "SendPrimary,SetPrimary"); + {"desktop", "AcceptPointerEvents", "SendCutText", + "AcceptCutText", "SendPrimary", "SetPrimary"}); core::BoolParameter setPrimary("SetPrimary", "Set the PRIMARY as well as the CLIPBOARD selection", @@ -167,19 +159,6 @@ static rfb::PixelFormat vncGetPixelFormat(int scrIdx) redShift, greenShift, blueShift); } -static void parseOverrideList(const char *text, ParamSet &out) -{ - for (const char* iter = text; ; ++iter) { - if (*iter == ',' || *iter == '\0') { - out.insert(std::string(text, iter)); - text = iter + 1; - - if (*iter == '\0') - break; - } - } -} - void vncExtensionInit(void) { if (vncExtGeneration == vncGetServerGeneration()) { @@ -201,7 +180,6 @@ void vncExtensionInit(void) if (!initialised) { core::initStdIOLoggers(); - parseOverrideList(allowOverride, allowOverrideSet); allowOverride.setImmutable(); initialised = true; @@ -523,8 +501,10 @@ void vncAbortMsc(int scrIdx, uint64_t id) int vncOverrideParam(const char *param, const char *value) { - if (allowOverrideSet.find(param) == allowOverrideSet.end()) - return 0; + for (const char* allowed : allowOverride) { + if (strcasecmp(allowed, param) == 0) + return core::Configuration::setParam(param, value); + } - return core::Configuration::setParam(param, value); + return 0; } |