Commit Graph

1302 Commits

Author SHA1 Message Date
Marc-André Lureau
01d565ff54 Fix spice-protocol reference 2012-03-05 19:36:25 +01:00
Marc-André Lureau
36d8da6283 Send name & uuid to capable clients
Add spice_server_set_name() and spice_server_set_uuid() that allows
the client to identify a Spice server (useful to associate settings
with a particular server)

The SPICE_MSG_MAIN_NAME and SPICE_MSG_MAIN_UUID messages are only sent
to capable clients, announcing SPICE_MAIN_CAP_NAME_AND_UUID.
2012-03-05 18:19:07 +01:00
Marc-André Lureau
f0ff2e383e demarshal: fixed-size array are missing __nelements
A message with a fixed-size array, such as uint8 uuid[16] will
generate an invalid code, missing the __nelements variable. Make sure
that variable is defined.
2012-03-05 18:19:07 +01:00
Christophe Fergeau
15808ea7f5 server: more logging about certificates used
This commit adds some log messages indicating which certificates
could be loaded (or not).

Fixes rhbz#787678
2012-03-05 10:14:36 +01:00
Christophe Fergeau
8f8e73986b Add log for invalid/expired tickets
Currently, when a ticket has already expired, or is invalid, there is
no qemu log to tell what went wrong. This commit adds such a log.

Fixes rhbz#787669
2012-03-05 10:14:36 +01:00
Christophe Fergeau
735f8e2837 mingw: workaround weird openssl build failure
If X509_NAME isn't undefined before including x509v3.h, very
weird compilation error occurs. It seems to be caused by duplicate
definitions for this symbols coming from wincrypto.h
2012-03-04 10:50:39 +02:00
Christophe Fergeau
0f94e897b5 mingw: don't try to redefine alloca
mingw already has a #define alloca __builtin_alloca so trying to
redefine it triggers a warning.
2012-03-04 10:50:39 +02:00
Christophe Fergeau
32cd24be0a mingw: fix signed/unsigned comparison warnings 2012-03-04 10:50:38 +02:00
Christophe Fergeau
58b9aa9853 mingw: add workaround for _ftime_s issue on mingw
mingw has a _ftime_s prototype in its headers, but no corresponding
symbol available at link time. Workaround this issue for now by
 #defining it to _ftime. This is untested on win64 where the workaround
may not be needed.
2012-03-04 10:50:38 +02:00
Christophe Fergeau
4ec9ac20fc mingw: #ifdef unneeded #define in common.h
common.h has some #define when doing win32 build to workaround a few
missing functions on these systems. However, since mingw32 has some
of these, this causes either warnings about redefining preprocessor
symbols or wreak havoc in mingw headers trying to use these symbols.
This commit wraps these symbols in an #ifndef __MINGW32__ to avoid
using them on this platform.
2012-03-04 10:50:38 +02:00
Christophe Fergeau
5989e2d1c4 mingw: use uintptr_t when converting a pointer to an int
win64 uses 32 bit long, so we cannot use a long to hold a 64 bit
pointer. Thankfully, there's a [u]intptr_t type available exactly
for these uses.
2012-03-04 10:50:38 +02:00
Marc-André Lureau
534b71dfaa build-sys: fix make distcheck
- Do not refer to .c files managed by another makefile (this will fail
  make distclean)
- Do not refer to files by relative path (should use $top_srcdir for ex)
- Use LDADD for object linking instead of LDFLAGS, for linker flags
2012-03-01 16:24:10 +01:00
Marc-André Lureau
22ee470d4e build-sys: cleanup server/tests/Makefile.am 2012-03-01 16:24:10 +01:00
Marc-André Lureau
5d57fb4d1b build-sys: use spice-protocol as submodule 2012-03-01 16:24:10 +01:00
Marc-André Lureau
5077ab60f8 build-sys: cleanup, use autoreconf 2012-03-01 16:24:10 +01:00
Arnon Gilboa
f605e2774d client/windows: fix SetClipboardViewer error handling rhbz#786554
MSDN says the following about SetClipboardViewer(): "If an error occurs or there
are no other windows in the clipboard viewer chain, the return value is NULL".
Seems like the buggy case was "no other windows in the clipboard viewer chain",
which explains the 3rd party clipboard manager workaround detailed in the bug
description.

It also seems like SetClipboardViewer() does not clear the error state on
succcess. Calling SetLastError(0) before SetClipboardViewer() seems to solves
this issue.

Since we could not reproduce the bug on our env, the customer has verified on
several of their systems that a private build resolved the issue.
2012-03-01 14:16:49 +02:00
Yonit Halperin
d2cd7b2b02 client X11: support volume keys when evdev is in use
Add support for sending volume keys scancodes to the guest
RHBZ #552539

Signed-off-by: Yonit Halperin <yhalperi@redhat.com>
2012-03-01 08:59:19 +02:00
Yonit Halperin
68cdc5488d client: keyboard - add mapping for volume keys
Add support for sending volume keys scancodes to the guest
RHBZ #552539

A good reference for mapping keymaps to scancodes can be found in
spice-gtk/gtk/keymaps.csv

