Description: Upstream changes introduced in version 1.3.9-6.1
 This patch has been created by dpkg-source during the package build.
 Here's the last changelog entry, hopefully it gives details on why
 those changes were made:
 .
 tightvnc (1.3.9-6.1) unstable; urgency=low
 .
   * Non-maintainer upload.
     - Update to packaging format "3.0 (quilt)".
   * debian/compat
     - Update to 7.
   * debian/control
     - (Build-Depends): Update xutils to xutils-dev (important;
       Closes: #575865). Update to debhelper 7.1. Remove obsolete x-dev.
     - (Depends): Add ${misc:Depends}.
     - (Homepage): New field.
     - (Standards-Version): Update to 3.8.4.
     - (tightvncserver::Depends): Replace obsolete xbase-clients with
       x11-utils and xauth. The needed binaries xdpyinfo and xauth
       are used in Perl program /usr/bin/tightvncserver.
   * debian/copyright
     - Point to GPL-2.
   * debian/patches
     - (10, 20): Add new patches.
     - (30): Convert original MIPS patch to apply to current sources.
     - (tightvnc-ftbfs-mips.patch): Removed. See 30.
    * debian/*.{postrm,prerm}
     - Add "set -e".
     - Fix Lintian maintainer-script-without-set-e.
   * debian/rules
     - (CC): Add. Export variable for xmkmf(1).
     - (DH_COMPAT): Delete; use debian/compat.
     - (install): Correct tightvncpasswd.1x to tightvncpasswd.1.
     - (binary-arch): Remove empty directories.
   * debian/source/format
     - New file.
   * debian/watch
     - New file.
   * debian/tightvncserver.doc-base
     - New file.
   * debian/xtightvncviewer.menu
     - (section): Update obsolete Apps/Net to
       Applications/Network/Communication.
 .
 The person named in the Author field signed this changelog entry.
Bug-Debian: http://bugs.debian.org/575865
Forwarded: no
Author: Jari Aalto <jari.aalto@cante.net>
Author: Sven Geuer <debmaint@g-e-u-e-r.de>
Last-Update: 2021-05-15
--- a/vncserver.man
+++ b/vncserver.man
@@ -3,7 +3,7 @@
 .\" Man page for vncserver
 .\"
 .\" Copyright (C) 1998 Marcus.Brinkmann@ruhr-uni-bochum.de
-.\" Copyright (C) 2000, opal@debian.org
+.\" Copyright (C) 2000,2008 Ola Lundqvist <opal@debian.org>
 .\" Copyright (C) 2000, 2001 Red Hat, Inc.
 .\" Copyright (C) 2001, 2002 Constantin Kaplinsky
 .\"
@@ -18,9 +18,10 @@
 \fBvncserver\fR
 [:\fIdisplay\fR] [\-geometry \fIwidth\fRx\fIheight\fR] [\-depth \fIdepth\fR]
 [\-pixelformat rgb\fINNN\fR|bgr\fINNN\fR] [\-name \fIdesktop\-name\fR]
-[\fIXvnc\-options\fR...]
+[\| \-httpport\ int \|] [\| \-basehttpport\ int \|] [\| \-alwaysshared \|]
+[\| \-nevershared \|] [\fIXvnc\-options\fR...]
 .TP
-\fBvncserver\fR \-kill :\fIdisplay\fR
+\fBvncserver\fR [\| \-clean \|] \-kill :\fIdisplay\fR
 .TP
 \fBvncserver\fR \-help
 .SH DESCRIPTION
@@ -54,9 +55,27 @@
 \fB\-name\fR \fIstring\fR
 This specifies the name of the desktop.
 .TP
+\fB\-clean\fR
+This option can be used in conjunction with
+.TP
 \fB\-kill\fR \fB:\fR\fIdisplay\fR
 Stops the session running on the specified display.
 .TP
+\fB\-nevershared\fR
+Never allow shared desktops.
+.TP
+\fB\-alwaysshared\fR
+Always allow shared desktops.
+.TP
+\fB\-basehttpport int\fR
+The base http port to use for the java client applet (you have to install
+the tightvnc-java package to make this work). The real port number will be
+port = base + display num.
+.TP
+\fB\-httpport int\fR
+The http port to use for the java client applet (you have to install
+the tightvnc-java package to make this work).
+.TP
 \fB\-help\fR
 Prints a short usage notice to stderr.
 .SH EXAMPLES
--- a/vncserver
+++ b/vncserver
@@ -1,5 +1,6 @@
 #!/usr/bin/perl
 #
+#  Copyright (C) 2004-2006,2008-2009 Ola Lundqvist <opal@debian.org>
 #  Copyright (C) 2002-2009 Constantin Kaplinsky.  All Rights Reserved.
 #  Copyright (C) 1999 AT&T Laboratories Cambridge.  All Rights Reserved.
 #
@@ -23,6 +24,13 @@
 # vncserver - wrapper script to start an X VNC server.
 #
 
+# This file was heavily edited by
+#              Ola Lundqvist <opal@debian.org>
+#               Marcus Brinkmann <Marcus.Brinkmann@ruhr-uni-bochum.de>
+# Clean option by Dirk Eddelbuettel <edd@debian.org>
+
+# Please report all errors to Debian and not to ORL.
+
 # First make sure we're operating in a sane environment.
 
 &SanityCheck();
@@ -32,9 +40,11 @@
 $geometry = "1024x768";
 $depth = 24;
 $desktopName = "X";
-$vncClasses = "/usr/local/vnc/classes";
+if (-d "/usr/share/tightvnc-java") {
+    $vncClasses = "/usr/share/tightvnc-java";
+}
 $vncUserDir = "$ENV{HOME}/.vnc";
-$fontPath = "unix/:7100";
+#$fontPath = "unix/:7100";
 $authType = "-rfbauth $vncUserDir/passwd";
 
 # Read configuration from the system-wide and user files if present.
@@ -50,14 +60,50 @@
     = ("#!/bin/sh\n\n".
        "xrdb \$HOME/.Xresources\n".
        "xsetroot -solid grey\n".
-       "xterm -geometry 80x24+10+10 -ls -title \"\$VNCDESKTOP Desktop\" &\n".
-       "twm &\n");
+       "#x-terminal-emulator -geometry 80x24+10+10 -ls -title \"\$VNCDESKTOP Desktop\" &\n".
+       "#x-window-manager &\n".
+       "# Fix to make GNOME work\n".
+       "export XKL_XMODMAP_DISABLE=1\n".
+       "/etc/X11/Xsession\n");
 
 $xauthorityFile = "$ENV{XAUTHORITY}";
 
+######## Adding configuration possibility ################
+$Config_file = "/etc/vnc.conf";
+&ReadConfigFile();
+$Config_file = "$ENV{HOME}/.vncrc";
+&ReadConfigFile();
+
+if (!$XFConfigPath) {
+  foreach ("/etc/X11/xorg.conf", "/etc/X11/XF86Config-4", "/etc/X11/XF86Config" ){
+      $XFConfigPath = $_;
+      last if ( -e $XFConfigPath );
+  }
+}
+if (!$fontPath) {
+  &ReadXFConfigFont;
+}
+if (!$fontPath) {
+  $fontPath = "/usr/share/fonts/X11/misc/,".
+              "/usr/share/fonts/X11/Type1/,".
+              "/usr/share/fonts/X11/75dpi/,".
+              "/usr/share/fonts/X11/100dpi/"
+}
+if (!$colorPath) {
+  &ReadXFConfigColor;
+}
+if (!$colorPath) {
+  foreach ("/etc/X11/rgb", "/usr/share/X11/rgb", "/usr/X11R6/lib/X11/rgb"){
+      $colorPath = $_;
+      last if ( -e "${colorPath}.txt" );
+  }
+}
+##########################################################
+
 $vncUserDirUnderTmp = ($vncUserDir =~ m|^/tmp/.+|) ? 1 : 0;
 $xstartup = ($vncUserDirUnderTmp) ?
   "$ENV{HOME}/.vncstartup" : "$vncUserDir/xstartup";
+$xstartup = $vncStartup if ($vncStartup);
 unless ($xauthorityFile) {
     if ($vncUserDirUnderTmp) {
         $xauthorityFile = "$vncUserDir/.Xauthority";
@@ -72,12 +118,23 @@
 # Check command line options
 
 &ParseOptions("-geometry",1,"-depth",1,"-pixelformat",1,"-name",1,"-kill",1,
-	      "-help",0,"-h",0,"--help",0);
+	      "-help",0,"-h",0,"--help",0,
+	      "-clean",0, "-fp",1,
+              "-alwaysshared",0, "-nevershared",0,
+              "-httpport",1,"-basehttpport",1);
 
 &Usage() if ($opt{'-help'} || $opt{'-h'} || $opt{'--help'});
 
 &Kill() if ($opt{'-kill'});
 
+$useClasses = 0;
+if (defined $vncClasses) {
+  if(! -d $vncClasses) {
+    die "VNC class files can not be found at $vncClasses.";
+  }
+  $useClasses = 1;
+}
+
 # Uncomment this line if you want default geometry, depth and pixelformat
 # to match the current X display:
 # &GetXDisplayDefaults();
@@ -93,6 +150,25 @@
     $pixelformat = $opt{'-pixelformat'};
 }
 
+if ($opt{'-fp'}) {
+    @fontPathElements = split(/\s*,\s*/, "$opt{'-fp'}");
+
+    $fontPath = '';
+
+    foreach $i (0.."$#fontPathElements") {
+        $tempFontPath = $fontPathElements[$i];
+        if ($tempFontPath !~ m!^[^/]*/[^/]*:\d+$!) {
+            $tempFontPath =~ s/:unscaled$//;
+            if (-r "$tempFontPath/fonts.dir") {
+                $fontPath .= "$fontPathElements[$i],";
+            }
+        } else {
+            $fontPath .= "$fontPathElements[$i],";
+        }
+    }
+    chop $fontPath;
+}
+
 &CheckGeometryAndDepth();
 
 if ($opt{'-name'}) {
@@ -106,14 +182,14 @@
         die "$prog: Could not create $vncUserDir.\n";
     }
 }
