mirror of
https://github.com/kasmtech/KasmVNC.git
synced 2025-01-23 22:39:01 +01:00
Log client settings
This commit is contained in:
parent
7350b12b3d
commit
9a73cb4a60
@ -24,6 +24,7 @@
|
|||||||
#include <rfb/Exception.h>
|
#include <rfb/Exception.h>
|
||||||
#include <rfb/encodings.h>
|
#include <rfb/encodings.h>
|
||||||
#include <rfb/ledStates.h>
|
#include <rfb/ledStates.h>
|
||||||
|
#include <rfb/LogWriter.h>
|
||||||
#include <rfb/clipboardTypes.h>
|
#include <rfb/clipboardTypes.h>
|
||||||
#include <rfb/ConnParams.h>
|
#include <rfb/ConnParams.h>
|
||||||
#include <rfb/ServerCore.h>
|
#include <rfb/ServerCore.h>
|
||||||
@ -32,6 +33,19 @@
|
|||||||
|
|
||||||
using namespace rfb;
|
using namespace rfb;
|
||||||
|
|
||||||
|
static LogWriter vlog("CP");
|
||||||
|
|
||||||
|
static void clientparlog(const char name[], const bool applied) {
|
||||||
|
vlog.debug("Client sent config param %s, %s",
|
||||||
|
name,
|
||||||
|
applied ? "applied" : "ignored due to -IgnoreClientSettingsKasm/lacking perms");
|
||||||
|
}
|
||||||
|
static void clientparlog(const char name[], int val, const bool applied) {
|
||||||
|
vlog.debug("Client sent config param %s %d, %s",
|
||||||
|
name, val,
|
||||||
|
applied ? "applied" : "ignored due to -IgnoreClientSettingsKasm/lacking perms");
|
||||||
|
}
|
||||||
|
|
||||||
ConnParams::ConnParams()
|
ConnParams::ConnParams()
|
||||||
: majorVersion(0), minorVersion(0),
|
: majorVersion(0), minorVersion(0),
|
||||||
width(0), height(0), useCopyRect(false),
|
width(0), height(0), useCopyRect(false),
|
||||||
@ -147,54 +161,71 @@ void ConnParams::setEncodings(int nEncodings, const rdr::S32* encodings)
|
|||||||
switch (encodings[i]) {
|
switch (encodings[i]) {
|
||||||
case encodingCopyRect:
|
case encodingCopyRect:
|
||||||
useCopyRect = true;
|
useCopyRect = true;
|
||||||
|
clientparlog("copyrect", true);
|
||||||
break;
|
break;
|
||||||
case pseudoEncodingCursor:
|
case pseudoEncodingCursor:
|
||||||
supportsLocalCursor = true;
|
supportsLocalCursor = true;
|
||||||
|
clientparlog("cursor", true);
|
||||||
break;
|
break;
|
||||||
case pseudoEncodingXCursor:
|
case pseudoEncodingXCursor:
|
||||||
supportsLocalXCursor = true;
|
supportsLocalXCursor = true;
|
||||||
|
clientparlog("xcursor", true);
|
||||||
break;
|
break;
|
||||||
case pseudoEncodingCursorWithAlpha:
|
case pseudoEncodingCursorWithAlpha:
|
||||||
supportsLocalCursorWithAlpha = true;
|
supportsLocalCursorWithAlpha = true;
|
||||||
|
clientparlog("cursorWithAlpha", true);
|
||||||
break;
|
break;
|
||||||
case pseudoEncodingVMwareCursor:
|
case pseudoEncodingVMwareCursor:
|
||||||
supportsVMWareCursor = true;
|
supportsVMWareCursor = true;
|
||||||
|
clientparlog("vmwareCursor", true);
|
||||||
break;
|
break;
|
||||||
case pseudoEncodingDesktopSize:
|
case pseudoEncodingDesktopSize:
|
||||||
supportsDesktopResize = true;
|
supportsDesktopResize = true;
|
||||||
|
clientparlog("desktopSize", true);
|
||||||
break;
|
break;
|
||||||
case pseudoEncodingExtendedDesktopSize:
|
case pseudoEncodingExtendedDesktopSize:
|
||||||
supportsExtendedDesktopSize = true;
|
supportsExtendedDesktopSize = true;
|
||||||
|
clientparlog("extendedDesktopSize", true);
|
||||||
break;
|
break;
|
||||||
case pseudoEncodingVMwareCursorPosition:
|
case pseudoEncodingVMwareCursorPosition:
|
||||||
supportsCursorPosition = true;
|
supportsCursorPosition = true;
|
||||||
|
clientparlog("vmwareCursorPosition", true);
|
||||||
break;
|
break;
|
||||||
case pseudoEncodingDesktopName:
|
case pseudoEncodingDesktopName:
|
||||||
supportsDesktopRename = true;
|
supportsDesktopRename = true;
|
||||||
|
clientparlog("desktopRename", true);
|
||||||
break;
|
break;
|
||||||
case pseudoEncodingLastRect:
|
case pseudoEncodingLastRect:
|
||||||
supportsLastRect = true;
|
supportsLastRect = true;
|
||||||
|
clientparlog("lastRect", true);
|
||||||
break;
|
break;
|
||||||
case pseudoEncodingLEDState:
|
case pseudoEncodingLEDState:
|
||||||
supportsLEDState = true;
|
supportsLEDState = true;
|
||||||
|
clientparlog("ledState", true);
|
||||||
break;
|
break;
|
||||||
case pseudoEncodingQEMUKeyEvent:
|
case pseudoEncodingQEMUKeyEvent:
|
||||||
supportsQEMUKeyEvent = true;
|
supportsQEMUKeyEvent = true;
|
||||||
|
clientparlog("qemuKeyEvent", true);
|
||||||
break;
|
break;
|
||||||
case pseudoEncodingWEBP:
|
case pseudoEncodingWEBP:
|
||||||
supportsWEBP = true;
|
supportsWEBP = true;
|
||||||
|
clientparlog("webp", true);
|
||||||
break;
|
break;
|
||||||
case pseudoEncodingQOI:
|
case pseudoEncodingQOI:
|
||||||
supportsQOI = true;
|
supportsQOI = true;
|
||||||
|
clientparlog("qoi", true);
|
||||||
break;
|
break;
|
||||||
case pseudoEncodingFence:
|
case pseudoEncodingFence:
|
||||||
supportsFence = true;
|
supportsFence = true;
|
||||||
|
clientparlog("fence", true);
|
||||||
break;
|
break;
|
||||||
case pseudoEncodingContinuousUpdates:
|
case pseudoEncodingContinuousUpdates:
|
||||||
supportsContinuousUpdates = true;
|
supportsContinuousUpdates = true;
|
||||||
|
clientparlog("continuousUpdates", true);
|
||||||
break;
|
break;
|
||||||
case pseudoEncodingExtendedClipboard:
|
case pseudoEncodingExtendedClipboard:
|
||||||
supportsExtendedClipboard = true;
|
supportsExtendedClipboard = true;
|
||||||
|
clientparlog("extendedClipboard", true);
|
||||||
break;
|
break;
|
||||||
case pseudoEncodingSubsamp1X:
|
case pseudoEncodingSubsamp1X:
|
||||||
subsampling = subsampleNone;
|
subsampling = subsampleNone;
|
||||||
@ -215,8 +246,12 @@ void ConnParams::setEncodings(int nEncodings, const rdr::S32* encodings)
|
|||||||
subsampling = subsample16X;
|
subsampling = subsample16X;
|
||||||
break;
|
break;
|
||||||
case pseudoEncodingPreferBandwidth:
|
case pseudoEncodingPreferBandwidth:
|
||||||
if (!rfb::Server::ignoreClientSettingsKasm && canChangeSettings)
|
if (!rfb::Server::ignoreClientSettingsKasm && canChangeSettings) {
|
||||||
Server::preferBandwidth.setParam(true);
|
Server::preferBandwidth.setParam(true);
|
||||||
|
clientparlog("preferBandwidth", true);
|
||||||
|
} else {
|
||||||
|
clientparlog("preferBandwidth", false);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case pseudoEncodingMaxVideoResolution:
|
case pseudoEncodingMaxVideoResolution:
|
||||||
if (!rfb::Server::ignoreClientSettingsKasm && canChangeSettings)
|
if (!rfb::Server::ignoreClientSettingsKasm && canChangeSettings)
|
||||||
@ -225,57 +260,133 @@ void ConnParams::setEncodings(int nEncodings, const rdr::S32* encodings)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (encodings[i] >= pseudoEncodingCompressLevel0 &&
|
if (encodings[i] >= pseudoEncodingCompressLevel0 &&
|
||||||
encodings[i] <= pseudoEncodingCompressLevel9)
|
encodings[i] <= pseudoEncodingCompressLevel9) {
|
||||||
compressLevel = encodings[i] - pseudoEncodingCompressLevel0;
|
compressLevel = encodings[i] - pseudoEncodingCompressLevel0;
|
||||||
|
clientparlog("compressLevel", compressLevel, true);
|
||||||
|
}
|
||||||
|
|
||||||
if (encodings[i] >= pseudoEncodingQualityLevel0 &&
|
if (encodings[i] >= pseudoEncodingQualityLevel0 &&
|
||||||
encodings[i] <= pseudoEncodingQualityLevel9)
|
encodings[i] <= pseudoEncodingQualityLevel9) {
|
||||||
qualityLevel = encodings[i] - pseudoEncodingQualityLevel0;
|
qualityLevel = encodings[i] - pseudoEncodingQualityLevel0;
|
||||||
|
clientparlog("qualityLevel", qualityLevel, true);
|
||||||
|
}
|
||||||
|
|
||||||
if (encodings[i] >= pseudoEncodingFineQualityLevel0 &&
|
if (encodings[i] >= pseudoEncodingFineQualityLevel0 &&
|
||||||
encodings[i] <= pseudoEncodingFineQualityLevel100)
|
encodings[i] <= pseudoEncodingFineQualityLevel100) {
|
||||||
fineQualityLevel = encodings[i] - pseudoEncodingFineQualityLevel0;
|
fineQualityLevel = encodings[i] - pseudoEncodingFineQualityLevel0;
|
||||||
|
clientparlog("fineQualityLevel", fineQualityLevel, true);
|
||||||
|
}
|
||||||
|
|
||||||
if (!rfb::Server::ignoreClientSettingsKasm && canChangeSettings) {
|
if (!rfb::Server::ignoreClientSettingsKasm && canChangeSettings) {
|
||||||
if (encodings[i] >= pseudoEncodingJpegVideoQualityLevel0 &&
|
if (encodings[i] >= pseudoEncodingJpegVideoQualityLevel0 &&
|
||||||
encodings[i] <= pseudoEncodingJpegVideoQualityLevel9)
|
encodings[i] <= pseudoEncodingJpegVideoQualityLevel9) {
|
||||||
Server::jpegVideoQuality.setParam(encodings[i] - pseudoEncodingJpegVideoQualityLevel0);
|
Server::jpegVideoQuality.setParam(encodings[i] - pseudoEncodingJpegVideoQualityLevel0);
|
||||||
|
clientparlog("jpegVideoQuality", encodings[i] - pseudoEncodingJpegVideoQualityLevel0, true);
|
||||||
|
}
|
||||||
|
|
||||||
if (encodings[i] >= pseudoEncodingWebpVideoQualityLevel0 &&
|
if (encodings[i] >= pseudoEncodingWebpVideoQualityLevel0 &&
|
||||||
encodings[i] <= pseudoEncodingWebpVideoQualityLevel9)
|
encodings[i] <= pseudoEncodingWebpVideoQualityLevel9) {
|
||||||
Server::webpVideoQuality.setParam(encodings[i] - pseudoEncodingWebpVideoQualityLevel0);
|
Server::webpVideoQuality.setParam(encodings[i] - pseudoEncodingWebpVideoQualityLevel0);
|
||||||
|
clientparlog("webpVideoQuality", encodings[i] - pseudoEncodingWebpVideoQualityLevel0, true);
|
||||||
|
}
|
||||||
|
|
||||||
if (encodings[i] >= pseudoEncodingTreatLosslessLevel0 &&
|
if (encodings[i] >= pseudoEncodingTreatLosslessLevel0 &&
|
||||||
encodings[i] <= pseudoEncodingTreatLosslessLevel10)
|
encodings[i] <= pseudoEncodingTreatLosslessLevel10) {
|
||||||
Server::treatLossless.setParam(encodings[i] - pseudoEncodingTreatLosslessLevel0);
|
Server::treatLossless.setParam(encodings[i] - pseudoEncodingTreatLosslessLevel0);
|
||||||
|
clientparlog("treatLossless", encodings[i] - pseudoEncodingTreatLosslessLevel0, true);
|
||||||
|
}
|
||||||
|
|
||||||
if (encodings[i] >= pseudoEncodingDynamicQualityMinLevel0 &&
|
if (encodings[i] >= pseudoEncodingDynamicQualityMinLevel0 &&
|
||||||
encodings[i] <= pseudoEncodingDynamicQualityMinLevel9)
|
encodings[i] <= pseudoEncodingDynamicQualityMinLevel9) {
|
||||||
Server::dynamicQualityMin.setParam(encodings[i] - pseudoEncodingDynamicQualityMinLevel0);
|
Server::dynamicQualityMin.setParam(encodings[i] - pseudoEncodingDynamicQualityMinLevel0);
|
||||||
|
clientparlog("dynamicQualityMin", encodings[i] - pseudoEncodingDynamicQualityMinLevel0, true);
|
||||||
|
}
|
||||||
|
|
||||||
if (encodings[i] >= pseudoEncodingDynamicQualityMaxLevel0 &&
|
if (encodings[i] >= pseudoEncodingDynamicQualityMaxLevel0 &&
|
||||||
encodings[i] <= pseudoEncodingDynamicQualityMaxLevel9)
|
encodings[i] <= pseudoEncodingDynamicQualityMaxLevel9) {
|
||||||
Server::dynamicQualityMax.setParam(encodings[i] - pseudoEncodingDynamicQualityMaxLevel0);
|
Server::dynamicQualityMax.setParam(encodings[i] - pseudoEncodingDynamicQualityMaxLevel0);
|
||||||
|
clientparlog("dynamicQualityMax", encodings[i] - pseudoEncodingDynamicQualityMaxLevel0, true);
|
||||||
|
}
|
||||||
|
|
||||||
if (encodings[i] >= pseudoEncodingVideoAreaLevel1 &&
|
if (encodings[i] >= pseudoEncodingVideoAreaLevel1 &&
|
||||||
encodings[i] <= pseudoEncodingVideoAreaLevel100)
|
encodings[i] <= pseudoEncodingVideoAreaLevel100) {
|
||||||
Server::videoArea.setParam(encodings[i] - pseudoEncodingVideoAreaLevel1 + 1);
|
Server::videoArea.setParam(encodings[i] - pseudoEncodingVideoAreaLevel1 + 1);
|
||||||
|
clientparlog("videoArea", encodings[i] - pseudoEncodingVideoAreaLevel1 + 1, true);
|
||||||
|
}
|
||||||
|
|
||||||
if (encodings[i] >= pseudoEncodingVideoTimeLevel0 &&
|
if (encodings[i] >= pseudoEncodingVideoTimeLevel0 &&
|
||||||
encodings[i] <= pseudoEncodingVideoTimeLevel100)
|
encodings[i] <= pseudoEncodingVideoTimeLevel100) {
|
||||||
Server::videoTime.setParam(encodings[i] - pseudoEncodingVideoTimeLevel0);
|
Server::videoTime.setParam(encodings[i] - pseudoEncodingVideoTimeLevel0);
|
||||||
|
clientparlog("videoTime", encodings[i] - pseudoEncodingVideoTimeLevel0, true);
|
||||||
|
}
|
||||||
|
|
||||||
if (encodings[i] >= pseudoEncodingVideoOutTimeLevel1 &&
|
if (encodings[i] >= pseudoEncodingVideoOutTimeLevel1 &&
|
||||||
encodings[i] <= pseudoEncodingVideoOutTimeLevel100)
|
encodings[i] <= pseudoEncodingVideoOutTimeLevel100) {
|
||||||
Server::videoOutTime.setParam(encodings[i] - pseudoEncodingVideoOutTimeLevel1 + 1);
|
Server::videoOutTime.setParam(encodings[i] - pseudoEncodingVideoOutTimeLevel1 + 1);
|
||||||
|
clientparlog("videoOutTime", encodings[i] - pseudoEncodingVideoOutTimeLevel1 + 1, true);
|
||||||
|
}
|
||||||
|
|
||||||
if (encodings[i] >= pseudoEncodingFrameRateLevel10 &&
|
if (encodings[i] >= pseudoEncodingFrameRateLevel10 &&
|
||||||
encodings[i] <= pseudoEncodingFrameRateLevel60)
|
encodings[i] <= pseudoEncodingFrameRateLevel60) {
|
||||||
Server::frameRate.setParam(encodings[i] - pseudoEncodingFrameRateLevel10 + 10);
|
Server::frameRate.setParam(encodings[i] - pseudoEncodingFrameRateLevel10 + 10);
|
||||||
|
clientparlog("frameRate", encodings[i] - pseudoEncodingFrameRateLevel10 + 10, true);
|
||||||
|
}
|
||||||
|
|
||||||
if (encodings[i] >= pseudoEncodingVideoScalingLevel0 &&
|
if (encodings[i] >= pseudoEncodingVideoScalingLevel0 &&
|
||||||
encodings[i] <= pseudoEncodingVideoScalingLevel9)
|
encodings[i] <= pseudoEncodingVideoScalingLevel9) {
|
||||||
Server::videoScaling.setParam(encodings[i] - pseudoEncodingVideoScalingLevel0);
|
Server::videoScaling.setParam(encodings[i] - pseudoEncodingVideoScalingLevel0);
|
||||||
|
clientparlog("videoScaling", encodings[i] - pseudoEncodingVideoScalingLevel0, true);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (encodings[i] >= pseudoEncodingJpegVideoQualityLevel0 &&
|
||||||
|
encodings[i] <= pseudoEncodingJpegVideoQualityLevel9) {
|
||||||
|
clientparlog("jpegVideoQuality", encodings[i] - pseudoEncodingJpegVideoQualityLevel0, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (encodings[i] >= pseudoEncodingWebpVideoQualityLevel0 &&
|
||||||
|
encodings[i] <= pseudoEncodingWebpVideoQualityLevel9) {
|
||||||
|
clientparlog("webpVideoQuality", encodings[i] - pseudoEncodingWebpVideoQualityLevel0, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (encodings[i] >= pseudoEncodingTreatLosslessLevel0 &&
|
||||||
|
encodings[i] <= pseudoEncodingTreatLosslessLevel10) {
|
||||||
|
clientparlog("treatLossless", encodings[i] - pseudoEncodingTreatLosslessLevel0, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (encodings[i] >= pseudoEncodingDynamicQualityMinLevel0 &&
|
||||||
|
encodings[i] <= pseudoEncodingDynamicQualityMinLevel9) {
|
||||||
|
clientparlog("dynamicQualityMin", encodings[i] - pseudoEncodingDynamicQualityMinLevel0, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (encodings[i] >= pseudoEncodingDynamicQualityMaxLevel0 &&
|
||||||
|
encodings[i] <= pseudoEncodingDynamicQualityMaxLevel9) {
|
||||||
|
clientparlog("dynamicQualityMax", encodings[i] - pseudoEncodingDynamicQualityMaxLevel0, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (encodings[i] >= pseudoEncodingVideoAreaLevel1 &&
|
||||||
|
encodings[i] <= pseudoEncodingVideoAreaLevel100) {
|
||||||
|
clientparlog("videoArea", encodings[i] - pseudoEncodingVideoAreaLevel1 + 1, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (encodings[i] >= pseudoEncodingVideoTimeLevel0 &&
|
||||||
|
encodings[i] <= pseudoEncodingVideoTimeLevel100) {
|
||||||
|
clientparlog("videoTime", encodings[i] - pseudoEncodingVideoTimeLevel0, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (encodings[i] >= pseudoEncodingVideoOutTimeLevel1 &&
|
||||||
|
encodings[i] <= pseudoEncodingVideoOutTimeLevel100) {
|
||||||
|
clientparlog("videoOutTime", encodings[i] - pseudoEncodingVideoOutTimeLevel1 + 1, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (encodings[i] >= pseudoEncodingFrameRateLevel10 &&
|
||||||
|
encodings[i] <= pseudoEncodingFrameRateLevel60) {
|
||||||
|
clientparlog("frameRate", encodings[i] - pseudoEncodingFrameRateLevel10 + 10, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (encodings[i] >= pseudoEncodingVideoScalingLevel0 &&
|
||||||
|
encodings[i] <= pseudoEncodingVideoScalingLevel9) {
|
||||||
|
clientparlog("videoScaling", encodings[i] - pseudoEncodingVideoScalingLevel0, false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (encodings[i] > 0)
|
if (encodings[i] > 0)
|
||||||
|
@ -171,6 +171,9 @@ void SMsgReader::readSetMaxVideoResolution()
|
|||||||
if (!rfb::Server::ignoreClientSettingsKasm && handler->canChangeKasmSettings()) {
|
if (!rfb::Server::ignoreClientSettingsKasm && handler->canChangeKasmSettings()) {
|
||||||
sprintf(tmp, "%ux%u", width, height);
|
sprintf(tmp, "%ux%u", width, height);
|
||||||
rfb::Server::maxVideoResolution.setParam(tmp);
|
rfb::Server::maxVideoResolution.setParam(tmp);
|
||||||
|
vlog.debug("Client sent config param maxVideoResolution %ux%u, applied", width, height);
|
||||||
|
} else {
|
||||||
|
vlog.debug("Client sent config param maxVideoResolution %ux%u, ignored due to -IgnoreClientSettingsKasm/lacking perms", width, height);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user