Re: [PATCH spice-gtk] smartcard: add reader and cards on channel up

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> 
> Looks like this patchset broke the build with smartcard support
> disabled.
> 

Sorry about that, I'm sending a patch.

Thanks for reporting

Pavel

> 
> 
> On Wed, 2015-03-25 at 06:28 -0400, Pavel Grunt wrote:
> > Hi, it looks good, ACK.
> > 
> > I tested it in rhel6.7 using the "smartcard emulation".
> > For spice-gtk v0.26 I "needed" commit
> > 2a72a2c665d4d6ecd9861377f7dfb6223cf31c47.
> > 
> > Thanks,
> > 
> > Pavel
> > 
> > > 
> > > The smartcard manager reports reader/card events on insertion and
> > > removal. If a smartcard channel is created after those events,
> > > the
> > > channel state will not be in sync with the current reader/card
> > > state.
> > > Sync the state when the channel is up.
> > > 
> > > Fixes:
> > > https://bugzilla.redhat.com/show_bug.cgi?id=1205171
> > > ---
> > >  gtk/channel-smartcard.c | 24 +++++++++++++++++++++++-
> > >  1 file changed, 23 insertions(+), 1 deletion(-)
> > > 
> > > diff --git a/gtk/channel-smartcard.c b/gtk/channel-smartcard.c
> > > index cc3ae3b..0ab7213 100644
> > > --- a/gtk/channel-smartcard.c
> > > +++ b/gtk/channel-smartcard.c
> > > @@ -400,6 +400,10 @@ static void
> > > reader_added_cb(SpiceSmartcardManager *manager, VReader *reader,
> > >      SpiceSmartcardChannel *channel =
> > >      SPICE_SMARTCARD_CHANNEL(user_data);
> > >      const char *reader_name = vreader_get_name(reader);
> > >  
> > > +    if (vreader_get_id(reader) != -1 ||
> > > +        g_list_find(channel->priv->pending_reader_additions,
> > > reader))
> > > +        return;
> > > +
> > >      channel->priv->pending_reader_additions =
> > >          g_list_append(channel->priv->pending_reader_additions,
> > >          reader);
> > >  
> > > @@ -452,6 +456,8 @@ static void
> > > spice_smartcard_channel_up_cb(GObject
> > > *source_object,
> > >                                            gpointer user_data)
> > >  {
> > >      SpiceChannel *channel = SPICE_CHANNEL(user_data);
> > > +    SpiceSmartcardManager *manager =
> > > spice_smartcard_manager_get();
> > > +    GList *l, *list = NULL;
> > >      GError *error = NULL;
> > >  
> > >      g_return_if_fail(channel != NULL);
> > > @@ -459,9 +465,25 @@ static void
> > > spice_smartcard_channel_up_cb(GObject *source_object,
> > >  
> > >      spice_smartcard_manager_init_finish(SPICE_SESSION(source_object),
> > >                                          res, &error);
> > > -    if (error)
> > > +    if (error) {
> > >          g_warning("%s", error->message);
> > > +        goto end;
> > > +    }
> > > +
> > > +    list = spice_smartcard_manager_get_readers(manager);
> > > +    for (l = list; l != NULL; l = l->next) {
> > > +        VReader *reader = l->data;
> > > +        gboolean has_card = vreader_card_is_present(reader) ==
> > > VREADER_OK;
> > > +
> > > +        reader_added_cb(manager, reader, channel);
> > > +        if (has_card)
> > > +            card_inserted_cb(manager, reader, channel);
> > > +
> > > +        g_boxed_free(SPICE_TYPE_SMARTCARD_READER, reader);
> > > +    }
> > >  
> > > +end:
> > > +    g_list_free(list);
> > >      g_clear_error(&error);
> > >  }
> > >  
> > > --
> > > 2.1.0
> > > 
> > > 
> > _______________________________________________
> > Spice-devel mailing list
> > Spice-devel@xxxxxxxxxxxxxxxxxxxxx
> > http://lists.freedesktop.org/mailman/listinfo/spice-devel
> 
> 
> 
_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/spice-devel





[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]