help-gsasl
[Top][All Lists]
Advanced

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

Re: [PATCH] Fix SASL operations through TLS


From: Simon Josefsson
Subject: Re: [PATCH] Fix SASL operations through TLS
Date: Tue, 01 Jul 2008 15:39:01 +0200
User-agent: Gnus/5.110011 (No Gnus v0.11) Emacs/22.2 (gnu/linux)

Hi Enrico!  Many thanks for the report.  The patch looks correct to me.
Applied and pushed.

Regards,
Simon

Enrico Scholz <address@hidden> writes:

> SASL operations through TLS do not work as the custom 'writeln()'
> operation would skip the gnutls_record_send() call unconditionally
> ('len' is initialized to 0 and won't be modified).
>
> This patch initializes 'len' with the length of the string and
> reuses this value in the following send/write calls.
>
> Signed-off-by: Enrico Scholz <address@hidden>
> ---
>  src/gsasl.c |    6 +++---
>  1 files changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/src/gsasl.c b/src/gsasl.c
> index c0a2620..619964c 100644
> --- a/src/gsasl.c
> +++ b/src/gsasl.c
> @@ -45,7 +45,7 @@ writeln (const char *str)
>  
>    if (sockfd)
>      {
> -      ssize_t len = 0;
> +      ssize_t len = strlen (str);
>  
>  #ifdef HAVE_LIBGNUTLS
>        if (using_tls)
> @@ -53,13 +53,13 @@ writeln (const char *str)
>         /* GnuTLS < 1.2.9 cannot handle data != NULL && count == 0,
>            it will return an error. */
>         if (len > 0)
> -         len = gnutls_record_send (session, str, strlen (str));
> +         len = gnutls_record_send (session, str, len);
>         else
>           len = 0;
>       }
>        else
>  #endif
> -     len = write (sockfd, str, strlen (str));
> +     len = write (sockfd, str, len);
>        if (len != strlen (str))
>       return 0;
>  
> -- 
> 1.5.5.1




reply via email to

[Prev in Thread] Current Thread [Next in Thread]