Commit Graph

12708 Commits

Author SHA1 Message Date
ilammy
9292b2231f xfreerdp: set _NET_WM_ICON to RAIL app icon
Icons on X11 windows are configured using the _NET_WM_ICON property
described in Extended Window Manager Hints. Here we implement converison
from DIB bitmaps used by RAIL to the format expected by _NET_WM_ICON,
and actually set the icon for RAIL app windows.

Both DIB format and _NET_WM_ICON (or rather, Xlib) are weird. Let's
start with RAIL's format. That's the one used in BMP and ICO formats
on Windows. It has some strange properties but thankfully FreeRDP's
freerdp_image_copy() can handle most of them for us. (With an exception
of monochrome and 16-color formats that it does not support. Sorry, but
I'm too lazy to fix them. They are not seem to be used by any real
application either.) The one thing that it can't do is to apply the
alpha transparency bitmask so we have to do it manually. This instantly
reminds us that DIB format has HISTORY: it's vertically flipped and
each must be padded to 4 bytes. Both these quirks having reasonable
(for a certain definition of 'reason') explanations. Such is life.
(Also, 8-bit images require a color palette which we must fill in.)

So okay, now comes _NET_WM_ICON. It is more sane (or rather, easier to
deal with). The bitmap is represented with a tiny [width, height] header
followed by an array of pixels in ARGB format. There is no padding, no
weird color formats. But here's a catch: you can't simply take the
output of freerdp_image_copy() and cast to (unsigned char*) of colors.
We have to allocate an array of C's longs and copy the pixels there,
because that's what Xlib expects (and this is mentioned in the spec).
Simply casting an array of bytes causes crashes on 64-bit systems.
So don't try to cheat or "optimize" and read the docs, kids.

Note that XFlush() call after XChangeProperty(). It's there because it
seems to helps see the icon quicker with Unity on Ubuntu 14.04. I don't
know why. (And Unity does not support _NET_WM_ICON officially. But it
sorta kinda works sometimes.)

Oh, and while we're here, delete some old, unused, and commented out
code that was setting window icons in the past. It's not needed anymore.
2018-11-14 10:53:45 +01:00
ilammy
8163b6d1ce xfreerdp: add RAIL icon cache
This commit adds a cache for RAIL application icons. It is (surpisingly)
used to cache icons for remote applications. This mechanism is described
in MS-RDPERP 3.1.1.2 Icon Cache Support and related items.

Note that some (actually, most) of the icons are not cached. These are
marked with CacheId == 0xFF. In order to keep the code clean we do not
introduce a special case and instead use a 'scratch' icon and simply
pretend to return an xfRailIcon from cache.

We're going to set icons via _NET_WM_ICON property which explains
why we use "long" values to store pixel data. The icon conversion
is not implemented in this commit, it's only stubs.

However, we do implement processing of window information orders that
contain new icons or cached references to previously sent icons. Note
that it is important to not fail (i.e., to not return FALSE) if we
cannot find a window for the icon by its ID. The server occasionally
likes to be slow or something and send icon updates for nonexistent
windows. This behavior is mandated by the spec, too:

    MS-RDPERP 3.2.5.1.6 Processing Window Information Orders

    Upon receipt of a Window Information Order for an icon or
    cached icon, as specified in sections 2.2.1.3.1.2.2 and
    2.2.1.3.1.2.3, the client SHOULD locate the local RAIL window
    that corresponds to the WindowId reported in the Hdr field
    and apply the icon updates to the RAIL window. If no such
    window can be found, the client SHOULD ignore the order.

Indeed, we silently ignore such orders now.
2018-11-14 10:53:45 +01:00
ilammy
7a2b6e1301 libfreerdp-core: fix reading TS_ICON_INFO
The spec says that CbColorTable field is present when Bpp is 1, 4, 8.
Actually, bpp == 2 is not supported by TS_ICON_INFO according to the
spec (though, DIB definitely supports 16-color images).

    MS-RDPERP 2.2.1.2.3 Icon Info (TS_ICON_INFO)

    CbColorTable (2 bytes):
        This field is ONLY present if the bits per pixel (Bpp)
        value is 1, 4, or 8.

