> > From: Jonathon Jongsma <jjongsma@xxxxxxxxxx> > > Removing more global variables > --- > server/reds-private.h | 2 ++ > server/reds.c | 20 +++++++++----------- > 2 files changed, 11 insertions(+), 11 deletions(-) > > diff --git a/server/reds-private.h b/server/reds-private.h > index 6d36065..c1ecac1 100644 > --- a/server/reds-private.h > +++ b/server/reds-private.h > @@ -205,6 +205,8 @@ struct RedsState { > int spice_listen_socket_fd; > char spice_addr[256]; > int spice_family; > + TicketAuthentication taTicket; > + > }; > > #endif > diff --git a/server/reds.c b/server/reds.c > index d346b1b..7f5532d 100644 > --- a/server/reds.c > +++ b/server/reds.c > @@ -143,8 +143,6 @@ static SpiceCoreInterfaceInternal core_interface_adapter > = { > #define REDS_TOKENS_TO_SEND 5 > #define REDS_VDI_PORT_NUM_RECEIVE_BUFFS 5 > > -static TicketAuthentication taTicket; > - > static int sasl_enabled = 0; // sasl disabled by default > #if HAVE_SASL > static char *sasl_appname = NULL; // default to "spice" if NULL > @@ -1950,15 +1948,15 @@ static void reds_handle_ticket(void *opaque) > password[password_size] = '\0'; > > if (ticketing_enabled && !link->skip_auth) { > - int expired = taTicket.expiration_time < ltime; > + int expired = reds->taTicket.expiration_time < ltime; > > - if (strlen(taTicket.password) == 0) { > + if (strlen(reds->taTicket.password) == 0) { > spice_warning("Ticketing is enabled, but no password is set. " > "please set a ticket first"); > goto error; > } > > - if (expired || strcmp(password, taTicket.password) != 0) { > + if (expired || strcmp(password, reds->taTicket.password) != 0) { > if (expired) { > spice_warning("Ticket has expired"); > } else { > @@ -3558,7 +3556,7 @@ SPICE_GNUC_VISIBLE int > spice_server_set_exit_on_disconnect(SpiceServer *s, int f > SPICE_GNUC_VISIBLE int spice_server_set_noauth(SpiceServer *s) > { > spice_assert(reds == s); > - memset(taTicket.password, 0, sizeof(taTicket.password)); > + memset(s->taTicket.password, 0, sizeof(s->taTicket.password)); > ticketing_enabled = 0; > return 0; > } > @@ -3615,18 +3613,18 @@ SPICE_GNUC_VISIBLE int > spice_server_set_ticket(SpiceServer *reds, > on_activating_ticketing(reds); > ticketing_enabled = 1; > if (lifetime == 0) { > - taTicket.expiration_time = INT_MAX; > + reds->taTicket.expiration_time = INT_MAX; > } else { > time_t now = time(NULL); > - taTicket.expiration_time = now + lifetime; > + reds->taTicket.expiration_time = now + lifetime; > } > if (passwd != NULL) { > if (strlen(passwd) > SPICE_MAX_PASSWORD_LENGTH) > return -1; > - g_strlcpy(taTicket.password, passwd, sizeof(taTicket.password)); > + g_strlcpy(reds->taTicket.password, passwd, > sizeof(reds->taTicket.password)); > } else { > - memset(taTicket.password, 0, sizeof(taTicket.password)); > - taTicket.expiration_time = 0; > + memset(reds->taTicket.password, 0, sizeof(reds->taTicket.password)); > + reds->taTicket.expiration_time = 0; > } > return 0; > } Acked-by: Frediano Ziglio <fziglio@xxxxxxxxxx> Frediano _______________________________________________ Spice-devel mailing list Spice-devel@xxxxxxxxxxxxxxxxxxxxx http://lists.freedesktop.org/mailman/listinfo/spice-devel