Commit Graph

150 Commits

Author SHA1 Message Date
Roland Kaufmann 6ca8962045 Map logical to physical mouse button events
RDP expects to receive an indicator of the physical mouse button that
was pressed on the client, whereas X11 deliver a value for which
logical mouse button that was pressed.

This patch introduces a (reverse) mapping from logical mouse buttons to
physical mouse buttons, so that the RDP server can do correct mapping
for the event on its end.

However, no actual mapping is done here; this patch just introduces the
framework to do so. Thus, there should be no behavioural change from
this patch alone.

There is an implicit assumption that only the first three buttons are
mapped to eachother. Enabling more a general mapping would require
extensive changes to the event handling as fourth logical button and
up is used for special functionality such as wheel.
2015-12-15 17:42:05 +01:00
Hardening 57fe581b16 Merge pull request #2824 from bjcollins/nla_auth_exit_code
Return FREERDP_ERROR_AUTHENTICATION_FAILED on an authentication failure
2015-12-08 22:46:29 +01:00
Norbert Federa 3eee70b164 Merge pull request #2926 from bjcollins/rail_fixes
Rail fixes
2015-11-06 13:34:42 +01:00
Norbert Federa a4580923e7 xfreerdp/clipr: fix self owned test and hardening
- xf_cliprdr_is_self_owned() lied if multiple xfreerdp instances were
  running.
- fixed a few unchecked callocs
- added/modified and handled some return values in compliance with
  the new hardened channel api
2015-10-20 21:28:29 +02:00
bjcollins 8e27b6d05e RemoteApp Support
1. Remove all uses of "localWindowOffsetCorr" variables, they added an extra layer of complexity and they are not actually needed to handle coordination of window position/size between
the local coordinate system and the remote one. This logic was causing issues in the case where the window was moved off the left side of the screen.

2. Update the xf_setWindowVisibilityRects function to offset the visibility rects as necessary when the window is hanging off the left side of the screen.

3. Stop sending mouse events when doing keyboard moves/sizes(as desired), and stop sending two mouse events for non-keyboard moves/sizes

4. Move location of new UTF8_STRING variable from previous commit

5. Refresh window and window shape for any window position/size updates, this helps keep the local and server windows in sync and works around some race conditions
2015-10-15 18:41:55 -05:00
bjcollins cb4e4cf6fc Store Miscellaneous X11 Atoms into variables to match how we handle other X11 Atoms. 2015-10-15 14:59:53 -05:00
bjcollins 6d3565bd4c Fix xf_rail_paint fencepost error
The regions used to store and calculate the invalidRegion are exclusive
of the bottom and right edges, not inclusive.

Fixes "mouse droppings" in mspaint.exe when moving the mouse leftwards
across the canvas.
2015-10-15 14:29:48 -05:00
bjcollins 7fbc7e45a7 Clean up NLA authentication failure handling code
1. Make use of freerdp_set_last_error to set authentication failure without the helper functions
2. Rename ssl callback function
3. Break out AuthenticationOnly exit handling from bad connect handling
2015-09-15 14:07:14 -05:00
bjcollins 32a1406dc4 Return FREERDP_ERROR_AUTHENTICATION_FAILED on an authentication failure
when using NLA with xfreerdp.
2015-09-15 14:07:14 -05:00
Martin Haimberger 52405a3e79 Remove WIN32ERROR type
All return values are UINT now.
2015-08-27 05:38:20 -07:00
Martin Haimberger 2862109337 Merge remote-tracking branch 'upstream/master' into mh-channel-fix
Conflicts:
	channels/smartcard/client/smartcard_main.c
	channels/smartcard/client/smartcard_operations.c
2015-07-30 07:29:12 -07:00
MartinHaimberger 45f9519b58 Merge pull request #2723 from akallabeth/pwd_from_stdin
New /from-stdin
2015-07-15 14:12:13 +02:00
Martin Haimberger 6ab0187d84 Merge remote-tracking branch 'upstream/master' into mh-channel
Conflicts:
	channels/audin/client/oss/audin_oss.c
	channels/drive/client/drive_main.c
	channels/printer/client/printer_cups.c
	channels/printer/client/printer_main.c
	channels/rail/client/rail_main.c
	channels/rdpgfx/client/rdpgfx_main.c
	channels/rdpsnd/client/oss/rdpsnd_oss.c
	channels/remdesk/client/remdesk_main.c
	channels/remdesk/server/remdesk_main.c
	channels/tsmf/client/tsmf_media.c
