summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'net-misc/vnc')
-rw-r--r--net-misc/vnc/ChangeLog7
-rw-r--r--net-misc/vnc/files/vnc-4.0/vnc-cookie.patch21
-rw-r--r--net-misc/vnc/files/vnc-4.0/vnc-def.patch12
-rw-r--r--net-misc/vnc/files/vnc-4.0/vnc-fPIC.patch69
-rw-r--r--net-misc/vnc/files/vnc-4.0/vnc-gcc34.patch162
-rw-r--r--net-misc/vnc/files/vnc-4.0/vnc-idle.patch11
-rw-r--r--net-misc/vnc/files/vnc-4.0/vnc-restart.patch21
-rw-r--r--net-misc/vnc/files/vnc-4.0/vnc-sparc.patch32
-rw-r--r--net-misc/vnc/files/vnc-4.0/vnc-via.patch185
-rw-r--r--net-misc/vnc/files/vnc-4.0/vnc-xclients.patch13
-rw-r--r--net-misc/vnc/files/vnc-4.0/vnc-xorg.patch80
-rw-r--r--net-misc/vnc/vnc-4.0.ebuild70
12 files changed, 682 insertions, 1 deletions
diff --git a/net-misc/vnc/ChangeLog b/net-misc/vnc/ChangeLog
index 222c5a59c890..469721322187 100644
--- a/net-misc/vnc/ChangeLog
+++ b/net-misc/vnc/ChangeLog
@@ -1,6 +1,11 @@
# ChangeLog for net-misc/vnc
# Copyright 2002-2004 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/net-misc/vnc/ChangeLog,v 1.26 2004/06/25 00:18:37 agriffis Exp $
+# $Header: /var/cvsroot/gentoo-x86/net-misc/vnc/ChangeLog,v 1.27 2004/08/23 12:53:44 aliz Exp $
+
+*vnc-4.0 (20 Aug 2004)
+
+ 20 Aug 2004; Daniel Ahlberg <aliz@gentoo.org> vnc-4.0.ebuild:
+ Version bump, closing #55592.
15 Jun 2004; Danny van Dyk <kugelfang@gentoo.org> vnc-3.3.7.ebuild:
Marked stable on amd64.
diff --git a/net-misc/vnc/files/vnc-4.0/vnc-cookie.patch b/net-misc/vnc/files/vnc-4.0/vnc-cookie.patch
new file mode 100644
index 000000000000..55795766db59
--- /dev/null
+++ b/net-misc/vnc/files/vnc-4.0/vnc-cookie.patch
@@ -0,0 +1,21 @@
+--- vnc-4.0b3-unixsrc/vncserver.orig 2003-07-28 13:57:25.000000000 +0100
++++ vnc-4.0b3-unixsrc/vncserver 2003-07-31 17:43:33.000000000 +0100
+@@ -116,16 +116,8 @@
+ $desktopLog = "$vncUserDir/$host:$displayNumber.log";
+ unlink($desktopLog);
+
+-# Make an X server cookie - use as the seed the sum of the current time, our
+-# PID and part of the encrypted form of the password. Ideally we'd use
+-# /dev/urandom, but that's only available on Linux.
+-
+-srand(time+$$+unpack("L",`cat $vncUserDir/passwd`));
+-$cookie = "";
+-for (1..16) {
+- $cookie .= sprintf("%02x", int(rand(256)) % 256);
+-}
+-
++# Make an X server cookie - use mcookie
++$cookie = `/usr/bin/mcookie`;
+ system("xauth -f $xauthorityFile add $host:$displayNumber . $cookie");
+ system("xauth -f $xauthorityFile add $host/unix:$displayNumber . $cookie");
+
diff --git a/net-misc/vnc/files/vnc-4.0/vnc-def.patch b/net-misc/vnc/files/vnc-4.0/vnc-def.patch
new file mode 100644
index 000000000000..3b11aedc948e
--- /dev/null
+++ b/net-misc/vnc/files/vnc-4.0/vnc-def.patch
@@ -0,0 +1,12 @@
+--- vnc-4.0b5-unixsrc/xc/config/cf/vnc.def.def 2003-07-07 10:51:22.000000000 +0100
++++ vnc-4.0b5-unixsrc/xc/config/cf/vnc.def 2004-05-27 13:24:02.489007854 +0100
+@@ -6,7 +6,8 @@
+ #define BuildNls NO
+ #define BuildXIE NO
+ #define BuildGlxExt NO
+-#define XnestServer NO
++#define XnestServer YES
++#define XF86Server NO
+ #define XprtServer NO
+
+ #ifdef SunArchitecture
diff --git a/net-misc/vnc/files/vnc-4.0/vnc-fPIC.patch b/net-misc/vnc/files/vnc-4.0/vnc-fPIC.patch
new file mode 100644
index 000000000000..db749361a5d5
--- /dev/null
+++ b/net-misc/vnc/files/vnc-4.0/vnc-fPIC.patch
@@ -0,0 +1,69 @@
+--- vnc-4.0b3-unixsrc/Xregion/Makefile.in.fPIC 2003-03-31 16:07:29.000000000 +0100
++++ vnc-4.0b3-unixsrc/Xregion/Makefile.in 2003-08-01 10:35:14.000000000 +0100
+@@ -12,4 +12,5 @@
+ $(AR) $(library) $(OBJS)
+ $(RANLIB) $(library)
+
++DIR_CFLAGS = -DPIC -fPIC
+ # followed by boilerplate.mk
+--- vnc-4.0b3-unixsrc/network/Makefile.in.fPIC 2002-10-28 15:09:54.000000000 +0000
++++ vnc-4.0b3-unixsrc/network/Makefile.in 2003-08-01 10:35:14.000000000 +0100
+@@ -14,4 +14,5 @@
+ $(AR) $(library) $(OBJS)
+ $(RANLIB) $(library)
+
++DIR_CXXFLAGS = -DPIC -fPIC
+ # followed by boilerplate.mk
+--- vnc-4.0b3-unixsrc/rdr/Makefile.in.fPIC 2003-08-01 10:45:29.000000000 +0100
++++ vnc-4.0b3-unixsrc/rdr/Makefile.in 2003-08-01 10:45:41.000000000 +0100
+@@ -16,4 +16,5 @@
+ $(AR) $(library) $(OBJS)
+ $(RANLIB) $(library)
+
++DIR_CXXFLAGS = -DPIC -fPIC
+ # followed by boilerplate.mk
+--- vnc-4.0b3-unixsrc/rfb/Makefile.in.fPIC 2003-07-23 18:25:29.000000000 +0100
++++ vnc-4.0b3-unixsrc/rfb/Makefile.in 2003-08-01 10:35:14.000000000 +0100
+@@ -62,4 +62,6 @@
+ $(AR) $(library) $(OBJS)
+ $(RANLIB) $(library)
+
++DIR_CFLAGS = -DPIC -fPIC
++DIR_CXXFLAGS = -DPIC -fPIC
+ # followed by boilerplate.mk
+--- vnc-4.0b3-unixsrc/xc/programs/Xserver/vnc/module/Imakefile.fPIC 2003-06-03 10:09:12.000000000 +0100
++++ vnc-4.0b3-unixsrc/xc/programs/Xserver/vnc/module/Imakefile 2003-08-01 10:35:14.000000000 +0100
+@@ -20,7 +20,8 @@
+ LinkSourceFile(xf86vncModule.cc,..)
+ LinkSourceFile(XserverDesktop.cc,..)
+
+-ModuleObjectRule()
++.CCsuf.Osuf:
++ NormalSharedLibObjCplusplusCompile($(_NOOP_))
+ /*
+ LibraryModuleTarget(vnc,$(OBJS) $(VNCLIBS))
+ InstallLibraryModule(vnc,$(MODULEDIR),extensions)
+--- vnc-4.0b3-unixsrc/xc/programs/Xserver/vnc/Imakefile.fPIC 2003-06-12 10:48:43.000000000 +0100
++++ vnc-4.0b3-unixsrc/xc/programs/Xserver/vnc/Imakefile 2003-08-01 10:35:14.000000000 +0100
+@@ -35,8 +35,8 @@
+ NormalLintTarget($(SRCS))
+
+ NormalLibraryObjectRule()
+-NormalCplusplusObjectRule()
+-
++.CCsuf.Osuf:
++ NormalSharedLibObjCplusplusCompile($(_NOOP_))
+
+ MakeSubdirs($(SUBDIRS))
+ DependSubdirs($(SUBDIRS))
+--- vnc-4.0b3-unixsrc/boilerplate.mk.fPIC 2002-08-30 11:38:22.000000000 +0100
++++ vnc-4.0b3-unixsrc/boilerplate.mk 2003-08-01 10:35:14.000000000 +0100
+@@ -15,7 +15,7 @@
+ CFLAGS = @CFLAGS@ $(DIR_CFLAGS)
+ CCLD = $(CC)
+ CXX = @CXX@
+-CXXFLAGS = @CXXFLAGS@
++CXXFLAGS = @CXXFLAGS@ $(DIR_CXXFLAGS)
+ CXXLD = $(CXX)
+ CPPFLAGS = @CPPFLAGS@
+ DEFS = @DEFS@
diff --git a/net-misc/vnc/files/vnc-4.0/vnc-gcc34.patch b/net-misc/vnc/files/vnc-4.0/vnc-gcc34.patch
new file mode 100644
index 000000000000..ca7fdbc58cf0
--- /dev/null
+++ b/net-misc/vnc/files/vnc-4.0/vnc-gcc34.patch
@@ -0,0 +1,162 @@
+--- vnc-4.0b5-unixsrc/rfb/Rect.h.gcc34 2003-06-30 21:50:25.000000000 +0100
++++ vnc-4.0b5-unixsrc/rfb/Rect.h 2004-05-20 14:43:56.299371046 +0100
+@@ -21,13 +21,7 @@
+ #ifndef __RFB_RECT_INCLUDED__
+ #define __RFB_RECT_INCLUDED__
+
+-#ifndef max
+-#define max(a,b) (((a) > (b)) ? (a) : (b))
+-#endif
+-
+-#ifndef min
+-#define min(a,b) (((a) < (b)) ? (a) : (b))
+-#endif
++#include <algorithm>
+
+ namespace rfb {
+
+@@ -70,20 +64,20 @@
+ }
+ inline Rect intersect(const Rect &r) const {
+ Rect result;
+- result.tl.x = max(tl.x, r.tl.x);
+- result.tl.y = max(tl.y, r.tl.y);
+- result.br.x = max(min(br.x, r.br.x), result.tl.x);
+- result.br.y = max(min(br.y, r.br.y), result.tl.y);
++ result.tl.x = std::max(tl.x, r.tl.x);
++ result.tl.y = std::max(tl.y, r.tl.y);
++ result.br.x = std::max(std::min(br.x, r.br.x), result.tl.x);
++ result.br.y = std::max(std::min(br.y, r.br.y), result.tl.y);
+ return result;
+ }
+ inline Rect union_boundary(const Rect &r) const {
+ if (r.is_empty()) return *this;
+ if (is_empty()) return r;
+ Rect result;
+- result.tl.x = min(tl.x, r.tl.x);
+- result.tl.y = min(tl.y, r.tl.y);
+- result.br.x = max(br.x, r.br.x);
+- result.br.y = max(br.y, r.br.y);
++ result.tl.x = std::min(tl.x, r.tl.x);
++ result.tl.y = std::min(tl.y, r.tl.y);
++ result.br.x = std::max(br.x, r.br.x);
++ result.br.y = std::max(br.y, r.br.y);
+ return result;
+ }
+ inline Rect translate(const Point &p) const {
+--- vnc-4.0b5-unixsrc/rfb/ComparingUpdateTracker.cxx.gcc34 2004-05-18 17:16:51.000000000 +0100
++++ vnc-4.0b5-unixsrc/rfb/ComparingUpdateTracker.cxx 2004-05-20 14:44:48.225445585 +0100
+@@ -60,7 +60,7 @@
+ // since in effect the entire framebuffer has changed.
+ oldFb.setSize(fb->width(), fb->height());
+ for (int y=0; y<fb->height(); y+=BLOCK_SIZE) {
+- Rect pos(0, y, fb->width(), min(fb->height(), y+BLOCK_SIZE));
++ Rect pos(0, y, fb->width(), std::min(fb->height(), y+BLOCK_SIZE));
+ int srcStride;
+ const rdr::U8* srcData = fb->getPixelsR(pos, &srcStride);
+ oldFb.imageRect(pos, srcData, srcStride);
+@@ -100,20 +100,20 @@
+ for (int blockTop = r.tl.y; blockTop < r.br.y; blockTop += BLOCK_SIZE)
+ {
+ // Get a strip of the source buffer
+- Rect pos(r.tl.x, blockTop, r.br.x, min(r.br.y, blockTop+BLOCK_SIZE));
++ Rect pos(r.tl.x, blockTop, r.br.x, std::min(r.br.y, blockTop+BLOCK_SIZE));
+ int fbStride;
+ const rdr::U8* newBlockPtr = fb->getPixelsR(pos, &fbStride);
+ int newStrideBytes = fbStride * bytesPerPixel;
+
+ rdr::U8* oldBlockPtr = oldData;
+- int blockBottom = min(blockTop+BLOCK_SIZE, r.br.y);
++ int blockBottom = std::min(blockTop+BLOCK_SIZE, r.br.y);
+
+ for (int blockLeft = r.tl.x; blockLeft < r.br.x; blockLeft += BLOCK_SIZE)
+ {
+ const rdr::U8* newPtr = newBlockPtr;
+ rdr::U8* oldPtr = oldBlockPtr;
+
+- int blockRight = min(blockLeft+BLOCK_SIZE, r.br.x);
++ int blockRight = std::min(blockLeft+BLOCK_SIZE, r.br.x);
+ int blockWidthInBytes = (blockRight-blockLeft) * bytesPerPixel;
+
+ for (int y = blockTop; y < blockBottom; y++)
+--- vnc-4.0b5-unixsrc/rfb/hextileDecode.h.gcc34 2003-07-31 19:03:38.000000000 +0100
++++ vnc-4.0b5-unixsrc/rfb/hextileDecode.h 2004-05-20 14:43:56.337363784 +0100
+@@ -52,11 +52,11 @@
+
+ for (t.tl.y = r.tl.y; t.tl.y < r.br.y; t.tl.y += 16) {
+
+- t.br.y = min(r.br.y, t.tl.y + 16);
++ t.br.y = std::min(r.br.y, t.tl.y + 16);
+
+ for (t.tl.x = r.tl.x; t.tl.x < r.br.x; t.tl.x += 16) {
+
+- t.br.x = min(r.br.x, t.tl.x + 16);
++ t.br.x = std::min(r.br.x, t.tl.x + 16);
+
+ int tileType = is->readU8();
+
+--- vnc-4.0b5-unixsrc/rfb/hextileEncode.h.gcc34 2003-07-31 19:03:38.000000000 +0100
++++ vnc-4.0b5-unixsrc/rfb/hextileEncode.h 2004-05-20 14:43:56.340363210 +0100
+@@ -60,11 +60,11 @@
+
+ for (t.tl.y = r.tl.y; t.tl.y < r.br.y; t.tl.y += 16) {
+
+- t.br.y = min(r.br.y, t.tl.y + 16);
++ t.br.y = std::min(r.br.y, t.tl.y + 16);
+
+ for (t.tl.x = r.tl.x; t.tl.x < r.br.x; t.tl.x += 16) {
+
+- t.br.x = min(r.br.x, t.tl.x + 16);
++ t.br.x = std::min(r.br.x, t.tl.x + 16);
+
+ GET_IMAGE_INTO_BUF(t,buf);
+
+--- vnc-4.0b5-unixsrc/rfb/zrleEncode.h.gcc34 2004-05-18 17:16:52.000000000 +0100
++++ vnc-4.0b5-unixsrc/rfb/zrleEncode.h 2004-05-20 14:46:54.105384909 +0100
+@@ -130,7 +130,7 @@
+
+ for (t.tl.y = r.tl.y; t.tl.y < r.br.y; t.tl.y += 64) {
+
+- t.br.y = min(r.br.y, t.tl.y + 64);
++ t.br.y = std::min(r.br.y, t.tl.y + 64);
+
+ if (os->length() + worstCaseLine > maxLen) {
+ if (t.tl.y == r.tl.y)
+@@ -143,7 +143,7 @@
+
+ for (t.tl.x = r.tl.x; t.tl.x < r.br.x; t.tl.x += 64) {
+
+- t.br.x = min(r.br.x, t.tl.x + 64);
++ t.br.x = std::min(r.br.x, t.tl.x + 64);
+
+ GET_IMAGE_INTO_BUF(t,buf);
+
+--- vnc-4.0b5-unixsrc/rfb/zrleDecode.h.gcc34 2003-07-31 19:03:38.000000000 +0100
++++ vnc-4.0b5-unixsrc/rfb/zrleDecode.h 2004-05-20 14:43:56.352360917 +0100
+@@ -61,11 +61,11 @@
+
+ for (t.tl.y = r.tl.y; t.tl.y < r.br.y; t.tl.y += 64) {
+
+- t.br.y = min(r.br.y, t.tl.y + 64);
++ t.br.y = std::min(r.br.y, t.tl.y + 64);
+
+ for (t.tl.x = r.tl.x; t.tl.x < r.br.x; t.tl.x += 64) {
+
+- t.br.x = min(r.br.x, t.tl.x + 64);
++ t.br.x = std::min(r.br.x, t.tl.x + 64);
+
+ int mode = zis->readU8();
+ bool rle = mode & 128;
+--- vnc-4.0b5-unixsrc/tx/TXImage.cxx.gcc34 2004-03-18 17:37:37.000000000 +0000
++++ vnc-4.0b5-unixsrc/tx/TXImage.cxx 2004-05-20 14:43:56.355360344 +0100
+@@ -71,8 +71,8 @@
+ if (w == width() && h == height()) return;
+
+ int oldStrideBytes = getStride() * (format.bpp/8);
+- int rowsToCopy = min(h, height());
+- int bytesPerRow = min(w, width()) * (format.bpp/8);
++ int rowsToCopy = std::min(h, height());
++ int bytesPerRow = std::min(w, width()) * (format.bpp/8);
+ rdr::U8* oldData = 0;
+ bool allocData = false;
+
diff --git a/net-misc/vnc/files/vnc-4.0/vnc-idle.patch b/net-misc/vnc/files/vnc-4.0/vnc-idle.patch
new file mode 100644
index 000000000000..a559e212ce3c
--- /dev/null
+++ b/net-misc/vnc/files/vnc-4.0/vnc-idle.patch
@@ -0,0 +1,11 @@
+--- vnc-4.0b3-unixsrc/rfb/ServerCore.cxx.idle 2003-08-20 17:46:58.000000000 +0100
++++ vnc-4.0b3-unixsrc/rfb/ServerCore.cxx 2003-08-20 17:47:09.000000000 +0100
+@@ -29,7 +29,7 @@
+ rfb::IntParameter rfb::Server::idleTimeout
+ ("IdleTimeout",
+ "The number of seconds after which an idle VNC connection will be dropped",
+- 3600);
++ 0);
+ rfb::IntParameter rfb::Server::clientWaitTimeMillis
+ ("ClientWaitTimeMillis",
+ "The number of milliseconds to wait for a client which is no longer "
diff --git a/net-misc/vnc/files/vnc-4.0/vnc-restart.patch b/net-misc/vnc/files/vnc-4.0/vnc-restart.patch
new file mode 100644
index 000000000000..1fb45a7d52aa
--- /dev/null
+++ b/net-misc/vnc/files/vnc-4.0/vnc-restart.patch
@@ -0,0 +1,21 @@
+--- vnc-4.0b4-unixsrc/network/TcpSocket.cxx.restart 2004-01-22 15:24:34.000000000 +0000
++++ vnc-4.0b4-unixsrc/network/TcpSocket.cxx 2004-01-22 15:27:22.000000000 +0000
+@@ -131,10 +131,14 @@
+ }
+
+ // Attempt to connect to the remote host
+- if (connect(sock, (struct sockaddr *)&addr, sizeof(addr)) != 0) {
+- int e = errorNumber;
+- closesocket(sock);
+- throw SocketException("unable to connect to host", e);
++ for (;;) {
++ if (connect(sock, (struct sockaddr *)&addr, sizeof(addr)) != 0) {
++ int e = errorNumber;
++ if (e == EINTR)
++ continue;
++ closesocket(sock);
++ throw SocketException("unable to connect to host", e);
++ } else break;
+ }
+
+ int one = 1;
diff --git a/net-misc/vnc/files/vnc-4.0/vnc-sparc.patch b/net-misc/vnc/files/vnc-4.0/vnc-sparc.patch
new file mode 100644
index 000000000000..d5a1e31b94a1
--- /dev/null
+++ b/net-misc/vnc/files/vnc-4.0/vnc-sparc.patch
@@ -0,0 +1,32 @@
+--- vnc-4.0b5-unixsrc/xc/programs/Xserver/hw/xfree86/os-support/bus/xf86Sbus.h.sparc 2004-06-20 18:02:36.782820000 -0400
++++ vnc-4.0b5-unixsrc/xc/programs/Xserver/hw/xfree86/os-support/bus/xf86Sbus.h 2004-06-20 18:02:53.602820000 -0400
+@@ -27,6 +27,7 @@
+
+ #if defined(linux)
+ #include <asm/types.h>
++#include <linux/fb.h>
+ #include <asm/fbio.h>
+ #include <asm/openpromio.h>
+ #elif defined(SVR4)
+--- vnc-4.0b5-unixsrc/xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_io.c.sparc 2004-03-04 12:48:09.000000000 -0500
++++ vnc-4.0b5-unixsrc/xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_io.c 2004-06-20 16:50:48.442820000 -0400
+@@ -117,7 +117,7 @@
+
+ static int
+ KIOCSRATE_ioctl_ok(int rate, int delay) {
+-#ifdef KIOCSRATE
++#if defined(KIOCSRATE) && !defined(__sparc__)
+ struct kbd_rate kbdrate_s;
+ int fd;
+
+--- vnc-4.0b5-unixsrc/xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_kbd.c.sparc 2004-03-04 12:48:09.000000000 -0500
++++ vnc-4.0b5-unixsrc/xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_kbd.c 2004-06-20 16:50:48.452820000 -0400
+@@ -145,7 +145,7 @@
+
+ static int
+ KIOCSRATE_ioctl_ok(int rate, int delay) {
+-#ifdef KIOCSRATE
++#if defined(KIOCSRATE) && !defined(__sparc__)
+ struct kbd_rate kbdrate_s;
+ int fd;
+
diff --git a/net-misc/vnc/files/vnc-4.0/vnc-via.patch b/net-misc/vnc/files/vnc-4.0/vnc-via.patch
new file mode 100644
index 000000000000..812a4fc846d0
--- /dev/null
+++ b/net-misc/vnc/files/vnc-4.0/vnc-via.patch
@@ -0,0 +1,185 @@
+--- vnc-4.0b4-unixsrc/network/TcpSocket.cxx.via 2003-09-04 14:04:39.000000000 +0100
++++ vnc-4.0b4-unixsrc/network/TcpSocket.cxx 2003-11-27 18:13:31.000000000 +0000
+@@ -57,6 +57,29 @@
+
+ static rfb::LogWriter vlog("TcpSocket");
+
++/* Tunnelling support. */
++int network::findFreeTcpPort (void)
++{
++ int sock, port;
++ struct sockaddr_in addr;
++ memset(&addr, 0, sizeof(addr));
++ addr.sin_family = AF_INET;
++ addr.sin_addr.s_addr = INADDR_ANY;
++
++ if ((sock = socket (AF_INET, SOCK_STREAM, 0)) < 0)
++ throw SocketException ("unable to create socket", errorNumber);
++
++ for (port = TUNNEL_PORT_OFFSET + 99; port > TUNNEL_PORT_OFFSET; port--) {
++ addr.sin_port = htons ((unsigned short) port);
++ if (bind (sock, (struct sockaddr *)&addr, sizeof (addr)) == 0) {
++ close (sock);
++ return port;
++ }
++ }
++ throw SocketException ("no free port in range", 0);
++ return 0;
++}
++
+
+ void
+ TcpSocket::initTcpSockets() {
+--- vnc-4.0b4-unixsrc/network/TcpSocket.h.via 2003-08-11 10:44:53.000000000 +0100
++++ vnc-4.0b4-unixsrc/network/TcpSocket.h 2003-11-27 18:13:31.000000000 +0000
+@@ -27,8 +27,14 @@
+
+ #include <list>
+
++/* Tunnelling support. */
++#define TUNNEL_PORT_OFFSET 5500
++
+ namespace network {
+
++ /* Tunnelling support. */
++ int findFreeTcpPort (void);
++
+ class TcpSocket : public Socket {
+ public:
+ TcpSocket(int sock, bool close=true);
+--- vnc-4.0b4-unixsrc/vncviewer/vncviewer.cxx.via 2003-09-04 14:04:40.000000000 +0100
++++ vnc-4.0b4-unixsrc/vncviewer/vncviewer.cxx 2003-11-27 18:18:53.000000000 +0000
+@@ -39,6 +39,7 @@
+
+ using namespace network;
+ using namespace rfb;
++using namespace std;
+
+ IntParameter wmDecorationWidth("WMDecorationWidth", "Width of window manager "
+ "decoration around a window", 6);
+@@ -90,6 +91,9 @@
+ StringParameter geometry("geometry", "X geometry specification", 0);
+ StringParameter displayname("display", "The X display", 0);
+
++/* Support for tunnelling */
++StringParameter via("via", "Gateway to tunnel via", "");
++
+ char aboutText[256];
+ char* programName;
+ extern char buildtime[];
+@@ -157,6 +161,61 @@
+ exit(1);
+ }
+
++/* Tunnelling support. */
++static void
++interpretViaParam (char **gatewayHost, char **remoteHost,
++ int *remotePort, char **vncServerName,
++ int localPort)
++{
++ const int SERVER_PORT_OFFSET = 5900;
++ char *pos = strchr (*vncServerName, ':');
++ if (pos == NULL)
++ *remotePort = SERVER_PORT_OFFSET;
++ else {
++ int portOffset = SERVER_PORT_OFFSET;
++ size_t len;
++ *pos++ = '\0';
++ len = strlen (pos);
++ if (*pos == ':') {
++ /* Two colons is an absolute port number, not an offset. */
++ pos++;
++ len--;
++ portOffset = 0;
++ }
++ if (!len || strspn (pos, "-0123456789") != len )
++ usage ();
++ *remotePort = atoi (pos) + portOffset;
++ }
++
++ if (**vncServerName != '\0')
++ *remoteHost = *vncServerName;
++
++ *gatewayHost = strDup (via.getValueStr ());
++ *vncServerName = new char[50];
++ sprintf (*vncServerName, "localhost::%d", localPort);
++}
++
++static void
++createTunnel (const char *gatewayHost, const char *remoteHost,
++ int remotePort, int localPort)
++{
++ char *cmd = getenv ("VNC_VIA_CMD");
++ char *percent;
++ char lport[10], rport[10];
++ sprintf (lport, "%d", localPort);
++ sprintf (rport, "%d", remotePort);
++ setenv ("G", gatewayHost, 1);
++ setenv ("H", remoteHost, 1);
++ setenv ("R", rport, 1);
++ setenv ("L", lport, 1);
++ if (!cmd)
++ cmd = "/usr/bin/ssh -f -L \"$L\":\"$H\":\"$R\" \"$G\" sleep 20";
++ /* Compatibility with TightVNC's method. */
++ while ((percent = strchr (cmd, '%')) != NULL)
++ *percent = '$';
++ system (cmd);
++}
++
+ int main(int argc, char** argv)
+ {
+ sprintf(aboutText, "VNC viewer for X version 4.0b4 - built %s\n"
+@@ -197,14 +256,25 @@
+ usage();
+ }
+
+- if (vncServerName)
+- usage();
+ vncServerName = argv[i];
+ }
+
+ try {
+ TcpSocket::initTcpSockets();
+
++ /* Tunnelling support. */
++ if (strlen (via.getValueStr ()) > 0) {
++ char *gatewayHost = "";
++ char *remoteHost = "localhost";
++ int localPort = findFreeTcpPort ();
++ int remotePort;
++ if (!vncServerName)
++ usage();
++ interpretViaParam (&gatewayHost, &remoteHost, &remotePort,
++ &vncServerName, localPort);
++ createTunnel (gatewayHost, remoteHost, remotePort, localPort);
++ }
++
+ Socket* sock = 0;
+
+ if (listenMode) {
+--- vnc-4.0b4-unixsrc/vncviewer/vncviewer.man.via 2003-08-07 10:45:06.000000000 +0100
++++ vnc-4.0b4-unixsrc/vncviewer/vncviewer.man 2003-11-27 18:13:31.000000000 +0000
+@@ -162,6 +162,23 @@
+ specific source file if you know the name of its "LogWriter". Default is
+ \fB*:stderr:30\fP.
+
++.TP
++\fB\-via\fR \fIgateway\fR
++Automatically create encrypted TCP tunnel to the \fIgateway\fR machine
++before connection, connect to the \fIhost\fR through that tunnel
++(TightVNC\-specific). By default, this option invokes SSH local port
++forwarding, assuming that SSH client binary can be accessed as
++/usr/bin/ssh. Note that when using the \fB\-via\fR option, the host
++machine name should be specified as known to the gateway machine, e.g.
++"localhost" denotes the \fIgateway\fR, not the machine where vncviewer
++was launched. The environment variable \fIVNC_VIA_CMD\fR can override
++the default tunnel command of
++\fB/usr/bin/ssh\ -f\ -L\ "$L":"$H":"$R"\ "$G"\ sleep\ 20\fR. The tunnel
++command is executed with the environment variables \fIH\fR, \fIL\fR, \fIH\fR,
++\fIR\fR, and \fIG\fR taken the values of the local port number, the remote
++host, the port number on the remote host, and the gateway machine
++respectively.
++
+ .SH SEE ALSO
+ .BR Xvnc (1)
+ .BR vncconfig (1),
diff --git a/net-misc/vnc/files/vnc-4.0/vnc-xclients.patch b/net-misc/vnc/files/vnc-4.0/vnc-xclients.patch
new file mode 100644
index 000000000000..8357305cd1d6
--- /dev/null
+++ b/net-misc/vnc/files/vnc-4.0/vnc-xclients.patch
@@ -0,0 +1,13 @@
+--- vnc-4.0b3-unixsrc/vncserver.xclients 2003-08-06 11:15:30.000000000 +0100
++++ vnc-4.0b3-unixsrc/vncserver 2003-08-06 11:16:41.000000000 +0100
+@@ -42,6 +42,10 @@
+
+ $defaultXStartup
+ = ("#!/bin/sh\n\n".
++ "# Uncomment the following two lines for normal desktop:\n".
++ "# unset SESSION_MANAGER\n".
++ "# exec /etc/X11/xinit/xinitrc\n\n".
++ "[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup\n".
+ "[ -r \$HOME/.Xresources ] && xrdb \$HOME/.Xresources\n".
+ "xsetroot -solid grey\n".
+ "vncconfig -iconic &\n".
diff --git a/net-misc/vnc/files/vnc-4.0/vnc-xorg.patch b/net-misc/vnc/files/vnc-4.0/vnc-xorg.patch
new file mode 100644
index 000000000000..d7a46223ab3c
--- /dev/null
+++ b/net-misc/vnc/files/vnc-4.0/vnc-xorg.patch
@@ -0,0 +1,80 @@
+--- vnc-4.0b4-unixsrc/xc/programs/Xserver/vnc/XserverDesktop.cc.xorg 2003-09-04 14:04:40.000000000 +0100
++++ vnc-4.0b4-unixsrc/xc/programs/Xserver/vnc/XserverDesktop.cc 2004-03-22 17:50:05.000000000 +0000
+@@ -376,25 +376,6 @@
+ }
+ }
+
+-static void printRegion(RegionPtr reg)
+-{
+- int nrects = REGION_NUM_RECTS(reg);
+-
+- fprintf(stderr,"Region num rects %2d extents %3d,%3d %3dx%3d\n",nrects,
+- (REGION_EXTENTS(pScreen,reg))->x1,
+- (REGION_EXTENTS(pScreen,reg))->y1,
+- (REGION_EXTENTS(pScreen,reg))->x2-(REGION_EXTENTS(pScreen,reg))->x1,
+- (REGION_EXTENTS(pScreen,reg))->y2-(REGION_EXTENTS(pScreen,reg))->y1);
+-
+- for (int i = 0; i < nrects; i++) {
+- fprintf(stderr," rect %3d,%3d %3dx%3d\n",
+- REGION_RECTS(reg)[i].x1,
+- REGION_RECTS(reg)[i].y1,
+- REGION_RECTS(reg)[i].x2-REGION_RECTS(reg)[i].x1,
+- REGION_RECTS(reg)[i].y2-REGION_RECTS(reg)[i].y1);
+- }
+-}
+-
+ CARD32 XserverDesktop::deferredUpdateTimerCallback(OsTimerPtr timer,
+ CARD32 now, pointer arg)
+ {
+--- vnc-4.0b4-unixsrc/xc/programs/Xserver/Imakefile.xorg 2004-03-04 17:47:16.000000000 +0000
++++ vnc-4.0b4-unixsrc/xc/programs/Xserver/Imakefile 2004-03-22 17:50:05.000000000 +0000
+@@ -119,7 +119,7 @@
+ LIBREGEX = RegexLibrary
+
+ #if DoLoadableServer
+- LIBCWRAPPER = os/libcwrapper.o
++ LIBCWRAPPER = os/libcwrapper.o os/libos.a
+ #endif
+
+ #if BuildXprint
+--- vnc-4.0b4-unixsrc/xc.patch.xorg 2004-03-23 10:53:05.000000000 +0000
++++ vnc-4.0b4-unixsrc/xc.patch 2004-03-23 10:53:42.000000000 +0000
+@@ -8,11 +8,11 @@
+ + XCOMM
+ + XCOMM X VNC server
+ + XCOMM
+-+ MFBDIR = mfb
+-+ CFB8DIR = cfb
+-+ CFB16DIR = cfb16
+-+ CFB24DIR = cfb24
+-+ CFB32DIR = cfb32
+++ MFBSUBDIR = mfb
+++ CFB8SUBDIR = cfb
+++ CFB16SUBDIR = cfb16
+++ CFB24SUBDIR = cfb24
+++ CFB32SUBDIR = cfb32
+ + XVNCDDXDIR = vnc/Xvnc
+ + XVNCDIRS = $(STDDIRS) $(MFBDIR) \
+ + $(CFB8DIR) $(CFB16DIR) $(CFB24DIR) $(CFB32DIR) \
+--- vnc-4.0b5-unixsrc/xc/programs/Xserver/vnc/RegionHelper.h.xorg 2003-05-30 11:42:38.000000000 +0100
++++ vnc-4.0b5-unixsrc/xc/programs/Xserver/vnc/RegionHelper.h 2004-05-27 11:26:06.499536143 +0100
+@@ -36,7 +36,7 @@
+ RegionHelper(ScreenPtr pScreen_, RegionPtr pRegion)
+ : pScreen(pScreen_), reg(&regRec)
+ {
+- REGION_INIT(pScreen, reg, NullBox, 0);
++ REGION_NULL(pScreen, reg);
+ REGION_COPY(pScreen, reg, pRegion);
+ }
+
+@@ -54,8 +54,8 @@
+
+ void init(BoxPtr rect, int size) {
+ reg = &regRec;
+- if (rect && (rect->x2 == rect->x1 || rect->y2 == rect->y1)) {
+- REGION_INIT(pScreen, reg, NullBox, 0);
++ if (!rect || (rect->x2 == rect->x1 || rect->y2 == rect->y1)) {
++ REGION_NULL(pScreen, reg);
+ } else {
+ REGION_INIT(pScreen, reg, rect, size);
+ }
diff --git a/net-misc/vnc/vnc-4.0.ebuild b/net-misc/vnc/vnc-4.0.ebuild
new file mode 100644
index 000000000000..2a8adaf9cf9b
--- /dev/null
+++ b/net-misc/vnc/vnc-4.0.ebuild
@@ -0,0 +1,70 @@
+# Copyright 1999-2004 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/net-misc/vnc/vnc-4.0.ebuild,v 1.1 2004/08/23 12:53:44 aliz Exp $
+
+inherit eutils
+
+X_VERSION="6.7.0"
+
+MY_P="${P}-unixsrc"
+DESCRIPTION="Remote desktop viewer display system"
+HOMEPAGE="http://www.realvnc.com/"
+SRC_URI="http://www.realvnc.com/dist/${MY_P}.tar.gz
+ http://freedesktop.org/~xorg/X11R${X_VERSION}/src/X11R${X_VERSION}-src1.tar.gz
+ http://freedesktop.org/~xorg/X11R${X_VERSION}/src/X11R${X_VERSION}-src2.tar.gz
+ http://freedesktop.org/~xorg/X11R${X_VERSION}/src/X11R${X_VERSION}-src3.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~x86 ~sparc ~ppc ~amd64"
+IUSE=""
+
+DEPEND="sys-libs/zlib
+ media-libs/freetype
+ !virtual/vnc"
+
+PROVIDE="virtual/vnc"
+S="${WORKDIR}/${MY_P}"
+
+src_unpack() {
+ mkdir -p ${S}/xc ; cd ${S}
+
+ unpack X11R${X_VERSION}-src1.tar.gz
+ unpack X11R${X_VERSION}-src2.tar.gz
+ unpack X11R${X_VERSION}-src3.tar.gz
+
+ cd ${WORKDIR}
+ unpack ${MY_P}.tar.gz ; cd ${S}
+
+ # patches from Redhat
+ epatch ${FILESDIR}/${P}/vnc-cookie.patch
+ epatch ${FILESDIR}/${P}/vnc-def.patch
+ epatch ${FILESDIR}/${P}/vnc-fPIC.patch
+ epatch ${FILESDIR}/${P}/vnc-gcc34.patch
+ epatch ${FILESDIR}/${P}/vnc-idle.patch
+ epatch ${FILESDIR}/${P}/vnc-restart.patch
+ epatch ${FILESDIR}/${P}/vnc-sparc.patch
+ epatch ${FILESDIR}/${P}/vnc-via.patch
+ epatch ${FILESDIR}/${P}/vnc-xclients.patch
+ epatch ${FILESDIR}/${P}/vnc-xorg.patch
+
+ epatch ${FILESDIR}/xc.patch-cfbglblt8.patch
+ epatch xc.patch
+}
+
+src_compile() {
+ # client
+ econf --with-installed-zlib || die
+ emake || die
+
+ # server
+ cd ${S}/xc
+ make CDEBUGFLAGS="${CFLAGS}" CXXDEBUGFLAGS="${CXXFLAGS}" World FAST=1 || die
+}
+
+src_install() {
+ # client
+ dodir /usr/bin /usr/share/man/man1
+ ./vncinstall ${D}/usr/bin ${D}/usr/share/man ${D}/usr/X11R6/lib/modules/extensions || die
+ dodoc LICENCE.TXT README
+}