Commit Graph

130 Commits

Author SHA1 Message Date
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
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
Marc-André Moreau f1bd547580 Merge branch 'master' of github.com:FreeRDP/FreeRDP
Conflicts:
	client/X11/xf_client.c
2014-12-15 15:55:51 -05:00
Norbert Federa 5c68b1cf22 xfreerdp: fix RDP order color conversion
Note: /gdi:sw was working fine, this commit fixes /gdi:hw

* calculate color channel shifts based on X11 visual color masks
* fast path to skip conversion if visual color masks equal rdp color masks
* successfully tested 8/15/16/24/32 bpp rdp sessions on 16/24/32 bpp visuals
2014-12-15 16:34:09 +01:00
Marc-André Moreau e2f377ae11 libfreerdp-core: fix TSG thread shutdown and input freeze problem 2014-12-15 09:42:04 -05:00
Bernhard Miklautz 67b6cc7518 xfreerdp: clean up AuthenticationOnly
* removed dead code path: user name is always set now
* update message if no password was set
2014-12-08 18:13:54 +01:00
Bernhard Miklautz 2dca3f3356 xfreerdp: use login name if no user name was set
If no user name is set with /u:.. use the login name of the current user will be
used as user name.
2014-12-08 18:07:05 +01:00
Marc-André Moreau 53686e414a Merge pull request #2259 from erbth/master
fixed shutdown of input thread in xfreerdp
2014-12-08 10:01:27 -05:00
erbth 9f068ca0f7 fixed shutdown of input thread in xfreerdp 2014-12-05 21:48:24 +01:00
Norbert Federa 443ee42db5 gdi: don't pollute invalid region with empty rects 2014-12-05 19:47:29 +01:00
Marc-André Moreau d5414c33a5 Merge branch 'master' of github.com:FreeRDP/FreeRDP 2014-12-04 13:32:59 -05:00
Norbert Federa 415a0a158e xfreerdp: smart sizing fix
Standard format PictStandardRGB24 is not always available.
Use XRenderFindVisualFormat instead of XRenderFindStandardFormat
2014-12-04 17:52:54 +01:00
Marc-André Moreau 75e0e84130 Merge branch 'master' of github.com:FreeRDP/FreeRDP 2014-12-04 10:00:10 -05:00
Bernhard Miklautz 7b55c3a48e xfreerdp: fix formating - indentation 2014-12-03 18:23:20 +01:00
Bernhard Miklautz bd8c3f448e xfreerdp: fix a possible re-size race condition
In case of server side initiated desktop resize it could happen that the
client was "scaling" even if smart-sizing was disabled. The reason for
this was that the "scaled" width and height was set when the X Configure
event arrived but not in xf_desktop_resize.
2014-12-03 18:08:01 +01:00
Marc-André Moreau 01ac15a879 libfreerdp-core: fix crash on failed redirect 2014-12-03 11:48:27 -05:00
Norbert Federa 0e443484d8 xfreerdp: smart-sizing and software-gdi fixes
* fixed crash on server-initiated desktop resize and fullscreen toggle with /gdi:sw
* implemented desktop resize for /gdi:sw
* check for availibility of XRender extension and show error messages if a setting would require it
* fixed compile error if xrender devel packages are missing
* fixed bug with server-initiated desktop resize in fullscreen mode
2014-12-03 15:41:10 +01:00
Norbert Federa 25f66d2e6d xfreerdp: added smart sizing, mt gesture fixes
- removed setting ScalingFactor
- added settings SmartSizingWidth and SmartSizingHeight
- changed option /smart-sizing to optionally support <width>x<height>
- consolidated transformation of input event coordinates
- rdp8 gfx ignored scaling and panning offsets: fixed
- never resize window on panning/pinching
- simplified keyboard multitouch gesture debugging emulation
- disabled keyboard multitouch gesture emulation debug code via define
2014-12-01 11:56:44 +01:00
Norbert Federa 3fa3384eb4 xfreerdp: several fixes for panned/pinched drawing
- use bilinear filter instead of nearest filter
- fixed invalid transformation matrix
- support non-proportional scaling
- fix calculation of transformed coordinates (rounding errors)
2014-12-01 11:17:16 +01:00
Marc-André Moreau 1225c6b5ce xfreerdp: separate app windows from desktop windows 2014-11-11 22:27:33 -05:00
Marc-André Moreau d955851052 xfreerdp: remove RAIL dependency on deprecated event system 2014-11-11 18:32:18 -05:00
Marc-André Moreau f3d1830eb4 xfreerdp: partially migrate RAIL to callback interface 2014-11-11 17:49:29 -05:00