diff --git a/.fmf/version b/.fmf/version deleted file mode 100644 index d00491f..0000000 --- a/.fmf/version +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/.gitignore b/.gitignore index 586a68d..11f8a4a 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,19 @@ -/gnome-remote-desktop-*.tar.xz -/gnome-remote-desktop-*-build +/gnome-remote-desktop-0.1.*.tar.xz +/gnome-remote-desktop-40.beta.tar.xz +/gnome-remote-desktop-40.rc.tar.xz +/gnome-remote-desktop-40.0.tar.xz +/gnome-remote-desktop-40.1.tar.xz +/gnome-remote-desktop-41.rc.tar.xz +/gnome-remote-desktop-41.0.tar.xz +/gnome-remote-desktop-41.1.tar.xz +/gnome-remote-desktop-41.2.tar.xz +/gnome-remote-desktop-42.beta.tar.xz +/gnome-remote-desktop-42.rc.tar.xz +/gnome-remote-desktop-42.0.tar.xz +/gnome-remote-desktop-42.1.tar.xz +/gnome-remote-desktop-42.1.1.tar.xz +/gnome-remote-desktop-42.2.tar.xz +/gnome-remote-desktop-42.3.tar.xz +/gnome-remote-desktop-42.4.tar.xz +/gnome-remote-desktop-42.5.tar.xz +/gnome-remote-desktop-42.6.tar.xz diff --git a/0001-Add-man-page.patch b/0001-Add-man-page.patch new file mode 100644 index 0000000..ef8ef47 --- /dev/null +++ b/0001-Add-man-page.patch @@ -0,0 +1,220 @@ +From 712d6a036cfb6b49ad35d4d27ba8255f5fef36b6 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Jonas=20=C3=85dahl?= +Date: Mon, 14 Mar 2022 10:38:55 +0100 +Subject: [PATCH] Add man page + +Uses asciidoc; the stylesheet was copied from gnome-shell. +--- + .gitlab-ci.yml | 3 +- + man/grdctl.txt | 88 ++++++++++++++++++++++++++++++++++++++++++++++ + man/meson.build | 9 +++++ + man/stylesheet.xsl | 27 ++++++++++++++ + meson.build | 5 +++ + meson_options.txt | 5 +++ + 6 files changed, 136 insertions(+), 1 deletion(-) + create mode 100644 man/grdctl.txt + create mode 100644 man/meson.build + create mode 100644 man/stylesheet.xsl + +diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml +index f261657..735bb64 100644 +--- a/.gitlab-ci.yml ++++ b/.gitlab-ci.yml +@@ -9,7 +9,7 @@ stages: + .gnome-remote-desktop.fedora:35@common: + variables: + FDO_DISTRIBUTION_VERSION: 35 +- BASE_TAG: '2022-02-11.0' ++ BASE_TAG: '2022-03-14.0' + FDO_UPSTREAM_REPO: GNOME/gnome-remote-desktop + FDO_DISTRIBUTION_EXEC: | + dnf -y update && dnf -y upgrade && +@@ -21,6 +21,7 @@ stages: + dnf builddep -y gnome-remote-desktop && + dnf install -y 'pkgconfig(epoxy)' 'pkgconfig(libdrm)' 'pkgconfig(gbm)' \ + 'pkgconfig(gudev-1.0)' && ++ dnf install -y asciidoc && + + # To test + dnf install -y 'pkgconfig(libvncclient)' && +diff --git a/man/grdctl.txt b/man/grdctl.txt +new file mode 100644 +index 0000000..83777da +--- /dev/null ++++ b/man/grdctl.txt +@@ -0,0 +1,88 @@ ++GRDCTL(1) ++========= ++:man manual: User Commands ++:man source: GNOME-REMOTE-DESKTOP ++:doctype: manpage ++:date: March 2022 ++ ++NAME ++---- ++grdctl - Command line tool for configuring GNOME Remote Desktop ++ ++SYNOPSIS ++-------- ++*grdctl* ['OPTION'...] ['COMMAND'] ['SUBCOMMAND'...] ++ ++DESCRIPTION ++----------- ++grdctl provides methods for configuring the GNOME Remote Desktop service, ++for example setting credentials. ++ ++OPTIONS ++------- ++*--help*:: ++Show help text. ++ ++GENERAL COMMANDS ++---------------- ++*status*:: ++Show current status. ++ ++RDP COMMANDS ++------------ ++*rdp* *enable*:: ++Enable the RDP backend. ++ ++*rdp* *disable*:: ++Disable the RDP backend. ++ ++*rdp* *set-tls-cert* 'TLS-CERT':: ++Set path to TLS certificate. ++ ++*rdp* *set-tls-key* 'TLS-KEY':: ++Set path to TLS key. ++ ++*rdp* *set-credentials* 'USERNAME' 'PASSWORD':: ++Set username and password credentials. ++ ++*rdp* *clear-credentials*:: ++Clear username and password credentials. ++ ++*rdp* *enable-view-only*:: ++Disable remote control of input devices. ++ ++*rdp* *disable-view-only*:: ++Enable remote control of input devices. ++ ++VNC COMMANDS ++------------ ++*vnc* *enable*:: ++Enable the VNC backend. ++ ++*vnc* *disable*:: ++Disable the VNC backend. ++ ++*vnc* *set-password* 'PASSWORD':: ++Set the VNC password. ++ ++*vnc* *clear-password*:: ++Clear the VNC password. ++ ++*vnc* *set-auth-method* 'AUTH-METHOD':: ++Set the authorization method used for new VNC connections. Can be either ++*password* or *prompt*. ++ ++*vnc* *enable-view-only*: ++Disable remote control of input devices. ++ ++*vnc* *disable-view-only*:: ++Enable remote control of input devices. ++ ++BUGS ++---- ++The bug tracker can be reached by visiting the website ++https://gitlab.gnome.org/GNOME/gnome-remote-desktop/issues. Before sending ++a bug report, please verify that you have the latest version of ++gnome-remote-desktop. Many bugs (major and minor) are fixed at each ++release, and if yours is out of date, the problem may already have been ++solved. +diff --git a/man/meson.build b/man/meson.build +new file mode 100644 +index 0000000..1e73f11 +--- /dev/null ++++ b/man/meson.build +@@ -0,0 +1,9 @@ ++a2x = find_program('a2x') ++ ++custom_target('man page', ++ input: ['grdctl.txt', 'stylesheet.xsl'], ++ output: 'grdctl.1', ++ command: [a2x, '-v', '-D', '@OUTDIR@', '--xsl-file', '@INPUT1@', '-f' ,'manpage', '@INPUT0@'], ++ install_dir: mandir + '/man1', ++ install: true ++) +diff --git a/man/stylesheet.xsl b/man/stylesheet.xsl +new file mode 100644 +index 0000000..047bd1b +--- /dev/null ++++ b/man/stylesheet.xsl +@@ -0,0 +1,27 @@ ++ ++ ++ ++ ++ ++ .PP ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ .RS 4 ++ ++ .\" ++ ++ ++ ++ .RE ++ ++ ++ ++ +diff --git a/meson.build b/meson.build +index 6bd2420..0660cd0 100644 +--- a/meson.build ++++ b/meson.build +@@ -55,6 +55,7 @@ endif + prefix = get_option('prefix') + libexecdir = join_paths(prefix, get_option('libexecdir')) + datadir = join_paths(prefix, get_option('datadir')) ++mandir = join_paths(prefix, get_option('mandir')) + schemadir = join_paths(datadir, 'glib-2.0', 'schemas') + + grd_datadir = join_paths(datadir, 'gnome-remote-desktop') +@@ -93,6 +94,10 @@ subdir('src') + subdir('tests') + subdir('po') + ++if get_option('man') ++ subdir('man') ++endif ++ + meson.add_install_script('meson_post_install.py') + + output = [ +diff --git a/meson_options.txt b/meson_options.txt +index 3527588..2897f30 100644 +--- a/meson_options.txt ++++ b/meson_options.txt +@@ -1,3 +1,8 @@ ++option('man', ++ type: 'boolean', ++ value: true, ++ description: 'Generate man pages') ++ + option('rdp', + type: 'boolean', + value: true, +-- +2.34.1 + diff --git a/gnome-remote-desktop.spec b/gnome-remote-desktop.spec index 5d15c82..0eab6ff 100644 --- a/gnome-remote-desktop.spec +++ b/gnome-remote-desktop.spec @@ -1,70 +1,45 @@ -%global systemd_unit_handover gnome-remote-desktop-handover.service -%global systemd_unit_headless gnome-remote-desktop-headless.service -%global systemd_unit_system gnome-remote-desktop.service -%global systemd_unit_user gnome-remote-desktop.service +%global systemd_unit gnome-remote-desktop.service %global tarball_version %%(echo %{version} | tr '~' '.') -%bcond rdp %[0%{?fedora} || 0%{?rhel} >= 10] -%bcond vnc %[0%{?fedora} || 0%{?rhel} < 10] - -%global libei_version 1.0.901 -%global pipewire_version 0.3.49 - Name: gnome-remote-desktop -Version: 49.2 -Release: %autorelease +Version: 42.6 +Release: 1%{?dist} Summary: GNOME Remote Desktop screen share service -License: GPL-2.0-or-later +License: GPLv2+ URL: https://gitlab.gnome.org/GNOME/gnome-remote-desktop -Source0: https://download.gnome.org/sources/%{name}/49/%{name}-%{tarball_version}.tar.xz +Source0: https://download.gnome.org/sources/%{name}/42/%{name}-%{tarball_version}.tar.xz # Adds encryption support (requires patched LibVNCServer) Patch0: gnutls-anontls.patch +Patch1: 0001-Add-man-page.patch + BuildRequires: asciidoc BuildRequires: gcc BuildRequires: meson >= 0.47.0 BuildRequires: systemd-rpm-macros BuildRequires: pkgconfig(cairo) BuildRequires: pkgconfig(epoxy) -BuildRequires: pkgconfig(dbus-1) BuildRequires: pkgconfig(ffnvcodec) -%if %{with rdp} -BuildRequires: glslc -BuildRequires: spirv-tools -BuildRequires: pkgconfig(fdk-aac) -BuildRequires: pkgconfig(freerdp3) +BuildRequires: pkgconfig(freerdp2) BuildRequires: pkgconfig(fuse3) -BuildRequires: pkgconfig(libva) -BuildRequires: pkgconfig(opus) -BuildRequires: pkgconfig(polkit-gobject-1) -BuildRequires: pkgconfig(vulkan) -BuildRequires: pkgconfig(winpr3) -%endif BuildRequires: pkgconfig(gbm) BuildRequires: pkgconfig(glib-2.0) >= 2.68 BuildRequires: pkgconfig(gio-unix-2.0) BuildRequires: pkgconfig(gnutls) BuildRequires: pkgconfig(gudev-1.0) BuildRequires: pkgconfig(libdrm) -BuildRequires: pkgconfig(libei-1.0) >= %{libei_version} BuildRequires: pkgconfig(libnotify) BuildRequires: pkgconfig(libpipewire-0.3) BuildRequires: pkgconfig(libsecret-1) -%if %{with vnc} BuildRequires: pkgconfig(libvncserver) >= 0.9.11-7 -%endif BuildRequires: pkgconfig(systemd) +BuildRequires: pkgconfig(winpr2) BuildRequires: pkgconfig(xkbcommon) -BuildRequires: pkgconfig(tss2-esys) -BuildRequires: pkgconfig(tss2-mu) -BuildRequires: pkgconfig(tss2-rc) -BuildRequires: pkgconfig(tss2-tctildr) -Requires: libei%{?_isa} >= %{libei_version} -Requires: pipewire%{?_isa} >= %{pipewire_version} +Requires: pipewire%{?_isa} >= 0.3.0 Obsoletes: vino < 3.22.0-21 @@ -79,18 +54,9 @@ GNOME desktop environment. %build %meson \ -%if %{with rdp} -Drdp=true \ -%else - -Drdp=false \ -%endif -%if %{with vnc} - -Dvnc=true \ -%else - -Dvnc=false \ -%endif -Dsystemd=true \ - -Dtests=false + -Dvnc=true %meson_build @@ -101,54 +67,175 @@ GNOME desktop environment. %post -%systemd_post %{systemd_unit_system} -%systemd_user_post %{systemd_unit_handover} -%systemd_user_post %{systemd_unit_headless} -%systemd_user_post %{systemd_unit_user} +%systemd_user_post %{systemd_unit} %preun -%systemd_preun %{systemd_unit_system} -%systemd_user_preun %{systemd_unit_handover} -%systemd_user_preun %{systemd_unit_headless} -%systemd_user_preun %{systemd_unit_user} +%systemd_user_preun %{systemd_unit} %postun -%systemd_postun_with_restart %{systemd_unit_system} -%systemd_user_postun_with_restart %{systemd_unit_handover} -%systemd_user_postun_with_restart %{systemd_unit_headless} -%systemd_user_postun_with_restart %{systemd_unit_user} +%systemd_user_postun_with_restart %{systemd_unit} %files -f %{name}.lang %license COPYING -%doc README.md +%doc README %{_bindir}/grdctl %{_libexecdir}/gnome-remote-desktop-daemon -%{_libexecdir}/gnome-remote-desktop-enable-service -%{_libexecdir}/gnome-remote-desktop-configuration-daemon -%{_userunitdir}/%{systemd_unit_user} -%{_userunitdir}/%{systemd_unit_headless} -%{_userunitdir}/%{systemd_unit_handover} -%{_unitdir}/%{systemd_unit_system} -%{_unitdir}/gnome-remote-desktop-configuration.service -%{_datadir}/applications/org.gnome.RemoteDesktop.Handover.desktop -%{_datadir}/dbus-1/system-services/org.gnome.RemoteDesktop.Configuration.service -%{_datadir}/dbus-1/system.d/org.gnome.RemoteDesktop.conf +%{_userunitdir}/%{systemd_unit} %{_datadir}/glib-2.0/schemas/org.gnome.desktop.remote-desktop.gschema.xml %{_datadir}/glib-2.0/schemas/org.gnome.desktop.remote-desktop.enums.xml -%{_datadir}/polkit-1/actions/org.gnome.remotedesktop.configure-system-daemon.policy -%{_datadir}/polkit-1/actions/org.gnome.remotedesktop.enable-system-daemon.policy -%{_datadir}/polkit-1/rules.d/20-gnome-remote-desktop.rules -%{_sysusersdir}/gnome-remote-desktop-sysusers.conf -%{_tmpfilesdir}/gnome-remote-desktop-tmpfiles.conf - -%if %{with rdp} %{_datadir}/gnome-remote-desktop/ -%endif %{_mandir}/man1/grdctl.1* %changelog -%autochangelog +* Fri Nov 25 2022 Jonas Ådahl - 42.6-1 +- Update to 42.6 + +* Wed Oct 05 2022 Jonas Ådahl - 42.5-1 +- Update to 42.5 + +* Thu Aug 18 2022 Kalev Lember - 42.4-1 +- Update to 42.4 + +* Mon Aug 15 2022 Simone Caronni - 42.3-2 +- Rebuild for updated FreeRDP. + +* Thu Jul 07 2022 David King - 42.3-1 +- Update to 42.3 (#2091415) + +* Thu Jun 09 2022 Jonas Ådahl - 42.2-2 +- Backport regression fix + Resolves: #2094291 + +* Sun May 29 2022 David King - 42.2-1 +- Update to 42.2 + +* Wed May 11 2022 David King - 42.1.1-1 +- Update to 42.1.1 (#2061546) + +* Wed Apr 27 2022 David King - 42.1-2 +- Fix isa macro in Requires + +* Tue Apr 26 2022 David King - 42.1-1 +- Update to 42.1 (#2061546) + +* Mon Mar 21 2022 Jonas Ådahl - 42.0 +- Update to 42.0 + +* Mon Mar 14 2022 Jonas Ådahl - 42~rc-1 +- Update to 42.rc + +* Wed Feb 16 2022 Jonas Ådahl - 42~beta-1 +- Update to 42.beta + +* Thu Jan 20 2022 Fedora Release Engineering - 41.2-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild + +* Wed Dec 08 2021 Jonas Ådahl - 41.2-1 +- Update to 41.2 + +* Mon Nov 01 2021 Kalev Lember - 41.1-1 +- Update to 41.1 + +* Mon Sep 20 2021 Kalev Lember - 41.0-1 +- Update to 41.0 + +* Tue Sep 07 2021 Jonas Ådahl - 41~rc-1 +- Bump to 41.rc + +* Wed Aug 04 2021 Kalev Lember - 40.1-3 +- Avoid systemd_requires as per updated packaging guidelines + +* Thu Jul 22 2021 Fedora Release Engineering - 40.1-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild + +* Mon May 03 2021 Jonas Ådahl - 40.1-1 +- Bump to 40.1 + +* Thu Apr 15 2021 Simone Caronni - 40.0-2 +- Rebuild for updated FreeRDP. + +* Mon Mar 22 2021 Kalev Lember - 40.0-1 +- Update to 40.0 + +* Thu Mar 18 2021 Michael Catanzaro - 40.0~rc-2 +- Add Obsoletes: vino + +* Mon Mar 15 2021 Kalev Lember - 40.0~rc-1 +- Update to 40.rc + +* Thu Mar 04 2021 Jonas Ådahl - 40.0~beta-1 +- Bump to 40.beta + +* Tue Jan 26 2021 Fedora Release Engineering - 0.1.9-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild + +* Mon Sep 14 2020 Jonas Ådahl - 0.1.9-2 +- Copy using the right destination stride + +* Mon Sep 14 2020 Jonas Ådahl - 0.1.9-1 +- Update to 0.1.9 +- Backport race condition crash fix +- Rebase anon-tls patches + +* Thu Aug 27 2020 Ray Strode - 0.1.8-3 +- Fix crash + Related: #1844993 + +* Mon Jun 1 2020 Felipe Borges - 0.1.8-2 +- Fix black screen issue in remote connections on Wayland + +* Wed Mar 11 2020 Jonas Ådahl - 0.1.8-1 +- Update to 0.1.8 + +* Tue Jan 28 2020 Fedora Release Engineering - 0.1.7-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild + +* Thu Jul 25 2019 Fedora Release Engineering - 0.1.7-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild + +* Mon Mar 4 2019 Jonas Ådahl - 0.1.7-1 +- Update to 0.1.7 + +* Thu Jan 31 2019 Fedora Release Engineering - 0.1.6-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild + +* Tue Oct 2 2018 Jonas Ådahl - 0.1.6-2 +- Don't crash when PipeWire disconnects (rhbz#1632781) + +* Tue Aug 7 2018 Jonas Ådahl - 0.1.6 +- Update to 0.1.6 +- Apply ANON-TLS patch +- Depend on pipewire 0.2.2 + +* Fri Jul 13 2018 Fedora Release Engineering - 0.1.4-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild + +* Wed May 30 2018 Jonas Ådahl - 0.1.4-1 +- Update to new version + +* Fri Feb 09 2018 Igor Gnatenko - 0.1.2-5 +- Escape macros in %%changelog + +* Wed Feb 07 2018 Fedora Release Engineering - 0.1.2-4 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild + +* Tue Aug 29 2017 Jonas Ådahl - 0.1.2-3 +- Use %%autosetup +- Install licence file + +* Tue Aug 22 2017 Jonas Ådahl - 0.1.2-2 +- Remove gschema compilation step as that had been deprecated + +* Mon Aug 21 2017 Jonas Ådahl - 0.1.2-1 +- Update to 0.1.2 +- Changed tabs to spaces +- Added systemd user macros +- Install to correct systemd user unit directory +- Compile gsettings schemas after install and uninstall + +* Mon Aug 21 2017 Jonas Ådahl - 0.1.1-1 +- First packaged version diff --git a/gnutls-anontls.patch b/gnutls-anontls.patch index 6151d72..d36acfd 100644 --- a/gnutls-anontls.patch +++ b/gnutls-anontls.patch @@ -1,4 +1,4 @@ -From 005617f3e2cb59241dc02c2db714c2b934553acb Mon Sep 17 00:00:00 2001 +From 63d1c041e3997bfc78803b4d0fe09d96b53c9e50 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20=C3=85dahl?= Date: Thu, 14 Jun 2018 12:21:37 +0200 Subject: [PATCH 1/7] vnc: Add anonymous TLS encryption support @@ -13,34 +13,34 @@ VNC connection. src/grd-enums.h | 6 + src/grd-session-vnc.c | 120 ++++- src/grd-session-vnc.h | 17 + - src/grd-settings-user.c | 4 + - src/grd-settings.c | 18 + - src/grd-vnc-server.c | 49 ++ + src/grd-settings.c | 28 ++ + src/grd-settings.h | 2 + + src/grd-vnc-server.c | 45 ++ src/grd-vnc-tls.c | 444 ++++++++++++++++++ src/grd-vnc-tls.h | 28 ++ src/meson.build | 3 + ...nome.desktop.remote-desktop.gschema.xml.in | 10 + - 11 files changed, 674 insertions(+), 26 deletions(-) + 11 files changed, 678 insertions(+), 26 deletions(-) create mode 100644 src/grd-vnc-tls.c create mode 100644 src/grd-vnc-tls.h diff --git a/meson.build b/meson.build -index 5dcb77c3..269238c0 100644 +index 72d34a4..9a341fa 100644 --- a/meson.build +++ b/meson.build -@@ -70,6 +70,7 @@ endif +@@ -50,6 +50,7 @@ endif if have_vnc - libvncclient_dep = dependency('libvncclient') libvncserver_dep = dependency('libvncserver') + libvncclient_dep = dependency('libvncclient') + gnutls_dep = dependency('gnutls') endif prefix = get_option('prefix') diff --git a/src/grd-enums.h b/src/grd-enums.h -index 25b42661..f4438764 100644 +index e3ecc40..fa8dfb7 100644 --- a/src/grd-enums.h +++ b/src/grd-enums.h -@@ -32,6 +32,12 @@ typedef enum +@@ -33,4 +33,10 @@ typedef enum GRD_VNC_AUTH_METHOD_PASSWORD } GrdVncAuthMethod; @@ -50,14 +50,12 @@ index 25b42661..f4438764 100644 + GRD_VNC_ENCRYPTION_TLS_ANON = 1 << 1, +} GrdVncEncryption; + - typedef enum - { - GRD_VNC_SCREEN_SHARE_MODE_MIRROR_PRIMARY, + #endif /* GRD_ENUMS_H */ diff --git a/src/grd-session-vnc.c b/src/grd-session-vnc.c -index f7e14080..b5e4fe13 100644 +index fbc66a4..fa694f0 100644 --- a/src/grd-session-vnc.c +++ b/src/grd-session-vnc.c -@@ -46,7 +46,9 @@ struct _GrdSessionVnc +@@ -45,7 +45,9 @@ struct _GrdSessionVnc { GrdSession parent; @@ -67,7 +65,7 @@ index f7e14080..b5e4fe13 100644 GSource *source; rfbScreenInfoPtr rfb_screen; rfbClientPtr rfb_client; -@@ -608,6 +610,12 @@ check_rfb_password (rfbClientPtr rfb_client, +@@ -543,6 +545,12 @@ check_rfb_password (rfbClientPtr rfb_client, } } @@ -80,7 +78,7 @@ index f7e14080..b5e4fe13 100644 int grd_session_vnc_get_stride_for_width (GrdSessionVnc *session_vnc, int width) -@@ -615,6 +623,18 @@ grd_session_vnc_get_stride_for_width (GrdSessionVnc *session_vnc, +@@ -550,6 +558,18 @@ grd_session_vnc_get_stride_for_width (GrdSessionVnc *session_vnc, return width * BGRX_BYTES_PER_PIXEL; } @@ -99,7 +97,7 @@ index f7e14080..b5e4fe13 100644 static void init_vnc_session (GrdSessionVnc *session_vnc) { -@@ -689,44 +709,85 @@ init_vnc_session (GrdSessionVnc *session_vnc) +@@ -593,44 +613,85 @@ init_vnc_session (GrdSessionVnc *session_vnc) rfbProcessEvents (rfb_screen, 0); } @@ -210,7 +208,7 @@ index f7e14080..b5e4fe13 100644 } return G_SOURCE_CONTINUE; -@@ -739,7 +800,10 @@ grd_session_vnc_attach_source (GrdSessionVnc *session_vnc) +@@ -643,7 +704,10 @@ grd_session_vnc_attach_source (GrdSessionVnc *session_vnc) socket = g_socket_connection_get_socket (session_vnc->connection); session_vnc->source = g_socket_create_source (socket, @@ -222,23 +220,18 @@ index f7e14080..b5e4fe13 100644 NULL); g_source_set_callback (session_vnc->source, (GSourceFunc) handle_socket_data, -@@ -780,6 +844,7 @@ grd_session_vnc_new (GrdVncServer *vnc_server, +@@ -673,8 +737,10 @@ grd_session_vnc_new (GrdVncServer *vnc_server, "context", context, NULL); + session_vnc->vnc_server = vnc_server; session_vnc->connection = g_object_ref (connection); - settings = grd_context_get_settings (context); -@@ -792,6 +857,7 @@ grd_session_vnc_new (GrdVncServer *vnc_server, - G_CALLBACK (on_view_only_changed), - session_vnc); - + grd_session_vnc_grab_socket (session_vnc, vnc_socket_grab_func); grd_session_vnc_attach_source (session_vnc); init_vnc_session (session_vnc); -@@ -806,6 +872,8 @@ grd_session_vnc_dispose (GObject *object) +@@ -689,6 +755,8 @@ grd_session_vnc_dispose (GObject *object) g_assert (!session_vnc->rfb_screen); @@ -248,7 +241,7 @@ index f7e14080..b5e4fe13 100644 G_OBJECT_CLASS (grd_session_vnc_parent_class)->dispose (object); diff --git a/src/grd-session-vnc.h b/src/grd-session-vnc.h -index 8fc71850..3c08f812 100644 +index fcc508d..092d9dc 100644 --- a/src/grd-session-vnc.h +++ b/src/grd-session-vnc.h @@ -36,6 +36,9 @@ G_DECLARE_FINAL_TYPE (GrdSessionVnc, @@ -261,7 +254,7 @@ index 8fc71850..3c08f812 100644 GrdSessionVnc *grd_session_vnc_new (GrdVncServer *vnc_server, GSocketConnection *connection); -@@ -62,4 +65,18 @@ void grd_session_vnc_set_client_clipboard_text (GrdSessionVnc *session_vnc, +@@ -62,6 +65,20 @@ void grd_session_vnc_set_client_clipboard_text (GrdSessionVnc *session_vnc, int grd_session_vnc_get_stride_for_width (GrdSessionVnc *session_vnc, int width); @@ -270,7 +263,7 @@ index 8fc71850..3c08f812 100644 +int grd_session_vnc_get_framebuffer_stride (GrdSessionVnc *session_vnc); + gboolean grd_session_vnc_is_client_gone (GrdSessionVnc *session_vnc); -+ + +rfbClientPtr grd_session_vnc_get_rfb_client (GrdSessionVnc *session_vnc); + +void grd_session_vnc_grab_socket (GrdSessionVnc *session_vnc, @@ -280,81 +273,96 @@ index 8fc71850..3c08f812 100644 + GrdVncSocketGrabFunc grab_func); + +GrdVncServer * grd_session_vnc_get_vnc_server (GrdSessionVnc *session_vnc); -diff --git a/src/grd-settings-user.c b/src/grd-settings-user.c -index 1bd679e4..c54e0b80 100644 ---- a/src/grd-settings-user.c -+++ b/src/grd-settings-user.c -@@ -91,6 +91,10 @@ grd_settings_user_constructed (GObject *object) - g_settings_bind (settings->vnc_settings, "screen-share-mode", - settings, "vnc-screen-share-mode", - G_SETTINGS_BIND_DEFAULT); -+ g_settings_bind (settings->vnc_settings, "encryption", -+ settings, "vnc-encryption", -+ G_SETTINGS_BIND_DEFAULT); + - - G_OBJECT_CLASS (grd_settings_user_parent_class)->constructed (object); - } + #endif /* GRD_SESSION_VNC_H */ diff --git a/src/grd-settings.c b/src/grd-settings.c -index 8393ace5..a65385ef 100644 +index dad5d57..7753186 100644 --- a/src/grd-settings.c +++ b/src/grd-settings.c -@@ -58,6 +58,7 @@ enum - PROP_RDP_SERVER_CERT_PATH, - PROP_RDP_SERVER_KEY_PATH, - PROP_VNC_AUTH_METHOD, -+ PROP_VNC_ENCRYPTION, - }; - - typedef struct _GrdSettingsPrivate -@@ -84,6 +85,7 @@ typedef struct _GrdSettingsPrivate +@@ -69,6 +69,7 @@ struct _GrdSettings gboolean view_only; - GrdVncScreenShareMode screen_share_mode; GrdVncAuthMethod auth_method; + int port; + GrdVncEncryption encryption; } vnc; - } GrdSettingsPrivate; + }; -@@ -426,6 +428,9 @@ grd_settings_get_property (GObject *object, - else - g_value_set_enum (value, priv->vnc.auth_method); - break; -+ case PROP_VNC_ENCRYPTION: -+ g_value_set_flags (value, priv->vnc.encryption); -+ break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - } -@@ -563,6 +568,9 @@ grd_settings_set_property (GObject *object, - case PROP_VNC_AUTH_METHOD: - priv->vnc.auth_method = g_value_get_enum (value); - break; -+ case PROP_VNC_ENCRYPTION: -+ priv->vnc.encryption = g_value_get_flags (value); -+ break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - } -@@ -744,4 +752,14 @@ grd_settings_class_init (GrdSettingsClass *klass) - G_PARAM_READWRITE | - G_PARAM_CONSTRUCT | - G_PARAM_STATIC_STRINGS)); -+ g_object_class_install_property (object_class, -+ PROP_VNC_ENCRYPTION, -+ g_param_spec_flags ("vnc-encryption", -+ "vnc encryption", -+ "vnc encryption", -+ GRD_TYPE_VNC_ENCRYPTION, -+ GRD_VNC_ENCRYPTION_TLS_ANON, -+ G_PARAM_READWRITE | -+ G_PARAM_CONSTRUCT | -+ G_PARAM_STATIC_STRINGS)); +@@ -259,6 +260,12 @@ grd_settings_get_vnc_auth_method (GrdSettings *settings) + return settings->vnc.auth_method; } + ++GrdVncEncryption ++grd_settings_get_vnc_encryption (GrdSettings *settings) ++{ ++ return settings->vnc.encryption; ++} ++ + static void + update_screen_share_mode (GrdSettings *settings) + { +@@ -317,6 +324,13 @@ update_vnc_auth_method (GrdSettings *settings) + "auth-method"); + } + ++static void ++update_vnc_encryption (GrdSettings *settings) ++{ ++ settings->vnc.encryption = g_settings_get_flags (settings->vnc.settings, ++ "encryption"); ++} ++ + static void + on_rdp_settings_changed (GSettings *rdp_settings, + const char *key, +@@ -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); + } ++ else if (strcmp (key, "encryption") == 0) ++ { ++ update_vnc_encryption (settings); ++ g_signal_emit (settings, signals[VNC_ENCRYPTION_CHANGED], 0); ++ } + } + + static void +@@ -406,6 +425,8 @@ grd_settings_init (GrdSettings *settings) + + settings->rdp.port = GRD_RDP_SERVER_PORT; + settings->vnc.port = GRD_VNC_SERVER_PORT; ++ ++ update_vnc_encryption (settings); + } + + static void +@@ -471,4 +492,11 @@ grd_settings_class_init (GrdSettingsClass *klass) + 0, + NULL, NULL, NULL, + G_TYPE_NONE, 0); ++ signals[VNC_ENCRYPTION_CHANGED] = ++ g_signal_new ("vnc-encryption-changed", ++ G_TYPE_FROM_CLASS (klass), ++ G_SIGNAL_RUN_LAST, ++ 0, ++ NULL, NULL, NULL, ++ G_TYPE_NONE, 0); + } +diff --git a/src/grd-settings.h b/src/grd-settings.h +index 449894a..900d81e 100644 +--- a/src/grd-settings.h ++++ b/src/grd-settings.h +@@ -65,4 +65,6 @@ gboolean grd_settings_get_vnc_view_only (GrdSettings *settings); + + GrdVncAuthMethod grd_settings_get_vnc_auth_method (GrdSettings *settings); + ++GrdVncEncryption grd_settings_get_vnc_encryption (GrdSettings *settings); ++ + #endif /* GRD_SETTINGS_H */ diff --git a/src/grd-vnc-server.c b/src/grd-vnc-server.c -index 83220655..2f8229b2 100644 +index 0b4322d..e8833f1 100644 --- a/src/grd-vnc-server.c +++ b/src/grd-vnc-server.c -@@ -24,6 +24,7 @@ +@@ -24,11 +24,13 @@ #include "grd-vnc-server.h" @@ -362,15 +370,13 @@ index 83220655..2f8229b2 100644 #include #include -@@ -31,6 +32,7 @@ - #include "grd-debug.h" + #include "grd-context.h" #include "grd-session-vnc.h" - #include "grd-utils.h" +#include "grd-vnc-tls.h" + enum - { -@@ -130,6 +132,45 @@ on_incoming (GSocketService *service, +@@ -129,6 +131,43 @@ on_incoming (GSocketService *service, return TRUE; } @@ -382,9 +388,7 @@ index 83220655..2f8229b2 100644 + GrdVncEncryption encryption; + + tls_security_handler = grd_vnc_tls_get_security_handler (); -+ g_object_get (G_OBJECT (settings), -+ "vnc-encryption", &encryption, -+ NULL); ++ encryption = grd_settings_get_vnc_encryption (settings); + + if (encryption == (GRD_VNC_ENCRYPTION_NONE | GRD_VNC_ENCRYPTION_TLS_ANON)) + { @@ -416,19 +420,18 @@ index 83220655..2f8229b2 100644 gboolean grd_vnc_server_start (GrdVncServer *vnc_server, GError **error) -@@ -242,11 +283,19 @@ grd_vnc_server_dispose (GObject *object) - static void +@@ -217,12 +256,18 @@ static void grd_vnc_server_constructed (GObject *object) { -+ GrdVncServer *vnc_server = GRD_VNC_SERVER (object); + GrdVncServer *vnc_server = GRD_VNC_SERVER (object); + GrdSettings *settings = grd_context_get_settings (vnc_server->context); -+ - if (grd_get_debug_flags () & GRD_DEBUG_VNC) + + if (grd_context_get_debug_flags (vnc_server->context) & GRD_DEBUG_VNC) rfbLogEnable (1); else rfbLogEnable (0); -+ g_signal_connect (settings, "notify::vnc-encryption", ++ g_signal_connect (settings, "vnc-encryption-changed", + G_CALLBACK (on_vnc_encryption_changed), + vnc_server); + sync_encryption_settings (vnc_server); @@ -438,7 +441,7 @@ index 83220655..2f8229b2 100644 diff --git a/src/grd-vnc-tls.c b/src/grd-vnc-tls.c new file mode 100644 -index 00000000..ec4758e0 +index 0000000..ec4758e --- /dev/null +++ b/src/grd-vnc-tls.c @@ -0,0 +1,444 @@ @@ -888,7 +891,7 @@ index 00000000..ec4758e0 +} diff --git a/src/grd-vnc-tls.h b/src/grd-vnc-tls.h new file mode 100644 -index 00000000..135ef8c7 +index 0000000..135ef8c --- /dev/null +++ b/src/grd-vnc-tls.h @@ -0,0 +1,28 @@ @@ -921,10 +924,10 @@ index 00000000..135ef8c7 + +#endif /* GRD_VNC_TLS_H */ diff --git a/src/meson.build b/src/meson.build -index 1b2cb93d..6b8b517e 100644 +index 1d671d7..ab675ff 100644 --- a/src/meson.build +++ b/src/meson.build -@@ -274,10 +274,13 @@ if have_vnc +@@ -115,10 +115,13 @@ if have_vnc 'grd-vnc-pipewire-stream.h', 'grd-vnc-server.c', 'grd-vnc-server.h', @@ -939,11 +942,11 @@ index 1b2cb93d..6b8b517e 100644 endif diff --git a/src/org.gnome.desktop.remote-desktop.gschema.xml.in b/src/org.gnome.desktop.remote-desktop.gschema.xml.in -index 2986a0e5..a0169789 100644 +index 939b9a6..e57affb 100644 --- a/src/org.gnome.desktop.remote-desktop.gschema.xml.in +++ b/src/org.gnome.desktop.remote-desktop.gschema.xml.in -@@ -173,6 +173,16 @@ - configuration updates. +@@ -90,5 +90,15 @@ + * password - by requiring the remote client to provide a known password + @@ -957,184 +960,15 @@ index 2986a0e5..a0169789 100644 + + - - + -- -2.51.0 +2.36.1 -From bc65e13fb3687b2f79433c880525333810d6ba31 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Jonas=20=C3=85dahl?= -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 b5e4fe13..79de30d4 100644 ---- a/src/grd-session-vnc.c -+++ b/src/grd-session-vnc.c -@@ -42,14 +42,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; - -@@ -81,7 +94,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); -@@ -248,7 +261,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; - } -@@ -338,7 +352,7 @@ handle_new_client (rfbClientPtr rfb_client) - { - case GRD_VNC_AUTH_METHOD_PROMPT: - show_sharing_desktop_prompt (session_vnc, rfb_client->host); -- 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; -@@ -601,7 +615,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 -@@ -821,6 +835,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); -+} -+ - static void - on_view_only_changed (GrdSettings *settings, - GParamSpec *pspec, -@@ -859,6 +903,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); - -@@ -893,7 +938,7 @@ grd_session_vnc_stop (GrdSession *session) - g_clear_object (&session_vnc->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); -@@ -984,8 +1029,8 @@ on_stream_ready (GrdStream *stream, - 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 -@@ -1021,4 +1066,17 @@ grd_session_vnc_class_init (GrdSessionVncClass *klass) - - session_class->stop = grd_session_vnc_stop; - session_class->on_stream_created = grd_session_vnc_on_stream_created; -+ -+ 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.51.0 - - -From aabc0245e247fbffe9ae6b8281cbf2bccc9ab882 Mon Sep 17 00:00:00 2001 +From 38d981d05fa79da2aa15076637253f6c4cc606d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20=C3=85dahl?= 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. @@ -1144,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 79de30d4..b48b9017 100644 +index fa694f0..1edd33a 100644 --- a/src/grd-session-vnc.c +++ b/src/grd-session-vnc.c -@@ -771,6 +771,21 @@ vnc_socket_grab_func (GrdSessionVnc *session_vnc, +@@ -661,6 +661,21 @@ vnc_socket_grab_func (GrdSessionVnc *session_vnc, return TRUE; } @@ -1169,7 +1003,7 @@ index 79de30d4..b48b9017 100644 static gboolean handle_socket_data (GSocket *socket, GIOCondition condition, -@@ -787,16 +802,7 @@ handle_socket_data (GSocket *socket, +@@ -677,16 +692,7 @@ handle_socket_data (GSocket *socket, } else if (condition & G_IO_IN) { @@ -1188,24 +1022,26 @@ index 79de30d4..b48b9017 100644 else { diff --git a/src/grd-session-vnc.h b/src/grd-session-vnc.h -index 3c08f812..f230887e 100644 +index 092d9dc..e9eced0 100644 --- a/src/grd-session-vnc.h +++ b/src/grd-session-vnc.h -@@ -79,4 +79,6 @@ void grd_session_vnc_grab_socket (GrdSessionVnc *session_vnc, +@@ -79,6 +79,8 @@ void grd_session_vnc_grab_socket (GrdSessionVnc *session_vnc, void grd_session_vnc_ungrab_socket (GrdSessionVnc *session_vnc, GrdVncSocketGrabFunc grab_func); +void grd_session_vnc_dispatch (GrdSessionVnc *session_vnc); + GrdVncServer * grd_session_vnc_get_vnc_server (GrdSessionVnc *session_vnc); + + #endif /* GRD_SESSION_VNC_H */ -- -2.51.0 +2.36.1 -From 2d43f0586ae24b202beda4d283b25fec3e722af7 Mon Sep 17 00:00:00 2001 +From 9aacfa825fcdef0f2eb87b7f48872b1a93ec7923 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20=C3=85dahl?= 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. @@ -1214,7 +1050,7 @@ protocol rather than the session itself. 1 file changed, 9 insertions(+) diff --git a/src/grd-vnc-tls.c b/src/grd-vnc-tls.c -index ec4758e0..ac6c35f6 100644 +index ec4758e..ac6c35f 100644 --- a/src/grd-vnc-tls.c +++ b/src/grd-vnc-tls.c @@ -67,6 +67,7 @@ grd_vnc_tls_context_new (void) @@ -1276,13 +1112,13 @@ index ec4758e0..ac6c35f6 100644 { g_warning ("TLS handshake failed: %s", error->message); -- -2.51.0 +2.36.1 -From 62e04d794eaf2c0acfc16af0b0968fead4bb4df1 Mon Sep 17 00:00:00 2001 +From aeaa81db6cf160a32c8d83a945c860bb7451babf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20=C3=85dahl?= 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 @@ -1296,7 +1132,7 @@ long as there is data to read in those buffers. 2 files changed, 86 insertions(+), 6 deletions(-) diff --git a/src/grd-session-vnc.h b/src/grd-session-vnc.h -index f230887e..9dd33442 100644 +index e9eced0..8a916b7 100644 --- a/src/grd-session-vnc.h +++ b/src/grd-session-vnc.h @@ -79,6 +79,8 @@ void grd_session_vnc_grab_socket (GrdSessionVnc *session_vnc, @@ -1309,7 +1145,7 @@ index f230887e..9dd33442 100644 GrdVncServer * grd_session_vnc_get_vnc_server (GrdSessionVnc *session_vnc); diff --git a/src/grd-vnc-tls.c b/src/grd-vnc-tls.c -index ac6c35f6..312b6b92 100644 +index ac6c35f..312b6b9 100644 --- a/src/grd-vnc-tls.c +++ b/src/grd-vnc-tls.c @@ -41,6 +41,12 @@ typedef enum _GrdTlsHandshakeState @@ -1446,13 +1282,216 @@ index ac6c35f6..312b6b92 100644 } -- -2.51.0 +2.36.1 -From 799e2b287bd055c46709d0063436b819894200e6 Mon Sep 17 00:00:00 2001 +From be203b966ff119e82ea7ac9894b67a1db2f55f26 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20=C3=85dahl?= -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?= +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?= +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 @@ -1468,10 +1507,10 @@ password prompt. 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/grd-session-vnc.c b/src/grd-session-vnc.c -index b48b9017..87cc7d86 100644 +index 39d3ead..6d0e5e2 100644 --- a/src/grd-session-vnc.c +++ b/src/grd-session-vnc.c -@@ -99,11 +99,6 @@ grd_session_vnc_pause (GrdSessionVnc *session_vnc); +@@ -95,11 +95,6 @@ grd_session_vnc_pause (GrdSessionVnc *session_vnc); static gboolean close_session_idle (gpointer user_data); @@ -1483,7 +1522,7 @@ index b48b9017..87cc7d86 100644 static void swap_uint8 (uint8_t *a, uint8_t *b) -@@ -355,7 +350,6 @@ handle_new_client (rfbClientPtr rfb_client) +@@ -322,7 +317,6 @@ handle_new_client (rfbClientPtr rfb_client) grd_session_vnc_pause (session_vnc); return RFB_CLIENT_ON_HOLD; case GRD_VNC_AUTH_METHOD_PASSWORD: @@ -1491,9 +1530,9 @@ index b48b9017..87cc7d86 100644 /* * authPasswdData needs to be non NULL in libvncserver to trigger * password authentication. -@@ -719,6 +713,8 @@ init_vnc_session (GrdSessionVnc *session_vnc) - session_vnc->monitor_config->connectors = connectors; - } +@@ -623,6 +617,8 @@ init_vnc_session (GrdSessionVnc *session_vnc) + rfb_screen->frameBuffer = g_malloc0 (screen_width * screen_height * 4); + memset (rfb_screen->frameBuffer, 0x1f, screen_width * screen_height * 4); + rfb_screen->passwordCheck = check_rfb_password; + @@ -1501,41 +1540,5 @@ index b48b9017..87cc7d86 100644 rfbProcessEvents (rfb_screen, 0); } -- -2.51.0 - - -From b74286bdb8876d27d279c725357d73a23a3316b4 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Jonas=20=C3=85dahl?= -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 9dd33442..98c73451 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.51.0 - +2.36.1 diff --git a/plans/main.fmf b/plans/main.fmf deleted file mode 100644 index ae0c305..0000000 --- a/plans/main.fmf +++ /dev/null @@ -1,6 +0,0 @@ -summary: Run all tests -execute: - how: tmt -discover: - how: fmf - diff --git a/sources b/sources index d817ea5..6ec4d9f 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (gnome-remote-desktop-49.2.tar.xz) = b678ee125e1b5f6d58e85f57a332cf02ee6b5dee654469e66f496f9467e6512a701a3e37a9580562e0b064320380d2df4ca6b15e20bd35b1605b4bd9de73827c +SHA512 (gnome-remote-desktop-42.6.tar.xz) = dfd116a225cfe579a1d6c37e130bf70812c3bf83e76d4764eb025d39136c911c06ca43f665d6c9d9521c51af3f5bd0bb7e4882e9124c8ef801c5b1ba8bb20013 diff --git a/tests/got-audit/got-audit.gdb b/tests/got-audit/got-audit.gdb deleted file mode 100644 index 6661297..0000000 --- a/tests/got-audit/got-audit.gdb +++ /dev/null @@ -1,2 +0,0 @@ -gef config gef.disable_color True -got-audit --all diff --git a/tests/got-audit/main.fmf b/tests/got-audit/main.fmf deleted file mode 100644 index 25caf1d..0000000 --- a/tests/got-audit/main.fmf +++ /dev/null @@ -1,10 +0,0 @@ -summary: Audit the GOT for signs of tampering -description: | - Pointers in the server process GOT will be checked to ensure that - each function pointer's value is within a shared object file - that exports a symbol of that name, and that no shared object - files export conflicting symbols. -contact: Gordon Messmer -require+: - - gdb-gef # needed to test got-audit - - gnome-remote-desktop diff --git a/tests/got-audit/runtest.sh b/tests/got-audit/runtest.sh deleted file mode 100755 index c4b9b29..0000000 --- a/tests/got-audit/runtest.sh +++ /dev/null @@ -1,41 +0,0 @@ -#!/bin/bash -# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -# -# runtest.sh of /CoreOS/gnome-remote-desktop/Sanity/got-audit -# Description: Check pointers in the server process GOT for signs of tampering -# Author: Gordon Messmer -# - -# Include Beaker environment -. /usr/share/beakerlib/beakerlib.sh || exit 1 - -rlJournalStart - rlPhaseStartSetup - rlRun "systemctl start --user gnome-remote-desktop-headless" - rlRun "TestDir=\$(pwd)" - rlRun "TmpDir=\$(mktemp -d)" 0 "Creating tmp directory" - rlRun "pushd $TmpDir" - rlRun "auditfile=\$(mktemp --tmpdir=${TmpDir})" - rlPhaseEnd - - rlPhaseStartTest "Run GEF got-audit" - rlRun "SERVICE_PID=\$( systemctl show --property=MainPID --user gnome-remote-desktop-headless.service | cut -f2 -d= )" - rlRun "echo SERVICE_PID is '$SERVICE_PID'" - [ -n "$SERVICE_PID" ] || rlFail "No service pid was found" - rlRun "gdb-gef --pid '$SERVICE_PID' --command='$TestDir'/got-audit.gdb --batch > '$auditfile'" - # Basic test: ensure that at least one symbol is found in libc.so, - # to verify that the report looks plausible. - rlAssertGrep " : /.*/libc.so" "$auditfile" - # Ensure the got-audit did not report any errors - rlAssertNotGrep " :: ERROR" "$auditfile" - rlRun "cp '$auditfile' '$TMT_TEST_DATA'/got-audit.txt" - rlPhaseEnd - - rlPhaseStartCleanup - rlRun "systemctl stop --user gnome-remote-desktop-headless" - rlRun "popd" - rlRun "rm -r $TmpDir" 0 "Removing tmp directory" - rlPhaseEnd -rlJournalPrintText -rlJournalEnd diff --git a/tests/main.fmf b/tests/main.fmf deleted file mode 100644 index f225a72..0000000 --- a/tests/main.fmf +++ /dev/null @@ -1,2 +0,0 @@ -test: ./runtest.sh -framework: beakerlib