From d3dc1c780d9056072af72e68ea5fb5e7be53b12a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Moreau?= Date: Mon, 21 May 2012 16:01:24 -0400 Subject: [PATCH] wfreerdp: fix compilation --- CMakeLists.txt | 5 +++-- include/freerdp/errorcodes.h | 7 ++++--- libfreerdp-codec/color.c | 7 +++---- libfreerdp-core/connection.c | 5 ++++- libfreerdp-core/errinfo.c | 2 ++ libfreerdp-core/freerdp.c | 16 +++++++++++++--- libfreerdp-core/transport.c | 18 ++++++++++-------- libfreerdp-utils/dsp.c | 5 +++-- libfreerdp-utils/tcp.c | 23 +++-------------------- winpr/rpc/CMakeLists.txt | 1 - winpr/sspi/CMakeLists.txt | 5 ++++- 11 files changed, 49 insertions(+), 45 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index fd2730801..6729528f7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -151,6 +151,9 @@ endif() # Sub-directories add_subdirectory(include) add_subdirectory(libfreerdp-utils) + +add_subdirectory(winpr) + add_subdirectory(libfreerdp-gdi) add_subdirectory(libfreerdp-rail) add_subdirectory(libfreerdp-cache) @@ -160,8 +163,6 @@ add_subdirectory(libfreerdp-channels) add_subdirectory(libfreerdp-locale) add_subdirectory(libfreerdp-core) -add_subdirectory(winpr) - if(NOT WIN32) add_subdirectory(channels) endif() diff --git a/include/freerdp/errorcodes.h b/include/freerdp/errorcodes.h index d330858fc..e36e2ce7c 100644 --- a/include/freerdp/errorcodes.h +++ b/include/freerdp/errorcodes.h @@ -11,14 +11,16 @@ #ifdef __cplusplus extern "C" { #endif - + /** * This static variable holds an error code if the return value from connect is false. * This variable is always set to 0 in the beginning of the connect sequence. * The returned code can be used to inform the user of the detailed connect error. * The value can hold one of the defined error codes below OR an error according to errno */ -extern int connectErrorCode ; + +extern int connectErrorCode; + #define ERRORSTART 10000 #define PREECONNECTERROR ERRORSTART + 1 #define UNDEFINEDCONNECTERROR ERRORSTART + 2 @@ -30,7 +32,6 @@ extern int connectErrorCode ; #define TLSCONNECTERROR ERRORSTART + 8 #define AUTHENTICATIONERROR ERRORSTART + 9 - #ifdef __cplusplus } #endif diff --git a/libfreerdp-codec/color.c b/libfreerdp-codec/color.c index 3cadc2876..fe3d63647 100644 --- a/libfreerdp-codec/color.c +++ b/libfreerdp-codec/color.c @@ -791,13 +791,12 @@ uint8* freerdp_image_flip(uint8* srcData, uint8* dstData, int width, int height, uint8* freerdp_icon_convert(uint8* srcData, uint8* dstData, uint8* mask, int width, int height, int bpp, HCLRCONV clrconv) { - int x, y, bit; - int maskIndex; uint8* data; uint8 bmask; - uint32 pmask; uint32* icon; - + int x, y, bit; + int maskIndex; + if (bpp == 16) { /* Server sends 16 bpp field, but data is usually 15-bit 555 */ diff --git a/libfreerdp-core/connection.c b/libfreerdp-core/connection.c index 1daeb0508..46fc2c470 100644 --- a/libfreerdp-core/connection.c +++ b/libfreerdp-core/connection.c @@ -22,6 +22,8 @@ #include "connection.h" +#include + /** * Connection Sequence\n * client server\n @@ -107,7 +109,8 @@ boolean rdp_client_connect(rdpRdp* rdp) if (mcs_send_connect_initial(rdp->mcs) != true) { - if(!connectErrorCode){ + if (!connectErrorCode) + { connectErrorCode = MCSCONNECTINITIALERROR; } printf("Error: unable to send MCS Connect Initial\n"); diff --git a/libfreerdp-core/errinfo.c b/libfreerdp-core/errinfo.c index bd6899cc4..48b1ef228 100644 --- a/libfreerdp-core/errinfo.c +++ b/libfreerdp-core/errinfo.c @@ -19,6 +19,8 @@ #include "errinfo.h" +int connectErrorCode; + /* Protocol-independent codes */ #define ERRINFO_RPC_INITIATED_DISCONNECT_STRING \ diff --git a/libfreerdp-core/freerdp.c b/libfreerdp-core/freerdp.c index e059492d8..80d01d0c7 100644 --- a/libfreerdp-core/freerdp.c +++ b/libfreerdp-core/freerdp.c @@ -26,6 +26,7 @@ #include "extension.h" #include +#include #include /* connectErrorCode is 'extern' in errorcodes.h. See comment there.*/ @@ -45,8 +46,9 @@ boolean freerdp_connect(freerdp* instance) { rdpRdp* rdp; boolean status = false; + /* We always set the return code to 0 before we start the connect sequence*/ - connectErrorCode = 0 ; + connectErrorCode = 0; rdp = instance->context->rdp; @@ -81,9 +83,12 @@ boolean freerdp_connect(freerdp* instance) if (status != true) { printf("freerdp_post_connect failed\n"); - if(!connectErrorCode){ + + if (!connectErrorCode) + { connectErrorCode = POSTCONNECTERROR; } + return false; } @@ -95,8 +100,10 @@ boolean freerdp_connect(freerdp* instance) s = stream_new(1024); instance->update->pcap_rfx = pcap_open(instance->settings->play_rfx_file, false); + if (instance->update->pcap_rfx) instance->update->play_rfx = true; + update = instance->update; while (instance->update->play_rfx && pcap_has_next_record(update->pcap_rfx)) @@ -119,9 +126,12 @@ boolean freerdp_connect(freerdp* instance) return true; } } - if(!connectErrorCode){ + + if (!connectErrorCode) + { connectErrorCode = UNDEFINEDCONNECTERROR; } + return status; } diff --git a/libfreerdp-core/transport.c b/libfreerdp-core/transport.c index dbc3fcbd1..964477410 100644 --- a/libfreerdp-core/transport.c +++ b/libfreerdp-core/transport.c @@ -88,10 +88,11 @@ boolean transport_connect_tls(rdpTransport* transport) transport->layer = TRANSPORT_LAYER_TLS; transport->tls->sockfd = transport->tcp->sockfd; - if (tls_connect(transport->tls) != true) { - if(!connectErrorCode){ + if (tls_connect(transport->tls) != true) + { + if (!connectErrorCode) connectErrorCode = TLSCONNECTERROR; - } + tls_free(transport->tls); transport->tls = NULL; return false; @@ -111,10 +112,11 @@ boolean transport_connect_nla(rdpTransport* transport) transport->layer = TRANSPORT_LAYER_TLS; transport->tls->sockfd = transport->tcp->sockfd; - if (tls_connect(transport->tls) != true) { - if(!connectErrorCode){ + if (tls_connect(transport->tls) != true) + { + if (!connectErrorCode) connectErrorCode = TLSCONNECTERROR; - } + tls_free(transport->tls); transport->tls = NULL; return false; @@ -133,9 +135,9 @@ boolean transport_connect_nla(rdpTransport* transport) if (credssp_authenticate(transport->credssp) < 0) { - if(!connectErrorCode){ + if (!connectErrorCode) connectErrorCode = AUTHENTICATIONERROR; - } + printf("Authentication failure, check credentials.\n" "If credentials are valid, the NTLMSSP implementation may be to blame.\n"); diff --git a/libfreerdp-utils/dsp.c b/libfreerdp-utils/dsp.c index fd8beb0f9..3a28b44fd 100644 --- a/libfreerdp-utils/dsp.c +++ b/libfreerdp-utils/dsp.c @@ -41,10 +41,11 @@ static void freerdp_dsp_resample(FREERDP_DSP_CONTEXT* context, rbytes = bytes_per_sample * rchan; rframes = sframes * rrate / srate; rsize = rbytes * rframes; - if (rsize > context->resampled_maxlength) + + if (rsize > (int) context->resampled_maxlength) { context->resampled_maxlength = rsize + 1024; - context->resampled_buffer = xrealloc(context->resampled_buffer, context->resampled_maxlength); + context->resampled_buffer = (uint8*) xrealloc(context->resampled_buffer, context->resampled_maxlength); } dst = context->resampled_buffer; diff --git a/libfreerdp-utils/tcp.c b/libfreerdp-utils/tcp.c index b986788ab..82f8c8b4c 100644 --- a/libfreerdp-utils/tcp.c +++ b/libfreerdp-utils/tcp.c @@ -19,7 +19,6 @@ #include #include -#include #include #include @@ -56,9 +55,6 @@ #endif -/* connectErrorCode is 'extern' in errorcodes.h. See comment there.*/ -int connectErrorCode ; - int freerdp_tcp_connect(const char* hostname, int port) { int status; @@ -77,19 +73,12 @@ int freerdp_tcp_connect(const char* hostname, int port) if (status != 0) { - if(status==EAI_NONAME){ - if(!connectErrorCode){ - connectErrorCode = DNSNAMENOTFOUND; - } - } - if(!connectErrorCode){ - connectErrorCode = DNSERROR; - } printf("tcp_connect: getaddrinfo (%s)\n", gai_strerror(status)); return -1; } sockfd = -1; + for (ai = res; ai; ai = ai->ai_next) { sockfd = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol); @@ -102,17 +91,11 @@ int freerdp_tcp_connect(const char* hostname, int port) printf("connected to %s:%s\n", hostname, servname); break; } - if(!connectErrorCode){ - int tmperror = errno ; - if(tmperror!=0){ - connectErrorCode = tmperror ; - }else{ - connectErrorCode = CONNECTERROR; - } - } + close(sockfd); sockfd = -1; } + freeaddrinfo(res); if (sockfd == -1) diff --git a/winpr/rpc/CMakeLists.txt b/winpr/rpc/CMakeLists.txt index 3978f8abf..af607cbae 100644 --- a/winpr/rpc/CMakeLists.txt +++ b/winpr/rpc/CMakeLists.txt @@ -47,4 +47,3 @@ endif() target_link_libraries(winpr-rpc ${OPENSSL_LIBRARIES}) install(TARGETS winpr-rpc DESTINATION ${CMAKE_INSTALL_LIBDIR}) - diff --git a/winpr/sspi/CMakeLists.txt b/winpr/sspi/CMakeLists.txt index cdf527d71..b95574fa6 100644 --- a/winpr/sspi/CMakeLists.txt +++ b/winpr/sspi/CMakeLists.txt @@ -64,7 +64,10 @@ include_directories(${ZLIB_INCLUDE_DIRS}) set_target_properties(winpr-sspi PROPERTIES VERSION ${FREERDP_VERSION_FULL} SOVERSION ${FREERDP_VERSION} PREFIX "lib") -target_link_libraries(winpr-sspi winpr-crt) +if (NOT WIN32) + target_link_libraries(winpr-sspi winpr-crt) +endif() + target_link_libraries(winpr-sspi freerdp-utils) target_link_libraries(winpr-sspi freerdp-crypto) target_link_libraries(winpr-sspi ${ZLIB_LIBRARIES})