Commit Graph

1514 Commits

Author SHA1 Message Date
Marc-André Lureau
b74dd14c7b README: add vala-tools build-dep 2014-05-22 15:55:14 +02:00
Tiziano Müller
c56cc41d51 Add missing GIO_LIBS to libspice-client-glibs
If spice-gtk is built without PHODAV, libgio is missing from the list of
libraries to link against, causing undefined symbols for all gio functions.
2014-05-22 11:42:55 +02:00
Tiziano Müller
1e5c0990fe Do not depend on libsoup directly
The libsoup-dependency is not directly used but comes in as a dependency
of phodav and phodav has libsoup correctly recorded in its pkg-config
file.
2014-05-21 11:28:15 +02:00
Tiziano Müller
b637cd43da Introduce --enable/disable-webdav option
This makes the phodav dependency configureable.
And name it after the corresponding channel.
2014-05-21 11:28:12 +02:00
Marc-André Lureau
aea53ec51d Revert "clipboard: prevent reentering main loop if main channel is busy"
This change broke primary clipboard copying from remote to client, on win32.

There is a pending ::clipboard-grab emission, so the channel is not
idle, and it will handle emission and resume in the inner loop without
issue. We should really handle this situation with care though, and the
best would be to teach gtk+ to do async clipboard request.

This reverts commit e3efa8cec5.
2014-05-20 16:58:09 +02:00
Marc-André Lureau
4eb0d20f0a clipboard: check that clipboard request does not belong to remote
Check clipboard owner, to avoid cyclic dependency of clipboard requests.
2014-05-15 14:58:57 +02:00
Marc-André Lureau
e3efa8cec5 clipboard: prevent reentering main loop if main channel is busy
The main channel must be idle to avoid entering the nested loop,
or it will never reach the condition to leave it.

This should not happen. It can happen currently when the remote sends a
clipboard request while the clipboard is grabbed by the remote. In this
case, while the clipboard-request signal is emitted by main channel, the
clipboard_get() loop is entered, but the main coroutine will not be
woken up to proceed with the request, the main channel will remain
"frozen" and it won't be possible to leave cleanly from the inner loop.
The application appears to be frozen, because it can't quit properly.

Related to:
https://bugzilla.redhat.com/show_bug.cgi?id=1083489
2014-05-15 14:58:54 +02:00
Christophe Fergeau
e9a8ecf666 Include glib-compat.h in spice-option.c
Commit 8c89485 added a call to g_clear_pointer().
2014-04-29 16:05:42 +02:00
Marc-André Lureau
8c8948597e option: check that default ca-file exists
Don't set default ca-file path if the file doesn't exists.
2014-04-24 15:45:21 +02:00
Marc-André Lureau
39ded7a4d1 option: use more portable default ca-file path
If no CA path is given, a default one is set. Use g_build_filename() to
set a more portable and valid default path.
2014-04-23 20:03:49 +02:00
Christophe Fergeau
4c8ade49f4 Fix leak in spice_gtk_session_sync_keyboard_modifiers()
The list of channels returned by spice_session_get_channels()
must be freed after use.
2014-04-17 11:47:09 +02:00
Marc-André Lureau
a7e80610e8 display: signal primary-destroy when clearing all surfaces
When destroying the primary surface, we need to signal it, since
listeners might be referencing the data pointer. Currently, this only
happens during channel finalize().

This could help with rhbz#1082555.
2014-04-15 15:51:00 +02:00
Marc-André Lureau
3d8deef5f3 gtk-session: always sync modifiers for client events
The channel state is not synchronous.

It may happen that we want to set and unset quickly a modifier, but the
guest modifier state hasn't been updated yet, and will still be seen as
unset, preventing the last unset change.
2014-04-15 15:51:00 +02:00
Marc-André Lureau
d961e53da9 gtk-session: s/g_debug/CHANNEL_DEBUG 2014-04-15 15:51:00 +02:00
Christophe Fergeau
0407ebb5a4 Include gtk-compat.h in spice-gtk-session.c
GDK_IS_X11_DISPLAY is not available on gtk+ 2.x, but it already has a
fallback definition in gtk-compat.h
2014-04-15 10:24:13 +02:00
Christophe Fergeau
c2356a716b Gather gtk+ compatibility code in a single file
There are gtk+ version checks in several source files to add
compatibility implementations of gtk3 functions not available
in gtk2. This commit gathers all of them in a gtk-compat.h header,
similar to what is done for glib-compat.h
2014-04-15 10:24:11 +02:00
Christophe Fergeau
5a1c94f4ad Add compat implementation of g_queue_free_full()
This was introduced in glib 2.32 and the webdav channel uses it.
2014-04-15 10:24:09 +02:00
Christophe Fergeau
9dcdfebf4f Use correct printf format modifier for gssize
This fixes this warning/error:

