Commit Graph

739 Commits

Author SHA1 Message Date
Alon Levy
529dc40dc3 server/smartcard: fix use after free 2011-05-24 16:11:26 +03:00
Arnon Gilboa
31358b640b client/windows: init PACKAGE_VERSION
in windows, we set PACKAGE_VERSION to the binary version
since we don't have config.h as generated by linux configure
2011-05-24 12:29:13 +03:00
Yonit Halperin
04595c74ad client: fix flipped video in Linux guest on windows client, RHBZ #667689
Video streams from Linux guests are oriented top-down, where gdi_canvas_put_image always
received display context for down-top oriented bitmap. I fixed create_bitmap
to consider the stream orientation.
2011-05-19 14:07:57 +03:00
Alon Levy
f73a05021c client: fix return code when missing host 2011-05-12 12:56:04 +03:00
Hans de Goede
9a03fbcbe4 Release 0.8.1 2011-04-20 10:51:32 +02:00
Christophe Fergeau
e733aee0f2 client: skip spaces in --host-subject
This fixes fdo bug #32896:

"Subject in certificates is stored in following format (values separated by
comma and space):

grep Subject: server-cert.pem | awk -F": " '{print $2}'
O=REDHAT, CN=10.34.58.2

While spicec expects that values in host subject are separated only by comma:

spicec --host-subject "O=REDHAT,CN=10.34.58.2"
"

In this case, ignoring spaces make it much easier to directly copy and paste
the subject line from certificates.
2011-04-20 10:47:18 +02:00
Christophe Fergeau
1d61c0211e client: add --version cmdline option to spicec
This fixes freedesktop bug #33907
2011-04-20 10:45:14 +02:00
Christophe Fergeau
4bcb62f9a1 client: s/AVAILIBLE/AVAILABLE in CmdLineParser
It was mispelt in a CmdLineParser enum.
2011-04-20 10:45:10 +02:00
Hans de Goede
443994ba87 server: make sure we clear vdagent and update mouse mode on agent disconnect
The check this patch removes causes us to not set vdagent to NULL, nor
update the mouse mode when the guest agent disconnects when no client is
attached. Which leads to a non working mouse, and on agent reconnect a
"spice_server_char_device_add_interface: vdagent already attached" message
instead of a successful re-add of the agent interface .
2011-04-01 16:46:55 +02:00
Hans de Goede
620a02da31 server: ignore SPICE_MSGC_MAIN_AGENT_START messages when there is no agent
This can happen for example when a SPICE_MSGC_MAIN_AGENT_START message
from the client and the vdagent disconnecting race.
2011-04-01 16:45:50 +02:00
Hans de Goede
2df49c8a67 server: hookup agent-msg-filter discard-all functionality
This ensures that if the client or agent connects to the client-agent
"tunnel" while the other side is halfway through sending a multi part
message, the rest of the message gets discarded, and the connecting
party starts getting data at the beginning of the next message.
2011-04-01 16:31:37 +02:00
Hans de Goede
5d7cf4c002 server: add discard all option to agent message filter 2011-04-01 14:22:44 +02:00
Hans de Goede
1ec316e561 server: filter all data from client
Filter all data from client, even when there is no agent connected
to keep filter state correct.
2011-04-01 14:14:00 +02:00
Hans de Goede
add4bedb2f server: reset read/write filter on agent/client disconnect
The agent message filter keeps track of messages as they are being send
reset the relevant filter to its initial state when one of the 2 ends
of the agent<->client "tunnel" disconnects.
2011-04-01 14:08:56 +02:00
Hans de Goede
a19f51265c server: break read_from_vdi_port loop if the guest gets disconnected
read_from_vdi_port calls dispatch_vdi_port data, which will disconnect
the guest agent if it sends invalid data. It would then try to read more
data from the disconnected guest agent resulting in a NULL ptr dereference,
this patch fixes this.
2011-04-01 11:13:50 +02:00
Hans de Goede
7cc85f33be server: Don't stop writing agent data to the guest when the client disconnects
write_to_vdi_port() was checking for reds->agent_state.connected to determine
wether it could write queued data. But agent_state.connected reflects if
*both* ends are connected. If the client has disconnected, but the guest agent
is still connected and some data is still pending (like a final clipboard
release from the client), then this data should be written to the guest agent.
2011-04-01 11:13:50 +02:00
Hans de Goede
ef6886732e server: Don't reset agent state when the client disconnects
We were calling reds_reset_vdp on client disconnect, which is not a good
idea. reds_reset_vdp does 3 things:

1) It resets the state related to reading chunks from the spicevmc virtio
   port. If the client disconnects while the guest agent is in the middle
   of sending a chunk, this will lead to an inconsistent state, and lots
   of printing of "dispatch_vdi_port_data: invalid port" messages caused
   by this inconsistent state sometimes followed by a segfault.

   This can be triggered by copy and pasting something large (say
   a screenshot) from the guest to the spice-gtk client, as the spice-gtk
   client currently has a bug causing it to crash when receiving a multi
   chunk vdagent messages. Without this patch (and with the spice-gtk bug
   present) I can consistently reproduce this.

