client/X11: Reintroduce handling for relieving filename restriction

Commit 6492a00959 introduced a way to
relieve the filename restriction, which ensured that file lists
containing files with names, that have characters, which are not allowed
on MS Windows.
This relief handling kicked in, when xfreerdp did not connect to MS
Windows RDS.
Commit d521c7fa74 got rid of any
wClipboardDelegate occurrence in xf_cliprdr.c, which also got rid of the
filename restriction relieve handling.
However, the relief handling was not added back, so do it now.
This commit is contained in:
Pascal Nowack 2023-04-01 11:36:27 +02:00 committed by akallabeth
parent 126fb7b2fc
commit 1f79eaa831

View File

@ -2030,6 +2030,26 @@ xf_cliprdr_server_format_data_response(CliprdrClientContext* context,
return CHANNEL_RC_OK;
}
static BOOL xf_cliprdr_is_valid_unix_filename(LPCWSTR filename)
{
LPCWSTR c;
if (!filename)
return FALSE;
if (filename[0] == L'\0')
return FALSE;
/* Reserved characters */
for (c = filename; *c; ++c)
{
if (*c == L'/')
return FALSE;
}
return TRUE;
}
xfClipboard* xf_clipboard_new(xfContext* xfc, BOOL relieveFilenameRestriction)
{
int n = 0;
@ -2206,6 +2226,13 @@ xfClipboard* xf_clipboard_new(xfContext* xfc, BOOL relieveFilenameRestriction)
clipboard->numTargets = 2;
clipboard->incr_atom = XInternAtom(xfc->display, "INCR", FALSE);
if (relieveFilenameRestriction)
{
WLog_DBG(TAG, "Relieving CLIPRDR filename restriction");
ClipboardGetDelegate(clipboard->system)->IsFileNameComponentValid =
xf_cliprdr_is_valid_unix_filename;
}
return clipboard;
fail: