bug-wget
[Top][All Lists]
Advanced

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

Re: [Bug-wget] [PATCH] utils: rename base64_{encode,decode}


From: Tim Ruehsen
Subject: Re: [Bug-wget] [PATCH] utils: rename base64_{encode,decode}
Date: Wed, 14 Dec 2016 16:01:10 +0100
User-agent: KMail/5.2.3 (Linux/4.8.0-2-amd64; KDE/5.28.0; x86_64; ; )

Thanks, pushed as 'trivial patch', so no FSF Copyright Assignment needed.

BTW, GnuTLS normally only exports gnutls_* stuff.
You must have some unsupported compiler/linker combination ;-)

Regards, Tim

On Wednesday, December 14, 2016 6:10:22 PM CET Rahul Bedarkar wrote:
> When statically linking with gnutls, we get definition clash error for
> base64_encode which is also defined by gnutls.
> 
> /home/rahul.bedarkar/buildroot/output/host/usr/arm-buildroot-linux-uclibcgnu
> eabi/sysroot/usr/lib/libgnutls.a(base64.o): In function `base64_encode':
> base64.c:(.text+0x148): multiple definition of `base64_encode'
> utils.o:utils.c:(.text+0x4378): first defined here
> collect2: error: ld returned 1 exit status
> 
> To prevent definition clash, rename base64_{encode,decode}
> 
> Signed-off-by: Rahul Bedarkar <address@hidden>
> ---
>  src/http-ntlm.c | 6 +++---
>  src/http.c      | 4 ++--
>  src/utils.c     | 8 ++++----
>  src/utils.h     | 4 ++--
>  4 files changed, 11 insertions(+), 11 deletions(-)
> 
> diff --git a/src/http-ntlm.c b/src/http-ntlm.c
> index 56c40ae..87f5a37 100644
> --- a/src/http-ntlm.c
> +++ b/src/http-ntlm.c
> @@ -122,7 +122,7 @@ ntlm_input (struct ntlmdata *ntlm, const char *header)
> 
>        DEBUGP (("Received a type-2 NTLM message.\n"));
> 
> -      size = base64_decode (header, buffer);
> +      size = wget_base64_decode (header, buffer);
>        if (size < 0)
>          return false;           /* malformed base64 from server */
> 
> @@ -411,7 +411,7 @@ ntlm_output (struct ntlmdata *ntlm, const char *user,
> const char *passwd, size = 32 + hostlen + domlen;
> 
>      base64 = (char *) alloca (BASE64_LENGTH (size) + 1);
> -    base64_encode (ntlmbuf, size, base64);
> +    wget_base64_encode (ntlmbuf, size, base64);
> 
>      output = concat_strings ("NTLM ", base64, (char *) 0);
>      break;
> @@ -584,7 +584,7 @@ ntlm_output (struct ntlmdata *ntlm, const char *user,
> const char *passwd,
> 
>      /* convert the binary blob into base64 */
>      base64 = (char *) alloca (BASE64_LENGTH (size) + 1);
> -    base64_encode (ntlmbuf, size, base64);
> +    wget_base64_encode (ntlmbuf, size, base64);
> 
>      output = concat_strings ("NTLM ", base64, (char *) 0);
> 
> diff --git a/src/http.c b/src/http.c
> index 67b3686..289be99 100644
> --- a/src/http.c
> +++ b/src/http.c
> @@ -2977,7 +2977,7 @@ skip_content_type:
>            char *bin_hash = alloca (dig_hash_str_len * 3 / 4 + 1);
>            ssize_t hash_bin_len;
> 
> -          hash_bin_len = base64_decode (dig_hash, bin_hash);
> +          hash_bin_len = wget_base64_decode (dig_hash, bin_hash);
> 
>            /* Detect malformed base64 input.  */
>            if (hash_bin_len < 0)
> @@ -4730,7 +4730,7 @@ basic_authentication_encode (const char *user, const
> char *passwd) sprintf (t1, "%s:%s", user, passwd);
> 
>    t2 = (char *)alloca (BASE64_LENGTH (len1) + 1);
> -  base64_encode (t1, len1, t2);
> +  wget_base64_encode (t1, len1, t2);
> 
>    return concat_strings ("Basic ", t2, (char *) 0);
>  }
> diff --git a/src/utils.c b/src/utils.c
> index dcf90a6..3928e9d 100644
> --- a/src/utils.c
> +++ b/src/utils.c
> @@ -2149,7 +2149,7 @@ xsleep (double seconds)
>     base64 data.  */
> 
>  size_t
> -base64_encode (const void *data, size_t length, char *dest)
> +wget_base64_encode (const void *data, size_t length, char *dest)
>  {
>    /* Conversion table.  */
>    static const char tbl[64] = {
> @@ -2217,7 +2217,7 @@ base64_encode (const void *data, size_t length, char
> *dest) This function originates from Free Recode.  */
> 
>  ssize_t
> -base64_decode (const char *base64, void *dest)
> +wget_base64_decode (const char *base64, void *dest)
>  {
>    /* Table of base64 values for first 128 characters.  Note that this
>       assumes ASCII (but so does Wget in other places).  */
> @@ -2597,7 +2597,7 @@ wg_pubkey_pem_to_der (const char *pem, unsigned char
> **der, size_t *der_len)
> 
>    base64data = xmalloc (BASE64_LENGTH(stripped_pem_count));
> 
> -  size = base64_decode (stripped_pem, base64data);
> +  size = wget_base64_decode (stripped_pem, base64data);
> 
>    if (size < 0) {
>      xfree (base64data);           /* malformed base64 from server */
> @@ -2660,7 +2660,7 @@ wg_pin_peer_pubkey (const char *pinnedpubkey, const
> char *pubkey, size_t pubkeyl end_pos[0] = '\0';
> 
>          /* decode base64 pinnedpubkey, 8 is length of "sha256//" */
> -        decoded_hash_length = base64_decode (begin_pos + 8,
> expectedsha256sumdigest); +        decoded_hash_length = wget_base64_decode
> (begin_pos + 8, expectedsha256sumdigest); /* if valid base64, compare
> sha256 digests directly */
>          if (SHA256_DIGEST_SIZE == decoded_hash_length &&
>             !memcmp (sha256sumdigest, expectedsha256sumdigest,
> SHA256_DIGEST_SIZE)) { diff --git a/src/utils.h b/src/utils.h
> index f224b73..aaac730 100644
> --- a/src/utils.h
> +++ b/src/utils.h
> @@ -140,8 +140,8 @@ void xsleep (double);
>  /* How many bytes it will take to store LEN bytes in base64.  */
>  #define BASE64_LENGTH(len) (4 * (((len) + 2) / 3))
> 
> -size_t base64_encode (const void *, size_t, char *);
> -ssize_t base64_decode (const char *, void *);
> +size_t wget_base64_encode (const void *, size_t, char *);
> +ssize_t wget_base64_decode (const char *, void *);
> 
>  #ifdef HAVE_LIBPCRE
>  void *compile_pcre_regex (const char *);

Attachment: signature.asc
Description: This is a digitally signed message part.


reply via email to

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