[Spice-devel] [PATCH spice-server 2/2] reds: Use monotonic time for ticket expiration
Frediano Ziglio
fziglio at redhat.com
Thu Oct 18 14:19:14 UTC 2018
ping
>
> Avoid time adjustment issues.
> For instance ticket validity can change when daylight time changes.
>
> Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
> ---
> server/reds.c | 5 ++---
> 1 file changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/server/reds.c b/server/reds.c
> index bff5b68e..727c3a14 100644
> --- a/server/reds.c
> +++ b/server/reds.c
> @@ -2099,8 +2099,7 @@ static void reds_handle_ticket(void *opaque)
> goto error;
> }
>
> - //todo: use monotonic time
> - time(<ime);
> + ltime = spice_get_monotonic_time_ns() / NSEC_PER_SEC;
> expired = (reds->config->taTicket.expiration_time < ltime);
>
> if (expired) {
> @@ -3833,7 +3832,7 @@ SPICE_GNUC_VISIBLE int
> spice_server_set_ticket(SpiceServer *reds,
> if (lifetime == 0) {
> reds->config->taTicket.expiration_time = INT_MAX;
> } else {
> - time_t now = time(NULL);
> + time_t now = spice_get_monotonic_time_ns() / NSEC_PER_SEC;
> reds->config->taTicket.expiration_time = now + lifetime;
> }
> if (passwd != NULL) {
Frediano
More information about the Spice-devel
mailing list