smartcard passthrough can't handle multiple sessions in the same process
@teuf
Submitted by Christophe Fergau Fergau Assigned to Spice Bug List
Description
11:55 `< hansg>` teuf, I'm currently re-doing some of the usb-device-manager
stuff. One of the things I got wrong is that I didn't keep in
mind that one process can have multiple sessions open (think
vinagre with 2 spice tabs)
11:57 `< hansg>` teuf, it seems you've made the same mistake with the
smartcard stuff.
11:58 `< hansg>` Hmm, never mind, it seems all transfer to / from the reader
happen by: vreader_xfr_bytes, so as long as the 2 sessions
are handled by the same thread, all should be will I think
12:00 `< hansg>` One problem could be the use of vreader_set_id, actually
looking at the code, this will trigger for a second session:
g_return_if_fail(vreader_get_id(reader) == -1);
12:01 `< hansg>` I guess the mapping of ids -> readers should be moved to
channel-smartcard.c instead of relying on the mapping inside
libcacard (assuming that the id is only used for mapping and
not for other uses inside libcacard)
12:03 -!- yonit [~yhalperi@nat-pool-tlv-t1.redhat.com] has quit [Leaving]
12:04 `< teuf>` hansg: I definitely haven't thought at all about multiple
widget instances in the same process while doing the smartcard
stuff
12:05 `< hansg>` teuf, yeah I know that feeling :)
12:05 `< teuf>` :)
12:05 `< hansg>` Note multiple widgets (aka SpiceDisplay) != multiple sessions
12:05 `< hansg>` One session can have multiple widgets (think multi monitor)
12:05 `< teuf>` ah yup
12:06 -!- yonit [~yhalperi@nat-pool-tlv-t1.redhat.com] has joined #spice
12:07 `< hansg>` Luckily for the smartcard stuff the widget does not seem to
do to much, actually the only thing it does is do a
spice_channel_connect() on the smartcard channel. So with a
multi mon setup this will happen multiple times, but
spice-channel.c protects against this
12:12 -!- alon [~alon@85.64.131.212.dynamic.barak-online.net] has quit [Read
error: 145 (Connection timed out)]
12:13 `< hansg>` Hmm, channel-smartcard.c will try to send messages on
smartcard reader detection even if the channel is not
connected (think an app using spice-client-glib but not
spice-client-gtk)
Edited by Marc-André Lureau