cvs commit: apachen/src/main conf.h
dgaudet 97/12/18 18:16:02 Modified:src/main conf.h Log: Better glibc support for linux. PR: 1542 Reviewed by: Martin Kraemer, Jim Jagielski Revision ChangesPath 1.163 +30 -2 apachen/src/main/conf.h Index: conf.h === RCS file: /export/home/cvs/apachen/src/main/conf.h,v retrieving revision 1.162 retrieving revision 1.163 diff -u -r1.162 -r1.163 --- conf.h1997/12/01 12:10:14 1.162 +++ conf.h1997/12/19 02:16:01 1.163 @@ -310,22 +310,50 @@ #define HAVE_SYSLOG #elif defined(LINUX) + #if LINUX 1 #include features.h + +/* libc4 systems probably still work, it probably doesn't define + * __GNU_LIBRARY__ + * libc5 systems define __GNU_LIBRARY__ == 1, but don't define __GLIBC__ + * glibc 2.x and later systems define __GNU_LIBRARY__ == 6, but list it as + * deprecated in favour of __GLIBC__; the value 6 will never be changed. + * glibc 1.x systems (i.e. redhat 4.x on sparc/alpha) should have + * __GLIBC__ 2 + * all glibc based systems need crypt.h + */ #if defined(__GNU_LIBRARY__) __GNU_LIBRARY__ 1 -/* it's a glibc host */ #include crypt.h -#define NET_SIZE_T size_t #endif + +/* glibc 2.0.0 through 2.0.4 need size_t * here, where 2.0.5 needs socklen_t * + * there's no way to discern between these two libraries. But using int should + * be portable because otherwise these libs would be hopelessly broken with + * reams of existing networking code. We'll use socklen_t * for 2.1.x and + * later. + * + * int works for all the earlier libs, and is picked up by default later. + */ +#if defined(__GLIBC__) (__GLIBC__ 2 || (__GLIBC__ == 2 __GLIBC_MINOR__ 0)) +#define NET_SIZE_T socklen_t +#endif + #define HAVE_SHMGET #define USE_MMAP_FILES #define HAVE_SYS_RESOURCE_H + +/* glibc 2.1 and later finally define rlim_t */ +#if !defined(__GLIBC__) || __GLIBC__ 2 || (__GLIBC__ == 2 __GLIBC_MINOR__ 1) typedef int rlim_t; +#endif /* flock is faster ... but hasn't been tested on 1.x systems */ #define USE_FLOCK_SERIALIZED_ACCEPT + #else #define USE_FCNTL_SERIALIZED_ACCEPT #endif + #undef HAVE_GMTOFF #undef NO_KILLPG #undef NO_SETSID
cvs commit: apachen/src CHANGES
dgaudet 97/12/18 18:17:17 Modified:src CHANGES Log: pr 1542 Revision ChangesPath 1.530 +2 -0 apachen/src/CHANGES Index: CHANGES === RCS file: /export/home/cvs/apachen/src/CHANGES,v retrieving revision 1.529 retrieving revision 1.530 diff -u -r1.529 -r1.530 --- CHANGES 1997/12/14 20:49:48 1.529 +++ CHANGES 1997/12/19 02:17:15 1.530 @@ -1,5 +1,7 @@ Changes with Apache 1.3b4 + *) Better glibc support under Linux. [Dean Gaudet] PR#1542 + *) RedirectMatch gone / would cause a SIGSEGV. [Dean Gaudet] PR#1319 *) WIN32: avoid overflows during file canonicalisations.
cvs commit: apachen/src/modules/standard mod_negotiation.c
dgaudet 97/12/19 10:24:59 Modified:src CHANGES src/modules/standard mod_negotiation.c Log: Fix a potential SEGV -- the hdr variable was being incremented twice going past the \0 terminator. Reviewed by: Jim Jagielski, Martin Kraemer Revision ChangesPath 1.531 +3 -0 apachen/src/CHANGES Index: CHANGES === RCS file: /export/home/cvs/apachen/src/CHANGES,v retrieving revision 1.530 retrieving revision 1.531 diff -u -r1.530 -r1.531 --- CHANGES 1997/12/19 02:17:15 1.530 +++ CHANGES 1997/12/19 18:24:50 1.531 @@ -1,5 +1,8 @@ Changes with Apache 1.3b4 + *) Fix a potential SEGV problem in mod_negotiation when dealing + with type-maps. [Dean Gaudet] + *) Better glibc support under Linux. [Dean Gaudet] PR#1542 *) RedirectMatch gone / would cause a SIGSEGV. [Dean Gaudet] PR#1319 1.62 +5 -4 apachen/src/modules/standard/mod_negotiation.c Index: mod_negotiation.c === RCS file: /export/home/cvs/apachen/src/modules/standard/mod_negotiation.c,v retrieving revision 1.61 retrieving revision 1.62 diff -u -r1.61 -r1.62 --- mod_negotiation.c 1997/10/22 20:30:26 1.61 +++ mod_negotiation.c 1997/12/19 18:24:52 1.62 @@ -645,10 +645,11 @@ while (*hdr) { if (*hdr == '') { -while (*++hdr *hdr != '') { -continue; -} -++hdr; + hdr = strchr(hdr, ''); + if (hdr == NULL) { + return; + } + ++hdr; } else if (*hdr == '(') { while (*hdr *hdr != ')') {
cvs commit: apachen/src/modules/standard mod_mime_magic.c
dgaudet 97/12/19 15:53:02 Modified:src CHANGES src/modules/standard mod_mime_magic.c Log: - fix an off-by-1 on read() which I think I introduced in an earlier cleanup - fix case where m-desc[] may be left unterminated - note some code which is not multithread safe Reviewed by: Jim Jagielski, Marc Slemko Revision ChangesPath 1.532 +3 -0 apachen/src/CHANGES Index: CHANGES === RCS file: /export/home/cvs/apachen/src/CHANGES,v retrieving revision 1.531 retrieving revision 1.532 diff -u -r1.531 -r1.532 --- CHANGES 1997/12/19 18:24:50 1.531 +++ CHANGES 1997/12/19 23:52:58 1.532 @@ -1,5 +1,8 @@ Changes with Apache 1.3b4 + *) Fix an off-by-1, and an unterminated string error in + mod_mime_magic. [Dean Gaudet] + *) Fix a potential SEGV problem in mod_negotiation when dealing with type-maps. [Dean Gaudet] 1.21 +8 -8 apachen/src/modules/standard/mod_mime_magic.c Index: mod_mime_magic.c === RCS file: /export/home/cvs/apachen/src/modules/standard/mod_mime_magic.c,v retrieving revision 1.20 retrieving revision 1.21 diff -u -r1.20 -r1.21 --- mod_mime_magic.c 1997/11/16 01:52:23 1.20 +++ mod_mime_magic.c 1997/12/19 23:53:01 1.21 @@ -881,7 +881,7 @@ /* * try looking at the first HOWMANY bytes */ -if ((nbytes = read(fd, (char *) buf, sizeof(buf))) == -1) { +if ((nbytes = read(fd, (char *) buf, sizeof(buf) - 1)) == -1) { aplog_error(APLOG_MARK, APLOG_ERR, r-server, MODNAME : read failed: %s, r-filename); return HTTP_INTERNAL_SERVER_ERROR; @@ -1086,7 +1086,6 @@ */ static int parse(server_rec *serv, pool *p, char *l, int lineno) { -int i = 0; struct magic *m; char *t, *s; magic_server_config_rec *conf = (magic_server_config_rec *) @@ -1297,14 +1296,13 @@ } else m-nospflag = 0; -while ((m-desc[i++] = *l++) != '\0' i MAXDESC) - /* NULLBODY */ ; +strncpy(m-desc, l, sizeof(m-desc) - 1); +m-desc[sizeof(m-desc) - 1] = '\0'; #if MIME_MAGIC_DEBUG aplog_error(APLOG_MARK, APLOG_NOERRNO | APLOG_DEBUG, serv, MODNAME : parse line=%d m=%x next=%x cont=%d desc=%s, - lineno, m, m-next, m-cont_level, - m-desc ? m-desc : NULL); + lineno, m, m-next, m-cont_level, m-desc); #endif /* MIME_MAGIC_DEBUG */ return 0; @@ -1650,7 +1648,7 @@ MODNAME : line=%d mc=%x mc-next=%x cont=%d desc=%s, m_cont-lineno, m_cont, m_cont-next, m_cont-cont_level, - m_cont-desc ? m_cont-desc : NULL); + m_cont-desc); #endif /* * this trick allows us to keep *m in sync when the continue @@ -1779,6 +1777,7 @@ case DATE: case BEDATE: case LEDATE: + /* XXX: not multithread safe */ pp = ctime((time_t *) p-l); if ((rt = strchr(pp, '\n')) != NULL) *rt = '\0'; @@ -1842,10 +1841,10 @@ struct magic *m, int nbytes) { long offset = m-offset; + if (offset + sizeof(union VALUETYPE) nbytes) return 0; - memcpy(p, s + offset, sizeof(union VALUETYPE)); if (!mconvert(r, p, m)) @@ -2066,6 +2065,7 @@ s = (unsigned char *) memcpy(nbuf, buf, small_nbytes); s[small_nbytes] = '\0'; has_escapes = (memchr(s, '\033', small_nbytes) != NULL); +/* XXX: not multithread safe */ while ((token = strtok((char *) s, \t\n\r\f)) != NULL) { s = NULL; /* make strtok() keep on tokin' */ for (p = names; p names + NNAMES; p++) {