httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From traw...@locus.apache.org
Subject cvs commit: apache-2.0/src/support htpasswd.c
Date Tue, 16 May 2000 19:48:09 GMT
trawick     00/05/16 12:48:08

  Modified:    src/ap   ap_sha1.c
               src/main util_ebcdic.c
               src/support htpasswd.c
  Log:
  APR-ize the CHARSET_EBCDIC support in the SHA1 routines.  The app (e.g.,
  Apache, htpasswd) must call a function to set up translation.
  
  Revision  Changes    Path
  1.8       +22 -5     apache-2.0/src/ap/ap_sha1.c
  
  Index: ap_sha1.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/ap/ap_sha1.c,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- ap_sha1.c	2000/04/29 16:00:30	1.7
  +++ ap_sha1.c	2000/05/16 19:48:07	1.8
  @@ -87,7 +87,7 @@
   #include "ap_base64.h"
   #include "apr_lib.h"
   #ifdef CHARSET_EBCDIC
  -#include "ebcdic.h"
  +#include "apr_xlate.h"
   #endif /*CHARSET_EBCDIC*/
   
   /* a bit faster & bigger, if defined */
  @@ -118,6 +118,16 @@
   
   #define SHA_BLOCKSIZE           64
   
  +#ifdef CHARSET_EBCDIC
  +static ap_xlate_t *ebcdic2ascii_xlate;
  +
  +API_EXPORT(ap_status_t) ap_SHA1InitEBCDIC(ap_xlate_t *x)
  +{
  +    ebcdic2ascii_xlate = x;
  +    return APR_SUCCESS;
  +}
  +#endif
  +
   typedef unsigned char AP_BYTE;
   
   /* do SHA transformation */
  @@ -279,6 +289,7 @@
   #ifdef CHARSET_EBCDIC
       int i;
       const AP_BYTE *buffer = (const AP_BYTE *) buf;
  +    ap_size_t inbytes_left, outbytes_left;
   
       if ((sha_info->count_lo + ((ap_uint32_t) count << 3)) < sha_info->count_lo)
{
   	++sha_info->count_hi;
  @@ -291,8 +302,10 @@
   	if (i > count) {
   	    i = count;
   	}
  -	ebcdic2ascii_strictly(((AP_BYTE *) sha_info->data) + sha_info->local,
  -			      buffer, i);
  +        inbytes_left = outbytes_left = i;
  +        ap_xlate_conv_buffer(ebcdic2ascii_xlate, buffer, &inbytes_left,
  +                             ((AP_BYTE *) sha_info->data) + sha_info->local,
  +                             &outbytes_left);
   	count -= i;
   	buffer += i;
   	sha_info->local += i;
  @@ -305,13 +318,17 @@
   	}
       }
       while (count >= SHA_BLOCKSIZE) {
  -	ebcdic2ascii_strictly((AP_BYTE *)sha_info->data, buffer, SHA_BLOCKSIZE);
  +        inbytes_left = outbytes_left = SHA_BLOCKSIZE;
  +        ap_xlate_conv_buffer(ebcdic2ascii_xlate, buffer, &inbytes_left,
  +                             (AP_BYTE *) sha_info->data, &outbytes_left);
   	buffer += SHA_BLOCKSIZE;
   	count -= SHA_BLOCKSIZE;
   	maybe_byte_reverse(sha_info->data, SHA_BLOCKSIZE);
   	sha_transform(sha_info);
       }
  -    ebcdic2ascii_strictly((AP_BYTE *)sha_info->data, buffer, count);
  +    inbytes_left = outbytes_left = count;
  +    ap_xlate_conv_buffer(ebcdic2ascii_xlate, buffer, &inbytes_left,
  +                         (AP_BYTE *) sha_info->data, &outbytes_left);
       sha_info->local = count;
   #else
       ap_SHA1Update_binary(sha_info, (const unsigned char *) buf, count);
  
  
  
  1.5       +7 -0      apache-2.0/src/main/util_ebcdic.c
  
  Index: util_ebcdic.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/main/util_ebcdic.c,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- util_ebcdic.c	2000/05/16 03:11:12	1.4
  +++ util_ebcdic.c	2000/05/16 19:48:08	1.5
  @@ -104,6 +104,13 @@
           return rv;
       }
       
  +    rv = ap_SHA1InitEBCDIC(ap_hdrs_to_ascii);
  +    if (rv) {
  +        ap_log_error(APLOG_MARK, APLOG_ERR, rv, NULL,
  +                     "ap_SHA1InitEBCDIC() failed");
  +        return rv;
  +    }
  +    
       return APR_SUCCESS;
   }
   
  
  
  
  1.14      +5 -0      apache-2.0/src/support/htpasswd.c
  
  Index: htpasswd.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/support/htpasswd.c,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- htpasswd.c	2000/05/16 03:59:15	1.13
  +++ htpasswd.c	2000/05/16 19:48:08	1.14
  @@ -391,6 +391,11 @@
           fprintf(stderr, "ap_xlate_open(to ASCII)->%d\n", rv);
           exit(1);
       }
  +    rv = ap_SHA1InitEBCDIC(to_ascii);
  +    if (rv) {
  +        fprintf(stderr, "ap_SHA1InitEBCDIC()->%d\n", rv);
  +        exit(1);
  +    }
       rv = ap_MD5InitEBCDIC(to_ascii);
       if (rv) {
           fprintf(stderr, "ap_MD5InitEBCDIC()->%d\n", rv);
  
  
  

Mime
View raw message