libxrdp: work on TLS mode, temporary changes

ulab-next-nosound
speidy 11 years ago
parent 7ab1d887ae
commit 1acdc3085e

@ -630,7 +630,6 @@ static int APP_CC
xrdp_mcs_ber_out_header(struct xrdp_mcs *self, struct stream *s,
int tag_val, int len)
{
g_writeln("tag_val > 0xff ? %d", tag_val > 0xff);
if (tag_val > 0xff)
{
out_uint16_be(s, tag_val);
@ -640,7 +639,6 @@ xrdp_mcs_ber_out_header(struct xrdp_mcs *self, struct stream *s,
out_uint8(s, tag_val);
}
g_writeln("len >= 0x80 ? %d", len >= 0x80);
if (len >= 0x80)
{
out_uint8(s, 0x82);
@ -721,6 +719,7 @@ xrdp_mcs_send_connect_response(struct xrdp_mcs *self)
make_stream(s);
init_stream(s, 8192);
data_len = (int) (self->server_mcs_data->end - self->server_mcs_data->data);
g_writeln("data len = %d , +36= %d", data_len, data_len+36);
xrdp_iso_init(self->iso_layer, s);
//TODO: 36 - tls , 38 - rdp - we should calculate that
xrdp_mcs_ber_out_header(self, s, MCS_CONNECT_RESPONSE, data_len + 36);
@ -734,6 +733,7 @@ xrdp_mcs_send_connect_response(struct xrdp_mcs *self)
out_uint8a(s, self->server_mcs_data->data, data_len);
s_mark_end(s);
g_hexdump(s->data, 150);
if (xrdp_iso_send(self->iso_layer, s) != 0)
{
free_stream(s);

@ -277,8 +277,8 @@ xrdp_sec_create(struct xrdp_rdp *owner, struct trans *trans, int crypt_level,
self->fastpath_layer = xrdp_fastpath_create(self, trans);
self->chan_layer = xrdp_channel_create(self, self->mcs_layer);
//TODO: add cert to config
self->tls = xrdp_tls_create(trans, "/opt/xrdpdev/etc/xrdp/pkey.pem",
"/opt/xrdpdev/etc/xrdp/cert.pem");
self->tls = xrdp_tls_create(trans, "/opt/xrdpinstall/etc/xrdp/pkey.pem",
"/opt/xrdpinstall/etc/xrdp/cert.pem");
DEBUG((" out xrdp_sec_create"));
return self;
}
@ -329,7 +329,7 @@ xrdp_sec_init(struct xrdp_sec *self, struct stream *s)
}
else
{
s_push_layer(s, sec_hdr, 4);
// s_push_layer(s, sec_hdr, 4);
}
return 0;
@ -1048,6 +1048,7 @@ xrdp_sec_recv(struct xrdp_sec *self, struct stream *s, int *chan)
}
in_uint32_le(s, flags);
DEBUG((" in xrdp_sec_recv flags $%x", flags));
g_writeln("userdata shareheaedr flags = %d", flags);
if (flags & SEC_ENCRYPT) /* 0x08 */
{
@ -1257,7 +1258,7 @@ xrdp_sec_send(struct xrdp_sec *self, struct stream *s, int chan)
}
else
{
out_uint32_le(s, 0);
// out_uint32_le(s, 0);
}
if (xrdp_mcs_send(self->mcs_layer, s, chan) != 0)
@ -1835,11 +1836,11 @@ xrdp_sec_out_mcs_data(struct xrdp_sec *self)
num_channels_even = num_channels + (num_channels & 1);
s = &(self->server_mcs_data);
init_stream(s, 8192);
out_uint16_be(s, 5);
out_uint16_be(s, 5); /* AsnBerObjectIdentifier */
out_uint16_be(s, 0x14);
out_uint8(s, 0x7c);
out_uint16_be(s, 1);
out_uint8(s, 0x2a);
out_uint16_be(s, 1); /* -- */
out_uint8(s, 0x2a); /* ConnectPDULen */
out_uint8(s, 0x14);
out_uint8(s, 0x76);
out_uint8(s, 0x0a);
@ -1854,7 +1855,7 @@ xrdp_sec_out_mcs_data(struct xrdp_sec *self)
out_uint8(s, 0x6e); /* n */
/* GCC Response Total Length - 2 bytes , set later */
gcc_size_ptr = s->p; /* RDPGCCUserDataResponseLength */
out_uint8s(s, 2);
out_uint8(s, 0);
ud_ptr = s->p; /* User Data */
out_uint16_le(s, SEC_TAG_SRV_INFO);
@ -1873,7 +1874,7 @@ xrdp_sec_out_mcs_data(struct xrdp_sec *self)
if (self->mcs_layer->iso_layer->rdpNegData)
{
/* ReqeustedProtocol */
out_uint32_le(s, self->mcs_layer->iso_layer->selectedProtocol);
out_uint32_le(s, self->mcs_layer->iso_layer->requestedProtocol);
}
out_uint16_le(s, SEC_TAG_SRV_CHANNELS);
out_uint16_le(s, 8 + (num_channels_even * 2)); /* len */
@ -1960,7 +1961,7 @@ xrdp_sec_out_mcs_data(struct xrdp_sec *self)
out_uint16_le(s, 12); /* len is 12 */
out_uint32_le(s, self->crypt_method);
out_uint32_le(s, self->crypt_level);
}
}
else
{
LLOGLN(0, ("xrdp_sec_out_mcs_data: error"));
@ -1968,9 +1969,9 @@ xrdp_sec_out_mcs_data(struct xrdp_sec *self)
/* end certificate */
s_mark_end(s);
gcc_size = (int)(s->end - ud_ptr) | 0x8000;
gcc_size_ptr[0] = gcc_size >> 8;
gcc_size_ptr[1] = gcc_size;
gcc_size = (int)(s->end - ud_ptr);// | 0x8000;
gcc_size_ptr[0] = gcc_size;// >> 8;
//gcc_size_ptr[1] = gcc_size;
return 0;
}

Loading…
Cancel
Save