mirror of
https://github.com/FreeRDP/FreeRDP.git
synced 2025-06-03 00:00:20 +00:00
freerdp: make use of stream macros to access members
This commit is contained in:
parent
9229548cd7
commit
367ebf32a3
@ -125,7 +125,7 @@ void rail_send_pdu(rdpRailOrder* rail_order, wStream* s, UINT16 orderType)
|
|||||||
DEBUG_RAIL("Sending %s PDU, length:%d",
|
DEBUG_RAIL("Sending %s PDU, length:%d",
|
||||||
RAIL_ORDER_TYPE_STRINGS[((orderType & 0xF0) >> 3) + (orderType & 0x0F)], orderLength);
|
RAIL_ORDER_TYPE_STRINGS[((orderType & 0xF0) >> 3) + (orderType & 0x0F)], orderLength);
|
||||||
|
|
||||||
rail_send_channel_data(rail_order->plugin, s->buffer, orderLength);
|
rail_send_channel_data(rail_order->plugin, Stream_Buffer(s), orderLength);
|
||||||
}
|
}
|
||||||
|
|
||||||
void rail_write_high_contrast(wStream* s, HIGH_CONTRAST* high_contrast)
|
void rail_write_high_contrast(wStream* s, HIGH_CONTRAST* high_contrast)
|
||||||
|
@ -287,6 +287,7 @@ static BOOL rdp_client_establish_keys(rdpRdp* rdp)
|
|||||||
|
|
||||||
Stream_Write_UINT32(s, length);
|
Stream_Write_UINT32(s, length);
|
||||||
Stream_Write(s, crypt_client_random, length);
|
Stream_Write(s, crypt_client_random, length);
|
||||||
|
Stream_SealLength(s);
|
||||||
|
|
||||||
if (transport_write(rdp->mcs->transport, s) < 0)
|
if (transport_write(rdp->mcs->transport, s) < 0)
|
||||||
{
|
{
|
||||||
|
@ -331,7 +331,7 @@ static int fastpath_recv_update_data(rdpFastPath* fastpath, wStream* s)
|
|||||||
|
|
||||||
if (compressionFlags & PACKET_COMPRESSED)
|
if (compressionFlags & PACKET_COMPRESSED)
|
||||||
{
|
{
|
||||||
if (decompress_rdp(rdp->mppc_dec, s->pointer, size, compressionFlags, &roff, &rlen))
|
if (decompress_rdp(rdp->mppc_dec, Stream_Pointer(s), size, compressionFlags, &roff, &rlen))
|
||||||
{
|
{
|
||||||
size = rlen;
|
size = rlen;
|
||||||
buffer = rdp->mppc_dec->history_buf + roff;
|
buffer = rdp->mppc_dec->history_buf + roff;
|
||||||
@ -760,6 +760,7 @@ BOOL fastpath_send_multiple_input_pdu(rdpFastPath* fastpath, wStream* s, int iNu
|
|||||||
rdp->sec_flags = 0;
|
rdp->sec_flags = 0;
|
||||||
|
|
||||||
Stream_SetPosition(s, length);
|
Stream_SetPosition(s, length);
|
||||||
|
Stream_SealLength(s);
|
||||||
|
|
||||||
if (transport_write(fastpath->rdp->transport, s) < 0)
|
if (transport_write(fastpath->rdp->transport, s) < 0)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@ -846,7 +847,7 @@ BOOL fastpath_send_update_pdu(rdpFastPath* fastpath, BYTE updateCode, wStream* s
|
|||||||
|
|
||||||
if (try_comp)
|
if (try_comp)
|
||||||
{
|
{
|
||||||
if (compress_rdp(rdp->mppc_enc, ls->pointer + header_bytes, dlen))
|
if (compress_rdp(rdp->mppc_enc, Stream_Pointer(ls) + header_bytes, dlen))
|
||||||
{
|
{
|
||||||
if (rdp->mppc_enc->flags & PACKET_COMPRESSED)
|
if (rdp->mppc_enc->flags & PACKET_COMPRESSED)
|
||||||
{
|
{
|
||||||
@ -918,6 +919,8 @@ BOOL fastpath_send_update_pdu(rdpFastPath* fastpath, BYTE updateCode, wStream* s
|
|||||||
security_encrypt(ptr_to_crypt, bytes_to_crypt, rdp);
|
security_encrypt(ptr_to_crypt, bytes_to_crypt, rdp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Stream_SealLength(s);
|
||||||
|
|
||||||
if (transport_write(fastpath->rdp->transport, update) < 0)
|
if (transport_write(fastpath->rdp->transport, update) < 0)
|
||||||
{
|
{
|
||||||
result = FALSE;
|
result = FALSE;
|
||||||
|
@ -136,19 +136,19 @@ BOOL freerdp_connect(freerdp* instance)
|
|||||||
{
|
{
|
||||||
pcap_get_next_record_header(update->pcap_rfx, &record);
|
pcap_get_next_record_header(update->pcap_rfx, &record);
|
||||||
|
|
||||||
s->buffer = (BYTE*) realloc(s->buffer, record.length);
|
Stream_Buffer(s) = (BYTE*) realloc(Stream_Buffer(s), record.length);
|
||||||
record.data = s->buffer;
|
record.data = Stream_Buffer(s);
|
||||||
s->capacity = record.length;
|
Stream_Capacity(s) = record.length;
|
||||||
|
|
||||||
pcap_get_next_record_content(update->pcap_rfx, &record);
|
pcap_get_next_record_content(update->pcap_rfx, &record);
|
||||||
Stream_SetPosition(s, 0);
|
Stream_SetPosition(s, 0);
|
||||||
|
|
||||||
update->BeginPaint(update->context);
|
update->BeginPaint(update->context);
|
||||||
update_recv_surfcmds(update, s->capacity, s);
|
update_recv_surfcmds(update, Stream_Capacity(s), s);
|
||||||
update->EndPaint(update->context);
|
update->EndPaint(update->context);
|
||||||
}
|
}
|
||||||
|
|
||||||
free(s->buffer);
|
free(Stream_Buffer(s));
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -415,7 +415,7 @@ RPC_PDU* rpc_recv_dequeue_pdu(rdpRpc* rpc)
|
|||||||
if (pdu)
|
if (pdu)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "Receiving PDU (length: %d, CallId: %d)\n", pdu->s->length, pdu->CallId);
|
fprintf(stderr, "Receiving PDU (length: %d, CallId: %d)\n", pdu->s->length, pdu->CallId);
|
||||||
winpr_HexDump(pdu->s->buffer, pdu->s->length);
|
winpr_HexDump(Stream_Buffer(pdu->s), Stream_Length(pdu->s));
|
||||||
fprintf(stderr, "\n");
|
fprintf(stderr, "\n");
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -399,7 +399,7 @@ BOOL gcc_read_server_data_blocks(wStream* s, rdpSettings* settings, int length)
|
|||||||
|
|
||||||
while (offset < length)
|
while (offset < length)
|
||||||
{
|
{
|
||||||
holdp = s->pointer;
|
holdp = Stream_Pointer(s);
|
||||||
|
|
||||||
if (!gcc_read_user_data_header(s, &type, &blockLength))
|
if (!gcc_read_user_data_header(s, &type, &blockLength))
|
||||||
{
|
{
|
||||||
@ -438,7 +438,7 @@ BOOL gcc_read_server_data_blocks(wStream* s, rdpSettings* settings, int length)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
offset += blockLength;
|
offset += blockLength;
|
||||||
s->pointer = holdp + blockLength;
|
Stream_Pointer(s) = holdp + blockLength;
|
||||||
}
|
}
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
@ -203,10 +203,11 @@ BOOL license_send(rdpLicense* license, wStream* s, BYTE type)
|
|||||||
|
|
||||||
#ifdef WITH_DEBUG_LICENSE
|
#ifdef WITH_DEBUG_LICENSE
|
||||||
fprintf(stderr, "Sending %s Packet, length %d\n", LICENSE_MESSAGE_STRINGS[type & 0x1F], wMsgSize);
|
fprintf(stderr, "Sending %s Packet, length %d\n", LICENSE_MESSAGE_STRINGS[type & 0x1F], wMsgSize);
|
||||||
winpr_HexDump(s->pointer - 4, wMsgSize);
|
winpr_HexDump(Stream_Pointer(s) - 4, wMsgSize);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
Stream_SetPosition(s, length);
|
Stream_SetPosition(s, length);
|
||||||
|
Stream_SealLength(s);
|
||||||
|
|
||||||
if (transport_write(license->rdp->transport, s) < 0)
|
if (transport_write(license->rdp->transport, s) < 0)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
@ -479,6 +479,7 @@ BOOL mcs_send_connect_initial(rdpMcs* mcs)
|
|||||||
tpkt_write_header(s, length);
|
tpkt_write_header(s, length);
|
||||||
tpdu_write_data(s);
|
tpdu_write_data(s);
|
||||||
Stream_SetPointer(s, em);
|
Stream_SetPointer(s, em);
|
||||||
|
Stream_SealLength(s);
|
||||||
|
|
||||||
status = transport_write(mcs->transport, s);
|
status = transport_write(mcs->transport, s);
|
||||||
|
|
||||||
@ -558,6 +559,7 @@ BOOL mcs_send_connect_response(rdpMcs* mcs)
|
|||||||
tpkt_write_header(s, length);
|
tpkt_write_header(s, length);
|
||||||
tpdu_write_data(s);
|
tpdu_write_data(s);
|
||||||
Stream_SetPointer(s, em);
|
Stream_SetPointer(s, em);
|
||||||
|
Stream_SealLength(s);
|
||||||
|
|
||||||
ret = transport_write(mcs->transport, s);
|
ret = transport_write(mcs->transport, s);
|
||||||
|
|
||||||
@ -600,6 +602,8 @@ BOOL mcs_send_erect_domain_request(rdpMcs* mcs)
|
|||||||
per_write_integer(s, 0); /* subHeight (INTEGER) */
|
per_write_integer(s, 0); /* subHeight (INTEGER) */
|
||||||
per_write_integer(s, 0); /* subInterval (INTEGER) */
|
per_write_integer(s, 0); /* subInterval (INTEGER) */
|
||||||
|
|
||||||
|
Stream_SealLength(s);
|
||||||
|
|
||||||
if (transport_write(mcs->transport, s) < 0)
|
if (transport_write(mcs->transport, s) < 0)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
@ -636,6 +640,8 @@ BOOL mcs_send_attach_user_request(rdpMcs* mcs)
|
|||||||
|
|
||||||
mcs_write_domain_mcspdu_header(s, DomainMCSPDU_AttachUserRequest, length, 0);
|
mcs_write_domain_mcspdu_header(s, DomainMCSPDU_AttachUserRequest, length, 0);
|
||||||
|
|
||||||
|
Stream_SealLength(s);
|
||||||
|
|
||||||
if (transport_write(mcs->transport, s) < 0)
|
if (transport_write(mcs->transport, s) < 0)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
@ -680,6 +686,8 @@ BOOL mcs_send_attach_user_confirm(rdpMcs* mcs)
|
|||||||
mcs->user_id = MCS_GLOBAL_CHANNEL_ID + 1 + mcs->transport->settings->ChannelCount;
|
mcs->user_id = MCS_GLOBAL_CHANNEL_ID + 1 + mcs->transport->settings->ChannelCount;
|
||||||
per_write_integer16(s, mcs->user_id, MCS_BASE_CHANNEL_ID); /* initiator (UserId) */
|
per_write_integer16(s, mcs->user_id, MCS_BASE_CHANNEL_ID); /* initiator (UserId) */
|
||||||
|
|
||||||
|
Stream_SealLength(s);
|
||||||
|
|
||||||
transport_write(mcs->transport, s);
|
transport_write(mcs->transport, s);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
@ -724,6 +732,8 @@ BOOL mcs_send_channel_join_request(rdpMcs* mcs, UINT16 channel_id)
|
|||||||
per_write_integer16(s, mcs->user_id, MCS_BASE_CHANNEL_ID);
|
per_write_integer16(s, mcs->user_id, MCS_BASE_CHANNEL_ID);
|
||||||
per_write_integer16(s, channel_id, 0);
|
per_write_integer16(s, channel_id, 0);
|
||||||
|
|
||||||
|
Stream_SealLength(s);
|
||||||
|
|
||||||
if (transport_write(mcs->transport, s) < 0)
|
if (transport_write(mcs->transport, s) < 0)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
@ -776,6 +786,8 @@ BOOL mcs_send_channel_join_confirm(rdpMcs* mcs, UINT16 channel_id)
|
|||||||
per_write_integer16(s, channel_id, 0); /* requested (ChannelId) */
|
per_write_integer16(s, channel_id, 0); /* requested (ChannelId) */
|
||||||
per_write_integer16(s, channel_id, 0); /* channelId */
|
per_write_integer16(s, channel_id, 0); /* channelId */
|
||||||
|
|
||||||
|
Stream_SealLength(s);
|
||||||
|
|
||||||
transport_write(mcs->transport, s);
|
transport_write(mcs->transport, s);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
@ -154,7 +154,7 @@ static void update_message_SurfaceCommand(rdpContext* context, wStream* s)
|
|||||||
|
|
||||||
wParam = (wStream*) malloc(sizeof(wStream));
|
wParam = (wStream*) malloc(sizeof(wStream));
|
||||||
|
|
||||||
wParam->capacity = s->capacity;
|
wParam->capacity = Stream_Capacity(s);
|
||||||
wParam->buffer = (BYTE*) malloc(wParam->capacity);
|
wParam->buffer = (BYTE*) malloc(wParam->capacity);
|
||||||
wParam->pointer = wParam->buffer;
|
wParam->pointer = wParam->buffer;
|
||||||
|
|
||||||
@ -1005,8 +1005,7 @@ int update_message_process_update_class(rdpUpdateProxy* proxy, wMessage* msg, in
|
|||||||
IFCALL(proxy->SurfaceCommand, msg->context, (wStream*) msg->wParam);
|
IFCALL(proxy->SurfaceCommand, msg->context, (wStream*) msg->wParam);
|
||||||
{
|
{
|
||||||
wStream* s = (wStream*) msg->wParam;
|
wStream* s = (wStream*) msg->wParam;
|
||||||
free(s->buffer);
|
Stream_Free(s, TRUE);
|
||||||
free(s);
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -289,6 +289,8 @@ BOOL nego_send_preconnection_pdu(rdpNego* nego)
|
|||||||
free(wszPCB);
|
free(wszPCB);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Stream_SealLength(s);
|
||||||
|
|
||||||
if (transport_write(nego->transport, s) < 0)
|
if (transport_write(nego->transport, s) < 0)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
@ -688,6 +690,8 @@ BOOL nego_send_negotiation_request(rdpNego* nego)
|
|||||||
tpdu_write_connection_request(s, length - 5);
|
tpdu_write_connection_request(s, length - 5);
|
||||||
Stream_SetPointer(s, em);
|
Stream_SetPointer(s, em);
|
||||||
|
|
||||||
|
Stream_SealLength(s);
|
||||||
|
|
||||||
if (transport_write(nego->transport, s) < 0)
|
if (transport_write(nego->transport, s) < 0)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
@ -843,6 +847,8 @@ BOOL nego_send_negotiation_response(rdpNego* nego)
|
|||||||
tpdu_write_connection_confirm(s, length - 5);
|
tpdu_write_connection_confirm(s, length - 5);
|
||||||
Stream_SetPointer(s, em);
|
Stream_SetPointer(s, em);
|
||||||
|
|
||||||
|
Stream_SealLength(s);
|
||||||
|
|
||||||
if (transport_write(nego->transport, s) < 0)
|
if (transport_write(nego->transport, s) < 0)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
|
@ -817,7 +817,7 @@ void credssp_read_ts_password_creds(rdpCredssp* credssp, wStream* s)
|
|||||||
ber_read_octet_string_tag(s, &length);
|
ber_read_octet_string_tag(s, &length);
|
||||||
credssp->identity.DomainLength = (UINT32) length;
|
credssp->identity.DomainLength = (UINT32) length;
|
||||||
credssp->identity.Domain = (UINT16*) malloc(length);
|
credssp->identity.Domain = (UINT16*) malloc(length);
|
||||||
CopyMemory(credssp->identity.Domain, s->pointer, credssp->identity.DomainLength);
|
CopyMemory(credssp->identity.Domain, Stream_Pointer(s), credssp->identity.DomainLength);
|
||||||
Stream_Seek(s, credssp->identity.DomainLength);
|
Stream_Seek(s, credssp->identity.DomainLength);
|
||||||
credssp->identity.DomainLength /= 2;
|
credssp->identity.DomainLength /= 2;
|
||||||
|
|
||||||
@ -826,7 +826,7 @@ void credssp_read_ts_password_creds(rdpCredssp* credssp, wStream* s)
|
|||||||
ber_read_octet_string_tag(s, &length);
|
ber_read_octet_string_tag(s, &length);
|
||||||
credssp->identity.UserLength = (UINT32) length;
|
credssp->identity.UserLength = (UINT32) length;
|
||||||
credssp->identity.User = (UINT16*) malloc(length);
|
credssp->identity.User = (UINT16*) malloc(length);
|
||||||
CopyMemory(credssp->identity.User, s->pointer, credssp->identity.UserLength);
|
CopyMemory(credssp->identity.User, Stream_Pointer(s), credssp->identity.UserLength);
|
||||||
Stream_Seek(s, credssp->identity.UserLength);
|
Stream_Seek(s, credssp->identity.UserLength);
|
||||||
credssp->identity.UserLength /= 2;
|
credssp->identity.UserLength /= 2;
|
||||||
|
|
||||||
@ -835,7 +835,7 @@ void credssp_read_ts_password_creds(rdpCredssp* credssp, wStream* s)
|
|||||||
ber_read_octet_string_tag(s, &length);
|
ber_read_octet_string_tag(s, &length);
|
||||||
credssp->identity.PasswordLength = (UINT32) length;
|
credssp->identity.PasswordLength = (UINT32) length;
|
||||||
credssp->identity.Password = (UINT16*) malloc(length);
|
credssp->identity.Password = (UINT16*) malloc(length);
|
||||||
CopyMemory(credssp->identity.Password, s->pointer, credssp->identity.PasswordLength);
|
CopyMemory(credssp->identity.Password, Stream_Pointer(s), credssp->identity.PasswordLength);
|
||||||
Stream_Seek(s, credssp->identity.PasswordLength);
|
Stream_Seek(s, credssp->identity.PasswordLength);
|
||||||
credssp->identity.PasswordLength /= 2;
|
credssp->identity.PasswordLength /= 2;
|
||||||
|
|
||||||
@ -1125,7 +1125,10 @@ void credssp_send(rdpCredssp* credssp)
|
|||||||
ber_write_octet_string(s, credssp->pubKeyAuth.pvBuffer, credssp->pubKeyAuth.cbBuffer);
|
ber_write_octet_string(s, credssp->pubKeyAuth.pvBuffer, credssp->pubKeyAuth.cbBuffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Stream_SealLength(s);
|
||||||
|
|
||||||
transport_write(credssp->transport, s);
|
transport_write(credssp->transport, s);
|
||||||
|
|
||||||
Stream_Free(s, TRUE);
|
Stream_Free(s, TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1397,7 +1397,7 @@ BOOL update_read_glyph_index_order(wStream* s, ORDER_INFO* orderInfo, GLYPH_INDE
|
|||||||
if (Stream_GetRemainingLength(s) < glyph_index->cbData)
|
if (Stream_GetRemainingLength(s) < glyph_index->cbData)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
memcpy(glyph_index->data, s->pointer, glyph_index->cbData);
|
memcpy(glyph_index->data, Stream_Pointer(s), glyph_index->cbData);
|
||||||
Stream_Seek(s, glyph_index->cbData);
|
Stream_Seek(s, glyph_index->cbData);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1497,7 +1497,7 @@ BOOL update_read_fast_index_order(wStream* s, ORDER_INFO* orderInfo, FAST_INDEX_
|
|||||||
|
|
||||||
if (Stream_GetRemainingLength(s) < fast_index->cbData)
|
if (Stream_GetRemainingLength(s) < fast_index->cbData)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
memcpy(fast_index->data, s->pointer, fast_index->cbData);
|
memcpy(fast_index->data, Stream_Pointer(s), fast_index->cbData);
|
||||||
Stream_Seek(s, fast_index->cbData);
|
Stream_Seek(s, fast_index->cbData);
|
||||||
}
|
}
|
||||||
return TRUE;
|
return TRUE;
|
||||||
@ -1538,8 +1538,8 @@ BOOL update_read_fast_glyph_order(wStream* s, ORDER_INFO* orderInfo, FAST_GLYPH_
|
|||||||
if (Stream_GetRemainingLength(s) < fast_glyph->cbData)
|
if (Stream_GetRemainingLength(s) < fast_glyph->cbData)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
memcpy(fast_glyph->data, s->pointer, fast_glyph->cbData);
|
memcpy(fast_glyph->data, Stream_Pointer(s), fast_glyph->cbData);
|
||||||
phold = s->pointer;
|
phold = Stream_Pointer(s);
|
||||||
|
|
||||||
if (!Stream_SafeSeek(s, 1))
|
if (!Stream_SafeSeek(s, 1))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@ -1566,7 +1566,7 @@ BOOL update_read_fast_glyph_order(wStream* s, ORDER_INFO* orderInfo, FAST_GLYPH_
|
|||||||
Stream_Read(s, glyph->aj, glyph->cb);
|
Stream_Read(s, glyph->aj, glyph->cb);
|
||||||
}
|
}
|
||||||
|
|
||||||
s->pointer = phold + fast_glyph->cbData;
|
Stream_Pointer(s) = phold + fast_glyph->cbData;
|
||||||
}
|
}
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
@ -2200,7 +2200,7 @@ BOOL update_decompress_brush(wStream* s, BYTE* output, BYTE bpp)
|
|||||||
BYTE* palette;
|
BYTE* palette;
|
||||||
int bytesPerPixel;
|
int bytesPerPixel;
|
||||||
|
|
||||||
palette = s->pointer + 16;
|
palette = Stream_Pointer(s) + 16;
|
||||||
bytesPerPixel = ((bpp + 1) / 8);
|
bytesPerPixel = ((bpp + 1) / 8);
|
||||||
|
|
||||||
if (Stream_GetRemainingLength(s) < 16) // 64 / 4
|
if (Stream_GetRemainingLength(s) < 16) // 64 / 4
|
||||||
@ -3044,7 +3044,7 @@ BOOL update_recv_secondary_order(rdpUpdate* update, wStream* s, BYTE flags)
|
|||||||
Stream_Read_UINT16(s, extraFlags); /* extraFlags (2 bytes) */
|
Stream_Read_UINT16(s, extraFlags); /* extraFlags (2 bytes) */
|
||||||
Stream_Read_UINT8(s, orderType); /* orderType (1 byte) */
|
Stream_Read_UINT8(s, orderType); /* orderType (1 byte) */
|
||||||
|
|
||||||
next = s->pointer + ((INT16) orderLength) + 7;
|
next = Stream_Pointer(s) + ((INT16) orderLength) + 7;
|
||||||
|
|
||||||
#ifdef WITH_DEBUG_ORDERS
|
#ifdef WITH_DEBUG_ORDERS
|
||||||
if (orderType < SECONDARY_DRAWING_ORDER_COUNT)
|
if (orderType < SECONDARY_DRAWING_ORDER_COUNT)
|
||||||
@ -3116,7 +3116,8 @@ BOOL update_recv_secondary_order(rdpUpdate* update, wStream* s, BYTE flags)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
s->pointer = next;
|
Stream_Pointer(s) = next;
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -332,9 +332,9 @@ static UINT32 rdp_security_stream_out(rdpRdp* rdp, wStream* s, int length)
|
|||||||
{
|
{
|
||||||
if (rdp->settings->EncryptionMethods == ENCRYPTION_METHOD_FIPS)
|
if (rdp->settings->EncryptionMethods == ENCRYPTION_METHOD_FIPS)
|
||||||
{
|
{
|
||||||
data = s->pointer + 12;
|
data = Stream_Pointer(s) + 12;
|
||||||
|
|
||||||
length = length - (data - s->buffer);
|
length = length - (data - Stream_Buffer(s));
|
||||||
Stream_Write_UINT16(s, 0x10); /* length */
|
Stream_Write_UINT16(s, 0x10); /* length */
|
||||||
Stream_Write_UINT8(s, 0x1); /* TSFIPS_VERSION 1*/
|
Stream_Write_UINT8(s, 0x1); /* TSFIPS_VERSION 1*/
|
||||||
|
|
||||||
@ -348,20 +348,22 @@ static UINT32 rdp_security_stream_out(rdpRdp* rdp, wStream* s, int length)
|
|||||||
|
|
||||||
Stream_Write_UINT8(s, pad);
|
Stream_Write_UINT8(s, pad);
|
||||||
|
|
||||||
security_hmac_signature(data, length, s->pointer, rdp);
|
security_hmac_signature(data, length, Stream_Pointer(s), rdp);
|
||||||
Stream_Seek(s, 8);
|
Stream_Seek(s, 8);
|
||||||
security_fips_encrypt(data, length + pad, rdp);
|
security_fips_encrypt(data, length + pad, rdp);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
data = s->pointer + 8;
|
data = Stream_Pointer(s) + 8;
|
||||||
length = length - (data - s->buffer);
|
length = length - (data - Stream_Buffer(s));
|
||||||
|
|
||||||
if (sec_flags & SEC_SECURE_CHECKSUM)
|
if (sec_flags & SEC_SECURE_CHECKSUM)
|
||||||
security_salted_mac_signature(rdp, data, length, TRUE, s->pointer);
|
security_salted_mac_signature(rdp, data, length, TRUE, Stream_Pointer(s));
|
||||||
else
|
else
|
||||||
security_mac_signature(rdp, data, length, s->pointer);
|
security_mac_signature(rdp, data, length, Stream_Pointer(s));
|
||||||
|
|
||||||
Stream_Seek(s, 8);
|
Stream_Seek(s, 8);
|
||||||
security_encrypt(s->pointer, length, rdp);
|
security_encrypt(Stream_Pointer(s), length, rdp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -413,13 +415,14 @@ BOOL rdp_send(rdpRdp* rdp, wStream* s, UINT16 channel_id)
|
|||||||
rdp_write_header(rdp, s, length, channel_id);
|
rdp_write_header(rdp, s, length, channel_id);
|
||||||
|
|
||||||
sec_bytes = rdp_get_sec_bytes(rdp);
|
sec_bytes = rdp_get_sec_bytes(rdp);
|
||||||
sec_hold = s->pointer;
|
sec_hold = Stream_Pointer(s);
|
||||||
Stream_Seek(s, sec_bytes);
|
Stream_Seek(s, sec_bytes);
|
||||||
|
|
||||||
s->pointer = sec_hold;
|
Stream_Pointer(s) = sec_hold;
|
||||||
length += rdp_security_stream_out(rdp, s, length);
|
length += rdp_security_stream_out(rdp, s, length);
|
||||||
|
|
||||||
Stream_SetPosition(s, length);
|
Stream_SetPosition(s, length);
|
||||||
|
Stream_SealLength(s);
|
||||||
|
|
||||||
if (transport_write(rdp->transport, s) < 0)
|
if (transport_write(rdp->transport, s) < 0)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@ -439,15 +442,17 @@ BOOL rdp_send_pdu(rdpRdp* rdp, wStream* s, UINT16 type, UINT16 channel_id)
|
|||||||
rdp_write_header(rdp, s, length, MCS_GLOBAL_CHANNEL_ID);
|
rdp_write_header(rdp, s, length, MCS_GLOBAL_CHANNEL_ID);
|
||||||
|
|
||||||
sec_bytes = rdp_get_sec_bytes(rdp);
|
sec_bytes = rdp_get_sec_bytes(rdp);
|
||||||
sec_hold = s->pointer;
|
sec_hold = Stream_Pointer(s);
|
||||||
Stream_Seek(s, sec_bytes);
|
Stream_Seek(s, sec_bytes);
|
||||||
|
|
||||||
rdp_write_share_control_header(s, length - sec_bytes, type, channel_id);
|
rdp_write_share_control_header(s, length - sec_bytes, type, channel_id);
|
||||||
|
|
||||||
s->pointer = sec_hold;
|
Stream_Pointer(s) = sec_hold;
|
||||||
length += rdp_security_stream_out(rdp, s, length);
|
length += rdp_security_stream_out(rdp, s, length);
|
||||||
|
|
||||||
Stream_SetPosition(s, length);
|
Stream_SetPosition(s, length);
|
||||||
|
Stream_SealLength(s);
|
||||||
|
|
||||||
if (transport_write(rdp->transport, s) < 0)
|
if (transport_write(rdp->transport, s) < 0)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
@ -466,16 +471,18 @@ BOOL rdp_send_data_pdu(rdpRdp* rdp, wStream* s, BYTE type, UINT16 channel_id)
|
|||||||
rdp_write_header(rdp, s, length, MCS_GLOBAL_CHANNEL_ID);
|
rdp_write_header(rdp, s, length, MCS_GLOBAL_CHANNEL_ID);
|
||||||
|
|
||||||
sec_bytes = rdp_get_sec_bytes(rdp);
|
sec_bytes = rdp_get_sec_bytes(rdp);
|
||||||
sec_hold = s->pointer;
|
sec_hold = Stream_Pointer(s);
|
||||||
Stream_Seek(s, sec_bytes);
|
Stream_Seek(s, sec_bytes);
|
||||||
|
|
||||||
rdp_write_share_control_header(s, length - sec_bytes, PDU_TYPE_DATA, channel_id);
|
rdp_write_share_control_header(s, length - sec_bytes, PDU_TYPE_DATA, channel_id);
|
||||||
rdp_write_share_data_header(s, length - sec_bytes, type, rdp->settings->ShareId);
|
rdp_write_share_data_header(s, length - sec_bytes, type, rdp->settings->ShareId);
|
||||||
|
|
||||||
s->pointer = sec_hold;
|
Stream_Pointer(s) = sec_hold;
|
||||||
length += rdp_security_stream_out(rdp, s, length);
|
length += rdp_security_stream_out(rdp, s, length);
|
||||||
|
|
||||||
Stream_SetPosition(s, length);
|
Stream_SetPosition(s, length);
|
||||||
|
Stream_SealLength(s);
|
||||||
|
|
||||||
if (transport_write(rdp->transport, s) < 0)
|
if (transport_write(rdp->transport, s) < 0)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
@ -526,7 +533,7 @@ int rdp_recv_data_pdu(rdpRdp* rdp, wStream* s)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (decompress_rdp(rdp->mppc_dec, s->pointer, compressed_len - 18, compressed_type, &roff, &rlen))
|
if (decompress_rdp(rdp->mppc_dec, Stream_Pointer(s), compressed_len - 18, compressed_type, &roff, &rlen))
|
||||||
{
|
{
|
||||||
buffer = rdp->mppc_dec->history_buf + roff;
|
buffer = rdp->mppc_dec->history_buf + roff;
|
||||||
cs = StreamPool_Take(rdp->transport->ReceivePool, rlen);
|
cs = StreamPool_Take(rdp->transport->ReceivePool, rlen);
|
||||||
@ -699,25 +706,25 @@ BOOL rdp_decrypt(rdpRdp* rdp, wStream* s, int length, UINT16 securityFlags)
|
|||||||
Stream_Read_UINT8(s, version); /* 0x1 */
|
Stream_Read_UINT8(s, version); /* 0x1 */
|
||||||
Stream_Read_UINT8(s, pad);
|
Stream_Read_UINT8(s, pad);
|
||||||
|
|
||||||
sig = s->pointer;
|
sig = Stream_Pointer(s);
|
||||||
Stream_Seek(s, 8); /* signature */
|
Stream_Seek(s, 8); /* signature */
|
||||||
|
|
||||||
length -= 12;
|
length -= 12;
|
||||||
|
|
||||||
if (!security_fips_decrypt(s->pointer, length, rdp))
|
if (!security_fips_decrypt(Stream_Pointer(s), length, rdp))
|
||||||
{
|
{
|
||||||
fprintf(stderr, "FATAL: cannot decrypt\n");
|
fprintf(stderr, "FATAL: cannot decrypt\n");
|
||||||
return FALSE; /* TODO */
|
return FALSE; /* TODO */
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!security_fips_check_signature(s->pointer, length - pad, sig, rdp))
|
if (!security_fips_check_signature(Stream_Pointer(s), length - pad, sig, rdp))
|
||||||
{
|
{
|
||||||
fprintf(stderr, "FATAL: invalid packet signature\n");
|
fprintf(stderr, "FATAL: invalid packet signature\n");
|
||||||
return FALSE; /* TODO */
|
return FALSE; /* TODO */
|
||||||
}
|
}
|
||||||
|
|
||||||
/* is this what needs adjusting? */
|
/* is this what needs adjusting? */
|
||||||
s->capacity -= pad;
|
Stream_Capacity(s) -= pad;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -726,13 +733,14 @@ BOOL rdp_decrypt(rdpRdp* rdp, wStream* s, int length, UINT16 securityFlags)
|
|||||||
|
|
||||||
Stream_Read(s, wmac, sizeof(wmac));
|
Stream_Read(s, wmac, sizeof(wmac));
|
||||||
length -= sizeof(wmac);
|
length -= sizeof(wmac);
|
||||||
if (!security_decrypt(s->pointer, length, rdp))
|
|
||||||
|
if (!security_decrypt(Stream_Pointer(s), length, rdp))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
if (securityFlags & SEC_SECURE_CHECKSUM)
|
if (securityFlags & SEC_SECURE_CHECKSUM)
|
||||||
security_salted_mac_signature(rdp, s->pointer, length, FALSE, cmac);
|
security_salted_mac_signature(rdp, Stream_Pointer(s), length, FALSE, cmac);
|
||||||
else
|
else
|
||||||
security_mac_signature(rdp, s->pointer, length, cmac);
|
security_mac_signature(rdp, Stream_Pointer(s), length, cmac);
|
||||||
|
|
||||||
if (memcmp(wmac, cmac, sizeof(wmac)) != 0)
|
if (memcmp(wmac, cmac, sizeof(wmac)) != 0)
|
||||||
{
|
{
|
||||||
@ -792,7 +800,7 @@ static int rdp_recv_tpkt_pdu(rdpRdp* rdp, wStream* s)
|
|||||||
* [MS-RDPBCGR] 2.2.13.2.1
|
* [MS-RDPBCGR] 2.2.13.2.1
|
||||||
* - no share control header, nor the 2 byte pad
|
* - no share control header, nor the 2 byte pad
|
||||||
*/
|
*/
|
||||||
s->pointer -= 2;
|
Stream_Rewind(s, 2);
|
||||||
rdp_recv_enhanced_security_redirection_packet(rdp, s);
|
rdp_recv_enhanced_security_redirection_packet(rdp, s);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -406,29 +406,29 @@ int transport_read_layer(rdpTransport* transport, UINT8* data, int bytes)
|
|||||||
int transport_read(rdpTransport* transport, wStream* s)
|
int transport_read(rdpTransport* transport, wStream* s)
|
||||||
{
|
{
|
||||||
int status;
|
int status;
|
||||||
int pdu_bytes;
|
int pduLength;
|
||||||
int stream_bytes;
|
int streamPosition;
|
||||||
int transport_status;
|
int transport_status;
|
||||||
|
|
||||||
pdu_bytes = 0;
|
pduLength = 0;
|
||||||
transport_status = 0;
|
transport_status = 0;
|
||||||
|
|
||||||
/* first check if we have header */
|
/* first check if we have header */
|
||||||
stream_bytes = Stream_GetPosition(s);
|
streamPosition = Stream_GetPosition(s);
|
||||||
|
|
||||||
if (stream_bytes < 4)
|
if (streamPosition < 4)
|
||||||
{
|
{
|
||||||
status = transport_read_layer(transport, s->buffer + stream_bytes, 4 - stream_bytes);
|
status = transport_read_layer(transport, Stream_Buffer(s) + streamPosition, 4 - streamPosition);
|
||||||
|
|
||||||
if (status < 0)
|
if (status < 0)
|
||||||
return status;
|
return status;
|
||||||
|
|
||||||
transport_status += status;
|
transport_status += status;
|
||||||
|
|
||||||
if ((status + stream_bytes) < 4)
|
if ((status + streamPosition) < 4)
|
||||||
return transport_status;
|
return transport_status;
|
||||||
|
|
||||||
stream_bytes += status;
|
streamPosition += status;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* if header is present, read in exactly one PDU */
|
/* if header is present, read in exactly one PDU */
|
||||||
@ -436,7 +436,7 @@ int transport_read(rdpTransport* transport, wStream* s)
|
|||||||
{
|
{
|
||||||
/* TPKT header */
|
/* TPKT header */
|
||||||
|
|
||||||
pdu_bytes = (s->buffer[2] << 8) | s->buffer[3];
|
pduLength = (s->buffer[2] << 8) | s->buffer[3];
|
||||||
}
|
}
|
||||||
else if (s->buffer[0] == 0x30)
|
else if (s->buffer[0] == 0x30)
|
||||||
{
|
{
|
||||||
@ -446,13 +446,13 @@ int transport_read(rdpTransport* transport, wStream* s)
|
|||||||
{
|
{
|
||||||
if ((s->buffer[1] & ~(0x80)) == 1)
|
if ((s->buffer[1] & ~(0x80)) == 1)
|
||||||
{
|
{
|
||||||
pdu_bytes = s->buffer[2];
|
pduLength = s->buffer[2];
|
||||||
pdu_bytes += 3;
|
pduLength += 3;
|
||||||
}
|
}
|
||||||
else if ((s->buffer[1] & ~(0x80)) == 2)
|
else if ((s->buffer[1] & ~(0x80)) == 2)
|
||||||
{
|
{
|
||||||
pdu_bytes = (s->buffer[2] << 8) | s->buffer[3];
|
pduLength = (s->buffer[2] << 8) | s->buffer[3];
|
||||||
pdu_bytes += 4;
|
pduLength += 4;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -461,8 +461,8 @@ int transport_read(rdpTransport* transport, wStream* s)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
pdu_bytes = s->buffer[1];
|
pduLength = s->buffer[1];
|
||||||
pdu_bytes += 2;
|
pduLength += 2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -470,12 +470,12 @@ int transport_read(rdpTransport* transport, wStream* s)
|
|||||||
/* Fast-Path Header */
|
/* Fast-Path Header */
|
||||||
|
|
||||||
if (s->buffer[1] & 0x80)
|
if (s->buffer[1] & 0x80)
|
||||||
pdu_bytes = ((s->buffer[1] & 0x7f) << 8) | s->buffer[2];
|
pduLength = ((s->buffer[1] & 0x7F) << 8) | s->buffer[2];
|
||||||
else
|
else
|
||||||
pdu_bytes = s->buffer[1];
|
pduLength = s->buffer[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
status = transport_read_layer(transport, s->buffer + stream_bytes, pdu_bytes - stream_bytes);
|
status = transport_read_layer(transport, Stream_Buffer(s) + streamPosition, pduLength - streamPosition);
|
||||||
|
|
||||||
if (status < 0)
|
if (status < 0)
|
||||||
return status;
|
return status;
|
||||||
@ -484,10 +484,10 @@ int transport_read(rdpTransport* transport, wStream* s)
|
|||||||
|
|
||||||
#ifdef WITH_DEBUG_TRANSPORT
|
#ifdef WITH_DEBUG_TRANSPORT
|
||||||
/* dump when whole PDU is read */
|
/* dump when whole PDU is read */
|
||||||
if (stream_bytes + status >= pdu_bytes)
|
if (streamPosition + status >= pduLength)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "Local < Remote\n");
|
fprintf(stderr, "Local < Remote\n");
|
||||||
winpr_HexDump(s->buffer, pdu_bytes);
|
winpr_HexDump(Stream_Buffer(s), pduLength);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -511,8 +511,8 @@ static int transport_read_nonblocking(rdpTransport* transport)
|
|||||||
|
|
||||||
int transport_write(rdpTransport* transport, wStream* s)
|
int transport_write(rdpTransport* transport, wStream* s)
|
||||||
{
|
{
|
||||||
int status = -1;
|
|
||||||
int length;
|
int length;
|
||||||
|
int status = -1;
|
||||||
|
|
||||||
length = Stream_GetPosition(s);
|
length = Stream_GetPosition(s);
|
||||||
Stream_SetPosition(s, 0);
|
Stream_SetPosition(s, 0);
|
||||||
@ -521,7 +521,7 @@ int transport_write(rdpTransport* transport, wStream* s)
|
|||||||
if (length > 0)
|
if (length > 0)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "Local > Remote\n");
|
fprintf(stderr, "Local > Remote\n");
|
||||||
winpr_HexDump(s->buffer, length);
|
winpr_HexDump(Stream_Buffer(s), length);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -734,14 +734,6 @@ int transport_check_fds(rdpTransport** ptransport)
|
|||||||
Stream_SealLength(received);
|
Stream_SealLength(received);
|
||||||
Stream_SetPosition(received, 0);
|
Stream_SetPosition(received, 0);
|
||||||
|
|
||||||
/**
|
|
||||||
* ReceiveCallback return values:
|
|
||||||
*
|
|
||||||
* -1: synchronous failure
|
|
||||||
* 0: synchronous success
|
|
||||||
* 1: asynchronous return
|
|
||||||
*/
|
|
||||||
|
|
||||||
recv_status = transport->ReceiveCallback(transport, received, transport->ReceiveExtra);
|
recv_status = transport->ReceiveCallback(transport, received, transport->ReceiveExtra);
|
||||||
|
|
||||||
Stream_Release(received);
|
Stream_Release(received);
|
||||||
|
@ -402,7 +402,7 @@ BOOL per_read_octet_string(wStream* s, BYTE* oct_str, int length, int min)
|
|||||||
if (Stream_GetRemainingLength(s) < length)
|
if (Stream_GetRemainingLength(s) < length)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
a_oct_str = s->pointer;
|
a_oct_str = Stream_Pointer(s);
|
||||||
Stream_Seek(s, length);
|
Stream_Seek(s, length);
|
||||||
|
|
||||||
for (i = 0; i < length; i++)
|
for (i = 0; i < length; i++)
|
||||||
|
@ -376,12 +376,12 @@ void tf_peer_dump_rfx(freerdp_peer* client)
|
|||||||
{
|
{
|
||||||
pcap_get_next_record_header(pcap_rfx, &record);
|
pcap_get_next_record_header(pcap_rfx, &record);
|
||||||
|
|
||||||
s->buffer = realloc(s->buffer, record.length);
|
Stream_Buffer(s) = realloc(Stream_Buffer(s), record.length);
|
||||||
record.data = s->buffer;
|
record.data = Stream_Buffer(s);
|
||||||
s->capacity = record.length;
|
Stream_Capacity(s) = record.length;
|
||||||
|
|
||||||
pcap_get_next_record_content(pcap_rfx, &record);
|
pcap_get_next_record_content(pcap_rfx, &record);
|
||||||
s->pointer = s->buffer + s->capacity;
|
Stream_Pointer(s) = Stream_Buffer(s) + Stream_Capacity(s);
|
||||||
|
|
||||||
if (test_dump_rfx_realtime && test_sleep_tsdiff(&prev_seconds, &prev_useconds, record.header.ts_sec, record.header.ts_usec) == FALSE)
|
if (test_dump_rfx_realtime && test_sleep_tsdiff(&prev_seconds, &prev_useconds, record.header.ts_sec, record.header.ts_usec) == FALSE)
|
||||||
break;
|
break;
|
||||||
|
@ -326,7 +326,7 @@ SECURITY_STATUS ntlm_write_NegotiateMessage(NTLM_CONTEXT* context, PSecBuffer bu
|
|||||||
|
|
||||||
#ifdef WITH_DEBUG_NTLM
|
#ifdef WITH_DEBUG_NTLM
|
||||||
fprintf(stderr, "NEGOTIATE_MESSAGE (length = %d)\n", length);
|
fprintf(stderr, "NEGOTIATE_MESSAGE (length = %d)\n", length);
|
||||||
winpr_HexDump(s->buffer, length);
|
winpr_HexDump(Stream_Buffer(s), length);
|
||||||
fprintf(stderr, "\n");
|
fprintf(stderr, "\n");
|
||||||
|
|
||||||
if (message->NegotiateFlags & NTLMSSP_NEGOTIATE_VERSION)
|
if (message->NegotiateFlags & NTLMSSP_NEGOTIATE_VERSION)
|
||||||
@ -610,7 +610,7 @@ SECURITY_STATUS ntlm_write_ChallengeMessage(NTLM_CONTEXT* context, PSecBuffer bu
|
|||||||
buffer->cbBuffer = length;
|
buffer->cbBuffer = length;
|
||||||
|
|
||||||
sspi_SecBufferAlloc(&context->ChallengeMessage, length);
|
sspi_SecBufferAlloc(&context->ChallengeMessage, length);
|
||||||
CopyMemory(context->ChallengeMessage.pvBuffer, s->buffer, length);
|
CopyMemory(context->ChallengeMessage.pvBuffer, Stream_Buffer(s), length);
|
||||||
|
|
||||||
#ifdef WITH_DEBUG_NTLM
|
#ifdef WITH_DEBUG_NTLM
|
||||||
fprintf(stderr, "CHALLENGE_MESSAGE (length = %d)\n", length);
|
fprintf(stderr, "CHALLENGE_MESSAGE (length = %d)\n", length);
|
||||||
@ -720,7 +720,7 @@ SECURITY_STATUS ntlm_read_AuthenticateMessage(NTLM_CONTEXT* context, PSecBuffer
|
|||||||
|
|
||||||
length = Stream_GetPosition(s);
|
length = Stream_GetPosition(s);
|
||||||
sspi_SecBufferAlloc(&context->AuthenticateMessage, length);
|
sspi_SecBufferAlloc(&context->AuthenticateMessage, length);
|
||||||
CopyMemory(context->AuthenticateMessage.pvBuffer, s->buffer, length);
|
CopyMemory(context->AuthenticateMessage.pvBuffer, Stream_Buffer(s), length);
|
||||||
buffer->cbBuffer = length;
|
buffer->cbBuffer = length;
|
||||||
|
|
||||||
Stream_SetPosition(s, PayloadBufferOffset);
|
Stream_SetPosition(s, PayloadBufferOffset);
|
||||||
@ -1016,7 +1016,7 @@ SECURITY_STATUS ntlm_write_AuthenticateMessage(NTLM_CONTEXT* context, PSecBuffer
|
|||||||
|
|
||||||
length = Stream_GetPosition(s);
|
length = Stream_GetPosition(s);
|
||||||
sspi_SecBufferAlloc(&context->AuthenticateMessage, length);
|
sspi_SecBufferAlloc(&context->AuthenticateMessage, length);
|
||||||
CopyMemory(context->AuthenticateMessage.pvBuffer, s->buffer, length);
|
CopyMemory(context->AuthenticateMessage.pvBuffer, Stream_Buffer(s), length);
|
||||||
buffer->cbBuffer = length;
|
buffer->cbBuffer = length;
|
||||||
|
|
||||||
if (context->UseMIC)
|
if (context->UseMIC)
|
||||||
@ -1031,7 +1031,7 @@ SECURITY_STATUS ntlm_write_AuthenticateMessage(NTLM_CONTEXT* context, PSecBuffer
|
|||||||
|
|
||||||
#ifdef WITH_DEBUG_NTLM
|
#ifdef WITH_DEBUG_NTLM
|
||||||
fprintf(stderr, "AUTHENTICATE_MESSAGE (length = %d)\n", length);
|
fprintf(stderr, "AUTHENTICATE_MESSAGE (length = %d)\n", length);
|
||||||
winpr_HexDump(s->buffer, length);
|
winpr_HexDump(Stream_Buffer(s), length);
|
||||||
fprintf(stderr, "\n");
|
fprintf(stderr, "\n");
|
||||||
|
|
||||||
ntlm_print_negotiate_flags(message->NegotiateFlags);
|
ntlm_print_negotiate_flags(message->NegotiateFlags);
|
||||||
|
@ -127,7 +127,7 @@ wStream* StreamPool_Take(wStreamPool* pool, size_t size)
|
|||||||
{
|
{
|
||||||
s = pool->aArray[index];
|
s = pool->aArray[index];
|
||||||
|
|
||||||
if (s->capacity >= size)
|
if (Stream_Capacity(s) >= size)
|
||||||
{
|
{
|
||||||
foundIndex = index;
|
foundIndex = index;
|
||||||
found = TRUE;
|
found = TRUE;
|
||||||
@ -247,7 +247,7 @@ wStream* StreamPool_Find(wStreamPool* pool, BYTE* ptr)
|
|||||||
{
|
{
|
||||||
s = pool->uArray[index];
|
s = pool->uArray[index];
|
||||||
|
|
||||||
if ((ptr >= s->buffer) && (ptr < (s->buffer + s->capacity)))
|
if ((ptr >= Stream_Buffer(s)) && (ptr < (Stream_Buffer(s) + Stream_Capacity(s))))
|
||||||
{
|
{
|
||||||
found = TRUE;
|
found = TRUE;
|
||||||
break;
|
break;
|
||||||
|
Loading…
Reference in New Issue
Block a user