Commit Graph

177 Commits (08d0c64ff97d3a64e05a908d97ec0b822c8a26be)

Author SHA1 Message Date
Alfred Wingate d95b678d7a server: Remove undeclared variable from tracing macro
* 3647457f6d accidentally referred to
  an nonexistant variable. This leads to build failure if you then
  enable the systemtap feature.
* Downstream bug https://bugs.gentoo.org/902141

Signed-off-by: Alfred Wingate <parona@protonmail.com>
2024-02-26 12:41:15 +00:00
Andri Yngvason c22a0c0379 Add option to enable experimental features
With this, I can release without modifying things specially on the release
branch.
2024-02-25 10:59:56 +00:00
Andri Yngvason dedac2f82f Implement colour map
Instead of dropping the connection, we now implement a simple static
colour map that emulates RGB332.

The quality isn't great, but it's better than dropping the connection
without any explanation.
2024-02-20 21:59:51 +00:00
Andri Yngvason d654e06eea Consolidate security handshake result handling 2024-02-15 10:05:21 +00:00
Andri Yngvason 1647505e94 server: Extract encoder initialisation function 2024-02-02 22:35:23 +00:00
Andri Yngvason 9fa1027353 server: Drop current frame if formats change
If the currently in-flight frame was dispatched before a format change,
it might be the wrong format for the client, so it's better to drop it.
2024-02-02 22:24:03 +00:00
Andri Yngvason ef106b92f1 server: Log encodings reported by client 2024-02-02 22:22:03 +00:00
Andri Yngvason f1a6710bba server: Log pixel format choice 2024-02-02 22:17:52 +00:00
Andri Yngvason c7d7929f7c Keep zlib streams when switching encodings
Both RealVNC and TigerVNC clients expect zlib streams to remain when
switching encodings, so when they switch back, inflate fails if the
encoder is discared.

fixes #109
2024-02-02 22:10:01 +00:00
Andri Yngvason 58509ca889 Warn when client chooses non-true-color pixel format
This at least lets the user know why things failed.
2024-01-30 21:50:23 +00:00
Andri Yngvason 65fc23c88d server: Allow server to request more than 32 encodings
fixes #108
2024-01-24 18:29:50 +00:00
Andri Yngvason f503cbef25 Replace nvnc_client_get_hostname with nvnc_client_get_address
This is a more accurate name for what is returned since
c76129b2d2.
2023-12-31 17:59:52 +00:00
Andri Yngvason d80b51f650 server: Don't complete fb update more than once
If stream_send in finish_fb_update returns -1, then complete_fb_update
will be called there and in the callback to stream_send.
2023-11-19 20:28:43 +00:00
Andri Yngvason c76129b2d2 server: Remove DNS lookup
DNS lookup is slow and can even fail. Under some circumstances, it will
even block for a significant amount of time until it completes.

The user of this library can do the lookup instead if they wish.
2023-11-05 10:29:04 +00:00
Andri Yngvason 175d53bc41 server: Fix double-free on failed Apple DH 2023-11-04 23:10:15 +00:00
Andri Yngvason 6beb263027 Don't use tag for git version 2023-10-09 22:54:18 +00:00
Philipp Zabel bc3a47a654 Indent wrapped argument lists with two tabs (function calls)
Do not align wrapped function argument lists with the opening
parenthesis. Indent them with two tabs.

Signed-off-by: Philipp Zabel <philipp.zabel@gmail.com>
2023-10-06 20:41:30 +00:00
Philipp Zabel f04284351e Indent wrapped argument lists with two tabs (function definitions)
Do not align wrapped function argument lists with the opening
parenthesis. Indent them with two tabs.

