summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author(no author) <(no author)@13f79535-47bb-0310-9956-ffa450edef68>2000-05-27 22:40:19 +0000
committer(no author) <(no author)@13f79535-47bb-0310-9956-ffa450edef68>2000-05-27 22:40:19 +0000
commiteea8e61f70495123b6d716f6eb943f211438c8ee (patch)
tree8052e08436e50c35833774d0eda33b8439498b0d
parent65c9f2f9bed8684a46cd8086cee2ce90ee654b27 (diff)
downloadlibapr-util-APACHE_2_0_ALPHA_4.tar.gz
This commit was manufactured by cvs2svn to create tagAPACHE_2_0_ALPHA_4
'APACHE_2_0_ALPHA_4'. git-svn-id: http://svn.apache.org/repos/asf/apr/apr-util/tags/APACHE_2_0_ALPHA_4@57809 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--crypto/ap_sha1.c411
-rw-r--r--crypto/apr_sha1.c411
-rw-r--r--encoding/ap_base64.c311
-rw-r--r--encoding/apr_base64.c311
-rw-r--r--hooks/ap_hooks.c237
-rw-r--r--hooks/apr_hooks.c237
-rw-r--r--include/ap_base64.h92
-rw-r--r--include/ap_hooks.h188
-rw-r--r--include/ap_sha1.h100
-rw-r--r--include/apr_base64.h92
-rw-r--r--include/apr_hooks.h188
-rw-r--r--include/apr_sha1.h100
12 files changed, 0 insertions, 2678 deletions
diff --git a/crypto/ap_sha1.c b/crypto/ap_sha1.c
deleted file mode 100644
index 5acda4b8..00000000
--- a/crypto/ap_sha1.c
+++ /dev/null
@@ -1,411 +0,0 @@
-/* ====================================================================
- * The Apache Software License, Version 1.1
- *
- * Copyright (c) 2000 The Apache Software Foundation. All rights
- * reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * 3. The end-user documentation included with the redistribution,
- * if any, must include the following acknowledgment:
- * "This product includes software developed by the
- * Apache Software Foundation (http://www.apache.org/)."
- * Alternately, this acknowledgment may appear in the software itself,
- * if and wherever such third-party acknowledgments normally appear.
- *
- * 4. The names "Apache" and "Apache Software Foundation" must
- * not be used to endorse or promote products derived from this
- * software without prior written permission. For written
- * permission, please contact apache@apache.org.
- *
- * 5. Products derived from this software may not be called "Apache",
- * nor may "Apache" appear in their name, without prior written
- * permission of the Apache Software Foundation.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- * ====================================================================
- *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Software Foundation. For more
- * information on the Apache Software Foundation, please see
- * <http://www.apache.org/>.
- */
-
-/*
- * The exported function:
- *
- * ap_sha1_base64(const char *clear, int len, char *out);
- *
- * provides a means to SHA1 crypt/encode a plaintext password in
- * a way which makes password files compatible with those commonly
- * used in netscape web and ldap installations. It was put together
- * by Clinton Wong <clintdw@netcom.com>, who also notes that:
- *
- * Note: SHA1 support is useful for migration purposes, but is less
- * secure than Apache's password format, since Apache's (MD5)
- * password format uses a random eight character salt to generate
- * one of many possible hashes for the same password. Netscape
- * uses plain SHA1 without a salt, so the same password
- * will always generate the same hash, making it easier
- * to break since the search space is smaller.
- *
- * See also the documentation in support/SHA1 as to hints on how to
- * migrate an existing netscape installation and other supplied utitlites.
- *
- * This software also makes use of the following component:
- *
- * NIST Secure Hash Algorithm
- * heavily modified by Uwe Hollerbach uh@alumni.caltech edu
- * from Peter C. Gutmann's implementation as found in
- * Applied Cryptography by Bruce Schneier
- * This code is hereby placed in the public domain
- */
-
-#include "ap_config.h"
-#include "ap_sha1.h"
-#include "ap_base64.h"
-#include "apr_lib.h"
-#ifdef CHARSET_EBCDIC
-#include "apr_xlate.h"
-#endif /*CHARSET_EBCDIC*/
-
-/* a bit faster & bigger, if defined */
-#define UNROLL_LOOPS
-
-/* NIST's proposed modification to SHA, 7/11/94 */
-#define USE_MODIFIED_SHA
-
-/* SHA f()-functions */
-#define f1(x,y,z) ((x & y) | (~x & z))
-#define f2(x,y,z) (x ^ y ^ z)
-#define f3(x,y,z) ((x & y) | (x & z) | (y & z))
-#define f4(x,y,z) (x ^ y ^ z)
-
-/* SHA constants */
-#define CONST1 0x5a827999L
-#define CONST2 0x6ed9eba1L
-#define CONST3 0x8f1bbcdcL
-#define CONST4 0xca62c1d6L
-
-/* 32-bit rotate */
-
-#define ROT32(x,n) ((x << n) | (x >> (32 - n)))
-
-#define FUNC(n,i) \
- temp = ROT32(A,5) + f##n(B,C,D) + E + W[i] + CONST##n; \
- E = D; D = C; C = ROT32(B,30); B = A; A = temp
-
-#define SHA_BLOCKSIZE 64
-
-#ifdef CHARSET_EBCDIC
-static ap_xlate_t *ebcdic2ascii_xlate;
-
-API_EXPORT(ap_status_t) ap_SHA1InitEBCDIC(ap_xlate_t *x)
-{
- ap_status_t rv;
- int onoff;
-
- /* Only single-byte conversion is supported.
- */
- rv = ap_xlate_get_sb(x, &onoff);
- if (rv) {
- return rv;
- }
- if (!onoff) { /* If conversion is not single-byte-only */
- return APR_EINVAL;
- }
- ebcdic2ascii_xlate = x;
- return APR_SUCCESS;
-}
-#endif
-
-typedef unsigned char AP_BYTE;
-
-/* do SHA transformation */
-static void sha_transform(AP_SHA1_CTX *sha_info)
-{
- int i;
- ap_uint32_t temp, A, B, C, D, E, W[80];
-
- for (i = 0; i < 16; ++i) {
- W[i] = sha_info->data[i];
- }
- for (i = 16; i < 80; ++i) {
- W[i] = W[i-3] ^ W[i-8] ^ W[i-14] ^ W[i-16];
-#ifdef USE_MODIFIED_SHA
- W[i] = ROT32(W[i], 1);
-#endif /* USE_MODIFIED_SHA */
- }
- A = sha_info->digest[0];
- B = sha_info->digest[1];
- C = sha_info->digest[2];
- D = sha_info->digest[3];
- E = sha_info->digest[4];
-#ifdef UNROLL_LOOPS
- FUNC(1, 0); FUNC(1, 1); FUNC(1, 2); FUNC(1, 3); FUNC(1, 4);
- FUNC(1, 5); FUNC(1, 6); FUNC(1, 7); FUNC(1, 8); FUNC(1, 9);
- FUNC(1,10); FUNC(1,11); FUNC(1,12); FUNC(1,13); FUNC(1,14);
- FUNC(1,15); FUNC(1,16); FUNC(1,17); FUNC(1,18); FUNC(1,19);
-
- FUNC(2,20); FUNC(2,21); FUNC(2,22); FUNC(2,23); FUNC(2,24);
- FUNC(2,25); FUNC(2,26); FUNC(2,27); FUNC(2,28); FUNC(2,29);
- FUNC(2,30); FUNC(2,31); FUNC(2,32); FUNC(2,33); FUNC(2,34);
- FUNC(2,35); FUNC(2,36); FUNC(2,37); FUNC(2,38); FUNC(2,39);
-
- FUNC(3,40); FUNC(3,41); FUNC(3,42); FUNC(3,43); FUNC(3,44);
- FUNC(3,45); FUNC(3,46); FUNC(3,47); FUNC(3,48); FUNC(3,49);
- FUNC(3,50); FUNC(3,51); FUNC(3,52); FUNC(3,53); FUNC(3,54);
- FUNC(3,55); FUNC(3,56); FUNC(3,57); FUNC(3,58); FUNC(3,59);
-
- FUNC(4,60); FUNC(4,61); FUNC(4,62); FUNC(4,63); FUNC(4,64);
- FUNC(4,65); FUNC(4,66); FUNC(4,67); FUNC(4,68); FUNC(4,69);
- FUNC(4,70); FUNC(4,71); FUNC(4,72); FUNC(4,73); FUNC(4,74);
- FUNC(4,75); FUNC(4,76); FUNC(4,77); FUNC(4,78); FUNC(4,79);
-#else /* !UNROLL_LOOPS */
- for (i = 0; i < 20; ++i) {
- FUNC(1,i);
- }
- for (i = 20; i < 40; ++i) {
- FUNC(2,i);
- }
- for (i = 40; i < 60; ++i) {
- FUNC(3,i);
- }
- for (i = 60; i < 80; ++i) {
- FUNC(4,i);
- }
-#endif /* !UNROLL_LOOPS */
- sha_info->digest[0] += A;
- sha_info->digest[1] += B;
- sha_info->digest[2] += C;
- sha_info->digest[3] += D;
- sha_info->digest[4] += E;
-}
-
-union endianTest {
- long Long;
- char Char[sizeof(long)];
-};
-
-static char isLittleEndian(void)
-{
- static union endianTest u;
- u.Long = 1;
- return (u.Char[0] == 1);
-}
-
-/* change endianness of data */
-
-/* count is the number of bytes to do an endian flip */
-static void maybe_byte_reverse(ap_uint32_t *buffer, int count)
-{
- int i;
- AP_BYTE ct[4], *cp;
-
- if (isLittleEndian()) { /* do the swap only if it is little endian */
- count /= sizeof(ap_uint32_t);
- cp = (AP_BYTE *) buffer;
- for (i = 0; i < count; ++i) {
- ct[0] = cp[0];
- ct[1] = cp[1];
- ct[2] = cp[2];
- ct[3] = cp[3];
- cp[0] = ct[3];
- cp[1] = ct[2];
- cp[2] = ct[1];
- cp[3] = ct[0];
- cp += sizeof(ap_uint32_t);
- }
- }
-}
-
-/* initialize the SHA digest */
-
-API_EXPORT(void) ap_SHA1Init(AP_SHA1_CTX *sha_info)
-{
- sha_info->digest[0] = 0x67452301L;
- sha_info->digest[1] = 0xefcdab89L;
- sha_info->digest[2] = 0x98badcfeL;
- sha_info->digest[3] = 0x10325476L;
- sha_info->digest[4] = 0xc3d2e1f0L;
- sha_info->count_lo = 0L;
- sha_info->count_hi = 0L;
- sha_info->local = 0;
-}
-
-/* update the SHA digest */
-
-API_EXPORT(void) ap_SHA1Update_binary(AP_SHA1_CTX *sha_info,
- const unsigned char *buffer,
- unsigned int count)
-{
- unsigned int i;
-
- if ((sha_info->count_lo + ((ap_uint32_t) count << 3)) < sha_info->count_lo) {
- ++sha_info->count_hi;
- }
- sha_info->count_lo += (ap_uint32_t) count << 3;
- sha_info->count_hi += (ap_uint32_t) count >> 29;
- if (sha_info->local) {
- i = SHA_BLOCKSIZE - sha_info->local;
- if (i > count) {
- i = count;
- }
- memcpy(((AP_BYTE *) sha_info->data) + sha_info->local, buffer, i);
- count -= i;
- buffer += i;
- sha_info->local += i;
- if (sha_info->local == SHA_BLOCKSIZE) {
- maybe_byte_reverse(sha_info->data, SHA_BLOCKSIZE);
- sha_transform(sha_info);
- }
- else {
- return;
- }
- }
- while (count >= SHA_BLOCKSIZE) {
- memcpy(sha_info->data, buffer, SHA_BLOCKSIZE);
- buffer += SHA_BLOCKSIZE;
- count -= SHA_BLOCKSIZE;
- maybe_byte_reverse(sha_info->data, SHA_BLOCKSIZE);
- sha_transform(sha_info);
- }
- memcpy(sha_info->data, buffer, count);
- sha_info->local = count;
-}
-
-API_EXPORT(void) ap_SHA1Update(AP_SHA1_CTX *sha_info, const char *buf,
- unsigned int count)
-{
-#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;
- }
- sha_info->count_lo += (ap_uint32_t) count << 3;
- sha_info->count_hi += (ap_uint32_t) count >> 29;
- /* Is there a remainder of the previous Update operation? */
- if (sha_info->local) {
- i = SHA_BLOCKSIZE - sha_info->local;
- if (i > count) {
- i = count;
- }
- 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;
- if (sha_info->local == SHA_BLOCKSIZE) {
- maybe_byte_reverse(sha_info->data, SHA_BLOCKSIZE);
- sha_transform(sha_info);
- }
- else {
- return;
- }
- }
- while (count >= 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);
- }
- 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);
-#endif
-}
-
-/* finish computing the SHA digest */
-
-API_EXPORT(void) ap_SHA1Final(unsigned char digest[SHA_DIGESTSIZE],
- AP_SHA1_CTX *sha_info)
-{
- int count, i, j;
- ap_uint32_t lo_bit_count, hi_bit_count, k;
-
- lo_bit_count = sha_info->count_lo;
- hi_bit_count = sha_info->count_hi;
- count = (int) ((lo_bit_count >> 3) & 0x3f);
- ((AP_BYTE *) sha_info->data)[count++] = 0x80;
- if (count > SHA_BLOCKSIZE - 8) {
- memset(((AP_BYTE *) sha_info->data) + count, 0, SHA_BLOCKSIZE - count);
- maybe_byte_reverse(sha_info->data, SHA_BLOCKSIZE);
- sha_transform(sha_info);
- memset((AP_BYTE *) sha_info->data, 0, SHA_BLOCKSIZE - 8);
- }
- else {
- memset(((AP_BYTE *) sha_info->data) + count, 0,
- SHA_BLOCKSIZE - 8 - count);
- }
- maybe_byte_reverse(sha_info->data, SHA_BLOCKSIZE);
- sha_info->data[14] = hi_bit_count;
- sha_info->data[15] = lo_bit_count;
- sha_transform(sha_info);
-
- for (i = 0, j = 0; j < SHA_DIGESTSIZE; i++) {
- k = sha_info->digest[i];
- digest[j++] = (unsigned char) ((k >> 24) & 0xff);
- digest[j++] = (unsigned char) ((k >> 16) & 0xff);
- digest[j++] = (unsigned char) ((k >> 8) & 0xff);
- digest[j++] = (unsigned char) (k & 0xff);
- }
-}
-
-
-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, AP_SHA1PW_ID, AP_SHA1PW_IDLEN) == 0) {
- clear += AP_SHA1PW_IDLEN;
- }
-
- ap_SHA1Init(&context);
- ap_SHA1Update(&context, clear, len);
- ap_SHA1Final(digest, &context);
-
- /* private marker. */
- ap_cpystrn(out, AP_SHA1PW_ID, AP_SHA1PW_IDLEN + 1);
-
- /* SHA1 hash is always 20 chars */
- l = ap_base64encode_binary(out + AP_SHA1PW_IDLEN, digest, sizeof(digest));
- out[l + AP_SHA1PW_IDLEN] = '\0';
-
- /*
- * output of base64 encoded SHA1 is always 28 chars + AP_SHA1PW_IDLEN
- */
-}
diff --git a/crypto/apr_sha1.c b/crypto/apr_sha1.c
deleted file mode 100644
index 5acda4b8..00000000
--- a/crypto/apr_sha1.c
+++ /dev/null
@@ -1,411 +0,0 @@
-/* ====================================================================
- * The Apache Software License, Version 1.1
- *
- * Copyright (c) 2000 The Apache Software Foundation. All rights
- * reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * 3. The end-user documentation included with the redistribution,
- * if any, must include the following acknowledgment:
- * "This product includes software developed by the
- * Apache Software Foundation (http://www.apache.org/)."
- * Alternately, this acknowledgment may appear in the software itself,
- * if and wherever such third-party acknowledgments normally appear.
- *
- * 4. The names "Apache" and "Apache Software Foundation" must
- * not be used to endorse or promote products derived from this
- * software without prior written permission. For written
- * permission, please contact apache@apache.org.
- *
- * 5. Products derived from this software may not be called "Apache",
- * nor may "Apache" appear in their name, without prior written
- * permission of the Apache Software Foundation.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- * ====================================================================
- *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Software Foundation. For more
- * information on the Apache Software Foundation, please see
- * <http://www.apache.org/>.
- */
-
-/*
- * The exported function:
- *
- * ap_sha1_base64(const char *clear, int len, char *out);
- *
- * provides a means to SHA1 crypt/encode a plaintext password in
- * a way which makes password files compatible with those commonly
- * used in netscape web and ldap installations. It was put together
- * by Clinton Wong <clintdw@netcom.com>, who also notes that:
- *
- * Note: SHA1 support is useful for migration purposes, but is less
- * secure than Apache's password format, since Apache's (MD5)
- * password format uses a random eight character salt to generate
- * one of many possible hashes for the same password. Netscape
- * uses plain SHA1 without a salt, so the same password
- * will always generate the same hash, making it easier
- * to break since the search space is smaller.
- *
- * See also the documentation in support/SHA1 as to hints on how to
- * migrate an existing netscape installation and other supplied utitlites.
- *
- * This software also makes use of the following component:
- *
- * NIST Secure Hash Algorithm
- * heavily modified by Uwe Hollerbach uh@alumni.caltech edu
- * from Peter C. Gutmann's implementation as found in
- * Applied Cryptography by Bruce Schneier
- * This code is hereby placed in the public domain
- */
-
-#include "ap_config.h"
-#include "ap_sha1.h"
-#include "ap_base64.h"
-#include "apr_lib.h"
-#ifdef CHARSET_EBCDIC
-#include "apr_xlate.h"
-#endif /*CHARSET_EBCDIC*/
-
-/* a bit faster & bigger, if defined */
-#define UNROLL_LOOPS
-
-/* NIST's proposed modification to SHA, 7/11/94 */
-#define USE_MODIFIED_SHA
-
-/* SHA f()-functions */
-#define f1(x,y,z) ((x & y) | (~x & z))
-#define f2(x,y,z) (x ^ y ^ z)
-#define f3(x,y,z) ((x & y) | (x & z) | (y & z))
-#define f4(x,y,z) (x ^ y ^ z)
-
-/* SHA constants */
-#define CONST1 0x5a827999L
-#define CONST2 0x6ed9eba1L
-#define CONST3 0x8f1bbcdcL
-#define CONST4 0xca62c1d6L
-
-/* 32-bit rotate */
-
-#define ROT32(x,n) ((x << n) | (x >> (32 - n)))
-
-#define FUNC(n,i) \
- temp = ROT32(A,5) + f##n(B,C,D) + E + W[i] + CONST##n; \
- E = D; D = C; C = ROT32(B,30); B = A; A = temp
-
-#define SHA_BLOCKSIZE 64
-
-#ifdef CHARSET_EBCDIC
-static ap_xlate_t *ebcdic2ascii_xlate;
-
-API_EXPORT(ap_status_t) ap_SHA1InitEBCDIC(ap_xlate_t *x)
-{
- ap_status_t rv;
- int onoff;
-
- /* Only single-byte conversion is supported.
- */
- rv = ap_xlate_get_sb(x, &onoff);
- if (rv) {
- return rv;
- }
- if (!onoff) { /* If conversion is not single-byte-only */
- return APR_EINVAL;
- }
- ebcdic2ascii_xlate = x;
- return APR_SUCCESS;
-}
-#endif
-
-typedef unsigned char AP_BYTE;
-
-/* do SHA transformation */
-static void sha_transform(AP_SHA1_CTX *sha_info)
-{
- int i;
- ap_uint32_t temp, A, B, C, D, E, W[80];
-
- for (i = 0; i < 16; ++i) {
- W[i] = sha_info->data[i];
- }
- for (i = 16; i < 80; ++i) {
- W[i] = W[i-3] ^ W[i-8] ^ W[i-14] ^ W[i-16];
-#ifdef USE_MODIFIED_SHA
- W[i] = ROT32(W[i], 1);
-#endif /* USE_MODIFIED_SHA */
- }
- A = sha_info->digest[0];
- B = sha_info->digest[1];
- C = sha_info->digest[2];
- D = sha_info->digest[3];
- E = sha_info->digest[4];
-#ifdef UNROLL_LOOPS
- FUNC(1, 0); FUNC(1, 1); FUNC(1, 2); FUNC(1, 3); FUNC(1, 4);
- FUNC(1, 5); FUNC(1, 6); FUNC(1, 7); FUNC(1, 8); FUNC(1, 9);
- FUNC(1,10); FUNC(1,11); FUNC(1,12); FUNC(1,13); FUNC(1,14);
- FUNC(1,15); FUNC(1,16); FUNC(1,17); FUNC(1,18); FUNC(1,19);
-
- FUNC(2,20); FUNC(2,21); FUNC(2,22); FUNC(2,23); FUNC(2,24);
- FUNC(2,25); FUNC(2,26); FUNC(2,27); FUNC(2,28); FUNC(2,29);
- FUNC(2,30); FUNC(2,31); FUNC(2,32); FUNC(2,33); FUNC(2,34);
- FUNC(2,35); FUNC(2,36); FUNC(2,37); FUNC(2,38); FUNC(2,39);
-
- FUNC(3,40); FUNC(3,41); FUNC(3,42); FUNC(3,43); FUNC(3,44);
- FUNC(3,45); FUNC(3,46); FUNC(3,47); FUNC(3,48); FUNC(3,49);
- FUNC(3,50); FUNC(3,51); FUNC(3,52); FUNC(3,53); FUNC(3,54);
- FUNC(3,55); FUNC(3,56); FUNC(3,57); FUNC(3,58); FUNC(3,59);
-
- FUNC(4,60); FUNC(4,61); FUNC(4,62); FUNC(4,63); FUNC(4,64);
- FUNC(4,65); FUNC(4,66); FUNC(4,67); FUNC(4,68); FUNC(4,69);
- FUNC(4,70); FUNC(4,71); FUNC(4,72); FUNC(4,73); FUNC(4,74);
- FUNC(4,75); FUNC(4,76); FUNC(4,77); FUNC(4,78); FUNC(4,79);
-#else /* !UNROLL_LOOPS */
- for (i = 0; i < 20; ++i) {
- FUNC(1,i);
- }
- for (i = 20; i < 40; ++i) {
- FUNC(2,i);
- }
- for (i = 40; i < 60; ++i) {
- FUNC(3,i);
- }
- for (i = 60; i < 80; ++i) {
- FUNC(4,i);
- }
-#endif /* !UNROLL_LOOPS */
- sha_info->digest[0] += A;
- sha_info->digest[1] += B;
- sha_info->digest[2] += C;
- sha_info->digest[3] += D;
- sha_info->digest[4] += E;
-}
-
-union endianTest {
- long Long;
- char Char[sizeof(long)];
-};
-
-static char isLittleEndian(void)
-{
- static union endianTest u;
- u.Long = 1;
- return (u.Char[0] == 1);
-}
-
-/* change endianness of data */
-
-/* count is the number of bytes to do an endian flip */
-static void maybe_byte_reverse(ap_uint32_t *buffer, int count)
-{
- int i;
- AP_BYTE ct[4], *cp;
-
- if (isLittleEndian()) { /* do the swap only if it is little endian */
- count /= sizeof(ap_uint32_t);
- cp = (AP_BYTE *) buffer;
- for (i = 0; i < count; ++i) {
- ct[0] = cp[0];
- ct[1] = cp[1];
- ct[2] = cp[2];
- ct[3] = cp[3];
- cp[0] = ct[3];
- cp[1] = ct[2];
- cp[2] = ct[1];
- cp[3] = ct[0];
- cp += sizeof(ap_uint32_t);
- }
- }
-}
-
-/* initialize the SHA digest */
-
-API_EXPORT(void) ap_SHA1Init(AP_SHA1_CTX *sha_info)
-{
- sha_info->digest[0] = 0x67452301L;
- sha_info->digest[1] = 0xefcdab89L;
- sha_info->digest[2] = 0x98badcfeL;
- sha_info->digest[3] = 0x10325476L;
- sha_info->digest[4] = 0xc3d2e1f0L;
- sha_info->count_lo = 0L;
- sha_info->count_hi = 0L;
- sha_info->local = 0;
-}
-
-/* update the SHA digest */
-
-API_EXPORT(void) ap_SHA1Update_binary(AP_SHA1_CTX *sha_info,
- const unsigned char *buffer,
- unsigned int count)
-{
- unsigned int i;
-
- if ((sha_info->count_lo + ((ap_uint32_t) count << 3)) < sha_info->count_lo) {
- ++sha_info->count_hi;
- }
- sha_info->count_lo += (ap_uint32_t) count << 3;
- sha_info->count_hi += (ap_uint32_t) count >> 29;
- if (sha_info->local) {
- i = SHA_BLOCKSIZE - sha_info->local;
- if (i > count) {
- i = count;
- }
- memcpy(((AP_BYTE *) sha_info->data) + sha_info->local, buffer, i);
- count -= i;
- buffer += i;
- sha_info->local += i;
- if (sha_info->local == SHA_BLOCKSIZE) {
- maybe_byte_reverse(sha_info->data, SHA_BLOCKSIZE);
- sha_transform(sha_info);
- }
- else {
- return;
- }
- }
- while (count >= SHA_BLOCKSIZE) {
- memcpy(sha_info->data, buffer, SHA_BLOCKSIZE);
- buffer += SHA_BLOCKSIZE;
- count -= SHA_BLOCKSIZE;
- maybe_byte_reverse(sha_info->data, SHA_BLOCKSIZE);
- sha_transform(sha_info);
- }
- memcpy(sha_info->data, buffer, count);
- sha_info->local = count;
-}
-
-API_EXPORT(void) ap_SHA1Update(AP_SHA1_CTX *sha_info, const char *buf,
- unsigned int count)
-{
-#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;
- }
- sha_info->count_lo += (ap_uint32_t) count << 3;
- sha_info->count_hi += (ap_uint32_t) count >> 29;
- /* Is there a remainder of the previous Update operation? */
- if (sha_info->local) {
- i = SHA_BLOCKSIZE - sha_info->local;
- if (i > count) {
- i = count;
- }
- 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;
- if (sha_info->local == SHA_BLOCKSIZE) {
- maybe_byte_reverse(sha_info->data, SHA_BLOCKSIZE);
- sha_transform(sha_info);
- }
- else {
- return;
- }
- }
- while (count >= 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);
- }
- 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);
-#endif
-}
-
-/* finish computing the SHA digest */
-
-API_EXPORT(void) ap_SHA1Final(unsigned char digest[SHA_DIGESTSIZE],
- AP_SHA1_CTX *sha_info)
-{
- int count, i, j;
- ap_uint32_t lo_bit_count, hi_bit_count, k;
-
- lo_bit_count = sha_info->count_lo;
- hi_bit_count = sha_info->count_hi;
- count = (int) ((lo_bit_count >> 3) & 0x3f);
- ((AP_BYTE *) sha_info->data)[count++] = 0x80;
- if (count > SHA_BLOCKSIZE - 8) {
- memset(((AP_BYTE *) sha_info->data) + count, 0, SHA_BLOCKSIZE - count);
- maybe_byte_reverse(sha_info->data, SHA_BLOCKSIZE);
- sha_transform(sha_info);
- memset((AP_BYTE *) sha_info->data, 0, SHA_BLOCKSIZE - 8);
- }
- else {
- memset(((AP_BYTE *) sha_info->data) + count, 0,
- SHA_BLOCKSIZE - 8 - count);
- }
- maybe_byte_reverse(sha_info->data, SHA_BLOCKSIZE);
- sha_info->data[14] = hi_bit_count;
- sha_info->data[15] = lo_bit_count;
- sha_transform(sha_info);
-
- for (i = 0, j = 0; j < SHA_DIGESTSIZE; i++) {
- k = sha_info->digest[i];
- digest[j++] = (unsigned char) ((k >> 24) & 0xff);
- digest[j++] = (unsigned char) ((k >> 16) & 0xff);
- digest[j++] = (unsigned char) ((k >> 8) & 0xff);
- digest[j++] = (unsigned char) (k & 0xff);
- }
-}
-
-
-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, AP_SHA1PW_ID, AP_SHA1PW_IDLEN) == 0) {
- clear += AP_SHA1PW_IDLEN;
- }
-
- ap_SHA1Init(&context);
- ap_SHA1Update(&context, clear, len);
- ap_SHA1Final(digest, &context);
-
- /* private marker. */
- ap_cpystrn(out, AP_SHA1PW_ID, AP_SHA1PW_IDLEN + 1);
-
- /* SHA1 hash is always 20 chars */
- l = ap_base64encode_binary(out + AP_SHA1PW_IDLEN, digest, sizeof(digest));
- out[l + AP_SHA1PW_IDLEN] = '\0';
-
- /*
- * output of base64 encoded SHA1 is always 28 chars + AP_SHA1PW_IDLEN
- */
-}
diff --git a/encoding/ap_base64.c b/encoding/ap_base64.c
deleted file mode 100644
index 8bff85bb..00000000
--- a/encoding/ap_base64.c
+++ /dev/null
@@ -1,311 +0,0 @@
-/* ====================================================================
- * The Apache Software License, Version 1.1
- *
- * Copyright (c) 2000 The Apache Software Foundation. All rights
- * reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * 3. The end-user documentation included with the redistribution,
- * if any, must include the following acknowledgment:
- * "This product includes software developed by the
- * Apache Software Foundation (http://www.apache.org/)."
- * Alternately, this acknowledgment may appear in the software itself,
- * if and wherever such third-party acknowledgments normally appear.
- *
- * 4. The names "Apache" and "Apache Software Foundation" must
- * not be used to endorse or promote products derived from this
- * software without prior written permission. For written
- * permission, please contact apache@apache.org.
- *
- * 5. Products derived from this software may not be called "Apache",
- * nor may "Apache" appear in their name, without prior written
- * permission of the Apache Software Foundation.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- * ====================================================================
- *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Software Foundation. For more
- * information on the Apache Software Foundation, please see
- * <http://www.apache.org/>.
- *
- * Portions of this software are based upon public domain software
- * originally written at the National Center for Supercomputing Applications,
- * University of Illinois, Urbana-Champaign.
- */
-
-/* base64 encoder/decoder. Originally part of main/util.c
- * but moved here so that support/ab and ap_sha1.c could
- * use it. This meant removing the ap_palloc()s and adding
- * ugly 'len' functions, which is quite a nasty cost.
- */
-
-#include "ap_config.h"
-#include "ap_base64.h"
-#ifdef CHARSET_EBCDIC
-#include "apr_xlate.h"
-#endif /* CHARSET_EBCDIC */
-
-/* aaaack but it's fast and const should make it shared text page. */
-static const unsigned char pr2six[256] =
-{
-#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
-#else /*CHARSET_EBCDIC*/
- /* EBCDIC 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, 64, 64, 64, 64, 64,
- 64, 64, 64, 64, 64, 64, 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, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
- 64, 63, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
- 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
- 64, 26, 27, 28, 29, 30, 31, 32, 33, 34, 64, 64, 64, 64, 64, 64,
- 64, 35, 36, 37, 38, 39, 40, 41, 42, 43, 64, 64, 64, 64, 64, 64,
- 64, 64, 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, 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
-#endif /*CHARSET_EBCDIC*/
-};
-
-#ifdef CHARSET_EBCDIC
-static ap_xlate_t *xlate_to_ebcdic;
-static unsigned char os_toascii[256];
-
-API_EXPORT(ap_status_t) ap_base64init_ebcdic(ap_xlate_t *to_ascii,
- ap_xlate_t *to_ebcdic)
-{
- int i;
- ap_size_t inbytes_left, outbytes_left;
- ap_status_t rv;
- int onoff;
-
- /* Only single-byte conversion is supported.
- */
- rv = ap_xlate_get_sb(to_ascii, &onoff);
- if (rv) {
- return rv;
- }
- if (!onoff) { /* If conversion is not single-byte-only */
- return APR_EINVAL;
- }
- rv = ap_xlate_get_sb(to_ebcdic, &onoff);
- if (rv) {
- return rv;
- }
- if (!onoff) { /* If conversion is not single-byte-only */
- return APR_EINVAL;
- }
- xlate_to_ebcdic = to_ebcdic;
- for (i = 0; i < sizeof(os_toascii); i++) {
- os_toascii[i] = i;
- }
- inbytes_left = outbytes_left = sizeof(os_toascii);
- ap_xlate_conv_buffer(to_ascii, os_toascii, &inbytes_left,
- os_toascii, &outbytes_left);
-
- return APR_SUCCESS;
-}
-#endif /*CHARSET_EBCDIC*/
-
-API_EXPORT(int) ap_base64decode_len(const char *bufcoded)
-{
- int nbytesdecoded;
- register const unsigned char *bufin;
- register int nprbytes;
-
- bufin = (const unsigned char *) bufcoded;
- while (pr2six[*(bufin++)] <= 63);
-
- nprbytes = (bufin - (const unsigned char *) bufcoded) - 1;
- nbytesdecoded = ((nprbytes + 3) / 4) * 3;
-
- return nbytesdecoded + 1;
-}
-
-API_EXPORT(int) ap_base64decode(char *bufplain, const char *bufcoded)
-{
-#ifdef CHARSET_EBCDIC
- ap_size_t inbytes_left, outbytes_left;
-#endif /* CHARSET_EBCDIC */
- int len;
-
- len = ap_base64decode_binary((unsigned char *) bufplain, bufcoded);
-#ifdef CHARSET_EBCDIC
- inbytes_left = outbytes_left = len;
- ap_xlate_conv_buffer(xlate_to_ebcdic, bufplain, &inbytes_left,
- bufplain, &outbytes_left);
-#endif /* CHARSET_EBCDIC */
- bufplain[len] = '\0';
- return len;
-}
-
-/* This is the same as ap_base64decode() except on EBCDIC machines, where
- * the conversion of the output to ebcdic is left out.
- */
-API_EXPORT(int) ap_base64decode_binary(unsigned char *bufplain,
- const char *bufcoded)
-{
- int nbytesdecoded;
- register const unsigned char *bufin;
- register unsigned char *bufout;
- register int nprbytes;
-
- bufin = (const unsigned char *) bufcoded;
- while (pr2six[*(bufin++)] <= 63);
- nprbytes = (bufin - (const unsigned char *) bufcoded) - 1;
- nbytesdecoded = ((nprbytes + 3) / 4) * 3;
-
- bufout = (unsigned char *) bufplain;
- bufin = (const unsigned char *) bufcoded;
-
- while (nprbytes > 4) {
- *(bufout++) =
- (unsigned char) (pr2six[*bufin] << 2 | pr2six[bufin[1]] >> 4);
- *(bufout++) =
- (unsigned char) (pr2six[bufin[1]] << 4 | pr2six[bufin[2]] >> 2);
- *(bufout++) =
- (unsigned char) (pr2six[bufin[2]] << 6 | pr2six[bufin[3]]);
- bufin += 4;
- nprbytes -= 4;
- }
-
- /* Note: (nprbytes == 1) would be an error, so just ingore that case */
- if (nprbytes > 1) {
- *(bufout++) =
- (unsigned char) (pr2six[*bufin] << 2 | pr2six[bufin[1]] >> 4);
- }
- if (nprbytes > 2) {
- *(bufout++) =
- (unsigned char) (pr2six[bufin[1]] << 4 | pr2six[bufin[2]] >> 2);
- }
- if (nprbytes > 3) {
- *(bufout++) =
- (unsigned char) (pr2six[bufin[2]] << 6 | pr2six[bufin[3]]);
- }
-
- nbytesdecoded -= (4 - nprbytes) & 3;
- return nbytesdecoded;
-}
-
-static const char basis_64[] =
- "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
-
-API_EXPORT(int) ap_base64encode_len(int len)
-{
- return ((len + 2) / 3 * 4) + 1;
-}
-
-API_EXPORT(int) ap_base64encode(char *encoded, const char *string, int len)
-{
-#ifndef CHARSET_EBCDIC
- return ap_base64encode_binary(encoded, (const unsigned char *) string, len);
-#else /* CHARSET_EBCDIC */
- int i;
- char *p;
-
- 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 + 2]] & 0x3F];
- }
- if (i < len) {
- *p++ = basis_64[(os_toascii[string[i]] >> 2) & 0x3F];
- if (i == (len - 1)) {
- *p++ = basis_64[((os_toascii[string[i]] & 0x3) << 4)];
- *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 + 1]] & 0xF) << 2)];
- }
- *p++ = '=';
- }
-
- *p++ = '\0';
- return p - encoded;
-#endif /* CHARSET_EBCDIC */
-}
-
-/* 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)
-{
- int i;
- char *p;
-
- 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 + 2] & 0x3F];
- }
- if (i < len) {
- *p++ = basis_64[(string[i] >> 2) & 0x3F];
- if (i == (len - 1)) {
- *p++ = basis_64[((string[i] & 0x3) << 4)];
- *p++ = '=';
- }
- else {
- *p++ = basis_64[((string[i] & 0x3) << 4) |
- ((int) (string[i + 1] & 0xF0) >> 4)];
- *p++ = basis_64[((string[i + 1] & 0xF) << 2)];
- }
- *p++ = '=';
- }
-
- *p++ = '\0';
- return p - encoded;
-}
diff --git a/encoding/apr_base64.c b/encoding/apr_base64.c
deleted file mode 100644
index 8bff85bb..00000000
--- a/encoding/apr_base64.c
+++ /dev/null
@@ -1,311 +0,0 @@
-/* ====================================================================
- * The Apache Software License, Version 1.1
- *
- * Copyright (c) 2000 The Apache Software Foundation. All rights
- * reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * 3. The end-user documentation included with the redistribution,
- * if any, must include the following acknowledgment:
- * "This product includes software developed by the
- * Apache Software Foundation (http://www.apache.org/)."
- * Alternately, this acknowledgment may appear in the software itself,
- * if and wherever such third-party acknowledgments normally appear.
- *
- * 4. The names "Apache" and "Apache Software Foundation" must
- * not be used to endorse or promote products derived from this
- * software without prior written permission. For written
- * permission, please contact apache@apache.org.
- *
- * 5. Products derived from this software may not be called "Apache",
- * nor may "Apache" appear in their name, without prior written
- * permission of the Apache Software Foundation.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- * ====================================================================
- *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Software Foundation. For more
- * information on the Apache Software Foundation, please see
- * <http://www.apache.org/>.
- *
- * Portions of this software are based upon public domain software
- * originally written at the National Center for Supercomputing Applications,
- * University of Illinois, Urbana-Champaign.
- */
-
-/* base64 encoder/decoder. Originally part of main/util.c
- * but moved here so that support/ab and ap_sha1.c could
- * use it. This meant removing the ap_palloc()s and adding
- * ugly 'len' functions, which is quite a nasty cost.
- */
-
-#include "ap_config.h"
-#include "ap_base64.h"
-#ifdef CHARSET_EBCDIC
-#include "apr_xlate.h"
-#endif /* CHARSET_EBCDIC */
-
-/* aaaack but it's fast and const should make it shared text page. */
-static const unsigned char pr2six[256] =
-{
-#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
-#else /*CHARSET_EBCDIC*/
- /* EBCDIC 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, 64, 64, 64, 64, 64,
- 64, 64, 64, 64, 64, 64, 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, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
- 64, 63, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
- 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
- 64, 26, 27, 28, 29, 30, 31, 32, 33, 34, 64, 64, 64, 64, 64, 64,
- 64, 35, 36, 37, 38, 39, 40, 41, 42, 43, 64, 64, 64, 64, 64, 64,
- 64, 64, 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, 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
-#endif /*CHARSET_EBCDIC*/
-};
-
-#ifdef CHARSET_EBCDIC
-static ap_xlate_t *xlate_to_ebcdic;
-static unsigned char os_toascii[256];
-
-API_EXPORT(ap_status_t) ap_base64init_ebcdic(ap_xlate_t *to_ascii,
- ap_xlate_t *to_ebcdic)
-{
- int i;
- ap_size_t inbytes_left, outbytes_left;
- ap_status_t rv;
- int onoff;
-
- /* Only single-byte conversion is supported.
- */
- rv = ap_xlate_get_sb(to_ascii, &onoff);
- if (rv) {
- return rv;
- }
- if (!onoff) { /* If conversion is not single-byte-only */
- return APR_EINVAL;
- }
- rv = ap_xlate_get_sb(to_ebcdic, &onoff);
- if (rv) {
- return rv;
- }
- if (!onoff) { /* If conversion is not single-byte-only */
- return APR_EINVAL;
- }
- xlate_to_ebcdic = to_ebcdic;
- for (i = 0; i < sizeof(os_toascii); i++) {
- os_toascii[i] = i;
- }
- inbytes_left = outbytes_left = sizeof(os_toascii);
- ap_xlate_conv_buffer(to_ascii, os_toascii, &inbytes_left,
- os_toascii, &outbytes_left);
-
- return APR_SUCCESS;
-}
-#endif /*CHARSET_EBCDIC*/
-
-API_EXPORT(int) ap_base64decode_len(const char *bufcoded)
-{
- int nbytesdecoded;
- register const unsigned char *bufin;
- register int nprbytes;
-
- bufin = (const unsigned char *) bufcoded;
- while (pr2six[*(bufin++)] <= 63);
-
- nprbytes = (bufin - (const unsigned char *) bufcoded) - 1;
- nbytesdecoded = ((nprbytes + 3) / 4) * 3;
-
- return nbytesdecoded + 1;
-}
-
-API_EXPORT(int) ap_base64decode(char *bufplain, const char *bufcoded)
-{
-#ifdef CHARSET_EBCDIC
- ap_size_t inbytes_left, outbytes_left;
-#endif /* CHARSET_EBCDIC */
- int len;
-
- len = ap_base64decode_binary((unsigned char *) bufplain, bufcoded);
-#ifdef CHARSET_EBCDIC
- inbytes_left = outbytes_left = len;
- ap_xlate_conv_buffer(xlate_to_ebcdic, bufplain, &inbytes_left,
- bufplain, &outbytes_left);
-#endif /* CHARSET_EBCDIC */
- bufplain[len] = '\0';
- return len;
-}
-
-/* This is the same as ap_base64decode() except on EBCDIC machines, where
- * the conversion of the output to ebcdic is left out.
- */
-API_EXPORT(int) ap_base64decode_binary(unsigned char *bufplain,
- const char *bufcoded)
-{
- int nbytesdecoded;
- register const unsigned char *bufin;
- register unsigned char *bufout;
- register int nprbytes;
-
- bufin = (const unsigned char *) bufcoded;
- while (pr2six[*(bufin++)] <= 63);
- nprbytes = (bufin - (const unsigned char *) bufcoded) - 1;
- nbytesdecoded = ((nprbytes + 3) / 4) * 3;
-
- bufout = (unsigned char *) bufplain;
- bufin = (const unsigned char *) bufcoded;
-
- while (nprbytes > 4) {
- *(bufout++) =
- (unsigned char) (pr2six[*bufin] << 2 | pr2six[bufin[1]] >> 4);
- *(bufout++) =
- (unsigned char) (pr2six[bufin[1]] << 4 | pr2six[bufin[2]] >> 2);
- *(bufout++) =
- (unsigned char) (pr2six[bufin[2]] << 6 | pr2six[bufin[3]]);
- bufin += 4;
- nprbytes -= 4;
- }
-
- /* Note: (nprbytes == 1) would be an error, so just ingore that case */
- if (nprbytes > 1) {
- *(bufout++) =
- (unsigned char) (pr2six[*bufin] << 2 | pr2six[bufin[1]] >> 4);
- }
- if (nprbytes > 2) {
- *(bufout++) =
- (unsigned char) (pr2six[bufin[1]] << 4 | pr2six[bufin[2]] >> 2);
- }
- if (nprbytes > 3) {
- *(bufout++) =
- (unsigned char) (pr2six[bufin[2]] << 6 | pr2six[bufin[3]]);
- }
-
- nbytesdecoded -= (4 - nprbytes) & 3;
- return nbytesdecoded;
-}
-
-static const char basis_64[] =
- "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
-
-API_EXPORT(int) ap_base64encode_len(int len)
-{
- return ((len + 2) / 3 * 4) + 1;
-}
-
-API_EXPORT(int) ap_base64encode(char *encoded, const char *string, int len)
-{
-#ifndef CHARSET_EBCDIC
- return ap_base64encode_binary(encoded, (const unsigned char *) string, len);
-#else /* CHARSET_EBCDIC */
- int i;
- char *p;
-
- 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 + 2]] & 0x3F];
- }
- if (i < len) {
- *p++ = basis_64[(os_toascii[string[i]] >> 2) & 0x3F];
- if (i == (len - 1)) {
- *p++ = basis_64[((os_toascii[string[i]] & 0x3) << 4)];
- *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 + 1]] & 0xF) << 2)];
- }
- *p++ = '=';
- }
-
- *p++ = '\0';
- return p - encoded;
-#endif /* CHARSET_EBCDIC */
-}
-
-/* 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)
-{
- int i;
- char *p;
-
- 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 + 2] & 0x3F];
- }
- if (i < len) {
- *p++ = basis_64[(string[i] >> 2) & 0x3F];
- if (i == (len - 1)) {
- *p++ = basis_64[((string[i] & 0x3) << 4)];
- *p++ = '=';
- }
- else {
- *p++ = basis_64[((string[i] & 0x3) << 4) |
- ((int) (string[i + 1] & 0xF0) >> 4)];
- *p++ = basis_64[((string[i + 1] & 0xF) << 2)];
- }
- *p++ = '=';
- }
-
- *p++ = '\0';
- return p - encoded;
-}
diff --git a/hooks/ap_hooks.c b/hooks/ap_hooks.c
deleted file mode 100644
index cd07e826..00000000
--- a/hooks/ap_hooks.c
+++ /dev/null
@@ -1,237 +0,0 @@
-#include "ap_config.h"
-#include "ap_hooks.h"
-#include <assert.h>
-
-#if 0
-#define ap_palloc(pool,size) malloc(size)
-#endif
-
-API_VAR_EXPORT ap_pool_t *ap_global_hook_pool = NULL;
-API_VAR_EXPORT int ap_debug_module_hooks = FALSE;
-API_VAR_EXPORT const char *ap_debug_module_name = NULL;
-
-/* NB: This must echo the LINK_##name structure */
-typedef struct
-{
- void (*dummy)(void *);
- const char *szName;
- const char * const *aszPredecessors;
- const char * const *aszSuccessors;
- int nOrder;
-} TSortData;
-
-typedef struct tsort_
-{
- void *pData;
- int nPredecessors;
- struct tsort_ **ppPredecessors;
- struct tsort_ *pNext;
-} TSort;
-
-static int crude_order(const void *a_,const void *b_)
-{
- const TSortData *a=a_;
- const TSortData *b=b_;
-
- return a->nOrder-b->nOrder;
-}
-
-static TSort *prepare(ap_pool_t *p,TSortData *pItems,int nItems)
-{
- TSort *pData=ap_palloc(p,nItems*sizeof *pData);
- int n;
-
- qsort(pItems,nItems,sizeof *pItems,crude_order);
- for(n=0 ; n < nItems ; ++n) {
- pData[n].nPredecessors=0;
- pData[n].ppPredecessors=ap_pcalloc(p,nItems*sizeof *pData[n].ppPredecessors);
- pData[n].pNext=NULL;
- pData[n].pData=&pItems[n];
- }
-
- for(n=0 ; n < nItems ; ++n) {
- int i,k;
-
- for(i=0 ; pItems[n].aszPredecessors && pItems[n].aszPredecessors[i] ; ++i)
- for(k=0 ; k < nItems ; ++k)
- if(!strcmp(pItems[k].szName,pItems[n].aszPredecessors[i])) {
- int l;
-
- for(l=0 ; l < pData[n].nPredecessors ; ++l)
- if(pData[n].ppPredecessors[l] == &pData[k])
- goto got_it;
- pData[n].ppPredecessors[pData[n].nPredecessors]=&pData[k];
- ++pData[n].nPredecessors;
- got_it:
- break;
- }
- for(i=0 ; pItems[n].aszSuccessors && pItems[n].aszSuccessors[i] ; ++i)
- for(k=0 ; k < nItems ; ++k)
- if(!strcmp(pItems[k].szName,pItems[n].aszSuccessors[i])) {
- int l;
-
- for(l=0 ; l < pData[k].nPredecessors ; ++l)
- if(pData[k].ppPredecessors[l] == &pData[n])
- goto got_it2;
- pData[k].ppPredecessors[pData[k].nPredecessors]=&pData[n];
- ++pData[k].nPredecessors;
- got_it2:
- break;
- }
- }
-
- return pData;
-}
-
-static TSort *tsort(TSort *pData,int nItems)
-{
- int nTotal;
- TSort *pHead=NULL;
- TSort *pTail=NULL;
-
- for(nTotal=0 ; nTotal < nItems ; ++nTotal) {
- int n,i,k;
-
- for(n=0 ; ; ++n) {
- if(n == nItems)
- assert(0); /* // we have a loop... */
- if(!pData[n].pNext && !pData[n].nPredecessors)
- break;
- }
- if(pTail)
- pTail->pNext=&pData[n];
- else
- pHead=&pData[n];
- pTail=&pData[n];
- pTail->pNext=pTail; /* // fudge it so it looks linked */
- for(i=0 ; i < nItems ; ++i)
- for(k=0 ; pData[i].ppPredecessors[k] ; ++k)
- if(pData[i].ppPredecessors[k] == &pData[n]) {
- --pData[i].nPredecessors;
- break;
- }
- }
- pTail->pNext=NULL; /* // unfudge the tail */
- return pHead;
-}
-
-static ap_array_header_t *sort_hook(ap_array_header_t *pHooks,const char *szName)
-{
- ap_pool_t *p;
- TSort *pSort;
- ap_array_header_t *pNew;
- int n;
-
- ap_create_pool(&p, ap_global_hook_pool);
- pSort=prepare(p,(TSortData *)pHooks->elts,pHooks->nelts);
- pSort=tsort(pSort,pHooks->nelts);
- pNew=ap_make_array(ap_global_hook_pool,pHooks->nelts,sizeof(TSortData));
- if(ap_debug_module_hooks)
- printf("Sorting %s:",szName);
- for(n=0 ; pSort ; pSort=pSort->pNext,++n) {
- TSortData *pHook;
- assert(n < pHooks->nelts);
- pHook=ap_push_array(pNew);
- memcpy(pHook,pSort->pData,sizeof *pHook);
- if(ap_debug_module_hooks)
- printf(" %s",pHook->szName);
- }
- if(ap_debug_module_hooks)
- fputc('\n',stdout);
- return pNew;
-}
-
-static ap_array_header_t *s_aHooksToSort;
-typedef struct
-{
- const char *szHookName;
- ap_array_header_t **paHooks;
-} HookSortEntry;
-
-API_EXPORT(void) ap_hook_sort_register(const char *szHookName,
- ap_array_header_t **paHooks)
-{
- HookSortEntry *pEntry;
-
- if(!s_aHooksToSort)
- s_aHooksToSort=ap_make_array(ap_global_hook_pool,1,sizeof(HookSortEntry));
- pEntry=ap_push_array(s_aHooksToSort);
- pEntry->szHookName=szHookName;
- pEntry->paHooks=paHooks;
-}
-
-API_EXPORT(void) ap_sort_hooks()
-{
- int n;
-
- for(n=0 ; n < s_aHooksToSort->nelts ; ++n) {
- HookSortEntry *pEntry=&((HookSortEntry *)s_aHooksToSort->elts)[n];
- *pEntry->paHooks=sort_hook(*pEntry->paHooks,pEntry->szHookName);
- }
-}
-
-API_EXPORT(void) ap_hook_deregister_all(void)
-{
- int n;
-
- for(n=0 ; n < s_aHooksToSort->nelts ; ++n) {
- HookSortEntry *pEntry=&((HookSortEntry *)s_aHooksToSort->elts)[n];
- *pEntry->paHooks=NULL;
- }
- s_aHooksToSort=NULL;
-}
-
-API_EXPORT(void) ap_show_hook(const char *szName,const char * const *aszPre,
- const char * const *aszSucc)
-{
- int nFirst;
-
- printf(" Hooked %s",szName);
- if(aszPre) {
- fputs(" pre(",stdout);
- nFirst=1;
- while(*aszPre) {
- if(!nFirst)
- fputc(',',stdout);
- nFirst=0;
- fputs(*aszPre,stdout);
- ++aszPre;
- }
- fputc(')',stdout);
- }
- if(aszSucc) {
- fputs(" succ(",stdout);
- nFirst=1;
- while(*aszSucc) {
- if(!nFirst)
- fputc(',',stdout);
- nFirst=0;
- fputs(*aszSucc,stdout);
- ++aszSucc;
- }
- fputc(')',stdout);
- }
- fputc('\n',stdout);
-}
-
-#if 0
-void main()
-{
- const char *aszAPre[]={"b","c",NULL};
- const char *aszBPost[]={"a",NULL};
- const char *aszCPost[]={"b",NULL};
- TSortData t1[]=
- {
- { "a",aszAPre,NULL },
- { "b",NULL,aszBPost },
- { "c",NULL,aszCPost }
- };
- TSort *pResult;
-
- pResult=prepare(t1,3);
- pResult=tsort(pResult,3);
-
- for( ; pResult ; pResult=pResult->pNext)
- printf("%s\n",pResult->pData->szName);
-}
-#endif
diff --git a/hooks/apr_hooks.c b/hooks/apr_hooks.c
deleted file mode 100644
index cd07e826..00000000
--- a/hooks/apr_hooks.c
+++ /dev/null
@@ -1,237 +0,0 @@
-#include "ap_config.h"
-#include "ap_hooks.h"
-#include <assert.h>
-
-#if 0
-#define ap_palloc(pool,size) malloc(size)
-#endif
-
-API_VAR_EXPORT ap_pool_t *ap_global_hook_pool = NULL;
-API_VAR_EXPORT int ap_debug_module_hooks = FALSE;
-API_VAR_EXPORT const char *ap_debug_module_name = NULL;
-
-/* NB: This must echo the LINK_##name structure */
-typedef struct
-{
- void (*dummy)(void *);
- const char *szName;
- const char * const *aszPredecessors;
- const char * const *aszSuccessors;
- int nOrder;
-} TSortData;
-
-typedef struct tsort_
-{
- void *pData;
- int nPredecessors;
- struct tsort_ **ppPredecessors;
- struct tsort_ *pNext;
-} TSort;
-
-static int crude_order(const void *a_,const void *b_)
-{
- const TSortData *a=a_;
- const TSortData *b=b_;
-
- return a->nOrder-b->nOrder;
-}
-
-static TSort *prepare(ap_pool_t *p,TSortData *pItems,int nItems)
-{
- TSort *pData=ap_palloc(p,nItems*sizeof *pData);
- int n;
-
- qsort(pItems,nItems,sizeof *pItems,crude_order);
- for(n=0 ; n < nItems ; ++n) {
- pData[n].nPredecessors=0;
- pData[n].ppPredecessors=ap_pcalloc(p,nItems*sizeof *pData[n].ppPredecessors);
- pData[n].pNext=NULL;
- pData[n].pData=&pItems[n];
- }
-
- for(n=0 ; n < nItems ; ++n) {
- int i,k;
-
- for(i=0 ; pItems[n].aszPredecessors && pItems[n].aszPredecessors[i] ; ++i)
- for(k=0 ; k < nItems ; ++k)
- if(!strcmp(pItems[k].szName,pItems[n].aszPredecessors[i])) {
- int l;
-
- for(l=0 ; l < pData[n].nPredecessors ; ++l)
- if(pData[n].ppPredecessors[l] == &pData[k])
- goto got_it;
- pData[n].ppPredecessors[pData[n].nPredecessors]=&pData[k];
- ++pData[n].nPredecessors;
- got_it:
- break;
- }
- for(i=0 ; pItems[n].aszSuccessors && pItems[n].aszSuccessors[i] ; ++i)
- for(k=0 ; k < nItems ; ++k)
- if(!strcmp(pItems[k].szName,pItems[n].aszSuccessors[i])) {
- int l;
-
- for(l=0 ; l < pData[k].nPredecessors ; ++l)
- if(pData[k].ppPredecessors[l] == &pData[n])
- goto got_it2;
- pData[k].ppPredecessors[pData[k].nPredecessors]=&pData[n];
- ++pData[k].nPredecessors;
- got_it2:
- break;
- }
- }
-
- return pData;
-}
-
-static TSort *tsort(TSort *pData,int nItems)
-{
- int nTotal;
- TSort *pHead=NULL;
- TSort *pTail=NULL;
-
- for(nTotal=0 ; nTotal < nItems ; ++nTotal) {
- int n,i,k;
-
- for(n=0 ; ; ++n) {
- if(n == nItems)
- assert(0); /* // we have a loop... */
- if(!pData[n].pNext && !pData[n].nPredecessors)
- break;
- }
- if(pTail)
- pTail->pNext=&pData[n];
- else
- pHead=&pData[n];
- pTail=&pData[n];
- pTail->pNext=pTail; /* // fudge it so it looks linked */
- for(i=0 ; i < nItems ; ++i)
- for(k=0 ; pData[i].ppPredecessors[k] ; ++k)
- if(pData[i].ppPredecessors[k] == &pData[n]) {
- --pData[i].nPredecessors;
- break;
- }
- }
- pTail->pNext=NULL; /* // unfudge the tail */
- return pHead;
-}
-
-static ap_array_header_t *sort_hook(ap_array_header_t *pHooks,const char *szName)
-{
- ap_pool_t *p;
- TSort *pSort;
- ap_array_header_t *pNew;
- int n;
-
- ap_create_pool(&p, ap_global_hook_pool);
- pSort=prepare(p,(TSortData *)pHooks->elts,pHooks->nelts);
- pSort=tsort(pSort,pHooks->nelts);
- pNew=ap_make_array(ap_global_hook_pool,pHooks->nelts,sizeof(TSortData));
- if(ap_debug_module_hooks)
- printf("Sorting %s:",szName);
- for(n=0 ; pSort ; pSort=pSort->pNext,++n) {
- TSortData *pHook;
- assert(n < pHooks->nelts);
- pHook=ap_push_array(pNew);
- memcpy(pHook,pSort->pData,sizeof *pHook);
- if(ap_debug_module_hooks)
- printf(" %s",pHook->szName);
- }
- if(ap_debug_module_hooks)
- fputc('\n',stdout);
- return pNew;
-}
-
-static ap_array_header_t *s_aHooksToSort;
-typedef struct
-{
- const char *szHookName;
- ap_array_header_t **paHooks;
-} HookSortEntry;
-
-API_EXPORT(void) ap_hook_sort_register(const char *szHookName,
- ap_array_header_t **paHooks)
-{
- HookSortEntry *pEntry;
-
- if(!s_aHooksToSort)
- s_aHooksToSort=ap_make_array(ap_global_hook_pool,1,sizeof(HookSortEntry));
- pEntry=ap_push_array(s_aHooksToSort);
- pEntry->szHookName=szHookName;
- pEntry->paHooks=paHooks;
-}
-
-API_EXPORT(void) ap_sort_hooks()
-{
- int n;
-
- for(n=0 ; n < s_aHooksToSort->nelts ; ++n) {
- HookSortEntry *pEntry=&((HookSortEntry *)s_aHooksToSort->elts)[n];
- *pEntry->paHooks=sort_hook(*pEntry->paHooks,pEntry->szHookName);
- }
-}
-
-API_EXPORT(void) ap_hook_deregister_all(void)
-{
- int n;
-
- for(n=0 ; n < s_aHooksToSort->nelts ; ++n) {
- HookSortEntry *pEntry=&((HookSortEntry *)s_aHooksToSort->elts)[n];
- *pEntry->paHooks=NULL;
- }
- s_aHooksToSort=NULL;
-}
-
-API_EXPORT(void) ap_show_hook(const char *szName,const char * const *aszPre,
- const char * const *aszSucc)
-{
- int nFirst;
-
- printf(" Hooked %s",szName);
- if(aszPre) {
- fputs(" pre(",stdout);
- nFirst=1;
- while(*aszPre) {
- if(!nFirst)
- fputc(',',stdout);
- nFirst=0;
- fputs(*aszPre,stdout);
- ++aszPre;
- }
- fputc(')',stdout);
- }
- if(aszSucc) {
- fputs(" succ(",stdout);
- nFirst=1;
- while(*aszSucc) {
- if(!nFirst)
- fputc(',',stdout);
- nFirst=0;
- fputs(*aszSucc,stdout);
- ++aszSucc;
- }
- fputc(')',stdout);
- }
- fputc('\n',stdout);
-}
-
-#if 0
-void main()
-{
- const char *aszAPre[]={"b","c",NULL};
- const char *aszBPost[]={"a",NULL};
- const char *aszCPost[]={"b",NULL};
- TSortData t1[]=
- {
- { "a",aszAPre,NULL },
- { "b",NULL,aszBPost },
- { "c",NULL,aszCPost }
- };
- TSort *pResult;
-
- pResult=prepare(t1,3);
- pResult=tsort(pResult,3);
-
- for( ; pResult ; pResult=pResult->pNext)
- printf("%s\n",pResult->pData->szName);
-}
-#endif
diff --git a/include/ap_base64.h b/include/ap_base64.h
deleted file mode 100644
index 35c14ff8..00000000
--- a/include/ap_base64.h
+++ /dev/null
@@ -1,92 +0,0 @@
-/* ====================================================================
- * The Apache Software License, Version 1.1
- *
- * Copyright (c) 2000 The Apache Software Foundation. All rights
- * reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * 3. The end-user documentation included with the redistribution,
- * if any, must include the following acknowledgment:
- * "This product includes software developed by the
- * Apache Software Foundation (http://www.apache.org/)."
- * Alternately, this acknowledgment may appear in the software itself,
- * if and wherever such third-party acknowledgments normally appear.
- *
- * 4. The names "Apache" and "Apache Software Foundation" must
- * not be used to endorse or promote products derived from this
- * software without prior written permission. For written
- * permission, please contact apache@apache.org.
- *
- * 5. Products derived from this software may not be called "Apache",
- * nor may "Apache" appear in their name, without prior written
- * permission of the Apache Software Foundation.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- * ====================================================================
- *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Software Foundation. For more
- * information on the Apache Software Foundation, please see
- * <http://www.apache.org/>.
- *
- * The ap_vsnprintf/ap_snprintf functions are based on, and used with the
- * permission of, the SIO stdio-replacement strx_* functions by Panos
- * Tsirigotis <panos@alumni.cs.colorado.edu> for xinetd.
- */
-
-#ifndef APACHE_BASE64_H
-#define APACHE_BASE64_H
-
-#include "ap.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* Simple BASE64 encode/decode functions.
- *
- * As we might encode binary strings, hence we require the length of
- * the incoming plain source. And return the length of what we decoded.
- *
- * The decoding function takes any non valid char (i.e. whitespace, \0
- * or anything non A-Z,0-9 etc as terminal.
- *
- * plain strings/binary sequences are not assumed '\0' terminated. Encoded
- * strings are neither. But propably should.
- *
- */
-API_EXPORT(int) ap_base64encode_len(int len);
-API_EXPORT(int) ap_base64encode(char * coded_dst, const char *plain_src,int len_plain_src);
-API_EXPORT(int) ap_base64encode_binary(char * coded_dst, const unsigned char *plain_src,int len_plain_src);
-
-API_EXPORT(int) ap_base64decode_len(const char * coded_src);
-API_EXPORT(int) ap_base64decode(char * plain_dst, const char *coded_src);
-API_EXPORT(int) ap_base64decode_binary(unsigned char * plain_dst, const char *coded_src);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* !APACHE_BASE64_H */
diff --git a/include/ap_hooks.h b/include/ap_hooks.h
deleted file mode 100644
index db37b0e1..00000000
--- a/include/ap_hooks.h
+++ /dev/null
@@ -1,188 +0,0 @@
-/* ====================================================================
- * The Apache Software License, Version 1.1
- *
- * Copyright (c) 2000 The Apache Software Foundation. All rights
- * reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * 3. The end-user documentation included with the redistribution,
- * if any, must include the following acknowledgment:
- * "This product includes software developed by the
- * Apache Software Foundation (http://www.apache.org/)."
- * Alternately, this acknowledgment may appear in the software itself,
- * if and wherever such third-party acknowledgments normally appear.
- *
- * 4. The names "Apache" and "Apache Software Foundation" must
- * not be used to endorse or promote products derived from this
- * software without prior written permission. For written
- * permission, please contact apache@apache.org.
- *
- * 5. Products derived from this software may not be called "Apache",
- * nor may "Apache" appear in their name, without prior written
- * permission of the Apache Software Foundation.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- * ====================================================================
- *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Software Foundation. For more
- * information on the Apache Software Foundation, please see
- * <http://www.apache.org/>.
- */
-
-#ifndef APACHE_AP_HOOKS_H
-#define APACHE_AP_HOOKS_H
-
-#include "ap.h"
-
-/* For ap_array_header_t */
-#include "apr_lib.h"
-
-#define AP_DECLARE_HOOK(impl,ret,name,args) \
-typedef ret HOOK_##name args; \
-impl(void) ap_hook_##name(HOOK_##name *pf,const char * const *aszPre, \
- const char * const *aszSucc,int nOrder); \
-impl(ret) ap_run_##name args; \
-typedef struct _LINK_##name \
- { \
- HOOK_##name *pFunc; \
- const char *szName; \
- const char * const *aszPredecessors; \
- const char * const *aszSuccessors; \
- int nOrder; \
- } LINK_##name;
-
-#define AP_HOOK_STRUCT(members) \
-static struct { members } _hooks;
-
-#define AP_HOOK_LINK(name) \
- ap_array_header_t *link_##name;
-
-#define AP_IMPLEMENT_HOOK_BASE(impl,name) \
-impl(void) ap_hook_##name(HOOK_##name *pf,const char * const *aszPre, \
- const char * const *aszSucc,int nOrder) \
- { \
- LINK_##name *pHook; \
- if(!_hooks.link_##name) \
- { \
- _hooks.link_##name=ap_make_array(ap_global_hook_pool,1,sizeof(LINK_##name)); \
- ap_hook_sort_register(#name,&_hooks.link_##name); \
- } \
- pHook=ap_push_array(_hooks.link_##name); \
- pHook->pFunc=pf; \
- pHook->aszPredecessors=aszPre; \
- pHook->aszSuccessors=aszSucc; \
- pHook->nOrder=nOrder; \
- pHook->szName=ap_debug_module_name; \
- if(ap_debug_module_hooks) \
- ap_show_hook(#name,aszPre,aszSucc); \
- }
-
-/* RUN_ALL runs to the first one to return other than ok or decline
- RUN_FIRST runs to the first one to return other than decline
- VOID runs all
-*/
-
-#define AP_IMPLEMENT_HOOK_VOID(impl,name,args_decl,args_use) \
-AP_IMPLEMENT_HOOK_BASE(impl,name) \
-impl(void) ap_run_##name args_decl \
- { \
- LINK_##name *pHook; \
- int n; \
-\
- if(!_hooks.link_##name) \
- return; \
-\
- pHook=(LINK_##name *)_hooks.link_##name->elts; \
- for(n=0 ; n < _hooks.link_##name->nelts ; ++n) \
- pHook[n].pFunc args_use; \
- }
-
-/* FIXME: note that this returns ok when nothing is run. I suspect it should
- really return decline, but that breaks Apache currently - Ben
-*/
-#define AP_IMPLEMENT_HOOK_RUN_ALL(impl,ret,name,args_decl,args_use,ok,decline) \
-AP_IMPLEMENT_HOOK_BASE(impl,name) \
-impl(ret) ap_run_##name args_decl \
- { \
- LINK_##name *pHook; \
- int n; \
- ret rv; \
-\
- if(!_hooks.link_##name) \
- return ok; \
-\
- pHook=(LINK_##name *)_hooks.link_##name->elts; \
- for(n=0 ; n < _hooks.link_##name->nelts ; ++n) \
- { \
- rv=pHook[n].pFunc args_use; \
-\
- if(rv != ok && rv != decline) \
- return rv; \
- } \
- return ok; \
- }
-
-#define AP_IMPLEMENT_HOOK_RUN_FIRST(impl,ret,name,args_decl,args_use,decline) \
-AP_IMPLEMENT_HOOK_BASE(impl,name) \
-impl(ret) ap_run_##name args_decl \
- { \
- LINK_##name *pHook; \
- int n; \
- ret rv; \
-\
- if(!_hooks.link_##name) \
- return decline; \
-\
- pHook=(LINK_##name *)_hooks.link_##name->elts; \
- for(n=0 ; n < _hooks.link_##name->nelts ; ++n) \
- { \
- rv=pHook[n].pFunc args_use; \
-\
- if(rv != decline) \
- return rv; \
- } \
- return decline; \
- }
-
- /* Hook orderings */
-#define AP_HOOK_REALLY_FIRST (-10)
-#define AP_HOOK_FIRST 0
-#define AP_HOOK_MIDDLE 10
-#define AP_HOOK_LAST 20
-#define AP_HOOK_REALLY_LAST 30
-
-extern API_VAR_EXPORT ap_pool_t *ap_global_hook_pool;
-extern API_VAR_EXPORT int ap_debug_module_hooks;
-extern API_VAR_EXPORT const char *ap_debug_module_name;
-
-API_EXPORT(void) ap_hook_sort_register(const char *szHookName,
- ap_array_header_t **aHooks);
-API_EXPORT(void) ap_sort_hooks(void);
-API_EXPORT(void) ap_show_hook(const char *szName,const char * const *aszPre,
- const char * const *aszSucc);
-API_EXPORT(void) ap_hook_deregister_all(void);
-
-#endif /* ndef(AP_HOOKS_H) */
diff --git a/include/ap_sha1.h b/include/ap_sha1.h
deleted file mode 100644
index 63eb0918..00000000
--- a/include/ap_sha1.h
+++ /dev/null
@@ -1,100 +0,0 @@
-/* ====================================================================
- * The Apache Software License, Version 1.1
- *
- * Copyright (c) 2000 The Apache Software Foundation. All rights
- * reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * 3. The end-user documentation included with the redistribution,
- * if any, must include the following acknowledgment:
- * "This product includes software developed by the
- * Apache Software Foundation (http://www.apache.org/)."
- * Alternately, this acknowledgment may appear in the software itself,
- * if and wherever such third-party acknowledgments normally appear.
- *
- * 4. The names "Apache" and "Apache Software Foundation" must
- * not be used to endorse or promote products derived from this
- * software without prior written permission. For written
- * permission, please contact apache@apache.org.
- *
- * 5. Products derived from this software may not be called "Apache",
- * nor may "Apache" appear in their name, without prior written
- * permission of the Apache Software Foundation.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- * ====================================================================
- *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Software Foundation. For more
- * information on the Apache Software Foundation, please see
- * <http://www.apache.org/>.
- *
- * NIST Secure Hash Algorithm
- * heavily modified by Uwe Hollerbach uh@alumni.caltech edu
- * from Peter C. Gutmann's implementation as found in
- * Applied Cryptography by Bruce Schneier
- * This code is hereby placed in the public domain
- */
-
-#ifndef APACHE_SHA1_H
-#define APACHE_SHA1_H
-
-#include "ap.h"
-
-#ifdef __cplusplus
-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 struct {
- ap_uint32_t digest[5]; /* message digest */
- ap_uint32_t count_lo, count_hi; /* 64-bit bit count */
- ap_uint32_t data[16]; /* SHA data buffer */
- int local; /* unprocessed amount in data */
-} AP_SHA1_CTX;
-
-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,
- unsigned int inputLen);
-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[SHA_DIGESTSIZE],
- AP_SHA1_CTX *context);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* !APACHE_SHA1_H */
diff --git a/include/apr_base64.h b/include/apr_base64.h
deleted file mode 100644
index 35c14ff8..00000000
--- a/include/apr_base64.h
+++ /dev/null
@@ -1,92 +0,0 @@
-/* ====================================================================
- * The Apache Software License, Version 1.1
- *
- * Copyright (c) 2000 The Apache Software Foundation. All rights
- * reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * 3. The end-user documentation included with the redistribution,
- * if any, must include the following acknowledgment:
- * "This product includes software developed by the
- * Apache Software Foundation (http://www.apache.org/)."
- * Alternately, this acknowledgment may appear in the software itself,
- * if and wherever such third-party acknowledgments normally appear.
- *
- * 4. The names "Apache" and "Apache Software Foundation" must
- * not be used to endorse or promote products derived from this
- * software without prior written permission. For written
- * permission, please contact apache@apache.org.
- *
- * 5. Products derived from this software may not be called "Apache",
- * nor may "Apache" appear in their name, without prior written
- * permission of the Apache Software Foundation.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- * ====================================================================
- *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Software Foundation. For more
- * information on the Apache Software Foundation, please see
- * <http://www.apache.org/>.
- *
- * The ap_vsnprintf/ap_snprintf functions are based on, and used with the
- * permission of, the SIO stdio-replacement strx_* functions by Panos
- * Tsirigotis <panos@alumni.cs.colorado.edu> for xinetd.
- */
-
-#ifndef APACHE_BASE64_H
-#define APACHE_BASE64_H
-
-#include "ap.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* Simple BASE64 encode/decode functions.
- *
- * As we might encode binary strings, hence we require the length of
- * the incoming plain source. And return the length of what we decoded.
- *
- * The decoding function takes any non valid char (i.e. whitespace, \0
- * or anything non A-Z,0-9 etc as terminal.
- *
- * plain strings/binary sequences are not assumed '\0' terminated. Encoded
- * strings are neither. But propably should.
- *
- */
-API_EXPORT(int) ap_base64encode_len(int len);
-API_EXPORT(int) ap_base64encode(char * coded_dst, const char *plain_src,int len_plain_src);
-API_EXPORT(int) ap_base64encode_binary(char * coded_dst, const unsigned char *plain_src,int len_plain_src);
-
-API_EXPORT(int) ap_base64decode_len(const char * coded_src);
-API_EXPORT(int) ap_base64decode(char * plain_dst, const char *coded_src);
-API_EXPORT(int) ap_base64decode_binary(unsigned char * plain_dst, const char *coded_src);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* !APACHE_BASE64_H */
diff --git a/include/apr_hooks.h b/include/apr_hooks.h
deleted file mode 100644
index db37b0e1..00000000
--- a/include/apr_hooks.h
+++ /dev/null
@@ -1,188 +0,0 @@
-/* ====================================================================
- * The Apache Software License, Version 1.1
- *
- * Copyright (c) 2000 The Apache Software Foundation. All rights
- * reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * 3. The end-user documentation included with the redistribution,
- * if any, must include the following acknowledgment:
- * "This product includes software developed by the
- * Apache Software Foundation (http://www.apache.org/)."
- * Alternately, this acknowledgment may appear in the software itself,
- * if and wherever such third-party acknowledgments normally appear.
- *
- * 4. The names "Apache" and "Apache Software Foundation" must
- * not be used to endorse or promote products derived from this
- * software without prior written permission. For written
- * permission, please contact apache@apache.org.
- *
- * 5. Products derived from this software may not be called "Apache",
- * nor may "Apache" appear in their name, without prior written
- * permission of the Apache Software Foundation.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- * ====================================================================
- *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Software Foundation. For more
- * information on the Apache Software Foundation, please see
- * <http://www.apache.org/>.
- */
-
-#ifndef APACHE_AP_HOOKS_H
-#define APACHE_AP_HOOKS_H
-
-#include "ap.h"
-
-/* For ap_array_header_t */
-#include "apr_lib.h"
-
-#define AP_DECLARE_HOOK(impl,ret,name,args) \
-typedef ret HOOK_##name args; \
-impl(void) ap_hook_##name(HOOK_##name *pf,const char * const *aszPre, \
- const char * const *aszSucc,int nOrder); \
-impl(ret) ap_run_##name args; \
-typedef struct _LINK_##name \
- { \
- HOOK_##name *pFunc; \
- const char *szName; \
- const char * const *aszPredecessors; \
- const char * const *aszSuccessors; \
- int nOrder; \
- } LINK_##name;
-
-#define AP_HOOK_STRUCT(members) \
-static struct { members } _hooks;
-
-#define AP_HOOK_LINK(name) \
- ap_array_header_t *link_##name;
-
-#define AP_IMPLEMENT_HOOK_BASE(impl,name) \
-impl(void) ap_hook_##name(HOOK_##name *pf,const char * const *aszPre, \
- const char * const *aszSucc,int nOrder) \
- { \
- LINK_##name *pHook; \
- if(!_hooks.link_##name) \
- { \
- _hooks.link_##name=ap_make_array(ap_global_hook_pool,1,sizeof(LINK_##name)); \
- ap_hook_sort_register(#name,&_hooks.link_##name); \
- } \
- pHook=ap_push_array(_hooks.link_##name); \
- pHook->pFunc=pf; \
- pHook->aszPredecessors=aszPre; \
- pHook->aszSuccessors=aszSucc; \
- pHook->nOrder=nOrder; \
- pHook->szName=ap_debug_module_name; \
- if(ap_debug_module_hooks) \
- ap_show_hook(#name,aszPre,aszSucc); \
- }
-
-/* RUN_ALL runs to the first one to return other than ok or decline
- RUN_FIRST runs to the first one to return other than decline
- VOID runs all
-*/
-
-#define AP_IMPLEMENT_HOOK_VOID(impl,name,args_decl,args_use) \
-AP_IMPLEMENT_HOOK_BASE(impl,name) \
-impl(void) ap_run_##name args_decl \
- { \
- LINK_##name *pHook; \
- int n; \
-\
- if(!_hooks.link_##name) \
- return; \
-\
- pHook=(LINK_##name *)_hooks.link_##name->elts; \
- for(n=0 ; n < _hooks.link_##name->nelts ; ++n) \
- pHook[n].pFunc args_use; \
- }
-
-/* FIXME: note that this returns ok when nothing is run. I suspect it should
- really return decline, but that breaks Apache currently - Ben
-*/
-#define AP_IMPLEMENT_HOOK_RUN_ALL(impl,ret,name,args_decl,args_use,ok,decline) \
-AP_IMPLEMENT_HOOK_BASE(impl,name) \
-impl(ret) ap_run_##name args_decl \
- { \
- LINK_##name *pHook; \
- int n; \
- ret rv; \
-\
- if(!_hooks.link_##name) \
- return ok; \
-\
- pHook=(LINK_##name *)_hooks.link_##name->elts; \
- for(n=0 ; n < _hooks.link_##name->nelts ; ++n) \
- { \
- rv=pHook[n].pFunc args_use; \
-\
- if(rv != ok && rv != decline) \
- return rv; \
- } \
- return ok; \
- }
-
-#define AP_IMPLEMENT_HOOK_RUN_FIRST(impl,ret,name,args_decl,args_use,decline) \
-AP_IMPLEMENT_HOOK_BASE(impl,name) \
-impl(ret) ap_run_##name args_decl \
- { \
- LINK_##name *pHook; \
- int n; \
- ret rv; \
-\
- if(!_hooks.link_##name) \
- return decline; \
-\
- pHook=(LINK_##name *)_hooks.link_##name->elts; \
- for(n=0 ; n < _hooks.link_##name->nelts ; ++n) \
- { \
- rv=pHook[n].pFunc args_use; \
-\
- if(rv != decline) \
- return rv; \
- } \
- return decline; \
- }
-
- /* Hook orderings */
-#define AP_HOOK_REALLY_FIRST (-10)
-#define AP_HOOK_FIRST 0
-#define AP_HOOK_MIDDLE 10
-#define AP_HOOK_LAST 20
-#define AP_HOOK_REALLY_LAST 30
-
-extern API_VAR_EXPORT ap_pool_t *ap_global_hook_pool;
-extern API_VAR_EXPORT int ap_debug_module_hooks;
-extern API_VAR_EXPORT const char *ap_debug_module_name;
-
-API_EXPORT(void) ap_hook_sort_register(const char *szHookName,
- ap_array_header_t **aHooks);
-API_EXPORT(void) ap_sort_hooks(void);
-API_EXPORT(void) ap_show_hook(const char *szName,const char * const *aszPre,
- const char * const *aszSucc);
-API_EXPORT(void) ap_hook_deregister_all(void);
-
-#endif /* ndef(AP_HOOKS_H) */
diff --git a/include/apr_sha1.h b/include/apr_sha1.h
deleted file mode 100644
index 63eb0918..00000000
--- a/include/apr_sha1.h
+++ /dev/null
@@ -1,100 +0,0 @@
-/* ====================================================================
- * The Apache Software License, Version 1.1
- *
- * Copyright (c) 2000 The Apache Software Foundation. All rights
- * reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * 3. The end-user documentation included with the redistribution,
- * if any, must include the following acknowledgment:
- * "This product includes software developed by the
- * Apache Software Foundation (http://www.apache.org/)."
- * Alternately, this acknowledgment may appear in the software itself,
- * if and wherever such third-party acknowledgments normally appear.
- *
- * 4. The names "Apache" and "Apache Software Foundation" must
- * not be used to endorse or promote products derived from this
- * software without prior written permission. For written
- * permission, please contact apache@apache.org.
- *
- * 5. Products derived from this software may not be called "Apache",
- * nor may "Apache" appear in their name, without prior written
- * permission of the Apache Software Foundation.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- * ====================================================================
- *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Software Foundation. For more
- * information on the Apache Software Foundation, please see
- * <http://www.apache.org/>.
- *
- * NIST Secure Hash Algorithm
- * heavily modified by Uwe Hollerbach uh@alumni.caltech edu
- * from Peter C. Gutmann's implementation as found in
- * Applied Cryptography by Bruce Schneier
- * This code is hereby placed in the public domain
- */
-
-#ifndef APACHE_SHA1_H
-#define APACHE_SHA1_H
-
-#include "ap.h"
-
-#ifdef __cplusplus
-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 struct {
- ap_uint32_t digest[5]; /* message digest */
- ap_uint32_t count_lo, count_hi; /* 64-bit bit count */
- ap_uint32_t data[16]; /* SHA data buffer */
- int local; /* unprocessed amount in data */
-} AP_SHA1_CTX;
-
-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,
- unsigned int inputLen);
-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[SHA_DIGESTSIZE],
- AP_SHA1_CTX *context);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* !APACHE_SHA1_H */