summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
...
* main: fix recent main_channel_reset() warningMarc-André Lureau2013-11-201-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)
* coroutine: make gthread coroutine pass testsMarc-André Lureau2013-11-201-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.
* tests: add some coroutine testsMarc-André Lureau2013-11-202-7/+147
|
* coroutine: replace IN_MAIN_CONTEXT macroMarc-André Lureau2013-11-206-8/+10
| | | | | Use a nicer function, with correct prefix. Remove extra "context" from function name
* coroutine: error out on OOM or impossible conditionsMarc-André Lureau2013-11-207-39/+23
| | | | | Take an approach similar to gthreads, which are considered as low level/must work features by glib, which aborts on failures.
* channel: get rid of connection_id, available from sessionMarc-André Lureau2013-11-202-3/+1
|
* channel: remove useless desc != NULL checkMarc-André Lureau2013-11-201-1/+1
| | | | spice_channel_type_to_string() does not return NULL
* Fix 'monitors' leak in update_monitor_area()Christophe Fergeau2013-11-201-0/+1
| | | | | This function has an early return where we fail to unref the 'monitors' array.
* main: send max-clipboard to agentMarc-André Lureau2013-11-192-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
* main: simplify usage of VD_AGENT_HAS_CAPABILITYMarc-André Lureau2013-11-191-32/+28
| | | | | Introduce a helper function test_agent_cap() to clear the code a little bit.
* main: use self for main channel variableMarc-André Lureau2013-11-191-18/+19
| | | | | This simplifies the following commit which uses even more SPICE_MAIN_CHANNEL macro, and makes the code unnecessarily heavy.
* Add SPICE_MAX_CLIPBOARD environment variableMarc-André Lureau2013-11-191-5/+28
| | | | | Allow to easily override default max-clipboard value with environment variable.
* Block sending clipboard data > max-clipboardMarc-André Lureau2013-11-192-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.
* Use system-wide trust certificate storeChristophe Fergeau2013-11-191-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
* build-sys: Add real autodetection of pythonChristophe Fergeau2013-11-191-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.
* build-sys: Re-enable building of python bindings by defaultChristophe Fergeau2013-11-191-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.
* build-sys: Fix invalid 'test' syntax in configure.acChristophe Fergeau2013-11-191-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.
* Fix leak of mmapped memory when cc_init() failsChristophe Fergeau2013-11-181-1/+10
|
* Check coroutine_init() return valueChristophe Fergeau2013-11-182-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()
* Free coroutine stack when releasing coroutineDaniel P. Berrange2013-11-181-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>
* Abort if mmap of coroutine stack failsDaniel P. Berrange2013-11-181-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>
* Fix IN_MAIN_CONTEXT when using coroutine=gthreadChristophe Fergeau2013-11-184-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.
* Fix crash on remote-viewer startup with gthread coroutineChristophe Fergeau2013-11-181-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.
* coroutine: fix current coroutineMarc-André Lureau2013-11-181-1/+1
| | | | | When leaving a coroutine, it swaps back to where it came from, not to the leader/main coroutine.
* coroutine: add some preconditionsMarc-André Lureau2013-11-183-12/+10
|
* Guarantee that 'uuid' property is notified after connectionJonathon Jongsma2013-11-071-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.
* Make sure property notifications are done in the main contextJonathon Jongsma2013-11-072-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().
* Revert "Add ability to get SpiceDisplay resolution"Jonathon Jongsma2013-11-077-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
* display: blank surface on creationMarc-André Lureau2013-11-061-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.
* widget: add since tag for spice_display_get_monitor_config()Marc-André Lureau2013-11-041-0/+1
|
* SpiceDisplay: validate 'self' argument for public APIJonathon Jongsma2013-11-041-7/+29
| | | | Add defensive g_return[_val]_if_fail(SPICE_IS_DISPLAY()) to all public API
* Add ability to get SpiceDisplay resolutionJonathon Jongsma2013-11-047-13/+48
| | | | | Add spice_display_get_monitor_config() to get the current configuration of the display.
* Fix spice-common submodule, my badMarc-André Lureau2013-11-041-0/+0
|
* util: document spice_uuid_to_stringMarc-André Lureau2013-11-031-0/+10
|
* util: do not overwrite G_MESSAGES_DEBUG=allMarc-André Lureau2013-11-012-0/+2
| | | | | glib log handler only check for a single 'all' value, mixing it with other domains name will disable 'all' messages.
* Export spice_uuid_to_string() properlyJonathon Jongsma2013-10-292-0/+2
| | | | Update map-file and spice-glib-sym-file
* Expose spice_uuid_to_string() as public APIJonathon Jongsma2013-10-293-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.
* channel-cursor: mono cursors edge highlightingAlon Levy2013-10-204-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.
* cursor-channel.c: add cursor print function for debugging only (ifdefed)Alon Levy2013-10-181-0/+32
|
* main: add missing vdagent caps nameMarc-André Lureau2013-10-161-0/+3
| | | | This is useful in debug messages atm.
* sasl: Fix crash when ending a SASL sessionChristophe Fergeau2013-10-161-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.
* Display g_debug messages when SPICE_DEBUG is setChristophe Fergeau2013-10-161-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.
* Fix --spice-debugChristophe Fergeau2013-10-161-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.
* Fix switch to old SPICE protocolChristophe Fergeau2013-10-101-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.
* Reenable call to switch_protocol() on protocol version mismatchesChristophe Fergeau2013-10-101-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.
* Use latest warnings.m4 from gnulibChristophe Fergeau2013-10-101-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.
* gtk-session: avoid mainloop recursion in clipboard_getMarc-André Lureau2013-10-101-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.
* gtk-session: fix clipboard_agent_connectedMarc-André Lureau2013-10-101-1/+1
| | | | Use swapped connection to pass data as first argument to signal handler.
* main: fix notify of agent disconnectionMarc-André Lureau2013-10-101-1/+4
| | | | | | | spice_main_channel_reset_agent() reset connected state, and prevent notify of property change. This is a minor regression introduced in c3adb24425.
* display: cache id is uint64_tMarc-André Lureau2013-10-031-1/+1
|