channel-webdav.c: In function 'demux_to_client':
channel-webdav.c:318:5: error: format '%ld' expects argument of type 'long
int', but argument 5 has type 'gssize' [-Werror=format=]
     CHANNEL_DEBUG(self, "pushing %ld to client %p", size, client);
2014-04-08 13:31:00 +02:00
Christophe Fergeau
5718626cf3 Add man page
Spice-GTK provides SPICE-specific command line options. This man page
describes these options as well as the format of SPICE URIs.
2014-04-08 13:31:00 +02:00
Jonathon Jongsma
d06b256710 Use GdkKeymap to listen for keyboard modifier changes
Connect to the GdkKeymap::state-changed signal to detect when the client
keyboard modifiers have changed. This keeps the client and the guest in sync
even when the SpiceDisplay widget isn't focused. New values are only sent down
to the guest if the new value is different than the current value.
2014-04-03 16:07:25 -05:00
Jonathon Jongsma
9c75c7ee33 Ensure keyboard modifiers are synchronized properly
In certain circumstances, the keyboard modifiers get out-of-sync between the
guest and the client. This is easy to reproduce with the following steps:
 - launch virt-viewer with a guest that is not running
 - start the guest
 - while guest is booting, enable CAPS LOCK on the client
 - after guest finishes booting, it will set its modifiers to a default value
   (e.g. numlock on, capslock off)
 - now capslock is OFF in the guest, but ON in the client
 - toggle caps lock
 - now capslock is ON in the guest, but OFF in the client

This moves the responsibility for synchronizing client and guest modifiers into
SpiceGtkSession. It can't be handled easily within the SpiceDisplay widget since
there can be multiple display widgets for each inputs channel.

A new function (spice_gtk_session_sync_keyboard_modifiers()) was added so that
synchronization can be triggered manually if desired. But it also registers a
signal handler for the InputsChannel::inputs-modifiers signal to detect when the
guest has changed its modifiers. The signal handler simply overrides the guests
modifiers and sets them back to the value from the client.
2014-04-03 16:07:25 -05:00
Marc-André Lureau
31c099c931 Update NEWS for v0.25 2014-04-02 13:52:59 +02:00
Marc-André Lureau
d17d43ce5c Make phodav an optional external dependency
Now that upstream provides a stable/versioned API, it will be
easier to deal with than with submodules.
2014-04-02 13:52:30 +02:00
Marc-André Lureau
d4814544ea build-sys: re-organize summary to show major info first 2014-04-02 13:48:12 +02:00
Marc-André Lureau
941b96a235 build-sys: add missing soup subst 2014-04-02 13:46:54 +02:00
Jonathon Jongsma
4f8b8b1581 Fix missing SPICE_GTK_MICRO_VERSION value
configure.ac tries to assign a default value of 0 to the micro version if it's
empty, but the shell variable assignemnt doesn't work because there's whitespace
around the '=' sign.

This results in SPICE_GTK_MICRO_VERSION being defined to (), which causes a
compilation failure in files that include it.
2014-03-31 15:03:07 -05:00
Marc-André Lureau
6356941903 Update NEWS for v0.24 2014-03-25 17:31:28 +01:00
Marc-André Lureau
dc8fee5b26 Update phodav 2014-03-25 17:31:28 +01:00
Christophe Fergeau
8f5bd25249 Advertise SASL cap from client
A client setting this capability indicates to the server that it's able
to handle SASL authentication, and it also indicates that if SASL is
to be used for authentication, then it won't expect a valid 'pub_key' field
in SpiceLinkReply.

The reason for making guarantees about not looking at the pub_key field is
that its presence and size is hardcoded in the protocol, but in some
hardened setups (using fips mode), generating a RSA 1024 bit key as
expected is forbidden and fails. With this new capability, the server
knows the client will be able to handle SASL if needed, and can skip
the generation of the key altogether. This means that on the setups
described above, SASL authentication has to be used.
2014-03-25 15:55:41 +01:00
Marc-André Lureau
57571216a7 webdav: use some more explicit names
Address Alon's review from
http://lists.freedesktop.org/archives/spice-devel/2014-March/016383.html
2014-03-20 12:28:33 +01:00
Marc-André Lureau
a696dcca16 Start NEWS file 2014-03-19 15:24:23 +01:00
Marc-André Lureau
eeeb6e27be session: add shared-dir property and option
Allow to specify the shared directory from the command line, or at
runtime via properties. (still default to xdg public share, if none
specified)
2014-03-19 15:24:23 +01:00
Marc-André Lureau
382ecfa16f Add webdav channel
See spice-common for protocol details.  phodav, a webdav server library,
is imported thanks to a submodule, until this project has a stable API
and releases.

