diff --git a/0001-fix-crash-when-connection-fails-early.patch b/0001-fix-crash-when-connection-fails-early.patch new file mode 100644 index 0000000..c3694cc --- /dev/null +++ b/0001-fix-crash-when-connection-fails-early.patch @@ -0,0 +1,88 @@ +From 06a27a4fb52653b4cbf67b75b8116cf6692b435d Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= +Date: Fri, 24 Aug 2018 17:18:04 +0100 +Subject: [PATCH] fix crash when connection fails early +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +When reading the initial greeting a timer is set in the background. If +the connection fails early, we can jump to cleanup code before the timer +is disable. The timer will later fire, read a coroutine context from +freed memory, and likely jump to somewhere awful with predictably crashy +results. + + https://bugzilla.redhat.com/show_bug.cgi?id=1620203 + +Signed-off-by: Daniel P. Berrangé +--- + src/vncconnection.c | 15 ++++++++++++++- + 1 file changed, 14 insertions(+), 1 deletion(-) + +diff --git a/src/vncconnection.c b/src/vncconnection.c +index b6e13d5..afc1418 100644 +--- a/src/vncconnection.c ++++ b/src/vncconnection.c +@@ -319,7 +319,9 @@ static gboolean vnc_connection_timeout(gpointer data) + { + struct wait_queue *wait = data; + ++ VNC_DEBUG("Connection timeout wakeup start %p", data); + g_io_wakeup(wait); ++ VNC_DEBUG("Connection timeout wakeup done %p", data); + + return FALSE; + } +@@ -5318,6 +5320,7 @@ static gboolean vnc_connection_initialize(VncConnection *conn) + + priv->absPointer = TRUE; + ++ VNC_DEBUG("Schedule greeting timeout %p", &priv->wait); + timeout = g_timeout_add_seconds(2, vnc_connection_timeout, &priv->wait); + want = 12; + while (want > 0) { +@@ -5369,7 +5372,9 @@ static gboolean vnc_connection_initialize(VncConnection *conn) + } + + if (timeout != 0) { ++ VNC_DEBUG("Remove timeout %p", &priv->wait); + g_source_remove(timeout); ++ timeout = 0; + } + + version[12] = 0; +@@ -5449,6 +5454,11 @@ static gboolean vnc_connection_initialize(VncConnection *conn) + return !vnc_connection_has_error(conn); + + fail: ++ if (timeout != 0) { ++ VNC_DEBUG("Remove timeout %p", &priv->wait); ++ g_source_remove(timeout); ++ timeout = 0; ++ } + return !vnc_connection_has_error(conn); + } + +@@ -5481,6 +5491,7 @@ static GSocket *vnc_connection_connect_socket(struct wait_queue *wait, + if (!sock) + return NULL; + ++ VNC_DEBUG("Schedule socket timeout %p", wait); + guint timeout = g_timeout_add_seconds(10, vnc_connection_timeout, wait); + + g_socket_set_blocking(sock, FALSE); +@@ -5513,8 +5524,10 @@ timeout: + sock = NULL; + + end: +- if (timeout != 0) ++ if (timeout != 0) { ++ VNC_DEBUG("Remove timeout %p", wait); + g_source_remove(timeout); ++ } + + return sock; + } +-- +2.17.1 + diff --git a/0002-gvnc-1.0.pc.in-Use-GLIB_REQUIRED.patch b/0002-gvnc-1.0.pc.in-Use-GLIB_REQUIRED.patch new file mode 100644 index 0000000..51f1de7 --- /dev/null +++ b/0002-gvnc-1.0.pc.in-Use-GLIB_REQUIRED.patch @@ -0,0 +1,25 @@ +From fe11054a9940cdb9a9d6bd4b05bd2276a51d0abf Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Guido=20G=C3=BCnther?= +Date: Thu, 30 Aug 2018 18:08:35 +0200 +Subject: [PATCH] gvnc-1.0.pc.in: Use GLIB_REQUIRED + +GOBJECT_REQUIRED is no more + +(cherry picked from commit 41c32208248b028f2c96da4d20ba6dc8e51b83ad) +--- + gvnc-1.0.pc.in | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/gvnc-1.0.pc.in b/gvnc-1.0.pc.in +index da95b65..b79fdf7 100644 +--- a/gvnc-1.0.pc.in ++++ b/gvnc-1.0.pc.in +@@ -5,7 +5,7 @@ includedir=@includedir@ + + Name: GVNC + Description: GObject for VNC client connections +-Requires: gobject-2.0 >= @GOBJECT_REQUIRED@ ++Requires: gobject-2.0 >= @GLIB_REQUIRED@ + Version: @VERSION@ + Libs: -L${libdir} -lgvnc-1.0 + Cflags: -I${includedir}/gvnc-1.0 diff --git a/gtk-vnc-0.9.0.tar.xz b/gtk-vnc-0.9.0.tar.xz new file mode 100644 index 0000000..10e4efc Binary files /dev/null and b/gtk-vnc-0.9.0.tar.xz differ diff --git a/gtk-vnc.spec b/gtk-vnc.spec new file mode 100644 index 0000000..a5bedd0 --- /dev/null +++ b/gtk-vnc.spec @@ -0,0 +1,189 @@ +Summary: VNC viewer widget for GTK +Name: gtk-vnc +Version: 0.9.0 +Release: 4 +License: LGPLv2+ +URL: https://wiki.gnome.org/Projects/gtk-vnc +Source: https://download.gnome.org/sources/gtk-vnc/0.9/gtk-vnc-0.9.0.tar.xz +Patch1: 0001-fix-crash-when-connection-fails-early.patch +Patch2: 0002-gvnc-1.0.pc.in-Use-GLIB_REQUIRED.patch + +Requires: gvnc = %{version}-%{release} +BuildRequires: python3 gnutls-devel libgcrypt-devel cyrus-sasl-devel +BuildRequires: zlib-devel intltool gobject-introspection-devel +BuildRequires: gtk3-devel vala-tools pulseaudio-libs-devel +BuildRequires: /usr/bin/pod2man + +%description +gtk-vnc is a VNC viewer widget for GTK. It is built using coroutines +allowing it to be completely asynchronous while remaining single +threaded. It provides a core C library, and bindings for Python (PyGTK). + +%package -n gvnc +Summary: A GObject for VNC connections + +%description -n gvnc +gvnc is a GObject for managing a VNC connection. It provides all the +infrastructure required to build a VNC client without having to deal +with the raw protocol itself. + +%package -n gvnc-devel +Summary: Libraries, includes, etc. to compile with the gvnc library +Requires: gvnc = %{version}-%{release} +Requires: pkgconfig + +%description -n gvnc-devel +gvnc is a GObject for managing a VNC connection. It provides all the +infrastructure required to build a VNC client without having to deal +with the raw protocol itself. + +Libraries, includes, etc. to compile with the gvnc library + +%package -n gvncpulse +Summary: A Pulse Audio bridge for VNC connections +Requires: gvnc = %{version}-%{release} + +%description -n gvncpulse +gvncpulse is a bridge to the Pulse Audio system for VNC. +It allows VNC clients to play back audio on the local +system + +%package -n gvncpulse-devel +Summary: Libraries, includes, etc. to compile with the gvncpulse library +Requires: gvncpulse = %{version}-%{release} +Requires: pkgconfig + +%description -n gvncpulse-devel +gvncpulse is a bridge to the Pulse Audio system for VNC. +It allows VNC clients to play back audio on the local +system + +Libraries, includes, etc. to compile with the gvnc library + +%package -n gvnc-tools +Summary: Command line VNC tools +Requires: gvnc = %{version}-%{release} + +%description -n gvnc-tools +Provides useful command line utilities for interacting with +VNC servers. Includes the gvnccapture program for capturing +screenshots of a VNC desktop + +%package -n gtk-vnc2 +Summary: A GTK3 widget for VNC clients +Requires: gvnc = %{version}-%{release} + +%description -n gtk-vnc2 +gtk-vnc2 is a VNC viewer widget for GTK3. It is built using coroutines +allowing it to be completely asynchronous while remaining single threaded. + +%package -n gtk-vnc2-devel +Summary: Development files to build GTK3 applications with gtk-vnc2 +Requires: gtk-vnc2 = %{version}-%{release} +Requires: pkgconfig +Requires: gtk3-devel + +%description -n gtk-vnc2-devel +gtk-vnc2 is a VNC viewer widget for GTK3. It is built using coroutines +allowing it to be completely asynchronous while remaining single threaded. + +Libraries, includes, etc. to compile with the gtk-vnc library + +%package_help + +%prep +%setup -q -n gtk-vnc-%{version} -c +pushd gtk-vnc-%{version} +%patch1 -p1 +%patch2 -p1 +popd +cp -a gtk-vnc-%{version} gtk-vnc2-%{version} + +%build +pushd gtk-vnc2-%{version} +%configure --with-gtk=3.0 --enable-introspection=yes --with-tls-priority="@LIBVIRT,SYSTEM" +%make_build V=1 +chmod -x examples/*.pl examples/*.js examples/*.py +popd + +%install +pushd gtk-vnc2-%{version} +%make_install +popd +%delete_la_and_a +%find_lang %{name} + +%post -p /sbin/ldconfig + +%postun -p /sbin/ldconfig + +%post -n gvnc -p /sbin/ldconfig + +%postun -n gvnc -p /sbin/ldconfig + +%post -n gvncpulse -p /sbin/ldconfig + +%postun -n gvncpulse -p /sbin/ldconfig + +%post -n gtk-vnc2 -p /sbin/ldconfig + +%postun -n gtk-vnc2 -p /sbin/ldconfig + +%files -n gvnc -f %{name}.lang +%{_libdir}/libgvnc-1.0.so.* +%{_libdir}/girepository-1.0/GVnc-1.0.typelib +%{_datadir}/vala/vapi/gvnc-1.0.deps +%{_datadir}/vala/vapi/gvnc-1.0.vapi + +%files -n gvnc-devel +%{_libdir}/libgvnc-1.0.so +%dir %{_includedir}/gvnc-1.0/ +%{_includedir}/gvnc-1.0/*.h +%{_libdir}/pkgconfig/gvnc-1.0.pc +%{_datadir}/gir-1.0/GVnc-1.0.gir + +%files -n gvncpulse -f %{name}.lang +%{_libdir}/libgvncpulse-1.0.so.* +%{_libdir}/girepository-1.0/GVncPulse-1.0.typelib +%{_datadir}/vala/vapi/gvncpulse-1.0.deps +%{_datadir}/vala/vapi/gvncpulse-1.0.vapi + +%files -n gvncpulse-devel +%{_libdir}/libgvncpulse-1.0.so +%dir %{_includedir}/gvncpulse-1.0/ +%{_includedir}/gvncpulse-1.0/*.h +%{_libdir}/pkgconfig/gvncpulse-1.0.pc +%{_datadir}/gir-1.0/GVncPulse-1.0.gir + +%files -n gvnc-tools +%{_bindir}/gvnccapture + +%files -n gtk-vnc2 +%{_libdir}/libgtk-vnc-2.0.so.* +%{_libdir}/girepository-1.0/GtkVnc-2.0.typelib +%{_datadir}/vala/vapi/gtk-vnc-2.0.deps +%{_datadir}/vala/vapi/gtk-vnc-2.0.vapi + +%files -n gtk-vnc2-devel +%doc gtk-vnc2-%{version}/examples/gvncviewer.c +%doc gtk-vnc2-%{version}/examples/gvncviewer.js +%doc gtk-vnc2-%{version}/examples/gvncviewer.pl +%doc gtk-vnc2-%{version}/examples/gvncviewer.py +%{_libdir}/libgtk-vnc-2.0.so +%dir %{_includedir}/%{name}-2.0/ +%{_includedir}/%{name}-2.0/*.h +%{_libdir}/pkgconfig/%{name}-2.0.pc +%{_datadir}/gir-1.0/GtkVnc-2.0.gir + +%files help +%doc gtk-vnc-%{version}/AUTHORS +%doc gtk-vnc-%{version}/ChangeLog +%doc gtk-vnc-%{version}/ChangeLog-old +%doc gtk-vnc-%{version}/NEWS +%doc gtk-vnc-%{version}/README +%doc gtk-vnc-%{version}/COPYING.LIB +%{_mandir}/man1/gvnccapture.1* + +%changelog +* Fri Feb 14 2020 fengbing - 0.9.0-4 +- Package init