Omitting 8-bit value breaks 256-color icons which are incorrectly
read with color and alpha data mixed up.
2018-11-14 10:53:45 +01:00
Armin Novak
138eb13fea Updated RDP_VERSION definitions. 2018-11-14 10:14:48 +01:00
Mathew Winters
f91a4d0b6e Resolve thread not exiting when remote lost or disconnected. 2018-11-14 15:25:38 +13:00
akallabeth
ca6d1d5919
Merge pull request #5005 from bmiklautz/nightly_build
fix [rpm/freerdp-nightly]: build dependencies
2018-11-13 14:39:39 +01:00
Bernhard Miklautz
bbd6a3e6c2 fix [rpm/freerdp-nightly]: build dependencies
Depend on libswresample-devel not libavresample-dev.
This reverts the behavior introduced in
fbe95209e7.
2018-11-13 13:59:41 +01:00
Armin Novak
ecac998340 Fixed rdg bio cleanup.
When attaching the RDG BIO to the TLS BIO also transfer ownership.
2018-11-13 12:22:09 +01:00
Armin Novak
3c35a098f5 Fixed direct rdg front bio access. 2018-11-13 11:24:04 +01:00
Armin Novak
e070bbea8d Fixed leaks in rdg_send_channel_create 2018-11-13 11:22:37 +01:00
Armin Novak
342ff8cf0b Fixed broken server name packet size 2018-11-13 11:22:37 +01:00
Armin Novak
15a41586a8 Don't read content length in VIRTUAL_CONNECTION_STATE_OUT_CHANNEL_WAIT 2018-11-13 11:22:37 +01:00
Armin Novak
90d2e42600 Fixed ntlm_authenticate, split return from continue flag. 2018-11-13 11:22:37 +01:00
Armin Novak
4e0b4d7096 Fixed static INT_MAX checks, replaced with assert. 2018-11-13 11:22:37 +01:00
Armin Novak
398a33af63 Fixed all warnings in rdg module
Fix all missing range checks and warnings.
2018-11-13 11:22:37 +01:00
Armin Novak
9078b0deb9 Fixed extern declaration of rpc_bind p_uuid_t variables. 2018-11-13 11:22:37 +01:00
Armin Novak
b4fc0c75ce Made rdpRdp opaque 2018-11-13 11:22:37 +01:00
David Fort
b6e6575bf6 license: support CAL license
This patch simplifies the licensing code mutualizing encryption / decryption
routines. It also adds the support for client_info packet that allows to send a
previously saved CAL file.
2018-11-13 09:42:19 +01:00
Martin Fleisz
097ac0ee13
Merge pull request #4997 from akallabeth/use_bio_free_all
Replaced BIO_free with BIO_free_all
2018-11-12 13:55:36 +01:00
Armin Novak
738aa56233 Fixed #4995: Don't forget to send the NULL of the clipboard string. 2018-11-12 08:40:54 +01:00
Bernhard Miklautz
c5c1bac31a
Merge pull request #4960 from akallabeth/interleaved_fix
Fixed #4954: Check destination buffer bounds.
2018-11-09 12:25:55 +00:00
Armin Novak
fff2454ae6 Make VS2010 happy, reworked UNROLL defines. 2018-11-09 12:18:51 +01:00
Armin Novak
6e61dd9d9f Unroll bBits loops as well. 2018-11-09 12:12:19 +01:00
Martin Fleisz
6d6a2959c2
Merge pull request #4968 from akallabeth/timezone_updates
Simplified timezone update handling:
2018-11-09 12:07:43 +01:00
Martin Fleisz
a7f0da2440
Merge pull request #4961 from akallabeth/align_malloc_fix
Fixed #2039: Check for overflow in calculations.
2018-11-09 11:58:04 +01:00
Armin Novak
7e932bbfa2 Readded loop unrolling. 2018-11-09 11:32:28 +01:00
Armin Novak
71036fe0b2 Fixed #2039: Check for overflow in calculations. 2018-11-09 10:50:53 +01:00
Mathew
2ff19597dc fix scripts to build with ndk r15c,
cache dependancies so we are not hitting github often
update android dependancies to latest and compile.
./android-build-freerdp.sh --ndk ~/Programming/android-ndk-r15c --relWithDebug --jpeg
Still an error compiling openh264
2018-11-09 15:20:52 +13:00
Armin Novak
cf8bc72dc4 Fixed profiler naming in tests. 2018-11-08 17:43:50 +01:00
Armin Novak
9e2c203771 Fixed various issues with freerdp_bitmap_compress and interleaved_compress 2018-11-08 17:21:28 +01:00
Armin Novak
c0c1d064be Added a unit test for interleaved codec compression. 2018-11-08 17:20:31 +01:00
Martin Fleisz
9400bdccdb
Merge pull request #4996 from bmiklautz/tls_security_level
new [crypto/tls]: add support to set tls security level
2018-11-08 15:33:40 +01:00
Armin Novak
5f4843191b Replaced BIO_free with BIO_free_all
There is no point in using BIO_free with a custom recursion
to free up stacked BIOs if there is already BIO_free_all.
Using it consistently avoids memory leaks due to stacked BIOs
not being recursively freed.
2018-11-08 12:09:49 +01:00
Bernhard Miklautz
8be6ec9720 fix [cmdline]: parameter parsing
use strtoul instead of strtol
2018-11-08 11:13:57 +01:00
Bernhard Miklautz
1222e7060b new [crypto/tls]: add support to set tls security level
The newly introduced option /tls-seclevel can be used to set the tls
security level on systems with openssl >= 1.1.0 or libressl.
As default level 1 is used as higher levels might prohibit connections
to older systems.
2018-11-08 11:13:15 +01:00
Bernhard Miklautz
1f2a22d0da
Merge pull request #4994 from akallabeth/bio_uninit_fix
Fixed #4993: Allow uninitialized bio socket in transport_bio_simple_uninit
2018-11-08 10:08:03 +00:00
Armin Novak
5eca5ebde8 Fixed #4993: Allow uninitialized bio socket in transport_bio_simple_uninit
When the TLS connection is aborted early (certificate issues, ...)
the bio simple socket might not have been initialized.
Do not access the NULL pointer on cleanup.
2018-11-07 17:02:07 +01:00
akallabeth
cf43406dc3
Merge pull request #4982 from bmiklautz/ctest_asan_fixes
Fix issues with multiple tests if address sanitation is on
2018-11-07 16:11:02 +01:00
Armin Novak
6a2d49e0ed Simplified timezone update handling:
* Fix #4965: Adjusted the timezone update script to initialize
  structs properly.