2015-07-15 01:57:07 -07:00
Bernhard Miklautz f589d5d6e0 x11: reorder xf_post_disconnect
Channels like EGFX need resources like the main window in order to
work correctly. Before the window, GDI,.. is freed it needs to be
ensured that all channels are stopped properly to prevent them to access
already freed resources. Disconnecting the channels first fixed a
possible race condition/SEGFAULT that could occur with remote initiated
disconnects.
2015-07-14 15:28:55 +02:00
Bernhard Miklautz 68e8569110 winpr/synch: remove the dependency on winsock.h
winsock.h pulls in a lot of defines and dependencies that are not
required and partially unwanted in winpr's core (for parts that are not
related to network). In order to get rid of this dependency and have an
independent defines for extended winpr functions the WINPR_FD_* defines
are used internally (and for exposed functions). Where required, like in
WSAEventSelect, the FD_* is mapped to WINPR_FD_*.
2015-07-14 11:39:41 +02:00
Armin Novak 4e7c03fabf Added error checks and resource cleanup. 2015-07-03 11:26:22 +02:00
Armin Novak d18b0fbeb4 Handle API updated. 2015-07-03 09:52:52 +02:00
Armin Novak 5a5ed77c57 Added /from-stdin 2015-06-23 14:59:54 +02:00
David FORT 7c3f8f33ab Fixes for malloc / calloc + other fixes
This patch contains:

* checks for malloc return value + treat callers;
* modified malloc() + ZeroMemory() to calloc();
* misc fixes of micro errors seen during the code audit:
** some invalid checks in gcc.c, also there were some possible
integer overflow. This is interesting because at the end the data are parsed
and freed directly, so it's a vulnerability in some kind of dead code (at least
useless);
** fixed usage of GetComputerNameExA with just one call, when 2 were used
in misc places. According to MSDN GetComputerNameA() is supposed to return
an error when called with NULL;
** there were a bug in the command line parsing of shadow;
** in freerdp_dynamic_channel_collection_add() the size of array was multiplied
by 4 instead of 2 on resize
2015-06-22 19:21:47 +02:00
Bernhard Miklautz d9d1759abc Fix compiler warnings:
gcc 4.7.2

client/X11/xf_keyboard.c: In function ‘xf_keyboard_action_script_init’:
client/X11/xf_keyboard.c:48:6: warning: unused variable ‘exitCode’
[-Wunused-variable]

gcc 4.9

client/X11/xf_client.c: In function ‘xf_client_thread’:
client/X11/xf_client.c:1537:3: warning: ‘inputThread’ may be used
uninitialized in this function [-Wmaybe-uninitialized]
2015-06-22 19:09:59 +02:00
Bernhard Miklautz bf73f4e4f1 Fix unchecked strdups
* add missing checks
* adapt function return values where necessary
* add initial test for settings
2015-06-22 19:09:59 +02:00
Martin Haimberger 6e4e1c2773 Merge remote-tracking branch 'upstream/master' into mh-stream-fix
Conflicts:
	client/Windows/wf_cliprdr.c
2015-06-18 03:06:40 -07:00
Martin Haimberger b9853f87eb channel encomsp hardend 2015-06-18 03:04:32 -07:00
Norbert Federa f04bb6c53d xfreerdp: xfc->palette wasn't updated with /gdi:sw
When using software gdi (/gdi:sw) the rdp update PDU callback
gdi_palette_update() is used which writes the new colors to
the rdpContext's gdi->palette buffer.
The X11 functions however access xfc->palette which gets only
updated by xf_gdi_palette_update() which is the callback if
/gdi:hw is used.

This commit changes xfc->palette to a pointer which points to
xfc's private buffer with /gdi:hw or to the gdi->palette if
software gdi is used.
2015-06-11 18:40:41 +02:00
David FORT 12f873f1f9 Fixed MessageQueue and callers 2015-05-29 14:24:14 +02:00
Norbert Federa 1b5abec683 client/x11: fixed if statements with empty body 2015-05-17 18:24:11 +02:00
Norbert Federa 71a4349928 fixed multiple missing gdi return value checks
mainly gdi_Create* functions
2015-05-08 21:39:23 +02:00
David FORT 0e2925d0b8 Fix remoteApps
The assert that have been removed were preventing RAIL from working when you
have an intermediary screen before seeing the application.
2015-05-07 14:36:07 +02:00
Norbert Federa 25fc866a58 Fix unchecked CreateThread calls and misc fixes 2015-05-05 13:55:48 +02:00
Norbert Federa ef1fd12b15 Fix unchecked CreateEvent calls and misc fixes
1)
Added missing checks for CreateEvent which also required the
following related changes:

- changed freerdp_context_new API to BOOL
- changed freerdp_peer_context_new API to BOOL
- changed pRdpClientNew callback to BOOL
- changed pContextNew callback to BOOL
- changed psPeerAccepted callback to BOOL
- changed psPeerContextNew callback to BOOL

2)
Fixed lots of missing alloc and error checks in the
changed code's neighbourhood.

3)
Check freerdp_client_codecs_prepare result to avoid segfaults
caused by using non-initialized codecs.

4)
Fixed deadlocks in x11 caused by missing xf_unlock_x11() calls
in some error handlers

