156 |
rdp_send_logon_info(uint32 flags, char *domain, char *user, |
rdp_send_logon_info(uint32 flags, char *domain, char *user, |
157 |
char *password, char *program, char *directory) |
char *password, char *program, char *directory) |
158 |
{ |
{ |
159 |
|
char *ipaddr = tcp_get_address(); |
160 |
int len_domain = 2 * strlen(domain); |
int len_domain = 2 * strlen(domain); |
161 |
int len_user = 2 * strlen(user); |
int len_user = 2 * strlen(user); |
162 |
int len_password = 2 * strlen(password); |
int len_password = 2 * strlen(password); |
163 |
int len_program = 2 * strlen(program); |
int len_program = 2 * strlen(program); |
164 |
int len_directory = 2 * strlen(directory); |
int len_directory = 2 * strlen(directory); |
165 |
int len_ip = 2 * strlen("127.0.0.1"); |
int len_ip = 2 * strlen(ipaddr); |
166 |
int len_dll = 2 * strlen("C:\\WINNT\\System32\\mstscax.dll"); |
int len_dll = 2 * strlen("C:\\WINNT\\System32\\mstscax.dll"); |
167 |
int packetlen = 0; |
int packetlen = 0; |
168 |
uint32 sec_flags = g_encryption ? (SEC_LOGON_INFO | SEC_ENCRYPT) : SEC_LOGON_INFO; |
uint32 sec_flags = g_encryption ? (SEC_LOGON_INFO | SEC_ENCRYPT) : SEC_LOGON_INFO; |
170 |
time_t t = time(NULL); |
time_t t = time(NULL); |
171 |
time_t tzone; |
time_t tzone; |
172 |
|
|
173 |
|
#if 0 |
174 |
|
// enable rdp compression |
175 |
|
flags |= RDP_COMPRESSION; |
176 |
|
#endif |
177 |
|
|
178 |
if (!g_use_rdp5 || 1 == g_server_rdp_version) |
if (!g_use_rdp5 || 1 == g_server_rdp_version) |
179 |
{ |
{ |
180 |
DEBUG_RDP5(("Sending RDP4-style Logon packet\n")); |
DEBUG_RDP5(("Sending RDP4-style Logon packet\n")); |
272 |
} |
} |
273 |
out_uint16_le(s, 2); |
out_uint16_le(s, 2); |
274 |
out_uint16_le(s, len_ip + 2); /* Length of client ip */ |
out_uint16_le(s, len_ip + 2); /* Length of client ip */ |
275 |
rdp_out_unistr(s, "127.0.0.1", len_ip); |
rdp_out_unistr(s, ipaddr, len_ip); |
276 |
out_uint16_le(s, len_dll + 2); |
out_uint16_le(s, len_dll + 2); |
277 |
rdp_out_unistr(s, "C:\\WINNT\\System32\\mstscax.dll", len_dll); |
rdp_out_unistr(s, "C:\\WINNT\\System32\\mstscax.dll", len_dll); |
278 |
|
|
282 |
rdp_out_unistr(s, "GTB, normaltid", 2 * strlen("GTB, normaltid")); |
rdp_out_unistr(s, "GTB, normaltid", 2 * strlen("GTB, normaltid")); |
283 |
out_uint8s(s, 62 - 2 * strlen("GTB, normaltid")); |
out_uint8s(s, 62 - 2 * strlen("GTB, normaltid")); |
284 |
|
|
|
|
|
285 |
out_uint32_le(s, 0x0a0000); |
out_uint32_le(s, 0x0a0000); |
286 |
out_uint32_le(s, 0x050000); |
out_uint32_le(s, 0x050000); |
287 |
out_uint32_le(s, 3); |
out_uint32_le(s, 3); |
870 |
process_data_pdu(STREAM s) |
process_data_pdu(STREAM s) |
871 |
{ |
{ |
872 |
uint8 data_pdu_type; |
uint8 data_pdu_type; |
873 |
|
uint8 ctype; |
874 |
|
uint16 clen; |
875 |
|
int roff, rlen, len, ret; |
876 |
|
static struct stream ns; |
877 |
|
static signed char *dict = 0; |
878 |
|
|
879 |
in_uint8s(s, 8); /* shareid, pad, streamid, length */ |
in_uint8s(s, 6); /* shareid, pad, streamid */ |
880 |
|
in_uint16(s, len); |
881 |
in_uint8(s, data_pdu_type); |
in_uint8(s, data_pdu_type); |
882 |
in_uint8s(s, 3); /* compress_type, compress_len */ |
in_uint8(s, ctype); |
883 |
|
in_uint16(s, clen); |
884 |
|
clen -= 18; |
885 |
|
|
886 |
|
#if 0 |
887 |
|
if (ctype & 0x20) |
888 |
|
{ |
889 |
|
if (!dict) |
890 |
|
{ |
891 |
|
dict = (signed char *) malloc(8200 * sizeof(signed char)); |
892 |
|
dict = (signed char *) memset(dict, 0, 8200 * sizeof(signed char)); |
893 |
|
} |
894 |
|
|
895 |
|
ret = decompress(s->p, clen, ctype, (signed char *) dict, &roff, &rlen); |
896 |
|
|
897 |
|
len -= 18; |
898 |
|
|
899 |
|
ns.data = xrealloc(ns.data, len); |
900 |
|
|
901 |
|
ns.data = (unsigned char *) memcpy(ns.data, (unsigned char *) (dict + roff), len); |
902 |
|
|
903 |
|
ns.size = len; |
904 |
|
ns.end = ns.data + ns.size; |
905 |
|
ns.p = ns.data; |
906 |
|
ns.rdp_hdr = ns.p; |
907 |
|
|
908 |
|
s = &ns; |
909 |
|
} |
910 |
|
#endif |
911 |
|
|
912 |
switch (data_pdu_type) |
switch (data_pdu_type) |
913 |
{ |
{ |