-($z,$z,$mode) = lstat("$vncUserDir");
+($z,$z,$mode) = stat("$vncUserDir");
 if (!-d _ || !-o _ || ($vncUserDirUnderTmp && ($mode & 0777) != 0700)) {
     die "$prog: Wrong type or access mode of $vncUserDir.\n";
 }
 
 # Make sure the user has a password.
 
-($z,$z,$mode) = lstat("$vncUserDir/passwd");
+($z,$z,$mode) = stat("$vncUserDir/passwd");
 if (-e _ && (!-f _ || !-o _)) {
     die "$prog: Wrong type or ownership on $vncUserDir/passwd.\n";
 }
@@ -159,9 +235,21 @@
 
 # Now start the X VNC Server
 
-$cmd = "Xvnc :$displayNumber";
+$cmd = "Xtightvnc :$displayNumber";
 $cmd .= " -desktop " . &quotedString($desktopName);
-$cmd .= " -httpd $vncClasses";
+if ($useClasses) {
+  $cmd .= " -httpd $vncClasses";
+  print ("Found $vncClasses for http connections.\n");
+  if ($opt{'-httpport'}) {
+    $cmd .= " -httpport $opt{'-httpport'}";
+    print ("Listening to $opt{'-httpport'} for http connections.\n");
+  }
+  elsif ($opt{'-basehttpport'}) {
+    my $v = $opt{'-basehttpport'} + $displayNumber;
+    print ("Listening to $v for http connections.\n");
+    $cmd .= " -httpport $v";
+  }
+}
 $cmd .= " -auth $xauthorityFile";
 $cmd .= " -geometry $geometry" if ($geometry);
 $cmd .= " -depth $depth" if ($depth);
