Commit Graph

805 Commits

Author SHA1 Message Date
Yonit Halperin
84ff23cd2b server: replace redundant code with red_cursor_reset
In addition (1) make handle_dev_destroy_surfaces call red_release_cursor
(2) call red_wait_outgoing_item(cursor_channel) only after adding msgs to pipe

[3d3066b175 cherry-pick with modifications]
2011-07-21 15:09:29 +03:00
Christophe Fergeau
7db7212c3a use foo(void) instead of foo() in prototypes
In C, the latter isn't a prototype for a function with no arg,
but declares a function with an undefined number of args.

[picked from master with changes since no main_channel, spice_common,
 and a bunch of functions aren't there yet]
2011-07-21 15:09:29 +03:00
Alon Levy
0d1a9a3c89 bump required spice-protocol to 0.8.1 for qxl_dev async and s3 updates 2011-07-21 15:09:29 +03:00
Alon Levy
c9c84c9f8d server: api: add spice_qxl_* calls based on QXLWorker contents
For each callback in QXLWorker, for example QXLWorker::update_area, add
a direct call named spice_qxl_update_area.

This will (a) remove the pointless indirection and (b) make shared
library versioning alot easier as we'll get new linker symbols which
we can tag with the version they appeared in the shared library.

[cherry-picked from master]
2011-07-21 15:09:29 +03:00
Christophe Fergeau
66ad3e84f3 s/__visible__/SPICE_GNUC_VISIBLE
The C specification reserves use of identifiers starting with __
to the compiler so we shouldn't use one such symbol.

[cherry-pick from master]
2011-07-21 15:09:29 +03:00
Alon Levy
f3ee396dfe server: spice-server.syms: move sasl symbols to 0.8.2
[0.8: there are no 0.10.0 symbols]
2011-07-21 15:09:29 +03:00
Uri Lublin
c685a3d4eb client: rename connect_unsecure to connect_to_peer
Both connect_secure() and connect_unsecure() call connect_to_peer().

Prior to this commit spicec.log reported all connections as unsecure,
as connect_secure() called connect_unsecure() to make the connection.
This fixes RH bug #653545
2011-07-21 15:09:29 +03:00
Christophe Fergeau
edce17a574 Fix spice-server/qemu channel version checks
When qemu creates a channel, reds.c contains code to check the
minor/major channel versions known to QEMU (ie the ones that were
current in spice-server when QEMU was compiled) and to compare these
versions against the current ones the currently installed spice-server
version.

According to kraxel [1], the rules for these interface numbers are:

"The purpose of the versions is exactly to avoid the need for a new
soname.  The rules are basically:

   (1) You add stuff to the interface, strictly append-only to not break
       binary compatibility.
   (2) You bump the minor version of the interface.
   (3) You check the minor version at runtime to figure whenever the
       added fields contain valid stuff or not.

An example is here (core interface, minor goes from 2 to 3, new
channel_event callback):

http://cgit.freedesktop.org/spice/spice/commit/?id=97f33fa86aa6edd25111b173dc0d9599ac29f879
"

The code currently refuses to create a channel if QEMU minor version is
less than the current spice-server version. This does not correspond
to the intended behaviour, this patch changes to fail is qemu was compiled
with a spice-server that is *newer* than the one currently installed. This
case is something we cannot support nicely.

[1] http://lists.freedesktop.org/archives/spice-devel/2011-July/004440.html
2011-07-21 15:09:29 +03:00
Christophe Fergeau
c44878ff8d client: don't crash when agent is missing WAN support
If you try to connect to a linux guest with WAN options, SPICE window opens up
and is blank - it then fails with vdagent timeout message.  It should give a
warning that this is only applicable for windows guest and still connect to
guest.

It all starts in RedClient::handle_init
This function checks whether we have an agent or not, because if we have an
agent, there will be some kind of handshake to check both sides capabilities
before all the spice channels are created.

When there is no agent running, the startup process goes on with
SPICE_MSGC_MAIN_ATTACH_CHANNELS

When there is a windows agent running, VD_AGENT_ANNOUNCE_CAPABILITIES and
VD_AGENT_DISPLAY_CONFIG messages are sent to the agent, and when processing the
agent answer to the VD_AGENT_DISPLAY_CONFIG message,
SPICE_MSGC_MAIN_ATTACH_CHANNELS will be sent and the startup process will go
on.

However, when there is no agent running but --color-depth was used, handle_init
won't send the SPICE_MSGC_MAIN_ATTACH_CHANNELS message but will wait for the
agent handshake to proceed to its end, which won't happen, so it will timeout
waiting for agent answers.

Similarly, the linux agent handles VD_AGENT_ANNOUNCE_CAPABILITIES messages, but
it doesn't handle VD_AGENT_DISPLAY_CONFIG messages, so we'll never reach the
point where a SPICE_MSGC_MAIN_ATTACH_CHANNELS will be sent.

This commit fixes this in 2 places:
- unconditionnally send SPICE_MSGC_ATTACH_CHANNELS when no agent is running in
handle_init
- send SPICE_MSGC_MAIN_ATTACH_CHANNELS in
RedClient::on_agent_announce_capabilities if the agent doesn't have the
VD_AGENT_CAP_DISPLAY_CONFIG capability

This fixes RH bug #712938
2011-07-21 15:09:29 +03:00
Christophe Fergeau
0e5452b0ba client: improve WAN option description
The WAN options (--color-depth and --disable-effects) need
support from the guest agent to be working. Currently they are
only supported on Windows. While I don't want to explicitly
mention Windows in --help output, we can hint that it won't
work with all guests in --help. This fixes RH bug #712941
2011-07-21 15:09:28 +03:00
Christophe Fergeau
0021a096e5 x11: don't return freed memory from get_clipboard
There is a double free in client/x11/platform.cpp.
In get_selection(), in the exit: case with ret_val == -1 and data != NULL,
*data_ret (which is returned to the caller) has already been
assigned "data", so it will be pointing to freed memory when "data" is
XFree'd'. Then in handle_selection_notify, get_selection_free is called on
this pointer, which causes a double free.
When the length of the read data = 0, set the returned value to NULL,
this way subsequent free attempts will be a noop.
Fixes RH bug #710461
2011-07-21 15:09:28 +03:00
Christophe Fergeau
f6df14e533 client: match delete[] with new[]
vinfo in x11/platform.cpp is allocated using new[] so it needs to
be freed with delete[]
2011-07-21 15:09:28 +03:00
Yonit Halperin
4c44be35b0 server: fix access to a released drawable. RHBZ #713474
red_pipe_add_drawable can lead to removal of drawables from current tree
(since it calls red_handle_drawable_surfaces_client_synced), which can
also lead to releasing these drawables.
Before the fix, red_current_add_equal, called red_pipe_add_drawable,
without assuring afterwards that the drawables it refers to are still alive or
still in the current tree.
2011-07-21 15:09:28 +03:00
Yonit Halperin
e22354141e server: add missing calls to red_handle_drawable_surfaces_client_synced
red_handle_drawable_surfaces_client_synced was called only from red_pipe_add_drawable, while it
should also be called from red_pipe_add_drawable_after. Otherwise, the client
might receive a command with a reference to a surface it doesn't hold and crash.
2011-07-21 15:09:28 +03:00
Yonit Halperin
ec6198218a server: removing local cursor, this solves RHBZ #714801
When the worker was stoped, the cursor was copied from guest ram to the host ram,
and its corresponding qxl command was released.
This is unecessary, since the qxl ram still exists (we keep references
to the surfaces in the same manner).
It also led to BSOD on guest upon migration: the device tracks cursor set commands and it stores
a reference to the last one. Then, it replays it to the destination server when migrating to it.
However, the command the qxl replayed has already been released from the pci by the original
worker, upon STOP.

Conflicts:

	server/red_worker.c
2011-07-21 15:09:28 +03:00
Alon Levy
a3a6224820 server/smartcard: register channel only when hardware is available 2011-07-21 15:09:28 +03:00
Alon Levy
d830cf0553 server/smartcard: handle BaseChannel messages
According to spice.proto the smartcard channel can receive acks and any
other message defined in BaseChannel. While the spicec implementation didn't
send an ACK spice-gtk does, so handle it.
2011-07-21 15:09:28 +03:00
Christophe Fergeau
b759a52fcd add check for pyparsing
Check both in configure.ac (after checking if we need to rebuild
the marshalling files) and in the python script using pyparsing
(for people modifying .proto files in tarballs)
2011-07-21 15:09:28 +03:00
Arnon Gilboa
e482c1f640 client/windows: enable image randomization (ASLR) rhbz#701111
Enable image randomized base address, hindering some types of
security attacks by making it more difficult for an attacker
to predict target addresses.
2011-07-21 15:09:28 +03:00
Arnon Gilboa
e35b6804db client/windows: undef SIZE_MAX in stdint.h
eliminating redefinition warning
2011-07-21 15:09:28 +03:00
Zeeshan Ali (Khattak)
51bc547921 server: Unset executable bit of red_tunnel_worker.h 2011-07-21 15:09:28 +03:00
Marc-André Lureau
bc9d045760 common: spice_memdup could accept NULL
(this patch is not to solve a crash fix, but to align with glib API)
2011-07-21 15:09:28 +03:00
Christophe Fergeau
551ad336c1 add missing "LGPLv2.1 or later" header to source files 2011-07-21 15:09:28 +03:00
Christophe Fergeau
6bd492fa79 common: add extern "C" guards to headers
Since some spice C++ code is using code from common/, the C
functions need to be marked as such for the C++ compiler, otherwise
we'll get linkage issues.
2011-07-21 15:09:27 +03:00
Christophe Fergeau
3dab7bda53 configure.ac: replace tab with spaces
This makes the "C++ Compiler:     ...." status output nicely
aligned with the other messages.
2011-07-21 15:09:27 +03:00
Christophe Fergeau
0244f9a4b4 configure.ac: remove unused dynamic linkage flag
configure.ac defines a SPICEC_STATIC_LINKAGE_BDYNAMIC variable
when --enable-static-linkage is not set, but it's never used.
SPICEC_STATIC_LINKAGE_BSTATIC is used in client/, but since we
are using libtool, it might be more appropriate to use
'make LDFLAGS="-all-static"' to achieve static link.
2011-07-21 15:09:27 +03:00
Christophe Fergeau
2f8c25d986 configure.ac: fix use of AC_ARG_ENABLE
Most uses of AC_ARG_ENABLE were buggy:
- when passing --disable-xxx, configure.ac would behave as if it
  was passed --enable-xxx
- passing --enable-xxx=foo would "leak" into the summary, ie the
  summary (at the end of configure) would say "xxx: foo" instead
  of "xxx: yes"

This patch fixes these 2 issues.
2011-07-21 15:09:27 +03:00
Alon Levy
03004a57d5 spice.proto: Fill.rop_descriptor type s/uint16/ropd (10x atiti) 2011-07-21 15:09:27 +03:00
Christophe Fergeau
2bd98219f3 client: s/reqired/required in CmdLineParser 2011-07-21 15:09:27 +03:00
Christophe Fergeau
fdfc940f59 server/tests remove useless assignment
This was detected by clang-static-analyzer.
2011-07-21 15:09:27 +03:00
Christophe Fergeau
e77fc7e877 common/pixman: remove dead assignments
They were detected using clang-static-analyzer. Don't initialize
the variable to a value to override it with a different value
a few lines after.
2011-07-21 15:09:27 +03:00
Christophe Fergeau
96555db49a gl: remove unused variables
gcc 4.6 warned about these.
2011-07-21 15:09:27 +03:00
Christophe Fergeau
dda8e3f62c gl: use correct pixman accessor for image data
Commit 774e5bd36f changed
-  dest->source.pixmap.x_image->data +
+  (uint8_t *)pixman_image_get_stride(dest->source.pixmap.pixman_image) +

The correct accessor to use is pixman_image_get_data. Thanks to gcc
4.6 for warning about a "different size" int to pointer conversion.
2011-07-21 15:09:27 +03:00
Christophe Fergeau
416009c0c1 client: use silent generation rules in Makefile.am
The server Makefile.am rules for marshallers generation are
prefixed with AM_V_SILENT to integrate nicely with automake silent
rules. The same AM_V_SILENT prefix isn't used in client/Makefile.am
resulting in verbose output even when automake silent mode is
enabled. This commit removes this verbosity.
2011-07-21 15:09:27 +03:00
Christophe Fergeau
4ef1b8c331 common/gl: remove unused variable
clang static analyzer warned that 'len' was computed but never
used in glc_vertex2d. glc_stroke_line_dash has side effects so
we have to call it, but we don't need to save its return value
since it's not used.
2011-07-21 15:09:27 +03:00
Christophe Fergeau
c6b4cb0564 opengl: fix compilation
When OpenGL is enabled, build fails in DisplayChannel::create_surface
because Canvas *canvas is declared twice. Remove the first
declaration to fix compilation.
2011-07-21 15:09:27 +03:00
Alon Levy
f2bb4cfe62 python_modules/codegen.py: fix indent error in an unused function 2011-07-21 15:09:27 +03:00
Marc-André Lureau
f42e261aa6 server: add SASL support
We introduce 2 public functions to integrate with the library user.

spice_server_set_sasl() - turn on SASL
spice_server_set_sasl_appname() - specify the name of the app (It is
used for where to find the default configuration file)

The patch for QEMU is on its way.

https://bugs.freedesktop.org/show_bug.cgi?id=34795

Conflicts:

	server/reds.c
	server/reds.h
2011-07-21 15:09:27 +03:00
Marc-André Lureau
6101cb805a server: add auth mechanism selection
https://bugs.freedesktop.org/show_bug.cgi?id=34795
2011-07-21 15:09:27 +03:00
Marc-André Lureau
bb6747b3d5 server: add reds_channel_dispose()
Try to have a common base dispose() method for channels. For now, it
just free the caps.

Make use of it in snd_worker, and in sync_write() - sync_write() is
going to have default caps later on.

https://bugs.freedesktop.org/show_bug.cgi?id=34795
2011-07-21 15:09:26 +03:00
Marc-André Lureau
159fee00c2 server: simplify and constify sync_write()
+ symplify, improving style of code using it.

https://bugs.freedesktop.org/show_bug.cgi?id=34795
2011-07-21 15:09:26 +03:00
Marc-André Lureau
8186db28c2 server: pull out reds_handle_link(), for future reuse
+ a couple of indent, style change

https://bugs.freedesktop.org/show_bug.cgi?id=34795
2011-07-21 15:09:26 +03:00
Marc-André Lureau
b1df04b9c5 build: add --with-sasl
Using cyrus SASL library (same as gtk-vnc/qemu).

https://bugs.freedesktop.org/show_bug.cgi?id=34795

Conflicts:

	configure.ac
2011-07-21 15:09:26 +03:00
Marc-André Lureau
6a0ea67113 common: add SpiceBuffer - based on qemu-vnc Buffer
https://bugs.freedesktop.org/show_bug.cgi?id=34795
2011-07-21 15:09:26 +03:00
Marc-André Lureau
a3732afda3 server/reds: make writev fallback more generic
We are going to reuse it for SASL/SSF encode write().

https://bugs.freedesktop.org/show_bug.cgi?id=34795
2011-07-21 15:09:26 +03:00
Marc-André Lureau
26ded5e395 server: rename s/peer/stream
This is stylish change again. We are talking about a RedStream object,
so let's just name the variable "stream" everywhere, to avoid
confusion with a non existent RedPeer object.

https://bugs.freedesktop.org/show_bug.cgi?id=34795
2011-07-21 15:09:26 +03:00
Marc-André Lureau
5f27f8f522 server/reds: remove the void* ctx field
https://bugs.freedesktop.org/show_bug.cgi?id=34795
2011-07-21 15:09:26 +03:00
Marc-André Lureau
36ab16d6c5 server: use the new reds_stream_{read,write}
https://bugs.freedesktop.org/show_bug.cgi?id=34795
2011-07-21 15:09:26 +03:00
Marc-André Lureau
584cc5a3d1 server: remove cb_free, not needed anymore
https://bugs.freedesktop.org/show_bug.cgi?id=34795
2011-07-21 15:09:26 +03:00
Marc-André Lureau
a5946a54dd server: use reds_{link,stream}_free()
Be carefull removing the watch before, like __release_link

https://bugs.freedesktop.org/show_bug.cgi?id=34795
2011-07-21 15:09:26 +03:00