5)
Some fixes in thread pool:
- DEFAULT_POOL assignment did not match TP_POOL definition
- don't free the pool pointer if it points to the static DEFAULT_POOL
- added error handling and cleanup in InitializeThreadpool
2015-04-29 18:18:39 +02:00
Hardening 6cd7713e12 Merge pull request #2544 from bmiklautz/boolenization
change return types of callbacks to BOOL
2015-04-22 11:01:27 +02:00
Bernhard Miklautz 515502ffa5 change return types of callbacks to BOOL
* change all client/server callbacks to BOOL
* update all clients accordingly
* add multiple return value checks
* small fixes
2015-04-21 14:18:07 +02:00
Armin Novak d3336340ba Add *get_event_handles handle count, return check. 2015-04-21 12:24:50 +02:00
Norbert Federa fd5f47428b xfreerdp: fixed initial smart-sizing dimensions
The window width/height variables and in turn SmartSizingWidth/Height
get automatically updated in th the configure notify event handler.
If the window is created initially the values don't differ from the
event values and therefore SmartSizing was not applied until the
window was resized.
2015-04-16 23:54:56 +02:00
Norbert Federa bad2f138c1 xfreerdp: FS fixes & smart-sizing resuscitation
- make smart-sizing work again which was killed in previous commits
- removed several unnecessary/ugly workarounds
- miscellaneous small fixes
- new feature: restore previous window position when toggling out of
  fullscreen mode
- new feature: if /f is specified in combination with /smart-sizing:WxH
  we run the session in the /smart-sizing dimensions scaled to full screen
2015-04-16 17:31:22 +02:00
Norbert Federa eb14ab15f5 xfreerdp: removed some weird/unnecessary code 2015-04-16 17:31:22 +02:00
Norbert Federa 98505a0234 xfreerdp: removed desktopWidth/desktopHeight vars
These were basically unused (from the contexts's point of view)
and only served as temporary storage
2015-04-16 17:31:22 +02:00
Norbert Federa 6354a7561c xfreerdp: rename xf_context's width height vars
Since several contributers in the past repeatedly made the error
to treat xfc->width and xfc->height as equal with the x11 window
width and heigth I've renamed these variables to sessionWidth and
sessionHeight.
2015-04-16 17:31:22 +02:00
bjcollins d4a9a2d3a8 Remove override redirect flag for fullscreen with keyboard grab enabled. Window manager should always know about the main window.
Small cleanup of passing around decorations flag.
Limit PercentScreen to single monitor vs. entire desktop. IMO - this is better behavior in a multimonitor environment.

Handle fullscreen windows better:
1. Ensure that size hints are set to allow resizing before setting a window to fullscreen as some window managers do not behave properly.
2. Handle fullscreen toggles without destroying and recreating window.
3. Use NET_WM_STATE_FULLSCREEN Extended Window Manager Hint for fullscreen functionality
4. Use the NET_WM_FULLSCREEN_MONITORS Extended Window Manager Hint when appropriate
5. When a single monitor fullscreen is requested - use the current monitor(as determined from mouse location)
6. Handle cases where there is no local monitor at coordinate 0,0. The Windows server expect there to be a monitor at this location, so we maintain offset if necessary between our local primary monitor and the server side primary monitor located at 0,0.
2015-02-23 11:22:28 -06:00
Marc-André Moreau 9b9fbd2ab1 xfreerdp: fix fullscreen mode 2015-02-10 15:15:30 -05:00
Marc-André Moreau b025d83919 Merge pull request #2374 from bjcollins/master
Apply correct exit code to xfreerdp application for certain log offs
2015-02-10 10:41:10 -05:00
bjcollins bb87599f80 Apply correct exit code to xfreerdp application for log off from certain flavors of Windows. 2015-02-09 17:15:07 -06:00
Armin Novak b4db02867a Fixed resource cleanup on disconnect. 2015-02-09 17:33:55 +01:00
Marc-André Moreau 82d58086db xfreerdp: partial reconnect fixes 2015-02-05 17:01:56 -05:00
Marc-André Moreau 7c6948cd5c xfreerdp: make use of freerdp_get_event_handles 2015-01-30 09:47:02 -05:00
Marc-André Moreau 9bc32c2a85 Revert "Moved channel loading, now only loading before connect."
This reverts commit f7756efca6.
2015-01-20 10:15:37 -05:00
Armin Novak f7756efca6 Moved channel loading, now only loading before connect. 2015-01-20 12:13:08 +01:00
Armin Novak 5bc1e41109 Using freerdp_channels_disconnect now. 2015-01-20 11:24:58 +01:00
Armin Novak 7dda510dda Resetting disconnect flag on client start.
Fixed initialisation of variable to avoid NULL dereference.
2015-01-13 12:43:27 +01:00
Armin Novak 524e4635fd Fixed typos.
gdi_free now done on disconnect.
2015-01-13 12:00:51 +01:00