Commit Graph

101 Commits

Author SHA1 Message Date
Koichiro Iwao e070902310
clipboard: tidy up bmp file header assembly
Sponsored by:   Krämer Pferdesport GmbH & Co KG
2024-06-18 11:13:40 +09:00
Koichiro Iwao 4968a34cd6
clipboard: fix a bug when pasting image to LibreOffice
While here, embed correct file size in BMP file header.

Fixes:          #3102
Sponsored by:   Krämer Pferdesport GmbH & Co KG
2024-06-17 21:08:30 +09:00
matt335672 f8e7fd4c2c Update clipboard code to use new UTF-8 calls 2023-10-23 14:15:47 +01:00
firewave f687174af1 provide more includes to Cppcheck
- added (temporary) suppression of Cppcheck `shiftTooManyBits` false positives in `libxrdp/xrdp_mppc_enc.c`
- added (temporary) suppression of Cppcheck `uninitMemberVar` true positives in `ulalaca/ulalaca.cpp` until fixes land downstream
- fix Cppcheck `nullPointerRedundantCheck` in `sesman/chansrv/clipboard.c`
- fix Cppcheck `syntaxError` in `fontutils/mkfv1.c` because it doesn't see the `freetype/fterrors.h` header / removed astyle workaround
2023-10-17 15:14:36 +02:00
matt335672 284c17c0b2 Remove client-server shortcut paste code
When significant amounts of data is coming from the client in a
fragmented CLIPRDR_DATA_RESPONSE PDU, this code provides a way to
start copying it to a requesting client before it is all read.

The only advantage of this code is to provide a slight speedup
before a paste is visible on the server.

There are significant problems with this code. Notably, it is
very difficult to parse Unicode text coming through this route. Each
UTF-16 character can occupy up to 4 bytes, and a fragmentation
boundary could occur at any point within a UTF-16 character.
2023-09-29 12:07:19 +01:00
matt335672 84ae372a58 clipboard: Fix TODO action in clipboard_common.h
Use the official Windows clipboard format names where appropriate

Replace g_file_format_id with g_file_group_descriptor_format_id
as the latter name is more descriptive of what is described in
[MS-ECLIP]
2023-08-07 15:11:04 +01:00
matt335672 8eed7a395e clipboard: Only advertise text to X11 clients if it is available 2023-08-07 15:11:04 +01:00
matt335672 45ca9fe098 clipboard: Tell the X11 client if a selection is unavailable 2023-08-07 14:45:11 +01:00
matt335672 e6c098e750 Remove s_check() macro 2022-02-09 10:18:15 +00:00
matt335672 cffce1f856 Only advertise X11 clip formats we can supply 2022-01-14 11:11:03 +00:00
Kentaro Hayashi 1d6d80d14f Block inbound clipboard text/image/file respectively
Disable clipboard_event_selection_request call is overkill for
blocking text/image/file purpose.
For example, it breaks existing behavior (slow response from gedit,
gimp as a side effects)

Instead, in clipboard_event_selection_request, these media format will
be blocked respectively which depends on the following configurations
in sesman.ini [Security] section.

  * RestrictInboundClipboard=text
  * RestrictInboundClipboard=file
  * RestrictInboundClipboard=image

You can also set comma separated list.

  * RestrictInboundClipboard=text,file,image
2022-01-14 10:17:02 +09:00
Kentaro Hayashi fb1c4ec945 Block outbound clipboard text/image/file respectively
RestrictOutboundClipboard kills all of test/file/image
transfer via clipboard.

For controlling each content type behavior,
clipboard_xevent is not appropriate place to block respectively.

Instead, in clipboard_event_selection_notify, these media type
will be blocked which depends on the following configurations in
sesman.ini [Security] section.

  * RestrictOutboundClipboard=text
  * RestrictOutboundClipboard=file
  * RestrictOutboundClipboard=image

You can also set comma separated list

  * RestrictOutboundClipboard=text, file, image
2022-01-14 10:17:02 +09:00
Kentaro Hayashi 53027ad5af Use LOG instead of LOG_DEVEL
According to https://github.com/neutrinolabs/xrdp/wiki/Logging,
it may be better to emit this log message because this log is
useful for system administrator to know whether RestrictOutboundClipboard
configuration works or not

And raise log level to info because it is informative for system
administrator.
2021-12-23 12:58:35 +09:00
Kentaro Hayashi 23906383b6 clipboard: Fix wrong debug level log message for g_file_atom2
As g_file_atom2 is x-special/gnome-copied-files
(See g_file_atom2 definition in sesman/chansrv/clipboard.c),
it should be "x-special/gnome-copied-files" in this context.

