[Pkg-tigervnc-devel] Bug#985614: tigervnc-standalone-server: Does not properly handle boolean configuration values

Jeremy Frasier jeremy.frasier at trio.dhs.gov
Sat Mar 20 18:38:32 GMT 2021


Package: tigervnc-standalone-server
Version: 1.11.0+dfsg-1
Severity: normal
Tags: patch
X-Debbugs-Cc: jeremy.frasier at trio.dhs.gov

Dear Maintainer,

I have several Kali instances for which I configure shared connections.
I can no longer do this with the latest package, despite the file
/home/vnc/.vnc/config contianing:
allowoverride=alwaysshared
alwaysshared
disconnectclients=no
geometry=1920x1080
localhost=no
log=*:syslog:100
nevershared=0
securitytypes=vncauth
session=xfce

I believe this bug has been fixed upstream:
* https://github.com/TigerVNC/tigervnc/issues/1097
* https://github.com/TigerVNC/tigervnc/issues/1098

Here is a patch created from the upstream commit that fixes the issue:
>From 38c6848b30cb1908171f2b4628e345fbf6727b39 Mon Sep 17 00:00:00 2001
From: Pierre Ossman <ossman at cendio.se>
Date: Fri, 18 Sep 2020 10:44:32 +0200
Subject: [PATCH] Tolerate specifying -BoolParam 0 and similar

This is needed by vncserver which doesn't know which parameters are
boolean, and it cannot use the -Param=Value form as that isn't tolerated
by the Xorg code.
---
 unix/vncserver/vncserver.in    |  8 ++++----
 unix/xserver/hw/vnc/RFBGlue.cc | 16 ++++++++++++++++
 unix/xserver/hw/vnc/RFBGlue.h  |  1 +
 unix/xserver/hw/vnc/xvnc.c     | 14 ++++++++++++++
 vncviewer/vncviewer.cxx        | 20 ++++++++++++++++++++
 5 files changed, 55 insertions(+), 4 deletions(-)

diff --git a/unix/vncserver/vncserver.in b/unix/vncserver/vncserver.in
index 25fbbd315..261b258f1 100755
--- a/unix/vncserver/vncserver.in
+++ b/unix/vncserver/vncserver.in
@@ -107,7 +107,7 @@ $default_opts{rfbwait} = 30000;
 $default_opts{rfbauth} = "$vncUserDir/passwd";
 $default_opts{rfbport} = $vncPort;
 $default_opts{fp} = $fontPath if ($fontPath);
-$default_opts{pn} = "";
+$default_opts{pn} = undef;

 # Load user-overrideable system defaults
 LoadConfig($vncSystemConfigDefaultsFile);
@@ -242,13 +242,13 @@ push(@cmd, "@CMAKE_INSTALL_FULL_BINDIR@/Xvnc", ":$displayNumber");

 foreach my $k (sort keys %config) {
   push(@cmd, "-$k");
-  push(@cmd, $config{$k}) if $config{$k};
+  push(@cmd, $config{$k}) if defined($config{$k});
   delete $default_opts{$k}; # file options take precedence
 }

 foreach my $k (sort keys %default_opts) {
   push(@cmd, "-$k");
-  push(@cmd, $default_opts{$k}) if $default_opts{$k};
+  push(@cmd, $default_opts{$k}) if defined($default_opts{$k});
 }

 warn "\nNew '$desktopName' desktop is $host:$displayNumber\n\n";
@@ -291,7 +291,7 @@ sub LoadConfig {
           # current config file being loaded defined the logical opposite setting
           # (NeverShared vs. AlwaysShared, etc etc).
           $toggle = lc($1); # must normalize key case
-          $config{$toggle} = $k;
+          $config{$toggle} = undef;
         }
       }
       close(IN);
diff --git a/unix/xserver/hw/vnc/RFBGlue.cc b/unix/xserver/hw/vnc/RFBGlue.cc
index f108fae43..7c32bea8f 100644
--- a/unix/xserver/hw/vnc/RFBGlue.cc
+++ b/unix/xserver/hw/vnc/RFBGlue.cc
@@ -143,6 +143,22 @@ const char* vncGetParamDesc(const char *name)
   return param->getDescription();
 }

+int vncIsParamBool(const char *name)
+{
+  VoidParameter *param;
+  BoolParameter *bparam;
+
+  param = rfb::Configuration::getParam(name);
+  if (param == NULL)
+    return false;
+
+  bparam = dynamic_cast<BoolParameter*>(param);
+  if (bparam == NULL)
+    return false;
+
+  return true;
+}
+
 int vncGetParamCount(void)
 {
   int count;
diff --git a/unix/xserver/hw/vnc/RFBGlue.h b/unix/xserver/hw/vnc/RFBGlue.h
index 112405b84..695cea105 100644
--- a/unix/xserver/hw/vnc/RFBGlue.h
+++ b/unix/xserver/hw/vnc/RFBGlue.h
@@ -41,6 +41,7 @@ int vncSetParam(const char *name, const char *value);
 int vncSetParamSimple(const char *nameAndValue);
 char* vncGetParam(const char *name);
 const char* vncGetParamDesc(const char *name);
+int vncIsParamBool(const char *name);

 int vncGetParamCount(void);
 char *vncGetParamList(void);
diff --git a/unix/xserver/hw/vnc/xvnc.c b/unix/xserver/hw/vnc/xvnc.c
index 4eb0b0b13..5744acac8 100644
--- a/unix/xserver/hw/vnc/xvnc.c
+++ b/unix/xserver/hw/vnc/xvnc.c
@@ -618,6 +618,20 @@ ddxProcessArgument(int argc, char *argv[], int i)
         exit(0);
     }