Signed-off-by: Philipp Zabel <philipp.zabel@gmail.com>
2023-10-06 20:41:30 +00:00
Andri Yngvason dc1d93cadf server: Defer cleaning up client resources on close
When the event is received, the client object may still be processing some
things, so let's allow it to finish.
2023-10-03 22:15:20 +00:00
Andri Yngvason f8f49196e8 server: Free RSA creds on close 2023-10-03 20:45:20 +00:00
Andri Yngvason 65d1d0e185 server: Use uint32_t for security result failure path 2023-10-02 23:05:19 +00:00
Andri Yngvason 913c314b31 server: Use memcpy instead of strncpy for username/password
This fixed zero-termination error
2023-10-02 21:57:22 +00:00
Andri Yngvason f54aeed334 Notify client about NTP support 2023-10-01 10:56:42 +00:00
Andri Yngvason bdadcad1c8 Replace strlcpy with strncpy
The former isn't portable.
2023-09-29 22:00:48 +00:00
Andri Yngvason 58d6dff5e5 API: Consolidate setup of security constraints 2023-09-29 21:53:20 +00:00
Andri Yngvason 373e5a0f9e Remove logging of sensitive information 2023-09-29 21:53:20 +00:00
Andri Yngvason d74878fd00 server: Allow arbitrary RSA key length 2023-09-29 21:53:20 +00:00
Andri Yngvason 74e9db19fd API: Add method to set RSA credentials 2023-09-29 21:53:20 +00:00
Andri Yngvason 4705c0cfcc Implement RSA-AES-256 security type 2023-09-29 21:53:20 +00:00
Andri Yngvason 396f4ed6c5 server: Clean up crypto resources on disconnect 2023-09-29 21:53:20 +00:00
Andri Yngvason 7eb42324bf server: Define rsa-aes server key length constant 2023-09-29 21:53:20 +00:00
Andri Yngvason c6df99ec46 server: Use hash_{one,many} 2023-09-29 21:53:20 +00:00
Andri Yngvason 9507624cf3 Create dedicated RSA-AES stream
The message format isn't really within the domain of the cipher, so it
doesn't belong to the crypto interface.
2023-09-29 21:53:20 +00:00
Andri Yngvason f90c628e66 Add temporary api function to enable auth without tls 2023-09-29 21:53:20 +00:00
Andri Yngvason e341898bbc Implement RSA-AES 2023-09-29 21:53:20 +00:00
Andri Yngvason 71aa5acfde crypto: Integrate message handling into cipher 2023-09-29 21:53:20 +00:00
Andri Yngvason c12c1c800a crypto: Add RSA and AES-EAX 2023-09-29 21:53:20 +00:00
Andri Yngvason 7b878033f0 Implement Apple's Diffie-Hellman based security type 30 2023-09-29 21:53:20 +00:00
Andri Yngvason 8872dece0c server: Defer client_unref in close_after_write
This ensures that the stream object stays alive while its write
queue is being processed.
2023-07-04 23:40:32 +00:00
Andri Yngvason 61fad8c96b server: Actually send a reason when handshake fails 2023-07-04 22:56:52 +00:00
Andri Yngvason d7dc9c0db5 server: Set SO_SNDBUF to 65536
The previous value of 4096 caused a very bad performance regression
with GnuTLS.
2023-04-11 20:37:22 +00:00
Andri Yngvason 5530b22fde server: Reduce SO_SNDBUF to 4096
This will allow us to more accuately gauge the back-pressure on the socket.
2023-04-08 13:40:24 +00:00
Andri Yngvason aa6fadf2fd server: Use stream_exec_and_send for ntp 2023-04-08 13:40:24 +00:00
Andri Yngvason 19172140ba Add NTP inspired latency tracking and time sync 2023-04-07 21:24:22 +00:00
Andri Yngvason 8847511596 Implement websocket 2023-04-07 12:47:49 +00:00
Philipp Zabel e19c9ad600 Implement desktop resizing
Implement minimal support for ExtendedDesktopSize pseudo-encoding
and SetDesktopSize client message.

The opaque nvnc_desktop_layout structure contains all information
from the SetDesktopSize client message.
2023-02-25 11:03:44 +00:00
Jim Ramsay 332be4d471 Add nvnc_client_close API
This allows the user or application to terminate any given nvnc_client
connection at any time.

Signed-off-by: Jim Ramsay <i.am@jimramsay.com>
2022-11-24 16:08:06 +00:00
Andri Yngvason 8f979c9928 Pass nvnc_client to cut-text callback 2022-11-20 22:42:01 +00:00
Andri Yngvason 79f26924ea Add functions for listing clients 2022-11-20 12:03:18 +00:00
Andri Yngvason 3647457f6d server: Properly handle stream write errors
This fixes leaked rcbufs when clients disconnect.
2022-11-05 13:22:14 +00:00