Clipboard file transfer is aborted in xfreerdp when clipboard contents changes during copy
Describe the bug When copying files from an RDP server to the local machine via clipboard (e.g. paste in a local file manager), if clipboard contents changes during transfer (user copies something else locally or on the server), the ongoing file transfer is immediately aborted.
There are three things that cause this behavior in client/common/client_cliprdr_file.c file:
- cliprdr_file_context_notify_new_client_format_list function destroys all FUSE entries when the local clipboard changes, even though the server's file is still valid and accessable
- cliprdr_file_context_notify_new_server_format_list function destroys all clip data entries including those with active LOCK_CLIPBOARD_DATA held by the server), even though the locked data is available on the server
- CB_CAN_LOCK_CLIPDATA is commented out in the client's capability flags. Without the client advertising it the server may ignore LOCK_CLIPBOARD_DATA PDUs from the client, rendering the locking mechanism ineffective
To Reproduce
- Connect to a Windows RDP server with xfreerdp (clipboard redirection enabled, built with the FUSE support)
- On the remote desktop, right click on a directory with many files (or a large file) -> copy
- In a local file manager, paste the copied content
- While the transfer is in progress, copy something else to the clipboard (e.g. select text and ctrl-c or copy the remote file several times)
- The ongoing transfer is aborted with an I/O error
Expected behavior The file transfer should continue to completion regardless of clipboard changes. Changing the clipboard should not interrupt ongoing transfers
Screenshots
Application details
FreeRDP version 3.22.1-dev0 (ce7258485). Previous versions have the same behavior
Command line used: xfreerdp /proxy:socks5://127.0.0.1:8891 /u:DOMAIN\\user /v:rdp.somesite.com:3389 /smart-sizing:3600x2000 /size:1800x1000 /scale:180
Output of
xfreerdp /buildconfig:Build configuration: BUILD_TESTING=OFF BUILD_TESTING_INTERNAL=OFF BUILD_TESTING_INTERNAL_AVAILABLE=1 BUILD_TESTING_NO_H264=OFF BUILD_TESTING_NO_H264_AVAILABLE=0 WINPR_HAVE_AIO_H=1 WINPR_HAVE_EXECINFO_BACKTRACE=1 WINPR_HAVE_EXECINFO_BACKTRACE_SYMBOLS=1 WINPR_HAVE_EXECINFO_BACKTRACE_SYMBOLS_FD=1 WINPR_HAVE_EXECINFO_HEADER=1 WINPR_HAVE_FCNTL_H=1 WINPR_HAVE_GETLOGIN_R=1 WINPR_HAVE_GETPWUID_R=1 WINPR_HAVE_INTTYPES_H=1 WINPR_HAVE_POLL_H=1 WINPR_HAVE_PTHREAD_MUTEX_TIMEDLOCK_LIB=1 WINPR_HAVE_PTHREAD_MUTEX_TIMEDLOCK_LIBS= WINPR_HAVE_PTHREAD_MUTEX_TIMEDLOCK_SYMBOL=1 WINPR_HAVE_STDBOOL_H=1 WINPR_HAVE_STDINT_H=1 WINPR_HAVE_STRERROR_R=1 WINPR_HAVE_STRNDUP=1 WINPR_HAVE_SYSLOG_H=1 WINPR_HAVE_SYS_EVENTFD_H=1 WINPR_HAVE_SYS_FILIO_H= WINPR_HAVE_SYS_SELECT_H=1 WINPR_HAVE_SYS_SOCKIO_H= WINPR_HAVE_SYS_TIMERFD_H=1 WINPR_HAVE_TM_GMTOFF=1 WINPR_HAVE_UNISTD_H=1 WINPR_HAVE_UNWIND_H=1 WITHOUT_FREERDP_3x_DEPRECATED=OFF WITH_AAD=OFF WITH_ABSOLUTE_PLUGIN_LOAD_PATHS=ON WITH_ADD_PLUGIN_TO_RPATH=OFF WITH_ALSA=ON WITH_AVX2=ON WITH_BINARY_VERSIONING=OFF WITH_CAIRO=OFF WITH_CCACHE=OFF WITH_CHANNELS=ON WITH_CJSON_REQUIRED=OFF WITH_CLANG_FORMAT=ON WITH_CLIENT=ON WITH_CLIENT_AVAILABLE=1 WITH_CLIENT_CHANNELS=ON WITH_CLIENT_CHANNELS_AVAILABLE=1 WITH_CLIENT_COMMON=ON WITH_CLIENT_INTERFACE=OFF WITH_CLIENT_SDL=ON WITH_CLIENT_SDL2=OFF WITH_CLIENT_SDL3=ON WITH_CLIENT_SDL_AVAILABLE=1 WITH_CLIENT_SDL_VERSIONED=OFF WITH_CUPS=ON WITH_CURSOR_DUMP=OFF WITH_DEBUG_ALL=OFF WITH_DEBUG_CAPABILITIES=OFF WITH_DEBUG_CERTIFICATE=OFF WITH_DEBUG_CHANNELS=OFF WITH_DEBUG_CLIPRDR=OFF WITH_DEBUG_CODECS=OFF WITH_DEBUG_DVC=OFF WITH_DEBUG_EVENTS=OFF WITH_DEBUG_KBD=OFF WITH_DEBUG_LICENSE=OFF WITH_DEBUG_MUTEX=OFF WITH_DEBUG_NEGO=OFF WITH_DEBUG_NLA=OFF WITH_DEBUG_NTLM=OFF WITH_DEBUG_RAIL=OFF WITH_DEBUG_RDP=OFF WITH_DEBUG_RDPDR=OFF WITH_DEBUG_RDPEI=OFF WITH_DEBUG_RDPGFX=OFF WITH_DEBUG_REDIR=OFF WITH_DEBUG_RFX=OFF WITH_DEBUG_RINGBUFFER=OFF WITH_DEBUG_SCARD=OFF WITH_DEBUG_SCHANNEL=OFF WITH_DEBUG_SDL_EVENTS=OFF WITH_DEBUG_SDL_KBD_EVENTS=OFF WITH_DEBUG_SND=OFF WITH_DEBUG_SVC=OFF WITH_DEBUG_SYMBOLS=OFF WITH_DEBUG_THREADS=OFF WITH_DEBUG_TIMEZONE=OFF WITH_DEBUG_TRANSPORT=OFF WITH_DEBUG_TSG=OFF WITH_DEBUG_TSMF=OFF WITH_DEBUG_TSMF_AVAILABLE=0 WITH_DEBUG_URBDRC=OFF WITH_DEBUG_UTILS_CMDLINE_DUMP=OFF WITH_DEBUG_WND=OFF WITH_DEBUG_X11=OFF WITH_DEBUG_X11_LOCAL_MOVESIZE=OFF WITH_DEBUG_XV=OFF WITH_DOCUMENTATION=OFF WITH_DSP_EXPERIMENTAL=OFF WITH_DSP_FFMPEG=ON WITH_DSP_FFMPEG_AVAILABLE=1 WITH_EVENTFD_READ_WRITE=1 WITH_FAAC=OFF WITH_FAAD2=OFF WITH_FDK_AAC=OFF WITH_FFMPEG=ON WITH_FREERDP_DEPRECATED=OFF WITH_FREERDP_DEPRECATED_COMMANDLINE=ON WITH_FULL_CONFIG_PATH=OFF WITH_FUSE=ON WITH_GFX_FRAME_DUMP=OFF WITH_GFX_H264=ON WITH_GPROF=OFF WITH_GSM=OFF WITH_GSTREAMER_1_0=ON WITH_INSTALL_CLIENT_DESKTOP_FILES=OFF WITH_INTERNAL_MD4=OFF WITH_INTERNAL_MD5=OFF WITH_INTERNAL_RC4=OFF WITH_JANSSON_REQUIRED=OFF WITH_JPEG=ON WITH_JSONC_REQUIRED=OFF WITH_JSON_DISABLED=OFF WITH_KEYBOARD_LAYOUT_FROM_FILE=OFF WITH_KRB5=ON WITH_KRB5_NO_NTLM_FALLBACK=OFF WITH_LAME=OFF WITH_LIBRARY_SOVERSIONING=ON WITH_LIBRARY_VERSIONING=ON WITH_LIBRESSL=OFF WITH_LIBSYSTEMD=ON WITH_LODEPNG=OFF WITH_MACAUDIO=OFF WITH_MACAUDIO_AVAILABLE=0 WITH_MANPAGES=ON WITH_MBEDTLS=OFF WITH_NATIVE_SSPI=OFF WITH_NEON=OFF WITH_NO_UNDEFINED=OFF WITH_OPAQUE_SETTINGS=OFF WITH_OPENCL=OFF WITH_OPENH264=OFF WITH_OPENSSL=ON WITH_OPUS=OFF WITH_OSS=OFF WITH_PCSC=OFF WITH_PKCS11=OFF WITH_PLATFORM_SERVER=ON WITH_POLL=ON WITH_PROFILER=OFF WITH_PROXY=ON WITH_PROXY_APP=ON WITH_PROXY_EMULATE_SMARTCARD=OFF WITH_PROXY_MODULES=ON WITH_PULSE=ON WITH_RDTK=OFF WITH_RESOURCE_VERSIONING=OFF WITH_SAMPLE=OFF WITH_SANITIZE_ADDRESS=OFF WITH_SANITIZE_ADDRESS_AVAILABLE=1 WITH_SANITIZE_MEMORY=OFF WITH_SANITIZE_MEMORY_AVAILABLE=1 WITH_SANITIZE_THREAD=OFF WITH_SANITIZE_THREAD_AVAILABLE=1 WITH_SDL_IMAGE_DIALOGS=OFF WITH_SDL_LINK_SHARED=ON WITH_SERVER=ON WITH_SERVER_CHANNELS=ON WITH_SERVER_INTERFACE=ON WITH_SERVER_SHADOW_CLI=ON WITH_SHADOW=ON WITH_SHADOW_SUBSYSTEM=ON WITH_SIMD=ON WITH_SMARTCARD_EMULATE=ON WITH_SMARTCARD_INSPECT=OFF WITH_SMARTCARD_PCSC=ON WITH_SOXR=OFF WITH_SSO_MIB=OFF WITH_STREAMPOOL_DEBUG=OFF WITH_SWSCALE=ON WITH_SYSTEMD=ON WITH_THIRD_PARTY=OFF WITH_TIMEZONE_COMPILED=ON WITH_TIMEZONE_FROM_FILE=OFF WITH_TIMEZONE_ICU=OFF WITH_UNICODE_BUILTIN=OFF WITH_URIPARSER=OFF WITH_VAAPI=OFF WITH_VAAPI_AVAILABLE=1 WITH_VAAPI_H264_ENCODING=ON WITH_VAAPI_H264_ENCODING_AVAILABLE=1 WITH_VALGRIND_MEMCHECK=OFF WITH_VALGRIND_MEMCHECK_AVAILABLE=1 WITH_VERBOSE_WINPR_ASSERT=OFF WITH_VIDEO_FFMPEG=ON WITH_VIDEO_FFMPEG_AVAILABLE=1 WITH_WAYLAND=OFF WITH_WCHAR_FILE_DIRECTORY_INFORMATION=OFF WITH_WEBVIEW=OFF WITH_WINPR_DEPRECATED=OFF WITH_WINPR_JSON=ON WITH_WINPR_TOOLS=ON WITH_WINPR_TOOLS_CLI=ON WITH_WIN_CONSOLE=ON WITH_X11=ON WITH_XCURSOR=ON WITH_XEXT=ON WITH_XFIXES=ON WITH_XI=ON WITH_XINERAMA=OFF WITH_XRANDR=ON WITH_XRENDER=ON WITH_XV=ON Build type: RelWithDebInfo CFLAGS: -fvisibility=hidden -fno-omit-frame-pointer -Wredundant-decls -fsigned-char -Wimplicit-function-declaration -Wno-jump-misses-init -fvisibility=hidden Compiler: GNU, 15.2.1 Target architecture:OS version connecting to (server side): Windows server 2022, version 21H2 build 20348.4773
Environment (please complete the following information):
- OS: Gentoo Linux
- Version/Distribution: [e.g. Debian 10, Windows 2008, Android 10]
- Architecture: amd64
Additional context Here is a quick patch which fixes the bug for me: 0001-fix-clipboard-issues.patch
But with the patch it is not possible to upload files to rdp server while downloading other file
Source: FreeRDP/FreeRDP