summaryrefslogtreecommitdiff
path: root/gtk
AgeCommit message (Collapse)AuthorFilesLines
2013-11-27build-sys: bump spice-glib versionMarc-André Lureau1-1/+1
new symbols in spice-glib, bump before release
2013-11-27continuation: fix "fortify" crashMarc-André Lureau1-2/+6
Since 0508f586, errno.h is included above #undef _FORTIFY_SOURCE. But it must be placed above system headers to take effect *** longjmp causes uninitialized stack frame ***: /home/jwhite/xfer/spice/bin/spicy terminated ======= Backtrace: ========= /lib/x86_64-linux-gnu/libc.so.6(__fortify_fail+0x37)[0x7ffff48dc2a7] /lib/x86_64-linux-gnu/libc.so.6(+0xef239)[0x7ffff48dc239] /lib/x86_64-linux-gnu/libc.so.6(__longjmp_chk+0x33)[0x7ffff48dc1a3] /home/jwhite/xfer/spice/lib/libspice-client-glib-2.0.so.8(+0x49761)[0x7ffff78f1761] /home/jwhite/xfer/spice/lib/libspice-client-glib-2.0.so.8(+0x499a4)[0x7ffff78f19a4] /home/jwhite/xfer/spice/lib/libspice-client-glib-2.0.so.8(+0x1bae7)[0x7ffff78c3ae7] /lib/x86_64-linux-gnu/libglib-2.0.so.0(g_main_context_dispatch+0x135)[0x7ffff505f355] /lib/x86_64-linux-gnu/libglib-2.0.so.0(+0x4a688)[0x7ffff505f688] /lib/x86_64-linux-gnu/libglib-2.0.so.0(g_main_loop_run+0x72)[0x7ffff505fa82] /home/jwhite/xfer/spice/bin/spicy[0x4054aa] /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xfd)[0x7ffff480bead] /home/jwhite/xfer/spice/bin/spicy[0x405679]
2013-11-26pulse: do not abort on corking no streamMarc-André Lureau1-1/+4
There is no guarantee that a stream actually exist when min-latency change is notified. Check that there is an actual stream before calling cork(). All callers where previously checking that stream existed. Add a pre-condition to verify argument and spot that error is from spice-gtk itself. Fixes the following crash: #1 0x0000003c12e34105 in abort () at abort.c:92 #2 0x0000003c2c223180 in pa_stream_is_corked (s=0x0) at pulse/stream.c:2536 #3 0x0000003c2c648cb7 in stream_cork (pulse=<value optimized out>, s=0x7fbb38, with_flush=0) at spice-pulse.c:227 #4 0x0000003c2c649989 in playback_min_latency_changed (object=<value optimized out>, pspec=<value optimized out>, data=0x7fbad0) at spice-pulse.c:674 https://bugzilla.redhat.com/show_bug.cgi?id=1032785
2013-11-22channel: swap channel GSocketConnection on migrationMarc-André Lureau1-0/+1
When migration completes, unrefing the new connection leads to original GSocket pending refs, and thus the sockets stay in CLOSE_WAIT. This is a regression from 8029bd0 where GSocketConnection is kept around to satisfy old glib. https://bugzilla.redhat.com/show_bug.cgi?id=1024501 This will also probably fix: https://bugzilla.redhat.com/show_bug.cgi?id=952375
2013-11-21Fix SASL for mechanism using WANT_CLIENT_FIRSTdietmar@proxmox.com1-1/+4
Current code works with DIGEST-MD5, but not with PLAIN. In particular, when using PLAIN, sasl_client_start() returns SASL_OK, which should not be an error in spite of vague/confusing upstream documentation about this: http://asg.andrew.cmu.edu/archive/message.php?mailbox=archive.cyrus-sasl&msg=10104 Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
2013-11-20main: fix recent main_channel_reset() warningMarc-André Lureau1-9/+8
Fix wrong warning added in 0704147d. (lt-spicy:17511): GSpice-WARNING **: (channel-main.c:415):spice_main_channel_reset: runtime check failed: (c->agent_connected == FALSE)
2013-11-20coroutine: make gthread coroutine pass testsMarc-André Lureau1-1/+5
The coroutine entry() return value must be passed via the caller->data, since coroutine_swap() returns from->data. (this is needed because coroutine_swap() argument is used both to return from entry() or to send data to a running coroutine) When leaving a coroutine, clear its caller. Return correct coroutine_self() before other coroutine are initialized.
2013-11-20coroutine: replace IN_MAIN_CONTEXT macroMarc-André Lureau6-8/+10
Use a nicer function, with correct prefix. Remove extra "context" from function name
2013-11-20coroutine: error out on OOM or impossible conditionsMarc-André Lureau7-39/+23
Take an approach similar to gthreads, which are considered as low level/must work features by glib, which aborts on failures.
2013-11-20channel: get rid of connection_id, available from sessionMarc-André Lureau2-3/+1
2013-11-20channel: remove useless desc != NULL checkMarc-André Lureau1-1/+1
spice_channel_type_to_string() does not return NULL
2013-11-20Fix 'monitors' leak in update_monitor_area()Christophe Fergeau1-0/+1
This function has an early return where we fail to unref the 'monitors' array.
2013-11-19main: send max-clipboard to agentMarc-André Lureau1-3/+38
Send configured max-clipboard size to the agent, after receiving agent capabilities. See also spice-protocol patch description: http://lists.freedesktop.org/archives/spice-devel/2013-November/015254.html
2013-11-19main: simplify usage of VD_AGENT_HAS_CAPABILITYMarc-André Lureau1-32/+28
Introduce a helper function test_agent_cap() to clear the code a little bit.
2013-11-19main: use self for main channel variableMarc-André Lureau1-18/+19
This simplifies the following commit which uses even more SPICE_MAIN_CHANNEL macro, and makes the code unnecessarily heavy.
2013-11-19Add SPICE_MAX_CLIPBOARD environment variableMarc-André Lureau1-5/+28
Allow to easily override default max-clipboard value with environment variable.
2013-11-19Block sending clipboard data > max-clipboardMarc-André Lureau2-3/+34
Attempt to send very large clipboard data may easy cause OOM abort, either in gdk - some patch are proposed to improve the situation, or in spice-gtk itself. Let's have a property that blocks unreasonably big clipboard data from being processed (by default 100mb). Users willing to send larger data can use the send basic drag-drop send file instead, or tweak the property value.
2013-11-19Use system-wide trust certificate storeChristophe Fergeau1-1/+10
Currently, spice-gtk will look in $HOME/.spicec/spice_truststore.pem by default for its trust certificate store (to verify the certificates used during SPICE TLS connections). However, these days, progress is under-way to have a system-wide certificate store [1]. In order to use it, we only need to call SSL_CTX_set_default_verify_paths() and it will automatically use the shared system CA store if the distro is properly setup. We only try to use that store if there was no user-provided CA file to use, or if we failed to load it. [1] https://fedoraproject.org/wiki/Features/SharedSystemCertificates
2013-11-18Fix leak of mmapped memory when cc_init() failsChristophe Fergeau1-1/+10
2013-11-18Check coroutine_init() return valueChristophe Fergeau2-2/+9
coroutine_init() can fail, but spice-channel.c was not checking its return value, which could lead to some crashes if coroutine_init() failed and we then try to use coroutine_yieldto()
2013-11-18Free coroutine stack when releasing coroutineDaniel P. Berrange1-0/+2
The coroutine_init function mmap's a stack for the ucontext coroutine, but nothing ever munmaps it. Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2013-11-18Abort if mmap of coroutine stack failsDaniel P. Berrange1-1/+4
If we fail to mmap the stack, abort the processs rather than returning an error. This is standard practice in glib apps, and the caller was not checking the coroutine_init() return code leading to memory corruption. Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2013-11-18Fix IN_MAIN_CONTEXT when using coroutine=gthreadChristophe Fergeau4-1/+17
The IN_MAIN_CONTEXT macro checks coroutine_self()->caller against NULL to decide whether we are in the main context or not. However, this is an implementation detail of the ucontext coroutine implementation, in the gthread implementation, coroutine_self()->caller will be non-NULL even in the main context. This commit introduces a coroutine_is_main_context() method which each coroutine backend implements. It turns out it can be implemented the same way for each backend.
2013-11-18Fix crash on remote-viewer startup with gthread coroutineChristophe Fergeau1-1/+1
g_object_notify_main_context() was recently changed to automatically detect whether we are running in the main context or not, and SpiceSession is now using g_object_notify_main_context(). In order to achieve that, IN_MAIN_CONTEXT is used, but it's not safe to be used before coroutine_init() is called. IN_MAIN_CONTEXT expands to (coroutine_self()->caller == NULL), but coroutine_self() will be NULL when using gthreads for the coroutine implementation until coroutine_init() has been called. Before coroutine_init() has been called, we'll always be running in the main context, so we can just add a check for coroutine_self() != NULL to IN_MAIN_CONTEXT to solve that issue.
2013-11-18coroutine: fix current coroutineMarc-André Lureau1-1/+1
When leaving a coroutine, it swaps back to where it came from, not to the leader/main coroutine.
2013-11-18coroutine: add some preconditionsMarc-André Lureau3-12/+10
2013-11-07Guarantee that 'uuid' property is notified after connectionJonathon Jongsma1-0/+5
This creates a synchronization point and allows API users to rely on the fact that they'll always get a UUID notification before all of the channels are created.
2013-11-07Make sure property notifications are done in the main contextJonathon Jongsma2-21/+24
Modify g_object_notify_main_conetxt() to work whether it's called from the main context or a coroutine context. Change object notify calls in SpiceSession to use g_object_notify_main_context() instead of g_object_notify().
2013-11-07Revert "Add ability to get SpiceDisplay resolution"Jonathon Jongsma6-47/+13
This reverts commit a285e0187d15ad650f6524f3811072fa55b20617. This API was not actually needed for what I intended to use it for. So revert for now. We can always add it back if necessary in the future. Conflicts: gtk/spice-widget.c
2013-11-06display: blank surface on creationMarc-André Lureau1-3/+2
In theory, zero-ing the surface shouldn't be necessary, as only invalidated/painted region should be shown. However, this results in less artifacts on resolution changes (probably some regions are painted, but with masks, blend, copy etc), in particular on console after VM reboot.
2013-11-04widget: add since tag for spice_display_get_monitor_config()Marc-André Lureau1-0/+1
2013-11-04SpiceDisplay: validate 'self' argument for public APIJonathon Jongsma1-7/+29
Add defensive g_return[_val]_if_fail(SPICE_IS_DISPLAY()) to all public API
2013-11-04Add ability to get SpiceDisplay resolutionJonathon Jongsma6-13/+46
Add spice_display_get_monitor_config() to get the current configuration of the display.
2013-11-03util: document spice_uuid_to_stringMarc-André Lureau1-0/+10
2013-11-01util: do not overwrite G_MESSAGES_DEBUG=allMarc-André Lureau1-0/+2
glib log handler only check for a single 'all' value, mixing it with other domains name will disable 'all' messages.
2013-10-29Export spice_uuid_to_string() properlyJonathon Jongsma2-0/+2
Update map-file and spice-glib-sym-file
2013-10-29Expose spice_uuid_to_string() as public APIJonathon Jongsma3-2/+1
SpiceSeession has a 'uuid' property that is a byte array, but clients often need the uuid in string format (for writing to disk, etc). Rather than having each client re-implement this, expose the utility function as public API in spice-gtk.
2013-10-20channel-cursor: mono cursors edge highlightingAlon Levy3-58/+120
Fix 998529, mono (invert) cursors not visible on a black background, by doing simple edge detection on the cursor (this is done once when the cursor is changed and then cached, cursors are 32x32 generally) and thus having a cursor with contrast on both dark and light backgrounds. When (if) GDK gets invert cursor support (wayland?) then we can just use the cursor as is. Until then X doesn't provide any way I see of solving this otherwise. The end result was tested with the I beam cursor that the original bug was referring to (run putty on a windows 7 vm) and looks ok to me. Moving the core function to spice-util for testing.
2013-10-18cursor-channel.c: add cursor print function for debugging only (ifdefed)Alon Levy1-0/+32
2013-10-16main: add missing vdagent caps nameMarc-André Lureau1-0/+3
This is useful in debug messages atm.
2013-10-16sasl: Fix crash when ending a SASL sessionChristophe Fergeau1-1/+1
When exiting remote-viewer after authenticating through SASL, I got this crash: #0 0x0000000100a51870 in ?? () #1 0x000000314d20c53e in _sasl_log (conn=<optimized out>, level=5, fmt=0x7fffe49893e8 "DIGEST-MD5 client mech dispose") at common.c:1985 #2 0x00007fffe4982d88 in digestmd5_client_mech_dispose (conn_context=0xaf1900, utils=0xaefd10) at digestmd5.c:4580 #3 0x000000314d208654 in client_dispose (pconn=0xaf0710) at client.c:332 #4 0x000000314d20b76b in sasl_dispose (pconn=0xa51898) at common.c:851 #5 0x00007ffff7602dc7 in channel_reset (channel=0xa52250, migrating=0) at spice-channel.c:2493 #6 0x00007ffff760f7b7 in spice_inputs_channel_reset (channel=0xa52250, migrating=0) at channel-inputs.c:615 #7 0x00007ffff76030ac in spice_channel_reset (channel=0xa52250, migrating=0) at spice-channel.c:2551 #8 0x00007ffff76031e0 in channel_disconnect (channel=0xa52250) at spice-channel.c:2570 #9 0x00007ffff760283d in spice_channel_coroutine (data=0xa52250) at spice-channel.c:2368 #10 0x00007ffff763d14b in coroutine_trampoline (cc=0xa51900) at coroutine_ucontext.c:58 #11 0x00007ffff763ce30 in continuation_trampoline (i0=10819840, i1=0) at continuation.c:49 #12 0x00000031342479c0 in ?? () from /lib64/libc.so.6 #13 0x0000000000a51cc8 in ?? () #14 0x0000000000000000 in ?? () It turns out that the sasl_callback_t data passed when calling sasl_client_new() must be valid until sasl_dispose() is called. I could not find mentions of this in the official documentation but https://mail-archives.apache.org/mod_mbox/subversion-dev/201109.mbox/%3C20110908072256.GN25324@ted.stsp.name%3E describes what happens. Making the sasl_callback_t structure static should be enough to guarantee that the data will stay around long enough.
2013-10-16Display g_debug messages when SPICE_DEBUG is setChristophe Fergeau1-11/+23
When SPICE_DEBUG is set but --spice-debug is not used, we fail to set G_MESSAGES_DEBUG to the log domain used by spice-gtk, which causes debug messages not to be printed as one would expect.
2013-10-16Fix --spice-debugChristophe Fergeau1-0/+7
If spice_util_set_debug() gets called before spice_util_get_debug(), then the value set using spice_util_set_debug() will be overridden by the result of g_getenv("SPICE_DEBUG") != NULL the first time spice_util_get_debug() is called. This causes remote-viewer --spice-debug to not enable debug as advertised if SPICE_DEBUG is not set. An alternate fix would have been to set debug_once.status to G_ONCE_STATUS_READY but then we would lose the thread-safety guarantees GOnce gives us.
2013-10-10Fix switch to old SPICE protocolChristophe Fergeau1-14/+8
After the previous commit, spice_channel_switch_protocol() is now called when needed, but it's not doing anything. What happens is that spice_channel_switch_protocol() triggers a channel disconnection and then it queues an idle to reconnect (after having changed the protocol version to be used). When spice_channel_recv_link_hdr() returns, we need to jump out of the coroutine to let the idle trigger and the new channel coroutine be started. But jumping out of the coroutine will call channel_disconnect() which calls channel_reset() which disables the idle switch_protocol() just queued. This causes the connection attempt to be apparently stuck with nothing happening. Falling back to the older SPICE protocol is not the only situation when we need to drop the current connection attempt and reconnect, we also need to do that when the remote server returns SPICE_LINK_ERR_NEED_SECURED to let the client know it needs to use a secure port for this channel. This is handled by the 'switch_tls' variable set in spice_channel_recv_link_msg and handled in spice_channel_coroutine(). 'switch_tls' does the same thing as spice_channel_switch_protocol(), except that it calls spice_channel_connect() after channel_disconnect() has been called, which means the idle queued by channel_connect() won't get cleared. This all that commit does, remove the spice_channel_switch_protocol() method and use the same codepath as 'switch_tls' to handle the reconnection.
2013-10-10Reenable call to switch_protocol() on protocol version mismatchesChristophe Fergeau1-2/+2
This partially reverts b19acbc. This commit broke the fallback to the old protocol as it added a check for c->peer_msg != NULL before calling switch_protocol(), but mismatch between local and remote protocol versions is detected before c->peer_msg is allocated, so: if (c->peer_msg != NULL && c->link_hdr.major_version != 1) { SPICE_DEBUG("%s: error, switching to protocol 1 (spice 0.4)", c->name); spice_channel_switch_protocol(channel, 1); return TRUE; } will never get triggered when c->peer_hdr.major_version != c->link_hdr.major_version The crash described in b19acbc occurred when calling spice_channel_recv_link_msg() in spice_channel_coroutine() after a call to spice_channel_recv_link_hdr() failed and did not set c->peer_msg. This commit removes the c>peer_msg check done before calling spice_channel_switch_protocol() so that it gets called when needed, but makes sure that we return FALSE to indicate that an error happened and that we need to reconnect. This way we won't try to call spice_channel_recv_link_msg() when c->peer_msg is NULL.
2013-10-10gtk-session: avoid mainloop recursion in clipboard_getMarc-André Lureau1-0/+9
clipboard_get() exits when the clipboard data is received, or when the agent connection state change. However, if the agent is already disconnected, neither of those 2 conditions can be reached. Check if the agent is connected before running loop, exit early if not.
2013-10-10gtk-session: fix clipboard_agent_connectedMarc-André Lureau1-1/+1
Use swapped connection to pass data as first argument to signal handler.
2013-10-10main: fix notify of agent disconnectionMarc-André Lureau1-1/+4
spice_main_channel_reset_agent() reset connected state, and prevent notify of property change. This is a minor regression introduced in c3adb24425.
2013-10-03display: cache id is uint64_tMarc-André Lureau1-1/+1
2013-10-03display: fix palette regressionMarc-André Lureau1-3/+3
palette_get() used to return a ref, and palette_release() used to release that ref. Since ed877341, the palette is no longer refcount'ed, since its usage is exclusively local in common/canvas code. palette_release() shouldn't remove the palette from the cache. https://bugzilla.redhat.com/show_bug.cgi?id=1011936