get real ip address, or lp if not avail - volker milde, also part of rdp compression within ifdef 0 from uni patches

git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/trunk/rdesktop@623 423420c4-83ab-492f-b58f-81f9feb106b5
This commit is contained in:
Peter Kallden 2004-03-04 08:11:40 +00:00
parent 09e90b4ee9
commit 256039d50a
2 changed files with 45 additions and 5 deletions

View File

@ -139,6 +139,7 @@ void tcp_send(STREAM s);
STREAM tcp_recv(STREAM s, uint32 length);
BOOL tcp_connect(char *server);
void tcp_disconnect(void);
char *tcp_get_address(void);
/* xclip.c */
void ui_clip_format_announce(uint8 * data, uint32 length);
void ui_clip_handle_data(uint8 * data, uint32 length);

49
rdp.c
View File

@ -156,12 +156,13 @@ static void
rdp_send_logon_info(uint32 flags, char *domain, char *user,
char *password, char *program, char *directory)
{
char *ipaddr = tcp_get_address();
int len_domain = 2 * strlen(domain);
int len_user = 2 * strlen(user);
int len_password = 2 * strlen(password);
int len_program = 2 * strlen(program);
int len_directory = 2 * strlen(directory);
int len_ip = 2 * strlen("127.0.0.1");
int len_ip = 2 * strlen(ipaddr);
int len_dll = 2 * strlen("C:\\WINNT\\System32\\mstscax.dll");
int packetlen = 0;
uint32 sec_flags = g_encryption ? (SEC_LOGON_INFO | SEC_ENCRYPT) : SEC_LOGON_INFO;
@ -169,6 +170,11 @@ rdp_send_logon_info(uint32 flags, char *domain, char *user,
time_t t = time(NULL);
time_t tzone;
#if 0
// enable rdp compression
flags |= RDP_COMPRESSION;
#endif
if (!g_use_rdp5 || 1 == g_server_rdp_version)
{
DEBUG_RDP5(("Sending RDP4-style Logon packet\n"));
@ -266,7 +272,7 @@ rdp_send_logon_info(uint32 flags, char *domain, char *user,
}
out_uint16_le(s, 2);
out_uint16_le(s, len_ip + 2); /* Length of client ip */
rdp_out_unistr(s, "127.0.0.1", len_ip);
rdp_out_unistr(s, ipaddr, len_ip);
out_uint16_le(s, len_dll + 2);
rdp_out_unistr(s, "C:\\WINNT\\System32\\mstscax.dll", len_dll);
@ -276,7 +282,6 @@ rdp_send_logon_info(uint32 flags, char *domain, char *user,
rdp_out_unistr(s, "GTB, normaltid", 2 * strlen("GTB, normaltid"));
out_uint8s(s, 62 - 2 * strlen("GTB, normaltid"));
out_uint32_le(s, 0x0a0000);
out_uint32_le(s, 0x050000);
out_uint32_le(s, 3);
@ -865,10 +870,44 @@ static void
process_data_pdu(STREAM s)
{
uint8 data_pdu_type;
uint8 ctype;
uint16 clen;
int roff, rlen, len, ret;
static struct stream ns;
static signed char *dict = 0;
in_uint8s(s, 8); /* shareid, pad, streamid, length */
in_uint8s(s, 6); /* shareid, pad, streamid */
in_uint16(s, len);
in_uint8(s, data_pdu_type);
in_uint8s(s, 3); /* compress_type, compress_len */
in_uint8(s, ctype);
in_uint16(s, clen);
clen -= 18;
#if 0
if (ctype & 0x20)
{
if (!dict)
{
dict = (signed char *) malloc(8200 * sizeof(signed char));
dict = (signed char *) memset(dict, 0, 8200 * sizeof(signed char));
}
ret = decompress(s->p, clen, ctype, (signed char *) dict, &roff, &rlen);
len -= 18;
ns.data = xrealloc(ns.data, len);
ns.data = (unsigned char *) memcpy(ns.data, (unsigned char *) (dict + roff), len);
ns.size = len;
ns.end = ns.data + ns.size;
ns.p = ns.data;
ns.rdp_hdr = ns.p;
s = &ns;
}
#endif
switch (data_pdu_type)
{