Commit Graph

501 Commits

Author SHA1 Message Date
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 bd82084505 Extend In/Outbound text,file,image restriction respectively
It supports the extended configurations for sesman.ini:

Before:

  [Security]
  RestrictOutboundClipboard=true or false

After:

  [Security]
  RestrictInboundClipboard=[true or false | text or file or image | comma separated list]
  RestrictOutboundClipboard=[true or false | text or file or image | comma separated list]

Above configuration is disabled by default (false)
And it can be specified comma separated list like this:.

  RestrictInboundClipboard=file, image
  RestrictOutboundClipboard=text, file, image

Note that if RestrictOutboundClipboard=true,file is set,
file is ignored and it is treated as RestrictOutboundClipboard=true

It is same for RestrictInboundClipboard.
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 a49144be73 Avoid deadlock in clipboard copy code 2021-10-25 16:16:59 +01:00
matt335672 b87b7f9ee8 Add xfuse_path_in_xfuse_fs() 2021-10-25 16:16:54 +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 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 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
matt335672 8e9fb8008f Addressed review comments 2021-09-08 11:51:21 +01:00
matt335672 d32953c405 Parse DEVICE_ANNOUNCE header correctly 2021-09-08 11:33:43 +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 87bbfd96ca Use symbolic names for static virtual channel name strings 2021-06-08 14:11:17 +01:00
matt335672 3ea19ef0cd Create ms-rdpeclip.h and update ms-rdpbcgr.h 2021-06-08 14:11:17 +01:00
matt335672 eda01f0853 Fix chansrv unterminated streams 2021-05-28 10:57:12 +01:00
matt335672 52a52daddd Split development option into separate things 2021-05-28 10:57:12 +01:00
Alexandre Quesnel 52707ac686 Fixing formatting with astyle 2021-05-08 16:58:11 +00:00
matt335672 86c87b6f15 Move get_display_num_from_display to string_calls module 2021-04-13 12:16:00 +01:00
matt335672 e7cb5bd64a Allow DISPLAY=:0 for chansrv and in other modules 2021-04-13 12:15:26 +01:00
matt335672 741be5a4a2 Enable FUSE in cirrus build 2021-04-09 10:04:30 +01:00
aquesnel 0ec471b02d
Add detailed logging to libxrdp (#1742)
* Added s_rem(s) for getting the remaining bytes in a stream
* Added s_rem_out() macro
* Fixed 15bpp pointer error checking
* Combined the 512 and 2048 bit certificate sending  code paths
* Other detailed comments and logging added following MS-RDPBCGR
2021-02-04 10:11:54 +00:00
matt335672 8ab3a2e9f8 Bumped cppcheck version to 2.3
addressed resulting warnings
2020-12-31 11:27:14 +00:00
Khem Raj d4e9b0f637 correct the location of errno.h
Fixes build on musl

Signed-off-by: Khem Raj <raj.khem@gmail.com>
2020-12-22 23:11:50 -08:00
matt335672 0a1a8f40e5 Moved a lot of string funcs to string_calls module 2020-12-22 11:57:24 +00:00
matt335672 5523847540 Allow FuseMountName for chansrv to be absolute path 2020-12-21 12:36:31 +00:00
matt335672 7ddc43aeea Cosmetic fixes for minor issues 2020-12-14 11:35:31 +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
Alexandre Quesnel 12a0266f1e Use a single type for the fuse file handle callback context 2020-09-15 15:37:56 +00:00
matt335672 79b88d7f30
Merge pull request #1635 from matt335672/minus-c-option-chansrv
chansrv improved config support
2020-09-09 09:59:43 +01:00
Alexandre Quesnel a7462404d5 Adding casts for narrowing to pointer width for issue #1678 2020-09-08 21:04:02 +00:00
matt335672 edda1b064d chansrv improved config support 2020-09-08 16:58:03 +01:00
matt335672 aa0dbbae15 Added CHANNEL_NAME_LEN to ms-rdpbcgr.h 2020-04-27 15:01:56 +01:00
matt335672 617283eb34 Remove unnecessary g_malloc() call 2020-04-24 11:27:36 +01:00
matt335672 7ef01f7b0c Address memory allocation overflow security issues 2020-04-23 17:29:06 +01:00
matt335672 a2266f23f6 Allow a redirected drive device_id to be zero (Guacamole support) 2020-03-03 16:16:09 +00:00
matt335672 a3d429b4f7 Minor fixes to drive redirection 2020-03-03 16:14:24 +00:00
matt335672 77686bf832 Fix cppcheck 1.89+1.90 warnings 2020-01-30 10:36:23 +00:00
metalefty 6d7cce3d34
Merge pull request #1484 from matt335672/cppc-chansrv-pcsc
xrdp_pcsc: Fix cppcheck 1.82 + 1.90 warnings
2020-01-30 10:28:36 +09:00
Derek Schrock 72bece526b return from xfs_delete_xfs_fs if NULL 2020-01-27 21:15:09 -05:00
matt335672 70d78dfb6f Fix cppcheck 1.82 + 1.90 warnings 2020-01-17 11:18:46 +00:00
metalefty 627da8da3e
Merge pull request #1470 from matt335672/rename-includes
Move MS-defined constants into separate includes
2020-01-16 15:01:18 +09:00
matt335672 6f881d47d3 Rationalise ms- constants
Constants from MS documents (MS-RDPBCGR etc) moved out of
common/xrdp_constants.h into includes named after the documents.

Similar includes moved from sesman/chansrv to the common area.
2020-01-06 15:46:37 +00:00
Ilya Shipitsin 00f17c3ffc sesman/chansrv/chansrv_fuse.c: resolve double free found by cppcheck
sesman/chansrv/chansrv_fuse.c:1719:9: error: Memory pointed to by 'full_path' is freed twice. [doubleFree]
2020-01-06 13:38:02 +05:00
matt335672 3820d279e2 Added includes for C/POSIX types referenced in chansrv_fuse.h to chansrv_fuse.h 2019-12-22 12:37:38 +00:00
matt335672 3ef2e7ce49 CI Fixes 2019-12-05 16:44:52 +00:00
matt335672 4d8f2b5a31 Significant remote file system improvements
- Reimplemented inode store in separate module chansrv_xfs.[hc]
- Allowed atimes and mtimes to be written to Windows side
- Mapped file user write bit to (inverted) Windows FILE_ATTRIBUTE_READONLY bit
- Mapped file user execute bit to Windows FILE_ATTRIBUTE_SYSTEM bit
- Implemented improved security for remotely mounted drives
- Implemented USB device removal, allowing hot-plug/remove of memory sticks
- Fixed pagefile.sys breaking Ubuntu file browser
- Fixed write offset bug
- Allowed renaming of open files
- Improved reported error codes
- Fixed various memory leaks
- Addressed valgrind errors related to struct fuse_file_info pointers.
2019-12-05 11:41:32 +00:00
Jay Sorg d7b1f12d9b default rdpsnd audin off, can enable with --enable-rdpsndaudin 2019-10-22 22:48:15 -07:00
Jay Sorg cf67dd56bf chansrv: no logic change, fix typo 2019-07-10 11:18:07 -07:00
Jay Sorg 417bb71abf chansrv: env var to disable rdpsnd record 2019-07-08 22:45:58 -07:00
Jay Sorg 933394c6be chansrv: remove excessive logging 2019-07-08 22:40:31 -07:00
Jay Sorg 8aedd31762 chansrv: use rdpsnd record if supported, else try AUDIO_INPUT(MS-RDPEAI) 2019-07-08 22:03:27 -07:00
Jay Sorg c5798df0bd chansrv: hook up audin 2019-07-08 18:25:59 -07:00
Jay Sorg ae40ff27c8 chansrv: audin close should chose channel 2019-07-07 22:05:46 -07:00
Jay Sorg a9a823b0da chansrv: audio in partial working 2019-07-04 23:52:18 -07:00
Jay Sorg 3c9241022a chansrv: add audin.c/h 2019-07-03 21:31:52 -07:00
Jay Sorg e14ea4ff2e chansrv: drop g_sent_flag, not very useful and some clients skip acks 2019-06-23 20:52:55 -07:00
Jay Sorg 4ad9e48ff5 chansrv: don't let audio fall behind 2019-06-22 23:01:13 -07:00
Koichiro IWAO ae2cbbb2e0
Fix build after #1327
Fixes #1335.

In file included from ./irp.h:27:
./chansrv_fuse.h:39:5: error: unknown type name 'time_t'
    time_t          atime;             /* Time of last access.              */
    ^
./chansrv_fuse.h:40:5: error: unknown type name 'time_t'
    time_t          mtime;             /* Time of last modification.        */
    ^
./chansrv_fuse.h:41:5: error: unknown type name 'time_t'
    time_t          ctime;             /* Time of last status change.       */
    ^
3 errors generated.
*** Error code 1
2019-04-18 14:25:46 +09:00
matt335672 6a6442e32f Fix sing symbol link error when --disable-fuse is set 2019-04-02 13:08:47 +01:00
matt335672 d154df5059 Add remote drive lookup functionality to fuse
- Replace xfuse_cb_enum_dir() directory callback for adding files with
  more general xfuse_devredir_add_file_or_dir() to be called from a
  directory or a lookup operation.
- Moved XRDP_INODE out of public interface for chansrv_fuse, and replaced
  with simpler struct file_attr to pass to
  xfuse_devredir_add_file_or_dir()
- Allow a struct file_attr to be placed in an IRP for assembly of file
  attributes over multiple IRP_MJ_QUERY_INFORMATION requats.
- Add dev_redir_lookup_entry() to public interface for devredir.c
- Add xfuse_devredir_cb_lookup_entry() callback to public interface for
  chansrv-fuse.c
2019-04-01 14:15:12 +01:00
matt335672 ef9013b4d9 Implement O_WRONLY option for open file
Allows files to be overwritten on Linux without EIO
Logging improved on failed write
2019-04-01 14:14:46 +01:00
matt335672 c43c9cd551 Code tidyups
- Remove unused 'is_synced' member from struct xrdp_inode
- Move prototype for xfuse_devredir_cb_write_file() to correct file
- Add const correctness to dev_redir_strings_ends_with() function
- Add const correctness to fuse_reverse_pathname() function
- Moved devredir_proc_cid_* functions out of devredir.h and made static
- Added XFUSE_DUMP_ADDED_ENTRIES maro for debugging
- Removed duplicate code path in xfuse_remove_dir_or_file()
- Removed duplicate code path in xfuse_cb_rename()
- Removed duplicate code path in xfuse_create_dir_or_file()
- Removed duplicate code path in xfuse_cb_open()
- Removed duplicate code path in xfuse_proc_opendir_req()
2019-04-01 14:14:22 +01:00
matt335672 c31b3b0dc2 chansrv_fuse.c tidyups
- Remove unused USE_SYNC_FLAG macro
- Remove unused members invoke_fuse, off, dirbuf1 from XFUSE_INFO
- Clear f_fifo_opendir entries on deinit
- Added some comments and fixed some others
2019-04-01 14:13:57 +01:00
metalefty ec05d4208d
Merge pull request #1298 from jaroslaw-osmanski/restrict-outbound-clipboard
Restrict outbound clipboard
2019-03-20 10:37:40 +09:00
Jaroslaw Osmanski 56fe961349 Fixed style and format issues. 2019-03-08 08:42:18 +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
matt335672 d49f405130 Add implementation of xfuse_deinit_xrdp_fs() 2019-02-26 13:22:30 +00: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
Koichiro IWAO 88f0d3114d
Fix build with FDK AAC v2
Original fix provided by takefu. See also:
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=233556
2018-11-28 01:31:14 +09:00
metalefty c2ade7a1f7
Merge pull request #1225 from savisko/devel
Fix crash of xrdp-chansrv process, issue #1202.
2018-10-18 10:49:09 +09:00
jsorg71 ae1514c167
dynamic virtual channel improvements
remove not used chansrv <-> xrdp messages
move static channel disable control into libxrdp
remove some blocking read, write chansrv calls
add drdynvc calls to libxrdp
add drdynvc calls to chansrv
channel cleanup
2018-10-11 22:09:20 -07:00
Michael Savisko 47d8e03d3a Fixed compilation warning in previous commit. 2018-10-11 13:51:59 +03:00
Michael Savisko ba93badf73 Fix crash of xrdp-chansrv process, issue #1202.
In xfuse_create_file_in_xrdp_fs insure that xfuse_fs is properly initialized.
2018-10-11 13:11:24 +03:00
Idan Freiberg 5d2c5b1410 chansrv: remove pulseaudio modules from xrdp source tree
its actually an independent code which is not part of xrdp
moved to its own repoistory: https://github.com/neutrinolabs/pulseaudio-modules

Signed-off-by: Idan Freiberg <speidy@gmail.com>
2018-08-03 06:12:53 +03:00
Koichiro IWAO ff85cb4530
Merge branch 'wfix-pulsechansrv-makefile' into devel 2018-08-03 10:05:46 +09:00
Brandon Wooldridge 8427c3601b Corrected spacing between arguments to `cc` for Pulseaudio chanserv Makefile 2018-08-02 15:24:46 -07:00
matt335672 c467ba6b04 Add handler for fatal X server conditions
Unless X server failures are caught, these can cause a premature
exit of chansrv, giving it no chance to clean up. This is currently a
particular problem for fuser mounts.
2018-07-19 08:16:29 +01:00
Koichiro IWAO 780ba744f6
Revert "devredir: fix xinode leak"
This reverts commit 5daa09171e.

Causes "double free". Fix #990 was not correct.

```
[1271363627]: DEV_REDIR  dev_redir_proc_device_iocompletion: 738 : entered: IoStatus=0x0 CompletionId=1
[1271363627]: DEV_REDIR  dev_redir_proc_device_iocompletion: 839 : got CID_DIRECTORY_CONTROL
[1271363627]: DEV_REDIR  dev_redir_proc_query_dir_response: 933 : processing FILE_DIRECTORY_INFORMATION structs
[1271363627]: DEV_REDIR  dev_redir_proc_query_dir_response: 968 : FileName:          .
[1271363627]: DEV_REDIR  devredir_fuse_data_peek: 1335 : returning 0x7f2a9c013410
*** Error in `/usr/sbin/xrdp-chansrv': double free or corruption (out): 0x00007f2a9c13a330 ***
```

Closes: #1025
2018-03-23 11:40:52 +09:00
Koichiro IWAO 5daa09171e
devredir: fix xinode leak
Pointed out by: #919
2018-01-12 09:24:03 +09:00
Dominik George 53eccc93a2 Simplify pulseaudio module build instructions 2017-12-26 19:06:36 +09:00
Koichiro IWAO 93481365d1 pulse: replace old pulse notes with bran-new README 2017-12-26 09:26:51 +09:00
Koichiro IWAO 929a7c359d chansrv: add LOG_LEVEL_TRACE here, too 2017-11-12 22:27:46 +09:00
Koichiro IWAO 3d29b6ec76 sound: g_bbuf_size should be determined after codec is determined
Fixes #910, if both client and server support more than one codecs,
g_bbuf_size might be set to wrong value.
2017-11-08 08:57:52 +09:00
Jay Sorg d9b929c185 chansrv: sound, fdk-aac, avoid 1 item array items 2017-08-04 17:24:57 -07:00
Jay Sorg 152318ad7c use pkg-config to configure with fdk-aac 2017-08-04 17:24:57 -07:00
Jay Sorg 4f91a52109 chansrv: sound, remove a do not know and a comment 2017-08-04 17:24:57 -07:00
Jay Sorg 021a78f4c6 chansrv: sound, use WAVE_FORMAT_AAC not WAVE_FORMAT_AAC_MS 2017-08-04 17:24:57 -07:00