static char* clientCutText = 0;
static int clientCutTextLen = 0;
+bool noclipboard = false;
static XserverDesktop* queryConnectDesktop = 0;
static void* queryConnectId = 0;
static int ProcVncExtSetParam(ClientPtr client)
{
+ char* value1 = 0;
+ char* value2 = 0;
+ rfb::VoidParameter *desktop1, *desktop2;
+
REQUEST(xVncExtSetParamReq);
REQUEST_FIXED_SIZE(xVncExtSetParamReq, stuff->paramLen);
CharArray param(stuff->paramLen+1);
int n;
rep.type = X_Reply;
rep.length = 0;
+ rep.success = 0;
rep.sequenceNumber = client->sequence;
// Retrieve desktop name before setting
- char* value1 = 0;
- rfb::VoidParameter* desktop1 = rfb::Configuration::getParam("desktop");
+ desktop1 = rfb::Configuration::getParam("desktop");
if (desktop1)
value1 = desktop1->getValueStr();
+ /*
+ * Allow to change only clipboard parameters and desktop name.
+ * Changing other parameters (for example PAM service name)
+ * could have negative security impact.
+ */
+ if (strcasecmp(param.buf, "desktop") != 0 &&
+ (noclipboard || strcasecmp(param.buf, "SendCutText") != 0) &&
+ (noclipboard || strcasecmp(param.buf, "AcceptCutText") != 0))
+ goto deny;
+
rep.success = rfb::Configuration::setParam(param.buf);
// Send DesktopName update if desktop name has been changed
- char* value2 = 0;
- rfb::VoidParameter* desktop2 = rfb::Configuration::getParam("desktop");
+ desktop2 = rfb::Configuration::getParam("desktop");
if (desktop2)
value2 = desktop2->getValueStr();
if (value1 && value2 && strcmp(value1, value2)) {
if (value2)
delete [] value2;
+deny:
if (client->swapped) {
swaps(&rep.sequenceNumber, n);
swapl(&rep.length, n);
ErrorF("-pixelformat fmt set pixel format (rgbNNN or bgrNNN)\n");
ErrorF("-inetd has been launched from inetd\n");
ErrorF("-interface IP_address listen on specified interface\n");
+ ErrorF("-noclipboard disable clipboard settings modification via vncconfig utility\n");
ErrorF("\nVNC parameters:\n");
fprintf(stderr,"\n"
return 2;
}
+
+ if (strcmp(argv[i], "-noclipboard") == 0) {
+ noclipboard = true;
+ return 1;
+ }
if (rfb::Configuration::setParam(argv[i]))
return 1;