diff options
author | Niall O'Higgins <niallo@cvs.openbsd.org> | 2005-03-28 23:26:52 +0000 |
---|---|---|
committer | Niall O'Higgins <niallo@cvs.openbsd.org> | 2005-03-28 23:26:52 +0000 |
commit | 21c6490fb7cda38e0868ff418bc084f407930697 (patch) | |
tree | ff0ee8c0b12eea12f0b77d6ed62012166829807a /usr.sbin | |
parent | 5631ce7bb78608891dade531ca5431bce809cd21 (diff) |
KNF
no binary changes.
Diffstat (limited to 'usr.sbin')
30 files changed, 710 insertions, 633 deletions
diff --git a/usr.sbin/httpd/src/include/ap.h b/usr.sbin/httpd/src/include/ap.h index e4e6ea871de..4a3b554221e 100644 --- a/usr.sbin/httpd/src/include/ap.h +++ b/usr.sbin/httpd/src/include/ap.h @@ -1,3 +1,5 @@ +/* $OpenBSD: ap.h,v 1.13 2005/03/28 23:26:51 niallo Exp $ */ + /* ==================================================================== * The Apache Software License, Version 1.1 * @@ -81,13 +83,13 @@ API_EXPORT(long) ap_strtol(const char *nptr, char **endptr, int base); /* small utility macros to make things easier to read */ -#define ap_killpg(x, y) (killpg ((x), (y))) +#define ap_killpg(x, y) (killpg ((x), (y))) /* ap_vformatter() is a generic printf-style formatting routine * with some extensions. The extensions are: * - * %pA takes a struct in_addr *, and prints it as a.b.c.d - * %pI takes a struct sockaddr_in * and prints it as a.b.c.d:port + * %pA takes a struct in_addr *, and prints it as a.b.c.d + * %pI takes a struct sockaddr_in * and prints it as a.b.c.d:port * %pp takes a void * and outputs it in hex * * The %p hacks are to force gcc's printf warning code to skip @@ -133,8 +135,8 @@ API_EXPORT(long) ap_strtol(const char *nptr, char **endptr, int base); */ typedef struct { - char *curpos; - char *endpos; + char *curpos; + char *endpos; } ap_vformatter_buff; API_EXPORT(int) ap_vformatter(int (*flush_func)(ap_vformatter_buff *), @@ -157,10 +159,10 @@ API_EXPORT(int) ap_vformatter(int (*flush_func)(ap_vformatter_buff *), * * In no event does ap_snprintf return a negative number. */ -API_EXPORT_NONSTD(int) ap_snprintf(char *buf, size_t len, const char *format,...) - __attribute__((format(printf,3,4))); +API_EXPORT_NONSTD(int) ap_snprintf(char *buf, size_t len, + const char *format,...) __attribute__((format(printf,3,4))); API_EXPORT(int) ap_vsnprintf(char *buf, size_t len, const char *format, - va_list ap); + va_list ap); /* Simple BASE64 encode/decode functions. * * As we might encode binary strings, hence we require the length of @@ -174,12 +176,15 @@ API_EXPORT(int) ap_vsnprintf(char *buf, size_t len, const char *format, * */ API_EXPORT(int) ap_base64encode_len(int len); -API_EXPORT(int) ap_base64encode(char * coded_dst, const char *plain_src,int len_plain_src); -API_EXPORT(int) ap_base64encode_binary(char * coded_dst, const unsigned char *plain_src,int len_plain_src); +API_EXPORT(int) ap_base64encode(char * coded_dst, const char *plain_src, + int len_plain_src); +API_EXPORT(int) ap_base64encode_binary(char * coded_dst, + const unsigned char *plain_src,int len_plain_src); API_EXPORT(int) ap_base64decode_len(const char * coded_src); API_EXPORT(int) ap_base64decode(char * plain_dst, const char *coded_src); -API_EXPORT(int) ap_base64decode_binary(unsigned char * plain_dst, const char *coded_src); +API_EXPORT(int) ap_base64decode_binary(unsigned char * plain_dst, + const char *coded_src); /* Password validation, as used in AuthType Basic which is able to cope * (based on the prefix) with the SHA1, Apache's internal MD5 and (depending diff --git a/usr.sbin/httpd/src/include/ap_alloc.h b/usr.sbin/httpd/src/include/ap_alloc.h index 6c8d1f1caaa..b9f24efc062 100644 --- a/usr.sbin/httpd/src/include/ap_alloc.h +++ b/usr.sbin/httpd/src/include/ap_alloc.h @@ -1,3 +1,5 @@ +/* $OpenBSD: ap_alloc.h,v 1.8 2005/03/28 23:26:51 niallo Exp $ */ + /* ==================================================================== * The Apache Software License, Version 1.1 * @@ -80,16 +82,16 @@ extern "C" { */ /* Arenas for configuration info and transaction info - * --- actual layout of the pool structure is private to - * alloc.c. + * --- actual layout of the pool structure is private to + * alloc.c. */ typedef struct pool pool; typedef struct pool ap_pool; -API_EXPORT(pool *) ap_init_alloc(void); /* Set up everything */ +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 */ +API_EXPORT(pool *) ap_make_sub_pool(pool *); /* All pools are subpools of permanent_pool */ typedef enum { AP_POOL_RD, AP_POOL_RW } ap_pool_lock_mode; int ap_shared_pool_possible(void); void ap_init_alloc_shared(int); @@ -164,7 +166,8 @@ API_EXPORT(void *) ap_pcalloc(struct pool *, int nbytes); API_EXPORT(char *) ap_pstrdup(struct pool *, const char *s); /* make a nul terminated copy of the n characters starting with s */ API_EXPORT(char *) ap_pstrndup(struct pool *, const char *s, int n); -API_EXPORT_NONSTD(char *) ap_pstrcat(struct pool *,...); /* all '...' must be char* */ +API_EXPORT_NONSTD(char *) ap_pstrcat(struct pool *,...); +/* all '...' must be char* */ API_EXPORT_NONSTD(char *) ap_psprintf(struct pool *, const char *fmt, ...) __attribute__((format(printf,2,3))); API_EXPORT(char *) ap_pvsprintf(struct pool *, const char *fmt, va_list); @@ -174,18 +177,18 @@ API_EXPORT(char *) ap_pvsprintf(struct pool *, const char *fmt, va_list); */ typedef struct { - ap_pool *pool; - int elt_size; - int nelts; - int nalloc; - char *elts; + ap_pool *pool; + int elt_size; + int nelts; + int nalloc; + char *elts; } array_header; API_EXPORT(array_header *) ap_make_array(pool *p, int nelts, int elt_size); API_EXPORT(void *) ap_push_array(array_header *); API_EXPORT(void) ap_array_cat(array_header *dst, const array_header *src); API_EXPORT(array_header *) ap_append_arrays(pool *, const array_header *, - const array_header *); + const array_header *); /* ap_array_pstrcat generates a new string from the pool containing * the concatenated sequence of substrings referenced as elements within @@ -194,7 +197,7 @@ API_EXPORT(array_header *) ap_append_arrays(pool *, const array_header *, * If sep is non-NUL, it will be inserted between elements as a separator. */ API_EXPORT(char *) ap_array_pstrcat(pool *p, const array_header *arr, - const char sep); + const char sep); /* copy_array copies the *entire* array. copy_array_hdr just copies * the header, and arranges for the elements to be copied if (and only @@ -217,10 +220,10 @@ API_EXPORT(array_header *) ap_copy_array_hdr(pool *p, const array_header *src); typedef struct table table; typedef struct { - char *key; /* maybe NULL in future; + char *key; /* maybe NULL in future; * check when iterating thru table_elts */ - char *val; + char *val; } table_entry; API_EXPORT(table *) ap_make_table(pool *p, int nelts); @@ -229,15 +232,18 @@ API_EXPORT(void) ap_clear_table(table *); API_EXPORT(const char *) ap_table_get(const table *, const char *); API_EXPORT(void) ap_table_set(table *, const char *name, const char *val); API_EXPORT(void) ap_table_setn(table *, const char *name, const char *val); -API_EXPORT(void) ap_table_merge(table *, const char *name, const char *more_val); -API_EXPORT(void) ap_table_mergen(table *, const char *name, const char *more_val); +API_EXPORT(void) ap_table_merge(table *, const char *name, + const char *more_val); +API_EXPORT(void) ap_table_mergen(table *, const char *name, + const char *more_val); API_EXPORT(void) ap_table_unset(table *, const char *key); API_EXPORT(void) ap_table_add(table *, const char *name, const char *val); API_EXPORT(void) ap_table_addn(table *, const char *name, const char *val); -API_EXPORT_NONSTD(void) ap_table_do(int (*comp) (void *, const char *, const char *), - void *rec, const table *t,...); +API_EXPORT_NONSTD(void) ap_table_do(int (*comp) (void *, const char *, + const char *), void *rec, const table *t,...); -API_EXPORT(table *) ap_overlay_tables(pool *p, const table *overlay, const table *base); +API_EXPORT(table *) ap_overlay_tables(pool *p, const table *overlay, + const table *base); /* Conceptually, ap_overlap_tables does this: @@ -246,12 +252,12 @@ API_EXPORT(table *) ap_overlay_tables(pool *p, const table *overlay, const table int i; for (i = 0; i < barr->nelts; ++i) { - if (flags & AP_OVERLAP_TABLES_MERGE) { - ap_table_mergen(a, belt[i].key, belt[i].val); - } - else { - ap_table_setn(a, belt[i].key, belt[i].val); - } + if (flags & AP_OVERLAP_TABLES_MERGE) { + ap_table_mergen(a, belt[i].key, belt[i].val); + } + else { + ap_table_setn(a, belt[i].key, belt[i].val); + } } Except that it is more efficient (less space and cpu-time) especially @@ -271,7 +277,8 @@ API_EXPORT(void) ap_overlap_tables(table *a, const table *b, unsigned flags); * written which assume that a table is the same as an array_header. -djg */ #define ap_table_elts(t) ((array_header *)(t)) -#define ap_is_empty_table(t) (((t) == NULL)||(((array_header *)(t))->nelts == 0)) +#define ap_is_empty_table(t) \ + (((t) == NULL)||(((array_header *)(t))->nelts == 0)) /* routines to remember allocation of other sorts of things... * generic interface first. Note that we want to have two separate @@ -279,7 +286,7 @@ API_EXPORT(void) ap_overlap_tables(table *a, const table *b, unsigned flags); * to keep CGI scripts and the like from inheriting access to things * they shouldn't be able to touch, and one for actually cleaning up, * when the actual server process wants to get rid of the thing, - * whatever it is. + * whatever it is. * * kill_cleanup disarms a cleanup, presumably because the resource in * question has been closed, freed, or whatever, and it's scarce @@ -300,15 +307,15 @@ API_EXPORT(void) ap_overlap_tables(table *a, const table *b, unsigned flags); */ API_EXPORT(void) ap_register_cleanup(pool *p, void *data, - void (*plain_cleanup) (void *), - void (*child_cleanup) (void *)); + void (*plain_cleanup) (void *), void (*child_cleanup) (void *)); API_EXPORT(void) ap_register_cleanup_ex(pool *p, void *data, - void (*plain_cleanup) (void *), - void (*child_cleanup) (void *), - int (*magic_cleanup) (void *)); + void (*plain_cleanup) (void *), void (*child_cleanup) (void *), + int (*magic_cleanup) (void *)); -API_EXPORT(void) ap_kill_cleanup(pool *p, void *data, void (*plain_cleanup) (void *)); -API_EXPORT(void) ap_run_cleanup(pool *p, void *data, void (*cleanup) (void *)); +API_EXPORT(void) ap_kill_cleanup(pool *p, void *data, + void (*plain_cleanup) (void *)); +API_EXPORT(void) ap_run_cleanup(pool *p, void *data, + void (*cleanup) (void *)); /* A "do-nothing" cleanup, for register_cleanup; it's faster to do * things this way than to test for NULL. */ @@ -331,11 +338,13 @@ API_EXPORT(void) ap_unblock_alarms(void); * the note_cleanups_for_foo routines are for */ -API_EXPORT(FILE *) ap_pfopen(struct pool *, const char *name, const char *fmode); -API_EXPORT(FILE *) ap_pfdopen(struct pool *, int fd, const char *fmode); +API_EXPORT(FILE *) ap_pfopen(struct pool *, const char *name, + const char *fmode); +API_EXPORT(FILE *) ap_pfdopen(struct pool *, int fd, + const char *fmode); API_EXPORT(int) ap_popenf(struct pool *, const char *name, int flg, int mode); -API_EXPORT(int) ap_popenf_ex(struct pool *, const char *name, int flg, - int mode, int domagic); +API_EXPORT(int) ap_popenf_ex(struct pool *, const char *name, int flg, int mode, + int domagic); API_EXPORT(void) ap_note_cleanups_for_file(pool *, FILE *); API_EXPORT(void) ap_note_cleanups_for_file_ex(pool *, FILE *, int); @@ -375,20 +384,19 @@ API_EXPORT(void) ap_pclosedir(pool *p, DIR * d); */ enum kill_conditions { - kill_never, /* process is never sent any signals */ - kill_always, /* process is sent SIGKILL on pool cleanup */ - kill_after_timeout, /* SIGTERM, wait 3 seconds, SIGKILL */ - just_wait, /* wait forever for the process to complete */ - kill_only_once /* send SIGTERM and then wait */ + kill_never, /* process is never sent any signals */ + kill_always, /* process is sent SIGKILL on pool cleanup */ + kill_after_timeout, /* SIGTERM, wait 3 seconds, SIGKILL */ + just_wait, /* wait forever for the process to complete */ + kill_only_once /* send SIGTERM and then wait */ }; typedef struct child_info child_info; API_EXPORT(void) ap_note_subprocess(pool *a, pid_t pid, - enum kill_conditions how); + enum kill_conditions how); API_EXPORT(int) ap_spawn_child(pool *, int (*)(void *, child_info *), - void *, enum kill_conditions, - FILE **pipe_in, FILE **pipe_out, - FILE **pipe_err); + void *, enum kill_conditions, FILE **pipe_in, FILE **pipe_out, + FILE **pipe_err); int ap_close_fd_on_exec(int fd); /* magic numbers --- min free bytes to consider a free pool block useable, diff --git a/usr.sbin/httpd/src/include/ap_ctx.h b/usr.sbin/httpd/src/include/ap_ctx.h index bdfb1b6357d..8f8d8402fcc 100644 --- a/usr.sbin/httpd/src/include/ap_ctx.h +++ b/usr.sbin/httpd/src/include/ap_ctx.h @@ -1,3 +1,5 @@ +/* $OpenBSD: ap_ctx.h,v 1.6 2005/03/28 23:26:51 niallo Exp $ */ + /* ==================================================================== * Copyright (c) 1998-2000 The Apache Group. All rights reserved. * @@ -75,13 +77,13 @@ #define AP_CTX_MAX_ENTRIES 1024 typedef struct { - char *ce_key; - void *ce_val; + char *ce_key; + void *ce_val; } ap_ctx_entry; typedef struct { - pool *cr_pool; - ap_ctx_entry **cr_entry; + pool *cr_pool; + ap_ctx_entry **cr_entry; } ap_ctx_rec; typedef ap_ctx_rec ap_ctx; diff --git a/usr.sbin/httpd/src/include/ap_ctype.h b/usr.sbin/httpd/src/include/ap_ctype.h index 028c5bf09de..769ae24b05c 100644 --- a/usr.sbin/httpd/src/include/ap_ctype.h +++ b/usr.sbin/httpd/src/include/ap_ctype.h @@ -1,3 +1,5 @@ +/* $OpenBSD: ap_ctype.h,v 1.7 2005/03/28 23:26:51 niallo Exp $ */ + /* ==================================================================== * The Apache Software License, Version 1.1 * diff --git a/usr.sbin/httpd/src/include/ap_ebcdic.h b/usr.sbin/httpd/src/include/ap_ebcdic.h index e5fd5379822..402309f5274 100644 --- a/usr.sbin/httpd/src/include/ap_ebcdic.h +++ b/usr.sbin/httpd/src/include/ap_ebcdic.h @@ -1,3 +1,5 @@ +/* $OpenBSD: ap_ebcdic.h,v 1.4 2005/03/28 23:26:51 niallo Exp $ */ + /* ==================================================================== * The Apache Software License, Version 1.1 * @@ -53,7 +55,7 @@ */ #ifndef AP_EBCDIC_H -#define AP_EBCDIC_H "$Id: ap_ebcdic.h,v 1.3 2003/08/21 13:11:35 henning Exp $" +#define AP_EBCDIC_H "$Id: ap_ebcdic.h,v 1.4 2005/03/28 23:26:51 niallo Exp $" #include <sys/types.h> diff --git a/usr.sbin/httpd/src/include/ap_hook.h b/usr.sbin/httpd/src/include/ap_hook.h index 2dd142605ac..e36f0f50e2a 100644 --- a/usr.sbin/httpd/src/include/ap_hook.h +++ b/usr.sbin/httpd/src/include/ap_hook.h @@ -1,3 +1,5 @@ +/* $OpenBSD: ap_hook.h,v 1.5 2005/03/28 23:26:51 niallo Exp $ */ + #if 0 =cut #endif @@ -293,27 +295,27 @@ typedef unsigned short int ap_hook_state; /* the union holding the arbitrary decline values */ typedef union { - char v_char; - int v_int; - long v_long; - float v_float; - double v_double; - void *v_ptr; + char v_char; + int v_int; + long v_long; + float v_float; + double v_double; + void *v_ptr; } ap_hook_value; /* the structure holding one hook function and its context */ typedef struct { - void *hf_ptr; /* function pointer */ - void *hf_ctx; /* function context */ + void *hf_ptr; /* function pointer */ + void *hf_ctx; /* function context */ } ap_hook_func; /* the structure holding one hook entry with all its registered functions */ typedef struct { - char *he_hook; /* hook name (=unique id) */ - ap_hook_sig he_sig; /* hook signature */ - int he_modeid; /* hook mode id */ - ap_hook_value he_modeval; /* hook mode value */ - ap_hook_func **he_func; /* hook registered funcs */ + char *he_hook; /* hook name (=unique id) */ + ap_hook_sig he_sig; /* hook signature */ + int he_modeid; /* hook mode id */ + ap_hook_value he_modeval; /* hook mode value */ + ap_hook_func **he_func; /* hook registered funcs */ } ap_hook_entry; /* the maximum number of hooks and functions per hook */ @@ -376,11 +378,14 @@ typedef struct { API_EXPORT(void) ap_hook_init (void); API_EXPORT(void) ap_hook_kill (void); -API_EXPORT(int) ap_hook_configure (char *hook, ap_hook_sig sig, ap_hook_mode modeid, ...); -API_EXPORT(int) ap_hook_register_I (char *hook, void *func, void *ctx); +API_EXPORT(int) ap_hook_configure (char *hook, ap_hook_sig sig, + ap_hook_mode modeid, ...); +API_EXPORT(int) ap_hook_register_I (char *hook, void *func, + void *ctx); API_EXPORT(int) ap_hook_unregister_I (char *hook, void *func); API_EXPORT(ap_hook_state) ap_hook_status (char *hook); -API_EXPORT(int) ap_hook_use (char *hook, ap_hook_sig sig, ap_hook_mode modeid, ...); +API_EXPORT(int) ap_hook_use (char *hook, ap_hook_sig sig, + ap_hook_mode modeid, ...); API_EXPORT(int) ap_hook_call (char *hook, ...); #endif /* AP_HOOK_H */ diff --git a/usr.sbin/httpd/src/include/ap_md5.h b/usr.sbin/httpd/src/include/ap_md5.h index e66ebdc8f63..91d8e545538 100644 --- a/usr.sbin/httpd/src/include/ap_md5.h +++ b/usr.sbin/httpd/src/include/ap_md5.h @@ -1,32 +1,4 @@ -/* - * This is work is derived from material Copyright RSA Data Security, Inc. - * - * The RSA copyright statement and Licence for that original material is - * included below. This is followed by the Apache copyright statement and - * licence for the modifications made to that material. - */ - -/* Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All - rights reserved. - - License to copy and use this software is granted provided that it - is identified as the "RSA Data Security, Inc. MD5 Message-Digest - Algorithm" in all material mentioning or referencing this software - or this function. - - License is also granted to make and use derivative works provided - that such works are identified as "derived from the RSA Data - Security, Inc. MD5 Message-Digest Algorithm" in all material - mentioning or referencing the derived work. - - RSA Data Security, Inc. makes no representations concerning either - the merchantability of this software or the suitability of this - software for any particular purpose. It is provided "as is" - without express or implied warranty of any kind. - - These notices must be retained in any copies of any part of this - documentation and/or software. - */ +/* $OpenBSD: ap_md5.h,v 1.9 2005/03/28 23:26:51 niallo Exp $ */ /* ==================================================================== * The Apache Software License, Version 1.1 @@ -110,12 +82,11 @@ typedef unsigned int UINT4; API_EXPORT(void) ap_MD5Init(AP_MD5_CTX *context); API_EXPORT(void) ap_MD5Update(AP_MD5_CTX *context, const unsigned char *input, - unsigned int inputLen); + unsigned int inputLen); API_EXPORT(void) ap_MD5Final(unsigned char digest[MD5_DIGESTSIZE], - AP_MD5_CTX *context); + AP_MD5_CTX *context); API_EXPORT(void) ap_MD5Encode(const unsigned char *password, - const unsigned char *salt, - char *result, size_t nbytes); + const unsigned char *salt, char *result, size_t nbytes); API_EXPORT(void) ap_to64(char *s, unsigned long v, int n); #ifdef __cplusplus diff --git a/usr.sbin/httpd/src/include/ap_mm.h b/usr.sbin/httpd/src/include/ap_mm.h index ca471935d5e..b7d17f5b392 100644 --- a/usr.sbin/httpd/src/include/ap_mm.h +++ b/usr.sbin/httpd/src/include/ap_mm.h @@ -1,3 +1,5 @@ +/* $OpenBSD: ap_mm.h,v 1.4 2005/03/28 23:26:51 niallo Exp $ */ + /* ==================================================================== * Copyright (c) 1999-2000 The Apache Group. All rights reserved. * @@ -91,7 +93,8 @@ API_EXPORT(char *) ap_MM_error(void); /* Standard Malloc-Style API */ API_EXPORT(AP_MM *) ap_mm_create(size_t size, char *file); -API_EXPORT(int) ap_mm_permission(AP_MM *mm, mode_t mode, uid_t owner, gid_t group); +API_EXPORT(int) ap_mm_permission(AP_MM *mm, mode_t mode, uid_t owner, + gid_t group); API_EXPORT(void) ap_mm_destroy(AP_MM *mm); API_EXPORT(int) ap_mm_lock(AP_MM *mm, ap_mm_lock_mode mode); API_EXPORT(int) ap_mm_unlock(AP_MM *mm); @@ -108,7 +111,8 @@ API_EXPORT(void) ap_mm_display_info(AP_MM *mm); /* Low-Level Shared Memory API */ API_EXPORT(void *) ap_mm_core_create(size_t size, char *file); -API_EXPORT(int) ap_mm_core_permission(void *core, mode_t mode, uid_t owner, gid_t group); +API_EXPORT(int) ap_mm_core_permission(void *core, mode_t mode, uid_t owner, + gid_t group); API_EXPORT(void) ap_mm_core_delete(void *core); API_EXPORT(size_t) ap_mm_core_size(void *core); API_EXPORT(int) ap_mm_core_lock(void *core, ap_mm_lock_mode mode); diff --git a/usr.sbin/httpd/src/include/ap_sha1.h b/usr.sbin/httpd/src/include/ap_sha1.h index 80e62071346..5a0eeadccf5 100644 --- a/usr.sbin/httpd/src/include/ap_sha1.h +++ b/usr.sbin/httpd/src/include/ap_sha1.h @@ -1,3 +1,5 @@ +/* $OpenBSD: ap_sha1.h,v 1.7 2005/03/28 23:26:51 niallo Exp $ */ + /* ==================================================================== * The Apache Software License, Version 1.1 * @@ -89,12 +91,11 @@ typedef u_int32_t AP_LONG; /* a 32-bit quantity */ API_EXPORT(void) ap_sha1_base64(const char *clear, int len, char *out); API_EXPORT(void) ap_SHA1Init(AP_SHA1_CTX *context); API_EXPORT(void) ap_SHA1Update(AP_SHA1_CTX *context, const char *input, - unsigned int inputLen); + unsigned int inputLen); API_EXPORT(void) ap_SHA1Update_binary(AP_SHA1_CTX *context, - const unsigned char *input, - unsigned int inputLen); + const unsigned char *input, unsigned int inputLen); API_EXPORT(void) ap_SHA1Final(unsigned char digest[SHA_DIGESTSIZE], - AP_SHA1_CTX *context); + AP_SHA1_CTX *context); #ifdef __cplusplus } diff --git a/usr.sbin/httpd/src/include/buff.h b/usr.sbin/httpd/src/include/buff.h index 6345c6beb13..3a2b5a5d7dd 100644 --- a/usr.sbin/httpd/src/include/buff.h +++ b/usr.sbin/httpd/src/include/buff.h @@ -1,3 +1,5 @@ +/* $OpenBSD: buff.h,v 1.12 2005/03/28 23:26:51 niallo Exp $ */ + /* ==================================================================== * The Apache Software License, Version 1.1 * @@ -92,33 +94,32 @@ extern "C" { typedef struct buff_struct BUFF; struct buff_struct { - int flags; /* flags */ - unsigned char *inptr; /* pointer to next location to read */ - int incnt; /* number of bytes left to read from input buffer; + int flags; /* flags */ + unsigned char *inptr; /* pointer to next location to read */ + int incnt; /* number of bytes left to read from input buffer; * always 0 if had a read error */ - int outchunk; /* location of chunk header when chunking */ - int outcnt; /* number of byte put in output buffer */ - unsigned char *inbase; - unsigned char *outbase; - int bufsiz; - void (*error) (BUFF *fb, int op, void *data); - void *error_data; - long int bytes_sent; /* number of bytes actually written */ + int outchunk; /* location of chunk header when chunking */ + int outcnt; /* number of byte put in output buffer */ + unsigned char *inbase; + unsigned char *outbase; + int bufsiz; + void (*error) (BUFF *fb, int op, void *data); + void *error_data; + long int bytes_sent; /* number of bytes actually written */ - ap_pool *pool; + ap_pool *pool; -/* could also put pointers to the basic I/O routines here */ - int fd; /* the file descriptor */ - int fd_in; /* input file descriptor, if different */ + /* could also put pointers to the basic I/O routines here */ + int fd; /* the file descriptor */ + int fd_in; /* input file descriptor, if different */ - /* transport handle, for RPC binding handle or some such */ - void *t_handle; + /* transport handle, for RPC binding handle or some such */ + void *t_handle; - ap_ctx *ctx; + ap_ctx *ctx; - void *callback_data; - void (*filter_callback)(BUFF *, const void *, int ); - + void *callback_data; + void (*filter_callback)(BUFF *, const void *, int ); }; /* Options to bset/getopt */ @@ -175,8 +176,7 @@ struct child_info { int dummy; }; API_EXPORT(int) ap_bspawn_child(pool *, int (*)(void *, child_info *), void *, - enum kill_conditions, BUFF **pipe_in, BUFF **pipe_out, - BUFF **pipe_err); + enum kill_conditions, BUFF **pipe_in, BUFF **pipe_out, BUFF **pipe_err); /* enable non-blocking operations */ API_EXPORT(int) ap_bnonblock(BUFF *fb, int direction); diff --git a/usr.sbin/httpd/src/include/compat.h b/usr.sbin/httpd/src/include/compat.h index 7b0f1931206..ab21c0fe63e 100644 --- a/usr.sbin/httpd/src/include/compat.h +++ b/usr.sbin/httpd/src/include/compat.h @@ -1,3 +1,5 @@ +/* $OpenBSD: compat.h,v 1.2 2005/03/28 23:26:51 niallo Exp $ */ + /* * compat.h -- backward compatibility header for ap_compat.h */ diff --git a/usr.sbin/httpd/src/include/conf.h b/usr.sbin/httpd/src/include/conf.h index 493365a21f3..b50b8c852e1 100644 --- a/usr.sbin/httpd/src/include/conf.h +++ b/usr.sbin/httpd/src/include/conf.h @@ -1,3 +1,5 @@ +/* $OpenBSD: conf.h,v 1.2 2005/03/28 23:26:51 niallo Exp $ */ + /* * conf.h -- backward compatibility header for ap_config.h */ diff --git a/usr.sbin/httpd/src/include/explain.h b/usr.sbin/httpd/src/include/explain.h index 217e999b9f1..4ab6bc7cbb0 100644 --- a/usr.sbin/httpd/src/include/explain.h +++ b/usr.sbin/httpd/src/include/explain.h @@ -1,3 +1,4 @@ +/* $OpenBSD: explain.h,v 1.2 2005/03/28 23:26:51 niallo Exp $ */ #ifdef __cplusplus extern "C" { diff --git a/usr.sbin/httpd/src/include/fnmatch.h b/usr.sbin/httpd/src/include/fnmatch.h index 84af844262f..5795a2241b5 100644 --- a/usr.sbin/httpd/src/include/fnmatch.h +++ b/usr.sbin/httpd/src/include/fnmatch.h @@ -1,3 +1,5 @@ +/* $OpenBSD: fnmatch.h,v 1.3 2005/03/28 23:26:51 niallo Exp $ */ + /*- * Copyright (c) 1992, 1993 * The Regents of the University of California. All rights reserved. diff --git a/usr.sbin/httpd/src/include/hsregex.h b/usr.sbin/httpd/src/include/hsregex.h index 4918042562c..9e5b8479e79 100644 --- a/usr.sbin/httpd/src/include/hsregex.h +++ b/usr.sbin/httpd/src/include/hsregex.h @@ -1,3 +1,5 @@ +/* $OpenBSD: hsregex.h,v 1.7 2005/03/28 23:26:51 niallo Exp $ */ + /* DON'T EVEN THINK ABOUT EDITING THIS, go see regex/Makefile, * search for mkh */ #ifndef _REGEX_H_ diff --git a/usr.sbin/httpd/src/include/http_conf_globals.h b/usr.sbin/httpd/src/include/http_conf_globals.h index 0b3f7bb7c43..9d08788761c 100644 --- a/usr.sbin/httpd/src/include/http_conf_globals.h +++ b/usr.sbin/httpd/src/include/http_conf_globals.h @@ -1,3 +1,5 @@ +/* $OpenBSD: http_conf_globals.h,v 1.15 2005/03/28 23:26:51 niallo Exp $ */ + /* ==================================================================== * The Apache Software License, Version 1.1 * diff --git a/usr.sbin/httpd/src/include/http_config.h b/usr.sbin/httpd/src/include/http_config.h index 51dd5079261..21482a9cc1a 100644 --- a/usr.sbin/httpd/src/include/http_config.h +++ b/usr.sbin/httpd/src/include/http_config.h @@ -1,3 +1,5 @@ +/* $OpenBSD: http_config.h,v 1.12 2005/03/28 23:26:51 niallo Exp $ */ + /* ==================================================================== * The Apache Software License, Version 1.1 * @@ -75,36 +77,36 @@ extern "C" { * RAW_ARGS. */ enum cmd_how { - RAW_ARGS, /* cmd_func parses command line itself */ - TAKE1, /* one argument only */ - TAKE2, /* two arguments only */ - ITERATE, /* one argument, occuring multiple times + RAW_ARGS, /* cmd_func parses command line itself */ + TAKE1, /* one argument only */ + TAKE2, /* two arguments only */ + ITERATE, /* one argument, occuring multiple times * (e.g., IndexIgnore) */ - ITERATE2, /* two arguments, 2nd occurs multiple times + ITERATE2, /* two arguments, 2nd occurs multiple times * (e.g., AddIcon) */ - FLAG, /* One of 'On' or 'Off' */ - NO_ARGS, /* No args at all, e.g. </Directory> */ - TAKE12, /* one or two arguments */ - TAKE3, /* three arguments only */ - TAKE23, /* two or three arguments */ - TAKE123, /* one, two or three arguments */ - TAKE13 /* one or three arguments */ + FLAG, /* One of 'On' or 'Off' */ + NO_ARGS, /* No args at all, e.g. </Directory> */ + TAKE12, /* one or two arguments */ + TAKE3, /* three arguments only */ + TAKE23, /* two or three arguments */ + TAKE123, /* one, two or three arguments */ + TAKE13 /* one or three arguments */ }; typedef struct command_struct { - const char *name; /* Name of this command */ - const char *(*func) (); /* Function invoked */ - void *cmd_data; /* Extra data, for functions which + const char *name; /* Name of this command */ + const char *(*func) (); /* Function invoked */ + void *cmd_data; /* Extra data, for functions which * implement multiple commands... */ - int req_override; /* What overrides need to be allowed to + int req_override; /* What overrides need to be allowed to * enable this command. */ - enum cmd_how args_how; /* What the command expects as arguments */ + enum cmd_how args_how; /* What the command expects as arguments */ - const char *errmsg; /* 'usage' message, in case of syntax errors */ + const char *errmsg; /* 'usage' message, in case of syntax errors */ } command_rec; /* The allowed locations for a configuration directive are the union of @@ -148,30 +150,31 @@ typedef struct command_struct { */ typedef struct { - void *info; /* Argument to command from cmd_table */ - int override; /* Which allow-override bits are set */ - int limited; /* Which methods are <Limit>ed */ + void *info; /* Argument to command from cmd_table */ + int override; /* Which allow-override bits are set */ + int limited; /* Which methods are <Limit>ed */ - configfile_t *config_file; /* Config file structure from pcfg_openfile() */ + /* Config file structure from pcfg_openfile() */ + configfile_t *config_file; - ap_pool *pool; /* Pool to allocate new storage in */ - struct pool *temp_pool; /* Pool for scratch memory; persists during + ap_pool *pool; /* Pool to allocate new storage in */ + struct pool *temp_pool; /* Pool for scratch memory; persists during * configuration, but wiped before the first * request is served... */ - server_rec *server; /* Server_rec being configured for */ - char *path; /* If configuring for a directory, + server_rec *server; /* Server_rec being configured for */ + char *path; /* If configuring for a directory, * pathname of that directory. * NOPE! That's what it meant previous to the * existance of <Files>, <Location> and regex * matching. Now the only usefulness that can - * be derived from this field is whether a command - * is being called in a server context (path == NULL) - * or being called in a dir context (path != NULL). + * be derived from this field is whether a command + * is being called in a server context (path == NULL) + * or being called in a dir context (path != NULL). */ - const command_rec *cmd; /* configuration command */ - const char *end_token; /* end token required to end a nested section */ - void *context; /* per_dir_config vector passed + const command_rec *cmd; /* configuration command */ + const char *end_token; /* end token required to end a nested section */ + void *context; /* per_dir_config vector passed * to handle_command */ } cmd_parms; @@ -189,129 +192,130 @@ typedef struct { */ typedef struct module_struct { - int version; /* API version, *not* module version; + int version; /* API version, *not* module version; * check that module is compatible with this * version of the server. */ - int minor_version; /* API minor version. Provides API feature - * milestones. Not checked during module init + int minor_version; /* API minor version. Provides API feature + * milestones. Not checked during module init */ - int module_index; /* Index to this modules structures in + int module_index; /* Index to this modules structures in * config vectors. */ - const char *name; - void *dynamic_load_handle; - - struct module_struct *next; - - unsigned long magic; /* Magic Cookie to identify a module structure; - * It's mainly important for the DSO facility - * (see also mod_so). - */ - - /* init() occurs after config parsing, but before any children are - * forked. - * Modules should not rely on the order in which create_server_config - * and create_dir_config are called. - */ - 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); - - const command_rec *cmds; - const handler_rec *handlers; - - /* Hooks for getting into the middle of server ops... - - * translate_handler --- translate URI to filename - * access_checker --- check access by host address, etc. All of these - * run; if all decline, that's still OK. - * check_user_id --- get and validate user id from the HTTP request - * auth_checker --- see if the user (from check_user_id) is OK *here*. - * If all of *these* decline, the request is rejected - * (as a SERVER_ERROR, since the module which was - * supposed to handle this was configured wrong). - * type_checker --- Determine MIME type of the requested entity; - * sets content_type, _encoding and _language fields. - * logger --- log a transaction. - * post_read_request --- run right after read_request or internal_redirect, - * and not run during any subrequests. - */ - - int (*translate_handler) (request_rec *); - int (*ap_check_user_id) (request_rec *); - int (*auth_checker) (request_rec *); - int (*access_checker) (request_rec *); - int (*type_checker) (request_rec *); - int (*fixer_upper) (request_rec *); - int (*logger) (request_rec *); - int (*header_parser) (request_rec *); - - /* Regardless of the model the server uses for managing "units of - * execution", i.e. multi-process, multi-threaded, hybrids of those, - * there is the concept of a "heavy weight process". That is, a - * process with its own memory space, file spaces, etc. This method, - * child_init, is called once for each heavy-weight process before - * any requests are served. Note that no provision is made yet for - * initialization per light-weight process (i.e. thread). The - * parameters passed here are the same as those passed to the global - * init method above. - */ - void (*child_init) (server_rec *, pool *); - void (*child_exit) (server_rec *, pool *); - int (*post_read_request) (request_rec *); - - /* - * ANSI C guarantees us that we can at least _extend_ the module structure - * with additional hooks without the need to change all existing modules. - * Because: ``If there are fewer initializers in the list than members of - * the structure, the trailing members are initialized with 0.'' (The C - * Programming Language, 2nd Ed., A8.7 Initialization). So we just - * have to put our additional hooks here: - * - * add_module: - * Called from within ap_add_module() right after the module structure - * was linked into the Apache internal module list. It is mainly - * intended to be used to define configuration defines (<IfDefine>) - * which have to be available directly after a LoadModule/AddModule. - * Actually this is the earliest possible hook a module can use. - * - * remove_module: - * Called from within ap_remove_module() right before the module - * structure is kicked out from the Apache internal module list. - * Actually this is last possible hook a module can use and exists for - * consistency with the add_module hook. - * - * rewrite_command: - * Called right after a configuration directive line was read and - * before it is processed. It is mainly intended to be used for - * rewriting directives in order to provide backward compatibility to - * old directive variants. - * - * new_connection: - * Called from within the internal new_connection() function, right - * after the conn_rec structure for the new established connection was - * created and before Apache starts processing the request with - * ap_read_request(). It is mainly intended to be used to setup/run - * connection dependent things like sending start headers for - * on-the-fly compression, etc. - * - * close_connection: - * Called from within the Apache dispatching loop just before any - * ap_bclose() is performed on the socket connection, but a long time - * before any pool cleanups are done for the connection (which can be - * too late for some applications). It is mainly intended to be used - * to close/finalize connection dependent things like sending end - * headers for on-the-fly compression, etc. - */ - 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 *); + const char *name; + void *dynamic_load_handle; + + struct module_struct *next; + + unsigned long magic; /* Magic Cookie to identify a module structure; + * It's mainly important for the DSO facility + * (see also mod_so). + */ + + /* init() occurs after config parsing, but before any children are + * forked. + * Modules should not rely on the order in which create_server_config + * and create_dir_config are called. + */ + 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); + + const command_rec *cmds; + const handler_rec *handlers; + + /* Hooks for getting into the middle of server ops... + + * translate_handler --- translate URI to filename + * access_checker --- check access by host address, etc. All of these + * run; if all decline, that's still OK. + * check_user_id --- get and validate user id from the HTTP request + * auth_checker --- see if the user (from check_user_id) is OK *here*. + * If all of *these* decline, the request is rejected + * (as a SERVER_ERROR, since the module which was + * supposed to handle this was configured wrong). + * type_checker --- Determine MIME type of the requested entity; + * sets content_type, _encoding and _language fields. + * logger --- log a transaction. + * post_read_request --- run right after read_request or + * internal_redirect, and not run during any subrequests. + */ + + int (*translate_handler) (request_rec *); + int (*ap_check_user_id) (request_rec *); + int (*auth_checker) (request_rec *); + int (*access_checker) (request_rec *); + int (*type_checker) (request_rec *); + int (*fixer_upper) (request_rec *); + int (*logger) (request_rec *); + int (*header_parser) (request_rec *); + + /* Regardless of the model the server uses for managing "units of + * execution", i.e. multi-process, multi-threaded, hybrids of those, + * there is the concept of a "heavy weight process". That is, a + * process with its own memory space, file spaces, etc. This method, + * child_init, is called once for each heavy-weight process before + * any requests are served. Note that no provision is made yet for + * initialization per light-weight process (i.e. thread). The + * parameters passed here are the same as those passed to the global + * init method above. + */ + void (*child_init) (server_rec *, pool *); + void (*child_exit) (server_rec *, pool *); + int (*post_read_request) (request_rec *); + + /* + * ANSI C guarantees us that we can at least extend the module structure + * with additional hooks without the need to change all existing modules. + * Because: ``If there are fewer initializers in the list than members of + * the structure, the trailing members are initialized with 0.'' (The C + * Programming Language, 2nd Ed., A8.7 Initialization). So we just + * have to put our additional hooks here: + * + * add_module: + * Called from within ap_add_module() right after the module + * structure was linked into the Apache internal module list. + * It is mainly intended to be used to define configuration defines + * (<IfDefine>) which have to be available directly after a + * LoadModule/AddModule. Actually this is the earliest possible + * hook a module can use. + * + * remove_module: + * Called from within ap_remove_module() right before the module + * structure is kicked out from the Apache internal module list. + * Actually this is last possible hook a module can use and exists + * for consistency with the add_module hook. + * + * rewrite_command: + * Called right after a configuration directive line was read and + * before it is processed. It is mainly intended to be used for + * rewriting directives in order to provide backward compatibility to + * old directive variants. + * + * new_connection: + * Called from within the internal new_connection() function, right + * after the conn_rec structure for the new established connection + * was created and before Apache starts processing the request with + * ap_read_request(). It is mainly intended to be used to setup/run + * connection dependent things like sending start headers for + * on-the-fly compression, etc. + * + * close_connection: + * Called from within the Apache dispatching loop just before any + * ap_bclose() is performed on the socket connection, but a long time + * before any pool cleanups are done for the connection (which can be + * too late for some applications). It is mainly intended to be used + * to close/finalize connection dependent things like sending end + * headers for on-the-fly compression, etc. + */ + 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 *); } module; /* Initializer for the first few module slots, which are only @@ -347,7 +351,8 @@ API_EXPORT(void) ap_set_module_config(void *conf_vector, module *m, void *val); /* Generic command handling function... */ API_EXPORT_NONSTD(const char *) ap_set_string_slot(cmd_parms *, char *, char *); -API_EXPORT_NONSTD(const char *) ap_set_string_slot_lower(cmd_parms *, char *, char *); +API_EXPORT_NONSTD(const char *) ap_set_string_slot_lower(cmd_parms *, char *, + char *); API_EXPORT_NONSTD(const char *) ap_set_flag_slot(cmd_parms *, char *, int); API_EXPORT_NONSTD(const char *) ap_set_file_slot(cmd_parms *, char *, char *); @@ -386,7 +391,8 @@ API_EXPORT(void) ap_single_module_configure(pool *p, server_rec *s, module *m); /* For http_main.c... */ -API_EXPORT(server_rec *) ap_read_config(pool *conf_pool, pool *temp_pool, char *config_name); +API_EXPORT(server_rec *) ap_read_config(pool *conf_pool, pool *temp_pool, + char *config_name); API_EXPORT(void) ap_init_modules(pool *p, server_rec *s); API_EXPORT(void) ap_child_init_modules(pool *p, server_rec *s); API_EXPORT(void) ap_child_exit_modules(pool *p, server_rec *s); @@ -404,14 +410,16 @@ CORE_EXPORT(void *) ap_merge_per_dir_configs(pool *p, void *base, void *new); /* For http_core.c... (<Directory> command and virtual hosts) */ CORE_EXPORT(int) ap_parse_htaccess(void **result, request_rec *r, int override, - const char *path, const char *access_name); + const char *path, const char *access_name); CORE_EXPORT(const char *) ap_init_virtual_host(pool *p, const char *hostname, - server_rec *main_server, server_rec **); -CORE_EXPORT(void) ap_process_resource_config(server_rec *s, char *fname, pool *p, pool *ptemp); + server_rec *main_server, server_rec **); +CORE_EXPORT(void) ap_process_resource_config(server_rec *s, char *fname, + pool *p, pool *ptemp); /* ap_check_cmd_context() definitions: */ -API_EXPORT(const char *) ap_check_cmd_context(cmd_parms *cmd, unsigned forbidden); +API_EXPORT(const char *) ap_check_cmd_context(cmd_parms *cmd, + unsigned forbidden); /* ap_check_cmd_context(): Forbidden in: */ #define NOT_IN_VIRTUALHOST 0x01 /* <Virtualhost> */ @@ -420,17 +428,22 @@ API_EXPORT(const char *) ap_check_cmd_context(cmd_parms *cmd, unsigned forbidden #define NOT_IN_LOCATION 0x08 /* <Location> */ #define NOT_IN_FILES 0x10 /* <Files> */ #define NOT_IN_DIR_LOC_FILE (NOT_IN_DIRECTORY|NOT_IN_LOCATION|NOT_IN_FILES) /* <Directory>/<Location>/<Files>*/ -#define GLOBAL_ONLY (NOT_IN_VIRTUALHOST|NOT_IN_LIMIT|NOT_IN_DIR_LOC_FILE) +#define GLOBAL_ONLY (NOT_IN_VIRTUALHOST|NOT_IN_LIMIT|NOT_IN_DIR_LOC_FILE) /* Module-method dispatchers, also for http_request.c */ API_EXPORT(int) ap_translate_name(request_rec *); -API_EXPORT(int) ap_check_access(request_rec *); /* check access on non-auth basis */ -API_EXPORT(int) ap_check_user_id(request_rec *); /* obtain valid username from client auth */ -API_EXPORT(int) ap_check_auth(request_rec *); /* check (validated) user is authorized here */ -API_EXPORT(int) ap_find_types(request_rec *); /* identify MIME type */ -API_EXPORT(int) ap_run_fixups(request_rec *); /* poke around for other metainfo, etc.... */ +/* check access on non-auth basis */ +API_EXPORT(int) ap_check_access(request_rec *); +/* obtain valid username from client auth */ +API_EXPORT(int) ap_check_user_id(request_rec *); +/* check (validated) user is authorized here */ +API_EXPORT(int) ap_check_auth(request_rec *); +/* identify MIME type */ +API_EXPORT(int) ap_find_types(request_rec *); +/* poke around for other metainfo, etc.... */ +API_EXPORT(int) ap_run_fixups(request_rec *); API_EXPORT(int) ap_invoke_handler(request_rec *); API_EXPORT(int) ap_log_transaction(request_rec *r); API_EXPORT(int) ap_header_parse(request_rec *); @@ -438,10 +451,14 @@ API_EXPORT(int) ap_run_post_read_request(request_rec *); /* for mod_perl */ -CORE_EXPORT(const command_rec *) ap_find_command(const char *name, const command_rec *cmds); -CORE_EXPORT(const command_rec *) ap_find_command_in_modules(const char *cmd_name, module **mod); -CORE_EXPORT(void *) ap_set_config_vectors(cmd_parms *parms, void *config, module *mod); -CORE_EXPORT(const char *) ap_handle_command(cmd_parms *parms, void *config, const char *l); +CORE_EXPORT(const command_rec *) ap_find_command(const char *name, + const command_rec *cmds); +CORE_EXPORT(const command_rec *) ap_find_command_in_modules(const char + *cmd_name, module **mod); +CORE_EXPORT(void *) ap_set_config_vectors(cmd_parms *parms, void *config, + module *mod); +CORE_EXPORT(const char *) ap_handle_command(cmd_parms *parms, void *config, + const char *l); #endif diff --git a/usr.sbin/httpd/src/include/http_log.h b/usr.sbin/httpd/src/include/http_log.h index 780017b7a3c..9c280047907 100644 --- a/usr.sbin/httpd/src/include/http_log.h +++ b/usr.sbin/httpd/src/include/http_log.h @@ -1,3 +1,5 @@ +/* $OpenBSD: http_log.h,v 1.10 2005/03/28 23:26:51 niallo Exp $ */ + /* ==================================================================== * The Apache Software License, Version 1.1 * @@ -95,12 +97,12 @@ API_EXPORT(void) ap_open_logs (server_rec *, pool *p); * like "%s", followed by the string containing the untrusted data. */ API_EXPORT_NONSTD(void) ap_log_error(const char *file, int line, int level, - const server_rec *s, const char *fmt, ...) - __attribute__((format(printf,5,6))); + const server_rec *s, const char *fmt, ...) + __attribute__((format(printf,5,6))); API_EXPORT_NONSTD(void) ap_log_rerror(const char *file, int line, int level, - const request_rec *s, const char *fmt, ...) - __attribute__((format(printf,5,6))); -API_EXPORT(void) ap_error_log2stderr (server_rec *); + const request_rec *s, const char *fmt, ...) + __attribute__((format(printf,5,6))); +API_EXPORT(void) ap_error_log2stderr (server_rec *); API_EXPORT(void) ap_log_pid (pool *p, char *fname); /* These are for legacy code, new code should use ap_log_error, @@ -108,17 +110,17 @@ API_EXPORT(void) ap_log_pid (pool *p, char *fname); */ API_EXPORT(void) ap_log_error_old(const char *err, server_rec *s); API_EXPORT(void) ap_log_unixerr(const char *routine, const char *file, - const char *msg, server_rec *s); + const char *msg, server_rec *s); API_EXPORT_NONSTD(void) ap_log_printf(const server_rec *s, const char *fmt, ...) - __attribute__((format(printf,2,3))); + __attribute__((format(printf,2,3))); API_EXPORT(void) ap_log_reason(const char *reason, const char *fname, - request_rec *r); + request_rec *r); typedef struct piped_log { - pool *p; - char *program; - int pid; - int fds[2]; + pool *p; + char *program; + int pid; + int fds[2]; } piped_log; API_EXPORT(piped_log *) ap_open_piped_log (pool *p, const char *program); diff --git a/usr.sbin/httpd/src/include/http_main.h b/usr.sbin/httpd/src/include/http_main.h index 7db612a6015..11292755170 100644 --- a/usr.sbin/httpd/src/include/http_main.h +++ b/usr.sbin/httpd/src/include/http_main.h @@ -1,3 +1,5 @@ +/* $OpenBSD: http_main.h,v 1.12 2005/03/28 23:26:51 niallo Exp $ */ + /* ==================================================================== * The Apache Software License, Version 1.1 * @@ -123,7 +125,8 @@ API_EXPORT(void) ap_reset_timeout(request_rec *); API_EXPORT(void) ap_child_terminate(request_rec *r); API_EXPORT(void) ap_sync_scoreboard_image(void); -API_EXPORT(int) ap_update_child_status(int child_num, int status, request_rec *r); +API_EXPORT(int) ap_update_child_status(int child_num, int status, + request_rec *r); void ap_time_process_request(int child_num, int status); API_EXPORT(unsigned int) ap_set_callback_and_alarm(void (*fn) (int), int x); API_EXPORT(int) ap_check_alarm(void); @@ -152,8 +155,8 @@ char *ap_init_mutex_method(char *t); * disable this feature, use -1 for write_fd. */ API_EXPORT(void) ap_register_other_child(int pid, - void (*maintenance) (int reason, void *data, ap_wait_t status), void *data, - int write_fd); + void (*maintenance) (int reason, void *data, ap_wait_t status), + void *data, int write_fd); #define OC_REASON_DEATH 0 /* child has died, caller must call * unregister still */ #define OC_REASON_UNWRITABLE 1 /* write_fd is unwritable */ diff --git a/usr.sbin/httpd/src/include/http_protocol.h b/usr.sbin/httpd/src/include/http_protocol.h index 97df961e556..7afa88a497e 100644 --- a/usr.sbin/httpd/src/include/http_protocol.h +++ b/usr.sbin/httpd/src/include/http_protocol.h @@ -1,3 +1,5 @@ +/* $OpenBSD: http_protocol.h,v 1.11 2005/03/28 23:26:51 niallo Exp $ */ + /* ==================================================================== * The Apache Software License, Version 1.1 * @@ -74,8 +76,8 @@ API_EXPORT(request_rec *) ap_read_request(conn_rec *c); /* Send a single HTTP header field */ -API_EXPORT_NONSTD(int) ap_send_header_field(request_rec *r, const char *fieldname, - const char *fieldval); +API_EXPORT_NONSTD(int) ap_send_header_field(request_rec *r, + const char *fieldname, const char *fieldval); /* Send the minimal part of an HTTP response header... but modules should be * very careful about using this, and should prefer ap_send_http_header(). @@ -151,7 +153,7 @@ API_EXPORT(int) ap_rwrite(const void *buf, int nbyte, request_rec *r); API_EXPORT_NONSTD(int) ap_rvputs(request_rec *r,...); API_EXPORT(int) ap_vrprintf(request_rec *r, const char *fmt, va_list vlist); API_EXPORT_NONSTD(int) ap_rprintf(request_rec *r, const char *fmt,...) - __attribute__((format(printf,2,3))); + __attribute__((format(printf,2,3))); API_EXPORT(int) ap_rflush(request_rec *r); /* @@ -205,7 +207,8 @@ API_EXPORT(int) ap_get_basic_auth_pw(request_rec *r, const char **pw); * Also, a wrapup function to keep the internal accounting straight. */ -API_EXPORT(void) ap_set_sub_req_protocol(request_rec *rnew, const request_rec *r); +API_EXPORT(void) ap_set_sub_req_protocol(request_rec *rnew, + const request_rec *r); API_EXPORT(void) ap_finalize_sub_req_protocol(request_rec *sub_r); /* This is also useful for putting sub_reqs and internal_redirects together */ diff --git a/usr.sbin/httpd/src/include/http_request.h b/usr.sbin/httpd/src/include/http_request.h index 2ddf002e1e0..a2463b5290c 100644 --- a/usr.sbin/httpd/src/include/http_request.h +++ b/usr.sbin/httpd/src/include/http_request.h @@ -1,3 +1,5 @@ +/* $OpenBSD: http_request.h,v 1.8 2005/03/28 23:26:51 niallo Exp $ */ + /* ==================================================================== * The Apache Software License, Version 1.1 * @@ -84,12 +86,11 @@ extern "C" { */ API_EXPORT(request_rec *) ap_sub_req_lookup_uri(const char *new_file, - const request_rec *r); + const request_rec *r); API_EXPORT(request_rec *) ap_sub_req_lookup_file(const char *new_file, - const request_rec *r); + const request_rec *r); API_EXPORT(request_rec *) ap_sub_req_method_uri(const char *method, - const char *new_file, - const request_rec *r); + const char *new_file, const request_rec *r); API_EXPORT(int) ap_run_sub_req(request_rec *r); API_EXPORT(void) ap_destroy_sub_req(request_rec *r); @@ -100,7 +101,8 @@ API_EXPORT(void) ap_destroy_sub_req(request_rec *r); */ API_EXPORT(void) ap_internal_redirect(const char *new_uri, request_rec *); -API_EXPORT(void) ap_internal_redirect_handler(const char *new_uri, request_rec *); +API_EXPORT(void) ap_internal_redirect_handler(const char *new_uri, + request_rec *); API_EXPORT(int) ap_some_auth_required(request_rec *r); API_EXPORT(int) ap_is_initial_req(request_rec *r); API_EXPORT(time_t) ap_update_mtime(request_rec *r, time_t dependency_mtime); diff --git a/usr.sbin/httpd/src/include/http_vhost.h b/usr.sbin/httpd/src/include/http_vhost.h index 456efee5d13..0677e51654f 100644 --- a/usr.sbin/httpd/src/include/http_vhost.h +++ b/usr.sbin/httpd/src/include/http_vhost.h @@ -1,3 +1,5 @@ +/* $OpenBSD: http_vhost.h,v 1.7 2005/03/28 23:26:51 niallo Exp $ */ + /* ==================================================================== * The Apache Software License, Version 1.1 * @@ -70,10 +72,12 @@ API_EXPORT(void) ap_init_vhost_config(pool *p); API_EXPORT(void) ap_fini_vhost_config(pool *p, server_rec *main_server); /* handle addresses in <VirtualHost> statement */ -API_EXPORT(const char *) ap_parse_vhost_addrs(pool *p, const char *hostname, server_rec *s); +API_EXPORT(const char *) ap_parse_vhost_addrs(pool *p, const char *hostname, + server_rec *s); /* handle NameVirtualHost directive */ -API_EXPORT_NONSTD(const char *) ap_set_name_virtual_host (cmd_parms *cmd, void *dummy, char *arg); +API_EXPORT_NONSTD(const char *) ap_set_name_virtual_host (cmd_parms *cmd, + void *dummy, char *arg); /* given an ip address only, give our best guess as to what vhost it is */ API_EXPORT(void) ap_update_vhost_given_ip(conn_rec *conn); diff --git a/usr.sbin/httpd/src/include/httpd.h b/usr.sbin/httpd/src/include/httpd.h index 3a968b81be3..2a6d4b0d5c9 100644 --- a/usr.sbin/httpd/src/include/httpd.h +++ b/usr.sbin/httpd/src/include/httpd.h @@ -1,3 +1,5 @@ +/* $OpenBSD: httpd.h,v 1.25 2005/03/28 23:26:51 niallo Exp $ */ + /* ==================================================================== * The Apache Software License, Version 1.1 * @@ -75,7 +77,7 @@ extern "C" { /* * 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. + * pool stuff but before buff.h because the buffer stuff uses the EAPI, too. */ #include "ap_hook.h" #include "ap_ctx.h" @@ -111,11 +113,11 @@ extern "C" { #define TARGET "httpd" #endif -/* +/* * --------- You shouldn't have to edit anything below this line ---------- * * Any modifications to any defaults not defined above should be done in the - * respective config. file. + * respective config. file. * */ @@ -132,8 +134,12 @@ extern "C" { #define DEFAULT_HTTP_PORT 80 #define DEFAULT_HTTPS_PORT 443 #define ap_is_default_port(port,r) ((port) == ap_default_port(r)) -#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) +#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) /* --------- Default user name and group name running standalone ---------- */ /* --- These may be specified as numbers by placing a # before a number --- */ @@ -299,7 +305,7 @@ extern "C" { * A fatal error, resulting in the whole server aborting. * If a child exits with this error, the parent process * considers this a server-wide fatal error and aborts. - * + * */ #define APEXIT_OK 0x0 #define APEXIT_INIT 0x2 @@ -323,7 +329,7 @@ extern "C" { /* * Unix only: - * Path to Shared Memory Files + * Path to Shared Memory Files */ #ifndef EAPI_MM_CORE_PATH #define EAPI_MM_CORE_PATH "logs/mm" @@ -352,8 +358,8 @@ extern "C" { * by listen(2). Under some systems, it should be increased if you * are experiencing a heavy TCP SYN flood attack. * - * It defaults to 511 instead of 512 because some systems store it - * as an 8-bit datatype; 512 truncated to 8-bits is 0, while 511 is + * It defaults to 511 instead of 512 because some systems store it + * as an 8-bit datatype; 512 truncated to 8-bits is 0, while 511 is * 255 when truncated. */ @@ -388,7 +394,7 @@ extern "C" { #endif /* default limit on number of request header fields */ /* - * The default default character set name to add if AddDefaultCharset is + * The default default character set name to add if AddDefaultCharset is * enabled. Overridden with AddDefaultCharsetName. */ #define DEFAULT_ADD_DEFAULT_CHARSET_NAME "iso-8859-1" @@ -400,7 +406,7 @@ extern "C" { * The tokens are listed in order of their significance for identifying the * application. * - * "Product tokens should be short and to the point -- use of them for + * "Product tokens should be short and to the point -- use of them for * advertizing or other non-essential information is explicitly forbidden." * * Example: "Apache/1.1.0 MrWidget/0.1-alpha" @@ -415,10 +421,10 @@ extern "C" { #define SERVER_REVISION SERVER_BASEREVISION #define SERVER_VERSION SERVER_PRODUCT "/" SERVER_REVISION enum server_token_type { - SrvTk_MIN, /* eg: Apache/1.3.0 */ - SrvTk_OS, /* eg: Apache/1.3.0 (UNIX) */ - SrvTk_FULL, /* eg: Apache/1.3.0 (UNIX) PHP/3.0 FooBar/1.2b */ - SrvTk_PRODUCT_ONLY /* eg: Apache */ + SrvTk_MIN, /* eg: Apache/1.3.0 */ + SrvTk_OS, /* eg: Apache/1.3.0 (UNIX) */ + SrvTk_FULL, /* eg: Apache/1.3.0 (UNIX) PHP/3.0 FooBar/1.2b */ + SrvTk_PRODUCT_ONLY /* eg: Apache */ }; API_EXPORT(const char *) ap_get_server_version(void); @@ -438,7 +444,7 @@ API_EXPORT(void) ap_add_config_define(const char *define); #endif #define DECLINED -1 /* Module declines to handle */ -#define DONE -2 /* Module has served the response completely +#define DONE -2 /* Module has served the response completely * - it's safe to die() with no more output */ #define OK 0 /* Module has handled this stage. */ @@ -619,11 +625,11 @@ API_EXPORT(void) ap_add_config_define(const char *define); * each request. */ struct htaccess_result { - char *dir; /* the directory to which this applies */ - int override; /* the overrides allowed for the .htaccess file */ - void *htaccess; /* the configuration directives */ -/* the next one, or NULL if no more; N.B. never change this */ - const struct htaccess_result *next; + char *dir; /* the directory to which this applies */ + int override; /* the overrides allowed for the .htaccess file */ + void *htaccess; /* the configuration directives */ + /* the next one, or NULL if no more; N.B. never change this */ + const struct htaccess_result *next; }; typedef struct conn_rec conn_rec; @@ -641,47 +647,48 @@ enum proxyreqtype { struct request_rec { - ap_pool *pool; - conn_rec *connection; - server_rec *server; + ap_pool *pool; + conn_rec *connection; + server_rec *server; - request_rec *next; /* If we wind up getting redirected, + request_rec *next; /* If we wind up getting redirected, * pointer to the request we redirected to. */ - request_rec *prev; /* If this is an internal redirect, + request_rec *prev; /* If this is an internal redirect, * pointer to where we redirected *from*. */ - request_rec *main; /* If this is a sub_request (see request.h) + request_rec *main; /* If this is a sub_request (see request.h) * pointer back to the main request. */ - /* Info about the request itself... we begin with stuff that only - * protocol.c should ever touch... - */ + /* Info about the request itself... we begin with stuff that only + * protocol.c should ever touch... + */ - char *the_request; /* First line of request, so we can log it */ - int assbackwards; /* HTTP/0.9, "simple" request */ - enum proxyreqtype proxyreq;/* A proxy request (calculated during + char *the_request; /* First line of request, so we can log it */ + int assbackwards; /* HTTP/0.9, "simple" request */ + enum proxyreqtype proxyreq;/* A proxy request (calculated during * post_read_request or translate_name) */ - int header_only; /* HEAD request, as opposed to GET */ - char *protocol; /* Protocol, as given to us, or HTTP/0.9 */ - int proto_num; /* Number version of protocol; 1.1 = 1001 */ - const char *hostname; /* Host, as set by full URI or Host: */ + int header_only; /* HEAD request, as opposed to GET */ + char *protocol; /* Protocol, as given to us, or HTTP/0.9 */ + int proto_num; /* Number version of protocol; 1.1 = 1001 */ + const char *hostname; /* Host, as set by full URI or Host: */ - time_t request_time; /* When the request started */ + time_t request_time; /* When the request started */ - const char *status_line; /* Status line, if set by script */ - int status; /* In any case */ + const char *status_line; /* Status line, if set by script */ + int status; /* In any case */ - /* Request method, two ways; also, protocol, etc.. Outside of protocol.c, - * look, but don't touch. - */ + /* Request method, two ways; also, protocol, etc.. + * Outside of protocol.c, + * look, but don't touch. + */ - const char *method; /* GET, HEAD, POST, etc. */ - int method_number; /* M_GET, M_POST, etc. */ + const char *method; /* GET, HEAD, POST, etc. */ + int method_number; /* M_GET, M_POST, etc. */ - /* + /* allowed is a bitvector of the allowed methods. A handler must ensure that the request method is one that @@ -700,107 +707,109 @@ struct request_rec { module which does *not* implement GET should probably return METHOD_NOT_ALLOWED. Unfortunately this means that a Script GET handler can't be installed by mod_actions. - */ - int allowed; /* Allowed methods - for 405, OPTIONS, etc */ - - int sent_bodyct; /* byte count in stream is for body */ - long bytes_sent; /* body byte count, for easy access */ - time_t mtime; /* Time the resource was last modified */ - - /* HTTP/1.1 connection-level features */ - - int chunked; /* sending chunked transfer-coding */ - int byterange; /* number of byte ranges */ - char *boundary; /* multipart/byteranges boundary */ - const char *range; /* The Range: header */ - long clength; /* The "real" content length */ - - long remaining; /* bytes left to read */ - long read_length; /* bytes that have been read */ - int read_body; /* how the request body should be read */ - int read_chunked; /* reading chunked transfer-coding */ - unsigned expecting_100; /* is client waiting for a 100 response? */ - - /* MIME header environments, in and out. Also, an array containing - * environment variables to be passed to subprocesses, so people can - * write modules to add to that environment. - * - * The difference between headers_out and err_headers_out is that the - * latter are printed even on error, and persist across internal redirects - * (so the headers printed for ErrorDocument handlers will have them). - * - * The 'notes' table is for notes from one module to another, with no - * other set purpose in mind... - */ - - table *headers_in; - table *headers_out; - table *err_headers_out; - table *subprocess_env; - table *notes; - - /* content_type, handler, content_encoding, content_language, and all - * content_languages MUST be lowercased strings. They may be pointers - * to static strings; they should not be modified in place. - */ - const char *content_type; /* Break these out --- we dispatch on 'em */ - const char *handler; /* What we *really* dispatch on */ - - const char *content_encoding; - const char *content_language; /* for back-compat. only -- do not use */ - array_header *content_languages; /* array of (char*) */ - - char *vlist_validator; /* variant list validator (if negotiated) */ - - int no_cache; - int no_local_copy; - - /* What object is being requested (either directly, or via include - * or content-negotiation mapping). - */ - - char *unparsed_uri; /* the uri without any parsing performed */ - char *uri; /* the path portion of the URI */ - char *filename; /* filename if found, otherwise NULL */ - char *path_info; - char *args; /* QUERY_ARGS, if any */ - struct stat finfo; /* ST_MODE set to zero if no such file */ - uri_components parsed_uri; /* components of uri, dismantled */ - - /* Various other config info which may change with .htaccess files - * These are config vectors, with one void* pointer for each module - * (the thing pointed to being the module's business). - */ - - void *per_dir_config; /* Options set in config files, etc. */ - void *request_config; /* Notes on *this* request */ - -/* - * a linked list of the configuration directives in the .htaccess files - * accessed by this request. - * N.B. always add to the head of the list, _never_ to the end. - * that way, a sub request's list can (temporarily) point to a parent's list - */ - const struct htaccess_result *htaccess; - - /* On systems with case insensitive file systems (Windows, OS/2, etc.), - * r->filename is case canonicalized (folded to either lower or upper - * case, depending on the specific system) to accomodate file access - * checking. case_preserved_filename is the same as r->filename - * except case is preserved. There is at least one instance where Apache - * needs access to the case preserved filename: Java class files published - * with WebDAV need to preserve filename case to make the Java compiler - * happy. - */ - char *case_preserved_filename; - -/* 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 - * binary compatibility for some other reason. - */ - - ap_ctx *ctx; + */ + int allowed; /* Allowed methods - for 405, OPTIONS, etc */ + + int sent_bodyct; /* byte count in stream is for body */ + long bytes_sent; /* body byte count, for easy access */ + time_t mtime; /* Time the resource was last modified */ + + /* HTTP/1.1 connection-level features */ + + int chunked; /* sending chunked transfer-coding */ + int byterange; /* number of byte ranges */ + char *boundary; /* multipart/byteranges boundary */ + const char *range; /* The Range: header */ + long clength; /* The "real" content length */ + + long remaining; /* bytes left to read */ + long read_length; /* bytes that have been read */ + int read_body; /* how the request body should be read */ + int read_chunked; /* reading chunked transfer-coding */ + unsigned expecting_100; /* is client waiting for a 100 response? */ + + /* MIME header environments, in and out. Also, an array containing + * environment variables to be passed to subprocesses, so people can + * write modules to add to that environment. + * + * The difference between headers_out and err_headers_out is that the + * latter are printed even on error, and persist across internal + * redirects (so the headers printed for ErrorDocument handlers will + * have them). + * + * The 'notes' table is for notes from one module to another, with no + * other set purpose in mind... + */ + + table *headers_in; + table *headers_out; + table *err_headers_out; + table *subprocess_env; + table *notes; + + /* content_type, handler, content_encoding, content_language, and all + * content_languages MUST be lowercased strings. They may be pointers + * to static strings; they should not be modified in place. + */ + const char *content_type; /* Break these out we dispatch on 'em */ + const char *handler; /* What we *really* dispatch on */ + + const char *content_encoding; + const char *content_language; /* for back-compat. only- do not use */ + array_header *content_languages; /* array of (char*) */ + + char *vlist_validator; /* variant list validator (if negotiated) */ + + int no_cache; + int no_local_copy; + + /* What object is being requested (either directly, or via include + * or content-negotiation mapping). + */ + + char *unparsed_uri; /* the uri without any parsing performed */ + char *uri; /* the path portion of the URI */ + char *filename; /* filename if found, otherwise NULL */ + char *path_info; + char *args; /* QUERY_ARGS, if any */ + struct stat finfo; /* ST_MODE set to zero if no such file */ + uri_components parsed_uri; /* components of uri, dismantled */ + + /* Various other config info which may change with .htaccess files + * These are config vectors, with one void* pointer for each module + * (the thing pointed to being the module's business). + */ + + void *per_dir_config; /* Options set in config files, etc. */ + void *request_config; /* Notes on *this* request */ + + /* + * a linked list of the configuration directives in the .htaccess files + * accessed by this request. + * N.B. always add to the head of the list, _never_ to the end. + * that way, a sub request's list can (temporarily) point to a parent's + * list + */ + const struct htaccess_result *htaccess; + + /* On systems with case insensitive file systems (Windows, OS/2, etc.), + * r->filename is case canonicalized (folded to either lower or upper + * case, depending on the specific system) to accomodate file access + * checking. case_preserved_filename is the same as r->filename + * except case is preserved. There is at least one instance where Apache + * needs access to the case preserved filename: Java class files + * published with WebDAV need to preserve filename case to make the + * Java compiler happy. + */ + char *case_preserved_filename; + + /* 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 + * binary compatibility for some other reason. + */ + + ap_ctx *ctx; }; @@ -809,47 +818,47 @@ struct request_rec { struct conn_rec { - ap_pool *pool; - server_rec *server; - server_rec *base_server; /* Physical vhost this conn come in on */ - void *vhost_lookup_data; /* used by http_vhost.c */ + ap_pool *pool; + server_rec *server; + server_rec *base_server;/* Physical vhost this conn come in on */ + void *vhost_lookup_data; /* used by http_vhost.c */ - /* Information about the connection itself */ + /* Information about the connection itself */ - int child_num; /* The number of the child handling conn_rec */ - BUFF *client; /* Connection to the guy */ + int child_num; /* The number of the child handling conn_rec */ + BUFF *client; /* Connection to the guy */ - /* Who is the client? */ + /* Who is the client? */ - struct sockaddr_in local_addr; /* local address */ - struct sockaddr_in remote_addr; /* remote address */ - char *remote_ip; /* Client's IP address */ - char *remote_host; /* Client's DNS name, if known. + struct sockaddr_in local_addr; /* local address */ + struct sockaddr_in remote_addr; /* remote address */ + char *remote_ip; /* Client's IP address */ + char *remote_host; /* Client's DNS name, if known. * NULL if DNS hasn't been checked, * "" if it has and no address was found. * N.B. Only access this though * get_remote_host() */ - char *remote_logname; /* Only ever set if doing rfc1413 lookups. + char *remote_logname; /* Only ever set if doing rfc1413 lookups. * N.B. Only access this through * get_remote_logname() */ - char *user; /* If an authentication check was made, + char *user; /* If an authentication check was made, * this gets set to the user name. We assume * that there's only one user per connection(!) */ - char *ap_auth_type; /* Ditto. */ + char *ap_auth_type; /* Ditto. */ - unsigned aborted:1; /* Are we still talking? */ - signed int keepalive:2; /* Are we using HTTP Keep-Alive? + unsigned aborted:1; /* Are we still talking? */ + signed int keepalive:2; /* Are we using HTTP Keep-Alive? * -1 fatal error, 0 undecided, 1 yes */ - unsigned keptalive:1; /* Did we use HTTP Keep-Alive? */ - signed int double_reverse:2;/* have we done double-reverse DNS? + unsigned keptalive:1; /* Did we use HTTP Keep-Alive? */ + signed int double_reverse:2;/* have we done double-reverse DNS? * -1 yes/failure, 0 not yet, 1 yes/success */ - int keepalives; /* How many times have we used it? */ - char *local_ip; /* server IP address */ - char *local_host; /* used for ap_get_server_name when + int keepalives; /* How many times have we used it? */ + char *local_ip; /* server IP address */ + char *local_host; /* used for ap_get_server_name when * UseCanonicalName is set to DNS * (ignores setting of HostnameLookups) */ - ap_ctx *ctx; + ap_ctx *ctx; }; /* Per-vhost config... */ @@ -861,78 +870,78 @@ struct conn_rec { typedef struct server_addr_rec server_addr_rec; struct server_addr_rec { - server_addr_rec *next; - struct in_addr host_addr; /* The bound address, for this server */ - unsigned short host_port; /* The bound port, for this server */ - char *virthost; /* The name given in <VirtualHost> */ + server_addr_rec *next; + struct in_addr host_addr; /* The bound address, for this server */ + unsigned short host_port; /* The bound port, for this server */ + char *virthost; /* The name given in <VirtualHost> */ }; struct server_rec { - server_rec *next; + server_rec *next; - /* description of where the definition came from */ - const char *defn_name; - unsigned defn_line_number; + /* description of where the definition came from */ + const char *defn_name; + unsigned defn_line_number; - /* Full locations of server config info */ + /* Full locations of server config info */ - char *srm_confname; - char *access_confname; + char *srm_confname; + char *access_confname; - /* Contact information */ + /* Contact information */ - char *server_admin; - char *server_hostname; - unsigned short port; /* for redirects, etc. */ + char *server_admin; + char *server_hostname; + unsigned short port; /* for redirects, etc. */ - /* Log files --- note that transfer log is now in the modules... */ + /* Log files --- note that transfer log is now in the modules... */ - char *error_fname; - FILE *error_log; - int loglevel; + char *error_fname; + FILE *error_log; + int loglevel; - /* Module-specific configuration for server, and defaults... */ + /* Module-specific configuration for server, and defaults... */ - int is_virtual; /* true if this is the virtual server */ - void *module_config; /* Config vector containing pointers to + int is_virtual; /* true if this is the virtual server */ + void *module_config; /* Config vector containing pointers to * modules' per-server config structures. */ - void *lookup_defaults; /* MIME type info, etc., before we start + void *lookup_defaults; /* MIME type info, etc., before we start * checking per-directory info. */ - /* Transaction handling */ - - server_addr_rec *addrs; - int timeout; /* Timeout, in seconds, before we give up */ - int keep_alive_timeout; /* Seconds we'll wait for another request */ - int keep_alive_max; /* Maximum requests per connection */ - int keep_alive; /* Use persistent connections? */ - int send_buffer_size; /* size of TCP send buffer (in bytes) */ - - char *path; /* Pathname for ServerPath */ - int pathlen; /* Length of path */ - - array_header *names; /* Normal names for ServerAlias servers */ - array_header *wild_names; /* Wildcarded names for ServerAlias servers */ - - uid_t server_uid; /* effective user id when calling exec wrapper */ - gid_t server_gid; /* effective group id when calling exec wrapper */ - - int limit_req_line; /* limit on size of the HTTP request line */ - int limit_req_fieldsize; /* limit on size of any request header field */ - int limit_req_fields; /* limit on number of request header fields */ - - ap_ctx *ctx; -}; - -/* These are more like real hosts than virtual hosts */ -struct listen_rec { - listen_rec *next; - struct sockaddr_in local_addr; /* local IP address and port */ - int fd; - int used; /* Only used during restart */ -/* more stuff here, like which protocol is bound to the port */ + /* Transaction handling */ + + server_addr_rec *addrs; + int timeout; /* Timeout, in seconds, before we give up */ + int keep_alive_timeout; /* Seconds we'll wait for another request */ + int keep_alive_max; /* Maximum requests per connection */ + int keep_alive; /* Use persistent connections? */ + int send_buffer_size; /* size of TCP send buffer (in bytes) */ + + char *path; /* Pathname for ServerPath */ + int pathlen; /* Length of path */ + + array_header *names; /* Normal names for ServerAlias servers */ + array_header *wild_names;/* Wildcarded names for ServerAlias servers */ + + uid_t server_uid; /* effective user id when calling exec wrapper */ + gid_t server_gid; /* effective group id when calling exec wrapper */ + + int limit_req_line; /* limit on size of the HTTP request line */ + int limit_req_fieldsize; /* limit on size of any request header field */ + int limit_req_fields; /* limit on number of request header fields */ + + ap_ctx *ctx; + }; + + /* These are more like real hosts than virtual hosts */ + struct listen_rec { + listen_rec *next; + struct sockaddr_in local_addr; /* local IP address and port */ + int fd; + int used; /* Only used during restart */ + /* more stuff here, like which protocol is bound to the port */ }; /* Prototypes for utilities... util.c. @@ -967,7 +976,8 @@ API_EXPORT(const char *) ap_size_list_item(const char **field, int *len); API_EXPORT(char *) ap_get_list_item(pool *p, const char **field); API_EXPORT(int) ap_find_list_item(pool *p, const char *line, const char *tok); -API_EXPORT(char *) ap_get_token(pool *p, const char **accept_line, int accept_white); +API_EXPORT(char *) ap_get_token(pool *p, const char **accept_line, + int accept_white); API_EXPORT(int) ap_find_token(pool *p, const char *line, const char *tok); API_EXPORT(int) ap_find_last_token(pool *p, const char *line, const char *tok); @@ -980,10 +990,10 @@ API_EXPORT(char *) ap_os_escape_path(pool *p, const char *path, int partial); #define ap_escape_uri(ppool,path) ap_os_escape_path(ppool,path,1) API_EXPORT(char *) ap_escape_html(pool *p, const char *s); API_EXPORT(char *) ap_construct_server(pool *p, const char *hostname, - unsigned port, const request_rec *r); + unsigned port, const request_rec *r); API_EXPORT(char *) ap_escape_logitem(pool *p, const char *str); API_EXPORT(size_t) ap_escape_errorlog_item(char *dest, const char *source, - size_t buflen); + size_t buflen); API_EXPORT(char *) ap_escape_shell_cmd(pool *p, const char *s); API_EXPORT(int) ap_count_dirs(const char *path); @@ -999,16 +1009,16 @@ API_EXPORT(int) ap_strcasecmp_match(const char *str, const char *exp); API_EXPORT(char *) ap_stripprefix(const char *bigstring, const char *prefix); API_EXPORT(char *) ap_strcasestr(const char *s1, const char *s2); API_EXPORT(char *) ap_pbase64decode(pool *p, const char *bufcoded); -API_EXPORT(char *) ap_pbase64encode(pool *p, char *string); +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); +API_EXPORT(char *) ap_uuencode(pool *p, char *string); 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, - char *errbuf, size_t errbuf_size); + size_t nmatch, regmatch_t pmatch[], int eflags); +API_EXPORT(size_t) ap_regerror(int errcode, const regex_t *preg, + char *errbuf, size_t errbuf_size); API_EXPORT(char *) ap_pregsub(pool *p, const char *input, const char *source, - size_t nmatch, regmatch_t pmatch[]); + size_t nmatch, regmatch_t pmatch[]); API_EXPORT(void) ap_content_type_tolower(char *); API_EXPORT(void) ap_str_tolower(char *); @@ -1021,7 +1031,8 @@ API_EXPORT(void) ap_remove_spaces(char *dest, char *src); /* Common structure for reading of config files / passwd files etc. */ typedef struct { int (*getch) (void *param); /* a getc()-like function */ - void *(*getstr) (void *buf, size_t bufsiz, void *param); /* a fgets()-like function */ + /* a fgets()-like function */ + void *(*getstr) (void *buf, size_t bufsiz, void *param); int (*close) (void *param); /* a close hander function */ void *param; /* the argument passed to getch/getstr/close */ const char *name; /* the filename / description */ @@ -1033,8 +1044,7 @@ API_EXPORT(configfile_t *) ap_pcfg_openfile(pool *p, const char *name); /* Allocate a configfile_t handle with user defined functions and params */ API_EXPORT(configfile_t *) ap_pcfg_open_custom(pool *p, const char *descr, - void *param, - int(*getc_func)(void*), + void *param, int(*getc_func)(void*), void *(*gets_func) (void *buf, size_t bufsiz, void *param), int(*close_func)(void *param)); @@ -1071,7 +1081,8 @@ API_EXPORT(char *) ap_os_canonical_filename(pool *p, const char *file); API_EXPORT(char *) ap_get_local_host(pool *); -API_EXPORT(unsigned long) ap_get_virthost_addr(char *hostname, unsigned short *port); +API_EXPORT(unsigned long) ap_get_virthost_addr(char *hostname, + unsigned short *port); extern API_VAR_EXPORT time_t ap_restart_time; @@ -1105,7 +1116,7 @@ API_EXPORT(char *) ap_escape_quotes(pool *p, const char *instr); * Redefine assert() to something more useful for an Apache... */ API_EXPORT(void) ap_log_assert(const char *szExp, const char *szFile, int nLine) - __attribute__((noreturn)); + __attribute__((noreturn)); #define ap_assert(exp) ((exp) ? (void)0 : ap_log_assert(#exp,__FILE__,__LINE__)) #define OPTIMIZE_TIMEOUTS diff --git a/usr.sbin/httpd/src/include/multithread.h b/usr.sbin/httpd/src/include/multithread.h index 2060a9a1a43..86a429e7575 100644 --- a/usr.sbin/httpd/src/include/multithread.h +++ b/usr.sbin/httpd/src/include/multithread.h @@ -1,3 +1,5 @@ +/* $OpenBSD: multithread.h,v 1.6 2005/03/28 23:26:51 niallo Exp $ */ + #ifndef APACHE_MULTITHREAD_H #define APACHE_MULTITHREAD_H diff --git a/usr.sbin/httpd/src/include/rfc1413.h b/usr.sbin/httpd/src/include/rfc1413.h index 76c3d221913..43e6bfd1707 100644 --- a/usr.sbin/httpd/src/include/rfc1413.h +++ b/usr.sbin/httpd/src/include/rfc1413.h @@ -1,3 +1,5 @@ +/* $OpenBSD: rfc1413.h,v 1.7 2005/03/28 23:26:51 niallo Exp $ */ + /* ==================================================================== * The Apache Software License, Version 1.1 * @@ -69,4 +71,4 @@ API_EXPORT(extern char *) ap_rfc1413(conn_rec *conn, server_rec *srv); } #endif -#endif /* !APACHE_RFC1413_H */ +#endif /* !APACHE_RFC1413_H */ diff --git a/usr.sbin/httpd/src/include/scoreboard.h b/usr.sbin/httpd/src/include/scoreboard.h index de6eb0174d3..cf3696ac1fc 100644 --- a/usr.sbin/httpd/src/include/scoreboard.h +++ b/usr.sbin/httpd/src/include/scoreboard.h @@ -1,3 +1,5 @@ +/* $OpenBSD: scoreboard.h,v 1.11 2005/03/28 23:26:51 niallo Exp $ */ + /* ==================================================================== * The Apache Software License, Version 1.1 * @@ -126,41 +128,41 @@ typedef int ap_generation_t; /* stuff which the children generally write, and the parent mainly reads */ typedef struct { - vtime_t cur_vtime; /* the child's current vtime */ - unsigned short timeout_len; /* length of the timeout */ - unsigned char status; - unsigned long access_count; - unsigned long bytes_served; - unsigned long my_access_count; - unsigned long my_bytes_served; - unsigned long conn_bytes; - unsigned short conn_count; - struct timeval start_time; - struct timeval stop_time; - struct tms times; - char client[32]; /* Keep 'em small... */ - char request[64]; /* We just want an idea... */ - server_rec *vhostrec; /* What virtual host is being accessed? */ - /* SEE ABOVE FOR SAFE USAGE! */ + vtime_t cur_vtime; /* the child's current vtime */ + unsigned short timeout_len; /* length of the timeout */ + unsigned char status; + unsigned long access_count; + unsigned long bytes_served; + unsigned long my_access_count; + unsigned long my_bytes_served; + unsigned long conn_bytes; + unsigned short conn_count; + struct timeval start_time; + struct timeval stop_time; + struct tms times; + char client[32]; /* Keep 'em small... */ + char request[64]; /* We just want an idea... */ + server_rec *vhostrec; /* What virtual host is being accessed? */ + /* SEE ABOVE FOR SAFE USAGE! */ } short_score; typedef struct { - ap_generation_t running_generation; /* the generation of children which + ap_generation_t running_generation;/* the generation of children which * should still be serving requests. */ } global_score; /* stuff which the parent generally writes and the children rarely read */ typedef struct { - pid_t pid; - time_t last_rtime; /* time(0) of the last change */ - vtime_t last_vtime; /* the last vtime the parent has seen */ - ap_generation_t generation; /* generation of this child */ + pid_t pid; + time_t last_rtime; /* time(0) of the last change */ + vtime_t last_vtime; /* the last vtime the parent has seen */ + ap_generation_t generation; /* generation of this child */ } parent_score; typedef struct { - short_score servers[HARD_SERVER_LIMIT]; - parent_score parent[HARD_SERVER_LIMIT]; - global_score global; + short_score servers[HARD_SERVER_LIMIT]; + parent_score parent[HARD_SERVER_LIMIT]; + global_score global; } scoreboard; #define SCOREBOARD_SIZE sizeof(scoreboard) diff --git a/usr.sbin/httpd/src/include/util_date.h b/usr.sbin/httpd/src/include/util_date.h index 8e7f6037511..d9538914655 100644 --- a/usr.sbin/httpd/src/include/util_date.h +++ b/usr.sbin/httpd/src/include/util_date.h @@ -1,3 +1,5 @@ +/* $OpenBSD: util_date.h,v 1.7 2005/03/28 23:26:51 niallo Exp $ */ + /* ==================================================================== * The Apache Software License, Version 1.1 * diff --git a/usr.sbin/httpd/src/include/util_md5.h b/usr.sbin/httpd/src/include/util_md5.h index 37ca1b380d6..a9c22a879f6 100644 --- a/usr.sbin/httpd/src/include/util_md5.h +++ b/usr.sbin/httpd/src/include/util_md5.h @@ -1,3 +1,5 @@ +/* $OpenBSD: util_md5.h,v 1.8 2005/03/28 23:26:51 niallo Exp $ */ + /* ==================================================================== * The Apache Software License, Version 1.1 * diff --git a/usr.sbin/httpd/src/include/util_script.h b/usr.sbin/httpd/src/include/util_script.h index 4d0980f4a22..35d40a6b955 100644 --- a/usr.sbin/httpd/src/include/util_script.h +++ b/usr.sbin/httpd/src/include/util_script.h @@ -1,3 +1,5 @@ +/* $OpenBSD: util_script.h,v 1.7 2005/03/28 23:26:51 niallo Exp $ */ + /* ==================================================================== * The Apache Software License, Version 1.1 * @@ -75,19 +77,17 @@ API_EXPORT(char **) ap_create_environment(pool *p, table *t); API_EXPORT(int) ap_find_path_info(const char *uri, const char *path_info); API_EXPORT(void) ap_add_cgi_vars(request_rec *r); API_EXPORT(void) ap_add_common_vars(request_rec *r); -API_EXPORT(int) ap_scan_script_header_err(request_rec *r, FILE *f, char *buffer); +API_EXPORT(int) ap_scan_script_header_err(request_rec *r, FILE *f, + char *buffer); API_EXPORT(int) ap_scan_script_header_err_buff(request_rec *r, BUFF *f, - char *buffer); + char *buffer); API_EXPORT(int) ap_scan_script_header_err_core(request_rec *r, char *buffer, - int (*getsfunc) (char *, int, void *), - void *getsfunc_data); -API_EXPORT_NONSTD(int) ap_scan_script_header_err_strs(request_rec *r, - char *buffer, - const char **termch, - int *termarg, ...); + int (*getsfunc) (char *, int, void *), void *getsfunc_data); +API_EXPORT_NONSTD(int) ap_scan_script_header_err_strs(request_rec *r, + char *buffer, const char **termch, int *termarg, ...); API_EXPORT(void) ap_send_size(size_t size, request_rec *r); -API_EXPORT(int) ap_call_exec(request_rec *r, child_info *pinfo, char *argv0, char **env, - int shellcmd); +API_EXPORT(int) ap_call_exec(request_rec *r, child_info *pinfo, char *argv0, + char **env, int shellcmd); #ifdef __cplusplus } diff --git a/usr.sbin/httpd/src/include/util_uri.h b/usr.sbin/httpd/src/include/util_uri.h index 8b2f8d1d326..cd47d801980 100644 --- a/usr.sbin/httpd/src/include/util_uri.h +++ b/usr.sbin/httpd/src/include/util_uri.h @@ -1,3 +1,5 @@ +/* $OpenBSD: util_uri.h,v 1.6 2005/03/28 23:26:51 niallo Exp $ */ + /* ==================================================================== * The Apache Software License, Version 1.1 * @@ -68,8 +70,8 @@ extern "C" { #endif typedef struct { - const char *name; - unsigned short default_port; + const char *name; + unsigned short default_port; } schemes_t; #define DEFAULT_FTP_DATA_PORT 20 @@ -83,33 +85,43 @@ typedef struct { #define DEFAULT_URI_SCHEME "http" /* Flags passed to unparse_uri_components(): */ -#define UNP_OMITSITEPART (1U<<0) /* suppress "scheme://user@site:port" */ -#define UNP_OMITUSER (1U<<1) /* Just omit user */ -#define UNP_OMITPASSWORD (1U<<2) /* Just omit password */ -#define UNP_OMITUSERINFO (UNP_OMITUSER|UNP_OMITPASSWORD) /* omit "user:password@" part */ -#define UNP_REVEALPASSWORD (1U<<3) /* Show plain text password (default: show XXXXXXXX) */ -#define UNP_OMITPATHINFO (1U<<4) /* Show "scheme://user@site:port" only */ -#define UNP_OMITQUERY (1U<<5) /* Omit the "?queryarg" from the path */ + +/* suppress "scheme://user@site:port" */ +#define UNP_OMITSITEPART (1U<<0) +/* Just omit user */ +#define UNP_OMITUSER (1U<<1) +/* Just omit password */ +#define UNP_OMITPASSWORD (1U<<2) +/* omit "user:password@" part */ +#define UNP_OMITUSERINFO (UNP_OMITUSER|UNP_OMITPASSWORD) +/* Show plain text password (default: show XXXXXXXX) */ +#define UNP_REVEALPASSWORD (1U<<3) +/* Show "scheme://user@site:port" only */ +#define UNP_OMITPATHINFO (1U<<4) +/* Omit the "?queryarg" from the path */ +#define UNP_OMITQUERY (1U<<5) typedef struct { - char *scheme; /* scheme ("http"/"ftp"/...) */ - char *hostinfo; /* combined [user[:password]@]host[:port] */ - char *user; /* user name, as in http://user:passwd@host:port/ */ - char *password; /* password, as in http://user:passwd@host:port/ */ - char *hostname; /* hostname from URI (or from Host: header) */ - char *port_str; /* port string (integer representation is in "port") */ - char *path; /* the request path (or "/" if only scheme://host was given) */ - char *query; /* Everything after a '?' in the path, if present */ - char *fragment; /* Trailing "#fragment" string, if present */ + char *scheme; /* scheme ("http"/"ftp"/...) */ + char *hostinfo; /* combined [user[:password]@]host[:port] */ + char *user; /* user name, as in http://user:passwd@host:port/ */ + char *password; /* password, as in http://user:passwd@host:port/ */ + char *hostname; /* hostname from URI (or from Host: header) */ + char *port_str; /* port string (integer representation is in "port") */ + char *path;/* request path (or "/" if only scheme://host was given)*/ + char *query; /* Everything after a '?' in the path, if present */ + char *fragment; /* Trailing "#fragment" string, if present */ + + struct hostent *hostent; - struct hostent *hostent; + unsigned short port; /* The port number, numeric, valid only if + * port_str != NULL + */ - unsigned short port; /* The port number, numeric, valid only if port_str != NULL */ - - unsigned is_initialized:1; + unsigned is_initialized:1; - unsigned dns_looked_up:1; - unsigned dns_resolved:1; + unsigned dns_looked_up:1; + unsigned dns_resolved:1; } uri_components; @@ -118,10 +130,12 @@ API_EXPORT(unsigned short) ap_default_port_for_scheme(const char *scheme_str); API_EXPORT(unsigned short) ap_default_port_for_request(const request_rec *r); API_EXPORT(struct hostent *) ap_pduphostent(pool *p, const struct hostent *hp); API_EXPORT(struct hostent *) ap_pgethostbyname(pool *p, const char *hostname); -API_EXPORT(char *) ap_unparse_uri_components(pool *p, const uri_components *uptr, - unsigned flags); -API_EXPORT(int) ap_parse_uri_components(pool *p, const char *uri, uri_components *uptr); -API_EXPORT(int) ap_parse_hostinfo_components(pool *p, const char *hostinfo, uri_components *uptr); +API_EXPORT(char *) ap_unparse_uri_components(pool *p, + const uri_components *uptr, unsigned flags); +API_EXPORT(int) ap_parse_uri_components(pool *p, const char *uri, + uri_components *uptr); +API_EXPORT(int) ap_parse_hostinfo_components(pool *p, const char *hostinfo, + uri_components *uptr); /* called by the core in main() */ extern void ap_util_uri_init(void); |