rbb         99/11/22 10:01:40

  Modified:    src/lib/apr/inc apr_fnmatch.h
               src/lib/apr/include apr_errno.h apr_lib.h apr_md5.h
               src/lib/apr/lib apr_execve.c apr_fnmatch.c apr_md5.c
  Log:
  Begin to update apr/lib files to follow the standard APR function format.
  This is the incredibly low hanging fruit, where all I am doing is
  standardizing the return codes for functions that already returned int's.
  
  Revision  Changes    Path
  1.3       +2 -1      apache-2.0/src/lib/apr/inc/apr_fnmatch.h
  
  Index: apr_fnmatch.h
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/lib/apr/inc/apr_fnmatch.h,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- apr_fnmatch.h     1999/08/31 05:32:31     1.2
  +++ apr_fnmatch.h     1999/11/22 18:00:46     1.3
  @@ -39,6 +39,7 @@
   #else
   #include "apr_win.h"
   #endif
  +#include "apr_errno.h"
   
   #ifndef      _APR_FNMATCH_H_
   #define      _APR_FNMATCH_H_
  @@ -55,7 +56,7 @@
   /* This flag is an Apache addition */
   #define FNM_CASE_BLIND  0x08    /* Compare characters case ap_context_t 
nsensitively. */
   
  -API_EXPORT(int) ap_fnmatch(const char *pattern, const char *strings,
  +API_EXPORT(ap_status_t) ap_fnmatch(const char *pattern, const char *strings,
                            int flags);
   
   /* this function is an Apache addition */
  
  
  
  1.9       +4 -0      apache-2.0/src/lib/apr/include/apr_errno.h
  
  Index: apr_errno.h
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/lib/apr/include/apr_errno.h,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- apr_errno.h       1999/10/21 16:13:24     1.8
  +++ apr_errno.h       1999/11/22 18:00:55     1.9
  @@ -128,6 +128,10 @@
    */
   #define APR_ENOTIMPL       (APR_OS_START_STATUS + 17)
   
  +/* Passwords do not match.
  + */
  +#define APR_EMISMATCH      (APR_OS_START_STATUS + 18)
  +
   /*
    * APR equivalents to what should be standard errno codes.
    */
  
  
  
  1.15      +2 -2      apache-2.0/src/lib/apr/include/apr_lib.h
  
  Index: apr_lib.h
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/lib/apr/include/apr_lib.h,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- apr_lib.h 1999/11/16 18:30:26     1.14
  +++ apr_lib.h 1999/11/22 18:00:59     1.15
  @@ -169,8 +169,8 @@
   API_EXPORT(const char *) ap_filename_of_pathname(const char *pathname);
   /*API_EXPORT(ap_mutex_t *) ap_create_mutex(void *m);*/
   API_EXPORT(int) ap_slack(int l, int h);
  -API_EXPORT_NONSTD(int) ap_execle(const char *c, const char *a, ...);
  -API_EXPORT_NONSTD(int) ap_execve(const char *c, const char *argv[],
  +API_EXPORT_NONSTD(ap_status_t) ap_execle(const char *c, const char *a, ...);
  +API_EXPORT_NONSTD(ap_status_t) ap_execve(const char *c, const char *argv[],
                                  const char *envp[]);
   
   #define ap_create_mutex(x) (0)
  
  
  
  1.3       +5 -5      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.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- apr_md5.h 1999/08/31 05:32:32     1.2
  +++ apr_md5.h 1999/11/22 18:01:01     1.3
  @@ -113,13 +113,13 @@
       unsigned char buffer[64];        /* input buffer */
   } APR_MD5_CTX;
   
  -API_EXPORT(void) ap_MD5Init(APR_MD5_CTX * context);
  -API_EXPORT(void) ap_MD5Update(APR_MD5_CTX * context, const unsigned char 
*input,
  +API_EXPORT(ap_status_t) ap_MD5Init(APR_MD5_CTX * context);
  +API_EXPORT(ap_status_t) ap_MD5Update(APR_MD5_CTX * context, const unsigned 
char *input,
                           unsigned int inputLen);
  -API_EXPORT(void) ap_MD5Final(unsigned char digest[16], APR_MD5_CTX * 
context);
  -API_EXPORT(void) ap_MD5Encode(const char *password, const char *salt,
  +API_EXPORT(ap_status_t) ap_MD5Final(unsigned char digest[16], APR_MD5_CTX * 
context);
  +API_EXPORT(ap_status_t) ap_MD5Encode(const char *password, const char *salt,
                              char *result, size_t nbytes);
  -API_EXPORT(char *) ap_validate_password(const char *passwd, const char 
*hash);
  +API_EXPORT(ap_status_t) ap_validate_password(const char *passwd, const char 
*hash);
   
   #ifdef __cplusplus
   }
  
  
  
  1.4       +7 -8      apache-2.0/src/lib/apr/lib/apr_execve.c
  
  Index: apr_execve.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/lib/apr/lib/apr_execve.c,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- apr_execve.c      1999/08/31 21:54:48     1.3
  +++ apr_execve.c      1999/11/22 18:01:14     1.4
  @@ -112,7 +112,7 @@
    * local argv[] array. The va_arg logic makes sure we do the right thing.
    * XXX: malloc() is used because we expect to be overlaid soon.
    */
  -int ap_execle(const char *filename, const char *argv0, ...)
  +ap_status_t ap_execle(const char *filename, const char *argv0, ...)
   {
       va_list adummy;
       char **envp;
  @@ -127,8 +127,7 @@
       va_end(adummy);
   
       if ((argv = (char **) malloc((argc + 2) * sizeof(*argv))) == NULL) {
  -     fprintf(stderr, "Ouch!  Out of memory in ap_execle()!\n");
  -     return -1;
  +     return APR_ENOMEM;
       }
   
       /* Pass two --- copy the argument strings into the result space */
  @@ -140,7 +139,8 @@
       envp = va_arg(adummy, char **);
       va_end(adummy);
   
  -    ret = ap_execve(filename, argv, envp);
  +    ap_execve(filename, argv, envp);
  +    ret = errno;
       free(argv);
   
       return ret;
  @@ -163,7 +163,7 @@
    * We have to fiddle with the argv array to make it work on platforms
    * which don't support the "hashbang" interpreter line by default.
    */
  -int ap_execve(const char *filename, const char *argv[],
  +ap_status_t ap_execve(const char *filename, const char *argv[],
              const char *envp[])
   {
       const char **script_argv;
  @@ -225,8 +225,7 @@
            int i = count_args(argv) + 1;   /* +1 for leading SHELL_PATH */
   
            if ((script_argv = malloc(sizeof(*script_argv) * i)) == NULL) {
  -             fprintf(stderr, "Ouch!  Out of memory in ap_execve()!\n");
  -             return -1;
  +             return APR_ENOMEM;
            }
   
            script_argv[0] = SHELL_PATH;
  @@ -241,7 +240,7 @@
            free(script_argv);
        }
       }
  -    return -1;
  +    return errno;
   }
   
   /*---------------------------------------------------------------*/
  
  
  
  1.4       +5 -5      apache-2.0/src/lib/apr/lib/apr_fnmatch.c
  
  Index: apr_fnmatch.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/lib/apr/lib/apr_fnmatch.c,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- apr_fnmatch.c     1999/09/12 10:52:17     1.3
  +++ apr_fnmatch.c     1999/11/22 18:01:23     1.4
  @@ -56,7 +56,7 @@
   
   static const char *rangematch(const char *, int, int);
   
  -API_EXPORT(int) ap_fnmatch(const char *pattern, const char *string, int 
flags)
  +API_EXPORT(ap_status_t) ap_fnmatch(const char *pattern, const char *string, 
int flags)
   {
       const char *stringstart;
       char c, test;
  @@ -64,7 +64,7 @@
       for (stringstart = string;;) {
        switch (c = *pattern++) {
        case EOS:
  -         return (*string == EOS ? 0 : FNM_NOMATCH);
  +         return (*string == EOS ? APR_SUCCESS : FNM_NOMATCH);
        case '?':
            if (*string == EOS) {
                return (FNM_NOMATCH);
  @@ -95,10 +95,10 @@
            /* Optimize for pattern with * at end or before /. */
            if (c == EOS) {
                if (flags & FNM_PATHNAME) {
  -                 return (strchr(string, '/') == NULL ? 0 : FNM_NOMATCH);
  +                 return (strchr(string, '/') == NULL ? APR_SUCCESS : 
FNM_NOMATCH);
                }
                else {
  -                 return (0);
  +                 return (APR_SUCCESS);
                }
            }
            else if (c == '/' && flags & FNM_PATHNAME) {
  @@ -111,7 +111,7 @@
            /* General case, use recursion. */
            while ((test = *string) != EOS) {
                if (!ap_fnmatch(pattern, string, flags & ~FNM_PERIOD)) {
  -                 return (0);
  +                 return (APR_SUCCESS);
                }
                if (test == '/' && flags & FNM_PATHNAME) {
                    break;
  
  
  
  1.4       +13 -8     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.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- apr_md5.c 1999/10/01 16:18:32     1.3
  +++ apr_md5.c 1999/11/22 18:01:28     1.4
  @@ -178,7 +178,7 @@
   
   /* MD5 initialization. Begins an MD5 operation, writing a new context.
    */
  -API_EXPORT(void) ap_MD5Init(APR_MD5_CTX * context)
  +API_EXPORT(ap_status_t) ap_MD5Init(APR_MD5_CTX * context)
   {
       context->count[0] = context->count[1] = 0;
       /* Load magic initialization constants. */
  @@ -186,13 +186,14 @@
       context->state[1] = 0xefcdab89;
       context->state[2] = 0x98badcfe;
       context->state[3] = 0x10325476;
  +    return APR_SUCCESS;
   }
   
   /* MD5 block update operation. Continues an MD5 message-digest
      operation, processing another message block, and updating the
      context.
    */
  -API_EXPORT(void) ap_MD5Update(APR_MD5_CTX * context, const unsigned char 
*input,
  +API_EXPORT(ap_status_t) ap_MD5Update(APR_MD5_CTX * context, const unsigned 
char *input,
                           unsigned int inputLen)
   {
       unsigned int i, idx, partLen;
  @@ -242,12 +243,13 @@
       /* Buffer remaining input */
       ebcdic2ascii_strictly(&context->buffer[idx], &input[i], inputLen - i);
   #endif /*CHARSET_EBCDIC*/
  +    return APR_SUCCESS;
   }
   
   /* MD5 finalization. Ends an MD5 message-digest operation, writing the
      the message digest and zeroizing the context.
    */
  -API_EXPORT(void) ap_MD5Final(unsigned char digest[16], APR_MD5_CTX * context)
  +API_EXPORT(ap_status_t) ap_MD5Final(unsigned char digest[16], APR_MD5_CTX * 
context)
   {
       unsigned char bits[8];
       unsigned int idx, padLen;
  @@ -284,6 +286,8 @@
   
       /* Zeroize sensitive information. */
       memset(context, 0, sizeof(*context));
  +    
  +    return APR_SUCCESS;
   }
   
   /* MD5 basic transformation. Transforms state based on block. */
  @@ -426,7 +430,7 @@
       }
   }
   
  -API_EXPORT(void) ap_MD5Encode(const char *pw, const char *salt,
  +API_EXPORT(ap_status_t) ap_MD5Encode(const char *pw, const char *salt,
                              char *result, size_t nbytes)
   {
       /*
  @@ -573,16 +577,17 @@
       memset(final, 0, sizeof(final));
   
       ap_cpystrn(result, passwd, nbytes - 1);
  +    return APR_SUCCESS;
   }
   
   /*
    * Validate a plaintext password against a smashed one.  Use either
    * crypt() (if available) or ap_MD5Encode(), depending upon the format
  - * of the smashed input password.  Return NULL if they match, or
  - * an explanatory text string if they don't.
  + * of the smashed input password.  Return APR_SUCCESS if they match, or
  + * APR_EMISMATCH if they don't.
    */
   
  -API_EXPORT(char *) ap_validate_password(const char *passwd, const char *hash)
  +API_EXPORT(ap_status_t) ap_validate_password(const char *passwd, const char 
*hash)
   {
       char sample[120];
   #ifndef WIN32
  @@ -605,5 +610,5 @@
        ap_cpystrn(sample, crypt_pw, sizeof(sample) - 1);
   #endif
       }
  -    return (strcmp(sample, hash) == 0) ? NULL : "password mismatch";
  +    return (strcmp(sample, hash) == 0) ? APR_SUCCESS : APR_EMISMATCH;
   }
  
  
  

Reply via email to