diff --git a/.gitignore b/.gitignore index d47ad7b..7bcad81 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1 @@ -SOURCES/spice-gtk-0.31.tar.bz2 +SOURCES/spice-gtk-0.33.tar.bz2 diff --git a/.spice-gtk.metadata b/.spice-gtk.metadata index 44b5e33..2710f85 100644 --- a/.spice-gtk.metadata +++ b/.spice-gtk.metadata @@ -1 +1 @@ -949d99191fae7c5f4e54a303384616ce2c40162f SOURCES/spice-gtk-0.31.tar.bz2 +99c26baa5e18c73f68fb11fbbe7fd0d3c171eedc SOURCES/spice-gtk-0.33.tar.bz2 diff --git a/SOURCES/0001-clipboard-Fix-crash-by-handling-error.patch b/SOURCES/0001-clipboard-Fix-crash-by-handling-error.patch new file mode 100644 index 0000000..f5cac1b --- /dev/null +++ b/SOURCES/0001-clipboard-Fix-crash-by-handling-error.patch @@ -0,0 +1,41 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Victor Toso +Date: Fri, 14 Oct 2016 18:12:01 +0200 +Subject: [PATCH] clipboard: Fix crash by handling error + +As manual states below, text could be NULL for different reasons and +we should handle that. I've included a debug message to help +identifying possible regressions from wayland's clipboard. + +This crash is a regression from 7b0de6217670e0f668aff2949f + + "The text parameter to callback will contain the resulting text if + the request succeeded, or NULL if it failed. This could happen for + various reasons, in particular if the clipboard was empty or if the + contents of the clipboard could not be converted into text form." + +Resolves: rhbz#1384676 + +Signed-off-by: Victor Toso +Acked-by: Pavel Grunt +(cherry picked from commit 03c016bea939ee4a26e90d80fa1012a993a8ea47) +--- + src/spice-gtk-session.c | 5 +++++ + 1 file changed, 5 insertions(+) + +diff --git a/src/spice-gtk-session.c b/src/spice-gtk-session.c +index f04d5e8..2da9bc0 100644 +--- a/src/spice-gtk-session.c ++++ b/src/spice-gtk-session.c +@@ -918,6 +918,11 @@ static void clipboard_received_text_cb(GtkClipboard *clipboard, + if (self == NULL) + return; + ++ if (text == NULL) { ++ SPICE_DEBUG("Failed to retrieve clipboard text"); ++ return; ++ } ++ + g_return_if_fail(SPICE_IS_GTK_SESSION(self)); + + selection = get_selection_from_clipboard(self->priv, clipboard); diff --git a/SOURCES/0001-display-Lower-level-of-warning-for-empty-monitor-con.patch b/SOURCES/0001-display-Lower-level-of-warning-for-empty-monitor-con.patch deleted file mode 100644 index 917c3f6..0000000 --- a/SOURCES/0001-display-Lower-level-of-warning-for-empty-monitor-con.patch +++ /dev/null @@ -1,37 +0,0 @@ -From bfdde4d94759666c2bd2da5632620e95da8c9214 Mon Sep 17 00:00:00 2001 -From: Pavel Grunt -Date: Wed, 16 Mar 2016 14:46:51 +0100 -Subject: [PATCH 1/5] display: Lower level of warning for empty monitor config - -It is a valid case when a guest requests to turn off monitors, eg: - xrandr --output Virtual-0 --off - -Related: -https://bugzilla.redhat.com/show_bug.cgi?id=1061942 - -Acked-by: Frediano Ziglio -(cherry picked from commit c0c721bbaae50d3ad1991d22df1c4397f24f7acb) ---- - src/channel-display.c | 6 +++++- - 1 file changed, 5 insertions(+), 1 deletion(-) - -diff --git a/src/channel-display.c b/src/channel-display.c -index 442642a..0ae84a0 100644 ---- a/src/channel-display.c -+++ b/src/channel-display.c -@@ -1846,7 +1846,11 @@ static void display_handle_monitors_config(SpiceChannel *channel, SpiceMsgIn *in - guint i; - - g_return_if_fail(config != NULL); -- g_return_if_fail(config->count > 0); -+ -+ if (config->count == 0) { -+ CHANNEL_DEBUG(channel, "received empty monitor config"); -+ return; -+ } - - CHANNEL_DEBUG(channel, "received new monitors config from guest: n: %d/%d", config->count, config->max_allowed); - --- -2.8.1 - diff --git a/SOURCES/0002-channel-usbredir-Fix-crash-on-channel-up.patch b/SOURCES/0002-channel-usbredir-Fix-crash-on-channel-up.patch new file mode 100644 index 0000000..48890b0 --- /dev/null +++ b/SOURCES/0002-channel-usbredir-Fix-crash-on-channel-up.patch @@ -0,0 +1,60 @@ +From 6e7401410f3fa8e817c6367a9fc120675c8c8d20 Mon Sep 17 00:00:00 2001 +From: Victor Toso +Date: Tue, 29 Nov 2016 22:34:04 +0100 +Subject: [PATCH] channel-usbredir: Fix crash on channel-up + +SpiceSession does not initialize its SpiceUsbDeviceManager object on +startup that could lead to a race condition where channel-usbredir is +requested to flush data while it is uninitialized. + +In a few places, spice_usb_device_manager_get() is called as in +usb-device-widget.c and spice-gtk-session.c but not used in +spicy-stats, making the tool to crash on startup if it encounters an +usbredir channel. + + #0 in usbredirhost_write_guest_data (host=0x0) at usbredir/usbredirhost/usbredirhost.c:876 + #1 in spice_usbredir_channel_up (c=0x643830) at channel-usbredir.c:821 + #2 in spice_channel_up (channel=0x643830) at spice-channel.c:1238 + #3 in spice_channel_recv_auth (channel=0x643830) at spice-channel.c:1225 + #4 in spice_channel_coroutine (data=0x643830) at spice-channel.c:2580 + #5 in coroutine_trampoline (cc=0x642ec0) at coroutine_ucontext.c:63 + #6 in continuation_trampoline (i0=6565568, i1=0) at continuation.c:55 + +Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1399838 + +Signed-off-by: Victor Toso +Reported-by: Michael Cullen +Acked-by: Christophe Fergeau +(cherry picked from commit 291f3e4419e6fb4077ae43a5e09eb1c37b9dd729) +--- + src/spice-session.c | 7 +++++++ + 1 file changed, 7 insertions(+) + +diff --git a/src/spice-session.c b/src/spice-session.c +index 860461f..a1786af 100644 +--- a/src/spice-session.c ++++ b/src/spice-session.c +@@ -282,6 +282,7 @@ static void spice_session_init(SpiceSession *session) + { + SpiceSessionPrivate *s; + gchar *channels; ++ GError *err = NULL; + + SPICE_DEBUG("New session (compiled from package " PACKAGE_STRING ")"); + s = session->priv = SPICE_SESSION_GET_PRIVATE(session); +@@ -294,6 +295,12 @@ static void spice_session_init(SpiceSession *session) + s->images = cache_image_new((GDestroyNotify)pixman_image_unref); + s->glz_window = glz_decoder_window_new(); + update_proxy(session, NULL); ++ ++ s->usb_manager = spice_usb_device_manager_get(session, &err); ++ if (err != NULL) { ++ SPICE_DEBUG("Could not initialize SpiceUsbDeviceManager - %s", err->message); ++ g_clear_error(&err); ++ } + } + + static void +-- +2.11.0 + diff --git a/SOURCES/0002-fix-16-bpp-LZ-image-decompression.patch b/SOURCES/0002-fix-16-bpp-LZ-image-decompression.patch deleted file mode 100644 index 76a8a17..0000000 --- a/SOURCES/0002-fix-16-bpp-LZ-image-decompression.patch +++ /dev/null @@ -1,165 +0,0 @@ -From e8d016187810f9c038370da14c24d744ed250e14 Mon Sep 17 00:00:00 2001 -From: Frediano Ziglio -Date: Thu, 14 Apr 2016 17:56:40 +0100 -Subject: [PATCH 2/5] fix 16 bpp LZ image decompression - -LZ image decompression was broken for 16 bpp: -- stride was computed not computed correctly (as width*4). This caused - also a buffer underflow; -- stride in pixman is always multiple of 4 bytes (so for 16 bpp is - ALIGN(width*2, 4)) so image decompressed by lz_decode as some missing - bytes to be fixed. - -The alignment code is reused from LZ4 function. - -This fix also https://bugzilla.redhat.com/show_bug.cgi?id=1285469. - -Signed-off-by: Frediano Ziglio -Acked-by: Pavel Grunt ---- - spice-common/common/canvas_base.c | 54 +++++++++++++++++++++++---------------- - 1 file changed, 32 insertions(+), 22 deletions(-) - -diff --git a/spice-common/common/canvas_base.c b/spice-common/common/canvas_base.c -index fa4d373..45dd75f 100644 ---- a/spice-common/common/canvas_base.c -+++ b/spice-common/common/canvas_base.c -@@ -515,13 +515,30 @@ static pixman_image_t *canvas_get_jpeg(CanvasBase *canvas, SpiceImage *image) - return surface; - } - -+static void canvas_fix_alignment(uint8_t *bits, -+ int stride_encoded, int stride_pixman, -+ int height) -+{ -+ if (stride_pixman > stride_encoded) { -+ // Fix the row alignment -+ int row; -+ uint8_t *dest = bits; -+ for (row = height - 1; row > 0; --row) { -+ uint32_t *dest_aligned, *dest_misaligned; -+ dest_aligned = (uint32_t *)(dest + stride_pixman*row); -+ dest_misaligned = (uint32_t*)(dest + stride_encoded*row); -+ memmove(dest_aligned, dest_misaligned, stride_encoded); -+ } -+ } -+} -+ - #ifdef USE_LZ4 - static pixman_image_t *canvas_get_lz4(CanvasBase *canvas, SpiceImage *image) - { - pixman_image_t *surface = NULL; - int dec_size, enc_size, available; - int stride, stride_abs, stride_encoded; -- uint8_t *dest, *data, *data_end; -+ uint8_t *dest, *data, *data_end, *bits; - int width, height, top_down; - LZ4_streamDecode_t *stream; - uint8_t spice_format; -@@ -576,6 +593,7 @@ static pixman_image_t *canvas_get_lz4(CanvasBase *canvas, SpiceImage *image) - if (!top_down) { - dest -= (stride_abs * (height - 1)); - } -+ bits = dest; - - do { - // Read next compressed block -@@ -594,20 +612,7 @@ static pixman_image_t *canvas_get_lz4(CanvasBase *canvas, SpiceImage *image) - data += enc_size; - } while (data < data_end); - -- if (stride_abs > stride_encoded) { -- // Fix the row alignment -- int row; -- dest = (uint8_t *)pixman_image_get_data(surface); -- if (!top_down) { -- dest -= (stride_abs * (height - 1)); -- } -- for (row = height - 1; row > 0; --row) { -- uint32_t *dest_aligned, *dest_misaligned; -- dest_aligned = (uint32_t *)(dest + stride_abs*row); -- dest_misaligned = (uint32_t*)(dest + stride_encoded*row); -- memmove(dest_aligned, dest_misaligned, stride_encoded); -- } -- } -+ canvas_fix_alignment(bits, stride_encoded, stride_abs, height); - - LZ4_freeStreamDecode(stream); - return surface; -@@ -782,7 +787,6 @@ static pixman_image_t *canvas_get_lz(CanvasBase *canvas, SpiceImage *image, - uint8_t *comp_buf = NULL; - int comp_size; - uint8_t *decomp_buf = NULL; -- uint8_t *src; - pixman_format_code_t pixman_format; - LzImageType type, as_type; - SpicePalette *palette; -@@ -790,6 +794,7 @@ static pixman_image_t *canvas_get_lz(CanvasBase *canvas, SpiceImage *image, - int width; - int height; - int top_down; -+ int stride_encoded; - int stride; - int free_palette; - -@@ -818,10 +823,12 @@ static pixman_image_t *canvas_get_lz(CanvasBase *canvas, SpiceImage *image, - lz_decode_begin(lz_data->lz, comp_buf, comp_size, &type, - &width, &height, &n_comp_pixels, &top_down, palette); - -+ stride_encoded = width; - switch (type) { - case LZ_IMAGE_TYPE_RGBA: - as_type = LZ_IMAGE_TYPE_RGBA; - pixman_format = PIXMAN_LE_a8r8g8b8; -+ stride_encoded *= 4; - break; - case LZ_IMAGE_TYPE_RGB32: - case LZ_IMAGE_TYPE_RGB24: -@@ -832,6 +839,7 @@ static pixman_image_t *canvas_get_lz(CanvasBase *canvas, SpiceImage *image, - case LZ_IMAGE_TYPE_PLT8: - as_type = LZ_IMAGE_TYPE_RGB32; - pixman_format = PIXMAN_LE_x8r8g8b8; -+ stride_encoded *= 4; - break; - case LZ_IMAGE_TYPE_A8: - as_type = LZ_IMAGE_TYPE_A8; -@@ -843,9 +851,11 @@ static pixman_image_t *canvas_get_lz(CanvasBase *canvas, SpiceImage *image, - canvas->format == SPICE_SURFACE_FMT_32_ARGB)) { - as_type = LZ_IMAGE_TYPE_RGB32; - pixman_format = PIXMAN_LE_x8r8g8b8; -+ stride_encoded *= 4; - } else { - as_type = LZ_IMAGE_TYPE_RGB16; - pixman_format = PIXMAN_x1r5g5b5; -+ stride_encoded *= 2; - } - break; - default: -@@ -865,18 +875,18 @@ static pixman_image_t *canvas_get_lz(CanvasBase *canvas, SpiceImage *image, - alloc_lz_image_surface(&lz_data->decode_data, pixman_format, - width, height, n_comp_pixels, top_down); - -- src = (uint8_t *)pixman_image_get_data(lz_data->decode_data.out_surface); -+ stride = pixman_image_get_stride(lz_data->decode_data.out_surface); -+ stride = abs(stride); - -- stride = (n_comp_pixels / height) * 4; -+ decomp_buf = (uint8_t *)pixman_image_get_data(lz_data->decode_data.out_surface); - if (!top_down) { -- stride = -stride; -- decomp_buf = src + stride * (height - 1); -- } else { -- decomp_buf = src; -+ decomp_buf -= stride * (height - 1); - } - - lz_decode(lz_data->lz, as_type, decomp_buf); - -+ canvas_fix_alignment(decomp_buf, stride_encoded, stride, height); -+ - if (free_palette) { - free(palette); - } --- -2.8.1 - diff --git a/SOURCES/0003-egl-fix-leak-when-display-is-unrealize.patch b/SOURCES/0003-egl-fix-leak-when-display-is-unrealize.patch deleted file mode 100644 index 63357d8..0000000 --- a/SOURCES/0003-egl-fix-leak-when-display-is-unrealize.patch +++ /dev/null @@ -1,177 +0,0 @@ -From 3355a08e286bc2430692239e47367c59d6ac8109 Mon Sep 17 00:00:00 2001 -From: Victor Toso -Date: Tue, 29 Mar 2016 15:09:22 +0200 -Subject: [PATCH 3/5] egl: fix leak when display is unrealize -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -eglTerminate should be called on unrealize. This not yet fix all the -leaks but reduces it significantly from 318kb to 74kb as definitely lost -and around 1mb to 8kb as indirectly lost. - -4,096 bytes in 1 blocks are definitely lost in loss record -9,762 of 9,882 - at 0x35B19E40: drm_intel_gem_bo_map (intel_bufmgr_gem.c:1454) - by 0x35688320: can_write_oacontrol (intel_extensions.c:121) - by 0x35688320: intelInitExtensions (intel_extensions.c:279) - by 0x35651380: brwCreateContext (brw_context.c:875) - by 0x35602720: driCreateContextAttribs (dri_util.c:426) - by 0xF0C48B1: dri2_create_context (egl_dri2.c:1072) - by 0xF0BE727: eglCreateContext (eglapi.c:638) - by 0x5461D27: spice_egl_init (spice-widget-egl.c:256) - by 0x545B885: drawing_area_realize (spice-widget.c:581) - by 0xB431784: g_closure_invoke (gclosure.c:804) - by 0xB443A40: signal_emit_unlocked_R (gsignal.c:3629) - by 0xB44C92E: g_signal_emit_valist (gsignal.c:3385) - by 0xB44CC51: g_signal_emit (gsignal.c:3441) - -4,856 (32 direct, 4,824 indirect) bytes in 1 blocks are definitely lost -in loss record 9,779 of 9,882 - at 0x4C2A988: calloc (vg_replace_malloc.c:711) - by 0xF0BEEF7: _eglCreateArray (eglarray.c:71) - by 0xF0BF420: _eglLinkConfig (eglconfig.c:90) - by 0xF0C4F8D: dri2_add_config (egl_dri2.c:307) - by 0xF0C66EE: dri2_x11_add_configs_for_visuals (platform_x11.c:766) - by 0xF0C80EC: dri2_initialize_x11_dri3 (platform_x11.c:1319) - by 0xF0C80EC: dri2_initialize_x11 (platform_x11.c:1464) - by 0xF0C18FE: _eglMatchAndInitialize (egldriver.c:261) - by 0xF0C19B8: _eglMatchDriver (egldriver.c:292) - by 0xF0BDD31: eglInitialize (eglapi.c:482) - by 0x5461A76: spice_egl_init (spice-widget-egl.c:226) - by 0x545B885: drawing_area_realize (spice-widget.c:581) - by 0xB431784: g_closure_invoke (gclosure.c:804) - -5,921 (472 direct, 5,449 indirect) bytes in 1 blocks are definitely lost -in loss record 9,794 of 9,882 - at 0x4C2A988: calloc (vg_replace_malloc.c:711) - by 0xF0C7E0E: dri2_initialize_x11_dri3 (platform_x11.c:1267) - by 0xF0C7E0E: dri2_initialize_x11 (platform_x11.c:1464) - by 0xF0C18FE: _eglMatchAndInitialize (egldriver.c:261) - by 0xF0C19B8: _eglMatchDriver (egldriver.c:292) - by 0xF0BDD31: eglInitialize (eglapi.c:482) - by 0x5461A76: spice_egl_init (spice-widget-egl.c:226) - by 0x545B885: drawing_area_realize (spice-widget.c:581) - by 0xB431784: g_closure_invoke (gclosure.c:804) - by 0xB443A40: signal_emit_unlocked_R (gsignal.c:3629) - by 0xB44C92E: g_signal_emit_valist (gsignal.c:3385) - by 0xB44CC51: g_signal_emit (gsignal.c:3441) - by 0x5D2C9DB: gtk_widget_realize (gtkwidget.c:5454) - -16,384 bytes in 4 blocks are definitely lost in loss record 9,854 of 9,882 - at 0x35B19E40: drm_intel_gem_bo_map (intel_bufmgr_gem.c:1454) - by 0x3568AB30: intel_miptree_map_raw (intel_mipmap_tree.c:2149) - by 0x3568CEE6: intel_miptree_map_gtt (intel_mipmap_tree.c:2182) - by 0x3568CEE6: intel_miptree_map (intel_mipmap_tree.c:2774) - by 0x35692851: intel_map_texture_image (intel_tex.c:227) - by 0x35447C3B: store_texsubimage (texstore.c:1069) - by 0x35447E9F: _mesa_store_teximage (texstore.c:1125) - by 0x3543D9BA: _mesa_get_fallback_texture (texobj.c:1056) - by 0x35443E1E: UnknownInlinedFun (texstate.c:562) - by 0x35443E1E: update_program_texture_state (texstate.c:587) - by 0x35443E1E: UnknownInlinedFun (texstate.c:726) - by 0x35443E1E: _mesa_update_texture (texstate.c:757) - by 0x35420809: _mesa_update_state_locked (state.c:430) - by 0x35420ED0: _mesa_update_state (state.c:504) - by 0x3535BF87: _mesa_Clear (clear.c:172) - by 0x546214F: spice_egl_update_display (spice-widget-egl.c:514) - -32,768 bytes in 1 blocks are definitely lost in loss record 9,864 of 9,882 - at 0x35B19E40: drm_intel_gem_bo_map (intel_bufmgr_gem.c:1454) - by 0x35683E3C: intel_batchbuffer_reset (intel_batchbuffer.c:68) - by 0x35684052: brw_new_batch (intel_batchbuffer.c:164) - by 0x35684052: _intel_batchbuffer_flush.part.2 (intel_batchbuffer.c:397) - by 0x3568853B: can_write_oacontrol (intel_extensions.c:153) - by 0x3568853B: intelInitExtensions (intel_extensions.c:279) - by 0x35651380: brwCreateContext (brw_context.c:875) - by 0x35602720: driCreateContextAttribs (dri_util.c:426) - by 0xF0C48B1: dri2_create_context (egl_dri2.c:1072) - by 0xF0BE727: eglCreateContext (eglapi.c:638) - by 0x5461D27: spice_egl_init (spice-widget-egl.c:256) - by 0x545B885: drawing_area_realize (spice-widget.c:581) - by 0xB431784: g_closure_invoke (gclosure.c:804) - by 0xB443A40: signal_emit_unlocked_R (gsignal.c:3629) - -32,768 bytes in 1 blocks are definitely lost in loss record 9,865 of 9,882 - at 0x35B19E40: drm_intel_gem_bo_map (intel_bufmgr_gem.c:1454) - by 0x35683E3C: intel_batchbuffer_reset (intel_batchbuffer.c:68) - by 0x35684052: brw_new_batch (intel_batchbuffer.c:164) - by 0x35684052: _intel_batchbuffer_flush.part.2 (intel_batchbuffer.c:397) - by 0x356887F3: can_do_pipelined_register_writes (intel_extensions.c:88) - by 0x356887F3: intelInitExtensions (intel_extensions.c:338) - by 0x35651380: brwCreateContext (brw_context.c:875) - by 0x35602720: driCreateContextAttribs (dri_util.c:426) - by 0xF0C48B1: dri2_create_context (egl_dri2.c:1072) - by 0xF0BE727: eglCreateContext (eglapi.c:638) - by 0x5461D27: spice_egl_init (spice-widget-egl.c:256) - by 0x545B885: drawing_area_realize (spice-widget.c:581) - by 0xB431784: g_closure_invoke (gclosure.c:804) - by 0xB443A40: signal_emit_unlocked_R (gsignal.c:3629) - -98,304 bytes in 3 blocks are definitely lost in loss record 9,872 of 9,882 - at 0x35B19E40: drm_intel_gem_bo_map (intel_bufmgr_gem.c:1454) - by 0x35683E3C: intel_batchbuffer_reset (intel_batchbuffer.c:68) - by 0x35684052: brw_new_batch (intel_batchbuffer.c:164) - by 0x35684052: _intel_batchbuffer_flush.part.2 (intel_batchbuffer.c:397) - by 0x3564F834: intel_glFlush (brw_context.c:259) - by 0xF0C3DA0: dri2_make_current (egl_dri2.c:1189) - by 0xF0BAB1B: eglMakeCurrent (eglapi.c:703) - by 0x546274E: spice_widget_init_egl_win (spice-widget-egl.c:316) - by 0x546274E: spice_egl_realize_display (spice-widget-egl.c:333) - by 0x545B89F: drawing_area_realize (spice-widget.c:586) - by 0xB431784: g_closure_invoke (gclosure.c:804) - by 0xB443A40: signal_emit_unlocked_R (gsignal.c:3629) - by 0xB44C92E: g_signal_emit_valist (gsignal.c:3385) - by 0xB44CC51: g_signal_emit (gsignal.c:3441) - -131,072 bytes in 4 blocks are definitely lost in loss record 9,874 of 9,882 - at 0x35B19E40: drm_intel_gem_bo_map (intel_bufmgr_gem.c:1454) - by 0x35683E3C: intel_batchbuffer_reset (intel_batchbuffer.c:68) - by 0x356848E8: intel_batchbuffer_init (intel_batchbuffer.c:45) - by 0x35651337: brwCreateContext (brw_context.c:848) - by 0x35602720: driCreateContextAttribs (dri_util.c:426) - by 0xF0C48B1: dri2_create_context (egl_dri2.c:1072) - by 0xF0BE727: eglCreateContext (eglapi.c:638) - by 0x5461D27: spice_egl_init (spice-widget-egl.c:256) - by 0x545B885: drawing_area_realize (spice-widget.c:581) - by 0xB431784: g_closure_invoke (gclosure.c:804) - by 0xB443A40: signal_emit_unlocked_R (gsignal.c:3629) - by 0xB44C92E: g_signal_emit_valist (gsignal.c:3385) - -1,080,655 (284 direct, 1,080,371 indirect) bytes in 1 blocks are -definitely lost in loss record 9,881 of 9,882 - at 0x4C2A988: calloc (vg_replace_malloc.c:711) - by 0x355A2221: ralloc_size (ralloc.c:113) - by 0x355A227D: rzalloc_size (ralloc.c:134) - by 0x355A2BEE: ra_alloc_reg_set (register_allocate.c:196) - by 0x356D79AA: brw_alloc_reg_set(brw_compiler*, int) (brw_fs_reg_allocate.cpp:159) - by 0x356D817D: brw_fs_alloc_reg_sets (brw_fs_reg_allocate.cpp:305) - by 0x356FDACC: brw_compiler_create (brw_shader.cpp:84) - by 0x35691995: intelInitScreen2 (intel_screen.c:1495) - by 0x35602A5E: driCreateNewScreen2 (dri_util.c:144) - by 0xF0C547B: dri2_create_screen (egl_dri2.c:674) - by 0xF0C808F: dri2_initialize_x11_dri3 (platform_x11.c:1303) - by 0xF0C808F: dri2_initialize_x11 (platform_x11.c:1464) - by 0xF0C18FE: _eglMatchAndInitialize (egldriver.c:261) - -Acked-by: Marc-André Lureau -(cherry picked from commit 181ec2511902483df5c02ecf12db437d9975a53b) ---- - src/spice-widget-egl.c | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/src/spice-widget-egl.c b/src/spice-widget-egl.c -index 1748189..7c2fdfb 100644 ---- a/src/spice-widget-egl.c -+++ b/src/spice-widget-egl.c -@@ -360,6 +360,7 @@ void spice_egl_unrealize_display(SpiceDisplay *display) - - eglMakeCurrent(d->egl.display, EGL_NO_SURFACE, EGL_NO_SURFACE, - EGL_NO_CONTEXT); -+ eglTerminate(d->egl.display); - } - - G_GNUC_INTERNAL --- -2.8.1 - diff --git a/SOURCES/0003-gtk-session-Use-GWeakRef.patch b/SOURCES/0003-gtk-session-Use-GWeakRef.patch new file mode 100644 index 0000000..d7ab1de --- /dev/null +++ b/SOURCES/0003-gtk-session-Use-GWeakRef.patch @@ -0,0 +1,152 @@ +From e1f40a2431f58e95437b2b326cf3a288fc11c76b Mon Sep 17 00:00:00 2001 +From: Victor Toso +Date: Fri, 10 Feb 2017 15:28:13 +0100 +Subject: [PATCH spice-gtk 1/2] gtk-session: Use GWeakRef +To: spice-devel@lists.freedesktop.org + +The custom WeakRef structure was introduced in 9baba9fd89 (2012) to +fix rhbz#743773. Since glib 2.32, GWeakRef was introduced and it +behaves similarly to our WeakRef. + +Moving to GWeakRef to remove some code which exists in glib. + +Note that I'm keeping two utility functions: +- get_weak_ref(gpointer object): which returns a newly allocated + GWeakRef, initialized with @object; +- free_weak_ref(gpointer pdata): which frees the GWeakRef and returns + the original object or NULL. It also takes care of an extra + reference to the object. + +Signed-off-by: Victor Toso +Acked-by: Christophe Fergeau +(cherry picked from commit 12f5d3391d6093b53c5b3f0f18182a859576a4b7) +--- + src/spice-gtk-session.c | 52 +++++++++++++++++++------------------------------ + 1 file changed, 20 insertions(+), 32 deletions(-) + +diff --git a/src/spice-gtk-session.c b/src/spice-gtk-session.c +index 3e0ec74..6424596 100644 +--- a/src/spice-gtk-session.c ++++ b/src/spice-gtk-session.c +@@ -572,31 +572,26 @@ static const struct { + } + }; + +-typedef struct _WeakRef { +- GObject *object; +-} WeakRef; +- +-static void weak_notify_cb(WeakRef *weakref, GObject *object) +-{ +- weakref->object = NULL; +-} +- +-static WeakRef* weak_ref(GObject *object) ++static GWeakRef* get_weak_ref(gpointer object) + { +- WeakRef *weakref = g_new(WeakRef, 1); +- +- g_object_weak_ref(object, (GWeakNotify)weak_notify_cb, weakref); +- weakref->object = object; +- ++ GWeakRef *weakref = g_new(GWeakRef, 1); ++ g_weak_ref_init(weakref, object); + return weakref; + } + +-static void weak_unref(WeakRef* weakref) ++static gpointer free_weak_ref(gpointer data) + { +- if (weakref->object) +- g_object_weak_unref(weakref->object, (GWeakNotify)weak_notify_cb, weakref); ++ GWeakRef *weakref = data; ++ gpointer object = g_weak_ref_get(weakref); + ++ g_weak_ref_clear(weakref); + g_free(weakref); ++ if (object != NULL) { ++ /* The main reference still exists as object is not NULL, so we can ++ * remove the strong reference given by g_weak_ref_get */ ++ g_object_unref(object); ++ } ++ return object; + } + + static void clipboard_get_targets(GtkClipboard *clipboard, +@@ -604,9 +599,7 @@ static void clipboard_get_targets(GtkClipboard *clipboard, + gint n_atoms, + gpointer user_data) + { +- WeakRef *weakref = user_data; +- SpiceGtkSession *self = (SpiceGtkSession*)weakref->object; +- weak_unref(weakref); ++ SpiceGtkSession *self = free_weak_ref(user_data); + + if (self == NULL) + return; +@@ -703,7 +696,7 @@ static void clipboard_owner_change(GtkClipboard *clipboard, + s->clip_hasdata[selection] = TRUE; + if (s->auto_clipboard_enable && !read_only(self)) + gtk_clipboard_request_targets(clipboard, clipboard_get_targets, +- weak_ref(G_OBJECT(self))); ++ get_weak_ref(self)); + break; + default: + s->clip_hasdata[selection] = FALSE; +@@ -934,14 +927,11 @@ static void clipboard_received_text_cb(GtkClipboard *clipboard, + const gchar *text, + gpointer user_data) + { +- WeakRef *weakref = user_data; +- SpiceGtkSession *self = (SpiceGtkSession*)weakref->object; ++ SpiceGtkSession *self = free_weak_ref(user_data); + char *conv = NULL; + int len = 0; + int selection; + +- weak_unref(weakref); +- + if (self == NULL) + return; + +@@ -977,9 +967,7 @@ static void clipboard_received_cb(GtkClipboard *clipboard, + GtkSelectionData *selection_data, + gpointer user_data) + { +- WeakRef *weakref = user_data; +- SpiceGtkSession *self = (SpiceGtkSession*)weakref->object; +- weak_unref(weakref); ++ SpiceGtkSession *self = free_weak_ref(user_data); + + if (self == NULL) + return; +@@ -1050,7 +1038,7 @@ static gboolean clipboard_request(SpiceMainChannel *main, guint selection, + + if (type == VD_AGENT_CLIPBOARD_UTF8_TEXT) { + gtk_clipboard_request_text(cb, clipboard_received_text_cb, +- weak_ref(G_OBJECT(self))); ++ get_weak_ref(self)); + } else { + for (m = 0; m < SPICE_N_ELEMENTS(atom2agent); m++) { + if (atom2agent[m].vdagent == type) +@@ -1061,7 +1049,7 @@ static gboolean clipboard_request(SpiceMainChannel *main, guint selection, + + atom = gdk_atom_intern_static_string(atom2agent[m].xatom); + gtk_clipboard_request_contents(cb, atom, clipboard_received_cb, +- weak_ref(G_OBJECT(self))); ++ get_weak_ref(self)); + } + + return TRUE; +@@ -1234,7 +1222,7 @@ void spice_gtk_session_copy_to_guest(SpiceGtkSession *self) + + if (s->clip_hasdata[selection] && !s->clip_grabbed[selection]) { + gtk_clipboard_request_targets(s->clipboard, clipboard_get_targets, +- weak_ref(G_OBJECT(self))); ++ get_weak_ref(self)); + } + } + +-- +2.12.0 + diff --git a/SOURCES/0004-Ensure-that-file-transfers-get-cancelled.patch b/SOURCES/0004-Ensure-that-file-transfers-get-cancelled.patch deleted file mode 100644 index a7a18dd..0000000 --- a/SOURCES/0004-Ensure-that-file-transfers-get-cancelled.patch +++ /dev/null @@ -1,61 +0,0 @@ -From 8f74b35fa15fa08054e6f14612219f3818224f7b Mon Sep 17 00:00:00 2001 -From: Jonathon Jongsma -Date: Thu, 7 Apr 2016 15:42:14 -0500 -Subject: [PATCH 4/5] Ensure that file transfers get cancelled - -When canceling a file transfer task in spicy, the client would often -stop sending additional data, but it would not send a "CANCELLED" -message to the guest. Because of this, the partial file would remain in -the guest's downloads folder until the spice client disconnected, at -which point the vdagent would remove the unfinshed file. - -This CANCELLED status message was only being sent if the task was -canceled during the async file read operation. If you cancel a task, -it's quite likely that it will happen during other operations -(e.g. file_xfer_flush_async(), etc). In order to handle these scenarios -(and make sure that the file gets canceled properly), send the -FILE_XFER_STATUS message in spice_file_transfer_task_completed(). - -(cherry picked from commit 4da4d9201cc3f86e38f00388cdd6157fe70e3328) ---- - src/channel-main.c | 17 ++++++++++------- - 1 file changed, 10 insertions(+), 7 deletions(-) - -diff --git a/src/channel-main.c b/src/channel-main.c -index e5a70af..67fce5b 100644 ---- a/src/channel-main.c -+++ b/src/channel-main.c -@@ -1919,13 +1919,6 @@ static void file_xfer_read_cb(GObject *source_object, - file_xfer_data_flushed_cb, self); - self->priv->pending = TRUE; - } else if (error) { -- VDAgentFileXferStatusMessage msg = { -- .id = self->priv->id, -- .result = error->code == G_IO_ERROR_CANCELLED ? -- VD_AGENT_FILE_XFER_STATUS_CANCELLED : VD_AGENT_FILE_XFER_STATUS_ERROR, -- }; -- agent_msg_queue_many(self->priv->channel, VD_AGENT_FILE_XFER_STATUS, -- &msg, sizeof(msg), NULL); - spice_channel_wakeup(SPICE_CHANNEL(self->priv->channel), FALSE); - spice_file_transfer_task_completed(self, error); - } -@@ -2946,6 +2939,16 @@ static void spice_file_transfer_task_completed(SpiceFileTransferTask *self, - self->priv->error = error; - } - -+ if (self->priv->error) { -+ VDAgentFileXferStatusMessage msg = { -+ .id = self->priv->id, -+ .result = error->code == G_IO_ERROR_CANCELLED ? -+ VD_AGENT_FILE_XFER_STATUS_CANCELLED : VD_AGENT_FILE_XFER_STATUS_ERROR, -+ }; -+ agent_msg_queue_many(self->priv->channel, VD_AGENT_FILE_XFER_STATUS, -+ &msg, sizeof(msg), NULL); -+ } -+ - if (self->priv->pending) - return; - --- -2.8.1 - diff --git a/SOURCES/0004-gtk-session-always-reply-to-agent-s-clipboard-reques.patch b/SOURCES/0004-gtk-session-always-reply-to-agent-s-clipboard-reques.patch new file mode 100644 index 0000000..82a3465 --- /dev/null +++ b/SOURCES/0004-gtk-session-always-reply-to-agent-s-clipboard-reques.patch @@ -0,0 +1,94 @@ +From 1d349aa519571199d10d38b0a0e2f91b051ab3c8 Mon Sep 17 00:00:00 2001 +From: Victor Toso +Date: Fri, 24 Feb 2017 14:12:45 +0100 +Subject: [PATCH spice-gtk 2/2] gtk-session: always reply to agent's clipboard + request +To: spice-devel@lists.freedesktop.org + +This fixes a regression from 7b0de6217670e0f668aff2949f + +We need to reply back to the agent all clipboard requests even in case +of failure otherwise it will have a pending request. The following +error message can be seen afterwards, in the linux agent, when client +sends down some clipboard data: + + > clipboard: selection requests pending on clipboard ownership + > change, clearing + +An easy way to reproduce this is: +1-) In client, copy image from lo-draw (selection or ctrl+c) +2-) In guest, paste it to GEdit (mouse3 our ctrl+v) +3-) Move to the client +4-) Move back to the guest +5-) see error on vdagent logs + +The reason for failure is that client's clipboard contains different +data type (image) then what was requested from guest's editor (text) + +While at it, include extra debug message as it might be hard to +identify why clipboard did not work. + +Resolves: rhbz#1409854 +Signed-off-by: Victor Toso +Acked-by: Pavel Grunt +(cherry picked from commit 172c521271a3dc6d9ed0c297406c2fa29266682d) +--- + src/spice-gtk-session.c | 21 +++++++++++++-------- + 1 file changed, 13 insertions(+), 8 deletions(-) + +diff --git a/src/spice-gtk-session.c b/src/spice-gtk-session.c +index 6424596..c0a46e8 100644 +--- a/src/spice-gtk-session.c ++++ b/src/spice-gtk-session.c +@@ -931,35 +931,40 @@ static void clipboard_received_text_cb(GtkClipboard *clipboard, + char *conv = NULL; + int len = 0; + int selection; ++ const guchar *data = NULL; + + if (self == NULL) + return; + ++ selection = get_selection_from_clipboard(self->priv, clipboard); ++ g_return_if_fail(selection != -1); ++ + if (text == NULL) { + SPICE_DEBUG("Failed to retrieve clipboard text"); +- return; ++ goto notify_agent; + } + + g_return_if_fail(SPICE_IS_GTK_SESSION(self)); + +- selection = get_selection_from_clipboard(self->priv, clipboard); +- g_return_if_fail(selection != -1); +- + len = strlen(text); + if (!check_clipboard_size_limits(self, len)) { +- return; ++ SPICE_DEBUG("Failed size limits of clipboard text (%d bytes)", len); ++ goto notify_agent; + } + + /* gtk+ internal utf8 newline is always LF, even on windows */ + conv = fixup_clipboard_text(self, text, &len); + if (!check_clipboard_size_limits(self, len)) { +- g_free(conv); +- return; ++ SPICE_DEBUG("Failed size limits of clipboard text (%d bytes)", len); ++ goto notify_agent; + } + ++ data = (const guchar *) (conv != NULL ? conv : text); ++notify_agent: + spice_main_clipboard_selection_notify(self->priv->main, selection, + VD_AGENT_CLIPBOARD_UTF8_TEXT, +- (guchar *)(conv ?: text), len); ++ data, ++ (data != NULL) ? len : 0); + g_free(conv); + } + +-- +2.12.0 + diff --git a/SOURCES/0005-channel-main-fix-leak-on-volume-sync.patch b/SOURCES/0005-channel-main-fix-leak-on-volume-sync.patch deleted file mode 100644 index 42de81b..0000000 --- a/SOURCES/0005-channel-main-fix-leak-on-volume-sync.patch +++ /dev/null @@ -1,62 +0,0 @@ -From abec5822455c76d353e40d5e2748ddce7c5219d9 Mon Sep 17 00:00:00 2001 -From: Victor Toso -Date: Wed, 23 Mar 2016 15:40:50 +0100 -Subject: [PATCH 5/5] channel-main: fix leak on volume-sync - -7 bytes in 1 blocks are definitely lost in loss record 128 of 10,009 - at 0x4C2A988: calloc (vg_replace_malloc.c:711) - by 0xB6C3200: g_malloc0 (gmem.c:124) - by 0x740BD5F: audio_playback_volume_info_cb (channel-main.c:1216) - by 0xB11D488: g_task_return_now (gtask.c:1107) - by 0xB11DCBD: g_task_return (gtask.c:1165) - by 0x742D1F5: spice_pulse_complete_all_async_tasks (spice-pulse.c:1034) - by 0x8B6B57C: ext_stream_restore_read_cb (ext-stream-restore.c:141) - by 0x10BA63C0: run_action (pdispatch.c:284) - by 0x10BA6722: pa_pdispatch_run (pdispatch.c:337) - by 0x8B6520D: pstream_packet_callback (context.c:338) - by 0x10BA8D7E: do_read (pstream.c:879) - by 0x10BAB39A: do_pstream_read_write (pstream.c:189) - -7 bytes in 1 blocks are definitely lost in loss record 129 of 10,009 - at 0x4C2A988: calloc (vg_replace_malloc.c:711) - by 0xB6C3200: g_malloc0 (gmem.c:124) - by 0x740BFBF: audio_record_volume_info_cb (channel-main.c:1273) - by 0xB11D488: g_task_return_now (gtask.c:1107) - by 0xB11DCBD: g_task_return (gtask.c:1165) - by 0x742D1F5: spice_pulse_complete_all_async_tasks (spice-pulse.c:1034) - by 0x8B6B57C: ext_stream_restore_read_cb (ext-stream-restore.c:141) - by 0x10BA63C0: run_action (pdispatch.c:284) - by 0x10BA6722: pa_pdispatch_run (pdispatch.c:337) - by 0x8B6520D: pstream_packet_callback (context.c:338) - by 0x10BA8D7E: do_read (pstream.c:879) - by 0x10BAB39A: do_pstream_read_write (pstream.c:189) - -Acked-by: Christophe Fergeau -(cherry picked from commit e47075093d5d78b05a2b34fa7aee43dd6818f6ab) ---- - src/channel-main.c | 2 ++ - 1 file changed, 2 insertions(+) - -diff --git a/src/channel-main.c b/src/channel-main.c -index 67fce5b..2ad1ece 100644 ---- a/src/channel-main.c -+++ b/src/channel-main.c -@@ -1234,6 +1234,7 @@ static void audio_playback_volume_info_cb(GObject *object, GAsyncResult *res, gp - g_free(volume); - agent_msg_queue(main_channel, VD_AGENT_AUDIO_VOLUME_SYNC, - sizeof(VDAgentAudioVolumeSync) + array_size, avs); -+ g_free (avs); - } - - static void agent_sync_audio_playback(SpiceMainChannel *main_channel) -@@ -1291,6 +1292,7 @@ static void audio_record_volume_info_cb(GObject *object, GAsyncResult *res, gpoi - g_free(volume); - agent_msg_queue(main_channel, VD_AGENT_AUDIO_VOLUME_SYNC, - sizeof(VDAgentAudioVolumeSync) + array_size, avs); -+ g_free (avs); - } - - static void agent_sync_audio_record(SpiceMainChannel *main_channel) --- -2.8.1 - diff --git a/SOURCES/0005-usb-Allow-to-compile-if-LZ4-is-disabled.patch b/SOURCES/0005-usb-Allow-to-compile-if-LZ4-is-disabled.patch new file mode 100644 index 0000000..5afbe41 --- /dev/null +++ b/SOURCES/0005-usb-Allow-to-compile-if-LZ4-is-disabled.patch @@ -0,0 +1,38 @@ +From a6e7077e0dbc57ae174b2fc6ab0f4082561f0a45 Mon Sep 17 00:00:00 2001 +From: Frediano Ziglio +Date: Mon, 14 Nov 2016 11:19:47 +0000 +Subject: [PATCH spice-gtk] usb: Allow to compile if LZ4 is disabled +To: spice-devel@lists.freedesktop.org + +spice_usbredir_channel_get_spice_usb_device is used only if LZ4 +is enabled so avoid to define if not used as this cause a +compile error. + +Signed-off-by: Frediano Ziglio +Acked-by: Victor Toso +(cherry picked from commit e0a6ca62acb2d2e46304a9ce6b1dcb41e0534587) +--- + src/channel-usbredir.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/src/channel-usbredir.c b/src/channel-usbredir.c +index 94a5050..add7d5e 100644 +--- a/src/channel-usbredir.c ++++ b/src/channel-usbredir.c +@@ -544,11 +544,13 @@ void spice_usbredir_channel_disconnect_device_async(SpiceUsbredirChannel *channe + g_object_unref(task); + } + ++#ifdef USE_LZ4 + static SpiceUsbDevice * + spice_usbredir_channel_get_spice_usb_device(SpiceUsbredirChannel *channel) + { + return channel->priv->spice_device; + } ++#endif + + G_GNUC_INTERNAL + libusb_device *spice_usbredir_channel_get_device(SpiceUsbredirChannel *channel) +-- +2.12.0 + diff --git a/SOURCES/0006-channel-Abort-migration-in-delayed-unref.patch b/SOURCES/0006-channel-Abort-migration-in-delayed-unref.patch deleted file mode 100644 index 057e894..0000000 --- a/SOURCES/0006-channel-Abort-migration-in-delayed-unref.patch +++ /dev/null @@ -1,50 +0,0 @@ -From 71789361f05fbdcca1c91b28eba9dbca5d1af249 Mon Sep 17 00:00:00 2001 -From: Pavel Grunt -Date: Fri, 22 Apr 2016 16:47:48 +0200 -Subject: [PATCH] channel: Abort migration in delayed unref - -When channel is unref'ed during migration migrate_channel_event_cb -is called causing a crash by coroutine yielding to nonexistent channel. - -The delayed_unref happens for the target host channel and will only occur -when the migration process fails. - -As comment in spice_channel_coroutine says: - Co-routine exits now - the SpiceChannel object may no longer exist, - so don't do anything else now unless you like SEGVs - -Related: rhbz#1318574 -Acked-by: Victor Toso ---- - src/spice-channel.c | 8 ++++++++ - 1 file changed, 8 insertions(+) - -diff --git a/src/spice-channel.c b/src/spice-channel.c -index d8a4ed6..e52a6a9 100644 ---- a/src/spice-channel.c -+++ b/src/spice-channel.c -@@ -2306,6 +2306,7 @@ static gboolean spice_channel_delayed_unref(gpointer data) - SpiceChannel *channel = SPICE_CHANNEL(data); - SpiceChannelPrivate *c = channel->priv; - gboolean was_ready = c->state == SPICE_CHANNEL_STATE_READY; -+ SpiceSession *session; - - CHANNEL_DEBUG(channel, "Delayed unref channel %p", channel); - -@@ -2313,6 +2314,13 @@ static gboolean spice_channel_delayed_unref(gpointer data) - - c->state = SPICE_CHANNEL_STATE_UNCONNECTED; - -+ session = spice_channel_get_session(channel); -+ if (spice_session_is_for_migration(session)) { -+ /* error during migration - abort migration */ -+ spice_session_abort_migration(session); -+ return FALSE; -+ } -+ - if (c->event != SPICE_CHANNEL_NONE) { - g_coroutine_signal_emit(channel, signals[SPICE_CHANNEL_EVENT], 0, c->event); - c->event = SPICE_CHANNEL_NONE; --- -2.8.1 - diff --git a/SOURCES/0006-widget-Always-call-gtk_widget_show_all.patch b/SOURCES/0006-widget-Always-call-gtk_widget_show_all.patch new file mode 100644 index 0000000..328311d --- /dev/null +++ b/SOURCES/0006-widget-Always-call-gtk_widget_show_all.patch @@ -0,0 +1,44 @@ +From a641a92e935a26bdaf104e76a324d533171aa7b4 Mon Sep 17 00:00:00 2001 +From: Pavel Grunt +Date: Mon, 27 Mar 2017 13:36:57 +0200 +Subject: [PATCH spice-gtk 6/8] widget: Always call gtk_widget_show_all +To: spice-devel@lists.freedesktop.org + +Since spice-gtk 0.32 SpiceDisplay widget internally has changed +from the GtkDrawingArea to a GtkContainer. + +Per gtk_widget_show documentation: + "Remember that you have to show the containers containing a widget, + in addition to the widget itself, before it will appear onscreen." + +Let's always call gtk_widget_show_all, not just for gtk+ >= 3.16 +otherwise you may get a blackscreen with spice-gtk compiled against +an old gtk+ version. + +Fixes: +https://bugs.freedesktop.org/show_bug.cgi?id=100251 + +Acked-by: Christophe Fergeau +(cherry picked from commit 721dbe9926c0e35e462595346829d55d7820ea05) +--- + src/spice-widget.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/spice-widget.c b/src/spice-widget.c +index 06e332f..cc0a705 100644 +--- a/src/spice-widget.c ++++ b/src/spice-widget.c +@@ -645,9 +645,9 @@ static void spice_display_init(SpiceDisplay *display) + "signal::realize", gl_area_realize, display, + NULL); + gtk_stack_add_named(d->stack, area, "gl-area"); +- gtk_widget_show_all(widget); + #endif + #endif ++ gtk_widget_show_all(widget); + + g_signal_connect(display, "grab-broken-event", G_CALLBACK(grab_broken), NULL); + g_signal_connect(display, "grab-notify", G_CALLBACK(grab_notify), NULL); +-- +2.12.1 + diff --git a/SOURCES/0007-authentication-Handle-failed-SASL-authentication-sep.patch b/SOURCES/0007-authentication-Handle-failed-SASL-authentication-sep.patch new file mode 100644 index 0000000..0f45105 --- /dev/null +++ b/SOURCES/0007-authentication-Handle-failed-SASL-authentication-sep.patch @@ -0,0 +1,94 @@ +From e32502ef5a9f6bae10924426e0e2e88dbac6dca5 Mon Sep 17 00:00:00 2001 +From: snir sheriber +Date: Sun, 26 Feb 2017 12:09:17 +0200 +Subject: [PATCH spice-gtk 7/8] authentication: Handle failed SASL + authentication separately +To: spice-devel@lists.freedesktop.org + +Move SASL authentication failures handling to a separate +function. + +Multiple error messages asking for username\password were +removed because they are not necessarily the reason for the +failure (avoiding similar issue as in rhbz#1365736). +Letting the user know about required username\password +should be achieved by setting specific Gerror's error code +and enabling\disabling the username\password fields +accordingly by the application. + +(cherry picked from commit 2dc8f0bad6558a944405404a266954fd29fd0fa2) +--- + src/spice-channel.c | 44 +++++++++++++++++++++++++++----------------- + 1 file changed, 27 insertions(+), 17 deletions(-) + +diff --git a/src/spice-channel.c b/src/spice-channel.c +index 95662f3..020606b 100644 +--- a/src/spice-channel.c ++++ b/src/spice-channel.c +@@ -1104,28 +1104,38 @@ static int spice_channel_read(SpiceChannel *channel, void *data, size_t length) + return length; + } + ++#if HAVE_SASL + /* coroutine context */ +-static void spice_channel_failed_authentication(SpiceChannel *channel, +- gboolean invalidPassword) ++static void spice_channel_failed_sasl_authentication(SpiceChannel *channel) + { + SpiceChannelPrivate *c = channel->priv; ++ gint err_code; /* The application should activate the authentication window fields accordingly */ + + if (c->auth_needs_username && c->auth_needs_password) +- g_set_error_literal(&c->error, +- SPICE_CLIENT_ERROR, +- SPICE_CLIENT_ERROR_AUTH_NEEDS_PASSWORD_AND_USERNAME, +- _("Authentication failed: password and username are required")); ++ err_code = SPICE_CLIENT_ERROR_AUTH_NEEDS_PASSWORD_AND_USERNAME; + else if (c->auth_needs_username) +- g_set_error_literal(&c->error, +- SPICE_CLIENT_ERROR, +- SPICE_CLIENT_ERROR_AUTH_NEEDS_USERNAME, +- _("Authentication failed: username is required")); +- else if (c->auth_needs_password) +- g_set_error_literal(&c->error, +- SPICE_CLIENT_ERROR, +- SPICE_CLIENT_ERROR_AUTH_NEEDS_PASSWORD, +- _("Authentication failed: password is required")); +- else if (invalidPassword) ++ err_code = SPICE_CLIENT_ERROR_AUTH_NEEDS_USERNAME; ++ else ++ err_code = SPICE_CLIENT_ERROR_AUTH_NEEDS_PASSWORD; ++ ++ g_set_error_literal(&c->error, ++ SPICE_CLIENT_ERROR, ++ err_code, ++ _("Authentication failed")); ++ ++ c->event = SPICE_CHANNEL_ERROR_AUTH; ++ ++ c->has_error = TRUE; /* force disconnect */ ++} ++#endif ++ ++/* coroutine context */ ++static void spice_channel_failed_authentication(SpiceChannel *channel, ++ gboolean invalidPassword) ++{ ++ SpiceChannelPrivate *c = channel->priv; ++ ++ if (invalidPassword) + g_set_error_literal(&c->error, + SPICE_CLIENT_ERROR, + SPICE_CLIENT_ERROR_AUTH_NEEDS_PASSWORD, +@@ -1799,7 +1809,7 @@ error: + if (saslconn) + sasl_dispose(&saslconn); + +- spice_channel_failed_authentication(channel, FALSE); ++ spice_channel_failed_sasl_authentication(channel); + ret = FALSE; + + cleanup: +-- +2.12.1 + diff --git a/SOURCES/0007-file-xfer-fix-segfault-on-agent-disconnection.patch b/SOURCES/0007-file-xfer-fix-segfault-on-agent-disconnection.patch deleted file mode 100644 index bbdc2bf..0000000 --- a/SOURCES/0007-file-xfer-fix-segfault-on-agent-disconnection.patch +++ /dev/null @@ -1,65 +0,0 @@ -From 51fa9b5b1d1c322206f7056d56bb74b1759a8161 Mon Sep 17 00:00:00 2001 -From: Victor Toso -Date: Thu, 12 May 2016 22:18:44 +0200 -Subject: [PATCH 07/15] file-xfer: fix segfault on agent disconnection -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -We are checking self->priv->error but accessing the argument GError * -which is NULL and leads to a segfault. - -Program received signal SIGSEGV, Segmentation fault. -spice_file_transfer_task_completed (self=self@entry=0x7fffd0006f00, error=0x0) at channel-main.c:2963 -2963 VDAgentFileXferStatusMessage msg = { -(gdb) bt - #0 spice_file_transfer_task_completed (self=self@entry=0x7fffd0006f00, error=0x0) at channel-main.c:2963 - #1 in file_xfer_data_flushed_cb (source_object=0x7cc1d0, res=0x953390, user_data=user_data@entry=0x7fffd0006f00) at channel-main.c:1857 - #2 in g_task_return_now (task=0x953390) at gtask.c:1108 - #3 in g_task_return (task=0x953390, type=) at gtask.c:1166 - #4 in flush_foreach_remove (key=, value=, user_data=) at channel-main.c:928 - #5 in g_hash_table_foreach_remove_or_steal (hash_table=0x70cea0, func=func@entry=0x7ffff5616f10 , user_data=user_data@entry=0x0, notify=notify@entry=1) at ghash.c:1492 - #6 in g_hash_table_foreach_remove (hash_table=, func=func@entry=0x7ffff5616f10 , user_data=user_data@entry=0x0) at ghash.c:1538 - #7 in file_xfer_flushed (success=0, channel=0x7cc1d0) at channel-main.c:936 - #8 spice_main_channel_reset_agent (channel=0x7cc1d0) at channel-main.c:466 - #9 set_agent_connected (channel=0x7cc1d0, connected=connected@entry=0) at channel-main.c:1572 - #10 in spice_main_channel_reset (channel=0x7cc1d0, migrating=0) at channel-main.c:485 - #11 in spice_channel_coroutine (data=0x7cc1d0) at spice-channel.c:2564 - #12 in coroutine_trampoline (cc=0x7cb860) at coroutine_ucontext.c:63 - #13 in continuation_trampoline (i0=, i1=) at continuation.c:55 - #14 in ?? () from /lib64/libc.so.6 - #15 in ?? () - #16 in ?? () -Backtrace stopped: Cannot access memory at address - -Acked-by: Fabiano Fidêncio -(cherry picked from commit a61c1ff0ac34fded8f71e528594c3f548479cd44) ---- - src/channel-main.c | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/src/channel-main.c b/src/channel-main.c -index 2ad1ece..7f4d0b3 100644 ---- a/src/channel-main.c -+++ b/src/channel-main.c -@@ -2944,7 +2944,7 @@ static void spice_file_transfer_task_completed(SpiceFileTransferTask *self, - if (self->priv->error) { - VDAgentFileXferStatusMessage msg = { - .id = self->priv->id, -- .result = error->code == G_IO_ERROR_CANCELLED ? -+ .result = self->priv->error->code == G_IO_ERROR_CANCELLED ? - VD_AGENT_FILE_XFER_STATUS_CANCELLED : VD_AGENT_FILE_XFER_STATUS_ERROR, - }; - agent_msg_queue_many(self->priv->channel, VD_AGENT_FILE_XFER_STATUS, -@@ -2966,7 +2966,7 @@ static void spice_file_transfer_task_completed(SpiceFileTransferTask *self, - self); - self->priv->pending = TRUE; - signal: -- g_signal_emit(self, task_signals[SIGNAL_FINISHED], 0, error); -+ g_signal_emit(self, task_signals[SIGNAL_FINISHED], 0, self->priv->error); - } - - --- -2.5.5 - diff --git a/SOURCES/0008-authentication-Handle-failed-spice-authentication.patch b/SOURCES/0008-authentication-Handle-failed-spice-authentication.patch new file mode 100644 index 0000000..3a79a73 --- /dev/null +++ b/SOURCES/0008-authentication-Handle-failed-spice-authentication.patch @@ -0,0 +1,63 @@ +From 9a3eab7d73b6300de21b0bf3aad176b774e5b1f5 Mon Sep 17 00:00:00 2001 +From: snir sheriber +Date: Sun, 26 Feb 2017 12:09:18 +0200 +Subject: [PATCH spice-gtk 8/8] authentication: Handle failed spice + authentication +To: spice-devel@lists.freedesktop.org + +Changing the name of the failures handling function (spice +and sasl authentication failures are now treated separately) +and display more suitable spice authentication failure error +message. + +Resolves: rhbz#1365736 +(cherry picked from commit 34be2a39949ebdffd7fdce4a9e6f3ddf1225b86b) +--- + src/spice-channel.c | 10 +++++----- + 1 file changed, 5 insertions(+), 5 deletions(-) + +diff --git a/src/spice-channel.c b/src/spice-channel.c +index 020606b..854fff6 100644 +--- a/src/spice-channel.c ++++ b/src/spice-channel.c +@@ -1130,8 +1130,8 @@ static void spice_channel_failed_sasl_authentication(SpiceChannel *channel) + #endif + + /* coroutine context */ +-static void spice_channel_failed_authentication(SpiceChannel *channel, +- gboolean invalidPassword) ++static void spice_channel_failed_spice_authentication(SpiceChannel *channel, ++ gboolean invalidPassword) + { + SpiceChannelPrivate *c = channel->priv; + +@@ -1144,7 +1144,7 @@ static void spice_channel_failed_authentication(SpiceChannel *channel, + g_set_error_literal(&c->error, + SPICE_CLIENT_ERROR, + SPICE_CLIENT_ERROR_AUTH_NEEDS_PASSWORD, +- _("Authentication failed: password is required")); ++ _("Authentication failed: wrong password ?")); + + c->event = SPICE_CHANNEL_ERROR_AUTH; + +@@ -1183,7 +1183,7 @@ static SpiceChannelEvent spice_channel_send_spice_ticket(SpiceChannel *channel) + if (password == NULL) + password = g_strdup(""); + if (strlen(password) > SPICE_MAX_PASSWORD_LENGTH) { +- spice_channel_failed_authentication(channel, TRUE); ++ spice_channel_failed_spice_authentication(channel, TRUE); + ret = SPICE_CHANNEL_ERROR_AUTH; + goto cleanup; + } +@@ -1219,7 +1219,7 @@ static gboolean spice_channel_recv_auth(SpiceChannel *channel) + + if (link_res != SPICE_LINK_ERR_OK) { + CHANNEL_DEBUG(channel, "link result: reply %u", link_res); +- spice_channel_failed_authentication(channel, FALSE); ++ spice_channel_failed_spice_authentication(channel, FALSE); + return FALSE; + } + +-- +2.12.1 + diff --git a/SOURCES/0008-tests-Add-test-for-SpiceURI.patch b/SOURCES/0008-tests-Add-test-for-SpiceURI.patch deleted file mode 100644 index 6ab4844..0000000 --- a/SOURCES/0008-tests-Add-test-for-SpiceURI.patch +++ /dev/null @@ -1,145 +0,0 @@ -From 087bba6bbc4d47e3e068c8b5ee902637de04bc7e Mon Sep 17 00:00:00 2001 -From: Pavel Grunt -Date: Wed, 1 Jun 2016 10:04:44 +0200 -Subject: [PATCH 08/15] tests: Add test for SpiceURI - -Related: rhbz#1335239 -(cherry picked from commit dab190d8d2cb93f85f1858135354dd4e93ff48f8) ---- - tests/Makefile.am | 2 ++ - tests/uri.c | 103 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ - 2 files changed, 105 insertions(+) - create mode 100644 tests/uri.c - -diff --git a/tests/Makefile.am b/tests/Makefile.am -index c1d95c1..9517431 100644 ---- a/tests/Makefile.am -+++ b/tests/Makefile.am -@@ -4,6 +4,7 @@ noinst_PROGRAMS = - TESTS = coroutine \ - util \ - session \ -+ test-spice-uri \ - $(NULL) - - if WITH_PHODAV -@@ -35,6 +36,7 @@ util_SOURCES = util.c - coroutine_SOURCES = coroutine.c - session_SOURCES = session.c - pipe_SOURCES = pipe.c -+test_spice_uri_SOURCES = uri.c - usb_acl_helper_SOURCES = usb-acl-helper.c - usb_acl_helper_CFLAGS = -DTESTDIR=\"$(abs_builddir)\" - mock_acl_helper_SOURCES = mock-acl-helper.c -diff --git a/tests/uri.c b/tests/uri.c -new file mode 100644 -index 0000000..b68f159 ---- /dev/null -+++ b/tests/uri.c -@@ -0,0 +1,103 @@ -+/* -*- Mode: C; c-basic-offset: 4; indent-tabs-mode: nil -*- */ -+/* -+ Copyright (C) 2016 Red Hat, Inc. -+ -+ This library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ This library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with this library; if not, see . -+*/ -+#include -+#include -+#include "spice-uri-priv.h" -+ -+struct test_case { -+ gchar *uri; -+ gchar *scheme; -+ gchar *hostname; -+ guint port; -+ gchar *user; -+ gchar *password; -+ gchar *error_msg; -+}; -+ -+static void test_spice_uri_bad(const struct test_case invalid_test_cases[], const guint cases_cnt) -+{ -+ guint i; -+ -+ SpiceURI *uri = spice_uri_new(); -+ g_assert_nonnull(uri); -+ -+ for (i = 0; i < cases_cnt; i++) { -+ GError *error = NULL; -+ g_assert_false(spice_uri_parse(uri, invalid_test_cases[i].uri, &error)); -+ g_assert_error(error, SPICE_CLIENT_ERROR, SPICE_CLIENT_ERROR_FAILED); -+ g_assert_cmpstr(error->message, ==, invalid_test_cases[i].error_msg); -+ g_error_free(error); -+ } -+ -+ g_object_unref(uri); -+} -+ -+static void test_spice_uri_good(const struct test_case valid_test_cases[], const guint cases_cnt) -+{ -+ guint i; -+ -+ SpiceURI *uri = spice_uri_new(); -+ g_assert_nonnull(uri); -+ -+ for (i = 0; i < cases_cnt; i++) { -+ GError *error = NULL; -+ g_assert_true(spice_uri_parse(uri, valid_test_cases[i].uri, &error)); -+ g_assert_cmpstr(spice_uri_get_scheme(uri), ==, valid_test_cases[i].scheme); -+ g_assert_cmpstr(spice_uri_get_hostname(uri), ==, valid_test_cases[i].hostname); -+ g_assert_cmpstr(spice_uri_get_user(uri), ==, valid_test_cases[i].user); -+ g_assert_cmpstr(spice_uri_get_password(uri), ==, valid_test_cases[i].password); -+ g_assert_cmpuint(spice_uri_get_port(uri), ==, valid_test_cases[i].port); -+ g_assert_no_error(error); -+ } -+ -+ g_object_unref(uri); -+} -+ -+static void test_spice_uri_ipv4_bad(void) -+{ -+ const struct test_case invalid_test_cases[] = { -+ {"http://:80", "http", NULL, 80, NULL, NULL, "Invalid hostname in uri address"}, -+ {"http://", "http", NULL, 3128, NULL, NULL, "Invalid hostname in uri address"}, -+ {"http://127.0.0.1:port", "http", "127.0.0.1", 3128, NULL, NULL, -+ "Invalid uri port: port"}, -+ }; -+ -+ test_spice_uri_bad(invalid_test_cases, G_N_ELEMENTS(invalid_test_cases)); -+} -+ -+static void test_spice_uri_ipv4_good(void) -+{ -+ const struct test_case valid_test_cases[] = { -+ {"http://127.0.0.1/", "http", "127.0.0.1", 3128, NULL, NULL, NULL}, -+ {"https://127.0.0.1", "https", "127.0.0.1", 3129, NULL, NULL, NULL}, -+ {"127.0.0.1", "http", "127.0.0.1", 3128, NULL, NULL, NULL}, -+ {"http://user:password@host:80", "http", "host", 80, "user", "password", NULL}, -+ }; -+ -+ test_spice_uri_good(valid_test_cases, G_N_ELEMENTS(valid_test_cases)); -+} -+ -+int main(int argc, char* argv[]) -+{ -+ g_test_init(&argc, &argv, NULL); -+ -+ g_test_add_func("/spice_uri/ipv4/bad-uri", test_spice_uri_ipv4_bad); -+ g_test_add_func("/spice_uri/ipv4/good-uri", test_spice_uri_ipv4_good); -+ -+ return g_test_run(); -+} --- -2.5.5 - diff --git a/SOURCES/0009-file-xfer-do-not-send-unnecessary-0-bytes-messages.patch b/SOURCES/0009-file-xfer-do-not-send-unnecessary-0-bytes-messages.patch new file mode 100644 index 0000000..1729fd8 --- /dev/null +++ b/SOURCES/0009-file-xfer-do-not-send-unnecessary-0-bytes-messages.patch @@ -0,0 +1,40 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Victor Toso +Date: Fri, 11 Nov 2016 14:19:53 +0100 +Subject: [PATCH] file-xfer: do not send unnecessary 0 bytes messages + +This fixes the situation when VDAgent receives 0 byte message +regarding a file-transfer operation that was terminated in the +previous message. + +This makes the VDAgent to send a STATUS_ERROR after STATUS_SUCCESS to +client. + +Resolves: https://bugs.freedesktop.org/show_bug.cgi?id=97227 + +Signed-off-by: Victor Toso +Acked-by: Jonathon Jongsma +(cherry picked from commit 885229393e3198bd4b386cf71a51832439dfb31b) +--- + src/channel-main.c | 8 ++++++++ + 1 file changed, 8 insertions(+) + +diff --git a/src/channel-main.c b/src/channel-main.c +index 990a06a..72ca712 100644 +--- a/src/channel-main.c ++++ b/src/channel-main.c +@@ -1822,6 +1822,14 @@ static void file_xfer_read_async_cb(GObject *source_object, + return; + } + ++ if (count == 0 && spice_file_transfer_task_get_total_bytes(xfer_task) > 0) { ++ /* If we have sent all payload to the agent, we should not send 0 bytes ++ * as it will cause https://bugs.freedesktop.org/show_bug.cgi?id=97227. ++ * Only when file has 0 bytes of size is when we should send 0 bytes to ++ * agent, see: https://bugzilla.redhat.com/show_bug.cgi?id=1135099 */ ++ return; ++ } ++ + file_xfer_queue_msg_to_agent(channel, spice_file_transfer_task_get_id(xfer_task), buffer, count); + if (count == 0 || spice_file_transfer_task_is_completed(xfer_task)) { + /* on EOF just wait for VD_AGENT_FILE_XFER_STATUS from agent diff --git a/SOURCES/0009-spice-uri-Reset-SpiceURI-before-parsing.patch b/SOURCES/0009-spice-uri-Reset-SpiceURI-before-parsing.patch deleted file mode 100644 index 2eaf421..0000000 --- a/SOURCES/0009-spice-uri-Reset-SpiceURI-before-parsing.patch +++ /dev/null @@ -1,71 +0,0 @@ -From 92a12ce39b7b49ab4f992066dcafeab98680232f Mon Sep 17 00:00:00 2001 -From: Pavel Grunt -Date: Wed, 1 Jun 2016 10:04:45 +0200 -Subject: [PATCH 09/15] spice-uri: Reset SpiceURI before parsing - -Avoid using old values after parsing a new uri. - -Related: rhbz#1335239 -(cherry picked from commit 024eccefba506f57fbff837c6d75864c51ed2add) ---- - src/spice-uri.c | 17 +++++++++++++---- - tests/uri.c | 1 + - 2 files changed, 14 insertions(+), 4 deletions(-) - -diff --git a/src/spice-uri.c b/src/spice-uri.c -index e2c5c9a..1684328 100644 ---- a/src/spice-uri.c -+++ b/src/spice-uri.c -@@ -68,6 +68,15 @@ SpiceURI* spice_uri_new(void) - return self; - } - -+static void spice_uri_reset(SpiceURI *self) -+{ -+ g_clear_pointer(&self->scheme, g_free); -+ g_clear_pointer(&self->hostname, g_free); -+ g_clear_pointer(&self->user, g_free); -+ g_clear_pointer(&self->password, g_free); -+ self->port = 0; -+} -+ - G_GNUC_INTERNAL - gboolean spice_uri_parse(SpiceURI *self, const gchar *_uri, GError **error) - { -@@ -76,6 +85,9 @@ gboolean spice_uri_parse(SpiceURI *self, const gchar *_uri, GError **error) - size_t len; - - g_return_val_if_fail(self != NULL, FALSE); -+ -+ spice_uri_reset(self); -+ - g_return_val_if_fail(_uri != NULL, FALSE); - - uri = dup = g_strdup(_uri); -@@ -304,10 +316,7 @@ static void spice_uri_finalize(GObject* obj) - SpiceURI *self; - - self = G_TYPE_CHECK_INSTANCE_CAST(obj, SPICE_TYPE_URI, SpiceURI); -- g_free(self->scheme); -- g_free(self->hostname); -- g_free(self->user); -- g_free(self->password); -+ spice_uri_reset(self); - - G_OBJECT_CLASS (spice_uri_parent_class)->finalize (obj); - } -diff --git a/tests/uri.c b/tests/uri.c -index b68f159..d57f072 100644 ---- a/tests/uri.c -+++ b/tests/uri.c -@@ -87,6 +87,7 @@ static void test_spice_uri_ipv4_good(void) - {"https://127.0.0.1", "https", "127.0.0.1", 3129, NULL, NULL, NULL}, - {"127.0.0.1", "http", "127.0.0.1", 3128, NULL, NULL, NULL}, - {"http://user:password@host:80", "http", "host", 80, "user", "password", NULL}, -+ {"https://host:42", "https", "host", 42, NULL, NULL, NULL}, /* tests resetting of username & password */ - }; - - test_spice_uri_good(valid_test_cases, G_N_ELEMENTS(valid_test_cases)); --- -2.5.5 - diff --git a/SOURCES/0010-file-xfer-avoid-g_hash_table_iter_-when-changing-the.patch b/SOURCES/0010-file-xfer-avoid-g_hash_table_iter_-when-changing-the.patch new file mode 100644 index 0000000..7e65a1a --- /dev/null +++ b/SOURCES/0010-file-xfer-avoid-g_hash_table_iter_-when-changing-the.patch @@ -0,0 +1,71 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Victor Toso +Date: Wed, 8 Feb 2017 09:59:51 +0100 +Subject: [PATCH] file-xfer: avoid g_hash_table_iter_* when changing the + GHashTable + +Using g_hash_table_iter_init() and g_hash_table_iter_next() here is +bad as spice_file_transfer_task_completed() will emit "finished" +signal from SpiceFileTransferTask resulting in the original GHashTable +to be changed in file_transfer_operation_task_finished() + +Debug will show: + GSpice-DEBUG: spice-file-transfer-task.c:303 File bigfile2 xfer + failed: Agent connection closed + + WARNING **: Agent connection closed + + GLib-CRITICAL **: g_hash_table_iter_next: assertion 'ri->version == + ri->hash_table->version' failed + +Reported-by: Pavel Grunt +Signed-off-by: Victor Toso +Acked-by: Pavel Grunt +(cherry picked from commit 01bb9bb30517b0ea3bdb230d40b2835c53a9cf59) +--- + src/channel-main.c | 19 ++++++++++++------- + 1 file changed, 12 insertions(+), 7 deletions(-) + +diff --git a/src/channel-main.c b/src/channel-main.c +index 72ca712..0a4435e 100644 +--- a/src/channel-main.c ++++ b/src/channel-main.c +@@ -2915,19 +2915,23 @@ static void file_transfer_operation_free(FileTransferOperation *xfer_op) + + static void spice_main_channel_reset_all_xfer_operations(SpiceMainChannel *channel) + { +- GHashTableIter iter_all_xfer_tasks; +- gpointer key, value; ++ GList *it, *keys; + + /* Mark each of SpiceFileTransferTask as completed due error */ +- g_hash_table_iter_init(&iter_all_xfer_tasks, channel->priv->file_xfer_tasks); +- while (g_hash_table_iter_next(&iter_all_xfer_tasks, &key, &value)) { +- FileTransferOperation *xfer_op = value; +- SpiceFileTransferTask *xfer_task = g_hash_table_lookup(xfer_op->xfer_task, key); ++ keys = g_hash_table_get_keys(channel->priv->file_xfer_tasks); ++ for (it = keys; it != NULL; it = it->next) { ++ FileTransferOperation *xfer_op; ++ SpiceFileTransferTask *xfer_task; + GError *error; + ++ xfer_op = g_hash_table_lookup(channel->priv->file_xfer_tasks, it->data); ++ if (xfer_op == NULL) ++ continue; ++ ++ xfer_task = g_hash_table_lookup(xfer_op->xfer_task, it->data); + if (xfer_task == NULL) { + spice_warning("(reset-all) can't complete task %u - completed already?", +- GPOINTER_TO_UINT(key)); ++ GPOINTER_TO_UINT(it->data)); + continue; + } + +@@ -2935,6 +2939,7 @@ static void spice_main_channel_reset_all_xfer_operations(SpiceMainChannel *chann + "Agent connection closed"); + spice_file_transfer_task_completed(xfer_task, error); + } ++ g_list_free(keys); + } + + static SpiceFileTransferTask *spice_main_channel_find_xfer_task_by_task_id(SpiceMainChannel *channel, diff --git a/SOURCES/0010-spice-uri-Do-not-allow-empty-port-string.patch b/SOURCES/0010-spice-uri-Do-not-allow-empty-port-string.patch deleted file mode 100644 index aa8d188..0000000 --- a/SOURCES/0010-spice-uri-Do-not-allow-empty-port-string.patch +++ /dev/null @@ -1,43 +0,0 @@ -From d2ea50359a5a646d3958bf2afdacebc20794b375 Mon Sep 17 00:00:00 2001 -From: Pavel Grunt -Date: Wed, 1 Jun 2016 10:04:46 +0200 -Subject: [PATCH 10/15] spice-uri: Do not allow empty port string - -Related: rhbz#1335239 - -Acked-by: Victor Toso -(cherry picked from commit 85051b06c1f04b206c00bb7f674a9a29bfb19594) ---- - src/spice-uri.c | 3 +++ - tests/uri.c | 1 + - 2 files changed, 4 insertions(+) - -diff --git a/src/spice-uri.c b/src/spice-uri.c -index 1684328..ce99f49 100644 ---- a/src/spice-uri.c -+++ b/src/spice-uri.c -@@ -147,6 +147,9 @@ gboolean spice_uri_parse(SpiceURI *self, const gchar *_uri, GError **error) - g_set_error(error, SPICE_CLIENT_ERROR, SPICE_CLIENT_ERROR_FAILED, - "Invalid uri port: %s", uri_port); - goto end; -+ } else if (endptr == uri_port) { -+ g_set_error(error, SPICE_CLIENT_ERROR, SPICE_CLIENT_ERROR_FAILED, "Missing uri port"); -+ goto end; - } - spice_uri_set_port(self, port); - } -diff --git a/tests/uri.c b/tests/uri.c -index d57f072..ee3d061 100644 ---- a/tests/uri.c -+++ b/tests/uri.c -@@ -75,6 +75,7 @@ static void test_spice_uri_ipv4_bad(void) - {"http://", "http", NULL, 3128, NULL, NULL, "Invalid hostname in uri address"}, - {"http://127.0.0.1:port", "http", "127.0.0.1", 3128, NULL, NULL, - "Invalid uri port: port"}, -+ {"http://127.0.0.1:", "http", "127.0.0.1", 3128, NULL, NULL, "Missing uri port"}, - }; - - test_spice_uri_bad(invalid_test_cases, G_N_ELEMENTS(invalid_test_cases)); --- -2.5.5 - diff --git a/SOURCES/0011-Remove-redundant-space-from-error-message.patch b/SOURCES/0011-Remove-redundant-space-from-error-message.patch new file mode 100644 index 0000000..2e21968 --- /dev/null +++ b/SOURCES/0011-Remove-redundant-space-from-error-message.patch @@ -0,0 +1,29 @@ +From f85c6387ff74bdb805fbb3a23b2af7dd087a982c Mon Sep 17 00:00:00 2001 +From: snir sheriber +Date: Tue, 25 Apr 2017 16:24:25 +0300 +Subject: [PATCH 11/13] Remove redundant space from error message + +Resolves: rhbz#1365736 + +Acked-by: Victor Toso +(cherry picked from commit 366344f37bc756137b0c5009135088f4bf562b04) +--- + src/spice-channel.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/spice-channel.c b/src/spice-channel.c +index 854fff6..df66386 100644 +--- a/src/spice-channel.c ++++ b/src/spice-channel.c +@@ -1144,7 +1144,7 @@ static void spice_channel_failed_spice_authentication(SpiceChannel *channel, + g_set_error_literal(&c->error, + SPICE_CLIENT_ERROR, + SPICE_CLIENT_ERROR_AUTH_NEEDS_PASSWORD, +- _("Authentication failed: wrong password ?")); ++ _("Authentication failed: wrong password?")); + + c->event = SPICE_CHANNEL_ERROR_AUTH; + +-- +2.12.2 + diff --git a/SOURCES/0011-spice-uri-Check-if-port-is-in-allowed-range.patch b/SOURCES/0011-spice-uri-Check-if-port-is-in-allowed-range.patch deleted file mode 100644 index 30bd646..0000000 --- a/SOURCES/0011-spice-uri-Check-if-port-is-in-allowed-range.patch +++ /dev/null @@ -1,59 +0,0 @@ -From fabbac1b93acb2ffd406e30092b0cecdfed04dd7 Mon Sep 17 00:00:00 2001 -From: Pavel Grunt -Date: Wed, 1 Jun 2016 10:04:47 +0200 -Subject: [PATCH 11/15] spice-uri: Check if port is in allowed range - -Use g_ascii_strtoll because it helps to detect overflow. - -Related: rhbz#1335239 - -Acked-by: Victor Toso -(cherry picked from commit eacbe261d48979f72585225107d00bba76623e8e) ---- - src/spice-uri.c | 8 ++++++-- - tests/uri.c | 3 +++ - 2 files changed, 9 insertions(+), 2 deletions(-) - -diff --git a/src/spice-uri.c b/src/spice-uri.c -index ce99f49..51a6d34 100644 ---- a/src/spice-uri.c -+++ b/src/spice-uri.c -@@ -141,8 +141,8 @@ gboolean spice_uri_parse(SpiceURI *self, const gchar *_uri, GError **error) - uri_port = uriv[1]; - - if (uri_port != NULL) { -- char *endptr; -- guint port = strtoul(uri_port, &endptr, 10); -+ gchar *endptr; -+ gint64 port = g_ascii_strtoll(uri_port, &endptr, 10); - if (*endptr != '\0') { - g_set_error(error, SPICE_CLIENT_ERROR, SPICE_CLIENT_ERROR_FAILED, - "Invalid uri port: %s", uri_port); -@@ -151,6 +151,10 @@ gboolean spice_uri_parse(SpiceURI *self, const gchar *_uri, GError **error) - g_set_error(error, SPICE_CLIENT_ERROR, SPICE_CLIENT_ERROR_FAILED, "Missing uri port"); - goto end; - } -+ if (port <= 0 || port > 65535) { -+ g_set_error(error, SPICE_CLIENT_ERROR, SPICE_CLIENT_ERROR_FAILED, "Port out of range"); -+ goto end; -+ } - spice_uri_set_port(self, port); - } - -diff --git a/tests/uri.c b/tests/uri.c -index ee3d061..34569ec 100644 ---- a/tests/uri.c -+++ b/tests/uri.c -@@ -76,6 +76,9 @@ static void test_spice_uri_ipv4_bad(void) - {"http://127.0.0.1:port", "http", "127.0.0.1", 3128, NULL, NULL, - "Invalid uri port: port"}, - {"http://127.0.0.1:", "http", "127.0.0.1", 3128, NULL, NULL, "Missing uri port"}, -+ {"http://127.0.0.1:-80", "http", "127.0.0.1", 3128, NULL, NULL, "Port out of range"}, -+ {"http://127.0.0.1:4294967396", "http", "127.0.0.1", 3128, NULL, NULL, "Port out of range"}, -+ {"http://127.0.0.1:12345678901234", "http", "127.0.0.1", 3128, NULL, NULL, "Port out of range"}, - }; - - test_spice_uri_bad(invalid_test_cases, G_N_ELEMENTS(invalid_test_cases)); --- -2.5.5 - diff --git a/SOURCES/0012-audio-debug-audio-codec-when-audio-stream-starts.patch b/SOURCES/0012-audio-debug-audio-codec-when-audio-stream-starts.patch new file mode 100644 index 0000000..736b013 --- /dev/null +++ b/SOURCES/0012-audio-debug-audio-codec-when-audio-stream-starts.patch @@ -0,0 +1,92 @@ +From a279657cabec5af3a0d58cb63dbd039b13fe563f Mon Sep 17 00:00:00 2001 +From: Victor Toso +Date: Tue, 28 Mar 2017 13:45:16 +0200 +Subject: [PATCH 12/13] audio: debug audio codec when audio stream starts +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +We already debug a few parameters but the audio codec is missing. + +Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1436249 +Signed-off-by: Victor Toso +Acked-by: Marc-André Lureau +(cherry picked from commit 7721d0906d55cfaa6ce8f5786829c5c738adf74c) +--- + src/channel-playback.c | 5 +++-- + src/channel-record.c | 5 +++-- + src/spice-session-priv.h | 1 + + src/spice-session.c | 13 +++++++++++++ + 4 files changed, 20 insertions(+), 4 deletions(-) + +diff --git a/src/channel-playback.c b/src/channel-playback.c +index 39c2178..ca14b96 100644 +--- a/src/channel-playback.c ++++ b/src/channel-playback.c +@@ -367,8 +367,9 @@ static void playback_handle_start(SpiceChannel *channel, SpiceMsgIn *in) + SpicePlaybackChannelPrivate *c = SPICE_PLAYBACK_CHANNEL(channel)->priv; + SpiceMsgPlaybackStart *start = spice_msg_in_parsed(in); + +- CHANNEL_DEBUG(channel, "%s: fmt %u channels %u freq %u time %u", __FUNCTION__, +- start->format, start->channels, start->frequency, start->time); ++ CHANNEL_DEBUG(channel, "%s: fmt %u channels %u freq %u time %u mode %s", __FUNCTION__, ++ start->format, start->channels, start->frequency, start->time, ++ spice_audio_data_mode_to_string(c->mode)); + + c->frame_count = 0; + c->last_time = start->time; +diff --git a/src/channel-record.c b/src/channel-record.c +index c1d9afa..9834e85 100644 +--- a/src/channel-record.c ++++ b/src/channel-record.c +@@ -405,8 +405,9 @@ static void record_handle_start(SpiceChannel *channel, SpiceMsgIn *in) + + c->mode = spice_record_desired_mode(channel, start->frequency); + +- CHANNEL_DEBUG(channel, "%s: fmt %u channels %u freq %u", __FUNCTION__, +- start->format, start->channels, start->frequency); ++ CHANNEL_DEBUG(channel, "%s: fmt %u channels %u freq %u mode %s", __FUNCTION__, ++ start->format, start->channels, start->frequency, ++ spice_audio_data_mode_to_string(c->mode)); + + g_return_if_fail(start->format == SPICE_AUDIO_FMT_S16); + +diff --git a/src/spice-session-priv.h b/src/spice-session-priv.h +index 049973a..03005aa 100644 +--- a/src/spice-session-priv.h ++++ b/src/spice-session-priv.h +@@ -99,6 +99,7 @@ guint spice_session_get_n_display_channels(SpiceSession *session); + void spice_session_set_main_channel(SpiceSession *session, SpiceChannel *channel); + gboolean spice_session_set_migration_session(SpiceSession *session, SpiceSession *mig_session); + SpiceAudio *spice_audio_get(SpiceSession *session, GMainContext *context); ++const gchar* spice_audio_data_mode_to_string(gint mode); + G_END_DECLS + + #endif /* __SPICE_CLIENT_SESSION_PRIV_H__ */ +diff --git a/src/spice-session.c b/src/spice-session.c +index 3f450d9..a972002 100644 +--- a/src/spice-session.c ++++ b/src/spice-session.c +@@ -2602,6 +2602,19 @@ void spice_session_set_shared_dir(SpiceSession *session, const gchar *dir) + s->shared_dir = g_strdup(dir); + } + ++G_GNUC_INTERNAL ++const gchar* spice_audio_data_mode_to_string(gint mode) ++{ ++ static const char *str[] = { ++ [ SPICE_AUDIO_DATA_MODE_INVALID ] = "invalid", ++ [ SPICE_AUDIO_DATA_MODE_RAW ] = "raw", ++ [ SPICE_AUDIO_DATA_MODE_CELT_0_5_1 ] = "celt", ++ [ SPICE_AUDIO_DATA_MODE_OPUS ] = "opus", ++ }; ++ return (mode >= 0 && mode < G_N_ELEMENTS(str)) ? str[mode] : "unknown audio codec"; ++} ++ ++ + /** + * spice_session_get_proxy_uri: + * @session: a #SpiceSession +-- +2.12.2 + diff --git a/SOURCES/0012-spice-uri-Validate-uri-scheme.patch b/SOURCES/0012-spice-uri-Validate-uri-scheme.patch deleted file mode 100644 index c2cc0c7..0000000 --- a/SOURCES/0012-spice-uri-Validate-uri-scheme.patch +++ /dev/null @@ -1,92 +0,0 @@ -From 0da3d2768c544cc3c1146b00b9f1481c32010c91 Mon Sep 17 00:00:00 2001 -From: Pavel Grunt -Date: Wed, 1 Jun 2016 10:04:48 +0200 -Subject: [PATCH 12/15] spice-uri: Validate uri scheme - -Related: rhbz#1335239 - -Acked-by: Victor Toso -(cherry picked from commit 8dcb4129acde2aed353cd66e28678408e7d1257c) ---- - src/spice-uri.c | 26 ++++++++++++++++---------- - tests/uri.c | 2 ++ - 2 files changed, 18 insertions(+), 10 deletions(-) - -diff --git a/src/spice-uri.c b/src/spice-uri.c -index 51a6d34..c452db3 100644 ---- a/src/spice-uri.c -+++ b/src/spice-uri.c -@@ -80,7 +80,9 @@ static void spice_uri_reset(SpiceURI *self) - G_GNUC_INTERNAL - gboolean spice_uri_parse(SpiceURI *self, const gchar *_uri, GError **error) - { -- gchar *dup, *uri; -+ gchar *dup, *uri, **uriv = NULL; -+ const gchar *uri_port = NULL; -+ char *uri_scheme = NULL; - gboolean success = FALSE; - size_t len; - -@@ -93,17 +95,21 @@ gboolean spice_uri_parse(SpiceURI *self, const gchar *_uri, GError **error) - uri = dup = g_strdup(_uri); - /* FIXME: use GUri when it is ready... only support http atm */ - /* the code is voluntarily not parsing thoroughly the uri */ -- if (g_ascii_strncasecmp("http://", uri, 7) == 0) { -- uri += 7; -+ uri_scheme = g_uri_parse_scheme(uri); -+ if (uri_scheme == NULL) { - spice_uri_set_scheme(self, "http"); -+ } else { -+ spice_uri_set_scheme(self, uri_scheme); -+ uri += strlen(uri_scheme) + 3; /* scheme + "://" */ -+ } -+ if (g_ascii_strcasecmp(spice_uri_get_scheme(self), "http") == 0) { - spice_uri_set_port(self, 3128); -- } else if (g_ascii_strncasecmp("https://", uri, 8) == 0) { -- uri += 8; -- spice_uri_set_scheme(self, "https"); -+ } else if (g_ascii_strcasecmp(spice_uri_get_scheme(self), "https") == 0) { - spice_uri_set_port(self, 3129); - } else { -- spice_uri_set_scheme(self, "http"); -- spice_uri_set_port(self, 3128); -+ g_set_error(error, SPICE_CLIENT_ERROR, SPICE_CLIENT_ERROR_FAILED, -+ "Invalid uri scheme for proxy: %s", spice_uri_get_scheme(self)); -+ goto end; - } - /* remove trailing slash */ - len = strlen(uri); -@@ -127,8 +133,7 @@ gboolean spice_uri_parse(SpiceURI *self, const gchar *_uri, GError **error) - } - - /* max 2 parts, host:port */ -- gchar **uriv = g_strsplit(uri, ":", 2); -- const gchar *uri_port = NULL; -+ uriv = g_strsplit(uri, ":", 2); - - if (uriv[0] == NULL || strlen(uriv[0]) == 0) { - g_set_error(error, SPICE_CLIENT_ERROR, SPICE_CLIENT_ERROR_FAILED, -@@ -161,6 +166,7 @@ gboolean spice_uri_parse(SpiceURI *self, const gchar *_uri, GError **error) - success = TRUE; - - end: -+ free(uri_scheme); - g_free(dup); - g_strfreev(uriv); - return success; -diff --git a/tests/uri.c b/tests/uri.c -index 34569ec..80b00f4 100644 ---- a/tests/uri.c -+++ b/tests/uri.c -@@ -79,6 +79,8 @@ static void test_spice_uri_ipv4_bad(void) - {"http://127.0.0.1:-80", "http", "127.0.0.1", 3128, NULL, NULL, "Port out of range"}, - {"http://127.0.0.1:4294967396", "http", "127.0.0.1", 3128, NULL, NULL, "Port out of range"}, - {"http://127.0.0.1:12345678901234", "http", "127.0.0.1", 3128, NULL, NULL, "Port out of range"}, -+ {"scheme://192.168.1.1:3128", "http", "127.0.0.1", 3128, NULL, NULL, -+ "Invalid uri scheme for proxy: scheme"}, - }; - - test_spice_uri_bad(invalid_test_cases, G_N_ELEMENTS(invalid_test_cases)); --- -2.5.5 - diff --git a/SOURCES/0013-file-xfer-Fix-bad-filename-encoding.patch b/SOURCES/0013-file-xfer-Fix-bad-filename-encoding.patch new file mode 100644 index 0000000..9a16096 --- /dev/null +++ b/SOURCES/0013-file-xfer-Fix-bad-filename-encoding.patch @@ -0,0 +1,69 @@ +From bfd5040f4a082441c143c128d13063d28ddc1e32 Mon Sep 17 00:00:00 2001 +From: Victor Toso +Date: Thu, 13 Apr 2017 14:32:55 +0200 +Subject: [PATCH 13/13] file-xfer: Fix bad filename encoding +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Manual for G_FILE_ATTRIBUTE_STANDARD_NAME states: + > The name is the on-disk filename which may not be in any known + > encoding, and can thus not be generally displayed as is. + +Considering a file named "ěščřžýáíé", if we use +G_FILE_ATTRIBUTE_STANDARD_NAME to get the file name, we will have the +following 72 bytes long string: +"\xc4\x9b\xc5\xa1\xc4\x8d\xc5\x99\xc5\xbe\xc3\xbd\xc3\xa1\xc3\xad\xc3\xa9" + +This is a regression introduced at 4647ac9a2a72c98b6841180ccf5f8d + +Possible solutions are: +1) Using G_FILE_ATTRIBUTE_STANDARD_DISPLAY_NAME attribute; +2) Using g_file_info_get_attribute_byte_string() function; +3) Using the g_file_get_basename() which was used before 4647ac9a2a72c9 + +Using option 2 based on better long term solution. +This give us the correct 18 bytes long utf-8 string to "ěščřžýáíé" + +Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1440206 +Signed-off-by: Victor Toso +Acked-by: Christophe Fergeau +(cherry picked from commit 5b9ad92814e3fc488cca8cba41b6af0caa390e1b) +--- + src/channel-main.c | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/src/channel-main.c b/src/channel-main.c +index 990a06a..b0878dd 100644 +--- a/src/channel-main.c ++++ b/src/channel-main.c +@@ -2822,7 +2822,8 @@ static void file_xfer_init_task_async_cb(GObject *obj, GAsyncResult *res, gpoint + GFileInfo *info; + SpiceFileTransferTask *xfer_task; + SpiceMainChannel *channel; +- gchar *string, *basename; ++ gchar *string; ++ const gchar *basename; + GKeyFile *keyfile; + VDAgentFileXferStartMessage msg; + guint64 file_size; +@@ -2837,7 +2838,7 @@ static void file_xfer_init_task_async_cb(GObject *obj, GAsyncResult *res, gpoint + goto failed; + + channel = spice_file_transfer_task_get_channel(xfer_task); +- basename = g_file_info_get_attribute_as_string(info, G_FILE_ATTRIBUTE_STANDARD_NAME); ++ basename = g_file_info_get_attribute_byte_string(info, G_FILE_ATTRIBUTE_STANDARD_NAME); + file_size = g_file_info_get_attribute_uint64(info, G_FILE_ATTRIBUTE_STANDARD_SIZE); + + xfer_op = data; +@@ -2846,7 +2847,6 @@ static void file_xfer_init_task_async_cb(GObject *obj, GAsyncResult *res, gpoint + keyfile = g_key_file_new(); + g_key_file_set_string(keyfile, "vdagent-file-xfer", "name", basename); + g_key_file_set_uint64(keyfile, "vdagent-file-xfer", "size", file_size); +- g_free(basename); + + /* Save keyfile content to memory. TODO: more file attributions + need to be sent to guest */ +-- +2.12.2 + diff --git a/SOURCES/0013-spice-uri-Add-ipv6-support.patch b/SOURCES/0013-spice-uri-Add-ipv6-support.patch deleted file mode 100644 index 382aa77..0000000 --- a/SOURCES/0013-spice-uri-Add-ipv6-support.patch +++ /dev/null @@ -1,109 +0,0 @@ -From e25a335f18c8138fd64e762d24afb512ca13583f Mon Sep 17 00:00:00 2001 -From: Pavel Grunt -Date: Wed, 1 Jun 2016 10:04:49 +0200 -Subject: [PATCH 13/15] spice-uri: Add ipv6 support - -Just basic support - http://user:password@[host]:port - -Resolves: rhbz#1335239 -(cherry picked from commit b542dfa2d58cd352dc596318a1e50f074865ef5e) ---- - src/spice-uri.c | 24 ++++++++++++++++++++---- - tests/uri.c | 33 +++++++++++++++++++++++++++++++++ - 2 files changed, 53 insertions(+), 4 deletions(-) - -diff --git a/src/spice-uri.c b/src/spice-uri.c -index c452db3..99431d0 100644 ---- a/src/spice-uri.c -+++ b/src/spice-uri.c -@@ -132,8 +132,26 @@ gboolean spice_uri_parse(SpiceURI *self, const gchar *_uri, GError **error) - uri = next; - } - -- /* max 2 parts, host:port */ -- uriv = g_strsplit(uri, ":", 2); -+ if (*uri == '[') { /* ipv6 address */ -+ uriv = g_strsplit(uri + 1, "]", 2); -+ if (uriv[1] == NULL) { -+ g_set_error(error, SPICE_CLIENT_ERROR, SPICE_CLIENT_ERROR_FAILED, -+ "Missing ']' in ipv6 uri"); -+ goto end; -+ } -+ if (*uriv[1] == ':') { -+ uri_port = uriv[1] + 1; -+ } else if (strlen(uriv[1]) > 0) { /* invalid string after the hostname */ -+ g_set_error(error, SPICE_CLIENT_ERROR, SPICE_CLIENT_ERROR_FAILED, -+ "Invalid uri address"); -+ goto end; -+ } -+ } else { -+ /* max 2 parts, host:port */ -+ uriv = g_strsplit(uri, ":", 2); -+ if (uriv[0] != NULL) -+ uri_port = uriv[1]; -+ } - - if (uriv[0] == NULL || strlen(uriv[0]) == 0) { - g_set_error(error, SPICE_CLIENT_ERROR, SPICE_CLIENT_ERROR_FAILED, -@@ -142,8 +160,6 @@ gboolean spice_uri_parse(SpiceURI *self, const gchar *_uri, GError **error) - } - - spice_uri_set_hostname(self, uriv[0]); -- if (uriv[0] != NULL) -- uri_port = uriv[1]; - - if (uri_port != NULL) { - gchar *endptr; -diff --git a/tests/uri.c b/tests/uri.c -index 80b00f4..ea8b794 100644 ---- a/tests/uri.c -+++ b/tests/uri.c -@@ -99,12 +99,45 @@ static void test_spice_uri_ipv4_good(void) - test_spice_uri_good(valid_test_cases, G_N_ELEMENTS(valid_test_cases)); - } - -+static void test_spice_uri_ipv6_bad(void) -+{ -+ const struct test_case invalid_test_cases[] = { -+ {"http://[]:80", "http", NULL, 80, NULL, NULL, "Invalid hostname in uri address"}, -+ {"http://[::1", "http", NULL, 3128, NULL, NULL, "Missing ']' in ipv6 uri"}, -+ {"http://[host]1234", "http", "host", 3128, NULL, NULL, "Invalid uri address"}, -+ {"http://[host]foo/", "http", "host", 3128, NULL, NULL, "Invalid uri address"}, -+ {"http://[::1]:port", "http", "::1", 3128, NULL, NULL, "Invalid uri port: port"}, -+ {"http://[::127.0.0.1]:", "http", "::127.0.0.1", 3128, NULL, NULL, "Missing uri port"}, -+ {"http://[::127.0.0.1]:-42", "http", "::127.0.0.1", 3128, NULL, NULL, "Port out of range"}, -+ {"[3ffe:2a00:100:7031::1]:42000000", "http", "3ffe:2a00:100:7031::1", 3128, NULL, NULL, "Port out of range"}, -+ {"scheme://[3ffe::192.168.1.1]:3128", "http", "3ffe::192.168.1.1", 3128, NULL, NULL, -+ "Invalid uri scheme for proxy: scheme"}, -+ }; -+ -+ test_spice_uri_bad(invalid_test_cases, G_N_ELEMENTS(invalid_test_cases)); -+} -+ -+static void test_spice_uri_ipv6_good(void) -+{ -+ const struct test_case valid_test_cases[] = { -+ {"http://user:password@[host]:80/", "http", "host", 80, "user", "password", NULL}, -+ {"http://user@[1080:0:0:0:8:800:200C:4171]:100", "http", "1080:0:0:0:8:800:200C:4171", 100, -+ "user", NULL, NULL}, -+ {"https://[1080::8:800:200C:417A]", "https", "1080::8:800:200C:417A", 3129, NULL, NULL, NULL}, -+ {"[3ffe:2a00:100:7031::1]", "http", "3ffe:2a00:100:7031::1", 3128, NULL, NULL, NULL}, -+ }; -+ -+ test_spice_uri_good(valid_test_cases, G_N_ELEMENTS(valid_test_cases)); -+} -+ - int main(int argc, char* argv[]) - { - g_test_init(&argc, &argv, NULL); - - g_test_add_func("/spice_uri/ipv4/bad-uri", test_spice_uri_ipv4_bad); - g_test_add_func("/spice_uri/ipv4/good-uri", test_spice_uri_ipv4_good); -+ g_test_add_func("/spice_uri/ipv6/bad-uri", test_spice_uri_ipv6_bad); -+ g_test_add_func("/spice_uri/ipv6/good-uri", test_spice_uri_ipv6_good); - - return g_test_run(); - } --- -2.5.5 - diff --git a/SOURCES/0014-Explicitly-specify-size-of-SpiceMsgSmartcardData.patch b/SOURCES/0014-Explicitly-specify-size-of-SpiceMsgSmartcardData.patch deleted file mode 100644 index 966c740..0000000 --- a/SOURCES/0014-Explicitly-specify-size-of-SpiceMsgSmartcardData.patch +++ /dev/null @@ -1,51 +0,0 @@ -From e45a8b586d19e7eb36f4fa72c2457947e5abb5de Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Fabiano=20Fid=C3=AAncio?= -Date: Tue, 7 Jun 2016 01:56:21 +0200 -Subject: [PATCH 14/15] Explicitly specify size of SpiceMsgSmartcardData - -Without this, the demarshalling code does not know we expect exactly -SpiceMsgSmartcardData::length bytes, and has to guess it from the -amount of data which was sent - -Signed-off-by: Frediano Ziglio -Acked-by: Christophe Fergeau ---- - spice-common/common/generated_client_demarshallers.c | 8 +++++++- - spice-common/common/generated_server_marshallers.c | 2 +- - 2 files changed, 8 insertions(+), 2 deletions(-) - -diff --git a/spice-common/common/generated_client_demarshallers.c b/spice-common/common/generated_client_demarshallers.c -index e1393e7..62ef234 100644 ---- a/spice-common/common/generated_client_demarshallers.c -+++ b/spice-common/common/generated_client_demarshallers.c -@@ -7854,7 +7854,13 @@ static uint8_t * parse_msg_smartcard_data(uint8_t *message_start, uint8_t *messa - SpiceMsgSmartcard *out; - - { /* data */ -- data__nelements = message_end - (start + 12); -+ uint32_t length__value; -+ pos = start + 8; -+ if (SPICE_UNLIKELY(pos + 4 > message_end)) { -+ goto error; -+ } -+ length__value = read_uint32(pos); -+ data__nelements = length__value; - - data__nw_size = data__nelements; - data__mem_size = sizeof(uint8_t) * data__nelements; -diff --git a/spice-common/common/generated_server_marshallers.c b/spice-common/common/generated_server_marshallers.c -index c00de5e..0f4978d 100644 ---- a/spice-common/common/generated_server_marshallers.c -+++ b/spice-common/common/generated_server_marshallers.c -@@ -1358,7 +1358,7 @@ void spice_marshall_msg_smartcard_data(SPICE_GNUC_UNUSED SpiceMarshaller *m, SPI - spice_marshaller_add_uint32(m, src->type); - spice_marshaller_add_uint32(m, src->reader_id); - spice_marshaller_add_uint32(m, src->length); -- /* Remaining data must be appended manually */ -+ /* Don't marshall @nomarshal data */ - } - - #endif /* USE_SMARTCARD */ --- -2.5.5 - diff --git a/SOURCES/0014-Revert-Ignore-modifiers-messages-if-no-modifiers-cha.patch b/SOURCES/0014-Revert-Ignore-modifiers-messages-if-no-modifiers-cha.patch new file mode 100644 index 0000000..ebfe275 --- /dev/null +++ b/SOURCES/0014-Revert-Ignore-modifiers-messages-if-no-modifiers-cha.patch @@ -0,0 +1,32 @@ +From fde2665c56db4e28bd0d9fbcfd28959166cdbc19 Mon Sep 17 00:00:00 2001 +From: Pavel Grunt +Date: Mon, 5 Jun 2017 15:22:27 +0200 +Subject: [PATCH spice-gtk] Revert "Ignore modifiers messages if no modifiers + changed" +To: spice-devel@lists.freedesktop.org + +This reverts commit 73cd553fb0fbd213b64d72f8b4289ed8a17fc6c0. +--- + src/channel-inputs.c | 6 ++---- + 1 file changed, 2 insertions(+), 4 deletions(-) + +diff --git a/src/channel-inputs.c b/src/channel-inputs.c +index f79bc38..7572bff 100644 +--- a/src/channel-inputs.c ++++ b/src/channel-inputs.c +@@ -242,10 +242,8 @@ static void inputs_handle_modifiers(SpiceChannel *channel, SpiceMsgIn *in) + SpiceInputsChannelPrivate *c = SPICE_INPUTS_CHANNEL(channel)->priv; + SpiceMsgInputsKeyModifiers *modifiers = spice_msg_in_parsed(in); + +- if (c->modifiers != modifiers->modifiers) { +- c->modifiers = modifiers->modifiers; +- g_coroutine_signal_emit(channel, signals[SPICE_INPUTS_MODIFIERS], 0); +- } ++ c->modifiers = modifiers->modifiers; ++ g_coroutine_signal_emit(channel, signals[SPICE_INPUTS_MODIFIERS], 0); + } + + /* coroutine context */ +-- +2.13.0 + diff --git a/SOURCES/0015-main-Don-t-delay-update_display_timer-0-for-up-to-1-.patch b/SOURCES/0015-main-Don-t-delay-update_display_timer-0-for-up-to-1-.patch deleted file mode 100644 index 51b7ce0..0000000 --- a/SOURCES/0015-main-Don-t-delay-update_display_timer-0-for-up-to-1-.patch +++ /dev/null @@ -1,70 +0,0 @@ -From 6dc79d9ffdb91784fd33c030de94b9b2c37be595 Mon Sep 17 00:00:00 2001 -From: Christophe Fergeau -Date: Wed, 25 May 2016 18:14:47 +0200 -Subject: [PATCH 15/15] main: Don't delay update_display_timer(0) for up to 1 - second - -When using remote-viewer --full-screen with a VM/client with multiple -monitors, a race can be observed during auto-configuration. First, the -client monitors config is sent to the guest: -(remote-viewer:19480): GSpice-DEBUG: channel-main.c:1166 main-1:0: sending new monitors config to guest -(remote-viewer:19480): GSpice-DEBUG: channel-main.c:1183 main-1:0: monitor #0: 1920x1080+0+0 @ 32 bpp -(remote-viewer:19480): GSpice-DEBUG: channel-main.c:1183 main-1:0: monitor #1: 1920x1080+1920+0 @ 32 bpp - -Then we receive messages from the agent which trigger a call to -update_display_timer(0) - -This should cause the current monitors state to be sent to the server -very soon after this call. However, in the racy case, this is delayed -for nearly a second, and timer_set_display() ends up being called at the -wrong time, when information about the first display channel have been -received from the server, but not the second one. - -When this happens, we inform the server that only one monitor is active, -then the server sends a MonitorsConfig message with 2 monitors (first -request we sent), and then with just 1 monitor (second request we sent). - -This causes remote-viewer to show one fullscreen black window indicating -"Connected to server" on one monitor and a working fullscreen window on -the second monitor. - -update_display_timer(0) schedules a timeout to be run with -g_timeout_add_seconds(0). However, g_timeout_add_seconds() schedules -timers with a granularity of a second, so the timeout we scheduled with -g_timeout_add_seconds() may fire up to 1 second later than when we -called it, while we really wanted it to fire as soon as possible. -Special-casing update_display_timer(0) and using g_timeout_add() in that -case avoid this issue. In theory, the race could probably still happen -with a very very bad timing, but in practice I don't think it will be -possible to trigger it after this change. - -https://bugzilla.redhat.com/show_bug.cgi?id=1323092 ---- - src/channel-main.c | 11 ++++++++++- - 1 file changed, 10 insertions(+), 1 deletion(-) - -diff --git a/src/channel-main.c b/src/channel-main.c -index 7f4d0b3..702ffa8 100644 ---- a/src/channel-main.c -+++ b/src/channel-main.c -@@ -1562,7 +1562,16 @@ static void update_display_timer(SpiceMainChannel *channel, guint seconds) - if (c->timer_id) - g_source_remove(c->timer_id); - -- c->timer_id = g_timeout_add_seconds(seconds, timer_set_display, channel); -+ if (seconds != 0) { -+ c->timer_id = g_timeout_add_seconds(seconds, timer_set_display, channel); -+ } else { -+ /* We need to special case 0, as we want the callback to fire as soon -+ * as possible. g_timeout_add_seconds(0) would set up a timer which would fire -+ * at the next second boundary, which might be nearly 1 full second later. -+ */ -+ c->timer_id = g_timeout_add(0, timer_set_display, channel); -+ } -+ - } - - /* coroutine context */ --- -2.5.5 - diff --git a/SOURCES/0016-sasl-fix-SASL-GSSAPI-by-allowing-NULL-username.patch b/SOURCES/0016-sasl-fix-SASL-GSSAPI-by-allowing-NULL-username.patch deleted file mode 100644 index 865f0c3..0000000 --- a/SOURCES/0016-sasl-fix-SASL-GSSAPI-by-allowing-NULL-username.patch +++ /dev/null @@ -1,43 +0,0 @@ -From e65dbb732d4f110dd6b55b510a754cffe0472b10 Mon Sep 17 00:00:00 2001 -From: Alexander Bokovoy -Date: Mon, 6 Jun 2016 18:04:59 +0200 -Subject: [PATCH 16/17] sasl: fix SASL GSSAPI by allowing NULL username -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -SASL GSSAPI module will try to negotiate authentication based on the -credentials in the default credentials cache. It does not matter if -SPICE knows username or not as SASL negotiation will pass through the -discovered name from the GSSAPI module. - -Signed-off-by: Alexander Bokovoy -Acked-by: Fabiano Fidêncio -(cherry picked from commit fb8e51667b9fa63497e413fb4fd484d23b772788) ---- - src/spice-channel.c | 9 ++++----- - 1 file changed, 4 insertions(+), 5 deletions(-) - -diff --git a/src/spice-channel.c b/src/spice-channel.c -index e52a6a9..fdc0e97 100644 ---- a/src/spice-channel.c -+++ b/src/spice-channel.c -@@ -1389,11 +1389,10 @@ spice_channel_gather_sasl_credentials(SpiceChannel *channel, - switch (interact[ninteract].id) { - case SASL_CB_AUTHNAME: - case SASL_CB_USER: -- if (spice_session_get_username(c->session) == NULL) -- return FALSE; -- -- interact[ninteract].result = spice_session_get_username(c->session); -- interact[ninteract].len = strlen(interact[ninteract].result); -+ if (spice_session_get_username(c->session) != NULL) { -+ interact[ninteract].result = spice_session_get_username(c->session); -+ interact[ninteract].len = strlen(interact[ninteract].result); -+ } - break; - - case SASL_CB_PASS: --- -2.9.0 - diff --git a/SOURCES/0017-session-Keep-brackets-around-ipv6-hostname.patch b/SOURCES/0017-session-Keep-brackets-around-ipv6-hostname.patch deleted file mode 100644 index cf20949..0000000 --- a/SOURCES/0017-session-Keep-brackets-around-ipv6-hostname.patch +++ /dev/null @@ -1,36 +0,0 @@ -From c5c4b2f5535977b0aec7567cfb016a5419d65873 Mon Sep 17 00:00:00 2001 -From: Pavel Grunt -Date: Tue, 21 Jun 2016 15:13:31 +0200 -Subject: [PATCH 17/17] session: Keep brackets around ipv6 hostname -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -According to rfc2732: -"To use a literal IPv6 address in a URL, the literal address should be -enclosed in "[" and "]" characters." - -Resolves: rhbz#1331777 - -Acked-by: Marc-André Lureau -(cherry picked from commit ea37f06eaa11b6307c797895aeb85d87d142625a) ---- - src/spice-session.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/src/spice-session.c b/src/spice-session.c -index f77487a..cc4b614 100644 ---- a/src/spice-session.c -+++ b/src/spice-session.c -@@ -479,7 +479,7 @@ static int spice_parse_uri(SpiceSession *session, const char *original_uri) - } - tmp[0] = '\0'; - tmp++; -- host = g_strdup(authority + 1); -+ host = g_strdup_printf("[%s]", authority + 1); - if (tmp[0] == ':') - port = g_strdup(tmp + 1); - } else { --- -2.9.0 - diff --git a/SOURCES/0018-session-Fix-IPv6-by-using-g_network_address_parse.patch b/SOURCES/0018-session-Fix-IPv6-by-using-g_network_address_parse.patch deleted file mode 100644 index af72a0f..0000000 --- a/SOURCES/0018-session-Fix-IPv6-by-using-g_network_address_parse.patch +++ /dev/null @@ -1,32 +0,0 @@ -From 482156c8fce4dce3ce9e098d808c515fa9ea2d87 Mon Sep 17 00:00:00 2001 -From: Pavel Grunt -Date: Fri, 29 Jul 2016 14:16:03 +0200 -Subject: [PATCH 18/19] session: Fix IPv6 by using g_network_address_parse - -It supports quoting the address with [] - -Regression since ea37f06eaa11b6307c797895aeb85d87d142625a - -Fixes: -https://bugzilla.redhat.com/show_bug.cgi?id=1361478 -(cherry picked from commit 5a301b201be77c0ece71640ba99e92733a93f950) ---- - src/spice-session.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/src/spice-session.c b/src/spice-session.c -index cc4b614..860461f 100644 ---- a/src/spice-session.c -+++ b/src/spice-session.c -@@ -2125,7 +2125,7 @@ static gboolean open_host_idle_cb(gpointer data) - #endif - } else { - SPICE_DEBUG("open host %s:%d", s->host, open_host->port); -- address = g_network_address_new(s->host, open_host->port); -+ address = g_network_address_parse(s->host, open_host->port, &open_host->error); - } - - if (address == NULL || open_host->error != NULL) { --- -2.9.2 - diff --git a/SOURCES/0019-channel-check-if-channel-has-a-session.patch b/SOURCES/0019-channel-check-if-channel-has-a-session.patch deleted file mode 100644 index f534946..0000000 --- a/SOURCES/0019-channel-check-if-channel-has-a-session.patch +++ /dev/null @@ -1,38 +0,0 @@ -From 0cb2f7634a5ddaefc115181ba76702378007b5c4 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= -Date: Fri, 20 May 2016 15:45:43 +0200 -Subject: [PATCH 19/19] channel: check if channel has a session -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Since 8943d2329, the channel may be disconnected from the session -before it's destroyed. In this case, session is NULL. - -Fixes some critical with virt-manager when closing a display: - -(virt-manager:20451): GSpice-CRITICAL **: spice_session_is_for_migration: assertion 'SPICE_IS_SESSION(session)' failed - -Signed-off-by: Marc-André Lureau -Acked-by: Pavel Grunt -(cherry picked from commit 73564cc1007a7c14e6c79dec67e99458de359898) ---- - src/spice-channel.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/src/spice-channel.c b/src/spice-channel.c -index fdc0e97..0d9e85a 100644 ---- a/src/spice-channel.c -+++ b/src/spice-channel.c -@@ -2314,7 +2314,7 @@ static gboolean spice_channel_delayed_unref(gpointer data) - c->state = SPICE_CHANNEL_STATE_UNCONNECTED; - - session = spice_channel_get_session(channel); -- if (spice_session_is_for_migration(session)) { -+ if (session && spice_session_is_for_migration(session)) { - /* error during migration - abort migration */ - spice_session_abort_migration(session); - return FALSE; --- -2.9.2 - diff --git a/SOURCES/0020-clipboard-Add-fixup_clipboard_text-helper.patch b/SOURCES/0020-clipboard-Add-fixup_clipboard_text-helper.patch deleted file mode 100644 index 7b551b1..0000000 --- a/SOURCES/0020-clipboard-Add-fixup_clipboard_text-helper.patch +++ /dev/null @@ -1,103 +0,0 @@ -From a11888af13a4cfab5ded7dec47dfb904dfb65fcb Mon Sep 17 00:00:00 2001 -From: Christophe Fergeau -Date: Wed, 10 Aug 2016 11:17:35 +0200 -Subject: [PATCH 20/23] clipboard: Add fixup_clipboard_text helper - -This makes clipboard_received_cb a bit shorter, and will be useful -in the next commit. - -(cherry picked from commit b0a2ff4f205e39f87e9b54d658a27d415ee3d055) ---- - src/spice-gtk-session.c | 69 +++++++++++++++++++++++++++++++------------------ - 1 file changed, 44 insertions(+), 25 deletions(-) - -diff --git a/src/spice-gtk-session.c b/src/spice-gtk-session.c -index 4201ee0..6b1bcf6 100644 ---- a/src/spice-gtk-session.c -+++ b/src/spice-gtk-session.c -@@ -883,6 +883,49 @@ static gboolean check_clipboard_size_limits(SpiceGtkSession *session, - return TRUE; - } - -+/* This will convert line endings if needed (between Windows/Unix conventions), -+ * and will make sure 'len' does not take into account any trailing \0 as this could -+ * cause some confusion guest side. -+ * The 'len' argument will be modified by this function to the length of the modified -+ * string -+ */ -+static char *fixup_clipboard_text(SpiceGtkSession *self, const char *text, int *len) -+{ -+ char *conv = NULL; -+ int new_len = *len; -+ -+ -+ if (spice_main_agent_test_capability(self->priv->main, VD_AGENT_CAP_GUEST_LINEEND_CRLF)) { -+ GError *err = NULL; -+ -+ conv = spice_unix2dos(text, *len, &err); -+ if (err) { -+ g_warning("Failed to convert text line ending: %s", err->message); -+ g_clear_error(&err); -+ return NULL; -+ } -+ -+ new_len = strlen(conv); -+ } else { -+ /* On Windows, with some versions of gtk+, GtkSelectionData::length -+ * will include the final '\0'. When a string with this trailing '\0' -+ * is pasted in some linux applications, it will be pasted as or -+ * as an invisible character, which is unwanted. Ensure the length we -+ * send to the agent does not include any trailing '\0' -+ * This is gtk+ bug https://bugzilla.gnome.org/show_bug.cgi?id=734670 -+ */ -+ new_len = strlen(text); -+ } -+ -+ if (!check_clipboard_size_limits(self, new_len)) { -+ g_free(conv); -+ return NULL; -+ } -+ -+ *len = new_len; -+ return conv; -+} -+ - static void clipboard_received_cb(GtkClipboard *clipboard, - GtkSelectionData *selection_data, - gpointer user_data) -@@ -932,31 +975,7 @@ static void clipboard_received_cb(GtkClipboard *clipboard, - - /* gtk+ internal utf8 newline is always LF, even on windows */ - if (type == VD_AGENT_CLIPBOARD_UTF8_TEXT) { -- if (spice_main_agent_test_capability(s->main, VD_AGENT_CAP_GUEST_LINEEND_CRLF)) { -- GError *err = NULL; -- -- conv = spice_unix2dos((gchar*)data, len, &err); -- if (err) { -- g_warning("Failed to convert text line ending: %s", err->message); -- g_clear_error(&err); -- return; -- } -- -- len = strlen(conv); -- } else { -- /* On Windows, with some versions of gtk+, GtkSelectionData::length -- * will include the final '\0'. When a string with this trailing '\0' -- * is pasted in some linux applications, it will be pasted as or -- * as an invisible character, which is unwanted. Ensure the length we -- * send to the agent does not include any trailing '\0' -- * This is gtk+ bug https://bugzilla.gnome.org/show_bug.cgi?id=734670 -- */ -- len = strlen((const char *)data); -- } -- if (!check_clipboard_size_limits(self, len)) { -- g_free(conv); -- return; -- } -+ conv = fixup_clipboard_text(self, (gchar *)data, &len); - } - - spice_main_clipboard_selection_notify(s->main, selection, type, --- -2.10.0 - diff --git a/SOURCES/0021-clipboard-Use-gtk_clipboard_request_text-for-text-da.patch b/SOURCES/0021-clipboard-Use-gtk_clipboard_request_text-for-text-da.patch deleted file mode 100644 index 5e0d1d5..0000000 --- a/SOURCES/0021-clipboard-Use-gtk_clipboard_request_text-for-text-da.patch +++ /dev/null @@ -1,125 +0,0 @@ -From 9b575d2eefbbbc5a308648f99fcc0be5e1f03d87 Mon Sep 17 00:00:00 2001 -From: Christophe Fergeau -Date: Wed, 10 Aug 2016 12:04:30 +0200 -Subject: [PATCH 21/23] clipboard: Use gtk_clipboard_request_text for text data - -Currently, when the agent asks us for VD_AGENT_CLIPBOARD_UTF8_TEXT data, -spice-gtk looks up for the first X11 target which would provide it with -UTF8_TEXT data, and uses that for the clipboard request. This means we -will use UTF8_STRING as the target for gtk_clipboard_request_contents(). - -However, some applications who can copy and paste text do not -necessarily support the UTF8_STRING target. This is the case for Motif -applications which support the STRING target however. It turns out gtk+ -also provides a gtk_clipboard_request_text() method which will try -several targets (UTF8_TEXT, COMPOUND_TEXT, TEXT), and will ensure the -returned string is UTF-8, so we can use that when the agent asks us for -some text data. - -This fixes https://bugzilla.redhat.com/show_bug.cgi?id=1348624 - -(cherry picked from commit 7b0de6217670e0f668aff2949fba174ed3cc0b50) ---- - src/spice-gtk-session.c | 67 ++++++++++++++++++++++++++++++++++++++----------- - 1 file changed, 52 insertions(+), 15 deletions(-) - -diff --git a/src/spice-gtk-session.c b/src/spice-gtk-session.c -index 6b1bcf6..3ab1465 100644 ---- a/src/spice-gtk-session.c -+++ b/src/spice-gtk-session.c -@@ -926,6 +926,40 @@ static char *fixup_clipboard_text(SpiceGtkSession *self, const char *text, int * - return conv; - } - -+static void clipboard_received_text_cb(GtkClipboard *clipboard, -+ const gchar *text, -+ gpointer user_data) -+{ -+ WeakRef *weakref = user_data; -+ SpiceGtkSession *self = (SpiceGtkSession*)weakref->object; -+ char *conv = NULL; -+ int len = 0; -+ int selection; -+ -+ weak_unref(weakref); -+ -+ if (self == NULL) -+ return; -+ -+ g_return_if_fail(SPICE_IS_GTK_SESSION(self)); -+ -+ selection = get_selection_from_clipboard(self->priv, clipboard); -+ g_return_if_fail(selection != -1); -+ -+ len = strlen(text); -+ if (!check_clipboard_size_limits(self, len)) { -+ return; -+ } -+ -+ /* gtk+ internal utf8 newline is always LF, even on windows */ -+ conv = fixup_clipboard_text(self, text, &len); -+ -+ spice_main_clipboard_selection_notify(self->priv->main, selection, -+ VD_AGENT_CLIPBOARD_UTF8_TEXT, -+ (guchar *)(conv ?: text), len); -+ g_free(conv); -+} -+ - static void clipboard_received_cb(GtkClipboard *clipboard, - GtkSelectionData *selection_data, - gpointer user_data) -@@ -971,16 +1005,14 @@ static void clipboard_received_cb(GtkClipboard *clipboard, - } - - const guchar *data = gtk_selection_data_get_data(selection_data); -- gpointer conv = NULL; - -- /* gtk+ internal utf8 newline is always LF, even on windows */ -- if (type == VD_AGENT_CLIPBOARD_UTF8_TEXT) { -- conv = fixup_clipboard_text(self, (gchar *)data, &len); -- } -+ /* text should be handled through clipboard_received_text_cb(), not -+ * clipboard_received_cb(). -+ */ -+ g_warn_if_fail(type != VD_AGENT_CLIPBOARD_UTF8_TEXT); - - spice_main_clipboard_selection_notify(s->main, selection, type, -- conv ?: data, len); -- g_free(conv); -+ data, len); - } - - static gboolean clipboard_request(SpiceMainChannel *main, guint selection, -@@ -1003,16 +1035,21 @@ static gboolean clipboard_request(SpiceMainChannel *main, guint selection, - cb = get_clipboard_from_selection(s, selection); - g_return_val_if_fail(cb != NULL, FALSE); - -- for (m = 0; m < SPICE_N_ELEMENTS(atom2agent); m++) { -- if (atom2agent[m].vdagent == type) -- break; -- } -+ if (type == VD_AGENT_CLIPBOARD_UTF8_TEXT) { -+ gtk_clipboard_request_text(cb, clipboard_received_text_cb, -+ weak_ref(G_OBJECT(self))); -+ } else { -+ for (m = 0; m < SPICE_N_ELEMENTS(atom2agent); m++) { -+ if (atom2agent[m].vdagent == type) -+ break; -+ } - -- g_return_val_if_fail(m < SPICE_N_ELEMENTS(atom2agent), FALSE); -+ g_return_val_if_fail(m < SPICE_N_ELEMENTS(atom2agent), FALSE); - -- atom = gdk_atom_intern_static_string(atom2agent[m].xatom); -- gtk_clipboard_request_contents(cb, atom, clipboard_received_cb, -- weak_ref(G_OBJECT(self))); -+ atom = gdk_atom_intern_static_string(atom2agent[m].xatom); -+ gtk_clipboard_request_contents(cb, atom, clipboard_received_cb, -+ weak_ref(G_OBJECT(self))); -+ } - - return TRUE; - } --- -2.10.0 - diff --git a/SOURCES/0022-util-Remove-unused-GError-parameter.patch b/SOURCES/0022-util-Remove-unused-GError-parameter.patch deleted file mode 100644 index f36029b..0000000 --- a/SOURCES/0022-util-Remove-unused-GError-parameter.patch +++ /dev/null @@ -1,228 +0,0 @@ -From f3092d6d61b7095517960faa967bd4c0c2ab4cb8 Mon Sep 17 00:00:00 2001 -From: Pavel Grunt -Date: Fri, 2 Sep 2016 11:24:43 +0200 -Subject: [PATCH 22/23] util: Remove unused GError parameter -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -The parameter is removed from functions: - get_line - spice_convert_newlines - spice_unix2dos - spice_dos2unix - -It was introduced in 75f1ea3ee9c4dbd6c5f27896caee07792bbdbba4 -but never used - -Acked-by: Marc-André Lureau -Acked-by: Christophe Fergeau -(cherry picked from commit b708989b12122af39144b856576c2dd234130b9c) ---- - src/spice-gtk-session.c | 22 ++-------------------- - src/spice-util-priv.h | 4 ++-- - src/spice-util.c | 28 ++++++++-------------------- - tests/util.c | 14 ++++---------- - 4 files changed, 16 insertions(+), 52 deletions(-) - -diff --git a/src/spice-gtk-session.c b/src/spice-gtk-session.c -index 3ab1465..5ebc7c2 100644 ---- a/src/spice-gtk-session.c -+++ b/src/spice-gtk-session.c -@@ -708,15 +708,7 @@ static void clipboard_got_from_guest(SpiceMainChannel *main, guint selection, - /* on windows, gtk+ would already convert to LF endings, but - not on unix */ - if (spice_main_agent_test_capability(s->main, VD_AGENT_CAP_GUEST_LINEEND_CRLF)) { -- GError *err = NULL; -- -- conv = spice_dos2unix((gchar*)data, size, &err); -- if (err) { -- g_warning("Failed to convert text line ending: %s", err->message); -- g_clear_error(&err); -- goto end; -- } -- -+ conv = spice_dos2unix((gchar*)data, size); - size = strlen(conv); - } - -@@ -727,7 +719,6 @@ static void clipboard_got_from_guest(SpiceMainChannel *main, guint selection, - 8, data, size); - } - --end: - if (g_main_loop_is_running (ri->loop)) - g_main_loop_quit (ri->loop); - -@@ -894,17 +885,8 @@ static char *fixup_clipboard_text(SpiceGtkSession *self, const char *text, int * - char *conv = NULL; - int new_len = *len; - -- - if (spice_main_agent_test_capability(self->priv->main, VD_AGENT_CAP_GUEST_LINEEND_CRLF)) { -- GError *err = NULL; -- -- conv = spice_unix2dos(text, *len, &err); -- if (err) { -- g_warning("Failed to convert text line ending: %s", err->message); -- g_clear_error(&err); -- return NULL; -- } -- -+ conv = spice_unix2dos(text, *len); - new_len = strlen(conv); - } else { - /* On Windows, with some versions of gtk+, GtkSelectionData::length -diff --git a/src/spice-util-priv.h b/src/spice-util-priv.h -index c0ea8d9..10a3d48 100644 ---- a/src/spice-util-priv.h -+++ b/src/spice-util-priv.h -@@ -28,8 +28,8 @@ G_BEGIN_DECLS - gboolean spice_strv_contains(const GStrv strv, const gchar *str); - const gchar* spice_yes_no(gboolean value); - guint16 spice_make_scancode(guint scancode, gboolean release); --gchar* spice_unix2dos(const gchar *str, gssize len, GError **error); --gchar* spice_dos2unix(const gchar *str, gssize len, GError **error); -+gchar* spice_unix2dos(const gchar *str, gssize len); -+gchar* spice_dos2unix(const gchar *str, gssize len); - void spice_mono_edge_highlight(unsigned width, unsigned hight, - const guint8 *and, const guint8 *xor, guint8 *dest); - -diff --git a/src/spice-util.c b/src/spice-util.c -index fd97ee7..2b9cb2f 100644 ---- a/src/spice-util.c -+++ b/src/spice-util.c -@@ -292,8 +292,7 @@ typedef enum { - } NewlineType; - - static gssize get_line(const gchar *str, gsize len, -- NewlineType type, gsize *nl_len, -- GError **error) -+ NewlineType type, gsize *nl_len) - { - const gchar *p, *endl; - gsize nl = 0; -@@ -312,19 +311,15 @@ static gssize get_line(const gchar *str, gsize len, - - static gchar* spice_convert_newlines(const gchar *str, gssize len, - NewlineType from, -- NewlineType to, -- GError **error) -+ NewlineType to) - { -- GError *err = NULL; - gssize length; - gsize nl; - GString *output; -- gboolean free_segment = FALSE; - gint i; - - g_return_val_if_fail(str != NULL, NULL); - g_return_val_if_fail(len >= -1, NULL); -- g_return_val_if_fail(error == NULL || *error == NULL, NULL); - /* only 2 supported combinations */ - g_return_val_if_fail((from == NEWLINE_TYPE_LF && - to == NEWLINE_TYPE_CR_LF) || -@@ -345,7 +340,7 @@ static gchar* spice_convert_newlines(const gchar *str, gssize len, - output = g_string_sized_new(len * 2 + 1); - - for (i = 0; i < len; i += length + nl) { -- length = get_line(str + i, len - i, from, &nl, &err); -+ length = get_line(str + i, len - i, from, &nl); - if (length < 0) - break; - -@@ -361,30 +356,23 @@ static gchar* spice_convert_newlines(const gchar *str, gssize len, - } - } - -- if (err) { -- g_propagate_error(error, err); -- free_segment = TRUE; -- } -- -- return g_string_free(output, free_segment); -+ return g_string_free(output, FALSE); - } - - G_GNUC_INTERNAL --gchar* spice_dos2unix(const gchar *str, gssize len, GError **error) -+gchar* spice_dos2unix(const gchar *str, gssize len) - { - return spice_convert_newlines(str, len, - NEWLINE_TYPE_CR_LF, -- NEWLINE_TYPE_LF, -- error); -+ NEWLINE_TYPE_LF); - } - - G_GNUC_INTERNAL --gchar* spice_unix2dos(const gchar *str, gssize len, GError **error) -+gchar* spice_unix2dos(const gchar *str, gssize len) - { - return spice_convert_newlines(str, len, - NEWLINE_TYPE_LF, -- NEWLINE_TYPE_CR_LF, -- error); -+ NEWLINE_TYPE_CR_LF); - } - - static bool buf_is_ones(unsigned size, const guint8 *data) -diff --git a/tests/util.c b/tests/util.c -index b9b9535..14862a5 100644 ---- a/tests/util.c -+++ b/tests/util.c -@@ -34,7 +34,6 @@ static const struct { - - static void test_dos2unix(void) - { -- GError *err = NULL; - gchar *tmp; - unsigned int i; - -@@ -42,22 +41,19 @@ static void test_dos2unix(void) - if (!(dosunix[i].flags & DOS2UNIX)) - continue; - -- tmp = spice_dos2unix(dosunix[i].d, -1, &err); -+ tmp = spice_dos2unix(dosunix[i].d, -1); - g_assert_cmpstr(tmp, ==, dosunix[i].u); -- g_assert_no_error(err); - g_free(tmp); - - /* including ending \0 */ -- tmp = spice_dos2unix(dosunix[i].d, strlen(dosunix[i].d) + 1, &err); -+ tmp = spice_dos2unix(dosunix[i].d, strlen(dosunix[i].d) + 1); - g_assert_cmpstr(tmp, ==, dosunix[i].u); -- g_assert_no_error(err); - g_free(tmp); - } - } - - static void test_unix2dos(void) - { -- GError *err = NULL; - gchar *tmp; - unsigned int i; - -@@ -65,15 +61,13 @@ static void test_unix2dos(void) - if (!(dosunix[i].flags & UNIX2DOS)) - continue; - -- tmp = spice_unix2dos(dosunix[i].u, -1, &err); -+ tmp = spice_unix2dos(dosunix[i].u, -1); - g_assert_cmpstr(tmp, ==, dosunix[i].d); -- g_assert_no_error(err); - g_free(tmp); - - /* including ending \0 */ -- tmp = spice_unix2dos(dosunix[i].u, strlen(dosunix[i].u) + 1, &err); -+ tmp = spice_unix2dos(dosunix[i].u, strlen(dosunix[i].u) + 1); - g_assert_cmpstr(tmp, ==, dosunix[i].d); -- g_assert_no_error(err); - g_free(tmp); - } - } --- -2.10.0 - diff --git a/SOURCES/0023-clipboard-Return-early-if-check_clipboard_size_limit.patch b/SOURCES/0023-clipboard-Return-early-if-check_clipboard_size_limit.patch deleted file mode 100644 index 6cd126b..0000000 --- a/SOURCES/0023-clipboard-Return-early-if-check_clipboard_size_limit.patch +++ /dev/null @@ -1,47 +0,0 @@ -From 601c9212631f682580d8e90e1c6dcd2850adcc3b Mon Sep 17 00:00:00 2001 -From: Pavel Grunt -Date: Fri, 2 Sep 2016 14:03:26 +0200 -Subject: [PATCH 23/23] clipboard: Return early if - check_clipboard_size_limits() fails - -b0a2ff4 "clipboard: Add fixup_clipboard_text helper" -mistakenly removed some early returns when text conversion fails for -some reason. This commit readds it. - -Signed-off-by: Christophe Fergeau -Signed-off-by: Pavel Grunt -(cherry picked from commit 24fe1387f966193c60d5f2c72a0f551b7ed593f1) ---- - src/spice-gtk-session.c | 9 ++++----- - 1 file changed, 4 insertions(+), 5 deletions(-) - -diff --git a/src/spice-gtk-session.c b/src/spice-gtk-session.c -index 5ebc7c2..f04d5e8 100644 ---- a/src/spice-gtk-session.c -+++ b/src/spice-gtk-session.c -@@ -899,11 +899,6 @@ static char *fixup_clipboard_text(SpiceGtkSession *self, const char *text, int * - new_len = strlen(text); - } - -- if (!check_clipboard_size_limits(self, new_len)) { -- g_free(conv); -- return NULL; -- } -- - *len = new_len; - return conv; - } -@@ -935,6 +930,10 @@ static void clipboard_received_text_cb(GtkClipboard *clipboard, - - /* gtk+ internal utf8 newline is always LF, even on windows */ - conv = fixup_clipboard_text(self, text, &len); -+ if (!check_clipboard_size_limits(self, len)) { -+ g_free(conv); -+ return; -+ } - - spice_main_clipboard_selection_notify(self->priv->main, selection, - VD_AGENT_CLIPBOARD_UTF8_TEXT, --- -2.10.0 - diff --git a/SOURCES/0024-clipboard-Fix-crash-by-handling-error.patch b/SOURCES/0024-clipboard-Fix-crash-by-handling-error.patch deleted file mode 100644 index f5cac1b..0000000 --- a/SOURCES/0024-clipboard-Fix-crash-by-handling-error.patch +++ /dev/null @@ -1,41 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Victor Toso -Date: Fri, 14 Oct 2016 18:12:01 +0200 -Subject: [PATCH] clipboard: Fix crash by handling error - -As manual states below, text could be NULL for different reasons and -we should handle that. I've included a debug message to help -identifying possible regressions from wayland's clipboard. - -This crash is a regression from 7b0de6217670e0f668aff2949f - - "The text parameter to callback will contain the resulting text if - the request succeeded, or NULL if it failed. This could happen for - various reasons, in particular if the clipboard was empty or if the - contents of the clipboard could not be converted into text form." - -Resolves: rhbz#1384676 - -Signed-off-by: Victor Toso -Acked-by: Pavel Grunt -(cherry picked from commit 03c016bea939ee4a26e90d80fa1012a993a8ea47) ---- - src/spice-gtk-session.c | 5 +++++ - 1 file changed, 5 insertions(+) - -diff --git a/src/spice-gtk-session.c b/src/spice-gtk-session.c -index f04d5e8..2da9bc0 100644 ---- a/src/spice-gtk-session.c -+++ b/src/spice-gtk-session.c -@@ -918,6 +918,11 @@ static void clipboard_received_text_cb(GtkClipboard *clipboard, - if (self == NULL) - return; - -+ if (text == NULL) { -+ SPICE_DEBUG("Failed to retrieve clipboard text"); -+ return; -+ } -+ - g_return_if_fail(SPICE_IS_GTK_SESSION(self)); - - selection = get_selection_from_clipboard(self->priv, clipboard); diff --git a/SOURCES/1000-gtk-Makefile.am-add-PIE-flags-to-libspice-client-gli.patch b/SOURCES/1000-gtk-Makefile.am-add-PIE-flags-to-libspice-client-gli.patch index 58ba391..1686db8 100644 --- a/SOURCES/1000-gtk-Makefile.am-add-PIE-flags-to-libspice-client-gli.patch +++ b/SOURCES/1000-gtk-Makefile.am-add-PIE-flags-to-libspice-client-gli.patch @@ -1,19 +1,40 @@ -From 7face0b98d7d6560fdb6b55427ef78a57b6c610e Mon Sep 17 00:00:00 2001 +From 9788af437a99cb2600aeae6e313a43efb2ceb466 Mon Sep 17 00:00:00 2001 From: Alon Levy Date: Wed, 6 May 2015 09:04:02 -0400 Subject: [PATCH] gtk/Makefile.am: add PIE flags to libspice-client-glib +Also to gtk and controller lib + +Signed-off-by: Pavel Grunt --- - src/Makefile.am | 5 +++++ - src/Makefile.in | 5 +++++ - 2 files changed, 10 insertions(+) + src/Makefile.am | 7 +++++++ + src/Makefile.in | 7 +++++++ + src/controller/Makefile.am | 2 ++ + src/controller/Makefile.in | 2 ++ + 4 files changed, 18 insertions(+) diff --git a/src/Makefile.am b/src/Makefile.am -index 7bc5842..f2256cc 100644 +index 78953dd..688a7e8 100644 --- a/src/Makefile.am +++ b/src/Makefile.am -@@ -189,6 +189,11 @@ libspice_client_glib_2_0_la_LDFLAGS = \ - -version-info 13:0:5 \ +@@ -115,6 +115,7 @@ SPICE_GTK_LDFLAGS_COMMON = \ + -version-info 5:0:0 \ + -no-undefined \ + $(GTK_SYMBOLS_LDFLAGS) \ ++ $(PIE_LDFLAGS) \ + $(NULL) + + SPICE_GTK_LIBADD_COMMON = \ +@@ -161,6 +162,7 @@ endif + if WITH_GTK + EXTRA_libspice_client_gtk_3_0_la_DEPENDENCIES = $(GTK_SYMBOLS_FILE) + libspice_client_gtk_3_0_la_LDFLAGS = $(SPICE_GTK_LDFLAGS_COMMON) ++libspice_client_gtk_3_0_la_CPPFLAGS = $(PIE_CFLAGS) + libspice_client_gtk_3_0_la_LIBADD = $(SPICE_GTK_LIBADD_COMMON) + libspice_client_gtk_3_0_la_SOURCES = $(SPICE_GTK_SOURCES_COMMON) + nodist_libspice_client_gtk_3_0_la_SOURCES = $(nodist_SPICE_GTK_SOURCES_COMMON) +@@ -185,6 +187,11 @@ libspice_client_glib_2_0_la_LDFLAGS = \ + -version-info 14:0:6 \ -no-undefined \ $(GLIB_SYMBOLS_LDFLAGS) \ + $(PIE_LDFLAGS) \ @@ -25,11 +46,27 @@ index 7bc5842..f2256cc 100644 libspice_client_glib_2_0_la_LIBADD = \ diff --git a/src/Makefile.in b/src/Makefile.in -index 9686995..ef8bcc5 100644 +index 2ea0804..a5e3a37 100644 --- a/src/Makefile.in +++ b/src/Makefile.in -@@ -848,6 +848,11 @@ libspice_client_glib_2_0_la_LDFLAGS = \ - -version-info 13:0:5 \ +@@ -790,6 +790,7 @@ SPICE_GTK_LDFLAGS_COMMON = \ + -version-info 5:0:0 \ + -no-undefined \ + $(GTK_SYMBOLS_LDFLAGS) \ ++ $(PIE_LDFLAGS) \ + $(NULL) + + SPICE_GTK_LIBADD_COMMON = \ +@@ -815,6 +816,7 @@ nodist_SPICE_GTK_SOURCES_COMMON = \ + + @WITH_GTK_TRUE@EXTRA_libspice_client_gtk_3_0_la_DEPENDENCIES = $(GTK_SYMBOLS_FILE) + @WITH_GTK_TRUE@libspice_client_gtk_3_0_la_LDFLAGS = $(SPICE_GTK_LDFLAGS_COMMON) ++@WITH_GTK_TRUE@libspice_client_gtk_3_0_la_CPPFLAGS = $(PIE_CFLAGS) + @WITH_GTK_TRUE@libspice_client_gtk_3_0_la_LIBADD = $(SPICE_GTK_LIBADD_COMMON) + @WITH_GTK_TRUE@libspice_client_gtk_3_0_la_SOURCES = $(SPICE_GTK_SOURCES_COMMON) + @WITH_GTK_TRUE@nodist_libspice_client_gtk_3_0_la_SOURCES = $(nodist_SPICE_GTK_SOURCES_COMMON) +@@ -836,6 +838,11 @@ libspice_client_glib_2_0_la_LDFLAGS = \ + -version-info 14:0:6 \ -no-undefined \ $(GLIB_SYMBOLS_LDFLAGS) \ + $(PIE_LDFLAGS) \ @@ -40,6 +77,46 @@ index 9686995..ef8bcc5 100644 $(NULL) libspice_client_glib_2_0_la_LIBADD = \ +diff --git a/src/controller/Makefile.am b/src/controller/Makefile.am +index fb56986..71dd2bd 100644 +--- a/src/controller/Makefile.am ++++ b/src/controller/Makefile.am +@@ -4,6 +4,7 @@ AM_CPPFLAGS = \ + -DG_LOG_DOMAIN=\"GSpiceController\" \ + $(GIO_CFLAGS) \ + $(COMMON_CFLAGS) \ ++ $(PIE_CFLAGS) \ + -Wno-deprecated-declarations \ + $(NULL) + +@@ -11,6 +12,7 @@ AM_CPPFLAGS = \ + AM_LDFLAGS = \ + -no-undefined \ + $(GIO_LIBS) \ ++ $(PIE_LDFLAGS) \ + $(NULL) + + AM_VALAFLAGS = \ +diff --git a/src/controller/Makefile.in b/src/controller/Makefile.in +index 03e67a4..32c1d44 100644 +--- a/src/controller/Makefile.in ++++ b/src/controller/Makefile.in +@@ -495,6 +495,7 @@ AM_CPPFLAGS = \ + -DG_LOG_DOMAIN=\"GSpiceController\" \ + $(GIO_CFLAGS) \ + $(COMMON_CFLAGS) \ ++ $(PIE_CFLAGS) \ + -Wno-deprecated-declarations \ + $(NULL) + +@@ -503,6 +504,7 @@ AM_CPPFLAGS = \ + AM_LDFLAGS = \ + -no-undefined \ + $(GIO_LIBS) \ ++ $(PIE_LDFLAGS) \ + $(NULL) + + AM_VALAFLAGS = \ -- -1.8.3.1 +2.13.0 diff --git a/SPECS/spice-gtk.spec b/SPECS/spice-gtk.spec index 62f8a8a..044adfb 100644 --- a/SPECS/spice-gtk.spec +++ b/SPECS/spice-gtk.spec @@ -4,57 +4,44 @@ %filter_setup } -%define with_gtk3 0 -%if 0%{?fedora} >= 15 || 0%{?rhel} >= 7 -%define with_gtk3 1 -%endif +%global _hardened_build 1 #define _version_suffix Name: spice-gtk -Version: 0.31 -Release: 6%{?dist}.2 +Version: 0.33 +Release: 6%{?dist} Summary: A GTK+ widget for SPICE clients Group: System Environment/Libraries License: LGPLv2+ -URL: http://spice-space.org/page/Spice-Gtk +URL: https://www.spice-space.org/ #VCS: git:git://anongit.freedesktop.org/spice/spice-gtk -Source0: http://www.spice-space.org/download/gtk/%{name}-%{version}%{?_version_suffix}.tar.bz2 -Patch0001: 0001-display-Lower-level-of-warning-for-empty-monitor-con.patch -Patch0002: 0002-fix-16-bpp-LZ-image-decompression.patch -Patch0003: 0003-egl-fix-leak-when-display-is-unrealize.patch -Patch0004: 0004-Ensure-that-file-transfers-get-cancelled.patch -Patch0005: 0005-channel-main-fix-leak-on-volume-sync.patch -Patch0006: 0006-channel-Abort-migration-in-delayed-unref.patch -Patch0007: 0007-file-xfer-fix-segfault-on-agent-disconnection.patch -Patch0008: 0008-tests-Add-test-for-SpiceURI.patch -Patch0009: 0009-spice-uri-Reset-SpiceURI-before-parsing.patch -Patch0010: 0010-spice-uri-Do-not-allow-empty-port-string.patch -Patch0011: 0011-spice-uri-Check-if-port-is-in-allowed-range.patch -Patch0012: 0012-spice-uri-Validate-uri-scheme.patch -Patch0013: 0013-spice-uri-Add-ipv6-support.patch -Patch0014: 0014-Explicitly-specify-size-of-SpiceMsgSmartcardData.patch -Patch0015: 0015-main-Don-t-delay-update_display_timer-0-for-up-to-1-.patch -Patch0016: 0016-sasl-fix-SASL-GSSAPI-by-allowing-NULL-username.patch -Patch0017: 0017-session-Keep-brackets-around-ipv6-hostname.patch -Patch0018: 0018-session-Fix-IPv6-by-using-g_network_address_parse.patch -Patch0019: 0019-channel-check-if-channel-has-a-session.patch -Patch0020: 0020-clipboard-Add-fixup_clipboard_text-helper.patch -Patch0021: 0021-clipboard-Use-gtk_clipboard_request_text-for-text-da.patch -Patch0022: 0022-util-Remove-unused-GError-parameter.patch -Patch0023: 0023-clipboard-Return-early-if-check_clipboard_size_limit.patch -Patch0024: 0024-clipboard-Fix-crash-by-handling-error.patch +Source0: https://www.spice-space.org/download/gtk/%{name}-%{version}%{?_version_suffix}.tar.bz2 + +Patch0001: 0001-clipboard-Fix-crash-by-handling-error.patch +Patch0002: 0002-channel-usbredir-Fix-crash-on-channel-up.patch +Patch0003: 0003-gtk-session-Use-GWeakRef.patch +Patch0004: 0004-gtk-session-always-reply-to-agent-s-clipboard-reques.patch +Patch0005: 0005-usb-Allow-to-compile-if-LZ4-is-disabled.patch +Patch0006: 0006-widget-Always-call-gtk_widget_show_all.patch +Patch0007: 0007-authentication-Handle-failed-SASL-authentication-sep.patch +Patch0008: 0008-authentication-Handle-failed-spice-authentication.patch +Patch0009: 0009-file-xfer-do-not-send-unnecessary-0-bytes-messages.patch +Patch0010: 0010-file-xfer-avoid-g_hash_table_iter_-when-changing-the.patch +Patch0011: 0011-Remove-redundant-space-from-error-message.patch +Patch0012: 0012-audio-debug-audio-codec-when-audio-stream-starts.patch +Patch0013: 0013-file-xfer-Fix-bad-filename-encoding.patch +Patch0014: 0014-Revert-Ignore-modifiers-messages-if-no-modifiers-cha.patch Patch1000: 1000-gtk-Makefile.am-add-PIE-flags-to-libspice-client-gli.patch BuildRequires: intltool -BuildRequires: gtk2-devel >= 2.14 BuildRequires: usbredir-devel >= 0.6-8 BuildRequires: libusb1-devel >= 1.0.9 BuildRequires: libgudev1-devel BuildRequires: pixman-devel openssl-devel libjpeg-turbo-devel BuildRequires: celt051-devel pulseaudio-libs-devel -BuildRequires: pygtk2-devel python-devel zlib-devel +BuildRequires: zlib-devel BuildRequires: cyrus-sasl-devel BuildRequires: libcacard-devel BuildRequires: gobject-introspection-devel @@ -65,13 +52,10 @@ BuildRequires: gtk-doc BuildRequires: vala-tools BuildRequires: usbutils BuildRequires: libepoxy-devel -%if %{with_gtk3} BuildRequires: gtk3-devel -%endif -# FIXME: should ship the generated files.. -BuildRequires: pyparsing +BuildRequires: gstreamer1-devel gstreamer1-plugins-base-devel # keep me to get gendeps magic happen -BuildRequires: spice-protocol >= 0.12.11-1 +BuildRequires: spice-protocol >= 0.12.12-1 # Hack because of bz #613466 BuildRequires: libtool Requires: spice-glib%{?_isa} = %{version}-%{release} @@ -80,25 +64,10 @@ Requires: spice-glib%{?_isa} = %{version}-%{release} %description Client libraries for SPICE desktop servers. -%package devel -Summary: Development files to build GTK2 applications with spice-gtk-2.0 -Group: Development/Libraries -Requires: %{name}%{?_isa} = %{version}-%{release} -Requires: spice-glib-devel%{?_isa} = %{version}-%{release} -Requires: pkgconfig -Requires: gtk2-devel - -%description devel -spice-client-gtk-2.0 provides a SPICE viewer widget for GTK2. - -Libraries, includes, etc. to compile with the spice-gtk2 libraries - %package -n spice-glib Summary: A GObject for communicating with Spice servers Group: Development/Libraries Requires: usbredir >= 0.6-8 -Requires: spice-protocol >= 0.12.11-1 -Requires: nss %description -n spice-glib spice-client-glib-2.0 is a SPICE client library for GLib2. @@ -109,18 +78,18 @@ Group: Development/Libraries Requires: spice-glib%{?_isa} = %{version}-%{release} Requires: pkgconfig Requires: glib2-devel +Obsoletes: spice-gtk-python < 0.32 %description -n spice-glib-devel spice-client-glib-2.0 is a SPICE client library for GLib2. Libraries, includes, etc. to compile with the spice-glib-2.0 libraries - -%if %{with_gtk3} %package -n spice-gtk3 Summary: A GTK3 widget for SPICE clients Group: Development/Libraries Requires: spice-glib%{?_isa} = %{version}-%{release} +Obsoletes: spice-gtk < 0.32 %description -n spice-gtk3 spice-client-glib-3.0 is a SPICE client library for Gtk3. @@ -132,6 +101,7 @@ Requires: spice-gtk3%{?_isa} = %{version}-%{release} Requires: spice-glib-devel%{?_isa} = %{version}-%{release} Requires: pkgconfig Requires: gtk3-devel +Obsoletes: spice-gtk-devel < 0.32 %description -n spice-gtk3-devel spice-client-gtk-3.0 provides a SPICE viewer widget for GTK3. @@ -146,23 +116,11 @@ Requires: spice-gtk3-devel%{?_isa} = %{version}-%{release} %description -n spice-gtk3-vala A module allowing use of the spice-gtk-3.0 widget from vala -%endif - -%package python -Summary: Python bindings for the spice-gtk-2.0 library -Group: Development/Libraries -Requires: %{name}%{?_isa} = %{version}-%{release} -Requires: spice-glib = %{version}-%{release} - -%description python -SpiceClientGtk module provides a SPICE viewer widget for GTK2. - -A module allowing use of the spice-gtk-2.0 widget from python %package tools Summary: Spice-gtk tools Group: Applications/Internet -Requires: %{name}%{?_isa} = %{version}-%{release} +Requires: spice-gtk3%{?_isa} = %{version}-%{release} Requires: spice-glib = %{version}-%{release} %description tools @@ -172,12 +130,8 @@ spicy-screenshot is a tool to capture screen-shots of a SPICE desktop. %prep -%setup -q -n spice-gtk-%{version}%{?_version_suffix} -c -if [ -n '%{?_version_suffix}' ]; then - mv spice-gtk-%{version}%{?_version_suffix} spice-gtk-%{version} -fi +%setup -q -n spice-gtk-%{version}%{?_version_suffix} -pushd spice-gtk-%{version} %patch0001 -p1 %patch0002 -p1 %patch0003 -p1 @@ -192,93 +146,38 @@ pushd spice-gtk-%{version} %patch0012 -p1 %patch0013 -p1 %patch0014 -p1 -%patch0015 -p1 -%patch0016 -p1 -%patch0017 -p1 -%patch0018 -p1 -%patch0019 -p1 -%patch0020 -p1 -%patch0021 -p1 -%patch0022 -p1 -%patch0023 -p1 -%patch0024 -p1 %patch1000 -p1 find . -name '*.stamp' | xargs touch -popd - -%if %{with_gtk3} -cp -a spice-gtk-%{version} spice-gtk3-%{version} -%endif %build - -cd spice-gtk-%{version} -%configure --with-gtk=2.0 --enable-gtk-doc --disable-epoxy --with-usb-acl-helper-dir=%{_libexecdir}/spice-gtk-%{_arch}/ -make %{?_smp_mflags} -cd .. - -%if %{with_gtk3} -cd spice-gtk3-%{version} -%configure --with-gtk=3.0 --enable-vala --disable-epoxy --with-usb-acl-helper-dir=%{_libexecdir}/spice-gtk-%{_arch}/ +%configure \ + --with-gtk=3.0 \ + --enable-vala \ + --with-usb-acl-helper-dir=%{_libexecdir}/spice-gtk-%{_arch}/ \ + --disable-werror make %{?_smp_mflags} -cd .. -%endif %install - -%if %{with_gtk3} -cd spice-gtk3-%{version} make install DESTDIR=%{buildroot} -cd .. -%endif - -cd spice-gtk-%{version} -make install DESTDIR=%{buildroot} -cd .. rm -f %{buildroot}%{_libdir}/*.a rm -f %{buildroot}%{_libdir}/*.la -rm -f %{buildroot}%{_libdir}/python*/site-packages/*.a -rm -f %{buildroot}%{_libdir}/python*/site-packages/*.la -# needed because of the upstream issue described in -# http://lists.freedesktop.org/archives/spice-devel/2012-August/010343.html -# these are unwanted spice-protocol files -rm -rf %{buildroot}%{_includedir}/spice-1 -rm -rf %{buildroot}%{_datadir}/pkgconfig/spice-protocol.pc %find_lang %{name} - %post -p /sbin/ldconfig %postun -p /sbin/ldconfig %post -n spice-glib -p /sbin/ldconfig %postun -n spice-glib -p /sbin/ldconfig -%if %{with_gtk3} %post -n spice-gtk3 -p /sbin/ldconfig %postun -n spice-gtk3 -p /sbin/ldconfig -%endif -%files -%doc spice-gtk-%{version}/AUTHORS -%doc spice-gtk-%{version}/COPYING -%doc spice-gtk-%{version}/README -%doc spice-gtk-%{version}/NEWS -%{_mandir}/man1/spice-client.1* -%{_libdir}/libspice-client-gtk-2.0.so.* -%{_libdir}/girepository-1.0/SpiceClientGtk-2.0.typelib - -%files devel -%{_libdir}/libspice-client-gtk-2.0.so -%{_includedir}/spice-client-gtk-2.0 -%{_libdir}/pkgconfig/spice-client-gtk-2.0.pc -%{_datadir}/gir-1.0/SpiceClientGtk-2.0.gir - %files -n spice-glib -f %{name}.lang %{_libdir}/libspice-client-glib-2.0.so.* %{_libdir}/libspice-controller.so.* @@ -298,8 +197,12 @@ rm -rf %{buildroot}%{_datadir}/pkgconfig/spice-protocol.pc %{_datadir}/vala/vapi/spice-protocol.vapi %doc %{_datadir}/gtk-doc/html/* -%if %{with_gtk3} %files -n spice-gtk3 +%doc AUTHORS +%doc COPYING +%doc README +%doc NEWS +%{_mandir}/man1/spice-client.1* %{_libdir}/libspice-client-gtk-3.0.so.* %{_libdir}/girepository-1.0/SpiceClientGtk-3.0.typelib @@ -314,10 +217,6 @@ rm -rf %{buildroot}%{_datadir}/pkgconfig/spice-protocol.pc %{_datadir}/vala/vapi/spice-client-glib-2.0.vapi %{_datadir}/vala/vapi/spice-client-gtk-3.0.deps %{_datadir}/vala/vapi/spice-client-gtk-3.0.vapi -%endif - -%files python -%{_libdir}/python*/site-packages/SpiceClientGtk.so %files tools %{_bindir}/spicy @@ -325,13 +224,53 @@ rm -rf %{buildroot}%{_datadir}/pkgconfig/spice-protocol.pc %{_bindir}/spicy-stats %changelog -* Thu Nov 10 2016 Victor Toso - 0.31-6.2 -- Rebuild as previous build did not apply patch0024 - Resolves: rhbz#1393046 - -* Thu Nov 10 2016 Victor Toso - 0.31-6.1 +* Wed Jun 7 2017 Pavel Grunt - 0.33-6 +- Fix capslock regression + Resolves: rhbz#1458730 + +* Thu May 25 2017 Pavel Grunt - 0.33-5 +- Enable hardened build flags + Resolves: rhbz#1420778 + +* Wed May 10 2017 Pavel Grunt - 0.33-4 +- Make connection error message more clear + Resolves: rhbz#1365736 +- Improve audio debug + Resolves: rhbz#1436249 +- Fix wrong encoding of transferred files + Resolves: rhbz#1440206 + +* Tue Apr 11 2017 Victor Toso - 0.33-3 +- Avoid CRITICALs on copy-paste + Resolves: rhbz#1440096 +- Avoid assertions on file-xfer while agent disconnects + Related: rhbz#1440096 + +* Mon Mar 27 2017 Pavel Grunt - 0.33-2 +- Add missing patch for rebase + Resolves: rhbz#1402474 +- Add obsoletes to the spec file to ease updates + Resolves: rhbz#1432776 +- Fix black screen in virt-manager + Resolves: rhbz#1433242 +- Make connection error message more clear + Resolves: rhbz#1365736 + +* Mon Mar 13 2017 Pavel Grunt - 0.33-1 +- Rebase to 0.33 + Resolves: rhbz#1402474 +- Rebuilt with correct hardening flags due to bug 1387475 + Resolves: rhbz#1420778 +- Fix copy paste issues + Resolve: rhbz#1409854 + +* Mon Dec 12 2016 Pavel Grunt - 0.31-8 +- Fix crash in spicy-stats + Resolves: rhbz#1403820 + +* Fri Dec 9 2016 Pavel Grunt - 0.31-7 - Avoid crash on clipboard due failure in text conversion - Resolves: rhbz#1393046 + Resolves: rhbz#1385225 * Fri Sep 9 2016 Pavel Grunt - 0.31-6 - Improve clipboard handling for motif applications