The webdav channel is reponsible for handling port events and
multiplexing the request streams. Extra care has been made to avoid
blocking and to enable some fairness between concurrent streams, however
this has been particularly tricky and is likely to have some issues
left.

The webdav server is run in a seperate thread, using libsoup. The client
communication is done via a local tcp socket, but protected to only
accept local connection and with a pretty strong password.

The home directory is exported for the remote to browse, which seems to
be a sensible default atm.
2014-03-19 15:24:23 +01:00
Christophe Fergeau
84b731a6f6 mingw64: Fix gssize printf-format warnings
When building with mingw64, several warnings about using the wrong format
specifier for gssize/gsize occur similar to:

win-usb-dev.c: In function 'g_udev_client_list_devices':
win-usb-dev.c:145:21: error: format '%i' expects argument of type 'int', but argument 7 has type 'gssize' [-Werror=format=]
                     name, errstr, rc);

This commit makes use of the G_GSIZE_FORMAT/G_GSSIZE_FORMAT macros provided
by glib to silence these warnings.

I've checked that this does not introduce new warnings on linux and mingw32
builds.
2014-03-18 18:02:12 +01:00
Marc-André Lureau
2cb753503a Fix spice_display_get_pixbuf() with offset area
Fix screenshot of secondary displays, with an area position != (0,0).

This has never been working correctly since the surface display "area"
was introducted in:

commit e3bb7b1cfd
Author: Marc-André Lureau <marcandre.lureau@redhat.com>
Date:   Tue Jun 12 19:24:47 2012 +0200

    display: learn to restrict display to an area

https://bugzilla.redhat.com/show_bug.cgi?id=1029761
2014-03-14 22:33:16 +01:00
Marc-André Lureau
524ee218cc Silence some gcc warnings
cc1: warnings being treated as errors
spice-uri.c: In function ‘spice_uri_parse’:
spice-uri.c:105: error: ‘saveptr’ may be used uninitialized in this
function [-Wuninitialized]
spice-uri.c:105: error: ‘saveptr2’ may be used uninitialized in this
function [-Wuninitialized]
2014-03-14 22:33:16 +01:00
Christophe Fergeau
76724d7cb6 sasl: Rework memory handling in spice_channel_perform_auth_sasl()
While looking at the SASL code, I noticed some memory leaks in error paths.
This commit adds a cleanup: block to free some of the memory dynamically
allocated in that function, and remove the corresponding g_free() from
the regular code flow. This should ensure that both the regular path
and the error paths free the same memory.

This fixes at least this 'mechlist' leak which I got during regular SASL
PLAIN authentication:
==3452== 6 bytes in 1 blocks are definitely lost in loss record 140 of 11,706
==3452==    at 0x4A0645D: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.s
==3452==    by 0x35BAC4EE6E: g_malloc (gmem.c:104)
==3452==    by 0x5BF7CAA: spice_channel_perform_auth_sasl (spice-channel.c:1440)
==3452==    by 0x5BF9033: spice_channel_recv_link_msg (spice-channel.c:1727)
==3452==    by 0x5BFAECD: spice_channel_coroutine (spice-channel.c:2348)
==3452==    by 0x5C35D6D: coroutine_trampoline (coroutine_ucontext.c:63)
==3452==    by 0x5C35A1B: continuation_trampoline (continuation.c:51)
==3452==    by 0x31342479BF: ??? (in /usr/lib64/libc-2.18.so)
==3452==    by 0x75F2940591224CFF: ???
==3452==    by 0xE756E5F: ???
==3452==    by 0xE7589BF: ???
==3452==    by 0xFFEFFF78F: ???
==3452==    by 0x5BFCD92: g_io_wait_helper (gio-coroutine.c:43)
=
2014-03-13 17:17:15 +01:00
Christophe Fergeau
b7c9343ba2 Make sure config.h is included first in all .c files
This is recommended by autoconf documentation
http://nondot.org/sabre/Mirrored/autoconf-2.12/autoconf_3.html#SEC15
and some #defines in config.h can change what happens in system headers,
so config.h has to be included first.

The only file which does not get this treatment is
gtk/spice-client-gtk-module.c as this breaks the build on gtk+2:

CC       SpiceClientGtk_la-spice-client-gtk-module.lo
In file included from /usr/include/python2.7/pyconfig.h:6:0,
                 from /usr/include/python2.7/Python.h:8,
                 from /usr/include/pygtk-2.0/pygobject.h:5,
                 from spice-client-gtk-module.c:20:
