summaryrefslogtreecommitdiffstats
path: root/rfb
diff options
context:
space:
mode:
authorSlávek Banko <slavek.banko@axis.cz>2019-02-06 16:56:55 +0100
committerSlávek Banko <slavek.banko@axis.cz>2019-02-06 16:56:55 +0100
commitf3f392caec43b4095bc1d84b315ed7972c13c144 (patch)
tree5c4ba8b5d38f1ae33de71507c5634a15a0b35bfe /rfb
parent8c081c8888bccbf5adfe0fc4ec518e2cbfba9871 (diff)
parent0a70095271d845d16a3ed17354841b01f33963ad (diff)
downloadlibtdevnc-f3f392caec43b4095bc1d84b315ed7972c13c144.tar.gz
libtdevnc-f3f392caec43b4095bc1d84b315ed7972c13c144.zip
Merge tag 'LibVNCServer-0.9.12'
Signed-off-by: Slávek Banko <slavek.banko@axis.cz>
Diffstat (limited to 'rfb')
-rw-r--r--rfb/default8x16.h5
-rw-r--r--rfb/rfb.h9
-rw-r--r--rfb/rfbclient.h69
-rw-r--r--rfb/rfbconfig.h.cmakein (renamed from rfb/rfbconfig.h.cmake)62
-rw-r--r--rfb/rfbint.h.cmake4
-rw-r--r--rfb/rfbproto.h9
6 files changed, 143 insertions, 15 deletions
diff --git a/rfb/default8x16.h b/rfb/default8x16.h
index 252f411..6096b1c 100644
--- a/rfb/default8x16.h
+++ b/rfb/default8x16.h
@@ -1,3 +1,6 @@
+#ifndef _DEFAULT_8_X_16_H
+#define _DEFAULT_8_X_16_H
+
static unsigned char default8x16FontData[4096+1]={
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x7e,0x81,0xa5,0x81,0x81,0xbd,0x99,0x81,0x81,0x7e,0x00,0x00,0x00,0x00,
@@ -259,3 +262,5 @@ static unsigned char default8x16FontData[4096+1]={
static int default8x16FontMetaData[256*5+1]={
0,8,16,0,0,16,8,16,0,0,32,8,16,0,0,48,8,16,0,0,64,8,16,0,0,80,8,16,0,0,96,8,16,0,0,112,8,16,0,0,128,8,16,0,0,144,8,16,0,0,160,8,16,0,0,176,8,16,0,0,192,8,16,0,0,208,8,16,0,0,224,8,16,0,0,240,8,16,0,0,256,8,16,0,0,272,8,16,0,0,288,8,16,0,0,304,8,16,0,0,320,8,16,0,0,336,8,16,0,0,352,8,16,0,0,368,8,16,0,0,384,8,16,0,0,400,8,16,0,0,416,8,16,0,0,432,8,16,0,0,448,8,16,0,0,464,8,16,0,0,480,8,16,0,0,496,8,16,0,0,512,8,16,0,0,528,8,16,0,0,544,8,16,0,0,560,8,16,0,0,576,8,16,0,0,592,8,16,0,0,608,8,16,0,0,624,8,16,0,0,640,8,16,0,0,656,8,16,0,0,672,8,16,0,0,688,8,16,0,0,704,8,16,0,0,720,8,16,0,0,736,8,16,0,0,752,8,16,0,0,768,8,16,0,0,784,8,16,0,0,800,8,16,0,0,816,8,16,0,0,832,8,16,0,0,848,8,16,0,0,864,8,16,0,0,880,8,16,0,0,896,8,16,0,0,912,8,16,0,0,928,8,16,0,0,944,8,16,0,0,960,8,16,0,0,976,8,16,0,0,992,8,16,0,0,1008,8,16,0,0,1024,8,16,0,0,1040,8,16,0,0,1056,8,16,0,0,1072,8,16,0,0,1088,8,16,0,0,1104,8,16,0,0,1120,8,16,0,0,1136,8,16,0,0,1152,8,16,0,0,1168,8,16,0,0,1184,8,16,0,0,1200,8,16,0,0,1216,8,16,0,0,1232,8,16,0,0,1248,8,16,0,0,1264,8,16,0,0,1280,8,16,0,0,1296,8,16,0,0,1312,8,16,0,0,1328,8,16,0,0,1344,8,16,0,0,1360,8,16,0,0,1376,8,16,0,0,1392,8,16,0,0,1408,8,16,0,0,1424,8,16,0,0,1440,8,16,0,0,1456,8,16,0,0,1472,8,16,0,0,1488,8,16,0,0,1504,8,16,0,0,1520,8,16,0,0,1536,8,16,0,0,1552,8,16,0,0,1568,8,16,0,0,1584,8,16,0,0,1600,8,16,0,0,1616,8,16,0,0,1632,8,16,0,0,1648,8,16,0,0,1664,8,16,0,0,1680,8,16,0,0,1696,8,16,0,0,1712,8,16,0,0,1728,8,16,0,0,1744,8,16,0,0,1760,8,16,0,0,1776,8,16,0,0,1792,8,16,0,0,1808,8,16,0,0,1824,8,16,0,0,1840,8,16,0,0,1856,8,16,0,0,1872,8,16,0,0,1888,8,16,0,0,1904,8,16,0,0,1920,8,16,0,0,1936,8,16,0,0,1952,8,16,0,0,1968,8,16,0,0,1984,8,16,0,0,2000,8,16,0,0,2016,8,16,0,0,2032,8,16,0,0,2048,8,16,0,0,2064,8,16,0,0,2080,8,16,0,0,2096,8,16,0,0,2112,8,16,0,0,2128,8,16,0,0,2144,8,16,0,0,2160,8,16,0,0,2176,8,16,0,0,2192,8,16,0,0,2208,8,16,0,0,2224,8,16,0,0,2240,8,16,0,0,2256,8,16,0,0,2272,8,16,0,0,2288,8,16,0,0,2304,8,16,0,0,2320,8,16,0,0,2336,8,16,0,0,2352,8,16,0,0,2368,8,16,0,0,2384,8,16,0,0,2400,8,16,0,0,2416,8,16,0,0,2432,8,16,0,0,2448,8,16,0,0,2464,8,16,0,0,2480,8,16,0,0,2496,8,16,0,0,2512,8,16,0,0,2528,8,16,0,0,2544,8,16,0,0,2560,8,16,0,0,2576,8,16,0,0,2592,8,16,0,0,2608,8,16,0,0,2624,8,16,0,0,2640,8,16,0,0,2656,8,16,0,0,2672,8,16,0,0,2688,8,16,0,0,2704,8,16,0,0,2720,8,16,0,0,2736,8,16,0,0,2752,8,16,0,0,2768,8,16,0,0,2784,8,16,0,0,2800,8,16,0,0,2816,8,16,0,0,2832,8,16,0,0,2848,8,16,0,0,2864,8,16,0,0,2880,8,16,0,0,2896,8,16,0,0,2912,8,16,0,0,2928,8,16,0,0,2944,8,16,0,0,2960,8,16,0,0,2976,8,16,0,0,2992,8,16,0,0,3008,8,16,0,0,3024,8,16,0,0,3040,8,16,0,0,3056,8,16,0,0,3072,8,16,0,0,3088,8,16,0,0,3104,8,16,0,0,3120,8,16,0,0,3136,8,16,0,0,3152,8,16,0,0,3168,8,16,0,0,3184,8,16,0,0,3200,8,16,0,0,3216,8,16,0,0,3232,8,16,0,0,3248,8,16,0,0,3264,8,16,0,0,3280,8,16,0,0,3296,8,16,0,0,3312,8,16,0,0,3328,8,16,0,0,3344,8,16,0,0,3360,8,16,0,0,3376,8,16,0,0,3392,8,16,0,0,3408,8,16,0,0,3424,8,16,0,0,3440,8,16,0,0,3456,8,16,0,0,3472,8,16,0,0,3488,8,16,0,0,3504,8,16,0,0,3520,8,16,0,0,3536,8,16,0,0,3552,8,16,0,0,3568,8,16,0,0,3584,8,16,0,0,3600,8,16,0,0,3616,8,16,0,0,3632,8,16,0,0,3648,8,16,0,0,3664,8,16,0,0,3680,8,16,0,0,3696,8,16,0,0,3712,8,16,0,0,3728,8,16,0,0,3744,8,16,0,0,3760,8,16,0,0,3776,8,16,0,0,3792,8,16,0,0,3808,8,16,0,0,3824,8,16,0,0,3840,8,16,0,0,3856,8,16,0,0,3872,8,16,0,0,3888,8,16,0,0,3904,8,16,0,0,3920,8,16,0,0,3936,8,16,0,0,3952,8,16,0,0,3968,8,16,0,0,3984,8,16,0,0,4000,8,16,0,0,4016,8,16,0,0,4032,8,16,0,0,4048,8,16,0,0,4064,8,16,0,0,4080,8,16,0,0,};
static rfbFontData default8x16Font = { default8x16FontData, default8x16FontMetaData };
+
+#endif
diff --git a/rfb/rfb.h b/rfb/rfb.h
index db89367..c20fde6 100644
--- a/rfb/rfb.h
+++ b/rfb/rfb.h
@@ -55,6 +55,7 @@ extern "C"
#ifdef WIN32
#undef SOCKET
+typedef UINT32 in_addr_t;
#include <winsock2.h>
#ifdef LIBVNCSERVER_HAVE_WS2TCPIP_H
#undef socklen_t
@@ -382,10 +383,8 @@ typedef struct _rfbScreenInfo
rfbDisplayFinishedHookPtr displayFinishedHook;
/** xvpHook is called to handle an xvp client message */
rfbXvpHookPtr xvpHook;
-#ifdef LIBVNCSERVER_WITH_WEBSOCKETS
char *sslkeyfile;
char *sslcertfile;
-#endif
int ipv6port; /**< The port to listen on when using IPv6. */
char* listen6Interface;
/* We have an additional IPv6 listen socket since there are systems that
@@ -699,11 +698,11 @@ typedef struct _rfbClientRec {
int turboQualityLevel; /* 1-100 scale */
#endif
#endif
-
-#ifdef LIBVNCSERVER_WITH_WEBSOCKETS
rfbSslCtx *sslctx;
wsCtx *wsctx;
char *wspath; /* Requests path component */
+#ifdef LIBVNCSERVER_HAVE_LIBPTHREAD
+ int pipe_notify_client_thread[2];
#endif
} rfbClientRec, *rfbClientPtr;
@@ -904,6 +903,8 @@ extern rfbBool rfbTightDisableGradient;
extern int rfbNumCodedRectsTight(rfbClientPtr cl, int x,int y,int w,int h);
extern rfbBool rfbSendRectEncodingTight(rfbClientPtr cl, int x,int y,int w,int h);
+extern rfbBool rfbSendTightHeader(rfbClientPtr cl, int x, int y, int w, int h);
+extern rfbBool rfbSendCompressedDataTight(rfbClientPtr cl, char *buf, int compressedLen);
#if defined(LIBVNCSERVER_HAVE_LIBPNG)
extern rfbBool rfbSendRectEncodingTightPng(rfbClientPtr cl, int x,int y,int w,int h);
diff --git a/rfb/rfbclient.h b/rfb/rfbclient.h
index 17ddba6..2eea004 100644
--- a/rfb/rfbclient.h
+++ b/rfb/rfbclient.h
@@ -7,6 +7,7 @@
*/
/*
+ * Copyright (C) 2017 D. R. Commander. All Rights Reserved.
* Copyright (C) 2000, 2001 Const Kaplinsky. All Rights Reserved.
* Copyright (C) 2000 Tridia Corporation. All Rights Reserved.
* Copyright (C) 1999 AT&T Laboratories Cambridge. All Rights Reserved.
@@ -35,14 +36,27 @@
#define WIN32_LEAN_AND_MEAN /* Prevent loading any Winsock 1.x headers from windows.h */
#endif
+#if defined(ANDROID) || defined(LIBVNCSERVER_HAVE_ANDROID)
+#include <arpa/inet.h>
+#include <sys/select.h>
+#endif
+
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#if LIBVNCSERVER_HAVE_SYS_TIME_H
#include <sys/time.h>
+#endif
+#if LIBVNCSERVER_HAVE_UNISTD_H
#include <unistd.h>
+#endif
#include <rfb/rfbproto.h>
#include <rfb/keysym.h>
+#ifdef LIBVNCSERVER_HAVE_SASL
+#include <sasl/sasl.h>
+#endif /* LIBVNCSERVER_HAVE_SASL */
+
#define rfbClientSwap16IfLE(s) \
(*(char *)&client->endianTest ? ((((s) & 0xff) << 8) | (((s) >> 8) & 0xff)) : (s))
@@ -127,6 +141,7 @@ typedef union _rfbCredential
char *x509CACrlFile;
char *x509ClientCertFile;
char *x509ClientKeyFile;
+ uint8_t x509CrlVerifyMode; /* Only required for OpenSSL - see meanings below */
} x509Credential;
/** Plain (VeNCrypt), MSLogon (UltraVNC) */
struct
@@ -139,6 +154,13 @@ typedef union _rfbCredential
#define rfbCredentialTypeX509 1
#define rfbCredentialTypeUser 2
+/* When using OpenSSL, CRLs can be included in both the x509CACrlFile and appended
+ to the x509CACertFile as is common with OpenSSL. When rfbX509CrlVerifyAll is
+ specified the CRL list must include CRLs for all certificates in the chain */
+#define rfbX509CrlVerifyNone 0 /* No CRL checking is performed */
+#define rfbX509CrlVerifyClient 1 /* Only the leaf server certificate is checked */
+#define rfbX509CrlVerifyAll 2 /* All certificates in the server chain are checked */
+
struct _rfbClient;
/**
@@ -184,9 +206,17 @@ typedef void (*BellProc)(struct _rfbClient* client);
*/
typedef void (*GotCursorShapeProc)(struct _rfbClient* client, int xhot, int yhot, int width, int height, int bytesPerPixel);
typedef void (*GotCopyRectProc)(struct _rfbClient* client, int src_x, int src_y, int w, int h, int dest_x, int dest_y);
+typedef void (*GotFillRectProc)(struct _rfbClient* client, int x, int y, int w, int h, uint32_t colour);
+typedef void (*GotBitmapProc)(struct _rfbClient* client, const uint8_t* buffer, int x, int y, int w, int h);
+typedef rfbBool (*GotJpegProc)(struct _rfbClient* client, const uint8_t* buffer, int length, int x, int y, int w, int h);
typedef rfbBool (*LockWriteToTLSProc)(struct _rfbClient* client);
typedef rfbBool (*UnlockWriteToTLSProc)(struct _rfbClient* client);
+#ifdef LIBVNCSERVER_HAVE_SASL
+typedef char* (*GetUserProc)(struct _rfbClient* client);
+typedef char* (*GetSASLMechanismProc)(struct _rfbClient* client, char* mechlist);
+#endif /* LIBVNCSERVER_HAVE_SASL */
+
typedef struct _rfbClient {
uint8_t* frameBuffer;
int width, height;
@@ -268,7 +298,7 @@ typedef struct _rfbClient {
uint8_t tightPrevRow[2048*3*sizeof(uint16_t)];
#ifdef LIBVNCSERVER_HAVE_LIBJPEG
- /** JPEG decoder state. */
+ /** JPEG decoder state (obsolete-- do not use). */
rfbBool jpegError;
struct jpeg_source_mgr* jpegSrcManager;
@@ -371,6 +401,40 @@ typedef struct _rfbClient {
LockWriteToTLSProc LockWriteToTLS;
UnlockWriteToTLSProc UnlockWriteToTLS;
+ /** Hooks for custom rendering
+ *
+ * VNC rendering boils down to 3 activities:
+ * - GotCopyRect: copy an area of the framebuffer
+ * - GotFillRect: fill an area of the framebuffer with a solid color
+ * - GotBitmap: copy the bitmap in the buffer into the framebuffer
+ * The client application should either set all three of these or none!
+ */
+ GotFillRectProc GotFillRect;
+ GotBitmapProc GotBitmap;
+ /** Hook for custom JPEG decoding and rendering */
+ GotJpegProc GotJpeg;
+
+#ifdef LIBVNCSERVER_HAVE_SASL
+ sasl_conn_t *saslconn;
+ const char *saslDecoded;
+ unsigned int saslDecodedLength;
+ unsigned int saslDecodedOffset;
+ sasl_secret_t *saslSecret;
+
+ /* Callback to allow the client to choose a preferred mechanism. The string returned will
+ be freed once no longer required. */
+ GetSASLMechanismProc GetSASLMechanism;
+ GetUserProc GetUser;
+
+#endif /* LIBVNCSERVER_HAVE_SASL */
+
+#ifdef LIBVNCSERVER_HAVE_LIBZ
+#ifdef LIBVNCSERVER_HAVE_LIBJPEG
+ /** JPEG decoder state. */
+ void *tjhnd;
+
+#endif
+#endif
} rfbClient;
/* cursor.c */
@@ -560,6 +624,9 @@ typedef struct _rfbClientProtocolExtension {
rfbBool (*handleMessage)(rfbClient* cl,
rfbServerToClientMsg* message);
struct _rfbClientProtocolExtension* next;
+ uint32_t const* securityTypes;
+ /** returns TRUE if it handled the authentication */
+ rfbBool (*handleAuthentication)(rfbClient* cl, uint32_t authScheme);
} rfbClientProtocolExtension;
void rfbClientRegisterExtension(rfbClientProtocolExtension* e);
diff --git a/rfb/rfbconfig.h.cmake b/rfb/rfbconfig.h.cmakein
index 5bd6569..f5d8d78 100644
--- a/rfb/rfbconfig.h.cmake
+++ b/rfb/rfbconfig.h.cmakein
@@ -18,6 +18,48 @@
/* Define to 1 if you have the `gettimeofday' function. */
#cmakedefine LIBVNCSERVER_HAVE_GETTIMEOFDAY 1
+/* Define to 1 if you have the `ftime' function. */
+#cmakedefine LIBVNCSERVER_HAVE_FTIME 1
+
+/* Define to 1 if you have the `gethostbyname' function. */
+#cmakedefine LIBVNCSERVER_HAVE_GETHOSTBYNAME 1
+
+/* Define to 1 if you have the `gethostname' function. */
+#cmakedefine LIBVNCSERVER_HAVE_GETHOSTNAME 1
+
+/* Define to 1 if you have the `inet_ntoa' function. */
+#cmakedefine LIBVNCSERVER_HAVE_INET_NTOA 1
+
+/* Define to 1 if you have the `memmove' function. */
+#cmakedefine LIBVNCSERVER_HAVE_MEMMOVE 1
+
+/* Define to 1 if you have the `memset' function. */
+#cmakedefine LIBVNCSERVER_HAVE_MEMSET 1
+
+/* Define to 1 if you have the `mkfifo' function. */
+#cmakedefine LIBVNCSERVER_HAVE_MKFIFO 1
+
+/* Define to 1 if you have the `select' function. */
+#cmakedefine LIBVNCSERVER_HAVE_SELECT 1
+
+/* Define to 1 if you have the `socket' function. */
+#cmakedefine LIBVNCSERVER_HAVE_SOCKET 1
+
+/* Define to 1 if you have the `strchr' function. */
+#cmakedefine LIBVNCSERVER_HAVE_STRCHR 1
+
+/* Define to 1 if you have the `strcspn' function. */
+#cmakedefine LIBVNCSERVER_HAVE_STRCSPN 1
+
+/* Define to 1 if you have the `strdup' function. */
+#cmakedefine LIBVNCSERVER_HAVE_STRDUP 1
+
+/* Define to 1 if you have the `strerror' function. */
+#cmakedefine LIBVNCSERVER_HAVE_STRERROR 1
+
+/* Define to 1 if you have the `strstr' function. */
+#cmakedefine LIBVNCSERVER_HAVE_STRSTR 1
+
/* Define to 1 if you have the `jpeg' library (-ljpeg). */
#cmakedefine LIBVNCSERVER_HAVE_LIBJPEG 1
@@ -30,6 +72,9 @@
/* Define to 1 if you have the `z' library (-lz). */
#cmakedefine LIBVNCSERVER_HAVE_LIBZ 1
+/* Define to 1 if you have the `lzo2' library (-llzo2). */
+#cmakedefine LIBVNCSERVER_HAVE_LZO 1
+
/* Define to 1 if you have the <netinet/in.h> header file. */
#cmakedefine LIBVNCSERVER_HAVE_NETINET_IN_H 1
@@ -51,6 +96,9 @@
/* Define to 1 if you have <sys/wait.h> that is POSIX.1 compatible. */
#cmakedefine LIBVNCSERVER_HAVE_SYS_WAIT_H 1
+/* Define to 1 if you have <sys/uio.h> */
+#cmakedefine LIBVNCSERVER_HAVE_SYS_UIO_H 1
+
/* Define to 1 if you have the <unistd.h> header file. */
#cmakedefine LIBVNCSERVER_HAVE_UNISTD_H 1
@@ -69,6 +117,12 @@
/* Define to 1 if `vfork' works. */
#cmakedefine LIBVNCSERVER_HAVE_WORKING_VFORK 1
+/* Define to 1 if `mmap' exists. */
+#cmakedefine LIBVNCSERVER_HAVE_MMAP 1
+
+/* Define to 1 if `fork' exists. */
+#cmakedefine LIBVNCSERVER_HAVE_FORK 1
+
/* Define to 1 if you have the <ws2tcpip.h> header file. */
#cmakedefine LIBVNCSERVER_HAVE_WS2TCPIP_H 1
@@ -92,7 +146,13 @@
#cmakedefine LIBVNCSERVER_WITH_CLIENT_GCRYPT 1
/* Define to 1 if GnuTLS is present */
-#cmakedefine LIBVNCSERVER_WITH_CLIENT_TLS 1
+#cmakedefine LIBVNCSERVER_HAVE_GNUTLS 1
+
+/* Define to 1 if OpenSSL is present */
+#cmakedefine LIBVNCSERVER_HAVE_LIBSSL 1
+
+/* Define to 1 if Cyrus SASL is present */
+#cmakedefine LIBVNCSERVER_HAVE_SASL 1
/* Define to 1 to build with websockets */
#cmakedefine LIBVNCSERVER_WITH_WEBSOCKETS 1
diff --git a/rfb/rfbint.h.cmake b/rfb/rfbint.h.cmake
deleted file mode 100644
index 17de6cd..0000000
--- a/rfb/rfbint.h.cmake
+++ /dev/null
@@ -1,4 +0,0 @@
-#ifndef _RFB_RFBINT_H
-#define _RFB_RFBINT_H 1
-/* empty ... */
-#endif
diff --git a/rfb/rfbproto.h b/rfb/rfbproto.h
index 6c1a2fb..8f7c2f9 100644
--- a/rfb/rfbproto.h
+++ b/rfb/rfbproto.h
@@ -65,14 +65,11 @@
#if defined(WIN32) && !defined(__MINGW32__)
#define LIBVNCSERVER_WORDS_BIGENDIAN
-#define rfbBool int
+typedef int8_t rfbBool;
#include <sys/timeb.h>
#include <winsock2.h>
-#undef SOCKET
-#define SOCKET int
-#else
-#include <rfb/rfbconfig.h>
#endif
+#include <rfb/rfbconfig.h>
#ifdef LIBVNCSERVER_HAVE_LIBZ
#include <zlib.h>
@@ -298,6 +295,7 @@ typedef char rfbProtocolVersionMsg[13]; /* allow extra byte for null */
#define rfbUltra 17
#define rfbTLS 18
#define rfbVeNCrypt 19
+#define rfbSASL 20
#define rfbARD 30
#define rfbMSLogon 0xfffffffa
@@ -449,6 +447,7 @@ typedef struct {
#define rfbEncodingTightPng 0xFFFFFEFC /* -260 */
#define rfbEncodingZlibHex 8
#define rfbEncodingUltra 9
+#define rfbEncodingTRLE 15
#define rfbEncodingZRLE 16
#define rfbEncodingZYWRLE 17