aboutsummaryrefslogtreecommitdiff
path: root/net/rdesktop/files
diff options
context:
space:
mode:
authorFlorent Thoumie <flz@FreeBSD.org>2005-04-20 08:12:44 +0000
committerFlorent Thoumie <flz@FreeBSD.org>2005-04-20 08:12:44 +0000
commitb2f6cc52960915985cbb4e60ccac035135ed8ede (patch)
treeb151b66d54b6dfe025cfc8db57c36ad13da4b09b /net/rdesktop/files
parentbf007f80d902b71cea20d8ccffd2445132dce2f4 (diff)
downloadports-b2f6cc52960915985cbb4e60ccac035135ed8ede.tar.gz
ports-b2f6cc52960915985cbb4e60ccac035135ed8ede.zip
Notes
Diffstat (limited to 'net/rdesktop/files')
-rw-r--r--net/rdesktop/files/patch-constants.h13
-rw-r--r--net/rdesktop/files/patch-licence.c12
-rw-r--r--net/rdesktop/files/patch-rdesktop.c67
-rw-r--r--net/rdesktop/files/patch-rdp.c118
4 files changed, 210 insertions, 0 deletions
diff --git a/net/rdesktop/files/patch-constants.h b/net/rdesktop/files/patch-constants.h
new file mode 100644
index 000000000000..bbe80c66a104
--- /dev/null
+++ b/net/rdesktop/files/patch-constants.h
@@ -0,0 +1,13 @@
+--- constants.h.orig 2004-11-03 16:56:44.000000000 +0300
++++ constants.h 2004-12-15 11:47:49.583973715 +0300
+@@ -21,6 +21,9 @@
+ /* TCP port for Remote Desktop Protocol */
+ #define TCP_PORT_RDP 3389
+
++#define DEFAULT_CODEPAGE "UTF-8"
++#define WINDOWS_CODEPAGE "UTF-16"
++
+ /* ISO PDU codes */
+ enum ISO_PDU_CODE
+ {
+diff -uNr licence.c.orig licence.c
diff --git a/net/rdesktop/files/patch-licence.c b/net/rdesktop/files/patch-licence.c
new file mode 100644
index 000000000000..4071ab9b8495
--- /dev/null
+++ b/net/rdesktop/files/patch-licence.c
@@ -0,0 +1,12 @@
+--- licence.c.orig 2004-07-31 17:07:41.000000000 +0400
++++ licence.c 2004-12-15 10:19:42.000000000 +0300
+@@ -21,7 +21,7 @@
+ #include "rdesktop.h"
+ #include <openssl/rc4.h>
+
+-extern char g_username[16];
++extern char g_username[64];
+ extern char g_hostname[16];
+
+ static uint8 g_licence_key[16];
+diff -uNr rdesktop.c.orig rdesktop.c
diff --git a/net/rdesktop/files/patch-rdesktop.c b/net/rdesktop/files/patch-rdesktop.c
new file mode 100644
index 000000000000..509be4c1107a
--- /dev/null
+++ b/net/rdesktop/files/patch-rdesktop.c
@@ -0,0 +1,67 @@
+--- rdesktop.c.orig 2004-11-18 14:18:49.000000000 +0300
++++ rdesktop.c 2004-12-15 12:19:11.263991136 +0300
+@@ -28,6 +28,8 @@
+ #include <sys/times.h> /* times */
+ #include <ctype.h> /* toupper */
+ #include <errno.h>
++#include <locale.h>
++#include <langinfo.h>
+ #include "rdesktop.h"
+
+ #ifdef EGD_SOCKET
+@@ -39,6 +41,7 @@
+
+ char g_title[64] = "";
+ char g_username[64];
++char g_codepage[16] = "";
+ char g_hostname[16];
+ char keymapname[16];
+ int g_keylayout = 0x409; /* Defaults to US keyboard layout */
+@@ -112,6 +115,7 @@
+ fprintf(stderr, " -g: desktop geometry (WxH)\n");
+ fprintf(stderr, " -f: full-screen mode\n");
+ fprintf(stderr, " -b: force bitmap updates\n");
++ fprintf(stderr, " -L: local codepage\n");
+ fprintf(stderr, " -B: use BackingStore of X-server (if available)\n");
+ fprintf(stderr, " -e: disable encryption (French TS)\n");
+ fprintf(stderr, " -E: disable encryption from client to server\n");
+@@ -366,7 +370,7 @@
+ #endif
+
+ while ((c = getopt(argc, argv,
+- VNCOPT "u:d:s:c:p:n:k:g:fbBeEmzCDKS:T:NX:a:x:Pr:045h?")) != -1)
++ VNCOPT "u:L:d:s:c:p:n:k:g:fbBeEmzCDKS:T:NX:a:x:Pr:045h?")) != -1)
+ {
+ switch (c)
+ {
+@@ -389,6 +393,10 @@
+ username_option = 1;
+ break;
+
++ case 'L':
++ STRNCPY(g_codepage, optarg, sizeof(g_codepage));
++ break;
++
+ case 'd':
+ STRNCPY(domain, optarg, sizeof(domain));
+ break;
+@@ -675,6 +683,18 @@
+ STRNCPY(g_username, pw->pw_name, sizeof(g_username));
+ }
+
++ if (g_codepage[0] == 0)
++ {
++ if (setlocale(LC_CTYPE, ""))
++ {
++ STRNCPY(g_codepage, nl_langinfo(CODESET), sizeof(g_codepage));
++ }
++ else
++ {
++ STRNCPY(g_codepage, DEFAULT_CODEPAGE, sizeof(g_codepage));
++ }
++ }
++
+ if (g_hostname[0] == 0)
+ {
+ if (gethostname(fullhostname, sizeof(fullhostname)) == -1)
+diff -uNr rdp.c.orig rdp.c
diff --git a/net/rdesktop/files/patch-rdp.c b/net/rdesktop/files/patch-rdp.c
new file mode 100644
index 000000000000..6c0c690fd024
--- /dev/null
+++ b/net/rdesktop/files/patch-rdp.c
@@ -0,0 +1,118 @@
+--- rdp.c.orig 2004-10-07 17:00:28.000000000 +0400
++++ rdp.c 2004-12-15 12:12:23.022107839 +0300
+@@ -19,10 +19,14 @@
+ */
+
+ #include <time.h>
++#include <errno.h>
++#include <iconv.h>
++#include <unistd.h>
+ #include "rdesktop.h"
+
+ extern uint16 g_mcs_userid;
+-extern char g_username[16];
++extern char g_username[64];
++extern char g_codepage[16];
+ extern BOOL g_bitmap_compression;
+ extern BOOL g_orders;
+ extern BOOL g_encryption;
+@@ -140,17 +144,51 @@
+ void
+ rdp_out_unistr(STREAM s, char *string, int len)
+ {
+- int i = 0, j = 0;
++ static iconv_t iconv_h = (iconv_t)-1;
++ size_t ibl = strlen(string), obl = len + 2;
++ char *pin = string, *pout;
++#ifdef WORDS_BIGENDIAN
++ char ss[4096]; // FIXME: global MAX_BUF_SIZE macro need
++
++ pout = ss;
++#else
++ pout = s->p;
++#endif
+
+- len += 2;
++ memset(pout, 0, len + 4);
+
+- while (i < len)
++ if (iconv_h == (iconv_t)-1)
+ {
+- s->p[i++] = string[j++];
+- s->p[i++] = 0;
++ size_t i = 1, o = 4;
++ if ((iconv_h = iconv_open(WINDOWS_CODEPAGE, g_codepage)) == (iconv_t)-1)
++ {
++ printf("rdp_out_unistr: iconv_open[%s -> %s] fail %d\n",
++ g_codepage, WINDOWS_CODEPAGE, (int)iconv_h);
++ return;
++ }
++ if (iconv(iconv_h, &pin, &i, &pout, &o) == (size_t)-1)
++ {
++ iconv_close(iconv_h);
++ iconv_h = (iconv_t)-1;
++ printf("rdp_out_unistr: iconv(1) fail, errno %d\n", errno);
++ return;
++ }
++ pin = string; pout = s->p;
+ }
+
+- s->p += len;
++ if (iconv(iconv_h, &pin, &ibl, &pout, &obl) == (size_t)-1)
++ {
++ iconv_close(iconv_h);
++ iconv_h = (iconv_t)-1;
++ printf("rdp_out_unistr: iconv(2) fail, errno %d\n", errno);
++ return;
++ }
++
++#ifdef WORDS_BIGENDIAN
++ swab(ss, s->p, len + 4);
++#endif
++
++ s->p += len + 2;
+ }
+
+ /* Input a string in Unicode
+@@ -160,15 +198,36 @@
+ int
+ rdp_in_unistr(STREAM s, char *string, int uni_len)
+ {
+- int i = 0;
++ static iconv_t iconv_h = (iconv_t)-1;
++ size_t ibl = uni_len, obl = uni_len;
++ char *pin, *pout = string;
++#ifdef WORDS_BIGENDIAN
++ char ss[4096]; // FIXME: global MAX_BUF_SIZE macro need
++
++ swab(s->p, ss, uni_len);
++ pin = ss;
++#else
++ pin = s->p;
++#endif
+
+- while (i < uni_len / 2)
++ if (iconv_h == (iconv_t)-1)
+ {
+- in_uint8a(s, &string[i++], 1);
+- in_uint8s(s, 1);
++ if ((iconv_h = iconv_open(g_codepage, WINDOWS_CODEPAGE)) == (iconv_t)-1)
++ {
++ printf("rdp_in_unistr: iconv_open[%s -> %s] fail %d\n",
++ WINDOWS_CODEPAGE, g_codepage, (int)iconv_h);
++ return 0;
++ }
+ }
+
+- return i - 1;
++ if (iconv(iconv_h, &pin, &ibl, &pout, &obl) == (size_t)-1)
++ {
++ iconv_close(iconv_h);
++ iconv_h = (iconv_t)-1;
++ printf("rdp_in_unistr: iconv fail, errno %d\n", errno);
++ return 0;
++ }
++ return pout - string;
+ }
+
+