@@ -171,6 +259,8 @@
 $cmd .= " -rfbport $vncPort";
 $cmd .= " -fp $fontPath" if ($fontPath);
 $cmd .= " -co $colorPath" if ($colorPath);
+$cmd .= " -alwaysshared" if ($opt{'-alwaysshared'});
+$cmd .= " -nevershared" if ($opt{'-nevershared'});
 
 foreach $arg (@ARGV) {
     $cmd .= " " . &quotedString($arg);
@@ -182,18 +272,18 @@
 $pidFile = "$vncUserDir/$host:$displayNumber.pid";
 system("$cmd & echo \$! >$pidFile");
 
-# Give Xvnc a chance to start up
+# Give Xtightvnc a chance to start up
 
 sleep(1);
 unless (kill 0, `cat $pidFile`) {
-    warn "Couldn't start Xvnc; trying default font path.\n";
+    warn "Couldn't start Xtightvnc; trying default font path.\n";
     warn "Please set correct fontPath in the $prog script.\n";
     $cmd =~ s@-fp [^ ]+@@;
     system("$cmd & echo \$! >$pidFile");
     sleep(1);
 }
 unless (kill 0, `cat $pidFile`) {
-    warn "Couldn't start Xvnc process.\n\n";
+    warn "Couldn't start Xtightvnc process.\n\n";
     open(LOG, "<$desktopLog");
     while (<LOG>) { print; }
     close(LOG);
@@ -231,6 +321,65 @@
 
 exit;
 
+############################ Debian functions #################################
+# I thank Manoj for the code below.
+#
+# ReadConfigFile reads in a config file and sets variables according to it.
+#
+
+sub ReadConfigFile
+{
+  open(CONFIG, "$Config_file") || return;
+  my $lineno = 0;
+  while (<CONFIG>) {
+      chomp;
+      $lineno++;
+      s/\#.*//og;
+      next if /^\s*$/og;
+      $_ .= ";" unless /;\s*$/;
+      if (/^\s*([^=]+)\s*=\s*(\S.*)$/o) {
+          my $ret = eval "$1=$2";
+          if ($@) {
+              print STDERR "Error parsing config file $Config_file!\n";
+              print STDERR "$lineno:$_\n";
+          }
+      }
+  }
+}
+
+sub ReadXFConfigFont
+{
+  open(CONFIG, "$XFConfigPath") || return;
+  my $lineno = 0;
+  while (<CONFIG>) {
+      chomp;
+      $lineno++;
+      s/\#.*//og;
+      next if /^\s*$/og;
+      if (/^\s*FontPath\s*"(\S.*)"\s*$/o) {
+          $fontPath .= "," if $fontPath;
+          $fontPath .= $1;
+      }
+  }
+}
+
+sub ReadXFConfigColor
+{
+  open(CONFIG, "$XFConfigPath") || return;
+  my $lineno = 0;
+  while (<CONFIG> && !$colorPath) {
+      chomp;
+      $lineno++;
+      s/\#.*//og;
+      next if /^\s*$/og;
+      if (/^\s*RgbPath\s*"(\S.*)"\s*$/o) {
+          $colorPath = $1;
+      }
+  }
+}
+
+
+########## End of debian functions ###########
 
 ###############################################################################
 #
@@ -296,7 +445,8 @@
 
     socket(S, $AF_INET, $SOCK_STREAM, 0) || die "$prog: socket failed: $!\n";
     eval 'setsockopt(S, &SOL_SOCKET, &SO_REUSEADDR, pack("l", 1))';
-    unless (bind(S, pack('S n x12', $AF_INET, 6000 + $n))) {
+    #unless (bind(S, pack('S n x12', $AF_INET, 6000 + $n))) {
+    unless (bind(S, sockaddr_in(6000 + $n, &INADDR_ANY))) {
 	close(S);
 	return 0;
     }
@@ -304,7 +454,8 @@
 
     socket(S, $AF_INET, $SOCK_STREAM, 0) || die "$prog: socket failed: $!\n";
     eval 'setsockopt(S, &SOL_SOCKET, &SO_REUSEADDR, pack("l", 1))';
-    unless (bind(S, pack('S n x12', $AF_INET, 5900 + $n))) {
+    #unless (bind(S, pack('S n x12', $AF_INET, 5900 + $n))) {
+    unless (bind(S, sockaddr_in(5900 + $n, &INADDR_ANY))) {
 	close(S);
 	return 0;
     }
@@ -442,15 +593,19 @@
 	"Usage: $prog [<OPTIONS>] [:<DISPLAY#>]\n".
 	"       $prog -kill :<DISPLAY#>\n".
 	"\n".
-	"<OPTIONS> are Xvnc options, or:\n".
+	"<OPTIONS> are Xtightvnc options, or:\n".
 	"\n".
 	"        -name <DESKTOP-NAME>\n".
 	"        -depth <DEPTH>\n".
 	"        -geometry <WIDTH>x<HEIGHT>\n".
+        "        -httpport number\n".
+        "        -basehttpport number\n".
+        "        -alwaysshared\n".
+        "        -nevershared\n".
 	"        -pixelformat rgb<NNN>\n".
 	"        -pixelformat bgr<NNN>\n".
 	"\n".
-	"See vncserver and Xvnc manual pages for more information.\n");
+	"See vncserver and Xtightvnc manual pages for more information.\n");
 }
 
 
@@ -474,14 +629,18 @@
 
     unless (-r $pidFile) {
 	die "\nCan't find file $pidFile\n".
-	    "You'll have to kill the Xvnc process manually\n\n";
+	    "You'll have to kill the Xtightvnc process manually\n\n";
     }
 
     $SIG{'HUP'} = 'IGNORE';
     chop($pid = `cat $pidFile`);
-    warn "Killing Xvnc process ID $pid\n";
+    warn "Killing Xtightvnc process ID $pid\n";
     system("kill $pid");
     unlink $pidFile;
+
+    ## If option -clean is given, also remove the logfile
+    unlink "$vncUserDir/$host$opt{'-kill'}.log" if ($opt{'-clean'});
+
     exit;
 }
 
