- initial release
This commit is contained in:
Valery Inozemtsev 2016-06-06 14:24:53 +00:00 committed by Girar Builder pender robot
commit 5e361f9129
34 changed files with 84925 additions and 0 deletions

2
.gear/rules Normal file
View File

@ -0,0 +1,2 @@
copy: *.patch
tar.xz: vncterm name=vncterm

24
libvncserver-memcpy.patch Normal file
View File

@ -0,0 +1,24 @@
Fix a buffer overflow on platforms where sizeof(long) > sizeof(int).
https://bugs.gentoo.org/show_bug.cgi?id=329031
--- libvncserver/tightvnc-filetransfer/filetransfermsg.c
+++ libvncserver/tightvnc-filetransfer/filetransfermsg.c
@@ -393,7 +393,8 @@
CreateFileDownloadZeroSizeDataMsg(unsigned long mTime)
{
FileTransferMsg fileDownloadZeroSizeDataMsg;
- int length = sz_rfbFileDownloadDataMsg + sizeof(int);
+ uint32_t mTime32 = (uint32_t)mTime;
+ int length = sz_rfbFileDownloadDataMsg + sizeof(mTime32);
rfbFileDownloadDataMsg *pFDD = NULL;
char *pFollow = NULL;
@@ -413,7 +414,7 @@
pFDD->compressedSize = Swap16IfLE(0);
pFDD->realSize = Swap16IfLE(0);
- memcpy(pFollow, &mTime, sizeof(unsigned long));
+ memcpy(pFollow, &mTime, sizeof(mTime32));
fileDownloadZeroSizeDataMsg.data = pData;
fileDownloadZeroSizeDataMsg.length = length;

50
pve-vncterm.spec Normal file
View File

@ -0,0 +1,50 @@
%define sname vncterm
Name: pve-%sname
Summary: VNC Terminal Emulator
Version: 1.2
Release: alt1
License: GPLv2
Group: Networking/WWW
Url: https://git.proxmox.com/
Packager: Valery Inozemtsev <shrek@altlinux.ru>
Source0: %sname.tar.xz
Source1: libvncserver-memcpy.patch
Patch0: %sname-alt.patch
Patch1: %sname-gnutls.patch
# Automatically added by buildreq on Mon Mar 21 2016
# optimized out: libp11-kit perl-Encode perl-Pod-Escapes perl-Pod-Simple perl-podlators xz
BuildRequires: libgnutls-devel libjpeg-devel perl-Pod-Usage zlib-devel
%description
With vncterm you can start commands and export its standard input and
output to any VNC client (simulating a xterm Terminal).
%prep
%setup -q -n %sname
%patch0 -p1
%patch1 -p1
cp %SOURCE1 vncpatches/
%build
make %sname
make %sname.1
%install
install -pD -m0755 %sname %buildroot%_bindir/%sname
install -pD -m0644 %sname.1 %buildroot%_man1dir/%sname.1
install -pD -m0644 VncViewer.jar %buildroot%_datadir/%sname/VncViewer.jar
%files
%_bindir/%sname
%_datadir/%sname
%_man1dir/%sname.1*
%changelog
* Mon Mar 21 2016 Valery Inozemtsev <shrek@altlinux.ru> 1.2-alt1
- initial release

16
vncterm-alt.patch Normal file
View File

@ -0,0 +1,16 @@
--- vncterm/Makefile.alt 2016-03-21 11:31:51.727559534 +0000
+++ vncterm/Makefile 2016-03-21 11:51:50.857533517 +0000
@@ -33,11 +33,11 @@ ${VNCLIB} vnc: ${VNCSRC}
rm -rf ${VNCDIR}
tar xf ${VNCSRC}
ln -s ../vncpatches ${VNCDIR}/patches
- cd ${VNCDIR}; quilt push -a
+ cd ${VNCDIR}; patch -p1 < patches/tls-auth-pluging.patch; patch -p0 < patches/libvncserver-memcpy.patch
cd ${VNCDIR}; ./configure;
cd ${VNCDIR}; make
-vncterm: vncterm.c glyphs.h ${VNCLIB}
+vncterm: vncterm.c ${VNCLIB}
gcc -O2 -g -o $@ vncterm.c -Wall -Wno-deprecated-declarations -D_GNU_SOURCE -I ${VNCDIR} ${VNCLIB} -lnsl -lpthread -lz -ljpeg -lutil -lgnutls
jar: tigervnc.org

46
vncterm-gnutls.patch Normal file
View File

@ -0,0 +1,46 @@
--- vncterm/vncterm.c.alt 2015-02-27 22:00:46.000000000 +0300
+++ vncterm/vncterm.c 2015-12-27 19:57:06.000000000 +0300
@@ -485,41 +485,8 @@
return;
}
- /* optimize for speed */
- static const int cipher_priority_performance[] = {
- GNUTLS_CIPHER_ARCFOUR_128,
- GNUTLS_CIPHER_AES_128_CBC,
- GNUTLS_CIPHER_3DES_CBC, 0
- };
-
- if ((ret = gnutls_cipher_set_priority(sd->session, cipher_priority_performance)) < 0) {
- rfbLog("gnutls_cipher_set_priority failed: %s\n", gnutls_strerror(ret));
- sd->session = NULL;
- rfbCloseClient(cl);
- return;
- }
-
- static const int kx_anon[] = {GNUTLS_KX_ANON_DH, 0};
- static const int kx_x509[] = {GNUTLS_KX_DHE_DSS, GNUTLS_KX_RSA, GNUTLS_KX_DHE_RSA, GNUTLS_KX_SRP, 0};
- if ((ret = gnutls_kx_set_priority(sd->session, use_x509 ? kx_x509 : kx_anon)) < 0) {
- rfbLog("gnutls_kx_set_priority failed: %s\n", gnutls_strerror(ret));
- sd->session = NULL;
- rfbCloseClient(cl);
- return;
- }
-
- static const int cert_type_priority[] = { GNUTLS_CRT_X509, 0 };
- if ((ret = gnutls_certificate_type_set_priority(sd->session, cert_type_priority)) < 0) {
- rfbLog("gnutls_certificate_type_set_priority failed: %s\n",
- gnutls_strerror(ret));
- sd->session = NULL;
- rfbCloseClient(cl);
- return;
- }
-
- static const int protocol_priority[]= { GNUTLS_TLS1_1, GNUTLS_TLS1_0, GNUTLS_SSL3, 0 };
- if ((ret = gnutls_protocol_set_priority(sd->session, protocol_priority)) < 0) {
- rfbLog("gnutls_protocol_set_priority failed: %s\n",
+ if ((ret = gnutls_priority_set_direct(sd->session, "NORMAL:+ANON-ECDH:+ANON-DH", NULL)) < 0) {
+ rfbLog("gnutls_priority_set_direct failed: %s\n",
gnutls_strerror(ret));
sd->session = NULL;
rfbCloseClient(cl);

Binary file not shown.

129
vncterm/Makefile Normal file
View File

@ -0,0 +1,129 @@
RELEASE=4.0
PACKAGE=vncterm
# Note: also change version in debian/control and debian/changelog
VERSION=1.2
PACKAGERELEASE=1
ARCH:=$(shell dpkg-architecture -qDEB_BUILD_ARCH)
CDATE:=$(shell date +%F)
VNCVER=0.9.7
VNCDIR=LibVNCServer-${VNCVER}
VNCSRC=${VNCDIR}.tar.gz
VNCLIB=${VNCDIR}/libvncserver/.libs/libvncserver.a
TIGERVNCSRC=tigervnc-1.1.0.tgz
#TIGERVNCSRC=tigervnc-1.2.0.tgz
DEB=${PACKAGE}_${VERSION}-${PACKAGERELEASE}_${ARCH}.deb
SNAP=${PACKAGE}-${VERSION}-${CDATE}.tar.gz
KEYSTORE=/home/dietmar/pve2-proxdev/proxmox-dev/comodo-for-java.keystore
all: vncterm
glyphs.h: genfont
./genfont > glyphs.h
genfont: genfont.c
gcc -g -O2 -o $@ genfont.c -Wall -D_GNU_SOURCE -lz
.PHONY: vnc
${VNCLIB} vnc: ${VNCSRC}
rm -rf ${VNCDIR}
tar xf ${VNCSRC}
ln -s ../vncpatches ${VNCDIR}/patches
cd ${VNCDIR}; quilt push -a
cd ${VNCDIR}; ./configure;
cd ${VNCDIR}; make
vncterm: vncterm.c glyphs.h ${VNCLIB}
gcc -O2 -g -o $@ vncterm.c -Wall -Wno-deprecated-declarations -D_GNU_SOURCE -I ${VNCDIR} ${VNCLIB} -lnsl -lpthread -lz -ljpeg -lutil -lgnutls
jar: tigervnc.org
if test ! -f /usr/share/icedtea-web/plugin.jar; then echo "please install package icedtea-netx-common"; exit 1; fi
rm -rf tigervnc VncViewer.jar
rsync -av --exclude .svn --exclude .svnignore tigervnc.org/ tigervnc
ln -s ../tigerpatches tigervnc/patches
cd tigervnc; quilt push -a
cd tigervnc/java/src/com/tigervnc/vncviewer; make clean; make
jarsigner -keystore ${KEYSTORE} -signedjar VncViewer.jar tigervnc/java/src/com/tigervnc/vncviewer/VncViewer.jar "dc475d72-124a-11e4-a53f-005056c00008"
# this is for version 1.2
# ln -s ../newtigerpatches tigervnc/patches
# cd tigervnc/java;cmake -G "Unix Makefiles"; make
# jarsigner -keystore ${KEYSTORE} -signedjar VncViewer.jar tigervnc/java/VncViewer.jar proxmox
tigervnc.org: ${TIGERVNCSRC}
rm -rf tigervnc.org
tar xf ${TIGERVNCSRC}
download:
rm -rf tigervnc.org
svn co https://tigervnc.svn.sourceforge.net/svnroot/tigervnc/tags/1_1_0 tigervnc.org
tar cf ${TIGERVNCSRC} tigervnc.org
.PHONY: install
install: vncterm vncterm.1 VncViewer.jar
mkdir -p ${DESTDIR}/usr/share/doc/${PACKAGE}
mkdir -p ${DESTDIR}/usr/share/man/man1
mkdir -p ${DESTDIR}/usr/bin
install -s -m 0755 vncterm ${DESTDIR}/usr/bin
mkdir -p ${DESTDIR}/usr/share/vncterm/
install -m 0644 VncViewer.jar ${DESTDIR}/usr/share/vncterm/
.PHONY: dinstall
dinstall: ${DEB}
dpkg -i ${DEB}
vncterm.1: vncterm.pod
rm -f $@
pod2man -n $< -s 1 -r ${VERSION} <$< >$@
.PHONY: deb
${DEB} deb:
make clean
rm -rf dest
mkdir dest
make DESTDIR=`pwd`/dest install
install -d -m 0755 dest/DEBIAN
install -m 0644 debian/control dest/DEBIAN
echo "Architecture: ${ARCH}" >>dest/DEBIAN/control
install -m 0644 debian/conffiles dest/DEBIAN
install -m 0644 copyright dest/usr/share/doc/${PACKAGE}
install -m 0644 vncterm.1 dest/usr/share/man/man1
install -m 0644 debian/changelog.Debian dest/usr/share/doc/${PACKAGE}
gzip --best dest/usr/share/man/*/*
gzip --best dest/usr/share/doc/${PACKAGE}/changelog.Debian
dpkg-deb --build dest
mv dest.deb ${DEB}
rm -rf dest
lintian ${DEB}
.PHONY: upload
upload: ${DEB}
umount /pve/${RELEASE}; mount /pve/${RELEASE} -o rw
mkdir -p /pve/${RELEASE}/extra
rm -f /pve/${RELEASE}/extra/${PACKAGE}_*.deb
rm -f /pve/${RELEASE}/extra/Packages*
cp ${DEB} /pve/${RELEASE}/extra
cd /pve/${RELEASE}/extra; dpkg-scanpackages . /dev/null > Packages; gzip -9c Packages > Packages.gz
umount /pve/${RELEASE}; mount /pve/${RELEASE} -o ro
.PHONY: clean
clean:
rm -rf vncterm vncterm.1 vncterm_*.deb tigervnc *~ ${VNCDIR} vncterm-*.tar.gz
.PHONY: distclean
distclean: clean
rm -rf tigervnc.org
.PHONY: dist
${SNAP} dist: distclean
rm -rf ../${SNAP}
cd ..; tar cvzf ${SNAP} --exclude .svn ${PACKAGE}
mv ../${SNAP} ${SNAP}
.PHONY: uploaddist
uploaddist: ${SNAP}
scp ${SNAP} pve.proxmox.com:/home/ftp/sources/

57
vncterm/README Normal file
View File

@ -0,0 +1,57 @@
Simple VNC terminal emulator (inspired by VncCommand)
We try to simulate a 'xterm', because we want to support:
- unicode
- mouse
and xterm seems to be the best solution for that.
some code is inspired by: qemu, VncCommand, xterm, linux kernel, ...
libvncserver
============
LibVNCServer does not suppurt TLS currently. So we staically link to a
patched versions on that library instead of using the debian shared
libraries.
VNC Java Applet (for use in web based applications):
====================================================
We use patched VncViewer files (TigerVNC 1.1.0 sources):
http://www.tigervnc.com/
We sign the applet to make clipboard working.
Note: Newer tigervnc 1.2.0 always use a toplevel window, which
make it basically useless as applet.
http://sourceforge.net/tracker/?func=detail&aid=3488166&group_id=254363&atid=1126849
I put patches for 1.2.0 to newtigerpatches subdir.
Note: javascript-events.patch requires JSObject, which is inside plugin.jar
previously provided by sun-java-jdk. For wheezy/openjdk, we need to install
package "icedtea-netx-common" which contains that file.
TODO:
=====
Useful sources for terminal emulation:
xterm source: ctlseqs.txt
http://vt100.net/docs/vt220-rm
man 5 terminfo
infocmp xterm
man console_codes
Fonts:
we currently use fonts provided by the debian console-data package:
see /usr/share/consolefonts/*
Only 8x16 fonts are supported
TODO contains a list of unimplemented things.

12
vncterm/TODO Normal file
View File

@ -0,0 +1,12 @@
TODO:
better command line parser - print usage infos
implement some kind of regression testing
cleanup the TLS patch and try to merge into upstream
scroll/history support?
more ESC sequences (see xterm source ctlseqs.txt)
disp_ctrl
add arabic font glyphs
add japanese font glyphs
add other font glyphs (maybe http://openlab.jp/efont/unicode/)?

BIN
vncterm/VncViewer.jar Normal file

Binary file not shown.

20
vncterm/copyright Normal file
View File

@ -0,0 +1,20 @@
Copyright (C) 2007 Proxmox Server Solutions GmbH
Copyright: vncterm is under GNU GPL, the GNU General Public License.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
The complete text of the GNU General
Public License can be found in `/usr/share/common-licenses/GPL'.

View File

@ -0,0 +1,94 @@
vncterm (1.1-8) unstable; urgency=low
* update applet signature (new code signing cert)
-- Proxmox Support Team <support@proxmox.com> Fri, 25 Jul 2014 06:57:46 +0200
vncterm (1.1-7) unstable; urgency=low
* new option -notls (for novnc)
-- Proxmox Support Team <support@proxmox.com> Mon, 23 Jun 2014 13:30:50 +0200
vncterm (1.1-6) unstable; urgency=low
* set Caller-Allowable-Codebase and remove Trusted-Library. This avoids
security popups with latest Java 7u45. Also see:
http://stackoverflow.com/questions/19393826/java-applet-manifest-allow-all-caller-allowable-codebase
-- Proxmox Support Team <support@proxmox.com> Fri, 08 Nov 2013 11:27:08 +0100
vncterm (1.1-5) unstable; urgency=low
* use Comodo code sign cert for applet signature
-- Proxmox Support Team <support@proxmox.com> Fri, 08 Nov 2013 08:35:10 +0100
vncterm (1.1-4) unstable; urgency=low
* Allow to add intermediate certificates to /etc/pve/local/pve-ssl.pem
(users previously used apache option SSLCertificateChainFile for that).
-- Proxmox Support Team <support@proxmox.com> Mon, 03 Jun 2013 08:26:59 +0200
vncterm (1.1-3) unstable; urgency=low
* re-enable javascript-events.patch (used for migrate/reload)
-- Proxmox Support Team <support@proxmox.com> Fri, 10 May 2013 07:56:35 +0200
vncterm (1.1-2) unstable; urgency=low
* recompile VnCViewer.jar with openJDK
* set trusted-lib to avoid security popup
* disable unused javascript-events.patch
-- Proxmox Support Team <support@proxmox.com> Sat, 20 Apr 2013 16:05:41 +0200
vncterm (1.1-1) unstable; urgency=low
* recompile for wheezy
-- Proxmox Support Team <support@proxmox.com> Fri, 15 Mar 2013 08:26:04 +0100
vncterm (1.0-3) unstable; urgency=low
* fix focus traversal
-- Proxmox Support Team <support@proxmox.com> Tue, 21 Aug 2012 09:14:04 +0200
vncterm (1.0-2) unstable; urgency=low
* do not create a new process group (with setsid), so
we can kill the whole pve task if used inside fork_worker().
-- Proxmox Support Team <support@proxmox.com> Tue, 13 Sep 2011 10:49:32 +0200
vncterm (1.0-1) unstable; urgency=low
* use TigerVNC java sources
* implement TLS encryption and vencrypt password auth
* removed support for -passwdfile option
-- root <root@maui.maurer-it.com> Mon, 24 Jan 2011 10:46:25 +0100
vncterm (0.9-2) unstable; urgency=low
* compiled for debian etch
* use memmove instead of rfbDoCopyRect (avoid SIGSEGV when
called with negative dy)
-- Proxmox Support Team <support@proxmox.com> Wed, 22 Apr 2009 10:02:08 +0200
vncterm (0.9-1) stable; urgency=low
* initial import
-- Proxmox Support Team <support@proxmox.com> Thu, 27 Dec 2007 05:57:17 +0100

0
vncterm/debian/conffiles Normal file
View File

9
vncterm/debian/control Normal file
View File

@ -0,0 +1,9 @@
Package: vncterm
Version: 1.2-1
Section: x11
Priority: optional
Depends: libc6 (>= 2.7-18), libjpeg62, zlib1g (>= 1:1.2.1),libgnutls-deb0-28
Maintainer: Proxmox Support Team <support@proxmox.com>
Description: VNC Terminal Emulator
With vncterm you can start commands and export its standard input and
output to any VNC client (simulating a xterm Terminal).

213
vncterm/genfont.c Normal file
View File

@ -0,0 +1,213 @@
/*
Copyright (C) 2007 Proxmox Server Solutions GmbH
Copyright: vzdump is under GNU GPL, the GNU General Public License.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 dated June, 1991.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
02111-1307, USA.
Author: Dietmar Maurer <dietmar@proxmox.com>
*/
#include <stdio.h>
#include <stdlib.h>
#include <zlib.h> /* read compressed console fonts */
#include <glob.h>
#include <string.h>
/* map unicode to font */
static unsigned short vt_fontmap[65536];
/* font glyph storage */
static unsigned char *vt_font_data = NULL;
static int vt_font_size = 0;
static int vt_font_maxsize = 0;
/* PSF stuff */
#define PSF_MAGIC1 0x36
#define PSF_MAGIC2 0x04
#define PSF_MODE256NOSFM 0
#define PSF_MODE512NOSFM 1
#define PSF_MODE256SFM 2
#define PSF_MODE512SFM 3
#define PSF_SEPARATOR 0xFFFF
struct psf_header
{
unsigned char magic1, magic2; /* Magic number */
unsigned char mode; /* PSF font mode */
unsigned char charheight; /* Character size */
};
#define PSF_MAGIC_OK(x) ((x).magic1 == PSF_MAGIC1 && (x).magic2 == PSF_MAGIC2)
#define PSF_MODE_VALID(x) ((x) <= PSF_MODE512SFM)
#define PSF_MODE_HAS512(x) (((x) == 1) || ((x) == 3))
#define PSF_MODE_HASSFM(x) (((x) == 2) || ((x) == 3))
typedef unsigned short unicode;
static int
font_add_glyph (const char *data)
{
if (vt_font_size >= vt_font_maxsize) {
vt_font_maxsize += 256;
vt_font_data = realloc (vt_font_data, vt_font_maxsize*16);
}
memcpy (vt_font_data + vt_font_size*16, data, 16);
vt_font_size += 1;
return vt_font_size - 1;
}
static int
load_psf_font (const char *filename, int is_default)
{
struct psf_header psfhdr;
gzFile *f = gzopen (filename, "rb");
if (f == NULL) {
fprintf (stderr, "unable to read file %s\n", filename);
exit(-1);
}
// read psf header
if (gzread(f, &psfhdr, sizeof(struct psf_header)) != sizeof(struct psf_header)) {
fprintf (stderr, "unable to read psf font header (%s)\n", filename);
gzclose (f);
return -1;
}
if (!PSF_MAGIC_OK(psfhdr) || !PSF_MODE_VALID(psfhdr.mode) ||
!PSF_MODE_HASSFM(psfhdr.mode) || (psfhdr.charheight != 16)) {
fprintf (stderr, "no valid 8*16 psf font (%s)\n", filename);
gzclose (f);
return -1;
}
int charcount = ((PSF_MODE_HAS512(psfhdr.mode)) ? 512 : 256);
int size = 16*charcount;
char *chardata = (char *)malloc (size);
if (size != gzread(f, chardata, size)) {
fprintf (stderr, "unable to read font character data (%s)\n", filename);
gzclose (f);
return -1;
}
unicode unichar;
int glyph;
for (glyph = 0 ;glyph < charcount ;glyph++) {
int fi = 0;
while (gzread (f, &unichar, sizeof(unicode)) == sizeof(unicode) &&
(unichar != PSF_SEPARATOR)) {
if (!vt_fontmap[unichar]) {
if (!fi) {
fi = font_add_glyph (chardata + glyph*16);
}
vt_fontmap[unichar] = fi;
}
}
if (is_default && fi && glyph < 256) {
vt_fontmap[0xf000 + glyph] = fi;
}
}
free (chardata);
gzclose (f);
return 0;
}
void
print_glyphs ()
{
int i, j;
printf ("static int vt_font_size = %d;\n\n", vt_font_size);
printf ("static unsigned char vt_font_data[] = {\n");
for (i = 0; i < vt_font_size; i++) {
printf ("\t/* %d 0x%02x */\n", i, i);
for (j = 0; j < 16; j++) {
unsigned char d = vt_font_data[i*16+j];
printf ("\t0x%02X, /* ", d);
int k;
for (k = 128; k > 0; k = k>>1) {
printf ("%c", (d & k) ? '1': '0');
}
printf (" */\n");
}
printf ("\n");
}
printf ("};\n\n");
printf ("static unsigned short vt_fontmap[65536] = {\n");
for (i = 0; i < 0x0ffff; i++) {
printf ("\t/* 0x%04X => */ %d,\n", i, vt_fontmap[i]);
}
printf ("};\n\n");
}
int
main (int argc, char** argv)
{
char empty[] = { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 };
glob_t globbuf;
font_add_glyph (empty);
/* font load order is only important if glyphs are redefined */
load_psf_font ("/usr/share/consolefonts/default8x16.psf.gz", 1); /* vga default */
load_psf_font ("/usr/share/consolefonts/lat1u-16.psf.gz", 0); /* Latin-1 */
load_psf_font ("/usr/share/consolefonts/lat2u-16.psf.gz", 0); /* Latin-2 */
load_psf_font ("/usr/share/consolefonts/lat4u-16.psf.gz", 0); /* Baltic */
load_psf_font ("/usr/share/consolefonts/iso07.f16.psf.gz", 0); /* Greek */
load_psf_font ("/usr/share/consolefonts/Goha-16.psf.gz", 0); /* Ethiopic */
/* fixme: Arabic, Japanese letters ? */
if (0) {
glob("/usr/share/consolefonts/*", GLOB_ERR, NULL, &globbuf);
int i;
for (i = 0; i < globbuf.gl_pathc; i++) {
int pc = vt_font_size;
load_psf_font (globbuf.gl_pathv[i], 0);
if (vt_font_size > pc) {
printf ("TEST: %s %d\n", globbuf.gl_pathv[i], vt_font_size - pc);
}
}
} else {
print_glyphs ();
}
exit (0);
}

80843
vncterm/glyphs.h Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,75 @@
Index: new/java/com/tigervnc/rfb/CSecurityTLS.java
===================================================================
--- new.orig/java/com/tigervnc/rfb/CSecurityTLS.java 2013-04-18 11:56:22.000000000 +0200
+++ new/java/com/tigervnc/rfb/CSecurityTLS.java 2013-04-18 13:59:03.000000000 +0200
@@ -25,6 +25,7 @@
import java.io.File;
import java.io.InputStream;
import java.io.FileInputStream;
+import java.io.ByteArrayInputStream;
import java.util.ArrayList;
import java.util.Collection;
import javax.swing.JOptionPane;
@@ -34,6 +35,9 @@
public class CSecurityTLS extends CSecurity {
+ public static StringParameter PVECert
+ = new StringParameter("PVECert",
+ "Proxmox VE CA certificate", "");
public static StringParameter x509ca
= new StringParameter("x509ca",
"X509 CA certificate", "");
@@ -92,6 +96,8 @@
{
anon = _anon;
setDefaults();
+
+ pvecert = PVECert.getData();
cafile = x509ca.getData();
crlfile = x509crl.getData();
}
@@ -170,10 +176,15 @@
CertificateFactory cf = CertificateFactory.getInstance("X.509");
try {
ks.load(null, null);
- File cacert = new File(cafile);
- if (!cacert.exists() || !cacert.canRead())
- return;
- InputStream caStream = new FileInputStream(cafile);
+ InputStream caStream;
+ if (pvecert != null) {
+ caStream = new ByteArrayInputStream(pvecert.getBytes("ISO-8859-1"));
+ } else {
+ File cacert = new File(cafile);
+ if (!cacert.exists() || !cacert.canRead())
+ return;
+ caStream = new FileInputStream(cafile);
+ }
X509Certificate ca = (X509Certificate)cf.generateCertificate(caStream);
ks.setCertificateEntry("CA", ca);
PKIXBuilderParameters params = new PKIXBuilderParameters(ks, new X509CertSelector());
@@ -241,6 +252,7 @@
private boolean anon;
private SSLSession session;
private String cafile, crlfile;
+ private String pvecert;
private InStream is;
private SSLSocket ssl;
Index: new/java/com/tigervnc/vncviewer/VncViewer.java
===================================================================
--- new.orig/java/com/tigervnc/vncviewer/VncViewer.java 2013-04-18 11:56:21.000000000 +0200
+++ new/java/com/tigervnc/vncviewer/VncViewer.java 2013-04-18 13:56:33.000000000 +0200
@@ -168,6 +168,11 @@
if (firstApplet) {
alwaysShowServerDialog.setParam(true);
Configuration.readAppletParams(this);
+ String tmpcert = this.getParameter("PVECert");
+ if (tmpcert != null) {
+ CSecurityTLS.PVECert.setParam(tmpcert.replace('|', '\n'));
+ }
+
String host = getCodeBase().getHost();
if (vncServerName.getValue() == null && vncServerPort.getValue() != 0) {
int port = vncServerPort.getValue();

View File

@ -0,0 +1,50 @@
Index: new/java/com/tigervnc/vncviewer/CConn.java
===================================================================
--- new.orig/java/com/tigervnc/vncviewer/CConn.java 2013-04-18 11:56:21.000000000 +0200
+++ new/java/com/tigervnc/vncviewer/CConn.java 2013-04-18 14:23:58.000000000 +0200
@@ -246,6 +246,16 @@
String passwordFileStr = viewer.passwordFile.getValue();
PasswdDialog dlg;
+ String usernameParam = viewer.usernameParam.getValue();
+ String passwordParam = viewer.passwordParam.getValue();
+ vlog.info("USERNAME: " + usernameParam);
+ vlog.info("PASSWORD: " + passwordParam);
+ if (usernameParam != null && passwordParam != null) {
+ user.append(usernameParam);
+ passwd.append(passwordParam);
+ return true;
+ }
+
if (user == null && passwordFileStr != "") {
InputStream fp = null;
try {
Index: new/java/com/tigervnc/vncviewer/VncViewer.java
===================================================================
--- new.orig/java/com/tigervnc/vncviewer/VncViewer.java 2013-04-18 13:56:33.000000000 +0200
+++ new/java/com/tigervnc/vncviewer/VncViewer.java 2013-04-19 07:52:32.000000000 +0200
@@ -168,6 +168,9 @@
if (firstApplet) {
alwaysShowServerDialog.setParam(true);
Configuration.readAppletParams(this);
+
+ System.err.print(Configuration.listParams());
+
String tmpcert = this.getParameter("PVECert");
if (tmpcert != null) {
CSecurityTLS.PVECert.setParam(tmpcert.replace('|', '\n'));
@@ -263,6 +266,14 @@
"Password file for VNC authentication", "");
AliasParameter passwd
= new AliasParameter("passwd", "Alias for PasswordFile", passwordFile);
+
+ StringParameter usernameParam
+ = new StringParameter("USERNAME",
+ "Username for VNC authentication", null);
+ StringParameter passwordParam
+ = new StringParameter("PASSWORD",
+ "Password for VNC authentication", null);
+
BoolParameter autoSelect
= new BoolParameter("AutoSelect",
"Auto select pixel format and encoding", true);

View File

@ -0,0 +1,2 @@
add-pvecert-parameter.patch
add-username-param.patch

View File

@ -0,0 +1,43 @@
Index: new/java/src/com/tigervnc/vncviewer/VncViewer.java
===================================================================
--- new.orig/java/src/com/tigervnc/vncviewer/VncViewer.java 2011-01-25 07:44:23.000000000 +0100
+++ new/java/src/com/tigervnc/vncviewer/VncViewer.java 2011-01-28 13:26:16.000000000 +0100
@@ -466,6 +466,38 @@
}
}
+ public void sendRefreshRequest()
+ {
+ if (rfb == null)
+ return;
+
+ try {
+ rfb.writeFramebufferUpdateRequest(0, 0, rfb.framebufferWidth,
+ rfb.framebufferHeight, false);
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+
+ public void sendCtrlAltDel()
+ {
+ if (rfb == null)
+ return;
+
+ int modifiers = InputEvent.CTRL_MASK | InputEvent.ALT_MASK;
+
+ try {
+ KeyEvent ctrlAltDelEvent =
+ new KeyEvent(this, KeyEvent.KEY_PRESSED, 0, modifiers, 127);
+ rfb.writeKeyEvent(ctrlAltDelEvent);
+
+ ctrlAltDelEvent =
+ new KeyEvent(this, KeyEvent.KEY_RELEASED, 0, modifiers, 127);
+ rfb.writeKeyEvent(ctrlAltDelEvent);
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
//
// Show an authentication panel.

View File

@ -0,0 +1,13 @@
Index: new/java/src/com/tigervnc/vncviewer/Makefile
===================================================================
--- new.orig/java/src/com/tigervnc/vncviewer/Makefile 2013-04-20 15:24:59.000000000 +0200
+++ new/java/src/com/tigervnc/vncviewer/Makefile 2013-04-20 15:31:48.000000000 +0200
@@ -4,7 +4,7 @@
CP = cp
JC = javac
-JCFLAGS = -target 1.5 -classpath ../../../
+JCFLAGS = -target 1.7 -classpath ../../../
JAR = jar
ARCHIVE = VncViewer.jar
MANIFEST = MANIFEST.MF

View File

@ -0,0 +1,35 @@
Sources found at http://dogfeathers.com/mark/java7issue.html
Index: tigervnc.new/java/src/com/tigervnc/vncviewer/VncViewer.java
===================================================================
--- tigervnc.new.orig/java/src/com/tigervnc/vncviewer/VncViewer.java 2012-08-21 09:05:04.000000000 +0200
+++ tigervnc.new/java/src/com/tigervnc/vncviewer/VncViewer.java 2012-08-21 09:10:27.000000000 +0200
@@ -110,6 +110,28 @@
public void init() {
+ // fix focus traversal
+ Container topParent = null;
+ Container parent = this;
+ // The natural thing would be to call getParent() until it returns
+ // null, but then you would be looping for a long time, since
+ // PluginEmbeddedFrame's getParent() returns itself.
+ for (int k=0; k < 10; k++) {
+ topParent = parent;
+ parent = parent.getParent();
+ if (parent == null) break;
+ }
+
+ // If topParent isn't a KeyEventDispatcher then we must be in some
+ // Plugin version that doesn't need the workaround.
+ try {
+ KeyEventDispatcher ked = (KeyEventDispatcher)topParent;
+ KeyboardFocusManager kfm = KeyboardFocusManager.getCurrentKeyboardFocusManager();
+ // You have to remove it twice, otherwise the problem isn't fixed
+ kfm.removeKeyEventDispatcher(ked);
+ kfm.removeKeyEventDispatcher(ked);
+ } catch (ClassCastException e) {}
+
readParameters();
refApplet = this;

View File

@ -0,0 +1,111 @@
Index: new/java/src/com/tigervnc/vncviewer/VncViewer.java
===================================================================
--- new.orig/java/src/com/tigervnc/vncviewer/VncViewer.java 2013-05-10 07:41:18.000000000 +0200
+++ new/java/src/com/tigervnc/vncviewer/VncViewer.java 2013-05-10 07:41:18.000000000 +0200
@@ -27,11 +27,15 @@
package com.tigervnc.vncviewer;
+import netscape.javascript.*;
import java.awt.*;
import java.awt.event.*;
import java.io.*;
import java.net.*;
+import java.awt.Graphics;
+import java.applet.Applet;
+
public class VncViewer extends java.applet.Applet
implements java.lang.Runnable, WindowListener, ComponentListener {
@@ -94,6 +98,9 @@
String PVECert;
+ JSObject jswin;
+ String myid;
+
// Reference to this applet for inter-applet communication.
public static java.applet.Applet refApplet;
@@ -129,6 +136,11 @@
refApplet = this;
+ if (inAnApplet) {
+ jswin = JSObject.getWindow(this);
+ myid = getParameter("id");
+ }
+
if (inSeparateFrame) {
vncFrame = new Frame("TigerVNC");
if (!inAnApplet) {
@@ -159,6 +171,9 @@
rfbThread = new Thread(this);
rfbThread.start();
+
+ String[] myparam = { myid, "init"};
+ jswin.call("PVE_vnc_console_event", myparam);
}
public void update(Graphics g) {
@@ -1002,6 +1017,8 @@
if (inAnApplet) {
showMessage("Disconnected");
+ String[] myparam = { myid, "disconnect"};
+ jswin.call("PVE_vnc_console_event", myparam);
} else {
System.exit(0);
}
@@ -1019,6 +1036,8 @@
// vncContainer null, applet not inited,
// can not present the error to the user.
Thread.currentThread().stop();
+ String[] myparam = { myid, "error", str};
+ jswin.call("PVE_vnc_console_event", myparam);
} else {
System.exit(1);
}
@@ -1040,6 +1059,8 @@
rfb.close();
if (inAnApplet) {
+ String[] myparam = { myid, "error", str};
+ jswin.call("PVE_vnc_console_event", myparam);
showMessage(str);
} else {
System.exit(1);
@@ -1109,6 +1130,9 @@
rfb.close();
if (inSeparateFrame)
vncFrame.dispose();
+
+ String[] myparam = { myid, "destroy"};
+ jswin.call("PVE_vnc_console_event", myparam);
}
//
@@ -1157,6 +1181,8 @@
if (!inAnApplet) {
System.exit(0);
}
+ String[] myparam = { myid, "close"};
+ jswin.call("PVE_vnc_console_event", myparam);
}
//
Index: new/java/src/com/tigervnc/vncviewer/Makefile
===================================================================
--- new.orig/java/src/com/tigervnc/vncviewer/Makefile 2013-05-10 07:41:18.000000000 +0200
+++ new/java/src/com/tigervnc/vncviewer/Makefile 2013-05-10 07:43:17.000000000 +0200
@@ -4,7 +4,7 @@
CP = cp
JC = javac
-JCFLAGS = -target 1.7 -classpath ../../../
+JCFLAGS = -target 1.7 -classpath ../../../ -Djava.ext.dirs=/usr/share/icedtea-web/
JAR = jar
ARCHIVE = VncViewer.jar
MANIFEST = MANIFEST.MF

View File

@ -0,0 +1,14 @@
Index: new/java/src/com/tigervnc/vncviewer/RfbProto.java
===================================================================
--- new.orig/java/src/com/tigervnc/vncviewer/RfbProto.java 2011-01-20 08:14:34.000000000 +0100
+++ new/java/src/com/tigervnc/vncviewer/RfbProto.java 2011-01-20 08:19:20.000000000 +0100
@@ -938,6 +938,9 @@
int keyChar = evt.getKeyChar();
+ int test = evt.getKeyCode();
+ System.out.println("KEYCODE: " + evt.getKeyText(test));
+
//
// Ignore event if only modifiers were pressed.
//

View File

@ -0,0 +1,11 @@
Index: new/java/src/com/tigervnc/vncviewer/MANIFEST.MF
===================================================================
--- new.orig/java/src/com/tigervnc/vncviewer/MANIFEST.MF 2011-08-18 14:05:33.000000000 +0200
+++ new/java/src/com/tigervnc/vncviewer/MANIFEST.MF 2013-11-08 11:17:13.000000000 +0100
@@ -1,2 +1,6 @@
Manifest-Version: 1.0
Main-Class: com.tigervnc.vncviewer.VncViewer
+Permissions: all-permissions
+Application-Name: vncterm
+Codebase: *
+Caller-Allowable-Codebase: *

View File

@ -0,0 +1,9 @@
#keydebug.patch
#javascript-events.patch
export-ctrl-alt-delete.patch
trust-manager.patch
fix-makefiles.patch
username-param.patch
fix-tab-button.patch
modify-jar-manifest.patch
javascript-events.patch

View File

@ -0,0 +1,190 @@
Unfortunately the java certificate store does not correctly access
the browser certificate store (firefox, chrome). We also tunnel VNC
traffic from other cluster nodes.
So we implement our own trust manager, and allow to pass the server
certificate (or CA who signed the server certificate) as applet
parameter "PVECert" (newline encoded as '|').
Index: tigervnc/java/src/com/tigervnc/vncviewer/X509Tunnel.java
===================================================================
--- tigervnc.orig/java/src/com/tigervnc/vncviewer/X509Tunnel.java 2013-06-03 08:17:17.000000000 +0200
+++ tigervnc/java/src/com/tigervnc/vncviewer/X509Tunnel.java 2013-06-03 08:22:52.000000000 +0200
@@ -26,13 +26,23 @@
import javax.net.ssl.*;
import java.security.*;
import java.security.cert.*;
+import java.security.cert.Certificate;
+import java.security.cert.CertificateFactory;
+import java.io.*;
public class X509Tunnel extends TLSTunnelBase
{
- public X509Tunnel (Socket sock_)
+ Certificate pvecert;
+
+ public X509Tunnel (Socket sock_, String certstr) throws CertificateException
{
super (sock_);
+
+ if (certstr != null) {
+ CertificateFactory cf = CertificateFactory.getInstance("X.509");
+ pvecert = cf.generateCertificate(new StringBufferInputStream(certstr));
+ }
}
protected void setParam (SSLSocket sock)
@@ -52,9 +62,48 @@
protected void initContext (SSLContext sc) throws java.security.
GeneralSecurityException
{
- TrustManager[] myTM = new TrustManager[]
- {
- new MyX509TrustManager ()};
+ TrustManager[] myTM;
+
+ if (pvecert != null) {
+ myTM = new TrustManager[] {
+ new X509TrustManager() {
+ public java.security.cert.X509Certificate[]
+ getAcceptedIssuers() {
+ return null;
+ }
+ public void checkClientTrusted(
+ java.security.cert.X509Certificate[] certs,
+ String authType) throws CertificateException {
+ throw new CertificateException("no clients");
+ }
+ public void checkServerTrusted(
+ java.security.cert.X509Certificate[] certs,
+ String authType) throws CertificateException {
+
+ if (certs == null || certs.length < 1) {
+ throw new CertificateException("no certs");
+ }
+ PublicKey cakey = pvecert.getPublicKey();
+
+ boolean ca_match;
+ try {
+ certs[0].verify(cakey);
+ ca_match = true;
+ } catch (Exception e) {
+ ca_match = false;
+ }
+
+ if (!ca_match && !pvecert.equals(certs[0])) {
+ throw new CertificateException("certificate does not match");
+ }
+ }
+ }
+ };
+ } else {
+ myTM = new TrustManager[] {
+ new MyX509TrustManager ()
+ };
+ }
sc.init (null, myTM, null);
}
@@ -100,4 +149,5 @@
return tm.getAcceptedIssuers ();
}
}
+
}
Index: tigervnc/java/src/com/tigervnc/vncviewer/RfbProto.java
===================================================================
--- tigervnc.orig/java/src/com/tigervnc/vncviewer/RfbProto.java 2013-06-03 08:17:17.000000000 +0200
+++ tigervnc/java/src/com/tigervnc/vncviewer/RfbProto.java 2013-06-03 08:19:05.000000000 +0200
@@ -411,7 +411,8 @@
}
void authenticateX509() throws Exception {
- X509Tunnel tunnel = new X509Tunnel(sock);
+
+ X509Tunnel tunnel = new X509Tunnel(sock, viewer.PVECert);
tunnel.setup (this);
}
Index: tigervnc/java/src/com/tigervnc/vncviewer/VncViewer.java
===================================================================
--- tigervnc.orig/java/src/com/tigervnc/vncviewer/VncViewer.java 2013-06-03 08:19:03.000000000 +0200
+++ tigervnc/java/src/com/tigervnc/vncviewer/VncViewer.java 2013-06-03 08:19:05.000000000 +0200
@@ -91,6 +91,8 @@
int debugStatsExcludeUpdates;
int debugStatsMeasureUpdates;
+ String PVECert;
+
// Reference to this applet for inter-applet communication.
public static java.applet.Applet refApplet;
@@ -263,7 +265,7 @@
fatalError(e.toString(), e);
}
}
-
+
}
//
@@ -299,7 +301,7 @@
// If the rfbThread is being stopped, ignore any exceptions,
// otherwise rethrow the exception so it can be handled.
//
-
+
void processNormalProtocol() throws Exception {
try {
vc.processNormalProtocol();
@@ -842,6 +844,11 @@
// SocketFactory.
socketFactory = readParameter("SocketFactory", false);
+
+ String tmpcert = readParameter("PVECert", false);
+ if (tmpcert != null) {
+ PVECert = tmpcert.replace('|', '\n');
+ }
}
//
@@ -991,7 +998,7 @@
}
synchronized public void fatalError(String str, Exception e) {
-
+
if (rfb != null && rfb.closed()) {
// Not necessary to show error message if the error was caused
// by I/O problems after the rfb.close() method call.
@@ -1084,11 +1091,11 @@
public void enableInput(boolean enable) {
vc.enableInput(enable);
}
-
+
//
// Resize framebuffer if autoScale is enabled.
//
-
+
public void componentResized(ComponentEvent e) {
if (e.getComponent() == vncFrame) {
if (options.autoScale) {
@@ -1100,11 +1107,11 @@
}
}
}
-
+
//
// Ignore component events we're not interested in.
//
-
+
public void componentShown(ComponentEvent e) { }
public void componentMoved(ComponentEvent e) { }
public void componentHidden(ComponentEvent e) { }

View File

@ -0,0 +1,38 @@
Index: new/java/src/com/tigervnc/vncviewer/VncViewer.java
===================================================================
--- new.orig/java/src/com/tigervnc/vncviewer/VncViewer.java 2011-01-28 13:26:51.000000000 +0100
+++ new/java/src/com/tigervnc/vncviewer/VncViewer.java 2011-01-28 13:27:04.000000000 +0100
@@ -86,6 +86,7 @@
String host;
int port;
String passwordParam;
+ String usernameParam;
boolean showControls;
boolean offerRelogin;
boolean showOfflineDesktop;
@@ -384,10 +385,12 @@
break;
case RfbProto.SecTypePlain:
showConnectionStatus("Plain authentication");
- {
- String user = askUser();
- String pw = askPassword();
- rfb.authenticatePlain(user,pw);
+ if (usernameParam != null && passwordParam != null) {
+ rfb.authenticatePlain(usernameParam, passwordParam);
+ } else {
+ String user = askUser();
+ String pw = askPassword();
+ rfb.authenticatePlain(user,pw);
}
break;
case RfbProto.SecTypeTLSNone:
@@ -822,6 +825,8 @@
// Read "ENCPASSWORD" or "PASSWORD" parameter if specified.
readPasswordParameters();
+ usernameParam = readParameter("USERNAME", false);
+
String str;
if (inAnApplet) {
str = readParameter("Open New Window", false);

BIN
vncterm/tigervnc-1.1.0.tgz Normal file

Binary file not shown.

View File

@ -0,0 +1 @@
tls-auth-pluging.patch

View File

@ -0,0 +1,70 @@
Index: vnc/libvncserver/auth.c
===================================================================
@@ -270,8 +270,9 @@
int32_t securityType = rfbSecTypeInvalid;
if (!cl->screen->authPasswdData || cl->reverseConnection) {
- /* chk if this condition is valid or not. */
- securityType = rfbSecTypeNone;
+ /* chk if this condition is valid or not. */
+ /* we disable anonymous auth */
+ // securityType = rfbSecTypeNone;
} else if (cl->screen->authPasswdData) {
securityType = rfbSecTypeVncAuth;
}
Index: vnc/newterm/Makefile.am
Index: vnc/libvncserver/sockets.c
===================================================================
--- vnc.orig/libvncserver/sockets.c 2011-01-20 16:42:41.000000000 +0100
+++ vnc/libvncserver/sockets.c 2011-01-21 10:20:03.000000000 +0100
@@ -454,8 +454,12 @@
fd_set fds;
struct timeval tv;
+
while (len > 0) {
- n = read(sock, buf, len);
+ if (cl->sock_read_fn)
+ n = cl->sock_read_fn(cl, buf, len);
+ else
+ n = read(sock, buf, len);
if (n > 0) {
@@ -538,7 +542,10 @@
LOCK(cl->outputMutex);
while (len > 0) {
- n = write(sock, buf, len);
+ if (cl->sock_write_fn)
+ n = cl->sock_write_fn(cl, buf, len);
+ else
+ n = write(sock, buf, len);
if (n > 0) {
Index: vnc/rfb/rfb.h
===================================================================
--- vnc.orig/rfb/rfb.h 2011-01-20 16:36:06.000000000 +0100
+++ vnc/rfb/rfb.h 2011-01-21 06:44:22.000000000 +0100
@@ -397,6 +397,9 @@
struct _rfbStatList *Next;
} rfbStatList;
+typedef ssize_t (*sock_read_fn_t)(struct _rfbClientRec *cl, void *buf, size_t count);
+typedef ssize_t (*sock_write_fn_t)(struct _rfbClientRec *cl, const void *buf, size_t count);
+
typedef struct _rfbClientRec {
/* back pointer to the screen */
@@ -417,6 +420,10 @@
void* clientData;
ClientGoneHookPtr clientGoneHook;
+ /* use to hook up TLS read/write */
+ sock_read_fn_t sock_read_fn;
+ sock_read_fn_t sock_write_fn;
+
SOCKET sock;
char *host;

2470
vncterm/vncterm.c Normal file

File diff suppressed because it is too large Load Diff

235
vncterm/vncterm.h Normal file
View File

@ -0,0 +1,235 @@
#include <rfb/rfb.h>
#define IBUFSIZE 1024
#define MAX_ESC_PARAMS 16
typedef unsigned short unicode;
typedef struct TextAttributes {
unsigned int fgcol:4;
unsigned int bgcol:4;
unsigned int bold:1;
unsigned int uline:1;
unsigned int blink:1;
unsigned int invers:1;
unsigned int unvisible:1;
} TextAttributes;
typedef struct TextCell {
unicode ch;
TextAttributes attrib;
} TextCell;
typedef struct vncTerm {
int maxx;
int maxy;
int width;
int height;
int total_height;
int scroll_height;
int y_base;
int y_displ;
int altbuf:1;
unsigned int utf8:1; // utf8 mode
long utf_char; // used by utf8 parser
int utf_count; // used by utf8 parser
TextAttributes default_attrib;
TextCell *cells;
TextCell *altcells;
rfbScreenInfoPtr screen;
// cursor
TextAttributes cur_attrib;
TextAttributes cur_attrib_saved;
int tty_state; // 0 - normal, 1 - ESC, 2 - CSI
int cx; // cursor x position
int cy; // cursor y position
int cx_saved; // saved cursor x position
int cy_saved; // saved cursor y position
int esc_buf[MAX_ESC_PARAMS];
int esc_count;
int esc_ques;
int esc_has_par;
char osc_textbuf[4096];
char osc_cmd;
int region_top;
int region_bottom;
unsigned int charset:1; // G0 or G1
unsigned int charset_saved:1; // G0 or G1
unsigned int g0enc:2;
unsigned int g0enc_saved:2;
unsigned int g1enc:2;
unsigned int g1enc_saved:2;
unsigned int cur_enc:2;
unsigned int cur_enc_saved:2;
// input buffer
char ibuf[IBUFSIZE];
int ibuf_count;
unicode *selection;
int selection_len;
unsigned int mark_active:1;
unsigned int report_mouse:1;
} vncTerm;
/* Unicode translations copied from kernel source consolemap.c */
#define LAT1_MAP 0
#define GRAF_MAP 1
#define IBMPC_MAP 2
#define USER_MAP 3
static unsigned short translations[][256] = {
/* 8-bit Latin-1 mapped to Unicode -- trivial mapping */
{
0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007,
0x0008, 0x0009, 0x000a, 0x000b, 0x000c, 0x000d, 0x000e, 0x000f,
0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017,
0x0018, 0x0019, 0x001a, 0x001b, 0x001c, 0x001d, 0x001e, 0x001f,
0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027,
0x0028, 0x0029, 0x002a, 0x002b, 0x002c, 0x002d, 0x002e, 0x002f,
0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037,
0x0038, 0x0039, 0x003a, 0x003b, 0x003c, 0x003d, 0x003e, 0x003f,
0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047,
0x0048, 0x0049, 0x004a, 0x004b, 0x004c, 0x004d, 0x004e, 0x004f,
0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057,
0x0058, 0x0059, 0x005a, 0x005b, 0x005c, 0x005d, 0x005e, 0x005f,
0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067,
0x0068, 0x0069, 0x006a, 0x006b, 0x006c, 0x006d, 0x006e, 0x006f,
0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077,
0x0078, 0x0079, 0x007a, 0x007b, 0x007c, 0x007d, 0x007e, 0x007f,
0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087,
0x0088, 0x0089, 0x008a, 0x008b, 0x008c, 0x008d, 0x008e, 0x008f,
0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097,
0x0098, 0x0099, 0x009a, 0x009b, 0x009c, 0x009d, 0x009e, 0x009f,
0x00a0, 0x00a1, 0x00a2, 0x00a3, 0x00a4, 0x00a5, 0x00a6, 0x00a7,
0x00a8, 0x00a9, 0x00aa, 0x00ab, 0x00ac, 0x00ad, 0x00ae, 0x00af,
0x00b0, 0x00b1, 0x00b2, 0x00b3, 0x00b4, 0x00b5, 0x00b6, 0x00b7,
0x00b8, 0x00b9, 0x00ba, 0x00bb, 0x00bc, 0x00bd, 0x00be, 0x00bf,
0x00c0, 0x00c1, 0x00c2, 0x00c3, 0x00c4, 0x00c5, 0x00c6, 0x00c7,
0x00c8, 0x00c9, 0x00ca, 0x00cb, 0x00cc, 0x00cd, 0x00ce, 0x00cf,
0x00d0, 0x00d1, 0x00d2, 0x00d3, 0x00d4, 0x00d5, 0x00d6, 0x00d7,
0x00d8, 0x00d9, 0x00da, 0x00db, 0x00dc, 0x00dd, 0x00de, 0x00df,
0x00e0, 0x00e1, 0x00e2, 0x00e3, 0x00e4, 0x00e5, 0x00e6, 0x00e7,
0x00e8, 0x00e9, 0x00ea, 0x00eb, 0x00ec, 0x00ed, 0x00ee, 0x00ef,
0x00f0, 0x00f1, 0x00f2, 0x00f3, 0x00f4, 0x00f5, 0x00f6, 0x00f7,
0x00f8, 0x00f9, 0x00fa, 0x00fb, 0x00fc, 0x00fd, 0x00fe, 0x00ff
},
/* VT100 graphics mapped to Unicode */
{
0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007,
0x0008, 0x0009, 0x000a, 0x000b, 0x000c, 0x000d, 0x000e, 0x000f,
0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017,
0x0018, 0x0019, 0x001a, 0x001b, 0x001c, 0x001d, 0x001e, 0x001f,
0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027,
0x0028, 0x0029, 0x002a, 0x2192, 0x2190, 0x2191, 0x2193, 0x002f,
0x2588, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037,
0x0038, 0x0039, 0x003a, 0x003b, 0x003c, 0x003d, 0x003e, 0x003f,
0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047,
0x0048, 0x0049, 0x004a, 0x004b, 0x004c, 0x004d, 0x004e, 0x004f,
0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057,
0x0058, 0x0059, 0x005a, 0x005b, 0x005c, 0x005d, 0x005e, 0x00a0,
0x25c6, 0x2592, 0x2409, 0x240c, 0x240d, 0x240a, 0x00b0, 0x00b1,
0x2591, 0x240b, 0x2518, 0x2510, 0x250c, 0x2514, 0x253c, 0x23ba,
0x23bb, 0x2500, 0x23bc, 0x23bd, 0x251c, 0x2524, 0x2534, 0x252c,
0x2502, 0x2264, 0x2265, 0x03c0, 0x2260, 0x00a3, 0x00b7, 0x007f,
0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087,
0x0088, 0x0089, 0x008a, 0x008b, 0x008c, 0x008d, 0x008e, 0x008f,
0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097,
0x0098, 0x0099, 0x009a, 0x009b, 0x009c, 0x009d, 0x009e, 0x009f,
0x00a0, 0x00a1, 0x00a2, 0x00a3, 0x00a4, 0x00a5, 0x00a6, 0x00a7,
0x00a8, 0x00a9, 0x00aa, 0x00ab, 0x00ac, 0x00ad, 0x00ae, 0x00af,
0x00b0, 0x00b1, 0x00b2, 0x00b3, 0x00b4, 0x00b5, 0x00b6, 0x00b7,
0x00b8, 0x00b9, 0x00ba, 0x00bb, 0x00bc, 0x00bd, 0x00be, 0x00bf,
0x00c0, 0x00c1, 0x00c2, 0x00c3, 0x00c4, 0x00c5, 0x00c6, 0x00c7,
0x00c8, 0x00c9, 0x00ca, 0x00cb, 0x00cc, 0x00cd, 0x00ce, 0x00cf,
0x00d0, 0x00d1, 0x00d2, 0x00d3, 0x00d4, 0x00d5, 0x00d6, 0x00d7,
0x00d8, 0x00d9, 0x00da, 0x00db, 0x00dc, 0x00dd, 0x00de, 0x00df,
0x00e0, 0x00e1, 0x00e2, 0x00e3, 0x00e4, 0x00e5, 0x00e6, 0x00e7,
0x00e8, 0x00e9, 0x00ea, 0x00eb, 0x00ec, 0x00ed, 0x00ee, 0x00ef,
0x00f0, 0x00f1, 0x00f2, 0x00f3, 0x00f4, 0x00f5, 0x00f6, 0x00f7,
0x00f8, 0x00f9, 0x00fa, 0x00fb, 0x00fc, 0x00fd, 0x00fe, 0x00ff
},
/* IBM Codepage 437 mapped to Unicode */
{
0x0000, 0x263a, 0x263b, 0x2665, 0x2666, 0x2663, 0x2660, 0x2022,
0x25d8, 0x25cb, 0x25d9, 0x2642, 0x2640, 0x266a, 0x266b, 0x263c,
0x25b6, 0x25c0, 0x2195, 0x203c, 0x00b6, 0x00a7, 0x25ac, 0x21a8,
0x2191, 0x2193, 0x2192, 0x2190, 0x221f, 0x2194, 0x25b2, 0x25bc,
0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027,
0x0028, 0x0029, 0x002a, 0x002b, 0x002c, 0x002d, 0x002e, 0x002f,
0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037,
0x0038, 0x0039, 0x003a, 0x003b, 0x003c, 0x003d, 0x003e, 0x003f,
0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047,
0x0048, 0x0049, 0x004a, 0x004b, 0x004c, 0x004d, 0x004e, 0x004f,
0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057,
0x0058, 0x0059, 0x005a, 0x005b, 0x005c, 0x005d, 0x005e, 0x005f,
0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067,
0x0068, 0x0069, 0x006a, 0x006b, 0x006c, 0x006d, 0x006e, 0x006f,
0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077,
0x0078, 0x0079, 0x007a, 0x007b, 0x007c, 0x007d, 0x007e, 0x2302,
0x00c7, 0x00fc, 0x00e9, 0x00e2, 0x00e4, 0x00e0, 0x00e5, 0x00e7,
0x00ea, 0x00eb, 0x00e8, 0x00ef, 0x00ee, 0x00ec, 0x00c4, 0x00c5,
0x00c9, 0x00e6, 0x00c6, 0x00f4, 0x00f6, 0x00f2, 0x00fb, 0x00f9,
0x00ff, 0x00d6, 0x00dc, 0x00a2, 0x00a3, 0x00a5, 0x20a7, 0x0192,
0x00e1, 0x00ed, 0x00f3, 0x00fa, 0x00f1, 0x00d1, 0x00aa, 0x00ba,
0x00bf, 0x2310, 0x00ac, 0x00bd, 0x00bc, 0x00a1, 0x00ab, 0x00bb,
0x2591, 0x2592, 0x2593, 0x2502, 0x2524, 0x2561, 0x2562, 0x2556,
0x2555, 0x2563, 0x2551, 0x2557, 0x255d, 0x255c, 0x255b, 0x2510,
0x2514, 0x2534, 0x252c, 0x251c, 0x2500, 0x253c, 0x255e, 0x255f,
0x255a, 0x2554, 0x2569, 0x2566, 0x2560, 0x2550, 0x256c, 0x2567,
0x2568, 0x2564, 0x2565, 0x2559, 0x2558, 0x2552, 0x2553, 0x256b,
0x256a, 0x2518, 0x250c, 0x2588, 0x2584, 0x258c, 0x2590, 0x2580,
0x03b1, 0x00df, 0x0393, 0x03c0, 0x03a3, 0x03c3, 0x00b5, 0x03c4,
0x03a6, 0x0398, 0x03a9, 0x03b4, 0x221e, 0x03c6, 0x03b5, 0x2229,
0x2261, 0x00b1, 0x2265, 0x2264, 0x2320, 0x2321, 0x00f7, 0x2248,
0x00b0, 0x2219, 0x00b7, 0x221a, 0x207f, 0x00b2, 0x25a0, 0x00a0
},
/* User mapping -- default to codes for direct font mapping */
{
0xf000, 0xf001, 0xf002, 0xf003, 0xf004, 0xf005, 0xf006, 0xf007,
0xf008, 0xf009, 0xf00a, 0xf00b, 0xf00c, 0xf00d, 0xf00e, 0xf00f,
0xf010, 0xf011, 0xf012, 0xf013, 0xf014, 0xf015, 0xf016, 0xf017,
0xf018, 0xf019, 0xf01a, 0xf01b, 0xf01c, 0xf01d, 0xf01e, 0xf01f,
0xf020, 0xf021, 0xf022, 0xf023, 0xf024, 0xf025, 0xf026, 0xf027,
0xf028, 0xf029, 0xf02a, 0xf02b, 0xf02c, 0xf02d, 0xf02e, 0xf02f,
0xf030, 0xf031, 0xf032, 0xf033, 0xf034, 0xf035, 0xf036, 0xf037,
0xf038, 0xf039, 0xf03a, 0xf03b, 0xf03c, 0xf03d, 0xf03e, 0xf03f,
0xf040, 0xf041, 0xf042, 0xf043, 0xf044, 0xf045, 0xf046, 0xf047,
0xf048, 0xf049, 0xf04a, 0xf04b, 0xf04c, 0xf04d, 0xf04e, 0xf04f,
0xf050, 0xf051, 0xf052, 0xf053, 0xf054, 0xf055, 0xf056, 0xf057,
0xf058, 0xf059, 0xf05a, 0xf05b, 0xf05c, 0xf05d, 0xf05e, 0xf05f,
0xf060, 0xf061, 0xf062, 0xf063, 0xf064, 0xf065, 0xf066, 0xf067,
0xf068, 0xf069, 0xf06a, 0xf06b, 0xf06c, 0xf06d, 0xf06e, 0xf06f,
0xf070, 0xf071, 0xf072, 0xf073, 0xf074, 0xf075, 0xf076, 0xf077,
0xf078, 0xf079, 0xf07a, 0xf07b, 0xf07c, 0xf07d, 0xf07e, 0xf07f,
0xf080, 0xf081, 0xf082, 0xf083, 0xf084, 0xf085, 0xf086, 0xf087,
0xf088, 0xf089, 0xf08a, 0xf08b, 0xf08c, 0xf08d, 0xf08e, 0xf08f,
0xf090, 0xf091, 0xf092, 0xf093, 0xf094, 0xf095, 0xf096, 0xf097,
0xf098, 0xf099, 0xf09a, 0xf09b, 0xf09c, 0xf09d, 0xf09e, 0xf09f,
0xf0a0, 0xf0a1, 0xf0a2, 0xf0a3, 0xf0a4, 0xf0a5, 0xf0a6, 0xf0a7,
0xf0a8, 0xf0a9, 0xf0aa, 0xf0ab, 0xf0ac, 0xf0ad, 0xf0ae, 0xf0af,
0xf0b0, 0xf0b1, 0xf0b2, 0xf0b3, 0xf0b4, 0xf0b5, 0xf0b6, 0xf0b7,
0xf0b8, 0xf0b9, 0xf0ba, 0xf0bb, 0xf0bc, 0xf0bd, 0xf0be, 0xf0bf,
0xf0c0, 0xf0c1, 0xf0c2, 0xf0c3, 0xf0c4, 0xf0c5, 0xf0c6, 0xf0c7,
0xf0c8, 0xf0c9, 0xf0ca, 0xf0cb, 0xf0cc, 0xf0cd, 0xf0ce, 0xf0cf,
0xf0d0, 0xf0d1, 0xf0d2, 0xf0d3, 0xf0d4, 0xf0d5, 0xf0d6, 0xf0d7,
0xf0d8, 0xf0d9, 0xf0da, 0xf0db, 0xf0dc, 0xf0dd, 0xf0de, 0xf0df,
0xf0e0, 0xf0e1, 0xf0e2, 0xf0e3, 0xf0e4, 0xf0e5, 0xf0e6, 0xf0e7,
0xf0e8, 0xf0e9, 0xf0ea, 0xf0eb, 0xf0ec, 0xf0ed, 0xf0ee, 0xf0ef,
0xf0f0, 0xf0f1, 0xf0f2, 0xf0f3, 0xf0f4, 0xf0f5, 0xf0f6, 0xf0f7,
0xf0f8, 0xf0f9, 0xf0fa, 0xf0fb, 0xf0fc, 0xf0fd, 0xf0fe, 0xf0ff
}
};

43
vncterm/vncterm.pod Normal file
View File

@ -0,0 +1,43 @@
=head1 NAME
vncterm - VNC Terminal Emulator
=head1 SYNOPSIS
vncterm [VNCOPTS] [-c command [ARGS]]
=head1 DESCRIPTION
Executes <command> redirecting stdin from a vncviewer and stdout & stderr
to the VNC clients. Implements a 'xterm' compatible terminal.
=head1 SEE ALSO
x11vnc(1).
=head1 AUTHOR
Dietmar Maurer <dietmar@proxmox.com>
Many thanks to Proxmox Server Solutions (www.proxmox.com) for sponsoring
this work.
=head1 COPYRIGHT AND DISCLAIMER
Copyright (C) 2007 Proxmox Server Solutions GmbH
Copyright: vncterm is under GNU GPL, the GNU General Public License.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.