libxrdp: some ISO_PDU_CR changes

ulab-next
Jay Sorg 11 years ago
parent 2df63787ca
commit 5adbf2d32b

@ -33,25 +33,26 @@
/* RDP Security Negotiation codes */
#define RDP_NEG_REQ 0x01
#define RDP_NEG_RSP 0x02
#define RDP_NEG_FAILURE 0x03
#define RDP_NEG_REQ 0x01
#define RDP_NEG_RSP 0x02
#define RDP_NEG_FAILURE 0x03
#define RDP_CORRELATION_INFO 0x06
/* Protocol types codes */
#define PROTOCOL_RDP 0x0
#define PROTOCOL_SSL 0x1
#define PROTOCOL_HYBRID 0x2
#define PROTOCOL_HYBRID_EX 0x8
#define PROTOCOL_RDP 0x0
#define PROTOCOL_SSL 0x1
#define PROTOCOL_HYBRID 0x2
#define PROTOCOL_HYBRID_EX 0x8
/* Negotiation packet flags */
#define EXTENDED_CLIENT_DATA_SUPPORTED 0x1
#define DYNVC_GFX_PROTOCOL_SUPPORTED 0x2
#define RDP_NEGRSP_RESERVED 0x4
#define RDP_NEGRSP_RESERVED 0x4
/* Failure Codes */
#define SSL_REQUIRED_BY_SERVER 0x1
#define SSL_NOT_ALLOWED_BY_SERVER 0x2
#define SSL_CERT_NOT_ON_SERVER 0x3
#define INCONSISTENT_FLAGS 0x4
#define HYBRID_REQUIRED_BY_SERVER 0x5
#define SSL_WITH_USER_AUTH_REQUIRED_BY_SERVER 0x6
#define SSL_REQUIRED_BY_SERVER 0x1
#define SSL_NOT_ALLOWED_BY_SERVER 0x2
#define SSL_CERT_NOT_ON_SERVER 0x3
#define INCONSISTENT_FLAGS 0x4
#define HYBRID_REQUIRED_BY_SERVER 0x5
#define SSL_WITH_USER_AUTH_REQUIRED_BY_SERVER 0x6
/* MCS PDU codes */
@ -95,7 +96,7 @@
#define SEC_TAG_CLI_CRYPT 0xc002
#define SEC_TAG_CLI_CHANNELS 0xc003
#define SEC_TAG_CLI_4 0xc004
#define SEC_TAG_CLI_MONITOR 0xc005
#define SEC_TAG_CLI_MONITOR 0xc005
#define SEC_TAG_PUBKEY 0x0006
#define SEC_TAG_KEYSIG 0x0008

@ -53,12 +53,9 @@ xrdp_iso_delete(struct xrdp_iso *self)
static int APP_CC
xrdp_iso_recv_rdpnegreq(struct xrdp_iso *self, struct stream *s)
{
int type;
int flags;
int len;
self->requestedProtocol = 0;
DEBUG((" in xrdp_iso_recv_rdpnegreq"));
in_uint8(s, flags);
@ -180,8 +177,6 @@ xrdp_iso_recv(struct xrdp_iso *self, struct stream *s)
static int APP_CC
xrdp_iso_send_rdpnegrsp(struct xrdp_iso *self, struct stream *s, int code)
{
int send_rdpnegdata;
if (xrdp_tcp_init(self->tcp_layer, s) != 0)
{
return 1;
@ -262,6 +257,7 @@ xrdp_iso_send_rdpnegfailure(struct xrdp_iso *self, struct stream *s, int code, i
return 0;
}
/*****************************************************************************/
static int APP_CC
xrdp_iso_send_nego(struct xrdp_iso *self)
@ -296,9 +292,6 @@ xrdp_iso_send_nego(struct xrdp_iso *self)
return 0;
}
#define TYPE_RDP_NEG_REQ 1
#define TYPE_RDP_CORRELATION_INFO 6
/*****************************************************************************/
/* returns error */
int APP_CC
@ -306,9 +299,6 @@ xrdp_iso_incoming(struct xrdp_iso *self)
{
int code;
int len;
int requestedProtocol;
int selectedProtocol;
int got_nego;
int cookie_index;
int cc_type;
char text[256];
@ -332,35 +322,30 @@ xrdp_iso_incoming(struct xrdp_iso *self)
return 1;
}
got_nego = 0;
self->selectedProtocol = -1;
self->requestedProtocol = PROTOCOL_RDP;
pend = s->p + len;
g_hexdump(s->p, len);
cookie_index = 0;
while (s->p < pend)
{
in_uint8(s, cc_type);
//g_writeln("cc_type %x", cc_type);
switch (cc_type)
{
case 0:
default:
break;
case TYPE_RDP_NEG_REQ: /* rdpNegReq 1 */
g_writeln("xrdp_iso_incoming: TYPE_RDP_NEG_REQ");
case RDP_NEG_REQ: /* rdpNegReq 1 */
if (xrdp_iso_recv_rdpnegreq(self, s) != 0)
{
free_stream(s);
return 1;
}
got_nego = 1;
break;
case TYPE_RDP_CORRELATION_INFO: /* rdpCorrelationInfo 6 */
g_writeln("xrdp_iso_incoming: TYPE_RDP_CORRELATION_INFO");
case RDP_CORRELATION_INFO: /* rdpCorrelationInfo 6 */
// TODO
in_uint8s(s, 1 + 2 + 16 + 16);
break;
case 'C': /* Cookie */
/* fall through */
default: /* routingToken */
g_writeln("xrdp_iso_incoming: cookie or token");
case 'C': /* Cookie routingToken */
while (s->p < pend)
{
text[cookie_index] = cc_type;
@ -374,23 +359,14 @@ xrdp_iso_incoming(struct xrdp_iso *self)
}
in_uint8(s, cc_type);
}
g_writeln("%s", text);
break;
}
}
if (got_nego)
{
if (xrdp_iso_send_nego(self) != 0)
{
free_stream(s);
return 1;
}
}
else
if (xrdp_iso_send_nego(self) != 0)
{
self->selectedProtocol = -1; //we are not doing negotiation
xrdp_iso_send_rdpnegrsp(self, s, ISO_PDU_CC);
free_stream(s);
return 1;
}
DEBUG((" out xrdp_iso_incoming"));

Loading…
Cancel
Save