2) It clears any buffered writes from the client to the guest still pending
   because the virtio port cannot consume data fast enough. Since the agent
   itself is still running fine, throwing away writes for it because the
   client has disconnected makes no sense. Esp, since on clean exit the
   client may very well send a clipboard release message directly
   before closing the connection, and this may get lost this way.

3) It sets client_agent_started to false, this is the only thing which
   actually makes sense to do on client disconnect.

Note that since we no longer reset the vdp state on client disconnect, we
must now reset it on agent disconnect even if we don't have a client. So
the reds_reset_vdp call in reds_agent_remove() gets moved to the top,
above both the agent_state.connected and reds->peer checks which will
both fail in the no client case.
2011-04-01 11:13:46 +02:00
Hans de Goede
302ab69f5b server: Make copy paste support configurable
Also bump SPICE_SERVER_VERSION to 0x000801 as 0.8.1 will be the
first version with the new API for this, and we need to be able to
detect the presence of this API in qemu.
2011-03-24 17:24:31 +01:00
Hans de Goede
0417117417 spice-server: Add the ability to filter agent messages 2011-03-24 17:24:31 +01:00
Hans de Goede
6696914bd9 spicec-x11: Work around a bug in xsel
Although ICCCM 2.2. Responsibilities of the Selection Owner:
http://tronche.com/gui/x/icccm/sec-2.html#s-2.2

Clearly states (about selection notify events):
The owner should set the specified selection, target, time, and property
arguments to the values received in the SelectionRequest event.

xsel sets the selection notify event target member to the incr atom when it
is going to send the clipboard data incremental, rather then setting it to
the UTF8_STRING atom (which was the target of the SelectionRequest).

Work around this (esp as it is likely other programs may get this wrong too)
and accept the incr atom as a valid target in a selection notify event.

This fixes Alon's test with running:
python -c "print list(range(1000))" | xsel -i -b
on the client.
2011-03-23 17:50:05 +01:00
Hans de Goede
69067b14e0 spicec-x11: Don't crash on apps sending bad atoms as TARGETS
Some apps (bad xsel, bad!) send invalid Atoms in their TARGETS property,
causing spicec to exit because of an XError. This patch makes spicec survive
this scenario.

For more info on the xsel bug, see:
https://bugzilla.redhat.com/show_bug.cgi?id=690214
2011-03-23 17:49:57 +01:00
Hans de Goede
b30f8b877c client: Don't handle hotkeys while sticky alt is active
In some cases rhev-m changes the hotkey for releasing the mouse grab
to ctrl + alt. This makes it impossible to send ctrl + alt + other-key
to the guest, even when using sticky alt.

What happens is:
-press alt until sticky alt activates
-release alt (but recorded state stays pressed due to sticky alt)
-press ctrl
-hotkey code sees ctrl+alt pressed, releases mouse grab
-mouse grab release code does an unpress all -> end of sticky state.

This patch makes it possible to atleast send ctrl + alt + del (or other key)
using sticky alt. Note: even with this patch it is still a bad idea to
use ctrl + alt as hotkey combi.
2011-03-11 15:31:27 +01:00
Alon Levy
5315888a70 server/reds: allow call to reds_agent_remove even if it is gone
The current assert(reds->agent_state.connected) tiggers if when
the agent disconnected there was still data waiting to be sent (for
instance if there is a bug in the client handling clipboard and it
is killed while a large clipboard transfer is in progress). So first
call to reds_agent_remove happens from spice_server_char_device_remove_interface,
and then it is called again (triggering the assert) from free_item_data
from read_from_vdi_port because of the channel destruction.

Other option would be to not call it from one of the paths - but that
is suboptimal:
 * if there is no data in the pipe, the second call never happens.
 * the second call has to be there anyway, because it may fail during
  parsing data from the agent.

