httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From traw...@locus.apache.org
Subject cvs commit: apache-2.0/src/support htdigest.c
Date Sat, 06 May 2000 13:42:01 GMT
trawick     00/05/06 06:42:00

  Modified:    src/lib/apr/include apr_md5.h
               src/lib/apr/lib apr_md5.c
               src/lib/apr/test Makefile.in .cvsignore
               src/support htdigest.c
  Added:       src/lib/apr/test testmd5.c
  Log:
  serious bug fix:
    htdigest didn't init the first parm to ap_open(), so ap_open()
    segfaults thinking it was passed valid storage
  build portability:
    make most src/lib/apr/test/Makefile.in compatible with OS/390
    make (no -o outfile after infile specified)
  MD5 translation support:
    when APR_HAS_XLATE, low-level routines allow translation handle
    to be specified
  
    when CHARSET_EBCDIC, password-specific routines always translate,
    but client app must set handle before using
  
  Revision  Changes    Path
  1.10      +10 -3     apache-2.0/src/lib/apr/include/apr_md5.h
  
  Index: apr_md5.h
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/lib/apr/include/apr_md5.h,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- apr_md5.h	2000/04/23 02:32:57	1.9
  +++ apr_md5.h	2000/05/06 13:41:55	1.10
  @@ -82,10 +82,11 @@
    * <http://www.apache.org/>.
    */
   
  -#ifndef APACHE_MD5_H
  -#define APACHE_MD5_H
  +#ifndef APR_MD5_H
  +#define APR_MD5_H
   
   #include "apr_lib.h"
  +#include "apr_xlate.h"
   
   #ifdef __cplusplus
   extern "C" {
  @@ -101,9 +102,15 @@
       UINT4 state[4];		/* state (ABCD) */
       UINT4 count[2];		/* number of bits, modulo 2^64 (lsb first) */
       unsigned char buffer[64];	/* input buffer */
  +#if APR_HAS_XLATE
  +    ap_xlate_t *xlate;          /* translation handle */
  +#endif
   } ap_md5_ctx_t;
   
   API_EXPORT(ap_status_t) ap_MD5Init(ap_md5_ctx_t *context);
  +#if APR_HAS_XLATE
  +API_EXPORT(ap_status_t) ap_MD5SetXlate(ap_md5_ctx_t *context, ap_xlate_t *xlate);
  +#endif
   API_EXPORT(ap_status_t) ap_MD5Update(ap_md5_ctx_t *context,
                                        const unsigned char *input,
                                        unsigned int inputLen);
  @@ -116,4 +123,4 @@
   }
   #endif
   
  -#endif	/* !APACHE_MD5_H */
  +#endif	/* !APR_MD5_H */
  
  
  
  1.13      +69 -25    apache-2.0/src/lib/apr/lib/apr_md5.c
  
  Index: apr_md5.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/lib/apr/lib/apr_md5.c,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- apr_md5.c	2000/04/23 02:32:57	1.12
  +++ apr_md5.c	2000/05/06 13:41:56	1.13
  @@ -144,6 +144,10 @@
       0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
   };
   
  +#ifdef CHARSET_EBCDIC
  +static ap_xlate_t *xlate_ebcdic_to_ascii; /* used in ap_MD5Encode() */
  +#endif
  +
   /* F, G, H and I are basic MD5 functions.
    */
   #define F(x, y, z) (((x) & (y)) | ((~x) & (z)))
  @@ -189,8 +193,24 @@
       context->state[1] = 0xefcdab89;
       context->state[2] = 0x98badcfe;
       context->state[3] = 0x10325476;
  +#if APR_HAS_XLATE
  +    context->xlate = NULL;
  +#endif
  +    return APR_SUCCESS;
  +}
  +
  +#if APR_HAS_XLATE
  +/* MD5 translation setup.  Provides the APR translation handle
  + * to be used for translating the content before calculating the
  + * digest.
  + */
  +
  +API_EXPORT(ap_status_t) ap_MD5SetXlate(ap_md5_ctx_t *context, ap_xlate_t *xlate)
  +{
  +    context->xlate = xlate;
       return APR_SUCCESS;
   }
  +#endif /* APR_HAS_XLATE */
   
   /* MD5 block update operation. Continues an MD5 message-digest
      operation, processing another message block, and updating the
  @@ -201,6 +221,9 @@
                                        unsigned int inputLen)
   {
       unsigned int i, idx, partLen;
  +#if APR_HAS_XLATE
  +    ap_size_t inbytes_left, outbytes_left;
  +#endif
   
       /* Compute number of bytes mod 64 */
       idx = (unsigned int) ((context->count[0] >> 3) & 0x3F);
  @@ -213,7 +236,7 @@
       partLen = 64 - idx;
   
       /* Transform as many times as possible. */
  -#ifndef CHARSET_EBCDIC
  +#if !APR_HAS_XLATE
       if (inputLen >= partLen) {
   	memcpy(&context->buffer[idx], input, partLen);
   	MD5Transform(context->state, context->buffer);
  @@ -228,15 +251,29 @@
   
       /* Buffer remaining input */
       memcpy(&context->buffer[idx], &input[i], inputLen - i);
  -#else /*CHARSET_EBCDIC*/
  +#else /*APR_HAS_XLATE*/
       if (inputLen >= partLen) {
  -	ebcdic2ascii_strictly(&context->buffer[idx], input, partLen);
  +        if (context->xlate) {
  +            inbytes_left = outbytes_left = partLen;
  +            ap_xlate_conv_buffer(context->xlate, input, &inbytes_left,
  +                                 &context->buffer[idx],&outbytes_left);
  +        }
  +        else {
  +            memcpy(&context->buffer[idx], input, partLen);
  +        }
   	MD5Transform(context->state, context->buffer);
   
   	for (i = partLen; i + 63 < inputLen; i += 64) {
  -	    unsigned char inp_tmp[64];
  -	    ebcdic2ascii_strictly(inp_tmp, &input[i], 64);
  -	    MD5Transform(context->state, inp_tmp);
  +            if (context->xlate) {
  +                unsigned char inp_tmp[64];
  +                inbytes_left = outbytes_left = 64;
  +                ap_xlate_conv_buffer(context->xlate, &input[i], &inbytes_left,
  +                                     inp_tmp, &outbytes_left);
  +                MD5Transform(context->state, inp_tmp);
  +            }
  +            else {
  +                MD5Transform(context->state, &input[i]);
  +            }
   	}
   
   	idx = 0;
  @@ -245,8 +282,15 @@
   	i = 0;
   
       /* Buffer remaining input */
  -    ebcdic2ascii_strictly(&context->buffer[idx], &input[i], inputLen - i);
  -#endif /*CHARSET_EBCDIC*/
  +    if (context->xlate) {
  +        inbytes_left = outbytes_left = inputLen - i;
  +        ap_xlate_conv_buffer(context->xlate, &input[i], &inbytes_left,
  +                             &context->buffer[idx], &outbytes_left);
  +    }
  +    else {
  +        memcpy(&context->buffer[idx], &input[i], inputLen - i);
  +    }
  +#endif /*APR_HAS_XLATE*/
       return APR_SUCCESS;
   }
   
  @@ -259,24 +303,13 @@
       unsigned char bits[8];
       unsigned int idx, padLen;
   
  -
       /* Save number of bits */
       Encode(bits, context->count, 8);
   
  -#ifdef CHARSET_EBCDIC
  -    /* XXX: @@@: In order to make this no more complex than necessary,
  -     * this kludge converts the bits[] array using the ascii-to-ebcdic
  -     * table, because the following ap_MD5Update() re-translates
  -     * its input (ebcdic-to-ascii).
  -     * Otherwise, we would have to pass a "conversion" flag to ap_MD5Update()
  -     */
  -    ascii2ebcdic(bits,bits,8);
  -
  -    /* Since everything is converted to ascii within ap_MD5Update(), 
  -     * the initial 0x80 (PADDING[0]) must be stored as 0x20 
  -     */
  -    PADDING[0] = os_toebcdic[0x80];
  -#endif /*CHARSET_EBCDIC*/
  +#if APR_HAS_XLATE
  +    /* ap_MD5Update() should not translate for this final round. */
  +    context->xlate = NULL;
  +#endif /*APR_HAS_XLATE*/
   
       /* Pad out to 56 mod 64. */
       idx = (unsigned int) ((context->count[0] >> 3) & 0x3f);
  @@ -413,6 +446,14 @@
   	    (((UINT4) input[j + 2]) << 16) | (((UINT4) input[j + 3]) << 24);
   }
   
  +#ifdef CHARSET_EBCDIC
  +API_EXPORT(ap_status_t) ap_MD5InitEBCDIC(ap_xlate_t *xlate)
  +{
  +    xlate_ebcdic_to_ascii = xlate;
  +    return APR_SUCCESS;
  +}
  +#endif
  +
   /*
    * Define the Magic String prefix that identifies a password as being
    * hashed using our algorithm.
  @@ -437,7 +478,7 @@
   }
   
   API_EXPORT(ap_status_t) ap_MD5Encode(const char *pw, const char *salt,
  -			      char *result, size_t nbytes)
  +                             char *result, size_t nbytes)
   {
       /*
        * Minimum size is 8 bytes for salt, plus 1 for the trailing NUL,
  @@ -482,7 +523,10 @@
        * 'Time to make the doughnuts..'
        */
       ap_MD5Init(&ctx);
  -
  +#ifdef CHARSET_EBCDIC
  +    ap_MD5SetXlate(&ctx, xlate_ebcdic_to_ascii);
  +#endif
  +    
       /*
        * The password first, since that is what is most unknown
        */
  
  
  
  1.22      +22 -17    apache-2.0/src/lib/apr/test/Makefile.in
  
  Index: Makefile.in
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/lib/apr/test/Makefile.in,v
  retrieving revision 1.21
  retrieving revision 1.22
  diff -u -r1.21 -r1.22
  --- Makefile.in	2000/05/03 18:12:49	1.21
  +++ Makefile.in	2000/05/06 13:41:58	1.22
  @@ -7,13 +7,14 @@
   RM=@RM@
   CC=@CC@
   RANLIB=@RANLIB@
  -CFLAGS=@CFLAGS@ @OPTIM@ 
  -LIBS=-L.. -lapr @LIBS@ 
  +CFLAGS=@CFLAGS@ @OPTIM@
  +LIBS=../libapr.a @LIBS@ 
   LDFLAGS=@LDFLAGS@ $(LIBS)
   INCDIR=../include
   INCLUDES=-I$(INCDIR)
   
  -TARGETS= testfile@EXEEXT@ \
  +TARGETS= testmd5@EXEEXT@ \
  +	testfile@EXEEXT@ \
   	testproc@EXEEXT@ \
   	testsock@EXEEXT@ \
   	testthread@EXEEXT@ \
  @@ -28,7 +29,8 @@
   	occhild@EXEEXT@ \
   	mod_test.so
   
  -OBJS= testfile.o \
  +OBJS= testmd5.o \
  +	testfile.o \
   	testproc.o \
   	testsock.o \
   	testthread.o \
  @@ -46,14 +48,17 @@
   
   all: $(TARGETS) 
   
  +testmd5@EXEEXT@: testmd5.o
  +	$(CC) $(CFLAGS) -o testmd5@EXEEXT@ testmd5.o $(LDFLAGS)
  +
   testfile@EXEEXT@: testfile.o
  -	$(CC) $(CFLAGS) testfile.o -o testfile@EXEEXT@ $(LDFLAGS) 
  +	$(CC) $(CFLAGS) -o testfile@EXEEXT@ testfile.o $(LDFLAGS) 
   
   testdso@EXEEXT@: testdso.o
   	$(CC) $(CFLAGS) --export-dynamic -fPIC testdso.o -o testdso@EXEEXT@ $(LDFLAGS) 
   
   testoc@EXEEXT@: testoc.o
  -	$(CC) $(CFLAGS) testoc.o -o testoc@EXEEXT@ $(LDFLAGS) 
  +	$(CC) $(CFLAGS) -o testoc@EXEEXT@ testoc.o $(LDFLAGS) 
   
   occhild.so: occhild.o
   	$(CC) -shared occhild.o -o occhild.so 
  @@ -62,33 +67,33 @@
   	$(CC) -shared mod_test.o -o mod_test.so 
   
   testargs@EXEEXT@: testargs.o
  -	$(CC) $(CFLAGS) testargs.o -o testargs@EXEEXT@ $(LDFLAGS) 
  +	$(CC) $(CFLAGS) -o testargs@EXEEXT@ testargs.o $(LDFLAGS) 
   
   testcontext@EXEEXT@: testcontext.o
  -	$(CC) $(CFLAGS) testcontext.o -o testcontext@EXEEXT@ $(LDFLAGS) 
  +	$(CC) $(CFLAGS) -o testcontext@EXEEXT@ testcontext.o $(LDFLAGS) 
   
   testproc@EXEEXT@: testproc.o
  -	$(CC) $(CFLAGS) testproc.o -o testproc@EXEEXT@ $(LDFLAGS)
  +	$(CC) $(CFLAGS) -o testproc@EXEEXT@ testproc.o $(LDFLAGS)
   
   testthread@EXEEXT@: testthread.o
  -	$(CC) $(CFLAGS) testthread.o -o testthread@EXEEXT@ $(LDFLAGS)
  +	$(CC) $(CFLAGS) -o testthread@EXEEXT@ testthread.o $(LDFLAGS)
   
   testsock@EXEEXT@: testsock.o client.o server.o 
  -	$(CC) $(CFLAGS) testsock.o -o testsock@EXEEXT@  $(LDFLAGS)
  -	$(CC) $(CFLAGS) server.o -o server@EXEEXT@ $(LDFLAGS) 
  -	$(CC) $(CFLAGS) client.o -o client@EXEEXT@ $(LDFLAGS)
  +	$(CC) $(CFLAGS) -o testsock@EXEEXT@ testsock.o $(LDFLAGS)
  +	$(CC) $(CFLAGS) -o server@EXEEXT@ server.o $(LDFLAGS) 
  +	$(CC) $(CFLAGS) -o client@EXEEXT@ client.o $(LDFLAGS)
   
   testtime@EXEEXT@: testtime.o
  -	$(CC) $(CFLAGS) testtime.o -o testtime@EXEEXT@ $(LDFLAGS)
  +	$(CC) $(CFLAGS) -o testtime@EXEEXT@ testtime.o $(LDFLAGS)
   
   testmmap@EXEEXT@: testmmap.o
  -	$(CC) $(CFLAGS) testmmap.o -o testmmap@EXEEXT@ $(LDFLAGS)
  +	$(CC) $(CFLAGS) -o testmmap@EXEEXT@ testmmap.o $(LDFLAGS)
   
   testshmem@EXEEXT@: testshmem.o
  -	$(CC) $(CFLAGS) testshmem.o -o testshmem@EXEEXT@ $(LDFLAGS)
  +	$(CC) $(CFLAGS) -o testshmem@EXEEXT@ testshmem.o $(LDFLAGS)
   
   testpipe@EXEEXT@: testpipe.o
  -	$(CC) $(CFLAGS) testpipe.o -o testpipe@EXEEXT@ $(LDFLAGS)
  +	$(CC) $(CFLAGS) -o testpipe@EXEEXT@ testpipe.o $(LDFLAGS)
   
   clean:
   	$(RM) -f *.o *.a *.so $(TARGETS)
  
  
  
  1.4       +1 -0      apache-2.0/src/lib/apr/test/.cvsignore
  
  Index: .cvsignore
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/lib/apr/test/.cvsignore,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- .cvsignore	2000/04/14 13:42:09	1.3
  +++ .cvsignore	2000/05/06 13:41:59	1.4
  @@ -1,4 +1,5 @@
   Makefile
  +testmd5
   testmmap
   htdigest
   ab
  
  
  
  1.1                  apache-2.0/src/lib/apr/test/testmd5.c
  
  Index: testmd5.c
  ===================================================================
  /* ====================================================================
   * 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/>.
   */
  
  #include <assert.h>
  #include <stdlib.h>
  
  #include "apr_md5.h"
  #include "apr_xlate.h"
  
  struct testcase {
      const char *s;
      const char *digest;
  };
  
  struct testcase testcases[] =
  {
      {"Jeff was here!",
       "\xa5\x25\x8a\x89\x11\xb2\x9d\x1f\x81\x75\x96\x3b\x60\x94\x49\xc0"},
      {"01234567890aBcDeFASDFGHJKLPOIUYTR"
       "POIUYTREWQZXCVBN  LLLLLLLLLLLLLLL",
       "\xd4\x1a\x06\x2c\xc5\xfd\x6f\x24\x67\x68\x56\x7c\x40\x8a\xd5\x69"},
      {"111111118888888888888888*******%%%%%%%%%%#####"
       "142134u8097289720432098409289nkjlfkjlmn,m..   ",
       "\xb6\xea\x5b\xe8\xca\x45\x8a\x33\xf0\xf1\x84\x6f\xf9\x65\xa8\xe1"},
      {"01234567890aBcDeFASDFGHJKLPOIUYTR"
       "POIUYTREWQZXCVBN  LLLLLLLLLLLLLLL"
       "01234567890aBcDeFASDFGHJKLPOIUYTR"
       "POIUYTREWQZXCVBN  LLLLLLLLLLLLLLL"
       "1",
       "\xd1\xa1\xc0\x97\x8a\x60\xbb\xfb\x2a\x25\x46\x9d\xa5\xae\xd0\xb0"}
  };
  
  static void try(const void *buf, size_t bufLen, ap_xlate_t *xlate,
                  const void *digest)
  {
      int i;
      ap_status_t rv;
      ap_md5_ctx_t context;
      unsigned char hash[MD5_DIGESTSIZE];
  
      rv = ap_MD5Init(&context);
      assert(!rv);
  
      if (xlate) {
  #if APR_HAS_XLATE
          ap_MD5SetXlate(&context, xlate);
  #else
          fprintf(stderr,
                  "A translation handle was unexpected.\n");
  #endif
      }
      
      rv = ap_MD5Update(&context, buf, bufLen);
      assert(!rv);
  
      rv = ap_MD5Final(hash, &context);
      assert(!rv);
  
      for (i = 0; i < MD5_DIGESTSIZE; i++) {
          printf("%02x",hash[i]);
      }
  
      printf("\n");
  
      if (memcmp(hash, digest, MD5_DIGESTSIZE)) {
          fprintf(stderr,
                  "The digest is not as expected!\n");
  #if 'A' != 0x41
          fprintf(stderr,
                  "Maybe you didn't tell me what character sets "
                  "to translate between?\n"
                  "The expected digest is based on the string "
                  "being in ASCII.\n");
  #endif
      }
  }
  
  int main(int argc, char **argv)
  {
      ap_status_t rv;
      ap_xlate_t *xlate = NULL;
      ap_pool_t *pool;
      const char *src = NULL, *dst = NULL;
      int cur;
  
      switch(argc) {
      case 1:
          break;
      case 3:
          src = argv[1];
          dst = argv[2];
          break;
      default:
          fprintf(stderr,
                  "Usage: %s [src-charset dst-charset]\n",
                  argv[0]);
          exit(1);
      }
  
      rv = ap_initialize();
      assert(!rv);
      atexit(ap_terminate);
  
      rv = ap_create_pool(&pool, NULL);
  
      if (src) {
  #if APR_HAS_XLATE
          rv = ap_xlate_open(&xlate, dst, src, pool);
          if (rv) {
              char buf[80];
  
              fprintf(stderr, "ap_xlate_open()->%s (%d)\n",
                      ap_strerror(rv, buf, sizeof(buf)), rv);
              exit(1);
          }
  #else
          fprintf(stderr,
                  "APR doesn't implement translation for this "
                  "configuration.\n");
  #endif
      }
  
      for (cur = 0; cur < sizeof(testcases) / sizeof(testcases[0]); cur++) {
          try(testcases[cur].s, strlen(testcases[cur].s), xlate,
              testcases[cur].digest);
      }
      
      return 0;
  }
  
  
  
  1.9       +27 -2     apache-2.0/src/support/htdigest.c
  
  Index: htdigest.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/support/htdigest.c,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- htdigest.c	2000/04/28 18:24:59	1.8
  +++ htdigest.c	2000/05/06 13:41:59	1.9
  @@ -85,6 +85,10 @@
   #include <conio.h>
   #endif
   
  +#if 'A' == 0xC1
  +#define CHARSET_EBCDIC
  +#endif
  +
   #ifdef CHARSET_EBCDIC
   #define LF '\n'
   #define CR '\r'
  @@ -97,6 +101,9 @@
   
   char *tn;
   ap_pool_t *cntxt;
  +#ifdef CHARSET_EBCDIC
  +ap_xlate_t *to_ascii;
  +#endif
   
   static void getword(char *word, char *line, char stop)
   {
  @@ -178,6 +185,9 @@
       sprintf(string, "%s:%s:%s", user, realm, pw);
   
       ap_MD5Init(&context);
  +#ifdef CHARSET_EBCDIC
  +    ap_MD5SetXlate(&context, to_ascii);
  +#endif
       ap_MD5Update(&context, (unsigned char *) string, strlen(string));
       ap_MD5Final(digest, &context);
   
  @@ -204,7 +214,8 @@
   
   int main(int argc, char *argv[])
   {
  -    ap_file_t *tfp, *f;
  +    ap_file_t *tfp = NULL, *f;
  +    ap_status_t rv;
       char user[MAX_STRING_LEN];
       char realm[MAX_STRING_LEN];
       char line[MAX_STRING_LEN];
  @@ -214,10 +225,24 @@
       char command[MAX_STRING_LEN];
       int found;
      
  -    ap_initialize();
  +    rv = ap_initialize();
  +    if (rv) {
  +        fprintf(stderr, "ap_initialize(): %s (%d)\n",
  +                ap_strerror(rv, line, sizeof(line)), rv);
  +        exit(1);
  +    }
       atexit(ap_terminate); 
       ap_create_pool(&cntxt, NULL);
   
  +#ifdef CHARSET_EBCDIC
  +    rv = ap_xlate_open(&to_ascii, "ISO8859-1", APR_DEFAULT_CHARSET, cntxt);
  +    if (rv) {
  +        fprintf(stderr, "ap_xlate_open(): %s (%d)\n",
  +                ap_strerror(rv, line, sizeof(line)), rv);
  +        exit(1);
  +    }
  +#endif
  +    
       tn = NULL;
       ap_signal(SIGINT, (void (*)(int)) interrupted);
       if (argc == 5) {
  
  
  

Mime
View raw message