Request channels in an orderly way :).
Allow transmission on a certain channel (still retaining old interface). Indentation changes. git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/trunk/rdesktop@411 423420c4-83ab-492f-b58f-81f9feb106b5
This commit is contained in:
parent
5f9d3feb42
commit
d612e591e1
48
secure.c
48
secure.c
@ -41,6 +41,7 @@ extern BOOL encryption;
|
|||||||
extern BOOL g_licence_issued;
|
extern BOOL g_licence_issued;
|
||||||
extern BOOL use_rdp5;
|
extern BOOL use_rdp5;
|
||||||
extern int server_bpp;
|
extern int server_bpp;
|
||||||
|
extern uint16 mcs_userid;
|
||||||
|
|
||||||
static int rc4_key_len;
|
static int rc4_key_len;
|
||||||
static RC4_KEY rc4_decrypt_key;
|
static RC4_KEY rc4_decrypt_key;
|
||||||
@ -340,9 +341,9 @@ sec_init(uint32 flags, int maxlen)
|
|||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Transmit secure transport packet */
|
/* Transmit secure transport packet over specified channel */
|
||||||
void
|
void
|
||||||
sec_send(STREAM s, uint32 flags)
|
sec_send_to_channel(STREAM s, uint32 flags, uint16 channel)
|
||||||
{
|
{
|
||||||
int datalen;
|
int datalen;
|
||||||
|
|
||||||
@ -364,9 +365,18 @@ sec_send(STREAM s, uint32 flags)
|
|||||||
sec_encrypt(s->p + 8, datalen);
|
sec_encrypt(s->p + 8, datalen);
|
||||||
}
|
}
|
||||||
|
|
||||||
mcs_send(s);
|
mcs_send_to_channel(s, channel);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Transmit secure transport packet */
|
||||||
|
|
||||||
|
void
|
||||||
|
sec_send(STREAM s, uint32 flags)
|
||||||
|
{
|
||||||
|
sec_send_to_channel(s, flags, MCS_GLOBAL_CHANNEL);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Transfer the client random to the server */
|
/* Transfer the client random to the server */
|
||||||
static void
|
static void
|
||||||
sec_establish_key(void)
|
sec_establish_key(void)
|
||||||
@ -389,8 +399,16 @@ sec_establish_key(void)
|
|||||||
static void
|
static void
|
||||||
sec_out_mcs_data(STREAM s)
|
sec_out_mcs_data(STREAM s)
|
||||||
{
|
{
|
||||||
|
uint16 num_channels = get_num_channels();
|
||||||
int hostlen = 2 * strlen(hostname);
|
int hostlen = 2 * strlen(hostname);
|
||||||
int length = 158 + 76 + 12 + 4 + 20;
|
int length = 158 + 76 + 12 + 4 + (CHANNEL_TAGDATA_SIZE * num_channels);
|
||||||
|
uint16 i;
|
||||||
|
rdp5_channel *channel;
|
||||||
|
|
||||||
|
if (0 < num_channels)
|
||||||
|
{
|
||||||
|
length += +4 + 4;
|
||||||
|
}
|
||||||
|
|
||||||
if (hostlen > 30)
|
if (hostlen > 30)
|
||||||
hostlen = 30;
|
hostlen = 30;
|
||||||
@ -467,12 +485,20 @@ sec_out_mcs_data(STREAM s)
|
|||||||
out_uint32_le(s, encryption ? 0x3 : 0); /* encryption supported, 128-bit supported */
|
out_uint32_le(s, encryption ? 0x3 : 0); /* encryption supported, 128-bit supported */
|
||||||
out_uint32(s, 0); /* Unknown */
|
out_uint32(s, 0); /* Unknown */
|
||||||
|
|
||||||
|
DEBUG_RDP5(("num_channels is %d\n", num_channels));
|
||||||
|
if (0 < num_channels)
|
||||||
|
{
|
||||||
out_uint16_le(s, SEC_TAG_CLI_CHANNELS);
|
out_uint16_le(s, SEC_TAG_CLI_CHANNELS);
|
||||||
out_uint16_le(s, 20); /* length */
|
out_uint16_le(s, num_channels * CHANNEL_TAGDATA_SIZE + 4 + 4); /* length */
|
||||||
out_uint32_le(s, 1); /* number of virtual channels */
|
out_uint32_le(s, num_channels); /* number of virtual channels */
|
||||||
out_uint8p(s, "cliprdr", 8); /* name padded to 8(?) */
|
for (i = 0; i < num_channels; i++)
|
||||||
out_uint16(s, 0);
|
{
|
||||||
out_uint16_le(s, 0xc0a0); /* Flags. Rumours tell this is documented in MSDN. */
|
channel = find_channel_by_num(i);
|
||||||
|
DEBUG_RDP5(("Requesting channel %s\n", channel->name));
|
||||||
|
out_uint8p(s, channel->name, 8);
|
||||||
|
out_uint32_be(s, channel->channelflags);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
s_mark_end(s);
|
s_mark_end(s);
|
||||||
}
|
}
|
||||||
@ -673,6 +699,7 @@ sec_process_crypt_info(STREAM s)
|
|||||||
}
|
}
|
||||||
|
|
||||||
DEBUG(("Generating client random\n"));
|
DEBUG(("Generating client random\n"));
|
||||||
|
/* Generate a client random, and hence determine encryption keys */
|
||||||
// This is what the MS client do:
|
// This is what the MS client do:
|
||||||
memset(inr, 0, SEC_RANDOM_SIZE);
|
memset(inr, 0, SEC_RANDOM_SIZE);
|
||||||
/* *ARIGL!* Plaintext attack, anyone?
|
/* *ARIGL!* Plaintext attack, anyone?
|
||||||
@ -775,7 +802,8 @@ sec_recv(void)
|
|||||||
|
|
||||||
if (sec_flags & SEC_LICENCE_NEG)
|
if (sec_flags & SEC_LICENCE_NEG)
|
||||||
{
|
{
|
||||||
if (sec_flags & SEC_ENCRYPT) {
|
if (sec_flags & SEC_ENCRYPT)
|
||||||
|
{
|
||||||
DEBUG_RDP5(("Encrypted license detected\n"));
|
DEBUG_RDP5(("Encrypted license detected\n"));
|
||||||
}
|
}
|
||||||
licence_process(s);
|
licence_process(s);
|
||||||
|
Loading…
Reference in New Issue
Block a user