httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jeff Trawick <>
Subject Re: [PATCH] clean up translation support APR MD5 routines
Date Wed, 03 May 2000 20:05:55 GMT
In the patch previously posted, ap_MD5SetXlate() was provided for
storing an APR translation handle in the md5 context structure.
Whether or not the translation handle was stored determines whether or
not translation is performed.

The other functions implemented in apr_md5.c need to support
translation as well.  These are


For now, I have added an APR translation handle to the parameter list
of each.  In other words:


API_EXPORT(ap_status_t) ap_validate_password(const char *passwd, const char *hash);

API_EXPORT(ap_status_t) ap_MD5Encode(const char *password, const char *salt,
                                     char *result, size_t nbytes);


API_EXPORT(ap_status_t) ap_validate_password(const char *passwd, const char *hash,
                                             ap_xlate_t *xlate);

API_EXPORT(ap_status_t) ap_MD5Encode(const char *password, const char *salt,
                                     char *result, size_t nbytes,
                                     ap_xlate_t *xlate);

Unfortunately, just having the extra parameter brings a bit of bloat
even when it is not going to be used in the current configuration.  On
the other hand, this seems "better" than having different flavors of
the parameter list depending on whether or not CHARSET_EBCDIC (or
similar) is defined.

For these particular routines, the presense of the parameter doesn't
seem too harmful.

A completely different tact on these routines is to keep the old
parameter lists and, when CHARSET_EBCDIC is defined, reference a
translation handle stored in a global variable.  The translation
handle variable would be set by the client (e.g., Apache, htpasswd)
via a function.  On an EBCDIC machine, the translation handle must be
stored before calling ap_validate_password() or ap_MD5Encode();
ap_validate_password() and ap_MD5Encode() would always do translation.

Now that I've implemented the first design (added explicit parameters
to ap_MD5Encode() and ap_validate_password()), I think I like the
second design better (always translate on EBCDIC machine, force client
to store translation handle via separate call). 


Jeff Trawick | | PGP public key at web site:
          Born in Roswell... married an alien...

View raw message