[Spice-devel] [PATCH 4/9] Move ticket decryption to helper function

Marc-André Lureau mlureau at redhat.com
Wed Mar 12 12:19:22 PDT 2014


ack

----- Original Message -----
> ---
>  server/reds.c | 23 +++++++++++++++++------
>  1 file changed, 17 insertions(+), 6 deletions(-)
> 
> diff --git a/server/reds.c b/server/reds.c
> index 19a3298..f45092b 100644
> --- a/server/reds.c
> +++ b/server/reds.c
> @@ -1843,15 +1843,11 @@ static void reds_handle_link(RedLinkInfo *link)
>      }
>  }
>  
> -static void reds_handle_ticket(void *opaque)
> +static char *reds_get_ticket(RedLinkInfo *link)
>  {
> -    RedLinkInfo *link = (RedLinkInfo *)opaque;
>      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",
> @@ -1867,10 +1863,25 @@ static void reds_handle_ticket(void *opaque)
>      if (password_size == -1) {
>          spice_warning("failed to decrypt RSA encrypted password: %s",
>                        ERR_error_string(ERR_get_error(), NULL));
> -        goto error;
> +        return NULL;
>      }
>      password[password_size] = '\0';
>  
> +    return password;
> +}
> +
> +
> +static void reds_handle_ticket(void *opaque)
> +{
> +    RedLinkInfo *link = (RedLinkInfo *)opaque;
> +    char *password;
> +    time_t ltime;
> +
> +    //todo: use monotonic time
> +    time(&ltime);
> +
> +    password = reds_get_ticket(link);
> +
>      if (ticketing_enabled && !link->skip_auth) {
>          int expired =  taTicket.expiration_time < ltime;
>  
> --
> 1.8.5.3
> 
> _______________________________________________
> Spice-devel mailing list
> Spice-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/spice-devel
> 


More information about the Spice-devel mailing list