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

# By Bernhard Miklautz (4) and others
# Via Marc-André Moreau
* 'master' of git://github.com/awakecoding/FreeRDP:
  libfreerdp-core: fix unused variable
  libfreerdp-codec: add bitmap encoder
  cmdline: unix/windows return detected error
  client/common: fixed command line parsing issue
  channels/serial: bring it back to life
  nla: invalidate sec handle after creation
  tls: updated certificate mismatch message
This commit is contained in:
Benoît LeBlanc 2013-07-05 16:35:08 -04:00
commit d72452b4f5
11 changed files with 1619 additions and 56 deletions

View File

@ -67,7 +67,6 @@ struct _SERIAL_DEVICE
wQueue* queue;
LIST* pending_irps;
HANDLE in_event;
fd_set read_fds;
fd_set write_fds;
@ -330,7 +329,9 @@ static void* serial_thread_func(void* arg)
if (WaitForSingleObject(serial->stopEvent, 0) == WAIT_OBJECT_0)
break;
if (WaitForSingleObject(Queue_Event(serial->queue), 10) == WAIT_OBJECT_0)
status = WaitForSingleObject(Queue_Event(serial->queue), 10);
if ((status != WAIT_OBJECT_0) && (status != WAIT_TIMEOUT))
break;
serial->nfds = 1;
@ -341,18 +342,13 @@ static void* serial_thread_func(void* arg)
serial->tv.tv_usec = 0;
serial->select_timeout = 0;
irp = (IRP*) Queue_Dequeue(serial->queue);
if (irp)
serial_process_irp(serial, irp);
status = WaitForSingleObject(serial->in_event, 0);
if ((status == WAIT_OBJECT_0) || (status == WAIT_TIMEOUT))
if (status == WAIT_OBJECT_0)
{
if (serial_check_fds(serial))
ResetEvent(serial->in_event);
if ((irp = (IRP*) Queue_Dequeue(serial->queue)))
serial_process_irp(serial, irp);
}
serial_check_fds(serial);
}
return NULL;
@ -423,7 +419,6 @@ static void serial_abort_single_io(SERIAL_DEVICE* serial, UINT32 file_id, UINT32
Stream_Write_UINT32(irp->output, 0);
irp->Complete(irp);
SetEvent(serial->in_event);
break;
}
@ -460,8 +455,6 @@ static void serial_check_for_events(SERIAL_DEVICE* serial)
prev = irp;
irp = (IRP*) list_next(serial->pending_irps, irp);
list_remove(serial->pending_irps, prev);
SetEvent(serial->in_event);
}
}
@ -537,7 +530,6 @@ static void serial_handle_async_irp(SERIAL_DEVICE* serial, IRP* irp)
irp->IoStatus = STATUS_PENDING;
list_enqueue(serial->pending_irps, irp);
SetEvent(serial->in_event);
}
static void __serial_check_fds(SERIAL_DEVICE* serial)
@ -599,10 +591,7 @@ static void __serial_check_fds(SERIAL_DEVICE* serial)
irp = (IRP*) list_next(serial->pending_irps, irp);
if (irp_completed || (prev->IoStatus == STATUS_SUCCESS))
{
list_remove(serial->pending_irps, prev);
SetEvent(serial->in_event);
}
}
}
@ -692,7 +681,7 @@ int DeviceServiceEntry(PDEVICE_SERVICE_ENTRY_POINTS pEntryPoints)
name = device->Name;
path = device->Path;
if (name[0] && path[0])
if ((name && name[0]) && (path && path[0]))
{
serial = (SERIAL_DEVICE*) malloc(sizeof(SERIAL_DEVICE));
ZeroMemory(serial, sizeof(SERIAL_DEVICE));
@ -711,7 +700,6 @@ int DeviceServiceEntry(PDEVICE_SERVICE_ENTRY_POINTS pEntryPoints)
serial->path = path;
serial->queue = Queue_New(TRUE, -1, -1);
serial->pending_irps = list_new();
serial->in_event = CreateEvent(NULL, TRUE, FALSE, NULL);
serial->stopEvent = CreateEvent(NULL, TRUE, FALSE, NULL);

View File

@ -865,13 +865,10 @@ int freerdp_detect_windows_style_command_line_syntax(int argc, char** argv, int*
}
while ((arg = CommandLineFindNextArgumentA(arg)) != NULL);
if (detect_status == 0)
{
if ((status <= COMMAND_LINE_ERROR) && (status >= COMMAND_LINE_ERROR_LAST))
detect_status = -1;
}
if ((status <= COMMAND_LINE_ERROR) && (status >= COMMAND_LINE_ERROR_LAST))
detect_status = -1;
return 0;
return detect_status;
}
int freerdp_detect_posix_style_command_line_syntax(int argc, char** argv, int* count)
@ -901,13 +898,10 @@ int freerdp_detect_posix_style_command_line_syntax(int argc, char** argv, int* c
}
while ((arg = CommandLineFindNextArgumentA(arg)) != NULL);
if (detect_status == 0)
{
if ((status <= COMMAND_LINE_ERROR) && (status >= COMMAND_LINE_ERROR_LAST))
detect_status = -1;
}
if ((status <= COMMAND_LINE_ERROR) && (status >= COMMAND_LINE_ERROR_LAST))
detect_status = -1;
return 0;
return detect_status;
}
BOOL freerdp_client_detect_command_line(int argc, char** argv, DWORD* flags)
@ -1034,6 +1028,7 @@ int freerdp_client_parse_command_line_arguments(int argc, char** argv, rdpSettin
freerdp_client_command_line_pre_filter, freerdp_client_command_line_post_filter);
}
arg = CommandLineFindArgumentA(args, "v");
arg = args;
@ -1668,7 +1663,7 @@ int freerdp_client_parse_command_line_arguments(int argc, char** argv, rdpSettin
FillMemory(arg->Value, strlen(arg->Value), '*');
}
return 1;
return status;
}
int freerdp_client_load_static_channel_addin(rdpChannels* channels, rdpSettings* settings, char* name, void* data)

