Pierre Ossman [Tue, 10 Sep 2024 14:55:32 +0000 (16:55 +0200)]
Split SystemException to handle Windows
Windows has (at least) two error namespaces, both errno and
GetLastResult(). These overlap, so it is important we keep track of
which one we are dealing with.
To make things extra problematic, the BSD socket API normally uses
errno, but on Windows it has been mapped in to the GetLastResult()
namespace.
Try to keep better control of this by using separate classes for the
namespaces.
Pierre Ossman [Tue, 10 Sep 2024 14:57:24 +0000 (16:57 +0200)]
Consistently use SocketException for socket errors
The behaviour is not consistent as Windows doesn't use errno for socket
errors, but Unix systems do. Always use the same exception to keep
things somewhat sane.
Pierre Ossman [Tue, 10 Sep 2024 15:05:39 +0000 (17:05 +0200)]
Move SocketException to rdr
Socket APIs are used in more places than the abstraction in
common/network. Make it easier to use this exception class by putting
it in a more common place.
Samuel Mannehed [Wed, 2 Oct 2024 08:18:22 +0000 (10:18 +0200)]
Clear clipboard state when its not plain text
Commit 8a80c906b9f7c08b1c664569a97d327d62c6d8ae added a check to prevent
announcing clipboard when it's not plain text data. When this check
triggers and we want to ignore the non-plain text clipboard, we should
reset the state by no longer indicating pending clipboard, and by asking
the server to clear its clipboard. This ensures we don't end up in a
state where the server thinks the viewer has useful clipboard data, but
it doesn't.
Samuel Mannehed [Tue, 1 Oct 2024 10:49:40 +0000 (12:49 +0200)]
Only announce clipboard for plain text data
FLTK has support for both image and plain text clipboard data, we don't.
This means we only send plain text clipboard from the viewer to the
server. Some applications can get confused when we announce that
clipboard is available and later don't send anything. An example of such
an application is QGIS, in the remote session it froze when an image was
copied on the client side.
This fix means we only call announceClipboard() when the clipboard
contains plain text. That means TigerVNC is now more robust and doesn't
trigger freezes in buggy applications.
Pierre Ossman [Tue, 24 Sep 2024 07:03:53 +0000 (09:03 +0200)]
More carefully release mouse buttons on close
Only the client that currently has buttons pressed should actually send
a release event as the client might not be currently in control of the
pointer state. This is most clearly seen in a client that hasn't event
authenticated properly yet.
Approximate this from the server by using the last known server cursor
position. It should hopefully not differ much from the last client
provided position.
Pierre Ossman [Mon, 2 Sep 2024 18:41:47 +0000 (20:41 +0200)]
Remove ConnFailedException
There were more unclear usage of this exception class, and since nothing
catches it it is very unclear what the purpose is. Go ahead and just
remove it.
Pierre Ossman [Fri, 30 Aug 2024 14:09:38 +0000 (16:09 +0200)]
Only read first password from file
Read just the first password and ignore anything else in the password
file. This allows you to reuse a password file from the server that also
includes a view-only password.
Andri Yngvason [Thu, 22 Aug 2024 21:26:59 +0000 (21:26 +0000)]
H264Libav: Use nearest-neighbour sampling in scaler
sws_getCachedContext will set a default sampling method if 0 is passed
to the flags argument. This means that when it is called again, the
flags argument will not match the flags in the context, so a new one
will be allocated every time.
To get around this problem, we assign an explicit sampling method, one
that also happens to be more efficient and just as good for this
use-case as the default one, which is bicubic interpolation.
Pierre Ossman [Tue, 13 Aug 2024 13:53:07 +0000 (15:53 +0200)]
Use proper gnutls_free() on Windows
The underlying issue requiring this hack was fixed ages ago.
Unfortunately, the fixed GnuTLS doesn't consider static linking. So we
need to add a new hack that permits that.
Pierre Ossman [Tue, 3 Jan 2023 10:02:36 +0000 (11:02 +0100)]
Don't adjust manually sized window
It's unclear why this code was ever added, and it can be very confusing
that the window partially adjusts itself. The code is also in conflict
with the earlier comment that states we'll leave the window size alone
if it didn't perfectly match before the resize.
Pierre Ossman [Thu, 28 Dec 2023 08:33:07 +0000 (09:33 +0100)]
Remove fake framebuffer update request call
This method should only be called when the client actually sends a
framebuffer update request, otherwise we might send data the client is
not ready for.
It's unclear what the purpose of this call is, so we have no better fix
than to just remove it.
Pierre Ossman [Wed, 7 Aug 2024 08:08:43 +0000 (10:08 +0200)]
Remove auth exception prefix
This prefix often just added noise, and could sometimes be added
multiple times. It's better that user interface catch the specific
exception type and give a more descriptive presentation to the user.
Pierre Ossman [Tue, 6 Aug 2024 12:53:30 +0000 (14:53 +0200)]
Avoid XKeysymToString() conflict with libX11
We implement our own version of this, and because of this we carry our
lookup table generated by the same tool that libX11 uses. Unfortunately,
that table is a global symbol and as such there might be a mismatch of
which table should be used.
Make sure we get our own copy by changing the name of it. We use a
define rather than modifying ks_tables.h as that file is automatically
generated.
Carlos Santos [Thu, 25 Jul 2024 21:39:59 +0000 (18:39 -0300)]
vncsession: use /bin/sh if the user shell is not set
An empty shell field in the password file is valid, although not common.
Use /bin/sh in this case, as documented in the passwd(5) man page, since
the vncserver script requires a non-empty SHELL environment variable.
Fixes issue #1786.
Signed-off-by: Carlos Santos <casantos@redhat.com>
Pierre Ossman [Fri, 5 Jul 2024 12:05:45 +0000 (14:05 +0200)]
Be more careful with ComparingUpdateTracker pointer
As of 28c3f12, we might now be running the frame clock even without a
framebuffer present. This means we need to be more careful accessing the
ComparingUpdateTracker, as it might be NULL.
Pierre Ossman [Fri, 19 Apr 2024 21:48:37 +0000 (23:48 +0200)]
Remove careful client iteratation
Clients cannot remove themselves from the list as we are iterating, so
we don't need this complexity. If a client encounters a problem, it will
only mark it self as closed and will be removed from the list at a later
time.
Pierre Ossman [Wed, 3 Apr 2024 10:38:04 +0000 (12:38 +0200)]
Disable gcc NULL warning for context menu
We use the pointer to just store an identifier for the menu, but this is
enough for gcc to think we are using 0 instead of nullptr and complain.
Even an explicit cast isn't enough to silence it here for some reason.
Pierre Ossman [Tue, 2 Apr 2024 14:06:10 +0000 (16:06 +0200)]
Make sure we use C++ 11
It's rare we use a compiler that has anything older as a default, but it
does happen sometimes. So make sure to guarantee this so we can start
using more modern constructs.