mirror of
https://gitlab.uni-freiburg.de/opensourcevdi/spice
synced 2026-08-07 12:36:46 +00:00
reds: Do not get time if not needed
Signed-off-by: Frediano Ziglio <fziglio@redhat.com> Acked-by: Christophe Fergeau <cfergeau@redhat.com>
This commit is contained in:
parent
d57b61a584
commit
cb1211a6ca
@ -2036,11 +2036,8 @@ static void reds_handle_ticket(void *opaque)
|
||||
RedLinkInfo *link = (RedLinkInfo *)opaque;
|
||||
RedsState *reds = link->reds;
|
||||
char *password;
|
||||
time_t ltime;
|
||||
int password_size;
|
||||
|
||||
//todo: use monotonic time
|
||||
time(<ime);
|
||||
if (RSA_size(link->tiTicketing.rsa) < SPICE_MAX_PASSWORD_LENGTH) {
|
||||
spice_warning("RSA modulus size is smaller than SPICE_MAX_PASSWORD_LENGTH (%d < %d), "
|
||||
"SPICE ticket sent from client may be truncated",
|
||||
@ -2061,7 +2058,8 @@ static void reds_handle_ticket(void *opaque)
|
||||
password[password_size] = '\0';
|
||||
|
||||
if (reds->config->ticketing_enabled && !link->skip_auth) {
|
||||
int expired = reds->config->taTicket.expiration_time < ltime;
|
||||
time_t ltime;
|
||||
bool expired;
|
||||
|
||||
if (strlen(reds->config->taTicket.password) == 0) {
|
||||
spice_warning("Ticketing is enabled, but no password is set. "
|
||||
@ -2069,6 +2067,10 @@ static void reds_handle_ticket(void *opaque)
|
||||
goto error;
|
||||
}
|
||||
|
||||
//todo: use monotonic time
|
||||
time(<ime);
|
||||
expired = (reds->config->taTicket.expiration_time < ltime);
|
||||
|
||||
if (expired) {
|
||||
spice_warning("Ticket has expired");
|
||||
goto error;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user