Re: cvs commit: apache-1.3/src/modules/standard mod_auth.c mod_auth_db.c mod_auth_dbm.c
On 2 Aug 1999 [EMAIL PROTECTED] wrote: >src/include ap.h ap_md5.h ap_sha1.h >src/main http_main.c >src/modules/standard mod_auth.c mod_auth_db.c mod_auth_dbm.c > Removed: src/include ap_checkpass.h I am struggling with the same now; moving a few base64 encoders into one ap_base64.c file. What is the cut-off point for moving all declarations into ap.h as opposed to adding a few individual ap_*.h file ? Or was the current ap_md5.h simply wrong to begin with ? And caused by its legacy start; as an import from elsewhere ? Seeing your change I kind of prefer the ap.h collation; but I wonder a bit, as the base64 and validate_passwd functions are only used in just one or two files. ap.h is not getting any smaller. Or is that a needless worry ? Dw. > RCS file: /home/cvs/apache-1.3/src/include/ap.h,v > retrieving revision 1.21 > retrieving revision 1.22 > diff -u -r1.21 -r1.22 > --- ap.h1999/05/31 17:09:31 1.21 > +++ ap.h1999/08/02 20:50:14 1.22 > @@ -159,6 +159,7 @@ > __attribute__((format(printf,3,4))); >API_EXPORT(int) ap_vsnprintf(char *buf, size_t len, const char *format, >va_list ap); > +API_EXPORT(char *) ap_validate_password(const char *passwd, const char > *hash); > >#ifdef __cplusplus >} >
cvs commit: apache-1.3/src/modules/standard mod_auth.c mod_auth_db.c mod_auth_dbm.c
coar99/08/02 13:50:23 Modified:src/ap ap_sha1.c src/include ap.h ap_md5.h ap_sha1.h src/main http_main.c src/modules/standard mod_auth.c mod_auth_db.c mod_auth_dbm.c Removed: src/include ap_checkpass.h Log: Fix some spacing issues in the SHA1 and ap_validate_password changes. ap_validate_password() isn't called by anything in the core, so the link may well omit it -- causing DSO mod_auth* modules to fail to load. Force a reference to it into the core server so that won't happen. As soon as ap_checkpass.c includes any other symbols routinely referenced by the core, the kludge at the bottom of http_main.c can go away. Or earlier, if someone finds a better solution. Revision ChangesPath 1.2 +100 -91 apache-1.3/src/ap/ap_sha1.c Index: ap_sha1.c === RCS file: /home/cvs/apache-1.3/src/ap/ap_sha1.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- ap_sha1.c 1999/08/02 10:13:44 1.1 +++ ap_sha1.c 1999/08/02 20:50:12 1.2 @@ -55,7 +55,7 @@ * * The only exported function: * - *ap_sha1_base64(char *clear, int len, char *out); + *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 @@ -140,19 +140,19 @@ #define SHA_DIGESTSIZE 20 typedef struct { - LONG digest[5]; /* message digest */ - LONG count_lo, count_hi;/* 64-bit bit count */ - LONG data[16]; /* SHA data buffer */ - int local; /* unprocessed amount in data */ - } SHA_INFO; - -void sha_init(SHA_INFO *); -void sha_update(SHA_INFO *, BYTE *, int); -void sha_final(SHA_INFO *); -void sha_raw_swap(SHA_INFO *); -void output64chunk(unsigned char, unsigned char, unsigned char, - int, unsigned char **); -void encode_mime64(unsigned char *, unsigned char *, int); +LONG digest[5]; /* message digest */ +LONG count_lo, count_hi;/* 64-bit bit count */ +LONG data[16]; /* SHA data buffer */ +int local; /* unprocessed amount in data */ +} SHA_INFO; + +static void sha_init(SHA_INFO *); +static void sha_update(SHA_INFO *, const BYTE *, int); +static void sha_final(SHA_INFO *); +static void sha_raw_swap(SHA_INFO *); +static void output64chunk(unsigned char, unsigned char, unsigned char, + int, unsigned char **); +static void encode_mime64(unsigned char *, unsigned char *, int); void sha1_base64(char *, int, char *); /* do SHA transformation */ @@ -217,14 +217,15 @@ } union endianTest { - long Long; - char Char[sizeof(long)]; +long Long; +char Char[sizeof(long)]; }; -char isLittleEndian() { - static union endianTest u; - u.Long = 1; - return(u.Char[0]==1); +static char isLittleEndian(void) +{ +static union endianTest u; +u.Long = 1; +return (u.Char[0] == 1); } /* change endianness of data */ @@ -236,25 +237,25 @@ BYTE ct[4], *cp; if (isLittleEndian()) {/* do the swap only if it is little endian */ - count /= sizeof(LONG); - cp = (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(LONG); - } + count /= sizeof(LONG); + cp = (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(LONG); + } } } /* initialize the SHA digest */ -void sha_init(SHA_INFO *sha_info) +static void sha_init(SHA_INFO *sha_info) { sha_info->digest[0] = 0x67452301L; sha_info->digest[1] = 0xefcdab89L; @@ -268,7 +269,7 @@ /* update the SHA digest */ -void sha_update(SHA_INFO *sha_info, BYTE *buffer, int count) +static void sha_update(SHA_INFO *sha_info, const BYTE *buffer, int count) { int i; @@ -289,7 +290,8 @@ if (sha_info->local == SHA_BLOCKSIZE) { maybe_byte_reverse(sha_info->data, SHA_BLOCKSIZE); sha_transform(sha_info); - } else { + } + else { return; } } @@ -306,7 +308,7 @@ /* finish computing the SHA digest */ -void sha_final(SHA_INFO *sha_info) +static void sha_final(SHA_I
cvs commit: apache-1.3/src/modules/standard mod_auth.c mod_auth_db.c mod_auth_dbm.c
marc99/01/31 14:01:36 Modified:src/modules/standard mod_auth.c mod_auth_db.c mod_auth_dbm.c Log: We have found the prototype for crypt. Since people actually once in a while are "nice enough" to write in telling me that they know where the prototype is on their system based on that comment, plus we don't do the casting associated with the comment any more, it can go away. Revision ChangesPath 1.44 +0 -1 apache-1.3/src/modules/standard/mod_auth.c Index: mod_auth.c === RCS file: /export/home/cvs/apache-1.3/src/modules/standard/mod_auth.c,v retrieving revision 1.43 retrieving revision 1.44 diff -u -r1.43 -r1.44 --- mod_auth.c1999/01/25 22:55:38 1.43 +++ mod_auth.c1999/01/31 22:01:34 1.44 @@ -220,7 +220,6 @@ ap_note_basic_auth_failure(r); return AUTH_REQUIRED; } -/* anyone know where the prototype for crypt is? */ if (real_pw[0] == '$' && real_pw[1] == '1') { const char *salt = real_pw + 3; salt = ap_getword(r->pool, &salt, '$'); 1.39 +0 -1 apache-1.3/src/modules/standard/mod_auth_db.c Index: mod_auth_db.c === RCS file: /export/home/cvs/apache-1.3/src/modules/standard/mod_auth_db.c,v retrieving revision 1.38 retrieving revision 1.39 diff -u -r1.38 -r1.39 --- mod_auth_db.c 1999/01/26 00:15:21 1.38 +++ mod_auth_db.c 1999/01/31 22:01:34 1.39 @@ -251,7 +251,6 @@ if (colon_pw) { *colon_pw = '\0'; } -/* anyone know where the prototype for crypt is? */ if (real_pw[0] == '$' && real_pw[1] == '1') { char *salt = real_pw + 3; salt = ap_getword(r->pool, &salt, '$'); 1.44 +0 -1 apache-1.3/src/modules/standard/mod_auth_dbm.c Index: mod_auth_dbm.c === RCS file: /export/home/cvs/apache-1.3/src/modules/standard/mod_auth_dbm.c,v retrieving revision 1.43 retrieving revision 1.44 diff -u -r1.43 -r1.44 --- mod_auth_dbm.c1999/01/26 00:15:21 1.43 +++ mod_auth_dbm.c1999/01/31 22:01:34 1.44 @@ -232,7 +232,6 @@ colon_pw = strchr(real_pw, ':'); if (colon_pw) *colon_pw = '\0'; -/* anyone know where the prototype for crypt is? */ if (real_pw[0] == '$' && real_pw[1] == '1') { char *salt = real_pw + 3; salt = ap_getword(r->pool, &salt, '$');
cvs commit: apache-1.3/src/modules/standard mod_auth.c mod_auth_db.c mod_auth_dbm.c
rse 98/10/03 08:11:54 Modified:src CHANGES src/modules/standard mod_auth.c mod_auth_db.c mod_auth_dbm.c Log: Fix `require ...' directive parsing in mod_auth, mod_auth_dbm and mod_auth_db by using ap_getword_white() (which uses ap_isspace()) instead of ap_getword(..., ' ') (which parses only according to spaces but not tabs). Submitted by: James Morris <[EMAIL PROTECTED]> Reviewed and extended to other mods: Ralf S. Engelschall PR: 3105 Revision ChangesPath 1.1094+5 -0 apache-1.3/src/CHANGES Index: CHANGES === RCS file: /export/home/cvs/apache-1.3/src/CHANGES,v retrieving revision 1.1093 retrieving revision 1.1094 diff -u -r1.1093 -r1.1094 --- CHANGES 1998/10/03 14:42:23 1.1093 +++ CHANGES 1998/10/03 15:11:50 1.1094 @@ -1,5 +1,10 @@ Changes with Apache 1.3.3 + *) Fix `require ...' directive parsing in mod_auth, mod_auth_dbm and + mod_auth_db by using ap_getword_white() (which uses ap_isspace()) instead of + ap_getword(..., ' ') (which parses only according to spaces but not tabs). + [James Morris <[EMAIL PROTECTED]>, Ralf S. Engelschall] PR#3105 + *) Fix the SERVER_NAME variable under sub-request situations (where `UseCanonicalName off' is used) like CGI's called from SSI pages or RewriteCond variables by adopting r->hostname to sub-requests. 1.40 +1 -1 apache-1.3/src/modules/standard/mod_auth.c Index: mod_auth.c === RCS file: /export/home/cvs/apache-1.3/src/modules/standard/mod_auth.c,v retrieving revision 1.39 retrieving revision 1.40 diff -u -r1.39 -r1.40 --- mod_auth.c1998/08/06 17:30:54 1.39 +++ mod_auth.c1998/10/03 15:11:52 1.40 @@ -264,7 +264,7 @@ method_restricted = 1; t = reqs[x].requirement; - w = ap_getword(r->pool, &t, ' '); + w = ap_getword_white(r->pool, &t); if (!strcmp(w, "valid-user")) return OK; if (!strcmp(w, "user")) { 1.34 +2 -2 apache-1.3/src/modules/standard/mod_auth_db.c Index: mod_auth_db.c === RCS file: /export/home/cvs/apache-1.3/src/modules/standard/mod_auth_db.c,v retrieving revision 1.33 retrieving revision 1.34 diff -u -r1.33 -r1.34 --- mod_auth_db.c 1998/09/19 12:12:36 1.33 +++ mod_auth_db.c 1998/10/03 15:11:52 1.34 @@ -281,7 +281,7 @@ continue; t = reqs[x].requirement; - w = ap_getword(r->pool, &t, ' '); + w = ap_getword_white(r->pool, &t); if (!strcmp(w, "group") && sec->auth_dbgrpfile) { const char *orig_groups, *groups; @@ -298,7 +298,7 @@ } orig_groups = groups; while (t[0]) { - w = ap_getword(r->pool, &t, ' '); + w = ap_getword_white(r->pool, &t); groups = orig_groups; while (groups[0]) { v = ap_getword(r->pool, &groups, ','); 1.40 +2 -2 apache-1.3/src/modules/standard/mod_auth_dbm.c Index: mod_auth_dbm.c === RCS file: /export/home/cvs/apache-1.3/src/modules/standard/mod_auth_dbm.c,v retrieving revision 1.39 retrieving revision 1.40 diff -u -r1.39 -r1.40 --- mod_auth_dbm.c1998/08/06 17:30:55 1.39 +++ mod_auth_dbm.c1998/10/03 15:11:53 1.40 @@ -266,7 +266,7 @@ continue; t = reqs[x].requirement; - w = ap_getword(r->pool, &t, ' '); + w = ap_getword_white(r->pool, &t); if (!strcmp(w, "group") && sec->auth_dbmgrpfile) { const char *orig_groups, *groups; @@ -283,7 +283,7 @@ } orig_groups = groups; while (t[0]) { - w = ap_getword(r->pool, &t, ' '); + w = ap_getword_white(r->pool, &t); groups = orig_groups; while (groups[0]) { v = ap_getword(r->pool, &groups, ',');