--- vnc4-4.1.1+xorg4.3.0.orig/common/Makefile.in +++ vnc4-4.1.1+xorg4.3.0/common/Makefile.in @@ -1,4 +1,6 @@ SUBDIRS = @ZLIB_DIR@ rdr network Xregion rfb +DIR_CFLAGS = -DPIC -fPIC +DIR_CXXFLAGS = -DPIC -fPIC # followed by boilerplate.mk --- vnc4-4.1.1+xorg4.3.0.orig/common/Xregion/Makefile.in +++ vnc4-4.1.1+xorg4.3.0/common/Xregion/Makefile.in @@ -12,4 +12,8 @@ $(AR) $(library) $(OBJS) $(RANLIB) $(library) +DIR_CFLAGS = -DPIC -fPIC +DIR_CXXFLAGS = -DPIC -fPIC + +DIR_CFLAGS = -DPIC -fPIC # followed by boilerplate.mk --- vnc4-4.1.1+xorg4.3.0.orig/common/boilerplate.mk +++ vnc4-4.1.1+xorg4.3.0/common/boilerplate.mk @@ -15,7 +15,7 @@ CFLAGS = @CFLAGS@ $(DIR_CFLAGS) CCLD = $(CC) CXX = @CXX@ -CXXFLAGS = @CXXFLAGS@ +CXXFLAGS = @CXXFLAGS@ $(DIR_CXXFLAGS) CXXLD = $(CXX) CPPFLAGS = @CPPFLAGS@ DEFS = @DEFS@ --- vnc4-4.1.1+xorg4.3.0.orig/common/network/Makefile.in +++ vnc4-4.1.1+xorg4.3.0/common/network/Makefile.in @@ -14,4 +14,8 @@ $(AR) $(library) $(OBJS) $(RANLIB) $(library) +DIR_CFLAGS = -DPIC -fPIC +DIR_CXXFLAGS = -DPIC -fPIC + +DIR_CXXFLAGS = -DPIC -fPIC # followed by boilerplate.mk --- vnc4-4.1.1+xorg4.3.0.orig/common/network/TcpSocket.cxx +++ vnc4-4.1.1+xorg4.3.0/common/network/TcpSocket.cxx @@ -35,6 +35,7 @@ #include #include #include +#include #endif #include @@ -54,6 +55,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; +} + // -=- Socket initialisation static bool socketsInitialised = false; @@ -80,48 +104,78 @@ { } -TcpSocket::TcpSocket(const char *host, int port) +TcpSocket::TcpSocket(const char *host, int port, int version) : closeFd(true) { - int sock; + int sock, res, error = 0; + int connected = 0; + struct addrinfo hints; + struct addrinfo *hostaddr = NULL; + struct addrinfo *tmpaddr; + char portstring[16]; - // - Create a socket initSockets(); - if ((sock = socket(AF_INET, SOCK_STREAM, 0)) < 0) - throw SocketException("unable to create socket", errorNumber); -#ifndef WIN32 - // - By default, close the socket on exec() - fcntl(sock, F_SETFD, FD_CLOEXEC); + memset(&hints, 0, sizeof(hints)); + hints.ai_socktype = SOCK_STREAM; + hints.ai_flags = AI_NUMERICSERV; + if (version == 6) { +#ifdef AF_INET6 + hints.ai_family = AF_INET6; +#else + throw SocketException("IPv6 not supported", errorNumber); #endif + } else + hints.ai_family = (version == 4) ? AF_INET : 0; - // - Connect it to something + // - This is silly but it's easier than changing the interface + snprintf(portstring, sizeof(portstring), "%d", port); - // Try processing the host as an IP address - struct sockaddr_in addr; - memset(&addr, 0, sizeof(addr)); - addr.sin_family = AF_INET; - addr.sin_addr.s_addr = inet_addr(host); - addr.sin_port = htons(port); - if ((int)addr.sin_addr.s_addr == -1) { - // Host was not an IP address - try resolving as DNS name - struct hostent *hostinfo; - hostinfo = gethostbyname(host); - if (hostinfo && hostinfo->h_addr) { - addr.sin_addr.s_addr = ((struct in_addr *)hostinfo->h_addr)->s_addr; - } else { - int e = errorNumber; + res = getaddrinfo(host, portstring, &hints, &hostaddr); + if (res == EAI_NONAME) { + hints.ai_flags = AI_CANONNAME; + res = getaddrinfo(host, portstring, &hints, &hostaddr); + } else if(hostaddr) + hostaddr->ai_canonname = NULL; + if (res || !hostaddr) + throw SocketException("unable to resolve host by name", errorNumber); + + // - Try to connect to every listed round robin IP + tmpaddr = hostaddr; + errno = 0; + for (tmpaddr = hostaddr; tmpaddr; tmpaddr = tmpaddr->ai_next) { + if (tmpaddr->ai_family == AF_UNIX) + continue; + + // - Create a socket + sock = socket(tmpaddr->ai_family, SOCK_STREAM, 0); + if (sock < 0) { + error = errorNumber; + freeaddrinfo(hostaddr); + throw SocketException("unable to create socket", error); + } + +#ifndef WIN32 + // - By default, close the socket on exec() + fcntl(sock, F_SETFD, FD_CLOEXEC); +#endif + + // Attempt to connect to the remote host + do { + res = connect(sock, tmpaddr->ai_addr, tmpaddr->ai_addrlen); + } while (res != 0 && errorNumber == EINTR); + if (res != 0) { + error = errorNumber; closesocket(sock); - throw SocketException("unable to resolve host by name", e); + continue; } - } - // 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); + connected++; + break; } + freeaddrinfo(hostaddr); + if (!connected) + throw SocketException("unable to connect to host", error); // Disable Nagle's algorithm, to reduce latency enableNagles(sock, false); @@ -206,6 +260,7 @@ VNC_SOCKLEN_T addrlen = sizeof(struct sockaddr_in); getpeername(getFd(), (struct sockaddr *)&peeraddr, &addrlen); + addrlen = sizeof(struct sockaddr_in); getsockname(getFd(), (struct sockaddr *)&myaddr, &addrlen); return (peeraddr.sin_addr.s_addr == myaddr.sin_addr.s_addr); @@ -228,18 +283,12 @@ return true; } -bool TcpSocket::isSocket(int sock) +bool TcpSocket::isListening(int sock) { - struct sockaddr_in info; - VNC_SOCKLEN_T info_size = sizeof(info); - return getsockname(sock, (struct sockaddr *)&info, &info_size) >= 0; -} - -bool TcpSocket::isConnected(int sock) -{ - struct sockaddr_in info; - VNC_SOCKLEN_T info_size = sizeof(info); - return getpeername(sock, (struct sockaddr *)&info, &info_size) >= 0; + int listening = 0; + VNC_SOCKLEN_T listening_size = sizeof(listening); + return getsockopt(sock, SOL_SOCKET, SO_ACCEPTCONN, &listening, + &listening_size) >= 0 && listening; } int TcpSocket::getSockPort(int sock) @@ -260,9 +309,38 @@ return; } + bool use_ipv6; + int af; +#ifdef AF_INET6 + // - localhostOnly will mean "127.0.0.1 only", no IPv6 + if (use_ipv6 = !localhostOnly) + af = AF_INET6; + else + af = AF_INET; +#else + use_ipv6 = false; + af = AF_INET; +#endif + initSockets(); - if ((fd = socket(AF_INET, SOCK_STREAM, 0)) < 0) - throw SocketException("unable to create listening socket", errorNumber); + if ((fd = socket(af, SOCK_STREAM, 0)) < 0) { + // - Socket creation failed + if (use_ipv6) { + // - We were trying to make an IPv6-capable socket - try again, but IPv4-only + use_ipv6 = false; + af = AF_INET; + fd = socket(af, SOCK_STREAM, 0); + } + if (fd < 0) + throw SocketException("unable to create listening socket", errorNumber); + } else { + // - Socket creation succeeded + if (use_ipv6) { + // - We made an IPv6-capable socket, and we need it to do IPv4 too + int opt = 0; + setsockopt(fd, IPPROTO_IPV6, IPV6_V6ONLY, &opt, sizeof(opt)); + } + } #ifndef WIN32 // - By default, close the socket on exec() @@ -279,14 +357,25 @@ // - Bind it to the desired port struct sockaddr_in addr; - memset(&addr, 0, sizeof(addr)); - addr.sin_family = AF_INET; - addr.sin_port = htons(port); - if (localhostOnly) - addr.sin_addr.s_addr = htonl(INADDR_LOOPBACK); - else - addr.sin_addr.s_addr = htonl(INADDR_ANY); - if (bind(fd, (struct sockaddr *)&addr, sizeof(addr)) < 0) { + struct sockaddr_in6 addr6; + struct sockaddr *sa; + int sa_len; + if (use_ipv6) { + memset(&addr6, 0, (sa_len = sizeof(addr6))); + addr6.sin6_family = af; + addr6.sin6_port = htons(port); + sa = (struct sockaddr*) &addr6; + } else { + memset(&addr, 0, (sa_len = sizeof(addr))); + addr.sin_family = af; + addr.sin_port = htons(port); + if (localhostOnly) + addr.sin_addr.s_addr = htonl(INADDR_LOOPBACK); + else + addr.sin_addr.s_addr = htonl(INADDR_ANY); + sa = (struct sockaddr*) &addr; + } + if (bind(fd, sa, sa_len) < 0) { int e = errorNumber; closesocket(fd); throw SocketException("unable to bind listening socket", e); --- vnc4-4.1.1+xorg4.3.0.orig/common/network/TcpSocket.h +++ vnc4-4.1.1+xorg4.3.0/common/network/TcpSocket.h @@ -32,12 +32,19 @@ #include +/* 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); - TcpSocket(const char *name, int port); + // version can be 4 or 6 to force IPv4 or IPv6 respectively + TcpSocket(const char *name, int port, int version = 0); virtual ~TcpSocket(); virtual char* getMyAddress(); @@ -52,8 +59,7 @@ virtual void shutdown(); static bool enableNagles(int sock, bool enable); - static bool isSocket(int sock); - static bool isConnected(int sock); + static bool isListening(int sock); static int getSockPort(int sock); private: bool closeFd; --- vnc4-4.1.1+xorg4.3.0.orig/common/rdr/Makefile.in +++ vnc4-4.1.1+xorg4.3.0/common/rdr/Makefile.in @@ -16,4 +16,8 @@ $(AR) $(library) $(OBJS) $(RANLIB) $(library) +DIR_CFLAGS = -DPIC -fPIC +DIR_CXXFLAGS = -DPIC -fPIC + +DIR_CXXFLAGS = -DPIC -fPIC # followed by boilerplate.mk --- vnc4-4.1.1+xorg4.3.0.orig/common/rfb/CMsgReader.cxx +++ vnc4-4.1.1+xorg4.3.0/common/rfb/CMsgReader.cxx @@ -99,6 +99,8 @@ if (encoding == encodingCopyRect) { readCopyRect(r); } else { + if (encoding > encodingMax) + throw Exception("Unknown rect encoding"); if (!decoders[encoding]) { decoders[encoding] = Decoder::createDecoder(encoding, this); if (!decoders[encoding]) { --- vnc4-4.1.1+xorg4.3.0.orig/common/rfb/Makefile.in +++ vnc4-4.1.1+xorg4.3.0/common/rfb/Makefile.in @@ -65,4 +65,9 @@ $(AR) $(library) $(OBJS) $(RANLIB) $(library) +DIR_CFLAGS = -DPIC -fPIC +DIR_CXXFLAGS = -DPIC -fPIC + +DIR_CFLAGS = -DPIC -fPIC +DIR_CXXFLAGS = -DPIC -fPIC # followed by boilerplate.mk --- vnc4-4.1.1+xorg4.3.0.orig/common/rfb/Password.cxx +++ vnc4-4.1.1+xorg4.3.0/common/rfb/Password.cxx @@ -35,6 +35,9 @@ PlainPasswd::PlainPasswd() {} +PlainPasswd::PlainPasswd(int len) : CharArray(len) { +} + PlainPasswd::PlainPasswd(char* pwd) : CharArray(pwd) { } --- vnc4-4.1.1+xorg4.3.0.orig/common/rfb/Password.h +++ vnc4-4.1.1+xorg4.3.0/common/rfb/Password.h @@ -27,6 +27,7 @@ class PlainPasswd : public CharArray { public: PlainPasswd(); + PlainPasswd(int l); PlainPasswd(char* pwd); PlainPasswd(const ObfuscatedPasswd& obfPwd); ~PlainPasswd(); --- vnc4-4.1.1+xorg4.3.0.orig/common/rfb/SConnection.cxx +++ vnc4-4.1.1+xorg4.3.0/common/rfb/SConnection.cxx @@ -181,6 +181,16 @@ vlog.info("Client requests security type %s(%d)", secTypeName(secType),secType); + std::list secTypes; + std::list::iterator i; + securityFactory->getSecTypes(&secTypes, reverseConnection); + for (i=secTypes.begin(); i!=secTypes.end(); i++) + if (*i == secType) + break; + + if (i == secTypes.end()) + throwConnFailedException("Unexpected security type"); + try { state_ = RFBSTATE_SECURITY; security = securityFactory->getSSecurity(secType, reverseConnection); --- vnc4-4.1.1+xorg4.3.0.orig/common/rfb/ServerCore.cxx +++ vnc4-4.1.1+xorg4.3.0/common/rfb/ServerCore.cxx @@ -29,7 +29,7 @@ ("IdleTimeout", "The number of seconds after which an idle VNC connection will be dropped " "(zero means no timeout)", - 3600, 0); + 0, 0); rfb::IntParameter rfb::Server::clientWaitTimeMillis ("ClientWaitTimeMillis", "The number of milliseconds to wait for a client which is no longer " --- vnc4-4.1.1+xorg4.3.0.orig/debian/README.GENERATED +++ vnc4-4.1.1+xorg4.3.0/debian/README.GENERATED @@ -0,0 +1,9 @@ +This is how the .orig.tar.gz file is generated from two upstream sources. + +tar xfz vnc-4_1_1-unixsrc.tar.gz +mv vnc-4_1_1-unixsrc/ vnc4-4.1.1+X4.3.0 +cd vnc4-4.1.1+X4.3.0/unix/ +tar xfz ../../X430src-1.tgz +tar xfz ../../X430src-2.tgz +tar xfz ../../X430src-3.tgz +patch -Np0 < xc.patch --- vnc4-4.1.1+xorg4.3.0.orig/debian/changelog +++ vnc4-4.1.1+xorg4.3.0/debian/changelog @@ -0,0 +1,539 @@ +vnc4 (4.1.1+xorg4.3.0-37ubuntu5.0.2) trusty-security; urgency=medium + + * SECURITY UPDATE: authentication bypass + - common/rfb/SConnection.cxx: change logic in security check to prevent + compiler miscompile/optimization issue in 64-bit Ubuntu 14.04 LTS. + - CVE-2006-2369 + + -- Marc Deslauriers Fri, 31 Jul 2015 14:49:20 -0400 + +vnc4 (4.1.1+xorg4.3.0-37ubuntu5.0.1) trusty-proposed; urgency=medium + + * arm64-support.patch: Add arm64 support (LP: #1393598) + + -- dann frazier Mon, 17 Nov 2014 17:25:23 -0600 + +vnc4 (4.1.1+xorg4.3.0-37ubuntu5) raring; urgency=low + + * Add armhf_inw_inb.patch: Define compiler macros for armhf platform. + Fixes FTBS on armhf. + (LP: #945368) + + -- Bryce Harrington Thu, 10 Jan 2013 17:07:37 -0800 + +vnc4 (4.1.1+xorg4.3.0-37ubuntu4) precise; urgency=low + + * Reinitialize addrlen to avoid stack smashing (LP: #845855). + Patch by Kazuhiro NISHIYAMA. + + -- Alkis Georgopoulos Sun, 05 Feb 2012 19:08:14 +0200 + +vnc4 (4.1.1+xorg4.3.0-37ubuntu3) oneiric; urgency=low + + * Fix 100% CPU hang when run from inetd in nowait mode if a client + connects and disconnects quickly (e.g., nmap). LP: #819473 + - Added patch to debian/patches/*100-percent-cpu-hang-in-inetd-mode.patch + for reference. + + -- Tristan Schmelcher Fri, 02 Sep 2011 13:42:34 -0700 + +vnc4 (4.1.1+xorg4.3.0-37ubuntu2) lucid; urgency=low + + * unix/vncserver: revert "-extension XFIXES" as it is no longer + needed (LP: #556147) + * Remaining Ubuntu changes: + - None + + -- Steve Beattie Mon, 05 Apr 2010 18:31:57 -0700 + +vnc4 (4.1.1+xorg4.3.0-37ubuntu1) lucid; urgency=low + + * Merge package with debian unstable. Unfortunately Ubuntu adapted an + incompatible version scheme, so this can't be regularly synced. + - (4.1.1+xorg1.0.2-0ubuntu7 > 4.1.1+X4.3.0-37) + * Remaining Ubuntu changes: + - unix/vncserver: add "-extension XFIXES" (LP: #78282). + + -- Mario Limonciello Sat, 03 Apr 2010 18:41:34 -0500 + +vnc4 (4.1.1+X4.3.0-37) unstable; urgency=low + + * Applied patch from Ben Armstrong that makes dpi + to remain constant after RandR changes to geomentry, closes: + #572678. + + -- Ola Lundqvist Wed, 10 Mar 2010 21:37:21 +0100 + +vnc4 (4.1.1+X4.3.0-36) unstable; urgency=low + + * Correction for use of uninitilized memory, closes: #509949. Thanks + to Jö Fahlke for the patch. + + -- Ola Lundqvist Sun, 21 Feb 2010 10:02:12 +0100 + +vnc4 (4.1.1+X4.3.0-35) unstable; urgency=low + + * Applied workaround for IPv6 bindonly issue. Thanks to Roman Mamedov + for the patch. Closes: #568630, #561619, #560137, + #566758, #562169. + + -- Ola Lundqvist Sun, 07 Feb 2010 19:53:25 +0100 + +vnc4 (4.1.1+X4.3.0-34) unstable; urgency=low + + * Added support for xrandr, closes: #366493. Thanks to "Nikita V. + Youshchenko" for the patch and to Ben Armstrong + for the updated vncserver script. + + -- Ola Lundqvist Thu, 19 Nov 2009 22:39:14 +0100 + +vnc4 (4.1.1+X4.3.0-33) unstable; urgency=low + + * Applying patch from Red Hat to solve problem with vncconfig crashing + on amd64. Closes: #551278. Thanks to Michael Terry + for pointing to the patch. + * Applied patch from Roman Mamedov that adds IPv6 + support for the vncserver. Closes: #550789. + * Fixed assertion by using suggested patch from ubuntu bug 202123. + Closes: #282820. + * Applied patch from Otavio Salvador to support + XEmbed. Closes: #447723. + + -- Ola Lundqvist Thu, 19 Nov 2009 21:56:04 +0100 + +vnc4 (4.1.1+X4.3.0-32) unstable; urgency=low + + * Applying a patch from Mike Mammarella that + adds IPv6 support for the xnvcviewer program. Closes: #342620. + * Moved from x-dev to x11proto-core-dev build dependency. Closes: + #515398. + + -- Ola Lundqvist Wed, 09 Sep 2009 19:56:47 +0200 + +vnc4 (4.1.1+X4.3.0-31) unstable; urgency=high + + * Correction for CVE-2008-4770. Arbitrary code execution via crafted + RFB protocol data. Closes: #513531. + + -- Ola Lundqvist Fri, 30 Jan 2009 19:27:21 +0100 + +vnc4 (4.1.1+X4.3.0-30) unstable; urgency=low + + * Correction for seen build problem on alpha architecture. Do not + include asm/pci.h and asm/page.h in case of alpha arch. Closes: #489475. + + -- Ola Lundqvist Sat, 12 Jul 2008 00:08:54 +0200 + +vnc4 (4.1.1+X4.3.0-29) unstable; urgency=low + + * Correction for mipsel architecture. Same problem as for hppa. + Closes: #486104. This may affect mips architecture as well. + + -- Ola Lundqvist Fri, 13 Jun 2008 14:38:49 +0200 + +vnc4 (4.1.1+X4.3.0-28) unstable; urgency=low + + * Due to recent changes in build environment asm/page.h shall not be + included for hppa architecture in + unix/xc/programs/Xserver/hw/xfree86/fbdevhw/fbdevhw.c. Closes: + #485958. + + -- Ola Lundqvist Fri, 13 Jun 2008 08:05:55 +0200 + +vnc4 (4.1.1+X4.3.0-27) unstable; urgency=low + + * Adds a workaround for a problem on sparc architecture. Now + xf86Sbus.h include fb.h in before including fbio.h. Closes: #477659. + * No longer include asm/pci.h on alpha in lnx.h file. The reason is that + this file no longer exist on alpha architecture. + + -- Ola Lundqvist Thu, 12 Jun 2008 07:43:58 +0200 + +vnc4 (4.1.1+X4.3.0-26) unstable; urgency=low + + * Fix for FTBFS on s390, closes: #477232. It will no longer fail on those + architectures that do not build the removed vnc.so. + + -- Ola Lundqvist Tue, 22 Apr 2008 08:03:16 +0200 + +vnc4 (4.1.1+X4.3.0-25) unstable; urgency=low + + * Added conflict on vnc4-common, closes: #477191. + + -- Ola Lundqvist Mon, 21 Apr 2008 22:01:07 +0200 + +vnc4 (4.1.1+X4.3.0-24) unstable; urgency=low + + * Correction of FTBFS with g++-4.3, closes: #474981. + Thanks to Michael Meskes for the patch. + + -- Ola Lundqvist Sun, 20 Apr 2008 11:04:10 +0200 + +vnc4 (4.1.1+X4.3.0-23) unstable; urgency=low + + * Make sure to always strip the binary. Corrected sequence error in + the debian/rules file. + * Updated mentioning of windows in package description, closes: #413634. + * Applied patch for optimization build options, closes: #422662. + * Corrected configuration file reference, closes: #432886. + + -- Ola Lundqvist Fri, 21 Mar 2008 23:17:37 +0100 + +vnc4 (4.1.1+X4.3.0-22) unstable; urgency=low + + * Moving things from vnc4-common to vnc4server package and now conflict on + old no longer created package. + * Removed libvnc.so that do not work with recent xorg. This is a workaround + but solves the grave fault, closes: #444697. No longer provides + x0vnc-server. + * Applied patch from Jussi Judin that solves + the issue that .vnc directory can not be a symbolic link, closes: + #411185. + * Applied patch from Martin Michlmayr that solves gcc + 4.3 build problems, closes: #417740. + + -- Ola Lundqvist Wed, 19 Mar 2008 22:00:18 +0100 + +vnc4 (4.1.1+X4.3.0-21) unstable; urgency=low + + * Made so that errors will be printed on terminal when invoked from + terminal, closes: #409799. + Thanks to Reuben Thomas for correction suggestion. + + -- Ola Lundqvist Mon, 26 Feb 2007 20:33:19 +0100 + +vnc4 (4.1.1+X4.3.0-20) unstable; urgency=low + + * Applied patches from Luca Capello to change + PasswordDialog to XDialog option and to make console dialogs for + more than just the password. Closes: #397417. Thanks for this. + * One of the patches document the new option, closes: #394072. + * The patch from Luca is modified so that it handle newline character + for hostnames properly and to remove newline character on printing. + + -- Ola Lundqvist Thu, 9 Nov 2006 21:30:18 +0100 + +vnc4 (4.1.1+X4.3.0-19) unstable; urgency=low + + * Correcting PAGE_SIZE problem in fbdevhw.c, closes: #394217. + + -- Ola Lundqvist Sat, 21 Oct 2006 14:02:18 -0600 + +vnc4 (4.1.1+X4.3.0-18) unstable; urgency=low + + * Make sure that newline is removed at end of user and password input + if it is read from command line, closes: #387173. + + -- Ola Lundqvist Sun, 24 Sep 2006 21:50:49 +0200 + +vnc4 (4.1.1+X4.3.0-17) unstable; urgency=low + + * Make sure that longer passwords can be used, closes: #386404. + + -- Ola Lundqvist Fri, 8 Sep 2006 06:55:09 +0200 + +vnc4 (4.1.1+X4.3.0-16) unstable; urgency=low + + * Disabled MTRR support for amd64 arch in order to make it build on + that arch. Will enable it later when bug nr 382419 is solved. + + -- Ola Lundqvist Thu, 7 Sep 2006 07:00:04 +0200 + +vnc4 (4.1.1+X4.3.0-15) unstable; urgency=low + + * Finally found the problem with amd64. It was a bug in the makedepend + executeable. Now patched. + + -- Ola Lundqvist Wed, 6 Sep 2006 08:27:46 +0200 + +vnc4 (4.1.1+X4.3.0-14) unstable; urgency=low + + * Workaround for build problem on amd64. + * New option to force showing of user and password dialog. The default + is to have it off when running in a tty (command line) and on when + not. Closes: #384652. + + -- Ola Lundqvist Mon, 4 Sep 2006 20:22:14 +0200 + +vnc4 (4.1.1+X4.3.0-13) unstable; urgency=low + + * Correction of build problem on sparc, closes: #384418. + + -- Ola Lundqvist Tue, 29 Aug 2006 07:29:02 +0200 + +vnc4 (4.1.1+X4.3.0-12) unstable; urgency=low + + * Make it possible to compile (at least some more) on sparc, + closes: #382905. + * Applied patch from Javier Kohen that + inform the user that only 8 first characters of the password will + actually be used when typing more than 8 characters, closes: #355619. + + -- Ola Lundqvist Wed, 23 Aug 2006 20:12:06 +0200 + +vnc4 (4.1.1+X4.3.0-11) unstable; urgency=low + + * Correction of font problem, securitypath problem and rgb problem, + closes: #381274, #365595, #334135. + This finalizes the transition from xfree to xorg. + * Updated to standards version 3.7.2. + + -- Ola Lundqvist Wed, 9 Aug 2006 22:06:33 +0200 + +vnc4 (4.1.1+X4.3.0-10) unstable; urgency=high + + * Correction of critical security issue. Thanks to Martin Kogler + that informed me about the issue, + and provided the patch. + This flaw was originally found by Steve Wiseman of intelliadmin.com. + * Applied patch from Javier Kohen that + inform the user that only 8 first characters of the password will + actually be used when typing more than 8 characters, closes: + #355619. + + -- Ola Lundqvist Mon, 15 May 2006 20:35:17 +0200 + +vnc4 (4.1.1+X4.3.0-9) unstable; urgency=low + + * Final corrections that closes: #363296. + + -- Ola Lundqvist Thu, 27 Apr 2006 07:04:56 +0200 + +vnc4 (4.1.1+X4.3.0-8) unstable; urgency=low + + * Correction in passwd call, closes: #364665. Thanks to + Taco IJsselmuiden for the fix. + + -- Ola Lundqvist Mon, 24 Apr 2006 22:21:12 +0200 + +vnc4 (4.1.1+X4.3.0-7) unstable; urgency=low + + * Applied patch from Andreas Jochens to make it build + on ppc, closes: #364145. + * Corrected issue in vncserver so it work rgb path, closes: #364091. + * Run Xvnc4 instead of Xvnc. + + -- Ola Lundqvist Fri, 21 Apr 2006 21:11:11 +0200 + +vnc4 (4.1.1+X4.3.0-6) unstable; urgency=low + + * Incorporated changes to vncserver script from 4.0-8 version of this + package. + * Merged patch from Peter Cordes (for + tightvncserver) so it can work with xorg version 7.0, + closes: #363296. + * Moved to xorig dir for extensions, closes: #363309. + + -- Ola Lundqvist Wed, 19 Apr 2006 21:51:08 +0200 + +vnc4 (4.1.1+X4.3.0-5) unstable; urgency=low + + * Changed dependency from xserver-common to x11-common, closes: + #362089. + + -- Ola Lundqvist Mon, 17 Apr 2006 15:11:31 +0200 + +vnc4 (4.1.1+X4.3.0-4) unstable; urgency=low + + * Applied patch from Chris Donoghue . + This patch is originally from Fedora and contain support for -fPIC + and also tunneling via ssh support. + Closes: #353711, #353563, #353577, #350480. + + -- Ola Lundqvist Sat, 25 Feb 2006 13:03:26 +0100 + +vnc4 (4.1.1+X4.3.0-3) unstable; urgency=low + + * Made vnc.so optional for some architectures as it is only built + on some because of the X build configuration, closes: #352520. + + -- Ola Lundqvist Sun, 19 Feb 2006 15:06:41 +0100 + +vnc4 (4.1.1+X4.3.0-2) unstable; urgency=low + + * Corrected a build issue with gcc4 and 64 bit architectures, closes: + #350480, #350405, #352520. + * Fix for x0vncserver so that it actually work. The reason was that a + timeout variable was not initialized, closes: #352863. + + -- Ola Lundqvist Sun, 19 Feb 2006 11:43:56 +0100 + +vnc4 (4.1.1+X4.3.0-1) unstable; urgency=low + + + * New upstream version of vnc and X11, closes: #335995. + New type of build. + * This new version have updated linux.cf file, closes: #276238. + * Updated build dependency, closes: #346902. Thanks to + Danilo Piazzalunga . + * This version build with gcc4, + closes: #273536, #335160, #332682, #333255, #280103. + * Renamed vnc.so to libvnc.so, closes: #328523, #319366. Thanks to + Martin Stolle for giving this fix. + * Updated standards version to 3.6.2. + * Now provides xserver, closes: #320576. + * Corrected minor doc bug, closes: #300952. + + -- Ola Lundqvist Fri, 27 Jan 2006 18:59:46 +0100 +vnc4 (4.1.1+xorg1.0.2-0ubuntu7) hardy; urgency=low + + * Add missing X11/X.h include, to fix build with current xorg headers; + thanks to Michael Milligan for the patch. LP: #184225 + + -- Steve Langasek Wed, 16 Apr 2008 07:34:09 +0000 + +vnc4 (4.1.1+xorg1.0.2-0ubuntu6) gutsy; urgency=low + + * Fix build failures with g+-4.3. + + -- Matthias Klose Mon, 10 Sep 2007 16:22:03 +0000 + +vnc4 (4.1.1+xorg1.0.2-0ubuntu5) gutsy; urgency=low + + * unix/vncserver: add "-extension XFIXES" (LP: #78282). + + -- Kees Cook Tue, 21 Aug 2007 09:04:53 -0700 + +vnc4 (4.1.1+xorg1.0.2-0ubuntu4) feisty; urgency=low + + * debian/rules: fix default font paths. (Closes LP#3593) + + -- Kees Cook Sun, 7 Jan 2007 08:21:30 -0800 + +vnc4 (4.1.1+xorg1.0.2-0ubuntu3) feisty; urgency=low + + * debian/patches/xorg-vnc-debian.patch: Modify to remove deprecated include + of asm/kbio.h, in lnx_{kbd,io}.c, fixes FTBFS on sparc. (from + edgy-security) + + -- Kees Cook Sat, 6 Jan 2007 01:05:35 -0800 + +vnc4 (4.1.1+xorg1.0.2-0ubuntu2) feisty; urgency=low + + * SECURITY UPDATE: Fix password-bypassing exploit. + * common/rfb/SConnection.cxx: Confirm that the requested authentication + method is actually valid. Patch taken from 4.1.2. + * debian/control: Fix Build-Depends so that it will actually build. + * debian/rules: Fix bashisms. + * References: + - CVE-2006-2369 + + -- William Grant Sat, 6 Jan 2007 12:08:32 +1100 + +vnc4 (4.1.1+xorg1.0.2-0ubuntu1) dapper; urgency=low + + * Reupload 4.1.1-0ubuntu4 as 4.1.1+xorg1.0.2-0ubuntu1; the former + was erroneously overwritten with a sync from unstable (still + based on Xfree86, not xorg). + + -- Matthias Klose Mon, 29 May 2006 13:28:04 +0200 + +vnc4 (4.1.1-0ubuntu4) dapper; urgency=low + + * Update xorg-server to 1.0.2-0ubuntu9. + * Apply the Ubuntu patches. + * Add xorg-server's build dependencies to the build depenencies. + + -- Matthias Klose Mon, 8 May 2006 13:29:03 +0000 + +vnc4 (4.1.1-0ubuntu3) dapper; urgency=low + + * Update xorg-server to 1.0.2. + + -- Matthias Klose Thu, 30 Mar 2006 01:01:03 +0200 + +vnc4 (4.1.1-0ubuntu1) dapper; urgency=low + + * Unknown changes. + + -- Bjoern Brauel Tue, 24 Jan 2006 01:01:03 +0200 + +vnc4 (4.1.1-0ubuntu1) dapper; urgency=low + + * New upstream version. + + -- Matthias Klose Thu, 5 Jan 2006 18:54:14 +0100 + +vnc4 (4.0-8) unstable; urgency=medium + + * Added alternative for vncconfig, closes: #291591. + * Added menu entry, closes: #288054. + * Modified the vncinstall script so that it chmod files so that root + can modify them. This allow dh_strip to strip them. + + -- Ola Lundqvist Sat, 22 Jan 2005 10:55:33 +0100 + +vnc4 (4.0-7) unstable; urgency=low + + * Changed recommends of xfont-base to xfonts-base. Closes: #285483. + * Maintainer upload of -fPIC patch, closes: #283020. + * Now uses the work vncserver in the package description, closes: #284503. + + -- Ola Lundqvist Sat, 25 Dec 2004 21:33:58 +0100 + +vnc4 (4.0-6.1) unstable; urgency=high + + * Non-maintainer upload. + * High-urgency upload for sarge-targetted RC bugfix. + * Make sure everything that's included in vnc.so is built with -fPIC, + closes: #283020 + + -- Steve Langasek Tue, 14 Dec 2004 04:57:48 -0800 + +vnc4 (4.0-6) unstable; urgency=low + + * Added x dependencies, closes: #282521. + * Closed wrong bug in last upload, closes: #273739. + * Set BuildGlxExt to YES in xc/config/cf/vnc.def, closes: #269765. + * Added patch from Hein Roehrig to add + support for the -localhost option in x0vncserver as well. + + -- Ola Lundqvist Thu, 25 Nov 2004 20:39:21 +0100 + +vnc4 (4.0-5) unstable; urgency=low + + * Changed vncserver start script so it starts x-terminal-emulator and + x-window-manager instead of xterm and twm, closes: #273976. + * Moved in functionality from tightvncserver script. + This means that the options -clean, -fp, -alwaysshared, -nevershared + -httpport and -basehttpport is added. + * Fixed description of vnc4server package, closes: #73739. + + -- Ola Lundqvist Sun, 17 Oct 2004 20:58:47 +0200 + +vnc4 (4.0-4) unstable; urgency=medium + + * Fixed vncpasswd error in prerm of vnc4-common. + * Fixed x0vncserver error in prerm of vnc4server. + * Fixed vncviewer error in prerm of xvncviewer (was pointint at + xrealvncviewer instead xvnc4vewier). + * Added conflict with vnc-common << 3.3.7-6 because of + vncpasswd error there. + + -- Ola Lundqvist Thu, 16 Sep 2004 08:32:12 +0200 + +vnc4 (4.0-3) unstable; urgency=medium + + * Added dependency on vnc-common from vnc4server, closes: #270588. + + -- Ola Lundqvist Sat, 11 Sep 2004 11:59:23 +0200 + +vnc4 (4.0-2) unstable; urgency=medium + + * Now build libraries with -fPIC so vnc.so can be built properly, + closes: #266739. + * Removed tls build dep. Not needed. + + -- Ola Lundqvist Thu, 19 Aug 2004 12:07:12 +0200 + +vnc4 (4.0-1) unstable; urgency=low + + * Initial Release, closes: #250579, #260157. + Used some descriptions from the vnc package. + * This release fix a couple of issues in realvnc version 3. + - Broken on ia64, closes: #233313. + * Added source tar file of XFree86 (X420src-1.tgz). This is needed + in order to build Xvnc and vnc.so. I added this tar-file to the + orig tarball too in the xsrc dir. + + -- Ola Lundqvist Sun, 8 Aug 2004 14:54:54 +0200 --- vnc4-4.1.1+xorg4.3.0.orig/debian/compat +++ vnc4-4.1.1+xorg4.3.0/debian/compat @@ -0,0 +1 @@ +4 --- vnc4-4.1.1+xorg4.3.0.orig/debian/control +++ vnc4-4.1.1+xorg4.3.0/debian/control @@ -0,0 +1,46 @@ +Source: vnc4 +Section: x11 +Priority: optional +Maintainer: Ubuntu Developers +XSBC-Original-Maintainer: Ola Lundqvist +Build-Depends: debhelper (>= 4.0.0), perl, zlib1g-dev, xutils, libx11-dev, libxtst-dev, x11proto-core-dev, libxext-dev +Standards-Version: 3.7.2 + +Package: vnc4server +Architecture: any +Depends: ${shlibs:Depends}, ${misc:Depends}, xbase-clients, x11-common | xserver-common +Provides: vnc-server, xserver +Recommends: xfonts-base +Conflicts: vnc4-common +Suggests: vnc-java +Description: Virtual network computing server software + VNC stands for Virtual Network Computing. It is, in essence, a remote + display system which allows you to view a computing `desktop' environment + not only on the machine where it is running, but from anywhere on the + Internet and from a wide variety of machine architectures. + . + This package provides a vncserver to which X clients can connect and the + server generates a display that can be viewed with a vncviewer. + . + It contains an X server connector so clients can connect to your local X + desktop directly. + . + Note: This server does not need a display. You need a vncviewer to see + something. This viewer may also be on a computer running other operating + systems. + +Package: xvnc4viewer +Section: net +Architecture: any +Provides: vnc-viewer +Depends: ${shlibs:Depends}, ${misc:Depends} +Description: Virtual network computing client software for X + VNC stands for Virtual Network Computing. It is, in essence, a remote + display system which allows you to view a computing `desktop' environment + not only on the machine where it is running, but from anywhere on the + Internet and from a wide variety of machine architectures. + . + It is implemented in a client/server model. This package provides a vncclient + for X, with this you can connect to a vncserver somewhere in the network + and display its content in a window. There are vncservers available for other + operating systems. --- vnc4-4.1.1+xorg4.3.0.orig/debian/copyright +++ vnc4-4.1.1+xorg4.3.0/debian/copyright @@ -0,0 +1,182 @@ +This package was debianized by Ola Lundqvist on +Sun, 8 Aug 2004 14:54:54 +0200. + +It was downloaded from: + http://www.realvnc.com/ + +Copyright: + +Copyright (C) 2002-2004 RealVNC Ltd. All Rights Reserved. + + This software is distributed under the GNU General Public Licence as published + by the Free Software Foundation. See the file LICENCE.TXT (in the source + vnc4 source package) for the conditions under which this software is made + available. VNC also contains code from other sources. See the + Acknowledgements section below, and the individual files for details of the + conditions under which they are made available. + + You should have received a copy of the GNU General Public License with + your Debian GNU system, in /usr/share/common-licenses/GPL, or with the + Debian GNU source package as the file LICENSE.TXT. If not, write to the + Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, + MA 02110-1301, USA. + +This distribution contains public domain DES software by Richard Outerbridge. +This is: + + Copyright (c) 1988,1989,1990,1991,1992 by Richard Outerbridge. + (GEnie : OUTER; CIS : [71755,204]) Graven Imagery, 1992. + + +This distribution contains software from the X Window System. This is: + + Copyright 1987, 1988, 1998 The Open Group + + Permission to use, copy, modify, distribute, and sell this software and its + documentation for any purpose is hereby granted without fee, provided that + the above copyright notice appear in all copies and that both that + copyright notice and this permission notice appear in supporting + documentation. + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN + AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + + Except as contained in this notice, the name of The Open Group shall not be + used in advertising or otherwise to promote the sale, use or other dealings + in this Software without prior written authorization from The Open Group. + + + Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts. + + All Rights Reserved + + Permission to use, copy, modify, and distribute this software and its + documentation for any purpose and without fee is hereby granted, + provided that the above copyright notice appear in all copies and that + both that copyright notice and this permission notice appear in + supporting documentation, and that the name of Digital not be + used in advertising or publicity pertaining to distribution of the + software without specific, written prior permission. + + DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING + ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL + DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR + ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, + ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + SOFTWARE. + + +This distribution contains zlib compression software. This is: + + Copyright (C) 1995-2002 Jean-loup Gailly and Mark Adler + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. + + Jean-loup Gailly Mark Adler + jloup@gzip.org madler@alumni.caltech.edu + + +This distribution contains Java DES software by Dave Zimmerman + and Jef Poskanzer . This is: + + Copyright (c) 1996 Widget Workshop, Inc. All Rights Reserved. + + Permission to use, copy, modify, and distribute this software and its + documentation for NON-COMMERCIAL or COMMERCIAL purposes and without fee + is hereby granted, provided that this copyright notice is kept intact. + + WIDGET WORKSHOP MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE + SUITABILITY OF THE SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT + NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A + PARTICULAR PURPOSE, OR NON-INFRINGEMENT. WIDGET WORKSHOP SHALL NOT BE + LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, + MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. + + THIS SOFTWARE IS NOT DESIGNED OR INTENDED FOR USE OR RESALE AS ON-LINE + CONTROL EQUIPMENT IN HAZARDOUS ENVIRONMENTS REQUIRING FAIL-SAFE + PERFORMANCE, SUCH AS IN THE OPERATION OF NUCLEAR FACILITIES, AIRCRAFT + NAVIGATION OR COMMUNICATION SYSTEMS, AIR TRAFFIC CONTROL, DIRECT LIFE + SUPPORT MACHINES, OR WEAPONS SYSTEMS, IN WHICH THE FAILURE OF THE + SOFTWARE COULD LEAD DIRECTLY TO DEATH, PERSONAL INJURY, OR SEVERE + PHYSICAL OR ENVIRONMENTAL DAMAGE ("HIGH RISK ACTIVITIES"). WIDGET + WORKSHOP SPECIFICALLY DISCLAIMS ANY EXPRESS OR IMPLIED WARRANTY OF + FITNESS FOR HIGH RISK ACTIVITIES. + + Copyright (C) 1996 by Jef Poskanzer . All rights + reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS + BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + Visit the ACME Labs Java page for up-to-date versions of this and other + fine Java utilities: http://www.acme.com/java/ + +------------------------------------------------------------------------------- + +In addition to this the upstream source of XFree86 version 4.2.0 is included +in order to be able to build the Xvnc and vnc.so binaries. That software has +the following license and copyright information: + +Copyright (C) 1999,2000,2001 Compaq Computer Corporation +Copyright (C) 1999,2000,2001 Hewlett-Packard Company +Copyright (C) 1999,2000,2001 IBM Corporation +Copyright (C) 1999,2000,2001 Hummingbird Communications Ltd. +Copyright (C) 1999,2000,2001 Silicon Graphics, Inc. +Copyright (C) 1999,2000,2001 Sun Microsystems, Inc. +Copyright (C) 1999,2000,2001 The Open Group + +All rights reserved. + +Permission is hereby granted, free of charge, to any person obtaining a +copy of this software and associated documentation files (the "Soft- +ware"), to deal in the Software without restriction, including without +limitation the rights to use, copy, modify, merge, publish, distribute, +and/or sell copies of the Software, and to permit persons to whom the +Software is furnished to do so, provided that the above copyright +notice(s) and this permission notice appear in all copies of the Soft- +ware and that both the above copyright notice(s) and this permission +notice appear in supporting documentation. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABIL- +ITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY --- vnc4-4.1.1+xorg4.3.0.orig/debian/patches/amd64-bits-per-long-workaround.patch +++ vnc4-4.1.1+xorg4.3.0/debian/patches/amd64-bits-per-long-workaround.patch @@ -0,0 +1,43 @@ +--- unix/xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_video.c.orig 2006-09-04 20:07:43.755904750 +0200 ++++ unix/xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_video.c 2006-09-04 20:08:18.434072000 +0200 +@@ -67,6 +67,12 @@ + + #endif + ++#ifdef __x86_64__ ++#ifndef BITS_PER_LONG ++#define BITS_PER_LONG 64 ++#endif ++#endif ++ + #ifdef __alpha__ + + # ifdef LIBC_IS_FIXED +--- unix/xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_video.c~ 2006-09-04 20:08:18.434072000 +0200 ++++ unix/xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_video.c 2006-09-06 08:24:16.309429250 +0200 +@@ -25,6 +25,12 @@ + */ + /* $XConsortium: lnx_video.c /main/9 1996/10/19 18:06:34 kaleb $ */ + ++#ifdef __x86_64__ ++#ifndef BITS_PER_LONG ++#define BITS_PER_LONG 64 ++#endif ++#endif ++ + #include "X.h" + #include "input.h" + #include "scrnintstr.h" +@@ -67,12 +73,6 @@ + + #endif + +-#ifdef __x86_64__ +-#ifndef BITS_PER_LONG +-#define BITS_PER_LONG 64 +-#endif +-#endif +- + #ifdef __alpha__ + + # ifdef LIBC_IS_FIXED --- vnc4-4.1.1+xorg4.3.0.orig/debian/patches/arm64-support.patch +++ vnc4-4.1.1+xorg4.3.0/debian/patches/arm64-support.patch @@ -0,0 +1,96 @@ +Description: Add arm64 support +Author: dann frazier +Bug-Debian: http://bugs.debian.org/769490 +Last-Update: 2014-11-13 + +diff -urpN vnc4-4.1.1+X4.3.0.orig/unix/xc/config/cf/Imake.cf vnc4-4.1.1+X4.3.0/unix/xc/config/cf/Imake.cf +--- vnc4-4.1.1+X4.3.0.orig/unix/xc/config/cf/Imake.cf 2003-02-18 16:51:45.000000000 +0000 ++++ vnc4-4.1.1+X4.3.0/unix/xc/config/cf/Imake.cf 2014-11-13 22:56:20.646494516 +0000 +@@ -211,6 +211,10 @@ XCOMM $XFree86: xc/config/cf/Imake.cf,v + # define PpcArchitecture + # undef __powerpc__ + # endif ++# ifdef __aarch64__ ++# define Aarch64Architecture ++# undef __powerpc__ ++# endif + #endif /* NetBSD */ + + #ifdef __FreeBSD__ +@@ -727,6 +731,10 @@ XCOMM Keep cpp from replacing path eleme + # define s390Architecture + # undef __s390__ + # endif /* s390 */ ++# ifdef __aarch64__ ++# define Aarch64Architecture ++# undef __aarch64__ ++# endif + # ifdef __alpha + # define AlphaArchitecture + # undef __alpha +diff -urpN vnc4-4.1.1+X4.3.0.orig/unix/xc/config/cf/linux.cf vnc4-4.1.1+X4.3.0/unix/xc/config/cf/linux.cf +--- vnc4-4.1.1+X4.3.0.orig/unix/xc/config/cf/linux.cf 2014-11-13 23:52:53.000000000 +0000 ++++ vnc4-4.1.1+X4.3.0/unix/xc/config/cf/linux.cf 2014-11-13 23:00:43.786494516 +0000 +@@ -748,6 +748,17 @@ InstallNamedTargetNoClobber(install,file + # define VendorHasX11R6_3libXext YES /* XC or XFree86 >= 3.3.1 */ + #endif + ++#ifdef Aarch64Architecture ++/* Cargoculted from Arm32Architecture w/ -D_XSERVER64 added */ ++# define DefaultCCOptions -fsigned-char ++# ifndef OptimizedCDebugFlags ++# define OptimizedCDebugFlags -O3 ++# endif ++# define LinuxMachineDefines -D__aarch64__ ++# define ServerOSDefines XFree86ServerOSDefines -DDDXTIME -DPART_NET ++# define ServerExtraDefines -DGCCUSESGAS XFree86ServerDefines -D_XSERVER64 ++#endif /* Aarch64Architecture */ ++ + #ifdef AlphaArchitecture + # ifndef OptimizedCDebugFlags + # define OptimizedCDebugFlags DefaultGcc2AxpOpt +diff -urpN vnc4-4.1.1+X4.3.0.orig/unix/xc/include/Xmd.h vnc4-4.1.1+X4.3.0/unix/xc/include/Xmd.h +--- vnc4-4.1.1+X4.3.0.orig/unix/xc/include/Xmd.h 2014-11-13 23:52:53.000000000 +0000 ++++ vnc4-4.1.1+X4.3.0/unix/xc/include/Xmd.h 2014-11-13 23:02:10.936494516 +0000 +@@ -58,7 +58,8 @@ SOFTWARE. + #ifdef CRAY + #define WORD64 /* 64-bit architecture */ + #endif +-#if defined(__alpha) || defined(__alpha__) || \ ++#if defined (__aarch64__) || \ ++ defined(__alpha) || defined(__alpha__) || \ + defined(__ia64__) || defined(ia64) || \ + defined(__sparc64__) || defined(__powerpc64__) || \ + defined(__s390x__) || \ +diff -urpN vnc4-4.1.1+X4.3.0.orig/unix/xc/programs/Xserver/include/servermd.h vnc4-4.1.1+X4.3.0/unix/xc/programs/Xserver/include/servermd.h +--- vnc4-4.1.1+X4.3.0.orig/unix/xc/programs/Xserver/include/servermd.h 2002-05-31 18:46:04.000000000 +0000 ++++ vnc4-4.1.1+X4.3.0/unix/xc/programs/Xserver/include/servermd.h 2014-11-13 23:16:54.886494516 +0000 +@@ -132,6 +132,28 @@ SOFTWARE. + + #endif /* vax */ + ++#ifdef __aarch64__ ++/* Heavily cargo-culted from arm32 */ ++#define IMAGE_BYTE_ORDER LSBFirst ++ ++# if defined(XF86MONOVGA) || defined(XF86VGA16) || defined(XF86MONO) ++# define BITMAP_BIT_ORDER MSBFirst ++# else ++# define BITMAP_BIT_ORDER LSBFirst ++# endif ++ ++# if defined(XF86MONOVGA) || defined(XF86VGA16) ++# define BITMAP_SCANLINE_UNIT 8 ++# endif ++ ++#define GLYPHPADBYTES 4 ++#define GETLEFTBITS_ALIGNMENT 1 ++#define LARGE_INSTRUCTION_CACHE ++#define AVOID_MEMORY_READ ++#define PLENTIFUL_REGISTERS ++ ++#endif /* __aarch64__ */ ++ + #ifdef __arm32__ + + #define IMAGE_BYTE_ORDER LSBFirst --- vnc4-4.1.1+xorg4.3.0.orig/debian/patches/armhf_inw_inb.patch +++ vnc4-4.1.1+xorg4.3.0/debian/patches/armhf_inw_inb.patch @@ -0,0 +1,87 @@ +diff -Nurp vnc4-4.1.1+xorg4.3.0/unix/xc/programs/Xserver/hw/xfree86/common/compiler.h vnc4-4.1.1+xorg4.3.0-armhf/unix/xc/programs/Xserver/hw/xfree86/common/compiler.h +--- vnc4-4.1.1+xorg4.3.0/unix/xc/programs/Xserver/hw/xfree86/common/compiler.h 2012-09-28 16:48:44.312671616 -0700 ++++ vnc4-4.1.1+xorg4.3.0-armhf/unix/xc/programs/Xserver/hw/xfree86/common/compiler.h 2013-01-10 15:42:16.845010046 -0800 +@@ -86,8 +86,8 @@ extern int ffs(unsigned long); + # endif + + # if defined(NO_INLINE) || defined(DO_PROTOTYPES) +-# if !defined(__arm__) +-# if !defined(__sparc__) && !defined(__arm32__) \ ++ ++# if !defined(__sparc__) && !defined(__arm32__) \ + && !(defined(__alpha__) && defined(linux)) + + extern void outb(unsigned short, unsigned char); +@@ -97,7 +97,7 @@ extern unsigned int inb(unsigned short); + extern unsigned int inw(unsigned short); + extern unsigned int inl(unsigned short); + +-# else /* __sparc__, __arm32__, __alpha__*/ ++# else /* __sparc__, __arm32__, __alpha__*/ + + extern void outb(unsigned long, unsigned char); + extern void outw(unsigned long, unsigned short); +@@ -106,8 +106,8 @@ extern unsigned int inb(unsigned long); + extern unsigned int inw(unsigned long); + extern unsigned int inl(unsigned long); + +-# endif /* __sparc__, __arm32__, __alpha__ */ +-# endif /* __arm__ */ ++# endif /* __sparc__, __arm32__, __alpha__ */ ++ + extern unsigned long ldq_u(unsigned long *); + extern unsigned long ldl_u(unsigned int *); + extern unsigned long ldw_u(unsigned short *); +@@ -857,6 +857,7 @@ static __inline__ void stw_u(unsigned lo + + unsigned int IOPortBase; /* Memory mapped I/O port area */ + ++# if defined(__mips__) + static __inline__ void + outb(unsigned PORT_SIZE port, unsigned char val) + { +@@ -893,8 +894,6 @@ inl(unsigned PORT_SIZE port) + return *(volatile unsigned int*)(((unsigned PORT_SIZE)(port))+IOPortBase); + } + +- +-# if defined(__mips__) + static __inline__ unsigned long ldq_u(unsigned long * r11) + { + unsigned long r1; +@@ -1244,6 +1243,35 @@ inl(unsigned short port) + # define mem_barrier() eieio() + # define write_mem_barrier() eieio() + ++# elif defined(__arm__) && defined(__linux__) ++ ++/* for Linux on ARM, we use the LIBC inx/outx routines */ ++/* note that the appropriate setup via "ioperm" needs to be done */ ++/* *before* any inx/outx is done. */ ++#include ++ ++static __inline__ void ++xf_outb(unsigned short port, unsigned char val) ++{ ++ outb(val, port); ++} ++ ++static __inline__ void ++xf_outw(unsigned short port, unsigned short val) ++{ ++ outw(val, port); ++} ++ ++static __inline__ void ++xf_outl(unsigned short port, unsigned int val) ++{ ++ outl(val, port); ++} ++ ++#define outb xf_outb ++#define outw xf_outw ++#define outl xf_outl ++ + # else /* ix86 */ + + # define ldq_u(p) (*((unsigned long *)(p))) --- vnc4-4.1.1+xorg4.3.0.orig/debian/patches/build-lnx_io-sparc-fix.patch +++ vnc4-4.1.1+xorg4.3.0/debian/patches/build-lnx_io-sparc-fix.patch @@ -0,0 +1,11 @@ +--- unix/xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_io.c~ 2006-08-09 08:52:39.000000000 +0200 ++++ unix/xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_io.c 2006-08-23 20:10:38.293540750 +0200 +@@ -69,7 +69,7 @@ + #include + #ifdef __sparc__ + #include +-#include ++/*#include */ + #endif + + /* Deal with spurious kernel header change */ --- vnc4-4.1.1+xorg4.3.0.orig/debian/patches/build-lnx_kbd-sparc-fix.patch +++ vnc4-4.1.1+xorg4.3.0/debian/patches/build-lnx_kbd-sparc-fix.patch @@ -0,0 +1,11 @@ +--- ./unix/xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_kbd.c~ 2006-08-09 08:52:39.000000000 +0200 ++++ ./unix/xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_kbd.c 2006-08-29 07:24:09.274703500 +0200 +@@ -96,7 +96,7 @@ + + #ifdef __sparc__ + #include +-#include ++/*#include */ + #endif + + static int --- vnc4-4.1.1+xorg4.3.0.orig/debian/patches/gcc.patch +++ vnc4-4.1.1+xorg4.3.0/debian/patches/gcc.patch @@ -0,0 +1,62 @@ +Package: vnc4 +Version: 4.1.1+X4.3.0-21 +Usertags: ftbfs-gcc-4.3 +Tags: patch + +Your package fails to build with GCC 4.3. Version 4.3 has not been +released yet but I'm building with a snapshot in order to find errors +and give people an advance warning. In GCC 4.3, the C++ header +dependencies have been cleaned up. The advantage of this is that +programs will compile faster. The downside is that you actually +need to directly #include everything you use (but you really should +do this anyway, otherwise your program won't work with any compiler +other than GCC). Some background of this can be found at +http://gcc.gnu.org/PR28080 + +You can reproduce this problem with gcc-snapshot (20070326-1 or higher) +from unstable. (Currently not available for i386, but for amd64, powerpc +and ia64. I hope to have i386 binaries in the archive in ~3 weeks.) + +> Automatic build of vnc4_4.1.1+X4.3.0-21 on coconut0 by sbuild/ia64 0.49 +... +> c++ -DX_DISPLAY_MISSING=1 -I.. -DVNC_SOCKLEN_T=socklen_t -O2 -Wall -DPIC -fPIC -c TcpSocket.cxx +> TcpSocket.cxx: In static member function 'static network::TcpFilter::Pattern network::TcpFilter::parsePattern(const char*)': +> TcpSocket.cxx:448: error: 'atoi' was not declared in this scope +> make[2]: *** [TcpSocket.o] Error 1 + +--- unix/tx/TXImage.cxx~ 2007-04-04 13:02:27.000000000 +0000 ++++ unix/tx/TXImage.cxx 2007-04-04 13:02:36.000000000 +0000 +@@ -21,6 +21,7 @@ + + + #include ++#include + #include + #include + #include +--- unix/x0vncserver/Image.cxx~ 2007-04-04 13:03:18.000000000 +0000 ++++ unix/x0vncserver/Image.cxx 2007-04-04 13:03:24.000000000 +0000 +@@ -21,6 +21,7 @@ + + + #include ++#include + #include + #include + #include +--- common/network/TcpSocket.cxx~ 2007-04-04 13:00:25.000000000 +0000 ++++ common/network/TcpSocket.cxx 2007-04-04 13:00:49.000000000 +0000 +@@ -35,6 +35,7 @@ + #include + #include + #include ++#include + #endif + + #include + +-- +Martin Michlmayr +http://www.cyrius.com/ + + --- vnc4-4.1.1+xorg4.3.0.orig/debian/patches/ipv6-support.patch +++ vnc4-4.1.1+xorg4.3.0/debian/patches/ipv6-support.patch @@ -0,0 +1,200 @@ +diff -Nurd vnc4-4.1.1+X4.3.0/common/network/TcpSocket.cxx vnc4-4.1.1+X4.3.0/common/network/TcpSocket.cxx +--- vnc4-4.1.1+X4.3.0/common/network/TcpSocket.cxx 2009-06-03 16:59:51.000000000 -0700 ++++ vnc4-4.1.1+X4.3.0/common/network/TcpSocket.cxx 2009-06-03 16:57:40.000000000 -0700 +@@ -104,52 +104,78 @@ + { + } + +-TcpSocket::TcpSocket(const char *host, int port) ++TcpSocket::TcpSocket(const char *host, int port, int version) + : closeFd(true) + { +- int sock; ++ int sock, res, error = 0; ++ int connected = 0; ++ struct addrinfo hints; ++ struct addrinfo *hostaddr = NULL; ++ struct addrinfo *tmpaddr; ++ char portstring[16]; + +- // - Create a socket + initSockets(); +- if ((sock = socket(AF_INET, SOCK_STREAM, 0)) < 0) +- throw SocketException("unable to create socket", errorNumber); + +-#ifndef WIN32 +- // - By default, close the socket on exec() +- fcntl(sock, F_SETFD, FD_CLOEXEC); ++ memset(&hints, 0, sizeof(hints)); ++ hints.ai_socktype = SOCK_STREAM; ++ hints.ai_flags = AI_NUMERICSERV; ++ if (version == 6) { ++#ifdef AF_INET6 ++ hints.ai_family = AF_INET6; ++#else ++ throw SocketException("IPv6 not supported", errorNumber); + #endif ++ } else ++ hints.ai_family = (version == 4) ? AF_INET : 0; + +- // - Connect it to something ++ // - This is silly but it's easier than changing the interface ++ snprintf(portstring, sizeof(portstring), "%d", port); + +- // Try processing the host as an IP address +- struct sockaddr_in addr; +- memset(&addr, 0, sizeof(addr)); +- addr.sin_family = AF_INET; +- addr.sin_addr.s_addr = inet_addr(host); +- addr.sin_port = htons(port); +- if ((int)addr.sin_addr.s_addr == -1) { +- // Host was not an IP address - try resolving as DNS name +- struct hostent *hostinfo; +- hostinfo = gethostbyname(host); +- if (hostinfo && hostinfo->h_addr) { +- addr.sin_addr.s_addr = ((struct in_addr *)hostinfo->h_addr)->s_addr; +- } else { +- int e = errorNumber; +- closesocket(sock); +- throw SocketException("unable to resolve host by name", e); ++ res = getaddrinfo(host, portstring, &hints, &hostaddr); ++ if (res == EAI_NONAME) { ++ hints.ai_flags = AI_CANONNAME; ++ res = getaddrinfo(host, portstring, &hints, &hostaddr); ++ } else if(hostaddr) ++ hostaddr->ai_canonname = NULL; ++ if (res || !hostaddr) ++ throw SocketException("unable to resolve host by name", errorNumber); ++ ++ // - Try to connect to every listed round robin IP ++ tmpaddr = hostaddr; ++ errno = 0; ++ for (tmpaddr = hostaddr; tmpaddr; tmpaddr = tmpaddr->ai_next) { ++ if (tmpaddr->ai_family == AF_UNIX) ++ continue; ++ ++ // - Create a socket ++ sock = socket(tmpaddr->ai_family, SOCK_STREAM, 0); ++ if (sock < 0) { ++ error = errorNumber; ++ freeaddrinfo(hostaddr); ++ throw SocketException("unable to create socket", error); + } +- } + +- // Attempt to connect to the remote host +- for (;;) { +- if (connect(sock, (struct sockaddr *)&addr, sizeof(addr)) != 0) { +- int e = errorNumber; +- if (e == EINTR) +- continue; ++#ifndef WIN32 ++ // - By default, close the socket on exec() ++ fcntl(sock, F_SETFD, FD_CLOEXEC); ++#endif ++ ++ // Attempt to connect to the remote host ++ do { ++ res = connect(sock, tmpaddr->ai_addr, tmpaddr->ai_addrlen); ++ } while (res != 0 && errorNumber == EINTR); ++ if (res != 0) { ++ error = errorNumber; + closesocket(sock); +- throw SocketException("unable to connect to host", e); +- } else break; ++ continue; ++ } ++ ++ connected++; ++ break; + } ++ freeaddrinfo(hostaddr); ++ if (!connected) ++ throw SocketException("unable to connect to host", error); + + // Disable Nagle's algorithm, to reduce latency + enableNagles(sock, false); +diff -Nurd vnc4-4.1.1+X4.3.0/common/network/TcpSocket.h vnc4-4.1.1+X4.3.0/common/network/TcpSocket.h +--- vnc4-4.1.1+X4.3.0/common/network/TcpSocket.h 2009-06-03 16:59:51.000000000 -0700 ++++ vnc4-4.1.1+X4.3.0/common/network/TcpSocket.h 2009-06-03 16:57:40.000000000 -0700 +@@ -43,7 +43,8 @@ + class TcpSocket : public Socket { + public: + TcpSocket(int sock, bool close=true); +- TcpSocket(const char *name, int port); ++ // version can be 4 or 6 to force IPv4 or IPv6 respectively ++ TcpSocket(const char *name, int port, int version = 0); + virtual ~TcpSocket(); + + virtual char* getMyAddress(); +diff -Nurd vnc4-4.1.1+X4.3.0/unix/vncviewer/CConn.cxx vnc4-4.1.1+X4.3.0/unix/vncviewer/CConn.cxx +--- vnc4-4.1.1+X4.3.0/unix/vncviewer/CConn.cxx 2009-06-03 16:59:51.000000000 -0700 ++++ vnc4-4.1.1+X4.3.0/unix/vncviewer/CConn.cxx 2009-06-03 16:57:40.000000000 -0700 +@@ -52,7 +52,7 @@ + StringParameter windowName("name", "The X window name", ""); + + CConn::CConn(Display* dpy_, int argc_, char** argv_, network::Socket* sock_, +- char* vncServerName, bool reverse) ++ char* vncServerName, bool reverse, int ipVersion) + : dpy(dpy_), argc(argc_), + argv(argv_), serverHost(0), serverPort(0), sock(sock_), viewport(0), + desktop(0), desktopEventHandler(0), +@@ -106,7 +106,7 @@ + } + } + +- sock = new network::TcpSocket(serverHost, serverPort); ++ sock = new network::TcpSocket(serverHost, serverPort, ipVersion); + vlog.info("connected to host %s port %d", serverHost, serverPort); + } + +diff -Nurd vnc4-4.1.1+X4.3.0/unix/vncviewer/CConn.h vnc4-4.1.1+X4.3.0/unix/vncviewer/CConn.h +--- vnc4-4.1.1+X4.3.0/unix/vncviewer/CConn.h 2005-03-11 07:08:41.000000000 -0800 ++++ vnc4-4.1.1+X4.3.0/unix/vncviewer/CConn.h 2009-06-03 16:57:40.000000000 -0700 +@@ -48,7 +48,7 @@ + public: + + CConn(Display* dpy_, int argc_, char** argv_, network::Socket* sock_, +- char* vncServerName, bool reverse=false); ++ char* vncServerName, bool reverse=false, int ipVersion=0); + ~CConn(); + + // TXDeleteWindowCallback methods +diff -Nurd vnc4-4.1.1+X4.3.0/unix/vncviewer/vncviewer.cxx vnc4-4.1.1+X4.3.0/unix/vncviewer/vncviewer.cxx +--- vnc4-4.1.1+X4.3.0/unix/vncviewer/vncviewer.cxx 2009-06-03 16:59:51.000000000 -0700 ++++ vnc4-4.1.1+X4.3.0/unix/vncviewer/vncviewer.cxx 2009-06-03 16:57:40.000000000 -0700 +@@ -152,7 +152,7 @@ + static void usage() + { + fprintf(stderr, +- "\nusage: %s [parameters] [host:displayNum] [parameters]\n" ++ "\nusage: %s [-4|-6] [parameters] [host:displayNum] [parameters]\n" + " %s [parameters] -listen [port] [parameters]\n", + programName,programName); + fprintf(stderr,"\n" +@@ -239,8 +239,16 @@ + programName = argv[0]; + char* vncServerName = 0; + Display* dpy = 0; ++ int ipVersion = 0; + + for (int i = 1; i < argc; i++) { ++ if (!strcmp(argv[i], "-4")) { ++ ipVersion = 4; ++ continue; ++ } else if(!strcmp(argv[i], "-6")) { ++ ipVersion = 6; ++ continue; ++ } + if (Configuration::setParam(argv[i])) + continue; + +@@ -313,7 +321,7 @@ + + TXWindow::init(dpy, "Vncviewer"); + xloginIconifier.iconify(dpy); +- CConn cc(dpy, argc, argv, sock, vncServerName, listenMode); ++ CConn cc(dpy, argc, argv, sock, vncServerName, listenMode, ipVersion); + + // X events are processed whenever reading from the socket would block. + --- vnc4-4.1.1+xorg4.3.0.orig/debian/patches/makedepend-segv.patch +++ vnc4-4.1.1+xorg4.3.0/debian/patches/makedepend-segv.patch @@ -0,0 +1,25 @@ +--- unix/xc/config/makedepend/ifparser.c.orig 2006-09-06 08:25:51.847400000 +0200 ++++ unix/xc/config/makedepend/ifparser.c 2006-09-06 08:26:23.961407000 +0200 +@@ -296,12 +296,20 @@ + + case '/': + DO (cp = parse_product (g, cp + 1, &rightval)); +- *valp = (*valp / rightval); ++ if (rightval == 0) { ++ *valp = 0; ++ } else { ++ *valp = (*valp / rightval); ++ } + break; + + case '%': + DO (cp = parse_product (g, cp + 1, &rightval)); +- *valp = (*valp % rightval); ++ if (rightval == 0) { ++ *valp = 0; ++ } else { ++ *valp = (*valp % rightval); ++ } + break; + } + return cp; --- vnc4-4.1.1+xorg4.3.0.orig/debian/patches/nolonger/vnc-4.0b5-vncviewer-tls.diff +++ vnc4-4.1.1+xorg4.3.0/debian/patches/nolonger/vnc-4.0b5-vncviewer-tls.diff @@ -0,0 +1,836 @@ +--- vnc-4.0b5-unixsrc/x0vncserver/Makefile.in.tls 2004-06-11 16:36:08.113307745 +0100 ++++ vnc-4.0b5-unixsrc/x0vncserver/Makefile.in 2004-06-11 16:36:46.864918325 +0100 +@@ -7,9 +7,9 @@ + + DEP_LIBS = ../rfb/librfb.a ../network/libnetwork.a ../rdr/librdr.a + +-EXTRA_LIBS = @ZLIB_LIB@ @X_PRE_LIBS@ @X_LIBS@ -lXtst -lXext -lX11 @X_EXTRA_LIBS@ ++EXTRA_LIBS = @ZLIB_LIB@ @X_PRE_LIBS@ @X_LIBS@ -lXtst -lXext -lX11 @X_EXTRA_LIBS@ @LIBGNUTLS_LIBS@ + +-DIR_CPPFLAGS = -I$(top_srcdir) @X_CFLAGS@ # X_CFLAGS are really CPPFLAGS ++DIR_CPPFLAGS = -I$(top_srcdir) @X_CFLAGS@ @LIBGNUTLS_CFLAGS@ # X_CFLAGS are really CPPFLAGS + + all:: $(program) + +--- vnc-4.0b5-unixsrc/configure.in.tls 2004-06-11 16:36:08.147303017 +0100 ++++ vnc-4.0b5-unixsrc/configure.in 2004-06-11 16:36:46.865918186 +0100 +@@ -63,6 +63,14 @@ + AC_SUBST(ZLIB_INCLUDE) + AC_SUBST(ZLIB_LIB) + ++AC_ARG_ENABLE(gnutls, [ --enable-gnutls build with gnutls support]) ++if test "x$enable_gnutls" = "xyes"; then ++ AC_LANG_PUSH(C) ++ AM_PATH_LIBGNUTLS(1.0.0, [AC_DEFINE(HAVE_GNUTLS)], AC_MSG_ERROR([Unable to find GNUTLS])) ++ LIBGNUTLS_CFLAGS="-DHAVE_GNUTLS $LIBGNUTLS_CFLAGS" ++ AC_LANG_PUSH(C) ++fi ++ + AC_CHECK_FUNC(vsnprintf,VSNPRINTF_DEFINE='-DHAVE_VSNPRINTF',VSNPRINTF_DEFINE=) + AC_SUBST(VSNPRINTF_DEFINE) + +--- vnc-4.0b5-unixsrc/rfb/CSecurity.h.tls 2004-06-11 16:36:08.167300236 +0100 ++++ vnc-4.0b5-unixsrc/rfb/CSecurity.h 2004-06-11 16:36:46.867917908 +0100 +@@ -38,8 +38,14 @@ + class CConnection; + class CSecurity { + public: ++ enum statusEnum { ++ RFB_SECURITY_ERROR, ++ RFB_SECURITY_COMPLETED, ++ RFB_SECURITY_DEFER, ++ RFB_SECURITY_AUTH_TYPES ++ }; + virtual ~CSecurity() {} +- virtual bool processMsg(CConnection* cc, bool* done)=0; ++ virtual statusEnum processMsg(CConnection* cc)=0; + virtual void destroy() { delete this; } + virtual int getType() const = 0; + virtual const char* description() const = 0; +--- vnc-4.0b5-unixsrc/rfb/CSecurityTLS.cxx.tls 2004-06-11 16:36:36.557351881 +0100 ++++ vnc-4.0b5-unixsrc/rfb/CSecurityTLS.cxx 2004-06-11 16:36:46.868917769 +0100 +@@ -0,0 +1,122 @@ ++/* ++ * Copyright (C) 2004 Red Hat Inc. ++ * ++ * This 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 software 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 software; if not, write to the Free Software ++ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, ++ * USA. ++ */ ++ ++#ifdef HAVE_GNUTLS ++ ++#include ++#include ++#include ++#include ++#include ++ ++#undef TLS_DEBUG ++ ++using namespace rfb; ++ ++static LogWriter vlog("TLS"); ++ ++#ifdef TLS_DEBUG ++static void debug_log(int level, const char* str) ++{ ++ vlog.debug(str); ++} ++#endif ++ ++void CSecurityTLS::initGlobal() ++{ ++ static bool globalInitDone = false; ++ ++ if (!globalInitDone) { ++ gnutls_global_init(); ++ ++#ifdef TLS_DEBUG ++ gnutls_global_set_log_level(10); ++ gnutls_global_set_log_function(debug_log); ++#endif ++ ++ globalInitDone = true; ++ } ++} ++ ++CSecurityTLS::CSecurityTLS() : session(0), anon_cred(0) ++{ ++} ++ ++CSecurityTLS::~CSecurityTLS() ++{ ++ if (session) { ++ gnutls_bye(session, GNUTLS_SHUT_RDWR); ++ gnutls_anon_free_client_credentials (anon_cred); ++ gnutls_deinit (session); ++ } ++ ++ /* FIXME: should be doing gnutls_global_deinit() at some point */ ++} ++ ++CSecurityTLS::statusEnum CSecurityTLS::processMsg(CConnection* cc) ++{ ++ rdr::FdInStream* is; ++ rdr::FdOutStream* os; ++ ++ if ((is = dynamic_cast(cc->getInStream())) == 0) { ++ vlog.error("Cannot use TLS security type with anything other than FdInStream"); ++ return RFB_SECURITY_ERROR; ++ } ++ ++ if ((os = dynamic_cast(cc->getOutStream())) == 0) { ++ vlog.error("Cannot use TLS security type with anything other than FdOutStream"); ++ return RFB_SECURITY_ERROR; ++ } ++ ++ initGlobal(); ++ ++ gnutls_init(&session, GNUTLS_CLIENT); ++ gnutls_set_default_priority(session); ++ ++ int kx_priority[] = { GNUTLS_KX_ANON_DH, 0 }; ++ gnutls_kx_set_priority(session, kx_priority); ++ ++ gnutls_anon_allocate_client_credentials(&anon_cred); ++ gnutls_credentials_set(session, GNUTLS_CRD_ANON, anon_cred); ++ ++ gnutls_transport_set_ptr2(session, ++ (gnutls_transport_ptr)is->getFd(), ++ (gnutls_transport_ptr)os->getFd()); ++ ++ int err; ++ do { ++ err = gnutls_handshake(session); ++ } while (err != GNUTLS_E_SUCCESS && !gnutls_error_is_fatal(err)); ++ ++ if (err != GNUTLS_E_SUCCESS) { ++ vlog.error("TLS Handshake failed: %s\n", gnutls_strerror (err)); ++ gnutls_bye(session, GNUTLS_SHUT_RDWR); ++ gnutls_anon_free_client_credentials(anon_cred); ++ gnutls_deinit(session); ++ session = 0; ++ return RFB_SECURITY_ERROR; ++ } ++ ++ is->useTLS(session); ++ os->useTLS(session); ++ ++ return RFB_SECURITY_AUTH_TYPES; ++} ++ ++#endif /* HAVE_GNUTLS */ +--- vnc-4.0b5-unixsrc/rfb/CConnection.h.tls 2004-06-11 16:36:08.248288973 +0100 ++++ vnc-4.0b5-unixsrc/rfb/CConnection.h 2004-06-11 16:36:46.869917630 +0100 +@@ -59,6 +59,11 @@ + // first one is most preferred. + void addSecType(rdr::U8 secType); + ++ // addAuthType() should be called once for each authentication type which ++ // the client supports. The order in which they're added is such that the ++ // first one is most preferred. ++ void addAuthType(rdr::U8 authType); ++ + // setClientSecTypeOrder() determines whether the client should obey + // the server's security type preference, by picking the first server security + // type that the client supports, or whether it should pick the first type +@@ -150,6 +155,7 @@ + private: + void processVersionMsg(); + void processSecurityTypesMsg(); ++ void processAuthTypesMsg(); + void processSecurityMsg(); + void processSecurityResultMsg(); + void processInitMsg(); +@@ -164,9 +170,11 @@ + bool deleteStreamsWhenDone; + bool shared; + CSecurity* security; +- enum { maxSecTypes = 8 }; ++ enum { maxSecTypes = 8, maxAuthTypes = 8 }; + int nSecTypes; + rdr::U8 secTypes[maxSecTypes]; ++ int nAuthTypes; ++ rdr::U8 authTypes[maxAuthTypes]; + bool clientSecTypeOrder; + stateEnum state_; + +--- vnc-4.0b5-unixsrc/rfb/Makefile.in.tls 2004-06-11 16:36:08.250288695 +0100 ++++ vnc-4.0b5-unixsrc/rfb/Makefile.in 2004-06-11 16:36:46.869917630 +0100 +@@ -8,6 +8,7 @@ + CMsgWriter.cxx \ + CMsgWriterV3.cxx \ + CSecurityVncAuth.cxx \ ++ CSecurityTLS.cxx \ + ComparingUpdateTracker.cxx \ + Configuration.cxx \ + ConnParams.cxx \ +@@ -52,7 +53,7 @@ + + OBJS = d3des.o $(CXXSRCS:.cxx=.o) + +-DIR_CPPFLAGS = -I$(top_srcdir) @VSNPRINTF_DEFINE@ ++DIR_CPPFLAGS = -I$(top_srcdir) @VSNPRINTF_DEFINE@ @LIBGNUTLS_CFLAGS@ + + library = librfb.a + +@@ -63,4 +64,6 @@ + $(AR) $(library) $(OBJS) + $(RANLIB) $(library) + ++DIR_CFLAGS = -DPIC -fPIC ++DIR_CXXFLAGS = -DPIC -fPIC + # followed by boilerplate.mk +--- vnc-4.0b5-unixsrc/rfb/CSecurityVncAuth.cxx.tls 2004-06-11 16:36:08.252288416 +0100 ++++ vnc-4.0b5-unixsrc/rfb/CSecurityVncAuth.cxx 2004-06-11 16:36:46.869917630 +0100 +@@ -41,9 +41,8 @@ + { + } + +-bool CSecurityVncAuth::processMsg(CConnection* cc, bool* done) ++CSecurity::statusEnum CSecurityVncAuth::processMsg(CConnection* cc) + { +- *done = false; + rdr::InStream* is = cc->getInStream(); + rdr::OutStream* os = cc->getOutStream(); + +@@ -52,12 +51,11 @@ + CharArray passwd; + if (!upg->getUserPasswd(0, &passwd.buf)) { + vlog.error("Getting password failed"); +- return false; ++ return RFB_SECURITY_ERROR; + } + vncAuthEncryptChallenge(challenge, passwd.buf); + memset(passwd.buf, 0, strlen(passwd.buf)); + os->writeBytes(challenge, vncAuthChallengeSize); + os->flush(); +- *done = true; +- return true; ++ return RFB_SECURITY_COMPLETED; + } +--- vnc-4.0b5-unixsrc/rfb/secTypes.cxx.tls 2004-06-11 16:36:08.254288138 +0100 ++++ vnc-4.0b5-unixsrc/rfb/secTypes.cxx 2004-06-11 16:36:46.870917491 +0100 +@@ -28,6 +28,7 @@ + if (strcasecmp(name, "VncAuth") == 0) return secTypeVncAuth; + if (strcasecmp(name, "RA2") == 0) return secTypeRA2; + if (strcasecmp(name, "RA2ne") == 0) return secTypeRA2ne; ++ if (strcasecmp(name, "TLS") == 0) return secTypeTLS; + return secTypeInvalid; + } + +@@ -38,6 +39,7 @@ + case secTypeVncAuth: return "VncAuth"; + case secTypeRA2: return "RA2"; + case secTypeRA2ne: return "RA2ne"; ++ case secTypeTLS: return "TLS"; + default: return "[unknown secType]"; + } + } +@@ -46,6 +48,7 @@ + { + switch (num) { + case secTypeRA2: return true; ++ case secTypeTLS: return true; + default: return false; + } + } +--- vnc-4.0b5-unixsrc/rfb/CSecurityTLS.h.tls 2004-06-11 16:36:31.135105991 +0100 ++++ vnc-4.0b5-unixsrc/rfb/CSecurityTLS.h 2004-06-11 16:36:46.870917491 +0100 +@@ -0,0 +1,48 @@ ++/* ++ * Copyright (C) 2004 Red Hat Inc. ++ * ++ * This 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 software 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 software; if not, write to the Free Software ++ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, ++ * USA. ++ */ ++ ++#ifndef __C_SECURITY_TLS_H__ ++#define __C_SECURITY_TLS_H__ ++ ++#ifdef HAVE_GNUTLS ++ ++#include ++#include ++#include ++ ++namespace rfb { ++ class CSecurityTLS : public CSecurity { ++ public: ++ CSecurityTLS(); ++ virtual ~CSecurityTLS(); ++ virtual statusEnum processMsg(CConnection* cc); ++ virtual int getType() const { return secTypeTLS; }; ++ virtual const char* description() const { return "TLS Encryption"; } ++ ++ private: ++ static void initGlobal(); ++ ++ gnutls_session session; ++ gnutls_anon_server_credentials anon_cred; ++ }; ++} ++ ++#endif /* HAVE_GNUTLS */ ++ ++#endif /* __C_SECURITY_TLS_H__ */ +--- vnc-4.0b5-unixsrc/rfb/CSecurityNone.h.tls 2004-06-11 16:36:08.312280073 +0100 ++++ vnc-4.0b5-unixsrc/rfb/CSecurityNone.h 2004-06-11 16:36:46.871917352 +0100 +@@ -28,8 +28,8 @@ + + class CSecurityNone : public CSecurity { + public: +- virtual bool processMsg(CConnection* cc, bool* done) { +- *done = true; return true; ++ virtual statusEnum processMsg(CConnection* cc) { ++ return RFB_SECURITY_COMPLETED; + } + virtual int getType() const {return secTypeNone;} + virtual const char* description() const {return "No Encryption";} +--- vnc-4.0b5-unixsrc/rfb/CConnection.cxx.tls 2004-06-11 16:36:08.315279656 +0100 ++++ vnc-4.0b5-unixsrc/rfb/CConnection.cxx 2004-06-11 16:36:46.980902194 +0100 +@@ -33,7 +33,8 @@ + + CConnection::CConnection() + : is(0), os(0), reader_(0), writer_(0), +- shared(false), security(0), nSecTypes(0), clientSecTypeOrder(false), ++ shared(false), security(0), ++ nSecTypes(0), nAuthTypes(0), clientSecTypeOrder(false), + state_(RFBSTATE_UNINITIALISED), useProtocol3_3(false) + { + } +@@ -64,11 +65,19 @@ + + void CConnection::addSecType(rdr::U8 secType) + { ++ vlog.debug("adding %d", secType); + if (nSecTypes == maxSecTypes) + throw Exception("too many security types"); + secTypes[nSecTypes++] = secType; + } + ++void CConnection::addAuthType(rdr::U8 authType) ++{ ++ if (nAuthTypes == maxAuthTypes) ++ throw Exception("too many authentication types"); ++ authTypes[nAuthTypes++] = authType; ++} ++ + void CConnection::setClientSecTypeOrder(bool clientOrder) { + clientSecTypeOrder = clientOrder; + } +@@ -204,15 +213,72 @@ + processSecurityMsg(); + } + ++void CConnection::processAuthTypesMsg() ++{ ++ vlog.debug("processing authentication types message"); ++ ++ int authType = secTypeInvalid; ++ ++ int nServerAuthTypes = is->readU8(); ++ if (nServerAuthTypes == 0) ++ throwConnFailedException(); ++ ++ int authTypePos = nAuthTypes; ++ for (int i = 0; i < nServerAuthTypes; i++) { ++ rdr::U8 serverAuthType = is->readU8(); ++ vlog.debug("Server offers security type %s(%d)", ++ secTypeName(serverAuthType),serverAuthType); ++ ++ // If we haven't already chosen a authType, try this one ++ // If we are using the client's preference for types, ++ // we keep trying types, to find the one that matches and ++ // which appears first in the client's list of supported types. ++ if (authType == secTypeInvalid || clientSecTypeOrder) { ++ for (int j = 0; j < nAuthTypes; j++) { ++ if (authTypes[j] == serverAuthType && j < authTypePos) { ++ authType = authTypes[j]; ++ authTypePos = j; ++ break; ++ } ++ } ++ // NB: Continue reading the remaining server authTypes, but ignore them ++ } ++ } ++ ++ // Inform the server of our decision ++ if (authType != secTypeInvalid) { ++ os->writeU8(authType); ++ os->flush(); ++ vlog.debug("Choosing authentication type %s(%d)",secTypeName(authType),authType); ++ } ++ ++ if (authType == secTypeInvalid) { ++ state_ = RFBSTATE_INVALID; ++ vlog.error("No matching authentication types"); ++ throw Exception("No matching authentication types"); ++ } ++ ++ security = getCSecurity(authType); ++ processSecurityMsg(); ++} ++ + void CConnection::processSecurityMsg() + { + vlog.debug("processing security message"); +- bool done; +- if (!security->processMsg(this, &done)) ++ switch (security->processMsg(this)) { ++ case CSecurity::RFB_SECURITY_ERROR: + throwAuthFailureException(); +- if (done) { ++ case CSecurity::RFB_SECURITY_COMPLETED: + state_ = RFBSTATE_SECURITY_RESULT; + processSecurityResultMsg(); ++ break; ++ case CSecurity::RFB_SECURITY_DEFER: ++ break; ++ case CSecurity::RFB_SECURITY_AUTH_TYPES: ++ processAuthTypesMsg(); ++ break; ++ default: ++ throw Exception("CConnection::processSecurityMsg: invalid security status"); + } + } + +--- vnc-4.0b5-unixsrc/rfb/CSecurityVncAuth.h.tls 2004-06-11 16:36:08.317279378 +0100 ++++ vnc-4.0b5-unixsrc/rfb/CSecurityVncAuth.h 2004-06-11 16:36:46.980902194 +0100 +@@ -30,7 +30,7 @@ + public: + CSecurityVncAuth(UserPasswdGetter* pg); + virtual ~CSecurityVncAuth(); +- virtual bool processMsg(CConnection* cc, bool* done); ++ virtual statusEnum processMsg(CConnection* cc); + virtual int getType() const {return secTypeVncAuth;}; + virtual const char* description() const {return "No Encryption";} + private: +--- vnc-4.0b5-unixsrc/network/Makefile.in.tls 2004-06-11 16:36:08.319279100 +0100 ++++ vnc-4.0b5-unixsrc/network/Makefile.in 2004-06-11 16:36:46.981902055 +0100 +@@ -3,7 +3,7 @@ + + OBJS = $(SRCS:.cxx=.o) + +-DIR_CPPFLAGS = -I$(top_srcdir) @SOCKLEN_T_DEFINE@ ++DIR_CPPFLAGS = -I$(top_srcdir) @SOCKLEN_T_DEFINE@ @LIBGNUTLS_CFLAGS@ + + library = libnetwork.a + +@@ -14,4 +14,5 @@ + $(AR) $(library) $(OBJS) + $(RANLIB) $(library) + ++DIR_CXXFLAGS = -DPIC -fPIC + # followed by boilerplate.mk +--- vnc-4.0b5-unixsrc/vncconfig/Makefile.in.tls 2004-06-11 16:36:08.322278683 +0100 ++++ vnc-4.0b5-unixsrc/vncconfig/Makefile.in 2004-06-11 16:36:47.034894685 +0100 +@@ -8,9 +8,9 @@ + DEP_LIBS = ../tx/libtx.a ../rfb/librfb.a ../network/libnetwork.a \ + ../rdr/librdr.a + +-EXTRA_LIBS = @X_PRE_LIBS@ @X_LIBS@ -lX11 -lXext @X_EXTRA_LIBS@ ++EXTRA_LIBS = @X_PRE_LIBS@ @X_LIBS@ -lX11 -lXext @X_EXTRA_LIBS@ @LIBGNUTLS_LIBS@ + +-DIR_CPPFLAGS = -I$(top_srcdir) -I$(top_srcdir)/tx @X_CFLAGS@ # X_CFLAGS are really CPPFLAGS ++DIR_CPPFLAGS = -I$(top_srcdir) -I$(top_srcdir)/tx @X_CFLAGS@ @LIBGNUTLS_CFLAGS@ # X_CFLAGS are really CPPFLAGS + + all:: $(program) + +--- vnc-4.0b5-unixsrc/rdr/FdInStream.h.tls 2004-06-11 16:36:08.324278405 +0100 ++++ vnc-4.0b5-unixsrc/rdr/FdInStream.h 2004-06-11 16:36:47.035894546 +0100 +@@ -25,6 +25,10 @@ + + #include + ++#ifdef HAVE_GNUTLS ++#include ++#endif ++ + namespace rdr { + + class FdInStreamBlockCallback { +@@ -47,6 +51,10 @@ + int pos(); + void readBytes(void* data, int length); + ++#ifdef HAVE_GNUTLS ++ void useTLS(gnutls_session session); ++#endif ++ + void startTiming(); + void stopTiming(); + unsigned int kbitsPerSecond(); +@@ -63,6 +71,10 @@ + int timeoutms; + FdInStreamBlockCallback* blockCallback; + ++#ifdef HAVE_GNUTLS ++ gnutls_session tlsSession; ++#endif ++ + bool timing; + unsigned int timeWaitedIn100us; + unsigned int timedKbits; +--- vnc-4.0b5-unixsrc/rdr/FdOutStream.cxx.tls 2004-06-11 16:36:08.327277987 +0100 ++++ vnc-4.0b5-unixsrc/rdr/FdOutStream.cxx 2004-06-11 16:36:47.035894546 +0100 +@@ -45,6 +45,9 @@ + FdOutStream::FdOutStream(int fd_, int timeoutms_, int bufSize_) + : fd(fd_), timeoutms(timeoutms_), + bufSize(bufSize_ ? bufSize_ : DEFAULT_BUF_SIZE), offset(0) ++#ifdef HAVE_GNUTLS ++ ,tlsSession(0) ++#endif + { + ptr = start = new U8[bufSize]; + end = start + bufSize; +@@ -113,6 +116,13 @@ + return nItems; + } + ++#ifdef HAVE_GNUTLS ++void FdOutStream::useTLS(gnutls_session session) ++{ ++ tlsSession = session; ++} ++#endif ++ + // + // writeWithTimeout() writes up to the given length in bytes from the given + // buffer to the file descriptor. If there is a timeout set and that timeout +@@ -127,7 +137,9 @@ + { + int n; + ++#ifndef HAVE_GNUTLS + do { ++#endif + + do { + fd_set fds; +@@ -159,15 +171,32 @@ + + if (n == 0) throw TimedOut(); + +- do { +- n = ::write(fd, data, length); +- } while (n < 0 && (errno == EINTR)); ++#ifdef HAVE_GNUTLS ++ if (!tlsSession) { ++#endif ++ ++ do { ++ n = ::write(fd, data, length); ++ } while (n < 0 && (errno == EINTR)); ++ ++#ifdef HAVE_GNUTLS ++ } else { ++ ++ do { ++ n = gnutls_record_send(tlsSession, data, length); ++ } while (n == GNUTLS_E_INTERRUPTED); ++ ++ if (n < 0) throw TLSException("send",n); ++ } ++#else + + // NB: This outer loop simply fixes a broken Winsock2 EWOULDBLOCK + // condition, found only under Win98 (first edition), with slow + // network connections. Should in fact never ever happen... + } while (n < 0 && (errno == EWOULDBLOCK)); + ++#endif /* HAVE_GNUTLS */ ++ + if (n < 0) throw SystemException("write",errno); + + return n; +--- vnc-4.0b5-unixsrc/rdr/FdOutStream.h.tls 2004-06-11 16:36:08.329277709 +0100 ++++ vnc-4.0b5-unixsrc/rdr/FdOutStream.h 2004-06-11 16:36:47.088887176 +0100 +@@ -25,6 +25,10 @@ + + #include + ++#ifdef HAVE_GNUTLS ++#include ++#endif ++ + namespace rdr { + + class FdOutStream : public OutStream { +@@ -41,6 +45,10 @@ + int length(); + void writeBytes(const void* data, int length); + ++#ifdef HAVE_GNUTLS ++ void useTLS(gnutls_session session); ++#endif ++ + private: + int overrun(int itemSize, int nItems); + int writeWithTimeout(const void* data, int length); +@@ -49,6 +57,10 @@ + int bufSize; + int offset; + U8* start; ++ ++#ifdef HAVE_GNUTLS ++ gnutls_session tlsSession; ++#endif + }; + + } +--- vnc-4.0b5-unixsrc/rdr/Makefile.in.tls 2004-06-11 16:36:08.331277431 +0100 ++++ vnc-4.0b5-unixsrc/rdr/Makefile.in 2004-06-11 16:36:47.089887037 +0100 +@@ -5,7 +5,7 @@ + + OBJS = $(SRCS:.cxx=.o) + +-DIR_CPPFLAGS = -I$(top_srcdir) @ZLIB_INCLUDE@ ++DIR_CPPFLAGS = -I$(top_srcdir) @ZLIB_INCLUDE@ @LIBGNUTLS_CFLAGS@ + + library = librdr.a + +--- vnc-4.0b5-unixsrc/rdr/Exception.cxx.tls 2004-06-11 16:36:08.333277153 +0100 ++++ vnc-4.0b5-unixsrc/rdr/Exception.cxx 2004-06-11 16:36:47.089887037 +0100 +@@ -62,3 +62,17 @@ + strncat(str_, buf, len-1-strlen(str_)); + strncat(str_, ")", len-1-strlen(str_)); + } ++ ++#ifdef HAVE_GNUTLS ++TLSException::TLSException(const char* s, int err_) ++ : Exception(s, "rdr::TLSException"), err(err_) ++{ ++ strncat(str_, ": ", len-1-strlen(str_)); ++ strncat(str_, gnutls_strerror(err), len-1-strlen(str_)); ++ strncat(str_, " (", len-1-strlen(str_)); ++ char buf[20]; ++ sprintf(buf,"%d",err); ++ strncat(str_, buf, len-1-strlen(str_)); ++ strncat(str_, ")", len-1-strlen(str_)); ++} ++#endif /* HAVE_GNUTLS */ +--- vnc-4.0b5-unixsrc/rdr/FdInStream.cxx.tls 2004-06-11 16:36:08.335276875 +0100 ++++ vnc-4.0b5-unixsrc/rdr/FdInStream.cxx 2004-06-11 16:36:47.142879667 +0100 +@@ -53,6 +53,9 @@ + bool closeWhenDone_) + : fd(fd_), closeWhenDone(closeWhenDone_), + timeoutms(timeoutms_), blockCallback(0), ++#ifdef HAVE_GNUTLS ++ tlsSession(0), ++#endif + timing(false), timeWaitedIn100us(5), timedKbits(0), + bufSize(bufSize_ ? bufSize_ : DEFAULT_BUF_SIZE), offset(0) + { +@@ -169,6 +172,13 @@ + } + #endif + ++#ifdef HAVE_GNUTLS ++void FdInStream::useTLS(gnutls_session session) ++{ ++ tlsSession = session; ++} ++#endif ++ + // + // readWithTimeoutOrCallback() reads up to the given length in bytes from the + // file descriptor into a buffer. If the wait argument is false, then zero is +@@ -217,12 +227,29 @@ + blockCallback->blockCallback(); + } + +- do { +- n = ::read(fd, buf, len); +- } while (n < 0 && errno == EINTR); ++#ifdef HAVE_GNUTLS ++ if (!tlsSession) { ++#endif ++ ++ do { ++ n = ::read(fd, buf, len); ++ } while (n < 0 && errno == EINTR); + +- if (n < 0) throw SystemException("read",errno); +- if (n == 0) throw EndOfStream(); ++ if (n < 0) throw SystemException("read",errno); ++ if (n == 0) throw EndOfStream(); ++ ++#ifdef HAVE_GNUTLS ++ } else { ++ ++ do { ++ n = gnutls_record_recv(tlsSession, buf, len); ++ } while (n == GNUTLS_E_INTERRUPTED); ++ ++ if (n < 0) throw TLSException("recv",n); ++ if (n == 0) throw EndOfStream(); ++ ++ } ++#endif + + if (timing) { + gettimeofday(&after, 0); +--- vnc-4.0b5-unixsrc/rdr/Exception.h.tls 2004-06-11 16:36:08.337276597 +0100 ++++ vnc-4.0b5-unixsrc/rdr/Exception.h 2004-06-11 16:36:47.143879528 +0100 +@@ -22,6 +22,10 @@ + #include + #include + ++#ifdef HAVE_GNUTLS ++#include ++#endif ++ + namespace rdr { + + struct Exception { +@@ -44,7 +48,7 @@ + struct SystemException : public Exception { + int err; + SystemException(const char* s, int err_); +- }; ++ }; + + struct TimedOut : public Exception { + TimedOut(const char* s="Timed out") : Exception(s,"rdr::TimedOut") {} +@@ -54,6 +58,13 @@ + EndOfStream(const char* s="End of stream") + : Exception(s,"rdr::EndOfStream") {} + }; ++ ++#ifdef HAVE_GNUTLS ++ struct TLSException : public Exception { ++ int err; ++ TLSException(const char* s, int err_); ++ }; ++#endif + } + + #endif +--- vnc-4.0b5-unixsrc/vncviewer/Makefile.in.tls 2004-06-11 16:36:08.339276319 +0100 ++++ vnc-4.0b5-unixsrc/vncviewer/Makefile.in 2004-06-11 16:36:47.144879388 +0100 +@@ -8,9 +8,9 @@ + DEP_LIBS = ../tx/libtx.a ../rfb/librfb.a ../network/libnetwork.a \ + ../rdr/librdr.a + +-EXTRA_LIBS = @ZLIB_LIB@ @X_PRE_LIBS@ @X_LIBS@ -lXext -lX11 @X_EXTRA_LIBS@ ++EXTRA_LIBS = @ZLIB_LIB@ @X_PRE_LIBS@ @X_LIBS@ -lXext -lX11 @X_EXTRA_LIBS@ @LIBGNUTLS_LIBS@ + +-DIR_CPPFLAGS = -I$(top_srcdir) -I$(top_srcdir)/tx @X_CFLAGS@ # X_CFLAGS are really CPPFLAGS ++DIR_CPPFLAGS = -I$(top_srcdir) -I$(top_srcdir)/tx @X_CFLAGS@ @LIBGNUTLS_CFLAGS@ # X_CFLAGS are really CPPFLAGS + + all:: $(program) + +--- vnc-4.0b5-unixsrc/vncviewer/CConn.cxx.tls 2004-06-11 16:36:08.341276041 +0100 ++++ vnc-4.0b5-unixsrc/vncviewer/CConn.cxx 2004-06-11 16:36:47.201871462 +0100 +@@ -26,6 +26,7 @@ + #include + #include + #include ++#include + #include + #include + #include +@@ -64,8 +65,16 @@ + menuKeysym = XStringToKeysym(menuKeyStr.buf); + + setShared(shared); ++ ++#ifdef HAVE_GNUTLS ++ addSecType(secTypeTLS); ++#endif + addSecType(secTypeNone); + addSecType(secTypeVncAuth); ++ ++ addAuthType(secTypeNone); ++ addAuthType(secTypeVncAuth); ++ + CharArray encStr(preferredEncoding.getData()); + int encNum = encodingNum(encStr.buf); + if (encNum != -1) { +@@ -216,6 +225,10 @@ + return new CSecurityNone(); + case secTypeVncAuth: + return new CSecurityVncAuth(this); ++#ifdef HAVE_GNUTLS ++ case secTypeTLS: ++ return new CSecurityTLS(); ++#endif + default: + throw rfb::Exception("Unsupported secType?"); + } +--- vnc-4.0b5-unixsrc/tx/Makefile.in.tls 2004-06-11 16:36:08.392268949 +0100 ++++ vnc-4.0b5-unixsrc/tx/Makefile.in 2004-06-11 16:36:47.202871323 +0100 +@@ -4,7 +4,7 @@ + + OBJS = $(SRCS:.cxx=.o) + +-DIR_CPPFLAGS = -I$(top_srcdir) @X_CFLAGS@ # X_CFLAGS are really CPPFLAGS ++DIR_CPPFLAGS = -I$(top_srcdir) @X_CFLAGS@ @LIBGNUTLS_CFLAGS@ # X_CFLAGS are really CPPFLAGS + + library = libtx.a + --- vnc4-4.1.1+xorg4.3.0.orig/debian/patches/password-dialog-default-off-for-tty-2.patch +++ vnc4-4.1.1+xorg4.3.0/debian/patches/password-dialog-default-off-for-tty-2.patch @@ -0,0 +1,24 @@ +--- unix/vncviewer/CConn.cxx~ 2006-09-03 22:28:17.819338250 +0200 ++++ unix/vncviewer/CConn.cxx 2006-09-08 06:54:34.233326750 +0200 +@@ -218,8 +218,8 @@ + if (user) { + /* Get username */ + fprintf(stderr, "Username: "); +- *user = new char[40]; +- fgets(*user, 40, stdin); ++ *user = new char[128]; ++ fgets(*user, 128, stdin); + } + + if (tcgetattr (fileno (stdin), &oldio) != 0) { +@@ -234,8 +234,8 @@ + popup = 1; + + /* Read the password. */ +- *password = new char[8]; +- fgets (*password, 8, stdin); ++ *password = new char[64]; ++ fgets (*password, 64, stdin); + + /* Restore terminal. */ + (void) tcsetattr (fileno (stdin), TCSAFLUSH, &oldio); --- vnc4-4.1.1+xorg4.3.0.orig/debian/patches/password-dialog-default-off-for-tty-3.patch +++ vnc4-4.1.1+xorg4.3.0/debian/patches/password-dialog-default-off-for-tty-3.patch @@ -0,0 +1,20 @@ +--- unix/vncviewer/CConn.cxx.orig 2006-09-24 21:52:37.731592500 +0200 ++++ unix/vncviewer/CConn.cxx 2006-09-24 21:52:42.575895250 +0200 +@@ -220,6 +220,8 @@ + fprintf(stderr, "Username: "); + *user = new char[128]; + fgets(*user, 128, stdin); ++ /* Remove \n at the end */ ++ (*user)[strlen(*user)-1] = '\0'; + } + + if (tcgetattr (fileno (stdin), &oldio) != 0) { +@@ -236,6 +238,8 @@ + /* Read the password. */ + *password = new char[64]; + fgets (*password, 64, stdin); ++ /* Remove \n at the end */ ++ (*password)[strlen(*password)-1] = '\0'; + + /* Restore terminal. */ + (void) tcsetattr (fileno (stdin), TCSAFLUSH, &oldio); --- vnc4-4.1.1+xorg4.3.0.orig/debian/patches/password-dialog-default-off-for-tty.patch +++ vnc4-4.1.1+xorg4.3.0/debian/patches/password-dialog-default-off-for-tty.patch @@ -0,0 +1,108 @@ +--- ./unix/vncviewer/vncviewer.cxx~ 2006-08-09 08:52:39.000000000 +0200 ++++ ./unix/vncviewer/vncviewer.cxx 2006-09-03 22:17:07.089420250 +0200 +@@ -93,6 +93,10 @@ + + BoolParameter listenMode("listen", "Listen for connections from VNC servers", + false); ++BoolParameter popupUserPassDialog("PasswordDialog", ++ "Popup a user and password dialog. Default " ++ "no when running from command line", ++ !isatty(0)); + StringParameter geometry("geometry", "X geometry specification", ""); + StringParameter displayname("display", "The X display", ""); + +--- ./unix/vncviewer/parameters.h~ 2005-03-11 16:08:41.000000000 +0100 ++++ ./unix/vncviewer/parameters.h 2006-09-03 21:46:02.932917750 +0200 +@@ -37,6 +37,7 @@ + extern rfb::BoolParameter sendPrimary; + extern rfb::BoolParameter fullScreen; + extern rfb::StringParameter geometry; ++extern rfb::BoolParameter popupUserPassDialog; + + extern char aboutText[]; + extern char* programName; +--- ./unix/vncviewer/CConn.cxx~ 2005-03-11 16:08:41.000000000 +0100 ++++ ./unix/vncviewer/CConn.cxx 2006-09-03 22:28:17.819338250 +0200 +@@ -37,6 +37,8 @@ + #include "ServerDialog.h" + #include "PasswdDialog.h" + #include "parameters.h" ++#include ++#include + + using namespace rfb; + +@@ -48,6 +50,8 @@ + StringParameter menuKey("MenuKey", "The key which brings up the popup menu", + "F8"); + StringParameter windowName("name", "The X window name", ""); ++#include ++#include + + CConn::CConn(Display* dpy_, int argc_, char** argv_, network::Socket* sock_, + char* vncServerName, bool reverse) +@@ -194,6 +198,9 @@ + + void CConn::getUserPasswd(char** user, char** password) + { ++ struct termios oldio; ++ struct termios newio; ++ + CharArray passwordFileStr(passwordFile.getData()); + if (!user && passwordFileStr.buf[0]) { + FILE* fp = fopen(passwordFileStr.buf, "r"); +@@ -206,15 +213,45 @@ + return; + } + +- const char* secType = secTypeName(getCurrentCSecurity()->getType()); +- const char* titlePrefix = "VNC Authentication"; +- CharArray title(strlen(titlePrefix) + strlen(secType) + 4); +- sprintf(title.buf, "%s [%s]", titlePrefix, secType); +- PasswdDialog dlg(dpy, title.buf, !user); +- if (!dlg.show()) throw rfb::Exception("Authentication cancelled"); +- if (user) +- *user = strDup(dlg.userEntry.getText()); +- *password = strDup(dlg.passwdEntry.getText()); ++ int popup = popupUserPassDialog; ++ if (!popup) { ++ if (user) { ++ /* Get username */ ++ fprintf(stderr, "Username: "); ++ *user = new char[40]; ++ fgets(*user, 40, stdin); ++ } ++ ++ if (tcgetattr (fileno (stdin), &oldio) != 0) { ++ popup = 1; ++ } ++ else { ++ newio = oldio; ++ newio.c_lflag &= ~ECHO; ++ fprintf(stderr, "Password: "); ++ /* Echo off */ ++ if (tcsetattr (fileno (stdin), TCSAFLUSH, &newio) != 0) ++ popup = 1; ++ ++ /* Read the password. */ ++ *password = new char[8]; ++ fgets (*password, 8, stdin); ++ ++ /* Restore terminal. */ ++ (void) tcsetattr (fileno (stdin), TCSAFLUSH, &oldio); ++ } ++ } ++ if (popup) { ++ const char* secType = secTypeName(getCurrentCSecurity()->getType()); ++ const char* titlePrefix = "VNC Authentication"; ++ CharArray title(strlen(titlePrefix) + strlen(secType) + 4); ++ sprintf(title.buf, "%s [%s]", titlePrefix, secType); ++ PasswdDialog dlg(dpy, title.buf, !user); ++ if (!dlg.show()) throw rfb::Exception("Authentication cancelled"); ++ if (user) ++ *user = strDup(dlg.userEntry.getText()); ++ *password = strDup(dlg.passwdEntry.getText()); ++ } + } + + --- vnc4-4.1.1+xorg4.3.0.orig/debian/patches/reinitialize-addrlen.patch +++ vnc4-4.1.1+xorg4.3.0/debian/patches/reinitialize-addrlen.patch @@ -0,0 +1,10 @@ +--- common/network/TcpSocket.cxx 2012-02-05 17:04:07 +0000 ++++ common/network/TcpSocket.cxx 2012-02-05 17:06:16 +0000 +@@ -260,6 +260,7 @@ + VNC_SOCKLEN_T addrlen = sizeof(struct sockaddr_in); + + getpeername(getFd(), (struct sockaddr *)&peeraddr, &addrlen); ++ addrlen = sizeof(struct sockaddr_in); + getsockname(getFd(), (struct sockaddr *)&myaddr, &addrlen); + + return (peeraddr.sin_addr.s_addr == myaddr.sin_addr.s_addr); --- vnc4-4.1.1+xorg4.3.0.orig/debian/patches/tunnel-and-fpic-vnc4-4.3.0-3.patch +++ vnc4-4.1.1+xorg4.3.0/debian/patches/tunnel-and-fpic-vnc4-4.3.0-3.patch @@ -0,0 +1,765 @@ +diff -Naur vnc4-4.1.1+X4.3.0.orig_old/common/boilerplate.mk vnc4-4.1.1+X4.3.0.orig/common/boilerplate.mk +--- vnc4-4.1.1+X4.3.0.orig_old/common/boilerplate.mk 2004-07-14 03:23:21.000000000 +1000 ++++ vnc4-4.1.1+X4.3.0.orig/common/boilerplate.mk 2006-02-22 15:16:24.000000000 +1100 +@@ -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 -Naur vnc4-4.1.1+X4.3.0.orig_old/common/Makefile.in vnc4-4.1.1+X4.3.0.orig/common/Makefile.in +--- vnc4-4.1.1+X4.3.0.orig_old/common/Makefile.in 2004-07-14 03:28:00.000000000 +1000 ++++ vnc4-4.1.1+X4.3.0.orig/common/Makefile.in 2006-02-22 15:16:24.000000000 +1100 +@@ -1,4 +1,6 @@ + + SUBDIRS = @ZLIB_DIR@ rdr network Xregion rfb + ++DIR_CFLAGS = -DPIC -fPIC ++DIR_CXXFLAGS = -DPIC -fPIC + # followed by boilerplate.mk +diff -Naur vnc4-4.1.1+X4.3.0.orig_old/common/network/Makefile.in vnc4-4.1.1+X4.3.0.orig/common/network/Makefile.in +--- vnc4-4.1.1+X4.3.0.orig_old/common/network/Makefile.in 2006-02-22 15:15:16.000000000 +1100 ++++ vnc4-4.1.1+X4.3.0.orig/common/network/Makefile.in 2006-02-22 15:16:24.000000000 +1100 +@@ -17,4 +17,5 @@ + DIR_CFLAGS = -DPIC -fPIC + DIR_CXXFLAGS = -DPIC -fPIC + ++DIR_CXXFLAGS = -DPIC -fPIC + # followed by boilerplate.mk +diff -Naur vnc4-4.1.1+X4.3.0.orig_old/common/network/TcpSocket.cxx vnc4-4.1.1+X4.3.0.orig/common/network/TcpSocket.cxx +--- vnc4-4.1.1+X4.3.0.orig_old/common/network/TcpSocket.cxx 2005-03-12 02:08:41.000000000 +1100 ++++ vnc4-4.1.1+X4.3.0.orig/common/network/TcpSocket.cxx 2006-02-22 15:16:24.000000000 +1100 +@@ -54,6 +54,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; ++} ++ + + // -=- Socket initialisation + static bool socketsInitialised = false; +@@ -117,10 +140,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; + } + + // Disable Nagle's algorithm, to reduce latency +diff -Naur vnc4-4.1.1+X4.3.0.orig_old/common/network/TcpSocket.h vnc4-4.1.1+X4.3.0.orig/common/network/TcpSocket.h +--- vnc4-4.1.1+X4.3.0.orig_old/common/network/TcpSocket.h 2005-03-12 02:08:41.000000000 +1100 ++++ vnc4-4.1.1+X4.3.0.orig/common/network/TcpSocket.h 2006-02-22 15:16:24.000000000 +1100 +@@ -32,8 +32,14 @@ + + #include + ++/* 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); +diff -Naur vnc4-4.1.1+X4.3.0.orig_old/common/rdr/Makefile.in vnc4-4.1.1+X4.3.0.orig/common/rdr/Makefile.in +--- vnc4-4.1.1+X4.3.0.orig_old/common/rdr/Makefile.in 2006-02-22 15:15:16.000000000 +1100 ++++ vnc4-4.1.1+X4.3.0.orig/common/rdr/Makefile.in 2006-02-22 15:16:24.000000000 +1100 +@@ -19,4 +19,5 @@ + DIR_CFLAGS = -DPIC -fPIC + DIR_CXXFLAGS = -DPIC -fPIC + ++DIR_CXXFLAGS = -DPIC -fPIC + # followed by boilerplate.mk +diff -Naur vnc4-4.1.1+X4.3.0.orig_old/common/rfb/Makefile.in vnc4-4.1.1+X4.3.0.orig/common/rfb/Makefile.in +--- vnc4-4.1.1+X4.3.0.orig_old/common/rfb/Makefile.in 2006-02-22 15:15:16.000000000 +1100 ++++ vnc4-4.1.1+X4.3.0.orig/common/rfb/Makefile.in 2006-02-22 15:16:24.000000000 +1100 +@@ -68,4 +68,6 @@ + DIR_CFLAGS = -DPIC -fPIC + DIR_CXXFLAGS = -DPIC -fPIC + ++DIR_CFLAGS = -DPIC -fPIC ++DIR_CXXFLAGS = -DPIC -fPIC + # followed by boilerplate.mk +diff -Naur vnc4-4.1.1+X4.3.0.orig_old/common/rfb/ServerCore.cxx vnc4-4.1.1+X4.3.0.orig/common/rfb/ServerCore.cxx +--- vnc4-4.1.1+X4.3.0.orig_old/common/rfb/ServerCore.cxx 2005-03-12 02:08:41.000000000 +1100 ++++ vnc4-4.1.1+X4.3.0.orig/common/rfb/ServerCore.cxx 2006-02-22 15:16:24.000000000 +1100 +@@ -29,7 +29,7 @@ + ("IdleTimeout", + "The number of seconds after which an idle VNC connection will be dropped " + "(zero means no timeout)", +- 3600, 0); ++ 0, 0); + rfb::IntParameter rfb::Server::clientWaitTimeMillis + ("ClientWaitTimeMillis", + "The number of milliseconds to wait for a client which is no longer " +diff -Naur vnc4-4.1.1+X4.3.0.orig_old/common/Xregion/Makefile.in vnc4-4.1.1+X4.3.0.orig/common/Xregion/Makefile.in +--- vnc4-4.1.1+X4.3.0.orig_old/common/Xregion/Makefile.in 2006-02-22 15:15:16.000000000 +1100 ++++ vnc4-4.1.1+X4.3.0.orig/common/Xregion/Makefile.in 2006-02-22 15:16:24.000000000 +1100 +@@ -15,4 +15,5 @@ + DIR_CFLAGS = -DPIC -fPIC + DIR_CXXFLAGS = -DPIC -fPIC + ++DIR_CFLAGS = -DPIC -fPIC + # followed by boilerplate.mk +diff -Naur vnc4-4.1.1+X4.3.0.orig_old/unix/configure.in vnc4-4.1.1+X4.3.0.orig/unix/configure.in +--- vnc4-4.1.1+X4.3.0.orig_old/unix/configure.in 2005-01-12 03:37:17.000000000 +1100 ++++ vnc4-4.1.1+X4.3.0.orig/unix/configure.in 2006-02-22 15:16:24.000000000 +1100 +@@ -65,6 +65,18 @@ + AC_SUBST(ZLIB_INCLUDE) + AC_SUBST(ZLIB_LIB) + ++AC_ARG_WITH(fb, ++[ --with-fb use the new 'fb' framebuffer implementation]) ++if test "$with_installed_zlib" = yes; then ++ echo "using 'fb' framebuffer" ++ USE_FB=YES ++else ++ echo "using 'mfb' and 'cfb' framebuffer" ++ USE_FB=NO ++fi ++ ++AC_SUBST(USE_FB) ++ + BOILERPLATE=boilerplate.mk + + if (sh -c "make --version" 2>/dev/null | grep GNU 2>&1 >/dev/null); then +@@ -79,4 +91,5 @@ + vncviewer/Makefile:common.mk:vncviewer/Makefile.in:$BOILERPLATE \ + vncconfig/Makefile:common.mk:vncconfig/Makefile.in:$BOILERPLATE \ + vncpasswd/Makefile:common.mk:vncpasswd/Makefile.in:$BOILERPLATE \ ++ xc/config/cf/vnc.def \ + ) +diff -Naur vnc4-4.1.1+X4.3.0.orig_old/unix/vncserver vnc4-4.1.1+X4.3.0.orig/unix/vncserver +--- vnc4-4.1.1+X4.3.0.orig_old/unix/vncserver 2005-02-23 23:28:18.000000000 +1100 ++++ vnc4-4.1.1+X4.3.0.orig/unix/vncserver 2006-02-22 15:16:24.000000000 +1100 +@@ -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". +@@ -116,18 +120,12 @@ + $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); +-} +- +-system("xauth -f $xauthorityFile add $host:$displayNumber . $cookie"); +-system("xauth -f $xauthorityFile add $host/unix:$displayNumber . $cookie"); ++# Make an X server cookie - use mcookie ++$cookie = `/usr/bin/mcookie`; ++open (XAUTH, "|xauth -f $xauthorityFile source -"); ++print XAUTH "add $host:$displayNumber . $cookie\n"; ++print XAUTH "add $host/unix:$displayNumber . $cookie\n"; ++close XAUTH; + + if ($opt{'-name'}) { + $desktopName = $opt{'-name'}; +diff -Naur vnc4-4.1.1+X4.3.0.orig_old/unix/vncviewer/vncviewer.cxx vnc4-4.1.1+X4.3.0.orig/unix/vncviewer/vncviewer.cxx +--- vnc4-4.1.1+X4.3.0.orig_old/unix/vncviewer/vncviewer.cxx 2005-03-12 02:08:41.000000000 +1100 ++++ vnc4-4.1.1+X4.3.0.orig/unix/vncviewer/vncviewer.cxx 2006-02-22 15:16:24.000000000 +1100 +@@ -41,6 +41,7 @@ + + using namespace network; + using namespace rfb; ++using namespace std; + + IntParameter pointerEventInterval("PointerEventInterval", + "Time in milliseconds to rate-limit" +@@ -95,6 +96,9 @@ + StringParameter geometry("geometry", "X geometry specification", ""); + StringParameter displayname("display", "The X display", ""); + ++/* 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 Free Edition 4.1.1 for X - built %s\n" +@@ -190,8 +249,6 @@ + usage(); + } + +- if (vncServerName) +- usage(); + vncServerName = argv[i]; + } + +@@ -207,6 +264,19 @@ + vlog.error("Could not create .vnc directory: environment variable $HOME not set."); + + try { ++ /* 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) { +diff -Naur vnc4-4.1.1+X4.3.0.orig_old/unix/vncviewer/vncviewer.man vnc4-4.1.1+X4.3.0.orig/unix/vncviewer/vncviewer.man +--- vnc4-4.1.1+X4.3.0.orig_old/unix/vncviewer/vncviewer.man 2005-03-04 00:10:40.000000000 +1100 ++++ vnc4-4.1.1+X4.3.0.orig/unix/vncviewer/vncviewer.man 2006-02-22 15:16:24.000000000 +1100 +@@ -174,6 +174,23 @@ + specified as an X11 keysym name (these can be obtained by removing the XK_ + prefix from the entries in "/usr/include/X11/keysymdef.h"). Default is F8. + ++.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 \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 vncpasswd (1), +diff -Naur vnc4-4.1.1+X4.3.0.orig_old/unix/xc/config/cf/vnc.def.in vnc4-4.1.1+X4.3.0.orig/unix/xc/config/cf/vnc.def.in +--- vnc4-4.1.1+X4.3.0.orig_old/unix/xc/config/cf/vnc.def.in 1970-01-01 10:00:00.000000000 +1000 ++++ vnc4-4.1.1+X4.3.0.orig/unix/xc/config/cf/vnc.def.in 2006-02-22 15:16:24.000000000 +1100 +@@ -0,0 +1,38 @@ ++#define BuildServersOnly YES ++#define BuildFonts NO ++#define BuildClients NO ++#define BuildDocs NO ++#define BuildPexExt NO ++#define BuildNls NO ++#define BuildXIE NO ++#define BuildGlxExt NO ++#define XnestServer YES ++#define XF86Server NO ++#define XprtServer NO ++ ++#ifdef SunArchitecture ++#define ProjectRoot /usr/openwin ++#define HasGcc2 YES ++#define BuildXKB NO ++#endif ++ ++#define HasFreetype2 NO ++#define BuildVNCExt YES ++#define VNCExtDefines -DVNCEXT ++#define SiteExtensionDefines VNCExtDefines ++#define SiteExtensionDirs vnc ++ ++#define VncUseFb @USE_FB@ ++ ++#define VncUnixDir $(TOP)/.. ++#define VncCommonDir VncUnixDir/../common ++#define VncExtLibs VncCommonDir/rfb/librfb.a \ ++ VncCommonDir/Xregion/libXregion.a \ ++ VncCommonDir/network/libnetwork.a \ ++ VncCommonDir/rdr/librdr.a ++ ++#define SiteExtensionLibs vnc/LibraryTargetName(vnc) VncExtLibs ++ ++#define ServerTarget(server,subdirs,objects,libs,syslibs) @@\ ++CCLINK = $(CXXENVSETUP) $(CXX) @@\ ++ServerTargetWithFlags(server,subdirs,objects,libs,syslibs,$(_NOOP_)) +diff -Naur vnc4-4.1.1+X4.3.0.orig_old/unix/xc/programs/Xserver/vnc/Imakefile vnc4-4.1.1+X4.3.0.orig/unix/xc/programs/Xserver/vnc/Imakefile +--- vnc4-4.1.1+X4.3.0.orig_old/unix/xc/programs/Xserver/vnc/Imakefile 2004-07-14 03:21:33.000000000 +1000 ++++ vnc4-4.1.1+X4.3.0.orig/unix/xc/programs/Xserver/vnc/Imakefile 2006-02-22 15:16:24.000000000 +1100 +@@ -19,7 +19,7 @@ + SRCS = vncExtInit.cc vncHooks.cc XserverDesktop.cc + OBJS = vncExtInit.o vncHooks.o XserverDesktop.o + INCLUDES = -I../include -I$(EXTINCSRC) -I$(XINCLUDESRC) -I$(FONTINCSRC) \ +- -I../mfb -I../mi $(VNCINCLUDE) ++ -I../render $(VNCINCLUDE) + #if defined(XFree86Version) && XFree86Version >= 4000 + VNCDEFINES = -DGC_HAS_COMPOSITE_CLIP + #endif +@@ -36,8 +36,8 @@ + NormalLintTarget($(SRCS)) + + NormalLibraryObjectRule() +-NormalCplusplusObjectRule() +- ++.CCsuf.Osuf: ++ NormalSharedLibObjCplusplusCompile($(_NOOP_)) + + MakeSubdirs($(SUBDIRS)) + DependSubdirs($(SUBDIRS)) +diff -Naur vnc4-4.1.1+X4.3.0.orig_old/unix/xc/programs/Xserver/vnc/module/Imakefile vnc4-4.1.1+X4.3.0.orig/unix/xc/programs/Xserver/vnc/module/Imakefile +--- vnc4-4.1.1+X4.3.0.orig_old/unix/xc/programs/Xserver/vnc/module/Imakefile 2006-02-22 15:15:16.000000000 +1100 ++++ vnc4-4.1.1+X4.3.0.orig/unix/xc/programs/Xserver/vnc/module/Imakefile 2006-02-22 15:16:24.000000000 +1100 +@@ -13,7 +13,7 @@ + OBJS = vncExtInit.o vncHooks.o xf86vncModule.o XserverDesktop.o + INCLUDES = -I.. -I../../include -I$(EXTINCSRC) -I$(XINCLUDESRC) \ + -I$(FONTINCSRC) -I$(XF86COMSRC) \ +- $(VNCINCLUDE) ++ -I../../render $(VNCINCLUDE) + DEFINES = -fPIC $(STD_DEFINES) -DGC_HAS_COMPOSITE_CLIP -DXFree86LOADER + + LinkSourceFile(vncExtInit.cc,..) +@@ -21,7 +21,8 @@ + LinkSourceFile(xf86vncModule.cc,..) + LinkSourceFile(XserverDesktop.cc,..) + +-ModuleObjectRule() ++.CCsuf.Osuf: ++ NormalSharedLibObjCplusplusCompile($(_NOOP_)) + /* + LibraryModuleTarget(vnc,$(OBJS) $(VNCLIBS)) + InstallLibraryModule(vnc,$(MODULEDIR),extensions) +diff -Naur vnc4-4.1.1+X4.3.0.orig_old/unix/xc/programs/Xserver/vnc/vncHooks.cc vnc4-4.1.1+X4.3.0.orig/unix/xc/programs/Xserver/vnc/vncHooks.cc +--- vnc4-4.1.1+X4.3.0.orig_old/unix/xc/programs/Xserver/vnc/vncHooks.cc 2005-03-12 02:08:41.000000000 +1100 ++++ vnc4-4.1.1+X4.3.0.orig/unix/xc/programs/Xserver/vnc/vncHooks.cc 2006-02-22 15:16:24.000000000 +1100 +@@ -29,6 +29,9 @@ + #include "regionstr.h" + #include "dixfontstr.h" + #include "colormapst.h" ++#ifdef RENDER ++#include "picturestr.h" ++#endif + + #ifdef GC_HAS_COMPOSITE_CLIP + #define COMPOSITE_CLIP(gc) ((gc)->pCompositeClip) +@@ -74,6 +77,9 @@ + StoreColorsProcPtr StoreColors; + DisplayCursorProcPtr DisplayCursor; + ScreenBlockHandlerProcPtr BlockHandler; ++#ifdef RENDER ++ CompositeProcPtr Composite; ++#endif + } vncHooksScreenRec, *vncHooksScreenPtr; + + typedef struct { +@@ -104,6 +110,13 @@ + static Bool vncHooksDisplayCursor(ScreenPtr pScreen, CursorPtr cursor); + static void vncHooksBlockHandler(int i, pointer blockData, pointer pTimeout, + pointer pReadmask); ++#ifdef RENDER ++static void vncHooksComposite(CARD8 op, PicturePtr pSrc, PicturePtr pMask, ++ PicturePtr pDst, INT16 xSrc, INT16 ySrc, ++ INT16 xMask, INT16 yMask, INT16 xDst, INT16 yDst, ++ CARD16 width, CARD16 height); ++#endif ++ + + // GC "funcs" + +@@ -229,6 +242,13 @@ + vncHooksScreen->StoreColors = pScreen->StoreColors; + vncHooksScreen->DisplayCursor = pScreen->DisplayCursor; + vncHooksScreen->BlockHandler = pScreen->BlockHandler; ++#ifdef RENDER ++ PictureScreenPtr ps; ++ ps = GetPictureScreenIfSet(pScreen); ++ if (ps) { ++ vncHooksScreen->Composite = ps->Composite; ++ } ++#endif + + pScreen->CloseScreen = vncHooksCloseScreen; + pScreen->CreateGC = vncHooksCreateGC; +@@ -241,6 +261,11 @@ + pScreen->StoreColors = vncHooksStoreColors; + pScreen->DisplayCursor = vncHooksDisplayCursor; + pScreen->BlockHandler = vncHooksBlockHandler; ++#ifdef RENDER ++ if (ps) { ++ ps->Composite = vncHooksComposite; ++ } ++#endif + + return TRUE; + } +@@ -470,6 +495,38 @@ + SCREEN_REWRAP(BlockHandler); + } + ++// Composite - needed for RENDER ++ ++#ifdef RENDER ++void vncHooksComposite(CARD8 op, PicturePtr pSrc, PicturePtr pMask, ++ PicturePtr pDst, INT16 xSrc, INT16 ySrc, INT16 xMask, ++ INT16 yMask, INT16 xDst, INT16 yDst, CARD16 width, ++ CARD16 height) ++{ ++ ScreenPtr pScreen = pDst->pDrawable->pScreen; ++ vncHooksScreenPtr vncHooksScreen = \ ++ ((vncHooksScreenPtr)pScreen->devPrivates[vncHooksScreenIndex].ptr); ++ BoxRec box; ++ PictureScreenPtr ps = GetPictureScreen(pScreen); ++ ++ if ((xDst >= 0) && (yDst >= 0)) { ++ box.x1 = pDst->pDrawable->x + xDst; ++ box.y1 = pDst->pDrawable->y + yDst; ++ box.x2 = box.x1 + width; ++ box.y2 = box.y1 + height; ++ ++ RegionHelper changed(pScreen, &box, 0); ++ vncHooksScreen->desktop->add_changed(changed.reg); ++ } ++ ++ ps->Composite = vncHooksScreen->Composite; ++ (*ps->Composite)(op, pSrc, pMask, pDst, xSrc, ySrc, ++ xMask, yMask, xDst, yDst, width, height); ++ ps->Composite = vncHooksComposite; ++} ++ ++#endif /* RENDER */ ++ + + + ///////////////////////////////////////////////////////////////////////////// +diff -Naur vnc4-4.1.1+X4.3.0.orig_old/unix/xc/programs/Xserver/vnc/Xvnc/Imakefile vnc4-4.1.1+X4.3.0.orig/unix/xc/programs/Xserver/vnc/Xvnc/Imakefile +--- vnc4-4.1.1+X4.3.0.orig_old/unix/xc/programs/Xserver/vnc/Xvnc/Imakefile 2005-03-11 01:51:39.000000000 +1100 ++++ vnc4-4.1.1+X4.3.0.orig/unix/xc/programs/Xserver/vnc/Xvnc/Imakefile 2006-02-22 15:16:24.000000000 +1100 +@@ -31,12 +31,19 @@ + OBJS1 = os2_stubs.o + #endif + ++#ifdef VncUseFb ++FB_DEFINES = -DVNC_USE_FB ++ FBINCLUDE = -I../../fb ++#else ++ FBINCLUDE = -I../../cfb ++#endif ++ + SRCSA = xvnc.cc stubs.c $(SRCS1) miinitext.c $(SRCS2) + + OBJSA = xvnc.o stubs.o $(OBJS1) miinitext.o $(OBJS2) + +-INCLUDES = -I. -I.. -I$(XBUILDINCDIR) -I$(FONTINCSRC) \ +- -I../../cfb -I../../mfb -I../../mi -I../../include -I../../os \ ++INCLUDES = -I. -I.. -I$(XBUILDINCDIR) -I$(FONTINCSRC) $(FB_DEFINES) \ ++ $(FBINCLUDE) -I../../mfb -I../../mi -I../../include -I../../os \ + -I$(EXTINCSRC) -I$(XINCLUDESRC) -I$(SERVERSRC)/render $(VNCINCLUDE) + + DEFINES = $(OS_DEFINES) $(SHMDEF) $(MMAPDEF) \ +@@ -48,7 +55,7 @@ + * Make sure XINPUT, XF86VidTune, etc arent defined for the miinitext.o + * used by Xvnc + */ +-EXT_DEFINES = ExtensionDefines -UXF86VIDMODE -UXFreeXDGA -UXF86MISC ++EXT_DEFINES = ExtensionDefines -UXINPUT -UXF86VIDMODE -UXFreeXDGA -UXF86MISC + #endif + + +@@ -70,7 +77,7 @@ + SpecialCplusplusObjectRule(xvnc,$(ICONFIGFILES) xvnc,$(EXT_DEFINES) $(NO_OPERATOR_NAMES)) + + LinkSourceFile(miinitext.c,$(SERVERSRC)/mi) +-SpecialCObjectRule(miinitext,$(ICONFIGFILES),$(EXT_DEFINES) $(PAN_DEFINES) -DNO_MODULE_EXTS $(EXT_MODULE_DEFINES) -UXFree86LOADER) ++SpecialCObjectRule(miinitext,$(ICONFIGFILES),$(EXT_DEFINES) $(PAN_DEFINES) -DNO_HW_ONLY_EXTS -DNO_MODULE_EXTS $(EXT_MODULE_DEFINES) -UXFree86LOADER) + + /* InstallManPage(Xvfb,$(MANDIR)) */ + DependTarget() +diff -Naur vnc4-4.1.1+X4.3.0.orig_old/unix/xc/programs/Xserver/vnc/Xvnc/xvnc.cc vnc4-4.1.1+X4.3.0.orig/unix/xc/programs/Xserver/vnc/Xvnc/xvnc.cc +--- vnc4-4.1.1+X4.3.0.orig_old/unix/xc/programs/Xserver/vnc/Xvnc/xvnc.cc 2005-03-11 02:52:58.000000000 +1100 ++++ vnc4-4.1.1+X4.3.0.orig/unix/xc/programs/Xserver/vnc/Xvnc/xvnc.cc 2006-02-22 15:16:24.000000000 +1100 +@@ -48,8 +48,12 @@ + #include "X11/Xos.h" + #include "scrnintstr.h" + #include "servermd.h" ++#ifdef VNC_USE_FB ++#include "fb.h" ++#else + #define PSZ 8 + #include "cfb.h" ++#endif + #include "mi.h" + #include "mibstore.h" + #include "colormapst.h" +@@ -73,6 +77,7 @@ + #undef public + #undef xor + #undef and ++#ifndef VNC_USE_FB + extern Bool cfb16ScreenInit(ScreenPtr, pointer, int, int, int, int, int); + extern Bool cfb32ScreenInit(ScreenPtr, pointer, int, int, int, int, int); + extern Bool cfb16CreateGC(GCPtr); +@@ -83,6 +88,7 @@ + unsigned long, char*); + extern void cfb32GetImage(DrawablePtr, int, int, int, int, unsigned int, + unsigned long, char*); ++#endif + } + + #define XVNCVERSION "Free Edition 4.1.1" +@@ -129,6 +135,9 @@ + static Bool vfbPixmapDepths[33]; + static char needswap = 0; + static int lastScreen = -1; ++#ifdef RENDER ++static Bool Render = FALSE; ++#endif + + static bool displaySpecified = false; + static bool wellKnownSocketsCreated = false; +@@ -220,6 +229,10 @@ + VENDOR_STRING); + ErrorF("-screen scrn WxHxD set screen's width, height, depth\n"); + ErrorF("-pixdepths list-of-int support given pixmap depths\n"); ++#ifdef RENDER ++ ErrorF("+/-render turn on/off RENDER extension support" ++ "(default on)\n"); ++#endif + ErrorF("-linebias n adjust thin line pixelization\n"); + ErrorF("-blackpixel n pixel value for black\n"); + ErrorF("-whitepixel n pixel value for white\n"); +@@ -316,6 +329,20 @@ + return ret; + } + ++#ifdef RENDER ++ if (strcmp (argv[i], "+render") == 0) /* +render */ ++ { ++ Render = TRUE; ++ return 1; ++ } ++ ++ if (strcmp (argv[i], "-render") == 0) /* -render */ ++ { ++ Render = FALSE; ++ return 1; ++ } ++#endif ++ + if (strcmp (argv[i], "-blackpixel") == 0) /* -blackpixel n */ + { + Pixel pix; +@@ -482,7 +509,7 @@ + } + #endif + +- ++#ifndef VNC_USE_FB + static Bool vfbMultiDepthCreateGC(GCPtr pGC) + { + switch (vfbBitsPerPixel(pGC->depth)) +@@ -541,6 +568,7 @@ + break; + } + } ++#endif + + static ColormapPtr InstalledMaps[MAXSCREENS]; + +@@ -811,6 +839,16 @@ + defaultColorVisualClass + = (pvfb->bitsPerPixel > 8) ? TrueColor : PseudoColor; + ++#ifdef VNC_USE_FB ++ if (!fbScreenInit(pScreen, pbits, pvfb->width, pvfb->height, ++ dpi, dpi, pvfb->paddedWidth, pvfb->bitsPerPixel)) ++ return FALSE; ++ ++#ifdef RENDER ++ if (ret && Render) ++ fbPictureInit(pScreen, 0, 0); ++#endif /* RENDER */ ++#else /* VNC_USE_FB */ + switch (pvfb->bitsPerPixel) + { + case 1: +@@ -838,6 +876,7 @@ + pScreen->CreateGC = vfbMultiDepthCreateGC; + pScreen->GetImage = vfbMultiDepthGetImage; + pScreen->GetSpans = vfbMultiDepthGetSpans; ++#endif + + pScreen->InstallColormap = vfbInstallColormap; + pScreen->UninstallColormap = vfbUninstallColormap; +@@ -883,6 +922,9 @@ + } + } + ++#ifdef VNC_USE_FB ++ ret = fbCreateDefColormap(pScreen); ++#else + if (pvfb->bitsPerPixel == 1) + { + ret = mfbCreateDefColormap(pScreen); +@@ -891,6 +933,7 @@ + { + ret = cfbCreateDefColormap(pScreen); + } ++#endif + + miSetZeroLineBias(pScreen, pvfb->lineBias); + +@@ -926,6 +969,19 @@ + vfbPixmapDepths[vfbScreens[i].depth] = TRUE; + } + ++#ifdef RENDER ++ /* RENDER needs a good set of pixmaps. */ ++ if (Render) { ++ vfbPixmapDepths[1] = TRUE; ++ vfbPixmapDepths[4] = TRUE; ++ vfbPixmapDepths[8] = TRUE; ++/* vfbPixmapDepths[15] = TRUE; */ ++ vfbPixmapDepths[16] = TRUE; ++ vfbPixmapDepths[24] = TRUE; ++ vfbPixmapDepths[32] = TRUE; ++ } ++#endif ++ + for (i = 1; i <= 32; i++) + { + if (vfbPixmapDepths[i]) +diff -Naur vnc4-4.1.1+X4.3.0.orig_old/unix/xc.patch vnc4-4.1.1+X4.3.0.orig/unix/xc.patch +--- vnc4-4.1.1+X4.3.0.orig_old/unix/xc.patch 2004-12-01 22:33:15.000000000 +1100 ++++ vnc4-4.1.1+X4.3.0.orig/unix/xc.patch 2006-02-22 15:16:24.000000000 +1100 +@@ -2,7 +2,7 @@ + --- xc/programs/Xserver/Imakefile Fri Jun 6 11:14:39 2003 + *************** + *** 409,412 **** +---- 409,429 ---- ++--- 409,435 ---- + #endif + #endif /* XsunServer */ + + XCOMM +@@ -13,12 +13,18 @@ + + CFB16DIR = cfb16 + + CFB24DIR = cfb24 + + CFB32DIR = cfb32 +++ FBDIR = fb + + XVNCDDXDIR = vnc/Xvnc +++ #if VncUseFb +++ XVNCDIRS = $(STDDIRS) $(FBDIR) $(XVNCDDXDIR) $(DEPDIRS) +++ XVNCLIBS = PreFbLibs vnc/Xvnc/LibraryTargetName(xvnc) FbPostFbLibs +++ #else + + XVNCDIRS = $(STDDIRS) $(MFBDIR) \ + + $(CFB8DIR) $(CFB16DIR) $(CFB24DIR) $(CFB32DIR) \ + + $(XVNCDDXDIR) $(DEPDIRS) +-+ XVNCOBJS = $(XVNCDDXDIR)/stubs.o $(XVNCDDXDIR)/miinitext.o + + XVNCLIBS = PreFbLibs vnc/Xvnc/LibraryTargetName(xvnc) CFBLibs PostFbLibs +++ #endif +++ XVNCOBJS = $(XVNCDDXDIR)/stubs.o $(XVNCDDXDIR)/miinitext.o + + XVNCSYSLIBS = $(FONTLIBS) $(SYSLIBS) + + ServerTarget(Xvnc,$(XVNCDIRS),$(XVNCOBJS), \ + + $(LIBCWRAPPER) $(XVNCLIBS) $(LOADABLEEXTS),$(XVNCSYSLIBS)) --- vnc4-4.1.1+xorg4.3.0.orig/debian/patches/vnc-4.0-x0vncserver-localhost.patch +++ vnc4-4.1.1+xorg4.3.0/debian/patches/vnc-4.0-x0vncserver-localhost.patch @@ -0,0 +1,34 @@ +From: Hein Roehrig + +Here is a patch to have the -localhost option in the x0vncserver +command as well... important when trying to secure the VNC connection +via ssh. + +Thanks, +Hein + +--- vnc4-4.0/x0vncserver/x0vncserver.cxx.~1~ 2004-10-23 10:59:42.000000000 -0600 ++++ vnc4-4.0/x0vncserver/x0vncserver.cxx 2004-10-23 11:48:41.000000000 -0600 +@@ -47,6 +47,9 @@ + StringParameter displayname("display", "The X display", ""); + IntParameter rfbport("rfbport", "TCP port to listen for RFB protocol",5900); + VncAuthPasswdFileParameter vncAuthPasswdFile; ++BoolParameter localhostOnly("localhost", ++ "Only allow connections from localhost", ++ false); + + static void CleanupSignalHandler(int sig) + { +@@ -230,7 +233,7 @@ + desktop.setVNCServer(&server); + + TcpSocket::initTcpSockets(); +- TcpListener listener((int)rfbport); ++ TcpListener listener((int)rfbport, localhostOnly); + vlog.info("Listening on port %d", (int)rfbport); + + while (true) { + + + + --- vnc4-4.1.1+xorg4.3.0.orig/debian/patches/vnc-CVE-2008-4770.diff +++ vnc4-4.1.1+xorg4.3.0/debian/patches/vnc-CVE-2008-4770.diff @@ -0,0 +1,11 @@ +--- common/rfb/CMsgReader.cxx.orig 2006-05-15 18:56:20.000000000 +0200 ++++ common/rfb/CMsgReader.cxx 2008-10-16 17:16:20.000000000 +0200 +@@ -99,6 +99,8 @@ void CMsgReader::readRect(const Rect& r, + if (encoding == encodingCopyRect) { + readCopyRect(r); + } else { ++ if (encoding > encodingMax) ++ throw Exception("Unknown rect encoding"); + if (!decoders[encoding]) { + decoders[encoding] = Decoder::createDecoder(encoding, this); + if (!decoders[encoding]) { --- vnc4-4.1.1+xorg4.3.0.orig/debian/patches/vnc-vnconnect-on-x86_64.patch +++ vnc4-4.1.1+xorg4.3.0/debian/patches/vnc-vnconnect-on-x86_64.patch @@ -0,0 +1,19 @@ +--- vnc-4_1_2-unixsrc/unix/xc/programs/Xserver/vnc/vncExtInit.cc.vnconnect-on-x86_64 2006-08-01 19:04:17.000000000 +0100 ++++ vnc-4_1_2-unixsrc/unix/xc/programs/Xserver/vnc/vncExtInit.cc 2006-08-01 18:59:22.000000000 +0100 +@@ -18,6 +18,8 @@ + + #include + ++#include "XserverDesktop.h" ++ + extern "C" { + #define class c_class + #define NEED_EVENTS +@@ -48,7 +50,6 @@ + #undef min + #include + +-#include "XserverDesktop.h" + #include "vncHooks.h" + #include "vncExtInit.h" + --- vnc4-4.1.1+xorg4.3.0.orig/debian/patches/vnc4-4.1.1+X4.3.0+572678.patch +++ vnc4-4.1.1+xorg4.3.0/debian/patches/vnc4-4.1.1+X4.3.0+572678.patch @@ -0,0 +1,27 @@ +diff -ur vnc4-4.1.1+X4.3.0/unix/xc/programs/Xserver/vnc/Xvnc/xvnc.cc vnc4-4.1.1+X4.3.0+572678/unix/xc/programs/Xserver/vnc/Xvnc/xvnc.cc +--- vnc4-4.1.1+X4.3.0/unix/xc/programs/Xserver/vnc/Xvnc/xvnc.cc 2010-03-10 12:54:58.000000000 -0400 ++++ vnc4-4.1.1+X4.3.0+572678/unix/xc/programs/Xserver/vnc/Xvnc/xvnc.cc 2010-03-10 14:23:31.000000000 -0400 +@@ -889,7 +889,8 @@ + + pSize = RRRegisterSize(pScreen, + pvfb->rrScreenSizes[i].width, pvfb->rrScreenSizes[i].height, +- pScreen->mmWidth, pScreen->mmHeight); ++ (pvfb->rrScreenSizes[i].width * 254 + dpi * 5) / (dpi * 10), ++ (pvfb->rrScreenSizes[i].height * 254 + dpi * 5) / (dpi * 10)); + if (!pSize) + return FALSE; + RRRegisterRate(pScreen, pSize, 60); +@@ -1046,8 +1047,13 @@ + static Bool vncRandRSetConfig (ScreenPtr pScreen, Rotation rotation, + int rate, RRScreenSizePtr pSize) + { ++ int dpi = monitorResolution ? monitorResolution : 100; ++ + pScreen->width = pSize->width; + pScreen->height = pSize->height; ++ pScreen->mmWidth = (pScreen->width * 254 + dpi * 5) / (dpi * 10); ++ pScreen->mmHeight = (pScreen->height * 254 + dpi * 5) / (dpi * 10); ++ + xf86SetRootClip(pScreen, TRUE); + vncHooksResizeScreen(pScreen); + return TRUE; --- vnc4-4.1.1+xorg4.3.0.orig/debian/patches/vnc4-build-ppc.patch +++ vnc4-4.1.1+xorg4.3.0/debian/patches/vnc4-build-ppc.patch @@ -0,0 +1,45 @@ +Package: vnc4 +Version: 4.1.1+X4.3.0-6 +Severity: wishlist +Tags: patch + +When building 'vnc4' on ppc64/unstable, I get the following error: + +gcc -O2 -fsigned-char -fno-merge-constants -I../../../programs/Xserver/fb -I../../../programs/Xserver/mi -I../../../programs/Xserver/include -I../../../exports/include/X11 -I../../../include/fonts -I../../../programs/Xserver/hw/xfree86/common -I../../../programs/Xserver/render -I../../../include/extensions -I../../../programs/Xserver/Xext -I../../.. -I../../../exports/include -I/usr/X11R6/include -Dlinux -D__powerpc__ -D_POSIX_C_SOURCE=199309L -D_POSIX_SOURCE -D_XOPEN_SOURCE -D_BSD_SOURCE -D_SVID_SOURCE -D_GNU_SOURCE -DSHAPE -DXINPUT -DXKB -DLBX -DXAPPGROUP -DXCSECURITY -DTOGCUP -DXF86BIGFONT -DDPMSExtension -DPANORAMIX -DRENDER -DRANDR -DGCCUSESGAS -DAVOID_GLYPHBLT -DPIXPRIV -DSINGLEDEPTH -DXFreeXDGA -DXvExtension -DXFree86LOADER -DXFree86Server -DXF86VIDMODE -DXvMCExtension -DSMART_SCHEDULE -DBUILDDEBUG -DXResExtension -DX_BYTE_ORDER=X_BIG_ENDIAN -DNDEBUG -DFUNCPROTO=15 -DNARROWPROTO -DIN_MODULE -DXFree86Module -c fbblt.c +fbblt.c: In function 'fbBlt': +fbblt.c:136: error: duplicate case value + +With the attached patch 'vnc4' can be compiled on ppc64. + +Regards +Andreas Jochens + +diff -urN ../tmp-orig/vnc4-4.1.1+X4.3.0/unix/xc/config/cf/linux.cf ./unix/xc/config/cf/linux.cf +--- ../tmp-orig/vnc4-4.1.1+X4.3.0/unix/xc/config/cf/linux.cf 2006-04-21 11:53:04.000000000 +0000 ++++ ./unix/xc/config/cf/linux.cf 2006-04-21 09:02:32.000000000 +0000 +@@ -818,7 +818,11 @@ + # endif + # define LinuxMachineDefines -D__powerpc__ + # define ServerOSDefines XFree86ServerOSDefines -DDDXTIME -DPART_NET ++# ifdef __powerpc64__ ++# define ServerExtraDefines -DGCCUSESGAS XFree86ServerDefines -D_XSERVER64 ++# else + # define ServerExtraDefines -DGCCUSESGAS XFree86ServerDefines ++# endif + #endif /* PpcArchitecture */ + + #ifdef s390Architecture +diff -urN ../tmp-orig/vnc4-4.1.1+X4.3.0/unix/xc/include/Xmd.h ./unix/xc/include/Xmd.h +--- ../tmp-orig/vnc4-4.1.1+X4.3.0/unix/xc/include/Xmd.h 2002-05-31 18:45:39.000000000 +0000 ++++ ./unix/xc/include/Xmd.h 2006-04-21 10:18:20.000000000 +0000 +@@ -60,7 +60,7 @@ + #endif + #if defined(__alpha) || defined(__alpha__) || \ + defined(__ia64__) || defined(ia64) || \ +- defined(__sparc64__) || \ ++ defined(__sparc64__) || defined(__powerpc64__) || \ + defined(__s390x__) || \ + (defined(__hppa__) && defined(__LP64__)) || \ + defined(__x86_64__) || defined(x86_64) + + --- vnc4-4.1.1+xorg4.3.0.orig/debian/patches/vnc4-passwd-jkohen.patch +++ vnc4-4.1.1+xorg4.3.0/debian/patches/vnc4-passwd-jkohen.patch @@ -0,0 +1,22 @@ +--- common/rfb/Password.cxx~ 2005-03-11 12:08:41.000000000 -0300 ++++ common/rfb/Password.cxx 2006-03-09 16:09:13.000000000 -0300 +@@ -35,6 +35,9 @@ + + PlainPasswd::PlainPasswd() {} + ++PlainPasswd::PlainPasswd(int len) : CharArray(len) { ++} ++ + PlainPasswd::PlainPasswd(char* pwd) : CharArray(pwd) { + } + +--- common/rfb/Password.h~ 2005-03-11 12:08:41.000000000 -0300 ++++ common/rfb/Password.h 2006-03-09 16:08:55.000000000 -0300 +@@ -27,6 +27,7 @@ + class PlainPasswd : public CharArray { + public: + PlainPasswd(); ++ PlainPasswd(int l); + PlainPasswd(char* pwd); + PlainPasswd(const ObfuscatedPasswd& obfPwd); + ~PlainPasswd(); --- vnc4-4.1.1+xorg4.3.0.orig/debian/patches/vnc4server-fix-100-percent-cpu-hang-in-inetd-mode.patch +++ vnc4-4.1.1+xorg4.3.0/debian/patches/vnc4server-fix-100-percent-cpu-hang-in-inetd-mode.patch @@ -0,0 +1,112 @@ +diff -u vnc4-4.1.1+xorg4.3.0/common/network/TcpSocket.h vnc4-4.1.1+xorg4.3.0/common/network/TcpSocket.h +--- vnc4-4.1.1+xorg4.3.0/common/network/TcpSocket.h ++++ vnc4-4.1.1+xorg4.3.0/common/network/TcpSocket.h +@@ -59,8 +59,7 @@ + virtual void shutdown(); + + static bool enableNagles(int sock, bool enable); +- static bool isSocket(int sock); +- static bool isConnected(int sock); ++ static bool isListening(int sock); + static int getSockPort(int sock); + private: + bool closeFd; +diff -u vnc4-4.1.1+xorg4.3.0/common/network/TcpSocket.cxx vnc4-4.1.1+xorg4.3.0/common/network/TcpSocket.cxx +--- vnc4-4.1.1+xorg4.3.0/common/network/TcpSocket.cxx ++++ vnc4-4.1.1+xorg4.3.0/common/network/TcpSocket.cxx +@@ -282,18 +282,12 @@ + return true; + } + +-bool TcpSocket::isSocket(int sock) ++bool TcpSocket::isListening(int sock) + { +- struct sockaddr_in info; +- VNC_SOCKLEN_T info_size = sizeof(info); +- return getsockname(sock, (struct sockaddr *)&info, &info_size) >= 0; +-} +- +-bool TcpSocket::isConnected(int sock) +-{ +- struct sockaddr_in info; +- VNC_SOCKLEN_T info_size = sizeof(info); +- return getpeername(sock, (struct sockaddr *)&info, &info_size) >= 0; ++ int listening = 0; ++ VNC_SOCKLEN_T listening_size = sizeof(listening); ++ return getsockopt(sock, SOL_SOCKET, SO_ACCEPTCONN, &listening, ++ &listening_size) >= 0 && listening; + } + + int TcpSocket::getSockPort(int sock) +diff -u vnc4-4.1.1+xorg4.3.0/unix/xc/programs/Xserver/vnc/vncExtInit.cc vnc4-4.1.1+xorg4.3.0/unix/xc/programs/Xserver/vnc/vncExtInit.cc +--- vnc4-4.1.1+xorg4.3.0/unix/xc/programs/Xserver/vnc/vncExtInit.cc ++++ vnc4-4.1.1+xorg4.3.0/unix/xc/programs/Xserver/vnc/vncExtInit.cc +@@ -160,8 +160,7 @@ + network::TcpListener* listener = 0; + network::TcpListener* httpListener = 0; + if (scr == 0 && vncInetdSock != -1) { +- if (network::TcpSocket::isSocket(vncInetdSock) && +- !network::TcpSocket::isConnected(vncInetdSock)) ++ if (network::TcpSocket::isListening(vncInetdSock)) + { + listener = new network::TcpListener(0, 0, vncInetdSock, true); + vlog.info("inetd wait"); + +only in patch2: +unchanged: +--- vnc4-4.1.1+xorg4.3.0.orig/debian/patches/fix-100-percent-cpu-hang-in-inetd-mode.patch ++++ vnc4-4.1.1+xorg4.3.0/debian/patches/fix-100-percent-cpu-hang-in-inetd-mode.patch +@@ -0,0 +1,53 @@ ++diff -ur vnc4-4.1.1+xorg4.3.0/common/network/TcpSocket.cxx vnc4-4.1.1+xorg4.3.0.new/common/network/TcpSocket.cxx ++--- vnc4-4.1.1+xorg4.3.0/common/network/TcpSocket.cxx 2011-09-02 13:30:44.000000000 -0700 +++++ vnc4-4.1.1+xorg4.3.0.new/common/network/TcpSocket.cxx 2011-09-01 18:17:07.074243662 -0700 ++@@ -282,18 +282,12 @@ ++ return true; ++ } ++ ++-bool TcpSocket::isSocket(int sock) +++bool TcpSocket::isListening(int sock) ++ { ++- struct sockaddr_in info; ++- VNC_SOCKLEN_T info_size = sizeof(info); ++- return getsockname(sock, (struct sockaddr *)&info, &info_size) >= 0; ++-} ++- ++-bool TcpSocket::isConnected(int sock) ++-{ ++- struct sockaddr_in info; ++- VNC_SOCKLEN_T info_size = sizeof(info); ++- return getpeername(sock, (struct sockaddr *)&info, &info_size) >= 0; +++ int listening = 0; +++ VNC_SOCKLEN_T listening_size = sizeof(listening); +++ return getsockopt(sock, SOL_SOCKET, SO_ACCEPTCONN, &listening, +++ &listening_size) >= 0 && listening; ++ } ++ ++ int TcpSocket::getSockPort(int sock) ++diff -ur vnc4-4.1.1+xorg4.3.0/common/network/TcpSocket.h vnc4-4.1.1+xorg4.3.0.new/common/network/TcpSocket.h ++--- vnc4-4.1.1+xorg4.3.0/common/network/TcpSocket.h 2011-09-02 13:30:44.000000000 -0700 +++++ vnc4-4.1.1+xorg4.3.0.new/common/network/TcpSocket.h 2011-09-01 18:17:25.524243654 -0700 ++@@ -59,8 +59,7 @@ ++ virtual void shutdown(); ++ ++ static bool enableNagles(int sock, bool enable); ++- static bool isSocket(int sock); ++- static bool isConnected(int sock); +++ static bool isListening(int sock); ++ static int getSockPort(int sock); ++ private: ++ bool closeFd; ++diff -ur vnc4-4.1.1+xorg4.3.0/unix/xc/programs/Xserver/vnc/vncExtInit.cc vnc4-4.1.1+xorg4.3.0.new/unix/xc/programs/Xserver/vnc/vncExtInit.cc ++--- vnc4-4.1.1+xorg4.3.0/unix/xc/programs/Xserver/vnc/vncExtInit.cc 2011-09-02 13:30:44.000000000 -0700 +++++ vnc4-4.1.1+xorg4.3.0.new/unix/xc/programs/Xserver/vnc/vncExtInit.cc 2011-09-01 18:15:50.874243690 -0700 ++@@ -160,8 +160,7 @@ ++ network::TcpListener* listener = 0; ++ network::TcpListener* httpListener = 0; ++ if (scr == 0 && vncInetdSock != -1) { ++- if (network::TcpSocket::isSocket(vncInetdSock) && ++- !network::TcpSocket::isConnected(vncInetdSock)) +++ if (network::TcpSocket::isListening(vncInetdSock)) ++ { ++ listener = new network::TcpListener(0, 0, vncInetdSock, true); ++ vlog.info("inetd wait"); --- vnc4-4.1.1+xorg4.3.0.orig/debian/patches/vncserver +++ vnc4-4.1.1+xorg4.3.0/debian/patches/vncserver @@ -0,0 +1,570 @@ +#!/usr/bin/perl +# +# Copyright (C) 2002-2003 RealVNC Ltd. +# Copyright (C) 1999 AT&T Laboratories Cambridge. All Rights Reserved. +# +# This 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 software 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 software; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, +# USA. +# + +# +# vncserver - wrapper script to start an X VNC server. +# + +# +# First make sure we're operating in a sane environment. +# + +&SanityCheck(); + +# +# Global variables. You may want to configure some of these for your site. +# + +$geometry = "1024x768"; +$depth = 16; +$vncJavaFiles = (((-d "/usr/share/vnc/classes") && "/usr/share/vnc/classes") || + ((-d "/usr/local/vnc/classes") && "/usr/local/vnc/classes")); +$vncUserDir = "$ENV{HOME}/.vnc"; +$xauthorityFile = "$ENV{XAUTHORITY}" || "$ENV{HOME}/.Xauthority"; + +$defaultXStartup + = ("#!/bin/sh\n\n". + "[ -r \$HOME/.Xresources ] && xrdb \$HOME/.Xresources\n". + "xsetroot -solid grey\n". + "vncconfig -iconic &\n". + "x-terminal-emulator -geometry 80x24+10+10 -ls -title \"\$VNCDESKTOP Desktop\" &\n". + "x-window-manager &\n"); + +chop($host = `uname -n`); + + +# Check command line options + +&ParseOptions("-geometry",1,"-depth",1,"-pixelformat",1,"-name",1,"-kill",1, + "-help",0,"-h",0,"--help",0); + +&Usage() if ($opt{'-help'} || $opt{'-h'} || $opt{'--help'}); + +&Kill() if ($opt{'-kill'}); + +# Uncomment this line if you want default geometry, depth and pixelformat +# to match the current X display: +# &GetXDisplayDefaults(); + +if ($opt{'-geometry'}) { + $geometry = $opt{'-geometry'}; +} +if ($opt{'-depth'}) { + $depth = $opt{'-depth'}; + $pixelformat = ""; +} +if ($opt{'-pixelformat'}) { + $pixelformat = $opt{'-pixelformat'}; +} + +&CheckGeometryAndDepth(); + + +# Create the user's vnc directory if necessary. + +if (!(-e $vncUserDir)) { + if (!mkdir($vncUserDir,0755)) { + die "$prog: Could not create $vncUserDir.\n"; + } +} + +# Make sure the user has a password. + +($z,$z,$mode) = stat("$vncUserDir/passwd"); +if (!(-e "$vncUserDir/passwd") || ($mode & 077)) { + warn "\nYou will require a password to access your desktops.\n\n"; + system("vncpasswd -q $vncUserDir/passwd"); + if (($? >> 8) != 0) { + exit 1; + } +} + +# Find display number. + +if ((@ARGV > 0) && ($ARGV[0] =~ /^:(\d+)$/)) { + $displayNumber = $1; + shift(@ARGV); + if (!&CheckDisplayNumber($displayNumber)) { + die "A VNC server is already running as :$displayNumber\n"; + } +} elsif ((@ARGV > 0) && ($ARGV[0] !~ /^-/)) { + &Usage(); +} else { + $displayNumber = &GetDisplayNumber(); +} + +$vncPort = 5900 + $displayNumber; + +$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); +} + +system("xauth -f $xauthorityFile add $host:$displayNumber . $cookie"); +system("xauth -f $xauthorityFile add $host/unix:$displayNumber . $cookie"); + +if ($opt{'-name'}) { + $desktopName = $opt{'-name'}; +} else { + $desktopName = "$host:$displayNumber ($ENV{USER})"; +} + +# Now start the X VNC Server + +$cmd = "Xvnc :$displayNumber"; +$cmd .= " -desktop " . "edString($desktopName); +$cmd .= " -httpd $vncJavaFiles" if ($vncJavaFiles); +$cmd .= " -auth $xauthorityFile"; +$cmd .= " -geometry $geometry" if ($geometry); +$cmd .= " -depth $depth" if ($depth); +$cmd .= " -pixelformat $pixelformat" if ($pixelformat); +$cmd .= " -rfbwait 30000"; +$cmd .= " -rfbauth $vncUserDir/passwd"; +$cmd .= " -rfbport $vncPort"; +$cmd .= " -pn"; + +# Add font path and color database stuff here, e.g.: +# +# $cmd .= " -fp /usr/lib/X11/fonts/misc/,/usr/lib/X11/fonts/75dpi/"; +# $cmd .= " -co /usr/lib/X11/rgb"; +# + +foreach $arg (@ARGV) { + $cmd .= " " . "edString($arg); +} +$cmd .= " >> " . "edString($desktopLog) . " 2>&1"; + +# Run $cmd and record the process ID. + +$pidFile = "$vncUserDir/$host:$displayNumber.pid"; +system("$cmd & echo \$! >$pidFile"); + +# Give Xvnc a chance to start up + +sleep(3); + +warn "\nNew '$desktopName' desktop is $host:$displayNumber\n\n"; + +# Create the user's xstartup script if necessary. + +if (!(-e "$vncUserDir/xstartup")) { + warn "Creating default startup script $vncUserDir/xstartup\n"; + open(XSTARTUP, ">$vncUserDir/xstartup"); + print XSTARTUP $defaultXStartup; + close(XSTARTUP); + chmod 0755, "$vncUserDir/xstartup"; +} + +# Run the X startup script. + +warn "Starting applications specified in $vncUserDir/xstartup\n"; +warn "Log file is $desktopLog\n\n"; + +# If the unix domain socket exists then use that (DISPLAY=:n) otherwise use +# TCP (DISPLAY=host:n) + +if (-e "/tmp/.X11-unix/X$displayNumber" || + -e "/usr/spool/sockets/X11/$displayNumber") +{ + $ENV{DISPLAY}= ":$displayNumber"; +} else { + $ENV{DISPLAY}= "$host:$displayNumber"; +} +$ENV{VNCDESKTOP}= $desktopName; + +system("$vncUserDir/xstartup >> " . "edString($desktopLog) . " 2>&1 &"); + +exit; + + +############################################################################### +# +# CheckGeometryAndDepth simply makes sure that the geometry and depth values +# are sensible. +# + +sub CheckGeometryAndDepth +{ + if ($geometry =~ /^(\d+)x(\d+)$/) { + $width = $1; $height = $2; + + if (($width<1) || ($height<1)) { + die "$prog: geometry $geometry is invalid\n"; + } + + while (($width % 4)!=0) { + $width = $width + 1; + } + + while (($height % 2)!=0) { + $height = $height + 1; + } + + $geometry = "${width}x$height"; + } else { + die "$prog: geometry $geometry is invalid\n"; + } + + if (($depth < 8) || ($depth > 32)) { + die "Depth must be between 8 and 32\n"; + } +} + + +# +# GetDisplayNumber gets the lowest available display number. A display number +# n is taken if something is listening on the VNC server port (5900+n) or the +# X server port (6000+n). +# + +sub GetDisplayNumber +{ + foreach $n (1..99) { + if (&CheckDisplayNumber($n)) { + return $n+0; # Bruce Mah's workaround for bug in perl 5.005_02 + } + } + + die "$prog: no free display number on $host.\n"; +} + + +# +# CheckDisplayNumber checks if the given display number is available. A +# display number n is taken if something is listening on the VNC server port +# (5900+n) or the X server port (6000+n). +# + +sub CheckDisplayNumber +{ + local ($n) = @_; + + socket(S, $AF_INET, $SOCK_STREAM, 0) || die "$prog: socket failed: $!\n"; + eval 'setsockopt(S, &SOL_SOCKET, &SO_REUSEADDR, pack("l", 1))'; + if (!bind(S, pack('S n x12', $AF_INET, 6000 + $n))) { + close(S); + return 0; + } + close(S); + + socket(S, $AF_INET, $SOCK_STREAM, 0) || die "$prog: socket failed: $!\n"; + eval 'setsockopt(S, &SOL_SOCKET, &SO_REUSEADDR, pack("l", 1))'; + if (!bind(S, pack('S n x12', $AF_INET, 5900 + $n))) { + close(S); + return 0; + } + close(S); + + if (-e "/tmp/.X$n-lock") { + warn "\nWarning: $host:$n is taken because of /tmp/.X$n-lock\n"; + warn "Remove this file if there is no X server $host:$n\n"; + return 0; + } + + if (-e "/tmp/.X11-unix/X$n") { + warn "\nWarning: $host:$n is taken because of /tmp/.X11-unix/X$n\n"; + warn "Remove this file if there is no X server $host:$n\n"; + return 0; + } + + if (-e "/usr/spool/sockets/X11/$n") { + warn("\nWarning: $host:$n is taken because of ". + "/usr/spool/sockets/X11/$n\n"); + warn "Remove this file if there is no X server $host:$n\n"; + return 0; + } + + return 1; +} + + +# +# GetXDisplayDefaults uses xdpyinfo to find out the geometry, depth and pixel +# format of the current X display being used. If successful, it sets the +# options as appropriate so that the X VNC server will use the same settings +# (minus an allowance for window manager decorations on the geometry). Using +# the same depth and pixel format means that the VNC server won't have to +# translate pixels when the desktop is being viewed on this X display (for +# TrueColor displays anyway). +# + +sub GetXDisplayDefaults +{ + local (@lines, @matchlines, $width, $height, $defaultVisualId, $i, + $red, $green, $blue); + + $wmDecorationWidth = 4; # a guess at typical size for window manager + $wmDecorationHeight = 24; # decoration size + + return if (!defined($ENV{DISPLAY})); + + @lines = `xdpyinfo 2>/dev/null`; + + return if ($? != 0); + + @matchlines = grep(/dimensions/, @lines); + if (@matchlines) { + ($width, $height) = ($matchlines[0] =~ /(\d+)x(\d+) pixels/); + + $width -= $wmDecorationWidth; + $height -= $wmDecorationHeight; + + $geometry = "${width}x$height"; + } + + @matchlines = grep(/default visual id/, @lines); + if (@matchlines) { + ($defaultVisualId) = ($matchlines[0] =~ /id:\s+(\S+)/); + + for ($i = 0; $i < @lines; $i++) { + if ($lines[$i] =~ /^\s*visual id:\s+$defaultVisualId$/) { + if (($lines[$i+1] !~ /TrueColor/) || + ($lines[$i+2] !~ /depth/) || + ($lines[$i+4] !~ /red, green, blue masks/)) + { + return; + } + last; + } + } + + return if ($i >= @lines); + + ($depth) = ($lines[$i+2] =~ /depth:\s+(\d+)/); + ($red,$green,$blue) + = ($lines[$i+4] + =~ /masks:\s+0x([0-9a-f]+), 0x([0-9a-f]+), 0x([0-9a-f]+)/); + + $red = hex($red); + $green = hex($green); + $blue = hex($blue); + + if ($red > $blue) { + $red = int(log($red) / log(2)) - int(log($green) / log(2)); + $green = int(log($green) / log(2)) - int(log($blue) / log(2)); + $blue = int(log($blue) / log(2)) + 1; + $pixelformat = "rgb$red$green$blue"; + } else { + $blue = int(log($blue) / log(2)) - int(log($green) / log(2)); + $green = int(log($green) / log(2)) - int(log($red) / log(2)); + $red = int(log($red) / log(2)) + 1; + $pixelformat = "bgr$blue$green$red"; + } + } +} + + +# +# quotedString returns a string which yields the original string when parsed +# by a shell. +# + +sub quotedString +{ + local ($in) = @_; + + $in =~ s/\'/\'\"\'\"\'/g; + + return "'$in'"; +} + + +# +# removeSlashes turns slashes into underscores for use as a file name. +# + +sub removeSlashes +{ + local ($in) = @_; + + $in =~ s|/|_|g; + + return "$in"; +} + + +# +# Usage +# + +sub Usage +{ + die("\nusage: $prog [:] [-name ] [-depth ]\n". + " [-geometry x]\n". + " [-pixelformat rgbNNN|bgrNNN]\n". + " ...\n\n". + " $prog -kill \n\n"); +} + + +# +# Kill +# + +sub Kill +{ + $opt{'-kill'} =~ s/(:\d+)\.\d+$/$1/; # e.g. turn :1.0 into :1 + + if ($opt{'-kill'} =~ /^:\d+$/) { + $pidFile = "$vncUserDir/$host$opt{'-kill'}.pid"; + } else { + if ($opt{'-kill'} !~ /^$host:/) { + die "\nCan't tell if $opt{'-kill'} is on $host\n". + "Use -kill : instead\n\n"; + } + $pidFile = "$vncUserDir/$opt{'-kill'}.pid"; + } + + if (! -r $pidFile) { + die "\nCan't find file $pidFile\n". + "You'll have to kill the Xvnc process manually\n\n"; + } + + $SIG{'HUP'} = 'IGNORE'; + chop($pid = `cat $pidFile`); + warn "Killing Xvnc process ID $pid\n"; + system("kill $pid"); + unlink $pidFile; + exit; +} + + +# +# ParseOptions takes a list of possible options and a boolean indicating +# whether the option has a value following, and sets up an associative array +# %opt of the values of the options given on the command line. It removes all +# the arguments it uses from @ARGV and returns them in @optArgs. +# + +sub ParseOptions +{ + local (@optval) = @_; + local ($opt, @opts, %valFollows, @newargs); + + while (@optval) { + $opt = shift(@optval); + push(@opts,$opt); + $valFollows{$opt} = shift(@optval); + } + + @optArgs = (); + %opt = (); + + arg: while (defined($arg = shift(@ARGV))) { + foreach $opt (@opts) { + if ($arg eq $opt) { + push(@optArgs, $arg); + if ($valFollows{$opt}) { + if (@ARGV == 0) { + &Usage(); + } + $opt{$opt} = shift(@ARGV); + push(@optArgs, $opt{$opt}); + } else { + $opt{$opt} = 1; + } + next arg; + } + } + push(@newargs,$arg); + } + + @ARGV = @newargs; +} + + +# +# Routine to make sure we're operating in a sane environment. +# + +sub SanityCheck +{ + local ($cmd); + + # + # Get the program name + # + + ($prog) = ($0 =~ m|([^/]+)$|); + + # + # Check we have all the commands we'll need on the path. + # + + cmd: + foreach $cmd ("uname","xauth","Xvnc","vncpasswd") { + for (split(/:/,$ENV{PATH})) { + if (-x "$_/$cmd") { + next cmd; + } + } + die "$prog: couldn't find \"$cmd\" on your PATH.\n"; + } + + # + # Check the HOME environment variable is set + # + + if (!defined($ENV{HOME})) { + die "$prog: The HOME environment variable is not set.\n"; + } + chdir($ENV{HOME}); + + # + # Find socket constants. 'use Socket' is a perl5-ism, so we wrap it in an + # eval, and if it fails we try 'require "sys/socket.ph"'. If this fails, + # we just guess at the values. If you find perl moaning here, just + # hard-code the values of AF_INET and SOCK_STREAM. You can find these out + # for your platform by looking in /usr/include/sys/socket.h and related + # files. + # + + chop($os = `uname`); + chop($osrev = `uname -r`); + + eval 'use Socket'; + if ($@) { + eval 'require "sys/socket.ph"'; + if ($@) { + if (($os eq "SunOS") && ($osrev !~ /^4/)) { + $AF_INET = 2; + $SOCK_STREAM = 2; + } else { + $AF_INET = 2; + $SOCK_STREAM = 1; + } + } else { + $AF_INET = &AF_INET; + $SOCK_STREAM = &SOCK_STREAM; + } + } else { + $AF_INET = &AF_INET; + $SOCK_STREAM = &SOCK_STREAM; + } +} --- vnc4-4.1.1+xorg4.3.0.orig/debian/patches/vncserver-ipv6-v2.patch +++ vnc4-4.1.1+xorg4.3.0/debian/patches/vncserver-ipv6-v2.patch @@ -0,0 +1,69 @@ +--- orig/vnc4-4.1.1+X4.3.0/common/network/TcpSocket.cxx 2009-10-13 03:39:50.000000000 +0600 ++++ vnc4-4.1.1+X4.3.0/common/network/TcpSocket.cxx 2009-10-14 01:41:55.451051305 +0600 +@@ -314,9 +314,30 @@ + return; + } + ++ bool use_ipv6; ++ int af; ++#ifdef AF_INET6 ++ // - localhostOnly will mean "127.0.0.1 only", no IPv6 ++ if (use_ipv6 = !localhostOnly) ++ af = AF_INET6; ++ else ++ af = AF_INET; ++#else ++ use_ipv6 = false; ++ af = AF_INET; ++#endif ++ + initSockets(); +- if ((fd = socket(AF_INET, SOCK_STREAM, 0)) < 0) +- throw SocketException("unable to create listening socket", errorNumber); ++ if ((fd = socket(af, SOCK_STREAM, 0)) < 0) { ++ if (use_ipv6) { ++ // - We were trying to make an IPv6-capable socket - try again, but IPv4-only ++ use_ipv6 = false; ++ af = AF_INET; ++ fd = socket(af, SOCK_STREAM, 0); ++ } ++ if (fd < 0) ++ throw SocketException("unable to create listening socket", errorNumber); ++ } + + #ifndef WIN32 + // - By default, close the socket on exec() +@@ -333,14 +354,25 @@ + + // - Bind it to the desired port + struct sockaddr_in addr; +- memset(&addr, 0, sizeof(addr)); +- addr.sin_family = AF_INET; +- addr.sin_port = htons(port); +- if (localhostOnly) +- addr.sin_addr.s_addr = htonl(INADDR_LOOPBACK); +- else +- addr.sin_addr.s_addr = htonl(INADDR_ANY); +- if (bind(fd, (struct sockaddr *)&addr, sizeof(addr)) < 0) { ++ struct sockaddr_in6 addr6; ++ struct sockaddr *sa; ++ int sa_len; ++ if (use_ipv6) { ++ memset(&addr6, 0, (sa_len = sizeof(addr6))); ++ addr6.sin6_family = af; ++ addr6.sin6_port = htons(port); ++ sa = (struct sockaddr*) &addr6; ++ } else { ++ memset(&addr, 0, (sa_len = sizeof(addr))); ++ addr.sin_family = af; ++ addr.sin_port = htons(port); ++ if (localhostOnly) ++ addr.sin_addr.s_addr = htonl(INADDR_LOOPBACK); ++ else ++ addr.sin_addr.s_addr = htonl(INADDR_ANY); ++ sa = (struct sockaddr*) &addr; ++ } ++ if (bind(fd, sa, sa_len) < 0) { + int e = errorNumber; + closesocket(fd); + throw SocketException("unable to bind listening socket", e); --- vnc4-4.1.1+xorg4.3.0.orig/debian/patches/vncsofpicfix.patch +++ vnc4-4.1.1+xorg4.3.0/debian/patches/vncsofpicfix.patch @@ -0,0 +1,11 @@ +--- buildtemp/xc/programs/Xserver/vnc/module/Imakefile~ 2004-08-19 12:42:56.000000000 +0200 ++++ buildtemp/xc/programs/Xserver/vnc/module/Imakefile 2004-08-19 22:51:01.000000000 +0200 +@@ -13,7 +13,7 @@ + INCLUDES = -I.. -I../../include -I$(EXTINCSRC) -I$(XINCLUDESRC) \ + -I$(FONTINCSRC) -I$(XF86COMSRC) \ + $(VNCINCLUDE) +- DEFINES = $(STD_DEFINES) -DGC_HAS_COMPOSITE_CLIP -DXFree86LOADER ++ DEFINES = -fPIC $(STD_DEFINES) -DGC_HAS_COMPOSITE_CLIP -DXFree86LOADER + + LinkSourceFile(vncExtInit.cc,..) + LinkSourceFile(vncHooks.cc,..) --- vnc4-4.1.1+xorg4.3.0.orig/debian/patches/xccompilefix.patch +++ vnc4-4.1.1+xorg4.3.0/debian/patches/xccompilefix.patch @@ -0,0 +1,30 @@ +--- buildtemp/xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_io.c~ 2001-11-08 05:00:14.000000000 +0100 ++++ buildtemp/xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_io.c 2004-08-09 09:02:19.000000000 +0200 +@@ -80,19 +80,20 @@ + struct kbd_repeat kbdrep_s; + + /* don't change, just test */ +- kbdrep_s.rate = -1; ++ /*kbdrep_s.rate = -1;*/ + kbdrep_s.delay = -1; + if (ioctl( 0, KDKBDREP, &kbdrep_s )) { + return 0; + } + + /* do the change */ +- if (rate == 0) /* switch repeat off */ +- kbdrep_s.rate = 0; +- else +- kbdrep_s.rate = 10000 / rate; /* convert cps to msec */ +- if (kbdrep_s.rate < 1) +- kbdrep_s.rate = 1; ++ /*if (rate == 0)*/ /* switch repeat off */ ++ /* kbdrep_s.rate = 0;*/ ++ /*else*/ ++ /* kbdrep_s.rate = 10000 / rate;*/ /* convert cps to msec */ ++ /* if (kbdrep_s.rate < 1)*/ ++ /* kbdrep_s.rate = 1; */ ++ + kbdrep_s.delay = delay; + if (kbdrep_s.delay < 1) + kbdrep_s.delay = 1; --- vnc4-4.1.1+xorg4.3.0.orig/debian/patches/xdialog-1_gismo-20061107.patch +++ vnc4-4.1.1+xorg4.3.0/debian/patches/xdialog-1_gismo-20061107.patch @@ -0,0 +1,29 @@ +--- vnc4-4.1.1+X4.3.0/unix/vncviewer/CConn.cxx 2006-11-06 18:52:04.000000000 +0100 ++++ vnc4-4.1.1+X4.3.0_gismo-1/unix/vncviewer/CConn.cxx 2006-11-07 17:48:42.000000000 +0100 +@@ -19,6 +19,8 @@ + // CConn.cxx + // + ++#include ++#include + #include + #include "CConn.h" + #include +@@ -37,8 +39,6 @@ + #include "ServerDialog.h" + #include "PasswdDialog.h" + #include "parameters.h" +-#include +-#include + + using namespace rfb; + +@@ -50,8 +50,6 @@ + StringParameter menuKey("MenuKey", "The key which brings up the popup menu", + "F8"); + StringParameter windowName("name", "The X window name", ""); +-#include +-#include + + CConn::CConn(Display* dpy_, int argc_, char** argv_, network::Socket* sock_, + char* vncServerName, bool reverse) --- vnc4-4.1.1+xorg4.3.0.orig/debian/patches/xdialog-2_gismo-20061107.patch +++ vnc4-4.1.1+xorg4.3.0/debian/patches/xdialog-2_gismo-20061107.patch @@ -0,0 +1,41 @@ +--- vnc4-4.1.1+X4.3.0_gismo-1/unix/vncviewer/CConn.cxx 2006-11-07 18:15:41.000000000 +0100 ++++ vnc4-4.1.1+X4.3.0_gismo-2/unix/vncviewer/CConn.cxx 2006-11-07 18:17:26.000000000 +0100 +@@ -211,7 +211,7 @@ + return; + } + +- int popup = popupUserPassDialog; ++ int popup = popupXDialog; + if (!popup) { + if (user) { + /* Get username */ + +--- vnc4-4.1.1+X4.3.0_gismo-1/unix/vncviewer/parameters.h 2006-11-07 18:14:28.000000000 +0100 ++++ vnc4-4.1.1+X4.3.0_gismo-2/unix/vncviewer/parameters.h 2006-11-07 18:18:23.000000000 +0100 +@@ -37,7 +37,7 @@ + extern rfb::BoolParameter sendPrimary; + extern rfb::BoolParameter fullScreen; + extern rfb::StringParameter geometry; +-extern rfb::BoolParameter popupUserPassDialog; ++extern rfb::BoolParameter popupXDialog; + + extern char aboutText[]; + extern char* programName; + +--- vnc4-4.1.1+X4.3.0_gismo-1/unix/vncviewer/vncviewer.cxx 2006-11-07 18:14:28.000000000 +0100 ++++ vnc4-4.1.1+X4.3.0_gismo-2/unix/vncviewer/vncviewer.cxx 2006-11-07 18:20:42.000000000 +0100 +@@ -93,10 +93,10 @@ + + BoolParameter listenMode("listen", "Listen for connections from VNC servers", + false); +-BoolParameter popupUserPassDialog("PasswordDialog", +- "Popup a user and password dialog. Default " +- "no when running from command line", +- !isatty(0)); ++BoolParameter popupXDialog("XDialog", ++ "Popup a user and password dialog. Default " ++ "no when running from command line", ++ !isatty(0)); + StringParameter geometry("geometry", "X geometry specification", ""); + StringParameter displayname("display", "The X display", ""); + --- vnc4-4.1.1+xorg4.3.0.orig/debian/patches/xdialog-3_gismo-20061107.patch +++ vnc4-4.1.1+xorg4.3.0/debian/patches/xdialog-3_gismo-20061107.patch @@ -0,0 +1,20 @@ +--- vnc4-4.1.1+X4.3.0_gismo-2/unix/vncviewer/CConn.cxx 2006-11-07 18:17:26.000000000 +0100 ++++ vnc4-4.1.1+X4.3.0_gismo-3/unix/vncviewer/CConn.cxx 2006-11-07 18:09:38.000000000 +0100 +@@ -224,8 +224,7 @@ + + if (tcgetattr (fileno (stdin), &oldio) != 0) { + popup = 1; +- } +- else { ++ } else { + newio = oldio; + newio.c_lflag &= ~ECHO; + fprintf(stderr, "Password: "); +@@ -243,6 +242,7 @@ + (void) tcsetattr (fileno (stdin), TCSAFLUSH, &oldio); + } + } ++ + if (popup) { + const char* secType = secTypeName(getCurrentCSecurity()->getType()); + const char* titlePrefix = "VNC Authentication"; --- vnc4-4.1.1+xorg4.3.0.orig/debian/patches/xdialog-4_gismo-20061107.patch +++ vnc4-4.1.1+xorg4.3.0/debian/patches/xdialog-4_gismo-20061107.patch @@ -0,0 +1,42 @@ +--- vnc4-4.1.1+X4.3.0_gismo-3/unix/vncviewer/CConn.cxx 2006-11-07 18:09:38.000000000 +0100 ++++ vnc4-4.1.1+X4.3.0_gismo-4/unix/vncviewer/CConn.cxx 2006-11-07 18:47:01.000000000 +0100 +@@ -88,11 +88,20 @@ + if (vncServerName) { + getHostAndPort(vncServerName, &serverHost, &serverPort); + } else { +- ServerDialog dlg(dpy, &options, &about); +- if (!dlg.show() || dlg.entry.getText()[0] == 0) { +- exit(1); ++ int popup = popupXDialog; ++ if (!popup) { ++ /* Get server */ ++ fprintf(stderr, "Server: "); ++ vncServerName = new char[128]; ++ fgets(vncServerName, 128, stdin); ++ getHostAndPort(vncServerName, &serverHost, &serverPort); ++ } else { ++ ServerDialog dlg(dpy, &options, &about); ++ if (!dlg.show() || dlg.entry.getText()[0] == 0) { ++ exit(1); ++ } ++ getHostAndPort(dlg.entry.getText(), &serverHost, &serverPort); + } +- getHostAndPort(dlg.entry.getText(), &serverHost, &serverPort); + } + + sock = new network::TcpSocket(serverHost, serverPort); + +--- vnc4-4.1.1+X4.3.0_gismo-3/unix/vncviewer/vncviewer.cxx 2006-11-07 18:24:12.000000000 +0100 ++++ vnc4-4.1.1+X4.3.0_gismo-4/unix/vncviewer/vncviewer.cxx 2006-11-07 18:47:30.000000000 +0100 +@@ -94,8 +94,9 @@ + BoolParameter listenMode("listen", "Listen for connections from VNC servers", + false); + BoolParameter popupXDialog("XDialog", +- "Popup a user and password dialog. Default " +- "no when running from command line", ++ "Popup an X dialog when asking for server, " ++ "username and password. Default no when " ++ "running from command line", + !isatty(0)); + StringParameter geometry("geometry", "X geometry specification", ""); + StringParameter displayname("display", "The X display", ""); --- vnc4-4.1.1+xorg4.3.0.orig/debian/patches/xdialog-5_gismo-20061107.patch +++ vnc4-4.1.1+xorg4.3.0/debian/patches/xdialog-5_gismo-20061107.patch @@ -0,0 +1,29 @@ +--- vnc4-4.1.1+X4.3.0_gismo-4/unix/vncviewer/CConn.cxx 2006-11-07 19:43:39.000000000 +0100 ++++ vnc4-4.1.1+X4.3.0_gismo-5/unix/vncviewer/CConn.cxx 2006-11-07 19:43:05.000000000 +0100 +@@ -91,7 +91,7 @@ + int popup = popupXDialog; + if (!popup) { + /* Get server */ +- fprintf(stderr, "Server: "); ++ fprintf(stderr, "\nServer: "); + vncServerName = new char[128]; + fgets(vncServerName, 128, stdin); + getHostAndPort(vncServerName, &serverHost, &serverPort); +@@ -224,7 +224,7 @@ + if (!popup) { + if (user) { + /* Get username */ +- fprintf(stderr, "Username: "); ++ fprintf(stderr, "\nUsername: "); + *user = new char[128]; + fgets(*user, 128, stdin); + /* Remove \n at the end */ +@@ -236,7 +236,7 @@ + } else { + newio = oldio; + newio.c_lflag &= ~ECHO; +- fprintf(stderr, "Password: "); ++ fprintf(stderr, "\nPassword: "); + /* Echo off */ + if (tcsetattr (fileno (stdin), TCSAFLUSH, &newio) != 0) + popup = 1; --- vnc4-4.1.1+xorg4.3.0.orig/debian/patches/xdialog-6_gismo-20061108.patch +++ vnc4-4.1.1+xorg4.3.0/debian/patches/xdialog-6_gismo-20061108.patch @@ -0,0 +1,20 @@ +--- vnc4-4.1.1+X4.3.0_gismo-5/unix/vncviewer/vncviewer.man 2006-11-07 08:36:01.000000000 +0100 ++++ vnc4-4.1.1+X4.3.0_gismo-6/unix/vncviewer/vncviewer.man 2006-11-08 11:53:51.000000000 +0100 +@@ -1,4 +1,4 @@ +-.TH vncviewer 1 "03 Mar 2005" "RealVNC Ltd" "Virtual Network Computing" ++.TH vncviewer 1 "08 Nov 2006" "RealVNC Ltd" "Virtual Network Computing" + .SH NAME + vncviewer \- VNC viewer for X + .SH SYNOPSIS +@@ -102,6 +102,11 @@ + .B vncconfig. + + .TP ++.B \-XDialog ++Popup an X dialog when asking for server, username and password. Default is to ++not popup when vncviewer is start from command line. ++ ++.TP + .B \-passwd \fIpassword-file\fP + If you are on a filesystem which gives you access to the password file used by + the server, you can specify it here to avoid typing it in. It will usually be --- vnc4-4.1.1+xorg4.3.0.orig/debian/patches/xvnc4-randr-patch-20060603.patch +++ vnc4-4.1.1+xorg4.3.0/debian/patches/xvnc4-randr-patch-20060603.patch @@ -0,0 +1,417 @@ +diff -urN vnc4-4.1.1+X4.3.0/unix/xc/programs/Xserver/randr/randr.c vnc4-4.1.1+X4.3.0+RANDR/unix/xc/programs/Xserver/randr/randr.c +--- vnc4-4.1.1+X4.3.0/unix/xc/programs/Xserver/randr/randr.c 2003-02-08 06:52:30.000000000 +0300 ++++ vnc4-4.1.1+X4.3.0+RANDR/unix/xc/programs/Xserver/randr/randr.c 2006-06-03 16:34:48.000000000 +0400 +@@ -726,10 +726,31 @@ + * timestamp, then the config information isn't up-to-date and + * can't even be validated + */ ++ /* A DIRTY WORKAROUND. ++ * Looks like under some reasons, this test fails, although 32bit timestamp ++ * passed in stuff->configTimestamp is exactly the same as was returned ++ * in RRGetScreenInfo just before. So 'months' parts differ. Maybe ++ * some bug elsewhere, causing 'months' jump? Or maybe it could happen ++ * if enough time passed since previous configuration? I'm afraid that ++ * both have happened here ... ++ * Since I have no time to investigate details, I'm just replacing this ++ * with 32bit compare. Probability of config times that differ only ++ * in months is extremely low ... */ + if (CompareTimeStamps (configTime, pScrPriv->lastConfigTime) != 0) + { +- rep.status = RRSetConfigInvalidConfigTime; +- goto sendReply; ++ if (pScrPriv->lastConfigTime.milliseconds == stuff->configTimestamp) ++ { ++ ErrorF("Point X: last: %lu %lu, new: %lu %lu\n", ++ pScrPriv->lastConfigTime.months, ++ pScrPriv->lastConfigTime.milliseconds, ++ configTime.months, ++ configTime.milliseconds); ++ } ++ else ++ { ++ rep.status = RRSetConfigInvalidConfigTime; ++ goto sendReply; ++ } + } + + /* +diff -urN vnc4-4.1.1+X4.3.0/unix/xc/programs/Xserver/vnc/vncHooks.cc vnc4-4.1.1+X4.3.0+RANDR/unix/xc/programs/Xserver/vnc/vncHooks.cc +--- vnc4-4.1.1+X4.3.0/unix/xc/programs/Xserver/vnc/vncHooks.cc 2006-06-03 16:14:57.000000000 +0400 ++++ vnc4-4.1.1+X4.3.0+RANDR/unix/xc/programs/Xserver/vnc/vncHooks.cc 2006-06-03 16:14:30.000000000 +0400 +@@ -1530,3 +1530,11 @@ + + vncHooksScreen->desktop->add_changed(changed.reg); + } ++ ++void vncHooksResizeScreen(ScreenPtr pScreen) ++{ ++ vncHooksScreenPtr vncHooksScreen ++ = ((vncHooksScreenPtr)pScreen->devPrivates[vncHooksScreenIndex].ptr); ++ ++ vncHooksScreen->desktop->setSize(pScreen->width, pScreen->height); ++} +diff -urN vnc4-4.1.1+X4.3.0/unix/xc/programs/Xserver/vnc/XserverDesktop.cc vnc4-4.1.1+X4.3.0+RANDR/unix/xc/programs/Xserver/vnc/XserverDesktop.cc +--- vnc4-4.1.1+X4.3.0/unix/xc/programs/Xserver/vnc/XserverDesktop.cc 2005-03-11 18:08:41.000000000 +0300 ++++ vnc4-4.1.1+X4.3.0+RANDR/unix/xc/programs/Xserver/vnc/XserverDesktop.cc 2006-06-03 16:14:30.000000000 +0400 +@@ -193,6 +193,9 @@ + else + data = new rdr::U8[pScreen->width * pScreen->height * (format.bpp/8)]; + colourmap = this; ++#ifdef RANDR ++ initialWidth = width_; ++#endif + + serverReset(pScreen); + +@@ -714,7 +717,11 @@ + grabbing = true; + + int bytesPerPixel = format.bpp/8; ++#ifdef RANDR ++ int bytesPerRow = initialWidth * bytesPerPixel; ++#else + int bytesPerRow = pScreen->width * bytesPerPixel; ++#endif + + std::vector rects; + std::vector::iterator i; +diff -urN vnc4-4.1.1+X4.3.0/unix/xc/programs/Xserver/vnc/XserverDesktop.h vnc4-4.1.1+X4.3.0+RANDR/unix/xc/programs/Xserver/vnc/XserverDesktop.h +--- vnc4-4.1.1+X4.3.0/unix/xc/programs/Xserver/vnc/XserverDesktop.h 2005-03-11 18:08:41.000000000 +0300 ++++ vnc4-4.1.1+X4.3.0+RANDR/unix/xc/programs/Xserver/vnc/XserverDesktop.h 2006-06-03 16:14:30.000000000 +0400 +@@ -68,6 +68,12 @@ + void addClient(network::Socket* sock, bool reverse); + void disconnectClients(); + ++#ifdef RANDR ++ void setSize(int w, int h) { ++ width_ = w; height_ = h; server->setPixelBuffer(this); ++ } ++#endif ++ + // QueryConnect methods called from X server code + // getQueryTimeout() + // Returns the timeout associated with a particular +@@ -126,5 +132,9 @@ + void* queryConnectId; + rfb::CharArray queryConnectAddress; + rfb::CharArray queryConnectUsername; ++#ifdef RANDR ++ int initialWidth; ++ int getStride() const { return initialWidth; } ++#endif + }; + #endif +diff -urN vnc4-4.1.1+X4.3.0/unix/xc/programs/Xserver/vnc/Xvnc/Imakefile vnc4-4.1.1+X4.3.0+RANDR/unix/xc/programs/Xserver/vnc/Xvnc/Imakefile +--- vnc4-4.1.1+X4.3.0/unix/xc/programs/Xserver/vnc/Xvnc/Imakefile 2006-06-03 16:14:57.000000000 +0400 ++++ vnc4-4.1.1+X4.3.0+RANDR/unix/xc/programs/Xserver/vnc/Xvnc/Imakefile 2006-06-03 16:14:30.000000000 +0400 +@@ -44,7 +44,8 @@ + + INCLUDES = -I. -I.. -I$(XBUILDINCDIR) -I$(FONTINCSRC) $(FB_DEFINES) \ + $(FBINCLUDE) -I../../mfb -I../../mi -I../../include -I../../os \ +- -I$(EXTINCSRC) -I$(XINCLUDESRC) -I$(SERVERSRC)/render $(VNCINCLUDE) ++ -I$(EXTINCSRC) -I$(XINCLUDESRC) -I$(SERVERSRC)/render \ ++ -I$(SERVERSRC)/randr $(VNCINCLUDE) + + DEFINES = $(OS_DEFINES) $(SHMDEF) $(MMAPDEF) \ + $(VENDOR_STRING) $(VENDOR_RELEASE) $(STD_DEFINES) ServerOSDefines \ +diff -urN vnc4-4.1.1+X4.3.0/unix/xc/programs/Xserver/vnc/Xvnc/xvnc.cc vnc4-4.1.1+X4.3.0+RANDR/unix/xc/programs/Xserver/vnc/Xvnc/xvnc.cc +--- vnc4-4.1.1+X4.3.0/unix/xc/programs/Xserver/vnc/Xvnc/xvnc.cc 2006-06-03 16:14:57.000000000 +0400 ++++ vnc4-4.1.1+X4.3.0+RANDR/unix/xc/programs/Xserver/vnc/Xvnc/xvnc.cc 2006-06-03 16:14:30.000000000 +0400 +@@ -107,6 +107,16 @@ + #define VFB_DEFAULT_LINEBIAS 0 + #define XWD_WINDOW_NAME_LEN 60 + ++#ifdef RANDR ++ ++extern "C" { ++#include ++} ++ ++#define RR_MAX_SCREEN_SIZES 8 ++typedef struct { int width, height; } rrScreenSize; ++#endif ++ + typedef struct + { + int scrnum; +@@ -127,7 +137,10 @@ + Bool pixelFormatDefined; + Bool rgbNotBgr; + int redBits, greenBits, blueBits; +- ++#ifdef RANDR ++ int rrScreenSizesDefined; ++ rrScreenSize rrScreenSizes[RR_MAX_SCREEN_SIZES]; ++#endif + } vfbScreenInfo, *vfbScreenInfoPtr; + + static int vfbNumScreens; +@@ -175,6 +188,11 @@ + vfbScreens[i].lineBias = VFB_DEFAULT_LINEBIAS; + vfbScreens[i].pixelFormatDefined = FALSE; + vfbScreens[i].pfbMemory = NULL; ++#ifdef RANDR ++ vfbScreens[i].rrScreenSizesDefined = 0; ++ vfbScreens[i].rrScreenSizes[0].width = VFB_DEFAULT_WIDTH; ++ vfbScreens[i].rrScreenSizes[0].height = VFB_DEFAULT_HEIGHT; ++#endif + } + vfbNumScreens = 1; + } +@@ -406,11 +424,45 @@ + if (strcmp(argv[i], "-geometry") == 0) + { + if (++i >= argc) UseMsg(); ++#ifdef RANDR ++ if (vfbScreens[0].rrScreenSizesDefined == RR_MAX_SCREEN_SIZES) ++ { ++ ErrorF("Too many modes\n"); ++ UseMsg(); ++ } ++ else ++ { ++ rrScreenSize *rrss; ++ rrss = &(vfbScreens[0].rrScreenSizes[vfbScreens[0].rrScreenSizesDefined]); ++ if (sscanf(argv[i], "%dx%d", &rrss->width, &rrss->height) != 2 || ++ rrss->width <= 32 && rrss->height <= 32) { ++ ErrorF("Invalid geometry %s\n", argv[i]); ++ UseMsg(); ++ } ++ else ++ { ++ if (vfbScreens[0].rrScreenSizesDefined == 0) { ++ vfbScreens[0].width = rrss->width; ++ vfbScreens[0].height = rrss->height; ++ } ++ else ++ { ++ if (vfbScreens[0].width < rrss->width) ++ vfbScreens[0].width = rrss->width; ++ if (vfbScreens[0].height < rrss->height) ++ vfbScreens[0].height = rrss->height; ++ } ++ ++ vfbScreens[0].rrScreenSizesDefined++; ++ } ++ } ++#else + if (sscanf(argv[i],"%dx%d",&vfbScreens[0].width, + &vfbScreens[0].height) != 2) { + ErrorF("Invalid geometry %s\n", argv[i]); + UseMsg(); + } ++#endif + return 2; + } + +@@ -820,6 +872,189 @@ + miPointerWarpCursor + }; + ++#ifdef RANDR ++ ++static Bool vncRandRGetInfo (ScreenPtr pScreen, Rotation *rotations) ++{ ++ vfbScreenInfoPtr pvfb = &vfbScreens[pScreen->myNum]; ++ int dpi = monitorResolution ? monitorResolution : 100; ++ int i; ++ ++ if (pvfb->rrScreenSizesDefined == 0) ++ pvfb->rrScreenSizesDefined = 1; /* case without -geometry */ ++ ++ for (i = 0; i < pvfb->rrScreenSizesDefined; i++) ++ { ++ RRScreenSizePtr pSize; ++ ++ pSize = RRRegisterSize(pScreen, ++ pvfb->rrScreenSizes[i].width, pvfb->rrScreenSizes[i].height, ++ pScreen->mmWidth, pScreen->mmHeight); ++ if (!pSize) ++ return FALSE; ++ RRRegisterRate(pScreen, pSize, 60); ++ ++ if (pvfb->rrScreenSizes[i].width == pScreen->width && ++ pvfb->rrScreenSizes[i].height == pScreen->height) ++ RRSetCurrentConfig(pScreen, RR_Rotate_0, 60, pSize); ++ } ++ ++ *rotations = RR_Rotate_0; ++ return TRUE; ++} ++ ++/* from hw/xfree86/common/xf86Helper.c */ ++ ++#include "mivalidate.h" ++static void ++xf86SetRootClip (ScreenPtr pScreen, Bool enable) ++{ ++ WindowPtr pWin = WindowTable[pScreen->myNum]; ++ WindowPtr pChild; ++ Bool WasViewable = (Bool)(pWin->viewable); ++ Bool anyMarked = FALSE; ++ RegionPtr pOldClip = NULL, bsExposed; ++#ifdef DO_SAVE_UNDERS ++ Bool dosave = FALSE; ++#endif ++ WindowPtr pLayerWin; ++ BoxRec box; ++ ++ if (WasViewable) ++ { ++ for (pChild = pWin->firstChild; pChild; pChild = pChild->nextSib) ++ { ++ (void) (*pScreen->MarkOverlappedWindows)(pChild, ++ pChild, ++ &pLayerWin); ++ } ++ (*pScreen->MarkWindow) (pWin); ++ anyMarked = TRUE; ++ if (pWin->valdata) ++ { ++ if (HasBorder (pWin)) ++ { ++ RegionPtr borderVisible; ++ ++ borderVisible = REGION_CREATE(pScreen, NullBox, 1); ++ REGION_SUBTRACT(pScreen, borderVisible, ++ &pWin->borderClip, &pWin->winSize); ++ pWin->valdata->before.borderVisible = borderVisible; ++ } ++ pWin->valdata->before.resized = TRUE; ++ } ++ } ++ ++ /* ++ * Use REGION_BREAK to avoid optimizations in ValidateTree ++ * that assume the root borderClip can't change well, normally ++ * it doesn't...) ++ */ ++ if (enable) ++ { ++ box.x1 = 0; ++ box.y1 = 0; ++ box.x2 = pScreen->width; ++ box.y2 = pScreen->height; ++ REGION_INIT (pScreen, &pWin->winSize, &box, 1); ++ REGION_INIT (pScreen, &pWin->borderSize, &box, 1); ++ if (WasViewable) ++ REGION_RESET(pScreen, &pWin->borderClip, &box); ++ pWin->drawable.width = pScreen->width; ++ pWin->drawable.height = pScreen->height; ++ REGION_BREAK (pWin->drawable.pScreen, &pWin->clipList); ++ } ++ else ++ { ++ REGION_EMPTY(pScreen, &pWin->borderClip); ++ REGION_BREAK (pWin->drawable.pScreen, &pWin->clipList); ++ } ++ ++ ResizeChildrenWinSize (pWin, 0, 0, 0, 0); ++ ++ if (WasViewable) ++ { ++ if (pWin->backStorage) ++ { ++ pOldClip = REGION_CREATE(pScreen, NullBox, 1); ++ REGION_COPY(pScreen, pOldClip, &pWin->clipList); ++ } ++ ++ if (pWin->firstChild) ++ { ++ anyMarked |= (*pScreen->MarkOverlappedWindows)(pWin->firstChild, ++ pWin->firstChild, ++ (WindowPtr *)NULL); ++ } ++ else ++ { ++ (*pScreen->MarkWindow) (pWin); ++ anyMarked = TRUE; ++ } ++ ++#ifdef DO_SAVE_UNDERS ++ if (DO_SAVE_UNDERS(pWin)) ++ { ++ dosave = (*pScreen->ChangeSaveUnder)(pLayerWin, pLayerWin); ++ } ++#endif /* DO_SAVE_UNDERS */ ++ ++ if (anyMarked) ++ (*pScreen->ValidateTree)(pWin, NullWindow, VTOther); ++ } ++ ++ if (pWin->backStorage && ++ ((pWin->backingStore == Always) || WasViewable)) ++ { ++ if (!WasViewable) ++ pOldClip = &pWin->clipList; /* a convenient empty region */ ++ bsExposed = (*pScreen->TranslateBackingStore) ++ (pWin, 0, 0, pOldClip, ++ pWin->drawable.x, pWin->drawable.y); ++ if (WasViewable) ++ REGION_DESTROY(pScreen, pOldClip); ++ if (bsExposed) ++ { ++ RegionPtr valExposed = NullRegion; ++ ++ if (pWin->valdata) ++ valExposed = &pWin->valdata->after.exposed; ++ (*pScreen->WindowExposures) (pWin, valExposed, bsExposed); ++ if (valExposed) ++ REGION_EMPTY(pScreen, valExposed); ++ REGION_DESTROY(pScreen, bsExposed); ++ } ++ } ++ if (WasViewable) ++ { ++ if (anyMarked) ++ (*pScreen->HandleExposures)(pWin); ++#ifdef DO_SAVE_UNDERS ++ if (dosave) ++ (*pScreen->PostChangeSaveUnder)(pLayerWin, pLayerWin); ++#endif /* DO_SAVE_UNDERS */ ++ if (anyMarked && pScreen->PostValidateTree) ++ (*pScreen->PostValidateTree)(pWin, NullWindow, VTOther); ++ } ++ if (pWin->realized) ++ WindowsRestructured (); ++ FlushAllOutput (); ++} ++ ++extern void vncHooksResizeScreen(ScreenPtr pScreen); ++ ++static Bool vncRandRSetConfig (ScreenPtr pScreen, Rotation rotation, ++ int rate, RRScreenSizePtr pSize) ++{ ++ pScreen->width = pSize->width; ++ pScreen->height = pSize->height; ++ xf86SetRootClip(pScreen, TRUE); ++ vncHooksResizeScreen(pScreen); ++ return TRUE; ++} ++ ++#endif ++ + static Bool vfbScreenInit(int index, ScreenPtr pScreen, int argc, char** argv) + { + vfbScreenInfoPtr pvfb = &vfbScreens[index]; +@@ -942,6 +1177,20 @@ + pScreen->backingStoreSupport = Always; + #endif + ++#ifdef RANDR ++ if (!ret) return FALSE; ++ ++ { ++ rrScrPrivPtr rp; ++ ++ ret = RRScreenInit(pScreen); ++ if (!ret) return FALSE; ++ rp = rrGetScrPriv(pScreen); ++ rp->rrGetInfo = vncRandRGetInfo; ++ rp->rrSetConfig = vncRandRSetConfig; ++ } ++#endif ++ + return ret; + + } /* end vfbScreenInit */ --- vnc4-4.1.1+xorg4.3.0.orig/debian/rules +++ vnc4-4.1.1+xorg4.3.0/debian/rules @@ -0,0 +1,208 @@ +#!/usr/bin/make -f +# -*- makefile -*- +# Sample debian/rules that uses debhelper. +# +# This file was originally written by Joey Hess and Craig Small. +# As a special exception, when this file is copied by dh-make into a +# dh-make output file, you may use that output file without restriction. +# This special exception was added by Craig Small in version 0.37 of dh-make. +# +# Modified to make a template file for a multi-binary package with separated +# build-arch and build-indep targets by Bill Allombert 2001 + +# Uncomment this to turn on verbose mode. +#export DH_VERBOSE=1 + +# This has to be exported to make some magic below work. +export DH_OPTIONS + + + +CFLAGS = -Wall -g +CXXFLAGS = -Wall -g + +ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS))) + CFLAGS += -O0 + CXXFLAGS += -O0 +else + CFLAGS += -O2 +endif + +configure: configure-unix-stamp configure-common-stamp + +configure-common-stamp: + dh_testdir + # Add here commands to configure the package. + (cd common; CFLAGS="$(CFLAGS)" CXXFLAGS="$(CXXFLAGS)" ./configure \ + --host=$(DEB_HOST_GNU_TYPE) --build=$(DEB_BUILD_GNU_TYPE) \ + --prefix=/usr --mandir=\$${prefix}/share/man \ + --infodir=\$${prefix}/share/info \ + --with-installed-zlib) + touch configure-common-stamp + +configure-unix-stamp: + dh_testdir + # Add here commands to configure the package. + (cd unix; CFLAGS="$(CFLAGS)" CXXFLAGS="$(CXXFLAGS)" ./configure \ + --host=$(DEB_HOST_GNU_TYPE) --build=$(DEB_BUILD_GNU_TYPE) \ + --prefix=/usr --mandir=\$${prefix}/share/man \ + --infodir=\$${prefix}/share/info \ + --with-installed-zlib) + touch configure-unix-stamp + +#Architecture +build: build-arch build-indep + +build-arch: build-arch-unix-stamp build-arch-common-stamp build-arch-x-stamp + +build-arch-x-stamp: build-arch-common-stamp build-arch-unix-stamp + (cd unix/xc; make World) + touch build-arch-x-stamp + +build-arch-common-stamp: configure-common-stamp + (cd common; $(MAKE)) + touch build-arch-common-stamp + +build-arch-unix-stamp: configure-unix-stamp build-arch-common-stamp + (cd unix; $(MAKE)) + touch build-arch-unix-stamp + +build-indep: build-indep-stamp +build-indep-stamp: + # Add here commands to compile the indep part of the package. + #$(MAKE) doc + touch build-indep-stamp + +clean: + dh_testdir + dh_testroot + rm -f build-arch-common-stamp build-arch-unix-stamp build-arch-x-stamp build-indep-stamp configure-unix-stamp configure-common-stamp #CONFIGURE-STAMP# + # Add here commands to clean up after the build process. + -rm -f config.log config.status config.cache config.guess config.sub + -(cd unix/xc; $(MAKE) clean) + -(cd unix/xc; $(MAKE) distclean) + -(cd common; $(MAKE) clean) + -(cd common; $(MAKE) distclean) + -(cd unix; $(MAKE) clean) + -(cd unix; $(MAKE) distclean) + -rm -f \ + unix/tx/Makefile \ + unix/vncconfig/Makefile \ + unix/vncpasswd/Makefile \ + unix/vncviewer/Makefile \ + unix/x0vncserver/Makefile \ + unix/Makefile \ + common/Xregion/Makefile \ + common/network/Makefile \ + common/rdr/Makefile \ + common/rfb/Makefile \ + common/Makefile + -rm -f unix/config.log unix/config.cache unix/config.status + -rm -f common/config.log common/config.cache common/config.status + dh_clean + +install: install-indep install-arch +install-indep: +# dh_testdir +# dh_testroot +# dh_clean -k -i +# dh_installdirs -i +# +# # Add here commands to install the indep part of the package into +# # debian/-doc. +# #INSTALLDOC# +# dh_install -i + +install-arch: + dh_testdir + dh_testroot + dh_clean -k -s + dh_installdirs -s + + # Add here commands to install the arch part of the package into + # debian/tmp. + #$(MAKE) install DESTDIR=$(CURDIR)/debian/vnc4 + mkdir -p $(CURDIR)/debian/tmp/usr/bin + mkdir -p $(CURDIR)/debian/tmp/usr/share/man/man1 + mkdir -p $(CURDIR)/debian/tmp/usr/lib/xorg/modules/extensions + (cd unix; ./vncinstall \ + $(CURDIR)/debian/tmp/usr/bin \ + $(CURDIR)/debian/tmp/usr/share/man \ + $(CURDIR)/debian/tmp/usr/lib/xorg/modules/extensions) + rename "s/vncviewer/xvncviewer/;" \ + debian/tmp/usr/bin/* \ + debian/tmp/usr/share/man/man1/* + rename "s/vnc/vnc4/;" \ + debian/tmp/usr/bin/* \ + debian/tmp/usr/share/man/man1/* + -rm -f debian/tmp/usr/lib/xorg/modules/extensions/*vnc.so + dh_install -s + +# Must not depend on anything. This is to be called by +# binary-arch/binary-indep +# in another 'make' thread. +binary-common: + +# Build architecture independant packages using the common target. +binary-indep: build-indep install-indep + +binary-indep-for-later: + dh_testdir -i + dh_testroot -i + dh_installchangelogs -i + dh_installdocs -i + dh_installexamples -i + dh_installmenu -i +# dh_installdebconf +# dh_installlogrotate +# dh_installemacsen +# dh_installpam +# dh_installmime +# dh_installinit +# dh_installcron +# dh_installinfo + dh_installman -i + dh_link -i + dh_compress -i + dh_fixperms -i +# dh_perl +# dh_python +# dh_makeshlibs -i + dh_installdeb -i +# dh_shlibdeps + dh_gencontrol -i + dh_md5sums -i + dh_builddeb -i + +# Build architecture dependant packages using the common target. +binary-arch: build-arch install-arch + dh_testdir -a + dh_testroot -a + dh_installchangelogs -a + dh_installdocs -a + dh_installexamples -a + dh_installmenu -a +# dh_installdebconf +# dh_installlogrotate +# dh_installemacsen +# dh_installpam +# dh_installmime +# dh_installinit +# dh_installcron +# dh_installinfo + dh_installman -a + dh_link -a + dh_compress -a + dh_fixperms -a +# dh_perl +# dh_python + dh_strip -a + dh_makeshlibs -a + dh_installdeb -a + dh_shlibdeps -a + dh_gencontrol -a + dh_md5sums -a + dh_builddeb -a + +binary: binary-arch binary-indep +.PHONY: build clean binary-indep binary-arch binary install install-indep install-arch configure --- vnc4-4.1.1+xorg4.3.0.orig/debian/vnc.conf +++ vnc4-4.1.1+xorg4.3.0/debian/vnc.conf @@ -0,0 +1,106 @@ +# /etc/vnc.conf written by Marcus Brinkmann. This file is in the Public Domain. +# +# This is the configuration file for the vncserver package. +# It is perl syntax, but only variable assignment is allowed. +# A semicolon will be added if missing. +# Every value has suitable defaults, so you probably don't need any file. +# +# This file will be sourced by `vncserver' and `vncpasswd'. +# After this file, $(HOME)/.vncrc will be sourced, so values can be +# overwritten on a per-user basis. If you want to reactivate the default +# value there, you have to specify an empty value. For example, $fontPath +# will set to the default value after +# +# $fontPath = "/foo"; +# $fontPath = ""; +# +# If you are missing something, please let me know. +# Marcus.Brinkmann@ruhr-uni-bochum.de + +# System configuration +# -------------------- +# +# This section contains entries that should be true for all users. + +# $vncClasses should be the path to the java classes of server. +# $vncClasses = "/usr/share/vncserver"; + +# $XFConfigPath can be set to the global XF86Config file. This will be +# parsed to gain default values for $fontPath and $colorPath. +# If you want to disable this feature, point it to an +# invalid file, "/foo" for example. +# $XFConfigPath = "/etc/X11/XF86Config-4"; + +# $fontPath should be a comma seperated list of fonts to be added to the font +# path. If not specified, and $XFConfigPath is valid, vncserver +# will read the $fontPath from there. If both are not set, the +# default will apply. +# Example: $fontPath = "tcp/localhost:7100"; # would make vnc to use xfs. +# Example: $fontPath = ""; +# $fontPath .= "/usr/X11R6/lib/X11/fonts/misc/,"; +# $fontPath .= "/usr/X11R6/lib/X11/fonts/75dpi/:unscaled,"; +# $fontPath .= "/usr/X11R6/lib/X11/fonts/100dpi/:unscaled,"; +# $fontPath .= "/usr/X11R6/lib/X11/fonts/Type1/,"; +# $fontPath .= "/usr/X11R6/lib/X11/fonts/Speedo/,"; +# $fontPath .= "/usr/X11R6/lib/X11/fonts/75dpi/,"; +# $fontPath .= "/usr/X11R6/lib/X11/fonts/100dpi/,"; +# $fontPath .= "/usr/X11R6/lib/X11/fonts/freefont/,"; +# $fontPath .= "/usr/X11R6/lib/X11/fonts/sharefont/"; +# I don't know what the default is, though. + +# $colorPath should be the RGB file to be used by X. This can also be taken from +# XF86Config file if specified by $XFConfigPath +# $colorPath = "/usr/X11R6/lib/X11/rgb"; + +# User configuration +# ------------------ +# +# This section contains entries that may change from user to user. + +# $vncUserDir contains the filename for the log files directory of Xvnc +# (the server) and the viewers that are connected to it. +# $vncUserDir = "$ENV{HOME}/.vnc"; + +# $vncPasswdFile contains the filename of the password file for Xvnc. +# $vncPasswdFile = $vncUserDir . "/passwd"; + +# $vncStartup points to a script that will be started at the very beginning. +# $vncStartup = "/etc/X11/Xsession"; + +# $xauthorityFile should be the path to the authority file that should be used +# by your vnc X server. +# $xauthorityFile = "$ENV{HOME}/.Xauthority"; + +# $defaultDesktopName should be set to the default name of the desktop. +# This can be changed at the command line with -name. +# $defaultDesktopName = "X"; + +# $geometry sets framebuffer width & height. Default will be calculated if +# server is started from within a running X servers. Can be changed at +# the commandline (-geometry). A fixed default will be used if +# vncserver is not invoked in a running X session. +# Example: $geometry ="640x480"; +# +# For xrandr support: +# $geometry = ["800x600", "1024x768", "640x480"]; + +# $depth sets the framebuffer color depth. Must be between 8 and 32. +# $pixelformat sets the default pixelformat. +# The default will be calculated if none of both is specified +# and when vncserver is called from within a running X servers. +# Can be changed at the command line with option -depth. +# A fixed default value will be used if vncserver is not +# invoked in a running X session. +# Example: $depth = "16"; +# $pixelformat = "rgb565"; + +# $getDefaultFrom sets the display from which you can query the default of +# the above three options, if you don't want to start vncserver +# from within a running X server. It will be added to the call +# of xdpyinfo. +# It is useful to get the default from the X server you will +# run xvncviewer in. +# Example: $getDefaultFrom = "-display localhost:0" + +# $rfbwait sets the maximum time in msec to wait for vnc client viewer. +# $rfbwait = "120000"; --- vnc4-4.1.1+xorg4.3.0.orig/debian/vnc4server.README.Debian +++ vnc4-4.1.1+xorg4.3.0/debian/vnc4server.README.Debian @@ -0,0 +1,2 @@ +You can configure vnc4server by adding a vnc.conf file to /etc. +You can see a sample file in /usr/share/doc/vnc4server/examples. --- vnc4-4.1.1+xorg4.3.0.orig/debian/vnc4server.examples +++ vnc4-4.1.1+xorg4.3.0/debian/vnc4server.examples @@ -0,0 +1 @@ +debian/vnc.conf --- vnc4-4.1.1+xorg4.3.0.orig/debian/vnc4server.install +++ vnc4-4.1.1+xorg4.3.0/debian/vnc4server.install @@ -0,0 +1,11 @@ +debian/tmp/usr/bin/vnc4server usr/bin +debian/tmp/usr/bin/Xvnc4 usr/bin +debian/tmp/usr/bin/x0vnc4server usr/bin +debian/tmp/usr/lib usr +debian/tmp/usr/share/man/man1/vnc4server.1 usr/share/man/man1 +debian/tmp/usr/share/man/man1/x0vnc4server.1 usr/share/man/man1 +debian/tmp/usr/share/man/man1/Xvnc4.1 usr/share/man/man1 +debian/tmp/usr/bin/vnc4passwd usr/bin +debian/tmp/usr/share/man/man1/vnc4passwd.1 usr/share/man/man1 +debian/tmp/usr/bin/vnc4config usr/bin +debian/tmp/usr/share/man/man1/vnc4config.1 usr/share/man/man1 --- vnc4-4.1.1+xorg4.3.0.orig/debian/vnc4server.postinst +++ vnc4-4.1.1+xorg4.3.0/debian/vnc4server.postinst @@ -0,0 +1,30 @@ +#!/bin/sh -e + +if [ "$1" = "configure" ]; then + MAN=/usr/share/man/man1 + BIN=/usr/bin + update-alternatives --install \ + $BIN/vncserver vncserver $BIN/vnc4server 65 \ + --slave \ + $MAN/vncserver.1.gz vncserver.1.gz $MAN/vnc4server.1.gz + update-alternatives --install \ + $BIN/Xvnc Xvnc $BIN/Xvnc4 75 \ + --slave \ + $MAN/Xvnc.1.gz Xvnc.1.gz $MAN/Xvnc4.1.gz + update-alternatives --install \ + $BIN/x0vncserver x0vncserver $BIN/x0vnc4server 75 \ + --slave \ + $MAN/x0vncserver.1.gz x0vncserver.1.gz $MAN/x0vnc4server.1.gz + update-alternatives --install \ + $BIN/vncpasswd vncpasswd $BIN/vnc4passwd 75 \ + --slave \ + $MAN/vncpasswd.1.gz vncpasswd.1.gz $MAN/vnc4passwd.1.gz + update-alternatives --install \ + $BIN/vncconfig vncconfig $BIN/vnc4config 65 \ + --slave \ + $MAN/vncconfig.1.gz vncconfig.1.gz $MAN/vnc4config.1.gz +fi + +#DEBHELPER# + +exit 0 --- vnc4-4.1.1+xorg4.3.0.orig/debian/vnc4server.prerm +++ vnc4-4.1.1+xorg4.3.0/debian/vnc4server.prerm @@ -0,0 +1,19 @@ +#!/bin/sh -e + +if [ "$1" = "remove" ] ; then + BIN=/usr/bin + update-alternatives --remove \ + vncserver $BIN/vnc4server + update-alternatives --remove \ + Xvnc $BIN/Xvnc4 + update-alternatives --remove \ + x0vncserver $BIN/x0vnc4server + update-alternatives --remove \ + vncpasswd $BIN/vnc4passwd + update-alternatives --remove \ + vnc4config $BIN/vnc4config +fi + +#DEBHELPER# + +exit 0 --- vnc4-4.1.1+xorg4.3.0.orig/debian/xvnc4viewer.install +++ vnc4-4.1.1+xorg4.3.0/debian/xvnc4viewer.install @@ -0,0 +1,3 @@ +debian/tmp/usr/bin/xvnc4viewer usr/bin +debian/tmp/usr/share/man/man1/xvnc4viewer.1 usr/share/man/man1 + --- vnc4-4.1.1+xorg4.3.0.orig/debian/xvnc4viewer.menu +++ vnc4-4.1.1+xorg4.3.0/debian/xvnc4viewer.menu @@ -0,0 +1,5 @@ +?package(xvnc4viewer):needs="X11" \ + section="Apps/Net" \ + title="VNC Viewer" \ + command="xvnc4viewer" \ + hints="VNC viewer" --- vnc4-4.1.1+xorg4.3.0.orig/debian/xvnc4viewer.postinst +++ vnc4-4.1.1+xorg4.3.0/debian/xvnc4viewer.postinst @@ -0,0 +1,18 @@ +#!/bin/sh -e + +if [ "$1" = "configure" ]; then + MAN=/usr/share/man/man1 + BIN=/usr/bin + update-alternatives --install \ + $BIN/vncviewer vncviewer $BIN/xvnc4viewer 75 \ + --slave \ + $MAN/vncviewer.1.gz vncviewer.1.gz $MAN/xvnc4viewer.1.gz \ + --slave \ + $MAN/xvncviewer.1.gz xvncviewer.1.gz $MAN/xvnc4viewer.1.gz \ + --slave \ + $BIN/xvncviewer xvncviewer $BIN/xvnc4viewer +fi + +#DEBHELPER# + +exit 0 --- vnc4-4.1.1+xorg4.3.0.orig/debian/xvnc4viewer.prerm +++ vnc4-4.1.1+xorg4.3.0/debian/xvnc4viewer.prerm @@ -0,0 +1,11 @@ +#!/bin/sh -e + +if [ "$1" = "remove" ] ; then + BIN=/usr/bin + update-alternatives --remove \ + vncviewer $BIN/xvnc4viewer +fi + +#DEBHELPER# + +exit 0 --- vnc4-4.1.1+xorg4.3.0.orig/unix/boilerplate.mk +++ vnc4-4.1.1+xorg4.3.0/unix/boilerplate.mk @@ -15,7 +15,7 @@ CFLAGS = @CFLAGS@ $(DIR_CFLAGS) CCLD = $(CC) CXX = @CXX@ -CXXFLAGS = @CXXFLAGS@ +CXXFLAGS = @CXXFLAGS@ $(DIR_CXXFLAGS) CXXLD = $(CXX) CPPFLAGS = @CPPFLAGS@ DEFS = @DEFS@ --- vnc4-4.1.1+xorg4.3.0.orig/unix/configure.in +++ vnc4-4.1.1+xorg4.3.0/unix/configure.in @@ -65,6 +65,18 @@ AC_SUBST(ZLIB_INCLUDE) AC_SUBST(ZLIB_LIB) +AC_ARG_WITH(fb, +[ --with-fb use the new 'fb' framebuffer implementation]) +if test "$with_installed_zlib" = yes; then + echo "using 'fb' framebuffer" + USE_FB=YES +else + echo "using 'mfb' and 'cfb' framebuffer" + USE_FB=NO +fi + +AC_SUBST(USE_FB) + BOILERPLATE=boilerplate.mk if (sh -c "make --version" 2>/dev/null | grep GNU 2>&1 >/dev/null); then @@ -79,4 +91,5 @@ vncviewer/Makefile:common.mk:vncviewer/Makefile.in:$BOILERPLATE \ vncconfig/Makefile:common.mk:vncconfig/Makefile.in:$BOILERPLATE \ vncpasswd/Makefile:common.mk:vncpasswd/Makefile.in:$BOILERPLATE \ + xc/config/cf/vnc.def \ ) --- vnc4-4.1.1+xorg4.3.0.orig/unix/tx/TXImage.cxx +++ vnc4-4.1.1+xorg4.3.0/unix/tx/TXImage.cxx @@ -21,6 +21,7 @@ #include +#include #include #include #include --- vnc4-4.1.1+xorg4.3.0.orig/unix/tx/TXScrollbar.cxx +++ vnc4-4.1.1+xorg4.3.0/unix/tx/TXScrollbar.cxx @@ -44,8 +44,10 @@ void TXScrollbar::set(int limit_, int start_, int len_, bool vert) { - assert(limit_ > 0 && len_ >= 0 && len_ <= limit_); + // This assertion fails under certain window managers. + // assert(limit_ > 0 && len_ >= 0 && len_ <= limit_); + if (len_ > limit_) len_ = limit_; if (start_ < 0) start_ = 0; if (start_ > limit_ - len_) start_ = limit_ - len_; --- vnc4-4.1.1+xorg4.3.0.orig/unix/vncpasswd/vncpasswd.cxx +++ vnc4-4.1.1+xorg4.3.0/unix/vncpasswd/vncpasswd.cxx @@ -117,6 +117,9 @@ continue; } + if (strlen(passwd.buf) > 8) + fprintf(stderr,"Password too long - only the first 8 characters will be used\n"); + FILE* fp = fopen(fname,"w"); if (!fp) { fprintf(stderr,"Couldn't open %s for writing\n",fname); --- vnc4-4.1.1+xorg4.3.0.orig/unix/vncserver +++ vnc4-4.1.1+xorg4.3.0/unix/vncserver @@ -1,5 +1,6 @@ #!/usr/bin/env perl # +# Copyright (C) 2004-2006 Ola Lundqvist # Copyright (C) 2002-2005 RealVNC Ltd. # 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 using +# options from vnc package. +# Most modifications are written by Marcus.Brinkmann@ruhr-uni-bochum.de and +# now incorporated by Ola. + +# Please report all errors to Debian and not to ORL. + # # First make sure we're operating in a sane environment. # @@ -35,18 +43,75 @@ $geometry = "1024x768"; $depth = 16; -$vncJavaFiles = (((-d "/usr/share/vnc/classes") && "/usr/share/vnc/classes") || +$vncJavaFiles = (((-d "/usr/share/vnc-java") && "/usr/share/vnc-java") || + ((-d "/usr/share/vnc/classes") && "/usr/share/vnc/classes") || ((-d "/usr/local/vnc/classes") && "/usr/local/vnc/classes")); + $vncUserDir = "$ENV{HOME}/.vnc"; $xauthorityFile = "$ENV{XAUTHORITY}" || "$ENV{HOME}/.Xauthority"; $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". - "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"); + +######## 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/X11R6/lib/X11/fonts/Type1/,". + "/usr/X11R6/lib/X11/fonts/Speedo/,". + "/usr/X11R6/lib/X11/fonts/misc/,". + "/usr/X11R6/lib/X11/fonts/75dpi/,". + "/usr/X11R6/lib/X11/fonts/100dpi/,". + "/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"; + } else { + $xauthorityFile = "$ENV{HOME}/.Xauthority"; + } +} chop($host = `uname -n`); @@ -54,12 +119,22 @@ # 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 $vncJavaFiles) { + if(-d $vncJavaFiles) { + $useClasses = 1; + } +} + # Uncomment this line if you want default geometry, depth and pixelformat # to match the current X display: # &GetXDisplayDefaults(); @@ -75,8 +150,26 @@ $pixelformat = $opt{'-pixelformat'}; } -&CheckGeometryAndDepth(); +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(); # Create the user's vnc directory if necessary. @@ -85,13 +178,18 @@ die "$prog: Could not create $vncUserDir.\n"; } } - + +($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) = stat("$vncUserDir/passwd"); if (!(-e "$vncUserDir/passwd") || ($mode & 077)) { warn "\nYou will require a password to access your desktops.\n\n"; - system("vncpasswd -q $vncUserDir/passwd"); + system("vncpasswd $vncUserDir/passwd"); if (($? >> 8) != 0) { exit 1; } @@ -116,18 +214,12 @@ $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); -} - -system("xauth -f $xauthorityFile add $host:$displayNumber . $cookie"); -system("xauth -f $xauthorityFile add $host/unix:$displayNumber . $cookie"); +# Make an X server cookie - use mcookie +$cookie = `/usr/bin/mcookie`; +open (XAUTH, "|xauth -f $xauthorityFile source -"); +print XAUTH "add $host:$displayNumber . $cookie\n"; +print XAUTH "add $host/unix:$displayNumber . $cookie\n"; +close XAUTH; if ($opt{'-name'}) { $desktopName = $opt{'-name'}; @@ -137,11 +229,31 @@ # Now start the X VNC Server -$cmd = "Xvnc :$displayNumber"; +$cmd = "Xvnc4 :$displayNumber"; $cmd .= " -desktop " . "edString($desktopName); -$cmd .= " -httpd $vncJavaFiles" if ($vncJavaFiles); +if ($useClasses) { + $cmd .= " -httpd $vncJavaFiles"; + print ("Found $vncJavaFiles 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); +if ($geometry) { + if ($#$geometry==-1) { + $cmd .= " -geometry $geometry"; + } else { + foreach $i (0..$#$geometry) { + $cmd .= " -geometry $geometry->[$i]"; + } + } +} $cmd .= " -depth $depth" if ($depth); $cmd .= " -pixelformat $pixelformat" if ($pixelformat); $cmd .= " -rfbwait 30000"; @@ -154,6 +266,10 @@ # $cmd .= " -fp /usr/lib/X11/fonts/misc/,/usr/lib/X11/fonts/75dpi/"; # $cmd .= " -co /usr/lib/X11/rgb"; # +$cmd .= " -fp $fontPath" if ($fontPath); +$cmd .= " -co $colorPath" if ($colorPath); +$cmd .= " -alwaysshared" if ($opt{'-alwaysshared'}); +$cmd .= " -nevershared" if ($opt{'-nevershared'}); foreach $arg (@ARGV) { $cmd .= " " . "edString($arg); @@ -165,7 +281,7 @@ $pidFile = "$vncUserDir/$host:$displayNumber.pid"; system("$cmd & echo \$! >$pidFile"); -# Give Xvnc a chance to start up +# Give Xvnc4 a chance to start up sleep(3); @@ -173,17 +289,17 @@ # Create the user's xstartup script if necessary. -if (!(-e "$vncUserDir/xstartup")) { - warn "Creating default startup script $vncUserDir/xstartup\n"; - open(XSTARTUP, ">$vncUserDir/xstartup"); +if (!(-e "$xstartup")) { + warn "Creating default startup script $xstartup\n"; + open(XSTARTUP, ">$xstartup"); print XSTARTUP $defaultXStartup; close(XSTARTUP); - chmod 0755, "$vncUserDir/xstartup"; + chmod 0755, "$xstartup"; } # Run the X startup script. -warn "Starting applications specified in $vncUserDir/xstartup\n"; +warn "Starting applications specified in $xstartup\n"; warn "Log file is $desktopLog\n\n"; # If the unix domain socket exists then use that (DISPLAY=:n) otherwise use @@ -198,10 +314,70 @@ } $ENV{VNCDESKTOP}= $desktopName; -system("$vncUserDir/xstartup >> " . "edString($desktopLog) . " 2>&1 &"); +system("$xstartup >> " . "edString($desktopLog) . " 2>&1 &"); 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 () { + 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 () { + 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 ( && !$colorPath) { + chomp; + $lineno++; + s/\#.*//og; + next if /^\s*$/og; + if (/^\s*RgbPath\s*"(\S.*)"\s*$/o) { + $colorPath = $1; + } + } +} + + +########## End of debian functions ########### + ############################################################################### # @@ -209,9 +385,10 @@ # are sensible. # -sub CheckGeometryAndDepth +sub CheckGeometry { - if ($geometry =~ /^(\d+)x(\d+)$/) { + my $geometry=shift; + if ($geometry =~ /^(\d+)x(\d+)$/) { $width = $1; $height = $2; if (($width<1) || ($height<1)) { @@ -231,6 +408,19 @@ die "$prog: geometry $geometry is invalid\n"; } +} + +sub CheckGeometryAndDepth +{ + if ($geometry) { + if ($#$geometry==-1) { + &CheckGeometry($geometry); + } else { + foreach $i (0..$#$geometry) { + &CheckGeometry($geometry->[$i]); + } + } + } if (($depth < 8) || ($depth > 32)) { die "Depth must be between 8 and 32\n"; } @@ -415,11 +605,25 @@ sub Usage { - die("\nusage: $prog [:] [-name ] [-depth ]\n". - " [-geometry x]\n". - " [-pixelformat rgbNNN|bgrNNN]\n". - " ...\n\n". - " $prog -kill \n\n"); + die("VNC4 server\n". + "\n". + "Usage: $prog [] [:]\n". + " $prog -kill :\n". + "\n". + " are Xvnc4 options, or:\n". + "\n". + " -name \n". + " -depth \n". + " -geometry x\n". + " -httpport number\n". + " -basehttpport number\n". + " -alwaysshared\n". + " -nevershared\n". + " -pixelformat rgb\n". + " -pixelformat bgr\n". + " ...\n". + "\n". + "See vnc4server and Xvnc4 manual pages for more information.\n"); } @@ -443,12 +647,12 @@ if (! -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 Xvnc4 process manually\n\n"; } $SIG{'HUP'} = 'IGNORE'; chop($pid = `cat $pidFile`); - warn "Killing Xvnc process ID $pid\n"; + warn "Killing Xvnc4 process ID $pid\n"; system("kill $pid"); unlink $pidFile; exit; @@ -484,7 +688,13 @@ if (@ARGV == 0) { &Usage(); } - $opt{$opt} = shift(@ARGV); + if ($opt{$opt}) { + # Convert scalar to array if necessary + $opt{$opt} = [$opt{$opt}] if $#{$opt{$opt}}==-1; + push(@{$opt{$opt}},shift(@ARGV)); + } else { + $opt{$opt} = shift(@ARGV); + } push(@optArgs, $opt{$opt}); } else { $opt{$opt} = 1; @@ -518,7 +728,7 @@ # cmd: - foreach $cmd ("uname","xauth","Xvnc","vncpasswd") { + foreach $cmd ("uname","xauth","Xvnc4","vncpasswd") { for (split(/:/,$ENV{PATH})) { if (-x "$_/$cmd") { next cmd; --- vnc4-4.1.1+xorg4.3.0.orig/unix/vncserver.man +++ vnc4-4.1.1+xorg4.3.0/unix/vncserver.man @@ -53,6 +53,7 @@ .TP .B \-geometry \fIwidth\fPx\fIheight\fP Specify the size of the desktop to be created. Default is 1024x768. +Can be specified as an array or scalar for geometry. .TP .B \-depth \fIdepth\fP --- vnc4-4.1.1+xorg4.3.0.orig/unix/vncviewer/CConn.cxx +++ vnc4-4.1.1+xorg4.3.0/unix/vncviewer/CConn.cxx @@ -19,6 +19,8 @@ // CConn.cxx // +#include +#include #include #include "CConn.h" #include @@ -50,7 +52,7 @@ StringParameter windowName("name", "The X window name", ""); CConn::CConn(Display* dpy_, int argc_, char** argv_, network::Socket* sock_, - char* vncServerName, bool reverse) + char* vncServerName, bool reverse, int ipVersion) : dpy(dpy_), argc(argc_), argv(argv_), serverHost(0), serverPort(0), sock(sock_), viewport(0), desktop(0), desktopEventHandler(0), @@ -86,14 +88,31 @@ if (vncServerName) { getHostAndPort(vncServerName, &serverHost, &serverPort); } else { - ServerDialog dlg(dpy, &options, &about); - if (!dlg.show() || dlg.entry.getText()[0] == 0) { - exit(1); + int popup = popupXDialog; + if (!popup) { + /* Get server */ + fprintf(stderr, "Server: "); + vncServerName = new char[128]; + if(fgets(vncServerName, 128, stdin)) { + size_t len = strlen(vncServerName); + /* remove \n at the end */ + if(vncServerName[len-1] == '\n') + vncServerName[len-1] = '\0'; + } else { + /* fgets failed, probably eof -- assume empty string as input */ + vncServerName[0] = '\0'; + } + getHostAndPort(vncServerName, &serverHost, &serverPort); + } else { + ServerDialog dlg(dpy, &options, &about); + if (!dlg.show() || dlg.entry.getText()[0] == 0) { + exit(1); + } + getHostAndPort(dlg.entry.getText(), &serverHost, &serverPort); } - getHostAndPort(dlg.entry.getText(), &serverHost, &serverPort); } - sock = new network::TcpSocket(serverHost, serverPort); + sock = new network::TcpSocket(serverHost, serverPort, ipVersion); vlog.info("connected to host %s port %d", serverHost, serverPort); } @@ -194,6 +213,9 @@ void CConn::getUserPasswd(char** user, char** password) { + struct termios oldio; + struct termios newio; + CharArray passwordFileStr(passwordFile.getData()); if (!user && passwordFileStr.buf[0]) { FILE* fp = fopen(passwordFileStr.buf, "r"); @@ -206,15 +228,49 @@ return; } - const char* secType = secTypeName(getCurrentCSecurity()->getType()); - const char* titlePrefix = "VNC Authentication"; - CharArray title(strlen(titlePrefix) + strlen(secType) + 4); - sprintf(title.buf, "%s [%s]", titlePrefix, secType); - PasswdDialog dlg(dpy, title.buf, !user); - if (!dlg.show()) throw rfb::Exception("Authentication cancelled"); - if (user) - *user = strDup(dlg.userEntry.getText()); - *password = strDup(dlg.passwdEntry.getText()); + int popup = popupXDialog; + if (!popup) { + if (user) { + /* Get username */ + fprintf(stderr, "Username: "); + *user = new char[128]; + fgets(*user, 128, stdin); + /* Remove \n at the end */ + (*user)[strlen(*user)-1] = '\0'; + } + + if (tcgetattr (fileno (stdin), &oldio) != 0) { + popup = 1; + } else { + newio = oldio; + newio.c_lflag &= ~ECHO; + fprintf(stderr, "Password: "); + /* Echo off */ + if (tcsetattr (fileno (stdin), TCSAFLUSH, &newio) != 0) + popup = 1; + + /* Read the password. */ + *password = new char[64]; + fgets (*password, 64, stdin); + /* Remove \n at the end */ + (*password)[strlen(*password)-1] = '\0'; + + /* Restore terminal. */ + (void) tcsetattr (fileno (stdin), TCSAFLUSH, &oldio); + } + } + + if (popup) { + const char* secType = secTypeName(getCurrentCSecurity()->getType()); + const char* titlePrefix = "VNC Authentication"; + CharArray title(strlen(titlePrefix) + strlen(secType) + 4); + sprintf(title.buf, "%s [%s]", titlePrefix, secType); + PasswdDialog dlg(dpy, title.buf, !user); + if (!dlg.show()) throw rfb::Exception("Authentication cancelled"); + if (user) + *user = strDup(dlg.userEntry.getText()); + *password = strDup(dlg.passwdEntry.getText()); + } } @@ -245,9 +301,16 @@ fullColourPF = desktop->getPF(); if (!serverPF.trueColour) fullColour = true; - recreateViewport(); + CharArray xEmbedStr(xEmbed.getData()); + if (!xEmbedStr.buf[0]) + recreateViewport(); formatChange = encodingChange = true; requestNewUpdate(); + if (xEmbedStr.buf[0]) { + unsigned int targetWindow = 0; + targetWindow = strtol(xEmbed.getData(), NULL, 0); + XReparentWindow(dpy, desktop->win(), (Window) targetWindow, 0, 0); + } } // setDesktopSize() is called when the desktop size changes (including when --- vnc4-4.1.1+xorg4.3.0.orig/unix/vncviewer/CConn.h +++ vnc4-4.1.1+xorg4.3.0/unix/vncviewer/CConn.h @@ -48,7 +48,7 @@ public: CConn(Display* dpy_, int argc_, char** argv_, network::Socket* sock_, - char* vncServerName, bool reverse=false); + char* vncServerName, bool reverse=false, int ipVersion=0); ~CConn(); // TXDeleteWindowCallback methods --- vnc4-4.1.1+xorg4.3.0.orig/unix/vncviewer/parameters.h +++ vnc4-4.1.1+xorg4.3.0/unix/vncviewer/parameters.h @@ -37,6 +37,8 @@ extern rfb::BoolParameter sendPrimary; extern rfb::BoolParameter fullScreen; extern rfb::StringParameter geometry; +extern rfb::BoolParameter popupXDialog; +extern rfb::StringParameter xEmbed; extern char aboutText[]; extern char* programName; --- vnc4-4.1.1+xorg4.3.0.orig/unix/vncviewer/vncviewer.cxx +++ vnc4-4.1.1+xorg4.3.0/unix/vncviewer/vncviewer.cxx @@ -41,6 +41,7 @@ using namespace network; using namespace rfb; +using namespace std; IntParameter pointerEventInterval("PointerEventInterval", "Time in milliseconds to rate-limit" @@ -92,8 +93,17 @@ BoolParameter listenMode("listen", "Listen for connections from VNC servers", false); +BoolParameter popupXDialog("XDialog", + "Popup an X dialog when asking for server, " + "username and password. Default no when " + "running from command line", + !isatty(0)); StringParameter geometry("geometry", "X geometry specification", ""); StringParameter displayname("display", "The X display", ""); +StringParameter xEmbed("XEmbed", "Embed into another window with a given id", ""); + +/* Support for tunnelling */ +StringParameter via("via", "Gateway to tunnel via", ""); char aboutText[256]; char* programName; @@ -143,7 +153,7 @@ static void usage() { fprintf(stderr, - "\nusage: %s [parameters] [host:displayNum] [parameters]\n" + "\nusage: %s [-4|-6] [parameters] [host:displayNum] [parameters]\n" " %s [parameters] -listen [port] [parameters]\n", programName,programName); fprintf(stderr,"\n" @@ -157,6 +167,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 Free Edition 4.1.1 for X - built %s\n" @@ -175,8 +240,16 @@ programName = argv[0]; char* vncServerName = 0; Display* dpy = 0; + int ipVersion = 0; for (int i = 1; i < argc; i++) { + if (!strcmp(argv[i], "-4")) { + ipVersion = 4; + continue; + } else if(!strcmp(argv[i], "-6")) { + ipVersion = 6; + continue; + } if (Configuration::setParam(argv[i])) continue; @@ -190,8 +263,6 @@ usage(); } - if (vncServerName) - usage(); vncServerName = argv[i]; } @@ -207,6 +278,19 @@ vlog.error("Could not create .vnc directory: environment variable $HOME not set."); try { + /* 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) { @@ -238,7 +322,7 @@ TXWindow::init(dpy, "Vncviewer"); xloginIconifier.iconify(dpy); - CConn cc(dpy, argc, argv, sock, vncServerName, listenMode); + CConn cc(dpy, argc, argv, sock, vncServerName, listenMode, ipVersion); // X events are processed whenever reading from the socket would block. @@ -251,7 +335,7 @@ vlog.info(e.str()); } catch (rdr::Exception& e) { vlog.error(e.str()); - if (dpy) { + if (popupXDialog) { TXMsgBox msgBox(dpy, e.str(), MB_OK, "VNC Viewer: Information"); msgBox.show(); } --- vnc4-4.1.1+xorg4.3.0.orig/unix/vncviewer/vncviewer.man +++ vnc4-4.1.1+xorg4.3.0/unix/vncviewer/vncviewer.man @@ -1,4 +1,4 @@ -.TH vncviewer 1 "03 Mar 2005" "RealVNC Ltd" "Virtual Network Computing" +.TH vncviewer 1 "08 Nov 2006" "RealVNC Ltd" "Virtual Network Computing" .SH NAME vncviewer \- VNC viewer for X .SH SYNOPSIS @@ -102,6 +102,11 @@ .B vncconfig. .TP +.B \-XDialog +Popup an X dialog when asking for server, username and password. Default is to +not popup when vncviewer is start from command line. + +.TP .B \-passwd \fIpassword-file\fP If you are on a filesystem which gives you access to the password file used by the server, you can specify it here to avoid typing it in. It will usually be @@ -174,6 +179,23 @@ specified as an X11 keysym name (these can be obtained by removing the XK_ prefix from the entries in "/usr/include/X11/keysymdef.h"). Default is F8. +.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 \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 vncpasswd (1), --- vnc4-4.1.1+xorg4.3.0.orig/unix/x0vncserver/Image.cxx +++ vnc4-4.1.1+xorg4.3.0/unix/x0vncserver/Image.cxx @@ -21,6 +21,7 @@ #include +#include #include #include #include --- vnc4-4.1.1+xorg4.3.0.orig/unix/x0vncserver/x0vncserver.cxx +++ vnc4-4.1.1+xorg4.3.0/unix/x0vncserver/x0vncserver.cxx @@ -36,7 +36,7 @@ #include #include #include - +#include //#include @@ -48,6 +48,9 @@ StringParameter displayname("display", "The X display", ""); IntParameter rfbport("rfbport", "TCP port to listen for RFB protocol",5900); +BoolParameter localhostOnly("localhost", + "Only allow connections from localhost", + false); IntParameter queryConnectTimeout("QueryConnectTimeout", "Number of seconds to show the Accept Connection dialog before " "rejecting the connection", @@ -293,7 +296,7 @@ QueryConnHandler qcHandler(dpy, &server); server.setQueryConnectionHandler(&qcHandler); - TcpListener listener((int)rfbport); + TcpListener listener((int)rfbport, localhostOnly); vlog.info("Listening on port %d", (int)rfbport); while (true) { @@ -307,6 +310,8 @@ TXWindow::handleXEvents(dpy); // Process expired timers and get the time until the next one + tv.tv_sec = 0; + tv.tv_usec = 100000; int timeoutMs = Timer::checkTimeouts(); soonestTimeout(&timeoutMs, server.checkTimeouts()); if (timeoutMs) { --- vnc4-4.1.1+xorg4.3.0.orig/unix/xc.patch +++ vnc4-4.1.1+xorg4.3.0/unix/xc.patch @@ -2,7 +2,7 @@ --- xc/programs/Xserver/Imakefile Fri Jun 6 11:14:39 2003 *************** *** 409,412 **** ---- 409,429 ---- +--- 409,435 ---- #endif #endif /* XsunServer */ + XCOMM @@ -13,12 +13,18 @@ + CFB16DIR = cfb16 + CFB24DIR = cfb24 + CFB32DIR = cfb32 ++ FBDIR = fb + XVNCDDXDIR = vnc/Xvnc ++ #if VncUseFb ++ XVNCDIRS = $(STDDIRS) $(FBDIR) $(XVNCDDXDIR) $(DEPDIRS) ++ XVNCLIBS = PreFbLibs vnc/Xvnc/LibraryTargetName(xvnc) FbPostFbLibs ++ #else + XVNCDIRS = $(STDDIRS) $(MFBDIR) \ + $(CFB8DIR) $(CFB16DIR) $(CFB24DIR) $(CFB32DIR) \ + $(XVNCDDXDIR) $(DEPDIRS) -+ XVNCOBJS = $(XVNCDDXDIR)/stubs.o $(XVNCDDXDIR)/miinitext.o + XVNCLIBS = PreFbLibs vnc/Xvnc/LibraryTargetName(xvnc) CFBLibs PostFbLibs ++ #endif ++ XVNCOBJS = $(XVNCDDXDIR)/stubs.o $(XVNCDDXDIR)/miinitext.o + XVNCSYSLIBS = $(FONTLIBS) $(SYSLIBS) + ServerTarget(Xvnc,$(XVNCDIRS),$(XVNCOBJS), \ + $(LIBCWRAPPER) $(XVNCLIBS) $(LOADABLEEXTS),$(XVNCSYSLIBS)) --- vnc4-4.1.1+xorg4.3.0.orig/unix/xc/config/cf/Imake.cf +++ vnc4-4.1.1+xorg4.3.0/unix/xc/config/cf/Imake.cf @@ -211,6 +211,10 @@ # define PpcArchitecture # undef __powerpc__ # endif +# ifdef __aarch64__ +# define Aarch64Architecture +# undef __powerpc__ +# endif #endif /* NetBSD */ #ifdef __FreeBSD__ @@ -727,6 +731,10 @@ # define s390Architecture # undef __s390__ # endif /* s390 */ +# ifdef __aarch64__ +# define Aarch64Architecture +# undef __aarch64__ +# endif # ifdef __alpha # define AlphaArchitecture # undef __alpha --- vnc4-4.1.1+xorg4.3.0.orig/unix/xc/config/cf/X11.tmpl +++ vnc4-4.1.1+xorg4.3.0/unix/xc/config/cf/X11.tmpl @@ -738,7 +738,7 @@ #endif #endif #ifndef DefaultRGBDatabase -#define DefaultRGBDatabase $(LIBDIR)/rgb +#define DefaultRGBDatabase /usr/share/X11/rgb #endif #ifndef UseRgbTxt #define UseRgbTxt NO /* default is to compile with dbm */ @@ -1548,7 +1548,7 @@ DOCDIR = DocDir DOCHTMLDIR = DocHtmlDir DOCPSDIR = DocPsDir - FONTDIR = FontDir /* font directories */ + FONTDIR = /usr/share/fonts/X11 /* font directories */ ENCODINGSDIR = $(FONTDIR)/encodings /* font encodings directory */ XINITDIR = XinitDir /* xinit config files */ XDMDIR = XdmDir /* xdm config files */ --- vnc4-4.1.1+xorg4.3.0.orig/unix/xc/config/cf/linux.cf +++ vnc4-4.1.1+xorg4.3.0/unix/xc/config/cf/linux.cf @@ -255,7 +255,9 @@ /* On x86, determine whether to build with MTRR support */ #ifndef HasMTRRSupport -# if defined (i386Architecture) || defined (x86_64Architecture) +# if defined (i386Architecture) +/* || defined (x86_64Architecture) */ +/* Temporarily disable MTRR support for amd64 arch */ /* There is no certain way to know if is available, but it made it into kernel 2.2, so... */ # if OSMajorVersion > 2 || (OSMajorVersion == 2 && OSMinorVersion >= 2) @@ -313,6 +315,8 @@ # define BuildXF86DRI NO # endif #endif +#undef BuildXF86DRI +#define BuildXF86DRI NO /* * Build shared libGL and the DRI modules without -fPIC on some architectures. @@ -744,6 +748,17 @@ # define VendorHasX11R6_3libXext YES /* XC or XFree86 >= 3.3.1 */ #endif +#ifdef Aarch64Architecture +/* Cargoculted from Arm32Architecture w/ -D_XSERVER64 added */ +# define DefaultCCOptions -fsigned-char +# ifndef OptimizedCDebugFlags +# define OptimizedCDebugFlags -O3 +# endif +# define LinuxMachineDefines -D__aarch64__ +# define ServerOSDefines XFree86ServerOSDefines -DDDXTIME -DPART_NET +# define ServerExtraDefines -DGCCUSESGAS XFree86ServerDefines -D_XSERVER64 +#endif /* Aarch64Architecture */ + #ifdef AlphaArchitecture # ifndef OptimizedCDebugFlags # define OptimizedCDebugFlags DefaultGcc2AxpOpt @@ -816,7 +831,11 @@ # endif # define LinuxMachineDefines -D__powerpc__ # define ServerOSDefines XFree86ServerOSDefines -DDDXTIME -DPART_NET +# ifdef __powerpc64__ +# define ServerExtraDefines -DGCCUSESGAS XFree86ServerDefines -D_XSERVER64 +# else # define ServerExtraDefines -DGCCUSESGAS XFree86ServerDefines +# endif #endif /* PpcArchitecture */ #ifdef s390Architecture --- vnc4-4.1.1+xorg4.3.0.orig/unix/xc/config/cf/vnc.def +++ vnc4-4.1.1+xorg4.3.0/unix/xc/config/cf/vnc.def @@ -5,7 +5,7 @@ #define BuildPexExt NO #define BuildNls NO #define BuildXIE NO -#define BuildGlxExt NO +#define BuildGlxExt YES #define XnestServer NO #define XprtServer NO --- vnc4-4.1.1+xorg4.3.0.orig/unix/xc/config/cf/vnc.def.in +++ vnc4-4.1.1+xorg4.3.0/unix/xc/config/cf/vnc.def.in @@ -0,0 +1,38 @@ +#define BuildServersOnly YES +#define BuildFonts NO +#define BuildClients NO +#define BuildDocs NO +#define BuildPexExt NO +#define BuildNls NO +#define BuildXIE NO +#define BuildGlxExt NO +#define XnestServer YES +#define XF86Server NO +#define XprtServer NO + +#ifdef SunArchitecture +#define ProjectRoot /usr/openwin +#define HasGcc2 YES +#define BuildXKB NO +#endif + +#define HasFreetype2 NO +#define BuildVNCExt YES +#define VNCExtDefines -DVNCEXT +#define SiteExtensionDefines VNCExtDefines +#define SiteExtensionDirs vnc + +#define VncUseFb @USE_FB@ + +#define VncUnixDir $(TOP)/.. +#define VncCommonDir VncUnixDir/../common +#define VncExtLibs VncCommonDir/rfb/librfb.a \ + VncCommonDir/Xregion/libXregion.a \ + VncCommonDir/network/libnetwork.a \ + VncCommonDir/rdr/librdr.a + +#define SiteExtensionLibs vnc/LibraryTargetName(vnc) VncExtLibs + +#define ServerTarget(server,subdirs,objects,libs,syslibs) @@\ +CCLINK = $(CXXENVSETUP) $(CXX) @@\ +ServerTargetWithFlags(server,subdirs,objects,libs,syslibs,$(_NOOP_)) --- vnc4-4.1.1+xorg4.3.0.orig/unix/xc/config/makedepend/ifparser.c +++ vnc4-4.1.1+xorg4.3.0/unix/xc/config/makedepend/ifparser.c @@ -296,12 +296,20 @@ case '/': DO (cp = parse_product (g, cp + 1, &rightval)); - *valp = (*valp / rightval); + if (rightval == 0) { + *valp = 0; + } else { + *valp = (*valp / rightval); + } break; case '%': DO (cp = parse_product (g, cp + 1, &rightval)); - *valp = (*valp % rightval); + if (rightval == 0) { + *valp = 0; + } else { + *valp = (*valp % rightval); + } break; } return cp; --- vnc4-4.1.1+xorg4.3.0.orig/unix/xc/include/Xmd.h +++ vnc4-4.1.1+xorg4.3.0/unix/xc/include/Xmd.h @@ -58,9 +58,10 @@ #ifdef CRAY #define WORD64 /* 64-bit architecture */ #endif -#if defined(__alpha) || defined(__alpha__) || \ +#if defined (__aarch64__) || \ + defined(__alpha) || defined(__alpha__) || \ defined(__ia64__) || defined(ia64) || \ - defined(__sparc64__) || \ + defined(__sparc64__) || defined(__powerpc64__) || \ defined(__s390x__) || \ (defined(__hppa__) && defined(__LP64__)) || \ defined(__x86_64__) || defined(x86_64) --- vnc4-4.1.1+xorg4.3.0.orig/unix/xc/programs/Xserver/Xext/Imakefile +++ vnc4-4.1.1+xorg4.3.0/unix/xc/programs/Xserver/Xext/Imakefile @@ -76,7 +76,7 @@ #if BuildXCSecurity SECURITYSRCS = security.c SECURITYOBJS = security.o - SERVERCONFIGDIR = ServerConfigDir + SERVERCONFIGDIR = /etc/X11/xserver POLICYFILEDEF = -DDEFAULTPOLICYFILE=\"$(SERVERCONFIGDIR)/SecurityPolicy\" #endif #if BuildCup --- vnc4-4.1.1+xorg4.3.0.orig/unix/xc/programs/Xserver/hw/xfree86/common/compiler.h +++ vnc4-4.1.1+xorg4.3.0/unix/xc/programs/Xserver/hw/xfree86/common/compiler.h @@ -857,6 +857,7 @@ unsigned int IOPortBase; /* Memory mapped I/O port area */ +# if defined(__mips__) static __inline__ void outb(unsigned PORT_SIZE port, unsigned char val) { @@ -893,8 +894,6 @@ return *(volatile unsigned int*)(((unsigned PORT_SIZE)(port))+IOPortBase); } - -# if defined(__mips__) static __inline__ unsigned long ldq_u(unsigned long * r11) { unsigned long r1; @@ -1244,6 +1243,35 @@ # define mem_barrier() eieio() # define write_mem_barrier() eieio() +# elif defined(__arm__) && defined(__linux__) + +/* for Linux on ARM, we use the LIBC inx/outx routines */ +/* note that the appropriate setup via "ioperm" needs to be done */ +/* *before* any inx/outx is done. */ +#include + +static __inline__ void +xf_outb(unsigned short port, unsigned char val) +{ + outb(val, port); +} + +static __inline__ void +xf_outw(unsigned short port, unsigned short val) +{ + outw(val, port); +} + +static __inline__ void +xf_outl(unsigned short port, unsigned int val) +{ + outl(val, port); +} + +#define outb xf_outb +#define outw xf_outw +#define outl xf_outl + # else /* ix86 */ # define ldq_u(p) (*((unsigned long *)(p))) --- vnc4-4.1.1+xorg4.3.0.orig/unix/xc/programs/Xserver/hw/xfree86/fbdevhw/fbdevhw.c +++ vnc4-4.1.1+xorg4.3.0/unix/xc/programs/Xserver/hw/xfree86/fbdevhw/fbdevhw.c @@ -14,7 +14,15 @@ #include "fbdevhw.h" #include "fbpriv.h" -#include "asm/page.h" /* #define for PAGE_* */ +/* Added check so that asm/page.h is not included for hppa arch */ +/* Ola Lundqvist, to work around Debian Bug#485958 & Bug#486104*/ +#if !defined(__hppa__) && !defined(__mips__) && !defined(__alpha__) +# include "asm/page.h" /* #define for PAGE_* */ +#endif + +#ifndef PAGE_MASK +#define PAGE_MASK (~(sysconf(_SC_PAGESIZE) - 1)) +#endif #include "globals.h" #define DPMS_SERVER --- vnc4-4.1.1+xorg4.3.0.orig/unix/xc/programs/Xserver/hw/xfree86/os-support/bus/xf86Sbus.h +++ vnc4-4.1.1+xorg4.3.0/unix/xc/programs/Xserver/hw/xfree86/os-support/bus/xf86Sbus.h @@ -27,6 +27,8 @@ #if defined(linux) #include +/* Next line is added by Ola Lundqvist to solve Debian Bug#477659. */ +#include #include #include #elif defined(SVR4) --- vnc4-4.1.1+xorg4.3.0.orig/unix/xc/programs/Xserver/hw/xfree86/os-support/linux/lnx.h +++ vnc4-4.1.1+xorg4.3.0/unix/xc/programs/Xserver/hw/xfree86/os-support/linux/lnx.h @@ -8,7 +8,9 @@ /* new pciconfig_iobase syscall added in 2.2.15 and 2.3.99 */ # include -# include +/* No longer include asm/pci.h on alpha on Debian as it do not exist in any + * package (Ola Lundqvist) */ +/* include */ extern long (*_iobase)(unsigned, int, int, int); /* --- vnc4-4.1.1+xorg4.3.0.orig/unix/xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_axp.c +++ vnc4-4.1.1+xorg4.3.0/unix/xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_axp.c @@ -110,7 +110,9 @@ * pciconfig_iobase wrappers and dynamic i/o selection */ #include +#if !defined(__alpha__) #include +#endif #include /* glibc versions (single hose only) */ --- vnc4-4.1.1+xorg4.3.0.orig/unix/xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_io.c +++ vnc4-4.1.1+xorg4.3.0/unix/xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_io.c @@ -69,7 +69,7 @@ #include #ifdef __sparc__ #include -#include +/*#include */ #endif /* Deal with spurious kernel header change */ @@ -87,19 +87,20 @@ struct kbd_repeat kbdrep_s; /* don't change, just test */ - kbdrep_s.rate = -1; + /*kbdrep_s.rate = -1;*/ kbdrep_s.delay = -1; if (ioctl( 0, KDKBDREP, &kbdrep_s )) { return 0; } /* do the change */ - if (rate == 0) /* switch repeat off */ - kbdrep_s.rate = 0; - else - kbdrep_s.rate = 10000 / rate; /* convert cps to msec */ - if (kbdrep_s.rate < 1) - kbdrep_s.rate = 1; + /*if (rate == 0)*/ /* switch repeat off */ + /* kbdrep_s.rate = 0;*/ + /*else*/ + /* kbdrep_s.rate = 10000 / rate;*/ /* convert cps to msec */ + /* if (kbdrep_s.rate < 1)*/ + /* kbdrep_s.rate = 1; */ + kbdrep_s.delay = delay; if (kbdrep_s.delay < 1) kbdrep_s.delay = 1; @@ -124,10 +125,10 @@ if (fd == -1) return 0; - kbdrate_s.rate = (rate + 5) / 10; /* must be integer, so round up */ + /*kbdrate_s.rate = (rate + 5) / 10;*/ /* must be integer, so round up */ kbdrate_s.delay = delay * HZ / 1000; /* convert ms to Hz */ - if (kbdrate_s.rate > 50) - kbdrate_s.rate = 50; + /*if (kbdrate_s.rate > 50) + kbdrate_s.rate = 50;*/ if (ioctl( fd, KIOCSRATE, &kbdrate_s )) return 0; --- vnc4-4.1.1+xorg4.3.0.orig/unix/xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_kbd.c +++ vnc4-4.1.1+xorg4.3.0/unix/xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_kbd.c @@ -96,7 +96,7 @@ #ifdef __sparc__ #include -#include +/*#include */ #endif static int @@ -107,19 +107,19 @@ struct kbd_repeat kbdrep_s; /* don't change, just test */ - kbdrep_s.rate = -1; + /*kbdrep_s.rate = -1;*/ kbdrep_s.delay = -1; if (ioctl( 0, KDKBDREP, &kbdrep_s )) { return 0; } /* do the change */ - if (rate == 0) /* switch repeat off */ - kbdrep_s.rate = 0; - else - kbdrep_s.rate = 10000 / rate; /* convert cps to msec */ - if (kbdrep_s.rate < 1) - kbdrep_s.rate = 1; + /*if (rate == 0)*/ /* switch repeat off */ + /* kbdrep_s.rate = 0;*/ + /*else + kbdrep_s.rate = 10000 / rate;*/ /* convert cps to msec */ + /*if (kbdrep_s.rate < 1) + kbdrep_s.rate = 1;*/ kbdrep_s.delay = delay; if (kbdrep_s.delay < 1) kbdrep_s.delay = 1; @@ -144,10 +144,10 @@ if (fd == -1) return 0; - kbdrate_s.rate = (rate + 5) / 10; /* must be integer, so round up */ + /*kbdrate_s.rate = (rate + 5) / 10;*/ /* must be integer, so round up */ kbdrate_s.delay = delay * HZ / 1000; /* convert ms to Hz */ - if (kbdrate_s.rate > 50) - kbdrate_s.rate = 50; + /*if (kbdrate_s.rate > 50) + kbdrate_s.rate = 50;*/ if (ioctl( fd, KIOCSRATE, &kbdrate_s )) return 0; --- vnc4-4.1.1+xorg4.3.0.orig/unix/xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_video.c +++ vnc4-4.1.1+xorg4.3.0/unix/xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_video.c @@ -25,6 +25,12 @@ */ /* $XConsortium: lnx_video.c /main/9 1996/10/19 18:06:34 kaleb $ */ +#ifdef __x86_64__ +#ifndef BITS_PER_LONG +#define BITS_PER_LONG 64 +#endif +#endif + #include "X.h" #include "input.h" #include "scrnintstr.h" @@ -67,6 +73,12 @@ #endif +#ifdef __x86_64__ +#ifndef BITS_PER_LONG +#define BITS_PER_LONG 64 +#endif +#endif + #ifdef __alpha__ # ifdef LIBC_IS_FIXED --- vnc4-4.1.1+xorg4.3.0.orig/unix/xc/programs/Xserver/include/servermd.h +++ vnc4-4.1.1+xorg4.3.0/unix/xc/programs/Xserver/include/servermd.h @@ -132,6 +132,28 @@ #endif /* vax */ +#ifdef __aarch64__ +/* Heavily cargo-culted from arm32 */ +#define IMAGE_BYTE_ORDER LSBFirst + +# if defined(XF86MONOVGA) || defined(XF86VGA16) || defined(XF86MONO) +# define BITMAP_BIT_ORDER MSBFirst +# else +# define BITMAP_BIT_ORDER LSBFirst +# endif + +# if defined(XF86MONOVGA) || defined(XF86VGA16) +# define BITMAP_SCANLINE_UNIT 8 +# endif + +#define GLYPHPADBYTES 4 +#define GETLEFTBITS_ALIGNMENT 1 +#define LARGE_INSTRUCTION_CACHE +#define AVOID_MEMORY_READ +#define PLENTIFUL_REGISTERS + +#endif /* __aarch64__ */ + #ifdef __arm32__ #define IMAGE_BYTE_ORDER LSBFirst --- vnc4-4.1.1+xorg4.3.0.orig/unix/xc/programs/Xserver/randr/randr.c +++ vnc4-4.1.1+xorg4.3.0/unix/xc/programs/Xserver/randr/randr.c @@ -726,10 +726,31 @@ * timestamp, then the config information isn't up-to-date and * can't even be validated */ + /* A DIRTY WORKAROUND. + * Looks like under some reasons, this test fails, although 32bit timestamp + * passed in stuff->configTimestamp is exactly the same as was returned + * in RRGetScreenInfo just before. So 'months' parts differ. Maybe + * some bug elsewhere, causing 'months' jump? Or maybe it could happen + * if enough time passed since previous configuration? I'm afraid that + * both have happened here ... + * Since I have no time to investigate details, I'm just replacing this + * with 32bit compare. Probability of config times that differ only + * in months is extremely low ... */ if (CompareTimeStamps (configTime, pScrPriv->lastConfigTime) != 0) { - rep.status = RRSetConfigInvalidConfigTime; - goto sendReply; + if (pScrPriv->lastConfigTime.milliseconds == stuff->configTimestamp) + { + ErrorF("Point X: last: %lu %lu, new: %lu %lu\n", + pScrPriv->lastConfigTime.months, + pScrPriv->lastConfigTime.milliseconds, + configTime.months, + configTime.milliseconds); + } + else + { + rep.status = RRSetConfigInvalidConfigTime; + goto sendReply; + } } /* --- vnc4-4.1.1+xorg4.3.0.orig/unix/xc/programs/Xserver/vnc/Imakefile +++ vnc4-4.1.1+xorg4.3.0/unix/xc/programs/Xserver/vnc/Imakefile @@ -19,7 +19,7 @@ SRCS = vncExtInit.cc vncHooks.cc XserverDesktop.cc OBJS = vncExtInit.o vncHooks.o XserverDesktop.o INCLUDES = -I../include -I$(EXTINCSRC) -I$(XINCLUDESRC) -I$(FONTINCSRC) \ - -I../mfb -I../mi $(VNCINCLUDE) + -I../render $(VNCINCLUDE) #if defined(XFree86Version) && XFree86Version >= 4000 VNCDEFINES = -DGC_HAS_COMPOSITE_CLIP #endif @@ -36,8 +36,8 @@ NormalLintTarget($(SRCS)) NormalLibraryObjectRule() -NormalCplusplusObjectRule() - +.CCsuf.Osuf: + NormalSharedLibObjCplusplusCompile($(_NOOP_)) MakeSubdirs($(SUBDIRS)) DependSubdirs($(SUBDIRS)) --- vnc4-4.1.1+xorg4.3.0.orig/unix/xc/programs/Xserver/vnc/XserverDesktop.cc +++ vnc4-4.1.1+xorg4.3.0/unix/xc/programs/Xserver/vnc/XserverDesktop.cc @@ -193,6 +193,9 @@ else data = new rdr::U8[pScreen->width * pScreen->height * (format.bpp/8)]; colourmap = this; +#ifdef RANDR + initialWidth = width_; +#endif serverReset(pScreen); @@ -714,7 +717,11 @@ grabbing = true; int bytesPerPixel = format.bpp/8; +#ifdef RANDR + int bytesPerRow = initialWidth * bytesPerPixel; +#else int bytesPerRow = pScreen->width * bytesPerPixel; +#endif std::vector rects; std::vector::iterator i; --- vnc4-4.1.1+xorg4.3.0.orig/unix/xc/programs/Xserver/vnc/XserverDesktop.h +++ vnc4-4.1.1+xorg4.3.0/unix/xc/programs/Xserver/vnc/XserverDesktop.h @@ -68,6 +68,12 @@ void addClient(network::Socket* sock, bool reverse); void disconnectClients(); +#ifdef RANDR + void setSize(int w, int h) { + width_ = w; height_ = h; server->setPixelBuffer(this); + } +#endif + // QueryConnect methods called from X server code // getQueryTimeout() // Returns the timeout associated with a particular @@ -126,5 +132,9 @@ void* queryConnectId; rfb::CharArray queryConnectAddress; rfb::CharArray queryConnectUsername; +#ifdef RANDR + int initialWidth; + int getStride() const { return initialWidth; } +#endif }; #endif --- vnc4-4.1.1+xorg4.3.0.orig/unix/xc/programs/Xserver/vnc/Xvnc/Imakefile +++ vnc4-4.1.1+xorg4.3.0/unix/xc/programs/Xserver/vnc/Xvnc/Imakefile @@ -31,13 +31,21 @@ OBJS1 = os2_stubs.o #endif +#ifdef VncUseFb +FB_DEFINES = -DVNC_USE_FB + FBINCLUDE = -I../../fb +#else + FBINCLUDE = -I../../cfb +#endif + SRCSA = xvnc.cc stubs.c $(SRCS1) miinitext.c $(SRCS2) OBJSA = xvnc.o stubs.o $(OBJS1) miinitext.o $(OBJS2) -INCLUDES = -I. -I.. -I$(XBUILDINCDIR) -I$(FONTINCSRC) \ - -I../../cfb -I../../mfb -I../../mi -I../../include -I../../os \ - -I$(EXTINCSRC) -I$(XINCLUDESRC) -I$(SERVERSRC)/render $(VNCINCLUDE) +INCLUDES = -I. -I.. -I$(XBUILDINCDIR) -I$(FONTINCSRC) $(FB_DEFINES) \ + $(FBINCLUDE) -I../../mfb -I../../mi -I../../include -I../../os \ + -I$(EXTINCSRC) -I$(XINCLUDESRC) -I$(SERVERSRC)/render \ + -I$(SERVERSRC)/randr $(VNCINCLUDE) DEFINES = $(OS_DEFINES) $(SHMDEF) $(MMAPDEF) \ $(VENDOR_STRING) $(VENDOR_RELEASE) $(STD_DEFINES) ServerOSDefines \ @@ -48,7 +56,7 @@ * Make sure XINPUT, XF86VidTune, etc arent defined for the miinitext.o * used by Xvnc */ -EXT_DEFINES = ExtensionDefines -UXF86VIDMODE -UXFreeXDGA -UXF86MISC +EXT_DEFINES = ExtensionDefines -UXINPUT -UXF86VIDMODE -UXFreeXDGA -UXF86MISC #endif @@ -70,7 +78,7 @@ SpecialCplusplusObjectRule(xvnc,$(ICONFIGFILES) xvnc,$(EXT_DEFINES) $(NO_OPERATOR_NAMES)) LinkSourceFile(miinitext.c,$(SERVERSRC)/mi) -SpecialCObjectRule(miinitext,$(ICONFIGFILES),$(EXT_DEFINES) $(PAN_DEFINES) -DNO_MODULE_EXTS $(EXT_MODULE_DEFINES) -UXFree86LOADER) +SpecialCObjectRule(miinitext,$(ICONFIGFILES),$(EXT_DEFINES) $(PAN_DEFINES) -DNO_HW_ONLY_EXTS -DNO_MODULE_EXTS $(EXT_MODULE_DEFINES) -UXFree86LOADER) /* InstallManPage(Xvfb,$(MANDIR)) */ DependTarget() --- vnc4-4.1.1+xorg4.3.0.orig/unix/xc/programs/Xserver/vnc/Xvnc/xvnc.cc +++ vnc4-4.1.1+xorg4.3.0/unix/xc/programs/Xserver/vnc/Xvnc/xvnc.cc @@ -48,8 +48,12 @@ #include "X11/Xos.h" #include "scrnintstr.h" #include "servermd.h" +#ifdef VNC_USE_FB +#include "fb.h" +#else #define PSZ 8 #include "cfb.h" +#endif #include "mi.h" #include "mibstore.h" #include "colormapst.h" @@ -73,6 +77,7 @@ #undef public #undef xor #undef and +#ifndef VNC_USE_FB extern Bool cfb16ScreenInit(ScreenPtr, pointer, int, int, int, int, int); extern Bool cfb32ScreenInit(ScreenPtr, pointer, int, int, int, int, int); extern Bool cfb16CreateGC(GCPtr); @@ -83,6 +88,7 @@ unsigned long, char*); extern void cfb32GetImage(DrawablePtr, int, int, int, int, unsigned int, unsigned long, char*); +#endif } #define XVNCVERSION "Free Edition 4.1.1" @@ -101,6 +107,16 @@ #define VFB_DEFAULT_LINEBIAS 0 #define XWD_WINDOW_NAME_LEN 60 +#ifdef RANDR + +extern "C" { +#include +} + +#define RR_MAX_SCREEN_SIZES 8 +typedef struct { int width, height; } rrScreenSize; +#endif + typedef struct { int scrnum; @@ -121,7 +137,10 @@ Bool pixelFormatDefined; Bool rgbNotBgr; int redBits, greenBits, blueBits; - +#ifdef RANDR + int rrScreenSizesDefined; + rrScreenSize rrScreenSizes[RR_MAX_SCREEN_SIZES]; +#endif } vfbScreenInfo, *vfbScreenInfoPtr; static int vfbNumScreens; @@ -129,6 +148,9 @@ static Bool vfbPixmapDepths[33]; static char needswap = 0; static int lastScreen = -1; +#ifdef RENDER +static Bool Render = FALSE; +#endif static bool displaySpecified = false; static bool wellKnownSocketsCreated = false; @@ -166,6 +188,11 @@ vfbScreens[i].lineBias = VFB_DEFAULT_LINEBIAS; vfbScreens[i].pixelFormatDefined = FALSE; vfbScreens[i].pfbMemory = NULL; +#ifdef RANDR + vfbScreens[i].rrScreenSizesDefined = 0; + vfbScreens[i].rrScreenSizes[0].width = VFB_DEFAULT_WIDTH; + vfbScreens[i].rrScreenSizes[0].height = VFB_DEFAULT_HEIGHT; +#endif } vfbNumScreens = 1; } @@ -220,6 +247,10 @@ VENDOR_STRING); ErrorF("-screen scrn WxHxD set screen's width, height, depth\n"); ErrorF("-pixdepths list-of-int support given pixmap depths\n"); +#ifdef RENDER + ErrorF("+/-render turn on/off RENDER extension support" + "(default on)\n"); +#endif ErrorF("-linebias n adjust thin line pixelization\n"); ErrorF("-blackpixel n pixel value for black\n"); ErrorF("-whitepixel n pixel value for white\n"); @@ -316,6 +347,20 @@ return ret; } +#ifdef RENDER + if (strcmp (argv[i], "+render") == 0) /* +render */ + { + Render = TRUE; + return 1; + } + + if (strcmp (argv[i], "-render") == 0) /* -render */ + { + Render = FALSE; + return 1; + } +#endif + if (strcmp (argv[i], "-blackpixel") == 0) /* -blackpixel n */ { Pixel pix; @@ -379,11 +424,45 @@ if (strcmp(argv[i], "-geometry") == 0) { if (++i >= argc) UseMsg(); +#ifdef RANDR + if (vfbScreens[0].rrScreenSizesDefined == RR_MAX_SCREEN_SIZES) + { + ErrorF("Too many modes\n"); + UseMsg(); + } + else + { + rrScreenSize *rrss; + rrss = &(vfbScreens[0].rrScreenSizes[vfbScreens[0].rrScreenSizesDefined]); + if (sscanf(argv[i], "%dx%d", &rrss->width, &rrss->height) != 2 || + rrss->width <= 32 && rrss->height <= 32) { + ErrorF("Invalid geometry %s\n", argv[i]); + UseMsg(); + } + else + { + if (vfbScreens[0].rrScreenSizesDefined == 0) { + vfbScreens[0].width = rrss->width; + vfbScreens[0].height = rrss->height; + } + else + { + if (vfbScreens[0].width < rrss->width) + vfbScreens[0].width = rrss->width; + if (vfbScreens[0].height < rrss->height) + vfbScreens[0].height = rrss->height; + } + + vfbScreens[0].rrScreenSizesDefined++; + } + } +#else if (sscanf(argv[i],"%dx%d",&vfbScreens[0].width, &vfbScreens[0].height) != 2) { ErrorF("Invalid geometry %s\n", argv[i]); UseMsg(); } +#endif return 2; } @@ -482,7 +561,7 @@ } #endif - +#ifndef VNC_USE_FB static Bool vfbMultiDepthCreateGC(GCPtr pGC) { switch (vfbBitsPerPixel(pGC->depth)) @@ -541,6 +620,7 @@ break; } } +#endif static ColormapPtr InstalledMaps[MAXSCREENS]; @@ -792,6 +872,195 @@ miPointerWarpCursor }; +#ifdef RANDR + +static Bool vncRandRGetInfo (ScreenPtr pScreen, Rotation *rotations) +{ + vfbScreenInfoPtr pvfb = &vfbScreens[pScreen->myNum]; + int dpi = monitorResolution ? monitorResolution : 100; + int i; + + if (pvfb->rrScreenSizesDefined == 0) + pvfb->rrScreenSizesDefined = 1; /* case without -geometry */ + + for (i = 0; i < pvfb->rrScreenSizesDefined; i++) + { + RRScreenSizePtr pSize; + + pSize = RRRegisterSize(pScreen, + pvfb->rrScreenSizes[i].width, pvfb->rrScreenSizes[i].height, + (pvfb->rrScreenSizes[i].width * 254 + dpi * 5) / (dpi * 10), + (pvfb->rrScreenSizes[i].height * 254 + dpi * 5) / (dpi * 10)); + if (!pSize) + return FALSE; + RRRegisterRate(pScreen, pSize, 60); + + if (pvfb->rrScreenSizes[i].width == pScreen->width && + pvfb->rrScreenSizes[i].height == pScreen->height) + RRSetCurrentConfig(pScreen, RR_Rotate_0, 60, pSize); + } + + *rotations = RR_Rotate_0; + return TRUE; +} + +/* from hw/xfree86/common/xf86Helper.c */ + +#include "mivalidate.h" +static void +xf86SetRootClip (ScreenPtr pScreen, Bool enable) +{ + WindowPtr pWin = WindowTable[pScreen->myNum]; + WindowPtr pChild; + Bool WasViewable = (Bool)(pWin->viewable); + Bool anyMarked = FALSE; + RegionPtr pOldClip = NULL, bsExposed; +#ifdef DO_SAVE_UNDERS + Bool dosave = FALSE; +#endif + WindowPtr pLayerWin; + BoxRec box; + + if (WasViewable) + { + for (pChild = pWin->firstChild; pChild; pChild = pChild->nextSib) + { + (void) (*pScreen->MarkOverlappedWindows)(pChild, + pChild, + &pLayerWin); + } + (*pScreen->MarkWindow) (pWin); + anyMarked = TRUE; + if (pWin->valdata) + { + if (HasBorder (pWin)) + { + RegionPtr borderVisible; + + borderVisible = REGION_CREATE(pScreen, NullBox, 1); + REGION_SUBTRACT(pScreen, borderVisible, + &pWin->borderClip, &pWin->winSize); + pWin->valdata->before.borderVisible = borderVisible; + } + pWin->valdata->before.resized = TRUE; + } + } + + /* + * Use REGION_BREAK to avoid optimizations in ValidateTree + * that assume the root borderClip can't change well, normally + * it doesn't...) + */ + if (enable) + { + box.x1 = 0; + box.y1 = 0; + box.x2 = pScreen->width; + box.y2 = pScreen->height; + REGION_INIT (pScreen, &pWin->winSize, &box, 1); + REGION_INIT (pScreen, &pWin->borderSize, &box, 1); + if (WasViewable) + REGION_RESET(pScreen, &pWin->borderClip, &box); + pWin->drawable.width = pScreen->width; + pWin->drawable.height = pScreen->height; + REGION_BREAK (pWin->drawable.pScreen, &pWin->clipList); + } + else + { + REGION_EMPTY(pScreen, &pWin->borderClip); + REGION_BREAK (pWin->drawable.pScreen, &pWin->clipList); + } + + ResizeChildrenWinSize (pWin, 0, 0, 0, 0); + + if (WasViewable) + { + if (pWin->backStorage) + { + pOldClip = REGION_CREATE(pScreen, NullBox, 1); + REGION_COPY(pScreen, pOldClip, &pWin->clipList); + } + + if (pWin->firstChild) + { + anyMarked |= (*pScreen->MarkOverlappedWindows)(pWin->firstChild, + pWin->firstChild, + (WindowPtr *)NULL); + } + else + { + (*pScreen->MarkWindow) (pWin); + anyMarked = TRUE; + } + +#ifdef DO_SAVE_UNDERS + if (DO_SAVE_UNDERS(pWin)) + { + dosave = (*pScreen->ChangeSaveUnder)(pLayerWin, pLayerWin); + } +#endif /* DO_SAVE_UNDERS */ + + if (anyMarked) + (*pScreen->ValidateTree)(pWin, NullWindow, VTOther); + } + + if (pWin->backStorage && + ((pWin->backingStore == Always) || WasViewable)) + { + if (!WasViewable) + pOldClip = &pWin->clipList; /* a convenient empty region */ + bsExposed = (*pScreen->TranslateBackingStore) + (pWin, 0, 0, pOldClip, + pWin->drawable.x, pWin->drawable.y); + if (WasViewable) + REGION_DESTROY(pScreen, pOldClip); + if (bsExposed) + { + RegionPtr valExposed = NullRegion; + + if (pWin->valdata) + valExposed = &pWin->valdata->after.exposed; + (*pScreen->WindowExposures) (pWin, valExposed, bsExposed); + if (valExposed) + REGION_EMPTY(pScreen, valExposed); + REGION_DESTROY(pScreen, bsExposed); + } + } + if (WasViewable) + { + if (anyMarked) + (*pScreen->HandleExposures)(pWin); +#ifdef DO_SAVE_UNDERS + if (dosave) + (*pScreen->PostChangeSaveUnder)(pLayerWin, pLayerWin); +#endif /* DO_SAVE_UNDERS */ + if (anyMarked && pScreen->PostValidateTree) + (*pScreen->PostValidateTree)(pWin, NullWindow, VTOther); + } + if (pWin->realized) + WindowsRestructured (); + FlushAllOutput (); +} + +extern void vncHooksResizeScreen(ScreenPtr pScreen); + +static Bool vncRandRSetConfig (ScreenPtr pScreen, Rotation rotation, + int rate, RRScreenSizePtr pSize) +{ + int dpi = monitorResolution ? monitorResolution : 100; + + pScreen->width = pSize->width; + pScreen->height = pSize->height; + pScreen->mmWidth = (pScreen->width * 254 + dpi * 5) / (dpi * 10); + pScreen->mmHeight = (pScreen->height * 254 + dpi * 5) / (dpi * 10); + + xf86SetRootClip(pScreen, TRUE); + vncHooksResizeScreen(pScreen); + return TRUE; +} + +#endif + static Bool vfbScreenInit(int index, ScreenPtr pScreen, int argc, char** argv) { vfbScreenInfoPtr pvfb = &vfbScreens[index]; @@ -811,6 +1080,16 @@ defaultColorVisualClass = (pvfb->bitsPerPixel > 8) ? TrueColor : PseudoColor; +#ifdef VNC_USE_FB + if (!fbScreenInit(pScreen, pbits, pvfb->width, pvfb->height, + dpi, dpi, pvfb->paddedWidth, pvfb->bitsPerPixel)) + return FALSE; + +#ifdef RENDER + if (ret && Render) + fbPictureInit(pScreen, 0, 0); +#endif /* RENDER */ +#else /* VNC_USE_FB */ switch (pvfb->bitsPerPixel) { case 1: @@ -838,6 +1117,7 @@ pScreen->CreateGC = vfbMultiDepthCreateGC; pScreen->GetImage = vfbMultiDepthGetImage; pScreen->GetSpans = vfbMultiDepthGetSpans; +#endif pScreen->InstallColormap = vfbInstallColormap; pScreen->UninstallColormap = vfbUninstallColormap; @@ -883,6 +1163,9 @@ } } +#ifdef VNC_USE_FB + ret = fbCreateDefColormap(pScreen); +#else if (pvfb->bitsPerPixel == 1) { ret = mfbCreateDefColormap(pScreen); @@ -891,6 +1174,7 @@ { ret = cfbCreateDefColormap(pScreen); } +#endif miSetZeroLineBias(pScreen, pvfb->lineBias); @@ -899,6 +1183,20 @@ pScreen->backingStoreSupport = Always; #endif +#ifdef RANDR + if (!ret) return FALSE; + + { + rrScrPrivPtr rp; + + ret = RRScreenInit(pScreen); + if (!ret) return FALSE; + rp = rrGetScrPriv(pScreen); + rp->rrGetInfo = vncRandRGetInfo; + rp->rrSetConfig = vncRandRSetConfig; + } +#endif + return ret; } /* end vfbScreenInit */ @@ -926,6 +1224,19 @@ vfbPixmapDepths[vfbScreens[i].depth] = TRUE; } +#ifdef RENDER + /* RENDER needs a good set of pixmaps. */ + if (Render) { + vfbPixmapDepths[1] = TRUE; + vfbPixmapDepths[4] = TRUE; + vfbPixmapDepths[8] = TRUE; +/* vfbPixmapDepths[15] = TRUE; */ + vfbPixmapDepths[16] = TRUE; + vfbPixmapDepths[24] = TRUE; + vfbPixmapDepths[32] = TRUE; + } +#endif + for (i = 1; i <= 32; i++) { if (vfbPixmapDepths[i]) @@ -1215,4 +1526,18 @@ RegisterKeyboardDevice(k); miRegisterPointerDevice(screenInfo.screens[0], p); (void)mieqInit ((DevicePtr)k, (DevicePtr)p); + + // Use this point as a hook to set initial screen geometry + // We could not do it before vncExtensionInit() call, because + // at that point pScreen->width should correspond to real framebuffer width + { + ScreenPtr pScreen = screenInfo.screens[0]; + vfbScreenInfoPtr pvfb = &vfbScreens[0]; + int dpi = monitorResolution ? monitorResolution : 100; + pScreen->width = pvfb->rrScreenSizes[0].width; + pScreen->height = pvfb->rrScreenSizes[0].height; + pScreen->mmWidth = (pScreen->width * 254 + dpi * 5) / (dpi * 10); + pScreen->mmHeight = (pScreen->height * 254 + dpi * 5) / (dpi * 10); + vncHooksResizeScreen(pScreen); + } } --- vnc4-4.1.1+xorg4.3.0.orig/unix/xc/programs/Xserver/vnc/module/Imakefile +++ vnc4-4.1.1+xorg4.3.0/unix/xc/programs/Xserver/vnc/module/Imakefile @@ -13,15 +13,16 @@ OBJS = vncExtInit.o vncHooks.o xf86vncModule.o XserverDesktop.o INCLUDES = -I.. -I../../include -I$(EXTINCSRC) -I$(XINCLUDESRC) \ -I$(FONTINCSRC) -I$(XF86COMSRC) \ - $(VNCINCLUDE) - DEFINES = $(STD_DEFINES) -DGC_HAS_COMPOSITE_CLIP -DXFree86LOADER + -I../../render $(VNCINCLUDE) + DEFINES = -fPIC $(STD_DEFINES) -DGC_HAS_COMPOSITE_CLIP -DXFree86LOADER LinkSourceFile(vncExtInit.cc,..) LinkSourceFile(vncHooks.cc,..) LinkSourceFile(xf86vncModule.cc,..) LinkSourceFile(XserverDesktop.cc,..) -ModuleObjectRule() +.CCsuf.Osuf: + NormalSharedLibObjCplusplusCompile($(_NOOP_)) /* LibraryModuleTarget(vnc,$(OBJS) $(VNCLIBS)) InstallLibraryModule(vnc,$(MODULEDIR),extensions) --- vnc4-4.1.1+xorg4.3.0.orig/unix/xc/programs/Xserver/vnc/vncExtInit.cc +++ vnc4-4.1.1+xorg4.3.0/unix/xc/programs/Xserver/vnc/vncExtInit.cc @@ -18,6 +18,8 @@ #include +#include "XserverDesktop.h" + extern "C" { #define class c_class #define NEED_EVENTS @@ -48,7 +50,6 @@ #undef min #include -#include "XserverDesktop.h" #include "vncHooks.h" #include "vncExtInit.h" @@ -159,8 +160,7 @@ network::TcpListener* listener = 0; network::TcpListener* httpListener = 0; if (scr == 0 && vncInetdSock != -1) { - if (network::TcpSocket::isSocket(vncInetdSock) && - !network::TcpSocket::isConnected(vncInetdSock)) + if (network::TcpSocket::isListening(vncInetdSock)) { listener = new network::TcpListener(0, 0, vncInetdSock, true); vlog.info("inetd wait"); @@ -751,7 +751,7 @@ rep.timeout = qcTimeout; rep.addrLen = qcTimeout ? strlen(qcAddress) : 0; rep.userLen = qcTimeout ? strlen(qcUsername) : 0; - rep.opaqueId = (CARD32)queryConnectId; + rep.opaqueId = (CARD32)(long)queryConnectId; rep.length = (rep.userLen + rep.addrLen + 3) >> 2; if (client->swapped) { swaps(&rep.sequenceNumber, n); --- vnc4-4.1.1+xorg4.3.0.orig/unix/xc/programs/Xserver/vnc/vncHooks.cc +++ vnc4-4.1.1+xorg4.3.0/unix/xc/programs/Xserver/vnc/vncHooks.cc @@ -29,6 +29,9 @@ #include "regionstr.h" #include "dixfontstr.h" #include "colormapst.h" +#ifdef RENDER +#include "picturestr.h" +#endif #ifdef GC_HAS_COMPOSITE_CLIP #define COMPOSITE_CLIP(gc) ((gc)->pCompositeClip) @@ -74,6 +77,9 @@ StoreColorsProcPtr StoreColors; DisplayCursorProcPtr DisplayCursor; ScreenBlockHandlerProcPtr BlockHandler; +#ifdef RENDER + CompositeProcPtr Composite; +#endif } vncHooksScreenRec, *vncHooksScreenPtr; typedef struct { @@ -104,6 +110,13 @@ static Bool vncHooksDisplayCursor(ScreenPtr pScreen, CursorPtr cursor); static void vncHooksBlockHandler(int i, pointer blockData, pointer pTimeout, pointer pReadmask); +#ifdef RENDER +static void vncHooksComposite(CARD8 op, PicturePtr pSrc, PicturePtr pMask, + PicturePtr pDst, INT16 xSrc, INT16 ySrc, + INT16 xMask, INT16 yMask, INT16 xDst, INT16 yDst, + CARD16 width, CARD16 height); +#endif + // GC "funcs" @@ -229,6 +242,13 @@ vncHooksScreen->StoreColors = pScreen->StoreColors; vncHooksScreen->DisplayCursor = pScreen->DisplayCursor; vncHooksScreen->BlockHandler = pScreen->BlockHandler; +#ifdef RENDER + PictureScreenPtr ps; + ps = GetPictureScreenIfSet(pScreen); + if (ps) { + vncHooksScreen->Composite = ps->Composite; + } +#endif pScreen->CloseScreen = vncHooksCloseScreen; pScreen->CreateGC = vncHooksCreateGC; @@ -241,6 +261,11 @@ pScreen->StoreColors = vncHooksStoreColors; pScreen->DisplayCursor = vncHooksDisplayCursor; pScreen->BlockHandler = vncHooksBlockHandler; +#ifdef RENDER + if (ps) { + ps->Composite = vncHooksComposite; + } +#endif return TRUE; } @@ -470,6 +495,38 @@ SCREEN_REWRAP(BlockHandler); } +// Composite - needed for RENDER + +#ifdef RENDER +void vncHooksComposite(CARD8 op, PicturePtr pSrc, PicturePtr pMask, + PicturePtr pDst, INT16 xSrc, INT16 ySrc, INT16 xMask, + INT16 yMask, INT16 xDst, INT16 yDst, CARD16 width, + CARD16 height) +{ + ScreenPtr pScreen = pDst->pDrawable->pScreen; + vncHooksScreenPtr vncHooksScreen = \ + ((vncHooksScreenPtr)pScreen->devPrivates[vncHooksScreenIndex].ptr); + BoxRec box; + PictureScreenPtr ps = GetPictureScreen(pScreen); + + if ((xDst >= 0) && (yDst >= 0)) { + box.x1 = pDst->pDrawable->x + xDst; + box.y1 = pDst->pDrawable->y + yDst; + box.x2 = box.x1 + width; + box.y2 = box.y1 + height; + + RegionHelper changed(pScreen, &box, 0); + vncHooksScreen->desktop->add_changed(changed.reg); + } + + ps->Composite = vncHooksScreen->Composite; + (*ps->Composite)(op, pSrc, pMask, pDst, xSrc, ySrc, + xMask, yMask, xDst, yDst, width, height); + ps->Composite = vncHooksComposite; +} + +#endif /* RENDER */ + ///////////////////////////////////////////////////////////////////////////// @@ -1473,3 +1530,11 @@ vncHooksScreen->desktop->add_changed(changed.reg); } + +void vncHooksResizeScreen(ScreenPtr pScreen) +{ + vncHooksScreenPtr vncHooksScreen + = ((vncHooksScreenPtr)pScreen->devPrivates[vncHooksScreenIndex].ptr); + + vncHooksScreen->desktop->setSize(pScreen->width, pScreen->height); +}