/usr/include/python2.7/pyconfig-64.h:1182:0: error: "_POSIX_C_SOURCE" redefined [-Werror]
 #define _POSIX_C_SOURCE 200112L
 ^
In file included from /usr/include/limits.h:25:0,
                 from /usr/lib/gcc/x86_64-redhat-linux/4.8.2/include/limits.h:168,
                 from /usr/lib/gcc/x86_64-redhat-linux/4.8.2/include/syslimits.h:7,
                 from /usr/lib/gcc/x86_64-redhat-linux/4.8.2/include/limits.h:34,
                 from /usr/lib64/glib-2.0/include/glibconfig.h:11,
                 from /usr/include/glib-2.0/glib/gtypes.h:34,
                 from /usr/include/glib-2.0/glib/galloca.h:34,
                 from /usr/include/glib-2.0/glib.h:32,
                 from /usr/include/glib-2.0/gobject/gbinding.h:30,
                 from /usr/include/glib-2.0/glib-object.h:25,
                 from ./glib-compat.h:24,
                 from ../config.h:201,
                 from spice-client-gtk-module.c:18:
/usr/include/features.h:228:0: note: this is the location of the previous definition
 #  define _POSIX_C_SOURCE 200809L
 ^
cc1: all warnings being treated as errors
2014-03-13 17:15:42 +01:00
Christophe Fergeau
6f379eeba9 build-sys: Fix setting of SPICE_GTK_MICRO_VERSION
After e124a3b2e which added the SPICE_GTK_CHECK_VERSION macro, a non-fatal
'./configure: line 15251: x24: command not found' appears in configure
output. This is because [ ] is not interpreted as the 'test' command by
autoconf, but is rather used as a way to quote configure.ac content.
This commit replaces the use of [] with a more typical AS_IF.
2014-03-10 16:46:55 +01:00
Christophe Fergeau
79fb87e9cb Add missing #include "glib-compat.h"
wocky-http-proxy.c and vmcstream.c make use of functions that were
not available in glib 2.26 so we need fallback for them through
glib-compat.h or spice-gtk won't build with older glibs.
2014-02-27 15:47:57 +01:00
Marc-André Lureau
055a310f65 display: fix crash when releasing primary surface
Since 1fcaaa15f8, display_surface is
allocated using gslice. However MSG_DISPLAY_MODE handler didn't allocate
using GSlice. This can eventually lead to a crash when freeing, such as:

Thread no. 1 (6 frames)
 #2 g_slice_free1 at gslice.c:1097
 #3 iter_remove_or_steal at ghash.c:787
 #4 clear_surfaces at /lib64/libspice-client-glib-2.0.so.8
 #5 spice_display_channel_finalize at
 /lib64/libspice-client-glib-2.0.so.8
 #7 spice_channel_delayed_unref at /lib64/libspice-client-glib-2.0.so.8
 #12 gtk_main at gtkmain.c:1158

https://bugzilla.redhat.com/show_bug.cgi?id=1069546
2014-02-25 11:42:47 +01:00
Marc-André Lureau
e124a3b2e8 Add a SPICE_GTK_CHECK_VERSION macro 2014-02-24 15:59:41 +01:00
Marc-André Lureau
603bad139c spice-common: revert last change 2014-02-21 12:56:49 +01:00
Marc-André Lureau
8cbdc3d2d6 session: add spice_session_get_proxy_uri()
Learn to return the currently configured proxy, to allow
client to tweak parameters, such as username and password.
2014-02-21 12:23:16 +01:00
Marc-André Lureau
3edcc04f20 channel: add spice_channel_get_error()
Add a function to retrieve the last GError from a channel, this may be
useful to provide additional error details to the client.
2014-02-21 12:23:12 +01:00
Marc-André Lureau
7c909790ca Make SpiceURI a public API
Generalize a little bit SpiceProxy to allow easy URI manipulation by
clients.
2014-02-21 12:23:01 +01:00
Marc-André Lureau
68370795f0 channel: talk to giostream instead of gsocket 2014-02-21 12:22:03 +01:00
Marc-André Lureau
9cf9ca4348 channel: simplify has error code
Get rid of a superflous g_socket_condition_check().
2014-02-21 12:22:00 +01:00
Marc-André Lureau
35f06b8fda openssl: learn to handle a new kind of BIO based on GIOStream
Although reusing BIO_new_socket() once again is a hack, it seems
to be the easiest way... The proper solution is certainly to start
using GTls instead, but that will require a glib 2.28 dep bump.
2014-02-21 12:21:57 +01:00
Marc-André Lureau
263e3014b9 Fill g_proxy_address_new() with protocol, user and password
This way, the call might eventually support more proxy and
authentication.
2014-02-21 12:21:55 +01:00