Signed-off-by: Yonit Halperin <yhalperi@redhat.com>
2012-03-01 08:58:52 +02:00
Christophe Fergeau
a50619e733 Fix compilation when smartcard support is disabled
The addition of smartcard control to the controller doesn't handle
the case when smartcard support is disabled at compile time. When
this is the case, this causes compile errors.
2012-02-29 18:20:01 +01:00
Alon Levy
4b7c66cafc controller_test: add README 2012-02-28 14:40:42 +02:00
Alon Levy
294dae31b0 client controller_test: reorder parameters since pid isn't needed for linux client test 2012-02-28 14:40:42 +02:00
Alon Levy
26516fc5a2 client: handle CONTROLLER_ENABLE_SMARTCARD (rhbz 641828) 2012-02-28 14:40:42 +02:00
Alon Levy
bbd01f5f63 controller_test: add ENABLE_SMARTCARD 2012-02-28 14:40:42 +02:00
Alon Levy
7a079b452b server: fix segfault on client disconnect
..as a result of missing initialization of newly introduced
pre_disconnect in main channel.
2012-02-26 13:34:39 +01:00
Fabiano Fidêncio
65f89aca2c Enabling cursor in server/tests
Now, cursor is being shown in all tests as a white rectangle and is
    running in the screen doing a diagonal movement. It's a very simple
    way to test cursor commands and is sufficient for our tests.
2012-02-26 13:10:25 +01:00
Dan McGee
016bc7513f Use standard IOV_MAX definition where applicable
This is provided by <limits.h> on all platforms as long as _XOPEN_SOURCE
is defined. On Linux, this is 1024, on Solaris, this is 16, and on any
other platform, we now respect the value supported by the OS.

Signed-off-by: Dan McGee <dpmcgee@gmail.com>
2012-02-21 10:20:47 +02:00
Dan McGee
bdfd6c234b Respect IOV_MAX if defined
Solaris has a pitiful maximum writev vector size of only 16, so the ping
request at initial startup destroyed this call and broke things
immediately. Reimplement stream_writev_cb() to respect IOV_MAX and break
the writev() calls into chunks as necessary. Care was taken to return
the correct values as necessary so the EAGAIN handling logic can
determine where to resume the writev call the next time around.

Signed-off-by: Dan McGee <dpmcgee@gmail.com>
2012-02-21 10:20:46 +02:00
Dan McGee
143a1df24e red_worker: reimplement event loop using poll()
This removes the epoll dependency we had in red_worker, which was the
last Linux-specific call we were using in the entire Spice server. Given
we never have more than 10 file descriptors involved, there is little
performance gain had here by using epoll() over poll().

The biggest change is introduction of a new pre_disconnect callback;
this is because poll, unlike epoll, cannot automatically remove file
descriptors as they are closed from the pollfd set. This cannot be done
in the existing on_disconnect callback; that is too late as the stream
has already been closed and the file descriptor lost. The on_disconnect
callback can not be moved before the close and other operations easily
because of some behavior that relies on client_num being set to a
certain value.

Signed-off-by: Dan McGee <dpmcgee@gmail.com>
2012-02-21 10:20:46 +02:00
Dan McGee
dfbac622bf Use memcpy call in red_channel_create
Rather than assign the callbacks one-by-one, we can just memcpy the
struct into the one we have allocated in our RedChannel object, which is
much more efficient, not to mention future-proof when more callbacks are
added.

Signed-off-by: Dan McGee <dpmcgee@gmail.com>
2012-02-21 10:20:45 +02:00
Dan McGee
10d79a35c1 Cleanup definitions of disconnect methods
We had multiple stub methods that simply called other disconnect
methods, making my head hurt with the indirection. Call the right
methods at the right time and rip out the stub methods; if they are
truely needed later they can be added again.

Signed-off-by: Dan McGee <dpmcgee@gmail.com>
2012-02-21 10:20:45 +02:00
Dan McGee
a67268cbe1 red_worker: rename epoll_timeout to event_timeout
With future patches in mind that will allow for some other
non-Linux-specific event polling sytem to be used, rename this to a more
generic name. All of the select/poll/epoll/kqueue family of calls are
related to evented I/O, so 'event_' makes sense in this case.

Signed-off-by: Dan McGee <dpmcgee@gmail.com>
2012-02-21 10:20:44 +02:00
Dan McGee
0e3ff74b84 Add configure-time check for -Wl, --version-script option
This is supported by the GNU linker, but not the Solaris linker, which
is used as the default on that platform even when compiling with GCC.
Omit passing the option to the linker on platforms that do not support
it.

Signed-off-by: Dan McGee <dpmcgee@gmail.com>
2012-02-21 10:20:44 +02:00
Hans de Goede
f3f8ebe91b server/spicevmc: Don't destroy the rcc twice
spicevmc calls red_channel_client_destroy() on the rcc when it disconnects
since we don't want to delay the destroy until the session gets closed as
spicevmc channels can be opened, closed and opened again during a single
session.

