Skip to content

Commit

Permalink
Merge pull request #7510 from akallabeth/stable-2.0.fix
Browse files Browse the repository at this point in the history
Stable 2.0.fix
  • Loading branch information
bmiklautz committed Jan 12, 2022
2 parents 4f15d5c + fd4876a commit d50aef9
Show file tree
Hide file tree
Showing 27 changed files with 843 additions and 258 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ if ($ENV{BUILD_NUMBER})
endif()
set(WITH_LIBRARY_VERSIONING "ON")

set(RAW_VERSION_STRING "2.4.1")
set(RAW_VERSION_STRING "2.5.0")
if(EXISTS "${CMAKE_SOURCE_DIR}/.source_tag")
file(READ ${CMAKE_SOURCE_DIR}/.source_tag RAW_VERSION_STRING)
elseif(USE_VERSION_FROM_GIT_TAG)
Expand Down
10 changes: 8 additions & 2 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,18 +1,24 @@
# 20xx-xx-xx Version 2.x.x
# 2022-01-12 Version 2.5.0

Noteworthy changes:
* Fixed smartcard login in case a redirection occurs the pin was lost
* Backported windows client drawing fixes
* Backported improved macOS keyboard layout detection
* Backported TcpConnectTimeout
* Backported LibreSSL compatibility patches
* Backported signal handler backtrace
* Backported OpenSSL 3.0 support

Fixed issues:
* Backport #7539: Wayland client clipboard issues
* Backport #7509: Various fixes regarding registry emulation, addin loader
and updated locale detection
* Backport #7466: Android android_register_pointer missing initialization

Important notes:

For a complete and detailed change log since the last release run:
git log 2.4.1..2.x.x
git log 2.4.1..2.5.0

# 2021-10-20 Version 2.4.1

