diff options
author | Henning Brauer <henning@cvs.openbsd.org> | 2004-12-02 19:42:49 +0000 |
---|---|---|
committer | Henning Brauer <henning@cvs.openbsd.org> | 2004-12-02 19:42:49 +0000 |
commit | 05219e268f1de9a40d2c605b42dd5d55542874f7 (patch) | |
tree | 5f6ed8b4c6b732e8dfd2819e1f5c94b6d8aa90fc /usr.sbin/httpd | |
parent | a42092c6d6caa5db6bfd3d52f1d428139eda5165 (diff) |
big time httpd cleanup
this diff removes a lot of #ifdef'd stuff that is irrelevant for us.
done by Daniel Ouellet after my advice.
tested by many, ok miod@
Diffstat (limited to 'usr.sbin/httpd')
89 files changed, 24 insertions, 7553 deletions
diff --git a/usr.sbin/httpd/src/ap/ap_base64.c b/usr.sbin/httpd/src/ap/ap_base64.c index 23e7a54e167..7d48df7fb83 100644 --- a/usr.sbin/httpd/src/ap/ap_base64.c +++ b/usr.sbin/httpd/src/ap/ap_base64.c @@ -67,14 +67,10 @@ #include "ap_config.h" #include "ap.h" -#ifdef CHARSET_EBCDIC -#include "ap_ebcdic.h" -#endif /* CHARSET_EBCDIC */ /* aaaack but it's fast and const should make it shared text page. */ static const unsigned char pr2six[256] = { -#ifndef CHARSET_EBCDIC /* ASCII table */ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, @@ -92,25 +88,6 @@ static const unsigned char pr2six[256] = 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64 -#else /*CHARSET_EBCDIC*/ - /* EBCDIC table */ - 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, - 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, - 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, - 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, - 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 62, 64, - 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, - 64, 63, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, - 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, - 64, 26, 27, 28, 29, 30, 31, 32, 33, 34, 64, 64, 64, 64, 64, 64, - 64, 35, 36, 37, 38, 39, 40, 41, 42, 43, 64, 64, 64, 64, 64, 64, - 64, 64, 44, 45, 46, 47, 48, 49, 50, 51, 64, 64, 64, 64, 64, 64, - 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, - 64, 0, 1, 2, 3, 4, 5, 6, 7, 8, 64, 64, 64, 64, 64, 64, - 64, 9, 10, 11, 12, 13, 14, 15, 16, 17, 64, 64, 64, 64, 64, 64, - 64, 64, 18, 19, 20, 21, 22, 23, 24, 25, 64, 64, 64, 64, 64, 64, - 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 64, 64, 64, 64, 64, 64 -#endif /*CHARSET_EBCDIC*/ }; API_EXPORT(int) ap_base64decode_len(const char *bufcoded) @@ -130,16 +107,9 @@ API_EXPORT(int) ap_base64decode_len(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_base64decode_binary((unsigned char *) bufplain, bufcoded); -#ifdef CHARSET_EBCDIC - for (i = 0; i < len; i++) - bufplain[i] = os_toebcdic[bufplain[i]]; -#endif /* CHARSET_EBCDIC */ bufplain[len] = '\0'; return len; } @@ -202,38 +172,7 @@ API_EXPORT(int) ap_base64encode_len(int len) API_EXPORT(int) ap_base64encode(char *encoded, const char *string, int len) { -#ifndef CHARSET_EBCDIC return ap_base64encode_binary(encoded, (const unsigned char *) string, len); -#else /* CHARSET_EBCDIC */ - int i; - char *p; - - p = encoded; - for (i = 0; i < len - 2; i += 3) { - *p++ = basis_64[(os_toascii[string[i]] >> 2) & 0x3F]; - *p++ = basis_64[((os_toascii[string[i]] & 0x3) << 4) | - ((int) (os_toascii[string[i + 1]] & 0xF0) >> 4)]; - *p++ = basis_64[((os_toascii[string[i + 1]] & 0xF) << 2) | - ((int) (os_toascii[string[i + 2]] & 0xC0) >> 6)]; - *p++ = basis_64[os_toascii[string[i + 2]] & 0x3F]; - } - if (i < len) { - *p++ = basis_64[(os_toascii[string[i]] >> 2) & 0x3F]; - if (i == (len - 1)) { - *p++ = basis_64[((os_toascii[string[i]] & 0x3) << 4)]; - *p++ = '='; - } - else { - *p++ = basis_64[((os_toascii[string[i]] & 0x3) << 4) | - ((int) (os_toascii[string[i + 1]] & 0xF0) >> 4)]; - *p++ = basis_64[((os_toascii[string[i + 1]] & 0xF) << 2)]; - } - *p++ = '='; - } - - *p++ = '\0'; - return p - encoded; -#endif /* CHARSET_EBCDIC */ } /* This is the same as ap_base64encode() except on EBCDIC machines, where diff --git a/usr.sbin/httpd/src/ap/ap_checkpass.c b/usr.sbin/httpd/src/ap/ap_checkpass.c index aebb2ad5586..5b5f13fac55 100644 --- a/usr.sbin/httpd/src/ap/ap_checkpass.c +++ b/usr.sbin/httpd/src/ap/ap_checkpass.c @@ -101,15 +101,7 @@ API_EXPORT(char *) ap_validate_password(const char *passwd, const char *hash) /* * It's not our algorithm, so feed it to crypt() if possible. */ -#if defined(WIN32) || defined(NETWARE) - /* - * On Windows, the only alternative to our MD5 algorithm is plain - * text. - */ - ap_cpystrn(sample, passwd, sizeof(sample) - 1); -#else ap_cpystrn(sample, (char *)crypt(passwd, hash), sizeof(sample) - 1); -#endif } return (strcmp(sample, hash) == 0) ? NULL : "password mismatch"; } diff --git a/usr.sbin/httpd/src/ap/ap_ebcdic.c b/usr.sbin/httpd/src/ap/ap_ebcdic.c index 72ef926e198..2d3aadacaf5 100644 --- a/usr.sbin/httpd/src/ap/ap_ebcdic.c +++ b/usr.sbin/httpd/src/ap/ap_ebcdic.c @@ -57,202 +57,3 @@ #include "http_config.h" #include "ap_config.h" -#ifdef CHARSET_EBCDIC -#include "ap_ebcdic.h" - - -/* ====================================================================== */ -/* Global functions for dealing with EBCDIC <-> ASCII conversion: */ -/* ====================================================================== */ - -/* EBCDIC-to-ASCII tables: - These tables are bijective - there are no ambigous or duplicate characters. - */ -const unsigned char os_toascii[256] = { -#ifdef _OSD_POSIX /* Fujitsu-Siemens' EDF04 character set on BS2000: */ -/*00*/ 0x00, 0x01, 0x02, 0x03, 0x85, 0x09, 0x86, 0x7f, - 0x87, 0x8d, 0x8e, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /*................*/ -/*10*/ 0x10, 0x11, 0x12, 0x13, 0x8f, 0x0a, 0x08, 0x97, - 0x18, 0x19, 0x9c, 0x9d, 0x1c, 0x1d, 0x1e, 0x1f, /*................*/ -/*20*/ 0x80, 0x81, 0x82, 0x83, 0x84, 0x92, 0x17, 0x1b, - 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x05, 0x06, 0x07, /*................*/ -/*30*/ 0x90, 0x91, 0x16, 0x93, 0x94, 0x95, 0x96, 0x04, - 0x98, 0x99, 0x9a, 0x9b, 0x14, 0x15, 0x9e, 0x1a, /*................*/ -/*40*/ 0x20, 0xa0, 0xe2, 0xe4, 0xe0, 0xe1, 0xe3, 0xe5, - 0xe7, 0xf1, 0x60, 0x2e, 0x3c, 0x28, 0x2b, 0x7c, /* .........`.<(+|*/ -/*50*/ 0x26, 0xe9, 0xea, 0xeb, 0xe8, 0xed, 0xee, 0xef, - 0xec, 0xdf, 0x21, 0x24, 0x2a, 0x29, 0x3b, 0x9f, /*&.........!$*);.*/ -/*60*/ 0x2d, 0x2f, 0xc2, 0xc4, 0xc0, 0xc1, 0xc3, 0xc5, - 0xc7, 0xd1, 0x5e, 0x2c, 0x25, 0x5f, 0x3e, 0x3f, /*-/........^,%_>?*/ -/*70*/ 0xf8, 0xc9, 0xca, 0xcb, 0xc8, 0xcd, 0xce, 0xcf, - 0xcc, 0xa8, 0x3a, 0x23, 0x40, 0x27, 0x3d, 0x22, /*..........:#@'="*/ -/*80*/ 0xd8, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, - 0x68, 0x69, 0xab, 0xbb, 0xf0, 0xfd, 0xfe, 0xb1, /*.abcdefghi......*/ -/*90*/ 0xb0, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, 0x70, - 0x71, 0x72, 0xaa, 0xba, 0xe6, 0xb8, 0xc6, 0xa4, /*.jklmnopqr......*/ -/*a0*/ 0xb5, 0xaf, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, - 0x79, 0x7a, 0xa1, 0xbf, 0xd0, 0xdd, 0xde, 0xae, /*..stuvwxyz......*/ -/*b0*/ 0xa2, 0xa3, 0xa5, 0xb7, 0xa9, 0xa7, 0xb6, 0xbc, - 0xbd, 0xbe, 0xac, 0x5b, 0x5c, 0x5d, 0xb4, 0xd7, /*...........[\]..*/ -/*c0*/ 0xf9, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, - 0x48, 0x49, 0xad, 0xf4, 0xf6, 0xf2, 0xf3, 0xf5, /*.ABCDEFGHI......*/ -/*d0*/ 0xa6, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, 0x50, - 0x51, 0x52, 0xb9, 0xfb, 0xfc, 0xdb, 0xfa, 0xff, /*.JKLMNOPQR......*/ -/*e0*/ 0xd9, 0xf7, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, - 0x59, 0x5a, 0xb2, 0xd4, 0xd6, 0xd2, 0xd3, 0xd5, /*..STUVWXYZ......*/ -/*f0*/ 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, - 0x38, 0x39, 0xb3, 0x7b, 0xdc, 0x7d, 0xda, 0x7e /*0123456789.{.}.~*/ - -#elif defined(OS390) || defined(TPF) /* IBM's OS/390 and TPF systems: */ -/* -Bijective EBCDIC (character set IBM-1047) to US-ASCII table: -*/ - 0x00, 0x01, 0x02, 0x03, 0x85, 0x09, 0x86, 0x7f, /* 00-0f: */ - 0x87, 0x8d, 0x8e, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* ................ */ - 0x10, 0x11, 0x12, 0x13, 0x8f, 0x0a, 0x08, 0x97, /* 10-1f: */ - 0x18, 0x19, 0x9c, 0x9d, 0x1c, 0x1d, 0x1e, 0x1f, /* ................ */ - 0x80, 0x81, 0x82, 0x83, 0x84, 0x92, 0x17, 0x1b, /* 20-2f: */ - 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x05, 0x06, 0x07, /* ................ */ - 0x90, 0x91, 0x16, 0x93, 0x94, 0x95, 0x96, 0x04, /* 30-3f: */ - 0x98, 0x99, 0x9a, 0x9b, 0x14, 0x15, 0x9e, 0x1a, /* ................ */ - 0x20, 0xa0, 0xe2, 0xe4, 0xe0, 0xe1, 0xe3, 0xe5, /* 40-4f: */ - 0xe7, 0xf1, 0xa2, 0x2e, 0x3c, 0x28, 0x2b, 0x7c, /* ...........<(+| */ - 0x26, 0xe9, 0xea, 0xeb, 0xe8, 0xed, 0xee, 0xef, /* 50-5f: */ - 0xec, 0xdf, 0x21, 0x24, 0x2a, 0x29, 0x3b, 0x5e, /* &.........!$*);^ */ - 0x2d, 0x2f, 0xc2, 0xc4, 0xc0, 0xc1, 0xc3, 0xc5, /* 60-6f: */ - 0xc7, 0xd1, 0xa6, 0x2c, 0x25, 0x5f, 0x3e, 0x3f, /* -/.........,%_>? */ - 0xf8, 0xc9, 0xca, 0xcb, 0xc8, 0xcd, 0xce, 0xcf, /* 70-7f: */ - 0xcc, 0x60, 0x3a, 0x23, 0x40, 0x27, 0x3d, 0x22, /* .........`:#@'=" */ - 0xd8, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, /* 80-8f: */ - 0x68, 0x69, 0xab, 0xbb, 0xf0, 0xfd, 0xfe, 0xb1, /* .abcdefghi...... */ - 0xb0, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, 0x70, /* 90-9f: */ - 0x71, 0x72, 0xaa, 0xba, 0xe6, 0xb8, 0xc6, 0xa4, /* .jklmnopqr...... */ - 0xb5, 0x7e, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, /* a0-af: */ - 0x79, 0x7a, 0xa1, 0xbf, 0xd0, 0x5b, 0xde, 0xae, /* .~stuvwxyz...[.. */ - 0xac, 0xa3, 0xa5, 0xb7, 0xa9, 0xa7, 0xb6, 0xbc, /* b0-bf: */ - 0xbd, 0xbe, 0xdd, 0xa8, 0xaf, 0x5d, 0xb4, 0xd7, /* .............].. */ - 0x7b, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, /* c0-cf: */ - 0x48, 0x49, 0xad, 0xf4, 0xf6, 0xf2, 0xf3, 0xf5, /* {ABCDEFGHI...... */ - 0x7d, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, 0x50, /* d0-df: */ - 0x51, 0x52, 0xb9, 0xfb, 0xfc, 0xf9, 0xfa, 0xff, /* }JKLMNOPQR...... */ - 0x5c, 0xf7, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, /* e0-ef: */ - 0x59, 0x5a, 0xb2, 0xd4, 0xd6, 0xd2, 0xd3, 0xd5, /* \.STUVWXYZ...... */ - 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, /* f0-ff: */ - 0x38, 0x39, 0xb3, 0xdb, 0xdc, 0xd9, 0xda, 0x9f /* 0123456789...... */ -#else -#error Unimplemented EBCDIC platform. Please send information about your system to <martin@apache.org>! -#endif -}; - - -/* Bijective ascii-to-ebcdic table: */ -const unsigned char os_toebcdic[256] = { -#ifdef _OSD_POSIX /* Fujitsu-Siemens' EDF04 character set on BS2000: */ -/*00*/ 0x00, 0x01, 0x02, 0x03, 0x37, 0x2d, 0x2e, 0x2f, - 0x16, 0x05, 0x15, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /*................*/ -/*10*/ 0x10, 0x11, 0x12, 0x13, 0x3c, 0x3d, 0x32, 0x26, - 0x18, 0x19, 0x3f, 0x27, 0x1c, 0x1d, 0x1e, 0x1f, /*................*/ -/*20*/ 0x40, 0x5a, 0x7f, 0x7b, 0x5b, 0x6c, 0x50, 0x7d, - 0x4d, 0x5d, 0x5c, 0x4e, 0x6b, 0x60, 0x4b, 0x61, /* !"#$%&'()*+,-./ */ -/*30*/ 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, - 0xf8, 0xf9, 0x7a, 0x5e, 0x4c, 0x7e, 0x6e, 0x6f, /*0123456789:;<=>?*/ -/*40*/ 0x7c, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, - 0xc8, 0xc9, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, /*@ABCDEFGHIJKLMNO*/ -/*50*/ 0xd7, 0xd8, 0xd9, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, - 0xe7, 0xe8, 0xe9, 0xbb, 0xbc, 0xbd, 0x6a, 0x6d, /*PQRSTUVWXYZ[\]^_*/ -/*60*/ 0x4a, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, - 0x88, 0x89, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, /*`abcdefghijklmno*/ -/*70*/ 0x97, 0x98, 0x99, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, - 0xa7, 0xa8, 0xa9, 0xfb, 0x4f, 0xfd, 0xff, 0x07, /*pqrstuvwxyz{|}~.*/ -/*80*/ 0x20, 0x21, 0x22, 0x23, 0x24, 0x04, 0x06, 0x08, - 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x09, 0x0a, 0x14, /*................*/ -/*90*/ 0x30, 0x31, 0x25, 0x33, 0x34, 0x35, 0x36, 0x17, - 0x38, 0x39, 0x3a, 0x3b, 0x1a, 0x1b, 0x3e, 0x5f, /*................*/ -/*a0*/ 0x41, 0xaa, 0xb0, 0xb1, 0x9f, 0xb2, 0xd0, 0xb5, - 0x79, 0xb4, 0x9a, 0x8a, 0xba, 0xca, 0xaf, 0xa1, /*................*/ -/*b0*/ 0x90, 0x8f, 0xea, 0xfa, 0xbe, 0xa0, 0xb6, 0xb3, - 0x9d, 0xda, 0x9b, 0x8b, 0xb7, 0xb8, 0xb9, 0xab, /*................*/ -/*c0*/ 0x64, 0x65, 0x62, 0x66, 0x63, 0x67, 0x9e, 0x68, - 0x74, 0x71, 0x72, 0x73, 0x78, 0x75, 0x76, 0x77, /*................*/ -/*d0*/ 0xac, 0x69, 0xed, 0xee, 0xeb, 0xef, 0xec, 0xbf, - 0x80, 0xe0, 0xfe, 0xdd, 0xfc, 0xad, 0xae, 0x59, /*................*/ -/*e0*/ 0x44, 0x45, 0x42, 0x46, 0x43, 0x47, 0x9c, 0x48, - 0x54, 0x51, 0x52, 0x53, 0x58, 0x55, 0x56, 0x57, /*................*/ -/*f0*/ 0x8c, 0x49, 0xcd, 0xce, 0xcb, 0xcf, 0xcc, 0xe1, - 0x70, 0xc0, 0xde, 0xdb, 0xdc, 0x8d, 0x8e, 0xdf /*................*/ -#elif defined(OS390) || defined(TPF) /* IBM's OS/390 and TPF systems: */ -/* -The US-ASCII to EBCDIC (character set IBM-1047) table: -This table is bijective (no ambiguous or duplicate characters) -*/ - 0x00, 0x01, 0x02, 0x03, 0x37, 0x2d, 0x2e, 0x2f, /* 00-0f: */ - 0x16, 0x05, 0x15, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* ................ */ - 0x10, 0x11, 0x12, 0x13, 0x3c, 0x3d, 0x32, 0x26, /* 10-1f: */ - 0x18, 0x19, 0x3f, 0x27, 0x1c, 0x1d, 0x1e, 0x1f, /* ................ */ - 0x40, 0x5a, 0x7f, 0x7b, 0x5b, 0x6c, 0x50, 0x7d, /* 20-2f: */ - 0x4d, 0x5d, 0x5c, 0x4e, 0x6b, 0x60, 0x4b, 0x61, /* !"#$%&'()*+,-./ */ - 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, /* 30-3f: */ - 0xf8, 0xf9, 0x7a, 0x5e, 0x4c, 0x7e, 0x6e, 0x6f, /* 0123456789:;<=>? */ - 0x7c, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, /* 40-4f: */ - 0xc8, 0xc9, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, /* @ABCDEFGHIJKLMNO */ - 0xd7, 0xd8, 0xd9, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, /* 50-5f: */ - 0xe7, 0xe8, 0xe9, 0xad, 0xe0, 0xbd, 0x5f, 0x6d, /* PQRSTUVWXYZ[\]^_ */ - 0x79, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, /* 60-6f: */ - 0x88, 0x89, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, /* `abcdefghijklmno */ - 0x97, 0x98, 0x99, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, /* 70-7f: */ - 0xa7, 0xa8, 0xa9, 0xc0, 0x4f, 0xd0, 0xa1, 0x07, /* pqrstuvwxyz{|}~. */ - 0x20, 0x21, 0x22, 0x23, 0x24, 0x04, 0x06, 0x08, /* 80-8f: */ - 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x09, 0x0a, 0x14, /* ................ */ - 0x30, 0x31, 0x25, 0x33, 0x34, 0x35, 0x36, 0x17, /* 90-9f: */ - 0x38, 0x39, 0x3a, 0x3b, 0x1a, 0x1b, 0x3e, 0xff, /* ................ */ - 0x41, 0xaa, 0x4a, 0xb1, 0x9f, 0xb2, 0x6a, 0xb5, /* a0-af: */ - 0xbb, 0xb4, 0x9a, 0x8a, 0xb0, 0xca, 0xaf, 0xbc, /* ................ */ - 0x90, 0x8f, 0xea, 0xfa, 0xbe, 0xa0, 0xb6, 0xb3, /* b0-bf: */ - 0x9d, 0xda, 0x9b, 0x8b, 0xb7, 0xb8, 0xb9, 0xab, /* ................ */ - 0x64, 0x65, 0x62, 0x66, 0x63, 0x67, 0x9e, 0x68, /* c0-cf: */ - 0x74, 0x71, 0x72, 0x73, 0x78, 0x75, 0x76, 0x77, /* ................ */ - 0xac, 0x69, 0xed, 0xee, 0xeb, 0xef, 0xec, 0xbf, /* d0-df: */ - 0x80, 0xfd, 0xfe, 0xfb, 0xfc, 0xba, 0xae, 0x59, /* ................ */ - 0x44, 0x45, 0x42, 0x46, 0x43, 0x47, 0x9c, 0x48, /* e0-ef: */ - 0x54, 0x51, 0x52, 0x53, 0x58, 0x55, 0x56, 0x57, /* ................ */ - 0x8c, 0x49, 0xcd, 0xce, 0xcb, 0xcf, 0xcc, 0xe1, /* f0-ff: */ - 0x70, 0xdd, 0xde, 0xdb, 0xdc, 0x8d, 0x8e, 0xdf /* ................ */ -#else -#error Unimplemented EBCDIC platform. Please send information about your system to <martin@apache.org>! -#endif -}; - - -/* Translate a memory block from EBCDIC (host charset) to ASCII (net charset) - * dest and srce may be identical, or separate memory blocks, but - * should not overlap. These functions intentionally have an interface - * compatible to memcpy(3). - */ - - -API_EXPORT(void *) -ebcdic2ascii(void *dest, const void *srce, size_t count) -{ - unsigned char *udest = dest; - const unsigned char *usrce = srce; - - while (count-- != 0) { - *udest++ = os_toascii[*usrce++]; - } - - return dest; -} - -API_EXPORT(void *) -ascii2ebcdic(void *dest, const void *srce, size_t count) -{ - unsigned char *udest = dest; - const unsigned char *usrce = srce; - - while (count-- != 0) { - *udest++ = os_toebcdic[*usrce++]; - } - - return dest; -} -#endif /*CHARSET_EBCDIC*/ diff --git a/usr.sbin/httpd/src/ap/ap_execve.c b/usr.sbin/httpd/src/ap/ap_execve.c index 74e8e142638..8cda15c21dc 100644 --- a/usr.sbin/httpd/src/ap/ap_execve.c +++ b/usr.sbin/httpd/src/ap/ap_execve.c @@ -263,10 +263,6 @@ static const char **hashbang(const char *filename, char * const *argv) int fd; int sargc = 0; int i, j; -#ifdef WIN32 - int fw = 0; /* found at least one word */ - int first_word = 0; -#endif /* WIN32 */ if ((fd = open(filename, O_RDONLY)) == -1) { return NULL; @@ -292,23 +288,10 @@ static const char **hashbang(const char *filename, char * const *argv) #endif /*NEW_CRLF */ if (ws) { /* a blank after a word.. save it */ *p = '\0'; -#ifndef WIN32 if (sargc < HACKVECSZ - 1) { sargv[sargc++] = ws; } ws = NULL; -#else /* WIN32 */ - if (sargc < HACKVECSZ - 1) { - sargv[sargc] = first_word ? NULL : hb_subst(ws); - if (sargv[sargc] == NULL) { - sargv[sargc] = ws; - } - sargc++; - } - ws = NULL; - fw = 1; - first_word = 1; -#endif /* WIN32 */ } p++; continue; @@ -318,24 +301,11 @@ static const char **hashbang(const char *filename, char * const *argv) case '\n': /* The end of the line. */ if ( -#ifdef WIN32 - fw || -#endif /* WIN32 */ ws) { /* terminate the last word */ *p = '\0'; -#ifndef WIN32 if (sargc < HACKVECSZ - 1) { sargv[sargc++] = ws; } -#else /* WIN32 */ - if (sargc < HACKVECSZ - 1) { /* deal with the 1-word case */ - sargv[sargc] = first_word ? NULL : hb_subst(ws); - if (sargv[sargc] == NULL) { - sargv[sargc] = ws; - } - sargc++; - } -#endif /* !WIN32 */ sargv[sargc] = NULL; } /* Count number of entries in the old argv vector */ diff --git a/usr.sbin/httpd/src/ap/ap_getpass.c b/usr.sbin/httpd/src/ap/ap_getpass.c index e98dfc2ae94..ee2c2645145 100644 --- a/usr.sbin/httpd/src/ap/ap_getpass.c +++ b/usr.sbin/httpd/src/ap/ap_getpass.c @@ -63,112 +63,17 @@ */ #include "ap_config.h" -#ifndef NETWARE #include <sys/types.h> -#endif #include <errno.h> #include "ap.h" -#ifdef WIN32 -#include <conio.h> -#endif - -#ifndef CHARSET_EBCDIC #define LF 10 #define CR 13 -#else /* CHARSET_EBCDIC */ -#define LF '\n' -#define CR '\r' -#endif /* CHARSET_EBCDIC */ #define MAX_STRING_LEN 256 #define ERR_OVERFLOW 5 -#if defined(MPE) || defined(BEOS) || defined(BONE) -#include <termios.h> - -char * -getpass(const char *prompt) -{ - static char buf[MAX_STRING_LEN+1]; /* null byte at end */ - char *ptr; - sigset_t sig, sigsave; - struct termios term, termsave; - FILE *fp,*outfp; - int c; - - if ((outfp = fp = fopen("/dev/tty", "w+")) == NULL) { - outfp = stderr; - fp = stdin; - } - - sigemptyset(&sig); /* block SIGINT & SIGTSTP, save signal mask */ - sigaddset(&sig, SIGINT); - sigaddset(&sig, SIGTSTP); - sigprocmask(SIG_BLOCK, &sig, &sigsave); - - tcgetattr(fileno(fp), &termsave); /* save tty state */ - term = termsave; /* structure copy */ - term.c_lflag &= ~(ECHO | ECHOE | ECHOK | ECHONL); - tcsetattr(fileno(fp), TCSAFLUSH, &term); - - fputs(prompt, outfp); - - ptr = buf; - while ( (c = getc(fp)) != EOF && c != '\n') { - if (ptr < &buf[MAX_STRING_LEN]) - *ptr++ = c; - } - *ptr = 0; /* null terminate */ - putc('\n', outfp); /* we echo a newline */ - - /* restore tty state */ - tcsetattr(fileno(fp), TCSAFLUSH, &termsave); - - /* restore signal mask */ - sigprocmask(SIG_SETMASK, &sigsave, NULL); - if (fp != stdin) fclose(fp); - - return(buf); -} -#endif /* MPE */ - -#if defined(WIN32) || defined(NETWARE) -/* - * Windows lacks getpass(). So we'll re-implement it here. - */ - -static char *getpass(const char *prompt) -{ - static char password[MAX_STRING_LEN]; - int n = 0; - - fputs(prompt, stderr); - - while ((password[n] = _getch()) != '\r') { - if (password[n] >= ' ' && password[n] <= '~') { - n++; - printf("*"); - } - else { - printf("\n"); - fputs(prompt, stderr); - n = 0; - } - } - - password[n] = '\0'; - printf("\n"); - - if (n > (MAX_STRING_LEN - 1)) { - password[MAX_STRING_LEN - 1] = '\0'; - } - - return (char *) &password; -} -#endif - /* * Use the OS getpass() routine (or our own) to obtain a password from * the input stream. diff --git a/usr.sbin/httpd/src/ap/ap_md5c.c b/usr.sbin/httpd/src/ap/ap_md5c.c index ed5c03f89a5..2a5f4228eeb 100644 --- a/usr.sbin/httpd/src/ap/ap_md5c.c +++ b/usr.sbin/httpd/src/ap/ap_md5c.c @@ -105,9 +105,6 @@ #include "ap_config.h" #include "ap_md5.h" #include "ap.h" -#ifdef CHARSET_EBCDIC -#include "ap_ebcdic.h" -#endif /*CHARSET_EBCDIC*/ #if HAVE_CRYPT_H #include <crypt.h> #endif @@ -214,7 +211,6 @@ API_EXPORT(void) ap_MD5Update(AP_MD5_CTX *context, const unsigned char *input, partLen = 64 - idx; /* Transform as many times as possible. */ -#ifndef CHARSET_EBCDIC if (inputLen >= partLen) { memcpy(&context->buffer[idx], input, partLen); MD5Transform(context->state, context->buffer); @@ -231,26 +227,6 @@ API_EXPORT(void) ap_MD5Update(AP_MD5_CTX *context, const unsigned char *input, /* Buffer remaining input */ memcpy(&context->buffer[idx], &input[i], inputLen - i); -#else /*CHARSET_EBCDIC*/ - if (inputLen >= partLen) { - ebcdic2ascii(&context->buffer[idx], input, partLen); - MD5Transform(context->state, context->buffer); - - for (i = partLen; i + 63 < inputLen; i += 64) { - unsigned char inp_tmp[64]; - ebcdic2ascii(inp_tmp, &input[i], 64); - MD5Transform(context->state, inp_tmp); - } - - idx = 0; - } - else { - i = 0; - } - - /* Buffer remaining input */ - ebcdic2ascii(&context->buffer[idx], &input[i], inputLen - i); -#endif /*CHARSET_EBCDIC*/ } /* MD5 finalization. Ends an MD5 message-digest operation, writing the @@ -265,21 +241,6 @@ API_EXPORT(void) ap_MD5Final(unsigned char digest[16], AP_MD5_CTX *context) /* Save number of bits */ Encode(bits, context->count, 8); -#ifdef CHARSET_EBCDIC - /* XXX: @@@: In order to make this no more complex than necessary, - * this kludge converts the bits[] array using the ascii-to-ebcdic - * table, because the following ap_MD5Update() re-translates - * its input (ebcdic-to-ascii). - * Otherwise, we would have to pass a "conversion" flag to ap_MD5Update() - */ - ascii2ebcdic(bits,bits,8); - - /* Since everything is converted to ascii within ap_MD5Update(), - * the initial 0x80 (PADDING[0]) must be stored as 0x20 - */ - PADDING[0] = os_toebcdic[0x80]; -#endif /*CHARSET_EBCDIC*/ - /* Pad out to 56 mod 64. */ idx = (unsigned int) ((context->count[0] >> 3) & 0x3f); padLen = (idx < 56) ? (56 - idx) : (120 - idx); diff --git a/usr.sbin/httpd/src/ap/ap_sha1.c b/usr.sbin/httpd/src/ap/ap_sha1.c index 2d41801e05f..6e9124a7b5d 100644 --- a/usr.sbin/httpd/src/ap/ap_sha1.c +++ b/usr.sbin/httpd/src/ap/ap_sha1.c @@ -92,9 +92,6 @@ #include "ap_config.h" #include "ap_sha1.h" #include "ap.h" -#ifdef CHARSET_EBCDIC -#include "ap_ebcdic.h" -#endif /*CHARSET_EBCDIC*/ /* a bit faster & bigger, if defined */ #define UNROLL_LOOPS @@ -282,46 +279,7 @@ API_EXPORT(void) ap_SHA1Update_binary(AP_SHA1_CTX *sha_info, API_EXPORT(void) ap_SHA1Update(AP_SHA1_CTX *sha_info, const char *buf, unsigned int count) { -#ifdef CHARSET_EBCDIC - int i; - const AP_BYTE *buffer = (const AP_BYTE *) buf; - - if ((sha_info->count_lo + ((AP_LONG) count << 3)) < sha_info->count_lo) { - ++sha_info->count_hi; - } - sha_info->count_lo += (AP_LONG) count << 3; - sha_info->count_hi += (AP_LONG) count >> 29; - /* Is there a remainder of the previous Update operation? */ - if (sha_info->local) { - i = SHA_BLOCKSIZE - sha_info->local; - if (i > count) { - i = count; - } - ebcdic2ascii(((AP_BYTE *) sha_info->data) + sha_info->local, - buffer, i); - count -= i; - buffer += i; - sha_info->local += i; - if (sha_info->local == SHA_BLOCKSIZE) { - maybe_byte_reverse(sha_info->data, SHA_BLOCKSIZE); - sha_transform(sha_info); - } - else { - return; - } - } - while (count >= SHA_BLOCKSIZE) { - ebcdic2ascii((AP_BYTE *)sha_info->data, buffer, SHA_BLOCKSIZE); - buffer += SHA_BLOCKSIZE; - count -= SHA_BLOCKSIZE; - maybe_byte_reverse(sha_info->data, SHA_BLOCKSIZE); - sha_transform(sha_info); - } - ebcdic2ascii((AP_BYTE *)sha_info->data, buffer, count); - sha_info->local = count; -#else ap_SHA1Update_binary(sha_info, (const unsigned char *) buf, count); -#endif } /* finish computing the SHA digest */ diff --git a/usr.sbin/httpd/src/ap/ap_snprintf.c b/usr.sbin/httpd/src/ap/ap_snprintf.c index 45358a6bb0c..c6443a7c23d 100644 --- a/usr.sbin/httpd/src/ap/ap_snprintf.c +++ b/usr.sbin/httpd/src/ap/ap_snprintf.c @@ -66,16 +66,11 @@ #include <stdio.h> #include <ctype.h> -#ifndef NETWARE #include <sys/types.h> -#endif #include <stdarg.h> #include <string.h> #include <stdlib.h> #include <math.h> -#ifdef WIN32 -#include <float.h> -#endif typedef enum { NO = 0, YES = 1 @@ -97,12 +92,7 @@ typedef enum { typedef WIDE_INT wide_int; typedef unsigned WIDE_INT u_wide_int; typedef WIDEST_INT widest_int; -#ifdef __TANDEM -/* Although Tandem supports "long long" there is no unsigned variant. */ -typedef unsigned long u_widest_int; -#else typedef unsigned WIDEST_INT u_widest_int; -#endif typedef int bool_int; #define S_NULL "(null)" diff --git a/usr.sbin/httpd/src/ap/ap_strtol.c b/usr.sbin/httpd/src/ap/ap_strtol.c index 2419bbc2b9a..26702446302 100644 --- a/usr.sbin/httpd/src/ap/ap_strtol.c +++ b/usr.sbin/httpd/src/ap/ap_strtol.c @@ -168,25 +168,10 @@ API_EXPORT(long) ap_strtol(const char *nptr, char **endptr, int base) for ( ; ; c = *s++) { if (c >= '0' && c <= '9') c -= '0'; -#ifdef CHARSET_EBCDIC - else if (c >= 'A' && c <= 'I') - c -= 'A' - 10; - else if (c >= 'a' && c <= 'i') - c -= 'a' - 10; - else if (c >= 'J' && c <= 'R') - c -= 'J' - 19; - else if (c >= 'j' && c <= 'r') - c -= 'j' - 19; - else if (c >= 'S' && c <= 'Z') - c -= 'S' - 28; - else if (c >= 's' && c <= 'z') - c -= 's' - 28; -#else else if (c >= 'A' && c <= 'Z') c -= 'A' - 10; else if (c >= 'a' && c <= 'z') c -= 'a' - 10; -#endif /* CHARSET_EBCDIC */ else break; if (c >= base) diff --git a/usr.sbin/httpd/src/include/ap.h b/usr.sbin/httpd/src/include/ap.h index 465d975e658..b9d5b4b90dd 100644 --- a/usr.sbin/httpd/src/include/ap.h +++ b/usr.sbin/httpd/src/include/ap.h @@ -81,15 +81,11 @@ API_EXPORT(long) ap_strtol(const char *nptr, char **endptr, int base); /* small utility macros to make things easier to read */ -#ifdef WIN32 -#define ap_killpg(x, y) -#else #ifdef NO_KILLPG #define ap_killpg(x, y) (kill (-(x), (y))) #else #define ap_killpg(x, y) (killpg ((x), (y))) #endif -#endif /* WIN32 */ /* ap_vformatter() is a generic printf-style formatting routine * with some extensions. The extensions are: diff --git a/usr.sbin/httpd/src/include/ap_alloc.h b/usr.sbin/httpd/src/include/ap_alloc.h index 8d427ef339a..994c51e0d36 100644 --- a/usr.sbin/httpd/src/include/ap_alloc.h +++ b/usr.sbin/httpd/src/include/ap_alloc.h @@ -84,11 +84,6 @@ extern "C" { * alloc.c. */ - /* Need declaration of DIR on Win32 */ -#ifdef WIN32 -#include "readdir.h" -#endif - typedef struct pool pool; typedef struct pool ap_pool; @@ -331,13 +326,8 @@ API_EXPORT_NONSTD(void) ap_null_cleanup(void *data); * up with timeout handling in general... */ -#ifdef TPF -#define ap_block_alarms() (0) -#define ap_unblock_alarms() (0) -#else API_EXPORT(void) ap_block_alarms(void); API_EXPORT(void) ap_unblock_alarms(void); -#endif /* TPF */ /* Common cases which want utility support.. * the note_cleanups_for_foo routines are for @@ -353,9 +343,6 @@ API_EXPORT(void) ap_note_cleanups_for_file(pool *, FILE *); API_EXPORT(void) ap_note_cleanups_for_file_ex(pool *, FILE *, int); API_EXPORT(void) ap_note_cleanups_for_fd(pool *, int); API_EXPORT(void) ap_note_cleanups_for_fd_ex(pool *, int, int); -#ifdef WIN32 -API_EXPORT(void) ap_note_cleanups_for_h(pool *, HANDLE); -#endif API_EXPORT(void) ap_kill_cleanups_for_fd(pool *p, int fd); API_EXPORT(void) ap_note_cleanups_for_socket(pool *, int); @@ -374,9 +361,6 @@ API_EXPORT(void) ap_pregfree(pool *p, regex_t * reg); API_EXPORT(int) ap_pfclose(struct pool *, FILE *); API_EXPORT(int) ap_pclosef(struct pool *, int fd); -#ifdef WIN32 -API_EXPORT(int) ap_pcloseh(struct pool *, HANDLE hDevice); -#endif /* routines to deal with directories */ API_EXPORT(DIR *) ap_popendir(pool *p, const char *name); diff --git a/usr.sbin/httpd/src/include/ap_config.h b/usr.sbin/httpd/src/include/ap_config.h index 9f1727b0309..adea9350c51 100644 --- a/usr.sbin/httpd/src/include/ap_config.h +++ b/usr.sbin/httpd/src/include/ap_config.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ap_config.h,v 1.17 2003/08/21 13:11:35 henning Exp $ */ +/* $OpenBSD: ap_config.h,v 1.18 2004/12/02 19:42:46 henning Exp $ */ /* ==================================================================== * The Apache Software License, Version 1.1 @@ -75,18 +75,11 @@ extern "C" { /* * Support for platform dependent autogenerated defines */ -#if !defined(WIN32) && !defined(NETWARE) #include "ap_config_auto.h" -#else -/* not available under WIN32, so provide important entries manually */ -#undef HAVE_UNISTD_H -#endif /* Have to include sys/stat.h before ../win32/os.h so we can override stat() properly */ -#ifndef NETWARE #include <sys/types.h> -#endif #include <sys/stat.h> @@ -116,569 +109,7 @@ stat() properly */ #include "os.h" /* Define one of these according to your system. */ -#if defined(MINT) -typedef int rlim_t; -#define JMP_BUF sigjmp_buf -#define NO_LONG_DOUBLE -#define HAVE_FLOCK_SERIALIZED_ACCEPT -#define _BSD_SOURCE -#define EAGAIN EWOULDBLOCK -int initgroups (char *, int); -char *crypt (const char *pw, const char *salt); -int gethostname (char *name, int namelen); - -#elif defined(MPE) -#include <sys/times.h> -#define NO_SETSID -#define NO_KILLPG -#define NO_WRITEV -#define HAVE_SHMGET 1 -#define USE_SHMGET_SCOREBOARD -/* - UID/GID isn't a native concept for MPE, and it's definitely not a 100% - Unix implementation. There isn't a traditional superuser concept either, - so we're forced to liberalize SHM security a bit so the parent & children - can communicate when they're running with different UIDs within the same - GID (the GID will *always* be the same on MPE). Thus the weird SHM_R and - SHM_W below. -*/ -#define SHM_R 0440 /* Read permission */ -#define SHM_W 0220 /* Write permission */ -#define NEED_INITGROUPS -#define NEED_STRCASECMP -#define NEED_STRDUP -#define NEED_STRNCASECMP -extern void GETPRIVMODE(); -extern void GETUSERMODE(); -extern char *inet_ntoa(); -#define NO_SLACK -#define S_IEXEC S_IXUSR -#define S_IREAD S_IRUSR -#define S_IWRITE S_IWUSR -#define PF_INET AF_INET -#define HAVE_FCNTL_SERIALIZED_ACCEPT - -#elif defined(SUNOS4) -#define HAVE_GMTOFF 1 -#undef NO_KILLPG -#undef NO_SETSID -char *crypt(const char *pw, const char *salt); -char *mktemp(char *); -#define HAVE_MMAP 1 -#define USE_MMAP_SCOREBOARD -#define USE_MMAP_FILES -#include <sys/time.h> -#define NEED_STRERROR -typedef int rlim_t; -#define memmove(a,b,c) bcopy(b,a,c) -#define NO_LINGCLOSE -#define HAVE_FLOCK_SERIALIZED_ACCEPT -#define NEED_DIFFTIME -#define HAVE_SYSLOG 1 - -#elif defined(SOLARIS2) -#undef HAVE_GMTOFF -#define NO_KILLPG -#undef NO_SETSID -#define bzero(a,b) memset(a,0,b) -#define HAVE_SYSVSEM_SERIALIZED_ACCEPT -#define HAVE_FCNTL_SERIALIZED_ACCEPT -#define HAVE_PTHREAD_SERIALIZED_ACCEPT -#if !defined(USE_SYSVSEM_SERIALIZED_ACCEPT) && \ - !defined(USE_PTHREAD_SERIALIZED_ACCEPT) -#define USE_FCNTL_SERIALIZED_ACCEPT -#endif -#define NEED_UNION_SEMUN -#define HAVE_MMAP 1 -#define USE_MMAP_SCOREBOARD -#define USE_MMAP_FILES -int gethostname(char *name, int namelen); -#define HAVE_SYSLOG 1 -#define SYS_SIGLIST _sys_siglist - -#elif defined(IRIX) -#undef HAVE_GMTOFF -/* IRIX has killpg, but it's only in _BSD_COMPAT, so don't use it in case - * there's some weird conflict with non-BSD signals */ -#define NO_KILLPG -#undef NO_SETSID -#define HAVE_FLOCK_SERIALIZED_ACCEPT -#define HAVE_FCNTL_SERIALIZED_ACCEPT -#define HAVE_USLOCK_SERIALIZED_ACCEPT -#define HAVE_SYSVSEM_SERIALIZED_ACCEPT -#if !defined(USE_FLOCK_SERIALIZED_ACCEPT) && \ - !defined(USE_USLOCK_SERIALIZED_ACCEPT) && \ - !defined(USE_SYSVSEM_SERIALIZED_ACCEPT) -#define USE_FCNTL_SERIALIZED_ACCEPT -#endif -#define HAVE_SHMGET 1 -#define USE_SHMGET_SCOREBOARD -#define HAVE_MMAP 1 -#define USE_MMAP_FILES -#define NO_LONG_DOUBLE -#define NO_LINGCLOSE -#define HAVE_SYSLOG 1 - -#elif defined(HIUX) -#undef HAVE_GMTOFF -#define NO_KILLPG -#undef NO_SETSID -#ifndef _HIUX_SOURCE -#define _HIUX_SOURCE -#endif -#define HAVE_SHMGET 1 -#define USE_SHMGET_SCOREBOARD -#define SELECT_NEEDS_CAST -#define HAVE_SYSLOG 1 - -#elif defined(HPUX) || defined(HPUX10) -#undef HAVE_GMTOFF -#define NO_KILLPG -#undef NO_SETSID -#define HAVE_FCNTL_SERIALIZED_ACCEPT -#ifndef _HPUX_SOURCE -#define _HPUX_SOURCE -#endif -#define HAVE_SHMGET 1 -#define USE_SHMGET_SCOREBOARD -#define HAVE_SYSLOG 1 -#ifndef HPUX10 -#define SELECT_NEEDS_CAST -typedef int rlim_t; -#endif - -#elif defined(HPUX11) -#ifndef _HPUX_SOURCE -#define _HPUX_SOURCE -#endif -#define HAVE_SHMGET -#define USE_SHMGET_SCOREBOARD -#undef HAVE_GMTOFF -#define HAVE_FCNTL_SERIALIZED_ACCEPT -/* feeling brave? want to try using POSIX mutexes? */ -/* #define HAVE_MMAP */ -/* #define USE_MMAP_SCOREBOARD */ -/* #define USE_MMAP_FILES */ -/* #define HAVE_PTHREAD_SERIALIZED_ACCEPT */ -#define NO_KILLPG -#undef NO_SETSID -#define HAVE_SYSLOG - -#elif defined(AIX) -#undef HAVE_GMTOFF -#undef NO_KILLPG -#undef NO_SETSID -#ifndef __ps2__ -#define HAVE_MMAP 1 -#define USE_MMAP_SCOREBOARD -#define USE_MMAP_FILES -#define HAVE_SYSLOG 1 -#ifndef DEFAULT_GROUP -#define DEFAULT_GROUP "nobody" -#endif -#endif -#ifndef DEFAULT_USER -#define DEFAULT_USER "nobody" -#endif -#ifdef NEED_RLIM_T -typedef int rlim_t; -#endif -#define HAVE_FCNTL_SERIALIZED_ACCEPT -#define HAVE_SYSVSEM_SERIALIZED_ACCEPT -#define NEED_UNION_SEMUN -#if AIX >= 430 -#define HAVE_PTHREAD_SERIALIZED_ACCEPT -#endif -#define USE_FCNTL_SERIALIZED_ACCEPT -#if AIX >= 432 -#define SINGLE_LISTEN_UNSERIALIZED_ACCEPT -#endif -#ifdef USEBCOPY -#define memmove(a,b,c) bcopy(b,a,c) -#endif -#if AIX >= 510 -#define NET_SIZE_T socklen_t -#elif AIX >= 420 -#define NET_SIZE_T size_t -#endif - -#elif defined(ULTRIX) -/* we don't want to use sys/resource.h under - Ultrix although this header exists. */ -#undef HAVE_SYS_RESOURCE_H -#define HAVE_GMTOFF 1 -#undef NO_KILLPG -#undef NO_SETSID -#define ULTRIX_BRAIN_DEATH -#define NEED_STRDUP -/* If you have Ultrix 4.3, and are using cc, const is broken */ -#ifndef __ultrix__ /* Hack to check for pre-Ultrix 4.4 cc */ -#define const /* Not implemented */ -#endif - -#elif defined(OSF1) -#define HAVE_GMTOFF 1 -#undef NO_KILLPG -#undef NO_SETSID -#define HAVE_MMAP 1 -#define USE_MMAP_SCOREBOARD -#define USE_MMAP_FILES -#define NO_LONG_DOUBLE -#define HAVE_SYSLOG 1 -#define HAVE_FLOCK_SERIALIZED_ACCEPT -#define SINGLE_LISTEN_UNSERIALIZED_ACCEPT - -#elif defined(PARAGON) -#define HAVE_GMTOFF 1 -#undef NO_KILLPG -#undef NO_SETSID -#define HAVE_MMAP 1 -#define USE_MMAP_SCOREBOARD -#define USE_MMAP_FILES -#define NO_LONG_DOUBLE -#define HAVE_SYSLOG 1 -typedef int rlim_t; - -#elif defined(SEQUENT) -#define DEFAULT_USER "nobody" -#define DEFAULT_GROUP "nobody" -#define NO_SHMGET 1 -#define HAVE_MMAP 1 -#define HAVE_SYSLOG 1 -#define USE_MMAP_FILES 1 -#define USE_MMAP_SCOREBOARD 1 -#define HAVE_FCNTL_SERIALIZED_ACCEPT 1 -#define JMP_BUF sigjmp_buf -#undef NO_SETSID -#if SEQUENT < 40 -typedef int rlim_t; -#define NO_GETTIMEOFDAY -#undef HAVE_SYS_RESOURCE_H /* exists but does not provide *rlimit funcs */ -#include <sys/times.h> -#endif -#if SEQUENT < 42 -#define NEED_STRCASECMP -#define NEED_STRNCASECMP -#endif -#if SEQUENT < 44 -#define NO_KILLPG 1 -#define NET_SIZE_T int -#endif -#if SEQUENT >= 44 -#undef NO_KILLPG -#define NET_SIZE_T size_t -#endif - -#elif defined(NEXT) -typedef unsigned short mode_t; -typedef int rlim_t; -#define HAVE_GMTOFF 1 -#undef NO_KILLPG -#define NO_SETSID -#define NEED_STRDUP -#define NO_LINGCLOSE -#undef _POSIX_SOURCE -#ifndef FD_CLOEXEC -#define FD_CLOEXEC 1 -#endif -#ifndef S_ISDIR -#define S_ISDIR(m) (((m)&(S_IFMT)) == (S_IFDIR)) -#endif -#ifndef S_ISREG -#define S_ISREG(m) (((m)&(S_IFMT)) == (S_IFREG)) -#endif -#ifndef S_IXUSR -#define S_IXUSR 00100 -#endif -#ifndef S_IRGRP -#define S_IRGRP 00040 -#endif -#ifndef S_IXGRP -#define S_IXGRP 00010 -#endif -#ifndef S_IROTH -#define S_IROTH 00004 -#endif -#ifndef S_IXOTH -#define S_IXOTH 00001 -#endif -#ifndef S_IRUSR -#define S_IRUSR S_IREAD -#endif -#ifndef S_IWUSR -#define S_IWUSR S_IWRITE -#endif -#ifndef S_IWGRP -#define S_IWGRP 000020 -#endif -#ifndef S_IWOTH -#define S_IWOTH 000002 -#endif - -#define STDIN_FILENO 0 -#define STDOUT_FILENO 1 -#define STDERR_FILENO 2 - -/* PR#2293 fix */ -#define ap_wait_t union wait -#define waitpid(a,b,c) wait4((a) == -1 ? 0 : (a),(union wait *)(b),c,NULL) -#define WEXITSTATUS(status) (int)( WIFEXITED(status) ? ( (status).w_retcode ) : -1) -#define WTERMSIG(status) (int)( (status).w_termsig ) - -typedef int pid_t; -#define USE_LONGJMP -#define NO_USE_SIGACTION -#define HAVE_SYSLOG 1 - -#if defined(__DYNAMIC__) -#define HAVE_DYLD -#define DYLD_CANT_UNLOAD -#endif - -#elif defined(DARWIN) /* Darwin (Mac OS) */ -#undef PLATFORM -#define PLATFORM "Darwin" -#define HAVE_DYLD -#define HAVE_GMTOFF -#define HAVE_MMAP -#define USE_MMAP_FILES -#define USE_MMAP_SCOREBOARD -#ifdef MAC_OS_X_SERVER -#define MAP_TMPFILE -#endif /* MAC_OS_X_SERVER */ -#define HAVE_RESOURCE -#define HAVE_SNPRINTF -#define JMP_BUF jmp_buf -#define USE_LONGJMP -#define HAVE_FLOCK_SERIALIZED_ACCEPT -#define HAVE_FCNTL_SERIALIZED_ACCEPT -#define USE_FLOCK_SERIALIZED_ACCEPT -#define SINGLE_LISTEN_UNSERIALIZED_ACCEPT - -#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 -#include <crypt.h> -#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 1 -#define USE_SHMGET_SCOREBOARD -#define HAVE_MMAP 1 -#define USE_MMAP_FILES - -#if LINUX > 20 -/* see Pine.LNX.4.21.0011041233550.1897-100000@twinlark.arctic.org - * in new-httpd archives for performance numbers indicating these - * are the right choices for linux 2.2.x and later - */ -#define HAVE_SYSVSEM_SERIALIZED_ACCEPT -#define HAVE_FCNTL_SERIALIZED_ACCEPT -#define SINGLE_LISTEN_UNSERIALIZED_ACCEPT -#include <sys/sem.h> -#if _SEM_SEMUN_UNDEFINED -#define NEED_UNION_SEMUN -#endif -#else -#define USE_FCNTL_SERIALIZED_ACCEPT -#endif - -#define SYS_SIGLIST _sys_siglist - -#else -#define USE_FCNTL_SERIALIZED_ACCEPT -#endif - -#undef HAVE_GMTOFF -#undef NO_KILLPG -#undef NO_SETSID -#undef NEED_STRDUP -#include <sys/time.h> -#define HAVE_SYSLOG 1 - -/* glibc 2.1 and later finally define rlim_t */ -#if !defined(__GLIBC__) || __GLIBC__ < 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ < 1) -typedef int rlim_t; -#endif - -#elif defined(SCO) -#undef HAVE_GMTOFF -#undef NO_KILLPG -#undef NO_SETSID -#define NEED_INITGROUPS -#define NO_WRITEV -#include <sys/time.h> -#define HAVE_SYSLOG 1 -#undef HAVE_SYS_RESOURCE_H - -#elif defined(ATHEOS) - -#include <features.h> -#include <crypt.h> -#include <sys/time.h> - -#define HAVE_FCNTL_SERIALIZED_ACCEPT -#define USE_FCNTL_SERIALIZED_ACCEPT - -#undef HAVE_GMTOFF -#undef NO_KILLPG -#undef NO_SETSID -#undef NEED_STRDUP -#define HAVE_SYSLOG 1 - -#ifdef PLATFORM -#undef PLATFORM -#endif -#define PLATFORM "AtheOS" - -#elif defined(SCO5) - -#define HAVE_FCNTL_SERIALIZED_ACCEPT -#define HAVE_MMAP 1 -#define USE_MMAP_SCOREBOARD -#define USE_MMAP_FILES -#define SecureWare -#define HAVE_SYSLOG 1 - -/* Although SCO 5 defines these in <strings.h> (note the "s") they don't have - consts. Sigh. */ -extern int strcasecmp(const char *, const char *); -extern int strncasecmp(const char *, const char *, unsigned); - -#elif defined(AUX3) -/* These are to let -Wall compile more cleanly */ -extern int strcasecmp(const char *, const char *); -extern int strncasecmp(const char *, const char *, unsigned); -extern int set42sig(), getopt(), getpeername(), bzero(); -extern int listen(), bind(), socket(), getsockname(); -extern int accept(), gethostname(), connect(), lstat(); -extern int select(), killpg(), shutdown(); -extern int initgroups(), setsockopt(); -extern char *shmat(); -extern int shmctl(); -extern int shmget(); -extern char *sbrk(); -extern char *crypt(); -#include <sys/time.h> -#undef HAVE_GMTOFF -#undef NO_KILLPG -#undef NO_SETSID -#define NEED_STRDUP -/* fcntl() locking is expensive with NFS */ -#define HAVE_FLOCK_SERIALIZED_ACCEPT -#define SINGLE_LISTEN_UNSERIALIZED_ACCEPT -#define HAVE_SHMGET 1 -#define USE_SHMGET_SCOREBOARD -/* - * NOTE: If when you run Apache under A/UX and you get a warning - * that httpd couldn't move break, then the below value for - * MOVEBREAK (64megs) is too large for your setup. Try reducing - * to 0x2000000 which is still PLENTY of space. I doubt if - * even on heavy systems sbrk() would be called at all... - */ -#define MOVEBREAK 0x4000000 -#define NO_LINGCLOSE -#define NO_SLACK -#define HAVE_SYSLOG 1 -#undef HAVE_SYS_RESOURCE_H /* exists but does not provide *rlimit funcs */ - -#elif defined(SVR4) -#define NO_KILLPG -#undef NO_SETSID -#undef NEED_STRDUP -#ifndef MPRAS -#define NEED_STRCASECMP -#ifndef ENCORE -#define NEED_STRNCASECMP -#endif /* ENCORE */ -#endif /* MPRAS */ -#define bzero(a,b) memset(a,0,b) -/* A lot of SVR4 systems need this */ -#define HAVE_FCNTL_SERIALIZED_ACCEPT -#ifdef SNI -#define HAVE_SYSVSEM_SERIALIZED_ACCEPT -#endif -#ifndef USE_SYSVSEM_SERIALIZED_ACCEPT -#define USE_FCNTL_SERIALIZED_ACCEPT -#endif -#define HAVE_SYSLOG 1 -#define NET_SIZE_T size_t -#define HAVE_SHMGET 1 -#define USE_SHMGET_SCOREBOARD -#ifdef _OSD_POSIX /* BS2000-POSIX mainframe needs initgroups */ -#define NEED_HASHBANG_EMUL /* execve() doesn't start shell scripts by default */ -#define _KMEMUSER /* Enable SHM_R/SHM_W defines in <shm.h> */ -#undef NEED_STRCASECMP -#undef NEED_STRNCASECMP -#undef bzero -#endif /*_OSD_POSIX*/ - -#elif defined(UW) -#define HAVE_FCNTL_SERIALIZED_ACCEPT -#if UW < 700 -#define NO_LINGCLOSE -#define NO_KILLPG -#else -#define SINGLE_LISTEN_UNSERIALIZED_ACCEPT -#endif -#undef NO_SETSID -#undef NEED_STRDUP -#define NEED_STRCASECMP -#define NEED_STRNCASECMP -#define bzero(a,b) memset(a,0,b) -#define HAVE_MMAP 1 -#define USE_MMAP_SCOREBOARD -#define USE_MMAP_FILES -#define HAVE_SHMGET 1 -#undef USE_SHMGET_SCOREBOARD /* force use of mmap() scoreboard */ -#include <sys/time.h> -#if UW >= 200 -#define _POSIX_SOURCE -#endif -#define NET_SIZE_T size_t -#define HAVE_SYSLOG 1 - -#elif defined(DGUX) -#define NO_KILLPG -#undef NO_SETSID -#undef NEED_STRDUP -#ifdef _IX86_DG -#undef NEED_STRCASECMP -#undef NEED_STRNCASECMP -#else -#define NEED_STRCASECMP -#define NEED_STRNCASECMP -#endif -#define bzero(a,b) memset(a,0,b) -/* A lot of SVR4 systems need this */ -#define HAVE_FCNTL_SERIALIZED_ACCEPT -#define ap_inet_addr inet_network -#define HAVE_SYSLOG 1 - -#elif defined(__NetBSD__) || defined(__OpenBSD__) || defined(NETBSD) +#if defined(__NetBSD__) || defined(__OpenBSD__) || defined(NETBSD) #define HAVE_GMTOFF 1 #undef NO_KILLPG #undef NO_SETSID @@ -704,37 +135,6 @@ extern char *crypt(); #endif #define SINGLE_LISTEN_UNSERIALIZED_ACCEPT -#elif defined(UTS21) -#undef HAVE_GMTOFF -#undef NO_KILLPG -#define NO_SETSID -#define NEED_WAITPID -#define STDIN_FILENO 0 -#define STDOUT_FILENO 1 -#define STDERR_FILENO 2 -#define HAVE_SYSLOG 1 -#define USE_LONGJMP -#define JMP_BUF jmp_buf -#define NO_USE_SIGACTION -#define NEED_STRERROR -#define NEED_STRSTR -#define NEED_HASHBANG_EMUL -#define NDELAY_PIPE_RETURNS_ZERO -#define NO_DATA NO_ADDRESS -#define ap_wait_t union wait -#define WEXITSTATUS(status) (int)((status).w_retcode) -#define WTERMSIG(status) (int)((status).w_termsig) -#define strftime(buf,bufsize,fmt,tm) ascftime(buf,fmt,tm) -#undef HAVE_SYS_RESOURCE_H /* exists but does not provide *rlimit funcs */ -#include <sys/types.h> -#include <sys/time.h> - -#elif defined(APOLLO) -#undef HAVE_GMTOFF -#undef NO_KILLPG -#undef NO_SETSID -#define HAVE_SYSLOG 1 - #elif defined(__FreeBSD__) || defined(__bsdi__) #if defined(__FreeBSD__) #include <osreldate.h> @@ -763,280 +163,6 @@ typedef quad_t rlim_t; #define NET_SIZE_T socklen_t #endif -#elif defined(QNX) -#ifndef crypt -char *crypt(const char *pw, const char *salt); -#endif -#ifndef initgroups -int initgroups(char *, int); -#endif -#ifndef strncasecmp -#define strncasecmp strnicmp -#endif -#undef NO_KILLPG -#undef NO_SETSID -#define NEED_INITGROUPS -#define NEED_SELECT_H -#define NEED_PROCESS_H -#include <unix.h> -#define HAVE_MMAP 1 -#define USE_POSIX_SCOREBOARD -#define HAVE_FLOCK_SERIALIZED_ACCEPT -#define SINGLE_LISTEN_UNSERIALIZED_ACCEPT -#define HAVE_SYSLOG 1 - -#elif defined(LYNXOS) -#undef HAVE_GMTOFF -#undef USE_MMAP_SCOREBOARD -#undef USE_SHMGET_SCOREBOARD -#undef HAVE_FCNTL_SERIALIZED_ACCEPT -#undef HAVE_FLOCK_SERIALIZED_ACCEPT -#define HAVE_NONE_SERIALIZED_ACCEPT -#define USE_LONGJMP -#undef NO_KILLPG -#undef NO_SETSID -#undef NO_USE_SIGACTION -#undef NO_LINGCLOSE -extern char *crypt(char *pw, char *salt); -typedef int rlim_t; -#define HAVE_SYSLOG 1 - -#elif defined(UXPDS) -#undef NEED_STRCASECMP -#undef NEED_STRNCASECMP -#undef NEED_STRDUP -#undef HAVE_GMTOFF -#define NO_KILLPG -#undef NO_SETSID -#define bzero(a,b) memset(a,0,b) -#define HAVE_FCNTL_SERIALIZED_ACCEPT -#define HAVE_MMAP 1 -#define USE_MMAP_SCOREBOARD -#define USE_MMAP_FILES -#define HAVE_SYSLOG 1 - -#elif defined(OS2) -/* Defines required for EMX OS/2 port. */ -#define NO_KILLPG -#define NEED_STRCASECMP -#define NEED_STRNCASECMP -#define NEED_PROCESS_H -#define NO_SETSID -#define NO_TIMES -#define CASE_BLIND_FILESYSTEM -/* Add some drive name support */ -#define chdir _chdir2 -#include <sys/time.h> -#define MAXSOCKETS 2048 -#define USE_OS2_SCOREBOARD -#define NO_RELIABLE_PIPED_LOGS -#define HAVE_OS2SEM_SERIALIZED_ACCEPT -#define SINGLE_LISTEN_UNSERIALIZED_ACCEPT -#define NO_SLACK -#define FOPEN_REQUIRES_T - -#elif defined(__MACHTEN__) -typedef int rlim_t; -#undef NO_KILLPG -#define NO_SETSID -#define HAVE_GMTOFF 1 -#ifndef __MACHTEN_PPC__ -#ifndef __MACHTEN_68K__ -#define __MACHTEN_68K__ -#endif -#define HAVE_FLOCK_SERIALIZED_ACCEPT -#define NO_USE_SIGACTION -#define JMP_BUF sigjmp_buf -#define USE_LONGJMP -#undef NEED_STRDUP -#else -#define HAVE_SHMGET 1 -#define USE_SHMGET_SCOREBOARD -#define HAVE_FCNTL_SERIALIZED_ACCEPT -#endif - -/* Convex OS v11 */ -#elif defined(CONVEXOS11) -#undef HAVE_GMTOFF -#undef NO_KILLPG -#undef NO_SETSID -#undef NEED_STRDUP -#define HAVE_MMAP 1 -#define USE_MMAP_SCOREBOARD -#define USE_MMAP_FILES -#define HAVE_SYSLOG 1 - -#define NO_TIMEZONE -#include <stdio.h> -#include <sys/types.h> -typedef int rlim_t; - -#elif defined(ISC) -#include <net/errno.h> -#define NO_KILLPG -#undef NO_SETSID -#define HAVE_SHMGET 1 -#define USE_SHMGET_SCOREBOARD -#define HAVE_FCNTL_SERIALIZED_ACCEPT -#define HAVE_SYSLOG 1 - -#elif defined(NEWSOS) -#define HAVE_SHMGET 1 -#define USE_SHMGET_SCOREBOARD -#define USE_LONGJMP -#define NO_SETSID -#define NO_USE_SIGACTION -#define NEED_WAITPID -#define NO_OTHER_CHILD -#define HAVE_SYSLOG 1 -#include <sys/time.h> -#include <stdlib.h> -#include <sys/types.h> -typedef int pid_t; -typedef int rlim_t; -typedef int mode_t; - -#elif defined(RISCIX) -#include <sys/time.h> -typedef int rlim_t; -#define NO_USE_SIGACTION -#define USE_LONGJMP -#define NEED_STRCASECMP -#define NEED_STRNCASECMP -#define NEED_STRDUP - -#elif defined(BEOS) -#undef PLATFORM -#define PLATFORM "BeOS" -#include <stddef.h> -#include <kernel/OS.h> - -#define HAVE_BEOS_SERIALIZED_ACCEPT -#define SINGLE_LISTEN_UNSERIALIZED_ACCEPT - -#define NO_WRITEV -#define NO_KILLPG -#define NEED_INITGROUPS -#define PF_INET AF_INET -#define S_IEXEC S_IXUSR - -#elif defined(BONE) -#undef PLATFORM -#define PLATFORM "BeOS BONE" -#include <kernel/OS.h> - -#define NO_KILLPG -#define NEED_INITGROUPS -#define S_IEXEC S_IXUSR -#define HAVE_BEOS_SERIALIZED_ACCEPT -#define SINGLE_LISTEN_UNSERIALIZED_ACCEPT - -#elif defined(_CX_SX) -#define JMP_BUF sigjmp_buf -#include <sys/types.h> -#include <sys/time.h> - -#elif defined(WIN32) - -/* All windows stuff is now in os/win32/os.h */ - -#elif defined(TPF) /* IBM Transaction Processing Facility operating system */ - -#include <tpfeq.h> -#include <tpfio.h> -#include <sysapi.h> -#include <sysgtime.h> -#define PRIMECRAS 0x010000 -#define JMP_BUF jmp_buf -#define HAVE_SHMGET -#undef HAVE_SYS_RESOURCE_H -#define NEED_INITGROUPS -#define NEED_SIGNAL_INTERRUPT -#include <strings.h> -#ifndef __strings_h -#define NEED_STRCASECMP -#define NEED_STRNCASECMP -#endif -#define NEED_STRDUP -#define NO_DBM_REWRITEMAP -#define NO_GETTIMEOFDAY -#define NO_LINGCLOSE -#define NO_MMAP -#define NO_OTHER_CHILD -#define NO_PIPED_LOGS -#define NO_RELIABLE_PIPED_LOGS -#define NO_SETSID -#define NO_SLACK -#define NO_TIMES -#ifndef TPF_HAVE_SIGACTION -#define NO_USE_SIGACTION -#endif -#define USE_LONGJMP -#define USE_SHMGET_SCOREBOARD -#define USE_TPF_ACCEPT -#define HAVE_TPF_CORE_SERIALIZED_ACCEPT -#define USE_TPF_SELECT -#define S_IREAD S_IRUSR -#define S_IWRITE S_IWUSR -#define S_IEXEC S_IXUSR -#include <unistd.h> -#define crypt(buf,salt) ((char *)buf) -#undef offsetof -#define offsetof(s_type,field) ((size_t)&(((s_type*)0)->field)) - -#elif defined(__TANDEM) -#define NO_WRITEV -#define NO_KILLPG -#define NEED_INITGROUPS -#define NO_SLACK - -#elif defined(OS390) /* IBM OS/390 Operating System */ -#define HAVE_MMAP -#define HAVE_SHMGET -#define USE_SHMGET_SCOREBOARD -#define USE_MMAP_FILES -#define NEED_UNION_SEMUN -#define HAVE_SYSVSEM_SERIALIZED_ACCEPT -#define HAVE_FCNTL_SERIALIZED_ACCEPT -#define _POSIX_SOURCE -#include <signal.h> -#ifdef SIGDUMP /* SIGDUMP is not defined by OS/390 v1r2 */ -#define NSIG SIGDUMP+1 -#else -#define NSIG 40 -#endif -#define JMP_BUF sigjmp_buf -#define _XOPEN_SOURCE_EXTENDED 1 -#define _OPEN_MSGQ_EXT -#define _XOPEN_SOURCE -#define SHM_R S_IRUSR -#define SHM_W S_IWUSR -#include <sys/time.h> -#include <sys/types.h> -#include <sys/msg.h> -#include <sys/socket.h> -#define NET_SIZE_T size_t -#define NEED_HASHBANG_EMUL - -#elif defined(CYGWIN) /* Cygwin 1.x POSIX layer for Win32 */ -#define SYSTEM_UID 18 -#define JMP_BUF jmp_buf -#define NO_KILLPG -#define NO_SETSID -#define USE_LONGJMP -#define GDBM_STATIC -#define HAVE_MMAP 1 -#define USE_MMAP_SCOREBOARD -#define USE_MMAP_FILES -#define HAVE_SYSLOG 1 -#define HAVE_FCNTL_SERIALIZED_ACCEPT -#define HAVE_PTHREAD_SERIALIZED_ACCEPT -#define SINGLE_LISTEN_UNSERIALIZED_ACCEPT -#if !defined(USE_FCNTL_SERIALIZED_ACCEPT) -#define USE_PTHREAD_SERIALIZED_ACCEPT -#endif - - #else /* Unknown system - Edit these to match */ #ifdef BSD @@ -1108,91 +234,39 @@ typedef int rlim_t; * file. If you have neither, I'm confused. */ -#ifndef NETWARE #include <sys/types.h> -#endif #include <stdarg.h> -#if !defined(NEXT) && !defined(WIN32) #include <dirent.h> #define DIR_TYPE dirent -#elif !defined(WIN32) -#include <sys/dir.h> -#define DIR_TYPE direct -#else -#define DIR_TYPE dirent -#endif #include <stdio.h> #include <stdlib.h> #include <string.h> -#ifdef __TANDEM -#include <strings.h> -#endif #include "ap_ctype.h" -#if !defined(MPE) && !defined(WIN32) && !defined(TPF) && !defined(__TANDEM) && !defined(NETWARE) #include <sys/file.h> -#endif -#if !defined(WIN32) && !defined(NETWARE) #include <sys/socket.h> #ifdef HAVE_SYS_SELECT_H #include <sys/select.h> #endif /* HAVE_SYS_SELECT_H */ -#ifndef TPF #include <netinet/in.h> -#endif /* TPF */ -#if defined(OS390) && !defined(NO_ADDRESS) -#define NO_ADDRESS NO_DATA /* Not defined properly by OS/390 v1r2 */ -#endif #include <netdb.h> #include <sys/ioctl.h> -#if !defined(MPE) && !defined(BEOS) && !defined(TPF) #include <arpa/inet.h> /* for inet_ntoa */ -#endif #include <sys/wait.h> #include <pwd.h> #include <grp.h> #include <fcntl.h> -#ifndef BEOS #define closesocket(s) close(s) -#endif #ifndef O_BINARY #define O_BINARY (0) #endif -#endif /* ndef WIN32 */ #include <limits.h> #include <time.h> /* for ctime */ -#ifdef WIN32 -#define strftime(s,max,format,tm) os_strftime(s,max,format,tm) -#endif #include <signal.h> -#ifdef NETWARE -#undef SIGKILL -#undef SA_NOCLDSTOP -#undef SIGALRM -#undef SIGCHILD -#undef SIGCONT -#undef SIGHUP -#undef SIGPIPE -#undef SIGQUIT -#undef SIGSTOP -#undef SIGTSTP -#undef SIGTTIN -#undef SIGTTOU -#undef SIGUSR1 -#undef SIGUSR2 -#undef SIG_BLOCK -#undef SIG_SETMASK -#undef SIG_UNBLOCK -#endif -#if defined(TPF) && defined(NSIG) -#undef NSIG -#endif #include <errno.h> -#if !defined(QNX) && !defined(CONVEXOS11) && !defined(NEXT) && !defined(TPF) && !defined(NETWARE) && !defined(MPE) #include <memory.h> -#endif #ifdef NEED_PROCESS_H #include <process.h> @@ -1206,17 +280,10 @@ typedef int rlim_t; #ifdef HAVE_SYS_RESOURCE_H #include <sys/resource.h> -#ifdef SUNOS4 -int getrlimit(int, struct rlimit *); -int setrlimit(int, struct rlimit *); -#endif #endif #ifdef USE_MMAP_SCOREBOARD -#if !defined(OS2) && !defined(WIN32) -/* This file is not needed for OS/2 */ #include <sys/mman.h> #endif -#endif #if !defined(MAP_ANON) && defined(MAP_ANONYMOUS) #define MAP_ANON MAP_ANONYMOUS #endif @@ -1249,15 +316,6 @@ int setrlimit(int, struct rlimit *); #if defined(USE_FLOCK_SERIALIZED_ACCEPT) && !defined(HAVE_FLOCK_SERIALIZED_ACCEPT) #define HAVE_FLOCK_SERIALIZED_ACCEPT #endif -#if defined(USE_OS2SEM_SERIALIZED_ACCEPT) && !defined(HAVE_OS2SEM_SERIALIZED_ACCEPT) -#define HAVE_OS2SEM_SERIALIZED_ACCEPT -#endif -#if defined(USE_TPF_CORE_SERIALIZED_ACCEPT) && !defined(HAVE_TPF_CORE_SERIALIZED_ACCEPT) -#define HAVE_TPF_CORE_SERIALIZED_ACCEPT -#endif -#if defined(USE_BEOS_SERIALIZED_ACCEPT) && !defined(HAVE_BEOS_SERIALIZED_ACCEPT) -#define HAVE_BEOS_SERIALIZED_ACCEPT -#endif #if defined(USE_NONE_SERIALIZED_ACCEPT) && !defined(HAVE_NONE_SERIALIZED_ACCEPT) #define HAVE_NONE_SERIALIZED_ACCEPT #endif @@ -1270,10 +328,6 @@ int setrlimit(int, struct rlimit *); #include <unistd.h> #endif -#ifdef ultrix -#define ULTRIX_BRAIN_DEATH -#endif - #ifndef S_ISLNK #define S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK) #endif @@ -1319,14 +373,9 @@ Sigfunc *signal(int signo, Sigfunc * func); #endif /* Majority of os's want to verify FD_SETSIZE */ -#if !defined(WIN32) && !defined(TPF) && !defined(NETWARE) #define CHECK_FD_SETSIZE -#endif -#ifdef USE_TPF_SELECT -#define ap_select(_a, _b, _c, _d, _e) \ - tpf_select(_a, _b, _c, _d, _e) -#elif defined(SELECT_NEEDS_CAST) +#if defined(SELECT_NEEDS_CAST) #define ap_select(_a, _b, _c, _d, _e) \ select((_a), (int *)(_b), (int *)(_c), (int *)(_d), (_e)) #else @@ -1334,11 +383,7 @@ Sigfunc *signal(int signo, Sigfunc * func); select(_a, _b, _c, _d, _e) #endif -#ifdef USE_TPF_ACCEPT -#define ap_accept(_fd, _sa, _ln) tpf_accept(_fd, _sa, _ln) -#else #define ap_accept(_fd, _sa, _ln) accept(_fd, _sa, _ln) -#endif #ifdef NEED_SIGNAL_INTERRUPT #define ap_check_signals() tpf_process_signals() @@ -1346,11 +391,7 @@ Sigfunc *signal(int signo, Sigfunc * func); #define ap_check_signals() #endif -#ifdef ULTRIX_BRAIN_DEATH -#define ap_fdopen(d,m) fdopen((d), (char *)(m)) -#else #define ap_fdopen(d,m) fdopen((d), (m)) -#endif #ifndef ap_inet_addr #define ap_inet_addr inet_addr diff --git a/usr.sbin/httpd/src/include/buff.h b/usr.sbin/httpd/src/include/buff.h index a252d0898ea..ce138680661 100644 --- a/usr.sbin/httpd/src/include/buff.h +++ b/usr.sbin/httpd/src/include/buff.h @@ -92,10 +92,6 @@ extern "C" { #define B_SAFEREAD (128) /* buffer is a socket */ #define B_SOCKET (256) -#ifdef CHARSET_EBCDIC -#define B_ASCII2EBCDIC 0x40000000 /* Enable conversion for this buffer */ -#define B_EBCDIC2ASCII 0x80000000 /* Enable conversion for this buffer */ -#endif /*CHARSET_EBCDIC*/ typedef struct buff_struct BUFF; @@ -118,9 +114,6 @@ struct buff_struct { /* could also put pointers to the basic I/O routines here */ int fd; /* the file descriptor */ int fd_in; /* input file descriptor, if different */ -#ifdef WIN32 - HANDLE hFH; /* Windows filehandle */ -#endif /* transport handle, for RPC binding handle or some such */ void *t_handle; @@ -154,9 +147,6 @@ extern Sfdisc_t *bsfio_new(pool *p, BUFF *b); /* Stream creation and modification */ API_EXPORT(BUFF *) ap_bcreate(pool *p, int flags); API_EXPORT(void) ap_bpushfd(BUFF *fb, int fd_in, int fd_out); -#ifdef WIN32 -API_EXPORT(void) ap_bpushh(BUFF *fb, HANDLE hFH); -#endif API_EXPORT(int) ap_bsetopt(BUFF *fb, int optname, const void *optval); API_EXPORT(int) ap_bgetopt(BUFF *fb, int optname, void *optval); API_EXPORT(int) ap_bsetflag(BUFF *fb, int flag, int value); @@ -189,8 +179,6 @@ API_EXPORT(int) ap_bfilbuf(BUFF *fb); #define ap_bpeekc(fb) ( ((fb)->incnt == 0) ? EOF : *((fb)->inptr) ) #endif -#ifndef CHARSET_EBCDIC - #define ap_bgetc(fb) ( ((fb)->incnt == 0) ? ap_bfilbuf(fb) : \ ((fb)->incnt--, *((fb)->inptr++)) ) @@ -198,28 +186,7 @@ API_EXPORT(int) ap_bfilbuf(BUFF *fb); (fb)->outcnt == (fb)->bufsiz) ? ap_bflsbuf(c, (fb)) : \ ((fb)->outbase[(fb)->outcnt++] = (c), 0)) -#else /*CHARSET_EBCDIC*/ - -#define ap_bgetc(fb) ( ((fb)->incnt == 0) ? ap_bfilbuf(fb) : \ - ((fb)->incnt--, (fb->flags & B_ASCII2EBCDIC)\ - ?os_toebcdic[(unsigned char)*((fb)->inptr++)]:*((fb)->inptr++)) ) - -#define ap_bputc(c, fb) ((((fb)->flags & (B_EOUT|B_WRERR|B_WR)) != B_WR || \ - (fb)->outcnt == (fb)->bufsiz) ? ap_bflsbuf(c, (fb)) : \ - ((fb)->outbase[(fb)->outcnt++] = (fb->flags & B_EBCDIC2ASCII)\ - ?os_toascii[(unsigned char)c]:(c), 0)) - -#endif /*CHARSET_EBCDIC*/ struct child_info { -#ifdef WIN32 - /* - * These handles are used by ap_call_exec to call - * create process with pipe handles. - */ - HANDLE hPipeInputRead; - HANDLE hPipeOutputWrite; - HANDLE hPipeErrorWrite; -#else /* * We need to put a dummy member in here to avoid compilation * errors under certain Unix compilers, like SGI's and HPUX's, @@ -228,7 +195,6 @@ struct child_info { * structure under Unix. Aah the joys of x-platform code. */ int dummy; -#endif }; API_EXPORT(int) ap_bspawn_child(pool *, int (*)(void *, child_info *), void *, enum kill_conditions, BUFF **pipe_in, BUFF **pipe_out, @@ -242,14 +208,6 @@ API_EXPORT(int) ap_bfileno(BUFF *fb, int direction); /* bflush() if a read now would block, but don't actually read anything */ API_EXPORT(void) ap_bhalfduplex(BUFF *fb); -#if defined(WIN32) || defined(NETWARE) || defined(CYGWIN_WINSOCK) - -/* ap_recvwithtimeout/ap_sendwithtimeout socket primitives for WinSock */ -API_EXPORT(int) ap_sendwithtimeout(int sock, const char *buf, int len, int flags); -API_EXPORT(int) ap_recvwithtimeout(int sock, char *buf, int len, int flags); - -#endif - #ifdef __cplusplus } #endif diff --git a/usr.sbin/httpd/src/include/hsregex.h b/usr.sbin/httpd/src/include/hsregex.h index 673884b6f1e..4918042562c 100644 --- a/usr.sbin/httpd/src/include/hsregex.h +++ b/usr.sbin/httpd/src/include/hsregex.h @@ -9,19 +9,11 @@ extern "C" { /* === regex2.h === */ #ifndef API_EXPORT -#ifdef WIN32 -#define API_EXPORT(type) __declspec(dllexport) type __stdcall -#else #define API_EXPORT(type) type #endif -#endif #undef ap_private_extern -#if defined(MAC_OS) || defined(MAC_OS_X_SERVER) || (defined(DARWIN) && defined(__DYNAMIC__)) -#define ap_private_extern __private_extern__ -#else #define ap_private_extern -#endif typedef off_t regoff_t; typedef struct { diff --git a/usr.sbin/httpd/src/include/http_conf_globals.h b/usr.sbin/httpd/src/include/http_conf_globals.h index d1f0f79b23d..b56364ffc48 100644 --- a/usr.sbin/httpd/src/include/http_conf_globals.h +++ b/usr.sbin/httpd/src/include/http_conf_globals.h @@ -73,9 +73,6 @@ extern int ap_docrootcheck; extern API_VAR_EXPORT uid_t ap_user_id; extern API_VAR_EXPORT char *ap_user_name; extern API_VAR_EXPORT gid_t ap_group_id; -#ifdef NETWARE -extern unsigned int ap_thread_stack_size; -#endif #ifdef MULTIPLE_GROUPS extern gid_t group_id_list[NGROUPS_MAX]; #endif diff --git a/usr.sbin/httpd/src/include/http_config.h b/usr.sbin/httpd/src/include/http_config.h index e6f00fc5f1b..df90de4a1ce 100644 --- a/usr.sbin/httpd/src/include/http_config.h +++ b/usr.sbin/httpd/src/include/http_config.h @@ -215,19 +215,11 @@ typedef struct module_struct { * Modules should not rely on the order in which create_server_config * and create_dir_config are called. */ -#ifdef ULTRIX_BRAIN_DEATH - void (*init) (); - void *(*create_dir_config) (); - void *(*merge_dir_config) (); - void *(*create_server_config) (); - void *(*merge_server_config) (); -#else void (*init) (server_rec *, pool *); void *(*create_dir_config) (pool *p, char *dir); void *(*merge_dir_config) (pool *p, void *base_conf, void *new_conf); void *(*create_server_config) (pool *p, server_rec *s); void *(*merge_server_config) (pool *p, void *base_conf, void *new_conf); -#endif const command_rec *cmds; const handler_rec *handlers; @@ -268,13 +260,8 @@ typedef struct module_struct { * parameters passed here are the same as those passed to the global * init method above. */ -#ifdef ULTRIX_BRAIN_DEATH - void (*child_init) (); - void (*child_exit) (); -#else void (*child_init) (server_rec *, pool *); void (*child_exit) (server_rec *, pool *); -#endif int (*post_read_request) (request_rec *); #ifdef EAPI @@ -321,19 +308,11 @@ typedef struct module_struct { * to close/finalize connection dependent things like sending end * headers for on-the-fly compression, etc. */ -#ifdef ULTRIX_BRAIN_DEATH - void (*add_module) (); - void (*remove_module) (); - char *(*rewrite_command) (); - void (*new_connection) (); - void (*close_connection) (); -#else void (*add_module) (struct module_struct *); void (*remove_module) (struct module_struct *); char *(*rewrite_command) (cmd_parms *, void *config, const char *); void (*new_connection) (conn_rec *); void (*close_connection) (conn_rec *); -#endif #endif /* EAPI */ } module; diff --git a/usr.sbin/httpd/src/include/http_core.h b/usr.sbin/httpd/src/include/http_core.h index ea2033a28ea..29a23f2e62d 100644 --- a/usr.sbin/httpd/src/include/http_core.h +++ b/usr.sbin/httpd/src/include/http_core.h @@ -166,17 +166,6 @@ API_EXPORT(const char *) ap_auth_nonce (request_rec *); API_EXPORT(int) ap_satisfies (request_rec *r); API_EXPORT(const array_header *) ap_requires (request_rec *); -#ifdef WIN32 -/* - * CGI Script stuff for Win32... - */ -typedef enum { eFileTypeUNKNOWN, eFileTypeBIN, eFileTypeEXE16, eFileTypeEXE32, - eFileTypeSCRIPT, eCommandShell16, eCommandShell32 } file_type_e; -typedef enum { INTERPRETER_SOURCE_UNSET, INTERPRETER_SOURCE_REGISTRY, - INTERPRETER_SOURCE_SHEBANG } interpreter_source_e; -API_EXPORT(file_type_e) ap_get_win32_interpreter(const request_rec *, char **); -#endif - #ifdef CORE_PRIVATE /* @@ -308,40 +297,7 @@ typedef struct { array_header *sec; regex_t *r; -#ifdef WIN32 - /* Where to find interpreter to run scripts */ - interpreter_source_e script_interpreter_source; -#endif -#ifdef CHARSET_EBCDIC - /* Configurable EBCDIC Conversion stuff */ - /* Direction specific conversion: */ -#define dir_Out 0 /* 0utput (returned contents in a GET or POST) */ -#define dir_In 1 /* 1nput (uploaded contents in a PUT / POST) */ - - /* Conversion Enabled/Disabled: */ -#define conv_Unset '?' /* Conversion unconfigured */ -#define conv_Off '0' /* BINARY or ASCII file (no conversion) */ -#define conv_On '1' /* TEXT file (EBCDIC->ASCII for dir_Out; ASCII->EBCDIC for dir_In) */ - - /* The configuration args {On|Off}[={In|Out|InOut}] are currently stored - * as character strings ("0" = conv_Off, "1" = conv_On) - */ - table *ebcdicconversion_by_ext_in; - table *ebcdicconversion_by_ext_out; - table *ebcdicconversion_by_type_in; - table *ebcdicconversion_by_type_out; - -#define LEGACY_KLUDGE 1 /* After a couple of versions this legacy kludge should be set to 0 */ -#ifndef ASCIITEXT_MAGIC_TYPE_PREFIX -#define ASCIITEXT_MAGIC_TYPE_PREFIX "text/x-ascii-" /* Text files whose content-type starts with this are passed thru unconverted */ -#endif - int x_ascii_magic_kludge; /* whether to handle the text/x-ascii- kludge */ - -#if ADD_EBCDICCONVERT_DEBUG_HEADER - int ebcdicconversion_debug_header; /* whether to add an X-EBCDIC-Debug-{In,Out} header to the response */ -#endif -#endif /* CHARSET_EBCDIC */ /* * What attributes/data should be included in ETag generation? diff --git a/usr.sbin/httpd/src/include/http_log.h b/usr.sbin/httpd/src/include/http_log.h index 71ea4235f3f..478f348fb31 100644 --- a/usr.sbin/httpd/src/include/http_log.h +++ b/usr.sbin/httpd/src/include/http_log.h @@ -93,11 +93,6 @@ extern "C" { #endif #define APLOG_NOERRNO (APLOG_LEVELMASK + 1) -#ifdef WIN32 -/* Set to indicate that error msg should come from Win32's GetLastError(), - * not errno. */ -#define APLOG_WIN32ERROR ((APLOG_LEVELMASK+1) * 2) -#endif #ifndef DEFAULT_LOGLEVEL #define DEFAULT_LOGLEVEL APLOG_WARNING diff --git a/usr.sbin/httpd/src/include/httpd.h b/usr.sbin/httpd/src/include/httpd.h index 3e2f6ec6bd8..9e9399f5d63 100644 --- a/usr.sbin/httpd/src/include/httpd.h +++ b/usr.sbin/httpd/src/include/httpd.h @@ -92,31 +92,14 @@ extern "C" { * file with a relative pathname will have this added. */ #ifndef HTTPD_ROOT -#ifdef OS2 -/* Set default for OS/2 file system */ -#define HTTPD_ROOT "/os2httpd" -#elif defined(WIN32) -/* Set default for Windows file system */ -#define HTTPD_ROOT "/apache" -#elif defined(BEOS) || defined(BONE) -#define HTTPD_ROOT "/boot/home/apache" -#elif defined(NETWARE) -#define HTTPD_ROOT "sys:/apache" -#else #define HTTPD_ROOT "/usr/local/apache" -#endif #endif /* HTTPD_ROOT */ /* Default location of documents. Can be overridden by the DocumentRoot * directive. */ #ifndef DOCUMENT_LOCATION -#ifdef OS2 -/* Set default for OS/2 file system */ -#define DOCUMENT_LOCATION HTTPD_ROOT "/docs" -#else #define DOCUMENT_LOCATION HTTPD_ROOT "/htdocs" -#endif #endif /* DOCUMENT_LOCATION */ /* Max. number of dynamically loaded modules */ @@ -153,10 +136,6 @@ extern "C" { #define DEFAULT_HTTP_PORT 80 #define DEFAULT_HTTPS_PORT 443 #define ap_is_default_port(port,r) ((port) == ap_default_port(r)) -#ifdef NETWARE -#define ap_http_method(r) ap_os_http_method((void*)r) -#define ap_default_port(r) ap_os_default_port((void*)r) -#else #ifdef EAPI #define ap_http_method(r) (((r)->ctx != NULL && ap_ctx_get((r)->ctx, "ap::http::method") != NULL) ? ((char *)ap_ctx_get((r)->ctx, "ap::http::method")) : "http") #define ap_default_port(r) (((r)->ctx != NULL && ap_ctx_get((r)->ctx, "ap::default::port") != NULL) ? atoi((char *)ap_ctx_get((r)->ctx, "ap::default::port")) : DEFAULT_HTTP_PORT) @@ -164,7 +143,6 @@ extern "C" { #define ap_http_method(r) "http" #define ap_default_port(r) DEFAULT_HTTP_PORT #endif /* EAPI */ -#endif /* --------- Default user name and group name running standalone ---------- */ /* --- These may be specified as numbers by placing a # before a number --- */ @@ -177,11 +155,7 @@ extern "C" { #endif #ifndef DEFAULT_ERRORLOG -#if defined(OS2) || defined(WIN32) -#define DEFAULT_ERRORLOG "logs/error.log" -#else #define DEFAULT_ERRORLOG "logs/error_log" -#endif #endif /* DEFAULT_ERRORLOG */ #ifndef DEFAULT_PIDLOG @@ -212,12 +186,7 @@ extern "C" { /* Define this to be what your per-directory security files are called */ #ifndef DEFAULT_ACCESS_FNAME -#ifdef OS2 -/* Set default for OS/2 file system */ -#define DEFAULT_ACCESS_FNAME "htaccess" -#else #define DEFAULT_ACCESS_FNAME ".htaccess" -#endif #endif /* DEFAULT_ACCESS_FNAME */ /* The name of the server config file */ @@ -256,12 +225,7 @@ extern "C" { /* The path to the shell interpreter, for parsed docs */ #ifndef SHELL_PATH -#if defined(OS2) || defined(WIN32) -/* Set default for OS/2 and Windows file system */ -#define SHELL_PATH "CMD.EXE" -#else #define SHELL_PATH "/bin/sh" -#endif #endif /* SHELL_PATH */ /* The path to the suExec wrapper, can be overridden in Configuration */ @@ -327,14 +291,8 @@ extern "C" { * the overhead. */ #ifndef HARD_SERVER_LIMIT -#ifdef WIN32 -#define HARD_SERVER_LIMIT 1024 -#elif defined(NETWARE) -#define HARD_SERVER_LIMIT 2048 -#else #define HARD_SERVER_LIMIT 256 #endif -#endif /* * Special Apache error codes. These are basically used @@ -618,9 +576,6 @@ API_EXPORT(void) ap_add_config_define(const char *define); #define CGI_MAGIC_TYPE "application/x-httpd-cgi" #define INCLUDES_MAGIC_TYPE "text/x-server-parsed-html" #define INCLUDES_MAGIC_TYPE3 "text/x-server-parsed-html3" -#ifdef CHARSET_EBCDIC -#define ASCIITEXT_MAGIC_TYPE_PREFIX "text/x-ascii-" /* Text files whose content-type starts with this are passed thru unconverted */ -#endif /*CHARSET_EBCDIC*/ #define MAP_FILE_MAGIC_TYPE "application/x-type-map" #define ASIS_MAGIC_TYPE "httpd/send-as-is" #define DIR_MAGIC_TYPE "httpd/unix-directory" @@ -644,25 +599,10 @@ API_EXPORT(void) ap_add_config_define(const char *define); "\"http://www.w3.org/TR/REC-html40/frameset.dtd\">\n" /* Just in case your linefeed isn't the one the other end is expecting. */ -#ifndef CHARSET_EBCDIC #define LF 10 #define CR 13 #define CRLF "\015\012" #define OS_ASC(c) (c) -#else /* CHARSET_EBCDIC */ -#include "ap_ebcdic.h" -/* OSD_POSIX uses the EBCDIC charset. The transition ASCII->EBCDIC is done in - * the buff package (bread/bputs/bwrite), so everywhere else, we use - * "native EBCDIC" CR and NL characters. These are therefore defined as - * '\r' and '\n'. - * NB: this is not the whole truth - sometimes \015 and \012 are contained - * in literal (EBCDIC!) strings, so these are not converted but passed. - */ -#define CR '\r' -#define LF '\n' -#define CRLF "\r\n" -#define OS_ASC(c) (os_toascii[c]) -#endif /* CHARSET_EBCDIC */ /* Possible values for request_rec.read_body (set by handling module): * REQUEST_NO_BODY Send 413 error if message has any body @@ -867,17 +807,6 @@ struct request_rec { */ char *case_preserved_filename; -#ifdef CHARSET_EBCDIC - /* We don't want subrequests to modify our current conversion flags. - * These flags save the state of the conversion flags when subrequests - * are run. - */ - struct { - unsigned conv_in:1; /* convert ASCII->EBCDIC when read()ing? */ - unsigned conv_out:1; /* convert EBCDIC->ASCII when write()ing? */ - } ebcdic; -#endif - /* Things placed at the end of the record to avoid breaking binary * compatibility. It would be nice to remember to reorder the entire * record to improve 64bit alignment the next time we need to break @@ -1093,15 +1022,6 @@ API_EXPORT(char *) ap_pbase64encode(pool *p, char *string); API_EXPORT(char *) ap_uudecode(pool *p, const char *bufcoded); API_EXPORT(char *) ap_uuencode(pool *p, char *string); -#if defined(OS2) || defined(WIN32) -API_EXPORT(char *) ap_double_quotes(pool *p, const char *str); -API_EXPORT(char *) ap_caret_escape_args(pool *p, const char *str); -#endif - -#ifdef OS2 -void os2pathname(char *path); -#endif - API_EXPORT(int) ap_regexec(const regex_t *preg, const char *string, size_t nmatch, regmatch_t pmatch[], int eflags); API_EXPORT(size_t) ap_regerror(int errcode, const regex_t *preg, @@ -1168,25 +1088,10 @@ API_EXPORT(void) ap_chdir_file(const char *file); #define ap_os_systemcase_filename(p,f) (f) #else API_EXPORT(char *) ap_os_canonical_filename(pool *p, const char *file); -#ifdef WIN32 -API_EXPORT(char *) ap_os_case_canonical_filename(pool *pPool, const char *szFile); -API_EXPORT(char *) ap_os_systemcase_filename(pool *pPool, const char *szFile); -#elif defined(OS2) -API_EXPORT(char *) ap_os_case_canonical_filename(pool *pPool, const char *szFile); -API_EXPORT(char *) ap_os_systemcase_filename(pool *pPool, const char *szFile); -#elif defined(NETWARE) -API_EXPORT(char *) ap_os_case_canonical_filename(pool *pPool, const char *szFile); -#define ap_os_systemcase_filename(p,f) ap_os_case_canonical_filename(p,f) -#else #define ap_os_case_canonical_filename(p,f) ap_os_canonical_filename(p,f) #define ap_os_systemcase_filename(p,f) ap_os_canonical_filename(p,f) #endif -#endif -#ifdef CHARSET_EBCDIC -API_EXPORT(int) ap_checkconv(struct request_rec *r); /* for downloads */ -API_EXPORT(int) ap_checkconv_in(struct request_rec *r); /* for uploads */ -#endif /*#ifdef CHARSET_EBCDIC*/ API_EXPORT(char *) ap_get_local_host(pool *); API_EXPORT(unsigned long) ap_get_virthost_addr(char *hostname, unsigned short *port); diff --git a/usr.sbin/httpd/src/include/multithread.h b/usr.sbin/httpd/src/include/multithread.h index f64f67e3971..bf8249d1df2 100644 --- a/usr.sbin/httpd/src/include/multithread.h +++ b/usr.sbin/httpd/src/include/multithread.h @@ -19,11 +19,7 @@ typedef void event; * I believe this is terribly ugly */ #ifdef MULTITHREAD -#ifdef NETWARE -#define APACHE_TLS -#else #define APACHE_TLS __declspec( thread ) -#endif thread *create_thread(void (thread_fn) (void *thread_arg), void *thread_arg); int kill_thread(thread *thread_id); diff --git a/usr.sbin/httpd/src/include/scoreboard.h b/usr.sbin/httpd/src/include/scoreboard.h index e1e29a310ef..67b6adbd2e1 100644 --- a/usr.sbin/httpd/src/include/scoreboard.h +++ b/usr.sbin/httpd/src/include/scoreboard.h @@ -63,14 +63,7 @@ extern "C" { #endif -#ifndef WIN32 -#if defined(TPF) || defined(NETWARE) -#include <time.h> -#else #include <sys/times.h> -#endif /* TPF */ -#endif - /* Scoreboard info on a process is, for now, kept very brief --- * just status value and pid (the latter so that the caretaker process diff --git a/usr.sbin/httpd/src/include/util_date.h b/usr.sbin/httpd/src/include/util_date.h index cf0f0401af2..8e7f6037511 100644 --- a/usr.sbin/httpd/src/include/util_date.h +++ b/usr.sbin/httpd/src/include/util_date.h @@ -67,10 +67,6 @@ extern "C" { * util_date.h: prototypes for date parsing utility routines */ -#ifdef NEWSOS -#include <stdlib.h> -#include <sys/types.h> -#endif #include <time.h> #define BAD_DATE (time_t)0 diff --git a/usr.sbin/httpd/src/include/util_md5.h b/usr.sbin/httpd/src/include/util_md5.h index a817c0b1df1..37ca1b380d6 100644 --- a/usr.sbin/httpd/src/include/util_md5.h +++ b/usr.sbin/httpd/src/include/util_md5.h @@ -68,11 +68,7 @@ extern "C" { API_EXPORT(char *) ap_md5(pool *a, const unsigned char *string); API_EXPORT(char *) ap_md5_binary(pool *a, const unsigned char *buf, int len); API_EXPORT(char *) ap_md5contextTo64(pool *p, AP_MD5_CTX * context); -#ifdef CHARSET_EBCDIC -API_EXPORT(char *) ap_md5digest(pool *p, FILE *infile, int convert); -#else API_EXPORT(char *) ap_md5digest(pool *p, FILE *infile); -#endif /* CHARSET_EBCDIC */ #ifdef __cplusplus } diff --git a/usr.sbin/httpd/src/lib/sdbm/sdbm.c b/usr.sbin/httpd/src/lib/sdbm/sdbm.c index 914dc6f4339..4071e3240de 100644 --- a/usr.sbin/httpd/src/lib/sdbm/sdbm.c +++ b/usr.sbin/httpd/src/lib/sdbm/sdbm.c @@ -17,15 +17,7 @@ #include <errno.h> #include <string.h> #include <stdlib.h> -#ifdef WIN32 -#include <io.h> -#include <stdio.h> -#else #include <unistd.h> /* for lseek() */ -#endif -#ifdef NETWARE -#include <nwsemaph.h> -#endif /* @@ -59,9 +51,6 @@ static long masks[] = { }; datum nullitem = {NULL, 0}; -#ifdef NETWARE -extern LONG locking_sem; -#endif DBM * sdbm_open(file, flags, mode) @@ -87,9 +76,6 @@ register int mode; return (DBM *) NULL; } -#ifdef NETWARE - locking_sem = OpenLocalSemaphore (1); -#endif db = sdbm_prep(dirname, pagname, flags, mode); free((char *) dirname); @@ -128,9 +114,6 @@ int mode; * open the files in sequence, and stat the dirfile. * If we fail anywhere, undo everything, return NULL. */ -#if defined(OS2) || defined(MSDOS) || defined(WIN32) || defined(NETWARE) - flags |= O_BINARY; -#endif if ((db->pagf = open(pagname, flags, mode)) > -1) { if ( sdbm_fd_lock(db->pagf, sdbm_rdonly(db)) > -1 ) { if ((db->dirf = open(dirname, flags, mode)) > -1) { @@ -174,9 +157,6 @@ register DBM *db; (void) sdbm_fd_unlock(db->pagf); (void) close(db->pagf); free((char *) db); -#ifdef NETWARE - CloseLocalSemaphore (locking_sem); -#endif } } diff --git a/usr.sbin/httpd/src/lib/sdbm/sdbm_lock.c b/usr.sbin/httpd/src/lib/sdbm/sdbm_lock.c index 2ebb2a9b549..ccf8209942d 100644 --- a/usr.sbin/httpd/src/lib/sdbm/sdbm_lock.c +++ b/usr.sbin/httpd/src/lib/sdbm/sdbm_lock.c @@ -22,32 +22,13 @@ #endif #if !defined(USE_FCNTL) && !defined(USE_FLOCK) #define USE_FLOCK 1 -#if !defined(MPE) && !defined(WIN32) && !defined(NETWARE) #include <sys/file.h> -#endif #ifndef LOCK_UN #undef USE_FLOCK #define USE_FCNTL 1 #include <fcntl.h> #endif #endif -#ifdef AIX -#undef USE_FLOCK -#define USE_FCNTL 1 -#include <fcntl.h> -#endif -#ifdef WIN32 -#undef USE_FCNTL -#define USE_LOCKING -#include <sys/locking.h> -#endif -#ifdef NETWARE -#undef USE_FCNTL -#define USE_SEM_LOCKING -#include <nwsemaph.h> -LONG locking_sem = 0; -#endif - #ifdef USE_FCNTL /* ugly interface requires this structure to be "live" for a while */ diff --git a/usr.sbin/httpd/src/main/alloc.c b/usr.sbin/httpd/src/main/alloc.c index 7924b619e74..38cd26c3a4d 100644 --- a/usr.sbin/httpd/src/main/alloc.c +++ b/usr.sbin/httpd/src/main/alloc.c @@ -73,11 +73,6 @@ #include <stdarg.h> -#ifdef OS2 -#define INCL_DOS -#include <os2.h> -#endif - /* debugging support, define this to enable code which helps detect re-use * of freed memory and other such nonsense. * @@ -645,11 +640,7 @@ void ap_init_alloc_shared(int early) } else { /* process a lot later on startup */ -#ifdef WIN32 - ap_mm_permission(mm, (_S_IREAD|_S_IWRITE), ap_user_id, -1); -#else ap_mm_permission(mm, (S_IRUSR|S_IWUSR), ap_user_id, -1); -#endif } #endif /* EAPI_MM */ return; @@ -2000,7 +1991,6 @@ static void cleanup_pool_for_exec(pool *p) API_EXPORT(void) ap_cleanup_for_exec(void) { -#if !defined(WIN32) && !defined(OS2) && !defined(NETWARE) /* * Don't need to do anything on NT, NETWARE or OS/2, because I * am actually going to spawn the new process - not @@ -2013,7 +2003,6 @@ API_EXPORT(void) ap_cleanup_for_exec(void) ap_block_alarms(); cleanup_pool_for_exec(permanent_pool); ap_unblock_alarms(); -#endif /* ndef WIN32 */ } API_EXPORT_NONSTD(void) ap_null_cleanup(void *data) @@ -2027,44 +2016,6 @@ API_EXPORT_NONSTD(void) ap_null_cleanup(void *data) * generic cleanup interface. */ -#if defined(WIN32) -/* Provided by service.c, internal to the core library (not exported) */ -BOOL isWindowsNT(void); - -int ap_close_handle_on_exec(HANDLE nth) -{ - /* Protect the fd so that it will not be inherited by child processes */ - if (isWindowsNT()) { - DWORD hinfo; - if (!GetHandleInformation(nth, &hinfo)) { - ap_log_error(APLOG_MARK, APLOG_ERR, NULL, "GetHandleInformation" - "(%08x) failed", nth); - return 0; - } - if ((hinfo & HANDLE_FLAG_INHERIT) - && !SetHandleInformation(nth, HANDLE_FLAG_INHERIT, 0)) { - ap_log_error(APLOG_MARK, APLOG_ERR, NULL, "SetHandleInformation" - "(%08x, HANDLE_FLAG_INHERIT, 0) failed", nth); - return 0; - } - return 1; - } - else /* Win9x */ { - /* XXX: This API doesn't work... you can't change the handle by just - * 'touching' it... you must duplicat to a second handle and close - * the original. - */ - return 0; - } -} - -int ap_close_fd_on_exec(int fd) -{ - return ap_close_handle_on_exec((HANDLE)_get_osfhandle(fd)); -} - -#else - int ap_close_fd_on_exec(int fd) { #if defined(F_SETFD) && defined(FD_CLOEXEC) @@ -2081,8 +2032,6 @@ int ap_close_fd_on_exec(int fd) #endif } -#endif /* ndef(WIN32) */ - static void fd_cleanup(void *fdv) { close((int) (long) fdv); @@ -2095,9 +2044,6 @@ static int fd_magic_cleanup(void *fdv) API_EXPORT(void) ap_note_cleanups_for_fd_ex(pool *p, int fd, int domagic) { -#if defined(NETWARE) - domagic = 0; /* skip magic for NetWare, at least for now */ -#endif ap_register_cleanup_ex(p, (void *) (long) fd, fd_cleanup, fd_cleanup, domagic ? fd_magic_cleanup : NULL); } @@ -2149,48 +2095,6 @@ API_EXPORT(int) ap_pclosef(pool *a, int fd) return res; } -#ifdef WIN32 -static void h_cleanup(void *nth) -{ - CloseHandle((HANDLE) nth); -} - -static int h_magic_cleanup(void *nth) -{ - /* Set handle not-inherited - */ - return ap_close_handle_on_exec((HANDLE) nth); -} - -API_EXPORT(void) ap_note_cleanups_for_h_ex(pool *p, HANDLE nth, int domagic) -{ - ap_register_cleanup_ex(p, (void *) nth, h_cleanup, h_cleanup, - domagic ? h_magic_cleanup : NULL); -} - -API_EXPORT(void) ap_note_cleanups_for_h(pool *p, HANDLE nth) -{ - ap_note_cleanups_for_h_ex(p, nth, 0); -} - -API_EXPORT(int) ap_pcloseh(pool *a, HANDLE hDevice) -{ - int res=0; - int save_errno; - - ap_block_alarms(); - - if (!CloseHandle(hDevice)) { - res = GetLastError(); - } - - save_errno = errno; - ap_kill_cleanup(a, (void *) hDevice, h_cleanup); - ap_unblock_alarms(); - errno = save_errno; - return res; -} -#endif /* Note that we have separate plain_ and child_ cleanups for FILE *s, * since fclose() would flush I/O buffers, which is extremely undesirable; @@ -2214,9 +2118,6 @@ static int file_magic_cleanup(void *fpv) API_EXPORT(void) ap_note_cleanups_for_file_ex(pool *p, FILE *fp, int domagic) { -#if defined(NETWARE) - domagic = 0; /* skip magic for NetWare, at least for now */ -#endif ap_register_cleanup_ex(p, (void *) fp, file_cleanup, file_child_cleanup, domagic ? file_magic_cleanup : NULL); } @@ -2233,11 +2134,7 @@ API_EXPORT(FILE *) ap_pfopen(pool *a, const char *name, const char *mode) int modeFlags = 0; int saved_errno; -#ifdef WIN32 - modeFlags = _S_IREAD | _S_IWRITE; -#else modeFlags = S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH; -#endif ap_block_alarms(); @@ -2337,18 +2234,11 @@ static void socket_cleanup(void *fdv) static int socket_magic_cleanup(void *fpv) { -#ifdef WIN32 - return ap_close_handle_on_exec((HANDLE) fpv); -#else return ap_close_fd_on_exec((int) (long) fpv); -#endif } API_EXPORT(void) ap_note_cleanups_for_socket_ex(pool *p, int fd, int domagic) { -#if defined(TPF) || defined(NETWARE) - domagic = 0; /* skip magic (fcntl) for TPF sockets, at least for now */ -#endif ap_register_cleanup_ex(p, (void *) (long) fd, socket_cleanup, socket_cleanup, domagic ? socket_magic_cleanup : NULL); @@ -2394,9 +2284,6 @@ API_EXPORT(int) ap_pclosesocket(pool *a, int sock) ap_block_alarms(); res = closesocket(sock); -#if defined(WIN32) || defined(NETWARE) - errno = WSAGetLastError(); -#endif /* WIN32 */ save_errno = errno; ap_kill_cleanup(a, (void *) (long) sock, socket_cleanup); ap_unblock_alarms(); @@ -2467,18 +2354,10 @@ how) { a->subprocesses = new; } -#ifdef WIN32 -#define os_pipe(fds) _pipe(fds, 512, O_BINARY | O_NOINHERIT) -#else #define os_pipe(fds) pipe(fds) -#endif /* WIN32 */ /* for ap_fdopen, to get binary mode */ -#if defined (OS2) || defined (WIN32) || defined (NETWARE) -#define BINMODE "b" -#else #define BINMODE -#endif static pid_t spawn_child_core(pool *p, int (*func) (void *, child_info *), void *data,enum kill_conditions kill_how, @@ -2518,147 +2397,6 @@ static pid_t spawn_child_core(pool *p, int (*func) (void *, child_info *), return 0; } -#ifdef WIN32 - - { - HANDLE thread_handle; - int hStdIn, hStdOut, hStdErr; - int old_priority; - child_info info; - - (void) ap_acquire_mutex(spawn_mutex); - thread_handle = GetCurrentThread(); /* doesn't need to be closed */ - old_priority = GetThreadPriority(thread_handle); - SetThreadPriority(thread_handle, THREAD_PRIORITY_HIGHEST); - /* Now do the right thing with your pipes */ - if (pipe_in) { - hStdIn = dup(fileno(stdin)); - if(dup2(in_fds[0], fileno(stdin))) - ap_log_error(APLOG_MARK, APLOG_ERR, NULL, "dup2(stdin) failed"); - close(in_fds[0]); - } - if (pipe_out) { - hStdOut = dup(fileno(stdout)); - close(fileno(stdout)); - if(dup2(out_fds[1], fileno(stdout))) - ap_log_error(APLOG_MARK, APLOG_ERR, NULL, "dup2(stdout) failed"); - close(out_fds[1]); - } - if (pipe_err) { - hStdErr = dup(fileno(stderr)); - if(dup2(err_fds[1], fileno(stderr))) - ap_log_error(APLOG_MARK, APLOG_ERR, NULL, "dup2(stderr) failed"); - close(err_fds[1]); - } - - info.hPipeInputRead = GetStdHandle(STD_INPUT_HANDLE); - info.hPipeOutputWrite = GetStdHandle(STD_OUTPUT_HANDLE); - info.hPipeErrorWrite = GetStdHandle(STD_ERROR_HANDLE); - - pid = (*func) (data, &info); - if (pid == -1) pid = 0; /* map Win32 error code onto Unix default */ - - if (!pid) { - save_errno = errno; - close(in_fds[1]); - close(out_fds[0]); - close(err_fds[0]); - } - - /* restore the original stdin, stdout and stderr */ - if (pipe_in) { - dup2(hStdIn, fileno(stdin)); - close(hStdIn); - } - if (pipe_out) { - dup2(hStdOut, fileno(stdout)); - close(hStdOut); - } - if (pipe_err) { - dup2(hStdErr, fileno(stderr)); - close(hStdErr); - } - - if (pid) { - ap_note_subprocess(p, pid, kill_how); - if (pipe_in) { - *pipe_in = in_fds[1]; - } - if (pipe_out) { - *pipe_out = out_fds[0]; - } - if (pipe_err) { - *pipe_err = err_fds[0]; - } - } - SetThreadPriority(thread_handle, old_priority); - (void) ap_release_mutex(spawn_mutex); - /* - * go on to the end of the function, where you can - * unblock alarms and return the pid - */ - - } -#elif defined(NETWARE) - /* NetWare currently has no pipes yet. This will - be solved with the new libc for NetWare soon. */ - pid = 0; -#elif defined(OS2) - { - int save_in=-1, save_out=-1, save_err=-1; - - if (pipe_out) { - save_out = dup(STDOUT_FILENO); - dup2(out_fds[1], STDOUT_FILENO); - close(out_fds[1]); - DosSetFHState(out_fds[0], OPEN_FLAGS_NOINHERIT); - } - - if (pipe_in) { - save_in = dup(STDIN_FILENO); - dup2(in_fds[0], STDIN_FILENO); - close(in_fds[0]); - DosSetFHState(in_fds[1], OPEN_FLAGS_NOINHERIT); - } - - if (pipe_err) { - save_err = dup(STDERR_FILENO); - dup2(err_fds[1], STDERR_FILENO); - close(err_fds[1]); - DosSetFHState(err_fds[0], OPEN_FLAGS_NOINHERIT); - } - - pid = func(data, NULL); - - if ( pid ) - ap_note_subprocess(p, pid, kill_how); - - if (pipe_out) { - close(STDOUT_FILENO); - dup2(save_out, STDOUT_FILENO); - close(save_out); - *pipe_out = out_fds[0]; - } - - if (pipe_in) { - close(STDIN_FILENO); - dup2(save_in, STDIN_FILENO); - close(save_in); - *pipe_in = in_fds[1]; - } - - if (pipe_err) { - close(STDERR_FILENO); - dup2(save_err, STDERR_FILENO); - close(save_err); - *pipe_err = err_fds[0]; - } - } -#elif defined(TPF) - return (pid = ap_tpf_spawn_child(p, func, data, kill_how, - pipe_in, pipe_out, pipe_err, out_fds, in_fds, err_fds)); -#else - if ((pid = fork()) < 0) { save_errno = errno; if (pipe_in) { @@ -2724,7 +2462,6 @@ static pid_t spawn_child_core(pool *p, int (*func) (void *, child_info *), close(err_fds[1]); *pipe_err = err_fds[0]; } -#endif /* WIN32 */ return pid; } @@ -2785,189 +2522,6 @@ API_EXPORT(int) ap_bspawn_child(pool *p, int (*func) (void *, child_info *), voi enum kill_conditions kill_how, BUFF **pipe_in, BUFF **pipe_out, BUFF **pipe_err) { -#ifdef WIN32 - SECURITY_ATTRIBUTES sa = {0}; - HANDLE hPipeOutputRead = NULL; - HANDLE hPipeOutputWrite = NULL; - HANDLE hPipeInputRead = NULL; - HANDLE hPipeInputWrite = NULL; - HANDLE hPipeErrorRead = NULL; - HANDLE hPipeErrorWrite = NULL; - HANDLE hPipeInputWriteDup = NULL; - HANDLE hPipeOutputReadDup = NULL; - HANDLE hPipeErrorReadDup = NULL; - HANDLE hCurrentProcess; - pid_t pid = 0; - child_info info; - - - ap_block_alarms(); - - /* - * First thing to do is to create the pipes that we will use for stdin, stdout, and - * stderr in the child process. - */ - sa.nLength = sizeof(sa); - sa.bInheritHandle = TRUE; - sa.lpSecurityDescriptor = NULL; - - - /* Create pipes for standard input/output/error redirection. */ - if (pipe_in && !CreatePipe(&hPipeInputRead, &hPipeInputWrite, &sa, 0)) - return 0; - - if (pipe_out && !CreatePipe(&hPipeOutputRead, &hPipeOutputWrite, &sa, 0)) { - if(pipe_in) { - CloseHandle(hPipeInputRead); - CloseHandle(hPipeInputWrite); - } - return 0; - } - - if (pipe_err && !CreatePipe(&hPipeErrorRead, &hPipeErrorWrite, &sa, 0)) { - if(pipe_in) { - CloseHandle(hPipeInputRead); - CloseHandle(hPipeInputWrite); - } - if(pipe_out) { - CloseHandle(hPipeOutputRead); - CloseHandle(hPipeOutputWrite); - } - return 0; - } - /* - * When the pipe handles are created, the security descriptor - * indicates that the handle can be inherited. However, we do not - * want the server side handles to the pipe to be inherited by the - * child CGI process. If the child CGI does inherit the server - * side handles, then the child may be left around if the server - * closes its handles (e.g. if the http connection is aborted), - * because the child will have a valid copy of handles to both - * sides of the pipes, and no I/O error will occur. Microsoft - * recommends using DuplicateHandle to turn off the inherit bit - * under NT and Win95. - */ - hCurrentProcess = GetCurrentProcess(); - if ((pipe_in && !DuplicateHandle(hCurrentProcess, hPipeInputWrite, - hCurrentProcess, - &hPipeInputWriteDup, 0, FALSE, - DUPLICATE_SAME_ACCESS)) - || (pipe_out && !DuplicateHandle(hCurrentProcess, hPipeOutputRead, - hCurrentProcess, &hPipeOutputReadDup, - 0, FALSE, DUPLICATE_SAME_ACCESS)) - || (pipe_err && !DuplicateHandle(hCurrentProcess, hPipeErrorRead, - hCurrentProcess, &hPipeErrorReadDup, - 0, FALSE, DUPLICATE_SAME_ACCESS))) { - if (pipe_in) { - CloseHandle(hPipeInputRead); - CloseHandle(hPipeInputWrite); - } - if (pipe_out) { - CloseHandle(hPipeOutputRead); - CloseHandle(hPipeOutputWrite); - } - if (pipe_err) { - CloseHandle(hPipeErrorRead); - CloseHandle(hPipeErrorWrite); - } - return 0; - } - else { - if (pipe_in) { - CloseHandle(hPipeInputWrite); - hPipeInputWrite = hPipeInputWriteDup; - } - if (pipe_out) { - CloseHandle(hPipeOutputRead); - hPipeOutputRead = hPipeOutputReadDup; - } - if (pipe_err) { - CloseHandle(hPipeErrorRead); - hPipeErrorRead = hPipeErrorReadDup; - } - } - - /* The script writes stdout to this pipe handle */ - info.hPipeOutputWrite = hPipeOutputWrite; - - /* The script reads stdin from this pipe handle */ - info.hPipeInputRead = hPipeInputRead; - - /* The script writes stderr to this pipe handle */ - info.hPipeErrorWrite = hPipeErrorWrite; - - /* - * Try to launch the CGI. Under the covers, this call - * will try to pick up the appropriate interpreter if - * one is needed. - */ - pid = func(data, &info); - if (pid == -1) { - /* Things didn't work, so cleanup */ - pid = 0; /* map Win32 error code onto Unix default */ - CloseHandle(hPipeOutputRead); - CloseHandle(hPipeInputWrite); - CloseHandle(hPipeErrorRead); - } - else { - if (pipe_out) { - /* - * This pipe represents stdout for the script, - * so we read from this pipe. - */ - /* Create a read buffer */ - *pipe_out = ap_bcreate(p, B_RD); - - /* Setup the cleanup routine for the handle */ - ap_note_cleanups_for_h_ex(p, hPipeOutputRead, 1); - - /* Associate the handle with the new buffer */ - ap_bpushh(*pipe_out, hPipeOutputRead); - } - - if (pipe_in) { - /* - * This pipe represents stdin for the script, so we - * write to this pipe. - */ - /* Create a write buffer */ - *pipe_in = ap_bcreate(p, B_WR); - - /* Setup the cleanup routine for the handle */ - ap_note_cleanups_for_h_ex(p, hPipeInputWrite, 1); - - /* Associate the handle with the new buffer */ - ap_bpushh(*pipe_in, hPipeInputWrite); - - } - - if (pipe_err) { - /* - * This pipe represents stderr for the script, so - * we read from this pipe. - */ - /* Create a read buffer */ - *pipe_err = ap_bcreate(p, B_RD); - - /* Setup the cleanup routine for the handle */ - ap_note_cleanups_for_h_ex(p, hPipeErrorRead, 1); - - /* Associate the handle with the new buffer */ - ap_bpushh(*pipe_err, hPipeErrorRead); - } - } - - - /* - * Now that handles have been inherited, close them to be safe. - * You don't want to read or write to them accidentally, and we - * sure don't want to have a handle leak. - */ - CloseHandle(hPipeOutputWrite); - CloseHandle(hPipeInputRead); - CloseHandle(hPipeErrorWrite); - -#else int fd_in, fd_out, fd_err; pid_t pid; int save_errno; @@ -3003,7 +2557,6 @@ API_EXPORT(int) ap_bspawn_child(pool *p, int (*func) (void *, child_info *), voi ap_note_cleanups_for_fd_ex(p, fd_err, 0); ap_bpushfd(*pipe_err, fd_err, fd_err); } -#endif ap_unblock_alarms(); return pid; @@ -3029,10 +2582,8 @@ static void free_proc_chain(struct process_chain *procs) struct process_chain *p; int need_timeout = 0; int status; -#if !defined(WIN32) && !defined(NETWARE) int timeout_interval; struct timeval tv; -#endif if (procs == NULL) return; /* No work. Whew! */ @@ -3043,43 +2594,6 @@ static void free_proc_chain(struct process_chain *procs) * don't waste any more cycles doing whatever it is that they shouldn't * be doing anymore. */ -#ifdef WIN32 - /* Pick up all defunct processes */ - for (p = procs; p; p = p->next) { - if (GetExitCodeProcess((HANDLE) p->pid, &status)) { - p->kill_how = kill_never; - } - } - - - for (p = procs; p; p = p->next) { - if (p->kill_how == kill_after_timeout) { - need_timeout = 1; - } - else if (p->kill_how == kill_always) { - TerminateProcess((HANDLE) p->pid, 1); - } - } - /* Sleep only if we have to... */ - - if (need_timeout) - sleep(3); - - /* OK, the scripts we just timed out for have had a chance to clean up - * --- now, just get rid of them, and also clean up the system accounting - * goop... - */ - - for (p = procs; p; p = p->next) { - if (p->kill_how == kill_after_timeout) - TerminateProcess((HANDLE) p->pid, 1); - } - - for (p = procs; p; p = p->next) { - CloseHandle((HANDLE) p->pid); - } -#elif defined(NETWARE) -#else #ifndef NEED_WAITPID /* Pick up all defunct processes */ for (p = procs; p; p = p->next) { @@ -3150,5 +2664,4 @@ static void free_proc_chain(struct process_chain *procs) if (p->kill_how != kill_never) waitpid(p->pid, &status, 0); } -#endif /* !WIN32 && !NETWARE*/ } diff --git a/usr.sbin/httpd/src/main/buff.c b/usr.sbin/httpd/src/main/buff.c index 1ba8923129b..741dd07d44a 100644 --- a/usr.sbin/httpd/src/main/buff.c +++ b/usr.sbin/httpd/src/main/buff.c @@ -122,177 +122,12 @@ * futher I/O will be done */ -#if defined(WIN32) || defined(NETWARE) || defined(CYGWIN_WINSOCK) - -/* - select() sometimes returns 1 even though the write will block. We must work around this. -*/ - -API_EXPORT(int) ap_sendwithtimeout(int sock, const char *buf, int len, int flags) -{ - int iostate = 1; - fd_set fdset; - struct timeval tv; - int err = WSAEWOULDBLOCK; - int rv; - int retry; - - tv.tv_sec = ap_check_alarm(); - - /* If ap_sendwithtimeout is called with an invalid timeout - * set a default timeout of 300 seconds. This hack is needed - * to emulate the non-blocking send() that was removed in - * the previous patch to this function. Network servers - * should never make network i/o calls w/o setting a timeout. - * (doing otherwise opens a DoS attack exposure) - */ - if (tv.tv_sec <= 0) { - tv.tv_sec = 300; - } - - rv = ioctlsocket(sock, FIONBIO, (u_long*)&iostate); - iostate = 0; - if (rv) { - err = WSAGetLastError(); - ap_assert(0); - } - - rv = send(sock, buf, len, flags); - if (rv == SOCKET_ERROR) { - err = WSAGetLastError(); - if (err == WSAEWOULDBLOCK) - do { - retry=0; - - FD_ZERO(&fdset); - FD_SET(sock, &fdset); - tv.tv_usec = 0; - rv = select(sock + 1, NULL, &fdset, NULL, &tv); - if (rv == SOCKET_ERROR) - err = WSAGetLastError(); - else if (rv == 0) { - ioctlsocket(sock, FIONBIO, (u_long*)&iostate); - if(ap_check_alarm() < 0) { - WSASetLastError(EINTR); /* Simulate an alarm() */ - return (SOCKET_ERROR); - } - } - else { - rv = send(sock, buf, len, flags); - if (rv == SOCKET_ERROR) { - err = WSAGetLastError(); - if(err == WSAEWOULDBLOCK) { - - retry=1; - ap_log_error(APLOG_MARK,APLOG_DEBUG,NULL, - "select claimed we could write, but in fact we couldn't."); -#ifdef NETWARE - ThreadSwitchWithDelay(); -#else - Sleep(100); -#endif - } - } - } - } while(retry); - } - - ioctlsocket(sock, FIONBIO, (u_long*)&iostate); - - if (rv == SOCKET_ERROR) - WSASetLastError(err); - return (rv); -} - - -API_EXPORT(int) ap_recvwithtimeout(int sock, char *buf, int len, int flags) -{ - int iostate = 1; - fd_set fdset; - struct timeval tv; - int err = WSAEWOULDBLOCK; - int rv; - int retry; - - tv.tv_sec = ap_check_alarm(); - - /* If ap_recvwithtimeout is called with an invalid timeout - * set a default timeout of 300 seconds. This hack is needed - * to emulate the non-blocking recv() that was removed in - * the previous patch to this function. Network servers - * should never make network i/o calls w/o setting a timeout. - * (doing otherwise opens a DoS attack exposure) - */ - if (tv.tv_sec <= 0) { - tv.tv_sec = 300; - } - - rv = ioctlsocket(sock, FIONBIO, (u_long*)&iostate); - iostate = 0; - ap_assert(!rv); - - rv = recv(sock, buf, len, flags); - if (rv == SOCKET_ERROR) { - err = WSAGetLastError(); - if (err == WSAEWOULDBLOCK) { - do { - retry = 0; - FD_ZERO(&fdset); - FD_SET(sock, &fdset); - tv.tv_usec = 0; - rv = select(sock + 1, &fdset, NULL, NULL, &tv); - if (rv == SOCKET_ERROR) - err = WSAGetLastError(); - else if (rv == 0) { - ioctlsocket(sock, FIONBIO, (u_long*)&iostate); - ap_check_alarm(); - WSASetLastError(WSAEWOULDBLOCK); - return (SOCKET_ERROR); - } - else { - rv = recv(sock, buf, len, flags); - if (rv == SOCKET_ERROR) { - err = WSAGetLastError(); - if (err == WSAEWOULDBLOCK) { - ap_log_error(APLOG_MARK, APLOG_DEBUG, NULL, - "select claimed we could read, but in fact we couldn't."); - retry = 1; -#ifdef NETWARE - ThreadSwitchWithDelay(); -#else - Sleep(100); -#endif - } - } - } - } while (retry); - } - } - - ioctlsocket(sock, FIONBIO, (u_long*)&iostate); - - if (rv == SOCKET_ERROR) - WSASetLastError(err); - return (rv); -} - -#endif /* WIN32 */ - /* the lowest level reading primitive */ static int ap_read(BUFF *fb, void *buf, int nbyte) { int rv; -#ifdef WIN32 - if (fb->hFH != INVALID_HANDLE_VALUE) { - if (!ReadFile(fb->hFH,buf,nbyte,&rv,NULL)) { - errno = GetLastError(); - rv = -1; - } - } - else -#endif #ifdef EAPI if (!ap_hook_call("ap::buff::read", &rv, fb, buf, nbyte)) #endif /* EAPI */ @@ -305,41 +140,7 @@ static ap_inline int buff_read(BUFF *fb, void *buf, int nbyte) { int rv; -#if defined (WIN32) || defined(NETWARE) || defined(CYGWIN_WINSOCK) - if (fb->flags & B_SOCKET) { -#ifdef EAPI - if (!ap_hook_call("ap::buff::recvwithtimeout", &rv, fb, buf, nbyte)) -#endif /* EAPI */ - rv = ap_recvwithtimeout(fb->fd_in, buf, nbyte, 0); - if (rv == SOCKET_ERROR) - errno = WSAGetLastError(); - } - else - rv = ap_read(fb, buf, nbyte); -#elif defined (BEOS) - if (fb->flags & B_SOCKET) { - rv = recv(fb->fd_in, buf, nbyte, 0); - } else - rv = ap_read(fb,buf,nbyte); -#elif defined(TPF) - fd_set fds; - struct timeval tv; - - ap_check_signals(); - if (fb->flags & B_SOCKET) { - FD_ZERO(&fds); - FD_SET(fb->fd_in, &fds); - tv.tv_sec = 1; - tv.tv_usec = 0; - rv = ap_select(fb->fd_in + 1, &fds, NULL, NULL, &tv); - if (rv > 0) - rv = ap_read(fb, buf, nbyte); - } - else - rv = ap_read(fb, buf, nbyte); -#else rv = ap_read(fb, buf, nbyte); -#endif /* WIN32 */ return rv; } @@ -348,32 +149,12 @@ static int ap_write(BUFF *fb, const void *buf, int nbyte) { int rv; -#ifdef WIN32 - if (fb->hFH != INVALID_HANDLE_VALUE) { - if (!WriteFile(fb->hFH,buf,nbyte,&rv,NULL)) { - errno = GetLastError(); - rv = -1; - } - } - else -#endif #ifdef EAPI if (!ap_hook_call("ap::buff::write", &rv, fb, buf, nbyte)) #endif /* EAPI */ #if defined (B_SFIO) rv = sfwrite(fb->sf_out, buf, nbyte); #else -#ifdef _OSD_POSIX - /* Sorry, but this is a hack: On BS2000, currently the send() call - * has slightly better performance, and it doesn't have a maximum - * transfer size of 16kB per write. Both write() and writev() - * currently have such a limit and therefore don't work - * too well with MMAP files. - */ - if (fb->flags & B_SOCKET) - rv = send(fb->fd, buf, nbyte, 0); - else -#endif rv = write(fb->fd, buf, nbyte); #endif @@ -388,25 +169,7 @@ static ap_inline int buff_write(BUFF *fb, const void *buf, int nbyte) fb->filter_callback(fb, buf, nbyte); } -#if defined(WIN32) || defined(NETWARE) - if (fb->flags & B_SOCKET) { -#ifdef EAPI - if (!ap_hook_call("ap::buff::sendwithtimeout", &rv, fb, buf, nbyte)) -#endif /* EAPI */ - rv = ap_sendwithtimeout(fb->fd, buf, nbyte, 0); - if (rv == SOCKET_ERROR) - errno = WSAGetLastError(); - } - else - rv = ap_write(fb, buf, nbyte); -#elif defined(BEOS) - if(fb->flags & B_SOCKET) { - rv = send(fb->fd, buf, nbyte, 0); - } else - rv = ap_write(fb, buf,nbyte); -#else rv = ap_write(fb, buf, nbyte); -#endif /* WIN32 */ return rv; } @@ -446,10 +209,6 @@ API_EXPORT(BUFF *) ap_bcreate(pool *p, int flags) else fb->outbase = NULL; -#ifdef CHARSET_EBCDIC - fb->flags |= (flags & B_SOCKET) ? (B_EBCDIC2ASCII | B_ASCII2EBCDIC) : 0; -#endif /*CHARSET_EBCDIC*/ - fb->inptr = fb->inbase; fb->incnt = 0; @@ -460,9 +219,6 @@ API_EXPORT(BUFF *) ap_bcreate(pool *p, int flags) fb->fd = -1; fb->fd_in = -1; -#ifdef WIN32 - fb->hFH = INVALID_HANDLE_VALUE; -#endif #ifdef B_SFIO fb->sf_in = NULL; @@ -492,16 +248,6 @@ API_EXPORT(void) ap_bpushfd(BUFF *fb, int fd_in, int fd_out) fb->fd_in = fd_in; } -#ifdef WIN32 -/* - * Push some Win32 handles onto the stream. - */ -API_EXPORT(void) ap_bpushh(BUFF *fb, HANDLE hFH) -{ - fb->hFH = hFH; -} -#endif - API_EXPORT(int) ap_bsetopt(BUFF *fb, int optname, const void *optval) { if (optname == BO_BYTECT) { @@ -606,12 +352,6 @@ static void end_chunk(BUFF *fb) fb->outbase[fb->outcnt++] = CR; fb->outbase[fb->outcnt++] = LF; -#ifdef CHARSET_EBCDIC - /* Chunks are an HTTP/1.1 Protocol feature. They must ALWAYS be in ASCII */ - ebcdic2ascii(&fb->outbase[fb->outchunk], &fb->outbase[fb->outchunk], CHUNK_HEADER_SIZE); - ebcdic2ascii(&fb->outbase[fb->outcnt-2], &fb->outbase[fb->outcnt-2], 2); -#endif /*CHARSET_EBCDIC*/ - fb->outchunk = -1; } @@ -802,32 +542,18 @@ API_EXPORT(int) ap_bread(BUFF *fb, void *buf, int nbyte) * buffer from before we went unbuffered. */ if (fb->incnt) { i = (fb->incnt > nbyte) ? nbyte : fb->incnt; -#ifdef CHARSET_EBCDIC - if (fb->flags & B_ASCII2EBCDIC) - ascii2ebcdic(buf, fb->inptr, i); - else -#endif /*CHARSET_EBCDIC*/ memcpy(buf, fb->inptr, i); fb->incnt -= i; fb->inptr += i; return i; } i = read_with_errors(fb, buf, nbyte); -#ifdef CHARSET_EBCDIC - if (i > 0 && ap_bgetflag(fb, B_ASCII2EBCDIC)) - ascii2ebcdic(buf, buf, i); -#endif /*CHARSET_EBCDIC*/ return i; } nrd = fb->incnt; /* can we fill the buffer */ if (nrd >= nbyte) { -#ifdef CHARSET_EBCDIC - if (fb->flags & B_ASCII2EBCDIC) - ascii2ebcdic(buf, fb->inptr, nbyte); - else -#endif /*CHARSET_EBCDIC*/ memcpy(buf, fb->inptr, nbyte); fb->incnt = nrd - nbyte; fb->inptr += nbyte; @@ -835,11 +561,6 @@ API_EXPORT(int) ap_bread(BUFF *fb, void *buf, int nbyte) } if (nrd > 0) { -#ifdef CHARSET_EBCDIC - if (fb->flags & B_ASCII2EBCDIC) - ascii2ebcdic(buf, fb->inptr, nrd); - else -#endif /*CHARSET_EBCDIC*/ memcpy(buf, fb->inptr, nrd); nbyte -= nrd; buf = nrd + (char *) buf; @@ -852,10 +573,6 @@ API_EXPORT(int) ap_bread(BUFF *fb, void *buf, int nbyte) if (nbyte >= fb->bufsiz) { /* read directly into caller's buffer */ i = read_with_errors(fb, buf, nbyte); -#ifdef CHARSET_EBCDIC - if (i > 0 && ap_bgetflag(fb, B_ASCII2EBCDIC)) - ascii2ebcdic(buf, buf, i); -#endif /*CHARSET_EBCDIC*/ if (i == -1) { return nrd ? nrd : -1; } @@ -870,11 +587,6 @@ API_EXPORT(int) ap_bread(BUFF *fb, void *buf, int nbyte) fb->incnt = i; if (i > nbyte) i = nbyte; -#ifdef CHARSET_EBCDIC - if (fb->flags & B_ASCII2EBCDIC) - ascii2ebcdic(buf, fb->inptr, i); - else -#endif /*CHARSET_EBCDIC*/ memcpy(buf, fb->inptr, i); fb->incnt -= i; fb->inptr += i; @@ -935,10 +647,6 @@ API_EXPORT(int) ap_bgets(char *buff, int n, BUFF *fb) } ch = fb->inptr[i++]; -#ifdef CHARSET_EBCDIC - if (fb->flags & B_ASCII2EBCDIC) - ch = os_toebcdic[(unsigned char)ch]; -#endif if (ch == LF) { /* got LF */ if (ct == 0) buff[ct++] = '\n'; @@ -997,13 +705,7 @@ API_EXPORT(int) ap_blookc(char *buff, BUFF *fb) fb->incnt = i; } -#ifndef CHARSET_EBCDIC *buff = fb->inptr[0]; -#else /*CHARSET_EBCDIC*/ - *buff = (fb->flags & B_ASCII2EBCDIC) - ? os_toebcdic[(unsigned char)fb->inptr[0]] - : fb->inptr[0]; -#endif /*CHARSET_EBCDIC*/ return 1; } @@ -1217,10 +919,6 @@ static int bcwrite(BUFF *fb, const void *buf, int nbyte) /* without writev() this has poor performance, too bad */ ap_snprintf(chunksize, sizeof(chunksize), "%x" CRLF, nbyte); -#ifdef CHARSET_EBCDIC - /* Chunks are an HTTP/1.1 Protocol feature. They must ALWAYS be in ASCII */ - ebcdic2ascii(chunksize, chunksize, strlen(chunksize)); -#endif /*CHARSET_EBCDIC*/ if (write_it_all(fb, chunksize, strlen(chunksize)) == -1) return -1; if (write_it_all(fb, buf, nbyte) == -1) @@ -1232,10 +930,6 @@ static int bcwrite(BUFF *fb, const void *buf, int nbyte) vec[0].iov_base = chunksize; vec[0].iov_len = ap_snprintf(chunksize, sizeof(chunksize), "%x" CRLF, nbyte); -#ifdef CHARSET_EBCDIC - /* Chunks are an HTTP/1.1 Protocol feature. They must ALWAYS be in ASCII */ - ebcdic2ascii(chunksize, chunksize, strlen(chunksize)); -#endif /*CHARSET_EBCDIC*/ vec[1].iov_base = (void *) buf; /* cast is to avoid const warning */ vec[1].iov_len = nbyte; vec[2].iov_base = ascii_CRLF; @@ -1271,10 +965,6 @@ static int large_write(BUFF *fb, const void *buf, int nbyte) vec[nvec].iov_base = chunksize; vec[nvec].iov_len = ap_snprintf(chunksize, sizeof(chunksize), "%x" CRLF, nbyte); -#ifdef CHARSET_EBCDIC - /* Chunks are an HTTP/1.1 Protocol feature. They must ALWAYS be in ASCII */ - ebcdic2ascii(chunksize, chunksize, strlen(chunksize)); -#endif /*CHARSET_EBCDIC*/ ++nvec; vec[nvec].iov_base = (void *) buf; vec[nvec].iov_len = nbyte; @@ -1311,32 +1001,12 @@ static int large_write(BUFF *fb, const void *buf, int nbyte) API_EXPORT(int) ap_bwrite(BUFF *fb, const void *buf, int nbyte) { int i, nwr, useable_bufsiz; -#ifdef CHARSET_EBCDIC - static char *cbuf = NULL; - static int csize = 0; -#endif /*CHARSET_EBCDIC*/ if (fb->flags & (B_WRERR | B_EOUT)) return -1; if (nbyte == 0) return 0; -#ifdef CHARSET_EBCDIC - if (ap_bgetflag(fb, B_EBCDIC2ASCII)) { - if (nbyte > csize) { - if (cbuf != NULL) - free(cbuf); - cbuf = malloc(csize = nbyte+HUGE_STRING_LEN); - if (cbuf == NULL) { - fprintf(stderr, "Ouch! Out of memory in ap_bwrite()!\n"); - csize = 0; - } - } - ebcdic2ascii((cbuf) ? cbuf : (void*)buf, buf, nbyte); - buf = (cbuf) ? cbuf : buf; - } -#endif /*CHARSET_EBCDIC*/ - if (!(fb->flags & B_WR)) { /* unbuffered write -- have to use bcwrite since we aren't taking care * of chunking any other way */ @@ -1525,13 +1195,6 @@ API_EXPORT(int) ap_bclose(BUFF *fb) rc3 = 0; } } else { -#if defined(WIN32) - if (fb->hFH != INVALID_HANDLE_VALUE) { - rc2 = ap_pcloseh(fb->pool, fb->hFH); - rc3 = 0; - } - else { -#endif rc2 = ap_pclosef(fb->pool, fb->fd); if (fb->fd_in != fb->fd) { rc3 = ap_pclosef(fb->pool, fb->fd_in); @@ -1540,9 +1203,6 @@ API_EXPORT(int) ap_bclose(BUFF *fb) rc3 = 0; } } -#if defined(WIN32) - } -#endif fb->inptr = fb->inbase; fb->incnt = 0; @@ -1623,13 +1283,6 @@ static int bprintf_flush(ap_vformatter_buff *vbuff) struct bprintf_data *b = (struct bprintf_data *)vbuff; BUFF *fb = b->fb; -#ifdef CHARSET_EBCDIC - /* Characters were pushed into the buffer without conversion. Do it now */ - if (fb->flags & B_EBCDIC2ASCII) - ebcdic2ascii(&fb->outbase[fb->outcnt], - &fb->outbase[fb->outcnt], - b->vbuff.curpos - (char *)&fb->outbase[fb->outcnt]); -#endif /*CHARSET_EBCDIC*/ fb->outcnt += b->vbuff.curpos - (char *)&fb->outbase[fb->outcnt]; if (fb->outcnt == fb->bufsiz) { if (ap_bflush(fb)) { @@ -1657,13 +1310,6 @@ API_EXPORT_NONSTD(int) ap_bprintf(BUFF *fb, const char *fmt, ...) res = ap_vformatter(bprintf_flush, &b.vbuff, fmt, ap); va_end(ap); if (res != -1) { -#ifdef CHARSET_EBCDIC - /* Characters were pushed into the buffer without conversion. Do it now */ - if (fb->flags & B_EBCDIC2ASCII) - ebcdic2ascii(&fb->outbase[fb->outcnt], - &fb->outbase[fb->outcnt], - b.vbuff.curpos - (char *)&fb->outbase[fb->outcnt]); -#endif /*CHARSET_EBCDIC*/ fb->outcnt += b.vbuff.curpos - (char *)&fb->outbase[fb->outcnt]; } return res; @@ -1682,13 +1328,6 @@ API_EXPORT(int) ap_vbprintf(BUFF *fb, const char *fmt, va_list ap) b.fb = fb; res = ap_vformatter(bprintf_flush, &b.vbuff, fmt, ap); if (res != -1) { -#ifdef CHARSET_EBCDIC - /* Characters were pushed into the buffer without conversion. Do it now */ - if (fb->flags & B_EBCDIC2ASCII) - ebcdic2ascii(&fb->outbase[fb->outcnt], - &fb->outbase[fb->outcnt], - b.vbuff.curpos - (char *)&fb->outbase[fb->outcnt]); -#endif /*CHARSET_EBCDIC*/ fb->outcnt += b.vbuff.curpos - (char *)&fb->outbase[fb->outcnt]; } return res; diff --git a/usr.sbin/httpd/src/main/gen_test_char.c b/usr.sbin/httpd/src/main/gen_test_char.c index d310dc55624..10d5360249c 100644 --- a/usr.sbin/httpd/src/main/gen_test_char.c +++ b/usr.sbin/httpd/src/main/gen_test_char.c @@ -40,23 +40,9 @@ int main(int argc, char *argv[]) flags = 0; /* escape_shell_cmd */ -#if defined(WIN32) || defined(OS2) - /* Win32/OS2 have many of the same vulnerable characters - * as Unix sh, plus the carriage return and percent char. - * The proper escaping of these characters varies from unix - * since Win32/OS2 use carets or doubled-double quotes, - * and neither lf nor cr can be escaped. We escape unix - * specific as well, to assure that cross-compiled unix - * applications behave similiarly when invoked on win32/os2. - */ - if (strchr("&;`'\"|*?~<>^()[]{}$\\\n\r%", c)) { - flags |= T_ESCAPE_SHELL_CMD; - } -#else if (strchr("&;`'\"|*?~<>^()[]{}$\\\n", c)) { flags |= T_ESCAPE_SHELL_CMD; } -#endif if (!ap_isalnum(c) && !strchr("$-_.+!*'(),:@&=~", c)) { flags |= T_ESCAPE_PATH_SEGMENT; diff --git a/usr.sbin/httpd/src/main/http_config.c b/usr.sbin/httpd/src/main/http_config.c index 52a1acb1688..6ed4c3114f9 100644 --- a/usr.sbin/httpd/src/main/http_config.c +++ b/usr.sbin/httpd/src/main/http_config.c @@ -1,4 +1,4 @@ -/* $OpenBSD: http_config.c,v 1.14 2003/08/21 13:11:35 henning Exp $ */ +/* $OpenBSD: http_config.c,v 1.15 2004/12/02 19:42:47 henning Exp $ */ /* ==================================================================== * The Apache Software License, Version 1.1 @@ -557,11 +557,7 @@ API_EXPORT(void) ap_add_module(module *m) fprintf(stderr, "%s: module \"%s\" is not compatible with this " "version of Apache.\n", ap_server_argv0, m->name); fprintf(stderr, "Please contact the vendor for the correct version.\n"); -#ifdef NETWARE - clean_parent_exit(1); -#else exit(1); -#endif } if (m->next == NULL) { @@ -577,11 +573,7 @@ API_EXPORT(void) ap_add_module(module *m) " the dynamic\n", ap_server_argv0, m->name); fprintf(stderr, "module limit was reached. Please increase " "DYNAMIC_MODULE_LIMIT and recompile.\n"); -#ifdef NETWARE - clean_parent_exit(1); -#else exit(1); -#endif } } @@ -595,15 +587,6 @@ API_EXPORT(void) ap_add_module(module *m) if (strrchr(m->name, '\\')) m->name = 1 + strrchr(m->name, '\\'); -#ifdef _OSD_POSIX /* __FILE__="*POSIX(/home/martin/apache/src/modules/standard/mod_info.c)" */ - /* We cannot fix the string in-place, because it's const */ - if (m->name[strlen(m->name)-1]==')') { - char *tmp = strdup(m->name); /* FIXME:memory leak, albeit a small one */ - tmp[strlen(tmp)-1] = '\0'; - m->name = tmp; - } -#endif /*_OSD_POSIX*/ - #ifdef EAPI /* * Invoke the `add_module' hook inside the now existing set @@ -748,11 +731,7 @@ API_EXPORT(void) ap_setup_prelinked_modules(void) sizeof(module *)*(total_modules+DYNAMIC_MODULE_LIMIT+1)); if (ap_loaded_modules == NULL) { fprintf(stderr, "Ouch! Out of memory in ap_setup_prelinked_modules()!\n"); -#ifdef NETWARE - clean_parent_exit(1); -#else exit(1); -#endif } for (m = ap_preloaded_modules, m2 = ap_loaded_modules; *m != NULL; ) *m2++ = *m++; @@ -1145,9 +1124,7 @@ API_EXPORT_NONSTD(const char *) ap_set_file_slot(cmd_parms *cmd, char *struct_pt so the server can be moved or mirrored with less pain. */ char *p; int offset = (int) (long) cmd->info; -#ifndef OS2 arg = ap_os_canonical_filename(cmd->pool, arg); -#endif if (ap_os_is_path_absolute(arg)) p = arg; else @@ -1166,9 +1143,7 @@ static cmd_parms default_parms = API_EXPORT(char *) ap_server_root_relative(pool *p, char *file) { -#ifndef OS2 file = ap_os_canonical_filename(p, file); -#endif if(ap_os_is_path_absolute(file)) return file; return ap_make_full_path(p, ap_server_root, file); @@ -1238,11 +1213,7 @@ static void process_command_config(server_rec *s, array_header *arr, pool *p, if (errmsg) { fprintf(stderr, "Syntax error in -C/-c directive:\n%s\n", errmsg); -#ifdef NETWARE - clean_parent_exit(1); -#else exit(1); -#endif } ap_cfg_closefile(parms.config_file); @@ -1332,11 +1303,7 @@ CORE_EXPORT(void) ap_process_resource_config(server_rec *s, char *fname, pool *p perror("fopen"); fprintf(stderr, "%s: could not open config directory %s\n", ap_server_argv0, path); -#ifdef NETWARE - clean_parent_exit(1); -#else exit(1); -#endif } candidates = ap_make_array(p, 1, sizeof(fnames)); while ((dir_entry = readdir(dirp)) != NULL) { @@ -1378,11 +1345,7 @@ CORE_EXPORT(void) ap_process_resource_config(server_rec *s, char *fname, pool *p perror("fopen"); fprintf(stderr, "%s: could not open document config file %s\n", ap_server_argv0, fname); -#ifdef NETWARE - clean_parent_exit(1); -#else exit(1); -#endif } errmsg = ap_srm_command_loop(&parms, s->lookup_defaults); @@ -1391,11 +1354,7 @@ CORE_EXPORT(void) ap_process_resource_config(server_rec *s, char *fname, pool *p fprintf(stderr, "Syntax error on line %d of %s:\n", parms.config_file->line_number, parms.config_file->name); fprintf(stderr, "%s\n", errmsg); -#ifdef NETWARE - clean_parent_exit(1); -#else exit(1); -#endif } ap_cfg_closefile(parms.config_file); @@ -1841,10 +1800,8 @@ API_EXPORT(void) ap_show_modules(void) for (n = 0; ap_loaded_modules[n]; ++n) { printf(" %s\n", ap_loaded_modules[n]->name); } -#if !defined(WIN32) && !defined(NETWARE) && !defined(TPF) printf("suexec: %s\n", ap_suexec_enabled ? "enabled; valid wrapper " SUEXEC_BIN : "disabled; invalid wrapper " SUEXEC_BIN); -#endif } diff --git a/usr.sbin/httpd/src/main/http_core.c b/usr.sbin/httpd/src/main/http_core.c index cbf71be830b..62794a0cf9e 100644 --- a/usr.sbin/httpd/src/main/http_core.c +++ b/usr.sbin/httpd/src/main/http_core.c @@ -1,4 +1,4 @@ -/* $OpenBSD: http_core.c,v 1.18 2004/07/31 20:01:55 brad Exp $ */ +/* $OpenBSD: http_core.c,v 1.19 2004/12/02 19:42:47 henning Exp $ */ /* ==================================================================== * The Apache Software License, Version 1.1 @@ -87,13 +87,9 @@ * the benefit for small files. It shouldn't be set lower than 1. */ #ifndef MMAP_THRESHOLD -#ifdef SUNOS4 -#define MMAP_THRESHOLD (8*1024) -#else #define MMAP_THRESHOLD 1 #endif #endif -#endif #ifndef MMAP_LIMIT #define MMAP_LIMIT (4*1024*1024) #endif @@ -152,26 +148,12 @@ static void *create_core_dir_config(pool *a, char *dir) conf->limit_req_body = 0; conf->sec = ap_make_array(a, 2, sizeof(void *)); -#ifdef WIN32 - conf->script_interpreter_source = INTERPRETER_SOURCE_UNSET; -#endif conf->server_signature = srv_sig_unset; conf->add_default_charset = ADD_DEFAULT_CHARSET_UNSET; conf->add_default_charset_name = DEFAULT_ADD_DEFAULT_CHARSET_NAME; -#ifdef CHARSET_EBCDIC - conf->ebcdicconversion_by_ext_in = ap_make_table(a, 4); - conf->ebcdicconversion_by_ext_out = ap_make_table(a, 4); - conf->ebcdicconversion_by_type_in = ap_make_table(a, 4); - conf->ebcdicconversion_by_type_out = ap_make_table(a, 4); - conf->x_ascii_magic_kludge = 0; -#if ADD_EBCDICCONVERT_DEBUG_HEADER - conf->ebcdicconversion_debug_header = 0; -#endif -#endif /* CHARSET_EBCDIC */ - /* * Flag for use of inodes in ETags. */ @@ -299,11 +281,6 @@ static void *merge_core_dir_configs(pool *a, void *basev, void *newv) conf->satisfy = new->satisfy; } -#ifdef WIN32 - if (new->script_interpreter_source != INTERPRETER_SOURCE_UNSET) { - conf->script_interpreter_source = new->script_interpreter_source; - } -#endif if (new->server_signature != srv_sig_unset) { conf->server_signature = new->server_signature; @@ -316,21 +293,6 @@ static void *merge_core_dir_configs(pool *a, void *basev, void *newv) } } -#ifdef CHARSET_EBCDIC - conf->ebcdicconversion_by_ext_in = ap_overlay_tables(a, new->ebcdicconversion_by_ext_in, - base->ebcdicconversion_by_ext_in); - conf->ebcdicconversion_by_ext_out = ap_overlay_tables(a, new->ebcdicconversion_by_ext_out, - base->ebcdicconversion_by_ext_out); - conf->ebcdicconversion_by_type_in = ap_overlay_tables(a, new->ebcdicconversion_by_type_in, - base->ebcdicconversion_by_type_in); - conf->ebcdicconversion_by_type_out = ap_overlay_tables(a, new->ebcdicconversion_by_type_out, - base->ebcdicconversion_by_type_out); - conf->x_ascii_magic_kludge = new->x_ascii_magic_kludge ? new->x_ascii_magic_kludge : base->x_ascii_magic_kludge; -#if ADD_EBCDICCONVERT_DEBUG_HEADER - conf->ebcdicconversion_debug_header = new->ebcdicconversion_debug_header ? new->ebcdicconversion_debug_header : base->ebcdicconversion_debug_header; -#endif -#endif /* CHARSET_EBCDIC */ - /* * Now merge the setting of the FileETag directive. */ @@ -902,227 +864,6 @@ API_EXPORT(unsigned long) ap_get_limit_req_body(const request_rec *r) return d->limit_req_body; } -#ifdef WIN32 -static char* get_interpreter_from_win32_registry(pool *p, const char* ext) -{ - char extension_path[] = "SOFTWARE\\Classes\\"; - char executable_path[] = "\\SHELL\\OPEN\\COMMAND"; - - HKEY hkeyOpen; - DWORD type; - int size; - int result; - char *keyName; - char *buffer; - char *s; - - if (!ext) - return NULL; - /* - * Future optimization: - * When the registry is successfully searched, store the interpreter - * string in a table to make subsequent look-ups faster - */ - - /* Open the key associated with the script extension */ - keyName = ap_pstrcat(p, extension_path, ext, NULL); - - result = RegOpenKeyEx(HKEY_LOCAL_MACHINE, keyName, 0, KEY_QUERY_VALUE, - &hkeyOpen); - - if (result != ERROR_SUCCESS) - return NULL; - - /* Read to NULL buffer to find value size */ - size = 0; - result = RegQueryValueEx(hkeyOpen, "", NULL, &type, NULL, &size); - - if (result == ERROR_SUCCESS) { - buffer = ap_palloc(p, size); - result = RegQueryValueEx(hkeyOpen, "", NULL, &type, buffer, &size); - } - - RegCloseKey(hkeyOpen); - - if (result != ERROR_SUCCESS) - return NULL; - - /* Open the key associated with the interpreter path */ - keyName = ap_pstrcat(p, extension_path, buffer, executable_path, NULL); - - result = RegOpenKeyEx(HKEY_LOCAL_MACHINE, keyName, 0, KEY_QUERY_VALUE, - &hkeyOpen); - - if (result != ERROR_SUCCESS) - return NULL; - - /* Read to NULL buffer to find value size */ - size = 0; - result = RegQueryValueEx(hkeyOpen, "", 0, &type, NULL, &size); - - if (result == ERROR_SUCCESS) { - buffer = ap_palloc(p, size); - result = RegQueryValueEx(hkeyOpen, "", 0, &type, buffer, &size); - } - - RegCloseKey(hkeyOpen); - - if (result != ERROR_SUCCESS) - return NULL; - - /* - * The command entry may contain embedded %envvar% entries, - * e.g. %winsysdir%\somecommand.exe %1 - * - * Resolve them here - */ - size = ExpandEnvironmentStrings(buffer, NULL, 0); - if (size) { - s = ap_palloc(p, size); - if (ExpandEnvironmentStrings(buffer, s, size)) - buffer = s; - } - - /* - * The canonical way shell command entries are entered in the Win32 - * registry is as follows: - * shell [options] "%1" [options] [%*] - * where - * shell - full path name to interpreter or shell to run. - * E.g., c:\usr\local\ntreskit\perl\bin\perl.exe - * options - optional switches - * E.g., /C or -w - * "%1" - Place holder for file to run the shell against. - * Quoted for if long path names are accepted. - * Not quoted if only short paths are acceptd - * - * %* - additional arguments - * - * Effective in v. 1.3.15, the responsibility is the consumer's - * to make these substitutions. - */ - - return buffer; -} - -API_EXPORT (file_type_e) ap_get_win32_interpreter(const request_rec *r, - char** interpreter ) -{ - HANDLE hFile; - DWORD nBytesRead; - BOOLEAN bResult; - char buffer[1024]; - core_dir_config *d; - int i; - file_type_e fileType = eFileTypeUNKNOWN; - char *ext = NULL; - char *exename = NULL; - - d = (core_dir_config *)ap_get_module_config(r->per_dir_config, - &core_module); - - /* Find the file extension */ - exename = strrchr(r->filename, '/'); - if (!exename) { - exename = strrchr(r->filename, '\\'); - } - if (!exename) { - exename = r->filename; - } - else { - exename++; - } - ext = strrchr(exename, '.'); - - if (ext && (!strcasecmp(ext,".bat") || !strcasecmp(ext,".cmd"))) - { - char *p, *shellcmd = getenv("COMSPEC"); - if (!shellcmd) - return eFileTypeUNKNOWN; - p = strchr(shellcmd, '\0'); - if ((p - shellcmd >= 11) && !strcasecmp(p - 11, "command.com")) - { - /* Command.com doesn't like long paths, doesn't do .cmd - */ - if (!strcasecmp(ext,".cmd")) - return eFileTypeUNKNOWN; - *interpreter = ap_pstrcat(r->pool, "\"", shellcmd, "\" /C %1", NULL); - return eCommandShell16; - } - else { - /* Assume any other likes long paths, and knows .cmd, - * but the entire /c arg should be double quoted, e.g. - * "c:\path\cmd.exe" /c ""prog" "arg" "arg"" - */ - *interpreter = ap_pstrcat(r->pool, "\"", shellcmd, "\" /C \"\"%1\" %*\"", NULL); - return eCommandShell32; - } - } - - /* If the file has an extension and it is not .com and not .exe and - * we've been instructed to search the registry, then do it! - */ - if (ext && strcasecmp(ext,".exe") && strcasecmp(ext,".com") && - d->script_interpreter_source == INTERPRETER_SOURCE_REGISTRY) { - /* Check the registry */ - *interpreter = get_interpreter_from_win32_registry(r->pool, ext); - if (*interpreter) - return eFileTypeSCRIPT; - else { - ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_INFO, r->server, - "ScriptInterpreterSource config directive set to \"registry\".\n\t" - "Registry was searched but interpreter not found. Trying the shebang line."); - } - } - - /* Need to peek into the file figure out what it really is... */ - hFile = CreateFile(r->filename, GENERIC_READ, FILE_SHARE_READ, NULL, - OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); - if (hFile == INVALID_HANDLE_VALUE) { - return eFileTypeUNKNOWN; - } - bResult = ReadFile(hFile, (void*) &buffer, sizeof(buffer) - 1, - &nBytesRead, NULL); - if (!bResult || (nBytesRead == 0)) { - ap_log_rerror(APLOG_MARK, APLOG_ERR, r, - "ReadFile(%s) failed", r->filename); - CloseHandle(hFile); - return eFileTypeUNKNOWN; - } - CloseHandle(hFile); - buffer[nBytesRead] = '\0'; - - /* Script or executable, that is the question... */ - if ((buffer[0] == '#') && (buffer[1] == '!')) { - /* Assuming file is a script since it starts with a shebang */ - fileType = eFileTypeSCRIPT; - for (i = 2; i < (sizeof(buffer) - 1); i++) { - if ((buffer[i] == '\r') - || (buffer[i] == '\n')) { - break; - } - } - buffer[i] = '\0'; - for (i = 2; buffer[i] == ' ' ; ++i) - ; - *interpreter = ap_pstrdup(r->pool, buffer + i ); - } - else { - /* Not a script, is it an executable? */ - IMAGE_DOS_HEADER *hdr = (IMAGE_DOS_HEADER*)buffer; - if ((nBytesRead >= sizeof(IMAGE_DOS_HEADER)) && (hdr->e_magic == IMAGE_DOS_SIGNATURE)) { - if (hdr->e_lfarlc < 0x40) - fileType = eFileTypeEXE16; - else - fileType = eFileTypeEXE32; - } - else - fileType = eFileTypeUNKNOWN; - } - - return fileType; -} -#endif /***************************************************************** * @@ -1555,11 +1296,7 @@ static const char *missing_endsection(cmd_parms *cmd, int nest) * people don't get bitten by wrong-cased regex matches */ -#ifdef WIN32 -#define USE_ICASE REG_ICASE -#else #define USE_ICASE 0 -#endif static const char *end_nested_section(cmd_parms *cmd, void *dummy) { @@ -2142,11 +1879,6 @@ static const char *set_send_buffer_size(cmd_parms *cmd, void *dummy, char *arg) static const char *set_user(cmd_parms *cmd, void *dummy, char *arg) { -#ifdef WIN32 - ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_NOTICE, cmd->server, - "User directive has no affect on Win32"); - cmd->server->server_uid = ap_user_id = 1; -#else const char *err = ap_check_cmd_context(cmd, NOT_IN_DIR_LOC_FILE|NOT_IN_LIMIT); if (err != NULL) { return err; @@ -2198,7 +1930,6 @@ static const char *set_user(cmd_parms *cmd, void *dummy, char *arg) exit (1); } #endif -#endif /* WIN32 */ return NULL; } @@ -2442,18 +2173,12 @@ static const char *set_use_canonical_name(cmd_parms *cmd, core_dir_config *d, static const char *set_daemons_to_start(cmd_parms *cmd, void *dummy, char *arg) { -#ifdef WIN32 - fprintf(stderr, "WARNING: StartServers has no effect on Win32\n"); -#elif defined(NETWARE) - fprintf(stderr, "WARNING: StartServers has no effect on NetWare\n"); -#else const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY); if (err != NULL) { return err; } ap_daemons_to_start = atoi(arg); -#endif return NULL; } @@ -2665,18 +2390,6 @@ static const char *set_bind_address(cmd_parms *cmd, void *dummy, char *arg) return NULL; } -#ifdef NETWARE -static const char *set_threadstacksize(cmd_parms *cmd, void *dummy, char *stacksize) -{ - const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY); - if (err != NULL) { - return err; - } - - ap_thread_stack_size = atoi(stacksize); - return NULL; -} -#endif /* Though the AcceptFilter functionality is not available across * all platforms - we still allow the config directive to appear @@ -2895,18 +2608,6 @@ static const char *set_authnonce (cmd_parms *cmd, void *mconfig, char *word1) } -#ifdef _OSD_POSIX /* BS2000 Logon Passwd file */ -static const char *set_bs2000_account(cmd_parms *cmd, void *dummy, char *name) -{ - const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY); - if (err != NULL) { - return err; - } - - return os_set_account(cmd->pool, name); -} -#endif /*_OSD_POSIX*/ - static const char *set_protocol_req_check(cmd_parms *cmd, core_dir_config *d, int arg) { @@ -3047,22 +2748,6 @@ static const char *set_limit_req_body(cmd_parms *cmd, core_dir_config *conf, return NULL; } -#ifdef WIN32 -static const char *set_interpreter_source(cmd_parms *cmd, core_dir_config *d, - char *arg) -{ - if (!strcasecmp(arg, "registry")) { - d->script_interpreter_source = INTERPRETER_SOURCE_REGISTRY; - } else if (!strcasecmp(arg, "script")) { - d->script_interpreter_source = INTERPRETER_SOURCE_SHEBANG; - } else { - return ap_pstrcat(cmd->temp_pool, "ScriptInterpreterSource \"", arg, - "\" must be \"registry\" or \"script\"", - NULL); - } - return NULL; -} -#endif static const char *set_cgi_command_args(cmd_parms *cmd, void *mconfig, @@ -3073,122 +2758,6 @@ static const char *set_cgi_command_args(cmd_parms *cmd, return NULL; } -#ifdef CHARSET_EBCDIC - -typedef struct { - char conv_out[2]; - char conv_in[2]; -} parsed_conf_t; - -/* Check for conversion syntax: { On | Off } [ = { In | Out | InOut } ] */ -static parsed_conf_t * -parse_on_off_in_out(pool *p, char *arg) -{ - static parsed_conf_t ret = { { conv_Unset, '\0' }, { conv_Unset, '\0' } }; - char *onoff = ap_getword_nc(p, &arg, '='); - int in = 0, out = 0, inout = 0; - char conv_val; - - /* Check for valid syntax: { On | Off } [ = { In | Out | InOut } ] */ - if (strcasecmp(onoff, "On") == 0) - conv_val = conv_On; - else if (strcasecmp(onoff, "Off") == 0) - conv_val = conv_Off; - else - return NULL; - - /* Check the syntax, and at the same time assign the test results */ - if (!(inout = (*arg == '\0')) && - !(in = (strcasecmp(arg, "In") == 0)) && - !(out = (strcasecmp(arg, "Out") == 0)) && - !(inout = (strcasecmp(arg, "InOut") == 0))) { - /* Invalid string, not conforming to syntax! */ - return NULL; - } - - ret.conv_in[0] = (in || inout) ? conv_val : conv_Unset; - ret.conv_out[0] = (out || inout) ? conv_val : conv_Unset; - - return &ret; -} - - -/* Handle the EBCDICConvert directive: - * EBCDICConvert {On|Off}[={In|Out|InOut}] ext ... - */ -static const char * -add_conversion_by_ext(cmd_parms *cmd, core_dir_config *m, - char *onoff, char *ext) -{ - parsed_conf_t *onoff_code = parse_on_off_in_out(cmd->pool, onoff); - - if (onoff_code == NULL) - return "Invalid syntax: use EBCDICConvert {On|Off}[={In|Out|InOut}] ext [...]"; - - if (*ext == '.') - ++ext; - - if (*onoff_code->conv_in != conv_Unset) - ap_table_addn(m->ebcdicconversion_by_ext_in, ext, - ap_pstrndup(cmd->pool, onoff_code->conv_in, 1)); - if (*onoff_code->conv_out != conv_Unset) - ap_table_addn(m->ebcdicconversion_by_ext_out, ext, - ap_pstrndup(cmd->pool, onoff_code->conv_out, 1)); - - return NULL; -} - - -/* Handle the EBCDICConvertByType directive: - * EBCDICConvertByType {On|Off}[={In|Out|InOut}] mimetype ... - */ -static const char * -add_conversion_by_type(cmd_parms *cmd, core_dir_config *m, - char *onoff, char *type) -{ - parsed_conf_t *onoff_code = parse_on_off_in_out(cmd->pool, onoff); - - if (onoff_code == NULL) - return "Invalid syntax: use EBCDICConvertByType {On|Off}[={In|Out|InOut}] mimetype [...]"; - - if (*onoff_code->conv_in != conv_Unset) - ap_table_addn(m->ebcdicconversion_by_type_in, type, - ap_pstrndup(cmd->pool, onoff_code->conv_in, 1)); - if (*onoff_code->conv_out != conv_Unset) - ap_table_addn(m->ebcdicconversion_by_type_out, type, - ap_pstrndup(cmd->pool, onoff_code->conv_out, 1)); - - return NULL; -} - - -/* Handle the EBCDICKludge directive: - * EBCDICKludge {On|Off} - */ -#ifdef LEGACY_KLUDGE -static const char * -set_x_ascii_kludge(cmd_parms *cmd, core_dir_config *m, int arg) -{ - m->x_ascii_magic_kludge = arg; - - return NULL; -} -#endif - -#if ADD_EBCDICCONVERT_DEBUG_HEADER -/* Handle the EBCDICDebugHeader directive: - * EBCDICDebugHeader {On|Off} - */ -static const char * -set_debug_header(cmd_parms *cmd, core_dir_config *m, int arg) -{ - m->ebcdicconversion_debug_header = arg; - - return NULL; -} -#endif -#endif /* CHARSET_EBCDIC */ - /* * Note what data should be used when forming file ETag values. * It would be nicer to do this as an ITERATE, but then we couldn't @@ -3632,10 +3201,6 @@ static const command_rec core_cmds[] = { OR_ALL, TAKE12, "soft/hard limits for max number of processes per uid" }, { "BindAddress", set_bind_address, NULL, RSRC_CONF, TAKE1, "'*', a numeric IP address, or the name of a host with a unique IP address"}, -#ifdef NETWARE -{ "ThreadStackSize", set_threadstacksize, NULL, RSRC_CONF, TAKE1, - "Stack size each created thread will use."}, -#endif { "Listen", set_listener, NULL, RSRC_CONF, TAKE1, "A port number or a numeric IP address and a port number"}, { "SendBufferSize", set_send_buffer_size, NULL, RSRC_CONF, TAKE1, @@ -3672,14 +3237,6 @@ static const command_rec core_cmds[] = { "Level of verbosity in error logging" }, { "NameVirtualHost", ap_set_name_virtual_host, NULL, RSRC_CONF, TAKE1, "A numeric IP address:port, or the name of a host" }, -#ifdef _OSD_POSIX -{ "BS2000Account", set_bs2000_account, NULL, RSRC_CONF, TAKE1, - "Name of server User's bs2000 logon account name" }, -#endif -#ifdef WIN32 -{ "ScriptInterpreterSource", set_interpreter_source, NULL, OR_FILEINFO, TAKE1, - "Where to find interpreter to run Win32 scripts - Registry or Script (shebang line)" }, -#endif { "CGICommandArgs", set_cgi_command_args, NULL, OR_OPTIONS, FLAG, "Allow or Disallow CGI requests to pass args on the command line" }, { "ServerTokens", set_serv_tokens, NULL, RSRC_CONF, TAKE1, @@ -3715,37 +3272,12 @@ static const command_rec core_cmds[] = { #ifdef HAVE_FLOCK_SERIALIZED_ACCEPT "'flock' " #endif -#ifdef HAVE_OS2SEM_SERIALIZED_ACCEPT - "'os2sem' " -#endif -#ifdef HAVE_TPF_CORE_SERIALIZED_ACCEPT - "'tpfcore' " -#endif -#ifdef HAVE_BEOS_SERIALIZED_ACCEPT - "'beos_sem' " -#endif #ifdef HAVE_NONE_SERIALIZED_ACCEPT "'none' " #endif "are compiled in" }, -/* EBCDIC Conversion directives: */ -#ifdef CHARSET_EBCDIC -{ "EBCDICConvert", add_conversion_by_ext, NULL, OR_FILEINFO, ITERATE2, - "{On|Off}[={In|Out|InOut}] followed by one or more file extensions" }, -{ "EBCDICConvertByType", add_conversion_by_type, NULL, OR_FILEINFO, ITERATE2, - "{On|Off}[={In|Out|InOut}] followed by one or more MIME types" }, -#ifdef LEGACY_KLUDGE -{ "EBCDICKludge", set_x_ascii_kludge, NULL, OR_FILEINFO, FLAG, - "'On': enable or default='Off': disable the old text/x-ascii-mimetype kludge" }, -#endif -#if ADD_EBCDICCONVERT_DEBUG_HEADER -{ "EBCDICDebugHeader", set_debug_header, NULL, OR_FILEINFO, FLAG, - "'On': enable or default='Off': disable the EBCDIC Debugging MIME Header" }, -#endif -#endif /* CHARSET_EBCDIC */ - { "FileETag", set_etag_bits, NULL, OR_FILEINFO, RAW_ARGS, "Specify components used to construct a file's ETag"}, @@ -3804,259 +3336,6 @@ static int core_translate(request_rec *r) static int do_nothing(request_rec *r) { return OK; } -#ifdef CHARSET_EBCDIC -struct do_mime_match_parms { - request_rec *request; /* [In] current request_rec */ - int direction; /* [In] determine conversion for: dir_In|dir_Out */ - const char *content_type; /* [In] Content-Type (dir_In: from MIME Header, else r->content_type) */ - int match_found; /* [Out] nonzero if a match was found */ - int conv; /* [Out] conversion setting if match was found */ -}; - - -/* This routine is called for each mime type configured by the - * EBCDICConvertByType directive. - */ -static int -do_mime_match(void *rec, const char *key, const char *val) -{ - int conv = (val[0] == conv_On); - const char *content_type; -#if ADD_EBCDICCONVERT_DEBUG_HEADER - request_rec *r = ((struct do_mime_match_parms *) rec)->request; -#endif - - ((struct do_mime_match_parms *) rec)->match_found = 0; - ((struct do_mime_match_parms *) rec)->conv = conv_Unset; - - content_type = ((struct do_mime_match_parms *) rec)->content_type; - - /* If no type set: no need to continue */ - if (content_type == NULL) - return 0; - - /* If the MIME type matches, set the conversion flag appropriately */ - if ((ap_is_matchexp(key) && ap_strcasecmp_match(content_type, key) == 0) - || (strcasecmp(key, content_type) == 0)) { - - ((struct do_mime_match_parms *) rec)->match_found = 1; - ((struct do_mime_match_parms *) rec)->conv = conv; - -#if ADD_EBCDICCONVERT_DEBUG_HEADER - ap_table_setn(r->headers_out, - ((((struct do_mime_match_parms *) rec)->direction) == dir_In) - ? "X-EBCDIC-Debug-In" : "X-EBCDIC-Debug-Out", - ap_psprintf(r->pool, "EBCDICConversionByType %s %s", - conv ? "On" : "Off", - key)); -#endif - - /* the mime type scan stops at the first match. */ - return 0; - } - - return 1; -} - -static void -ap_checkconv_dir(request_rec *r, const char **pType, int dir) -{ - core_dir_config *conf = - (core_dir_config *) ap_get_module_config(r->per_dir_config, &core_module); - table *conv_by_ext, *conv_by_type; - const char *type, *conversion; - char *ext; - int conv_valid = 0, conv; - - conv_by_ext = (dir == dir_In) ? conf->ebcdicconversion_by_ext_in : conf->ebcdicconversion_by_ext_out; - conv_by_type = (dir == dir_In) ? conf->ebcdicconversion_by_type_in : conf->ebcdicconversion_by_type_out; - - type = (*pType == NULL) ? ap_default_type(r) : *pType; - - /* Pseudo "loop" which is executed once only, with break's at individual steps */ - do { - /* Step 0: directories result in redirections or in directory listings. - * Both are EBCDIC text documents. - * @@@ Should we check for the handler instead? - */ - if (S_ISDIR(r->finfo.st_mode) && dir == dir_Out) { - conv = conv_valid = 1; - break; - } - - /* 1st step: check the binding on file extension. This allows us to - * override the conversion default based on a specific name. - * For instance, the following would allow some HTML files - * to be converted (.html) and others passed unconverted (.ahtml): - * AddType text/html .html .ahtml - * EBCDICConvert Off .ahtml - * For uploads, this assumes that the destination file name - * has the correct extension. That may not be true for, e.g., - * Netscape Communicator roaming profile uploads! - */ - if (r->filename && !ap_is_empty_table(conv_by_ext)) { - const char *fn = strrchr(r->filename, '/'); - - if (fn == NULL) - fn = r->filename; - - /* Parse filename extension */ - if ((ext = strrchr(fn, '.')) != NULL) { - ++ext; - - /* Check for Content-Type */ - if ((conversion = ap_table_get(conv_by_ext, ext)) != NULL) { - -#if ADD_EBCDICCONVERT_DEBUG_HEADER - if (conf->ebcdicconversion_debug_header) - ap_table_setn(r->headers_out, - (dir == dir_In) ? "X-EBCDIC-Debug-In" : "X-EBCDIC-Debug-Out", - ap_psprintf(r->pool, "EBCDICConversion %s .%s", - (conversion[0] == conv_On) ? "On" : "Off", - ext)); -#endif - - conv = (conversion[0] == conv_On); - conv_valid = 1; - break; - } - } - } - - - /* 2nd step: test for the old "legacy kludge", that is, a default - * conversion=on for text/?* message/?* multipart/?* and the possibility - * to override the text/?* conversion with a definition like - * AddType text/x-ascii-plain .atxt - * AddType text/x-ascii-html .ahtml - * where the "x-ascii-" would be removed and the conversion switched - * off. - * This step must be performed prior to testing wildcard MIME types - * like text/?* by the EBCDICConvertByType directive. - */ -#ifdef LEGACY_KLUDGE - /* This fallback is only used when enabled (default=off) */ - if (conf->x_ascii_magic_kludge) { - char *magic; - - /* If the mime type of a document is set to - * "text/x-ascii-anything", it gets changed to - * "text/anything" here and the conversion is forced to off - * ("binary" or ASCII documents). - */ - if (*pType != NULL - && (magic = strstr(*pType, "/x-ascii-")) != NULL) { - -#if ADD_EBCDICCONVERT_DEBUG_HEADER - if (conf->ebcdicconversion_debug_header) - ap_table_setn(r->headers_out, - (dir == dir_In) ? "X-EBCDIC-Debug-In" : "X-EBCDIC-Debug-Out", - ap_psprintf(r->pool, "EBCDICKludge On (and type is: %s, thus no conversion)", - *pType)); -#endif - - /* the mime type scan stops at the first match. */ - magic[1] = '\0'; /* overwrite 'x' */ - - /* Fix MIME type: strip out the magic "x-ascii-" substring */ - *pType = ap_pstrcat(r->pool, *pType, &magic[9], NULL); - - magic[1] = 'x'; /* restore 'x' in old string (just in case) */ - - /* Switch conversion to BINARY */ - conv = 0; /* do NOT convert this document */ - conv_valid = 1; - break; - } - } -#endif /*LEGACY_KLUDGE */ - - - /* 3rd step: check whether a generic conversion was defined for a MIME type, - * like in - * EBCDICConvertByType On model/vrml application/postscript text/?* - */ - if (!ap_is_empty_table(conv_by_type)) { - struct do_mime_match_parms do_par; - - do_par.request = r; - do_par.direction = dir; - do_par.content_type = type; - - ap_table_do(do_mime_match, (void *) &do_par, conv_by_type, NULL); - - if ((conv_valid = do_par.match_found) != 0) { - conv = do_par.conv; - break; - } - } - else /* If no conversion by type was configured, use the default: */ - { - /* - * As a final step, mime types starting with "text/", "message/" or - * "multipart/" imply a conversion, while all the rest is - * delivered unconverted (i.e., binary, e.g. application/octet-stream). - */ - - /* If no content type is set then treat it as text (conversion=on) */ - conv = - (type == NULL) || - (strncasecmp(type, "text/", 5) == 0) || - (strncasecmp(type, "message/", 8) == 0) || - (strncasecmp(type, "multipart/", 10) == 0) || - (strcasecmp(type, "application/x-www-form-urlencoded") == 0); - -#if ADD_EBCDICCONVERT_DEBUG_HEADER - if (conf->ebcdicconversion_debug_header) - ap_table_setn(r->headers_out, - (dir == dir_In) ? "X-EBCDIC-Debug-In" : "X-EBCDIC-Debug-Out", - ap_psprintf(r->pool, - "No EBCDICConversion configured (and type is: %s, " - "=> guessed conversion = %s)", - type, conv ? "On" : "Off")); -#endif - conv_valid = 1; - break; - } - } while (0); - - if (conv_valid) { - if (dir == dir_In) - r->ebcdic.conv_in = conv; - else - r->ebcdic.conv_out = conv; - } -} - -/* This function determines the conversion for uploads (PUT/POST): */ -API_EXPORT(int) -ap_checkconv_in(request_rec *r) -{ - const char *typep; - - /* If nothing is being sent as input anyway, we don't bother about conversion */ - /* (see ap_should_client_block())*/ - if (r->read_length || (!r->read_chunked && (r->remaining <= 0))) - return r->ebcdic.conv_in; - - typep = ap_table_get(r->headers_in, "Content-Type"); - ap_checkconv_dir(r, &typep, dir_In); - - return r->ebcdic.conv_in; -} - - -/* Backward compatibility function */ -API_EXPORT(int) -ap_checkconv(request_rec *r) -{ - ap_checkconv_dir(r, &r->content_type, dir_Out); - return r->ebcdic.conv_out; -} - -#endif /* CHARSET_EBCDIC */ - - #ifdef USE_MMAP_FILES struct mmap_rec { void *mm; @@ -4126,12 +3405,7 @@ static int default_handler(request_rec *r) return METHOD_NOT_ALLOWED; } -#if defined(OS2) || defined(WIN32) || defined(NETWARE) || defined(CYGWIN) - /* Need binary mode for OS/2 */ - f = ap_pfopen(r->pool, r->filename, "rb"); -#else f = ap_pfopen(r->pool, r->filename, "r"); -#endif if (f == NULL) { ap_log_rerror(APLOG_MARK, APLOG_ERR, r, @@ -4170,17 +3444,10 @@ static int default_handler(request_rec *r) ap_unblock_alarms(); #endif -#ifdef CHARSET_EBCDIC - if (d->content_md5 & 1) { - ap_table_setn(r->headers_out, "Content-MD5", - ap_md5digest(r->pool, f, r->ebcdic.conv_out)); - } -#else if (d->content_md5 & 1) { ap_table_setn(r->headers_out, "Content-MD5", ap_md5digest(r->pool, f)); } -#endif /* CHARSET_EBCDIC */ rangestatus = ap_set_byterange(r); diff --git a/usr.sbin/httpd/src/main/http_log.c b/usr.sbin/httpd/src/main/http_log.c index fcd019d165a..0ec9bd7af02 100644 --- a/usr.sbin/httpd/src/main/http_log.c +++ b/usr.sbin/httpd/src/main/http_log.c @@ -1,4 +1,4 @@ -/* $OpenBSD: http_log.c,v 1.15 2004/06/07 04:21:30 brad Exp $ */ +/* $OpenBSD: http_log.c,v 1.16 2004/12/02 19:42:47 henning Exp $ */ /* ==================================================================== * The Apache Software License, Version 1.1 @@ -165,32 +165,13 @@ static int error_log_child(void *cmd, child_info *pinfo) * be common for other foo-loggers to want this sort of thing... */ int child_pid = 0; -#if defined(WIN32) - char *shellcmd; -#endif ap_cleanup_for_exec(); #ifdef SIGHUP /* No concept of a child process on Win32 */ signal(SIGHUP, SIG_IGN); #endif /* ndef SIGHUP */ -#if defined(NETWARE) - child_pid = spawnlp(P_NOWAIT, SHELL_PATH, (char *)cmd); - return(child_pid); -#elif defined(WIN32) - shellcmd = getenv("COMSPEC"); - if (!shellcmd) - shellcmd = SHELL_PATH; - child_pid = spawnl(_P_NOWAIT, shellcmd, shellcmd, "/c", (char *)cmd, NULL); - return(child_pid); -#elif defined(OS2) - /* For OS/2 we need to use a '/' and spawn the child rather than exec as - * we haven't forked */ - child_pid = spawnl(P_NOWAIT, SHELL_PATH, SHELL_PATH, "/c", (char *)cmd, NULL); - return(child_pid); -#else execl(SHELL_PATH, SHELL_PATH, "-c", (char *)cmd, (char *)NULL); -#endif exit(1); /* NOT REACHED */ return(child_pid); @@ -202,17 +183,8 @@ static void open_error_log(server_rec *s, pool *p) if (*s->error_fname == '|') { FILE *dummy; -#ifdef TPF - TPF_FORK_CHILD cld; - cld.filename = s->error_fname+1; - cld.subprocess_env = NULL; - cld.prog_type = FORK_NAME; - if (!ap_spawn_child(p, NULL, &cld, - kill_after_timeout, &dummy, NULL, NULL)) { -#else if (!ap_spawn_child(p, error_log_child, (void *)(s->error_fname+1), kill_after_timeout, &dummy, NULL, NULL)) { -#endif /* TPF */ perror("ap_spawn_child"); fprintf(stderr, "Couldn't fork child for ErrorLog process\n"); exit(1); @@ -258,13 +230,6 @@ API_EXPORT(void) ap_open_logs(server_rec *s_main, pool *p) server_rec *virt, *q; int replace_stderr; -#ifdef OS390 - /* - * Cause errno2 (reason code) information to be generated whenever - * strerror(errno) is invoked. - */ - setenv("_EDC_ADD_ERRNO2", "1", 1); -#endif open_error_log(s_main, p); @@ -363,30 +328,10 @@ static void log_error_core(const char *file, int line, int level, len += ap_snprintf(errstr + len, sizeof(errstr) - len, "[%s] ", priorities[level & APLOG_LEVELMASK].t_name); -#ifndef TPF if (file && (level & APLOG_LEVELMASK) == APLOG_DEBUG) { -#ifdef _OSD_POSIX - char tmp[256]; - char *e = strrchr(file, '/'); - - /* In OSD/POSIX, the compiler returns for __FILE__ - * a string like: __FILE__="*POSIX(/usr/include/stdio.h)" - * (it even returns an absolute path for sources in - * the current directory). Here we try to strip this - * down to the basename. - */ - if (e != NULL && e[1] != '\0') { - ap_snprintf(tmp, sizeof(tmp), "%s", &e[1]); - e = &tmp[strlen(tmp)-1]; - if (*e == ')') - *e = '\0'; - file = tmp; - } -#endif /*_OSD_POSIX*/ len += ap_snprintf(errstr + len, sizeof(errstr) - len, "%s(%d): ", file, line); } -#endif /* TPF */ if (r) { /* XXX: TODO: add a method of selecting whether logged client * addresses are in dotted quad or resolved form... dotted @@ -398,57 +343,10 @@ static void log_error_core(const char *file, int line, int level, } if (!(level & APLOG_NOERRNO) && (save_errno != 0) -#ifdef WIN32 - && !(level & APLOG_WIN32ERROR) -#endif ) { len += ap_snprintf(errstr + len, sizeof(errstr) - len, "(%d)%s: ", save_errno, strerror(save_errno)); } -#ifdef WIN32 - if (level & APLOG_WIN32ERROR) { - int nChars; - int nErrorCode; - - nErrorCode = GetLastError(); - len += ap_snprintf(errstr + len, sizeof(errstr) - len, - "(%d)", nErrorCode); - - nChars = FormatMessage( - FORMAT_MESSAGE_FROM_SYSTEM, - NULL, - nErrorCode, - MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), /* Default language */ - (LPTSTR) errstr + len, - sizeof(errstr) - len, - NULL - ); - len += nChars; - if (nChars == 0) { - /* Um, error occurred, but we can't recurse to log it again - * (and it would probably only fail anyway), so lets just - * log the numeric value. - */ - nErrorCode = GetLastError(); - len += ap_snprintf(errstr + len, sizeof(errstr) - len, - "(FormatMessage failed with code %d): ", - nErrorCode); - } - else { - /* FormatMessage put the message in the buffer, but it may - * have appended a newline (\r\n). So remove it and use - * ": " instead like the Unix errors. The error may also - * end with a . before the return - if so, trash it. - */ - if (len > 1 && errstr[len-2] == '\r' && errstr[len-1] == '\n') { - if (len > 2 && errstr[len-3] == '.') - len--; - errstr[len-2] = ':'; - errstr[len-1] = ' '; - } - } - } -#endif #ifndef AP_UNSAFE_ERROR_LOG_UNESCAPED if (ap_vsnprintf(scratch, sizeof(scratch) - len, fmt, args)) { @@ -514,9 +412,7 @@ API_EXPORT(void) ap_log_pid(pool *p, char *fname) struct stat finfo; static pid_t saved_pid = -1; pid_t mypid; -#ifndef WIN32 mode_t u; -#endif if (!fname) return; @@ -539,19 +435,15 @@ API_EXPORT(void) ap_log_pid(pool *p, char *fname) ); } -#ifndef WIN32 u = umask(022); (void) umask(u | 022); -#endif if(!(pid_file = fopen(fname, "w"))) { perror("fopen"); fprintf(stderr, "%s: could not log pid to file %s\n", ap_server_argv0, fname); exit(1); } -#ifndef WIN32 (void) umask(u); -#endif fprintf(pid_file, "%ld\n", (long)mypid); fclose(pid_file); saved_pid = mypid; @@ -590,12 +482,8 @@ API_EXPORT(void) ap_log_assert(const char *szExp, const char *szFile, int nLine) { fprintf(stderr, "[%s] file %s, line %d, assertion \"%s\" failed\n", ap_get_time(), szFile, nLine, szExp); -#ifndef WIN32 /* unix assert does an abort leading to a core dump */ abort(); -#else - exit(1); -#endif } /* piped log support */ @@ -758,31 +646,12 @@ static int piped_log_child(void *cmd, child_info *pinfo) * be common for other foo-loggers to want this sort of thing... */ int child_pid = 1; -#if defined(WIN32) - char *shellcmd; -#endif ap_cleanup_for_exec(); #ifdef SIGHUP signal(SIGHUP, SIG_IGN); #endif -#if defined(NETWARE) - child_pid = spawnlp(P_NOWAIT, SHELL_PATH, (char *)cmd); - return(child_pid); -#elif defined(WIN32) - shellcmd = getenv("COMSPEC"); - if (!shellcmd) - shellcmd = SHELL_PATH; - child_pid = spawnl(_P_NOWAIT, shellcmd, shellcmd, "/c", (char *)cmd, NULL); - return(child_pid); -#elif defined(OS2) - /* For OS/2 we need to use a '/' and spawn the child rather than exec as - * we haven't forked */ - child_pid = spawnl(P_NOWAIT, SHELL_PATH, SHELL_PATH, "/c", (char *)cmd, NULL); - return(child_pid); -#else execl (SHELL_PATH, SHELL_PATH, "-c", (char *)cmd, (char *)NULL); -#endif perror("exec"); fprintf(stderr, "Exec of shell for logging failed!!!\n"); return(child_pid); diff --git a/usr.sbin/httpd/src/main/http_main.c b/usr.sbin/httpd/src/main/http_main.c index 7cb8a39c204..f2d7d180cc7 100644 --- a/usr.sbin/httpd/src/main/http_main.c +++ b/usr.sbin/httpd/src/main/http_main.c @@ -1,4 +1,4 @@ -/* $OpenBSD: http_main.c,v 1.35 2004/02/10 12:59:29 henning Exp $ */ +/* $OpenBSD: http_main.c,v 1.36 2004/12/02 19:42:47 henning Exp $ */ /* ==================================================================== * The Apache Software License, Version 1.1 @@ -118,11 +118,7 @@ int ap_main(int argc, char *argv[]); #include <sys/audit.h> #include <prot.h> #endif -#ifdef WIN32 -#include "../os/win32/getopt.h" -#elif !defined(BEOS) && !defined(TPF) && !defined(NETWARE) && !defined(OS390) && !defined(CYGWIN) #include <netinet/tcp.h> -#endif #ifdef HAVE_BSTRING_H #include <bstring.h> /* for IRIX, FD_SET calls bzero() */ #endif @@ -183,32 +179,13 @@ API_EXPORT(void) ap_force_library_loading(void) { #define max(a,b) (a > b ? a : b) #endif -#ifdef WIN32 -#include "../os/win32/service.h" -#include "../os/win32/registry.h" -#define DEFAULTSERVICENAME "Apache" -#define PATHSEPARATOR '\\' -#else #define PATHSEPARATOR '/' -#endif #ifdef MINT long _stksize = 32768; #endif -#ifdef USE_OS2_SCOREBOARD - /* Add MMAP style functionality to OS/2 */ -#define INCL_DOSMEMMGR -#define INCL_DOSEXCEPTIONS -#define INCL_DOSSEMAPHORES -#include <os2.h> -#include <umalloc.h> -#include <stdio.h> -caddr_t create_shared_heap(const char *, size_t); -caddr_t get_shared_heap(const char *); -#endif - DEF_Explain /* Defining GPROF when compiling uses the moncontrol() function to @@ -234,10 +211,6 @@ void *ap_dummy_mutex = &ap_dummy_mutex; * Actual definitions of config globals... here because this is * for the most part the only code that acts on 'em. (Hmmm... mod_main.c?) */ -#ifdef NETWARE -BOOL ap_main_finished = FALSE; -unsigned int ap_thread_stack_size = 65536; -#endif int ap_thread_count = 0; API_VAR_EXPORT int ap_standalone=0; API_VAR_EXPORT int ap_configtestonly=0; @@ -330,15 +303,11 @@ API_VAR_EXPORT int is_chrooted=0; /* *Non*-shared http_main globals... */ static server_rec *server_conf; -#ifndef NETWARE static JMP_BUF APACHE_TLS jmpbuffer; -#endif static int sd; static fd_set listenfds; static int listenmaxfd; -#ifndef NETWARE static pid_t pgrp; -#endif /* one_process --- debugging mode variable; can be set from the command line * with the -X flag. If set, this gets you the child_main loop running @@ -358,9 +327,7 @@ static int do_detach = 1; /* set if timeouts are to be handled by the children and not by the parent. * i.e. child_timeouts = !standalone || one_process. */ -#ifndef NETWARE static int child_timeouts; -#endif #ifdef DEBUG_SIGSTOP int raise_sigstop_flags; @@ -387,19 +354,11 @@ static pool *pchild; /* Pool for httpd child stuff */ static pool *pmutex; /* Pool for accept mutex in child */ static pool *pcommands; /* Pool for -C and -c switches */ -#ifndef NETWARE static int APACHE_TLS my_pid; /* it seems silly to call getpid all the time */ -#endif #ifndef MULTITHREAD static int my_child_num; #endif -#ifdef TPF -pid_t tpf_parent_pid; -int tpf_child = 0; -char tpf_server_name[INETD_SERVNAME_LENGTH+1]; -char tpf_mutex_key[TPF_MUTEX_KEY_SIZE]; -#endif /* TPF */ scoreboard *ap_scoreboard_image = NULL; @@ -507,9 +466,7 @@ static void ap_call_close_connection_hook(conn_rec *c) } #endif /* EAPI */ -#ifndef NETWARE static APACHE_TLS int volatile exit_after_unblock = 0; -#endif #ifdef GPROF /* @@ -759,16 +716,11 @@ static void accept_mutex_init_pthread(pool *p) perror("pthread_mutexattr_init"); exit(APEXIT_INIT); } -#if !defined(CYGWIN) - /* Cygwin has problems with this pthread call claiming that these - * are "Invalid arguements", Stipe Tolj <tolj@wapme-systems.de> - */ if ((errno = pthread_mutexattr_setpshared(&mattr, PTHREAD_PROCESS_SHARED))) { perror("pthread_mutexattr_setpshared"); exit(APEXIT_INIT); } -#endif if ((errno = pthread_mutex_init(accept_mutex, &mattr))) { perror("pthread_mutex_init"); exit(APEXIT_INIT); @@ -1091,181 +1043,6 @@ accept_mutex_methods_s accept_mutex_flock_s = { }; #endif -#if defined(HAVE_OS2SEM_SERIALIZED_ACCEPT) - -static HMTX lock_sem = -1; - -static void accept_mutex_cleanup_os2sem(void *foo) -{ - DosReleaseMutexSem(lock_sem); - DosCloseMutexSem(lock_sem); -} - -/* - * Initialize mutex lock. - * Done by each child at it's birth - */ -static void accept_mutex_child_init_os2sem(pool *p) -{ - int rc = DosOpenMutexSem(NULL, &lock_sem); - - if (rc != 0) { - ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_EMERG, server_conf, - "Child cannot open lock semaphore, rc=%d", rc); - clean_child_exit(APEXIT_CHILDINIT); - } else { - ap_register_cleanup(p, NULL, accept_mutex_cleanup_os2sem, ap_null_cleanup); - } -} - -/* - * Initialize mutex lock. - * Must be safe to call this on a restart. - */ -static void accept_mutex_init_os2sem(pool *p) -{ - int rc = DosCreateMutexSem(NULL, &lock_sem, DC_SEM_SHARED, FALSE); - - if (rc != 0) { - ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_EMERG, server_conf, - "Parent cannot create lock semaphore, rc=%d", rc); - exit(APEXIT_INIT); - } - - ap_register_cleanup(p, NULL, accept_mutex_cleanup_os2sem, ap_null_cleanup); -} - -static void accept_mutex_on_os2sem(void) -{ - int rc = DosRequestMutexSem(lock_sem, SEM_INDEFINITE_WAIT); - - if (rc != 0) { - ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_EMERG, server_conf, - "OS2SEM: Error %d getting accept lock. Exiting!", rc); - clean_child_exit(APEXIT_CHILDFATAL); - } -} - -static void accept_mutex_off_os2sem(void) -{ - int rc = DosReleaseMutexSem(lock_sem); - - if (rc != 0) { - ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_EMERG, server_conf, - "OS2SEM: Error %d freeing accept lock. Exiting!", rc); - clean_child_exit(APEXIT_CHILDFATAL); - } -} - -accept_mutex_methods_s accept_mutex_os2sem_s = { - accept_mutex_child_init_os2sem, - accept_mutex_init_os2sem, - accept_mutex_on_os2sem, - accept_mutex_off_os2sem, - "os2sem" -}; -#endif - -#if defined(HAVE_TPF_CORE_SERIALIZED_ACCEPT) - -static int tpf_core_held; - -static void accept_mutex_cleanup_tpfcore(void *foo) -{ - if(tpf_core_held) - deqc(tpf_mutex_key, QUAL_S); -} - -#define accept_mutex_init_tpfcore(x) - -static void accept_mutex_child_init_tpfcore(pool *p) -{ - ap_register_cleanup(p, NULL, accept_mutex_cleanup_tpfcore, ap_null_cleanup); - tpf_core_held = 0; -} - -static void accept_mutex_on_tpfcore(void) -{ - enqc(tpf_mutex_key, ENQ_WAIT, 0, QUAL_S); - tpf_core_held = 1; - ap_check_signals(); -} - -static void accept_mutex_off_tpfcore(void) -{ - deqc(tpf_mutex_key, QUAL_S); - tpf_core_held = 0; - ap_check_signals(); -} - -accept_mutex_methods_s accept_mutex_tpfcore_s = { - accept_mutex_child_init_tpfcore, - NULL, - accept_mutex_on_tpfcore, - accept_mutex_off_tpfcore, - "tpfcore" -}; -#endif - -#ifdef HAVE_BEOS_SERIALIZED_ACCEPT -static sem_id _sem = -1; -static int locked = 0; - -static void accept_mutex_child_cleanup_beos(void *foo) -{ - if (_sem > 0 && locked) - release_sem(_sem); -} - -static void accept_mutex_child_init_beos(pool *p) -{ - ap_register_cleanup(p, NULL, accept_mutex_child_cleanup_beos, ap_null_cleanup); - locked = 0; -} - -static void accept_mutex_cleanup_beos(void *foo) -{ - if (_sem > 0) - delete_sem(_sem); -} - -static void accept_mutex_init_beos(pool *p) -{ - _sem = create_sem(1, "httpd_accept"); - if (_sem < 0) { - ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_EMERG, server_conf, - "Parent cannot create lock semaphore, sem=%ld", _sem); - exit(APEXIT_INIT); - } - - ap_register_cleanup(p, NULL, accept_mutex_cleanup_beos, ap_null_cleanup); -} -void accept_mutex_on_beos(void) -{ - if (locked == 0) { - if (acquire_sem(_sem) == B_OK) - locked = 1; - } -} - -static void accept_mutex_off_beos(void) -{ - if (locked == 1) { - if (release_sem(_sem) == B_OK) - locked = 0; - } -} - -accept_mutex_methods_s accept_mutex_beos_s = { - accept_mutex_child_init_beos, - accept_mutex_init_beos, - accept_mutex_on_beos, - accept_mutex_off_beos, - "beos_sem" -}; -#endif /* HAVE_BEOS_SERIALIZED_ACCEPT */ - - /* Generally, HAVE_NONE_SERIALIZED_ACCEPT simply won't work but * for testing purposes, here it is... */ #if defined HAVE_NONE_SERIALIZED_ACCEPT @@ -1336,18 +1113,6 @@ char *ap_default_mutex_method(void) if ((!(strcasecmp(t,"default"))) || (!(strcasecmp(t,"flock")))) return "flock"; #endif -#if defined HAVE_OS2SEM_SERIALIZED_ACCEPT - if ((!(strcasecmp(t,"default"))) || (!(strcasecmp(t,"os2sem")))) - return "os2sem"; -#endif -#if defined HAVE_TPF_CORE_SERIALIZED_ACCEPT - if ((!(strcasecmp(t,"default"))) || (!(strcasecmp(t,"tpfcore")))) - return "tpfcore"; -#endif -#if defined HAVE_BEOS_SERIALIZED_ACCEPT - if ((!(strcasecmp(t,"default"))) || (!(strcasecmp(t,"beos_sem")))) - return "beos_sem"; -#endif #if defined HAVE_NONE_SERIALIZED_ACCEPT if ((!(strcasecmp(t,"default"))) || (!(strcasecmp(t,"none")))) return "none"; @@ -1389,21 +1154,6 @@ char *ap_init_mutex_method(char *t) amutex = &accept_mutex_flock_s; } else #endif -#if defined HAVE_OS2SEM_SERIALIZED_ACCEPT - if (!(strcasecmp(t,"os2sem"))) { - amutex = &accept_mutex_os2sem_s; - } else -#endif -#if defined HAVE_TPF_CORE_SERIALIZED_ACCEPT - if (!(strcasecmp(t,"tpfcore"))) { - amutex = &accept_mutex_tpfcore_s; - } else -#endif -#if defined HAVE_BEOS_SERIALIZED_ACCEPT - if (!(strcasecmp(t,"beos_sem"))) { - amutex = &accept_mutex_beos_s; - } else -#endif #if defined HAVE_NONE_SERIALIZED_ACCEPT if (!(strcasecmp(t,"none"))) { amutex = &accept_mutex_none_s; @@ -1411,7 +1161,6 @@ char *ap_init_mutex_method(char *t) #endif { /* Ignore this directive on Windows */ -#ifndef WIN32 if (server_conf) { ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_NOTICE, server_conf, "Requested serialization method '%s' not available",t); @@ -1420,7 +1169,6 @@ char *ap_init_mutex_method(char *t) fprintf(stderr, "Requested serialization method '%s' not available\n", t); exit(APEXIT_INIT); } -#endif } return NULL; } @@ -1444,11 +1192,6 @@ static void usage(char *bin) for (i = 0; i < strlen(bin); i++) pad[i] = ' '; pad[i] = '\0'; -#ifdef WIN32 - fprintf(stderr, "Usage: %s [-D name] [-d directory] [-f file] [-n service]\n", bin); - fprintf(stderr, " %s [-C \"directive\"] [-c \"directive\"] [-k signal]\n", pad); - fprintf(stderr, " %s [-v] [-V] [-h] [-l] [-L] [-S] [-t] [-T]\n", pad); -#else /* !WIN32 */ #ifdef SHARED_CORE fprintf(stderr, "Usage: %s [-R directory] [-D name] [-d directory] [-f file]\n", bin); #else @@ -1460,7 +1203,6 @@ static void usage(char *bin) #ifdef SHARED_CORE fprintf(stderr, " -R directory : specify an alternate location for shared object files\n"); #endif -#endif /* !WIN32 */ fprintf(stderr, " -D name : define a name for use in <IfDefine name> directives\n"); fprintf(stderr, " -d directory : specify an alternate initial ServerRoot\n"); fprintf(stderr, " -f file : specify an alternate ServerConfigFile\n"); @@ -1472,74 +1214,15 @@ static void usage(char *bin) fprintf(stderr, " -l : list compiled-in modules\n"); fprintf(stderr, " -L : list available configuration directives\n"); fprintf(stderr, " -S : show parsed settings (currently only vhost settings)\n"); -#ifdef NETWARE - fprintf(stderr, " -e : force the display of configuration file errors to the logger screen\n"); - fprintf(stderr, " -s : load Apache without a screen\n"); -#endif fprintf(stderr, " -t : run syntax check for config files (with docroot check)\n"); fprintf(stderr, " -T : run syntax check for config files (without docroot check)\n"); -#ifndef WIN32 fprintf(stderr, " -F : run main process in foreground, for process supervisors\n"); fprintf(stderr, " -u : Unsecure mode. Do not chroot into ServerRoot.\n"); -#endif -#ifdef WIN32 - fprintf(stderr, " -n name : name the Apache service for -k options below;\n"); - fprintf(stderr, " -k stop|shutdown : tell running Apache to shutdown\n"); - fprintf(stderr, " -k restart : tell running Apache to do a graceful restart\n"); - fprintf(stderr, " -k start : tell Apache to start\n"); - fprintf(stderr, " -k install | -i: install an Apache service\n"); - fprintf(stderr, " -k config : reconfigure an installed Apache service\n"); - fprintf(stderr, " -k uninstall | -u: uninstall an Apache service\n"); - fprintf(stderr, " -W service : after -k config|install; Apache starts after 'service'\n"); - fprintf(stderr, " -w : holds the window open for 30 seconds for fatal errors.\n"); -#endif -#if defined(NETWARE) - clean_parent_exit(0); -#else exit(1); -#endif -} - - - -#ifdef NETWARE -/* Thread Storage Data */ -typedef struct _TSD { - conn_rec* current_conn; - int alarms_blocked; - int alarm_pending; - request_rec* timeout_req; - char* timeout_name; - JMP_BUF jmpbuffer; - int exit_after_unblock; - void (*alarm_fn) (int); - unsigned int alarm_expiry_time; -} TSD; - -static TSD Tsd; - -void init_tsd() -{ - int *thread_ptr; - - memset(&Tsd, 0, sizeof(TSD)); - thread_ptr = __get_thread_data_area_ptr(); - *thread_ptr = (int) &Tsd; } -#define get_tsd TSD* tsd = (TSD*) Thread_Data_Area; -#define current_conn tsd->current_conn -#define alarms_blocked tsd->alarms_blocked -#define alarm_pending tsd->alarm_pending -#define timeout_req tsd->timeout_req -#define timeout_name tsd->timeout_name -#define jmpbuffer tsd->jmpbuffer -#define exit_after_unblock tsd->exit_after_unblock -#define alarm_fn tsd->alarm_fn -#define alarm_expiry_time tsd->alarm_expiry_time -#else /***************************************************************** * * Timeout handling. DISTINCTLY not thread-safe, but all this stuff @@ -1552,15 +1235,11 @@ static APACHE_TLS request_rec *volatile timeout_req; static APACHE_TLS const char *volatile timeout_name = NULL; static APACHE_TLS int volatile alarms_blocked = 0; static APACHE_TLS int volatile alarm_pending = 0; -#endif static void timeout(int sig) { void *dirconf; -#ifdef NETWARE - get_tsd -#endif if (alarms_blocked) { alarm_pending = 1; return; @@ -1597,9 +1276,6 @@ static void timeout(int sig) timeout_req = NULL; while (log_req->main || log_req->prev) { -#ifdef NETWARE - ThreadSwitch(); -#endif /* Get back to original request... */ if (log_req->main) log_req = log_req->main; @@ -1637,7 +1313,6 @@ static void timeout(int sig) } -#ifndef TPF /* * These two called from alloc.c to protect its critical sections... * Note that they can nest (as when destroying the sub_pools of a pool @@ -1646,17 +1321,11 @@ static void timeout(int sig) API_EXPORT(void) ap_block_alarms(void) { -#ifdef NETWARE - get_tsd -#endif ++alarms_blocked; } API_EXPORT(void) ap_unblock_alarms(void) { -#ifdef NETWARE - get_tsd -#endif --alarms_blocked; if (alarms_blocked == 0) { if (exit_after_unblock) { @@ -1677,46 +1346,20 @@ API_EXPORT(void) ap_unblock_alarms(void) } } } -#endif /* TPF */ -#ifndef NETWARE static APACHE_TLS void (*volatile alarm_fn) (int) = NULL; -#endif -#if defined(WIN32) || defined(CYGWIN_WINSOCK) -static APACHE_TLS unsigned int alarm_expiry_time = 0; -#endif /* WIN32 */ -#if !defined(WIN32) && !defined(NETWARE) static void alrm_handler(int sig) { if (alarm_fn) { (*alarm_fn) (sig); } } -#endif API_EXPORT(unsigned int) ap_set_callback_and_alarm(void (*fn) (int), int x) { unsigned int old; -#if defined(WIN32) || defined(NETWARE) - time_t now = time(NULL); -#ifdef NETWARE - get_tsd -#endif - old = alarm_expiry_time; - - if (old) - old -= now; - if (x == 0) { - alarm_fn = NULL; - alarm_expiry_time = 0; - } - else { - alarm_fn = fn; - alarm_expiry_time = now + x; - } -#else if (alarm_fn && x && fn != alarm_fn) { ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_DEBUG, NULL, "ap_set_callback_and_alarm: possible nested timer!"); @@ -1738,37 +1381,10 @@ API_EXPORT(unsigned int) ap_set_callback_and_alarm(void (*fn) (int), int x) ++ap_scoreboard_image->servers[my_child_num].cur_vtime; } #endif -#endif return (old); } -#if defined(WIN32) || defined(NETWARE) || defined(CYGWIN_WINSOCK) -API_EXPORT(int) ap_check_alarm(void) -{ -#ifdef NETWARE - get_tsd -#endif - if (alarm_expiry_time) { - unsigned int t; - - t = time(NULL); - if (t >= alarm_expiry_time) { - alarm_expiry_time = 0; - (*alarm_fn) (0); - return (-1); - } - else { - return (alarm_expiry_time - t); - } - } - else - return (0); -} -#endif /* WIN32 */ - - - /* reset_timeout (request_rec *) resets the timeout in effect, * as long as it hasn't expired already. */ @@ -1776,9 +1392,6 @@ API_EXPORT(int) ap_check_alarm(void) API_EXPORT(void) ap_reset_timeout(request_rec *r) { int i; -#ifdef NETWARE - get_tsd -#endif if (timeout_name) { /* timeout has been set */ i = ap_set_callback_and_alarm(alarm_fn, r->server->timeout); if (i == 0) /* timeout already expired, so set it back to 0 */ @@ -1792,9 +1405,6 @@ API_EXPORT(void) ap_reset_timeout(request_rec *r) API_EXPORT(void) ap_keepalive_timeout(char *name, request_rec *r) { unsigned int to; -#ifdef NETWARE - get_tsd -#endif timeout_req = r; timeout_name = name; if (r->connection->keptalive) @@ -1806,9 +1416,6 @@ API_EXPORT(void) ap_keepalive_timeout(char *name, request_rec *r) API_EXPORT(void) ap_hard_timeout(char *name, request_rec *r) { -#ifdef NETWARE - get_tsd -#endif timeout_req = r; timeout_name = name; ap_set_callback_and_alarm(timeout, r->server->timeout); @@ -1816,18 +1423,12 @@ API_EXPORT(void) ap_hard_timeout(char *name, request_rec *r) API_EXPORT(void) ap_soft_timeout(char *name, request_rec *r) { -#ifdef NETWARE - get_tsd -#endif timeout_name = name; ap_set_callback_and_alarm(timeout, r->server->timeout); } API_EXPORT(void) ap_kill_timeout(request_rec *dummy) { -#ifdef NETWARE - get_tsd -#endif ap_check_signals(); ap_set_callback_and_alarm(NULL, 0); timeout_req = NULL; @@ -1887,9 +1488,6 @@ static void sock_enable_linger(int s) static void lingerout(int sig) { -#ifdef NETWARE - get_tsd -#endif if (alarms_blocked) { alarm_pending = 1; return; @@ -1904,9 +1502,6 @@ static void lingerout(int sig) static void linger_timeout(void) { -#ifdef NETWARE - get_tsd -#endif timeout_name = "lingering close"; ap_set_callback_and_alarm(lingerout, MAX_SECS_TO_LINGER); } @@ -1974,9 +1569,6 @@ static void lingering_close(request_rec *r) * These parameters are reset on each pass, since they might be * changed by select. */ -#ifdef NETWARE - ThreadSwitch(); -#endif FD_SET(lsd, &lfds); tv.tv_sec = 2; @@ -1985,11 +1577,7 @@ static void lingering_close(request_rec *r) select_rv = ap_select(lsd + 1, &lfds, NULL, NULL, &tv); } while ((select_rv > 0) && -#if defined(WIN32) || defined(NETWARE) - (recv(lsd, dummybuf, sizeof(dummybuf), 0) > 0)); -#else (read(lsd, dummybuf, sizeof(dummybuf)) > 0)); -#endif /* Should now have seen final ack. Safe to finally kill socket */ @@ -2147,91 +1735,7 @@ API_EXPORT(void) ap_sync_scoreboard_image(void) #else /* MULTITHREAD */ -#if defined(USE_OS2_SCOREBOARD) - -/* The next two routines are used to access shared memory under OS/2. */ -/* This requires EMX v09c to be installed. */ - -caddr_t create_shared_heap(const char *name, size_t size) -{ - ULONG rc; - void *mem; - Heap_t h; - - rc = DosAllocSharedMem(&mem, name, size, - PAG_COMMIT | PAG_READ | PAG_WRITE); - if (rc != 0) - return NULL; - h = _ucreate(mem, size, !_BLOCK_CLEAN, _HEAP_REGULAR | _HEAP_SHARED, - NULL, NULL); - if (h == NULL) - DosFreeMem(mem); - return (caddr_t) h; -} - -caddr_t get_shared_heap(const char *Name) -{ - - PVOID BaseAddress; /* Pointer to the base address of - the shared memory object */ - ULONG AttributeFlags; /* Flags describing characteristics - of the shared memory object */ - APIRET rc; /* Return code */ - - /* Request read and write access to */ - /* the shared memory object */ - AttributeFlags = PAG_WRITE | PAG_READ; - - rc = DosGetNamedSharedMem(&BaseAddress, Name, AttributeFlags); - - if (rc != 0) { - printf("DosGetNamedSharedMem error: return code = %ld", rc); - return 0; - } - - return BaseAddress; -} - -static void setup_shared_mem(pool *p) -{ - caddr_t m; - - int rc; - - m = (caddr_t) create_shared_heap("\\SHAREMEM\\SCOREBOARD", SCOREBOARD_SIZE); - if (m == 0) { - fprintf(stderr, "%s: Could not create OS/2 Shared memory pool.\n", - ap_server_argv0); - exit(APEXIT_INIT); - } - - rc = _uopen((Heap_t) m); - if (rc != 0) { - fprintf(stderr, - "%s: Could not uopen() newly created OS/2 Shared memory pool.\n", - ap_server_argv0); - } - ap_scoreboard_image = (scoreboard *) m; - ap_scoreboard_image->global.running_generation = 0; -} - -static void reopen_scoreboard(pool *p) -{ - caddr_t m; - int rc; - - m = (caddr_t) get_shared_heap("\\SHAREMEM\\SCOREBOARD"); - if (m == 0) { - fprintf(stderr, "%s: Could not find existing OS/2 Shared memory pool.\n", - ap_server_argv0); - exit(APEXIT_INIT); - } - - rc = _uopen((Heap_t) m); - ap_scoreboard_image = (scoreboard *) m; -} - -#elif defined(USE_POSIX_SCOREBOARD) +#if defined(USE_POSIX_SCOREBOARD) #include <sys/mman.h> /* * POSIX 1003.4 style @@ -2314,24 +1818,7 @@ static void setup_shared_mem(pool *p) #if defined(MAP_ANON) /* BSD style */ -#ifdef CONVEXOS11 - /* - * 9-Aug-97 - Jeff Venters (venters@convex.hp.com) - * ConvexOS maps address space as follows: - * 0x00000000 - 0x7fffffff : Kernel - * 0x80000000 - 0xffffffff : User - * Start mmapped area 1GB above start of text. - * - * Also, the length requires a pointer as the actual length is - * returned (rounded up to a page boundary). - */ - { - unsigned len = SCOREBOARD_SIZE; - - m = mmap((caddr_t) 0xC0000000, &len, - PROT_READ | PROT_WRITE, MAP_ANON | MAP_SHARED, NOFD, 0); - } -#elif defined(MAP_TMPFILE) +#if defined(MAP_TMPFILE) { char mfile[] = "/tmp/apache_shmem_XXXX"; int fd = mkstemp(mfile); @@ -2398,14 +1885,6 @@ static void setup_shared_mem(pool *p) #endif if ((shmid = shmget(shmkey, SCOREBOARD_SIZE, IPC_CREAT | SHM_R | SHM_W)) == -1) { -#ifdef LINUX - if (errno == ENOSYS) { - ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_EMERG, server_conf, - "Your kernel was built without CONFIG_SYSVIPC\n" - "%s: Please consult the Apache FAQ for details", - ap_server_argv0); - } -#endif ap_log_error(APLOG_MARK, APLOG_EMERG, server_conf, "could not call shmget"); exit(APEXIT_INIT); @@ -2528,9 +2007,6 @@ void reopen_scoreboard(pool *p) if (scoreboard_fd != -1) ap_pclosef(p, scoreboard_fd); -#ifdef TPF - ap_scoreboard_fname = ap_server_root_relative(p, ap_scoreboard_fname); -#endif /* TPF */ scoreboard_fd = ap_popenf_ex(p, ap_scoreboard_fname, O_CREAT | O_BINARY | O_RDWR, 0666, 1); if (scoreboard_fd == -1) { perror(ap_scoreboard_fname); @@ -2607,39 +2083,11 @@ static ap_inline void put_scoreboard_info(int child_num, } /* a clean exit from the parent with proper cleanup */ -#ifdef NETWARE -void clean_shutdown_on_exit(void) -{ - if (!ap_main_finished) { - AMCSocketCleanup(); - ap_destroy_pool(pcommands); - free(ap_loaded_modules); - ap_cleanup_method_ptrs(); - ap_destroy_pool(pglobal); - ap_cleanup_alloc(); - ap_main_finished = TRUE; - } -} - -void clean_parent_exit(int code) __attribute__((noreturn)); -void clean_parent_exit(int code) -#else static void clean_parent_exit(int code) __attribute__((noreturn)); static void clean_parent_exit(int code) -#endif { -#ifdef NETWARE - AMCSocketCleanup(); - ap_destroy_pool(pcommands); - free(ap_loaded_modules); - ap_cleanup_method_ptrs(); - ap_destroy_pool(pglobal); - ap_cleanup_alloc(); - ap_main_finished = TRUE; -#else /* Clear the pool - including any registered cleanups */ ap_destroy_pool(pglobal); -#endif #ifdef EAPI ap_kill_alloc_shared(); #endif @@ -2661,9 +2109,6 @@ API_EXPORT(int) ap_update_child_status(int child_num, int status, request_rec *r ss = &ap_scoreboard_image->servers[child_num]; old_status = ss->status; ss->status = status; -#ifdef NETWARE - ap_scoreboard_image->parent[child_num].pid = GetThreadID(); -#endif #ifdef OPTIMIZE_TIMEOUTS ++ss->cur_vtime; @@ -2962,7 +2407,6 @@ int reap_children(ap_wait_t *status) * a while... */ -#ifndef NETWARE /* number of calls to wait_or_timeout between writable probes */ #ifndef INTERVAL_OF_WRITABLE_PROBES #define INTERVAL_OF_WRITABLE_PROBES 10 @@ -2971,35 +2415,6 @@ static int wait_or_timeout_counter; static int wait_or_timeout(ap_wait_t *status) { -#ifdef WIN32 -#define MAXWAITOBJ MAXIMUM_WAIT_OBJECTS - HANDLE h[MAXWAITOBJ]; - int e[MAXWAITOBJ]; - int round, pi, hi, rv, err; - for (round = 0; round <= (HARD_SERVER_LIMIT - 1) / MAXWAITOBJ + 1; round++) { - hi = 0; - for (pi = round * MAXWAITOBJ; - (pi < (round + 1) * MAXWAITOBJ) && (pi < HARD_SERVER_LIMIT); - pi++) { - if (ap_scoreboard_image->servers[pi].status != SERVER_DEAD) { - e[hi] = pi; - h[hi++] = (HANDLE) ap_scoreboard_image->parent[pi].pid; - } - - } - if (hi > 0) { - rv = WaitForMultipleObjects(hi, h, FALSE, 10000); - if (rv == -1) - err = GetLastError(); - if ((WAIT_OBJECT_0 <= (unsigned int) rv) && ((unsigned int) rv < (WAIT_OBJECT_0 + hi))) - return (ap_scoreboard_image->parent[e[rv - WAIT_OBJECT_0]].pid); - else if ((WAIT_ABANDONED_0 <= (unsigned int) rv) && ((unsigned int) rv < (WAIT_ABANDONED_0 + hi))) - return (ap_scoreboard_image->parent[e[rv - WAIT_ABANDONED_0]].pid); - - } - } - return (-1); -#else /* WIN32 */ struct timeval tv; int ret; @@ -3026,9 +2441,7 @@ static int wait_or_timeout(ap_wait_t *status) tv.tv_usec = SCOREBOARD_MAINTENANCE_INTERVAL % 1000000; ap_select(0, NULL, NULL, NULL, &tv); return -1; -#endif /* WIN32 */ } -#endif #if defined(NSIG) #define NumSIG NSIG @@ -3167,11 +2580,7 @@ static void sig_coredump(int sig) { chdir(ap_coredump_dir); signal(sig, SIG_DFL); -#if !defined(WIN32) && !defined(NETWARE) kill(getpid(), sig); -#else - raise(sig); -#endif /* At this point we've got sig blocked, because we're still inside * the signal handler. When we leave the signal handler it will * be unblocked, and we'll take the signal... and coredump or whatever @@ -3189,9 +2598,6 @@ static void just_die(int sig) { /* SIGHUP to child process??? */ /* if alarms are blocked we have to wait to die otherwise we might * end up with corruption in alloc.c's internal structures */ -#ifdef NETWARE - get_tsd -#endif if (alarms_blocked) { exit_after_unblock = 1; } @@ -3217,82 +2623,6 @@ static int volatile restart_pending; static int volatile is_graceful; API_VAR_EXPORT ap_generation_t volatile ap_my_generation=0; -#ifdef WIN32 -/* - * Signalling Apache on NT. - * - * Under Unix, Apache can be told to shutdown or restart by sending various - * signals (HUP, USR, TERM). On NT we don't have easy access to signals, so - * we use "events" instead. The parent apache process goes into a loop - * where it waits forever for a set of events. Two of those events are - * called - * - * apPID_shutdown - * apPID_restart - * - * (where PID is the PID of the apache parent process). When one of these - * is signalled, the Apache parent performs the appropriate action. The events - * can become signalled through internal Apache methods (e.g. if the child - * finds a fatal error and needs to kill its parent), via the service - * control manager (the control thread will signal the shutdown event when - * requested to stop the Apache service), from the -k Apache command line, - * or from any external program which finds the Apache PID from the - * httpd.pid file. - * - * The signal_parent() function, below, is used to signal one of these events. - * It can be called by any child or parent process, since it does not - * rely on global variables. - * - * On entry, type gives the event to signal. 0 means shutdown, 1 means - * graceful restart. - */ - -static void signal_parent(int type) -{ - HANDLE e; - char *signal_name; - extern char signal_shutdown_name[]; - extern char signal_restart_name[]; - - /* after updating the shutdown_pending or restart flags, we need - * to wake up the parent process so it can see the changes. The - * parent will normally be waiting for either a child process - * to die, or for a signal on the "spache-signal" event. So set the - * "apache-signal" event here. - */ - - /* XXX: This is no good, can't we please die in -X mode :-? */ - if (one_process) { - return; - } - - switch(type) { - case 0: signal_name = signal_shutdown_name; break; - case 1: signal_name = signal_restart_name; break; - default: return; - } - - APD2("signal_parent signalling event \"%s\"", signal_name); - - e = OpenEvent(EVENT_ALL_ACCESS, FALSE, signal_name); - if (!e) { - /* Um, problem, can't signal the parent, which means we can't - * signal ourselves to die. Ignore for now... - */ - ap_log_error(APLOG_MARK, APLOG_EMERG|APLOG_WIN32ERROR, server_conf, - "OpenEvent on %s event", signal_name); - return; - } - if (SetEvent(e) == 0) { - /* Same problem as above */ - ap_log_error(APLOG_MARK, APLOG_EMERG|APLOG_WIN32ERROR, server_conf, - "SetEvent on %s event", signal_name); - CloseHandle(e); - return; - } - CloseHandle(e); -} -#endif /* * ap_start_shutdown() and ap_start_restart(), below, are a first stab at @@ -3307,7 +2637,6 @@ static void signal_parent(int type) API_EXPORT(void) ap_start_shutdown(void) { -#ifndef WIN32 if (shutdown_pending == 1) { /* Um, is this _probably_ not an error, if the user has * tried to do a shutdown twice quickly, so we won't @@ -3316,24 +2645,17 @@ API_EXPORT(void) ap_start_shutdown(void) return; } shutdown_pending = 1; -#else - signal_parent(0); /* get the parent process to wake up */ -#endif } /* do a graceful restart if graceful == 1 */ API_EXPORT(void) ap_start_restart(int graceful) { -#ifndef WIN32 if (restart_pending == 1) { /* Probably not an error - don't bother reporting it */ return; } restart_pending = 1; is_graceful = graceful; -#else - signal_parent(1); /* get the parent process to wake up */ -#endif /* WIN32 */ } static void sig_term(int sig) @@ -3343,14 +2665,7 @@ static void sig_term(int sig) static void restart(int sig) { -#ifdef TPF - signal(sig, restart); -#endif -#if !defined (WIN32) && !defined(NETWARE) ap_start_restart(sig == SIGUSR1); -#else - ap_start_restart(1); -#endif } static void set_signals(void) @@ -3445,9 +2760,7 @@ static void set_signals(void) signal(SIGXFSZ, SIG_DFL); #endif /* SIGXFSZ */ } -#ifndef NETWARE signal(SIGTERM, sig_term); -#endif #ifdef SIGHUP signal(SIGHUP, restart); #endif /* SIGHUP */ @@ -3468,14 +2781,9 @@ static void set_signals(void) static void detach(void) { -#if !defined(WIN32) && !defined(NETWARE) int x; chdir("/"); -#if !defined(MPE) && !defined(OS2) && !defined(TPF) && !defined(BEOS) && \ - !defined(BONE) -/* Don't detach for MPE because child processes can't survive the death of - the parent. */ if (do_detach) { if ((x = fork()) > 0) exit(0); @@ -3486,7 +2794,6 @@ static void detach(void) } RAISE_SIGSTOP(DETACH); } -#endif #ifndef NO_SETSID if ((pgrp = setsid()) == -1) { perror("setsid"); @@ -3496,25 +2803,6 @@ static void detach(void) "running under a process management tool like daemontools\n"); exit(1); } -#elif defined(NEXT) || defined(NEWSOS) - if (setpgrp(0, getpid()) == -1 || (pgrp = getpgrp(0)) == -1) { - perror("setpgrp"); - fprintf(stderr, "%s: setpgrp or getpgrp failed\n", ap_server_argv0); - exit(1); - } -#elif defined(OS2) || defined(TPF) - /* OS/2 and TPF don't support process group IDs */ - pgrp = getpid(); -#elif defined(MPE) - /* MPE uses negative pid for process group */ - pgrp = -getpid(); -#elif defined(CYGWIN) - /* Cygwin does not take any argument for setpgrp() */ - if ((pgrp = setpgrp()) == -1) { - perror("setpgrp"); - fprintf(stderr, "%s: setpgrp failed\n", ap_server_argv0); - exit(1); - } #else if ((pgrp = setpgrp(getpid(), 0)) == -1) { perror("setpgrp"); @@ -3541,7 +2829,6 @@ static void detach(void) * but we haven't opened that yet. So leave it alone for now and it'll * be reopened moments later. */ -#endif /* ndef WIN32 */ } /* Set group privileges. @@ -3553,7 +2840,6 @@ static void detach(void) static void set_group_privs(void) { -#if !defined(WIN32) && !defined(NETWARE) && !defined(BEOS) && !defined(BONE) if (!geteuid()) { char *name; @@ -3576,28 +2862,18 @@ static void set_group_privs(void) else name = ap_user_name; -#if !defined(OS2) && !defined(TPF) /* OS/2 and TPF don't support groups. */ /* * Set the GID before initgroups(), since on some platforms * setgid() is known to zap the group list. */ -#ifdef MPE - GETPRIVMODE(); -#endif if (setgid(ap_group_id) == -1) { -#ifdef MPE - GETUSERMODE(); -#endif ap_log_error(APLOG_MARK, APLOG_ALERT, server_conf, "setgid: unable to set group id to Group %u", (unsigned)ap_group_id); clean_child_exit(APEXIT_CHILDFATAL); } -#ifdef MPE - GETUSERMODE(); -#endif /* Reset `groups' attributes. */ @@ -3614,9 +2890,7 @@ static void set_group_privs(void) clean_child_exit(APEXIT_CHILDFATAL); } #endif /* MULTIPLE_GROUPS */ -#endif /* !defined(OS2) && !defined(TPF) */ } -#endif /* !defined(WIN32) && !defined(NETWARE) && !defined(BEOS) */ } /* check to see if we have the 'suexec' setuid wrapper installed */ @@ -3624,7 +2898,6 @@ static int init_suexec(void) { int result = 0; -#if !defined(WIN32) && !defined(NETWARE) && !defined(TPF) struct stat wrapper; if ((stat(SUEXEC_BIN, &wrapper)) != 0) { @@ -3633,7 +2906,6 @@ static int init_suexec(void) else if ((wrapper.st_mode & S_ISUID) && (wrapper.st_uid == 0)) { result = 1; } -#endif /* ndef WIN32 */ return result; } @@ -3705,9 +2977,6 @@ static void sock_disable_nagle(int s, struct sockaddr_in *sin_client) if (setsockopt(s, IPPROTO_TCP, TCP_NODELAY, (char *) &just_say_no, sizeof(int)) < 0) { -#ifdef NETWARE - errno = WSAGetLastError(); -#endif if (sin_client) { ap_log_error(APLOG_MARK, APLOG_DEBUG, server_conf, "setsockopt: (TCP_NODELAY), client %pA probably " @@ -3751,9 +3020,6 @@ static int make_sock(pool *p, const struct sockaddr_in *server) * socket now it breaks things across SIGHUP restarts. It'll either * be unable to bind, or it won't respond. */ -#if defined (SOLARIS2) && SOLARIS2 < 260 -#define WORKAROUND_SOLARIS_BUG -#endif /* PR#1282 Unixware 1.x appears to have the same problem as solaris */ #if defined (UW) && UW < 200 @@ -3766,24 +3032,17 @@ static int make_sock(pool *p, const struct sockaddr_in *server) #endif #ifndef WORKAROUND_SOLARIS_BUG -#ifndef BEOS /* this won't work for BeOS sockets!! */ s = ap_slack(s, AP_SLACK_HIGH); -#endif ap_note_cleanups_for_socket_ex(p, s, 1); /* arrange to close on exec or restart */ -#ifdef TPF - os_note_additional_cleanups(p, s); -#endif /* TPF */ #endif if (setsockopt(s, SOL_SOCKET, SO_REUSEADDR, (char *) &one, sizeof(int)) < 0) { -#ifndef _OSD_POSIX ap_log_error(APLOG_MARK, APLOG_CRIT, server_conf, "make_sock: for %s, setsockopt: (SO_REUSEADDR)", addr); closesocket(s); ap_unblock_alarms(); exit(1); -#endif /*_OSD_POSIX*/ } one = 1; #if defined(SO_KEEPALIVE) && !defined(MPE) @@ -3819,7 +3078,6 @@ static int make_sock(pool *p, const struct sockaddr_in *server) * * If no size is specified, use the kernel default. */ -#ifndef BEOS /* BeOS does not support SO_SNDBUF */ if (server_conf->send_buffer_size) { if (setsockopt(s, SOL_SOCKET, SO_SNDBUF, (char *) &server_conf->send_buffer_size, sizeof(int)) < 0) { @@ -3829,30 +3087,16 @@ static int make_sock(pool *p, const struct sockaddr_in *server) /* not a fatal error */ } } -#endif -#ifdef MPE -/* MPE requires CAP=PM and GETPRIVMODE to bind to ports less than 1024 */ - if (ntohs(server->sin_port) < 1024) - GETPRIVMODE(); -#endif if (bind(s, (struct sockaddr *) server, sizeof(struct sockaddr_in)) == -1) { ap_log_error(APLOG_MARK, APLOG_CRIT, server_conf, "make_sock: could not bind to %s", addr); -#ifdef MPE - if (ntohs(server->sin_port) < 1024) - GETUSERMODE(); -#endif closesocket(s); ap_unblock_alarms(); exit(1); } -#ifdef MPE - if (ntohs(server->sin_port) < 1024) - GETUSERMODE(); -#endif if (listen(s, ap_listenbacklog) == -1) { ap_log_error(APLOG_MARK, APLOG_ERR, server_conf, @@ -4048,51 +3292,6 @@ static ap_inline listen_rec *find_ready_listener(fd_set * main_fds) } -#if defined(WIN32) || defined(NETWARE) -static int s_iInitCount = 0; - -static int AMCSocketInitialize(void) -{ - int iVersionRequested; - WSADATA wsaData; - int err; - - if (s_iInitCount > 0) { - s_iInitCount++; - return (0); - } - else if (s_iInitCount < 0) - return (s_iInitCount); - - /* s_iInitCount == 0. Do the initailization */ - iVersionRequested = MAKEWORD(2, 0); - err = WSAStartup((WORD) iVersionRequested, &wsaData); - if (err) { - printf("WSAStartup failed with error %d\n", err); - s_iInitCount = -1; - return (s_iInitCount); - } - - if (LOBYTE(wsaData.wVersion) != 2 || - HIBYTE(wsaData.wVersion) != 0) { - printf("Apache requires Winsock 2. Please see the Apache FAQ for more information.\n"); - s_iInitCount = -2; - WSACleanup(); - return (s_iInitCount); - } - s_iInitCount++; - return (s_iInitCount); -} - - -static void AMCSocketCleanup(void) -{ - if (--s_iInitCount == 0) - WSACleanup(); - return; -} -#endif - static void show_compile_settings(void) { printf("Server version: %s\n", ap_get_server_version()); @@ -4109,9 +3308,6 @@ static void show_compile_settings(void) printf(" -D EAPI_MM_CORE_PATH=\"" EAPI_MM_CORE_PATH "\"\n"); #endif #endif -#ifdef TPF - show_os_specific_compile_settings(); -#endif #ifdef BIG_SECURITY_HOLE printf(" -D BIG_SECURITY_HOLE\n"); #endif @@ -4130,9 +3326,6 @@ static void show_compile_settings(void) #ifdef USE_SHMGET_SCOREBOARD printf(" -D USE_SHMGET_SCOREBOARD\n"); #endif -#ifdef USE_OS2_SCOREBOARD - printf(" -D USE_OS2_SCOREBOARD\n"); -#endif #ifdef USE_POSIX_SCOREBOARD printf(" -D USE_POSIX_SCOREBOARD\n"); #endif @@ -4163,15 +3356,6 @@ static void show_compile_settings(void) #ifdef HAVE_PTHREAD_SERIALIZED_ACCEPT printf(" -D HAVE_PTHREAD_SERIALIZED_ACCEPT\n"); #endif -#ifdef HAVE_OS2SEM_SERIALIZED_ACCEPT - printf(" -D HAVE_OS2SEM_SERIALIZED_ACCEPT\n"); -#endif -#ifdef HAVE_TPF_CORE_SERIALIZED_ACCEPT - printf(" -D HAVE_TPF_CORE_SERIALIZED_ACCEPT\n"); -#endif -#ifdef HAVE_BEOS_SERIALIZED_ACCEPT - printf(" -D HAVE_BEOS_SERIALIZED_ACCEPT\n"); -#endif #ifdef HAVE_NONE_SERIALIZED_ACCEPT printf(" -D HAVE_NONE_SERIALIZED_ACCEPT\n"); #endif @@ -4195,9 +3379,6 @@ static void show_compile_settings(void) #ifdef MULTITHREAD printf(" -D MULTITHREAD\n"); #endif -#ifdef CHARSET_EBCDIC - printf(" -D CHARSET_EBCDIC\n"); -#endif #ifdef NEED_HASHBANG_EMUL printf(" -D NEED_HASHBANG_EMUL\n"); #endif @@ -4211,9 +3392,6 @@ static void show_compile_settings(void) #ifdef AP_ACCEPTFILTER_OFF printf(" -D AP_ACCEPTFILTER_OFF\n"); #endif -#ifdef CYGWIN_WINSOCK - printf(" -D CYGWIN_WINSOCK\n"); -#endif /* This list displays the compiled-in default paths: */ #ifdef HTTPD_ROOT @@ -4259,14 +3437,7 @@ static void show_compile_settings(void) static void common_init(void) { INIT_SIGLIST() -#ifdef AUX3 - (void) set42sig(); -#endif -#if defined(WIN32) || defined(NETWARE) - /* Initialize the stupid sockets */ - AMCSocketInitialize(); -#endif /* WIN32 */ pglobal = ap_init_alloc(); pconf = ap_make_sub_pool(pglobal); @@ -4359,35 +3530,16 @@ static void child_main(int child_num_arg) SAFE_ACCEPT(accept_mutex_child_init(pmutex)); set_group_privs(); -#ifdef MPE - /* No such thing as root on MPE, so try to switch unconditionally */ - GETPRIVMODE(); - if (setuid(ap_user_id) == -1) { - GETUSERMODE(); - ap_log_error(APLOG_MARK, APLOG_ALERT, server_conf, - "setuid: unable to change to uid: %d", ap_user_id); - exit(1); - } - GETUSERMODE(); -#else /* * Only try to switch if we're running as root * In case of Cygwin we have the special super-user named SYSTEM */ -#ifdef CYGWIN - if (getuid() == SYSTEM_UID && ( -#else if (!geteuid() && ( -#endif -#ifdef _OSD_POSIX - os_init_job_environment(server_conf, ap_user_name, one_process) != 0 || -#endif setuid(ap_user_id) == -1)) { ap_log_error(APLOG_MARK, APLOG_ALERT, server_conf, "setuid: unable to change to uid: %u", ap_user_id); clean_child_exit(APEXIT_CHILDFATAL); } -#endif ap_child_init_modules(pchild, server_conf); @@ -4400,27 +3552,13 @@ static void child_main(int child_num_arg) * Setup the jump buffers so that we can return here after a timeout */ ap_setjmp(jmpbuffer); -#ifndef OS2 #ifdef SIGURG signal(SIGURG, timeout); #endif -#endif if (signal(SIGALRM, alrm_handler) == SIG_ERR) { fprintf(stderr, "installing signal handler for SIGALRM failed, errno %u\n", errno); } -#ifdef TPF - signal(SIGHUP, just_die); - signal(SIGTERM, just_die); - signal(SIGUSR1, just_die); -#endif /* TPF */ - -#ifdef OS2 -/* Stop Ctrl-C/Ctrl-Break signals going to child processes */ - { - unsigned long ulTimes; - DosSetSignalExceptionFocus(0, &ulTimes); - } -#endif + while (1) { BUFF *conn_io; @@ -4447,14 +3585,10 @@ static void child_main(int child_num_arg) clean_child_exit(0); } -#ifndef WIN32 if ((ap_max_requests_per_child > 0 && requests_this_child++ >= ap_max_requests_per_child)) { clean_child_exit(0); } -#else - ++requests_this_child; -#endif (void) ap_update_child_status(my_child_num, SERVER_READY, (request_rec *) NULL); @@ -4527,17 +3661,6 @@ static void child_main(int child_num_arg) */ switch (errno) { -#if defined(HPUX11) && defined(ENOBUFS) - /* On HPUX 11.x, the 'ENOBUFS, No buffer space available' - * error occures because the accept() cannot complete. - * You will not see ENOBUFS at 10.20 because the kernel - * hides any occurrence from being returned from user space. - * ENOBUFS at 11.0 TCP/IP is quite possible, and could - * occur intermittently. As a work-around, we are going to - * ingnore ENOBUFS. - */ - case ENOBUFS: -#endif #ifdef EPROTO /* EPROTO on certain older kernels really means @@ -4600,25 +3723,10 @@ static void child_main(int child_num_arg) clean_child_exit(APEXIT_CHILDFATAL); #endif /*ENETDOWN*/ -#ifdef TPF - case EINACT: - ap_log_error(APLOG_MARK, APLOG_ALERT|APLOG_NOERRNO, - server_conf, "offload device inactive"); - clean_child_exit(APEXIT_CHILDFATAL); - break; - default: - if (getppid() != 1) { - ap_log_error(APLOG_MARK, APLOG_ALERT|APLOG_NOERRNO, - server_conf, "select/accept error (%u)", - errno); - } - clean_child_exit(APEXIT_CHILDFATAL); -#else default: ap_log_error(APLOG_MARK, APLOG_ERR, server_conf, "accept: (client socket)"); clean_child_exit(1); -#endif } } @@ -4639,10 +3747,6 @@ static void child_main(int child_num_arg) SAFE_ACCEPT(accept_mutex_off()); /* unlock after "accept" */ -#ifdef TPF - if (csd == 0) /* 0 is invalid socket for TPF */ - continue; -#endif /* We've got a socket, let's at least process one request off the * socket before we accept a graceful restart request. @@ -4741,17 +3845,6 @@ static void child_main(int child_num_arg) if(ap_extended_status) increment_counts(my_child_num, r); -#ifdef TPF_HAVE_NSD - /* Update the TPF Network Services Database message counters */ - tpf_tcpip_message_cnt(NSDB_INPUT_CNT, - ((struct sockaddr_in *)&sa_server)->sin_port, - NSDB_TCP_S, 1); - - tpf_tcpip_message_cnt(NSDB_OUTPUT_CNT, - ((struct sockaddr_in *)&sa_server)->sin_port, - NSDB_TCP_S, 1); -#endif /* TPF_HAVE_NSD */ - if (!current_conn->keepalive || current_conn->aborted) break; @@ -4815,35 +3908,6 @@ static void child_main(int child_num_arg) } } -#ifdef TPF -static void reset_tpf_listeners(APACHE_TPF_INPUT *input_parms) -{ - int count; - listen_rec *lr; - - count = 0; - listenmaxfd = -1; - FD_ZERO(&listenfds); - lr = ap_listeners; - - for(;;) { - lr->fd = input_parms->listeners[count]; - if(lr->fd >= 0) { - FD_SET(lr->fd, &listenfds); - if(lr->fd > listenmaxfd) - listenmaxfd = lr->fd; - } - if(lr->next == NULL) - break; - lr = lr->next; - count++; - } - lr->next = ap_listeners; - head_listener = ap_listeners; - close_unused_listeners(); -} - -#endif /* TPF */ static int make_child(server_rec *s, int slot, time_t now) { @@ -4870,14 +3934,7 @@ static int make_child(server_rec *s, int slot, time_t now) (void) ap_update_child_status(slot, SERVER_STARTING, (request_rec *) NULL); -#ifdef _OSD_POSIX - /* BS2000 requires a "special" version of fork() before a setuid() call */ - if ((pid = os_fork(ap_user_name)) == -1) { -#elif defined(TPF) - if ((pid = os_fork(s, slot)) == -1) { -#else if ((pid = fork()) == -1) { -#endif ap_log_error(APLOG_MARK, APLOG_ERR, s, "fork: Unable to fork new process"); /* fork didn't succeed. Fix the scoreboard or else @@ -4971,13 +4028,8 @@ static int hold_off_on_exponential_spawning; * use to kill of childs that exceed timeout. This effect has been * seen at least on Cygwin 1.x. -- Stipe Tolj <tolj@wapme-systems.de> */ -#if defined(CYGWIN) -#define SIG_IDLE_KILL SIGKILL -#define SIG_TIMEOUT_KILL SIGUSR2 -#else #define SIG_IDLE_KILL SIGUSR1 #define SIG_TIMEOUT_KILL SIGALRM -#endif static void perform_idle_server_maintenance(void) { @@ -5063,9 +4115,6 @@ static void perform_idle_server_maintenance(void) */ kill(ap_scoreboard_image->parent[to_kill].pid, SIG_IDLE_KILL); idle_spawn_rate = 1; -#ifdef TPF - ap_update_child_status(to_kill, SERVER_DEAD, (request_rec *)NULL); -#endif } else if (idle_count < ap_daemons_min_free) { /* terminate the free list */ @@ -5091,17 +4140,7 @@ static void perform_idle_server_maintenance(void) idle_count, total_non_dead); } for (i = 0; i < free_length; ++i) { -#ifdef TPF - if(make_child(server_conf, free_slots[i], now) == -1) { - if(free_length == 1) { - shutdown_pending = 1; - ap_log_error(APLOG_MARK, APLOG_EMERG, server_conf, - "No active child processes: shutting down"); - } - } -#else make_child(server_conf, free_slots[i], now); -#endif /* TPF */ } /* the next time around we want to spawn twice as many if this * wasn't good enough, but not if we've just done a graceful @@ -5191,9 +4230,6 @@ static void standalone_main(int argc, char **argv) { int remaining_children_to_start; -#ifdef OS2 - printf("%s \n", ap_get_server_version()); -#endif ap_standalone = 1; @@ -5349,11 +4385,6 @@ static void standalone_main(int argc, char **argv) * to start up and get into IDLE state then we may spawn an * extra child */ -#ifdef TPF - if (shutdown_pending += os_check_server(tpf_server_name)) { - break; - } -#endif if (pid >= 0) { process_child_status(pid, status); /* non-fatal death... note that it's gone in the scoreboard. */ @@ -5503,9 +4534,6 @@ extern int optind; * dllimport for it. -- Stipe Tolj <tolj@wapme-systems.de> */ -#if defined(CYGWIN) -__declspec(dllexport) -#endif int REALMAIN(int argc, char *argv[]) { @@ -5528,11 +4556,6 @@ int REALMAIN(int argc, char *argv[]) SOCKSinit(argv[0]); #endif -#ifdef TPF - EBW_AREA input_parms; - ecbptr()->ebrout = PRIMECRAS; - input_parms = * (EBW_AREA *)(&(ecbptr()->ebw000)); -#endif MONCONTROL(0); @@ -5598,12 +4621,6 @@ int REALMAIN(int argc, char *argv[]) case 'X': ++one_process; /* Weird debugging mode. */ break; -#ifdef TPF - case 'x': - os_tpf_child(&input_parms.child); - set_signals(); - break; -#endif #ifdef DEBUG_SIGSTOP case 'Z': raise_sigstop_flags = atoi(optarg); @@ -5667,12 +4684,7 @@ int REALMAIN(int argc, char *argv[]) child_timeouts = !ap_standalone || one_process; -#ifdef BEOS - /* make sure we're running in single_process mode - Yuck! */ - one_process = 1; -#endif -#ifndef TPF if (ap_standalone) { ap_open_logs(server_conf, plog); ap_set_version(); @@ -5680,45 +4692,6 @@ int REALMAIN(int argc, char *argv[]) version_locked++; STANDALONE_MAIN(argc, argv); } -#else - if (!tpf_child) { - memcpy(tpf_server_name, input_parms.parent.servname, - INETD_SERVNAME_LENGTH); - tpf_server_name[INETD_SERVNAME_LENGTH + 1] = '\0'; - snprintf(tpf_mutex_key, sizeof(tpf_mutex_key), "%.*x", TPF_MUTEX_KEY_SIZE - 1, getpid()); - tpf_parent_pid = getppid(); - ap_open_logs(server_conf, plog); - ap_tpf_zinet_checks(ap_standalone, tpf_server_name, server_conf); - ap_tpf_save_argv(argc, argv); /* save argv parms for children */ - } - if (ap_standalone) { - ap_set_version(); - ap_init_modules(pconf, server_conf); - version_locked++; - if(tpf_child) { - server_conf->error_log = stderr; -#ifdef HAVE_SYSLOG - /* if ErrorLog is syslog call ap_open_logs from the child since - syslog isn't redirected to stderr by the Apache parent */ - if (strncasecmp(server_conf->error_fname, "syslog", 6) == 0) { - ap_open_logs(server_conf, plog); - } -#endif /* HAVE_SYSLOG */ - copy_listeners(pconf); - reset_tpf_listeners(&input_parms.child); -#ifdef SCOREBOARD_FILE - ap_scoreboard_image = &_scoreboard_image; -#else /* must be USE_SHMGET_SCOREBOARD */ - ap_scoreboard_image = - (scoreboard *)input_parms.child.scoreboard_heap; -#endif - ap_init_mutex_method(ap_default_mutex_method()); - child_main(input_parms.child.slot); - } - else - STANDALONE_MAIN(argc, argv); - } -#endif else { conn_rec *conn; request_rec *r; @@ -5734,49 +4707,23 @@ int REALMAIN(int argc, char *argv[]) ap_init_modules(pconf, server_conf); set_group_privs(); -#ifdef MPE - /* No such thing as root on MPE, so try to switch unconditionally */ - GETPRIVMODE(); - if (setuid(ap_user_id) == -1) { - GETUSERMODE(); - ap_log_error(APLOG_MARK, APLOG_ALERT, server_conf, - "setuid: unable to change to uid: %d", ap_user_id); - exit(1); - } - GETUSERMODE(); -#else /* * Only try to switch if we're running as root * In case of Cygwin we have the special super-user named SYSTEM * with a pre-defined uid. */ -#ifdef CYGWIN - if ((getuid() == SYSTEM_UID) && setuid(ap_user_id) == -1) { -#else if (!geteuid() && setuid(ap_user_id) == -1) { -#endif ap_log_error(APLOG_MARK, APLOG_ALERT, server_conf, "setuid: unable to change to uid: %u", ap_user_id); exit(1); } -#endif if (ap_setjmp(jmpbuffer)) { exit(0); } -#ifdef MPE -/* HP MPE 5.5 inetd only passes the incoming socket as stdin (fd 0), whereas - HPUX inetd passes the incoming socket as stdin (fd 0) and stdout (fd 1). - Go figure. SR 5003355016 has been submitted to request that the existing - functionality be documented, and then to enhance the functionality to be - like HPUX. */ - sock_in = fileno(stdin); - sock_out = fileno(stdin); -#else sock_in = fileno(stdin); sock_out = fileno(stdout); -#endif l = sizeof(sa_client); if ((getpeername(sock_in, &sa_client, &l)) < 0) { @@ -6054,15 +5001,6 @@ static void child_sub_main(int child_num) int dupped_csd = -1; int srv = 0; -#ifdef NETWARE - TSD* tsd = NULL; - - while(tsd == NULL) { - tsd = (TSD*) Thread_Data_Area; - ThreadSwitchWithDelay(); - } - init_name_space(); -#endif ap_thread_count++; ptrans = ap_make_sub_pool(pconf); @@ -6080,17 +5018,11 @@ static void child_sub_main(int child_num) signal(SIGURG, timeout); #endif -#ifdef NETWARE - tsd = (TSD*) Thread_Data_Area; -#endif while (1) { BUFF *conn_io; request_rec *r; -#ifdef NETWARE - ThreadSwitch(); -#endif /* * (Re)initialize this child to a pre-connection state. */ @@ -6218,11 +5150,7 @@ static void child_sub_main(int child_num) } -#ifdef NETWARE -void child_main(void* child_num_arg) -#else void child_main(int child_num_arg) -#endif { /* * Only reason for this function, is to pass in @@ -6231,16 +5159,7 @@ void child_main(int child_num_arg) * variables and I don't need to make those * damn variables static/global */ -#ifdef NETWARE - TSD Tsd; - int *thread_ptr; - memset(&Tsd, 0, sizeof(TSD)); - thread_ptr = __get_thread_data_area_ptr(); - *thread_ptr = (int) &Tsd; - child_sub_main((int)child_num_arg); -#else child_sub_main(child_num_arg); -#endif } @@ -6254,46 +5173,6 @@ void cleanup_thread(thread **handles, int *thread_cnt, int thread_to_clean) handles[i] = handles[i + 1]; (*thread_cnt)--; } -#ifdef WIN32 -/* - * The Win32 call WaitForMultipleObjects will only allow you to wait for - * a maximum of MAXIMUM_WAIT_OBJECTS (current 64). Since the threading - * model in the multithreaded version of apache wants to use this call, - * we are restricted to a maximum of 64 threads. This is a simplistic - * routine that will increase this size. - */ -static DWORD wait_for_many_objects(DWORD nCount, CONST HANDLE *lpHandles, - DWORD dwSeconds) -{ - time_t tStopTime; - DWORD dwRet = WAIT_TIMEOUT; - DWORD dwIndex=0; - BOOL bFirst = TRUE; - - tStopTime = time(NULL) + dwSeconds; - - do { - if (!bFirst) - Sleep(1000); - else - bFirst = FALSE; - - for (dwIndex = 0; dwIndex * MAXIMUM_WAIT_OBJECTS < nCount; dwIndex++) { - dwRet = WaitForMultipleObjects( - min(MAXIMUM_WAIT_OBJECTS, - nCount - (dwIndex * MAXIMUM_WAIT_OBJECTS)), - lpHandles + (dwIndex * MAXIMUM_WAIT_OBJECTS), - 0, 0); - - if (dwRet != WAIT_TIMEOUT) { - break; - } - } - } while((time(NULL) < tStopTime) && (dwRet == WAIT_TIMEOUT)); - - return dwRet; -} -#endif /***************************************************************** * Executive routines. */ @@ -6326,7 +5205,6 @@ void setup_signal_names(char *prefix) APD2("signal prefix %s", signal_name_prefix); } -#ifndef NETWARE static void setup_inherited_listeners(pool *p) { HANDLE pipe; @@ -6379,7 +5257,6 @@ static void setup_inherited_listeners(pool *p) CloseHandle(pipe); return; } -#endif /* * worker_main() is main loop for the child process. The loop in @@ -6387,190 +5264,6 @@ static void setup_inherited_listeners(pool *p) * threads (which run in a loop in child_sub_main()). */ -#ifdef NETWARE -void worker_main(void) -{ - int nthreads; - fd_set main_fds; - int srv; - int clen; - int csd; - struct sockaddr_in sa_client; - thread **child_handles; - int rv; - int i; - struct timeval tv; - int my_pid; - int count_select_errors = 0; - pool *pchild; - module **m; - listen_rec* lr; - - - pchild = ap_make_sub_pool(pconf); - - ap_standalone = 1; - sd = -1; - nthreads = ap_threads_per_child; - - if (nthreads <= 0) - nthreads = 40; - - my_pid = getpid(); - - ++ap_my_generation; - - copy_listeners(pconf); - ap_restart_time = time(NULL); - - reinit_scoreboard(pconf); - setup_listeners(pconf); - - if (listenmaxfd == -1) { - /* Help, no sockets were made, better log something and exit */ - ap_log_error(APLOG_MARK, APLOG_CRIT|APLOG_NOERRNO, NULL, - "No sockets were created for listening"); - - ap_destroy_pool(pchild); - cleanup_scoreboard(); - exit(1); - } - - set_signals(); - - /* Display listening ports */ - printf(" Listening on port(s):"); - lr = ap_listeners; - do { - printf(" %d", ntohs(lr->local_addr.sin_port)); - lr = lr->next; - } while(lr && lr != ap_listeners); - - /* Display dynamic modules loaded */ - printf("\n"); - for (m = ap_loaded_modules; *m != NULL; m++) { - if (((module*)*m)->dynamic_load_handle) { - printf(" Loaded dynamic module %s\n", ap_find_module_name(*m)); - } - } - - /* - * - Initialize allowed_globals - * - Create the thread table - * - Spawn off threads - * - Create listen socket set (done above) - * - loop { - * wait for request - * create new job - * } while (!time to exit) - * - Close all listeners - * - Wait for all threads to complete - * - Exit - */ - - ap_child_init_modules(pconf, server_conf); - allowed_globals.jobmutex = ap_create_mutex(NULL); - allowed_globals.jobsemaphore = create_semaphore(0); - - /* spawn off the threads */ - child_handles = (thread *) malloc(nthreads * sizeof(int)); - - for (i = 0; i < nthreads; i++) { - child_handles[i] = create_thread((void (*)(void *)) child_main, (void *) i); - } - - if (nthreads > max_daemons_limit) { - max_daemons_limit = nthreads; - } - - while (1) { - tv.tv_sec = 1; - tv.tv_usec = 0; - - ThreadSwitch(); - - if (shutdown_pending) - break; - - memcpy(&main_fds, &listenfds, sizeof(fd_set)); - srv = ap_select(listenmaxfd + 1, &main_fds, NULL, NULL, &tv); - - if (srv == 0) { - count_select_errors = 0; /* reset count of errors */ - continue; - } - else if (srv == SOCKET_ERROR) { - if (h_errno != WSAEINTR) { - /* A "real" error occurred, log it and increment the count of - * select errors. This count is used to ensure we don't go into - * a busy loop of continuous errors. - */ - ap_log_error(APLOG_MARK, APLOG_WARNING, server_conf, - "select failed with errno %d", h_errno); - count_select_errors++; - if (count_select_errors > MAX_SELECT_ERRORS) { - ap_log_error(APLOG_MARK, APLOG_ERR|APLOG_NOERRNO, server_conf, - "Too many errors in select loop. Child process exiting."); - break; - } - } - continue; - } else { - listen_rec *lr; - - lr = find_ready_listener(&main_fds); - - if (lr != NULL) { - sd = lr->fd; - } - } - - do { - clen = sizeof(sa_client); - csd = accept(sd, (struct sockaddr *) &sa_client, &clen); - - if (csd == INVALID_SOCKET) { - csd = -1; - } - } while (csd < 0 && h_errno == EINTR); - - if (csd == INVALID_SOCKET) { - if (h_errno != WSAECONNABORTED) { - ap_log_error(APLOG_MARK, APLOG_ERR, server_conf, - "accept: (client socket) failed with errno = %d",h_errno); - } - } - else { - add_job(csd); - } - } - - APD2("process PID %d exiting", my_pid); - - /* Get ready to shutdown and exit */ - allowed_globals.exit_now = 1; - - for (i = 0; i < nthreads; i++) { - add_job(-1); - } - - APD2("process PID %d waiting for worker threads to exit", my_pid); - while(ap_thread_count) - ThreadSwitch(); - - destroy_semaphore(allowed_globals.jobsemaphore); - ap_destroy_mutex(allowed_globals.jobmutex); - - ap_child_exit_modules(pconf, server_conf); - ap_destroy_pool(pchild); - free(child_handles); - cleanup_scoreboard(); - - APD2("process PID %d exited", my_pid); - clean_parent_exit(0); - -} -#else void worker_main(void) { int nthreads; @@ -7301,7 +5994,6 @@ die_now: ap_destroy_mutex(start_mutex); return (0); } -#endif /* * Send signal to a running Apache. On entry signal should contain @@ -7365,32 +6057,7 @@ void post_parse_init() } -#ifdef NETWARE -extern char *optarg; - -void signal_handler(int sig) -{ - switch (sig) { - case SIGTERM: - shutdown_pending = 1; - - while(!ap_main_finished) - ThreadSwitchWithDelay(); - - break; - } - return; -} -#endif - -#if defined(NETWARE) -int apache_main(int argc, char *argv[]) -#elif defined(WIN32) - __declspec(dllexport) -int apache_main(int argc, char *argv[]) -#else int REALMAIN(int argc, char *argv[]) -#endif { int c; int child = 0; @@ -7398,46 +6065,6 @@ int REALMAIN(int argc, char *argv[]) char *s; int conf_specified = 0; -#ifdef WIN32 - jmp_buf reparse_args; - char *service_name = NULL; - int install = 0; - int reparsed = 0; - int is_child_of_service = 0; - char *signal_to_send = NULL; - - /* Service application under WinNT the first time through only... - * service_main immediately resets real_exit_code to zero - */ - if (real_exit_code && isWindowsNT()) - { - if (((argc == 1) && isProcessService()) - || ((argc == 2) && !strcmp(argv[1], "--ntservice"))) - { - service_main(apache_main, argc, argv); - /* this was the end of the service control thread... - * cleanups already ran when second thread of apache_main - * terminated, so simply... - */ - exit(0); - } - } - - /* This behavior is voided by setting real_exit_code to 0 */ - atexit(hold_console_open_on_error); -#endif - -#ifdef NETWARE - int currentScreen = GetCurrentScreen(); - /* If top_module is not NULL then APACHEC was not exited cleanly - * and is in a bad state. Simply clean up and exit. - */ - check_clean_load (top_module); - init_name_space(); - signal(SIGTERM, signal_handler); - atexit(clean_shutdown_on_exit); - init_tsd(); -#endif /* Console application or a child process. */ @@ -7455,27 +6082,6 @@ int REALMAIN(int argc, char *argv[]) * the user chooses a relative path for the -d serverroot arg a bit later */ -#ifdef NETWARE - if(!*ap_server_root) { - ap_cpystrn(ap_server_root, bslash2slash(remove_filename(argv[0])), - sizeof(ap_server_root)); - } -#endif - -#ifdef WIN32 - if(!*ap_server_root) { - if (GetModuleFileName(NULL, ap_server_root, sizeof(ap_server_root))) { - ap_cpystrn(ap_server_root, - ap_os_canonical_filename(pcommands, ap_server_root), - sizeof(ap_server_root)); - if (ap_os_is_path_absolute(ap_server_root) - && strchr(ap_server_root, '/')) - *strrchr(ap_server_root, '/') = '\0'; - else - *ap_server_root = '\0'; - } - } -#endif /* Fallback position if argv[0] wasn't deciphered */ @@ -7484,28 +6090,7 @@ int REALMAIN(int argc, char *argv[]) chdir (ap_server_root); -#ifdef WIN32 - /* If this is a service, we will need to fall back here and - * reparse the entire options list. - */ - if (setjmp(reparse_args)) { - /* Reset and reparse the command line */ - ap_server_pre_read_config = ap_make_array(pcommands, 1, sizeof(char *)); - ap_server_post_read_config = ap_make_array(pcommands, 1, sizeof(char *)); - ap_server_config_defines = ap_make_array(pcommands, 1, sizeof(char *)); - - /* Reset optreset and optind to allow getopt to work correctly - * the second time around, and assure we never come back here. - */ - optreset = 1; - optind = 1; - reparsed = 1; - } - - while ((c = getopt(argc, argv, "D:C:c:Xd:f:vVlLz:Z:wiuStThk:n:W:")) != -1) { -#else /* !WIN32 */ while ((c = getopt(argc, argv, "D:C:c:Xd:Ff:vVlLesStTh")) != -1) { -#endif char **new; switch (c) { case 'c': @@ -7520,96 +6105,6 @@ int REALMAIN(int argc, char *argv[]) new = (char **)ap_push_array(ap_server_config_defines); *new = ap_pstrdup(pcommands, optarg); break; -#ifdef WIN32 - /* Shortcuts; include the -w option to hold the window open on error. - * This must not be toggled once we reset real_exit_code to 0! - */ - case 'w': - if (real_exit_code) - real_exit_code = 2; - break; - /* service children must be created with the -z option, - * while console mode (interactive apache) children are created - * with the -Z option - */ - case 'z': - is_child_of_service = 1; - case 'Z': - /* Prevent holding open the (nonexistant) console */ - real_exit_code = 0; - exit_event = open_event(optarg); - APD2("child: opened process event %s", optarg); - cp = strchr(optarg, '_'); - ap_assert(cp); - *cp = 0; - setup_signal_names(optarg); - start_mutex = ap_open_mutex(signal_name_prefix); - ap_assert(start_mutex); - child = 1; - break; - case 'n': - service_name = ap_pstrdup(pcommands, optarg); - break; - case 'i': - install = 2; - break; - case 'u': - install = -1; - break; - case 'k': - if (!strcasecmp(optarg, "stop")) - signal_to_send = "shutdown"; - else if (!strcasecmp(optarg, "install")) - install = 2; - else if (!strcasecmp(optarg, "config")) - install = 1; - else if (!strcasecmp(optarg, "uninstall")) - install = -1; - else - signal_to_send = optarg; - break; - case 'W': - /* -With a dependent service */ - if (install < 1) { - fprintf(stderr, "%s: invalid option: -W %s ignored\n" - "\t-W only modifies -k install or -k config\n", - argv[0], optarg); - } - else if (!isWindowsNT()) { - fprintf(stderr, "%s: invalid option: -W %s ignored\n" - "\t-W is only supported for Windows NT/2000\n", - argv[0], optarg); - } - break; -#endif /* WIN32 */ -#ifdef NETWARE - case 'e': - { - int screenHandle; - - /* Get a screen handle for the console screen. */ - if ((screenHandle = CreateScreen("System Console", 0)) != NULL) - { - SetAutoScreenDestructionMode(1); - SetCurrentScreen(screenHandle); /* switch to console screen I/O */ - } - } - break; - case 's': - if (DestroyScreen(GetCurrentScreen()) == 0) - { - int screenHandle; - - /* Create a screen handle for the console screen, - even though the console screen exists. */ - if ((screenHandle = CreateScreen("System Console", 0)) != NULL) - { - SetCurrentScreen(screenHandle); /* switch to console screen I/O */ - currentScreen = GetCurrentScreen(); - } - } - break; -#endif case 'S': ap_dump_settings = 1; break; @@ -7626,11 +6121,9 @@ int REALMAIN(int argc, char *argv[]) && ap_server_root[strlen(ap_server_root) - 1] == '/') ap_server_root[strlen(ap_server_root) - 1] = '\0'; break; -#ifndef WIN32 case 'F': do_detach = 0; break; -#endif case 'f': ap_cpystrn(ap_server_confname, ap_os_canonical_filename(pcommands, optarg), @@ -7641,36 +6134,20 @@ int REALMAIN(int argc, char *argv[]) ap_set_version(); printf("Server version: %s\n", ap_get_server_version()); printf("Server built: %s\n", ap_get_server_built()); -#ifdef WIN32 - clean_parent_exit(1); -#else clean_parent_exit(0); -#endif case 'V': ap_set_version(); show_compile_settings(); -#ifdef WIN32 - clean_parent_exit(1); -#else clean_parent_exit(0); -#endif case 'l': ap_show_modules(); -#ifdef WIN32 - clean_parent_exit(1); -#else clean_parent_exit(0); -#endif case 'L': ap_show_directives(); -#ifdef WIN32 - clean_parent_exit(1); -#else clean_parent_exit(0); -#endif case 'X': ++one_process; /* Weird debugging mode. */ @@ -7688,78 +6165,8 @@ int REALMAIN(int argc, char *argv[]) case '?': usage(ap_server_argv0); } /* switch */ -#ifdef NETWARE - ThreadSwitch(); -#endif } /* while */ -#ifdef WIN32 - - if (!service_name && install) { - service_name = DEFAULTSERVICENAME; - } - - if (service_name) { - service_name = get_display_name(service_name); - } - - if (service_name && isValidService(service_name)) - { - if (install == 2) { - ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, NULL, - "Service \"%s\" is already installed!", service_name); - clean_parent_exit(1); - } - /* Don't proceed if we are configuring, uninstalling - * or already merged and reparsed the service args - */ - if (!install && !reparsed) - { - int svcargc; - char **newargv, **svcargv; - if (ap_configtestonly) - fprintf(stderr, "Default command options for service %s:\n", - service_name); - - /* Merge the service's default args */ - if (ap_registry_get_service_args(pcommands, &svcargc, &svcargv, - service_name) > 0) { - newargv = (char**)malloc((svcargc + argc + 1) * sizeof(char*)); - newargv[0] = argv[0]; /* The true executable name */ - memcpy(newargv + 1, svcargv, svcargc * sizeof(char*)); - memcpy(newargv + 1 + svcargc, argv + 1, - (argc - 1) * sizeof(char*)); - argc += svcargc; /* Add the startup options args */ - argv = newargv; - argv[argc] = NULL; - - if (ap_configtestonly) { - while (svcargc-- > 0) { - if ((**svcargv == '-') && strchr("dfDCc", svcargv[0][1]) - && svcargc) { - fprintf(stderr, " %s %s\n", - *svcargv, *(svcargv + 1)); - svcargv += 2; --svcargc; - } - else - fprintf(stderr, " %s\n", *(svcargv++)); - } - } - /* Run through the command line args all over again */ - longjmp(reparse_args, 1); - } - else if (ap_configtestonly) - fprintf (stderr, " (none)\n"); - } - } - else if (service_name && (install <= 1)) - { - ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, NULL, - "Service \"%s\" is not installed!", service_name); - clean_parent_exit(1); - } -#endif - /* ServerRoot/ServerConfFile are found in this order: * (1) serverroot set to Apache.exe's path, or HTTPD_ROOT if unparsable * (2) arguments are grabbed for the -n named service, if given @@ -7785,105 +6192,32 @@ int REALMAIN(int argc, char *argv[]) ap_getparents(ap_server_confname); ap_no2slash(ap_server_confname); -#ifdef WIN32 - /* Read the conf now unless we are uninstalling the service, - * or shutting down a running service - * (but do read the conf for the pidfile if we shutdown the console) - */ - if ((install >= 0) && (!service_name || !signal_to_send - || strcasecmp(signal_to_send,"shutdown"))) { - server_conf = ap_read_config(pconf, ptrans, ap_server_confname); - } - - if (install) { - if (install > 0) - InstallService(pconf, service_name, argc, argv, install == 1); - else - RemoveService(service_name); - clean_parent_exit(0); - } - - /* All NT signals, and all but the 9x start signal are handled entirely. - * Die if we failed, are on NT, or are not "start"ing the service - */ - if (service_name && signal_to_send) { - if (send_signal_to_service(service_name, signal_to_send, argc, argv)) - clean_parent_exit(0); - if (isWindowsNT() || strcasecmp(signal_to_send, "start")) - clean_parent_exit(1); - /* Still here? Then we are hanging around to detach the console - * and use this process as the Windows 9x service. - */ - } -#else /* ndef WIN32 */ server_conf = ap_read_config(pconf, ptrans, ap_server_confname); -#endif #ifdef EAPI ap_init_alloc_shared(FALSE); #endif if (ap_configtestonly) { fprintf(stderr, "%s: Syntax OK\n", ap_server_root_relative(pcommands, ap_server_confname)); -#ifdef WIN32 - clean_parent_exit(1); -#else clean_parent_exit(0); -#endif } if (ap_dump_settings) { -#ifdef WIN32 - clean_parent_exit(1); -#else clean_parent_exit(0); -#endif } -#ifdef WIN32 - /* Non-service Signals. (Ignore -k start for now [with or without -n arg]) */ - if (signal_to_send && strcasecmp(signal_to_send, "start")) { - send_signal(pconf, signal_to_send); - clean_parent_exit(0); - } -#endif - -#ifndef NETWARE if (!child && !ap_dump_settings) { ap_log_pid(pconf, ap_pid_fname); } -#endif post_parse_init(); -#if defined(OS2) - printf("%s running...\n", ap_get_server_version()); -#elif defined(WIN32) - if (!child) { - printf("%s running...\n", ap_get_server_version()); - } -#elif defined(NETWARE) - if (currentScreen != GetCurrentScreen()) { - SetCurrentScreen(currentScreen); /* switch to console screen I/O */ - SetAutoScreenDestructionMode(0); - } - printf("%s running...\n", ap_get_server_version()); -#endif - -#ifndef NETWARE if (one_process && !exit_event) exit_event = create_event(0, 0, NULL); if (one_process && !start_mutex) start_mutex = ap_create_mutex(NULL); -#endif - -#ifdef NETWARE - worker_main(); - destroy_semaphore(allowed_globals.jobsemaphore); - while((ap_thread_count) || (!shutdown_pending)) - ThreadSwitchWithDelay(); -#else /* * In the future, the main will spawn off a couple * of children and monitor them. As soon as a child @@ -7892,44 +6226,14 @@ int REALMAIN(int argc, char *argv[]) if (child || one_process) { if (!exit_event || !start_mutex) exit(-1); -#ifdef WIN32 - if (child) - ap_start_child_console(is_child_of_service); - else - ap_start_console_monitor(); -#endif worker_main(); ap_destroy_mutex(start_mutex); destroy_event(exit_event); } -#ifdef WIN32 - /* Windows NT service second time around ... we have all the overrides - * from the NT SCM, so go to town and return to the SCM when we quit. - */ - if (isWindowsNT() && isProcessService()) - { - master_main(argc, argv); - } - else if (service_name && signal_to_send && !isWindowsNT() - && !strcasecmp(signal_to_send, "start")) { - /* service95_main will call master_main() */ - service95_main(master_main, argc, argv, service_name); - } else { - /* Let's go fishing for some signals including ctrl+c, ctrl+break, - * logoff, close and shutdown, while the server is running - */ - ap_start_console_monitor(); master_main(argc, argv); } -#else /* ndef WIN32 */ - else - { - master_main(argc, argv); - } -#endif /* ndef WIN32 */ -#endif /* ndef NETWARE */ clean_parent_exit(0); return 0; /* purely to avoid a warning */ @@ -7958,22 +6262,6 @@ int main(int argc, char *argv[]) #endif /* ndef SHARED_CORE_TIESTATIC */ #else /* ndef SHARED_CORE_BOOTSTRAP */ -#if defined(OS2) || defined(CYGWIN) -/* Shared core loader for OS/2 and Cygwin */ - -#if defined(CYGWIN) -__declspec(dllimport) -#endif - - -int ap_main(int argc, char *argv[]); /* Load time linked from cyghttpd.dll */ - -int main(int argc, char *argv[]) -{ - return ap_main(argc, argv); -} - -#else /* ** Standalone Bootstrap Program for Shared Core support @@ -7992,11 +6280,7 @@ int main(int argc, char *argv[]) #include "ap_config.h" #include "httpd.h" -#if defined(HPUX) || defined(HPUX10) || defined(HPUX11) -#define VARNAME "SHLIB_PATH" -#else #define VARNAME "LD_LIBRARY_PATH" -#endif #ifndef SHARED_CORE_DIR #define SHARED_CORE_DIR HTTPD_ROOT "/libexec" @@ -8019,13 +6303,6 @@ int main(int argc, char *argv[], char *envp[]) char **envpnew; int c, i, l; -#ifdef MPE - /* - * MPE doesn't currently initialize the envp parameter. Instead, we must - * use the global variable environ. - */ - envp = environ; -#endif /* * parse argument line, @@ -8058,13 +6335,6 @@ int main(int argc, char *argv[], char *envp[]) } } -#ifdef MPE - /* - * MPE doesn't currently initialize the envp parameter. Instead, we must - * use the global variable environ. - */ - envp = environ; -#endif /* * create path to SHARED_CORE_EXECUTABLE_PROGRAM @@ -8114,7 +6384,6 @@ int main(int argc, char *argv[], char *envp[]) return 0; } -#endif /* def OS2 */ #endif /* ndef SHARED_CORE_BOOTSTRAP */ #ifndef SHARED_CORE_BOOTSTRAP diff --git a/usr.sbin/httpd/src/main/http_protocol.c b/usr.sbin/httpd/src/main/http_protocol.c index 850a64e8a6a..d995723c5a5 100644 --- a/usr.sbin/httpd/src/main/http_protocol.c +++ b/usr.sbin/httpd/src/main/http_protocol.c @@ -1,4 +1,4 @@ -/* $OpenBSD: http_protocol.c,v 1.26 2004/06/07 04:24:00 brad Exp $ */ +/* $OpenBSD: http_protocol.c,v 1.27 2004/12/02 19:42:47 henning Exp $ */ /* ==================================================================== * The Apache Software License, Version 1.1 * @@ -85,33 +85,6 @@ ap_bgetopt (r->connection->client, BO_BYTECT, &r->bytes_sent); \ } while (0) -#ifdef CHARSET_EBCDIC -/* Save & Restore the current conversion settings - * "input" means: ASCII -> EBCDIC (when reading MIME Headers and PUT/POST data) - * "output" means: EBCDIC -> ASCII (when sending MIME Headers and Chunks) - */ - -#define PUSH_EBCDIC_INPUTCONVERSION_STATE(_buff, _onoff) \ - int _convert_in = ap_bgetflag(_buff, B_ASCII2EBCDIC); \ - ap_bsetflag(_buff, B_ASCII2EBCDIC, _onoff); - -#define POP_EBCDIC_INPUTCONVERSION_STATE(_buff) \ - ap_bsetflag(_buff, B_ASCII2EBCDIC, _convert_in); - -#define PUSH_EBCDIC_INPUTCONVERSION_STATE_r(_req, _onoff) \ - ap_bsetflag(_req->connection->client, B_ASCII2EBCDIC, _onoff); - -#define POP_EBCDIC_INPUTCONVERSION_STATE_r(_req) \ - ap_bsetflag(_req->connection->client, B_ASCII2EBCDIC, _req->ebcdic.conv_in); - -#define PUSH_EBCDIC_OUTPUTCONVERSION_STATE_r(_req, _onoff) \ - ap_bsetflag(_req->connection->client, B_EBCDIC2ASCII, _onoff); - -#define POP_EBCDIC_OUTPUTCONVERSION_STATE_r(_req) \ - ap_bsetflag(_req->connection->client, B_EBCDIC2ASCII, _req->ebcdic.conv_out); - -#endif /*CHARSET_EBCDIC*/ - /* * Builds the content-type that should be sent to the client from the * content-type specified. The following rules are followed: @@ -249,14 +222,6 @@ static int byterange_boundary(request_rec *r, long start, long end, int output) { int length = 0; -#ifdef CHARSET_EBCDIC - /* determine current setting of conversion flag, - * set to ON (protocol strings MUST be converted) - * and reset to original setting before returning - */ - PUSH_EBCDIC_OUTPUTCONVERSION_STATE_r(r, 1); -#endif /*CHARSET_EBCDIC*/ - if (start < 0 || end < 0) { if (output) ap_rvputs(r, CRLF "--", r->boundary, "--" CRLF, NULL); @@ -277,10 +242,6 @@ static int byterange_boundary(request_rec *r, long start, long end, int output) + strlen(ct) + 23 + strlen(ts) + 4; } -#ifdef CHARSET_EBCDIC - POP_EBCDIC_OUTPUTCONVERSION_STATE_r(r); -#endif /*CHARSET_EBCDIC*/ - return length; } @@ -897,17 +858,6 @@ API_EXPORT(int) ap_getline(char *s, int n, BUFF *in, int fold) char *pos, next; int retval; int total = 0; -#ifdef CHARSET_EBCDIC - /* When ap_getline() is called, the HTTP protocol is in a state - * where we MUST be reading "plain text" protocol stuff, - * (Request line, MIME headers, Chunk sizes) regardless of - * the MIME type and conversion setting of the document itself. - * Save the current setting of the ASCII-EBCDIC conversion flag - * for uploads, then temporarily set it to ON - * (and restore it before returning). - */ - PUSH_EBCDIC_INPUTCONVERSION_STATE(in, 1); -#endif /*CHARSET_EBCDIC*/ pos = s; @@ -952,11 +902,6 @@ API_EXPORT(int) ap_getline(char *s, int n, BUFF *in, int fold) && (ap_blookc(&next, in) == 1) && ((next == ' ') || (next == '\t'))); -#ifdef CHARSET_EBCDIC - /* restore ASCII->EBCDIC conversion state */ - POP_EBCDIC_INPUTCONVERSION_STATE(in); -#endif /*CHARSET_EBCDIC*/ - return total; } @@ -990,18 +935,6 @@ CORE_EXPORT(void) ap_parse_uri(request_rec *r, const char *uri) r->args = r->parsed_uri.query; r->uri = r->parsed_uri.path ? r->parsed_uri.path : ap_pstrdup(r->pool, "/"); -#if defined(OS2) || defined(WIN32) - /* Handle path translations for OS/2 and plug security hole. - * This will prevent "http://www.wherever.com/..\..\/" from - * returning a directory for the root drive. - */ - { - char *x; - - for (x = r->uri; (x = strchr(x, '\\')) != NULL; ) - *x = '/'; - } -#endif /* OS2 || WIN32 */ } else { r->args = NULL; @@ -1224,11 +1157,6 @@ API_EXPORT(request_rec *) ap_read_request(conn_rec *conn) r->ctx = ap_ctx_new(r->pool); #endif /* EAPI */ -#ifdef CHARSET_EBCDIC - ap_bsetflag(r->connection->client, B_ASCII2EBCDIC, r->ebcdic.conv_in = 1); - ap_bsetflag(r->connection->client, B_EBCDIC2ASCII, r->ebcdic.conv_out = 1); -#endif - /* Get the request... */ ap_keepalive_timeout("read request line", r); @@ -1469,9 +1397,6 @@ API_EXPORT(int) ap_get_basic_auth_pw(request_rec *r, const char **pw) return AUTH_REQUIRED; } - /* No CHARSET_EBCDIC Issue here because the line has already - * been converted to native text. - */ while (*auth_line== ' ' || *auth_line== '\t') auth_line++; @@ -1494,15 +1419,7 @@ API_EXPORT(int) ap_get_basic_auth_pw(request_rec *r, const char **pw) * and must be listed in order. */ -#ifdef UTS21 -/* The second const triggers an assembler bug on UTS 2.1. - * Another workaround is to move some code out of this file into another, - * but this is easier. Dave Dykstra, 3/31/99 - */ -static const char * status_lines[RESPONSE_CODES] = -#else static const char * const status_lines[RESPONSE_CODES] = -#endif { "100 Continue", "101 Switching Protocols", @@ -1631,10 +1548,6 @@ API_EXPORT(void) ap_basic_http_header(request_rec *r) else protocol = SERVER_PROTOCOL; -#ifdef CHARSET_EBCDIC - PUSH_EBCDIC_OUTPUTCONVERSION_STATE_r(r, 1); -#endif /*CHARSET_EBCDIC*/ - /* output the HTTP/1.x Status-Line */ ap_rvputs(r, protocol, " ", r->status_line, CRLF, NULL); @@ -1656,9 +1569,6 @@ API_EXPORT(void) ap_basic_http_header(request_rec *r) /* unset so we don't send them again */ ap_table_unset(r->headers_out, "Date"); /* Avoid bogosity */ ap_table_unset(r->headers_out, "Server"); -#ifdef CHARSET_EBCDIC - POP_EBCDIC_OUTPUTCONVERSION_STATE_r(r); -#endif /*CHARSET_EBCDIC*/ } /* Navigator versions 2.x, 3.x and 4.0 betas up to and including 4.0b2 @@ -1728,10 +1638,6 @@ API_EXPORT(int) ap_send_http_trace(request_rec *r) r->content_type = "message/http"; ap_send_http_header(r); -#ifdef CHARSET_EBCDIC - /* Server-generated response, converted */ - ap_bsetflag(r->connection->client, B_EBCDIC2ASCII, r->ebcdic.conv_out = 1); -#endif /* Now we recreate the request, and echo it back */ @@ -1869,11 +1775,6 @@ API_EXPORT(void) ap_send_http_header(request_rec *r) int i; const long int zero = 0L; -#ifdef CHARSET_EBCDIC - /* Use previously determined conversion (output): */ - ap_bsetflag(r->connection->client, B_EBCDIC2ASCII, ap_checkconv(r)); -#endif /*CHARSET_EBCDIC*/ - if (r->assbackwards) { if (!r->main) ap_bsetopt(r->connection->client, BO_BYTECT, &zero); @@ -1908,10 +1809,6 @@ API_EXPORT(void) ap_send_http_header(request_rec *r) ap_basic_http_header(r); -#ifdef CHARSET_EBCDIC - PUSH_EBCDIC_OUTPUTCONVERSION_STATE_r(r, 1); -#endif /*CHARSET_EBCDIC*/ - ap_set_keepalive(r); if (r->chunked) { @@ -1961,9 +1858,6 @@ API_EXPORT(void) ap_send_http_header(request_rec *r) /* Set buffer flags for the body */ if (r->chunked) ap_bsetflag(r->connection->client, B_CHUNK, 1); -#ifdef CHARSET_EBCDIC - POP_EBCDIC_OUTPUTCONVERSION_STATE_r(r); -#endif /*CHARSET_EBCDIC*/ } /* finalize_request_protocol is called at completion of sending the @@ -1974,9 +1868,6 @@ API_EXPORT(void) ap_send_http_header(request_rec *r) API_EXPORT(void) ap_finalize_request_protocol(request_rec *r) { if (r->chunked && !r->connection->aborted) { -#ifdef CHARSET_EBCDIC - PUSH_EBCDIC_OUTPUTCONVERSION_STATE_r(r, 1); -#endif /* * Turn off chunked encoding --- we can only do this once. */ @@ -1989,9 +1880,6 @@ API_EXPORT(void) ap_finalize_request_protocol(request_rec *r) ap_rputs(CRLF, r); ap_kill_timeout(r); -#ifdef CHARSET_EBCDIC - POP_EBCDIC_OUTPUTCONVERSION_STATE_r(r); -#endif /*CHARSET_EBCDIC*/ } } @@ -2103,16 +1991,6 @@ API_EXPORT(int) ap_setup_client_block(request_rec *r, int read_policy) return HTTP_REQUEST_ENTITY_TOO_LARGE; } -#ifdef CHARSET_EBCDIC - { - /* Determine the EBCDIC conversion for the uploaded content - * by looking at the Content-Type MIME header. - * If no Content-Type header is found, text conversion is assumed. - */ - ap_bsetflag(r->connection->client, B_ASCII2EBCDIC, ap_checkconv_in(r)); - } -#endif - return OK; } @@ -2325,20 +2203,11 @@ API_EXPORT(long) ap_get_client_block(request_rec *r, char *buffer, int bufsiz) r->remaining -= len_read; if (r->remaining == 0) { /* End of chunk, get trailing CRLF */ -#ifdef CHARSET_EBCDIC - /* Chunk end is Protocol stuff! Set conversion = 1 to read CR LF: */ - PUSH_EBCDIC_INPUTCONVERSION_STATE_r(r, 1); -#endif /*CHARSET_EBCDIC*/ if ((c = ap_bgetc(r->connection->client)) == CR) { c = ap_bgetc(r->connection->client); } -#ifdef CHARSET_EBCDIC - /* restore ASCII->EBCDIC conversion state */ - POP_EBCDIC_INPUTCONVERSION_STATE_r(r); -#endif /*CHARSET_EBCDIC*/ - if (c != LF) { r->connection->keepalive = -1; return -1; @@ -2469,9 +2338,6 @@ API_EXPORT(long) ap_send_fb_length(BUFF *fb, request_rec *r, long length) long total_bytes_sent = 0; register int n, w, o, len, fd; fd_set fds; -#ifdef TPF - struct timeval tv; -#endif if (length == 0) return 0; @@ -2808,10 +2674,6 @@ API_EXPORT(void) ap_send_error_response(request_rec *r, int recursive_error) int idx = ap_index_of_response(status); char *custom_response; const char *location = ap_table_get(r->headers_out, "Location"); -#ifdef CHARSET_EBCDIC - /* Error Responses (builtin / string literal / redirection) are TEXT! */ - ap_bsetflag(r->connection->client, B_EBCDIC2ASCII, r->ebcdic.conv_out = 1); -#endif /* * It's possible that the Location field might be in r->err_headers_out @@ -2905,11 +2767,6 @@ API_EXPORT(void) ap_send_error_response(request_rec *r, int recursive_error) } } -#ifdef CHARSET_EBCDIC - /* Server-generated response, converted */ - ap_bsetflag(r->connection->client, B_EBCDIC2ASCII, r->ebcdic.conv_out = 1); -#endif - ap_hard_timeout("send error body", r); if ((custom_response = ap_response_code_string(r, idx))) { diff --git a/usr.sbin/httpd/src/main/http_request.c b/usr.sbin/httpd/src/main/http_request.c index b936a6c083e..20f4fa0b5df 100644 --- a/usr.sbin/httpd/src/main/http_request.c +++ b/usr.sbin/httpd/src/main/http_request.c @@ -114,10 +114,6 @@ static int check_safe_file(request_rec *r) static int check_symlinks(char *d, int opts) { -#if defined(OS2) || defined(WIN32) || defined(NETWARE) - /* OS/2 doesn't have symlinks */ - return OK; -#else struct stat lfi, fi; char *lastp; int res; @@ -167,7 +163,6 @@ static int check_symlinks(char *d, int opts) return (fi.st_uid == lfi.st_uid) ? OK : HTTP_FORBIDDEN; -#endif } /* Dealing with the file system to get PATH_INFO @@ -247,9 +242,6 @@ static int get_path_info(request_rec *r) else { errno = 0; rv = stat(path, &r->finfo); -#ifdef OS2 - r->finfo.st_ino = 0; -#endif } if (cp != end) @@ -458,15 +450,6 @@ static int directory_walk(request_rec *r) iStart = 4; #endif -#if defined(NETWARE) - /* If the name is a fully qualified volume name, then do not perform any - * true file test on the machine name (start at machine/share:/) - * XXX: The implementation eludes me at this moment... - * Does this make sense? Please test! - */ - if (num_dirs > 1 && strchr(test_filename, '/') < strchr(test_filename, ':')) - iStart = 2; -#endif #if defined(HAVE_DRIVE_LETTERS) || defined(NETWARE) /* Should match <Directory> sections starting from '/', not 'e:/' @@ -788,11 +771,6 @@ static request_rec *make_sub_request(const request_rec *r) request_rec *rr = ap_pcalloc(rrp, sizeof(request_rec)); rr->pool = rrp; -#ifdef CHARSET_EBCDIC - /* Assume virgin state (like after reading the request_line): */ - ap_bsetflag(r->connection->client, B_ASCII2EBCDIC, rr->ebcdic.conv_in = 1); - ap_bsetflag(r->connection->client, B_EBCDIC2ASCII, rr->ebcdic.conv_out = 1); -#endif return rr; } @@ -1039,12 +1017,6 @@ API_EXPORT(int) ap_run_sub_req(request_rec *r) API_EXPORT(void) ap_destroy_sub_req(request_rec *r) { -#ifdef CHARSET_EBCDIC - if (r->main) { - ap_bsetflag(r->connection->client, B_ASCII2EBCDIC, r->main->ebcdic.conv_in); - ap_bsetflag(r->connection->client, B_EBCDIC2ASCII, r->main->ebcdic.conv_out); - } -#endif /* Reclaim the space */ ap_destroy_pool(r->pool); } @@ -1444,10 +1416,6 @@ static request_rec *internal_internal_redirect(const char *new_uri, request_rec new->no_local_copy = r->no_local_copy; new->read_length = r->read_length; /* We can only read it once */ new->vlist_validator = r->vlist_validator; -#ifdef CHARSET_EBCDIC /* @@@ Is this correct? When is it used? */ - new->ebcdic.conv_out= r->ebcdic.conv_out; - new->ebcdic.conv_in = r->ebcdic.conv_in; -#endif ap_table_setn(new->subprocess_env, "REDIRECT_STATUS", ap_psprintf(r->pool, "%d", r->status)); diff --git a/usr.sbin/httpd/src/main/rfc1413.c b/usr.sbin/httpd/src/main/rfc1413.c index 6bc0dbfc72b..f53d9e5a461 100644 --- a/usr.sbin/httpd/src/main/rfc1413.c +++ b/usr.sbin/httpd/src/main/rfc1413.c @@ -99,33 +99,13 @@ int ap_rfc1413_timeout = RFC1413_TIMEOUT; /* Global so it can be changed */ -#if (defined (NETWARE) || defined (WIN32)) -#define write(a,b,c) send(a,b,c,0) -#define read(a,b,c) recv(a,b,c,0) -#endif #ifdef MULTITHREAD #define RFC_USER_STATIC static int setsocktimeout (int sock, int timeout) { -#if (defined (NETWARE) || defined (WIN32)) - u_long msec = 0; - - /* Make sure that we are in blocking mode */ - if (ioctlsocket(sock, FIONBIO, &msec) == SOCKET_ERROR) { - return h_errno; - } - - /* Win32 timeouts are in msec, represented as int */ - msec = timeout * 1000; - setsockopt(sock, SOL_SOCKET, SO_RCVTIMEO, - (char *) &msec, sizeof(msec)); - setsockopt(sock, SOL_SOCKET, SO_SNDTIMEO, - (char *) &msec, sizeof(msec)); -#else /* XXX Needs to be implemented for non-winsock platforms */ -#endif return 0; } #else /* MULTITHREAD */ @@ -164,9 +144,6 @@ static int get_rfc1413(int sock, const struct sockaddr_in *our_sin, our_query_sin = *our_sin; our_query_sin.sin_port = htons(ANY_PORT); -#ifdef MPE - our_query_sin.sin_addr.s_addr = INADDR_ANY; -#endif rmt_query_sin = *rmt_sin; rmt_query_sin.sin_port = htons(RFC1413_PORT); @@ -190,9 +167,6 @@ static int get_rfc1413(int sock, const struct sockaddr_in *our_sin, ntohs(our_sin->sin_port)); /* send query to server. Handle short write. */ -#ifdef CHARSET_EBCDIC - ebcdic2ascii(buffer, buffer, buflen); -#endif i = 0; while(i < (int)strlen(buffer)) { int j; @@ -222,20 +196,6 @@ static int get_rfc1413(int sock, const struct sockaddr_in *our_sin, while((cp = strchr(buffer, '\012')) == NULL && i < sizeof(buffer) - 1) { int j; -#ifdef TPF - /* - * socket read on TPF doesn't get interrupted by - * signals so additional processing is needed - */ - j = ap_set_callback_and_alarm(NULL, 0); - ap_set_callback_and_alarm(ident_timeout, j); - j = select(&sock, 1, 0, 0, j * 1000); - if (j < 1) { - ap_set_callback_and_alarm(NULL, 0); - ap_check_signals(); - return -1; - } -#endif /* TPF */ j = read(sock, buffer+i, (sizeof(buffer) - 1) - i); if (j < 0 && errno != EINTR) { ap_log_error(APLOG_MARK, APLOG_CRIT, srv, @@ -248,9 +208,6 @@ static int get_rfc1413(int sock, const struct sockaddr_in *our_sin, } /* RFC1413_USERLEN = 512 */ -#ifdef CHARSET_EBCDIC - ascii2ebcdic(buffer, buffer, (size_t)i); -#endif if (sscanf(buffer, "%u , %u : USERID :%*[^:]:%512s", &rmt_port, &our_port, user) != 3 || ntohs(rmt_sin->sin_port) != rmt_port || ntohs(our_sin->sin_port) != our_port) diff --git a/usr.sbin/httpd/src/main/util.c b/usr.sbin/httpd/src/main/util.c index f7cb18f8fdd..ec296c7b074 100644 --- a/usr.sbin/httpd/src/main/util.c +++ b/usr.sbin/httpd/src/main/util.c @@ -72,12 +72,6 @@ #include "httpd.h" #include "http_conf_globals.h" /* for user_id & group_id */ #include "http_log.h" -#if defined(SUNOS4) -/* stdio.h has been read in ap_config.h already. Add missing prototypes here: */ -extern int fgetc(FILE *); -extern char *fgets(char *s, int, FILE*); -extern int fclose(FILE *); -#endif /* A bunch of functions in util.c scan strings looking for certain characters. * To make that more efficient we encode a lookup table. The test_char_table @@ -900,13 +894,7 @@ API_EXPORT(configfile_t *) ap_pcfg_openfile(pool *p, const char *name) if (fstat(fileno(file), &stbuf) == 0 && !S_ISREG(stbuf.st_mode) && -#if defined(WIN32) || defined(OS2) - !(strcasecmp(name, "nul") == 0 || - (strlen(name) >= 4 && - strcasecmp(name + strlen(name) - 4, "/nul") == 0))) { -#else strcmp(name, "/dev/null") != 0) { -#endif /* WIN32 || OS2 */ saved_errno = errno; ap_log_error(APLOG_MARK, APLOG_ERR | APLOG_NOERRNO, NULL, "Access to file %s denied by server: not a regular file", @@ -1460,9 +1448,6 @@ static const char c2x_table[] = "0123456789abcdef"; static ap_inline unsigned char *c2x(unsigned what, unsigned char *where) { -#ifdef CHARSET_EBCDIC - what = os_toascii[what]; -#endif /*CHARSET_EBCDIC*/ *where++ = '%'; *where++ = c2x_table[what >> 4]; *where++ = c2x_table[what & 0xf]; @@ -1595,17 +1580,6 @@ API_EXPORT(char *) ap_escape_shell_cmd(pool *p, const char *str) s = (const unsigned char *)str; for (; *s; ++s) { -#if defined(WIN32) || defined(OS2) - /* - * Newlines to Win32/OS2 CreateProcess() are ill advised. - * Convert them to spaces since they are effectively white - * space to most applications - */ - if (*s == '\r' || *s == '\n') { - *d++ = ' '; - continue; - } -#endif if (TEST_CHAR(*s, T_ESCAPE_SHELL_CMD)) { *d++ = '\\'; @@ -1621,19 +1595,9 @@ static char x2c(const char *what) { register char digit; -#ifndef CHARSET_EBCDIC digit = ((what[0] >= 'A') ? ((what[0] & 0xdf) - 'A') + 10 : (what[0] - '0')); digit *= 16; digit += (what[1] >= 'A' ? ((what[1] & 0xdf) - 'A') + 10 : (what[1] - '0')); -#else /*CHARSET_EBCDIC*/ - char xstr[5]; - xstr[0]='0'; - xstr[1]='x'; - xstr[2]=what[0]; - xstr[3]=what[1]; - xstr[4]='\0'; - digit = os_toebcdic[0xFF & ap_strtol(xstr, NULL, 16)]; -#endif /*CHARSET_EBCDIC*/ return (digit); } @@ -1852,10 +1816,6 @@ API_EXPORT(int) ap_can_exec(const struct stat *finfo) #ifdef MULTIPLE_GROUPS int cnt; #endif -#if defined(OS2) || defined(WIN32) || defined(NETWARE) - /* OS/2 dosen't have Users and Groups */ - return 1; -#else if (ap_user_id == finfo->st_uid) if (finfo->st_mode & S_IXUSR) return 1; @@ -1870,7 +1830,6 @@ API_EXPORT(int) ap_can_exec(const struct stat *finfo) } #endif return ((finfo->st_mode & S_IXOTH) != 0); -#endif } #ifdef NEED_STRDUP @@ -1961,10 +1920,6 @@ char *strstr(char *s1, char *s2) #ifdef NEED_INITGROUPS int initgroups(const char *name, gid_t basegid) { -#if defined(QNX) || defined(MPE) || defined(BEOS) || defined(TPF) || defined(__TANDEM) || defined(NETWARE) || defined(BONE) -/* QNX, MPE and BeOS do not appear to support supplementary groups. */ - return 0; -#else /* ndef QNX */ gid_t groups[NGROUPS_MAX]; struct group *g; int index = 0; @@ -1985,7 +1940,6 @@ int initgroups(const char *name, gid_t basegid) endgrent(); return setgroups(index, groups); -#endif /* def QNX */ } #endif /* def NEED_INITGROUPS */ @@ -2041,9 +1995,6 @@ API_EXPORT(void) ap_str_tolower(char *str) API_EXPORT(uid_t) ap_uname2id(const char *name) { -#if defined(WIN32) || defined(NETWARE) - return (1); -#else struct passwd *ent; if (name[0] == '#') @@ -2054,14 +2005,10 @@ API_EXPORT(uid_t) ap_uname2id(const char *name) exit(1); } return (ent->pw_uid); -#endif } API_EXPORT(gid_t) ap_gname2id(const char *name) { -#if defined(WIN32) || defined(NETWARE) - return (1); -#else struct group *ent; if (name[0] == '#') @@ -2072,7 +2019,6 @@ API_EXPORT(gid_t) ap_gname2id(const char *name) exit(1); } return (ent->gr_gid); -#endif } @@ -2155,11 +2101,7 @@ API_EXPORT(char *) ap_get_local_host(pool *a) char *server_hostname = NULL; struct hostent *p; -#ifdef BEOS /* BeOS returns zero as an error for gethostname */ - if (gethostname(str, sizeof(str) - 1) == 0) { -#else if (gethostname(str, sizeof(str) - 1) != 0) { -#endif /* BeOS */ ap_log_error(APLOG_MARK, APLOG_WARNING, NULL, "%s: gethostname() failed to determine ServerName\n", ap_server_argv0); @@ -2235,71 +2177,6 @@ API_EXPORT(char *) ap_uuencode(pool *p, char *string) return ap_pbase64encode(p, string); } -#if defined(OS2) || defined(WIN32) -/* quotes in the string are doubled up. - * Used to escape quotes in args passed to OS/2's cmd.exe - * and Win32's command.com - */ -API_EXPORT(char *) ap_double_quotes(pool *p, const char *str) -{ - int num_quotes = 0; - int len = 0; - char *quote_doubled_str, *dest; - - while (str[len]) { - if (str[len++] == '\"') { - num_quotes++; - } - } - - quote_doubled_str = ap_palloc(p, len + num_quotes + 1); - dest = quote_doubled_str; - - while (*str) { - if (*str == '\"') - *(dest++) = '\"'; - *(dest++) = *(str++); - } - - *dest = 0; - return quote_doubled_str; -} - -/* - * If ap_caret_escape_args resembles ap_escape_shell_cmd, it aught to. - * Taken verbatim so we can trust the integrety of this function. - */ -API_EXPORT(char *) ap_caret_escape_args(pool *p, const char *str) -{ - char *cmd; - unsigned char *d; - const unsigned char *s; - - cmd = ap_palloc(p, 2 * strlen(str) + 1); /* Be safe */ - d = (unsigned char *)cmd; - s = (const unsigned char *)str; - for (; *s; ++s) { - - /* - * Newlines to Win32/OS2 CreateProcess() are ill advised. - * Convert them to spaces since they are effectively white - * space to most applications - */ - if (*s == '\r' || *s == '\n') { - *d++ = ' '; - continue; - } - - if (TEST_CHAR(*s, T_ESCAPE_SHELL_CMD)) { - *d++ = '^'; - } - *d++ = *s; - } - *d = '\0'; - - return cmd; -} -#endif #ifdef NEED_STRERROR char * diff --git a/usr.sbin/httpd/src/main/util_md5.c b/usr.sbin/httpd/src/main/util_md5.c index 9fdeef8348b..738231c8af8 100644 --- a/usr.sbin/httpd/src/main/util_md5.c +++ b/usr.sbin/httpd/src/main/util_md5.c @@ -188,27 +188,6 @@ API_EXPORT(char *) ap_md5contextTo64(pool *a, AP_MD5_CTX * context) return encodedDigest; } -#ifdef CHARSET_EBCDIC - -API_EXPORT(char *) ap_md5digest(pool *p, FILE *infile, int convert) -{ - AP_MD5_CTX context; - unsigned char buf[1000]; - int nbytes; - - ap_MD5Init(&context); - while ((nbytes = fread(buf, 1, sizeof(buf), infile))) { - if (!convert) { - ascii2ebcdic(buf, buf, nbytes); - } - ap_MD5Update(&context, buf, nbytes); - } - rewind(infile); - return ap_md5contextTo64(p, &context); -} - -#else - API_EXPORT(char *) ap_md5digest(pool *p, FILE *infile) { AP_MD5_CTX context; @@ -222,5 +201,3 @@ API_EXPORT(char *) ap_md5digest(pool *p, FILE *infile) rewind(infile); return ap_md5contextTo64(p, &context); } - -#endif /* CHARSET_EBCDIC */ diff --git a/usr.sbin/httpd/src/main/util_script.c b/usr.sbin/httpd/src/main/util_script.c index f61d696153b..f06190fdb59 100644 --- a/usr.sbin/httpd/src/main/util_script.c +++ b/usr.sbin/httpd/src/main/util_script.c @@ -68,10 +68,6 @@ #include "util_script.h" #include "util_date.h" /* For parseHTTPdate() */ -#ifdef OS2 -#define INCL_DOS -#include <os2.h> -#endif /* * Various utility functions which are common to a whole lot of @@ -196,9 +192,6 @@ API_EXPORT(void) ap_add_common_vars(request_rec *r) conn_rec *c = r->connection; const char *rem_logname; char *env_path; -#if defined(WIN32) || defined(OS2) - char *env_temp; -#endif const char *host; array_header *hdrs_arr = ap_table_elts(r->headers_in); table_entry *hdrs = (table_entry *) hdrs_arr->elts; @@ -250,33 +243,6 @@ API_EXPORT(void) ap_add_common_vars(request_rec *r) env_path = DEFAULT_PATH; } -#ifdef WIN32 - if (env_temp = getenv("SystemRoot")) { - ap_table_addn(e, "SystemRoot", env_temp); - } - if (env_temp = getenv("COMSPEC")) { - ap_table_addn(e, "COMSPEC", env_temp); - } - if (env_temp = getenv("WINDIR")) { - ap_table_addn(e, "WINDIR", env_temp); - } -#endif - -#ifdef OS2 - if ((env_temp = getenv("COMSPEC")) != NULL) { - ap_table_addn(e, "COMSPEC", env_temp); - } - if ((env_temp = getenv("ETC")) != NULL) { - ap_table_addn(e, "ETC", env_temp); - } - if ((env_temp = getenv("DPATH")) != NULL) { - ap_table_addn(e, "DPATH", env_temp); - } - if ((env_temp = getenv("PERLLIB_PREFIX")) != NULL) { - ap_table_addn(e, "PERLLIB_PREFIX", env_temp); - } -#endif - ap_table_addn(e, "PATH", env_path); ap_table_addn(e, "SERVER_SIGNATURE", ap_psignature("", r)); ap_table_addn(e, "SERVER_SOFTWARE", ap_get_server_version()); @@ -417,18 +383,9 @@ API_EXPORT(void) ap_add_cgi_vars(request_rec *r) pa_req = ap_sub_req_lookup_uri(ap_escape_uri(r->pool, r->path_info), r); if (pa_req->filename) { -#ifdef WIN32 - char buffer[HUGE_STRING_LEN]; -#endif char *pt = ap_pstrcat(r->pool, pa_req->filename, pa_req->path_info, NULL); -#ifdef WIN32 - /* We need to make this a real Windows path name */ - GetFullPathName(pt, HUGE_STRING_LEN, buffer, NULL); - ap_table_setn(e, "PATH_TRANSLATED", ap_pstrdup(r->pool, buffer)); -#else ap_table_setn(e, "PATH_TRANSLATED", pt); -#endif } ap_destroy_sub_req(pa_req); } @@ -528,27 +485,6 @@ API_EXPORT(int) ap_scan_script_header_err_core(request_rec *r, char *buffer, /* if we see a bogus header don't ignore it. Shout and scream */ -#ifdef CHARSET_EBCDIC - /* Chances are that we received an ASCII header text instead of - * the expected EBCDIC header lines. Try to auto-detect: - */ - if (!(l = strchr(w, ':'))) { - int maybeASCII = 0, maybeEBCDIC = 0; - char *cp; - - for (cp = w; *cp != '\0'; ++cp) { - if (isprint(*cp) && !isprint(os_toebcdic[*cp])) - ++maybeEBCDIC; - if (!isprint(*cp) && isprint(os_toebcdic[*cp])) - ++maybeASCII; - } - if (maybeASCII > maybeEBCDIC) { - ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, r->server, - "CGI Interface Error: Script headers apparently ASCII: (CGI = %s)", r->filename); - ascii2ebcdic(w, w, cp - w); - } - } -#endif if (!(l = strchr(w, ':'))) { char malformed[(sizeof MALFORMED_MESSAGE) + 1 + MALFORMED_HEADER_LENGTH_TO_SHOW]; @@ -735,14 +671,12 @@ API_EXPORT(int) ap_call_exec(request_rec *r, child_info *pinfo, char *argv0, conf = (core_dir_config *) ap_get_module_config(r->per_dir_config, &core_module); -#if !defined(WIN32) && !defined(OS2) /* the fd on r->server->error_log is closed, but we need somewhere to * put the error messages from the log_* functions. So, we use stderr, * since that is better than allowing errors to go unnoticed. Don't do * this on Win32, though, since we haven't fork()'d. */ r->server->error_log = stderr; -#endif #ifdef RLIMIT_CPU if (conf->limit_cpu != NULL) { @@ -786,393 +720,6 @@ API_EXPORT(int) ap_call_exec(request_rec *r, child_info *pinfo, char *argv0, } #endif -#ifdef OS2 - { - /* Additions by Alec Kloss, to allow exec'ing of scripts under OS/2 */ - int is_script = 0; - char interpreter[2048]; /* hope it's enough for the interpreter path */ - char error_object[260]; - FILE *program; - char *cmdline = r->filename, *cmdline_pos; - int cmdlen; - char *args = "", *args_end; - ULONG rc; - RESULTCODES rescodes; - int env_len, e; - char *env_block, *env_block_pos; - - if ((conf->cgi_command_args != AP_FLAG_OFF) - && r->args && r->args[0] - && !strchr(r->args, '=')) { - args = r->args; - } - - program = fopen(r->filename, "rt"); - - if (!program) { - ap_log_rerror(APLOG_MARK, APLOG_ERR, r, "fopen(%s) failed", - r->filename); - return (pid); - } - - fgets(interpreter, sizeof(interpreter), program); - fclose(program); - - if (!strncmp(interpreter, "#!", 2)) { - is_script = 1; - interpreter[strlen(interpreter) - 1] = '\0'; - if (interpreter[2] != '/' && interpreter[2] != '\\' && interpreter[3] != ':') { - char buffer[300]; - if (DosSearchPath(SEARCH_ENVIRONMENT, "PATH", interpreter+2, buffer, sizeof(buffer)) == 0) { - strcpy(interpreter+2, buffer); - } else { - strcat(interpreter, ".exe"); - if (DosSearchPath(SEARCH_ENVIRONMENT, "PATH", interpreter+2, buffer, sizeof(buffer)) == 0) { - strcpy(interpreter+2, buffer); - } - } - } - } - - if (is_script) { - cmdline = ap_pstrcat(r->pool, interpreter+2, " ", r->filename, NULL); - } - else if (strstr(strupr(r->filename), ".CMD") > 0) { - /* Special case to allow use of REXX commands as scripts. */ - os2pathname(r->filename); - cmdline = ap_pstrcat(r->pool, SHELL_PATH, " /C ", r->filename, NULL); - } - else { - cmdline = r->filename; - } - - args = ap_pstrdup(r->pool, args); - ap_unescape_url(args); - args = ap_double_quotes(r->pool, args); - args_end = args + strlen(args); - - if (args_end - args > 4000) { /* cmd.exe won't handle lines longer than 4k */ - args_end = args + 4000; - *args_end = 0; - } - - /* +4 = 1 space between progname and args, 2 for double null at end, 2 for possible quote on first arg */ - cmdlen = strlen(cmdline) + strlen(args) + 4; - cmdline_pos = cmdline; - - while (*cmdline_pos) { - cmdlen += 2 * (*cmdline_pos == '+'); /* Allow space for each arg to be quoted */ - cmdline_pos++; - } - - cmdline = ap_pstrndup(r->pool, cmdline, cmdlen); - cmdline_pos = cmdline + strlen(cmdline); - - while (args < args_end) { - char *arg; - - arg = ap_getword_nc(r->pool, &args, '+'); - - if (strpbrk(arg, "&|<> ")) - arg = ap_pstrcat(r->pool, "\"", arg, "\"", NULL); - - *(cmdline_pos++) = ' '; - strcpy(cmdline_pos, arg); - cmdline_pos += strlen(cmdline_pos); - } - - *(++cmdline_pos) = 0; /* Add required second terminator */ - args = strchr(cmdline, ' '); - - if (args) { - *args = 0; - args++; - } - - /* Create environment block from list of envariables */ - for (env_len=1, e=0; env[e]; e++) - env_len += strlen(env[e]) + 1; - - env_block = ap_palloc(r->pool, env_len); - env_block_pos = env_block; - - for (e=0; env[e]; e++) { - strcpy(env_block_pos, env[e]); - env_block_pos += strlen(env_block_pos) + 1; - } - - *env_block_pos = 0; /* environment block is terminated by a double null */ - - rc = DosExecPgm(error_object, sizeof(error_object), EXEC_ASYNC, cmdline, env_block, &rescodes, cmdline); - - if (rc) { - ap_log_rerror(APLOG_MARK, APLOG_ERR, r, "DosExecPgm(%s %s) failed, %s - %s", - cmdline, args ? args : "", ap_os_error_message(rc), error_object ); - return -1; - } - - return rescodes.codeTerminate; - } -#elif defined(WIN32) - { - /* Adapted from Alec Kloss' work for OS/2 */ - char *interpreter = NULL; - char *invokename = NULL; - char *arguments = NULL; - char *ext = NULL; - char *s = NULL; - char *t = NULL; - char *pCommand; - char *pEnvBlock, *pNext; - - int i; - int iEnvBlockLen; - - file_type_e fileType; - - STARTUPINFO si; - PROCESS_INFORMATION pi; - - memset(&si, 0, sizeof(si)); - memset(&pi, 0, sizeof(pi)); - - pid = -1; - - if (!shellcmd) { - - fileType = ap_get_win32_interpreter(r, &interpreter); - - if (fileType == eFileTypeUNKNOWN) { - ap_log_rerror(APLOG_MARK, APLOG_ERR|APLOG_NOERRNO, r, - "%s is not executable; ensure interpreted scripts have " - "\"#!\" first line", - r->filename); - return (pid); - } - - if (interpreter && *interpreter - && (s = strstr(interpreter, "\"%1\""))) { - s[1] = '\0'; - s += 3; - invokename = ap_pstrdup(r->pool, r->filename); - } - else - { - char shortname[MAX_PATH]; - DWORD rv = GetShortPathName(r->filename, shortname, MAX_PATH); - if (!rv || rv >= MAX_PATH) { - ap_log_rerror(APLOG_MARK, APLOG_ERR|APLOG_NOERRNO, r, - "%s is not executable; cannot translate " - "to a short path name.", r->filename); - return (pid); - } - invokename = ap_pstrdup(r->pool, shortname); - - if (interpreter && *interpreter - && (s = strstr(interpreter, "%1"))) { - s[0] = '\0'; - s += 2; - } - } - for (t = invokename; *t; ++t) { - if (*t == '/') - *t = '\\'; - } - - /* - * Look at the arguments... - */ - arguments = ""; - if ((conf->cgi_command_args != AP_FLAG_OFF) - && (r->args) && (r->args[0]) - && !strchr(r->args, '=')) { - /* If we are in this leg, there are some other arguments - * that we must include in the execution of the CGI. - * Because CreateProcess is the way it is, we have to - * create a command line like format for the execution - * of the CGI. This means we need to create on long - * string with the executable and arguments. - * - * The arguments string comes in the request structure, - * and each argument is separated by a '+'. We'll replace - * these pluses with spaces. - */ - - int iStringSize = 0; - int x; - - /* - * Duplicate the request structure string so we don't change it. - */ - arguments = ap_pstrdup(r->pool, r->args); - - /* - * Change the '+' to ' ' - */ - for (x=0; arguments[x]; x++) { - if ('+' == arguments[x]) { - arguments[x] = ' '; - } - } - - /* - * We need to unescape any characters that are - * in the arguments list. Truncate to 4000 - * characters for safety, being careful of the - * now-escaped characters. - */ - ap_unescape_url(arguments); - arguments = ap_escape_shell_cmd(r->pool, arguments); - if (strlen(arguments) > 4000) - { - int len = 4000; - while (len && arguments[len - 1] == '\\') { - --len; - } - arguments[len] = '\0'; - } - - /* - * Now that the arguments list is 'shell' escaped with - * backslashes, we need to make cmd.exe/command.com - * safe from this same set of characters. - */ - if (fileType == eCommandShell32) { - arguments = ap_caret_escape_args(r->pool, arguments); - } - else if (fileType == eCommandShell16) { - arguments = ap_pstrcat(r->pool, "\"", - ap_double_quotes(r->pool, arguments), "\"", NULL); - } - } - - /* - * The remaining code merges the interpreter, the backslashed - * and potentially shortened invoke name, the various - * interpreter segments and the arguments. - * - * Note that interpreter started out with %1 %* arguments, - * so the *t character skips the %* arguments list, and the - * *s already skipped the %1 argument (quoted or not.) - */ - - if (s && (t = strstr(s, "%*"))) { - /* interpreter formatted: prog [opts] %1 [opts] %* [opts] - */ - t[0] = '\0'; - t += 2; - pCommand = ap_pstrcat(r->pool, interpreter, invokename, - s, arguments, t, NULL); - } - else if (s) { - /* interpreter formatted: prog [opts] %1 [opts] - */ - pCommand = ap_pstrcat(r->pool, interpreter, invokename, - s, " ", arguments, NULL); - } - else if (interpreter) { - /* interpreter formatted: prog [opts] - */ - pCommand = ap_pstrcat(r->pool, interpreter, " ", invokename, - " ", arguments, NULL); - } - else { - /* no interpreter required - */ - pCommand = ap_pstrcat(r->pool, invokename, - " ", arguments, NULL); - } - - } - else /* shellcmd */ - { - char *p, *comspec = getenv("COMSPEC"); - const char *quotecomspec; - const char *quoteargv0; - if (!comspec) - comspec = SHELL_PATH; - p = strchr(comspec, '\0'); - quotecomspec = (strchr(comspec, ' ') && comspec[0] != '\"') - ? "\"" : ""; - quoteargv0 = (strchr(argv0, ' ') && argv0[0] != '\"') ? "\"" : ""; - pCommand = ap_pstrcat(r->pool, quotecomspec, comspec, quotecomspec, - " /c ", quoteargv0, argv0, quoteargv0, NULL); - /* Forward slash argv[0] only */ - for (p = pCommand + strlen(pCommand) - strlen(argv0) - - strlen(quoteargv0); *p; ++p) { - if (*p == '/') - *p = '\\'; - } - } - - /* - * Make child process use hPipeOutputWrite as standard out, - * and make sure it does not show on screen. - */ - si.cb = sizeof(si); - si.dwFlags = STARTF_USESTDHANDLES | STARTF_USESHOWWINDOW; - si.wShowWindow = SW_HIDE; - si.hStdInput = pinfo->hPipeInputRead; - si.hStdOutput = pinfo->hPipeOutputWrite; - si.hStdError = pinfo->hPipeErrorWrite; - - /* - * Win32's CreateProcess call requires that the environment - * be passed in an environment block, a null terminated block of - * null terminated strings. - */ - i = 0; - iEnvBlockLen = 1; - while (env[i]) { - iEnvBlockLen += strlen(env[i]) + 1; - i++; - } - - pEnvBlock = (char *)ap_pcalloc(r->pool,iEnvBlockLen); - - i = 0; - pNext = pEnvBlock; - while (env[i]) { - strcpy(pNext, env[i]); - pNext = pNext + strlen(pNext) + 1; - i++; - } - - ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_INFO, r->server, - "Invoking CGI Command '%s'", pCommand); - for (i = 0; env[i]; ++i) { - ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_DEBUG, r->server, - " CGI env[%d] = '%s'", i, env[i]); - } - - if (CreateProcess(NULL, pCommand, NULL, NULL, TRUE, - 0, - pEnvBlock, - ap_make_dirstr_parent(r->pool, r->filename), - &si, &pi)) { - if (fileType == eFileTypeEXE16 || fileType == eCommandShell16) { - /* Hack to get 16-bit CGI's working. It works for all the - * standard modules shipped with Apache. pi.dwProcessId is 0 - * for 16-bit CGIs and all the Unix specific code that calls - * ap_call_exec interprets this as a failure case. And we can't - * use -1 either because it is mapped to 0 by the caller. - */ - pid = -2; - } - else { - pid = pi.dwProcessId; - /* - * We must close the handles to the new process and its main thread - * to prevent handle and memory leaks. - */ - CloseHandle(pi.hProcess); - CloseHandle(pi.hThread); - } - } - return (pid); - } -#elif defined(NETWARE) -#else if (ap_suexec_enabled && ((r->server->server_uid != ap_user_id) || (r->server->server_gid != ap_group_id) @@ -1266,5 +813,4 @@ API_EXPORT(int) ap_call_exec(request_rec *r, child_info *pinfo, char *argv0, } } return (pid); -#endif } diff --git a/usr.sbin/httpd/src/main/util_uri.c b/usr.sbin/httpd/src/main/util_uri.c index dfa75c97519..6daf5fcdb65 100644 --- a/usr.sbin/httpd/src/main/util_uri.c +++ b/usr.sbin/httpd/src/main/util_uri.c @@ -163,12 +163,7 @@ API_EXPORT(struct hostent *) ap_pduphostent(pool *p, const struct hostent *hp) */ API_EXPORT(struct hostent *) ap_pgethostbyname(pool *p, const char *hostname) { -#ifdef TPF - /* get rid of compilation warning on TPF */ - struct hostent *hp = gethostbyname((char *)hostname); -#else struct hostent *hp = gethostbyname(hostname); -#endif return (hp == NULL) ? NULL : ap_pduphostent(p, hp); } diff --git a/usr.sbin/httpd/src/modules/example/mod_example.c b/usr.sbin/httpd/src/modules/example/mod_example.c index d52f41d5b1b..80ca46a0276 100644 --- a/usr.sbin/httpd/src/modules/example/mod_example.c +++ b/usr.sbin/httpd/src/modules/example/mod_example.c @@ -516,10 +516,6 @@ static int example_handler(request_rec *r) ap_soft_timeout("send example call trace", r); ap_send_http_header(r); -#ifdef CHARSET_EBCDIC - /* Server-generated response, converted */ - ap_bsetflag(r->connection->client, B_EBCDIC2ASCII, r->ebcdic.conv_out = 1); -#endif /* * If we're only supposed to send header information (HEAD request), we're diff --git a/usr.sbin/httpd/src/modules/experimental/mod_auth_digest.c b/usr.sbin/httpd/src/modules/experimental/mod_auth_digest.c index db8735fd9d2..7c368181734 100644 --- a/usr.sbin/httpd/src/modules/experimental/mod_auth_digest.c +++ b/usr.sbin/httpd/src/modules/experimental/mod_auth_digest.c @@ -145,11 +145,6 @@ #include "util_md5.h" #include "ap_sha1.h" -#ifdef WIN32 -/* Crypt APIs are available on Win95 with OSR 2 */ -#include <wincrypt.h> -#endif - #ifdef HAVE_SHMEM_MM #include "mm.h" #endif /* HAVE_SHMEM_MM */ @@ -387,11 +382,7 @@ static void initialize_tables(server_rec *s) client_mm = mm_create(SHMEM_SIZE, tmpnam(NULL)); if (client_mm == NULL) goto failed; -#ifdef MPE - if (geteuid() == 1) { -#else if (geteuid() == 0) { -#endif if (mm_permission(client_mm, 0600, ap_user_id, ap_group_id)) goto failed; } @@ -410,11 +401,7 @@ static void initialize_tables(server_rec *s) opaque_mm = mm_create(sizeof(*opaque_cntr), tmpnam(NULL)); if (opaque_mm == NULL) goto failed; -#ifdef MPE - if (geteuid() == 1) { -#else if (geteuid() == 0) { -#endif if (mm_permission(opaque_mm, 0600, ap_user_id, ap_group_id)) goto failed; } @@ -429,11 +416,7 @@ static void initialize_tables(server_rec *s) otn_count_mm = mm_create(sizeof(*otn_counter), tmpnam(NULL)); if (otn_count_mm == NULL) goto failed; -#ifdef MPE - if (geteuid() == 1) { -#else if (geteuid() == 0) { -#endif if (mm_permission(otn_count_mm, 0600, ap_user_id, ap_group_id)) goto failed; } diff --git a/usr.sbin/httpd/src/modules/experimental/mod_mmap_static.c b/usr.sbin/httpd/src/modules/experimental/mod_mmap_static.c index 92fc50988e7..46f261aa820 100644 --- a/usr.sbin/httpd/src/modules/experimental/mod_mmap_static.c +++ b/usr.sbin/httpd/src/modules/experimental/mod_mmap_static.c @@ -348,10 +348,6 @@ static int mmap_static_handler(request_rec *r) return errstatus; } -#ifdef CHARSET_EBCDIC - /* check Content Type to see if ebcdic conversion is appropriate */ - ap_checkconv(r); -#endif rangestatus = ap_set_byterange(r); ap_send_http_header(r); diff --git a/usr.sbin/httpd/src/modules/proxy/proxy_cache.c b/usr.sbin/httpd/src/modules/proxy/proxy_cache.c index 45c316896fc..39da529027f 100644 --- a/usr.sbin/httpd/src/modules/proxy/proxy_cache.c +++ b/usr.sbin/httpd/src/modules/proxy/proxy_cache.c @@ -64,20 +64,9 @@ #include "http_main.h" #include "http_core.h" #include "util_date.h" -#ifdef WIN32 -#include <sys/utime.h> -#else #include <utime.h> -#endif /* WIN32 */ #include "multithread.h" #include "ap_md5.h" -#ifdef __TANDEM -#include <sys/types.h> -#include <sys/stat.h> -#endif -#ifdef TPF -#include "os.h" -#endif struct gc_ent { unsigned long int len; @@ -126,9 +115,7 @@ static int sub_garbage_coll(request_rec *r, array_header *files, const char *cachedir, const char *cachesubdir); static void help_proxy_garbage_coll(request_rec *r); static int should_proxy_garbage_coll(request_rec *r); -#if !defined(WIN32) && !defined(MPE) && !defined(OS2) && !defined(NETWARE) && !defined(TPF) static void detached_proxy_garbage_coll(request_rec *r); -#endif void ap_proxy_garbage_coll(request_rec *r) @@ -146,11 +133,7 @@ void ap_proxy_garbage_coll(request_rec *r) ap_block_alarms(); /* avoid SIGALRM on big cache cleanup */ if (should_proxy_garbage_coll(r)) -#if !defined(WIN32) && !defined(MPE) && !defined(OS2) && !defined(NETWARE) && !defined(TPF) detached_proxy_garbage_coll(r); -#else - help_proxy_garbage_coll(r); -#endif ap_unblock_alarms(); (void)ap_acquire_mutex(garbage_mutex); @@ -203,7 +186,6 @@ static int gcdiff(const void *ap, const void *bp) return 0; } -#if !defined(WIN32) && !defined(MPE) && !defined(OS2) && !defined(NETWARE) && !defined(TPF) static void detached_proxy_garbage_coll(request_rec *r) { pid_t pid; @@ -241,21 +223,6 @@ static void detached_proxy_garbage_coll(request_rec *r) ap_server_argv0); exit(1); } -#elif defined(NEXT) || defined(NEWSOS) - if (setpgrp(0, getpid()) == -1 || (pgrp = getpgrp(0)) == -1) { - perror("setpgrp"); - fprintf(stderr, "%S: setpgrp or getpgrp failed\n", - ap_server_argv0); - exit(1); - } -#elif defined(CYGWIN) - /* Cygwin does not take any argument for setpgrp() */ - if ((pgrp = setpgrp()) == -1) { - perror("setpgrp"); - fprintf(stderr, "%S: setpgrp failed\n", - ap_server_argv0); - exit(1); - } #else if ((pgrp = setpgrp(getpid(), 0)) == -1) { perror("setpgrp"); @@ -279,7 +246,6 @@ static void detached_proxy_garbage_coll(request_rec *r) return; } } -#endif /* ndef WIN32 */ #define DOT_TIME "/.time" /* marker */ @@ -426,11 +392,7 @@ static int sub_garbage_coll(request_rec *r, array_header *files, struct stat buf; int fd, i; DIR *dir; -#if defined(NEXT) || defined(WIN32) - struct DIR_TYPE *ent; -#else struct dirent *ent; -#endif struct gc_ent *fent; int nfiles = 0; char *filename; @@ -480,49 +442,8 @@ static int sub_garbage_coll(request_rec *r, array_header *files, /* under OS/2 use dirent's d_attr to identify a diretory */ /* under TPF use stat to identify a directory */ -#if defined(OS2) || defined(TPF) -/* is it a directory? */ -#ifdef OS2 - if (ent->d_attr & A_DIR) -#elif defined(TPF) - if (stat(filename, &buf) == -1) { - if (errno != ENOENT) - ap_log_error(APLOG_MARK, APLOG_ERR, r->server, - "proxy gc: stat(%s)", filename); - } - if (S_ISDIR(buf.st_mode)) -#endif - { - char newcachedir[HUGE_STRING_LEN]; - ap_snprintf(newcachedir, sizeof(newcachedir), - "%s%s/", cachesubdir, ent->d_name); - if (!sub_garbage_coll(r, files, cachebasedir, newcachedir)) { - ap_snprintf(newcachedir, sizeof(newcachedir), - "%s%s", cachedir, ent->d_name); -#if TESTING - fprintf(stderr, "Would remove directory %s\n", newcachedir); -#else - rmdir(newcachedir); -#endif - --nfiles; - } - continue; - } -#endif /* read the file */ -#if defined(WIN32) - /* - * On WIN32 open does not work for directories, so we us stat instead - * of fstat to determine if the file is a directory - */ - if (stat(filename, &buf) == -1) { - ap_log_error(APLOG_MARK, APLOG_ERR, r->server, - "proxy gc: stat(%s)", filename); - continue; - } - fd = -1; -#else fd = open(filename, O_RDONLY | O_BINARY); if (fd == -1) { if (errno != ENOENT) @@ -536,16 +457,10 @@ static int sub_garbage_coll(request_rec *r, array_header *files, close(fd); continue; } -#endif -/* In OS/2 and TPF this has already been done above */ -#if !defined(OS2) && !defined(TPF) if (S_ISDIR(buf.st_mode)) { char newcachedir[HUGE_STRING_LEN]; -#if !defined(WIN32) - /* Win32 used stat, no file to close */ close(fd); -#endif ap_snprintf(newcachedir, sizeof(newcachedir), "%s%s/", cachesubdir, ent->d_name); if (!sub_garbage_coll(r, files, cachebasedir, newcachedir)) { @@ -564,21 +479,7 @@ static int sub_garbage_coll(request_rec *r, array_header *files, } continue; } -#endif -#if defined(WIN32) - /* - * Since we have determined above that the file is not a directory, - * it should be safe to open it now - */ - fd = open(filename, O_RDONLY | O_BINARY); - if (fd == -1) { - if (errno != ENOENT) - ap_log_error(APLOG_MARK, APLOG_ERR, r->server, - "proxy gc: open(%s) = %d", filename, errno); - continue; - } -#endif i = read(fd, line, 17 * (3) - 1); close(fd); @@ -1617,7 +1518,6 @@ int ap_proxy_cache_update(cache_req *c, table *resp_hdrs, while (1) { /* create temporary filename */ -#ifndef TPF #define TMPFILESTR "/tmpXXXXXXXXXX" if (conf->cache.root == NULL) { c = ap_proxy_cache_error(c); @@ -1629,18 +1529,6 @@ int ap_proxy_cache_update(cache_req *c, table *resp_hdrs, strlcat(c->tempfile, TMPFILESTR, tflen); #undef TMPFILESTR p = mktemp(c->tempfile); -#else - if (conf->cache.root == NULL) { - c = ap_proxy_cache_error(c); - break; - } - tflen = strlen(conf->cache.root) + 1 + L_tmpnam; - c->tempfile = ap_palloc(r->pool, tflen); - strlcpy(c->tempfile, conf->cache.root, tflen); - strlcat(c->tempfile, "/", tflen); - p = tmpnam(NULL); - strlcat(c->tempfile, p, tflen); -#endif if (p == NULL) { c = ap_proxy_cache_error(c); break; @@ -1783,29 +1671,13 @@ void ap_proxy_cache_tidy(cache_req *c) if (!p) break; *p = '\0'; -#if defined(WIN32) || defined(NETWARE) - if (mkdir(c->filename) < 0 && errno != EEXIST) -#elif defined(__TANDEM) - if (mkdir(c->filename, S_IRWXU | S_IRWXG | S_IRWXO) < 0 && errno != EEXIST) -#else if (mkdir(c->filename, S_IREAD | S_IWRITE | S_IEXEC) < 0 && errno != EEXIST) -#endif /* WIN32 */ ap_log_error(APLOG_MARK, APLOG_ERR, s, "proxy: error creating cache directory %s", c->filename); *p = '/'; ++p; } -#if defined(OS2) || defined(WIN32) || defined(NETWARE) || defined(MPE) - /* Under OS/2 use rename. */ - if (rename(c->tempfile, c->filename) == -1) { - ap_log_error(APLOG_MARK, APLOG_ERR, s, - "proxy: error renaming cache file %s to %s", - c->tempfile, c->filename); - (void)unlink(c->tempfile); - } -#else - if (link(c->tempfile, c->filename) == -1) ap_log_error(APLOG_MARK, APLOG_INFO, s, "proxy: error linking cache file %s to %s", @@ -1813,6 +1685,5 @@ void ap_proxy_cache_tidy(cache_req *c) if (unlink(c->tempfile) == -1) ap_log_error(APLOG_MARK, APLOG_ERR, s, "proxy: error deleting temp file %s", c->tempfile); -#endif } } diff --git a/usr.sbin/httpd/src/modules/proxy/proxy_ftp.c b/usr.sbin/httpd/src/modules/proxy/proxy_ftp.c index a39c111fd0c..5d92443e5a9 100644 --- a/usr.sbin/httpd/src/modules/proxy/proxy_ftp.c +++ b/usr.sbin/httpd/src/modules/proxy/proxy_ftp.c @@ -692,7 +692,6 @@ int ap_proxy_ftp_handler(request_rec *r, cache_req *c, char *url) return HTTP_INTERNAL_SERVER_ERROR; } -#if !defined(TPF) && !defined(BEOS) if (conf->recv_buffer_size > 0 && setsockopt(sock, SOL_SOCKET, SO_RCVBUF, (const char *)&conf->recv_buffer_size, sizeof(int)) @@ -700,16 +699,13 @@ int ap_proxy_ftp_handler(request_rec *r, cache_req *c, char *url) ap_log_rerror(APLOG_MARK, APLOG_ERR, r, "setsockopt(SO_RCVBUF): Failed to set ProxyReceiveBufferSize, using default"); } -#endif if (setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, (void *)&one, sizeof(one)) == -1) { -#ifndef _OSD_POSIX /* BS2000 has this option "always on" */ ap_log_rerror(APLOG_MARK, APLOG_ERR, r, "proxy: error setting reuseaddr option: setsockopt(SO_REUSEADDR)"); ap_pclosesocket(p, sock); return HTTP_INTERNAL_SERVER_ERROR; -#endif /* _OSD_POSIX */ } #ifdef SINIX_D_RESOLVER_BUG @@ -748,9 +744,6 @@ int ap_proxy_ftp_handler(request_rec *r, cache_req *c, char *url) ap_bpushfd(ctrl, sock, sock); /* shouldn't we implement telnet control options here? */ -#ifdef CHARSET_EBCDIC - ap_bsetflag(ctrl, B_ASCII2EBCDIC | B_EBCDIC2ASCII, 1); -#endif /* CHARSET_EBCDIC */ /* possible results: */ /* 120 Service ready in nnn minutes. */ @@ -971,7 +964,6 @@ int ap_proxy_ftp_handler(request_rec *r, cache_req *c, char *url) "proxy: error creating PASV socket")); } -#if !defined (TPF) && !defined(BEOS) if (conf->recv_buffer_size) { if (setsockopt(dsock, SOL_SOCKET, SO_RCVBUF, (const char *)&conf->recv_buffer_size, sizeof(int)) == -1) { @@ -979,7 +971,6 @@ int ap_proxy_ftp_handler(request_rec *r, cache_req *c, char *url) "setsockopt(SO_RCVBUF): Failed to set ProxyReceiveBufferSize, using default"); } } -#endif ap_bputs("PASV" CRLF, ctrl); ap_bflush(ctrl); @@ -1061,11 +1052,9 @@ int ap_proxy_ftp_handler(request_rec *r, cache_req *c, char *url) if (setsockopt(dsock, SOL_SOCKET, SO_REUSEADDR, (void *)&one, sizeof(one)) == -1) { -#ifndef _OSD_POSIX /* BS2000 has this option "always on" */ return ftp_cleanup_and_return(r, ctrl, data, sock, dsock, ap_proxyerror(r, HTTP_INTERNAL_SERVER_ERROR, "proxy: error setting reuseaddr option")); -#endif /* _OSD_POSIX */ } if (bind(dsock, (struct sockaddr *)&server, @@ -1280,15 +1269,8 @@ int ap_proxy_ftp_handler(request_rec *r, cache_req *c, char *url) if (get_dirlisting) { ap_table_setn(resp_hdrs, "Content-Type", "text/html"); -#ifdef CHARSET_EBCDIC - r->ebcdic.conv_out = 1; /* server-generated */ -#endif } else { -#ifdef CHARSET_EBCDIC - r->ebcdic.conv_out = 0; /* do not convert what we read from the ftp - * server */ -#endif if (r->content_type != NULL) { ap_table_setn(resp_hdrs, "Content-Type", r->content_type); ap_log_error(APLOG_MARK, APLOG_DEBUG | APLOG_NOERRNO, r->server, "FTP: Content-Type set to %s", r->content_type); @@ -1366,9 +1348,6 @@ int ap_proxy_ftp_handler(request_rec *r, cache_req *c, char *url) /* finally output the headers to the client */ ap_send_http_header(r); -#ifdef CHARSET_EBCDIC - ap_bsetflag(r->connection->client, B_EBCDIC2ASCII, r->ebcdic.conv_out); -#endif /* send body */ if (!r->header_only) { if (!get_dirlisting) { diff --git a/usr.sbin/httpd/src/modules/proxy/proxy_http.c b/usr.sbin/httpd/src/modules/proxy/proxy_http.c index 428985691fd..8530abba4e5 100644 --- a/usr.sbin/httpd/src/modules/proxy/proxy_http.c +++ b/usr.sbin/httpd/src/modules/proxy/proxy_http.c @@ -263,7 +263,6 @@ int ap_proxy_http_handler(request_rec *r, cache_req *c, char *url, return HTTP_INTERNAL_SERVER_ERROR; } -#if !defined(TPF) && !defined(BEOS) if (conf->recv_buffer_size) { if (setsockopt(sock, SOL_SOCKET, SO_RCVBUF, (const char *)&conf->recv_buffer_size, sizeof(int)) @@ -272,7 +271,6 @@ int ap_proxy_http_handler(request_rec *r, cache_req *c, char *url, "setsockopt(SO_RCVBUF): Failed to set ProxyReceiveBufferSize, using default"); } } -#endif #ifdef SINIX_D_RESOLVER_BUG { @@ -665,16 +663,6 @@ int ap_proxy_http_handler(request_rec *r, cache_req *c, char *url, } */ -#ifdef CHARSET_EBCDIC - /* - * What we read/write after the header should not be modified (i.e., the - * cache copy is ASCII, not EBCDIC, even for text/html) - */ - r->ebcdic.conv_in = r->ebcdic.conv_out = 0; - ap_bsetflag(f, B_ASCII2EBCDIC | B_EBCDIC2ASCII, 0); - ap_bsetflag(r->connection->client, B_ASCII2EBCDIC | B_EBCDIC2ASCII, 0); -#endif - /* send body */ /* if header only, then cache will be NULL */ /* HTTP/1.0 tells us to read to EOF, rather than content-length bytes */ diff --git a/usr.sbin/httpd/src/modules/proxy/proxy_util.c b/usr.sbin/httpd/src/modules/proxy/proxy_util.c index 0c998b87f7a..f902f2858e5 100644 --- a/usr.sbin/httpd/src/modules/proxy/proxy_util.c +++ b/usr.sbin/httpd/src/modules/proxy/proxy_util.c @@ -74,7 +74,6 @@ static struct per_thread_data *get_per_thread_data(void); int ap_proxy_hex2c(const char *x) { int i; -#ifndef CHARSET_EBCDIC int ch; ch = x[0]; @@ -94,14 +93,10 @@ int ap_proxy_hex2c(const char *x) else i += ch - ('a' - 10); return i; -#else /* CHARSET_EBCDIC */ - return (1 == sscanf(x, "%2x", &i)) ? os_toebcdic[i & 0xFF] : 0; -#endif /* CHARSET_EBCDIC */ } void ap_proxy_c2hex(int ch, char *x) { -#ifndef CHARSET_EBCDIC int i; x[0] = '%'; @@ -116,14 +111,6 @@ void ap_proxy_c2hex(int ch, char *x) x[2] = ('A' - 10) + i; else x[2] = '0' + i; -#else /* CHARSET_EBCDIC */ - static const char ntoa[] = {"0123456789ABCDEF"}; - ch = os_toascii[ch & 0xFF]; - x[0] = '%'; - x[1] = ntoa[(ch >> 4) & 0x0F]; - x[2] = ntoa[ch & 0x0F]; - x[3] = '\0'; -#endif /* CHARSET_EBCDIC */ } /* @@ -283,11 +270,7 @@ char * if (!ap_isdigit(host[i]) && host[i] != '.') break; /* must be an IP address */ -#if defined(WIN32) || defined(NETWARE) || defined(TPF) || defined(BEOS) - if (host[i] == '\0' && (inet_addr(host) == -1)) -#else if (host[i] == '\0' && (ap_inet_addr(host) == -1 || inet_network(host) == -1)) -#endif { return "Bad IP address in URL"; } @@ -471,12 +454,6 @@ long int ap_proxy_send_fb(BUFF *f, request_rec *r, cache_req *c, off_t len, int if (c != NULL) c->written = 0; -#ifdef CHARSET_EBCDIC - /* The cache copy is ASCII, not EBCDIC, even for text/html) */ - ap_bsetflag(f, B_ASCII2EBCDIC | B_EBCDIC2ASCII, 0); - ap_bsetflag(con->client, B_ASCII2EBCDIC | B_EBCDIC2ASCII, 0); -#endif - /* * Since we are reading from one buffer and writing to another, it is * unsafe to do a soft_timeout here, at least until the proxy has its own @@ -485,11 +462,6 @@ long int ap_proxy_send_fb(BUFF *f, request_rec *r, cache_req *c, off_t len, int ap_kill_timeout(r); -#if defined(WIN32) || defined(TPF) || defined(NETWARE) - /* works fine under win32, so leave it */ - ap_hard_timeout("proxy send body", r); - alternate_timeouts = 0; -#else /* * CHECKME! Since hard_timeout won't work in unix on sends with partial * cache completion, we have to alternate between hard_timeout for reads, @@ -503,7 +475,6 @@ long int ap_proxy_send_fb(BUFF *f, request_rec *r, cache_req *c, off_t len, int ap_hard_timeout("proxy send body", r); alternate_timeouts = 0; } -#endif /* * Loop and ap_bread() while we can successfully read and write, or @@ -842,17 +813,8 @@ void ap_proxy_hash(const char *it, char *val, int ndepth, int nlength) char tmp[22]; int i, k, d; unsigned int x; -#if defined(MPE) || (defined(AIX) && defined(__ps2__)) - /* - * Believe it or not, AIX 1.x does not allow you to name a file '@', so - * hack around it in the encoding. - */ - static const char enc_table[64] = - "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_%"; -#else static const char enc_table[64] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_@"; -#endif ap_MD5Init(&context); ap_MD5Update(&context, (const unsigned char *)it, strlen(it)); @@ -1371,10 +1333,6 @@ int ap_proxy_doconnect(int sock, struct sockaddr_in *addr, request_rec *r) ap_hard_timeout("proxy connect", r); do { i = connect(sock, (struct sockaddr *)addr, sizeof(struct sockaddr_in)); -#if defined(WIN32) || defined(NETWARE) - if (i == SOCKET_ERROR) - errno = WSAGetLastError(); -#endif /* WIN32 */ } while (i == -1 && errno == EINTR); if (i == -1) { ap_log_rerror(APLOG_MARK, APLOG_ERR, r, @@ -1644,45 +1602,8 @@ int ap_proxy_read_response_line(BUFF *f, request_rec *r, char *buffer, int size, } - -#if defined WIN32 - -static DWORD tls_index; - -BOOL WINAPI DllMain(HINSTANCE dllhandle, DWORD reason, LPVOID reserved) -{ - LPVOID memptr; - - switch (reason) { - case DLL_PROCESS_ATTACH: - tls_index = TlsAlloc(); - case DLL_THREAD_ATTACH: /* intentional no break */ - TlsSetValue(tls_index, malloc(sizeof(struct per_thread_data))); - break; - case DLL_THREAD_DETACH: - memptr = TlsGetValue(tls_index); - if (memptr) { - free(memptr); - TlsSetValue(tls_index, 0); - } - break; - } - - return TRUE; -} - -#endif - static struct per_thread_data *get_per_thread_data(void) { -#if defined(WIN32) - - return (struct per_thread_data *)TlsGetValue(tls_index); - -#else - static APACHE_TLS struct per_thread_data sptd; return &sptd; - -#endif } diff --git a/usr.sbin/httpd/src/modules/ssl/mod_ssl.h b/usr.sbin/httpd/src/modules/ssl/mod_ssl.h index fb42aa2f05a..ae2d9e4fed5 100644 --- a/usr.sbin/httpd/src/modules/ssl/mod_ssl.h +++ b/usr.sbin/httpd/src/modules/ssl/mod_ssl.h @@ -104,13 +104,7 @@ #include <sys/types.h> #include <sys/stat.h> #include <time.h> -#ifndef WIN32 #include <sys/time.h> -#endif -#ifdef WIN32 -#include <wincrypt.h> -#include <winsock2.h> -#endif /* OpenSSL headers */ #include <openssl/ssl.h> @@ -260,29 +254,18 @@ #endif #if !defined(SSL_USE_FCNTL) && !defined(SSL_USE_FLOCK) #define SSL_USE_FLOCK 1 -#if !defined(MPE) && !defined(WIN32) #include <sys/file.h> -#endif #ifndef LOCK_UN #undef SSL_USE_FLOCK #define SSL_USE_FCNTL 1 #include <fcntl.h> #endif #endif -#ifdef AIX -#undef SSL_USE_FLOCK -#define SSL_USE_FCNTL 1 -#include <fcntl.h> -#endif /* * Support for Mutex */ -#ifndef WIN32 #define SSL_MUTEX_LOCK_MODE ( S_IRUSR|S_IWUSR ) -#else -#define SSL_MUTEX_LOCK_MODE (_S_IREAD|_S_IWRITE ) -#endif #if defined(USE_SYSVSEM_SERIALIZED_ACCEPT) ||\ defined(__OpenBSD__) ||\ (defined(__FreeBSD__) && defined(__FreeBSD_version) &&\ @@ -309,31 +292,16 @@ union ssl_ipc_semun { unsigned short int *array; }; #endif -#ifdef WIN32 -#define SSL_CAN_USE_SEM -#define SSL_HAVE_W32SEM -#include "multithread.h" -#include <process.h> -#endif /* * Support for MM library */ -#ifndef WIN32 #define SSL_MM_FILE_MODE ( S_IRUSR|S_IWUSR ) -#else -#define SSL_MM_FILE_MODE ( _S_IREAD|_S_IWRITE ) -#endif /* * Support for DBM library */ -#ifndef WIN32 #define SSL_DBM_FILE_MODE ( S_IRUSR|S_IWUSR ) -#else -#define SSL_USE_SDBM -#define SSL_DBM_FILE_MODE ( _S_IREAD|_S_IWRITE ) -#endif #ifdef SSL_USE_SDBM #include "ssl_util_sdbm.h" diff --git a/usr.sbin/httpd/src/modules/ssl/ssl_engine_config.c b/usr.sbin/httpd/src/modules/ssl/ssl_engine_config.c index d6276ea7922..6bee39d538d 100644 --- a/usr.sbin/httpd/src/modules/ssl/ssl_engine_config.c +++ b/usr.sbin/httpd/src/modules/ssl/ssl_engine_config.c @@ -398,14 +398,10 @@ const char *ssl_cmd_SSLMutex( mc->nMutexMode = SSL_MUTEXMODE_NONE; } else if (strlen(arg) > 5 && strcEQn(arg, "file:", 5)) { -#ifndef WIN32 mc->nMutexMode = SSL_MUTEXMODE_FILE; mc->szMutexFile = ap_psprintf(mc->pPool, "%s.%lu", ssl_util_server_root_relative(cmd->pool, "mutex", arg+5), (unsigned long)getpid()); -#else - return "SSLMutex: Lockfiles not available on this platform"; -#endif } else if (strcEQ(arg, "sem")) { #ifdef SSL_CAN_USE_SEM diff --git a/usr.sbin/httpd/src/modules/ssl/ssl_engine_init.c b/usr.sbin/httpd/src/modules/ssl/ssl_engine_init.c index 69bc248f088..5fa861399ec 100644 --- a/usr.sbin/httpd/src/modules/ssl/ssl_engine_init.c +++ b/usr.sbin/httpd/src/modules/ssl/ssl_engine_init.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ssl_engine_init.c,v 1.24 2004/10/20 14:02:40 henning Exp $ */ +/* $OpenBSD: ssl_engine_init.c,v 1.25 2004/12/02 19:42:47 henning Exp $ */ /* _ _ ** _ __ ___ ___ __| | ___ ___| | mod_ssl @@ -178,11 +178,6 @@ void ssl_init_Module(server_rec *s, pool *p) SERVER_BASEVERSION, ssl_var_lookup(p, NULL, NULL, NULL, "SSL_VERSION_INTERFACE"), ssl_var_lookup(p, NULL, NULL, NULL, "SSL_VERSION_LIBRARY")); -#ifdef WIN32 - ssl_log(s, SSL_LOG_WARN, "You are using mod_ssl under Win32. " - "This combination is *NOT* officially supported. " - "Use it at your own risk!"); -#endif } /* @@ -258,9 +253,7 @@ void ssl_init_Module(server_rec *s, pool *p) #ifndef __OpenBSD__ ssl_init_TmpKeysHandle(SSL_TKP_GEN, s, p); #endif -#ifndef WIN32 return; -#endif } #ifdef __OpenBSD__ @@ -355,9 +348,6 @@ void ssl_init_Module(server_rec *s, pool *p) */ void ssl_init_SSLLibrary(void) { -#ifdef WIN32 - CRYPTO_malloc_init(); -#endif SSL_load_error_strings(); SSL_library_init(); ssl_util_thread_setup(); diff --git a/usr.sbin/httpd/src/modules/ssl/ssl_engine_io.c b/usr.sbin/httpd/src/modules/ssl/ssl_engine_io.c index 63347a159d4..6ac2baca0d3 100644 --- a/usr.sbin/httpd/src/modules/ssl/ssl_engine_io.c +++ b/usr.sbin/httpd/src/modules/ssl/ssl_engine_io.c @@ -305,10 +305,6 @@ static int ssl_io_hook_write(BUFF *fb, char *buf, int len); #ifndef NO_WRITEV static int ssl_io_hook_writev(BUFF *fb, const struct iovec *iov, int iovcnt); #endif -#ifdef WIN32 -static int ssl_io_hook_recvwithtimeout(BUFF *fb, char *buf, int len); -static int ssl_io_hook_sendwithtimeout(BUFF *fb, const char *buf, int len); -#endif /* WIN32 */ void ssl_io_register(void) { @@ -317,12 +313,6 @@ void ssl_io_register(void) #ifndef NO_WRITEV ap_hook_register("ap::buff::writev", ssl_io_hook_writev, AP_HOOK_NOCTX); #endif -#ifdef WIN32 - ap_hook_register("ap::buff::recvwithtimeout", - ssl_io_hook_recvwithtimeout, AP_HOOK_NOCTX); - ap_hook_register("ap::buff::sendwithtimeout", - ssl_io_hook_sendwithtimeout, AP_HOOK_NOCTX); -#endif return; } @@ -333,10 +323,6 @@ void ssl_io_unregister(void) #ifndef NO_WRITEV ap_hook_unregister("ap::buff::writev", ssl_io_hook_writev); #endif -#ifdef WIN32 - ap_hook_unregister("ap::buff::recvwithtimeout", ssl_io_hook_recvwithtimeout); - ap_hook_unregister("ap::buff::sendwithtimeout", ssl_io_hook_sendwithtimeout); -#endif return; } @@ -443,37 +429,6 @@ static int ssl_io_hook_writev(BUFF *fb, const struct iovec *iov, int iovcnt) } #endif -#ifdef WIN32 - -/* and the prototypes for our SSL_xxx variants */ -static int SSL_sendwithtimeout(BUFF *fb, const char *buf, int len); -static int SSL_recvwithtimeout(BUFF *fb, char *buf, int len); - -static int ssl_io_hook_recvwithtimeout(BUFF *fb, char *buf, int len) -{ - SSL *ssl; - int rc; - - if ((ssl = ap_ctx_get(fb->ctx, "ssl")) != NULL) - rc = SSL_recvwithtimeout(fb, buf, len); - else - rc = ap_recvwithtimeout(fb->fd, buf, len, 0); - return rc; -} - -static int ssl_io_hook_sendwithtimeout(BUFF *fb, const char *buf, int len) -{ - SSL *ssl; - int rc; - - if ((ssl = ap_ctx_get(fb->ctx, "ssl")) != NULL) - rc = SSL_sendwithtimeout(fb, buf, len); - else - rc = ap_sendwithtimeout(fb->fd, buf, len, 0); - return rc; -} - -#endif /* WIN32 */ /* _________________________________________________________________ ** @@ -481,131 +436,6 @@ static int ssl_io_hook_sendwithtimeout(BUFF *fb, const char *buf, int len) ** _________________________________________________________________ */ -#ifdef WIN32 - -static int SSL_sendwithtimeout(BUFF *fb, const char *buf, int len) -{ - int iostate = 1; - fd_set fdset; - struct timeval tv; - int err = WSAEWOULDBLOCK; - int rv; - int sock = fb->fd; - int retry; - SSL *ssl; - - - ssl = ap_ctx_get(fb->ctx, "ssl"); - - if (!(tv.tv_sec = ap_check_alarm())) - return (SSL_write(ssl, (char*)buf, len)); - - rv = ioctlsocket(sock, FIONBIO, &iostate); - iostate = 0; - if (rv) { - err = WSAGetLastError(); - ap_assert(0); - } - rv = SSL_write(ssl, (char*)buf, len); - if (rv <= 0) { - if (BIO_sock_should_retry(rv)) { - do { - retry = 0; - FD_ZERO(&fdset); - FD_SET((unsigned int)sock, &fdset); - tv.tv_usec = 0; - rv = select(sock + 1, NULL, &fdset, NULL, &tv); - if (rv == SOCKET_ERROR) - err = WSAGetLastError(); - else if (rv == 0) { - ioctlsocket(sock, FIONBIO, &iostate); - if(ap_check_alarm() < 0) { - WSASetLastError(EINTR); /* Simulate an alarm() */ - return (SOCKET_ERROR); - } - } - else { - rv = SSL_write(ssl, (char*)buf, len); - if (BIO_sock_should_retry(rv)) { - ap_log_error(APLOG_MARK,APLOG_DEBUG, NULL, - "select claimed we could write, " - "but in fact we couldn't. " - "This is a bug in Windows."); - retry = 1; - Sleep(100); - } - } - } while(retry); - } - } - ioctlsocket(sock, FIONBIO, &iostate); - if (rv == SOCKET_ERROR) - WSASetLastError(err); - return (rv); -} - -static int SSL_recvwithtimeout(BUFF *fb, char *buf, int len) -{ - int iostate = 1; - fd_set fdset; - struct timeval tv; - int err = WSAEWOULDBLOCK; - int rv; - int sock = fb->fd_in; - SSL *ssl; - int retry; - - ssl = ap_ctx_get(fb->ctx, "ssl"); - - if (!(tv.tv_sec = ap_check_alarm())) - return (SSL_read(ssl, buf, len)); - - rv = ioctlsocket(sock, FIONBIO, &iostate); - iostate = 0; - ap_assert(!rv); - rv = SSL_read(ssl, buf, len); - if (rv <= 0) { - if (BIO_sock_should_retry(rv)) { - do { - retry = 0; - FD_ZERO(&fdset); - FD_SET((unsigned int)sock, &fdset); - tv.tv_usec = 0; - rv = select(sock + 1, &fdset, NULL, NULL, &tv); - if (rv == SOCKET_ERROR) - err = WSAGetLastError(); - else if (rv == 0) { - ioctlsocket(sock, FIONBIO, &iostate); - ap_check_alarm(); - WSASetLastError(WSAEWOULDBLOCK); - return (SOCKET_ERROR); - } - else { - rv = SSL_read(ssl, buf, len); - if (rv == SOCKET_ERROR) { - if (BIO_sock_should_retry(rv)) { - ap_log_error(APLOG_MARK,APLOG_DEBUG, NULL, - "select claimed we could read, " - "but in fact we couldn't. " - "This is a bug in Windows."); - retry = 1; - Sleep(100); - } - else { - err = WSAGetLastError(); - } - } - } - } while(retry); - } - } - ioctlsocket(sock, FIONBIO, &iostate); - if (rv == SOCKET_ERROR) - WSASetLastError(err); - return (rv); -} - -#endif /*WIN32*/ /* * There is no SSL_writev() provided by OpenSSL. The reason is mainly because diff --git a/usr.sbin/httpd/src/modules/ssl/ssl_engine_kernel.c b/usr.sbin/httpd/src/modules/ssl/ssl_engine_kernel.c index 8bec6d690bf..01b0a9ea51a 100644 --- a/usr.sbin/httpd/src/modules/ssl/ssl_engine_kernel.c +++ b/usr.sbin/httpd/src/modules/ssl/ssl_engine_kernel.c @@ -429,9 +429,7 @@ void ssl_hook_NewConnection(conn_rec *conn) * (don't used under Win32, because * there we use select()) */ -#ifndef WIN32 SSL_set_read_ahead(ssl, TRUE); -#endif #ifdef SSL_VENDOR /* Allow vendors to do more things on connection time... */ diff --git a/usr.sbin/httpd/src/modules/ssl/ssl_engine_mutex.c b/usr.sbin/httpd/src/modules/ssl/ssl_engine_mutex.c index e87c5dfa2d2..2fd2cdc0e9c 100644 --- a/usr.sbin/httpd/src/modules/ssl/ssl_engine_mutex.c +++ b/usr.sbin/httpd/src/modules/ssl/ssl_engine_mutex.c @@ -141,7 +141,6 @@ void ssl_mutex_kill(server_rec *s) void ssl_mutex_file_create(server_rec *s, pool *p) { -#ifndef WIN32 SSLModConfigRec *mc = myModConfig(); char mutexfile[MAXPATHLEN]; @@ -159,10 +158,8 @@ void ssl_mutex_file_create(server_rec *s, pool *p) ap_pclosef(p, mc->nMutexFD); /* make sure the childs have access to this file */ -#ifndef OS2 if (geteuid() == 0 /* is superuser */) chown(mutexfile, ap_user_id, -1 /* no gid change */); -#endif /* open the lockfile for real */ if ((mc->nMutexFD = ap_popenf(p, mutexfile, @@ -172,13 +169,11 @@ void ssl_mutex_file_create(server_rec *s, pool *p) mutexfile); ssl_die(); } -#endif return; } void ssl_mutex_file_open(server_rec *s, pool *p) { -#ifndef WIN32 SSLModConfigRec *mc = myModConfig(); char mutexfile[MAXPATHLEN]; @@ -193,13 +188,11 @@ void ssl_mutex_file_open(server_rec *s, pool *p) mutexfile); ssl_die(); } -#endif return; } void ssl_mutex_file_remove(void *data) { -#ifndef WIN32 SSLModConfigRec *mc = myModConfig(); char mutexfile[MAXPATHLEN]; strlcpy(mutexfile, mc->szMutexFile, sizeof(mutexfile)); @@ -207,21 +200,17 @@ void ssl_mutex_file_remove(void *data) /* remove the mutex lockfile */ unlink(mutexfile); -#endif return; } -#ifndef WIN32 #ifdef SSL_USE_FCNTL static struct flock lock_it; static struct flock unlock_it; #endif -#endif BOOL ssl_mutex_file_acquire(void) { int rc = -1; -#ifndef WIN32 SSLModConfigRec *mc = myModConfig(); #ifdef SSL_USE_FCNTL @@ -240,7 +229,6 @@ BOOL ssl_mutex_file_acquire(void) && (errno == EINTR) ) ; #endif -#endif if (rc < 0) return FALSE; @@ -251,7 +239,6 @@ BOOL ssl_mutex_file_acquire(void) BOOL ssl_mutex_file_release(void) { int rc = -1; -#ifndef WIN32 SSLModConfigRec *mc = myModConfig(); #ifdef SSL_USE_FCNTL @@ -270,7 +257,6 @@ BOOL ssl_mutex_file_release(void) && (errno == EINTR) ) ; #endif -#endif if (rc < 0) return FALSE; diff --git a/usr.sbin/httpd/src/modules/ssl/ssl_engine_pphrase.c b/usr.sbin/httpd/src/modules/ssl/ssl_engine_pphrase.c index d887a014b41..b37ab99fb3f 100644 --- a/usr.sbin/httpd/src/modules/ssl/ssl_engine_pphrase.c +++ b/usr.sbin/httpd/src/modules/ssl/ssl_engine_pphrase.c @@ -450,9 +450,6 @@ int ssl_pphrase_Handle_CB(char *buf, int bufsize, int verify) if (sc->nPassPhraseDialogType == SSL_PPTYPE_BUILTIN) { char *prompt; int i; -#ifdef WIN32 - FILE *con; -#endif ssl_log(s, SSL_LOG_INFO, "Init: Requesting pass phrase via builtin terminal dialog"); @@ -462,21 +459,10 @@ int ssl_pphrase_Handle_CB(char *buf, int bufsize, int verify) * at our init stage Apache already connected STDERR * to the general error logfile. */ -#ifdef WIN32 - stderr_store = STDERR_FILENO_STORE; -#else if ((stderr_store = open("/dev/null", O_WRONLY)) == -1) stderr_store = STDERR_FILENO_STORE; -#endif dup2(STDERR_FILENO, stderr_store); -#ifdef WIN32 - if ((con = fopen("con", "w")) != NULL) - dup2(fileno(con), STDERR_FILENO); - else - dup2(STDOUT_FILENO, STDERR_FILENO); -#else dup2(STDOUT_FILENO, STDERR_FILENO); -#endif /* * The first time display a header to inform the user about what @@ -519,10 +505,6 @@ int ssl_pphrase_Handle_CB(char *buf, int bufsize, int verify) */ dup2(stderr_store, STDERR_FILENO); close(stderr_store); -#ifdef WIN32 - if (con != NULL) - fclose(con); -#endif } /* diff --git a/usr.sbin/httpd/src/modules/ssl/ssl_engine_rand.c b/usr.sbin/httpd/src/modules/ssl/ssl_engine_rand.c index 5adad9c36ff..9339605ff5a 100644 --- a/usr.sbin/httpd/src/modules/ssl/ssl_engine_rand.c +++ b/usr.sbin/httpd/src/modules/ssl/ssl_engine_rand.c @@ -101,11 +101,7 @@ int ssl_rand_seed(server_rec *s, pool *p, ssl_rsctx_t nCtx, char *prefix) /* * seed in contents of an external file */ -#ifdef WIN32 - if ((fp = ap_pfopen(p, pRandSeed->cpPath, "rb")) == NULL) -#else if ((fp = ap_pfopen(p, pRandSeed->cpPath, "r")) == NULL) -#endif continue; nDone += ssl_rand_feedfp(p, fp, pRandSeed->nBytes); ap_pfclose(p, fp); diff --git a/usr.sbin/httpd/src/modules/ssl/ssl_engine_vars.c b/usr.sbin/httpd/src/modules/ssl/ssl_engine_vars.c index 958c0530f27..c93cd7b38e0 100644 --- a/usr.sbin/httpd/src/modules/ssl/ssl_engine_vars.c +++ b/usr.sbin/httpd/src/modules/ssl/ssl_engine_vars.c @@ -438,9 +438,6 @@ static char *ssl_var_lookup_ssl_cert_dn(pool *p, X509_NAME *xsname, char *var) if (n == ssl_var_lookup_ssl_cert_dn_rec[i].nid) { result = ap_palloc(p, xsne->value->length+1); ap_cpystrn(result, (char *)xsne->value->data, xsne->value->length+1); -#ifdef CHARSET_EBCDIC - ascii2ebcdic(result, result, xsne->value->length); -#endif /* CHARSET_EBCDIC */ result[xsne->value->length] = NUL; break; } diff --git a/usr.sbin/httpd/src/modules/ssl/ssl_scache_dbm.c b/usr.sbin/httpd/src/modules/ssl/ssl_scache_dbm.c index d01b7c754f7..44276b750f2 100644 --- a/usr.sbin/httpd/src/modules/ssl/ssl_scache_dbm.c +++ b/usr.sbin/httpd/src/modules/ssl/ssl_scache_dbm.c @@ -84,7 +84,6 @@ void ssl_scache_dbm_init(server_rec *s, pool *p) } ssl_dbm_close(dbm); -#if !defined(OS2) && !defined(WIN32) /* * We have to make sure the Apache child processes have access to * the DBM file. But because there are brain-dead platforms where we @@ -107,7 +106,6 @@ void ssl_scache_dbm_init(server_rec *s, pool *p) ap_user_id, -1); } } -#endif ssl_mutex_off(s); ssl_scache_dbm_expire(s); return; diff --git a/usr.sbin/httpd/src/modules/ssl/ssl_util.c b/usr.sbin/httpd/src/modules/ssl/ssl_util.c index 99015482222..30cdedf70b0 100644 --- a/usr.sbin/httpd/src/modules/ssl/ssl_util.c +++ b/usr.sbin/httpd/src/modules/ssl/ssl_util.c @@ -183,39 +183,8 @@ int ssl_util_ppopen_child(void *cmd, child_info *pinfo) /* * Exec() the child program */ -#if defined(WIN32) - /* MS Windows */ - { - char pCommand[MAX_STRING_LEN]; - STARTUPINFO si; - PROCESS_INFORMATION pi; - - ap_snprintf(pCommand, sizeof(pCommand), "%s /C %s", SHELL_PATH, cmd); - - memset(&si, 0, sizeof(si)); - memset(&pi, 0, sizeof(pi)); - - si.cb = sizeof(si); - si.dwFlags = STARTF_USESHOWWINDOW | STARTF_USESTDHANDLES; - si.wShowWindow = SW_HIDE; - si.hStdInput = pinfo->hPipeInputRead; - si.hStdOutput = pinfo->hPipeOutputWrite; - si.hStdError = pinfo->hPipeErrorWrite; - - if (CreateProcess(NULL, pCommand, NULL, NULL, TRUE, 0, - environ, NULL, &si, &pi)) { - CloseHandle(pi.hProcess); - CloseHandle(pi.hThread); - child_pid = pi.dwProcessId; - } - } -#elif defined(OS2) - /* IBM OS/2 */ - spawnl(P_NOWAIT, SHELL_PATH, SHELL_PATH, "/c", (char *)cmd, NULL); -#else /* Standard Unix */ execl(SHELL_PATH, SHELL_PATH, "-c", (char *)cmd, (char *)NULL); -#endif return (child_pid); } @@ -365,41 +334,13 @@ char *ssl_util_ptxtsub( ** _________________________________________________________________ */ -#ifdef WIN32 -static HANDLE lock_cs[CRYPTO_NUM_LOCKS]; - -static void win32_locking_callback(int mode, int type, char* file, int line) -{ - if (mode & CRYPTO_LOCK) - WaitForSingleObject(lock_cs[type], INFINITE); - else - ReleaseMutex(lock_cs[type]); - return; -} -#endif /* WIN32 */ - void ssl_util_thread_setup(void) { -#ifdef WIN32 - int i; - - for (i = 0; i < CRYPTO_NUM_LOCKS; i++) - lock_cs[i] = CreateMutex(NULL, FALSE, NULL); - CRYPTO_set_locking_callback((void(*)(int, int, const char *, int)) - win32_locking_callback); -#endif /* WIN32 */ return; } void ssl_util_thread_cleanup(void) { -#ifdef WIN32 - int i; - - CRYPTO_set_locking_callback(NULL); - for (i = 0; i < CRYPTO_NUM_LOCKS; i++) - CloseHandle(lock_cs[i]); -#endif /* WIN32 */ return; } diff --git a/usr.sbin/httpd/src/modules/ssl/ssl_util_sdbm.c b/usr.sbin/httpd/src/modules/ssl/ssl_util_sdbm.c index 8a3afbc2b75..b7f4f80677e 100644 --- a/usr.sbin/httpd/src/modules/ssl/ssl_util_sdbm.c +++ b/usr.sbin/httpd/src/modules/ssl/ssl_util_sdbm.c @@ -74,12 +74,7 @@ #include <stdio.h> #include <stdlib.h> -#ifdef WIN32 -#include <io.h> -#include <errno.h> -#else #include <unistd.h> -#endif #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> @@ -94,13 +89,6 @@ #endif /* - * externals - */ -#ifdef sun -extern int errno; -#endif - -/* * forward */ static int getdbit proto((DBM *, long)); @@ -190,9 +178,6 @@ int mode; flags = (flags & ~O_WRONLY) | O_RDWR; else if ((flags & 03) == O_RDONLY) db->flags = DBM_RDONLY; -#if defined(OS2) || defined(MSDOS) || defined(WIN32) - flags |= O_BINARY; -#endif /* * open the files in sequence, and stat the dirfile. diff --git a/usr.sbin/httpd/src/modules/ssl/ssl_util_ssl.c b/usr.sbin/httpd/src/modules/ssl/ssl_util_ssl.c index 543680890cc..9cf8a063220 100644 --- a/usr.sbin/httpd/src/modules/ssl/ssl_util_ssl.c +++ b/usr.sbin/httpd/src/modules/ssl/ssl_util_ssl.c @@ -384,9 +384,6 @@ BOOL SSL_X509_getCN(pool *p, X509 *xs, char **cppCN) *cppCN = ap_palloc(p, xsne->value->length+1); ap_cpystrn(*cppCN, (char *)xsne->value->data, xsne->value->length+1); (*cppCN)[xsne->value->length] = NUL; -#ifdef CHARSET_EBCDIC - ascii2ebcdic(*cppCN, *cppCN, strlen(*cppCN)); -#endif return TRUE; } } diff --git a/usr.sbin/httpd/src/modules/ssl/ssl_util_table.c b/usr.sbin/httpd/src/modules/ssl/ssl_util_table.c index 9860e59b0a2..a9090bf47e9 100644 --- a/usr.sbin/httpd/src/modules/ssl/ssl_util_table.c +++ b/usr.sbin/httpd/src/modules/ssl/ssl_util_table.c @@ -93,12 +93,7 @@ #include <stdio.h> #include <stdlib.h> #include <string.h> -#ifdef WIN32 -#include <io.h> -#include <errno.h> -#else #include <unistd.h> -#endif /* forward definitions for table.h */ typedef struct table_st table_t; diff --git a/usr.sbin/httpd/src/modules/standard/mod_alias.c b/usr.sbin/httpd/src/modules/standard/mod_alias.c index 118a19cb607..4f43d56a224 100644 --- a/usr.sbin/httpd/src/modules/standard/mod_alias.c +++ b/usr.sbin/httpd/src/modules/standard/mod_alias.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mod_alias.c,v 1.11 2003/10/29 10:11:00 henning Exp $ */ +/* $OpenBSD: mod_alias.c,v 1.12 2004/12/02 19:42:47 henning Exp $ */ /* ==================================================================== * The Apache Software License, Version 1.1 @@ -147,12 +147,8 @@ static const char *add_alias_internal(cmd_parms *cmd, void *dummy, char *f, char return "Regular expression could not be compiled."; new->real = r; } -#ifndef OS2 else new->real = ap_os_canonical_filename(cmd->pool, r); -#else - new->real = r; -#endif new->fake = f; new->handler = cmd->info; diff --git a/usr.sbin/httpd/src/modules/standard/mod_auth.c b/usr.sbin/httpd/src/modules/standard/mod_auth.c index 65a4f091156..b1d2899ed43 100644 --- a/usr.sbin/httpd/src/modules/standard/mod_auth.c +++ b/usr.sbin/httpd/src/modules/standard/mod_auth.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mod_auth.c,v 1.11 2003/08/21 13:11:36 henning Exp $ */ +/* $OpenBSD: mod_auth.c,v 1.12 2004/12/02 19:42:47 henning Exp $ */ /* ==================================================================== * The Apache Software License, Version 1.1 @@ -285,12 +285,6 @@ static int check_user_access(request_rec *r) * owner of the document. */ if (strcmp(w, "file-owner") == 0) { -#if defined(WIN32) || defined(NETWARE) || defined(OS2) - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_INFO, r, - "'Require file-owner' not supported " - "on this platform, ignored"); - continue; -#else struct passwd *pwent; ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_DEBUG, r, "checking for 'owner' access for file '%s'", @@ -318,15 +312,8 @@ static int check_user_access(request_rec *r) continue; } } -#endif } if (strcmp(w, "file-group") == 0) { -#if defined(WIN32) || defined(NETWARE) || defined(OS2) - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_INFO, r, - "'Require file-group' not supported " - "on this platform, ignored"); - continue; -#else struct group *grent; if (sec->auth_grpfile == NULL) { ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_INFO, r, @@ -369,7 +356,6 @@ static int check_user_access(request_rec *r) continue; } } -#endif } if (strcmp(w, "user") == 0) { while (t[0] != '\0') { diff --git a/usr.sbin/httpd/src/modules/standard/mod_auth_dbm.c b/usr.sbin/httpd/src/modules/standard/mod_auth_dbm.c index a78b5b637ae..446dc2b6117 100644 --- a/usr.sbin/httpd/src/modules/standard/mod_auth_dbm.c +++ b/usr.sbin/httpd/src/modules/standard/mod_auth_dbm.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mod_auth_dbm.c,v 1.11 2003/08/21 13:11:36 henning Exp $ */ +/* $OpenBSD: mod_auth_dbm.c,v 1.12 2004/12/02 19:42:47 henning Exp $ */ /* ==================================================================== * The Apache Software License, Version 1.1 @@ -78,14 +78,7 @@ #include "http_log.h" #include "http_main.h" #include "http_protocol.h" -#if (defined(WIN32) || defined(NETWARE)) -#include <sdbm.h> -#define dbm_open sdbm_open -#define dbm_fetch sdbm_fetch -#define dbm_close sdbm_close -#else #include <ndbm.h> -#endif /* * Module definition information - the part between the -START and -END diff --git a/usr.sbin/httpd/src/modules/standard/mod_autoindex.c b/usr.sbin/httpd/src/modules/standard/mod_autoindex.c index 58525dc4027..c3150296718 100644 --- a/usr.sbin/httpd/src/modules/standard/mod_autoindex.c +++ b/usr.sbin/httpd/src/modules/standard/mod_autoindex.c @@ -1698,11 +1698,6 @@ static int index_directory(request_rec *r, } ap_send_http_header(r); -#ifdef CHARSET_EBCDIC - /* Server-generated response, converted */ - ap_bsetflag(r->connection->client, B_EBCDIC2ASCII, r->ebcdic.conv_out = 1); -#endif - if (r->header_only) { ap_pclosedir(r->pool, d); return 0; diff --git a/usr.sbin/httpd/src/modules/standard/mod_cern_meta.c b/usr.sbin/httpd/src/modules/standard/mod_cern_meta.c index da435117a8c..766f6a81515 100644 --- a/usr.sbin/httpd/src/modules/standard/mod_cern_meta.c +++ b/usr.sbin/httpd/src/modules/standard/mod_cern_meta.c @@ -151,9 +151,7 @@ #include "httpd.h" #include "http_config.h" -#ifndef NETWARE #include <sys/types.h> -#endif #include <sys/stat.h> #include "util_script.h" #include "http_log.h" diff --git a/usr.sbin/httpd/src/modules/standard/mod_cgi.c b/usr.sbin/httpd/src/modules/standard/mod_cgi.c index 1d4c2bfe6d6..0eff52558a0 100644 --- a/usr.sbin/httpd/src/modules/standard/mod_cgi.c +++ b/usr.sbin/httpd/src/modules/standard/mod_cgi.c @@ -211,19 +211,8 @@ static int log_script(request_rec *r, cgi_server_conf * conf, int ret, /* Soak up script output */ while (ap_bgets(argsbuffer, HUGE_STRING_LEN, script_in) > 0) continue; -#if defined(WIN32) || defined(NETWARE) - /* Soak up stderr and redirect it to the error log. - * Script output to stderr is already directed to the error log - * on Unix, thanks to the magic of fork(). - */ - while (ap_bgets(argsbuffer, HUGE_STRING_LEN, script_err) > 0) { - ap_log_rerror(APLOG_MARK, APLOG_ERR | APLOG_NOERRNO, r, - "%s", argsbuffer); - } -#else while (ap_bgets(argsbuffer, HUGE_STRING_LEN, script_err) > 0) continue; -#endif return ret; } @@ -287,9 +276,6 @@ static int log_script(request_rec *r, cgi_server_conf * conf, int ret, struct cgi_child_stuff { -#ifdef TPF - TPF_FORK_CHILD t; -#endif request_rec *r; int nph; int debug; @@ -304,12 +290,7 @@ static int cgi_child(void *child_stuff, child_info *pinfo) int child_pid; #ifdef DEBUG_CGI -#ifdef OS2 - /* Under OS/2 need to use device con. */ - FILE *dbg = fopen("con", "w"); -#else FILE *dbg = fopen("/dev/tty", "w"); -#endif int i; #endif @@ -330,9 +311,7 @@ static int cgi_child(void *child_stuff, child_info *pinfo) fprintf(dbg, "'%s'\n", env[i]); #endif -#ifndef WIN32 ap_chdir_file(r->filename); -#endif if (!cld->debug) ap_error_log2stderr(r->server); @@ -340,15 +319,9 @@ static int cgi_child(void *child_stuff, child_info *pinfo) * NB only ISINDEX scripts get decoded arguments. */ -#ifdef TPF - return (0); -#else ap_cleanup_for_exec(); child_pid = ap_call_exec(r, pinfo, argv0, env, 0); -#if defined(WIN32) || defined(OS2) - return (child_pid); -#else /* Uh oh. Still here. Where's the kaboom? There was supposed to be an * EARTH-shattering kaboom! @@ -363,8 +336,6 @@ static int cgi_child(void *child_stuff, child_info *pinfo) exit(0); /* NOT REACHED */ return (0); -#endif -#endif /* TPF */ } static int cgi_handler(request_rec *r) @@ -401,26 +372,9 @@ static int cgi_handler(request_rec *r) return log_scripterror(r, conf, FORBIDDEN, APLOG_NOERRNO, "attempt to include NPH CGI script"); -#if defined(OS2) || defined(WIN32) - /* Allow for cgi files without the .EXE extension on them under OS/2 */ - if (r->finfo.st_mode == 0) { - struct stat statbuf; - char *newfile; - - newfile = ap_pstrcat(r->pool, r->filename, ".EXE", NULL); - - if ((stat(newfile, &statbuf) != 0) || (!S_ISREG(statbuf.st_mode))) { - return log_scripterror(r, conf, NOT_FOUND, 0, - "script not found or unable to stat"); - } else { - r->filename = newfile; - } - } -#else if (r->finfo.st_mode == 0) return log_scripterror(r, conf, NOT_FOUND, APLOG_NOERRNO, "script not found or unable to stat"); -#endif if (S_ISDIR(r->finfo.st_mode)) return log_scripterror(r, conf, FORBIDDEN, APLOG_NOERRNO, "attempt to invoke directory as script"); @@ -438,21 +392,6 @@ static int cgi_handler(request_rec *r) cld.r = r; cld.nph = nph; cld.debug = conf->logname ? 1 : 0; -#ifdef TPF - cld.t.filename = r->filename; - cld.t.subprocess_env = r->subprocess_env; - cld.t.prog_type = FORK_FILE; -#endif /* TPF */ - -#ifdef CHARSET_EBCDIC - /* The included MIME headers must ALWAYS be in text/ebcdic format. - * Only after reading the MIME headers, we check the Content-Type - * and switch to the necessary conversion mode. - * Until then (and in case an nph- script was called), use the - * configured default conversion: - */ - ap_bsetflag(r->connection->client, B_EBCDIC2ASCII, r->ebcdic.conv_out); -#endif /*CHARSET_EBCDIC*/ /* * we spawn out of r->main if it's there so that we can avoid @@ -529,20 +468,9 @@ static int cgi_handler(request_rec *r) while (ap_bgets(argsbuffer, HUGE_STRING_LEN, script_in) > 0) { continue; } -#if defined(WIN32) || defined(NETWARE) - /* Soak up stderr and redirect it to the error log. - * Script output to stderr is already directed to the error log - * on Unix, thanks to the magic of fork(). - */ - while (ap_bgets(argsbuffer, HUGE_STRING_LEN, script_err) > 0) { - ap_log_rerror(APLOG_MARK, APLOG_ERR | APLOG_NOERRNO, r, - "%s", argsbuffer); - } -#else while (ap_bgets(argsbuffer, HUGE_STRING_LEN, script_err) > 0) { continue; } -#endif ap_kill_timeout(r); @@ -575,19 +503,9 @@ static int cgi_handler(request_rec *r) ap_bclose(script_in); ap_soft_timeout("soaking script stderr", r); -#if defined(WIN32) || defined(NETWARE) - /* Script output to stderr is already directed to the error log - * on Unix, thanks to the magic of fork(). - */ - while (ap_bgets(argsbuffer, HUGE_STRING_LEN, script_err) > 0) { - ap_log_rerror(APLOG_MARK, APLOG_ERR | APLOG_NOERRNO, r, - "%s", argsbuffer); - } -#else while (ap_bgets(argsbuffer, HUGE_STRING_LEN, script_err) > 0) { continue; } -#endif ap_kill_timeout(r); ap_bclose(script_err); } diff --git a/usr.sbin/httpd/src/modules/standard/mod_imap.c b/usr.sbin/httpd/src/modules/standard/mod_imap.c index 32c17237a46..cbc4d8b73c0 100644 --- a/usr.sbin/httpd/src/modules/standard/mod_imap.c +++ b/usr.sbin/httpd/src/modules/standard/mod_imap.c @@ -110,10 +110,6 @@ #define IMAP_DEFAULT_DEFAULT "nocontent" #define IMAP_BASE_DEFAULT "map" -#ifdef SUNOS4 -double strtod(); /* SunOS needed this */ -#endif - module MODULE_VAR_EXPORT imap_module; typedef struct { @@ -507,10 +503,6 @@ static void menu_header(request_rec *r, char *menu) { r->content_type = "text/html"; ap_send_http_header(r); -#ifdef CHARSET_EBCDIC - /* Server-generated response, converted */ - ap_bsetflag(r->connection->client, B_EBCDIC2ASCII, r->ebcdic.conv_out = 1); -#endif ap_hard_timeout("send menu", r); /* killed in menu_footer */ ap_rvputs(r, DOCTYPE_HTML_3_2, "<html><head>\n<title>Menu for ", r->uri, diff --git a/usr.sbin/httpd/src/modules/standard/mod_include.c b/usr.sbin/httpd/src/modules/standard/mod_include.c index 87e1cbdf046..799c202949a 100644 --- a/usr.sbin/httpd/src/modules/standard/mod_include.c +++ b/usr.sbin/httpd/src/modules/standard/mod_include.c @@ -101,11 +101,7 @@ #define DEFAULT_TIME_FORMAT "%A, %d-%b-%Y %H:%M:%S %Z" #define SIZEFMT_BYTES 0 #define SIZEFMT_KMG 1 -#ifdef CHARSET_EBCDIC -#define RAW_ASCII_CHAR(ch) os_toebcdic[(unsigned char)ch] -#else /*CHARSET_EBCDIC*/ #define RAW_ASCII_CHAR(ch) (ch) -#endif /*CHARSET_EBCDIC*/ module MODULE_VAR_EXPORT includes_module; @@ -114,9 +110,7 @@ module MODULE_VAR_EXPORT includes_module; /* XXX: could use ap_table_overlap here */ static void add_include_vars(request_rec *r, char *timefmt) { -#if !defined(WIN32) && !defined(NETWARE) struct passwd *pw; -#endif /* ndef WIN32 */ table *e = r->subprocess_env; char *t; time_t date = r->request_time; @@ -127,7 +121,6 @@ static void add_include_vars(request_rec *r, char *timefmt) ap_ht_time(r->pool, r->finfo.st_mtime, timefmt, 0)); ap_table_setn(e, "DOCUMENT_URI", r->uri); ap_table_setn(e, "DOCUMENT_PATH_INFO", r->path_info); -#if !defined(WIN32) && !defined(NETWARE) pw = getpwuid(r->finfo.st_uid); if (pw) { ap_table_setn(e, "USER_NAME", ap_pstrdup(r->pool, pw->pw_name)); @@ -136,7 +129,6 @@ static void add_include_vars(request_rec *r, char *timefmt) ap_table_setn(e, "USER_NAME", ap_psprintf(r->pool, "user#%lu", (unsigned long) r->finfo.st_uid)); } -#endif /* ndef WIN32 */ if ((t = strrchr(r->filename, '/'))) { ap_table_setn(e, "DOCUMENT_NAME", ++t); @@ -612,9 +604,7 @@ static int include_cgi(char *s, request_rec *r) } ap_destroy_sub_req(rr); -#if !defined(WIN32) && !defined(NETWARE) ap_chdir_file(r->filename); -#endif return 0; } @@ -631,10 +621,6 @@ static int is_only_below(const char *path) if (path[1] == ':') return 0; #endif -#ifdef NETWARE - if (strchr(path, ':')) - return 0; -#endif if (path[0] == '/') { return 0; } @@ -739,9 +725,7 @@ static int handle_include(FILE *in, request_rec *r, const char *error, int noexe if (!error_fmt && ap_run_sub_req(rr)) { error_fmt = "unable to include \"%s\" in parsed file %s"; } -#if !defined(WIN32) && !defined(NETWARE) ap_chdir_file(r->filename); -#endif if (error_fmt) { ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, r, error_fmt, tag_val, r->filename); @@ -765,9 +749,6 @@ static int handle_include(FILE *in, request_rec *r, const char *error, int noexe } typedef struct { -#ifdef TPF - TPF_FORK_CHILD t; -#endif request_rec *r; char *s; } include_cmd_arg; @@ -779,16 +760,9 @@ static int include_cmd_child(void *arg, child_info *pinfo) table *env = r->subprocess_env; int child_pid = 0; #ifdef DEBUG_INCLUDE_CMD -#ifdef OS2 - /* under OS/2 /dev/tty is referenced as con */ - FILE *dbg = fopen("con", "w"); -#else FILE *dbg = fopen("/dev/tty", "w"); #endif -#endif -#if !defined(WIN32) && !defined(OS2) char err_string[MAX_STRING_LEN]; -#endif #ifdef DEBUG_INCLUDE_CMD fprintf(dbg, "Attempting to include command '%s'\n", s); @@ -821,16 +795,10 @@ static int include_cmd_child(void *arg, child_info *pinfo) #ifdef DEBUG_INCLUDE_CMD fprintf(dbg, "Attempting to exec '%s'\n", s); #endif -#ifdef TPF - return (0); -#else ap_cleanup_for_exec(); /* set shellcmd flag to pass arg to SHELL_PATH */ child_pid = ap_call_exec(r, pinfo, s, ap_create_environment(r->pool, env), 1); -#if defined(WIN32) || defined(OS2) - return (child_pid); -#else /* Oh, drat. We're still here. The log file descriptors are closed, * so we have to whimper a complaint onto stderr... */ @@ -845,8 +813,6 @@ static int include_cmd_child(void *arg, child_info *pinfo) exit(0); /* NOT REACHED */ return (child_pid); -#endif /* WIN32 */ -#endif /* TPF */ } static int include_cmd(char *s, request_rec *r) @@ -856,11 +822,6 @@ static int include_cmd(char *s, request_rec *r) arg.r = r; arg.s = s; -#ifdef TPF - arg.t.filename = r->filename; - arg.t.subprocess_env = r->subprocess_env; - arg.t.prog_type = FORK_FILE; -#endif if (!ap_bspawn_child(r->pool, include_cmd_child, &arg, kill_after_timeout, NULL, &script_in, NULL)) { @@ -895,9 +856,7 @@ static int handle_exec(FILE *in, request_rec *r, const char *error) ap_rputs(error, r); } /* just in case some stooge changed directories */ -#if !defined(WIN32) && !defined(NETWARE) ap_chdir_file(r->filename); -#endif } else if (!strcmp(tag, "cgi")) { parse_string(r, tag_val, parsed_string, sizeof(parsed_string), 0); @@ -907,9 +866,7 @@ static int handle_exec(FILE *in, request_rec *r, const char *error) ap_rputs(error, r); } /* grumble groan */ -#if !defined(WIN32) && !defined(NETWARE) ap_chdir_file(r->filename); -#endif } else if (!strcmp(tag, "done")) { return 0; @@ -2172,22 +2129,8 @@ static int handle_printenv(FILE *in, request_rec *r, const char *error) static void send_parsed_content(FILE *f, request_rec *r) { -#ifdef NETWARE - /* NetWare has a fixed lengh stack. Since MAX_STRING_LEN is set - to 8k, one call to this function allocates 24k of stack space. - During a server-side include evaluation this function is - called recusively, allocating 24k each time. Obviously it - doesn't take long to blow a 64k stack which is the default - for Apache for NetWare. Since MAX_STRING_LEN is used all - throughout the Apache code, we should rethink using a default - of 8k especially in recursive functions. - */ - char directive[512], error[512]; - char timefmt[512]; -#else char directive[MAX_STRING_LEN], error[MAX_STRING_LEN]; char timefmt[MAX_STRING_LEN]; -#endif int noexec = ap_allow_options(r) & OPT_INCNOEXEC; int ret, sizefmt; int if_nesting; @@ -2202,9 +2145,7 @@ static void send_parsed_content(FILE *f, request_rec *r) printing = conditional_status = 1; if_nesting = 0; -#if !defined(WIN32) && !defined(NETWARE) ap_chdir_file(r->filename); -#endif if (r->args) { /* add QUERY stuff to env cause it ain't yet */ char *arg_copy = ap_pstrdup(r->pool, r->args); @@ -2399,10 +2340,7 @@ static int send_parsed_file(request_rec *r) } if ((*state == xbithack_full) -#if !defined(OS2) && !defined(WIN32) && !defined(NETWARE) - /* OS/2 dosen't support Groups. */ && (r->finfo.st_mode & S_IXGRP) -#endif ) { ap_update_mtime(r, r->finfo.st_mtime); ap_set_last_modified(r); @@ -2492,10 +2430,6 @@ static int send_parsed_file(request_rec *r) */ ap_hard_timeout("send SSI", r); -#ifdef CHARSET_EBCDIC - /* XXX:@@@ Is the generated/included output ALWAYS in text/ebcdic format? */ - ap_bsetflag(r->connection->client, B_EBCDIC2ASCII, 1); -#endif send_parsed_content(f, r); @@ -2524,10 +2458,6 @@ static int send_shtml_file(request_rec *r) static int xbithack_handler(request_rec *r) { -#if defined(OS2) || defined(WIN32) || defined(NETWARE) - /* OS/2 dosen't currently support the xbithack. This is being worked on. */ - return DECLINED; -#else enum xbithack *state; if (!(r->finfo.st_mode & S_IXUSR)) { @@ -2541,7 +2471,6 @@ static int xbithack_handler(request_rec *r) return DECLINED; } return send_parsed_file(r); -#endif } static const command_rec includes_cmds[] = diff --git a/usr.sbin/httpd/src/modules/standard/mod_info.c b/usr.sbin/httpd/src/modules/standard/mod_info.c index 7554feee7fe..d3a430c26a7 100644 --- a/usr.sbin/httpd/src/modules/standard/mod_info.c +++ b/usr.sbin/httpd/src/modules/standard/mod_info.c @@ -443,10 +443,6 @@ static int display_info(request_rec *r) if (r->header_only) { return 0; } -#ifdef CHARSET_EBCDIC - /* Server-generated response, converted */ - ap_bsetflag(r->connection->client, B_EBCDIC2ASCII, r->ebcdic.conv_out = 1); -#endif ap_hard_timeout("send server info", r); ap_rputs(DOCTYPE_HTML_3_2 diff --git a/usr.sbin/httpd/src/modules/standard/mod_log_agent.c b/usr.sbin/httpd/src/modules/standard/mod_log_agent.c index 3d5e50ad80e..d3b25799f13 100644 --- a/usr.sbin/httpd/src/modules/standard/mod_log_agent.c +++ b/usr.sbin/httpd/src/modules/standard/mod_log_agent.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mod_log_agent.c,v 1.7 2003/08/21 13:11:36 henning Exp $ */ +/* $OpenBSD: mod_log_agent.c,v 1.8 2004/12/02 19:42:48 henning Exp $ */ /* ==================================================================== * The Apache Software License, Version 1.1 @@ -68,12 +68,7 @@ module agent_log_module; static int xfer_flags = (O_WRONLY | O_APPEND | O_CREAT); -#ifdef OS2 -/* OS/2 dosen't support users and groups */ -static mode_t xfer_mode = (S_IREAD | S_IWRITE); -#else static mode_t xfer_mode = (S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); -#endif typedef struct { char *fname; diff --git a/usr.sbin/httpd/src/modules/standard/mod_log_config.c b/usr.sbin/httpd/src/modules/standard/mod_log_config.c index d67f7e767f7..055e3257269 100644 --- a/usr.sbin/httpd/src/modules/standard/mod_log_config.c +++ b/usr.sbin/httpd/src/modules/standard/mod_log_config.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mod_log_config.c,v 1.15 2004/01/15 12:17:18 otto Exp $ */ +/* $OpenBSD: mod_log_config.c,v 1.16 2004/12/02 19:42:48 henning Exp $ */ /* ==================================================================== * The Apache Software License, Version 1.1 @@ -192,12 +192,7 @@ module MODULE_VAR_EXPORT config_log_module; static int xfer_flags = (O_WRONLY | O_APPEND | O_CREAT); -#if defined(OS2) || defined(WIN32) || defined(NETWARE) -/* OS/2 dosen't support users and groups */ -static mode_t xfer_mode = (S_IREAD | S_IWRITE); -#else static mode_t xfer_mode = (S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); -#endif /* POSIX.1 defines PIPE_BUF as the maximum number of bytes that is * guaranteed to be atomic when writing a pipe. And PIPE_BUF >= 512 diff --git a/usr.sbin/httpd/src/modules/standard/mod_log_referer.c b/usr.sbin/httpd/src/modules/standard/mod_log_referer.c index cced7162fb9..2e13c8abe1b 100644 --- a/usr.sbin/httpd/src/modules/standard/mod_log_referer.c +++ b/usr.sbin/httpd/src/modules/standard/mod_log_referer.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mod_log_referer.c,v 1.7 2003/08/21 13:11:36 henning Exp $ */ +/* $OpenBSD: mod_log_referer.c,v 1.8 2004/12/02 19:42:48 henning Exp $ */ /* ==================================================================== * The Apache Software License, Version 1.1 @@ -69,12 +69,7 @@ module referer_log_module; static int xfer_flags = (O_WRONLY | O_APPEND | O_CREAT); -#ifdef OS2 -/* OS/2 lacks support for users and groups */ -static mode_t xfer_mode = (S_IREAD | S_IWRITE); -#else static mode_t xfer_mode = (S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); -#endif typedef struct { char *fname; diff --git a/usr.sbin/httpd/src/modules/standard/mod_mime_magic.c b/usr.sbin/httpd/src/modules/standard/mod_mime_magic.c index b8ae67076ce..8e676444e02 100644 --- a/usr.sbin/httpd/src/modules/standard/mod_mime_magic.c +++ b/usr.sbin/httpd/src/modules/standard/mod_mime_magic.c @@ -130,10 +130,7 @@ #include "http_core.h" #include "http_log.h" #include "http_protocol.h" - -#ifndef WIN32 #include <utime.h> -#endif /* * data structures and related constants @@ -2148,7 +2145,6 @@ struct uncompress_parms { static int uncompress_child(void *data, child_info *pinfo) { struct uncompress_parms *parm = data; -#ifndef WIN32 char *new_argv[4]; new_argv[0] = compr[parm->method].argv[0]; @@ -2165,48 +2161,6 @@ static int uncompress_child(void *data, child_info *pinfo) MODNAME ": could not execute `%s'.", compr[parm->method].argv[0]); return -1; -#else - char *pCommand; - STARTUPINFO si; - PROCESS_INFORMATION pi; - pid_t pid; - - memset(&si, 0, sizeof(si)); - memset(&pi, 0, sizeof(pi)); - - pid = -1; - - /* - * Look at the arguments... - */ - pCommand = ap_pstrcat(parm->r->pool, compr[parm->method].argv[0], " ", - compr[parm->method].argv[1], " \"", - parm->r->filename, "\"", NULL); - - /* - * Make child process use hPipeOutputWrite as standard out, - * and make sure it does not show on screen. - */ - si.cb = sizeof(si); - si.dwFlags = STARTF_USESTDHANDLES | STARTF_USESHOWWINDOW; - si.wShowWindow = SW_HIDE; - si.hStdInput = pinfo->hPipeInputRead; - si.hStdOutput = pinfo->hPipeOutputWrite; - si.hStdError = pinfo->hPipeErrorWrite; - - if (CreateProcess(NULL, pCommand, NULL, NULL, TRUE, 0, NULL, - ap_make_dirstr_parent(parm->r->pool, parm->r->filename), - &si, &pi)) { - pid = pi.dwProcessId; - /* - * We must close the handles to the new process and its main thread - * to prevent handle and memory leaks. - */ - CloseHandle(pi.hProcess); - CloseHandle(pi.hThread); - } - return (pid); -#endif } diff --git a/usr.sbin/httpd/src/modules/standard/mod_rewrite.c b/usr.sbin/httpd/src/modules/standard/mod_rewrite.c index 3ed1a8fa83b..d9263109b6d 100644 --- a/usr.sbin/httpd/src/modules/standard/mod_rewrite.c +++ b/usr.sbin/httpd/src/modules/standard/mod_rewrite.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mod_rewrite.c,v 1.22 2004/09/08 16:12:30 henning Exp $ */ +/* $OpenBSD: mod_rewrite.c,v 1.23 2004/12/02 19:42:48 henning Exp $ */ /* ==================================================================== * The Apache Software License, Version 1.1 @@ -97,16 +97,10 @@ #include "fdcache.h" #ifndef NO_WRITEV -#ifndef NETWARE #include <sys/types.h> -#endif #include <sys/uio.h> #endif -#ifdef NETWARE -#include <nwsemaph.h> -static LONG locking_sem = 0; -#endif /* ** +-------------------------------------------------------+ @@ -1232,9 +1226,7 @@ static int hook_uri2file(request_rec *r) /* it was finally rewritten to a local path */ /* expand "/~user" prefix */ -#if !defined(WIN32) && !defined(NETWARE) r->filename = expand_tildepaths(r, r->filename); -#endif rewritelog(r, 2, "local path result: %s", r->filename); /* the filename must be either an absolute local path or an @@ -2219,13 +2211,11 @@ static int apply_rewrite_cond(request_rec *r, rewritecond_entry *p, } } else if (strcmp(p->pattern, "-l") == 0) { -#if !defined(OS2) && !defined(WIN32) && !defined(NETWARE) if (lstat(input, &sb) == 0) { if (S_ISLNK(sb.st_mode)) { rc = 1; } } -#endif } else if (strcmp(p->pattern, "-d") == 0) { if (stat(input, &sb) == 0) { @@ -2812,7 +2802,6 @@ static char *escape_absolute_uri(ap_pool *p, char *uri, unsigned scheme) ** Unix /etc/passwd database information ** */ -#if !defined(WIN32) && !defined(NETWARE) static char *expand_tildepaths(request_rec *r, char *uri) { char user[LONG_STRING_LEN]; @@ -2848,7 +2837,6 @@ static char *expand_tildepaths(request_rec *r, char *uri) } return newuri; } -#endif @@ -3264,13 +3252,7 @@ static void open_rewritelog(server_rec *s, pool *p) char *fname; piped_log *pl; int rewritelog_flags = ( O_WRONLY|O_APPEND|O_CREAT ); -#if defined(NETWARE) - mode_t rewritelog_mode = ( S_IREAD|S_IWRITE ); -#elif defined(WIN32) - mode_t rewritelog_mode = ( _S_IREAD|_S_IWRITE ); -#else mode_t rewritelog_mode = ( S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH ); -#endif conf = ap_get_module_config(s->module_config, &rewrite_module); @@ -3430,13 +3412,7 @@ static char *current_logtime(request_rec *r) ** +-------------------------------------------------------+ */ -#if defined(NETWARE) -#define REWRITELOCK_MODE ( S_IREAD|S_IWRITE ) -#elif defined(WIN32) -#define REWRITELOCK_MODE ( _S_IREAD|_S_IWRITE ) -#else #define REWRITELOCK_MODE ( S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH ) -#endif static void rewritelock_create(server_rec *s, pool *p) { @@ -3457,15 +3433,10 @@ static void rewritelock_create(server_rec *s, pool *p) "file %s", lockname); exit(1); } -#if !defined(OS2) && !defined(WIN32) && !defined(NETWARE) /* make sure the childs have access to this file */ if (geteuid() == 0 /* is superuser */) chown(lockname, ap_user_id, -1 /* no gid change */); -#endif -#ifdef NETWARE - locking_sem = OpenLocalSemaphore (1); -#endif return; } @@ -3499,9 +3470,6 @@ static void rewritelock_remove(void *data) unlink(lockname); lockname = NULL; lockfd = -1; -#ifdef NETWARE - CloseLocalSemaphore (locking_sem); -#endif } @@ -3598,41 +3566,8 @@ static int rewritemap_program_child(void *cmd, child_info *pinfo) /* * Exec() the child program */ -#if defined(WIN32) - /* MS Windows */ - { - char pCommand[MAX_STRING_LEN]; - STARTUPINFO si; - PROCESS_INFORMATION pi; - - ap_snprintf(pCommand, sizeof(pCommand), "%s /C %s", SHELL_PATH, cmd); - - memset(&si, 0, sizeof(si)); - memset(&pi, 0, sizeof(pi)); - - si.cb = sizeof(si); - si.dwFlags = STARTF_USESHOWWINDOW | STARTF_USESTDHANDLES; - si.wShowWindow = SW_HIDE; - si.hStdInput = pinfo->hPipeInputRead; - si.hStdOutput = pinfo->hPipeOutputWrite; - si.hStdError = pinfo->hPipeErrorWrite; - - if (CreateProcess(NULL, pCommand, NULL, NULL, TRUE, 0, - environ, NULL, &si, &pi)) { - CloseHandle(pi.hProcess); - CloseHandle(pi.hThread); - child_pid = pi.dwProcessId; - } - } -#elif defined(NETWARE) - /* Need something here!!! Spawn???? */ -#elif defined(OS2) - /* IBM OS/2 */ - execl(SHELL_PATH, SHELL_PATH, "/c", (char *)cmd, (char *)NULL); -#else /* Standard Unix */ execl(SHELL_PATH, SHELL_PATH, "-c", (char *)cmd, (char *)NULL); -#endif return(child_pid); } @@ -3655,11 +3590,9 @@ static char *lookup_variable(request_rec *r, char *var) time_t tc; struct tm *tm; request_rec *rsub; -#ifndef WIN32 struct passwd *pw; struct group *gr; struct stat finfo; -#endif result = NULL; @@ -3851,9 +3784,6 @@ static char *lookup_variable(request_rec *r, char *var) LOOKAHEAD(ap_sub_req_lookup_file) } -#if !defined(WIN32) && !defined(NETWARE) - /* Win32 has a rather different view of file ownerships. - For now, just forget it */ /* file stuff */ else if (strcasecmp(var, "SCRIPT_USER") == 0) { @@ -3886,7 +3816,6 @@ static char *lookup_variable(request_rec *r, char *var) } } } -#endif /* ndef WIN32 && NETWARE*/ #ifdef EAPI else { @@ -4403,12 +4332,6 @@ static void fd_lock(request_rec *r, int fd) rc = _locking(fd, _LK_LOCK, 1); lseek(fd, 0, SEEK_END); #endif -#ifdef NETWARE - if ((locking_sem != 0) && (TimedWaitOnLocalSemaphore (locking_sem, 10000) != 0)) - rc = -1; - else - rc = 1; -#endif if (rc < 0) { ap_log_rerror(APLOG_MARK, APLOG_ERR, r, @@ -4439,11 +4362,6 @@ static void fd_unlock(request_rec *r, int fd) rc = _locking(fd, _LK_UNLCK, 1); lseek(fd, 0, SEEK_END); #endif -#ifdef NETWARE - if (locking_sem) - SignalLocalSemaphore (locking_sem); - rc = 1; -#endif if (rc < 0) { ap_log_rerror(APLOG_MARK, APLOG_ERR, r, diff --git a/usr.sbin/httpd/src/modules/standard/mod_rewrite.h b/usr.sbin/httpd/src/modules/standard/mod_rewrite.h index 9cf3907236f..f6f8f6213b8 100644 --- a/usr.sbin/httpd/src/modules/standard/mod_rewrite.h +++ b/usr.sbin/httpd/src/modules/standard/mod_rewrite.h @@ -102,9 +102,7 @@ #include <signal.h> #include <errno.h> #include <ctype.h> -#ifndef NETWARE #include <sys/types.h> -#endif #include <sys/stat.h> /* Include from the Apache server ... */ @@ -156,25 +154,13 @@ #endif #if !defined(USE_FCNTL) && !defined(USE_FLOCK) #define USE_FLOCK 1 -#if !defined(MPE) && !defined(WIN32) && !defined(__TANDEM) && !defined(NETWARE) #include <sys/file.h> -#endif #ifndef LOCK_UN #undef USE_FLOCK #define USE_FCNTL 1 #include <fcntl.h> #endif #endif -#if defined(AIX) || defined(AIXIA64) -#undef USE_FLOCK -#define USE_FCNTL 1 -#include <fcntl.h> -#endif -#ifdef WIN32 -#undef USE_FCNTL -#define USE_LOCKING -#include <sys/locking.h> -#endif /* diff --git a/usr.sbin/httpd/src/modules/standard/mod_so.c b/usr.sbin/httpd/src/modules/standard/mod_so.c index fc2958940bd..9c853b78803 100644 --- a/usr.sbin/httpd/src/modules/standard/mod_so.c +++ b/usr.sbin/httpd/src/modules/standard/mod_so.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mod_so.c,v 1.12 2003/08/21 13:11:37 henning Exp $ */ +/* $OpenBSD: mod_so.c,v 1.13 2004/12/02 19:42:48 henning Exp $ */ /* ==================================================================== * The Apache Software License, Version 1.1 @@ -182,9 +182,6 @@ static void unload_module(moduleinfo *modi) ap_remove_loaded_module(modi->modp); /* unload the module space itself */ -#ifdef NETWARE - ap_os_dso_unsym((ap_os_dso_handle_t)modi->modp->dynamic_load_handle, modi->name); -#endif ap_os_dso_unload((ap_os_dso_handle_t)modi->modp->dynamic_load_handle); /* destroy the module information */ diff --git a/usr.sbin/httpd/src/modules/standard/mod_status.c b/usr.sbin/httpd/src/modules/standard/mod_status.c index 8dfe4b11da5..44fc23d0246 100644 --- a/usr.sbin/httpd/src/modules/standard/mod_status.c +++ b/usr.sbin/httpd/src/modules/standard/mod_status.c @@ -555,16 +555,6 @@ static int status_handler(request_rec *r) if (!short_report) { if (no_table_report) { if (score_record.status == SERVER_DEAD) -#ifdef TPF - if (kill(ps_record.pid, 0) == 0) { - /* on TPF show PIDs of the living dead */ - ap_rprintf(r, - "<b>Server %d-%d</b> (%d): %d|%lu|%lu [", - i, (int) ps_record.generation, - (int)ps_record.pid, (int) conn_lres, - my_lres, lres); - } else -#endif /* TPF */ ap_rprintf(r, "<b>Server %d-%d</b> (-): %d|%lu|%lu [", i, (int) ps_record.generation, (int) conn_lres, @@ -644,16 +634,6 @@ static int status_handler(request_rec *r) ap_rprintf(r,"<tr>"); #endif if (score_record.status == SERVER_DEAD) -#ifdef TPF - if (kill(ps_record.pid, 0) == 0) { - /* on TPF show PIDs of the living dead */ - ap_rprintf(r, - "<tr><td><b>%d-%d</b><td>%d<td>%d/%lu/%lu", - i, (int) ps_record.generation, - (int) ps_record.pid, - (int) conn_lres, my_lres, lres); - } else -#endif /* TPF */ ap_rprintf(r, "<td><b>%d-%d</b><td>-<td>%d/%lu/%lu", i, (int) ps_record.generation, diff --git a/usr.sbin/httpd/src/modules/standard/mod_unique_id.c b/usr.sbin/httpd/src/modules/standard/mod_unique_id.c index 5b04ca82b6d..f2daa84aae7 100644 --- a/usr.sbin/httpd/src/modules/standard/mod_unique_id.c +++ b/usr.sbin/httpd/src/modules/standard/mod_unique_id.c @@ -144,50 +144,6 @@ typedef struct { static unsigned global_in_addr; -#ifdef WIN32 - -static DWORD tls_index; - -BOOL WINAPI DllMain (HINSTANCE dllhandle, DWORD reason, LPVOID reserved) -{ - LPVOID memptr; - - switch (reason) { - case DLL_PROCESS_ATTACH: - tls_index = TlsAlloc(); - case DLL_THREAD_ATTACH: /* intentional no break */ - TlsSetValue(tls_index, calloc(sizeof(unique_id_rec), 1)); - break; - case DLL_THREAD_DETACH: - memptr = TlsGetValue(tls_index); - if (memptr) { - free (memptr); - TlsSetValue (tls_index, 0); - } - break; - } - - return TRUE; -} - -static unique_id_rec* get_cur_unique_id(int parent) -{ - /* Apache initializes the child process, not the individual child threads. - * Copy the original parent record if this->pid is not yet initialized. - */ - static unique_id_rec *parent_id; - unique_id_rec *cur_unique_id = (unique_id_rec *) TlsGetValue(tls_index); - - if (parent) { - parent_id = cur_unique_id; - } - else if (!cur_unique_id->pid) { - memcpy(cur_unique_id, parent_id, sizeof(*parent_id)); - } - return cur_unique_id; -} - -#else /* !WIN32 */ /* Even when not MULTITHREAD, this will return a single structure, since * APACHE_TLS should be defined as empty on single-threaded platforms. @@ -198,8 +154,6 @@ static unique_id_rec* get_cur_unique_id(int parent) return &spcid; } -#endif /* !WIN32 */ - /* * Number of elements in the structure unique_id_rec. diff --git a/usr.sbin/httpd/src/modules/standard/mod_userdir.c b/usr.sbin/httpd/src/modules/standard/mod_userdir.c index bd60727e957..100da1446a3 100644 --- a/usr.sbin/httpd/src/modules/standard/mod_userdir.c +++ b/usr.sbin/httpd/src/modules/standard/mod_userdir.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mod_userdir.c,v 1.11 2003/08/21 13:11:37 henning Exp $ */ +/* $OpenBSD: mod_userdir.c,v 1.12 2004/12/02 19:42:48 henning Exp $ */ /* ==================================================================== * The Apache Software License, Version 1.1 @@ -173,29 +173,14 @@ static const char *set_user_dir(cmd_parms *cmd, void *dummy, char *arg) while (*userdirs) { char *thisdir = ap_getword_conf(cmd->pool, &userdirs); if (!ap_os_is_path_absolute(thisdir) && !strchr(thisdir, ':')) { -#if defined(WIN32) || defined(NETWARE) - return "UserDir must specify an absolute redirect " - "or absolute file path"; -#else if (strchr(thisdir, '*')) { return "UserDir cannot specify '*' substitution within " "a relative path"; } -#endif } } s_cfg->userdir = ap_pstrdup(cmd->pool, arg); ap_server_strip_chroot(s_cfg->userdir, 1); -#if defined(WIN32) || defined(OS2) || defined(NETWARE) - /* These are incomplete paths, so we cannot canonicalize them yet. - * but any backslashes will confuse the parser, later, so simply - * change them to slash form. - */ - arg = s_cfg->userdir; - while (arg = strchr(arg, '\\')) { - *(arg++) = '/'; - } -#endif return NULL; } /* @@ -345,24 +330,11 @@ static int translate_userdir(request_rec *r) * serves [homedir]/[UserDir arg] * e.g. /~smith -> /home/smith/public_html */ -#if defined(WIN32) || defined(NETWARE) - /* Need to figure out home dirs on NT and NetWare - * Shouldn't happen here, though, we trap for this in set_user_dir - */ - return DECLINED; -#else /* WIN32 & NetWare */ struct passwd *pw; if ((pw = getpwnam(w))) { -#ifdef OS2 - /* Need to manually add user name for OS/2 */ - filename = ap_pstrcat(r->pool, pw->pw_dir, w, "/", - userdir, NULL); -#else filename = ap_pstrcat(r->pool, pw->pw_dir, "/", userdir, NULL); -#endif } -#endif /* WIN32 & NetWare */ } /* diff --git a/usr.sbin/httpd/src/modules/standard/mod_usertrack.c b/usr.sbin/httpd/src/modules/standard/mod_usertrack.c index 5701c6160ee..719c6955496 100644 --- a/usr.sbin/httpd/src/modules/standard/mod_usertrack.c +++ b/usr.sbin/httpd/src/modules/standard/mod_usertrack.c @@ -96,9 +96,7 @@ #include "httpd.h" #include "http_config.h" #include "http_core.h" -#if !defined(WIN32) && !defined(MPE) && !defined(TPF) #include <sys/time.h> -#endif module MODULE_VAR_EXPORT usertrack_module; @@ -152,11 +150,7 @@ static char * make_cookie_id(char * buffer, int bufsize, request_rec *r, struct tms mpe_tms; #elif !defined(WIN32) struct timeval tv; -#ifdef NETWARE - time_t tz = 0; -#else struct timezone tz = {0, 0}; -#endif /* defined(NETWARE) */ #endif cookie_dir_rec *dcfg; diff --git a/usr.sbin/httpd/src/os/unix/os.c b/usr.sbin/httpd/src/os/unix/os.c index b524fdb8f40..a775c8eb83c 100644 --- a/usr.sbin/httpd/src/os/unix/os.c +++ b/usr.sbin/httpd/src/os/unix/os.c @@ -14,167 +14,35 @@ extern void ap_is_not_here(void); void ap_is_not_here(void) {} /* - * Insert the DSO emulation code for AIX for releases of AIX prior - * to 4.3. Use the native DSO code for 4.3 and later. - */ -#if defined(AIX) && !defined(NO_DL_NEEDED) -#if AIX < 430 -#include "os-aix-dso.c" -#endif -#endif - -/* * Abstraction layer for loading * Apache modules under run-time via * dynamic shared object (DSO) mechanism */ -#ifdef HAVE_DYLD /* NeXT/Apple dynamic linker */ -#include <mach-o/dyld.h> - -/* - * NSUnlinkModule() is a noop in old versions of dyld. - * Let's install an error handler to deal with "multiply defined - * symbol" runtime errors. - */ -#ifdef DYLD_CANT_UNLOAD -#include "httpd.h" -#include "http_log.h" - -ap_private_extern -void undefined_symbol_handler(const char *symbolName) -{ - ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_EMERG, NULL, - "dyld found undefined symbol: %s\n" - "Aborting.\n", - symbolName); - abort(); -} - -ap_private_extern -NSModule multiple_symbol_handler (NSSymbol s, NSModule old, NSModule new) -{ - /* - * Since we can't unload symbols, we're going to run into this - * every time we reload a module. Workaround here is to just - * rebind to the new symbol, and forget about the old one. - * This is crummy, because it's basically a memory leak. - */ - -#ifdef DEBUG - ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_DEBUG, NULL, - "dyld found a multiply defined symbol %s in modules:\n" - "%s\n%s\n", - NSNameOfSymbol(s), - NSNameOfModule(old), NSNameOfModule(new)); -#endif - - return(new); -} - -ap_private_extern -void linkEdit_symbol_handler (NSLinkEditErrors c, int errorNumber, - const char *fileName, const char *errorString) -{ - ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_EMERG, NULL, - "dyld errors during link edit for file %s\n%s\n", - fileName, errorString); - abort(); -} - -#endif /* DYLD_CANT_UNLOAD */ -#endif /* HAVE_DYLD */ - void ap_os_dso_init(void) { -#if defined(HAVE_DYLD) && defined(DYLD_CANT_UNLOAD) - NSLinkEditErrorHandlers handlers; - - handlers.undefined = undefined_symbol_handler; - handlers.multiple = multiple_symbol_handler; - handlers.linkEdit = linkEdit_symbol_handler; - - NSInstallLinkEditErrorHandlers(&handlers); -#endif } void *ap_os_dso_load(const char *path) { -#if defined(HPUX) || defined(HPUX10) || defined(HPUX11) - shl_t handle; - handle = shl_load(path, BIND_IMMEDIATE|BIND_VERBOSE, 0L); - return (void *)handle; - -#elif defined(HAVE_DYLD) - NSObjectFileImage image; - NSModule handle; - if (NSCreateObjectFileImageFromFile(path, &image) != - NSObjectFileImageSuccess) - return NULL; -#if defined(NSLINKMODULE_OPTION_RETURN_ON_ERROR) && defined(NSLINKMODULE_OPTION_NONE) - handle = NSLinkModule(image, path, - NSLINKMODULE_OPTION_RETURN_ON_ERROR | - NSLINKMODULE_OPTION_NONE); -#else - handle = NSLinkModule(image, path, FALSE); -#endif - NSDestroyObjectFileImage(image); - return handle; - -#elif defined(OSF1) || defined(SEQUENT) ||\ - (defined(__FreeBSD_version) && (__FreeBSD_version >= 220000)) - return dlopen((char *)path, RTLD_NOW | RTLD_GLOBAL); - -#else return dlopen(path, RTLD_NOW | RTLD_GLOBAL); -#endif } void ap_os_dso_unload(void *handle) { -#if defined(HPUX) || defined(HPUX10) || defined(HPUX11) - shl_unload((shl_t)handle); - -#elif defined(HAVE_DYLD) - NSUnLinkModule(handle,FALSE); - -#else dlclose(handle); -#endif - return; } void *ap_os_dso_sym(void *handle, const char *symname) { -#if defined(HPUX) || defined(HPUX10) || defined(HPUX11) - void *symaddr = NULL; - int status; - - errno = 0; - status = shl_findsym((shl_t *)&handle, symname, TYPE_PROCEDURE, &symaddr); - if (status == -1 && errno == 0) /* try TYPE_DATA instead */ - status = shl_findsym((shl_t *)&handle, symname, TYPE_DATA, &symaddr); - return (status == -1 ? NULL : symaddr); - -#elif defined(HAVE_DYLD) - NSSymbol symbol; - asprintf(&symname2, "_%s", symname); - symbol = NSLookupAndBindSymbol(symname2); - free(symname2); - return NSAddressOfSymbol(symbol); - -#elif defined(DLSYM_NEEDS_UNDERSCORE) +#if defined(DLSYM_NEEDS_UNDERSCORE) char *symbol; void *retval; asprintf(&symbol, "_%s", symname); retval = dlsym(handle, symbol); free(symbol); return retval; - -#elif defined(SEQUENT) - return dlsym(handle, (char *)symname); - #else return dlsym(handle, symname); #endif @@ -182,11 +50,5 @@ void *ap_os_dso_sym(void *handle, const char *symname) const char *ap_os_dso_error(void) { -#if defined(HPUX) || defined(HPUX10) || defined(HPUX11) - return strerror(errno); -#elif defined(HAVE_DYLD) - return NULL; -#else return dlerror(); -#endif } diff --git a/usr.sbin/httpd/src/regex/main.c b/usr.sbin/httpd/src/regex/main.c index 5a9ada8ffd9..1c4364cae9f 100644 --- a/usr.sbin/httpd/src/regex/main.c +++ b/usr.sbin/httpd/src/regex/main.c @@ -3,9 +3,6 @@ #include <sys/types.h> #include <assert.h> #include <stdlib.h> -#ifdef TPF -#include <sysapi.h> /* for tmslc() */ -#endif /* TPF */ #include "hsregex.h" #include "main.ih" @@ -142,9 +139,6 @@ FILE *in; char *bpname = "REG_BADPAT"; regex_t re; -#ifdef TPF - tmslc(TMSLC_ENABLE, "IBMHIPRI"); /* extend our process' life */ -#endif /* TPF */ while (fgets(inbuf, sizeof(inbuf), in) != NULL) { line++; if (inbuf[0] == '#' || inbuf[0] == '\n') diff --git a/usr.sbin/httpd/src/regex/regcomp.c b/usr.sbin/httpd/src/regex/regcomp.c index 54a22a11384..565d766ebb8 100644 --- a/usr.sbin/httpd/src/regex/regcomp.c +++ b/usr.sbin/httpd/src/regex/regcomp.c @@ -100,29 +100,6 @@ int cflags; #else # define GOODFLAGS(f) ((f)&~REG_DUMP) #endif -#ifdef CHARSET_EBCDIC /* Added for Apache by <martin@apache.org> */ - static int initialized = 0; - - if (!initialized) { - unsigned ch, idx = 0; - static unsigned char ctlchars_ebcdic[256+1]; - - for (ch = 1; ch <= 0xFF; ++ch) { - if (ap_iscntrl(ch)) { - ctlchars_ebcdic[idx++] = ch; - } - } - ctlchars_ebcdic[idx++] = '\0'; /* redundant */ - - for (idx=0; idx < sizeof(cclasses) / sizeof(cclasses[0]); ++idx) { - if (strcmp(cclasses[idx].name, "cntrl") == 0) { - cclasses[idx].chars = (char *)ctlchars_ebcdic; - break; - } - } - initialized = 1; - } -#endif /*CHARSET_EBCDIC*/ cflags = GOODFLAGS(cflags); if ((cflags®_EXTENDED) && (cflags®_NOSPEC)) @@ -731,22 +708,8 @@ register cset *cs; finish = start; /* xxx what about signed chars here... */ REQUIRE(start <= finish, REG_ERANGE); -#ifndef CHARSET_EBCDIC for (i = start; i <= finish; i++) CHadd(cs, i); -#else /* Added for Apache by <martin@apache.org> */ - /* Special provision for character ranges [a-zA-Z], */ - /* which are non-contiguous in EBCDIC: */ - if ((ap_isupper(start) && ap_isupper(finish)) || - (ap_islower(start) && ap_islower(finish))) { - for (i = start; i <= finish; i++) - if (ap_isalpha(i)) - CHadd(cs, i); - } else { - for (i = start; i <= finish; i++) - CHadd(cs, i); - } -#endif /*CHARSET_EBCDIC*/ break; } } diff --git a/usr.sbin/httpd/src/support/ab.c b/usr.sbin/httpd/src/support/ab.c index c2f4618f44c..e43134711da 100644 --- a/usr.sbin/httpd/src/support/ab.c +++ b/usr.sbin/httpd/src/support/ab.c @@ -144,13 +144,8 @@ #else /* (!)NO_APACHE_INCLUDES */ #include "ap_config.h" #include "ap.h" -#ifdef CHARSET_EBCDIC -#include "ebcdic.h" -#endif #include <fcntl.h> -#ifndef MPE #include <sys/time.h> -#endif #ifndef NO_WRITEV #include <sys/types.h> @@ -300,15 +295,9 @@ struct data *stats; /* date for each request */ fd_set readbits, writebits; /* bits for select */ struct sockaddr_in server; /* server addr structure */ -#ifndef BEOS #define ab_close(s) close(s) #define ab_read(a,b,c) read(a,b,c) #define ab_write(a,b,c) write(a,b,c) -#else -#define ab_close(s) closesocket(s) -#define ab_read(a,b,c) recv(a,b,c,0) -#define ab_write(a,b,c) send(a,b,c,0) -#endif static void close_connection(struct connection * c); #if (defined(NO_WRITEV) || defined(USE_SSL)) @@ -449,11 +438,7 @@ static int s_write(struct connection * c, char *buff, int len) static void nonblock(int fd) { int i = 1; -#ifdef BEOS - setsockopt(fd, SOL_SOCKET, SO_NONBLOCK, &i, sizeof(i)); -#else ioctl(fd, FIONBIO, &i); -#endif } /* --------------------------------------------------------- */ @@ -1035,11 +1020,7 @@ static void read_connection(struct connection * c) int space = CBUFFSIZE - c->cbx - 1; /* -1 to allow for 0 * terminator */ int tocopy = (space < r) ? space : r; -#ifndef CHARSET_EBCDIC memcpy(c->cbuff + c->cbx, buffer, tocopy); -#else /* CHARSET_EBCDIC */ - ascii2ebcdic(c->cbuff + c->cbx, buffer, tocopy); -#endif /* CHARSET_EBCDIC */ c->cbx += tocopy; space -= tocopy; c->cbuff[c->cbx] = 0; /* terminate for benefit of strstr */ @@ -1292,10 +1273,6 @@ static void test(void) reqlen = strlen(request); -#ifdef CHARSET_EBCDIC - ebcdic2ascii(request, request, reqlen); -#endif /* CHARSET_EBCDIC */ - /* ok - lets start */ gettimeofday(&start, 0); @@ -1357,14 +1334,14 @@ static void test(void) static void copyright(void) { if (!use_html) { - printf("This is ApacheBench, Version %s\n", VERSION " <$Revision: 1.15 $> apache-1.3"); + printf("This is ApacheBench, Version %s\n", VERSION " <$Revision: 1.16 $> apache-1.3"); printf("Copyright (c) 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/\n"); printf("Copyright (c) 1998-2002 The Apache Software Foundation, http://www.apache.org/\n"); printf("\n"); } else { printf("<p>\n"); - printf(" This is ApacheBench, Version %s <i><%s></i> apache-1.3<br>\n", VERSION, "$Revision: 1.15 $"); + printf(" This is ApacheBench, Version %s <i><%s></i> apache-1.3<br>\n", VERSION, "$Revision: 1.16 $"); printf(" Copyright (c) 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/<br>\n"); printf(" Copyright (c) 1998-2002 The Apache Software Foundation, http://www.apache.org/<br>\n"); printf("</p>\n<p>\n"); diff --git a/usr.sbin/httpd/src/support/htdigest.c b/usr.sbin/httpd/src/support/htdigest.c index 24e2ddde230..481093b12c3 100644 --- a/usr.sbin/httpd/src/support/htdigest.c +++ b/usr.sbin/httpd/src/support/htdigest.c @@ -68,29 +68,13 @@ */ #include "ap_config.h" -#ifndef NETWARE #include <sys/types.h> -#endif #include "ap.h" #include "ap_md5.h" -#if defined(MPE) || defined(QNX) || defined(WIN32) || defined(__TANDEM) || defined(OS390) || defined(BEOS) || defined(BONE) -#include <signal.h> -#else #include <sys/signal.h> -#endif -#ifdef WIN32 -#include <conio.h> -#define unlink _unlink -#endif - -#ifdef CHARSET_EBCDIC -#define LF '\n' -#define CR '\r' -#else #define LF 10 #define CR 13 -#endif /* CHARSET_EBCDIC */ #define MAX_STRING_LEN 256 @@ -194,16 +178,6 @@ static void interrupted(void) } -#ifdef NETWARE -static void copy_file(FILE *target, FILE *source) -{ - static char line[MAX_STRING_LEN]; - - while (!(getline(line, MAX_STRING_LEN, source))) { - putline(target, line); - } -} -#endif int main(int argc, char *argv[]) { @@ -222,11 +196,6 @@ int main(int argc, char *argv[]) if (argc == 5) { if (strcmp(argv[1], "-c")) usage(); -#ifdef NETWARE - UnAugmentAsterisk(TRUE); - SetCurrentNameSpace(NW_NS_LONG); - SetTargetNameSpace(NW_NS_LONG); -#endif if (!(tfp = fopen(argv[2], "w"))) { fprintf(stderr, "Could not open passwd file %s for writing.\n", argv[2]); @@ -282,26 +251,8 @@ int main(int argc, char *argv[]) } fclose(f); fclose(tfp); -#ifndef NETWARE -#if defined(OS2) || defined(WIN32) - snprintf(command, sizeof(command), "copy \"%s\" \"%s\"", tn, argv[1]); -#else snprintf(command, sizeof(command), "cp %s %s", tn, argv[1]); -#endif system(command); -#else - if (!(tfp = fopen(tn, "r"))) { - fprintf(stderr, "Could not open temp file.\n"); - exit(1); - } - - if (!(f = fopen(argv[1], "w"))) { - fprintf(stderr, "Could not open %s.\n", argv[1]); - exit(1); - } - - copy_file(f, tfp); -#endif unlink(tn); return 0; } diff --git a/usr.sbin/httpd/src/support/htpasswd.c b/usr.sbin/httpd/src/support/htpasswd.c index d4567b2db51..053261dff4b 100644 --- a/usr.sbin/httpd/src/support/htpasswd.c +++ b/usr.sbin/httpd/src/support/htpasswd.c @@ -81,9 +81,7 @@ */ #include "ap_config.h" -#ifndef NETWARE #include <sys/types.h> -#endif #include <signal.h> #include <errno.h> #include "ap.h" @@ -94,19 +92,9 @@ #include <crypt.h> #endif -#ifdef WIN32 -#include <conio.h> -#include "../os/win32/getopt.h" -#define unlink _unlink -#endif -#ifndef CHARSET_EBCDIC #define LF 10 #define CR 13 -#else /*CHARSET_EBCDIC*/ -#define LF '\n' -#define CR '\r' -#endif /*CHARSET_EBCDIC*/ #define MAX_STRING_LEN 256 #define ALG_PLAIN 0 @@ -188,10 +176,6 @@ static int mkrecord(char *user, char *record, size_t rlen, char *passwd, pw = passwd; } else { -#ifdef TPF - fprintf(stderr, "Invalid entry. The -b option is required on TPF.\n"); - return usage(); -#else if (ap_getpass("New password: ", pwin, sizeof(pwin)) != 0) { ap_snprintf(record, (rlen - 1), "password too long (>%lu)", (unsigned long) (sizeof(pwin) - 1)); @@ -204,7 +188,6 @@ static int mkrecord(char *user, char *record, size_t rlen, char *passwd, } pw = pwin; memset(pwv, '\0', sizeof(pwin)); -#endif /* TPF */ } switch (alg) { @@ -258,14 +241,9 @@ static int usage(void) fprintf(stderr, " -c Create a new file.\n"); fprintf(stderr, " -n Don't update file; display results on stdout.\n"); fprintf(stderr, " -m Force MD5 encryption of the password" -#if defined(WIN32) || defined(TPF) || defined(NETWARE) - " (default)" -#endif ".\n"); fprintf(stderr, " -d Force CRYPT encryption of the password" -#if (!(defined(WIN32) || defined(TPF) || defined(NETWARE))) " (default)" -#endif ".\n"); fprintf(stderr, " -p Do not encrypt the password (plaintext).\n"); fprintf(stderr, " -s Force SHA encryption of the password.\n"); @@ -324,18 +302,10 @@ static int writable(char *fname) */ static int exists(char *fname) { -#ifdef WIN32 - struct _stat sbuf; -#else struct stat sbuf; -#endif int check; -#ifdef WIN32 - check = _stat(fname, &sbuf); -#else check = stat(fname, &sbuf); -#endif return ((check == -1) && (errno == ENOENT)) ? 0 : 1; } @@ -433,11 +403,6 @@ int main(int argc, char *argv[]) if ((argc - i) != args_left) { return usage(); } -#ifdef NETWARE - UnAugmentAsterisk(TRUE); - SetCurrentNameSpace(NW_NS_LONG); - SetTargetNameSpace(NW_NS_LONG); -#endif if (newfile && nofile) { fprintf(stderr, "%s: -c and -n options conflict\n", argv[0]); return ERR_SYNTAX; @@ -472,24 +437,10 @@ int main(int argc, char *argv[]) strlcpy(password, argv[i + 2], sizeof(password)); } -#ifdef WIN32 - if (alg == ALG_CRYPT) { - alg = ALG_APMD5; - fprintf(stderr, "Automatically using MD5 format on Windows.\n"); - } -#elif defined(TPF) || defined(NETWARE) - if (alg == ALG_CRYPT) { - alg = ALG_APMD5; - fprintf(stderr, "Automatically using MD5 format.\n"); - } -#endif - -#if (!(defined(WIN32) || defined(TPF) || defined(NETWARE))) if (alg == ALG_PLAIN) { fprintf(stderr,"Warning: storing passwords as plain text might " "just not work on this platform.\n"); } -#endif if (! nofile) { /* * Only do the file checks if we're supposed to frob it. diff --git a/usr.sbin/httpd/src/support/logresolve.c b/usr.sbin/httpd/src/support/logresolve.c index 10072570b3f..4d05e6fd651 100644 --- a/usr.sbin/httpd/src/support/logresolve.c +++ b/usr.sbin/httpd/src/support/logresolve.c @@ -44,15 +44,7 @@ #include <ctype.h> -#if !defined(MPE) && !defined(WIN32) -#ifndef BEOS #include <arpa/inet.h> -#else -/* BeOS lacks the necessary files until we get the new networking */ -#include <netinet/in.h> -#define NO_ADDRESS 4 -#endif /* BEOS */ -#endif /* !MPE && !WIN32*/ static void cgethost(struct in_addr ipnum, char *string, int check); static int getline(char *s, int n); @@ -280,11 +272,6 @@ int main (int argc, char *argv[]) char *bar, hoststring[MAXDNAME + 1], line[MAXLINE], *statfile; int i, check; -#ifdef WIN32 - WSADATA wsaData; - WSAStartup(0x101, &wsaData); -#endif - check = 0; statfile = NULL; for (i = 1; i < argc; i++) { @@ -340,10 +327,6 @@ int main (int argc, char *argv[]) puts(hoststring); } -#ifdef WIN32 - WSACleanup(); -#endif - if (statfile != NULL) { FILE *fp; fp = fopen(statfile, "w"); diff --git a/usr.sbin/httpd/src/support/rotatelogs.c b/usr.sbin/httpd/src/support/rotatelogs.c index 10b90ff1d87..1137bce377e 100644 --- a/usr.sbin/httpd/src/support/rotatelogs.c +++ b/usr.sbin/httpd/src/support/rotatelogs.c @@ -12,9 +12,6 @@ #include <errno.h> #include <fcntl.h> -#if defined(WIN32) || defined(OS2) -#include <io.h> -#endif #define BUFSIZE 65536 #define ERRMSGSZ 82 @@ -32,26 +29,15 @@ int main (int argc, char **argv) time_t now; char *szLogRoot; -#ifdef TPF - /* set up signal handling to avoid default OPR-I007777 dump */ - signal(SIGPIPE, exit); - signal(SIGTERM, exit); -#endif if (argc < 3) { fprintf(stderr, "Usage: %s <logfile> <rotation time in seconds> " "[offset minutes from UTC]\n\n", argv[0]); -#ifdef OS2 - fprintf(stderr, - "Add this:\n\nTransferLog \"|%s.exe /some/where 86400\"\n\n", - argv[0]); -#else fprintf(stderr, "Add this:\n\nTransferLog \"|%s /some/where 86400\"\n\n", argv[0]); -#endif fprintf(stderr, "to httpd.conf. The generated name will be /some/where.nnnn " "where nnnn is the\nsystem time at which the log nominally " @@ -71,10 +57,6 @@ int main (int argc, char **argv) exit(6); } -#if defined(WIN32) || defined(OS2) - setmode(0, O_BINARY); -#endif - use_strftime = (strstr(szLogRoot, "%") != NULL); for (;;) { nRead = read(0, buf, sizeof buf); @@ -115,11 +97,7 @@ int main (int argc, char **argv) "new log file. %10d messages lost.\n", nMessCount); nWrite = strlen(errbuf); -#ifdef WIN32 - chsize(nLogFD, 0); -#else ftruncate(nLogFD, 0); -#endif write(nLogFD, errbuf, nWrite); } } @@ -138,11 +116,7 @@ int main (int argc, char **argv) "%10d messages lost.\n", nMessCount); nWrite = strlen(errbuf); -#ifdef WIN32 - chsize(nLogFD, 0); -#else ftruncate(nLogFD, 0); -#endif write (nLogFD, errbuf, nWrite); } else { diff --git a/usr.sbin/httpd/src/support/suexec.c b/usr.sbin/httpd/src/support/suexec.c index 04f6e494fbc..a0251da4971 100644 --- a/usr.sbin/httpd/src/support/suexec.c +++ b/usr.sbin/httpd/src/support/suexec.c @@ -312,12 +312,7 @@ int main(int argc, char *argv[]) if ((argc > 1) && (! strcmp(argv[1], "-V")) && ((uid == 0) -#ifdef _OSD_POSIX - /* User name comparisons are case insensitive on BS2000/OSD */ - || (! strcasecmp(HTTPD_USER, pw->pw_name))) -#else /* _OSD_POSIX */ || (! strcmp(HTTPD_USER, pw->pw_name))) -#endif /* _OSD_POSIX */ ) { #ifdef DOC_ROOT fprintf(stderr, " -D DOC_ROOT=\"%s\"\n", DOC_ROOT); @@ -362,20 +357,11 @@ int main(int argc, char *argv[]) * is the user allowed to do so as defined in * suexec.h. If not the allowed user, error out. */ -#ifdef _OSD_POSIX - /* User name comparisons are case insensitive on BS2000/OSD */ - if (strcasecmp(HTTPD_USER, pw->pw_name)) { - log_err("crit: calling user mismatch (%s instead of %s)\n", - pw->pw_name, HTTPD_USER); - exit(103); - } -#else /* _OSD_POSIX */ if (strcmp(HTTPD_USER, pw->pw_name)) { log_err("crit: calling user mismatch (%s instead of %s)\n", pw->pw_name, HTTPD_USER); exit(103); } -#endif /* _OSD_POSIX */ /* * Check for a leading '/' (absolute path) in the command to be executed, @@ -423,35 +409,6 @@ int main(int argc, char *argv[]) actual_gname = strdup(target_gname); } -#ifdef _OSD_POSIX - /* - * Initialize BS2000 user environment - */ - { - pid_t pid, reaped; - int status; - - switch (pid = ufork(target_uname)) - { - case -1: /* Error */ - log_err("emerg: failed to setup bs2000 environment for user " - "%s: %s\n", - target_uname, strerror(errno)); - exit(150); - case 0: /* Child */ - break; - default: /* Father */ - while (pid != (reaped = waitpid(pid, &status, 0)) - && (reaped != -1 || errno != ECHILD)) - ; - /* @@@ FIXME: should we deal with STOP signals as well? */ - if (WIFSIGNALED(status)) { - kill (getpid(), WTERMSIG(status)); - } - exit(WEXITSTATUS(status)); - } - } -#endif /* _OSD_POSIX */ /* * Save these for later since initgroups will hose the struct |