[Spice-commits] server/reds.c

Frediano Ziglio fziglio at kemper.freedesktop.org
Wed Nov 22 14:00:10 UTC 2017


 server/reds.c |   10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

New commits:
commit cb1211a6cae7b0e80d0039bf3dea0c26c70d570f
Author: Frediano Ziglio <fziglio at redhat.com>
Date:   Wed Nov 22 11:53:33 2017 +0000

    reds: Do not get time if not needed
    
    Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
    Acked-by: Christophe Fergeau <cfergeau at redhat.com>

diff --git a/server/reds.c b/server/reds.c
index ebcbe496..26789959 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;


More information about the Spice-commits mailing list