httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Life is hard, and then you die." <ron...@innovation.ch>
Subject Re: [patch] ab.c, ab.8
Date Mon, 05 Apr 1999 07:37:01 GMT

> Index: ab.c
> ===================================================================
> RCS file: /x3/home/cvs/apache-1.3/src/support/ab.c,v
> retrieving revision 1.20
> diff -u -c -3 -r1.20 ab.c
> *** ab.c        1999/02/19 16:25:35     1.20
> --- ab.c        1999/04/01 11:33:30
[snip]
> + /* -- simple uuencode, lifted from main/util.c which
> +  *    needed the pool, so duplicated here with normal
> +  *    malloc. Just for Basic Auth encoding.
> +  */
> + static const char basis_64[] =
> +       "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
> +
> + static char * uuencode(char *string)
> + {
> +       int i, len = strlen(string);
> +       char *p;
> +       char *encoded = (char *) malloc((len+2) / 3 * 4);
> +       p = encoded;
> +       for (i = 0; i < len; i += 3) {
> +               *p++ = basis_64[string[i] >> 2];
> +               *p++ = basis_64[((string[i] & 0x3) << 4) |
> +                               ((int) (string[i + 1] & 0xF0) >> 4) ];
> +               *p++ = basis_64[((string[i + 1] & 0xF) << 2) |
> +                               ((int) (string[i + 2] & 0xC0) >> 6)];
> +               *p++ = basis_64[string[i + 2] & 0x3F];
> +               };
> +       *p-- = '\0';
> +       *p-- = '=';
> +       *p-- = '=';
> +       return encoded;
> +       }
> +
[snip]

I suggest updating this to the latest version of ap_uuencode in util.c
as the above version is quite broken.


  Cheers,

  Ronald


Mime
View raw message