View File

@ -23,6 +23,12 @@
#include <freerdp/api.h>
#include <freerdp/types.h>
#include <winpr/crt.h>
#include <winpr/stream.h>
FREERDP_API BOOL bitmap_decompress(BYTE* srcData, BYTE* dstData, int width, int height, int size, int srcBpp, int dstBpp);
FREERDP_API int freerdp_bitmap_compress(char* in_data, int width, int height,
wStream* s, int bpp, int byte_limit, int start_line, wStream* temp_s, int e);
#endif /* FREERDP_CODEC_BITMAP_H */

View File

@ -20,9 +20,10 @@ set(MODULE_PREFIX "FREERDP_CODEC")
set(${MODULE_PREFIX}_SRCS
dsp.c
bitmap.c
color.c
audio.c
bitmap_decode.c
bitmap_encode.c
rfx_bitstream.h
rfx_constants.h
rfx_decode.c

View File

@ -1,6 +1,6 @@
/**
* FreeRDP: A Remote Desktop Protocol Implementation
* Compressed Bitmap
* Bitmap Decompression
*
* Copyright 2011 Jay Sorg <jay.sorg@gmail.com>
*

File diff suppressed because it is too large Load Diff

View File

@ -1245,6 +1245,7 @@ rdpCredssp* credssp_new(freerdp* instance, rdpTransport* transport, rdpSettings*
ZeroMemory(&credssp->negoToken, sizeof(SecBuffer));
ZeroMemory(&credssp->pubKeyAuth, sizeof(SecBuffer));
ZeroMemory(&credssp->authInfo, sizeof(SecBuffer));
SecInvalidateHandle(&credssp->context);
if (credssp->server)
{

View File

@ -272,6 +272,7 @@ static int peer_recv_callback(rdpTransport* transport, wStream* s, void* extra)
sspi_CopyAuthIdentity(&client->identity, &(rdp->nego->transport->credssp->identity));
IFCALLRET(client->Logon, client->authenticated, client, &client->identity, TRUE);
credssp_free(rdp->nego->transport->credssp);
rdp->nego->transport->credssp = NULL;
}
else
{

View File

@ -159,6 +159,7 @@ BOOL transport_connect_nla(rdpTransport* transport)
"If credentials are valid, the NTLMSSP implementation may be to blame.\n");
credssp_free(transport->credssp);
transport->credssp = NULL;
return FALSE;
}
@ -292,6 +293,7 @@ BOOL transport_accept_nla(rdpTransport* transport)
{
fprintf(stderr, "client authentication failure\n");
credssp_free(transport->credssp);
transport->credssp = NULL;
return FALSE;
}
@ -786,7 +788,6 @@ static void* transport_client_thread(void* arg)
freerdp* instance;
rdpContext* context;
rdpTransport* transport;
TerminateEventArgs e;
transport = (rdpTransport*) arg;
instance = (freerdp*) transport->settings->instance;

View File

@ -685,7 +685,8 @@ BOOL tls_verify_certificate(rdpTls* tls, CryptoCert cert, char* hostname)
}
#ifndef _WIN32
free(common_name);
if (common_name)
free(common_name);
#endif
return verification_status;
@ -715,25 +716,20 @@ void tls_print_certificate_name_mismatch_error(char* hostname, char* common_name
fprintf(stderr, "@ WARNING: CERTIFICATE NAME MISMATCH! @\n");
fprintf(stderr, "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@\n");
fprintf(stderr, "The hostname used for this connection (%s) \n", hostname);
if (alt_names_count < 1)
fprintf(stderr, "does not match %s given in the certificate:\n", alt_names_count < 1 ? "the name" : "any of the names");
fprintf(stderr, "Common Name (CN):\n");
fprintf(stderr, "\t%s\n", common_name ? common_name : "no CN found in certificate");
if (alt_names_count > 1)
{
fprintf(stderr, "does not match the name given in the certificate:\n");
fprintf(stderr, "%s\n", common_name);
}
else
{
fprintf(stderr, "does not match the names given in the certificate:\n");
fprintf(stderr, "%s", common_name);
for (index = 0; index < alt_names_count; index++)
fprintf(stderr, "Alternative names:\n");
if (alt_names_count > 1)
{
fprintf(stderr, ", %s", alt_names[index]);
for (index = 0; index < alt_names_count; index++)
{
fprintf(stderr, "\t %s\n", alt_names[index]);
}
}
fprintf(stderr, "\n");
}
fprintf(stderr, "A valid certificate for the wrong name should NOT be trusted!\n");
}

View File

@ -248,7 +248,7 @@ void* sspi_SecureHandleGetLowerPointer(SecHandle* handle)
{
void* pointer;
if (!handle)
if (!handle || !SecIsValidHandle(handle))
return NULL;
pointer = (void*) ~((size_t) handle->dwLower);
@ -268,7 +268,7 @@ void* sspi_SecureHandleGetUpperPointer(SecHandle* handle)
{
void* pointer;
if (!handle)
if (!handle || !SecIsValidHandle(handle))
return NULL;
pointer = (void*) ~((size_t) handle->dwUpper);
@ -839,7 +839,7 @@ SECURITY_STATUS SEC_ENTRY CompleteAuthToken(PCtxtHandle phContext, PSecBufferDes
SECURITY_STATUS SEC_ENTRY DeleteSecurityContext(PCtxtHandle phContext)
{
char* Name;
char* Name = NULL;
SECURITY_STATUS status;
SecurityFunctionTableA* table;