[Spice-devel] [PATCH 1/2] server/smartcard: handle BaseChannel messages

Alon Levy alevy at redhat.com
Thu Jun 23 04:16:38 PDT 2011


On Thu, Jun 23, 2011 at 12:10:31PM +0200, Christophe Fergeau wrote:
> On Thu, Jun 23, 2011 at 11:16:47AM +0200, Alon Levy wrote:
> > 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.
> > ---
> >  server/smartcard.c |    6 ++++++
> >  1 files changed, 6 insertions(+), 0 deletions(-)
> > 
> > diff --git a/server/smartcard.c b/server/smartcard.c
> > index 888b23a..f948e5b 100644
> > --- a/server/smartcard.c
> > +++ b/server/smartcard.c
> > @@ -454,6 +454,12 @@ static int smartcard_channel_handle_message(RedChannel *channel, SpiceDataHeader
> >      VSCMsgHeader* vheader = (VSCMsgHeader*)msg;
> >      SmartCardChannel* smartcard_channel = (SmartCardChannel*)channel;
> >  
> > +    if (header->type != SPICE_MSGC_SMARTCARD_DATA) {
> > +        /* handle ack's, spicy sends them while spicec does not */
> > +        return red_channel_handle_message(channel, header->size, header->type,
> > +                                          msg);
> > +    }
> > +
> 
> I couldn't figure out how other channels handle this, so ACK

inputs channel doesn't handle these, they are also not sent apparently (but it
doesn't assert on unexpected messages either)

display and cursor uses red_channel_handle_message (git grep
red_channel_handle_message), so does tunnel.

playback and record channels don't have these messages at all. (git grep MSGC_ACK,
only red_channel handles this messsage now, which was intended, since it's a common
message defined in BaseChannel in spice.proto and spice1.proto).

> 
> >      ASSERT(header->size == vheader->length + sizeof(VSCMsgHeader));
> 
> There shouldn't be an ASSERT here though, since as far as I can tell, these
> values come directly from the network, so specially crafted messages could
> use this assert to take down QEMU.
Right, I'll make a patch for that.

> 
> Christophe




More information about the Spice-devel mailing list