Signed-off-by: Kentaro Hayashi <hayashi@clear-code.com>
2021-12-06 12:40:41 +09:00
matt335672 2dbec63327 Add Nautilus 3 compatibility 2021-09-16 10:02:02 +01: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 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
matt335672 edda1b064d chansrv improved config support 2020-09-08 16:58:03 +01:00
Jaroslaw Osmanski 7d7e8184ae Use CHANSRV_RESTRICT_OUTBOUND_CLIPBOARD env between sesman -> chansrv 2019-03-02 16:53:15 +01:00
Jaroslaw Osmanski 1b6bfa682c Log when outbound copy was rejected because RestrictOutboundClipboard was set 2019-03-01 14:49:57 +01:00
Jaroslaw Osmanski 46c33ddaf4 Read sesman config in clipboard 2019-02-26 11:36:32 +01:00
Krzysztof Adamski 751cd97018 reapply outboud-resitrcted clipboard 2019-02-26 07:40:17 +01:00
Jaroslaw Osmanski 0d8a49ab13 astyle formatting for sesman config.h and chansrv clipboard 2019-02-26 07:40:10 +01: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
Szabolcs Seláf bf4c32c862 Fix calling XChangeProperty in clipboard provide
XChangeProperty's last parameter is number of elements, not number of bytes as it's in https://tronche.com/gui/x/xlib/window-information/XChangeProperty.html
Because of this bug Paste did not work in any java applications.
2017-01-17 15:18:23 +01:00
Pavel Roskin aeeb3d2c2e Fix warnings detected by -Wwrite-strings 2016-07-08 04:29:42 +00:00
Pavel Roskin 77b380c0b5 Fix format warnings in log_message() calls 2016-06-21 16:30:16 -07:00
Pavel Roskin 0dd0426e6f Check XGetWindowProperty() return code in clipboard_event_property_notify() 2016-05-06 18:31:03 -07:00
Pavel Roskin ca9cbcafc8 Typo fixes 2016-05-04 23:33:30 -07:00
Pavel Roskin e65bd6b7d7 Fix more format warnings 2016-04-21 21:21:17 -07:00
Pavel Roskin 92a6833e9b Fix typos 2016-02-13 20:41:07 -08:00
Pavel Roskin 986fa94733 clipboard: undefine previously defined log level 2016-01-30 18:01:12 -08:00
Pavel Roskin 964e860072 Run through codespell 2016-01-14 08:47:50 -08:00
Laxmikant Rashinkar 023c0b5bc1 coverity: fixed out of bounds read-write 2014-07-20 11:11:20 -07:00
Jay Sorg ef51e44119 chansrv: handle smartcard session reconnect and some logging changes 2013-12-07 17:57:35 -08:00
Jay Sorg c1b7cbd657 merges from authentic8 2013-09-26 11:28:07 -07:00
Jim Grandy b3ee3cbd4b Another merge error in sesman/chansrv/clipboar.c 2013-08-22 13:58:43 -07:00
Jim Grandy 72ec05d37e fix merge error in sesman/chansrv/clipboard.c 2013-08-22 13:50:04 -07:00
Jim Grandy a308d2e25c Fix errors cause by previous merge (2361914) 2013-08-22 12:57:00 -07:00
Jim Grandy b7b3d9ef28 Hand-apply patches (misc) from Authentic8: b18667d 6d22ada 95d93a3 433b49c b96f85f 8c32c46 f87f6b3 c93cce0 26ce9ce 2013-08-22 12:56:51 -07:00
Laxmikant Rashinkar 09dd58c5e1 clipboard: enabled module logging 2013-08-14 20:00:52 -07:00
Jay Sorg 29420b3134 chansrv: no logic change, work on warning 2013-07-02 00:45:40 -07:00
Jay Sorg 0aa3dbe738 chansrv: no logic change, EOL and coding style cleanup 2013-06-23 14:17:59 -07:00
Lukas Vacek e7fe39a65b Fix sound and clipboard crashes
- In case clipboard is not initialized, clipboard_data_in returns
    (fixes a segfault)
- If less than 4 bytes are sent to sound_send_wave_data_chunk, it
  returns
    (fixes a segfault)
- When sending sound initiliazation messages set g_chan in chansrv to 0,
  so the server waits for client to reply (this makes sound work afte
  reconnecting)
- In process_message_channel_setup, clear any leftover data in
  chan_items
2013-06-22 21:57:16 +01:00