fielding    99/08/14 01:35:55

  Modified:    src      ApacheCore.def ApacheCoreOS2.def CHANGES
                        Configuration.tmpl
               src/ap   ap_base64.c ap_checkpass.c ap_md5c.c ap_sha1.c
               src/include ap_md5.h ap_sha1.h httpd.h
               src/main http_protocol.c util.c
               src/modules/experimental mod_auth_digest.c
               src/modules/proxy proxy_ftp.c
               src/modules/standard mod_unique_id.c
               src/support httpd.exp
  Log:
  Clean up the base64 and SHA1 additions and make sure they are
  represented in the ApacheCore.def, ApacheCoreOS2.def, and httpd.exp
  files.
  
  I am very unhappy with the implementation assumptions between
  ap_validate_password and the various encoding routines, like the
  length of an encoded password never being greater than 120 characters,
  but I have no time to fix them right now.  Not to mention all the other
  usages of magic numbers with no explanation.  Yuck.
  
  Revision  Changes    Path
  1.19      +17 -3     apache-1.3/src/ApacheCore.def
  
  Index: ApacheCore.def
  ===================================================================
  RCS file: /home/cvs/apache-1.3/src/ApacheCore.def,v
  retrieving revision 1.18
  retrieving revision 1.19
  diff -u -r1.18 -r1.19
  --- ApacheCore.def    1999/08/09 15:31:08     1.18
  +++ ApacheCore.def    1999/08/14 08:35:42     1.19
  @@ -343,6 +343,20 @@
        ap_standalone   @337
        ap_server_confname   @338
        ap_sub_req_method_uri   @339
  -     ap_sha1_base64  @340
  -     ap_puudecode    @341
  -     ap_puuencode    @342
  +     ap_regerror   @341
  +     ap_regexec   @342
  +     ap_field_noparam   @343
  +     ap_pbase64decode   @344
  +     ap_pbase64encode   @345
  +     ap_base64encode   @346
  +     ap_base64encode_binary   @347
  +     ap_base64encode_len   @348
  +     ap_base64decode   @349
  +     ap_base64decode_binary   @350
  +     ap_base64decode_len   @351
  +     ap_SHA1Init   @352
  +     ap_SHA1Update_binary   @353
  +     ap_SHA1Update   @354
  +     ap_SHA1Final   @355
  +     ap_sha1_base64   @356
  +
  
  
  
  1.5       +16 -5     apache-1.3/src/ApacheCoreOS2.def
  
  Index: ApacheCoreOS2.def
  ===================================================================
  RCS file: /home/cvs/apache-1.3/src/ApacheCoreOS2.def,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- ApacheCoreOS2.def 1999/08/10 16:12:20     1.4
  +++ ApacheCoreOS2.def 1999/08/14 08:35:42     1.5
  @@ -268,7 +268,7 @@
   ;    os_stat   @261
   ;    readdir   @262
        regcomp   @263
  -     ap_regexec   @264
  +     regexec   @264
        regfree   @265
   ;    access_module @266
   ;    alias_module   @267
  @@ -349,7 +349,18 @@
        ap_dummy_mutex  @343
        ap_signal  @344
        ap_regerror  @345
  -     ap_puudecode  @346
  -     ap_puuencode  @347
  -     ap_sha1_base64  @348
  -     ap_field_noparam  @349
  +     ap_regexec  @346
  +     ap_field_noparam  @347
  +     ap_pbase64decode  @348
  +     ap_pbase64encode  @349
  +     ap_base64encode  @350
  +     ap_base64encode_binary  @351
  +     ap_base64encode_len  @352
  +     ap_base64decode  @353
  +     ap_base64decode_binary  @354
  +     ap_base64decode_len  @355
  +     ap_SHA1Init     @356
  +     ap_SHA1Update_binary    @357
  +     ap_SHA1Update   @358
  +     ap_SHA1Final    @359
  +     ap_sha1_base64  @360
  
  
  
  1.1421    +12 -4     apache-1.3/src/CHANGES
  
  Index: CHANGES
  ===================================================================
  RCS file: /home/cvs/apache-1.3/src/CHANGES,v
  retrieving revision 1.1420
  retrieving revision 1.1421
  diff -u -r1.1420 -r1.1421
  --- CHANGES   1999/08/14 01:24:29     1.1420
  +++ CHANGES   1999/08/14 08:35:43     1.1421
  @@ -1,5 +1,9 @@
   Changes with Apache 1.3.9
   
  +  *) Don't allow configure to include mod_auth_digest unless it is
  +     explicitly requested, even if the user asked for all modules.
  +     [Roy Fielding]
  +
     *) Translate module names to dll names for OS/2 so that they are no more
        than 8 characters long and have an extension of "dll" instead of "so".
        [Brian Havard]
  @@ -25,12 +29,16 @@
        problem observed by some Win95/98 users where they get CGI script
        output sent to the console.  [Bill Stoddard]
   
  -  *) Roll back (re)naming in the uuencode/decode section. The ap/ap_
  +  *) Fix (re)naming in the uuencode/decode section. The ap/ap_
        routines are now called ap_base64* and are 'plain' (i.e., no 
  -     pool access or anything clever). Inside apache the routines 
  -     acting like pstrdup are called ap_puuencode() and ap_puudecode().
  -     The oddly named ap_uuencode(), ap_uudecode() is kept around for
  +     pool access or anything clever). Inside util.c the routines acting
  +     like pstrdup are called ap_pbase64encode() and ap_pbase64decode().
  +     The oddly named ap_uuencode(), ap_uudecode() are kept around for
        now but deprecated.  [dirkx]
  +
  +  *) Clean up the base64 and SHA1 additions and make sure they are
  +     represented in the ApacheCore.def, ApacheCoreOS2.def, and httpd.exp
  +     files.  [Roy Fielding]
   
     *) WIN32: Migrate to InstallShield 5.5 and provide a bit more error
        checking.  Allow compiling on VS 6.0.  [Randy Terbush]
  
  
  
  1.121     +13 -7     apache-1.3/src/Configuration.tmpl
  
  Index: Configuration.tmpl
  ===================================================================
  RCS file: /home/cvs/apache-1.3/src/Configuration.tmpl,v
  retrieving revision 1.120
  retrieving revision 1.121
  diff -u -r1.120 -r1.121
  --- Configuration.tmpl        1999/08/09 06:25:24     1.120
  +++ Configuration.tmpl        1999/08/14 08:35:43     1.121
  @@ -322,13 +322,6 @@
   
   AddModule modules/standard/mod_userdir.o
   
  -## The proxy module enables the server to act as a proxy for outside
  -## http and ftp services. It's not as complete as it could be yet.
  -## NOTE: You do not want this module UNLESS you are running a proxy;
  -##       it is not needed for normal (origin server) operation.
  -
  -# AddModule modules/proxy/libproxy.a
  -
   ## The Alias module provides simple URL translation and redirection.
   
   AddModule modules/standard/mod_alias.o
  @@ -372,8 +365,21 @@
   ## truerand library (available for example from
   ## ftp://research.att.com/dist/mab/librand.shar) - see the Rule
   ## DEV_RANDOM above for more info.
  +##
  +## Must be added above (run later than) the proxy module because the
  +## WWW-Authenticate and Proxy-Authenticate headers are parsed in the
  +## post-read-request phase and it needs to know if this is a proxy request.
   
   # AddModule modules/experimental/mod_auth_digest.o
  +
  +## Optional Proxy
  +##
  +## The proxy module enables the server to act as a proxy for outside
  +## http and ftp services. It's not as complete as it could be yet.
  +## NOTE: You do not want this module UNLESS you are running a proxy;
  +##       it is not needed for normal (origin server) operation.
  +
  +# AddModule modules/proxy/libproxy.a
   
   ## Optional response header manipulation modules. 
   ##
  
  
  
  1.4       +34 -27    apache-1.3/src/ap/ap_base64.c
  
  Index: ap_base64.c
  ===================================================================
  RCS file: /home/cvs/apache-1.3/src/ap/ap_base64.c,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- ap_base64.c       1999/08/12 18:06:17     1.3
  +++ ap_base64.c       1999/08/14 08:35:45     1.4
  @@ -57,8 +57,8 @@
   
   /* base64 encoder/decoder. Originally part of main/util.c
    * but moved here so that support/ab and ap_sha1.c could
  - * use it. This mean (re)moving the ap_palloc()s. And adding
  - * ugly 'len' functions. Which is quite a nasty cost.
  + * use it. This meant removing the ap_palloc()s and adding
  + * ugly 'len' functions, which is quite a nasty cost.
    */
   
   #include <string.h>
  @@ -75,20 +75,21 @@
   {
   #ifndef CHARSET_EBCDIC
       /* ASCII table */
  -    64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
  -    64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
  -    64, 64, 64, 64, 64, 64, 64, 64, 64, 62, 64, 64, 64, 63, 52, 53, 54,
  -    55, 56, 57, 58, 59, 60, 61, 64, 64, 64, 64, 64, 64, 64, 0, 1, 2, 3,
  -    4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21,
  -    22, 23, 24, 25, 64, 64, 64, 64, 64, 64, 26, 27, 28, 29, 30, 31, 32,
  -    33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49,
  -    50, 51, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
  -    64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
  -    64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
  -    64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
  -    64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
  -    64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
  -    64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
  +    64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
  +    64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
  +    64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 62, 64, 64, 64, 63,
  +    52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 64, 64, 64, 64, 64, 64,
  +    64,  0,  1,  2,  3,  4,  5,  6,  7,  8,  9, 10, 11, 12, 13, 14,
  +    15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 64, 64, 64, 64, 64,
  +    64, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40,
  +    41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 64, 64, 64, 64, 64,
  +    64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
  +    64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
  +    64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
  +    64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
  +    64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
  +    64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
  +    64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
       64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64
   #else /*CHARSET_EBCDIC*/
       /* EBCDIC table */
  @@ -107,7 +108,7 @@
       64,  0,  1,  2,  3,  4,  5,  6,  7,  8, 64, 64, 64, 64, 64, 64,
       64,  9, 10, 11, 12, 13, 14, 15, 16, 17, 64, 64, 64, 64, 64, 64,
       64, 64, 18, 19, 20, 21, 22, 23, 24, 25, 64, 64, 64, 64, 64, 64,
  -    52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 64, 64, 64, 64, 64, 64,
  +    52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 64, 64, 64, 64, 64, 64
   #endif /*CHARSET_EBCDIC*/
   };
   
  @@ -135,7 +136,7 @@
       
       len = ap_base64decode_binary((unsigned char *) bufplain, bufcoded);
   #ifdef CHARSET_EBCDIC
  -    for (i=0; i<len; i++)
  +    for (i = 0; i < len; i++)
        bufplain[i] = os_toebcdic[bufplain[i]];
   #endif                               /* CHARSET_EBCDIC */
       return len;
  @@ -191,7 +192,7 @@
   }
   
   static const char basis_64[] =
  -"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
  +    "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
   
   API_EXPORT(int) ap_base64encode_len(int len)
   {
  @@ -209,8 +210,10 @@
       p = encoded;
       for (i = 0; i < len - 2; i += 3) {
        *p++ = basis_64[(os_toascii[string[i]] >> 2) & 0x3F];
  -     *p++ = basis_64[((os_toascii[string[i]] & 0x3) << 4) | ((int) 
(os_toascii[string[i + 1]] & 0xF0) >> 4)];
  -     *p++ = basis_64[((os_toascii[string[i + 1]] & 0xF) << 2) | ((int) 
(os_toascii[string[i + 2]] & 0xC0) >> 6)];
  +     *p++ = basis_64[((os_toascii[string[i]] & 0x3) << 4) |
  +                     ((int) (os_toascii[string[i + 1]] & 0xF0) >> 4)];
  +     *p++ = basis_64[((os_toascii[string[i + 1]] & 0xF) << 2) |
  +                     ((int) (os_toascii[string[i + 2]] & 0xC0) >> 6)];
        *p++ = basis_64[os_toascii[string[i + 2]] & 0x3F];
       }
       if (i < len) {
  @@ -220,7 +223,8 @@
            *p++ = '=';
        }
        else {
  -         *p++ = basis_64[((os_toascii[string[i]] & 0x3) << 4) | ((int) 
(os_toascii[string[i + 1]] & 0xF0) >> 4)];
  +         *p++ = basis_64[((os_toascii[string[i]] & 0x3) << 4) |
  +                         ((int) (os_toascii[string[i + 1]] & 0xF0) >> 4)];
            *p++ = basis_64[((os_toascii[string[i + 1]] & 0xF) << 2)];
        }
        *p++ = '=';
  @@ -234,8 +238,8 @@
   /* This is the same as ap_base64encode() except on EBCDIC machines, where
    * the conversion of the input to ascii is left out.
    */
  -API_EXPORT(int) ap_base64encode_binary(char *encoded, const unsigned char 
*string,
  -                                int len)
  +API_EXPORT(int) ap_base64encode_binary(char *encoded,
  +                                       const unsigned char *string, int len)
   {
       int i;
       char *p;
  @@ -243,8 +247,10 @@
       p = encoded;
       for (i = 0; i < len - 2; i += 3) {
        *p++ = basis_64[(string[i] >> 2) & 0x3F];
  -     *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] & 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];
       }
       if (i < len) {
  @@ -254,7 +260,8 @@
            *p++ = '=';
        }
        else {
  -         *p++ = basis_64[((string[i] & 0x3) << 4) | ((int) (string[i + 1] & 
0xF0) >> 4)];
  +         *p++ = basis_64[((string[i] & 0x3) << 4) |
  +                         ((int) (string[i + 1] & 0xF0) >> 4)];
            *p++ = basis_64[((string[i + 1] & 0xF) << 2)];
        }
        *p++ = '=';
  
  
  
  1.4       +2 -2      apache-1.3/src/ap/ap_checkpass.c
  
  Index: ap_checkpass.c
  ===================================================================
  RCS file: /home/cvs/apache-1.3/src/ap/ap_checkpass.c,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- ap_checkpass.c    1999/08/08 18:18:12     1.3
  +++ ap_checkpass.c    1999/08/14 08:35:45     1.4
  @@ -82,14 +82,14 @@
   
       /* FreeBSD style MD5 string 
        */
  -    if (!strncmp(hash, apr1_id, strlen(apr1_id))) {
  +    if (strncmp(hash, AP_MD5PW_ID, AP_MD5PW_IDLEN) == 0) {
   
        ap_MD5Encode((const unsigned char *)passwd,
                     (const unsigned char *)hash, sample, sizeof(sample));
       }
       /* Netscape / SHA1 ldap style strng  
        */
  -    else if (!strncmp(hash, sha1_id, strlen(sha1_id))) {
  +    else if (strncmp(hash, AP_SHA1PW_ID, AP_SHA1PW_IDLEN) == 0) {
   
        ap_sha1_base64(passwd, strlen(passwd), sample);
       }
  
  
  
  1.29      +7 -12     apache-1.3/src/ap/ap_md5c.c
  
  Index: ap_md5c.c
  ===================================================================
  RCS file: /home/cvs/apache-1.3/src/ap/ap_md5c.c,v
  retrieving revision 1.28
  retrieving revision 1.29
  diff -u -r1.28 -r1.29
  --- ap_md5c.c 1999/08/02 10:13:44     1.28
  +++ ap_md5c.c 1999/08/14 08:35:45     1.29
  @@ -412,12 +412,6 @@
   }
   
   /*
  - * Define the Magic String prefix that identifies a password as being
  - * hashed using our algorithm.
  - */
  -const char *apr1_id = "$apr1$";
  -
  -/*
    * The following MD5 password encryption code was largely borrowed from
    * the FreeBSD 3.0 /usr/src/lib/libcrypt/crypt.c file, which is
    * licenced as stated at the top of this file.
  @@ -463,8 +457,8 @@
       /*
        * If it starts with the magic string, then skip that.
        */
  -    if (!strncmp((char *)sp, apr1_id, strlen(apr1_id))) {
  -     sp += strlen(apr1_id);
  +    if (strncmp((char *)sp, AP_MD5PW_ID, AP_MD5PW_IDLEN) == 0) {
  +     sp += AP_MD5PW_IDLEN;
       }
   
       /*
  @@ -493,7 +487,7 @@
       /*
        * Then our magic string
        */
  -    ap_MD5Update(&ctx, (const unsigned char *)apr1_id, strlen(apr1_id));
  +    ap_MD5Update(&ctx, AP_MD5PW_ID, AP_MD5PW_IDLEN);
   
       /*
        * Then the raw salt
  @@ -533,9 +527,10 @@
        * Now make the output string.  We know our limitations, so we
        * can use the string routines without bounds checking.
        */
  -    strcpy(passwd, apr1_id);
  -    strncat(passwd, (char *)sp, sl);
  -    strcat(passwd, "$");
  +    ap_cpystrn(passwd, AP_MD5PW_ID, AP_MD5PW_IDLEN);
  +    ap_cpystrn(passwd + AP_MD5PW_IDLEN, (char *)sp, sl);
  +    passwd[AP_MD5PW_IDLEN + sl]     = '$';
  +    passwd[AP_MD5PW_IDLEN + sl + 1] = '\0';
   
       ap_MD5Final(final, &ctx);
   
  
  
  
  1.9       +8 -14     apache-1.3/src/ap/ap_sha1.c
  
  Index: ap_sha1.c
  ===================================================================
  RCS file: /home/cvs/apache-1.3/src/ap/ap_sha1.c,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- ap_sha1.c 1999/08/12 18:06:18     1.8
  +++ ap_sha1.c 1999/08/14 08:35:46     1.9
  @@ -118,7 +118,6 @@
       E = D; D = C; C = ROT32(B,30); B = A; A = temp
   
   #define SHA_BLOCKSIZE           64
  -#define SHA_DIGESTSIZE          20
   
   typedef unsigned char AP_BYTE;
   
  @@ -322,7 +321,8 @@
   
   /* finish computing the SHA digest */
   
  -API_EXPORT(void) ap_SHA1Final(unsigned char digest[20], AP_SHA1_CTX 
*sha_info)
  +API_EXPORT(void) ap_SHA1Final(unsigned char digest[SHA_DIGESTSIZE],
  +                              AP_SHA1_CTX *sha_info)
   {
       int count, i, j;
       AP_LONG lo_bit_count, hi_bit_count, k;
  @@ -356,19 +356,14 @@
   }
   
   
  -/* {SHA} is the prefix used for base64 encoded sha1 in
  - * ldap data interchange format.
  - */
  -const char *sha1_id = "{SHA}";
  -
   API_EXPORT(void) ap_sha1_base64(const char *clear, int len, char *out)
   {
       int l;
       AP_SHA1_CTX context;
       AP_BYTE digest[SHA_DIGESTSIZE];
   
  -    if (!strncmp(clear, sha1_id, strlen(sha1_id))) {
  -     clear += strlen(sha1_id);
  +    if (strncmp(clear, AP_SHA1PW_ID, AP_SHA1PW_IDLEN) == 0) {
  +     clear += AP_SHA1PW_IDLEN;
       }
   
       ap_SHA1Init(&context);
  @@ -376,14 +371,13 @@
       ap_SHA1Final(digest, &context);
   
       /* private marker. */
  -    strcpy(out, sha1_id);
  +    ap_cpystrn(out, AP_SHA1PW_ID, AP_SHA1PW_IDLEN);
   
       /* SHA1 hash is always 20 chars */
  -    l = ap_base64encode_binary(out + strlen(sha1_id), digest, 
sizeof(digest));
  -    out[l + strlen(sha1_id)] = '\0';
  +    l = ap_base64encode_binary(out + AP_SHA1PW_IDLEN, digest, 
sizeof(digest));
  +    out[l + AP_SHA1PW_IDLEN] = '\0';
   
       /*
  -     * output of MIME Base 64 encoded SHA1 is always 28 characters +
  -     * strlen(sha1_id)
  +     * output of base64 encoded SHA1 is always 28 chars + AP_SHA1PW_IDLEN
        */
   }
  
  
  
  1.9       +6 -1      apache-1.3/src/include/ap_md5.h
  
  Index: ap_md5.h
  ===================================================================
  RCS file: /home/cvs/apache-1.3/src/include/ap_md5.h,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- ap_md5.h  1999/08/05 20:04:02     1.8
  +++ ap_md5.h  1999/08/14 08:35:47     1.9
  @@ -104,7 +104,12 @@
       unsigned char buffer[64];        /* input buffer */
   } AP_MD5_CTX;
   
  -extern const char *apr1_id;          /* MD5 passwd marker string */
  +/*
  + * Define the Magic String prefix that identifies a password as being
  + * hashed using our algorithm.
  + */
  +#define AP_MD5PW_ID "$apr1$"
  +#define AP_MD5PW_IDLEN 6
   
   API_EXPORT(void) ap_MD5Init(AP_MD5_CTX *context);
   API_EXPORT(void) ap_MD5Update(AP_MD5_CTX *context, const unsigned char 
*input,
  
  
  
  1.6       +11 -2     apache-1.3/src/include/ap_sha1.h
  
  Index: ap_sha1.h
  ===================================================================
  RCS file: /home/cvs/apache-1.3/src/include/ap_sha1.h,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- ap_sha1.h 1999/08/08 17:58:35     1.5
  +++ ap_sha1.h 1999/08/14 08:35:47     1.6
  @@ -67,6 +67,15 @@
   extern "C" {
   #endif
   
  +#define SHA_DIGESTSIZE 20
  +
  +/*
  + * Define the Magic String prefix that identifies a password as being
  + * hashed using our algorithm.
  + */
  +#define AP_SHA1PW_ID "{SHA}"
  +#define AP_SHA1PW_IDLEN 5
  +
   typedef unsigned long AP_LONG;     /* a 32-bit quantity */
   
   typedef struct {
  @@ -76,7 +85,6 @@
       int local;                     /* unprocessed amount in data */
   } AP_SHA1_CTX;
   
  -extern const char *sha1_id;  /* passwd prefix marker for SHA1 */
   API_EXPORT(void) ap_sha1_base64(const char *clear, int len, char *out);
   API_EXPORT(void) ap_SHA1Init(AP_SHA1_CTX *context);
   API_EXPORT(void) ap_SHA1Update(AP_SHA1_CTX *context, const char *input,
  @@ -84,7 +92,8 @@
   API_EXPORT(void) ap_SHA1Update_binary(AP_SHA1_CTX *context,
                                      const unsigned char *input,
                                      unsigned int inputLen);
  -API_EXPORT(void) ap_SHA1Final(unsigned char digest[20], AP_SHA1_CTX 
*context);
  +API_EXPORT(void) ap_SHA1Final(unsigned char digest[SHA_DIGESTSIZE],
  +                              AP_SHA1_CTX *context);
   
   #ifdef __cplusplus
   }
  
  
  
  1.293     +3 -3      apache-1.3/src/include/httpd.h
  
  Index: httpd.h
  ===================================================================
  RCS file: /home/cvs/apache-1.3/src/include/httpd.h,v
  retrieving revision 1.292
  retrieving revision 1.293
  diff -u -r1.292 -r1.293
  --- httpd.h   1999/08/12 18:06:21     1.292
  +++ httpd.h   1999/08/14 08:35:47     1.293
  @@ -990,9 +990,9 @@
   API_EXPORT(int) ap_is_matchexp(const char *str);
   API_EXPORT(int) ap_strcmp_match(const char *str, const char *exp);
   API_EXPORT(int) ap_strcasecmp_match(const char *str, const char *exp);
  -API_EXPORT(char *) ap_puudecode(pool *, const char *);
  -API_EXPORT(char *) ap_puuencode(pool *p, char *string); 
  -API_EXPORT(char *) ap_uudecode(pool *, const char *);
  +API_EXPORT(char *) ap_pbase64decode(pool *p, const char *bufcoded);
  +API_EXPORT(char *) ap_pbase64encode(pool *p, char *string); 
  +API_EXPORT(char *) ap_uudecode(pool *p, const char *bufcoded);
   API_EXPORT(char *) ap_uuencode(pool *p, char *string); 
   
   #ifdef OS2
  
  
  
  1.278     +1 -1      apache-1.3/src/main/http_protocol.c
  
  Index: http_protocol.c
  ===================================================================
  RCS file: /home/cvs/apache-1.3/src/main/http_protocol.c,v
  retrieving revision 1.277
  retrieving revision 1.278
  diff -u -r1.277 -r1.278
  --- http_protocol.c   1999/08/09 09:41:39     1.277
  +++ http_protocol.c   1999/08/14 08:35:48     1.278
  @@ -1152,7 +1152,7 @@
       while (*auth_line== ' ' || *auth_line== '\t')
           auth_line++;
   
  -    t = ap_puudecode(r->pool, auth_line);
  +    t = ap_pbase64decode(r->pool, auth_line);
       /* Note that this allocation has to be made from r->connection->pool
        * because it has the lifetime of the connection.  The other allocations
        * are temporary and can be tossed away any time.
  
  
  
  1.171     +12 -11    apache-1.3/src/main/util.c
  
  Index: util.c
  ===================================================================
  RCS file: /home/cvs/apache-1.3/src/main/util.c,v
  retrieving revision 1.170
  retrieving revision 1.171
  diff -u -r1.170 -r1.171
  --- util.c    1999/08/12 18:06:25     1.170
  +++ util.c    1999/08/14 08:35:50     1.171
  @@ -1959,39 +1959,40 @@
   
   /* simple 'pool' alloc()ing glue to ap_base64.c
    */
  -API_EXPORT(char *) ap_puudecode(pool *p, const char *bufcoded)
  +API_EXPORT(char *) ap_pbase64decode(pool *p, const char *bufcoded)
   {
       char *decoded;
       int l;
   
  -    decoded = (char *) ap_palloc(p, 1+ap_base64decode_len(bufcoded));
  -    l = ap_base64decode(decoded,bufcoded);
  -    decoded[l]='\0'; /* make binary sequence into string */
  +    decoded = (char *) ap_palloc(p, 1 + ap_base64decode_len(bufcoded));
  +    l = ap_base64decode(decoded, bufcoded);
  +    decoded[l] = '\0'; /* make binary sequence into string */
   
       return decoded;
   }
   
  -
  -API_EXPORT(char *) ap_puuencode(pool *p, char *string) 
  +API_EXPORT(char *) ap_pbase64encode(pool *p, char *string) 
   { 
       char *encoded;
       int l = strlen(string);
   
  -    encoded = (char *) ap_palloc(p, 1+ap_base64encode_len(l));
  -    l=ap_base64encode(encoded,string,l);
  -    encoded[l]='\0'; /* make binary sequence into string */
  +    encoded = (char *) ap_palloc(p, 1 + ap_base64encode_len(l));
  +    l = ap_base64encode(encoded, string, l);
  +    encoded[l] = '\0'; /* make binary sequence into string */
   
       return encoded;
   }
   
  +/* deprecated names for the above two functions, here for compatibility
  + */
   API_EXPORT(char *) ap_uudecode(pool *p, const char *bufcoded)
   {
  -    return ap_puudecode(p,bufcoded);
  +    return ap_pbase64decode(p, bufcoded);
   }
   
   API_EXPORT(char *) ap_uuencode(pool *p, char *string) 
   { 
  -    return ap_puuencode(p,string);
  +    return ap_pbase64encode(p, string);
   }
   
   #ifdef OS2
  
  
  
  1.6       +2 -2      apache-1.3/src/modules/experimental/mod_auth_digest.c
  
  Index: mod_auth_digest.c
  ===================================================================
  RCS file: /home/cvs/apache-1.3/src/modules/experimental/mod_auth_digest.c,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- mod_auth_digest.c 1999/08/13 07:18:05     1.5
  +++ mod_auth_digest.c 1999/08/14 08:35:52     1.6
  @@ -943,7 +943,7 @@
                           const digest_config_rec *conf)
   {
       const char *hex = "0123456789abcdef";
  -    unsigned char sha1[20];
  +    unsigned char sha1[SHA_DIGESTSIZE];
       AP_SHA1_CTX ctx;
       int idx;
   
  @@ -958,7 +958,7 @@
                             strlen(opaque));
       ap_SHA1Final(sha1, &ctx);
   
  -    for (idx=0; idx<20; idx++) {
  +    for (idx=0; idx<SHA_DIGESTSIZE; idx++) {
        *hash++ = hex[sha1[idx] >> 4];
        *hash++ = hex[sha1[idx] & 0xF];
       }
  
  
  
  1.78      +1 -1      apache-1.3/src/modules/proxy/proxy_ftp.c
  
  Index: proxy_ftp.c
  ===================================================================
  RCS file: /home/cvs/apache-1.3/src/modules/proxy/proxy_ftp.c,v
  retrieving revision 1.77
  retrieving revision 1.78
  diff -u -r1.77 -r1.78
  --- proxy_ftp.c       1999/08/08 11:45:19     1.77
  +++ proxy_ftp.c       1999/08/14 08:35:53     1.78
  @@ -510,7 +510,7 @@
        */
       if ((password = ap_table_get(r->headers_in, "Authorization")) != NULL
        && strcasecmp(ap_getword(r->pool, &password, ' '), "Basic") == 0
  -     && (password = ap_puudecode(r->pool, password))[0] != ':') {
  +     && (password = ap_pbase64decode(r->pool, password))[0] != ':') {
        /* Note that this allocation has to be made from r->connection->pool
         * because it has the lifetime of the connection.  The other allocations
         * are temporary and can be tossed away any time.
  
  
  
  1.19      +3 -3      apache-1.3/src/modules/standard/mod_unique_id.c
  
  Index: mod_unique_id.c
  ===================================================================
  RCS file: /home/cvs/apache-1.3/src/modules/standard/mod_unique_id.c,v
  retrieving revision 1.18
  retrieving revision 1.19
  diff -u -r1.18 -r1.19
  --- mod_unique_id.c   1999/01/01 19:05:15     1.18
  +++ mod_unique_id.c   1999/08/14 08:35:53     1.19
  @@ -104,7 +104,7 @@
    * saving cpu cycles.  The counter is never reset, and is used to permit up 
to
    * 64k requests in a single second by a single child.
    *
  - * The 112-bits of unique_id_rec are uuencoded using the alphabet
  + * The 112-bits of unique_id_rec are encoded using the alphabet
    * [EMAIL PROTECTED], resulting in 19 bytes of printable characters.  That 
is then
    * stuffed into the environment variable UNIQUE_ID so that it is available to
    * other modules.  The alphabet choice differs from normal base64 encoding
  @@ -181,7 +181,7 @@
                                  unique_id_rec_size[2] + unique_id_rec_size[3];
   
       /*
  -     * Calculate the size of the structure when uuencoded.
  +     * Calculate the size of the structure when encoded.
        */
       unique_id_rec_size_uu = (unique_id_rec_total_size*8+5)/6;
   
  @@ -296,7 +296,7 @@
       cur_unique_id.counter = htons(cur_unique_id.counter);
   }
   
  -/* NOTE: This is *NOT* the same encoding used by uuencode ... the last two
  +/* NOTE: This is *NOT* the same encoding used by base64encode ... the last 
two
    * characters should be + and /.  But those two characters have very special
    * meanings in URLs, and we want to make it easy to use identifiers in
    * URLs.  So we replace them with @ and -.
  
  
  
  1.26      +12 -2     apache-1.3/src/support/httpd.exp
  
  Index: httpd.exp
  ===================================================================
  RCS file: /home/cvs/apache-1.3/src/support/httpd.exp,v
  retrieving revision 1.25
  retrieving revision 1.26
  diff -u -r1.25 -r1.26
  --- httpd.exp 1999/08/10 14:50:43     1.25
  +++ httpd.exp 1999/08/14 08:35:54     1.26
  @@ -3,6 +3,10 @@
   ap_MD5Final
   ap_MD5Init
   ap_MD5Update
  +ap_SHA1Final
  +ap_SHA1Init
  +ap_SHA1Update_binary
  +ap_SHA1Update
   ap_add_cgi_vars
   ap_add_common_vars
   ap_add_module
  @@ -17,6 +21,12 @@
   ap_array_pstrcat
   ap_auth_name
   ap_auth_type
  +ap_base64encode
  +ap_base64encode_binary
  +ap_base64encode_len
  +ap_base64decode
  +ap_base64decode_binary
  +ap_base64decode_len
   ap_basic_http_header
   ap_bclose
   ap_bcreate
  @@ -217,6 +227,8 @@
   ap_parse_uri
   ap_parse_uri_components
   ap_parse_vhost_addrs
  +ap_pbase64decode
  +ap_pbase64encode
   ap_pcalloc
   ap_pcfg_open_custom
   ap_pcfg_openfile
  @@ -245,8 +257,6 @@
   ap_pstrdup
   ap_pstrndup
   ap_push_array
  -ap_puudecode
  -ap_puuencode
   ap_pvsprintf
   ap_rationalize_mtime
   ap_read_config
  
  
  

Reply via email to