diff options
author | Henning Brauer <henning@cvs.openbsd.org> | 2004-12-06 13:14:11 +0000 |
---|---|---|
committer | Henning Brauer <henning@cvs.openbsd.org> | 2004-12-06 13:14:11 +0000 |
commit | 891be1f64424002e050047bcd21ecf4d4b4f2bc5 (patch) | |
tree | 37a97ff78a7ac46757f37cece243207266615d6f /usr.sbin | |
parent | 5bdb7a1f65ec91239613dfe6c0e7daae9204af1e (diff) |
kill more dead code, mostly inside #ifdef SOMENONSENSEONSTUPIDOSES
joint work by Michael Knudsen <e@molioner.dk> and Daniel Ouellet
<daniel@presscom.net> with my input
no change in binaries
Diffstat (limited to 'usr.sbin')
47 files changed, 10 insertions, 1097 deletions
diff --git a/usr.sbin/httpd/src/ap/ap_checkpass.c b/usr.sbin/httpd/src/ap/ap_checkpass.c index 5b5f13fac55..915238f863a 100644 --- a/usr.sbin/httpd/src/ap/ap_checkpass.c +++ b/usr.sbin/httpd/src/ap/ap_checkpass.c @@ -67,9 +67,6 @@ #include "ap_md5.h" #include "ap_sha1.h" #include "ap.h" -#if HAVE_CRYPT_H -#include <crypt.h> -#endif /* * Validate a plaintext password against a smashed one. Use either diff --git a/usr.sbin/httpd/src/ap/ap_ctx.c b/usr.sbin/httpd/src/ap/ap_ctx.c index a2dda81df24..b85940e54ae 100644 --- a/usr.sbin/httpd/src/ap/ap_ctx.c +++ b/usr.sbin/httpd/src/ap/ap_ctx.c @@ -60,8 +60,6 @@ ** Written by Ralf S. Engelschall <rse@engelschall.com> */ -#ifdef EAPI - #include "httpd.h" #include "ap_config.h" #include "ap_ctx.h" @@ -151,5 +149,3 @@ API_EXPORT(ap_ctx *) ap_ctx_overlay(pool *p, ap_ctx *over, ap_ctx *base) ap_ctx_set(new, over->cr_entry[i]->ce_key, over->cr_entry[i]->ce_val); return new; } - -#endif /* EAPI */ diff --git a/usr.sbin/httpd/src/ap/ap_execve.c b/usr.sbin/httpd/src/ap/ap_execve.c index 8cda15c21dc..16bc27adc2b 100644 --- a/usr.sbin/httpd/src/ap/ap_execve.c +++ b/usr.sbin/httpd/src/ap/ap_execve.c @@ -91,267 +91,5 @@ /*---------------------------------------------------------------*/ -#ifdef NEED_HASHBANG_EMUL - -#undef execle -#undef execve - -static const char **hashbang(const char *filename, char * const *argv); - - -/* Historically, a list of arguments on the stack was often treated as - * being equivalent to an array (since they already were "contiguous" - * on the stack, and the arguments were pushed in the correct order). - * On today's processors, this is not necessarily equivalent, because - * often arguments are padded or passed partially in registers, - * or the stack direction is backwards. - * To be on the safe side, we copy the argument list to our own - * local argv[] array. The va_arg logic makes sure we do the right thing. - * XXX: malloc() is used because we expect to be overlaid soon. - */ -int ap_execle(const char *filename, const char *argv0, ...) -{ - va_list adummy; - char **envp; - char **argv; - int argc, ret; - - /* First pass: Count arguments on stack */ - va_start(adummy, argv0); - for (argc = 1; va_arg(adummy, char *) != NULL; ++argc) { - continue; - } - va_end(adummy); - - if ((argv = (char **) malloc((argc + 2) * sizeof(*argv))) == NULL) { - fprintf(stderr, "Ouch! Out of memory in ap_execle()!\n"); - return -1; - } - - /* Pass two --- copy the argument strings into the result space */ - va_start(adummy, argv0); - argv[0] = (char *)argv0; - for (argc = 1; (argv[argc] = va_arg(adummy, char *)) != NULL; ++argc) { - continue; - } - envp = va_arg(adummy, char **); - va_end(adummy); - - ret = ap_execve(filename, argv, envp); - free(argv); - - return ret; -} - -/* Count number of entries in vector "args", including the trailing NULL entry - */ -static int -count_args(char * const *args) -{ - int i; - for (i = 0; args[i] != NULL; ++i) { - continue; - } - return i+1; -} - -/* Emulate the execve call, respecting a #!/interpreter line if present. - * On "real" unixes, the kernel does this. - * We have to fiddle with the argv array to make it work on platforms - * which don't support the "hashbang" interpreter line by default. - */ -int ap_execve(const char *filename, char * const argv[], - char * const envp[]) -{ - char **script_argv; - extern char **environ; - - if (envp == NULL) { - envp = (char * const *) environ; - } - - /* Try to execute the file directly first: */ - execve(filename, argv, envp); - - /* Still with us? Then something went seriously wrong. - * From the (linux) man page: - * EACCES The file is not a regular file. - * EACCES Execute permission is denied for the file. - * EACCES Search permission is denied on a component of the path prefix. - * EPERM The file system is mounted noexec. - * EPERM The file system is mounted nosuid and the file has an SUID - * or SGID bit set. - * E2BIG The argument list is too big. - * ENOEXEC The magic number in the file is incorrect. - * EFAULT filename points outside your accessible address space. - * ENAMETOOLONG filename is too long. - * ENOENT The file does not exist. - * ENOMEM Insufficient kernel memory was available. - * ENOTDIR A component of the path prefix is not a directory. - * ELOOP filename contains a circular reference (i.e., via a symbolic link) - */ - - if (errno == ENOEXEC) { - /* Probably a script. - * Have a look; if there's a "#!" header then try to emulate - * the feature found in all modern OS's: - * Interpret the line following the #! as a command line - * in shell style. - */ - if ((script_argv = (char **)hashbang(filename, argv)) != NULL) { - - /* new filename is the interpreter to call */ - filename = script_argv[0]; - - /* Restore argv[0] as on entry */ - if (argv[0] != NULL) { - script_argv[0] = argv[0]; - } - - execve(filename, script_argv, envp); - - free(script_argv); - } - /* - * Script doesn't start with a hashbang line! - * So, try to have the default shell execute it. - * For this, the size of argv must be increased by one - * entry: the shell's name. The remaining args are appended. - */ - else { - int i = count_args(argv) + 1; /* +1 for leading SHELL_PATH */ - - if ((script_argv = malloc(sizeof(*script_argv) * i)) == NULL) { - fprintf(stderr, "Ouch! Out of memory in ap_execve()!\n"); - return -1; - } - - script_argv[0] = SHELL_PATH; - - while (i > 0) { - script_argv[i] = argv[i-1]; - --i; - } - - execve(SHELL_PATH, script_argv, envp); - - free(script_argv); - } - } - return -1; -} - -/*---------------------------------------------------------------*/ - -/* - * From: peter@zeus.dialix.oz.au (Peter Wemm) - * (taken from tcsh) - * If exec() fails look first for a #! [word] [word] .... - * If it is, splice the header into the argument list and retry. - * Return value: the original argv array (sans argv[0]), with the - * script's argument list prepended. - * XXX: malloc() is used so that everything can be free()ed after a failure. - */ -#define HACKBUFSZ 1024 /* Max chars in #! vector */ -#define HACKVECSZ 128 /* Max words in #! vector */ -static const char **hashbang(const char *filename, char * const *argv) -{ - char lbuf[HACKBUFSZ]; - char *sargv[HACKVECSZ]; - const char **newargv; - char *p, *ws; - int fd; - int sargc = 0; - int i, j; - - if ((fd = open(filename, O_RDONLY)) == -1) { - return NULL; - } - - if (read(fd, (char *) lbuf, 2) != 2 - || lbuf[0] != '#' || lbuf[1] != '!' - || read(fd, (char *) lbuf, HACKBUFSZ) <= 0) { - close(fd); - return NULL; - } - - close(fd); - - ws = NULL; /* word started = 0 */ - - for (p = lbuf; p < &lbuf[HACKBUFSZ];) { - switch (*p) { - case ' ': - case '\t': -#ifdef NEW_CRLF - case '\r': -#endif /*NEW_CRLF */ - if (ws) { /* a blank after a word.. save it */ - *p = '\0'; - if (sargc < HACKVECSZ - 1) { - sargv[sargc++] = ws; - } - ws = NULL; - } - p++; - continue; - - case '\0': /* Whoa!! what the hell happened */ - return NULL; - - case '\n': /* The end of the line. */ - if ( - ws) { /* terminate the last word */ - *p = '\0'; - if (sargc < HACKVECSZ - 1) { - sargv[sargc++] = ws; - } - sargv[sargc] = NULL; - } - /* Count number of entries in the old argv vector */ - for (i = 0; argv[i] != NULL; ++i) { - continue; - } - ++i; - - newargv = (const char **) malloc((p - lbuf + 1) - + (i + sargc + 1) * sizeof(*newargv)); - if (newargv == NULL) { - fprintf(stderr, "Ouch! Out of memory in hashbang()!\n"); - return NULL; - } - ws = &((char *) newargv)[(i + sargc + 1) * sizeof(*newargv)]; - - /* Copy entries to allocated memory */ - for (j = 0; j < sargc; ++j) { - newargv[j] = strcpy(ws, sargv[j]); - ws += strlen(ws) + 1; /* skip trailing '\0' */ - } - newargv[sargc] = filename; - - /* Append the old array. The old argv[0] is skipped. */ - if (i > 1) { - memcpy(&newargv[sargc + 1], &argv[1], - (i - 1) * sizeof(*newargv)); - } - - newargv[sargc + i] = NULL; - - ws = NULL; - - return newargv; - - default: - if (!ws) { /* Start a new word? */ - ws = p; - } - p++; - break; - } - } - return NULL; -} -#else extern void ap_execve_is_not_here(void); void ap_execve_is_not_here(void) {} -#endif /* NEED_HASHBANG_EMUL */ diff --git a/usr.sbin/httpd/src/ap/ap_md5c.c b/usr.sbin/httpd/src/ap/ap_md5c.c index 2a5f4228eeb..b64e424fe2e 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" -#if HAVE_CRYPT_H -#include <crypt.h> -#endif /* Constants for MD5Transform routine. */ diff --git a/usr.sbin/httpd/src/ap/ap_mm.c b/usr.sbin/httpd/src/ap/ap_mm.c index 95df26e33d0..e0cad1a5598 100644 --- a/usr.sbin/httpd/src/ap/ap_mm.c +++ b/usr.sbin/httpd/src/ap/ap_mm.c @@ -73,8 +73,6 @@ * "What you see is all you get." * -- Brian Kernighan */ -#ifdef EAPI - #include "httpd.h" #include "ap_mm.h" @@ -174,5 +172,3 @@ API_EXPORT(char *) ap_mm_lib_error_get(void) STUB(mm_lib_error_get(), NULL) API_EXPORT(int) ap_mm_lib_version(void) STUB(mm_lib_version(), 0) - -#endif /* EAPI */ diff --git a/usr.sbin/httpd/src/ap/ap_signal.c b/usr.sbin/httpd/src/ap/ap_signal.c index f72763c2a19..7da2a868676 100644 --- a/usr.sbin/httpd/src/ap/ap_signal.c +++ b/usr.sbin/httpd/src/ap/ap_signal.c @@ -71,9 +71,6 @@ Sigfunc *signal(int signo, Sigfunc * func) act.sa_handler = func; sigemptyset(&act.sa_mask); act.sa_flags = 0; -#ifdef SA_INTERRUPT /* SunOS */ - act.sa_flags |= SA_INTERRUPT; -#endif if (sigaction(signo, &act, &oact) < 0) return SIG_ERR; return oact.sa_handler; diff --git a/usr.sbin/httpd/src/ap/ap_snprintf.c b/usr.sbin/httpd/src/ap/ap_snprintf.c index c6443a7c23d..7e02372f83d 100644 --- a/usr.sbin/httpd/src/ap/ap_snprintf.c +++ b/usr.sbin/httpd/src/ap/ap_snprintf.c @@ -926,20 +926,16 @@ API_EXPORT(int) ap_vformatter(int (*flush_func)(ap_vformatter_buff *), /* * * We use &num_buf[ 1 ], so that we have room for the sign */ -#ifdef HAVE_ISNAN if (isnan(fp_num)) { s = "nan"; s_len = 3; } else -#endif -#ifdef HAVE_ISINF if (isinf(fp_num)) { s = "inf"; s_len = 3; } else -#endif { s = conv_fp(*fmt, fp_num, alternate_form, (adjust_precision == NO) ? FLOAT_DIGITS : precision, diff --git a/usr.sbin/httpd/src/include/ap.h b/usr.sbin/httpd/src/include/ap.h index b9d5b4b90dd..e4e6ea871de 100644 --- a/usr.sbin/httpd/src/include/ap.h +++ b/usr.sbin/httpd/src/include/ap.h @@ -81,11 +81,7 @@ API_EXPORT(long) ap_strtol(const char *nptr, char **endptr, int base); /* small utility macros to make things easier to read */ -#ifdef NO_KILLPG -#define ap_killpg(x, y) (kill (-(x), (y))) -#else #define ap_killpg(x, y) (killpg ((x), (y))) -#endif /* 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 994c51e0d36..6c8d1f1caaa 100644 --- a/usr.sbin/httpd/src/include/ap_alloc.h +++ b/usr.sbin/httpd/src/include/ap_alloc.h @@ -90,7 +90,6 @@ typedef struct pool ap_pool; API_EXPORT(pool *) ap_init_alloc(void); /* Set up everything */ void ap_cleanup_alloc(void); API_EXPORT(pool *) ap_make_sub_pool(pool *); /* All pools are subpools of permanent_pool */ -#if defined(EAPI) typedef enum { AP_POOL_RD, AP_POOL_RW } ap_pool_lock_mode; int ap_shared_pool_possible(void); void ap_init_alloc_shared(int); @@ -98,7 +97,6 @@ void ap_kill_alloc_shared(void); API_EXPORT(pool *) ap_make_shared_sub_pool(pool *); API_EXPORT(int) ap_acquire_pool(pool *, ap_pool_lock_mode); API_EXPORT(int) ap_release_pool(pool *); -#endif API_EXPORT(void) ap_destroy_pool(pool *); /* pools have nested lifetimes -- sub_pools are destroyed when the diff --git a/usr.sbin/httpd/src/include/ap_config.h b/usr.sbin/httpd/src/include/ap_config.h index adea9350c51..a7bfede15e6 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.18 2004/12/02 19:42:46 henning Exp $ */ +/* $OpenBSD: ap_config.h,v 1.19 2004/12/06 13:14:09 henning Exp $ */ /* ==================================================================== * The Apache Software License, Version 1.1 @@ -134,53 +134,9 @@ stat() properly */ #endif #endif #define SINGLE_LISTEN_UNSERIALIZED_ACCEPT - -#elif defined(__FreeBSD__) || defined(__bsdi__) -#if defined(__FreeBSD__) -#include <osreldate.h> -#endif -#define HAVE_GMTOFF 1 -#undef NO_KILLPG -#undef NO_SETSID -#define HAVE_MMAP 1 -#define USE_MMAP_SCOREBOARD -#define USE_MMAP_FILES -#ifndef DEFAULT_USER -#define DEFAULT_USER "nobody" -#endif -#ifndef DEFAULT_GROUP -#define DEFAULT_GROUP "nogroup" -#endif -#if defined(__bsdi__) || \ -(defined(__FreeBSD_version) && (__FreeBSD_version < 220000)) -typedef quad_t rlim_t; -#endif -#define HAVE_FLOCK_SERIALIZED_ACCEPT -#define SINGLE_LISTEN_UNSERIALIZED_ACCEPT -#define HAVE_SYSLOG 1 -#define SYS_SIGLIST sys_siglist -#if (defined(__FreeBSD_version) && (__FreeBSD_version >= 400000)) -#define NET_SIZE_T socklen_t -#endif - -#else -/* Unknown system - Edit these to match */ -#ifdef BSD -#define HAVE_GMTOFF 1 -#else -#undef HAVE_GMTOFF -#endif -/* NO_KILLPG is set on systems that don't have killpg */ -#undef NO_KILLPG -/* NO_SETSID is set on systems that don't have setsid */ -#undef NO_SETSID -/* NEED_STRDUP is set on stupid systems that don't have strdup. */ -#undef NEED_STRDUP #endif -#ifdef HAVE_SYS_PARAM_H #include <sys/param.h> -#endif /* HAVE_SYS_PARAM_H */ /* stuff marked API_EXPORT is part of the API, and intended for use * by modules @@ -246,9 +202,7 @@ typedef quad_t rlim_t; #include "ap_ctype.h" #include <sys/file.h> #include <sys/socket.h> -#ifdef HAVE_SYS_SELECT_H #include <sys/select.h> -#endif /* HAVE_SYS_SELECT_H */ #include <netinet/in.h> #include <netdb.h> #include <sys/ioctl.h> @@ -268,65 +222,31 @@ typedef quad_t rlim_t; #include <errno.h> #include <memory.h> -#ifdef NEED_PROCESS_H -#include <process.h> -#endif - #if defined(WIN32) || defined(USE_HSREGEX) #include "hsregex.h" #else #include <regex.h> #endif -#ifdef HAVE_SYS_RESOURCE_H #include <sys/resource.h> -#endif -#ifdef USE_MMAP_SCOREBOARD #include <sys/mman.h> -#endif #if !defined(MAP_ANON) && defined(MAP_ANONYMOUS) #define MAP_ANON MAP_ANONYMOUS #endif -#if defined(USE_MMAP_FILES) && (defined(NO_MMAP) || !defined(HAVE_MMAP)) -#undef USE_MMAP_FILES -#endif - -#if defined(USE_MMAP_SCOREBOARD) && (defined(NO_MMAP) || !defined(HAVE_MMAP)) -#undef USE_MMAP_SCOREBOARD -#endif - -#if defined(USE_SHMGET_SCOREBOARD) && (defined(NO_SHMGET) || !defined(HAVE_SHMGET)) -#undef USE_SHMGET_SCOREBOARD -#endif - /* A USE_FOO_SERIALIZED_ACCEPT implies a HAVE_FOO_SERIALIZED_ACCEPT */ -#if defined(USE_USLOCK_SERIALIZED_ACCEPT) && !defined(HAVE_USLOCK_SERIALIZED_ACCEPT) -#define HAVE_USLOCK_SERIALIZED_ACCEPT -#endif -#if defined(USE_PTHREAD_SERIALIZED_ACCEPT) && !defined(HAVE_PTHREAD_SERIALIZED_ACCEPT) -#define HAVE_PTHREAD_SERIALIZED_ACCEPT -#endif #if defined(USE_SYSVSEM_SERIALIZED_ACCEPT) && !defined(HAVE_SYSVSEM_SERIALIZED_ACCEPT) #define HAVE_SYSVSEM_SERIALIZED_ACCEPT #endif -#if defined(USE_FCNTL_SERIALIZED_ACCEPT) && !defined(HAVE_FCNTL_SERIALIZED_ACCEPT) -#define HAVE_FCNTL_SERIALIZED_ACCEPT -#endif #if defined(USE_FLOCK_SERIALIZED_ACCEPT) && !defined(HAVE_FLOCK_SERIALIZED_ACCEPT) #define HAVE_FLOCK_SERIALIZED_ACCEPT #endif -#if defined(USE_NONE_SERIALIZED_ACCEPT) && !defined(HAVE_NONE_SERIALIZED_ACCEPT) -#define HAVE_NONE_SERIALIZED_ACCEPT -#endif #ifndef LOGNAME_MAX #define LOGNAME_MAX 25 #endif -#ifdef HAVE_UNISTD_H #include <unistd.h> -#endif #ifndef S_ISLNK #define S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK) @@ -385,11 +305,7 @@ Sigfunc *signal(int signo, Sigfunc * func); #define ap_accept(_fd, _sa, _ln) accept(_fd, _sa, _ln) -#ifdef NEED_SIGNAL_INTERRUPT -#define ap_check_signals() tpf_process_signals() -#else #define ap_check_signals() -#endif #define ap_fdopen(d,m) fdopen((d), (m)) @@ -397,47 +313,23 @@ Sigfunc *signal(int signo, Sigfunc * func); #define ap_inet_addr inet_addr #endif -#ifdef NO_OTHER_CHILD -#define NO_RELIABLE_PIPED_LOGS -#endif - -/* When the underlying OS doesn't support exec() of scripts which start - * with a HASHBANG (#!) followed by interpreter name and args, define this. - */ -#ifdef NEED_HASHBANG_EMUL -extern int ap_execle(const char *filename, const char *arg,...); -extern int ap_execve(const char *filename, char * const argv[], - char * const envp[]); -/* ap_execle() is a wrapper function around ap_execve(). */ -#define execle ap_execle -#define execve(path,argv,envp) ap_execve(path,argv,envp) -#endif - /* Finding offsets of elements within structures. * Taken from the X code... they've sweated portability of this stuff * so we don't have to. Sigh... */ -#if defined(CRAY) || (defined(__arm) && !defined(LINUX)) +#if defined(__arm) #ifdef __STDC__ #define XtOffset(p_type,field) _Offsetof(p_type,field) #else -#ifdef CRAY2 -#define XtOffset(p_type,field) \ - (sizeof(int)*((unsigned int)&(((p_type)NULL)->field))) - -#else /* !CRAY2 */ - #define XtOffset(p_type,field) ((unsigned int)&(((p_type)NULL)->field)) - -#endif /* !CRAY2 */ #endif /* __STDC__ */ -#else /* ! (CRAY || __arm) */ +#else /* ! (__arm) */ #define XtOffset(p_type,field) \ ((long) (((char *) (&(((p_type)NULL)->field))) - ((char *) NULL))) -#endif /* !CRAY */ +#endif /* __arm */ #ifdef offsetof #define XtOffsetOf(s_type,field) offsetof(s_type,field) @@ -476,91 +368,10 @@ extern int ap_execve(const char *filename, char * const argv[], #define WCOREDUMP __WCOREDUMP #endif -#ifdef SUNOS_LIB_PROTOTYPES -/* Prototypes needed to get a clean compile with gcc -Wall. - * Believe it or not, these do have to be declared, at least on SunOS, - * because they aren't mentioned in the relevant system headers. - * Sun Quality Software. Gotta love it. This section is not - * currently (13Nov97) used. - */ - -int getopt(int, char **, char *); - -int strcasecmp(const char *, const char *); -int strncasecmp(const char *, const char *, int); -int toupper(int); -int tolower(int); - -int printf(char *,...); -int fprintf(FILE *, char *,...); -int fputs(char *, FILE *); -int fread(char *, int, int, FILE *); -int fwrite(char *, int, int, FILE *); -int fgetc(FILE *); -char *fgets(char *s, int, FILE*); -int fflush(FILE *); -int fclose(FILE *); -int ungetc(int, FILE *); -int _filbuf(FILE *); /* !!! */ -int _flsbuf(unsigned char, FILE *); /* !!! */ -int sscanf(char *, char *,...); -void setbuf(FILE *, char *); -void perror(char *); - -time_t time(time_t *); -int strftime(char *, int, const char *, struct tm *); - -int initgroups(char *, int); -int wait3(int *, int, void *); /* Close enough for us... */ -int lstat(const char *, struct stat *); -int stat(const char *, struct stat *); -int flock(int, int); -#ifndef NO_KILLPG -int killpg(int, int); -#endif -int socket(int, int, int); -int setsockopt(int, int, int, const char *, int); -int listen(int, int); -int bind(int, struct sockaddr *, int); -int connect(int, struct sockaddr *, int); -int accept(int, struct sockaddr *, int *); -int shutdown(int, int); - -int getsockname(int s, struct sockaddr *name, int *namelen); -int getpeername(int s, struct sockaddr *name, int *namelen); -int gethostname(char *name, int namelen); -void syslog(int, char *,...); -char *mktemp(char *); - -int vfprintf(FILE *, const char *, va_list); - -#endif /* SUNOS_LIB_PROTOTYPES */ - /* The assumption is that when the functions are missing, * then there's no matching prototype available either. * Declare what is needed exactly as the replacement routines implement it. */ -#ifdef NEED_STRDUP -extern char *strdup (const char *str); -#endif -#ifdef NEED_STRCASECMP -extern int strcasecmp (const char *a, const char *b); -#endif -#ifdef NEED_STRNCASECMP -extern int strncasecmp (const char *a, const char *b, int n); -#endif -#ifdef NEED_INITGROUPS -extern int initgroups(const char *name, gid_t basegid); -#endif -#ifdef NEED_WAITPID -extern int waitpid(pid_t pid, int *statusp, int options); -#endif -#ifdef NEED_STRERROR -extern char *strerror (int err); -#endif -#ifdef NEED_DIFFTIME -extern double difftime(time_t time1, time_t time0); -#endif #ifndef ap_wait_t #define ap_wait_t int diff --git a/usr.sbin/httpd/src/include/ap_ctx.h b/usr.sbin/httpd/src/include/ap_ctx.h index 4f694c24314..bdfb1b6357d 100644 --- a/usr.sbin/httpd/src/include/ap_ctx.h +++ b/usr.sbin/httpd/src/include/ap_ctx.h @@ -60,8 +60,6 @@ ** Written by Ralf S. Engelschall <rse@engelschall.com> */ -#ifdef EAPI - #ifndef AP_CTX_H #define AP_CTX_H @@ -106,5 +104,3 @@ API_EXPORT(void *) ap_ctx_get(ap_ctx *ctx, char *key); API_EXPORT(ap_ctx *)ap_ctx_overlay(pool *p, ap_ctx *over, ap_ctx *base); #endif /* AP_CTX_H */ - -#endif /* EAPI */ diff --git a/usr.sbin/httpd/src/include/ap_hook.h b/usr.sbin/httpd/src/include/ap_hook.h index 0836cde4bb7..2dd142605ac 100644 --- a/usr.sbin/httpd/src/include/ap_hook.h +++ b/usr.sbin/httpd/src/include/ap_hook.h @@ -72,8 +72,6 @@ ** the pod2man translater. */ -#ifdef EAPI - #ifndef AP_HOOK_H #define AP_HOOK_H @@ -387,7 +385,6 @@ API_EXPORT(int) ap_hook_call (char *hook, ...); #endif /* AP_HOOK_H */ -#endif /* EAPI */ /* =pod ## diff --git a/usr.sbin/httpd/src/include/ap_mm.h b/usr.sbin/httpd/src/include/ap_mm.h index 90159b830f5..ca471935d5e 100644 --- a/usr.sbin/httpd/src/include/ap_mm.h +++ b/usr.sbin/httpd/src/include/ap_mm.h @@ -60,8 +60,6 @@ ** */ -#ifdef EAPI - #ifndef AP_MM_H #define AP_MM_H 1 @@ -125,6 +123,3 @@ API_EXPORT(char *) ap_mm_lib_error_get(void); API_EXPORT(int) ap_mm_lib_version(void); #endif /* AP_MM_H */ - -#endif /* EAPI */ - diff --git a/usr.sbin/httpd/src/include/ap_mmn.h b/usr.sbin/httpd/src/include/ap_mmn.h index ce00a75e21d..46f2e442dab 100644 --- a/usr.sbin/httpd/src/include/ap_mmn.h +++ b/usr.sbin/httpd/src/include/ap_mmn.h @@ -255,13 +255,9 @@ * the module structure. See also the code in mod_so for details on loading * (we accept both "AP13" and "EAPI"). */ -#ifdef EAPI #define MODULE_MAGIC_COOKIE_AP13 0x41503133UL /* "AP13" */ #define MODULE_MAGIC_COOKIE_EAPI 0x45415049UL /* "EAPI" */ #define MODULE_MAGIC_COOKIE MODULE_MAGIC_COOKIE_EAPI -#else -#define MODULE_MAGIC_COOKIE 0x41503133UL /* "AP13" */ -#endif #ifndef MODULE_MAGIC_NUMBER_MAJOR #define MODULE_MAGIC_NUMBER_MAJOR 19990320 diff --git a/usr.sbin/httpd/src/include/buff.h b/usr.sbin/httpd/src/include/buff.h index ce138680661..78319c53a4b 100644 --- a/usr.sbin/httpd/src/include/buff.h +++ b/usr.sbin/httpd/src/include/buff.h @@ -118,9 +118,7 @@ struct buff_struct { /* transport handle, for RPC binding handle or some such */ void *t_handle; -#ifdef EAPI ap_ctx *ctx; -#endif /* EAPI */ #ifdef B_SFIO Sfio_t *sf_in; @@ -175,9 +173,7 @@ API_EXPORT(int) ap_vbprintf(BUFF *fb, const char *fmt, va_list vlist); API_EXPORT(int) ap_bflsbuf(int c, BUFF *fb); API_EXPORT(int) ap_bfilbuf(BUFF *fb); -#ifdef EAPI #define ap_bpeekc(fb) ( ((fb)->incnt == 0) ? EOF : *((fb)->inptr) ) -#endif #define ap_bgetc(fb) ( ((fb)->incnt == 0) ? ap_bfilbuf(fb) : \ ((fb)->incnt--, *((fb)->inptr++)) ) diff --git a/usr.sbin/httpd/src/include/http_conf_globals.h b/usr.sbin/httpd/src/include/http_conf_globals.h index b56364ffc48..56acdfba357 100644 --- a/usr.sbin/httpd/src/include/http_conf_globals.h +++ b/usr.sbin/httpd/src/include/http_conf_globals.h @@ -92,9 +92,7 @@ extern int ap_acceptfilter; #endif extern int ap_dump_settings; extern API_VAR_EXPORT int ap_extended_status; -#ifdef EAPI extern API_VAR_EXPORT ap_ctx *ap_global_ctx; -#endif /* EAPI */ extern API_VAR_EXPORT char *ap_pid_fname; extern API_VAR_EXPORT char *ap_scoreboard_fname; diff --git a/usr.sbin/httpd/src/include/http_config.h b/usr.sbin/httpd/src/include/http_config.h index df90de4a1ce..51dd5079261 100644 --- a/usr.sbin/httpd/src/include/http_config.h +++ b/usr.sbin/httpd/src/include/http_config.h @@ -264,7 +264,6 @@ typedef struct module_struct { void (*child_exit) (server_rec *, pool *); int (*post_read_request) (request_rec *); -#ifdef EAPI /* * ANSI C guarantees us that we can at least _extend_ the module structure * with additional hooks without the need to change all existing modules. @@ -313,7 +312,6 @@ typedef struct module_struct { char *(*rewrite_command) (cmd_parms *, void *config, const char *); void (*new_connection) (conn_rec *); void (*close_connection) (conn_rec *); -#endif /* EAPI */ } module; /* Initializer for the first few module slots, which are only diff --git a/usr.sbin/httpd/src/include/http_log.h b/usr.sbin/httpd/src/include/http_log.h index 478f348fb31..780017b7a3c 100644 --- a/usr.sbin/httpd/src/include/http_log.h +++ b/usr.sbin/httpd/src/include/http_log.h @@ -63,7 +63,6 @@ extern "C" { #endif -#ifdef HAVE_SYSLOG #include <syslog.h> #define APLOG_EMERG LOG_EMERG /* system is unusable */ @@ -77,21 +76,6 @@ extern "C" { #define APLOG_LEVELMASK LOG_PRIMASK /* mask off the level value */ -#else - -#define APLOG_EMERG 0 /* system is unusable */ -#define APLOG_ALERT 1 /* action must be taken immediately */ -#define APLOG_CRIT 2 /* critical conditions */ -#define APLOG_ERR 3 /* error conditions */ -#define APLOG_WARNING 4 /* warning conditions */ -#define APLOG_NOTICE 5 /* normal but significant condition */ -#define APLOG_INFO 6 /* informational */ -#define APLOG_DEBUG 7 /* debug-level messages */ - -#define APLOG_LEVELMASK 7 /* mask off the level value */ - -#endif - #define APLOG_NOERRNO (APLOG_LEVELMASK + 1) #ifndef DEFAULT_LOGLEVEL @@ -132,24 +116,15 @@ API_EXPORT(void) ap_log_reason(const char *reason, const char *fname, typedef struct piped_log { pool *p; -#if !defined(NO_RELIABLE_PIPED_LOGS) || defined(TPF) char *program; int pid; int fds[2]; -#else - FILE *write_f; -#endif } piped_log; API_EXPORT(piped_log *) ap_open_piped_log (pool *p, const char *program); API_EXPORT(void) ap_close_piped_log (piped_log *); -#if !defined(NO_RELIABLE_PIPED_LOGS) || defined(TPF) #define ap_piped_log_read_fd(pl) ((pl)->fds[0]) #define ap_piped_log_write_fd(pl) ((pl)->fds[1]) -#else -#define ap_piped_log_read_fd(pl) (-1) -#define ap_piped_log_write_fd(pl) (fileno((pl)->write_f)) -#endif #ifdef __cplusplus } diff --git a/usr.sbin/httpd/src/include/http_main.h b/usr.sbin/httpd/src/include/http_main.h index b0d3020750e..7db612a6015 100644 --- a/usr.sbin/httpd/src/include/http_main.h +++ b/usr.sbin/httpd/src/include/http_main.h @@ -137,7 +137,6 @@ void setup_signal_names(char *prefix); char *ap_default_mutex_method(void); char *ap_init_mutex_method(char *t); -#ifndef NO_OTHER_CHILD /* * register an other_child -- a child which the main loop keeps track of * and knows it is different than the rest of the scoreboard. @@ -175,8 +174,6 @@ API_EXPORT(void) ap_register_other_child(int pid, */ API_EXPORT(void) ap_unregister_other_child(void *data); -#endif - #ifdef __cplusplus } #endif diff --git a/usr.sbin/httpd/src/include/httpd.h b/usr.sbin/httpd/src/include/httpd.h index 9e9399f5d63..405e59a401e 100644 --- a/usr.sbin/httpd/src/include/httpd.h +++ b/usr.sbin/httpd/src/include/httpd.h @@ -70,19 +70,15 @@ extern "C" { /* Headers in which EVERYONE has an interest... */ #include "ap_config.h" -#ifdef EAPI #include "ap_mm.h" -#endif #include "ap_alloc.h" /* * Include the Extended API headers. * Don't move the position. It has to be after ap_alloc.h because it uses the * pool stuff but before buff.h because the buffer stuff uses the EAPI, too. */ -#ifdef EAPI #include "ap_hook.h" #include "ap_ctx.h" -#endif /* EAPI */ #include "buff.h" #include "ap.h" @@ -136,13 +132,8 @@ 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 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) -#else /* EAPI */ -#define ap_http_method(r) "http" -#define ap_default_port(r) DEFAULT_HTTP_PORT -#endif /* EAPI */ /* --------- Default user name and group name running standalone ---------- */ /* --- These may be specified as numbers by placing a # before a number --- */ @@ -334,14 +325,12 @@ extern "C" { * Unix only: * Path to Shared Memory Files */ -#ifdef EAPI #ifndef EAPI_MM_CORE_PATH #define EAPI_MM_CORE_PATH "logs/mm" #endif #ifndef EAPI_MM_CORE_MAXSIZE #define EAPI_MM_CORE_MAXSIZE 1024*1024*1 /* max. 1MB */ #endif -#endif /* Number of requests to try to handle in a single process. If <= 0, * the children don't die off. That's the default here, since I'm still @@ -435,9 +424,7 @@ enum server_token_type { API_EXPORT(const char *) ap_get_server_version(void); API_EXPORT(void) ap_add_version_component(const char *component); API_EXPORT(const char *) ap_get_server_built(void); -#ifdef EAPI API_EXPORT(void) ap_add_config_define(const char *define); -#endif /* EAPI */ /* Numeric release version identifier: MMNNFFRBB: major minor fix final beta * Always increases along the same track as the source branch. @@ -813,9 +800,7 @@ struct request_rec { * binary compatibility for some other reason. */ -#ifdef EAPI ap_ctx *ctx; -#endif /* EAPI */ }; @@ -864,9 +849,7 @@ struct conn_rec { char *local_host; /* used for ap_get_server_name when * UseCanonicalName is set to DNS * (ignores setting of HostnameLookups) */ -#ifdef EAPI ap_ctx *ctx; -#endif /* EAPI */ }; /* Per-vhost config... */ @@ -940,9 +923,7 @@ struct server_rec { int limit_req_fieldsize; /* limit on size of any request header field */ int limit_req_fields; /* limit on number of request header fields */ -#ifdef EAPI ap_ctx *ctx; -#endif /* EAPI */ }; /* These are more like real hosts than virtual hosts */ @@ -1066,10 +1047,6 @@ API_EXPORT(int) ap_cfg_getc(configfile_t *cfp); /* Detach from open configfile_t, calling the close handler */ API_EXPORT(int) ap_cfg_closefile(configfile_t *cfp); -#ifdef NEED_STRERROR -char *strerror(int err); -#endif - /* Misc system hackery */ API_EXPORT(uid_t) ap_uname2id(const char *name); @@ -1122,13 +1099,9 @@ extern API_VAR_EXPORT time_t ap_restart_time; * never fails. If the high line was requested and it fails it will also try * the low line. */ -#ifdef NO_SLACK -#define ap_slack(fd,line) (fd) -#else int ap_slack(int fd, int line); #define AP_SLACK_LOW 1 #define AP_SLACK_HIGH 2 -#endif API_EXPORT(char *) ap_escape_quotes(pool *p, const char *instr); diff --git a/usr.sbin/httpd/src/include/multithread.h b/usr.sbin/httpd/src/include/multithread.h index bf8249d1df2..2060a9a1a43 100644 --- a/usr.sbin/httpd/src/include/multithread.h +++ b/usr.sbin/httpd/src/include/multithread.h @@ -18,35 +18,6 @@ typedef void event; * Ambarish: Need to do the right stuff on multi-threaded unix * I believe this is terribly ugly */ -#ifdef MULTITHREAD -#define APACHE_TLS __declspec( thread ) - -thread *create_thread(void (thread_fn) (void *thread_arg), void *thread_arg); -int kill_thread(thread *thread_id); -int await_thread(thread *thread_id, int sec_to_wait); -void exit_thread(int status); -void free_thread(thread *thread_id); - -API_EXPORT(mutex *) ap_create_mutex(char *name); -API_EXPORT(mutex *) ap_open_mutex(char *name); -API_EXPORT(int) ap_acquire_mutex(mutex *mutex_id); -API_EXPORT(int) ap_release_mutex(mutex *mutex_id); -API_EXPORT(void) ap_destroy_mutex(mutex *mutex_id); - -semaphore *create_semaphore(int initial); -int acquire_semaphore(semaphore *semaphore_id); -int release_semaphore(semaphore *semaphore_id); -void destroy_semaphore(semaphore *semaphore_id); - -event *create_event(int manual, int initial, char *name); -event *open_event(char *name); -int acquire_event(event *event_id); -int set_event(event *event_id); -int reset_event(event *event_id); -void destroy_event(event *event_id); - -#else /* ndef MULTITHREAD */ - #define APACHE_TLS /* Only define the ones actually used, for now */ extern void *ap_dummy_mutex; @@ -56,8 +27,6 @@ extern void *ap_dummy_mutex; #define ap_release_mutex(mutex_id) ((int)MULTI_OK) #define ap_destroy_mutex(mutex_id) -#endif /* ndef MULTITHREAD */ - #ifdef __cplusplus } #endif diff --git a/usr.sbin/httpd/src/include/scoreboard.h b/usr.sbin/httpd/src/include/scoreboard.h index 67b6adbd2e1..e865f04ab6e 100644 --- a/usr.sbin/httpd/src/include/scoreboard.h +++ b/usr.sbin/httpd/src/include/scoreboard.h @@ -137,16 +137,9 @@ typedef struct { unsigned long my_bytes_served; unsigned long conn_bytes; unsigned short conn_count; -#if defined(NO_GETTIMEOFDAY) - clock_t start_time; - clock_t stop_time; -#else struct timeval start_time; struct timeval stop_time; -#endif -#ifndef NO_TIMES struct tms times; -#endif #ifndef OPTIMIZE_TIMEOUTS time_t last_used; #endif diff --git a/usr.sbin/httpd/src/lib/expat-lite/xmldef.h b/usr.sbin/httpd/src/lib/expat-lite/xmldef.h index 20c31844d8b..0d9e8f777f3 100644 --- a/usr.sbin/httpd/src/lib/expat-lite/xmldef.h +++ b/usr.sbin/httpd/src/lib/expat-lite/xmldef.h @@ -29,25 +29,8 @@ your version of this file under either the MPL or the GPL. */ #include <string.h> - -#ifdef XML_WINLIB - -#define WIN32_LEAN_AND_MEAN -#define STRICT -#include <windows.h> - -#define malloc(x) HeapAlloc(GetProcessHeap(), 0, (x)) -#define calloc(x, y) HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, (x)*(y)) -#define free(x) HeapFree(GetProcessHeap(), 0, (x)) -#define realloc(x, y) HeapReAlloc(GetProcessHeap(), 0, x, y) -#define abort() /* as nothing */ - -#else /* not XML_WINLIB */ - #include <stdlib.h> -#endif /* not XML_WINLIB */ - /* This file can be used for any definitions needed in particular environments. */ diff --git a/usr.sbin/httpd/src/lib/expat-lite/xmlparse.c b/usr.sbin/httpd/src/lib/expat-lite/xmlparse.c index 7b64fc26b5c..5e92a8397a6 100644 --- a/usr.sbin/httpd/src/lib/expat-lite/xmlparse.c +++ b/usr.sbin/httpd/src/lib/expat-lite/xmlparse.c @@ -190,9 +190,6 @@ static Processor prologInitProcessor; static Processor contentProcessor; static Processor cdataSectionProcessor; static Processor epilogProcessor; -#if 0 -static Processor errorProcessor; -#endif static Processor externalEntityInitProcessor; static Processor externalEntityInitProcessor2; static Processor externalEntityInitProcessor3; @@ -1388,21 +1385,6 @@ doContent(XML_Parser parser, enum XML_Error result; if (startCdataSectionHandler) startCdataSectionHandler(handlerArg); -#if 0 - /* Suppose you doing a transformation on a document that involves - changing only the character data. You set up a defaultHandler - and a characterDataHandler. The defaultHandler simply copies - characters through. The characterDataHandler does the transformation - and writes the characters out escaping them as necessary. This case - will fail to work if we leave out the following two lines (because & - and < inside CDATA sections will be incorrectly escaped). - - However, now we have a start/endCdataSectionHandler, so it seems - easier to let the user deal with this. */ - - else if (characterDataHandler) - characterDataHandler(handlerArg, dataBuf, 0); -#endif else if (defaultHandler) reportDefault(parser, enc, s, next); result = doCdataSection(parser, enc, &next, end, nextPtr); @@ -1771,11 +1753,6 @@ enum XML_Error doCdataSection(XML_Parser parser, case XML_TOK_CDATA_SECT_CLOSE: if (endCdataSectionHandler) endCdataSectionHandler(handlerArg); -#if 0 - /* see comment under XML_TOK_CDATA_SECT_OPEN */ - else if (characterDataHandler) - characterDataHandler(handlerArg, dataBuf, 0); -#endif else if (defaultHandler) reportDefault(parser, enc, s, next); *startPtr = next; @@ -2335,17 +2312,6 @@ enum XML_Error epilogProcessor(XML_Parser parser, } } -#if 0 -static -enum XML_Error errorProcessor(XML_Parser parser, - const char *s, - const char *end, - const char **nextPtr) -{ - return errorCode; -} -#endif - static enum XML_Error storeAttributeValue(XML_Parser parser, const ENCODING *enc, int isCdata, const char *ptr, const char *end, @@ -2486,9 +2452,6 @@ enum XML_Error storeEntityValue(XML_Parser parser, const char *entityTextPtr, const char *entityTextEnd) { -#if 0 - const ENCODING *internalEnc = ns ? XmlGetInternalEncodingNS() : XmlGetInternalEncoding(); -#endif STRING_POOL *pool = &(dtd.pool); entityTextPtr += encoding->minBytesPerChar; entityTextEnd -= encoding->minBytesPerChar; diff --git a/usr.sbin/httpd/src/lib/expat-lite/xmlrole.c b/usr.sbin/httpd/src/lib/expat-lite/xmlrole.c index b18e35eb3c4..0be7ddae1c0 100644 --- a/usr.sbin/httpd/src/lib/expat-lite/xmlrole.c +++ b/usr.sbin/httpd/src/lib/expat-lite/xmlrole.c @@ -1070,26 +1070,6 @@ int declClose(PROLOG_STATE *state, return syntaxError(state); } -#if 0 - -static -int ignore(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - switch (tok) { - case XML_TOK_DECL_CLOSE: - state->handler = internalSubset; - return 0; - default: - return XML_ROLE_NONE; - } - return syntaxError(state); -} -#endif - static int error(PROLOG_STATE *state, int tok, diff --git a/usr.sbin/httpd/src/lib/sdbm/sdbm_lock.c b/usr.sbin/httpd/src/lib/sdbm/sdbm_lock.c index ccf8209942d..da4d7033cdd 100644 --- a/usr.sbin/httpd/src/lib/sdbm/sdbm_lock.c +++ b/usr.sbin/httpd/src/lib/sdbm/sdbm_lock.c @@ -13,52 +13,18 @@ * Small monkey business to ensure that fcntl is preferred, * unless we specified USE_FLOCK_SERIALIZED_ACCEPT during compile. */ -#if defined(HAVE_FCNTL_SERIALIZED_ACCEPT) && !defined(USE_FLOCK_SERIALIZED_ACCEPT) -#define USE_FCNTL 1 -#include <fcntl.h> -#elif defined(HAVE_FLOCK_SERIALIZED_ACCEPT) #define USE_FLOCK 1 #include <sys/file.h> -#endif -#if !defined(USE_FCNTL) && !defined(USE_FLOCK) -#define USE_FLOCK 1 -#include <sys/file.h> -#ifndef LOCK_UN -#undef USE_FLOCK -#define USE_FCNTL 1 -#include <fcntl.h> -#endif -#endif - -#ifdef USE_FCNTL -/* ugly interface requires this structure to be "live" for a while */ -static struct flock lock_it; -static struct flock unlock_it; -#endif /* NOTE: this function blocks until it acquires the lock */ int sdbm_fd_lock(int fd, int readonly) { int rc; -#ifdef USE_FCNTL - lock_it.l_whence = SEEK_SET; /* from current point */ - lock_it.l_start = 0; /* -"- */ - lock_it.l_len = 0; /* until end of file */ - lock_it.l_type = readonly ? F_RDLCK : F_WRLCK; /* set lock type */ - lock_it.l_pid = 0; /* pid not actually interesting */ - - while ( ((rc = fcntl(fd, F_SETLKW, &lock_it)) < 0) - && (errno == EINTR) ) { - continue; - } -#endif -#ifdef USE_FLOCK while ( ((rc = flock(fd, readonly ? LOCK_SH : LOCK_EX)) < 0) && (errno == EINTR) ) { continue; } -#endif #ifdef USE_LOCKING /* ### this doesn't allow simultaneous reads! */ /* ### this doesn't block forever */ @@ -80,18 +46,7 @@ int sdbm_fd_unlock(int fd) { int rc; -#ifdef USE_FCNTL - unlock_it.l_whence = SEEK_SET; /* from current point */ - unlock_it.l_start = 0; /* -"- */ - unlock_it.l_len = 0; /* until end of file */ - unlock_it.l_type = F_UNLCK; /* unlock */ - unlock_it.l_pid = 0; /* pid not actually interesting */ - - rc = fcntl(fd, F_SETLKW, &unlock_it); -#endif -#ifdef USE_FLOCK rc = flock(fd, LOCK_UN); -#endif #ifdef USE_LOCKING lseek(fd, 0, SEEK_SET); rc = _locking(fd, _LK_UNLCK, 1); diff --git a/usr.sbin/httpd/src/main/buff.c b/usr.sbin/httpd/src/main/buff.c index 741dd07d44a..ec33172b0b6 100644 --- a/usr.sbin/httpd/src/main/buff.c +++ b/usr.sbin/httpd/src/main/buff.c @@ -65,14 +65,8 @@ #include <stdio.h> #include <stdarg.h> #include <string.h> -#ifndef NO_WRITEV #include <sys/types.h> #include <sys/uio.h> -#endif - -#ifdef HAVE_BSTRING_H -#include <bstring.h> /* for IRIX, FD_SET calls bzero() */ -#endif #ifndef DEFAULT_BUFSIZE #define DEFAULT_BUFSIZE (4096) @@ -128,9 +122,7 @@ static int ap_read(BUFF *fb, void *buf, int nbyte) { int rv; -#ifdef EAPI if (!ap_hook_call("ap::buff::read", &rv, fb, buf, nbyte)) -#endif /* EAPI */ rv = read(fb->fd_in, buf, nbyte); return rv; @@ -149,9 +141,7 @@ static int ap_write(BUFF *fb, const void *buf, int nbyte) { int rv; -#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 @@ -232,9 +222,7 @@ API_EXPORT(BUFF *) ap_bcreate(pool *p, int flags) fb->callback_data = NULL; fb->filter_callback = NULL; -#ifdef EAPI fb->ctx = ap_ctx_new(p); -#endif /* EAPI */ return fb; } @@ -812,7 +800,6 @@ static int write_it_all(BUFF *fb, const void *buf, int nbyte) } -#ifndef NO_WRITEV /* Similar to previous, but uses writev. Note that it modifies vec. * return 0 if successful, -1 otherwise. * @@ -834,9 +821,7 @@ static int writev_it_all(BUFF *fb, struct iovec *vec, int nvec) i = 0; while (i < nvec) { do -#ifdef EAPI if (!ap_hook_call("ap::buff::writev", &rv, fb, &vec[i], nvec -i)) -#endif /* EAPI */ rv = writev(fb->fd, &vec[i], nvec - i); while (rv == -1 && (errno == EINTR || errno == EAGAIN) && !(fb->flags & B_EOUT)); @@ -865,7 +850,6 @@ static int writev_it_all(BUFF *fb, struct iovec *vec, int nvec) /* if we got here, we wrote it all */ return 0; } -#endif /* A wrapper for buff_write which deals with error conditions and * bytes_sent. Also handles non-blocking writes. @@ -904,9 +888,7 @@ static int write_with_errors(BUFF *fb, const void *buf, int nbyte) static int bcwrite(BUFF *fb, const void *buf, int nbyte) { char chunksize[16]; /* Big enough for practically anything */ -#ifndef NO_WRITEV struct iovec vec[3]; -#endif if (fb->flags & (B_WRERR | B_EOUT)) return -1; @@ -915,18 +897,6 @@ static int bcwrite(BUFF *fb, const void *buf, int nbyte) return write_with_errors(fb, buf, nbyte); } -#ifdef NO_WRITEV - /* without writev() this has poor performance, too bad */ - - ap_snprintf(chunksize, sizeof(chunksize), "%x" CRLF, nbyte); - if (write_it_all(fb, chunksize, strlen(chunksize)) == -1) - return -1; - if (write_it_all(fb, buf, nbyte) == -1) - return -1; - if (write_it_all(fb, ascii_CRLF, 2) == -1) - return -1; - return nbyte; -#else vec[0].iov_base = chunksize; vec[0].iov_len = ap_snprintf(chunksize, sizeof(chunksize), "%x" CRLF, nbyte); @@ -936,11 +906,9 @@ static int bcwrite(BUFF *fb, const void *buf, int nbyte) vec[2].iov_len = 2; return writev_it_all(fb, vec, (sizeof(vec) / sizeof(vec[0]))) ? -1 : nbyte; -#endif } -#ifndef NO_WRITEV /* * Used to combine the contents of the fb buffer, and a large buffer * passed in. @@ -988,7 +956,6 @@ static int large_write(BUFF *fb, const void *buf, int nbyte) } return nbyte; } -#endif /* @@ -1013,7 +980,6 @@ API_EXPORT(int) ap_bwrite(BUFF *fb, const void *buf, int nbyte) return bcwrite(fb, buf, nbyte); } -#ifndef NO_WRITEV /* * Detect case where we're asked to write a large buffer, and combine our * current buffer with it in a single writev(). Note we don't consider @@ -1025,7 +991,6 @@ API_EXPORT(int) ap_bwrite(BUFF *fb, const void *buf, int nbyte) && nbyte + fb->outcnt >= fb->bufsiz) { return large_write(fb, buf, nbyte); } -#endif /* * Whilst there is data in the buffer, keep on adding to it and writing it diff --git a/usr.sbin/httpd/src/modules/ssl/mod_ssl.h b/usr.sbin/httpd/src/modules/ssl/mod_ssl.h index ae2d9e4fed5..5ad632230dc 100644 --- a/usr.sbin/httpd/src/modules/ssl/mod_ssl.h +++ b/usr.sbin/httpd/src/modules/ssl/mod_ssl.h @@ -67,13 +67,6 @@ #define MOD_SSL_H 1 /* - * Check whether Extended API (EAPI) is enabled - */ -#ifndef EAPI -#error "mod_ssl requires Extended API (EAPI)" -#endif - -/* * Optionally enable the experimental stuff, but allow the user to * override the decision which experimental parts are included by using * CFLAGS="-DSSL_EXPERIMENTAL_xxxx_IGNORE". @@ -244,10 +237,6 @@ * Support for file locking: Try to determine whether we should use fcntl() or * flock(). Would be better ap_config.h could provide this... :-( */ -#if defined(USE_FCNTL_SERIALIZED_ACCEPT) -#define SSL_USE_FCNTL 1 -#include <fcntl.h> -#endif #if defined(USE_FLOCK_SERIALIZED_ACCEPT) #define SSL_USE_FLOCK 1 #include <sys/file.h> @@ -266,14 +255,6 @@ * Support for Mutex */ #define SSL_MUTEX_LOCK_MODE ( S_IRUSR|S_IWUSR ) -#if defined(USE_SYSVSEM_SERIALIZED_ACCEPT) ||\ - defined(__OpenBSD__) ||\ - (defined(__FreeBSD__) && defined(__FreeBSD_version) &&\ - __FreeBSD_version >= 300000) ||\ - (defined(LINUX) && defined(__GLIBC__) && defined(__GLIBC_MINOR__) &&\ - LINUX >= 2 && __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1) ||\ - defined(SOLARIS2) || defined(__hpux) ||\ - (defined (__digital__) && defined (__unix__)) #define SSL_CAN_USE_SEM #define SSL_HAVE_IPCSEM #include <sys/types.h> @@ -291,7 +272,6 @@ union ssl_ipc_semun { struct semid_ds *buf; unsigned short int *array; }; -#endif /* * Support for MM library @@ -340,8 +320,8 @@ union ssl_ipc_semun { /* * Check for OpenSSL version */ -#if SSL_LIBRARY_VERSION < 0x00903100 -#error "mod_ssl requires OpenSSL 0.9.3 or higher" +#if SSL_LIBRARY_VERSION < 0x00907000 +#error "mod_ssl requires OpenSSL 0.9.7 or higher" #endif /* @@ -482,9 +462,7 @@ typedef enum { SSL_RSSRC_BUILTIN = 1, SSL_RSSRC_FILE = 2, SSL_RSSRC_EXEC = 3 -#if SSL_LIBRARY_VERSION >= 0x00905100 ,SSL_RSSRC_EGD = 4 -#endif } ssl_rssrc_t; typedef struct { ssl_rsctx_t nCtx; @@ -689,11 +667,7 @@ int ssl_callback_SSLVerify_CRL(int, X509_STORE_CTX *, server_rec *); int ssl_callback_NewSessionCacheEntry(SSL *, SSL_SESSION *); SSL_SESSION *ssl_callback_GetSessionCacheEntry(SSL *, unsigned char *, int, int *); void ssl_callback_DelSessionCacheEntry(SSL_CTX *, SSL_SESSION *); -#if SSL_LIBRARY_VERSION >= 0x00907000 void ssl_callback_LogTracingState(const SSL *, int, int); -#else -void ssl_callback_LogTracingState(SSL *, int, int); -#endif /* Session Cache Support */ void ssl_scache_init(server_rec *, pool *); 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 6bee39d538d..8c3101c1607 100644 --- a/usr.sbin/httpd/src/modules/ssl/ssl_engine_config.c +++ b/usr.sbin/httpd/src/modules/ssl/ssl_engine_config.c @@ -404,11 +404,7 @@ const char *ssl_cmd_SSLMutex( (unsigned long)getpid()); } else if (strcEQ(arg, "sem")) { -#ifdef SSL_CAN_USE_SEM mc->nMutexMode = SSL_MUTEXMODE_SEM; -#else - return "SSLMutex: Semaphores not available on this platform"; -#endif } else return "SSLMutex: Invalid argument"; @@ -446,7 +442,6 @@ const char *ssl_cmd_SSLCryptoDevice( SSLModConfigRec *mc = myModConfig(); const char *err; ENGINE *e; -#if SSL_LIBRARY_VERSION >= 0x00907000 static int loaded_engines = FALSE; /* early loading to make sure the engines are already @@ -455,7 +450,6 @@ const char *ssl_cmd_SSLCryptoDevice( ENGINE_load_builtin_engines(); loaded_engines = TRUE; } -#endif if ((err = ap_check_cmd_context(cmd, GLOBAL_ONLY)) != NULL) return err; if (strcEQ(arg, "builtin")) { @@ -498,12 +492,10 @@ const char *ssl_cmd_SSLRandomSeed( pRS->nSrc = SSL_RSSRC_EXEC; pRS->cpPath = ap_pstrdup(mc->pPool, ssl_util_server_root_relative(cmd->pool, "random", arg2+5)); } -#if SSL_LIBRARY_VERSION >= 0x00905100 else if (strlen(arg2) > 4 && strEQn(arg2, "egd:", 4)) { pRS->nSrc = SSL_RSSRC_EGD; pRS->cpPath = ap_pstrdup(mc->pPool, ssl_util_server_root_relative(cmd->pool, "random", arg2+4)); } -#endif else if (strcEQ(arg2, "builtin")) { pRS->nSrc = SSL_RSSRC_BUILTIN; pRS->cpPath = NULL; diff --git a/usr.sbin/httpd/src/modules/ssl/ssl_engine_dh.c b/usr.sbin/httpd/src/modules/ssl/ssl_engine_dh.c index f774b2880ca..c4f7e8f3413 100644 --- a/usr.sbin/httpd/src/modules/ssl/ssl_engine_dh.c +++ b/usr.sbin/httpd/src/modules/ssl/ssl_engine_dh.c @@ -168,11 +168,7 @@ DH *ssl_dh_GetParamFromFile(char *file) if ((bio = BIO_new_file(file, "r")) == NULL) return NULL; -#if SSL_LIBRARY_VERSION < 0x00904000 - dh = PEM_read_bio_DHparams(bio, NULL, NULL); -#else dh = PEM_read_bio_DHparams(bio, NULL, NULL, NULL); -#endif BIO_free(bio); return (dh); } 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 5fa861399ec..863b7c4a01a 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.25 2004/12/02 19:42:47 henning Exp $ */ +/* $OpenBSD: ssl_engine_init.c,v 1.26 2004/12/06 13:14:10 henning Exp $ */ /* _ _ ** _ __ ___ ___ __| | ___ ___| | mod_ssl @@ -125,9 +125,7 @@ void ssl_init_Module(server_rec *s, pool *p) SSLSrvConfigRec *sc; server_rec *s2; char *cp; -#ifdef __OpenBSD__ int SSLenabled = 0; -#endif mc->nInitCount++; @@ -250,13 +248,9 @@ void ssl_init_Module(server_rec *s, pool *p) #endif if (mc->nInitCount == 1) { ssl_pphrase_Handle(s, p); -#ifndef __OpenBSD__ - ssl_init_TmpKeysHandle(SSL_TKP_GEN, s, p); -#endif return; } -#ifdef __OpenBSD__ for (s2 = s; s2 != NULL; s2 = s2->next) { sc = mySrvConfig(s2); /* find out if anyone's actually doing SSL */ @@ -265,7 +259,6 @@ void ssl_init_Module(server_rec *s, pool *p) } if (SSLenabled) /* skip expensive bits if we're not doing SSL */ ssl_init_TmpKeysHandle(SSL_TKP_GEN, s, p); -#endif /* * SSL external crypto device ("engine") support @@ -298,10 +291,8 @@ void ssl_init_Module(server_rec *s, pool *p) /* * allocate the temporary RSA keys and DH params */ -#ifdef __OpenBSD__ if (SSLenabled) /* skip expensive bits if we're not doing SSL */ -#endif - ssl_init_TmpKeysHandle(SSL_TKP_ALLOC, s, p); + ssl_init_TmpKeysHandle(SSL_TKP_ALLOC, s, p); /* * initialize servers @@ -460,11 +451,7 @@ void ssl_init_TmpKeysHandle(int action, server_rec *s, pool *p) if ((asn1 = (ssl_asn1_t *)ssl_ds_table_get(mc->tTmpKeys, "RSA:512")) != NULL) { ucp = asn1->cpData; if ((mc->pTmpKeys[SSL_TKPIDX_RSA512] = -#if SSL_LIBRARY_VERSION >= 0x00907000 (void *)d2i_RSAPrivateKey(NULL, (const unsigned char **)&ucp, asn1->nData)) == NULL) { -#else - (void *)d2i_RSAPrivateKey(NULL, &ucp, asn1->nData)) == NULL) { -#endif ssl_log(s, SSL_LOG_ERROR, "Init: Failed to load temporary 512 bit RSA private key"); ssl_die(); } @@ -478,11 +465,7 @@ void ssl_init_TmpKeysHandle(int action, server_rec *s, pool *p) if ((asn1 = (ssl_asn1_t *)ssl_ds_table_get(mc->tTmpKeys, "RSA:1024")) != NULL) { ucp = asn1->cpData; if ((mc->pTmpKeys[SSL_TKPIDX_RSA1024] = -#if SSL_LIBRARY_VERSION >= 0x00907000 (void *)d2i_RSAPrivateKey(NULL, (const unsigned char **)&ucp, asn1->nData)) == NULL) { -#else - (void *)d2i_RSAPrivateKey(NULL, &ucp, asn1->nData)) == NULL) { -#endif ssl_log(s, SSL_LOG_ERROR, "Init: Failed to load temporary 1024 bit RSA private key"); ssl_die(); } @@ -498,11 +481,7 @@ void ssl_init_TmpKeysHandle(int action, server_rec *s, pool *p) if ((asn1 = (ssl_asn1_t *)ssl_ds_table_get(mc->tTmpKeys, "DH:512")) != NULL) { ucp = asn1->cpData; if ((mc->pTmpKeys[SSL_TKPIDX_DH512] = -#if SSL_LIBRARY_VERSION >= 0x00907000 (void *)d2i_DHparams(NULL, (const unsigned char **)&ucp, asn1->nData)) == NULL) { -#else - (void *)d2i_DHparams(NULL, &ucp, asn1->nData)) == NULL) { -#endif ssl_log(s, SSL_LOG_ERROR, "Init: Failed to load temporary 512 bit DH parameters"); ssl_die(); } @@ -512,11 +491,7 @@ void ssl_init_TmpKeysHandle(int action, server_rec *s, pool *p) if ((asn1 = (ssl_asn1_t *)ssl_ds_table_get(mc->tTmpKeys, "DH:1024")) != NULL) { ucp = asn1->cpData; if ((mc->pTmpKeys[SSL_TKPIDX_DH1024] = -#if SSL_LIBRARY_VERSION >= 0x00907000 (void *)d2i_DHparams(NULL, (const unsigned char **)&ucp, asn1->nData)) == NULL) { -#else - (void *)d2i_DHparams(NULL, &ucp, asn1->nData)) == NULL) { -#endif ssl_log(s, SSL_LOG_ERROR, "Init: Failed to load temporary 1024 bit DH parameters"); ssl_die(); } 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 6ac2baca0d3..958bdaf3d05 100644 --- a/usr.sbin/httpd/src/modules/ssl/ssl_engine_io.c +++ b/usr.sbin/httpd/src/modules/ssl/ssl_engine_io.c @@ -295,24 +295,18 @@ static int ssl_io_suck_read(SSL *ssl, char *buf, int len) ** _________________________________________________________________ */ -#ifndef NO_WRITEV #include <sys/types.h> #include <sys/uio.h> -#endif static int ssl_io_hook_read(BUFF *fb, char *buf, int len); 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 void ssl_io_register(void) { ap_hook_register("ap::buff::read", ssl_io_hook_read, AP_HOOK_NOCTX); ap_hook_register("ap::buff::write", ssl_io_hook_write, AP_HOOK_NOCTX); -#ifndef NO_WRITEV ap_hook_register("ap::buff::writev", ssl_io_hook_writev, AP_HOOK_NOCTX); -#endif return; } @@ -320,9 +314,7 @@ void ssl_io_unregister(void) { ap_hook_unregister("ap::buff::read", ssl_io_hook_read); ap_hook_unregister("ap::buff::write", ssl_io_hook_write); -#ifndef NO_WRITEV ap_hook_unregister("ap::buff::writev", ssl_io_hook_writev); -#endif return; } @@ -392,7 +384,6 @@ static int ssl_io_hook_write(BUFF *fb, char *buf, int len) return rc; } -#ifndef NO_WRITEV /* the prototype for our own SSL_writev() */ static int SSL_writev(SSL *, const struct iovec *, int); @@ -427,7 +418,6 @@ static int ssl_io_hook_writev(BUFF *fb, const struct iovec *iov, int iovcnt) rc = writev(fb->fd, iov, iovcnt); return rc; } -#endif /* _________________________________________________________________ @@ -444,7 +434,6 @@ static int ssl_io_hook_writev(BUFF *fb, const struct iovec *iov, int iovcnt) * to at least being able to use the write() like interface. But keep in mind * that the network I/O performance is not write() like, of course. */ -#ifndef NO_WRITEV static int SSL_writev(SSL *ssl, const struct iovec *iov, int iovcnt) { int i; @@ -461,7 +450,6 @@ static int SSL_writev(SSL *ssl, const struct iovec *iov, int iovcnt) } return rc; } -#endif /* _________________________________________________________________ ** 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 01b0a9ea51a..a8fdff3cf3d 100644 --- a/usr.sbin/httpd/src/modules/ssl/ssl_engine_kernel.c +++ b/usr.sbin/httpd/src/modules/ssl/ssl_engine_kernel.c @@ -1540,9 +1540,7 @@ int ssl_callback_SSLVerify(int ok, X509_STORE_CTX *ctx) if ( ( errnum == X509_V_ERR_DEPTH_ZERO_SELF_SIGNED_CERT || errnum == X509_V_ERR_SELF_SIGNED_CERT_IN_CHAIN || errnum == X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT_LOCALLY -#if SSL_LIBRARY_VERSION >= 0x00905000 || errnum == X509_V_ERR_CERT_UNTRUSTED -#endif || errnum == X509_V_ERR_UNABLE_TO_VERIFY_LEAF_SIGNATURE ) && verify == SSL_CVERIFY_OPTIONAL_NO_CA ) { ssl_log(s, SSL_LOG_TRACE, @@ -1735,17 +1733,9 @@ int ssl_callback_SSLVerify_CRL( /* * Check if the current certificate is revoked by this CRL */ -#if SSL_LIBRARY_VERSION < 0x00904000 - n = sk_num(X509_CRL_get_REVOKED(crl)); -#else n = sk_X509_REVOKED_num(X509_CRL_get_REVOKED(crl)); -#endif for (i = 0; i < n; i++) { -#if SSL_LIBRARY_VERSION < 0x00904000 - revoked = (X509_REVOKED *)sk_value(X509_CRL_get_REVOKED(crl), i); -#else revoked = sk_X509_REVOKED_value(X509_CRL_get_REVOKED(crl), i); -#endif if (ASN1_INTEGER_cmp(revoked->serialNumber, X509_get_serialNumber(xs)) == 0) { serial = ASN1_INTEGER_get(revoked->serialNumber); @@ -1903,11 +1893,7 @@ void ssl_callback_DelSessionCacheEntry( * SSL handshake and does SSL record layer stuff. We use it to * trace OpenSSL's processing in out SSL logfile. */ -#if SSL_LIBRARY_VERSION >= 0x00907000 void ssl_callback_LogTracingState(const SSL *ssl, int where, int rc) -#else -void ssl_callback_LogTracingState(SSL *ssl, int where, int rc) -#endif { conn_rec *c; server_rec *s; 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 2fd2cdc0e9c..229360d8f20 100644 --- a/usr.sbin/httpd/src/modules/ssl/ssl_engine_mutex.c +++ b/usr.sbin/httpd/src/modules/ssl/ssl_engine_mutex.c @@ -272,15 +272,11 @@ BOOL ssl_mutex_file_release(void) void ssl_mutex_sem_create(server_rec *s, pool *p) { -#ifdef SSL_CAN_USE_SEM int semid; SSLModConfigRec *mc = myModConfig(); -#ifdef SSL_HAVE_IPCSEM union ssl_ipc_semun semctlarg; struct semid_ds semctlbuf; -#endif -#ifdef SSL_HAVE_IPCSEM semid = semget(IPC_PRIVATE, 1, IPC_CREAT|IPC_EXCL|S_IRUSR|S_IWUSR); if (semid == -1 && errno == EEXIST) semid = semget(IPC_PRIVATE, 1, IPC_EXCL|S_IRUSR|S_IWUSR); @@ -304,49 +300,28 @@ void ssl_mutex_sem_create(server_rec *s, pool *p) "Parent process could not set permissions for SSLMutex semaphore"); ssl_die(); } -#endif -#ifdef SSL_HAVE_W32SEM - semid = (int)ap_create_mutex("mod_ssl_mutex"); -#endif mc->nMutexSEMID = semid; -#endif return; } void ssl_mutex_sem_open(server_rec *s, pool *p) { -#ifdef SSL_CAN_USE_SEM -#ifdef SSL_HAVE_W32SEM - SSLModConfigRec *mc = myModConfig(); - - mc->nMutexSEMID = (int)ap_open_mutex("mod_ssl_mutex"); -#endif -#endif return; } void ssl_mutex_sem_remove(void *data) { -#ifdef SSL_CAN_USE_SEM SSLModConfigRec *mc = myModConfig(); -#ifdef SSL_HAVE_IPCSEM semctl(mc->nMutexSEMID, 0, IPC_RMID, 0); -#endif -#ifdef SSL_HAVE_W32SEM - ap_destroy_mutex((mutex *)mc->nMutexSEMID); -#endif -#endif return; } BOOL ssl_mutex_sem_acquire(void) { int rc = 0; -#ifdef SSL_CAN_USE_SEM SSLModConfigRec *mc = myModConfig(); -#ifdef SSL_HAVE_IPCSEM struct sembuf sb[] = { { 0, 0, 0 }, /* wait for semaphore */ { 0, 1, SEM_UNDO } /* increment semaphore */ @@ -355,11 +330,6 @@ BOOL ssl_mutex_sem_acquire(void) while ( (rc = semop(mc->nMutexSEMID, sb, 2)) < 0 && (errno == EINTR) ) ; -#endif -#ifdef SSL_HAVE_W32SEM - rc = ap_acquire_mutex((mutex *)mc->nMutexSEMID); -#endif -#endif if (rc != 0) return FALSE; else @@ -369,10 +339,8 @@ BOOL ssl_mutex_sem_acquire(void) BOOL ssl_mutex_sem_release(void) { int rc = 0; -#ifdef SSL_CAN_USE_SEM SSLModConfigRec *mc = myModConfig(); -#ifdef SSL_HAVE_IPCSEM struct sembuf sb[] = { { 0, -1, SEM_UNDO } /* decrements semaphore */ }; @@ -380,11 +348,6 @@ BOOL ssl_mutex_sem_release(void) while ( (rc = semop(mc->nMutexSEMID, sb, 1)) < 0 && (errno == EINTR) ) ; -#endif -#ifdef SSL_HAVE_W32SEM - rc = ap_release_mutex((mutex *)mc->nMutexSEMID); -#endif -#endif if (rc != 0) return FALSE; else 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 9339605ff5a..32a849a09fb 100644 --- a/usr.sbin/httpd/src/modules/ssl/ssl_engine_rand.c +++ b/usr.sbin/httpd/src/modules/ssl/ssl_engine_rand.c @@ -116,21 +116,15 @@ int ssl_rand_seed(server_rec *s, pool *p, ssl_rsctx_t nCtx, char *prefix) nDone += ssl_rand_feedfp(p, fp, pRandSeed->nBytes); ssl_util_ppclose(s, p, fp); } -#if SSL_LIBRARY_VERSION >= 0x00905100 else if (pRandSeed->nSrc == SSL_RSSRC_EGD) { /* * seed in contents provided by the external * Entropy Gathering Daemon (EGD) */ -#if SSL_LIBRARY_VERSION >= 0x00906000 if ((n = RAND_egd_bytes(pRandSeed->cpPath, pRandSeed->nBytes)) == -1) -#else - if ((n = RAND_egd(pRandSeed->cpPath)) == -1) -#endif continue; nDone += n; } -#endif else if (pRandSeed->nSrc == SSL_RSSRC_BUILTIN) { /* * seed in the current time (usually just 4 bytes) @@ -170,10 +164,8 @@ int ssl_rand_seed(server_rec *s, pool *p, ssl_rsctx_t nCtx, char *prefix) } ssl_log(s, SSL_LOG_INFO, "%sSeeding PRNG with %d bytes of entropy", prefix, nDone); -#if SSL_LIBRARY_VERSION >= 0x00905100 if (RAND_status() == 0) ssl_log(s, SSL_LOG_WARN, "%sPRNG still contains insufficient entropy!", prefix); -#endif return nDone; } 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 c93cd7b38e0..10965df9e71 100644 --- a/usr.sbin/httpd/src/modules/ssl/ssl_engine_vars.c +++ b/usr.sbin/httpd/src/modules/ssl/ssl_engine_vars.c @@ -413,11 +413,7 @@ static const struct { { "G", NID_givenName }, { "S", NID_surname }, { "D", NID_description }, -#if SSL_LIBRARY_VERSION >= 0x00907000 { "UID", NID_x500UniqueIdentifier }, -#else - { "UID", NID_uniqueIdentifier }, -#endif { "Email", NID_pkcs9_emailAddress }, { NULL, 0 } }; diff --git a/usr.sbin/httpd/src/modules/ssl/ssl_scache_shmcb.c b/usr.sbin/httpd/src/modules/ssl/ssl_scache_shmcb.c index fa9cbf5176e..d5b8050451a 100644 --- a/usr.sbin/httpd/src/modules/ssl/ssl_scache_shmcb.c +++ b/usr.sbin/httpd/src/modules/ssl/ssl_scache_shmcb.c @@ -178,24 +178,6 @@ * so as to decrease "struct-bloat". sigh. */ typedef struct { -#if 0 - unsigned char division_mask; - unsigned int division_offset; - unsigned int division_size; - unsigned int queue_size; - unsigned int index_num; - unsigned int index_offset; - unsigned int index_size; - unsigned int cache_data_offset; - unsigned int cache_data_size; - unsigned long num_stores; - unsigned long num_expiries; - unsigned long num_scrolled; - unsigned long num_retrieves_hit; - unsigned long num_retrieves_miss; - unsigned long num_removes_hit; - unsigned long num_removes_miss; -#else unsigned long num_stores; unsigned long num_expiries; unsigned long num_scrolled; @@ -212,7 +194,6 @@ typedef struct { unsigned int index_num; unsigned int index_offset; unsigned int index_size; -#endif } SHMCBHeader; /* @@ -269,16 +250,6 @@ static void shmcb_set_safe_uint_ex(unsigned char *, const unsigned char *); shmcb_set_safe_uint_ex((unsigned char *)pdest, \ (const unsigned char *)(&tmp_uint)); \ } while(0) -#if 0 /* Unused so far */ -static unsigned long shmcb_get_safe_ulong(unsigned long *); -static void shmcb_set_safe_ulong_ex(unsigned char *, const unsigned char *); -#define shmcb_set_safe_ulong(pdest, src) \ - do { \ - unsigned long tmp_ulong = src; \ - shmcb_set_safe_ulong_ex((unsigned char *)pdest, \ - (const unsigned char *)(&tmp_ulong)); \ - } while(0) -#endif static time_t shmcb_get_safe_time(time_t *); static void shmcb_set_safe_time_ex(unsigned char *, const unsigned char *); #define shmcb_set_safe_time(pdest, src) \ @@ -343,22 +314,6 @@ static void shmcb_set_safe_uint_ex(unsigned char *dest, memcpy(dest, src, sizeof(unsigned int)); } -#if 0 /* Unused so far */ -static unsigned long shmcb_get_safe_ulong(unsigned long *ptr) -{ - unsigned long ret; - shmcb_set_safe_ulong_ex((unsigned char *)(&ret), - (const unsigned char *)ptr); - return ret; -} - -static void shmcb_set_safe_ulong_ex(unsigned char *dest, - const unsigned char *src) -{ - memcpy(dest, src, sizeof(unsigned long)); -} -#endif - static time_t shmcb_get_safe_time(time_t * ptr) { time_t ret; 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 b7f4f80677e..16ba9bc13a4 100644 --- a/usr.sbin/httpd/src/modules/ssl/ssl_util_sdbm.c +++ b/usr.sbin/httpd/src/modules/ssl/ssl_util_sdbm.c @@ -528,13 +528,8 @@ register long dbit; db->dirbuf[c % DBLKSIZ] |= (1 << dbit % BYTESIZ); -#if 0 - if (dbit >= db->maxbno) - db->maxbno += DBLKSIZ * BYTESIZ; -#else if (OFF_DIR((dirb+1))*BYTESIZ > db->maxbno) db->maxbno = OFF_DIR((dirb+1)) * BYTESIZ; -#endif if (lseek(db->dirf, OFF_DIR(dirb), SEEK_SET) < 0 || write(db->dirf, db->dirbuf, DBLKSIZ) < 0) 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 9cf8a063220..2df27122ab7 100644 --- a/usr.sbin/httpd/src/modules/ssl/ssl_util_ssl.c +++ b/usr.sbin/httpd/src/modules/ssl/ssl_util_ssl.c @@ -105,11 +105,7 @@ X509 *SSL_read_X509(FILE *fp, X509 **x509, int (*cb)()) BIO *bioF; /* 1. try PEM (= DER+Base64+headers) */ -#if SSL_LIBRARY_VERSION < 0x00904000 - rc = PEM_read_X509(fp, x509, cb); -#else rc = PEM_read_X509(fp, x509, cb, NULL); -#endif if (rc == NULL) { /* 2. try DER+Base64 */ fseek(fp, 0L, SEEK_SET); @@ -141,16 +137,6 @@ X509 *SSL_read_X509(FILE *fp, X509 **x509, int (*cb)()) return rc; } -#if SSL_LIBRARY_VERSION <= 0x00904100 -static EVP_PKEY *d2i_PrivateKey_bio(BIO *bio, EVP_PKEY **key) -{ - return ((EVP_PKEY *)ASN1_d2i_bio( - (char *(*)())EVP_PKEY_new, - (char *(*)())d2i_PrivateKey, - (bio), (unsigned char **)(key))); -} -#endif - EVP_PKEY *SSL_read_PrivateKey(FILE *fp, EVP_PKEY **key, int (*cb)()) { EVP_PKEY *rc; @@ -158,11 +144,7 @@ EVP_PKEY *SSL_read_PrivateKey(FILE *fp, EVP_PKEY **key, int (*cb)()) BIO *bioF; /* 1. try PEM (= DER+Base64+headers) */ -#if SSL_LIBRARY_VERSION < 0x00904000 - rc = PEM_read_PrivateKey(fp, key, cb); -#else rc = PEM_read_PrivateKey(fp, key, cb, NULL); -#endif if (rc == NULL) { /* 2. try DER+Base64 */ fseek(fp, 0L, SEEK_SET); @@ -409,11 +391,7 @@ BOOL SSL_load_CrtAndKeyInfo_file(pool *p, STACK_OF(X509_INFO) *sk, char *filenam return FALSE; } ERR_clear_error(); -#if SSL_LIBRARY_VERSION < 0x00904000 - PEM_X509_INFO_read_bio(in, sk, NULL); -#else PEM_X509_INFO_read_bio(in, sk, NULL, NULL); -#endif BIO_free(in); return TRUE; } @@ -476,11 +454,7 @@ int SSL_CTX_use_certificate_chain( } /* optionally skip a leading server certificate */ if (skipfirst) { -#if SSL_LIBRARY_VERSION < 0x00904000 - if ((x509 = PEM_read_bio_X509(bio, NULL, cb)) == NULL) { -#else if ((x509 = PEM_read_bio_X509(bio, NULL, cb, NULL)) == NULL) { -#endif BIO_free(bio); return -1; } @@ -493,11 +467,7 @@ int SSL_CTX_use_certificate_chain( } /* create new extra chain by loading the certs */ n = 0; -#if SSL_LIBRARY_VERSION < 0x00904000 - while ((x509 = PEM_read_bio_X509(bio, NULL, cb)) != NULL) { -#else while ((x509 = PEM_read_bio_X509(bio, NULL, cb, NULL)) != NULL) { -#endif if (!SSL_CTX_add_extra_chain_cert(ctx, x509)) { X509_free(x509); BIO_free(bio); diff --git a/usr.sbin/httpd/src/modules/standard/mod_rewrite.h b/usr.sbin/httpd/src/modules/standard/mod_rewrite.h index f6f8f6213b8..9dd41fa7e70 100644 --- a/usr.sbin/httpd/src/modules/standard/mod_rewrite.h +++ b/usr.sbin/httpd/src/modules/standard/mod_rewrite.h @@ -145,13 +145,8 @@ * Small monkey business to ensure that fcntl is preferred, * unless we specified USE_FLOCK_SERIALIZED_ACCEPT during compile. */ -#if defined(HAVE_FCNTL_SERIALIZED_ACCEPT) && !defined(USE_FLOCK_SERIALIZED_ACCEPT) -#define USE_FCNTL 1 -#include <fcntl.h> -#elif defined(HAVE_FLOCK_SERIALIZED_ACCEPT) #define USE_FLOCK 1 #include <sys/file.h> -#endif #if !defined(USE_FCNTL) && !defined(USE_FLOCK) #define USE_FLOCK 1 #include <sys/file.h> diff --git a/usr.sbin/httpd/src/modules/standard/mod_usertrack.c b/usr.sbin/httpd/src/modules/standard/mod_usertrack.c index 719c6955496..56f9f556502 100644 --- a/usr.sbin/httpd/src/modules/standard/mod_usertrack.c +++ b/usr.sbin/httpd/src/modules/standard/mod_usertrack.c @@ -145,13 +145,8 @@ typedef struct { static char * make_cookie_id(char * buffer, int bufsize, request_rec *r, cookie_format_e cformat) { -#if defined(NO_GETTIMEOFDAY) && !defined(NO_TIMES) - clock_t mpe_times; - struct tms mpe_tms; -#elif !defined(WIN32) struct timeval tv; struct timezone tz = {0, 0}; -#endif cookie_dir_rec *dcfg; @@ -163,27 +158,6 @@ static char * make_cookie_id(char * buffer, int bufsize, request_rec *r, REMOTE_NAME); dcfg = ap_get_module_config(r->per_dir_config, &usertrack_module); -#if defined(NO_GETTIMEOFDAY) && !defined(NO_TIMES) -/* We lack gettimeofday(), so we must use time() to obtain the epoch - seconds, and then times() to obtain CPU clock ticks (milliseconds). - Combine this together to obtain a hopefully unique cookie ID. */ - - mpe_times = times(&mpe_tms); - clocktime = (long) mpe_tms.tms_utime; - -#elif defined(NETWARE) - clocktime = (long) clock(); - -#elif defined(WIN32) - /* - * We lack gettimeofday() and we lack times(). So we'll use - * GetTickCount(), which returns milliseconds since Windows - * was started. It should be relatively unique. - */ - - clocktime = (long) GetTickCount(); - -#else gettimeofday(&tv, &tz); reqtime = (long) tv.tv_sec; @@ -191,7 +165,6 @@ static char * make_cookie_id(char * buffer, int bufsize, request_rec *r, clocktime = (long) (tv.tv_usec % 65535); else clocktime = (long) (tv.tv_usec / 1000); -#endif if (cformat == CF_COMPACT) ap_snprintf(buffer, bufsize, "%s%lx%x%lx%lx", diff --git a/usr.sbin/httpd/src/os/unix/os.c b/usr.sbin/httpd/src/os/unix/os.c index a775c8eb83c..37d6d36de02 100644 --- a/usr.sbin/httpd/src/os/unix/os.c +++ b/usr.sbin/httpd/src/os/unix/os.c @@ -36,16 +36,7 @@ void ap_os_dso_unload(void *handle) void *ap_os_dso_sym(void *handle, const char *symname) { -#if defined(DLSYM_NEEDS_UNDERSCORE) - char *symbol; - void *retval; - asprintf(&symbol, "_%s", symname); - retval = dlsym(handle, symbol); - free(symbol); - return retval; -#else return dlsym(handle, symname); -#endif } const char *ap_os_dso_error(void) diff --git a/usr.sbin/httpd/src/os/unix/os.h b/usr.sbin/httpd/src/os/unix/os.h index 9d2d9712bc2..9e9ab866b41 100644 --- a/usr.sbin/httpd/src/os/unix/os.h +++ b/usr.sbin/httpd/src/os/unix/os.h @@ -100,28 +100,7 @@ extern int ap_os_is_path_absolute(const char *file); * dynamic shared object (DSO) mechanism */ -#ifdef HAVE_DL_H -#include <dl.h> -#endif - -/* - * Do not use native AIX DSO support on releases of AIX prior - * to 4.3. - */ -#ifdef AIX -#if AIX < 430 -#undef HAVE_DLFCN_H -#endif -#endif - -#ifdef HAVE_DLFCN_H #include <dlfcn.h> -#else -void *dlopen(const char *, int); -int dlclose(void *); -void *dlsym(void *, const char *); -const char *dlerror(void); -#endif /* probably on an older system that doesn't support RTLD_NOW or RTLD_LAZY. * The below define is a lie since we are really doing RTLD_LAZY since the @@ -135,12 +114,6 @@ const char *dlerror(void); #define RTLD_GLOBAL 0 #endif -#if (defined(__FreeBSD__) ||\ - defined(__OpenBSD__) ||\ - defined(__NetBSD__) ) && !defined(__ELF__) -#define DLSYM_NEEDS_UNDERSCORE -#endif - #define ap_os_dso_handle_t void * void ap_os_dso_init(void); void * ap_os_dso_load(const char *); diff --git a/usr.sbin/httpd/src/support/ab.c b/usr.sbin/httpd/src/support/ab.c index e43134711da..91de52bc578 100644 --- a/usr.sbin/httpd/src/support/ab.c +++ b/usr.sbin/httpd/src/support/ab.c @@ -147,10 +147,8 @@ #include <fcntl.h> #include <sys/time.h> -#ifndef NO_WRITEV #include <sys/types.h> #include <sys/uio.h> -#endif #endif /* NO_APACHE_INCLUDES */ @@ -1334,14 +1332,14 @@ static void test(void) static void copyright(void) { if (!use_html) { - printf("This is ApacheBench, Version %s\n", VERSION " <$Revision: 1.16 $> apache-1.3"); + printf("This is ApacheBench, Version %s\n", VERSION " <$Revision: 1.17 $> 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.16 $"); + printf(" This is ApacheBench, Version %s <i><%s></i> apache-1.3<br>\n", VERSION, "$Revision: 1.17 $"); 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/htpasswd.c b/usr.sbin/httpd/src/support/htpasswd.c index 053261dff4b..4e1da00faa5 100644 --- a/usr.sbin/httpd/src/support/htpasswd.c +++ b/usr.sbin/httpd/src/support/htpasswd.c @@ -88,11 +88,6 @@ #include "ap_md5.h" #include "ap_sha1.h" -#ifdef HAVE_CRYPT_H -#include <crypt.h> -#endif - - #define LF 10 #define CR 13 diff --git a/usr.sbin/httpd/src/support/logresolve.c b/usr.sbin/httpd/src/support/logresolve.c index 4d05e6fd651..aba7f602364 100644 --- a/usr.sbin/httpd/src/support/logresolve.c +++ b/usr.sbin/httpd/src/support/logresolve.c @@ -62,19 +62,6 @@ static void stats(FILE *output); /* number of buckets in cache hash table */ #define BUCKETS 256 -#if defined(NEED_STRDUP) -char *strdup (const char *str) -{ - char *dup; - - if (!(dup = (char *) malloc(strlen(str) + 1))) - return NULL; - dup = strlcpy(dup, str, strlen(str) + 1); - - return dup; -} -#endif - /* * struct nsrec - record of nameservice for cache linked list * diff --git a/usr.sbin/httpd/src/support/suexec.c b/usr.sbin/httpd/src/support/suexec.c index a0251da4971..2a64ec39755 100644 --- a/usr.sbin/httpd/src/support/suexec.c +++ b/usr.sbin/httpd/src/support/suexec.c @@ -97,29 +97,6 @@ #include "suexec.h" -/* - *********************************************************************** - * There is no initgroups() in QNX, so I believe this is safe :-) - * Use cc -osuexec -3 -O -mf -DQNX suexec.c to compile. - * - * May 17, 1997. - * Igor N. Kovalenko -- infoh@mail.wplus.net - *********************************************************************** - */ - -#if defined(NEED_INITGROUPS) -int initgroups(const char *name, gid_t basegid) -{ -/* QNX and MPE do not appear to support supplementary groups. */ - return 0; -} -#endif - -#if defined(NEED_STRERROR) -extern char *sys_errlist[]; -#define strerror(x) sys_errlist[(x)] -#endif - #if defined(PATH_MAX) #define AP_MAXPATH PATH_MAX #elif defined(MAXPATHLEN) @@ -601,16 +578,7 @@ int main(int argc, char *argv[]) /* * Execute the command, replacing our image with its own. */ -#ifdef NEED_HASHBANG_EMUL - /* We need the #! emulation when we want to execute scripts */ - { - extern char **environ; - - ap_execve(cmd, &argv[3], environ); - } -#else /*NEED_HASHBANG_EMUL*/ execv(cmd, &argv[3]); -#endif /*NEED_HASHBANG_EMUL*/ /* * (I can't help myself...sorry.) |