This patch fixes a segfault on this assert when a client starts passing
from guest agent to client a large clipboard and dies in the middle. There
is still another assert happening occasionally at marshaller which I don't
have a fix for (but it doesn't seem to be related).
2011-03-08 21:49:21 +02:00
Alon Levy
e1ec222e8b client/smartcard: handle the --smartcard-db option 2011-03-08 21:19:23 +02:00
Hans de Goede
7fd8b7c971 Release 0.8.0 2011-03-01 19:40:36 +02:00
Hans de Goede
1a20edffed x11: Use _exit rather then exit on X errors (rhbz#680763)
This avoids us trying to restore the original resolution when we're fullscreen
and an X error happens. As restoring fullscreen is a bad idea then as this
involves making more X calls, which can get us stuck (in side an XLockDisplay
call for example).
2011-03-01 19:40:36 +02:00
Uri Lublin
eda812f0d7 client: exit nicely for --controller with no SPICE_XPI_SOCKET (rhbz#644292)
When starting spicec with --controller, SPICE_XPI_SOCKET environment
variable must be defined so spicec and the controller can be connected.
2011-03-01 19:40:36 +02:00
Hans de Goede
a0996e0f70 Fix keyb modifiers not syncing from client to client os (rhbz#679467) 2011-03-01 19:40:36 +02:00
Gerd Hoffmann
aa827c5b99 fix spice-server segfault on migration
spice-server tries to use the migration information without checking
whenever this is available in the first place ...

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2011-02-15 11:24:28 +01:00
Hans de Goede
822fea8b32 Release 0.7.3 2011-02-11 15:37:54 +01:00
Hans de Goede
f173a38de7 Drop static_title.bmp from windows/Makefile.am 2011-02-11 15:37:54 +01:00
Alon Levy
09d843ccb6 update required minimal libcacard to 0.1.2 2011-02-10 10:35:04 +02:00
Alon Levy
f94d08cf3f client/smartcard: libcacard dropped ReaderAddResponse
uses VSC_Error with code==VSC_SUCCESS instead. This means that the VSC_Error
message is overloaded. Instead of the other option of adding a message id,
since the connection is TCP so no messages may be dropped or reordered, by
having each message followed by a response there is no ambiguity. Still
this commit adds a queue for messages that we only have one of which outstanding
at a time, i.e. send, wait for response, send the next, etc. This further
simplifies the logic, while not adding much overhead since only when spicec
starts up it has a situation where it needs to send two events (ReaderAdd
and ATR for Card Insert).
2011-02-10 10:34:58 +02:00
Alon Levy
5ed4050992 server/smartcard: don't push our own error on reader add
The device already sends one. There are actually two connections going
on:
 server to client - this is the smartcard channel, it reuses the VSC protocol.
 server to device - this is an internal connection using VSC too.

We generally just passthrough all messages from the client to the device,
and from the device to the client. We only rewrite the reader_id because
the device knows about a single id (it is actually a card id), and we
may manage more then one in the future.

Bottom line is that there was an extra VSC_Error message reaching the client.
2011-02-10 10:34:53 +02:00
Alon Levy
17ba06da2c client/smartcard: ignore VSC_Init 2011-02-10 10:34:47 +02:00
Alon Levy
0d6550ed60 server/smartcard: ignore VSC_Init from client 2011-02-10 10:34:42 +02:00
Alon Levy
21d1ec600b server/smartcard: print instead of assert on bad reader_id in smartcard_char_device_on_message_from_device 2011-02-10 10:34:37 +02:00
Alon Levy
b05c744f4a server/smartcard: libcacard uses network byte order, so we must too 2011-02-10 10:34:32 +02:00
Alon Levy
d7cf75f68c client/smartcard: s/reader_id_t/uint32_t/ (libcacard changed) 2011-02-10 10:34:26 +02:00
Alon Levy
ed5e2fc942 server/smartcard: libcacard removed ReaderAddResponse 2011-02-10 10:34:16 +02:00
Alon Levy
efa3704dbc server/smartcard: s/reader_id_t/uint32_t/ (libcacard changed) 2011-02-10 10:20:49 +02:00
Alon Levy
9de4c94a5d server/red_worker: fix used but uninitialized warning (gcc 4.6.0) 2011-02-07 18:51:50 +02:00
Hans de Goede
504306681c spicec: Remove spice-client watermark (rhbz#662450)
This patch stops us from drawing the spice client watermark at the top of
the virtual machine view. We have had requests through several channels to
remove this as it has little added value, and is seen as annoying by some.
Given that we now also have a bugzilla for this I think it is time we really
remove it.
(cherry picked from commit 392ed65dda)
2011-02-02 10:15:04 +02:00
Uri Lublin
fd4ee559a3 spice-client migration: fix minor for old migration support.
For not too old spice-migration, minor is 1.
For older (ancient) spice-migration, minor is 0.

Affects only VM migration while a spice client is connected.
2011-01-27 18:31:56 +02:00
Alon Levy
7b4e4f278a client/windows: don't allocate console unless required 2011-01-27 17:24:01 +02:00
Alon Levy
fe3b3d3937 client: fix broken vs2008 build 2011-01-27 17:23:56 +02:00
Alon Levy
bfdd2371f8 client: --help should not need platform initialization
separate initialization into before command line parsing and after,
call later only if command line parsing succeeds (in particular, it
"fails" if --help is given).
2011-01-27 17:23:51 +02:00
Alon Levy
3615be639b demarshaller/marshaller fix gcc 4.6.0
python_modules/demarshal.py and marshal.py fixes for gcc 4.6.0
warning about set but unused variables. The fixes disable creating
of variables mem_size when they are not used (demarshall) and
declaring a src variable when the message doesn't use it (marshal).

You need to touch *.proto after applying this (should add a Makefile
dependency).
2011-01-27 12:49:11 +02:00
Alon Levy
f414992e9b codegen: avoid creating out if not used (fix gcc 4.6.0 warning) 2011-01-27 12:49:00 +02:00
Alon Levy
c89c708888 client: gcc 4.6.0: two more unused variable fixes 2011-01-27 12:48:53 +02:00