[Spice-devel] [spice-server v3 1/2] utils: Introduce helpers to map channel types to names

Christophe Fergeau cfergeau at redhat.com
Mon Oct 23 16:34:00 UTC 2017


On Fri, Oct 20, 2017 at 06:05:27AM -0400, Frediano Ziglio wrote:
> > diff --git a/server/reds.c b/server/reds.c
> > index 4af804065..de5f4461c 100644
> > --- a/server/reds.c
> > +++ b/server/reds.c
> > @@ -3983,32 +3983,23 @@ SPICE_GNUC_VISIBLE int
> > spice_server_set_zlib_glz_compression(SpiceServer *s, spi
> >  
> >  SPICE_GNUC_VISIBLE int spice_server_set_channel_security(SpiceServer *s,
> >  const char *channel, int security)
> >  {
> > -    static const char *const names[] = {
> > -        [ SPICE_CHANNEL_MAIN     ] = "main",
> > -        [ SPICE_CHANNEL_DISPLAY  ] = "display",
> > -        [ SPICE_CHANNEL_INPUTS   ] = "inputs",
> > -        [ SPICE_CHANNEL_CURSOR   ] = "cursor",
> > -        [ SPICE_CHANNEL_PLAYBACK ] = "playback",
> > -        [ SPICE_CHANNEL_RECORD   ] = "record",
> > -#ifdef USE_SMARTCARD
> > -        [ SPICE_CHANNEL_SMARTCARD] = "smartcard",
> > -#endif
> > -        [ SPICE_CHANNEL_USBREDIR ] = "usbredir",
> > -        [ SPICE_CHANNEL_WEBDAV ] = "webdav",
> > -    };
> > -    int i;
> > -
> > +    int type;
> >      if (channel == NULL) {
> >          s->config->default_channel_security = security;
> >          return 0;
> >      }
> > -    for (i = 0; i < SPICE_N_ELEMENTS(names); i++) {
> > -        if (names[i] && strcmp(names[i], channel) == 0) {
> > -            reds_set_one_channel_security(s, i, security);
> > -            return 0;
> > -        }
> > +    type = red_channel_name_to_type(channel);
> > +#ifndef USE_SMARTCARD
> > +    if (type == SPICE_CHANNEL_SMARTCARD) {
> > +        type = -1;
> >      }
> > -    return -1;
> > +#endif
> 
> I personally would accept just even the smartcard, maybe adding a commit
> in the commit log. The only functional change to this would be accepting
> "smartcard" setting even if disabled but won't be used.


> 
> Maybe a follow up.

As said before, I'd rather just deprecate the whole functionality, so I
prefer not to change its behaviour at all. So I'd keep that as a
follow-up.

Christophe
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/spice-devel/attachments/20171023/4bfa03ca/attachment.sig>


More information about the Spice-devel mailing list