summaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
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-19build-sys: Add real autodetection of pythonChristophe Fergeau1-8/+42
configure help text says that by default python will be used automatically if appropriate, however this only means that on !windows and !gtk3, we will force build of the python bindings, and fail if any needed package to build them is missing. This commit improves on the current checks so that when autodetecting python, if a package is missing then build of the bindings is silently disabled rather than failing.
2013-11-19build-sys: Re-enable building of python bindings by defaultChristophe Fergeau1-1/+1
Commit daa4ece tried to disable building of python bindings on Windows by default, but in doing so, it also disabled building of python bindings by default when we are building neither for Windows nor for gtk3.
2013-11-19build-sys: Fix invalid 'test' syntax in configure.acChristophe Fergeau1-1/+1
test ... -o test ... is not a valid shell construct, change it to test ... || test ... as this is more portable than test ... -o ... This was causing a warning when running configure.
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 Jongsma7-49/+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 Jongsma7-13/+48
Add spice_display_get_monitor_config() to get the current configuration of the display.
2013-11-04Fix spice-common submodule, my badMarc-André Lureau1-0/+0
2013-11-03util: document spice_uuid_to_stringMarc-André Lureau1-0/+10
2013-11-01util: do not overwrite G_MESSAGES_DEBUG=allMarc-André Lureau2-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 Levy4-58/+237
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-10Use latest warnings.m4 from gnulibChristophe Fergeau1-20/+62
The one we were using does not work properly with clang, causing the build process to try to use -f/-W options that are not supported by clang.
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
2013-10-02mono cursor: increase contrast, better looking putty cursor (rhbz 998529)Alon Levy1-8/+8
Signed-off-by: Alon Levy <alevy@redhat.com>
2013-09-30spice-channel: Fix usbredir being broken since commit 159c6ebfHans de Goede1-0/+1
The usbredir channel uses spice_msg_in_raw to get its data, which uses in->dpos to determine the msg size and that was no longer being set for non sub-messages. https://bugs.freedesktop.org/show_bug.cgi?id=69935 Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2013-09-26win32: fix alt-tab grab regressionMarc-André Lureau1-1/+1
Since 5f67178c, alt-tab is no longer grabbed by the client. The keyboard hook still needs to handle WM_SYSKEY{DOWN,UP} messages. https://bugzilla.redhat.com/show_bug.cgi?id=873341
2013-09-26build-sys: do not compile python binding with windows by defaultMarc-André Lureau1-14/+10
2013-09-26Update spice-commonMarc-André Lureau1-0/+0
2013-09-26build-sys: add --with-audio=autoMarc-André Lureau1-2/+6
Defaults to GStreamer on Windows, and PulseAudio otherwise atm.
2013-09-26build-sys: fix --with-saslMarc-André Lureau1-11/+5
The default configure sasl auto setting will error out if SASL is missing. Instead, silentely skip sasl configure if detected missing.
2013-09-20build-sys: fix g_clear_pointer usage on old glibMarc-André Lureau1-0/+1
As pointed out and verified on the ML after 0.21 release by Klaus Hochlehnert.
2013-09-18Release v0.21v0.21Marc-André Lureau1-0/+11