dirkx 99/08/12 11:06:30
Modified: src/ap ap_base64.c ap_sha1.c
src/include ap.h httpd.h
src/main util.c
src/support ab.c
Log:
Resolution naming problems,
Rename of
*uuXXcode -> base64
rename of the old routines
ap_uuXXcode -> ap_puuXXcode
to signal that they are 'pool'ing.
Plus a wrapper to maintain the old name;
ap_uuencode
which just calls ap_puuencode. Used a wrapper rather than
a #define to faciliate linkers.
Revision Changes Path
1.3 +10 -10 apache-1.3/src/ap/ap_base64.c
Index: ap_base64.c
===================================================================
RCS file: /x3/home/cvs/apache-1.3/src/ap/ap_base64.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- ap_base64.c 1999/08/08 17:38:45 1.2
+++ ap_base64.c 1999/08/12 18:06:17 1.3
@@ -111,7 +111,7 @@
#endif /*CHARSET_EBCDIC*/
};
-API_EXPORT(int) ap_uudecode_len(const char *bufcoded)
+API_EXPORT(int) ap_base64decode_len(const char *bufcoded)
{
int nbytesdecoded;
register const unsigned char *bufin;
@@ -126,14 +126,14 @@
return nbytesdecoded + 1;
}
-API_EXPORT(int) ap_uudecode(char *bufplain, const char *bufcoded)
+API_EXPORT(int) ap_base64decode(char *bufplain, const char *bufcoded)
{
#ifdef CHARSET_EBCDIC
int i;
#endif /* CHARSET_EBCDIC */
int len;
- len = ap_uudecode_binary((unsigned char *) bufplain, bufcoded);
+ len = ap_base64decode_binary((unsigned char *) bufplain, bufcoded);
#ifdef CHARSET_EBCDIC
for (i=0; i<len; i++)
bufplain[i] = os_toebcdic[bufplain[i]];
@@ -141,10 +141,10 @@
return len;
}
-/* This is the same as ap_uudecode() except on EBCDIC machines, where
+/* This is the same as ap_base64udecode() except on EBCDIC machines, where
* the conversion of the output to ebcdic is left out.
*/
-API_EXPORT(int) ap_uudecode_binary(unsigned char *bufplain,
+API_EXPORT(int) ap_base64decode_binary(unsigned char *bufplain,
const char *bufcoded)
{
int nbytesdecoded;
@@ -193,15 +193,15 @@
static const char basis_64[] =
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
-API_EXPORT(int) ap_uuencode_len(int len)
+API_EXPORT(int) ap_base64encode_len(int len)
{
return ((len + 2) / 3 * 4) + 1;
}
-API_EXPORT(int) ap_uuencode(char *encoded, const char *string, int len)
+API_EXPORT(int) ap_base64encode(char *encoded, const char *string, int len)
{
#ifndef CHARSET_EBCDIC
- return ap_uuencode_binary(encoded, (const unsigned char *) string, len);
+ return ap_base64encode_binary(encoded, (const unsigned char *) string,
len);
#else /* CHARSET_EBCDIC */
int i;
char *p;
@@ -231,10 +231,10 @@
#endif /* CHARSET_EBCDIC */
}
-/* This is the same as ap_uuencode() except on EBCDIC machines, where
+/* 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_uuencode_binary(char *encoded, const unsigned char
*string,
+API_EXPORT(int) ap_base64encode_binary(char *encoded, const unsigned char
*string,
int len)
{
int i;
1.8 +1 -1 apache-1.3/src/ap/ap_sha1.c
Index: ap_sha1.c
===================================================================
RCS file: /x3/home/cvs/apache-1.3/src/ap/ap_sha1.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- ap_sha1.c 1999/08/10 11:31:53 1.7
+++ ap_sha1.c 1999/08/12 18:06:18 1.8
@@ -379,7 +379,7 @@
strcpy(out, sha1_id);
/* SHA1 hash is always 20 chars */
- l = ap_uuencode_binary(out + strlen(sha1_id), digest, sizeof(digest));
+ l = ap_base64encode_binary(out + strlen(sha1_id), digest,
sizeof(digest));
out[l + strlen(sha1_id)] = '\0';
/*
1.24 +6 -6 apache-1.3/src/include/ap.h
Index: ap.h
===================================================================
RCS file: /x3/home/cvs/apache-1.3/src/include/ap.h,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -r1.23 -r1.24
--- ap.h 1999/08/08 11:45:16 1.23
+++ ap.h 1999/08/12 18:06:20 1.24
@@ -171,13 +171,13 @@
* strings are neither. But propably should.
*
*/
-API_EXPORT(int) ap_uuencode_len(int len);
-API_EXPORT(int) ap_uuencode(char * coded_dst, const char *plain_src,int
len_plain_src);
-API_EXPORT(int) ap_uuencode_binary(char * coded_dst, const unsigned char
*plain_src,int len_plain_src);
+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_uudecode_len(const char * coded_src);
-API_EXPORT(int) ap_uudecode(char * plain_dst, const char *coded_src);
-API_EXPORT(int) ap_uudecode_binary(unsigned char * plain_dst, const char
*coded_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);
/* Password validation, as used in AuthType Basic which is able to cope
* (based on the prexix) with the SHA1, Apache's internal MD5 and (depending
1.292 +3 -0 apache-1.3/src/include/httpd.h
Index: httpd.h
===================================================================
RCS file: /x3/home/cvs/apache-1.3/src/include/httpd.h,v
retrieving revision 1.291
retrieving revision 1.292
diff -u -r1.291 -r1.292
--- httpd.h 1999/08/09 17:46:38 1.291
+++ httpd.h 1999/08/12 18:06:21 1.292
@@ -992,6 +992,9 @@
API_EXPORT(int) ap_strcasecmp_match(const char *str, const char *exp);
API_EXPORT(char *) ap_puudecode(pool *, const char *);
API_EXPORT(char *) ap_puuencode(pool *p, char *string);
+API_EXPORT(char *) ap_uudecode(pool *, const char *);
+API_EXPORT(char *) ap_uuencode(pool *p, char *string);
+
#ifdef OS2
void os2pathname(char *path);
char *ap_double_quotes(pool *p, char *str);
1.170 +15 -4 apache-1.3/src/main/util.c
Index: util.c
===================================================================
RCS file: /x3/home/cvs/apache-1.3/src/main/util.c,v
retrieving revision 1.169
retrieving revision 1.170
diff -u -r1.169 -r1.170
--- util.c 1999/08/08 11:45:18 1.169
+++ util.c 1999/08/12 18:06:25 1.170
@@ -1964,23 +1964,34 @@
char *decoded;
int l;
- decoded = (char *) ap_palloc(p, 1+ap_uudecode_len(bufcoded));
- l = ap_uudecode(decoded,bufcoded);
+ decoded = (char *) ap_palloc(p, 1+ap_base64decode_len(bufcoded));
+ l = ap_base64decode(decoded,bufcoded);
decoded[l]='\0'; /* make binary sequence into string */
return decoded;
}
+
API_EXPORT(char *) ap_puuencode(pool *p, char *string)
{
char *encoded;
int l = strlen(string);
- encoded = (char *) ap_palloc(p, 1+ap_uuencode_len(l));
- l=ap_uuencode(encoded,string,l);
+ encoded = (char *) ap_palloc(p, 1+ap_base64encode_len(l));
+ l=ap_base64encode(encoded,string,l);
encoded[l]='\0'; /* make binary sequence into string */
return encoded;
+}
+
+API_EXPORT(char *) ap_uudecode(pool *p, const char *bufcoded)
+{
+ return ap_puudecode(p,bufcoded);
+}
+
+API_EXPORT(char *) ap_uuencode(pool *p, char *string)
+{
+ return ap_puuencode(p,string);
}
#ifdef OS2
1.29 +2 -2 apache-1.3/src/support/ab.c
Index: ab.c
===================================================================
RCS file: /x3/home/cvs/apache-1.3/src/support/ab.c,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -r1.28 -r1.29
--- ab.c 1999/08/08 11:47:47 1.28
+++ ab.c 1999/08/12 18:06:28 1.29
@@ -1027,7 +1027,7 @@
*/
while(isspace(*optarg))
optarg++;
- l=ap_uuencode(tmp,optarg,strlen(optarg));
+ l=ap_base64encode(tmp,optarg,strlen(optarg));
tmp[l]='\0';
strncat(auth, "Authorization: basic ", sizeof(auth));
@@ -1040,7 +1040,7 @@
*/
while(isspace(*optarg))
optarg++;
- l=ap_uuencode(tmp,optarg,strlen(optarg));
+ l=ap_base64encode(tmp,optarg,strlen(optarg));
tmp[l]='\0';
strncat(auth, "Proxy-Authorization: basic ", sizeof(auth));