@@ -549,7 +708,7 @@
     #
 
  cmd:
-    foreach $cmd ("uname","xauth","Xvnc","vncpasswd") {
+    foreach $cmd ("uname","xauth","Xtightvnc","vncpasswd") {
 	for (split(/:/,$ENV{PATH})) {
 	    if (-x "$_/$cmd") {
 		next cmd;
--- a/Xvnc/programs/Xserver/Xvnc.man
+++ b/Xvnc/programs/Xserver/Xvnc.man
@@ -141,7 +141,7 @@
 allow only loopback connections from the server machine (the
 \fI\-localhost\fR option) and to use SSH tunneling for remote access
 to the Xvnc server. For details on SSH tunneling, see
-<URL:http://www.uk.research.att.com/vnc/sshvnc.html> .
+<URL:http://www.cl.cam.ac.uk/Research/DTG/attarchive/vnc/sshvnc.html> .
 .SH SEE ALSO
 \fBvncserver\fR(1), \fBvncviewer\fR(1), \fBvncpasswd\fR(1),
 \fBvncconnect\fR(1), \fBsshd\fR(1)
--- a/Xvnc/programs/Xserver/Xserver.man
+++ b/Xvnc/programs/Xserver/Xserver.man
@@ -649,7 +649,7 @@
 /tmp/rcX\fBn\fP
 Kerberos 5 replay cache for display number \fBn\fP
 .TP 30
-/usr/adm/X\fBn\fPmsgs
+/var/log/X\fBn\fPmsgs
 Error log file for display number \fBn\fP if run from \fIinit(8)\fP
 .TP 30
 <XRoot>/lib/X11/xdm/xdm-errors
--- a/Xvnc/programs/Xserver/os/osinit.c
+++ b/Xvnc/programs/Xserver/os/osinit.c
@@ -71,7 +71,7 @@
 #endif
 
 #ifndef ADMPATH
-#define ADMPATH "/usr/adm/X%smsgs"
+#define ADMPATH "/var/log/X%smsgs"
 #endif
 
 extern char *display;
--- a/Xvnc/programs/Xserver/include/servermd.h
+++ b/Xvnc/programs/Xserver/include/servermd.h
@@ -421,6 +421,20 @@
 
 #endif /* Linux/PPC */
 
+#if defined (linux) && defined(__sparc__)
+
+#define IMAGE_BYTE_ORDER       MSBFirst
+#define BITMAP_BIT_ORDER       MSBFirst
+#define GLYPHPADBYTES          4
+#define GETLEFTBITS_ALIGNMENT  1
+
+#define AVOID_MEMORY_READ
+#define LARGE_INSTRUCTION_CACHE
+#define FAST_CONSTANT_OFFSET_MODE
+#define SHARED_IDCACHE
+
+#endif /* Linux/sparc */
+
 #if defined(__MACH__) && defined(__POWERPC__)
 
 #define IMAGE_BYTE_ORDER       MSBFirst
--- a/Xvnc/programs/Xserver/dix/dixfonts.c
+++ b/Xvnc/programs/Xserver/dix/dixfonts.c
@@ -1759,10 +1759,11 @@
 	    if (err != Successful) {
 		xfree(fpe->name);
 		xfree(fpe);
-		err = BadValue;
-		goto bail;
+		err = Successful;
 	    }
-	    fplist[valid_paths++] = fpe;
+	    else {
+	      fplist[valid_paths++] = fpe;
+            }
 	} else {
 	    err = BadValue;
 	    goto bail;