Expand Down
2 changes: 1 addition & 1 deletion channels/audin/client/opensles/audin_opensl_es.c
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ static UINT audin_opensles_parse_addin_args(AudinOpenSLESDevice* device, ADDIN_A
{
UINT status;
DWORD flags;
COMMAND_LINE_ARGUMENT_A* arg;
const COMMAND_LINE_ARGUMENT_A* arg;
AudinOpenSLESDevice* opensles = (AudinOpenSLESDevice*)device;
COMMAND_LINE_ARGUMENT_A audin_opensles_args[] = {
{ "dev", COMMAND_LINE_VALUE_REQUIRED, "<device>", NULL, NULL, -1, NULL,
Expand Down
83 changes: 70 additions & 13 deletions channels/client/addin.c
Original file line number Diff line number Diff line change
Expand Up @@ -231,68 +231,125 @@ static FREERDP_ADDIN** freerdp_channels_list_dynamic_addins(LPCSTR pszName, LPCS

do
{
char* p[5];
FREERDP_ADDIN* pAddin;
nDashes = 0;
pAddin = (FREERDP_ADDIN*)calloc(1, sizeof(FREERDP_ADDIN));
BOOL used = FALSE;
FREERDP_ADDIN* pAddin = (FREERDP_ADDIN*)calloc(1, sizeof(FREERDP_ADDIN));

if (!pAddin)
{
WLog_ERR(TAG, "calloc failed!");
goto error_out;
}

nDashes = 0;
for (index = 0; FindData.cFileName[index]; index++)
nDashes += (FindData.cFileName[index] == '-') ? 1 : 0;

if (nDashes == 1)
{
size_t len;
char* p[2] = { 0 };
/* <name>-client.<extension> */
p[0] = FindData.cFileName;
p[1] = strchr(p[0], '-') + 1;
strncpy(pAddin->cName, p[0], (p[1] - p[0]) - 1);

len = p[1] - p[0];
if (len < 1)
{
WLog_WARN(TAG, "Skipping file '%s', invalid format", FindData.cFileName);
goto skip;
}
strncpy(pAddin->cName, p[0], MIN(ARRAYSIZE(pAddin->cName), len - 1));

pAddin->dwFlags = FREERDP_ADDIN_CLIENT;
pAddin->dwFlags |= FREERDP_ADDIN_DYNAMIC;
pAddin->dwFlags |= FREERDP_ADDIN_NAME;
ppAddins[nAddins++] = pAddin;

used = TRUE;
}
else if (nDashes == 2)
{
size_t len;
char* p[4] = { 0 };
/* <name>-client-<subsystem>.<extension> */
p[0] = FindData.cFileName;
p[1] = strchr(p[0], '-') + 1;
p[2] = strchr(p[1], '-') + 1;
p[3] = strchr(p[2], '.') + 1;
strncpy(pAddin->cName, p[0], (p[1] - p[0]) - 1);
strncpy(pAddin->cSubsystem, p[2], (p[3] - p[2]) - 1);

len = p[1] - p[0];
if (len < 1)
{
WLog_WARN(TAG, "Skipping file '%s', invalid format", FindData.cFileName);
goto skip;
}
strncpy(pAddin->cName, p[0], MIN(ARRAYSIZE(pAddin->cName), len - 1));

len = p[3] - p[2];
if (len < 1)
{
WLog_WARN(TAG, "Skipping file '%s', invalid format", FindData.cFileName);
goto skip;
}
strncpy(pAddin->cSubsystem, p[2], MIN(ARRAYSIZE(pAddin->cSubsystem), len - 1));

pAddin->dwFlags = FREERDP_ADDIN_CLIENT;
pAddin->dwFlags |= FREERDP_ADDIN_DYNAMIC;
pAddin->dwFlags |= FREERDP_ADDIN_NAME;
pAddin->dwFlags |= FREERDP_ADDIN_SUBSYSTEM;
ppAddins[nAddins++] = pAddin;

used = TRUE;
}
else if (nDashes == 3)
{
size_t len;
char* p[5] = { 0 };
/* <name>-client-<subsystem>-<type>.<extension> */
p[0] = FindData.cFileName;
p[1] = strchr(p[0], '-') + 1;
p[2] = strchr(p[1], '-') + 1;
p[3] = strchr(p[2], '-') + 1;
p[4] = strchr(p[3], '.') + 1;
strncpy(pAddin->cName, p[0], (p[1] - p[0]) - 1);
strncpy(pAddin->cSubsystem, p[2], (p[3] - p[2]) - 1);
strncpy(pAddin->cType, p[3], (p[4] - p[3]) - 1);

len = p[1] - p[0];
if (len < 1)
{
WLog_WARN(TAG, "Skipping file '%s', invalid format", FindData.cFileName);
goto skip;
}
strncpy(pAddin->cName, p[0], MIN(ARRAYSIZE(pAddin->cName), len - 1));

len = p[3] - p[2];
if (len < 1)
{
WLog_WARN(TAG, "Skipping file '%s', invalid format", FindData.cFileName);
goto skip;
}
strncpy(pAddin->cSubsystem, p[2], MIN(ARRAYSIZE(pAddin->cSubsystem), len - 1));

len = p[4] - p[3];
if (len < 1)
{
WLog_WARN(TAG, "Skipping file '%s', invalid format", FindData.cFileName);
goto skip;
}
strncpy(pAddin->cType, p[3], MIN(ARRAYSIZE(pAddin->cType), len - 1));

pAddin->dwFlags = FREERDP_ADDIN_CLIENT;
pAddin->dwFlags |= FREERDP_ADDIN_DYNAMIC;
pAddin->dwFlags |= FREERDP_ADDIN_NAME;
pAddin->dwFlags |= FREERDP_ADDIN_SUBSYSTEM;
pAddin->dwFlags |= FREERDP_ADDIN_TYPE;
ppAddins[nAddins++] = pAddin;

used = TRUE;
}
else
{

skip:
if (!used)
free(pAddin);
}

} while (FindNextFileA(hFind, &FindData));

FindClose(hFind);
Expand Down
2 changes: 1 addition & 1 deletion client/Android/Studio/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def getVersionName = { ->

ext {
versionName = properties.get('VERSION_NAME', getVersionName())
versionCode = properties.get('VERSION_CODE', 25)
versionCode = properties.get('VERSION_CODE', 26)
compileApi = properties.get('COMPILE_API', 30)
targetApi = properties.get('TARGET_API', 30)
minApi = properties.get('MIN_API', 21)
Expand Down
2 changes: 1 addition & 1 deletion client/Android/android_freerdp.c
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
#define TAG CLIENT_TAG("android")

/* Defines the JNI version supported by this library. */
#define FREERDP_JNI_VERSION "2.4.1"
#define FREERDP_JNI_VERSION "2.5.0"

static void android_OnChannelConnectedEventHandler(void* context, ChannelConnectedEventArgs* e)
{
Expand Down
43 changes: 37 additions & 6 deletions client/Wayland/wlf_cliprdr.c
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ struct wlf_clipboard
FILE* responseFile;
UINT32 responseFormat;
const char* responseMime;
CRITICAL_SECTION lock;
};

static BOOL wlf_mime_is_text(const char* mime)
Expand Down Expand Up @@ -275,7 +276,7 @@ BOOL wlf_cliprdr_handle_event(wfClipboard* clipboard, const UwacClipboardEvent*
return TRUE;

case UWAC_EVENT_CLIPBOARD_OFFER:
WLog_Print(clipboard->log, WLOG_INFO, "client announces mime %s", event->mime);
WLog_Print(clipboard->log, WLOG_DEBUG, "client announces mime %s", event->mime);
wlf_cliprdr_add_client_format(clipboard, event->mime);
return TRUE;

Expand Down Expand Up @@ -387,6 +388,8 @@ static void wlf_cliprdr_transfer_data(UwacSeat* seat, void* context, const char*
wfClipboard* clipboard = (wfClipboard*)context;
size_t x;
WINPR_UNUSED(seat);

EnterCriticalSection(&clipboard->lock);
clipboard->responseMime = NULL;

for (x = 0; x < ARRAYSIZE(mime_html); x++)
Expand Down Expand Up @@ -427,6 +430,8 @@ static void wlf_cliprdr_transfer_data(UwacSeat* seat, void* context, const char*

if (clipboard->responseMime != NULL)
{
if (clipboard->responseFile != NULL)
fclose(clipboard->responseFile);
clipboard->responseFile = fdopen(fd, "w");

if (clipboard->responseFile)
Expand All @@ -436,6 +441,7 @@ static void wlf_cliprdr_transfer_data(UwacSeat* seat, void* context, const char*
"failed to open clipboard file descriptor for MIME %s",
clipboard->responseMime);
}
LeaveCriticalSection(&clipboard->lock);
}

static void wlf_cliprdr_cancel_data(UwacSeat* seat, void* context)
Expand Down Expand Up @@ -673,6 +679,8 @@ wlf_cliprdr_server_format_data_response(CliprdrClientContext* context,
const WCHAR* wdata = (const WCHAR*)formatDataResponse->requestedFormatData;
wfClipboard* clipboard = (wfClipboard*)context->custom;

EnterCriticalSection(&clipboard->lock);

if (size > INT_MAX * sizeof(WCHAR))
return ERROR_INTERNAL_ERROR;

Expand All @@ -694,10 +702,16 @@ wlf_cliprdr_server_format_data_response(CliprdrClientContext* context,
break;
}

fwrite(data, 1, size, clipboard->responseFile);
fclose(clipboard->responseFile);
if (clipboard->responseFile)
{
fwrite(data, 1, size, clipboard->responseFile);
fclose(clipboard->responseFile);
clipboard->responseFile = NULL;
}
rc = CHANNEL_RC_OK;
free(cdata);

LeaveCriticalSection(&clipboard->lock);
return rc;
}

Expand Down Expand Up @@ -829,17 +843,24 @@ static UINT wlf_cliprdr_clipboard_file_range_failure(wClipboardDelegate* delegat
wfClipboard* wlf_clipboard_new(wlfContext* wfc)
{
rdpChannels* channels;
wfClipboard* clipboard;
wfClipboard* clipboard = (wfClipboard*)calloc(1, sizeof(wfClipboard));

if (!(clipboard = (wfClipboard*)calloc(1, sizeof(wfClipboard))))
return NULL;
if (!clipboard)
goto fail;

InitializeCriticalSection(&clipboard->lock);
clipboard->wfc = wfc;
channels = wfc->context.channels;
clipboard->log = WLog_Get(TAG);
clipboard->channels = channels;
clipboard->system = ClipboardCreate();
if (!clipboard->system)
goto fail;

clipboard->delegate = ClipboardGetDelegate(clipboard->system);
if (!clipboard->delegate)
goto fail;

clipboard->delegate->custom = clipboard;
/* TODO: set up a filesystem base path for local URI */
/* clipboard->delegate->basePath = "file:///tmp/foo/bar/gaga"; */
Expand All @@ -848,6 +869,10 @@ wfClipboard* wlf_clipboard_new(wlfContext* wfc)
clipboard->delegate->ClipboardFileRangeSuccess = wlf_cliprdr_clipboard_file_range_success;
clipboard->delegate->ClipboardFileRangeFailure = wlf_cliprdr_clipboard_file_range_failure;
return clipboard;

fail:
wlf_clipboard_free(clipboard);
return NULL;
}

void wlf_clipboard_free(wfClipboard* clipboard)
Expand All @@ -858,6 +883,12 @@ void wlf_clipboard_free(wfClipboard* clipboard)
wlf_cliprdr_free_server_formats(clipboard);
wlf_cliprdr_free_client_formats(clipboard);
ClipboardDestroy(clipboard->system);

EnterCriticalSection(&clipboard->lock);
if (clipboard->responseFile)
fclose(clipboard->responseFile);
LeaveCriticalSection(&clipboard->lock);
DeleteCriticalSection(&clipboard->lock);
free(clipboard);
}

Expand Down
9 changes: 6 additions & 3 deletions client/Wayland/wlfreerdp.c
Original file line number Diff line number Diff line change
Expand Up @@ -331,12 +331,15 @@ static BOOL handle_uwac_events(freerdp* instance, UwacDisplay* display)
break;

case UWAC_EVENT_FRAME_DONE:
{
UwacReturnCode r;
EnterCriticalSection(&context->critical);
rc = UwacWindowSubmitBuffer(context->window, false);
r = UwacWindowSubmitBuffer(context->window, false);
LeaveCriticalSection(&context->critical);
if (rc != UWAC_SUCCESS)
if (r != UWAC_SUCCESS)
return FALSE;
break;
}
break;

case UWAC_EVENT_POINTER_ENTER:
if (!wlf_handle_pointer_enter(instance, &event.mouse_enter_leave))
Expand Down
12 changes: 12 additions & 0 deletions client/Windows/wf_client.c
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,18 @@ static BOOL wf_end_paint(rdpContext* context)
updateRect.top = extents->top;
updateRect.right = extents->right;
updateRect.bottom = extents->bottom;

if (wfc->xScrollVisible)
{
updateRect.left -= MIN(updateRect.left, wfc->xCurrentScroll);
updateRect.right -= MIN(updateRect.right, wfc->xCurrentScroll);
}
if (wfc->yScrollVisible)
{
updateRect.top -= MIN(updateRect.top, wfc->yCurrentScroll);
updateRect.bottom -= MIN(updateRect.bottom, wfc->yCurrentScroll);
}

InvalidateRect(wfc->hwnd, &updateRect, FALSE);

if (wfc->rail)
Expand Down
4 changes: 4 additions & 0 deletions include/freerdp/locale/locale.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@
#define BRETON 0x047E
#define BULGARIAN 0x0402
#define CATALAN 0x0403
#define CHEROKEE 0x045C
#define CHINESE_TAIWAN 0x0404
#define CHINESE_PRC 0x0804
#define CHINESE_HONG_KONG 0x0C04
Expand Down Expand Up @@ -113,12 +114,14 @@
#define GREEK 0x0408
#define GREENLANDIC 0x046F
#define GUJARATI 0x0447
#define HAWAIIAN 0x0475
#define HEBREW 0x040D
#define HINDI 0x0439
#define HUNGARIAN 0x040E
#define ICELANDIC 0x040F
#define IGBO 0x0470
#define INDONESIAN 0x0421
#define INUKTITUT 0x045D
#define IRISH 0x083C
#define ITALIAN_STANDARD 0x0410
#define ITALIAN_SWISS 0x0810
Expand Down Expand Up @@ -146,6 +149,7 @@
#define MARATHI 0x044E
#define MOHAWK 0x047C
#define MONGOLIAN 0x0450
#define MYANMAR 0x0455
#define NEPALI 0x0461
#define NORWEGIAN_BOKMAL 0x0414
#define NORWEGIAN_NYNORSK 0x0814
Expand Down
Loading

0 comments on commit d50aef9

Please sign in to comment.