Merge branch 'master' of github.com:FreeRDP/FreeRDP

This commit is contained in:
Marc-André Moreau 2012-12-07 22:27:22 -05:00
commit db01d942a5
2 changed files with 76 additions and 45 deletions

View File

@ -336,32 +336,30 @@ void* freerdp_channels_load_static_addin_entry(LPCSTR pszName, LPSTR pszSubsyste
for (i = 0; CLIENT_STATIC_ADDIN_TABLE[i].name != NULL; i++)
{
if (pszSubsystem != NULL)
if (strcmp(CLIENT_STATIC_ADDIN_TABLE[i].name, pszName) == 0)
{
subsystems = (STATIC_SUBSYSTEM_ENTRY*) CLIENT_STATIC_ADDIN_TABLE[i].table;
for (j = 0; subsystems[j].name != NULL; j++)
if (pszSubsystem != NULL)
{
if (strcmp(subsystems[j].name, pszSubsystem) == 0)
subsystems = (STATIC_SUBSYSTEM_ENTRY*) CLIENT_STATIC_ADDIN_TABLE[i].table;
for (j = 0; subsystems[j].name != NULL; j++)
{
if (pszType)
if (strcmp(subsystems[j].name, pszSubsystem) == 0)
{
if (strcmp(subsystems[j].type, pszType) == 0)
if (pszType)
{
if (strcmp(subsystems[j].type, pszType) == 0)
return (void*) subsystems[j].entry;
}
else
{
return (void*) subsystems[j].entry;
}
else
{
return (void*) subsystems[j].entry;
}
}
}
}
}
else
{
if (strcmp(CLIENT_STATIC_ADDIN_TABLE[i].name, pszName) == 0)
{
else
return (void*) CLIENT_STATIC_ADDIN_TABLE[i].entry;
}
}
}
@ -1327,3 +1325,7 @@ void freerdp_channels_close(rdpChannels* channels, freerdp* instance)
}
}
/* Local variables: */
/* c-basic-offset: 8 */
/* c-file-style: "linux" */
/* End: */

View File

@ -269,44 +269,73 @@ BOOL transport_accept_nla(rdpTransport* transport)
return TRUE;
}
int transport_read(rdpTransport* transport, STREAM* s)
static int tr(rdpTransport* transport, UINT8* data, int bytes)
{
int status = -1;
while (TRUE)
{
if (transport->layer == TRANSPORT_LAYER_TLS)
status = tls_read(transport->TlsIn, stream_get_tail(s), stream_get_left(s));
else if (transport->layer == TRANSPORT_LAYER_TCP)
status = tcp_read(transport->TcpIn, stream_get_tail(s), stream_get_left(s));
else if (transport->layer == TRANSPORT_LAYER_TSG)
status = tsg_read(transport->tsg, stream_get_tail(s), stream_get_left(s));
if ((status == 0) && (transport->blocking))
{
freerdp_usleep(transport->usleep_interval);
continue;
}
break;
}
#ifdef WITH_DEBUG_TRANSPORT
if (status > 0)
{
printf("Local < Remote\n");
freerdp_hexdump(s->data, status);
}
#endif
if (transport->layer == TRANSPORT_LAYER_TLS)
status = tls_read(transport->TlsIn, data, bytes);
else if (transport->layer == TRANSPORT_LAYER_TCP)
status = tcp_read(transport->TcpIn, data, bytes);
else if (transport->layer == TRANSPORT_LAYER_TSG)
status = tsg_read(transport->tsg, data, bytes);
return status;
}
int transport_read(rdpTransport* transport, STREAM* s)
{
int status;
int pdu_bytes;
int s_bytes;
int rv;
rv = 0;
/* first check if we have header */
s_bytes = stream_get_length(s);
if (s_bytes < 4)
{
status = tr(transport, s->data + s_bytes, 4 - s_bytes);
if (status < 0)
{
return status;
}
rv += status;
if (status + s_bytes < 4)
{
return rv;
}
s_bytes += status;
}
/* if header is present, read in exactly one PDU */
if (s->data[0] == 0x03)
{
pdu_bytes = (s->data[2] << 8) | s->data[3];
}
else
{
if (s->data[1] & 0x80)
{
pdu_bytes = ((s->data[1] & 0x7f) << 8) | s->data[2];
}
else
{
pdu_bytes = s->data[1];
}
}
status = tr(transport, s->data + s_bytes, pdu_bytes - s_bytes);
if (status < 0)
{
return status;
}
rv += status;
return rv;
}
static int transport_read_nonblocking(rdpTransport* transport)
{
int status;
stream_check_size(transport->recv_buffer, 4096);
stream_check_size(transport->recv_buffer, 32 * 1024);
status = transport_read(transport, transport->recv_buffer);
if (status <= 0)