[PATCH spice-server] reds: Do not get time if not needed

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

 



Signed-off-by: Frediano Ziglio <fziglio@xxxxxxxxxx>
---
 server/reds.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/server/reds.c b/server/reds.c
index 2b43bc0d..8bda85c7 100644
--- a/server/reds.c
+++ b/server/reds.c
@@ -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(&ltime);
     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(&ltime);
+        expired =  reds->config->taTicket.expiration_time < ltime;
+
         if (expired) {
             spice_warning("Ticket has expired");
             goto error;
-- 
2.14.3

_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
https://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]