Commit Graph

48 Commits

Author SHA1 Message Date
matt335672
0f6e731524 clipboard: Allow a file read to return 0 for EOF
When used with a FreeRDP client on Linux, a file copy operation from
the clipboard detects end-of-file by a read returning 0 bytes. This is
currently marked as an error.

It is assumed that mstsc.exe detects end-of-file in another way, which
is why this has not been found before.
2024-08-02 12:41:20 +01:00
matt335672
34b5582460 Remove unnecessary copy from clipboard_get_files()
The routine clipboard_get_files() parses a potentially long string,
and copies portions of it into a temporary buffer. This buffer is then
passed to clipboard_get_file() as pointer + length;

The buffer is inadequately sized for very long filenames which may
approach XFS_MAXFILENAMELEN in length. This can cause chansrv to fail
when the user copies such filenames.

It turns out the buffer is unnecessary, as the filenames can be
passed directly into clipboard_get_file() from the source string,
using pointer + length. This avoids the length limitation entirely.
2024-08-02 12:41:20 +01:00
matt335672
a90228241d Remove hard-coded filename limit for clipboard file lists
The limit of 256 characters for clipboard files is limiting for
many Asian locales, particularly as '%xx' notation is used to
communicate bytes with bit 7 set.
2024-08-02 12:41:20 +01:00
matt335672
f8e7fd4c2c Update clipboard code to use new UTF-8 calls 2023-10-23 14:15:47 +01:00
Daniel Richard G
1c0c923ad1 Split g_file_open() into _ro() and _rw() variants
Rename g_file_open() to g_file_open_rw(), and add a new g_file_open_ro()
call that wraps the common g_file_open_ex(file, 1, 0, 0, 0) idiom. This
will make the file access mode more explicit in the code.

Change all calls to g_file_open() to the _ro() or _rw() variant as
appropriate, and replace g_file_open_ex(file, 1, 0, 0, 0) with the _ro()
call.