* Updated the scripts to generate the files directly
* Added a small HOWTO
* Split zone information to separate files to allow automatic
  update without further manual editing.

Create a timezone.c file that does conform to C rules.
2018-11-07 14:46:24 +01:00
Armin Novak
a544776bd8 Simplified code, moved bounds check out of loops. 2018-11-07 13:10:23 +01:00
Armin Novak
10d3ee131e Fixed #4954: Check destination buffer bounds. 2018-11-07 12:18:08 +01:00
Martin Fleisz
76c91ee51a
Merge pull request #4985 from informatimago/issue-4983
Fix Issue #4983 : Increased size of buffer to encrypt hash with kerbe…
2018-11-06 13:51:53 +01:00
Pascal J. Bourguignon
6f2caef778 Fix Issue #4983 : Increased size of buffer to encrypt hash with kerberos. 2018-11-06 11:20:02 +01:00
Bernhard Miklautz
37f8181735 fix [libfreerdp/codec]: heap buffer overflow in TestFreeRDPCodecClear
The examples and the allocated buffers assume that the destination
starts with x 0 and y 0 and not 1/1.
2018-11-05 15:43:12 +01:00
Bernhard Miklautz
649404dd29 fix [libfreerdp/crypto]: memory leak in Test_x509_cert_info 2018-11-05 13:46:05 +01:00
Bernhard Miklautz
472f7ea936 fix [winpr/util]: memory leak in TestCmdLine 2018-11-05 12:29:06 +01:00
Bernhard Miklautz
aecc77cd77
Merge pull request #4969 from akallabeth/covscan_fix
Covscan fixes
2018-11-05 10:44:01 +00:00
Bernhard Miklautz
a95a55a0cc
Merge pull request #4980 from hardening/logon_infov2_fix
fix uninitialised variable
2018-11-05 09:57:04 +00:00
David Fort
1a50a48332 fix uninitialised variable
Otherwise we can run in troubles when sending logon_info_v2 packets
2018-11-01 11:07:36 +01:00
Bernhard Miklautz
29d3fea3d7
Merge pull request #4974 from Devolutions/android_timezone_fix
Remove unsupported call to fseek when file is opened with popen
2018-10-31 11:26:19 +00:00