Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/Remmina/Remmina.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorllyzs <llyzs.vic@gmail.com>2011-02-02 10:18:46 +0300
committerVic Lee (llyzs) <llyzs@b6cfa94a-2857-405c-b0d6-536ef9fc39e1>2011-02-02 10:18:46 +0300
commitfdba049047443710dd2013551fb4fd25cffca652 (patch)
treec2a7ef859ce7c5cbd413095cd664ad159f9bd247 /remmina-plugins
parent3f8c83050c6ed6d47f98f12fcfd64fa2899d6e92 (diff)
Sync with latest libvncserver
Diffstat (limited to 'remmina-plugins')
-rw-r--r--remmina-plugins/libvncserver/Makefile.am16
-rw-r--r--remmina-plugins/libvncserver/common/d3des.c (renamed from remmina-plugins/libvncserver/libvncserver/d3des.c)0
-rw-r--r--remmina-plugins/libvncserver/common/d3des.h (renamed from remmina-plugins/libvncserver/libvncserver/d3des.h)0
-rw-r--r--remmina-plugins/libvncserver/common/lzoconf.h (renamed from remmina-plugins/libvncserver/libvncclient/lzoconf.h)1
-rw-r--r--remmina-plugins/libvncserver/common/minilzo.c (renamed from remmina-plugins/libvncserver/libvncclient/minilzo.c)1
-rw-r--r--remmina-plugins/libvncserver/common/minilzo.h (renamed from remmina-plugins/libvncserver/libvncclient/minilzo.h)1
-rw-r--r--remmina-plugins/libvncserver/common/vncauth.c (renamed from remmina-plugins/libvncserver/libvncserver/vncauth.c)11
-rw-r--r--remmina-plugins/libvncserver/common/zywrletemplate.c (renamed from remmina-plugins/libvncserver/libvncserver/zywrletemplate.c)0
-rw-r--r--remmina-plugins/libvncserver/libvncclient/rfbproto.c284
-rw-r--r--remmina-plugins/libvncserver/libvncclient/sockets.c74
-rw-r--r--remmina-plugins/libvncserver/libvncclient/vncviewer.c4
-rw-r--r--remmina-plugins/libvncserver/libvncclient/zrle.c2
-rw-r--r--remmina-plugins/libvncserver/rfb/rfbclient.h77
-rw-r--r--remmina-plugins/libvncserver/rfb/rfbint.h2
-rw-r--r--remmina-plugins/libvncserver/rfb/rfbproto.h84
15 files changed, 488 insertions, 69 deletions
diff --git a/remmina-plugins/libvncserver/Makefile.am b/remmina-plugins/libvncserver/Makefile.am
index fdd782cbe..d41d5b345 100644
--- a/remmina-plugins/libvncserver/Makefile.am
+++ b/remmina-plugins/libvncserver/Makefile.am
@@ -5,9 +5,9 @@ INCLUDES = $(GNUTLS_CFLAGS)
libvncclient_la_SOURCES = \
libvncclient/cursor.c \
libvncclient/listen.c \
- libvncclient/lzoconf.h \
- libvncclient/minilzo.c \
- libvncclient/minilzo.h \
+ common/lzoconf.h \
+ common/minilzo.c \
+ common/minilzo.h \
libvncclient/rfbproto.c \
libvncclient/sockets.c \
libvncclient/tls.c \
@@ -17,6 +17,8 @@ libvncclient_la_SOURCES = \
libvncclient/zlib.c \
libvncclient/zrle.c
+libvncclient_la_CFLAGS = -I./common
+
libvncclient_la_LIBADD = $(GNUTLS_LIBS)
EXTRA_DIST = \
@@ -24,10 +26,10 @@ EXTRA_DIST = \
libvncclient/hextile.c \
libvncclient/rre.c \
libvncclient/ultra.c \
- libvncserver/d3des.c \
- libvncserver/d3des.h \
- libvncserver/vncauth.c \
- libvncserver/zywrletemplate.c
+ common/d3des.c \
+ common/d3des.h \
+ common/vncauth.c \
+ common/zywrletemplate.c
DISTCLEANFILES = \
rfb/rfbconfig.h
diff --git a/remmina-plugins/libvncserver/libvncserver/d3des.c b/remmina-plugins/libvncserver/common/d3des.c
index 2df1aab68..2df1aab68 100644
--- a/remmina-plugins/libvncserver/libvncserver/d3des.c
+++ b/remmina-plugins/libvncserver/common/d3des.c
diff --git a/remmina-plugins/libvncserver/libvncserver/d3des.h b/remmina-plugins/libvncserver/common/d3des.h
index e3761ca25..e3761ca25 100644
--- a/remmina-plugins/libvncserver/libvncserver/d3des.h
+++ b/remmina-plugins/libvncserver/common/d3des.h
diff --git a/remmina-plugins/libvncserver/libvncclient/lzoconf.h b/remmina-plugins/libvncserver/common/lzoconf.h
index 96db18058..54e26c482 100644
--- a/remmina-plugins/libvncserver/libvncclient/lzoconf.h
+++ b/remmina-plugins/libvncserver/common/lzoconf.h
@@ -448,4 +448,3 @@ LZO_EXTERN(unsigned) __lzo_align_gap(const lzo_voidp _ptr, lzo_uint _size);
#endif
#endif /* already included */
-
diff --git a/remmina-plugins/libvncserver/libvncclient/minilzo.c b/remmina-plugins/libvncserver/common/minilzo.c
index 85771eb47..f99c52f2c 100644
--- a/remmina-plugins/libvncserver/libvncclient/minilzo.c
+++ b/remmina-plugins/libvncserver/common/minilzo.c
@@ -2932,4 +2932,3 @@ lookbehind_overrun:
}
/***** End of minilzo.c *****/
-
diff --git a/remmina-plugins/libvncserver/libvncclient/minilzo.h b/remmina-plugins/libvncserver/common/minilzo.h
index e3270f9a3..937db19d2 100644
--- a/remmina-plugins/libvncserver/libvncclient/minilzo.h
+++ b/remmina-plugins/libvncserver/common/minilzo.h
@@ -97,4 +97,3 @@ lzo1x_decompress_safe ( const lzo_byte *src, lzo_uint src_len,
#endif
#endif /* already included */
-
diff --git a/remmina-plugins/libvncserver/libvncserver/vncauth.c b/remmina-plugins/libvncserver/common/vncauth.c
index 0b73531fa..82c1b6879 100644
--- a/remmina-plugins/libvncserver/libvncserver/vncauth.c
+++ b/remmina-plugins/libvncserver/common/vncauth.c
@@ -101,7 +101,7 @@ rfbEncryptAndStorePasswd(char *passwd, char *fname)
for (i = 0; i < 8; i++) {
putc(encryptedPasswd[i], fp);
}
-
+
fclose(fp);
return 0;
}
@@ -120,12 +120,16 @@ rfbDecryptPasswdFromFile(char *fname)
int i, ch;
unsigned char *passwd = (unsigned char *)malloc(9);
- if ((fp = fopen(fname,"r")) == NULL) return NULL;
+ if ((fp = fopen(fname,"r")) == NULL) {
+ free(passwd);
+ return NULL;
+ }
for (i = 0; i < 8; i++) {
ch = getc(fp);
if (ch == EOF) {
fclose(fp);
+ free(passwd);
return NULL;
}
passwd[i] = ch;
@@ -159,7 +163,7 @@ rfbRandomBytes(unsigned char *bytes)
}
for (i = 0; i < CHALLENGESIZE; i++) {
- bytes[i] = (unsigned char)(random() & 255);
+ bytes[i] = (unsigned char)(random() & 255);
}
}
@@ -205,4 +209,3 @@ rfbEncryptBytes2(unsigned char *where, const int length, unsigned char *key) {
rfbDes(where + i, where + i);
}
}
-
diff --git a/remmina-plugins/libvncserver/libvncserver/zywrletemplate.c b/remmina-plugins/libvncserver/common/zywrletemplate.c
index 52b2b0b51..52b2b0b51 100644
--- a/remmina-plugins/libvncserver/libvncserver/zywrletemplate.c
+++ b/remmina-plugins/libvncserver/common/zywrletemplate.c
diff --git a/remmina-plugins/libvncserver/libvncclient/rfbproto.c b/remmina-plugins/libvncserver/libvncclient/rfbproto.c
index 83ba3a5b1..2de989181 100644
--- a/remmina-plugins/libvncserver/libvncclient/rfbproto.c
+++ b/remmina-plugins/libvncserver/libvncclient/rfbproto.c
@@ -31,13 +31,9 @@
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
-#else
-#define strncasecmp _strnicmp
-#endif
-#include <errno.h>
-#ifndef WIN32
#include <pwd.h>
#endif
+#include <errno.h>
#include <rfb/rfbclient.h>
#ifdef LIBVNCSERVER_HAVE_LIBZ
#include <zlib.h>
@@ -47,11 +43,18 @@
#endif
#endif
#ifdef LIBVNCSERVER_HAVE_LIBJPEG
+#ifdef _RPCNDR_H /* This Windows header typedefs 'boolean', jpeglib has to know */
+#define HAVE_BOOLEAN
+#endif
#include <jpeglib.h>
#endif
#include <stdarg.h>
#include <time.h>
+#ifdef LIBVNCSERVER_WITH_CLIENT_GCRYPT
+#include <gcrypt.h>
+#endif
+
#include "minilzo.h"
#include "tls.h"
@@ -418,6 +421,9 @@ ConnectToRFBServer(rfbClient* client,const char *hostname, int port)
return FALSE;
}
+ if(client->QoS_DSCP && !SetDSCP(client->sock, client->QoS_DSCP))
+ return FALSE;
+
return SetNonBlocking(client->sock);
}
@@ -564,6 +570,7 @@ ReadSupportedSecurityType(rfbClient* client, uint32_t *result, rfbBool subAuth)
rfbClientLog("%d) Received security type %d\n", loop, tAuth[loop]);
if (flag) continue;
if (tAuth[loop]==rfbVncAuth || tAuth[loop]==rfbNoAuth || tAuth[loop]==rfbMSLogon ||
+ tAuth[loop]==rfbARD ||
(!subAuth && (tAuth[loop]==rfbTLS || tAuth[loop]==rfbVeNCrypt)))
{
if (!subAuth && client->clientAuthSchemes)
@@ -793,6 +800,208 @@ HandleMSLogonAuth(rfbClient *client)
return TRUE;
}
+#ifdef LIBVNCSERVER_WITH_CLIENT_GCRYPT
+static rfbBool
+rfbMpiToBytes(const gcry_mpi_t value, uint8_t *result, size_t size)
+{
+ gcry_error_t error;
+ size_t len;
+ int i;
+
+ error = gcry_mpi_print(GCRYMPI_FMT_USG, result, size, &len, value);
+ if (gcry_err_code(error) != GPG_ERR_NO_ERROR)
+ {
+ rfbClientLog("gcry_mpi_print error: %s\n", gcry_strerror(error));
+ return FALSE;
+ }
+ for (i=size-1;i>(int)size-1-(int)len;--i)
+ result[i] = result[i-size+len];
+ for (;i>=0;--i)
+ result[i] = 0;
+ return TRUE;
+}
+
+static rfbBool
+HandleARDAuth(rfbClient *client)
+{
+ uint8_t gen[2], len[2];
+ size_t keylen;
+ uint8_t *mod = NULL, *resp, *pub, *key, *shared;
+ gcry_mpi_t genmpi = NULL, modmpi = NULL, respmpi = NULL;
+ gcry_mpi_t privmpi = NULL, pubmpi = NULL, keympi = NULL;
+ gcry_md_hd_t md5 = NULL;
+ gcry_cipher_hd_t aes = NULL;
+ gcry_error_t error;
+ uint8_t userpass[128], ciphertext[128];
+ int passwordLen, usernameLen;
+ rfbCredential *cred = NULL;
+ rfbBool result = FALSE;
+
+ while (1)
+ {
+ if (!ReadFromRFBServer(client, (char *)gen, 2))
+ break;
+ if (!ReadFromRFBServer(client, (char *)len, 2))
+ break;
+
+ if (!client->GetCredential)
+ {
+ rfbClientLog("GetCredential callback is not set.\n");
+ break;
+ }
+ cred = client->GetCredential(client, rfbCredentialTypeUser);
+ if (!cred)
+ {
+ rfbClientLog("Reading credential failed\n");
+ break;
+ }
+
+ keylen = 256*len[0]+len[1];
+ mod = (uint8_t*)malloc(keylen*4);
+ if (!mod)
+ {
+ rfbClientLog("malloc out of memory\n");
+ break;
+ }
+ resp = mod+keylen;
+ pub = resp+keylen;
+ key = pub+keylen;
+
+ if (!ReadFromRFBServer(client, (char *)mod, keylen))
+ break;
+ if (!ReadFromRFBServer(client, (char *)resp, keylen))
+ break;
+
+ error = gcry_mpi_scan(&genmpi, GCRYMPI_FMT_USG, gen, 2, NULL);
+ if (gcry_err_code(error) != GPG_ERR_NO_ERROR)
+ {
+ rfbClientLog("gcry_mpi_scan error: %s\n", gcry_strerror(error));
+ break;
+ }
+ error = gcry_mpi_scan(&modmpi, GCRYMPI_FMT_USG, mod, keylen, NULL);
+ if (gcry_err_code(error) != GPG_ERR_NO_ERROR)
+ {
+ rfbClientLog("gcry_mpi_scan error: %s\n", gcry_strerror(error));
+ break;
+ }
+ error = gcry_mpi_scan(&respmpi, GCRYMPI_FMT_USG, resp, keylen, NULL);
+ if (gcry_err_code(error) != GPG_ERR_NO_ERROR)
+ {
+ rfbClientLog("gcry_mpi_scan error: %s\n", gcry_strerror(error));
+ break;
+ }
+
+ privmpi = gcry_mpi_new(keylen);
+ if (!privmpi)
+ {
+ rfbClientLog("gcry_mpi_new out of memory\n");
+ break;
+ }
+ gcry_mpi_randomize(privmpi, (keylen/8)*8, GCRY_STRONG_RANDOM);
+
+ pubmpi = gcry_mpi_new(keylen);
+ if (!pubmpi)
+ {
+ rfbClientLog("gcry_mpi_new out of memory\n");
+ break;
+ }
+ gcry_mpi_powm(pubmpi, genmpi, privmpi, modmpi);
+
+ keympi = gcry_mpi_new(keylen);
+ if (!keympi)
+ {
+ rfbClientLog("gcry_mpi_new out of memory\n");
+ break;
+ }
+ gcry_mpi_powm(keympi, respmpi, privmpi, modmpi);
+
+ if (!rfbMpiToBytes(pubmpi, pub, keylen))
+ break;
+ if (!rfbMpiToBytes(keympi, key, keylen))
+ break;
+
+ error = gcry_md_open(&md5, GCRY_MD_MD5, 0);
+ if (gcry_err_code(error) != GPG_ERR_NO_ERROR)
+ {
+ rfbClientLog("gcry_md_open error: %s\n", gcry_strerror(error));
+ break;
+ }
+ gcry_md_write(md5, key, keylen);
+ error = gcry_md_final(md5);
+ if (gcry_err_code(error) != GPG_ERR_NO_ERROR)
+ {
+ rfbClientLog("gcry_md_final error: %s\n", gcry_strerror(error));
+ break;
+ }
+ shared = gcry_md_read(md5, GCRY_MD_MD5);
+
+ passwordLen = strlen(cred->userCredential.password)+1;
+ usernameLen = strlen(cred->userCredential.username)+1;
+ if (passwordLen > sizeof(userpass)/2)
+ passwordLen = sizeof(userpass)/2;
+ if (usernameLen > sizeof(userpass)/2)
+ usernameLen = sizeof(userpass)/2;
+
+ gcry_randomize(userpass, sizeof(userpass), GCRY_STRONG_RANDOM);
+ memcpy(userpass, cred->userCredential.username, usernameLen);
+ memcpy(userpass+sizeof(userpass)/2, cred->userCredential.password, passwordLen);
+
+ error = gcry_cipher_open(&aes, GCRY_CIPHER_AES128, GCRY_CIPHER_MODE_ECB, 0);
+ if (gcry_err_code(error) != GPG_ERR_NO_ERROR)
+ {
+ rfbClientLog("gcry_cipher_open error: %s\n", gcry_strerror(error));
+ break;
+ }
+ error = gcry_cipher_setkey(aes, shared, 16);
+ if (gcry_err_code(error) != GPG_ERR_NO_ERROR)
+ {
+ rfbClientLog("gcry_cipher_setkey error: %s\n", gcry_strerror(error));
+ break;
+ }
+ error = gcry_cipher_encrypt(aes, ciphertext, sizeof(ciphertext), userpass, sizeof(userpass));
+ if (gcry_err_code(error) != GPG_ERR_NO_ERROR)
+ {
+ rfbClientLog("gcry_cipher_encrypt error: %s\n", gcry_strerror(error));
+ break;
+ }
+
+ if (!WriteToRFBServer(client, (char *)ciphertext, sizeof(ciphertext)))
+ break;
+ if (!WriteToRFBServer(client, (char *)pub, keylen))
+ break;
+
+ /* Handle the SecurityResult message */
+ if (!rfbHandleAuthResult(client))
+ break;
+
+ result = TRUE;
+ break;
+ }
+
+ if (cred)
+ FreeUserCredential(cred);
+ if (mod)
+ free(mod);
+ if (genmpi)
+ gcry_mpi_release(genmpi);
+ if (modmpi)
+ gcry_mpi_release(modmpi);
+ if (respmpi)
+ gcry_mpi_release(respmpi);
+ if (privmpi)
+ gcry_mpi_release(privmpi);
+ if (pubmpi)
+ gcry_mpi_release(pubmpi);
+ if (keympi)
+ gcry_mpi_release(keympi);
+ if (md5)
+ gcry_md_close(md5);
+ if (aes)
+ gcry_cipher_close(aes);
+ return result;
+}
+#endif
+
/*
* SetClientAuthSchemes.
*/
@@ -926,6 +1135,15 @@ InitialiseRFBConnection(rfbClient* client)
if (!HandleMSLogonAuth(client)) return FALSE;
break;
+ case rfbARD:
+#ifndef LIBVNCSERVER_WITH_CLIENT_GCRYPT
+ rfbClientLog("GCrypt support was not compiled in\n");
+ return FALSE;
+#else
+ if (!HandleARDAuth(client)) return FALSE;
+#endif
+ break;
+
case rfbTLS:
#ifndef LIBVNCSERVER_WITH_CLIENT_TLS
rfbClientLog("TLS support was not compiled in\n");
@@ -1228,6 +1446,9 @@ SetFormatAndEncodings(rfbClient* client)
if (se->nEncodings < MAX_ENCODINGS)
encs[se->nEncodings++] = rfbClientSwap32IfLE(rfbEncodingServerIdentity);
+ /* xvp */
+ if (se->nEncodings < MAX_ENCODINGS)
+ encs[se->nEncodings++] = rfbClientSwap32IfLE(rfbEncodingXvp);
/* client extensions */
for(e = rfbClientExtensions; e; e = e->next)
@@ -1393,6 +1614,37 @@ rfbBool PermitServerInput(rfbClient* client, int enabled)
/*
+ * send xvp client message
+ * A client supporting the xvp extension sends this to request that the server initiate
+ * a clean shutdown, clean reboot or abrupt reset of the system whose framebuffer the
+ * client is displaying.
+ *
+ * only version 1 is defined in the protocol specs
+ *
+ * possible values for code are:
+ * rfbXvp_Shutdown
+ * rfbXvp_Reboot
+ * rfbXvp_Reset
+ */
+
+rfbBool SendXvpMsg(rfbClient* client, uint8_t version, uint8_t code)
+{
+ rfbXvpMsg xvp;
+
+ if (!SupportsClient2Server(client, rfbXvp)) return TRUE;
+ xvp.type = rfbXvp;
+ xvp.pad = 0;
+ xvp.version = version;
+ xvp.code = code;
+
+ if (!WriteToRFBServer(client, (char *)&xvp, sz_rfbXvpMsg))
+ return FALSE;
+
+ return TRUE;
+}
+
+
+/*
* SendPointerEvent.
*/
@@ -1982,6 +2234,24 @@ HandleRFBServerMessage(rfbClient* client)
break;
}
+ case rfbXvp:
+ {
+ if (!ReadFromRFBServer(client, ((char *)&msg) + 1,
+ sz_rfbXvpMsg -1))
+ return FALSE;
+
+ SetClient2Server(client, rfbXvp);
+ /* technically, we only care what we can *send* to the server
+ * but, we set Server2Client Just in case it ever becomes useful
+ */
+ SetServer2Client(client, rfbXvp);
+
+ if(client->HandleXvpMsg)
+ client->HandleXvpMsg(client, msg.xvp.version, msg.xvp.code);
+
+ break;
+ }
+
case rfbResizeFrameBuffer:
{
if (!ReadFromRFBServer(client, ((char *)&msg) + 1,
@@ -2131,5 +2401,5 @@ PrintPixelFormat(rfbPixelFormat *format)
#define rfbUseKey rfbClientUseKey
#define rfbCPKey rfbClientCPKey
-#include "../libvncserver/vncauth.c"
-#include "../libvncserver/d3des.c"
+#include "vncauth.c"
+#include "d3des.c"
diff --git a/remmina-plugins/libvncserver/libvncclient/sockets.c b/remmina-plugins/libvncserver/libvncclient/sockets.c
index ff4fe489f..334928e52 100644
--- a/remmina-plugins/libvncserver/libvncclient/sockets.c
+++ b/remmina-plugins/libvncserver/libvncclient/sockets.c
@@ -37,6 +37,10 @@
#define read(sock,buf,len) recv(sock,buf,len,0)
#define write(sock,buf,len) send(sock,buf,len,0)
#define socklen_t int
+#ifdef LIBVNCSERVER_HAVE_WS2TCPIP_H
+#undef socklen_t
+#include <ws2tcpip.h>
+#endif
#else
#include <sys/socket.h>
#include <netinet/in.h>
@@ -146,6 +150,11 @@ ReadFromRFBServer(rfbClient* client, char *out, unsigned int n)
errno=WSAGetLastError();
#endif
if (errno == EWOULDBLOCK || errno == EAGAIN) {
+#ifndef WIN32
+ usleep (10000);
+#else
+ Sleep (10);
+#endif
/* TODO:
ProcessXtEvents();
*/
@@ -187,6 +196,11 @@ ReadFromRFBServer(rfbClient* client, char *out, unsigned int n)
errno=WSAGetLastError();
#endif
if (errno == EWOULDBLOCK || errno == EAGAIN) {
+#ifndef WIN32
+ usleep (10000);
+#else
+ Sleep (10);
+#endif
/* TODO:
ProcessXtEvents();
*/
@@ -547,18 +561,70 @@ AcceptTcpConnection(int listenSock)
rfbBool
SetNonBlocking(int sock)
{
-#ifndef __MINGW32__
- if (fcntl(sock, F_SETFL, O_NONBLOCK) < 0) {
- rfbClientErr("AcceptTcpConnection: fcntl\n");
+#ifdef WIN32
+ unsigned long block=1;
+ if(ioctlsocket(sock, FIONBIO, &block) == SOCKET_ERROR) {
+ errno=WSAGetLastError();
+#else
+ int flags = fcntl(sock, F_GETFL);
+ if(flags < 0 || fcntl(sock, F_SETFL, flags | O_NONBLOCK) < 0) {
+#endif
+ rfbClientErr("Setting socket to non-blocking failed: %s\n",strerror(errno));
return FALSE;
}
+ return TRUE;
+}
+
+
+
+/*
+ * SetDSCP sets a socket's IP QoS parameters aka Differentiated Services Code Point field
+ */
+
+rfbBool
+SetDSCP(int sock, int dscp)
+{
+#ifdef WIN32
+ rfbClientErr("Setting of QoS IP DSCP not implemented for Windows\n");
+ return TRUE;
#else
- rfbClientErr("O_NONBLOCK on MinGW32 NOT IMPLEMENTED\n");
+ int level, cmd;
+ struct sockaddr addr;
+ socklen_t addrlen = sizeof(addr);
+
+ if(getsockname(sock, &addr, &addrlen) != 0) {
+ rfbClientErr("Setting socket QoS failed while getting socket address: %s\n",strerror(errno));
+ return FALSE;
+ }
+
+ switch(addr.sa_family)
+ {
+#if defined LIBVNCSERVER_IPv6 && defined IPV6_TCLASS
+ case AF_INET6:
+ level = IPPROTO_IPV6;
+ cmd = IPV6_TCLASS;
+ break;
#endif
+ case AF_INET:
+ level = IPPROTO_IP;
+ cmd = IP_TOS;
+ break;
+ default:
+ rfbClientErr("Setting socket QoS failed: Not bound to IP address");
+ return FALSE;
+ }
+
+ if(setsockopt(sock, level, cmd, (void*)&dscp, sizeof(dscp)) != 0) {
+ rfbClientErr("Setting socket QoS failed: %s\n", strerror(errno));
+ return FALSE;
+ }
+
return TRUE;
+#endif
}
+
/*
* StringToIPAddr - convert a host string to an IP address.
*/
diff --git a/remmina-plugins/libvncserver/libvncclient/vncviewer.c b/remmina-plugins/libvncserver/libvncclient/vncviewer.c
index 6541c1dbd..1c5ea6ea2 100644
--- a/remmina-plugins/libvncserver/libvncclient/vncviewer.c
+++ b/remmina-plugins/libvncserver/libvncclient/vncviewer.c
@@ -186,6 +186,7 @@ rfbClient* rfbGetClient(int bitsPerSample,int samplesPerPixel,
client->Bell = Dummy;
client->CurrentKeyboardLedState = 0;
client->HandleKeyboardLedState = (HandleKeyboardLedStateProc)DummyPoint;
+ client->QoS_DSCP = 0;
client->authScheme = 0;
client->subAuthScheme = 0;
@@ -288,6 +289,9 @@ rfbBool rfbInitClient(rfbClient* client,int* argc,char** argv) {
} else if (i+1<*argc && strcmp(argv[i], "-scale") == 0) {
client->appData.scaleSetting = atoi(argv[i+1]);
j+=2;
+ } else if (i+1<*argc && strcmp(argv[i], "-qosdscp") == 0) {
+ client->QoS_DSCP = atoi(argv[i+1]);
+ j+=2;
} else if (i+1<*argc && strcmp(argv[i], "-repeaterdest") == 0) {
char* colon=strchr(argv[i+1],':');
diff --git a/remmina-plugins/libvncserver/libvncclient/zrle.c b/remmina-plugins/libvncserver/libvncclient/zrle.c
index da2db4b5b..16fc091ae 100644
--- a/remmina-plugins/libvncserver/libvncclient/zrle.c
+++ b/remmina-plugins/libvncserver/libvncclient/zrle.c
@@ -72,7 +72,7 @@
#define PIXEL_T __RFB_CONCAT3E(uint,BPP,_t)
#if BPP!=8
#define ZYWRLE_DECODE 1
-#include "../libvncserver/zywrletemplate.c"
+#include "zywrletemplate.c"
#endif
#undef CPIXEL
diff --git a/remmina-plugins/libvncserver/rfb/rfbclient.h b/remmina-plugins/libvncserver/rfb/rfbclient.h
index b38f33576..f3bd11d65 100644
--- a/remmina-plugins/libvncserver/rfb/rfbclient.h
+++ b/remmina-plugins/libvncserver/rfb/rfbclient.h
@@ -1,6 +1,11 @@
#ifndef RFBCLIENT_H
#define RFBCLIENT_H
+/**
+ * @defgroup libvncclient_api LibVNCClient API Reference
+ * @{
+ */
+
/*
* Copyright (C) 2000, 2001 Const Kaplinsky. All Rights Reserved.
* Copyright (C) 2000 Tridia Corporation. All Rights Reserved.
@@ -22,8 +27,8 @@
* USA.
*/
-/*
- * vncviewer.h
+/**
+ * @file rfbclient.h
*/
#include <stdio.h>
@@ -72,7 +77,7 @@ extern "C"
{
#endif
-/* vncrec */
+/** vncrec */
typedef struct {
FILE* file;
@@ -81,7 +86,7 @@ typedef struct {
rfbBool doNotSleep;
} rfbVNCRec;
-/* client data */
+/** client data */
typedef struct rfbClientData {
void* tag;
@@ -89,7 +94,7 @@ typedef struct rfbClientData {
struct rfbClientData* next;
} rfbClientData;
-/* app data (belongs into rfbClient?) */
+/** app data (belongs into rfbClient?) */
typedef struct {
rfbBool shareDesktop;
@@ -107,14 +112,14 @@ typedef struct {
int qualityLevel;
rfbBool enableJPEG;
rfbBool useRemoteCursor;
- rfbBool palmVNC; /* use palmvnc specific SetScale (vs ultravnc) */
- int scaleSetting; /* 0 means no scale set, else 1/scaleSetting */
+ rfbBool palmVNC; /**< use palmvnc specific SetScale (vs ultravnc) */
+ int scaleSetting; /**< 0 means no scale set, else 1/scaleSetting */
} AppData;
-/* For GetCredentialProc callback function to return */
+/** For GetCredentialProc callback function to return */
typedef union _rfbCredential
{
- /* X509 (VeNCrypt) */
+ /** X509 (VeNCrypt) */
struct
{
char *x509CACertFile;
@@ -122,7 +127,7 @@ typedef union _rfbCredential
char *x509ClientCertFile;
char *x509ClientKeyFile;
} x509Credential;
- /* Plain (VeNCrypt), MSLogon (UltraVNC) */
+ /** Plain (VeNCrypt), MSLogon (UltraVNC) */
struct
{
char *username;
@@ -136,6 +141,7 @@ typedef union _rfbCredential
struct _rfbClient;
typedef void (*HandleTextChatProc)(struct _rfbClient* client, int value, char *text);
+typedef void (*HandleXvpMsgProc)(struct _rfbClient* client, uint8_t version, uint8_t opcode);
typedef void (*HandleKeyboardLedStateProc)(struct _rfbClient* client, int value, int pad);
typedef rfbBool (*HandleCursorPosProc)(struct _rfbClient* client, int x, int y);
typedef void (*SoftCursorLockAreaProc)(struct _rfbClient* client, int x, int y, int w, int h);
@@ -161,7 +167,7 @@ typedef struct _rfbClient {
const char* programName;
char* serverHost;
- int serverPort; /* if -1, then use file recorded by vncrec */
+ int serverPort; /**< if -1, then use file recorded by vncrec */
rfbBool listenSpecified;
int listenPort, flashPort;
@@ -169,7 +175,7 @@ typedef struct _rfbClient {
int x, y, w, h;
} updateRect;
- /* Note that the CoRRE encoding uses this buffer and assumes it is big enough
+ /** Note that the CoRRE encoding uses this buffer and assumes it is big enough
to hold 255 * 255 * 32 bits -> 260100 bytes. 640*480 = 307200 bytes.
Hextile also assumes it is big enough to hold 16 * 16 * 32 bits.
Tight encoding assumes BUFFER_SIZE is at least 16384 bytes. */
@@ -220,7 +226,7 @@ typedef struct _rfbClient {
* Variables for the ``tight'' encoding implementation.
*/
- /* Separate buffer for compressed data. */
+ /** Separate buffer for compressed data. */
#define ZLIB_BUFFER_SIZE 30000
char zlib_buffer[ZLIB_BUFFER_SIZE];
@@ -235,7 +241,7 @@ typedef struct _rfbClient {
uint8_t tightPrevRow[2048*3*sizeof(uint16_t)];
#ifdef LIBVNCSERVER_HAVE_LIBJPEG
- /* JPEG decoder state. */
+ /** JPEG decoder state. */
rfbBool jpegError;
struct jpeg_source_mgr* jpegSrcManager;
@@ -249,7 +255,7 @@ typedef struct _rfbClient {
/* cursor.c */
uint8_t *rcSource, *rcMask;
- /* private data pointer */
+ /** private data pointer */
rfbClientData* clientData;
rfbVNCRec* vncRec;
@@ -268,7 +274,7 @@ typedef struct _rfbClient {
SoftCursorUnlockScreenProc SoftCursorUnlockScreen;
GotFrameBufferUpdateProc GotFrameBufferUpdate;
FinishedFrameBufferUpdateProc FinishedFrameBufferUpdate;
- /* the pointer returned by GetPassword will be freed after use! */
+ /** the pointer returned by GetPassword will be freed after use! */
GetPasswordProc GetPassword;
MallocFrameBufferProc MallocFrameBuffer;
GotXCutTextProc GotXCutText;
@@ -277,7 +283,7 @@ typedef struct _rfbClient {
GotCursorShapeProc GotCursorShape;
GotCopyRectProc GotCopyRect;
- /* Which messages are supported by the server
+ /** Which messages are supported by the server
* This is a *guess* for most servers.
* (If we can even detect the type of server)
*
@@ -287,18 +293,18 @@ typedef struct _rfbClient {
*/
rfbSupportedMessages supportedMessages;
- /* negotiated protocol version */
+ /** negotiated protocol version */
int major, minor;
- /* The selected security types */
+ /** The selected security types */
uint32_t authScheme, subAuthScheme;
#ifdef LIBVNCSERVER_WITH_CLIENT_TLS
- /* The TLS session for Anonymous TLS and VeNCrypt */
+ /** The TLS session for Anonymous TLS and VeNCrypt */
gnutls_session_t tlsSession;
#endif
- /* To support security types that requires user input (except VNC password
+ /** To support security types that requires user input (except VNC password
* authentication), for example VeNCrypt and MSLogon, this callback function
* must be set before the authentication. Otherwise, it implicates that the
* caller application does not support it and related security types should
@@ -306,13 +312,19 @@ typedef struct _rfbClient {
*/
GetCredentialProc GetCredential;
- /* The 0-terminated security types supported by the client.
+ /** The 0-terminated security types supported by the client.
* Set by function SetClientAuthSchemes() */
uint32_t *clientAuthSchemes;
- /* When the server is a repeater, this specifies the final destination */
+ /** When the server is a repeater, this specifies the final destination */
char *destHost;
int destPort;
+
+ /** the QoS IP DSCP for this client */
+ int QoS_DSCP;
+
+ /** hook to handle xvp server messages */
+ HandleXvpMsgProc HandleXvpMsg;
} rfbClient;
/* cursor.c */
@@ -349,6 +361,7 @@ extern rfbBool TextChatOpen(rfbClient* client);
extern rfbBool TextChatClose(rfbClient* client);
extern rfbBool TextChatFinish(rfbClient* client);
extern rfbBool PermitServerInput(rfbClient* client, int enabled);
+extern rfbBool SendXvpMsg(rfbClient* client, uint8_t version, uint8_t code);
extern void PrintPixelFormat(rfbPixelFormat *format);
@@ -364,10 +377,10 @@ void* rfbClientGetClientData(rfbClient* client, void* tag);
typedef struct _rfbClientProtocolExtension {
int* encodings;
- /* returns TRUE if the encoding was handled */
+ /** returns TRUE if the encoding was handled */
rfbBool (*handleEncoding)(rfbClient* cl,
rfbFramebufferUpdateRectHeader* rect);
- /* returns TRUE if it handled the message */
+ /** returns TRUE if it handled the message */
rfbBool (*handleMessage)(rfbClient* cl,
rfbServerToClientMsg* message);
struct _rfbClientProtocolExtension* next;
@@ -388,6 +401,7 @@ extern int ConnectClientToTcpAddr6(const char *hostname, int port);
extern int ConnectClientToUnixSock(const char *sockFile);
extern int AcceptTcpConnection(int listenSock);
extern rfbBool SetNonBlocking(int sock);
+extern rfbBool SetDSCP(int sock, int dscp);
extern rfbBool StringToIPAddr(const char *str, unsigned int *addr);
extern rfbBool SameMachine(int sock);
@@ -396,12 +410,21 @@ extern int WaitForMessage(rfbClient* client,unsigned int usecs);
/* vncviewer.c */
rfbClient* rfbGetClient(int bitsPerSample,int samplesPerPixel,int bytesPerPixel);
rfbBool rfbInitClient(rfbClient* client,int* argc,char** argv);
-/* rfbClientCleanup() does not touch client->frameBuffer */
+/** rfbClientCleanup() does not touch client->frameBuffer */
void rfbClientCleanup(rfbClient* client);
#if(defined __cplusplus)
}
#endif
-#endif
+/**
+ * @}
+ */
+/**
+ @page libvncclient_doc LibVNCClient Documentation
+ @section example_code Example Code
+ See SDLvncviewer.c for a rather complete client example.
+*/
+
+#endif
diff --git a/remmina-plugins/libvncserver/rfb/rfbint.h b/remmina-plugins/libvncserver/rfb/rfbint.h
index 9ab601748..4ba446f89 100644
--- a/remmina-plugins/libvncserver/rfb/rfbint.h
+++ b/remmina-plugins/libvncserver/rfb/rfbint.h
@@ -2,7 +2,7 @@
#define _RFB_RFBINT_H 1
#ifndef _GENERATED_STDINT_H
#define _GENERATED_STDINT_H "LibVNCServer 0.9.7"
-/* generated using a gnu compiler version gcc (Debian 4.4.4-5) 4.4.4 Copyright (C) 2010 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. */
+/* generated using a gnu compiler version gcc (Debian 4.4.5-8) 4.4.5 Copyright (C) 2010 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. */
#include <stdint.h>
diff --git a/remmina-plugins/libvncserver/rfb/rfbproto.h b/remmina-plugins/libvncserver/rfb/rfbproto.h
index b6f201c9d..73d200a67 100644
--- a/remmina-plugins/libvncserver/rfb/rfbproto.h
+++ b/remmina-plugins/libvncserver/rfb/rfbproto.h
@@ -1,6 +1,17 @@
#ifndef RFBPROTO_H
#define RFBPROTO_H
+/**
+ @mainpage
+ @li @ref libvncserver_api
+ @li @ref libvncserver_doc
+
+
+ @li @ref libvncclient_api
+ @li @ref libvncclient_doc
+
+*/
+
/*
* Copyright (C) 2005 Rohit Kumar, Johannes E. Schindelin
* Copyright (C) 2000-2002 Constantin Kaplinsky. All Rights Reserved.
@@ -68,6 +79,16 @@
#endif
#endif
+/* some autotool versions do not properly prefix
+ WORDS_BIGENDIAN, so do that manually */
+#ifdef WORDS_BIGENDIAN
+#define LIBVNCSERVER_WORDS_BIGENDIAN
+#endif
+
+/* MS compilers don't have strncasecmp */
+#ifdef _MSC_VER
+#define strncasecmp _strnicmp
+#endif
#if !defined(WIN32) || defined(__MINGW32__)
#define max(a,b) (((a)>(b))?(a):(b))
@@ -96,7 +117,7 @@ typedef uint32_t in_addr_t;
#define INADDR_NONE ((in_addr_t) 0xffffffff)
#endif
-#define MAX_ENCODINGS 20
+#define MAX_ENCODINGS 21
/*****************************************************************************
*
@@ -265,6 +286,7 @@ typedef char rfbProtocolVersionMsg[13]; /* allow extra byte for null */
#define rfbUltra 17
#define rfbTLS 18
#define rfbVeNCrypt 19
+#define rfbARD 30
#define rfbMSLogon 0xfffffffa
#define rfbVeNCryptPlain 256
@@ -369,7 +391,6 @@ typedef struct {
#define rfbServerCutText 3
/* Modif sf@2002 */
#define rfbResizeFrameBuffer 4
-#define rfbKeyFrameUpdate 5
#define rfbPalmVNCReSizeFrameBuffer 0xF
/* client -> server */
@@ -392,9 +413,10 @@ typedef struct {
/* Modif sf@2002 - TextChat - Bidirectionnal */
#define rfbTextChat 11
/* Modif cs@2005 */
-#define rfbKeyFrameRequest 12
/* PalmVNC 1.4 & 2.0 SetScale Factor message */
#define rfbPalmVNCSetScaleFactor 0xF
+/* Xvp message - bidirectional */
+#define rfbXvp 250
@@ -429,6 +451,9 @@ typedef struct {
#define rfbEncodingSolMonoZip 0xFFFF0008
#define rfbEncodingUltraZip 0xFFFF0009
+/* Xvp pseudo-encoding */
+#define rfbEncodingXvp 0xFFFFFECB
+
/*
* Special encoding numbers:
* 0xFFFFFF00 .. 0xFFFFFF0F -- encoding-specific compression levels;
@@ -501,18 +526,6 @@ typedef struct {
#define sz_rfbFramebufferUpdateMsg 4
-/*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- * KeyFrameUpdate - Acknowledgment of a key frame request, it tells the client
- * that the next update received will be a key frame.
- */
-
-typedef struct {
- uint8_t type;
-} rfbKeyFrameUpdateMsg;
-
-#define sz_rfbKeyFrameUpdateMsg 1
-
-
/*
* Each rectangle of pixel data consists of a header describing the position
* and size of the rectangle and a type word describing the encoding of the
@@ -1051,6 +1064,44 @@ typedef struct _rfbTextChatMsg {
#define rfbTextChatFinished 0xFFFFFFFD
+/*-----------------------------------------------------------------------------
+ * Xvp Message
+ * Bidirectional message
+ * A server which supports the xvp extension declares this by sending a message
+ * with an Xvp_INIT xvp-message-code when it receives a request from the client
+ * to use the xvp Pseudo-encoding. The server must specify in this message the
+ * highest xvp-extension-version it supports: the client may assume that the
+ * server supports all versions from 1 up to this value. The client is then
+ * free to use any supported version. Currently, only version 1 is defined.
+ *
+ * A server which subsequently receives an xvp Client Message requesting an
+ * operation which it is unable to perform, informs the client of this by
+ * sending a message with an Xvp_FAIL xvp-message-code, and the same
+ * xvp-extension-version as included in the client's operation request.
+ *
+ * A client supporting the xvp extension sends this to request that the server
+ * initiate a clean shutdown, clean reboot or abrupt reset of the system whose
+ * framebuffer the client is displaying.
+ */
+
+
+typedef struct {
+ uint8_t type; /* always rfbXvp */
+ uint8_t pad;
+ uint8_t version; /* xvp extension version */
+ uint8_t code; /* xvp message code */
+} rfbXvpMsg;
+
+#define sz_rfbXvpMsg (4)
+
+/* server message codes */
+#define rfbXvp_Fail 0
+#define rfbXvp_Init 1
+/* client message codes */
+#define rfbXvp_Shutdown 2
+#define rfbXvp_Reboot 3
+#define rfbXvp_Reset 4
+
/*-----------------------------------------------------------------------------
* Modif sf@2002
@@ -1105,6 +1156,7 @@ typedef union {
rfbPalmVNCReSizeFrameBufferMsg prsfb;
rfbFileTransferMsg ft;
rfbTextChatMsg tc;
+ rfbXvpMsg xvp;
} rfbServerToClientMsg;
@@ -1340,6 +1392,7 @@ typedef struct _rfbSetSWMsg {
#define sz_rfbSetSWMsg 6
+
/*-----------------------------------------------------------------------------
* Union of all client->server messages.
*/
@@ -1359,6 +1412,7 @@ typedef union {
rfbFileTransferMsg ft;
rfbSetSWMsg sw;
rfbTextChatMsg tc;
+ rfbXvpMsg xvp;
} rfbClientToServerMsg;
/*