This is related to issue #729 and it is probably #729's cause.
The problem here is that during rdp_client_connect_demand_active, an error PDU may be sent from the server. The code is set up to handle unexpected PDUs, but it skips over a fixed number of bytes (RDP_PACKET_HEADER_MAX_LENGTH) rather than basing it on the content of the headers (TPKT+X224+T125, etc.). In summary, it skips over 15 bytes when it should be skipping over 14, and then when the demand_active parsing picks up again, it starts in the wrong place and fails.
The fix is to use the same header-parsing code to handle the error packet header, rather than relying on a fixed offset. That code is smart enough to compute the offsets correctly.
fix for PDU_TYPE_DEMAND_ACTIVE 0001, got 0007 error
Can one of the admins verify this patch?
@freerdp-bot test this please
Build results will soon be (or already are) available at: https://ci.freerdp.com/job/Github%20pull%20request%20tester/57/
Fix broken in Debian Jessie:
This is FreeRDP version 1.1.0-beta1 (git n/a)
Virtualmachin is on Virtualbox, guest is windows 8.1 pro; works without /app:"||calc"
xfreerdp /u:user /p:pass /app:"||calc" /v:machine /cert-ignore
loading channel rail
connected to machine:3389
expected PDU_TYPE_DEMAND_ACTIVE 0001, got 0007
SSL_read: I/O error: Success (0)