Lastly, add tests for the two new calls to test_os_calls.c (code
courteously provided by matt335672).
2023-05-15 17:38:31 -04:00
a1346054
7fe18cc1c0
fix typos 2022-09-03 02:01:48 +00:00
matt335672
a49144be73 Avoid deadlock in clipboard copy code 2021-10-25 16:16:59 +01:00
matt335672
32d5d7cc27
Merge pull request #2001 from metalefty/clipfile-fail
clipboard file: Implement MS-RDPECLIP 3.1.5.4.7 compliance (#2001)
2021-09-21 10:37:35 +01:00
Koichiro IWAO
eb848747d2
clipboard file: adjust log level and add some detailed info 2021-09-21 18:19:47 +09:00
Koichiro IWAO
ad13956b12
clipboard file: Implement MS-RDPECLIP 3.1.5.4.7 compliance
If the requested file data could not be retrieved or the sender received
an unsuccessful Format List Response PDU (section 3.1.5.2.4), then the
clipHeader field MUST contain the CB_RESPONSE_FAIL (0x0002) flag and the
requestedFileContentsData field MUST contain no data (zero-length).

https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-rdpeclip/5d3991e9-440d-4e4d-8b8d-391c324c4007

Fixes #1997.
2021-09-21 16:50:42 +09:00
matt335672
253ea6eb6d Send clip response for string while file list is available 2021-09-16 10:02:02 +01:00
matt335672
d9988c340c Improve error checking and logging for returned CLIPRDR_FILELIST 2021-09-16 10:02:02 +01:00
matt335672
e1bbef99aa Check CLIPRDR_FILEDESCRIPTOR is present before reading it 2021-09-09 14:38:07 +01:00
matt335672
8fdf7b518c Correct filename padding skip in CLIPRDR_FILEDESCRIPTOR 2021-09-09 14:38:04 +01:00
matt335672
6a5895ce37 Remove unnecessary malloc/free 2021-09-09 14:37:35 +01:00
matt335672
9d8676f89d Corrected size of filename in struct clip_file_desc 2021-09-09 14:37:27 +01:00
Koichiro IWAO
1722451715
clipboard: log file transfer for the purpose of audit
Sponsored by: @CyberTrust and @haw
2021-08-11 15:38:24 +09:00
matt335672
3ea19ef0cd Create ms-rdpeclip.h and update ms-rdpbcgr.h 2021-06-08 14:11:17 +01:00
matt335672
0a1a8f40e5 Moved a lot of string funcs to string_calls module 2020-12-22 11:57:24 +00:00
Alexandre Quesnel
0c61a15fc5 Migrating logging to LOG() and LOG_DEVEL() in sesman/* 2020-11-30 00:36:20 +00:00
Alexandre Quesnel
a9ec1ebd99 Unifying logging in chanserv
This commit adds:
* replace multiple logging macros with LOG and LOG_DEVEL
* logging configuration for chanserv
* logging configuration for console output
* logging configuration for per file or method log level filtering for
debug builds
* file, line, and method name in log message for debug builds
2020-10-19 05:10:47 +00:00
Pavel Roskin
6ed4c969f4 Eliminate APP_CC and DEFAULT_CC 2017-03-14 00:21:48 -07:00
Pavel Roskin
b2d3dcf169 Include config_ac.h from all source files 2017-03-04 00:52:34 -08:00
Pavel Roskin
e35b5a4708 Constify string arguments in xrdp-chansrv sources 2017-01-22 22:39:10 -08:00
Pavel Roskin
a618d4f757 Don't use final newline in log calls, it's already appended 2016-10-17 08:54:07 -07:00
Koichiro IWAO
9f277e4445 chansrv: pathname also should be URL decoded
because 1st argument to clipboard_get_file() is given as URL encoded.
Decoding only filename is incomplete.

Without this fix, clipboard file doesn't work in case pathname
contains non-ASCII characters or non-alphanumeric ASCII characters.
2016-08-30 15:49:58 +09:00
Kentaro Hayashi
8f3fb2f7c8 chansrv: avoid chansrv SEGV when xinode is NULL
When xfuse_create_file_in_xrdp_fs is failed, it returns NULL.

Without this fix, xinode->size causes SEGV, so implementation is changed
to return -1 and check the return value in caller.
2016-07-21 16:02:21 +09:00
Pavel Roskin
70f3d4c5e2 Fix warnings for unused variables read from byte streams 2016-04-23 00:18:38 -07:00
Pavel Roskin
0629b25d5f Fix warnings about unused variables and functions 2016-04-21 22:27:27 -07:00
Pavel Roskin
334eeb970a clipboard_file: include sys/time.h for struct timeval, needed on Mac OS X 2016-01-30 12:32:52 -08:00
Pavel Roskin
964e860072 Run through codespell 2016-01-14 08:47:50 -08:00
Jay Sorg
9e310fbe06 clipboard file paste, don't add new line to last line 2015-03-13 12:58:31 -07:00
Laxmikant Rashinkar
a990287c46 coverity: fixed unchecked return value from library 2014-07-20 13:14:09 -07:00
Laxmikant Rashinkar
09dd58c5e1 clipboard: enabled module logging 2013-08-14 20:00:52 -07:00
Laxmikant Rashinkar
58158e6a3b hooked up clipboard code with FUSE 2013-04-26 18:55:28 -07:00
Laxmikant Rashinkar
78d4e19258 o early checkin for drive redirection
o basic drive redirection is working
o functions currently supported: open:
  read, write, create, get/set attribute
o requires latest NeutrinoRDP to work
o note: clipboard is broken because of the move from
        linked lists to inodes in the FUSE code
2013-03-08 15:37:30 -08:00
Jay Sorg
898b8efdf2 chansrv: fix clipboard crash 2013-02-15 18:35:44 -08:00
Jay Sorg
0e111e64de chansrv: ignore directory clipboard copies for now and clean up logging 2012-11-07 23:38:28 -08:00
Jay Sorg
514c9ad846 chansrv: make sure ~/xrdp_client exists, other cleanups 2012-11-07 22:48:18 -08:00
Jay Sorg
77e74e8e68 chansrv: clipboard file copy / paste working now 2012-11-05 01:04:04 -08:00
Jay Sorg
e2ef19098b chansrv: work on clipboard file copy 2012-11-04 13:52:33 -08:00
Jay Sorg
900d66dc6e chansrv: work on clipboard file copy paste 2012-11-03 18:47:04 -07:00
Jay Sorg
cdb039080f chansrv: added --enable-fuse option 2012-11-02 23:10:36 -07:00
Jay Sorg
6e25a5e600 chansrv: work on clipboard 2012-10-29 20:12:24 -07:00
Jay Sorg
91be5fe9ad chansrv: work on clipboard 2012-10-21 22:15:31 -07:00
Jay Sorg
82d3f817fb chansrv: work on clipboard 2012-10-18 18:43:04 -07:00
Jay Sorg
faec53b7f3 chansrv: work on clipboard 2012-10-14 18:08:06 -07:00
Jay Sorg
37d4f5725c chansrv: split out clipboard code, getting big 2012-10-14 11:46:01 -07:00