Update to 42.1.1 (#2061546)
This commit is contained in:
parent
686710ebe0
commit
d1e6ebec7f
@ -1,71 +0,0 @@
|
||||
From 81172effba7c70d3b2932c67be79a2924eae9d73 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Jonas=20=C3=85dahl?= <jadahl@gmail.com>
|
||||
Date: Mon, 12 Oct 2020 17:34:30 +0200
|
||||
Subject: [PATCH] vnc: Copy pixels using the right destination stride
|
||||
|
||||
We're copying the pixels in a separate thread managed by PipeWire, and
|
||||
in this thread, accessing the VNC framebuffer dimension and stride is
|
||||
racy. Instead of fetching the dimension directly, pass the expected
|
||||
width and get the stride it will eventually have.
|
||||
|
||||
Already before this patch, when the copied pixel end up on the main
|
||||
thread and the dimension still doesn't match up, the frame will be
|
||||
dropped.
|
||||
---
|
||||
src/grd-session-vnc.c | 5 +++--
|
||||
src/grd-session-vnc.h | 3 ++-
|
||||
src/grd-vnc-pipewire-stream.c | 5 +++--
|
||||
3 files changed, 8 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/src/grd-session-vnc.c b/src/grd-session-vnc.c
|
||||
index 69fb33d..f4835aa 100644
|
||||
--- a/src/grd-session-vnc.c
|
||||
+++ b/src/grd-session-vnc.c
|
||||
@@ -535,9 +535,10 @@ grd_session_vnc_get_fd (GrdSessionVnc *session_vnc)
|
||||
}
|
||||
|
||||
int
|
||||
-grd_session_vnc_get_framebuffer_stride (GrdSessionVnc *session_vnc)
|
||||
+grd_session_vnc_get_stride_for_width (GrdSessionVnc *session_vnc,
|
||||
+ int width)
|
||||
{
|
||||
- return session_vnc->rfb_screen->paddedWidthInBytes;
|
||||
+ return width * BGRX_BYTES_PER_PIXEL;
|
||||
}
|
||||
|
||||
rfbClientPtr
|
||||
diff --git a/src/grd-session-vnc.h b/src/grd-session-vnc.h
|
||||
index 0d01ad3..ccd046c 100644
|
||||
--- a/src/grd-session-vnc.h
|
||||
+++ b/src/grd-session-vnc.h
|
||||
@@ -60,7 +60,8 @@ void grd_session_vnc_move_cursor (GrdSessionVnc *session_vnc,
|
||||
|
||||
int grd_session_vnc_get_fd (GrdSessionVnc *session_vnc);
|
||||
|
||||
-int grd_session_vnc_get_framebuffer_stride (GrdSessionVnc *session_vnc);
|
||||
+int grd_session_vnc_get_stride_for_width (GrdSessionVnc *session_vnc,
|
||||
+ int width);
|
||||
|
||||
gboolean grd_session_vnc_is_client_gone (GrdSessionVnc *session_vnc);
|
||||
|
||||
diff --git a/src/grd-vnc-pipewire-stream.c b/src/grd-vnc-pipewire-stream.c
|
||||
index 96dd7c9..82ceb9b 100644
|
||||
--- a/src/grd-vnc-pipewire-stream.c
|
||||
+++ b/src/grd-vnc-pipewire-stream.c
|
||||
@@ -326,10 +326,11 @@ process_buffer (GrdVncPipeWireStream *stream,
|
||||
int height;
|
||||
int y;
|
||||
|
||||
- src_stride = buffer->datas[0].chunk->stride;
|
||||
- dst_stride = grd_session_vnc_get_framebuffer_stride (stream->session);
|
||||
height = stream->spa_format.size.height;
|
||||
width = stream->spa_format.size.width;
|
||||
+ src_stride = buffer->datas[0].chunk->stride;
|
||||
+ dst_stride = grd_session_vnc_get_stride_for_width (stream->session,
|
||||
+ width);
|
||||
|
||||
frame->data = g_malloc (height * dst_stride);
|
||||
for (y = 0; y < height; y++)
|
||||
--
|
||||
2.28.0
|
||||
|
@ -1,80 +0,0 @@
|
||||
From ab97841629f5f3f4fab9993b6255b6ae04828b9c Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Jonas=20=C3=85dahl?= <jadahl@gmail.com>
|
||||
Date: Wed, 9 Sep 2020 10:14:20 +0200
|
||||
Subject: [PATCH] vnc: Drop frames if client is gone
|
||||
|
||||
Frames from PipeWire are posted asynchronously from a I/O thread to the
|
||||
main thread where they are turned into VNC frame updates and cursor
|
||||
movements. On the other hand, sessions are closed asynchronously when
|
||||
the VNC client disappears. If a frame ended up on the main thread after
|
||||
a client disappeared but before the session and stream was closed, we'd
|
||||
try to turn the new frames into VNC updates without a client being
|
||||
available, causing use after free.
|
||||
|
||||
Fix this by dropping frames that happens during this time frame.
|
||||
|
||||
Closes: https://gitlab.gnome.org/GNOME/gnome-remote-desktop/-/issues/43
|
||||
---
|
||||
src/grd-session-vnc.c | 7 +++++++
|
||||
src/grd-session-vnc.h | 2 ++
|
||||
src/grd-vnc-pipewire-stream.c | 8 ++++++++
|
||||
3 files changed, 17 insertions(+)
|
||||
|
||||
diff --git a/src/grd-session-vnc.c b/src/grd-session-vnc.c
|
||||
index 813838a..a06d34d 100644
|
||||
--- a/src/grd-session-vnc.c
|
||||
+++ b/src/grd-session-vnc.c
|
||||
@@ -209,6 +209,12 @@ maybe_queue_close_session_idle (GrdSessionVnc *session_vnc)
|
||||
g_idle_add (close_session_idle, session_vnc);
|
||||
}
|
||||
|
||||
+gboolean
|
||||
+grd_session_vnc_is_client_gone (GrdSessionVnc *session_vnc)
|
||||
+{
|
||||
+ return !session_vnc->rfb_client;
|
||||
+}
|
||||
+
|
||||
static void
|
||||
handle_client_gone (rfbClientPtr rfb_client)
|
||||
{
|
||||
@@ -218,6 +224,7 @@ handle_client_gone (rfbClientPtr rfb_client)
|
||||
|
||||
grd_session_vnc_detach_source (session_vnc);
|
||||
maybe_queue_close_session_idle (session_vnc);
|
||||
+ session_vnc->rfb_client = NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
diff --git a/src/grd-session-vnc.h b/src/grd-session-vnc.h
|
||||
index 579a12a..07678c8 100644
|
||||
--- a/src/grd-session-vnc.h
|
||||
+++ b/src/grd-session-vnc.h
|
||||
@@ -57,4 +57,6 @@ void grd_session_vnc_move_cursor (GrdSessionVnc *session_vnc,
|
||||
|
||||
int grd_session_vnc_get_framebuffer_stride (GrdSessionVnc *session_vnc);
|
||||
|
||||
+gboolean grd_session_vnc_is_client_gone (GrdSessionVnc *session_vnc);
|
||||
+
|
||||
#endif /* GRD_SESSION_VNC_H */
|
||||
diff --git a/src/grd-vnc-pipewire-stream.c b/src/grd-vnc-pipewire-stream.c
|
||||
index 78793c4..96dd7c9 100644
|
||||
--- a/src/grd-vnc-pipewire-stream.c
|
||||
+++ b/src/grd-vnc-pipewire-stream.c
|
||||
@@ -234,6 +234,14 @@ do_render (struct spa_loop *loop,
|
||||
if (!frame)
|
||||
return 0;
|
||||
|
||||
+ if (grd_session_vnc_is_client_gone (stream->session))
|
||||
+ {
|
||||
+ g_free (frame->data);
|
||||
+ g_clear_pointer (&frame->rfb_cursor, rfbFreeCursor);
|
||||
+ g_free (frame);
|
||||
+ return 0;
|
||||
+ }
|
||||
+
|
||||
if (frame->rfb_cursor)
|
||||
grd_session_vnc_set_cursor (stream->session, frame->rfb_cursor);
|
||||
|
||||
--
|
||||
2.26.2
|
||||
|
@ -1,73 +0,0 @@
|
||||
From 78c5bcb181fe2b0b9fc17eea696feac8b504df54 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Jonas=20=C3=85dahl?= <jadahl@gmail.com>
|
||||
Date: Thu, 7 May 2020 15:48:22 +0200
|
||||
Subject: [PATCH] vnc/pipewire-stream: Handle stride mismatch
|
||||
|
||||
The VNC server framebuffer assumes a particular stride; but there is no
|
||||
guarantee that we'll get the same from PipeWire. Handle this gracefully
|
||||
by coping row by row instead of the whole buffer.
|
||||
---
|
||||
src/grd-vnc-pipewire-stream.c | 23 +++++++++++++++--------
|
||||
1 file changed, 15 insertions(+), 8 deletions(-)
|
||||
|
||||
diff --git a/src/grd-vnc-pipewire-stream.c b/src/grd-vnc-pipewire-stream.c
|
||||
index 88c07be..261292a 100644
|
||||
--- a/src/grd-vnc-pipewire-stream.c
|
||||
+++ b/src/grd-vnc-pipewire-stream.c
|
||||
@@ -187,8 +187,6 @@ on_stream_param_changed (void *user_data,
|
||||
struct spa_pod_builder pod_builder;
|
||||
int width;
|
||||
int height;
|
||||
- int stride;
|
||||
- int size;
|
||||
const struct spa_pod *params[3];
|
||||
|
||||
if (!format || id != SPA_PARAM_Format)
|
||||
@@ -203,14 +201,9 @@ on_stream_param_changed (void *user_data,
|
||||
|
||||
grd_session_vnc_queue_resize_framebuffer (stream->session, width, height);
|
||||
|
||||
- stride = grd_session_vnc_get_framebuffer_stride (stream->session);
|
||||
- size = stride * height;
|
||||
-
|
||||
params[0] = spa_pod_builder_add_object (
|
||||
&pod_builder,
|
||||
SPA_TYPE_OBJECT_ParamBuffers, SPA_PARAM_Buffers,
|
||||
- SPA_PARAM_BUFFERS_size, SPA_POD_Int (size),
|
||||
- SPA_PARAM_BUFFERS_stride, SPA_POD_Int (stride),
|
||||
SPA_PARAM_BUFFERS_buffers, SPA_POD_CHOICE_RANGE_Int (8, 1, 8),
|
||||
0);
|
||||
|
||||
@@ -319,6 +312,10 @@ process_buffer (GrdVncPipeWireStream *stream,
|
||||
size_t size;
|
||||
uint8_t *map;
|
||||
void *src_data;
|
||||
+ int src_stride;
|
||||
+ int dst_stride;
|
||||
+ int height;
|
||||
+ int y;
|
||||
struct spa_meta_cursor *spa_meta_cursor;
|
||||
g_autofree GrdVncFrame *frame = NULL;
|
||||
|
||||
@@ -359,7 +356,17 @@ process_buffer (GrdVncPipeWireStream *stream,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
- frame->data = g_memdup (src_data, buffer->datas[0].maxsize);
|
||||
+ src_stride = buffer->datas[0].chunk->stride;
|
||||
+ dst_stride = grd_session_vnc_get_framebuffer_stride (stream->session);
|
||||
+ height = stream->spa_format.size.height;
|
||||
+
|
||||
+ frame->data = g_malloc (height * dst_stride);
|
||||
+ for (y = 0; y < height; y++)
|
||||
+ {
|
||||
+ memcpy (((uint8_t *) frame->data) + y * dst_stride,
|
||||
+ ((uint8_t *) src_data) + y * src_stride,
|
||||
+ stream->spa_format.size.width * 4);
|
||||
+ }
|
||||
|
||||
if (map)
|
||||
{
|
||||
--
|
||||
2.26.2
|
||||
|
@ -3,8 +3,8 @@
|
||||
%global tarball_version %%(echo %{version} | tr '~' '.')
|
||||
|
||||
Name: gnome-remote-desktop
|
||||
Version: 42.1
|
||||
Release: 2%{?dist}
|
||||
Version: 42.1.1
|
||||
Release: 1%{?dist}
|
||||
Summary: GNOME Remote Desktop screen share service
|
||||
|
||||
License: GPLv2+
|
||||
@ -91,6 +91,9 @@ GNOME desktop environment.
|
||||
|
||||
|
||||
%changelog
|
||||
* Wed May 11 2022 David King <amigadave@amigadave.com> - 42.1.1-1
|
||||
- Update to 42.1.1 (#2061546)
|
||||
|
||||
* Wed Apr 27 2022 David King <amigadave@amigadave.com> - 42.1-2
|
||||
- Fix isa macro in Requires
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
From 6ca82648e9b6791fbfbbbc9b05f15ec07a992e1a Mon Sep 17 00:00:00 2001
|
||||
From 63d1c041e3997bfc78803b4d0fe09d96b53c9e50 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Jonas=20=C3=85dahl?= <jadahl@gmail.com>
|
||||
Date: Thu, 14 Jun 2018 12:21:37 +0200
|
||||
Subject: [PATCH 1/7] vnc: Add anonymous TLS encryption support
|
||||
@ -25,7 +25,7 @@ VNC connection.
|
||||
create mode 100644 src/grd-vnc-tls.h
|
||||
|
||||
diff --git a/meson.build b/meson.build
|
||||
index 6bd2420..d6c5d9b 100644
|
||||
index 72d34a4..9a341fa 100644
|
||||
--- a/meson.build
|
||||
+++ b/meson.build
|
||||
@@ -50,6 +50,7 @@ endif
|
||||
@ -52,7 +52,7 @@ index e3ecc40..fa8dfb7 100644
|
||||
+
|
||||
#endif /* GRD_ENUMS_H */
|
||||
diff --git a/src/grd-session-vnc.c b/src/grd-session-vnc.c
|
||||
index a4cb958..c2e29b4 100644
|
||||
index fbc66a4..fa694f0 100644
|
||||
--- a/src/grd-session-vnc.c
|
||||
+++ b/src/grd-session-vnc.c
|
||||
@@ -45,7 +45,9 @@ struct _GrdSessionVnc
|
||||
@ -220,7 +220,7 @@ index a4cb958..c2e29b4 100644
|
||||
NULL);
|
||||
g_source_set_callback (session_vnc->source,
|
||||
(GSourceFunc) handle_socket_data,
|
||||
@@ -669,8 +733,10 @@ grd_session_vnc_new (GrdVncServer *vnc_server,
|
||||
@@ -673,8 +737,10 @@ grd_session_vnc_new (GrdVncServer *vnc_server,
|
||||
"context", context,
|
||||
NULL);
|
||||
|
||||
@ -231,7 +231,7 @@ index a4cb958..c2e29b4 100644
|
||||
grd_session_vnc_attach_source (session_vnc);
|
||||
|
||||
init_vnc_session (session_vnc);
|
||||
@@ -685,6 +751,8 @@ grd_session_vnc_dispose (GObject *object)
|
||||
@@ -689,6 +755,8 @@ grd_session_vnc_dispose (GObject *object)
|
||||
|
||||
g_assert (!session_vnc->rfb_screen);
|
||||
|
||||
@ -276,7 +276,7 @@ index fcc508d..092d9dc 100644
|
||||
+
|
||||
#endif /* GRD_SESSION_VNC_H */
|
||||
diff --git a/src/grd-settings.c b/src/grd-settings.c
|
||||
index c8f28fb..502d956 100644
|
||||
index dad5d57..7753186 100644
|
||||
--- a/src/grd-settings.c
|
||||
+++ b/src/grd-settings.c
|
||||
@@ -69,6 +69,7 @@ struct _GrdSettings
|
||||
@ -287,7 +287,7 @@ index c8f28fb..502d956 100644
|
||||
} vnc;
|
||||
};
|
||||
|
||||
@@ -245,6 +246,12 @@ grd_settings_get_vnc_auth_method (GrdSettings *settings)
|
||||
@@ -259,6 +260,12 @@ grd_settings_get_vnc_auth_method (GrdSettings *settings)
|
||||
return settings->vnc.auth_method;
|
||||
}
|
||||
|
||||
@ -300,7 +300,7 @@ index c8f28fb..502d956 100644
|
||||
static void
|
||||
update_screen_share_mode (GrdSettings *settings)
|
||||
{
|
||||
@@ -303,6 +310,13 @@ update_vnc_auth_method (GrdSettings *settings)
|
||||
@@ -317,6 +324,13 @@ update_vnc_auth_method (GrdSettings *settings)
|
||||
"auth-method");
|
||||
}
|
||||
|
||||
@ -314,7 +314,7 @@ index c8f28fb..502d956 100644
|
||||
static void
|
||||
on_rdp_settings_changed (GSettings *rdp_settings,
|
||||
const char *key,
|
||||
@@ -355,6 +369,11 @@ on_vnc_settings_changed (GSettings *vnc_settings,
|
||||
@@ -369,6 +383,11 @@ on_vnc_settings_changed (GSettings *vnc_settings,
|
||||
update_vnc_auth_method (settings);
|
||||
g_signal_emit (settings, signals[VNC_AUTH_METHOD_CHANGED], 0);
|
||||
}
|
||||
@ -326,7 +326,7 @@ index c8f28fb..502d956 100644
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -392,6 +411,8 @@ grd_settings_init (GrdSettings *settings)
|
||||
@@ -406,6 +425,8 @@ grd_settings_init (GrdSettings *settings)
|
||||
|
||||
settings->rdp.port = GRD_RDP_SERVER_PORT;
|
||||
settings->vnc.port = GRD_VNC_SERVER_PORT;
|
||||
@ -335,7 +335,7 @@ index c8f28fb..502d956 100644
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -457,4 +478,11 @@ grd_settings_class_init (GrdSettingsClass *klass)
|
||||
@@ -471,4 +492,11 @@ grd_settings_class_init (GrdSettingsClass *klass)
|
||||
0,
|
||||
NULL, NULL, NULL,
|
||||
G_TYPE_NONE, 0);
|
||||
@ -962,181 +962,13 @@ index 939b9a6..e57affb 100644
|
||||
</schema>
|
||||
</schemalist>
|
||||
--
|
||||
2.34.1
|
||||
2.36.1
|
||||
|
||||
|
||||
From 212fa98088cb4a754bac8cdb3a69d2a3e6b4dff9 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Jonas=20=C3=85dahl?= <jadahl@gmail.com>
|
||||
Date: Wed, 27 Nov 2019 11:02:09 +0100
|
||||
Subject: [PATCH 2/7] session-vnc: Add paused/resumed signals
|
||||
|
||||
Paused is when the socket sourec is detached, and resumed when attached.
|
||||
Meant to be used by the TLS channel security to a attach/detach
|
||||
out-of-socket source.
|
||||
---
|
||||
src/grd-session-vnc.c | 72 ++++++++++++++++++++++++++++++++++++++-----
|
||||
1 file changed, 65 insertions(+), 7 deletions(-)
|
||||
|
||||
diff --git a/src/grd-session-vnc.c b/src/grd-session-vnc.c
|
||||
index c2e29b4..4be4c49 100644
|
||||
--- a/src/grd-session-vnc.c
|
||||
+++ b/src/grd-session-vnc.c
|
||||
@@ -41,14 +41,27 @@
|
||||
#define BGRX_SAMPLES_PER_PIXEL 3
|
||||
#define BGRX_BYTES_PER_PIXEL 4
|
||||
|
||||
+enum
|
||||
+{
|
||||
+ PAUSED,
|
||||
+ RESUMED,
|
||||
+
|
||||
+ N_SIGNALS
|
||||
+};
|
||||
+
|
||||
+static guint signals[N_SIGNALS];
|
||||
+
|
||||
struct _GrdSessionVnc
|
||||
{
|
||||
GrdSession parent;
|
||||
|
||||
GrdVncServer *vnc_server;
|
||||
GSocketConnection *connection;
|
||||
+
|
||||
GList *socket_grabs;
|
||||
GSource *source;
|
||||
+ gboolean is_paused;
|
||||
+
|
||||
rfbScreenInfoPtr rfb_screen;
|
||||
rfbClientPtr rfb_client;
|
||||
|
||||
@@ -77,7 +90,7 @@ struct _GrdSessionVnc
|
||||
G_DEFINE_TYPE (GrdSessionVnc, grd_session_vnc, GRD_TYPE_SESSION)
|
||||
|
||||
static void
|
||||
-grd_session_vnc_detach_source (GrdSessionVnc *session_vnc);
|
||||
+grd_session_vnc_pause (GrdSessionVnc *session_vnc);
|
||||
|
||||
static gboolean
|
||||
close_session_idle (gpointer user_data);
|
||||
@@ -236,7 +249,8 @@ handle_client_gone (rfbClientPtr rfb_client)
|
||||
|
||||
g_debug ("VNC client gone");
|
||||
|
||||
- grd_session_vnc_detach_source (session_vnc);
|
||||
+ grd_session_vnc_pause (session_vnc);
|
||||
+
|
||||
maybe_queue_close_session_idle (session_vnc);
|
||||
session_vnc->rfb_client = NULL;
|
||||
}
|
||||
@@ -305,7 +319,7 @@ handle_new_client (rfbClientPtr rfb_client)
|
||||
session_vnc->prompt_cancellable,
|
||||
prompt_response_callback,
|
||||
session_vnc);
|
||||
- grd_session_vnc_detach_source (session_vnc);
|
||||
+ grd_session_vnc_pause (session_vnc);
|
||||
return RFB_CLIENT_ON_HOLD;
|
||||
case GRD_VNC_AUTH_METHOD_PASSWORD:
|
||||
session_vnc->rfb_screen->passwordCheck = check_rfb_password;
|
||||
@@ -536,7 +550,7 @@ check_rfb_password (rfbClientPtr rfb_client,
|
||||
if (memcmp (challenge_encrypted, response_encrypted, len) == 0)
|
||||
{
|
||||
grd_session_start (GRD_SESSION (session_vnc));
|
||||
- grd_session_vnc_detach_source (session_vnc);
|
||||
+ grd_session_vnc_pause (session_vnc);
|
||||
return TRUE;
|
||||
}
|
||||
else
|
||||
@@ -721,6 +735,36 @@ grd_session_vnc_detach_source (GrdSessionVnc *session_vnc)
|
||||
g_clear_pointer (&session_vnc->source, g_source_destroy);
|
||||
}
|
||||
|
||||
+gboolean
|
||||
+grd_session_vnc_is_paused (GrdSessionVnc *session_vnc)
|
||||
+{
|
||||
+ return session_vnc->is_paused;
|
||||
+}
|
||||
+
|
||||
+static void
|
||||
+grd_session_vnc_pause (GrdSessionVnc *session_vnc)
|
||||
+{
|
||||
+ if (grd_session_vnc_is_paused (session_vnc))
|
||||
+ return;
|
||||
+
|
||||
+ session_vnc->is_paused = TRUE;
|
||||
+
|
||||
+ grd_session_vnc_detach_source (session_vnc);
|
||||
+ g_signal_emit (session_vnc, signals[PAUSED], 0);
|
||||
+}
|
||||
+
|
||||
+static void
|
||||
+grd_session_vnc_resume (GrdSessionVnc *session_vnc)
|
||||
+{
|
||||
+ if (!grd_session_vnc_is_paused (session_vnc))
|
||||
+ return;
|
||||
+
|
||||
+ session_vnc->is_paused = FALSE;
|
||||
+
|
||||
+ grd_session_vnc_attach_source (session_vnc);
|
||||
+ g_signal_emit (session_vnc, signals[RESUMED], 0);
|
||||
+}
|
||||
+
|
||||
GrdSessionVnc *
|
||||
grd_session_vnc_new (GrdVncServer *vnc_server,
|
||||
GSocketConnection *connection)
|
||||
@@ -738,6 +782,7 @@ grd_session_vnc_new (GrdVncServer *vnc_server,
|
||||
|
||||
grd_session_vnc_grab_socket (session_vnc, vnc_socket_grab_func);
|
||||
grd_session_vnc_attach_source (session_vnc);
|
||||
+ session_vnc->is_paused = FALSE;
|
||||
|
||||
init_vnc_session (session_vnc);
|
||||
|
||||
@@ -767,7 +812,7 @@ grd_session_vnc_stop (GrdSession *session)
|
||||
|
||||
g_clear_object (&session_vnc->pipewire_stream);
|
||||
|
||||
- grd_session_vnc_detach_source (session_vnc);
|
||||
+ grd_session_vnc_pause (session_vnc);
|
||||
|
||||
g_clear_object (&session_vnc->connection);
|
||||
g_clear_object (&session_vnc->clipboard_vnc);
|
||||
@@ -827,8 +872,8 @@ grd_session_vnc_stream_ready (GrdSession *session,
|
||||
G_CALLBACK (on_pipewire_stream_closed),
|
||||
session_vnc);
|
||||
|
||||
- if (!session_vnc->source)
|
||||
- grd_session_vnc_attach_source (session_vnc);
|
||||
+ if (grd_session_vnc_is_paused (session_vnc))
|
||||
+ grd_session_vnc_resume (session_vnc);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -849,4 +894,17 @@ grd_session_vnc_class_init (GrdSessionVncClass *klass)
|
||||
session_class->remote_desktop_session_started =
|
||||
grd_session_vnc_remote_desktop_session_started;
|
||||
session_class->stream_ready = grd_session_vnc_stream_ready;
|
||||
+
|
||||
+ signals[PAUSED] = g_signal_new ("paused",
|
||||
+ G_TYPE_FROM_CLASS (klass),
|
||||
+ G_SIGNAL_RUN_LAST,
|
||||
+ 0,
|
||||
+ NULL, NULL, NULL,
|
||||
+ G_TYPE_NONE, 0);
|
||||
+ signals[RESUMED] = g_signal_new ("resumed",
|
||||
+ G_TYPE_FROM_CLASS (klass),
|
||||
+ G_SIGNAL_RUN_LAST,
|
||||
+ 0,
|
||||
+ NULL, NULL, NULL,
|
||||
+ G_TYPE_NONE, 0);
|
||||
}
|
||||
--
|
||||
2.34.1
|
||||
|
||||
|
||||
From db1ce3962bbe49491b87cb0a4a90de41614e118b Mon Sep 17 00:00:00 2001
|
||||
From 38d981d05fa79da2aa15076637253f6c4cc606d9 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Jonas=20=C3=85dahl?= <jadahl@gmail.com>
|
||||
Date: Wed, 27 Nov 2019 11:03:46 +0100
|
||||
Subject: [PATCH 3/7] session-vnc: Add grd_session_vnc_dispatch() helper
|
||||
Subject: [PATCH 2/7] session-vnc: Add grd_session_vnc_dispatch() helper
|
||||
|
||||
To be used by the TLS channel security to dispatch when there is data
|
||||
available that is not visible to the socket source.
|
||||
@ -1146,10 +978,10 @@ available that is not visible to the socket source.
|
||||
2 files changed, 18 insertions(+), 10 deletions(-)
|
||||
|
||||
diff --git a/src/grd-session-vnc.c b/src/grd-session-vnc.c
|
||||
index 4be4c49..9708de0 100644
|
||||
index fa694f0..1edd33a 100644
|
||||
--- a/src/grd-session-vnc.c
|
||||
+++ b/src/grd-session-vnc.c
|
||||
@@ -675,6 +675,21 @@ vnc_socket_grab_func (GrdSessionVnc *session_vnc,
|
||||
@@ -661,6 +661,21 @@ vnc_socket_grab_func (GrdSessionVnc *session_vnc,
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@ -1171,7 +1003,7 @@ index 4be4c49..9708de0 100644
|
||||
static gboolean
|
||||
handle_socket_data (GSocket *socket,
|
||||
GIOCondition condition,
|
||||
@@ -691,16 +706,7 @@ handle_socket_data (GSocket *socket,
|
||||
@@ -677,16 +692,7 @@ handle_socket_data (GSocket *socket,
|
||||
}
|
||||
else if (condition & G_IO_IN)
|
||||
{
|
||||
@ -1203,13 +1035,13 @@ index 092d9dc..e9eced0 100644
|
||||
|
||||
#endif /* GRD_SESSION_VNC_H */
|
||||
--
|
||||
2.34.1
|
||||
2.36.1
|
||||
|
||||
|
||||
From d6115fc524886ba716ba22464743c1a72472ff75 Mon Sep 17 00:00:00 2001
|
||||
From 9aacfa825fcdef0f2eb87b7f48872b1a93ec7923 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Jonas=20=C3=85dahl?= <jadahl@gmail.com>
|
||||
Date: Wed, 27 Nov 2019 11:05:13 +0100
|
||||
Subject: [PATCH 4/7] vnc/tls: Add some logging
|
||||
Subject: [PATCH 3/7] vnc/tls: Add some logging
|
||||
|
||||
Uses the log utility from libvncserver as it is related to the RFB
|
||||
protocol rather than the session itself.
|
||||
@ -1280,13 +1112,13 @@ index ec4758e..ac6c35f 100644
|
||||
{
|
||||
g_warning ("TLS handshake failed: %s", error->message);
|
||||
--
|
||||
2.34.1
|
||||
2.36.1
|
||||
|
||||
|
||||
From c71c9d295a2921014d55820042fc8bdad02df19c Mon Sep 17 00:00:00 2001
|
||||
From aeaa81db6cf160a32c8d83a945c860bb7451babf Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Jonas=20=C3=85dahl?= <jadahl@gmail.com>
|
||||
Date: Wed, 27 Nov 2019 11:07:40 +0100
|
||||
Subject: [PATCH 5/7] vnc/tls: Dispatch also when data is pending outside of
|
||||
Subject: [PATCH 4/7] vnc/tls: Dispatch also when data is pending outside of
|
||||
the socket
|
||||
|
||||
gnutls may have data available in its buffers, and we have our own peek
|
||||
@ -1450,13 +1282,216 @@ index ac6c35f..312b6b9 100644
|
||||
}
|
||||
|
||||
--
|
||||
2.34.1
|
||||
2.36.1
|
||||
|
||||
|
||||
From edc2380304d19e1bea58b079b943bad42cac5d69 Mon Sep 17 00:00:00 2001
|
||||
From be203b966ff119e82ea7ac9894b67a1db2f55f26 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Jonas=20=C3=85dahl?= <jadahl@gmail.com>
|
||||
Date: Wed, 27 Nov 2019 16:48:00 +0100
|
||||
Subject: [PATCH 6/7] session-vnc: Set our own password handling function up
|
||||
Date: Mon, 12 Oct 2020 17:34:30 +0200
|
||||
Subject: [PATCH 5/7] vnc: Copy pixels using the right destination stride
|
||||
|
||||
We're copying the pixels in a separate thread managed by PipeWire, and
|
||||
in this thread, accessing the VNC framebuffer dimension and stride is
|
||||
racy. Instead of fetching the dimension directly, pass the expected
|
||||
width and get the stride it will eventually have.
|
||||
|
||||
Already before this patch, when the copied pixel end up on the main
|
||||
thread and the dimension still doesn't match up, the frame will be
|
||||
dropped.
|
||||
---
|
||||
src/grd-session-vnc.h | 3 ++-
|
||||
1 file changed, 2 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/grd-session-vnc.h b/src/grd-session-vnc.h
|
||||
index 8a916b7..e85f31e 100644
|
||||
--- a/src/grd-session-vnc.h
|
||||
+++ b/src/grd-session-vnc.h
|
||||
@@ -67,7 +67,8 @@ int grd_session_vnc_get_stride_for_width (GrdSessionVnc *session_vnc,
|
||||
|
||||
int grd_session_vnc_get_fd (GrdSessionVnc *session_vnc);
|
||||
|
||||
-int grd_session_vnc_get_framebuffer_stride (GrdSessionVnc *session_vnc);
|
||||
+int grd_session_vnc_get_stride_for_width (GrdSessionVnc *session_vnc,
|
||||
+ int width);
|
||||
|
||||
gboolean grd_session_vnc_is_client_gone (GrdSessionVnc *session_vnc);
|
||||
|
||||
--
|
||||
2.36.1
|
||||
|
||||
|
||||
From ffd24b13dfce2e89acf5eb6ccd7bb6b90487e547 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Jonas=20=C3=85dahl?= <jadahl@gmail.com>
|
||||
Date: Wed, 11 May 2022 11:17:00 +0100
|
||||
Subject: [PATCH 6/7] session-vnc: Add paused/resumed signals
|
||||
|
||||
Paused is when the socket sourec is detached, and resumed when attached.
|
||||
Meant to be used by the TLS channel security to a attach/detach
|
||||
out-of-socket source.
|
||||
---
|
||||
src/grd-session-vnc.c | 72 ++++++++++++++++++++++++++++++++++++++-----
|
||||
1 file changed, 65 insertions(+), 7 deletions(-)
|
||||
|
||||
diff --git a/src/grd-session-vnc.c b/src/grd-session-vnc.c
|
||||
index 1edd33a..39d3ead 100644
|
||||
--- a/src/grd-session-vnc.c
|
||||
+++ b/src/grd-session-vnc.c
|
||||
@@ -41,14 +41,27 @@
|
||||
#define BGRX_SAMPLES_PER_PIXEL 3
|
||||
#define BGRX_BYTES_PER_PIXEL 4
|
||||
|
||||
+enum
|
||||
+{
|
||||
+ PAUSED,
|
||||
+ RESUMED,
|
||||
+
|
||||
+ N_SIGNALS
|
||||
+};
|
||||
+
|
||||
+static guint signals[N_SIGNALS];
|
||||
+
|
||||
struct _GrdSessionVnc
|
||||
{
|
||||
GrdSession parent;
|
||||
|
||||
GrdVncServer *vnc_server;
|
||||
GSocketConnection *connection;
|
||||
+
|
||||
GList *socket_grabs;
|
||||
GSource *source;
|
||||
+ gboolean is_paused;
|
||||
+
|
||||
rfbScreenInfoPtr rfb_screen;
|
||||
rfbClientPtr rfb_client;
|
||||
|
||||
@@ -77,7 +90,7 @@ struct _GrdSessionVnc
|
||||
G_DEFINE_TYPE (GrdSessionVnc, grd_session_vnc, GRD_TYPE_SESSION)
|
||||
|
||||
static void
|
||||
-grd_session_vnc_detach_source (GrdSessionVnc *session_vnc);
|
||||
+grd_session_vnc_pause (GrdSessionVnc *session_vnc);
|
||||
|
||||
static gboolean
|
||||
close_session_idle (gpointer user_data);
|
||||
@@ -236,7 +249,8 @@ handle_client_gone (rfbClientPtr rfb_client)
|
||||
|
||||
g_debug ("VNC client gone");
|
||||
|
||||
- grd_session_vnc_detach_source (session_vnc);
|
||||
+ grd_session_vnc_pause (session_vnc);
|
||||
+
|
||||
maybe_queue_close_session_idle (session_vnc);
|
||||
session_vnc->rfb_client = NULL;
|
||||
}
|
||||
@@ -305,7 +319,7 @@ handle_new_client (rfbClientPtr rfb_client)
|
||||
session_vnc->prompt_cancellable,
|
||||
prompt_response_callback,
|
||||
session_vnc);
|
||||
- grd_session_vnc_detach_source (session_vnc);
|
||||
+ grd_session_vnc_pause (session_vnc);
|
||||
return RFB_CLIENT_ON_HOLD;
|
||||
case GRD_VNC_AUTH_METHOD_PASSWORD:
|
||||
session_vnc->rfb_screen->passwordCheck = check_rfb_password;
|
||||
@@ -536,7 +550,7 @@ check_rfb_password (rfbClientPtr rfb_client,
|
||||
if (memcmp (challenge_encrypted, response_encrypted, len) == 0)
|
||||
{
|
||||
grd_session_start (GRD_SESSION (session_vnc));
|
||||
- grd_session_vnc_detach_source (session_vnc);
|
||||
+ grd_session_vnc_pause (session_vnc);
|
||||
return TRUE;
|
||||
}
|
||||
else
|
||||
@@ -731,6 +745,36 @@ grd_session_vnc_detach_source (GrdSessionVnc *session_vnc)
|
||||
g_clear_pointer (&session_vnc->source, g_source_unref);
|
||||
}
|
||||
|
||||
+gboolean
|
||||
+grd_session_vnc_is_paused (GrdSessionVnc *session_vnc)
|
||||
+{
|
||||
+ return session_vnc->is_paused;
|
||||
+}
|
||||
+
|
||||
+static void
|
||||
+grd_session_vnc_pause (GrdSessionVnc *session_vnc)
|
||||
+{
|
||||
+ if (grd_session_vnc_is_paused (session_vnc))
|
||||
+ return;
|
||||
+
|
||||
+ session_vnc->is_paused = TRUE;
|
||||
+
|
||||
+ grd_session_vnc_detach_source (session_vnc);
|
||||
+ g_signal_emit (session_vnc, signals[PAUSED], 0);
|
||||
+}
|
||||
+
|
||||
+static void
|
||||
+grd_session_vnc_resume (GrdSessionVnc *session_vnc)
|
||||
+{
|
||||
+ if (!grd_session_vnc_is_paused (session_vnc))
|
||||
+ return;
|
||||
+
|
||||
+ session_vnc->is_paused = FALSE;
|
||||
+
|
||||
+ grd_session_vnc_attach_source (session_vnc);
|
||||
+ g_signal_emit (session_vnc, signals[RESUMED], 0);
|
||||
+}
|
||||
+
|
||||
GrdSessionVnc *
|
||||
grd_session_vnc_new (GrdVncServer *vnc_server,
|
||||
GSocketConnection *connection)
|
||||
@@ -748,6 +792,7 @@ grd_session_vnc_new (GrdVncServer *vnc_server,
|
||||
|
||||
grd_session_vnc_grab_socket (session_vnc, vnc_socket_grab_func);
|
||||
grd_session_vnc_attach_source (session_vnc);
|
||||
+ session_vnc->is_paused = FALSE;
|
||||
|
||||
init_vnc_session (session_vnc);
|
||||
|
||||
@@ -777,7 +822,7 @@ grd_session_vnc_stop (GrdSession *session)
|
||||
|
||||
g_clear_object (&session_vnc->pipewire_stream);
|
||||
|
||||
- grd_session_vnc_detach_source (session_vnc);
|
||||
+ grd_session_vnc_pause (session_vnc);
|
||||
|
||||
g_clear_object (&session_vnc->connection);
|
||||
g_clear_object (&session_vnc->clipboard_vnc);
|
||||
@@ -837,8 +882,8 @@ grd_session_vnc_stream_ready (GrdSession *session,
|
||||
G_CALLBACK (on_pipewire_stream_closed),
|
||||
session_vnc);
|
||||
|
||||
- if (!session_vnc->source)
|
||||
- grd_session_vnc_attach_source (session_vnc);
|
||||
+ if (grd_session_vnc_is_paused (session_vnc))
|
||||
+ grd_session_vnc_resume (session_vnc);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -859,4 +904,17 @@ grd_session_vnc_class_init (GrdSessionVncClass *klass)
|
||||
session_class->remote_desktop_session_started =
|
||||
grd_session_vnc_remote_desktop_session_started;
|
||||
session_class->stream_ready = grd_session_vnc_stream_ready;
|
||||
+
|
||||
+ signals[PAUSED] = g_signal_new ("paused",
|
||||
+ G_TYPE_FROM_CLASS (klass),
|
||||
+ G_SIGNAL_RUN_LAST,
|
||||
+ 0,
|
||||
+ NULL, NULL, NULL,
|
||||
+ G_TYPE_NONE, 0);
|
||||
+ signals[RESUMED] = g_signal_new ("resumed",
|
||||
+ G_TYPE_FROM_CLASS (klass),
|
||||
+ G_SIGNAL_RUN_LAST,
|
||||
+ 0,
|
||||
+ NULL, NULL, NULL,
|
||||
+ G_TYPE_NONE, 0);
|
||||
}
|
||||
--
|
||||
2.36.1
|
||||
|
||||
|
||||
From 156cd6920fd461a677c3eb848590a88249079303 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Jonas=20=C3=85dahl?= <jadahl@gmail.com>
|
||||
Date: Wed, 11 May 2022 11:19:26 +0100
|
||||
Subject: [PATCH 7/7] session-vnc: Set our own password handling function up
|
||||
front
|
||||
|
||||
libvncserver decides whether to register a auth security handler
|
||||
@ -1472,7 +1507,7 @@ password prompt.
|
||||
1 file changed, 2 insertions(+), 6 deletions(-)
|
||||
|
||||
diff --git a/src/grd-session-vnc.c b/src/grd-session-vnc.c
|
||||
index 9708de0..bc60285 100644
|
||||
index 39d3ead..6d0e5e2 100644
|
||||
--- a/src/grd-session-vnc.c
|
||||
+++ b/src/grd-session-vnc.c
|
||||
@@ -95,11 +95,6 @@ grd_session_vnc_pause (GrdSessionVnc *session_vnc);
|
||||
@ -1505,40 +1540,5 @@ index 9708de0..bc60285 100644
|
||||
rfbProcessEvents (rfb_screen, 0);
|
||||
}
|
||||
--
|
||||
2.34.1
|
||||
|
||||
|
||||
From 539d2c562b8068f1f698468cb87b36b4968c1517 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Jonas=20=C3=85dahl?= <jadahl@gmail.com>
|
||||
Date: Mon, 12 Oct 2020 17:34:30 +0200
|
||||
Subject: [PATCH 7/7] vnc: Copy pixels using the right destination stride
|
||||
|
||||
We're copying the pixels in a separate thread managed by PipeWire, and
|
||||
in this thread, accessing the VNC framebuffer dimension and stride is
|
||||
racy. Instead of fetching the dimension directly, pass the expected
|
||||
width and get the stride it will eventually have.
|
||||
|
||||
Already before this patch, when the copied pixel end up on the main
|
||||
thread and the dimension still doesn't match up, the frame will be
|
||||
dropped.
|
||||
---
|
||||
src/grd-session-vnc.h | 3 ++-
|
||||
1 file changed, 2 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/grd-session-vnc.h b/src/grd-session-vnc.h
|
||||
index 8a916b7..e85f31e 100644
|
||||
--- a/src/grd-session-vnc.h
|
||||
+++ b/src/grd-session-vnc.h
|
||||
@@ -67,7 +67,8 @@ int grd_session_vnc_get_stride_for_width (GrdSessionVnc *session_vnc,
|
||||
|
||||
int grd_session_vnc_get_fd (GrdSessionVnc *session_vnc);
|
||||
|
||||
-int grd_session_vnc_get_framebuffer_stride (GrdSessionVnc *session_vnc);
|
||||
+int grd_session_vnc_get_stride_for_width (GrdSessionVnc *session_vnc,
|
||||
+ int width);
|
||||
|
||||
gboolean grd_session_vnc_is_client_gone (GrdSessionVnc *session_vnc);
|
||||
|
||||
--
|
||||
2.34.1
|
||||
2.36.1
|
||||
|
||||
|
2
sources
2
sources
@ -1 +1 @@
|
||||
SHA512 (gnome-remote-desktop-42.1.tar.xz) = 3e17d6482941fccfe6860d2ca2db50235ee70a26fd8942ee1850addb11006cfb152dd949102a4c573f2b6a29f9f2bb78c9ad5be1cba8622ad5b54f82c509376f
|
||||
SHA512 (gnome-remote-desktop-42.1.1.tar.xz) = 4fbf9305aa7339d9e7fcbf8df8eea97ba675630f6d01ef9a9f049ca3a3bf930f26b0e993ffe386682906d719b15058ce752e4592a3e710ceceb977000ebb1ce1
|
||||
|
Loading…
Reference in New Issue
Block a user