This causes red_channel_client_destroy() to get called twice, triggering
an assert, when a connected channel gets destroyed.

This was fixed with commit ffc4de01e6 for
the case where: a spicevmc channel was open on client disconnected, and
the main channel disconnect gets handled first.

But the channel can also be destroyed when the chardev gets unregistered
with the spice-server. This path still triggers the assert.

This patch fixes this by adding a destroying flag to the rcc struct, and
also moves the previous fix over to the same, more clean, method of
detecting this special case.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2012-02-20 16:32:31 +01:00
Alon Levy
7e3fb815cc server/tests/basic_event_loop: print something on channel_event 2012-02-15 15:09:13 +02:00
Alon Levy
5ec8515508 server, separate SpiceChannelEventInfo from RedStream
fixes rhbz 790749 use after free of SpiceChannelEventInfo.

The lifetime of the SpiceChannelEventInfo was that of RedsStream, but it
is used by main_dispatcher_handle_channel_event after the RedsStream is
freed for the cursor and display channels. Making SCEI allocation be at
RedsStream allocation, and deallocation after the DESTROY event is
processed by core->channel_event, fixes use after free.
2012-02-15 15:04:04 +02:00
Alon Levy
bdd3bf8777 README: make a note of SPICE_DEBUG_ALLOW_MC 2012-02-15 14:32:11 +02:00
Dan McGee
3f303d6014 Remove all usages of bzero()
As recommended by modern C practice, we should just be using memset().

Signed-off-by: Dan McGee <dpmcgee@gmail.com>
2012-02-14 18:19:43 +02:00
Dan McGee
08c514ee85 Remove extra '\n' from red_printf() calls
red_printf() takes care of adding a newline to all messages; remove the
extra newline from all messages and macros that were doubling them up.

Signed-off-by: Dan McGee <dpmcgee@gmail.com>
2012-02-14 18:19:29 +02:00
Alon Levy
e4a92b177a server/tests: use getopt_long 2012-02-14 17:30:50 +02:00
Fabiano Fidêncio
33bd5d2797 Adding image to be used as "correct" in regression tests 2012-02-14 14:53:47 +02:00
Fabiano Fidêncio
1e8e2f9ee0 Adding support to automated tests
As suggested by Alon, a simple automated test to try to find
    regressions in Spice code.
    To use this, compile Spice with --enable-automated-tests and
    run test_display_streaming passing --automated-tests as parameter.
2012-02-14 14:53:44 +02:00
Dan McGee
aebe837d3a Add casts for compatibility purposes
Some non-Linux platforms return a (caddr_t *) result for the return
value of mmap(), which is very unfortunate. Add a (void *) cast to
explicitly avoid the warning when compiling with -Werror.

For the IO vector related stuff, signed vs. unsigned comes into play so
adding a (void *) cast here is technically correct for all platforms.

Signed-off-by: Dan McGee <dpmcgee@gmail.com>
2012-02-14 10:44:49 +02:00
Yonit Halperin
5868c99da6 server: support IPV6 addresses in channel events sent to qemu
RHBZ #788444

CC: Gerd Hoffmann <kraxel@redhat.com>

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Yonit Halperin <yhalperi@redhat.com>
2012-02-12 13:15:18 +02:00
Erlon Cruz
9eb0e4b577 Fix mandatory -Werror option
Compilation was breaking due to warning errors even when configuring with
--enable-werror=no. This patch fix this.
2012-02-09 15:51:51 +01:00
Christophe Fergeau
67178944d2 Handle Application::set_hotkeys failure
Application::set_hotkeys can throw an exception if it fails parsing
the string describing the hotkeys to set. Currently this exception
is uncaught which causes spicec to terminate when the controller
tries to set invalid hotkeys. Fall back to using the default
hotkeys when the controller sends an invalid hotkeys string.
2012-02-03 13:11:11 +01:00
Christophe Fergeau
e3fb720cd1 Don't use "hw:0,0" for recording with alsa
We currently hardcode this device when spicec needs to record with
alsa. However, this doesn't interact well with PulseAudio, which
means that if something is already using the recording device, spicec
won't be able to open it again.
Using "default" as the device will let spicec use the PulseAudio
alsa support and will avoid this issue.
2012-01-31 16:40:57 +01:00
Hans de Goede
965a1a253c More comparison between signed and unsigned integer expressions warning fixes
Turns out that more recent snapshots of gcc-4.7 emit even more of these,
so the fixes which I've done before tagging the 0.10.1 release are not
enough to build warning free with the latest gcc-4.7 snapshot <sigh>.

This fixes this.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2012-01-23 20:33:27 +01:00
Hans de Goede
8817549795 Release 0.10.1 2012-01-23 15:58:13 +01:00
Hans de Goede
a0190fce23 Fix various comparison between signed and unsigned integer expressions warnings
These turn into errors because of our -Werror use, breaking the build.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2012-01-23 15:58:13 +01:00
Alon Levy
459a4dba56 server/red_channel: red_peer_handle_incoming: comment on null check
Signed-off-by: Alon Levy <alevy@redhat.com>
2012-01-23 12:58:30 +02:00