+    /* We need to resolve an ambiguity for booleans */
+    if (argv[i][0] == '-' && i+1 < argc &&
+        vncIsParamBool(&argv[i][1])) {
+        if ((strcasecmp(argv[i+1], "0") == 0) ||
+            (strcasecmp(argv[i+1], "1") == 0) ||
+            (strcasecmp(argv[i+1], "true") == 0) ||
+            (strcasecmp(argv[i+1], "false") == 0) ||
+            (strcasecmp(argv[i+1], "yes") == 0) ||
+            (strcasecmp(argv[i+1], "no") == 0)) {
+            vncSetParam(&argv[i][1], argv[i+1]);
+            return 2;
+        }
+    }
+
     if (vncSetParamSimple(argv[i]))
        return 1;

diff --git a/vncviewer/vncviewer.cxx b/vncviewer/vncviewer.cxx
index d4dd3063c..77ba3d3f4 100644
--- a/vncviewer/vncviewer.cxx
+++ b/vncviewer/vncviewer.cxx
@@ -556,6 +556,26 @@ int main(int argc, char** argv)
   }

   for (int i = 1; i < argc;) {
+    /* We need to resolve an ambiguity for booleans */
+    if (argv[i][0] == '-' && i+1 < argc) {
+        VoidParameter *param;
+
+        param = Configuration::getParam(&argv[i][1]);
+        if ((param != NULL) &&
+            (dynamic_cast<BoolParameter*>(param) != NULL)) {
+          if ((strcasecmp(argv[i+1], "0") == 0) ||
+              (strcasecmp(argv[i+1], "1") == 0) ||
+              (strcasecmp(argv[i+1], "true") == 0) ||
+              (strcasecmp(argv[i+1], "false") == 0) ||
+              (strcasecmp(argv[i+1], "yes") == 0) ||
+              (strcasecmp(argv[i+1], "no") == 0)) {
+              param->setParam(argv[i+1]);
+              i += 2;
+              continue;
+          }
+      }
+    }
+
     if (Configuration::setParam(argv[i])) {
       i++;
       continue;

-- System Information:
Distributor ID:	Kali
Description:	Kali GNU/Linux Rolling
Release:	2021.1
Codename:	kali-rolling
Architecture: x86_64

Kernel: Linux 5.10.0-kali4-cloud-amd64 (SMP w/4 CPU threads)
Kernel taint flags: TAINT_UNSIGNED_MODULE
Locale: LANG=C.UTF-8, LC_CTYPE=C.UTF-8 (charmap=UTF-8), LANGUAGE not set
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages tigervnc-standalone-server depends on:
ii  libaudit1                   1:3.0-2
ii  libbsd0                     0.11.3-1
ii  libc6                       2.31-9
ii  libfile-readbackwards-perl  1.05-2
ii  libgcrypt20                 1.8.7-3
ii  libgl1                      1.3.2-1
ii  libgnutls30                 3.7.0-7
ii  libjpeg62-turbo             1:2.0.6-2
ii  libpam0g                    1.4.0-6
ii  libpixman-1-0               0.40.0-1
ii  libselinux1                 3.1-3
ii  libstdc++6                  10.2.1-6
ii  libsystemd0                 247.3-1
ii  libunwind8                  1.3.2-2
ii  libxau6                     1:1.0.9-1
ii  libxdmcp6                   1:1.1.2-3
ii  libxfont2                   1:2.0.4-1
ii  perl                        5.32.1-2
ii  tigervnc-common             1.11.0+dfsg-1
ii  x11-xkb-utils               7.7+5
ii  xauth                       1:1.1-1
ii  xkb-data                    2.29-2
ii  zlib1g                      1:1.2.11.dfsg-2

Versions of packages tigervnc-standalone-server recommends:
ii  libgl1-mesa-dri    20.3.4-1
ii  x11-xserver-utils  7.7+8
ii  xfonts-base        1:1.0.5

Versions of packages tigervnc-standalone-server suggests:
ii  xfonts-100dpi    1:1.0.4+nmu1.1
ii  xfonts-75dpi     1:1.0.4+nmu1.1
ii  xfonts-scalable  1:1.0.3-1.2

-- Configuration Files:
/etc/tigervnc/vncserver.users changed:
:1=vnc


-- no debconf information



More information about the Pkg-tigervnc-devel mailing list