diff options
Diffstat (limited to 'main')
37 files changed, 0 insertions, 9637 deletions
diff --git a/main/SAPI.c b/main/SAPI.c deleted file mode 100644 index 09b1823f18..0000000000 --- a/main/SAPI.c +++ /dev/null @@ -1,357 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | PHP version 4.0 | - +----------------------------------------------------------------------+ - | Copyright (c) 1997, 1998, 1999 The PHP Group | - +----------------------------------------------------------------------+ - | This source file is subject to version 2.0 of the PHP license, | - | that is bundled with this package in the file LICENSE, and is | - | available at through the world-wide-web at | - | http://www.php.net/license/2_0.txt. | - | If you did not receive a copy of the PHP license and are unable to | - | obtain it through the world-wide-web, please send a note to | - | license@php.net so we can mail you a copy immediately. | - +----------------------------------------------------------------------+ - | Design: Shane Caraveo <shane@caraveo.com> | - | Authors: Andi Gutmans <andi@zend.com> | - | Zeev Suraski <zeev@zend.com> | - +----------------------------------------------------------------------+ -*/ - -#include <ctype.h> - -#include "php.h" -#include "SAPI.h" -#ifdef ZTS -#include "TSRM.h" -#endif - -#include "rfc1867.h" - -#if WIN32||WINNT -#define STRCASECMP stricmp -#else -#define STRCASECMP strcasecmp -#endif - - -SAPI_POST_READER_FUNC(sapi_read_standard_form_data); - -#define DEFAULT_POST_CONTENT_TYPE "application/x-www-form-urlencoded" - -static sapi_post_content_type_reader supported_post_content_types[] = { - { DEFAULT_POST_CONTENT_TYPE, sizeof(DEFAULT_POST_CONTENT_TYPE)-1, sapi_read_standard_form_data }, -#if HAVE_FDFLIB - { "application/vnd.fdf", sizeof("application/vnd.fdf")-1, sapi_read_standard_form_data }, -#endif - { NULL, 0, NULL } -}; - - -static HashTable known_post_content_types; - -SAPI_API void (*sapi_error)(int error_type, const char *message, ...); - - -#ifdef ZTS -SAPI_API int sapi_globals_id; -#else -sapi_globals_struct sapi_globals; -#endif - - -/* True globals (no need for thread safety) */ -sapi_module_struct sapi_module; -SAPI_API void (*sapi_error)(int error_type, const char *message, ...); - - -SAPI_API void sapi_startup(sapi_module_struct *sf) -{ - sapi_module = *sf; - zend_hash_init(&known_post_content_types, 5, NULL, NULL, 1); - - sapi_register_post_readers(supported_post_content_types); - -#ifdef ZTS - sapi_globals_id = ts_allocate_id(sizeof(sapi_globals_struct), NULL, NULL); -#endif - - php_global_startup_internal_extensions(); -} - -SAPI_API void sapi_shutdown(void) -{ - php_global_shutdown_internal_extensions(); - zend_hash_destroy(&known_post_content_types); -} - - -SAPI_API void sapi_free_header(sapi_header_struct *sapi_header) -{ - efree(sapi_header->header); -} - - -static void sapi_read_post_data(SLS_D) -{ - sapi_post_content_type_reader *post_content_type_reader; - uint content_type_length = strlen(SG(request_info).content_type); - char *content_type = estrndup(SG(request_info).content_type, content_type_length); - char *p; - char oldchar=0; - void (*post_reader_func)(char *content_type_dup SLS_DC); - - - /* dedicated implementation for increased performance: - * - Make the content type lowercase - * - Trim descriptive data, stay with the content-type only - */ - for (p=content_type; p<content_type+content_type_length; p++) { - switch (*p) { - case ';': - case ',': - case ' ': - content_type_length = p-content_type; - oldchar = *p; - *p = 0; - break; - default: - *p = tolower(*p); - break; - } - } - - if (zend_hash_find(&known_post_content_types, content_type, content_type_length+1, (void **) &post_content_type_reader)==SUCCESS) { - post_reader_func = post_content_type_reader->post_reader; - } else { - if (!sapi_module.default_post_reader) { - sapi_module.sapi_error(E_COMPILE_ERROR, "Unsupported content type: '%s'", content_type); - return; - } - post_reader_func = sapi_module.default_post_reader; - } - if (oldchar) { - *(p-1) = oldchar; - } - post_reader_func(content_type SLS_CC); - efree(content_type); -} - - -SAPI_POST_READER_FUNC(sapi_read_standard_form_data) -{ - int read_bytes, total_read_bytes=0; - int allocated_bytes=SAPI_POST_BLOCK_SIZE+1; - - SG(request_info).post_data = emalloc(allocated_bytes); - - for (;;) { - read_bytes = sapi_module.read_post(SG(request_info).post_data+total_read_bytes, SAPI_POST_BLOCK_SIZE SLS_CC); - if (read_bytes<=0) { - break; - } - total_read_bytes += read_bytes; - if (read_bytes < SAPI_POST_BLOCK_SIZE) { - break; - } - if (total_read_bytes+SAPI_POST_BLOCK_SIZE >= allocated_bytes) { - allocated_bytes = total_read_bytes+SAPI_POST_BLOCK_SIZE+1; - SG(request_info).post_data = erealloc(SG(request_info).post_data, allocated_bytes); - } - } - SG(request_info).post_data[total_read_bytes] = 0; /* terminating NULL */ - SG(request_info).post_data_length = total_read_bytes; -} - - -SAPI_API void sapi_activate(SLS_D) -{ - zend_llist_init(&SG(sapi_headers).headers, sizeof(sapi_header_struct), (void (*)(void *)) sapi_free_header, 0); - SG(sapi_headers).send_default_content_type = 1; - SG(sapi_headers).http_response_code = 200; - SG(sapi_headers).http_status_line = NULL; - SG(headers_sent) = 0; - SG(read_post_bytes) = 0; - SG(request_info).post_data = NULL; - - if (SG(request_info).request_method && !strcmp(SG(request_info).request_method, "HEAD")) { - SG(request_info).headers_only = 1; - } else { - SG(request_info).headers_only = 0; - } - - if (SG(server_context)) { - if (SG(request_info).request_method - && !strcmp(SG(request_info).request_method, "POST")) { - if (!SG(request_info).content_type) { - sapi_module.sapi_error(E_COMPILE_ERROR, "No content-type in POST request"); - } - sapi_read_post_data(SLS_C); - } - SG(request_info).cookie_data = sapi_module.read_cookies(SLS_C); - } -} - - -SAPI_API void sapi_deactivate(SLS_D) -{ - zend_llist_destroy(&SG(sapi_headers).headers); - if (SG(request_info).post_data) { - efree(SG(request_info).post_data); - } -} - -static int sapi_extract_response_code(const char *header_line) -{ - int code = 200; - const char *ptr; - - for (ptr = header_line; *ptr; ptr++) { - if (*ptr == ' ' && *(ptr + 1) != ' ') { - code = atoi(ptr + 1); - break; - } - } - - return code; -} - -/* This function expects a *duplicated* string, that was previously emalloc()'d. - * Pointers sent to this functions will be automatically freed by the framework. - */ -SAPI_API int sapi_add_header(char *header_line, uint header_line_len) -{ - int retval; - sapi_header_struct sapi_header; - char *colon_offset; - SLS_FETCH(); - - if (SG(headers_sent)) { - sapi_module.sapi_error(E_WARNING, "Cannot add header information - headers already sent"); - efree(header_line); - return FAILURE; - } - - sapi_header.header = header_line; - sapi_header.header_len = header_line_len; - - /* Check the header for a few cases that we have special support for in SAPI */ - if (header_line_len>=5 - && !memcmp(header_line, "HTTP/", 5)) { - /* filter out the response code */ - SG(sapi_headers).http_response_code = sapi_extract_response_code(header_line); - SG(sapi_headers).http_status_line = header_line; - return SUCCESS; - } else { - colon_offset = strchr(header_line, ':'); - if (colon_offset) { - *colon_offset = 0; - if (!STRCASECMP(header_line, "Content-Type")) { - SG(sapi_headers).send_default_content_type = 0; - } else if (!STRCASECMP(header_line, "Location")) { - SG(sapi_headers).http_response_code = 302; /* redirect */ - } else if (!STRCASECMP(header_line, "WWW-Authenticate")) { /* HTTP Authentication */ - SG(sapi_headers).http_response_code = 401; /* authentication-required */ - } - *colon_offset = ':'; - } - } - - if (sapi_module.header_handler) { - retval = sapi_module.header_handler(&sapi_header, &SG(sapi_headers) SLS_CC); - } else { - retval = SAPI_HEADER_ADD; - } - if (retval & SAPI_HEADER_DELETE_ALL) { - zend_llist_clean(&SG(sapi_headers).headers); - } - if (retval & SAPI_HEADER_ADD) { - zend_llist_add_element(&SG(sapi_headers).headers, (void *) &sapi_header); - } - return SUCCESS; -} - - -SAPI_API int sapi_send_headers() -{ - int retval; - int ret = FAILURE; - sapi_header_struct default_header = { SAPI_DEFAULT_CONTENT_TYPE, sizeof(SAPI_DEFAULT_CONTENT_TYPE)-1 }; - SLS_FETCH(); - - if (SG(headers_sent)) { - return SUCCESS; - } - - if (sapi_module.send_headers) { - retval = sapi_module.send_headers(&SG(sapi_headers) SLS_CC); - } else { - retval = SAPI_HEADER_DO_SEND; - } - - switch (retval) { - case SAPI_HEADER_SENT_SUCCESSFULLY: - SG(headers_sent) = 1; - ret = SUCCESS; - break; - case SAPI_HEADER_DO_SEND: - if (SG(sapi_headers).http_status_line) { - sapi_header_struct http_status_line; - - http_status_line.header = SG(sapi_headers).http_status_line; - http_status_line.header_len = strlen(SG(sapi_headers).http_status_line); - sapi_module.send_header(&http_status_line, SG(server_context)); - } - if (SG(sapi_headers).send_default_content_type) { - sapi_module.send_header(&default_header, SG(server_context)); - } - zend_llist_apply_with_argument(&SG(sapi_headers).headers, (void (*)(void *, void *)) sapi_module.send_header, SG(server_context)); - sapi_module.send_header(NULL, SG(server_context)); - SG(headers_sent) = 1; - ret = SUCCESS; - break; - case SAPI_HEADER_SEND_FAILED: - ret = FAILURE; - break; - } - - if (SG(sapi_headers).http_status_line) { - efree(SG(sapi_headers).http_status_line); - } - - return ret; -} - - -SAPI_API int sapi_register_post_readers(sapi_post_content_type_reader *post_content_type_readers) -{ - sapi_post_content_type_reader *p=post_content_type_readers; - - while (p->content_type) { - if (sapi_register_post_reader(p)==FAILURE) { - return FAILURE; - } - p++; - } - return SUCCESS; -} - - -SAPI_API int sapi_register_post_reader(sapi_post_content_type_reader *post_content_type_reader) -{ - return zend_hash_add(&known_post_content_types, post_content_type_reader->content_type, post_content_type_reader->content_type_len+1, (void *) post_content_type_reader, sizeof(sapi_post_content_type_reader), NULL); -} - - -SAPI_API void sapi_unregister_post_reader(sapi_post_content_type_reader *post_content_type_reader) -{ - zend_hash_del(&known_post_content_types, post_content_type_reader->content_type, post_content_type_reader->content_type_len+1); -} - - -SAPI_API int sapi_register_default_post_reader(void (*default_post_reader)(char *content_type_dup SLS_DC)) -{ - sapi_module.default_post_reader = default_post_reader; - return SUCCESS; -} - diff --git a/main/SAPI.h b/main/SAPI.h deleted file mode 100644 index 1e38d21bbe..0000000000 --- a/main/SAPI.h +++ /dev/null @@ -1,169 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | PHP version 4.0 | - +----------------------------------------------------------------------+ - | Copyright (c) 1997, 1998, 1999 The PHP Group | - +----------------------------------------------------------------------+ - | This source file is subject to version 2.0 of the PHP license, | - | that is bundled with this package in the file LICENSE, and is | - | available at through the world-wide-web at | - | http://www.php.net/license/2_0.txt. | - | If you did not receive a copy of the PHP license and are unable to | - | obtain it through the world-wide-web, please send a note to | - | license@php.net so we can mail you a copy immediately. | - +----------------------------------------------------------------------+ - | Authors: Zeev Suraski <zeev@zend.com> | - +----------------------------------------------------------------------+ -*/ - - -#ifndef _NEW_SAPI_H -#define _NEW_SAPI_H - -#include "zend.h" -#include "zend_llist.h" -#include "zend_operators.h" - -#define SAPI_POST_BLOCK_SIZE 4000 - -#if WIN32||WINNT -# ifdef SAPI_EXPORTS -# define SAPI_API __declspec(dllexport) -# else -# define SAPI_API __declspec(dllimport) -# endif -#else -#define SAPI_API -#endif - - -typedef struct { - char *header; - uint header_len; -} sapi_header_struct; - - -typedef struct { - zend_llist headers; - int http_response_code; - unsigned char send_default_content_type; - char *http_status_line; -} sapi_headers_struct; - - -typedef struct _sapi_module_struct sapi_module_struct; - - -extern sapi_module_struct sapi_module; /* true global */ - - -typedef struct { - char *request_method; - char *query_string; - char *post_data; - char *cookie_data; - uint content_length; - uint post_data_length; - - char *path_translated; - char *request_uri; - - char *content_type; - - unsigned char headers_only; - - /* for HTTP authentication */ - char *auth_user; - char *auth_password; -} sapi_request_info; - - -typedef struct { - void *server_context; - sapi_request_info request_info; - sapi_headers_struct sapi_headers; - uint read_post_bytes; - unsigned char headers_sent; -} sapi_globals_struct; - - -#ifdef ZTS -# define SLS_D sapi_globals_struct *sapi_globals -# define SLS_DC , SLS_D -# define SLS_C sapi_globals -# define SLS_CC , SLS_C -# define SG(v) (sapi_globals->v) -# define SLS_FETCH() sapi_globals_struct *sapi_globals = ts_resource(sapi_globals_id) -SAPI_API extern int sapi_globals_id; -#else -# define SLS_D void -# define SLS_DC -# define SLS_C -# define SLS_CC -# define SG(v) (sapi_globals.v) -# define SLS_FETCH() -extern SAPI_API sapi_globals_struct sapi_globals; -#endif - -typedef struct _sapi_post_content_type_reader { - char *content_type; - uint content_type_len; - void (*post_reader)(char *content_type_dup SLS_DC); -} sapi_post_content_type_reader; - - -SAPI_API void sapi_startup(sapi_module_struct *sf); -SAPI_API void sapi_shutdown(void); -SAPI_API void sapi_activate(SLS_D); -SAPI_API void sapi_deactivate(SLS_D); - -SAPI_API int sapi_add_header(char *header_line, uint header_line_len); -SAPI_API int sapi_send_headers(void); -SAPI_API void sapi_free_header(sapi_header_struct *sapi_header); - -SAPI_API int sapi_register_post_readers(sapi_post_content_type_reader *post_content_type_readers); -SAPI_API int sapi_register_post_reader(sapi_post_content_type_reader *post_content_type_reader); -SAPI_API void sapi_unregister_post_reader(sapi_post_content_type_reader *post_content_type_reader); -SAPI_API int sapi_register_default_post_reader(void (*default_post_reader)(char *content_type_dup SLS_DC)); - -struct _sapi_module_struct { - char *name; - - int (*startup)(struct _sapi_module_struct *sapi_module); - int (*shutdown)(struct _sapi_module_struct *sapi_module); - - int (*ub_write)(const char *str, unsigned int str_length); - - void (*sapi_error)(int type, const char *error_msg, ...); - - int (*header_handler)(sapi_header_struct *sapi_header, sapi_headers_struct *sapi_headers SLS_DC); - int (*send_headers)(sapi_headers_struct *sapi_headers SLS_DC); - void (*send_header)(sapi_header_struct *sapi_header, void *server_context); - - int (*read_post)(char *buffer, uint count_bytes SLS_DC); - char *(*read_cookies)(SLS_D); - - void (*default_post_reader)(char *content_type_dup SLS_DC); -}; - - -/* header_handler() constants */ -#define SAPI_HEADER_ADD (1<<0) -#define SAPI_HEADER_DELETE_ALL (1<<1) -#define SAPI_HEADER_SEND_NOW (1<<2) - - -#define SAPI_HEADER_SENT_SUCCESSFULLY 1 -#define SAPI_HEADER_DO_SEND 2 -#define SAPI_HEADER_SEND_FAILED 3 - -#define SAPI_DEFAULT_CONTENT_TYPE "Content-Type: text/html" -#define SAPI_PHP_VERSION_HEADER "X-Powered-By: PHP/" PHP_VERSION - -#define SAPI_POST_READER_FUNC(post_reader) void post_reader(char *content_type_dup SLS_DC) - -SAPI_POST_READER_FUNC(sapi_read_standard_form_data); - -#define STANDARD_SAPI_MODULE_PROPERTIES NULL - -#endif /* _NEW_SAPI_H */ diff --git a/main/alloca.c b/main/alloca.c deleted file mode 100644 index 7c6cd4f192..0000000000 --- a/main/alloca.c +++ /dev/null @@ -1,490 +0,0 @@ -/* alloca.c -- allocate automatically reclaimed memory - (Mostly) portable public-domain implementation -- D A Gwyn - - This implementation of the PWB library alloca function, - which is used to allocate space off the run-time stack so - that it is automatically reclaimed upon procedure exit, - was inspired by discussions with J. Q. Johnson of Cornell. - J.Otto Tennant <jot@cray.com> contributed the Cray support. - - There are some preprocessor constants that can - be defined when compiling for your specific system, for - improved efficiency; however, the defaults should be okay. - - The general concept of this implementation is to keep - track of all alloca-allocated blocks, and reclaim any - that are found to be deeper in the stack than the current - invocation. This heuristic does not reclaim storage as - soon as it becomes invalid, but it will do so eventually. - - As a special case, alloca(0) reclaims storage without - allocating any. It is a good idea to use alloca(0) in - your main control loop, etc. to force garbage collection. */ - -#include "php_config.h" - -#if !HAVE_ALLOCA - -#ifdef HAVE_STRING_H -#include <string.h> -#endif -#ifdef HAVE_STDLIB_H -#include <stdlib.h> -#endif - -#ifdef emacs -#include "blockinput.h" -#endif - -/* If compiling with GCC 2, this file's not needed. */ -#if !defined (__GNUC__) || __GNUC__ < 2 - -/* If someone has defined alloca as a macro, - there must be some other way alloca is supposed to work. */ -#ifndef alloca - -#ifdef emacs -#ifdef static -/* actually, only want this if static is defined as "" - -- this is for usg, in which emacs must undefine static - in order to make unexec workable - */ -#ifndef STACK_DIRECTION -you -lose --- must know STACK_DIRECTION at compile-time -#endif /* STACK_DIRECTION undefined */ -#endif /* static */ -#endif /* emacs */ - -/* If your stack is a linked list of frames, you have to - provide an "address metric" ADDRESS_FUNCTION macro. */ - -#if defined (CRAY) && defined (CRAY_STACKSEG_END) -long i00afunc (); -#define ADDRESS_FUNCTION(arg) (char *) i00afunc (&(arg)) -#else -#define ADDRESS_FUNCTION(arg) &(arg) -#endif - -#if __STDC__ -typedef void *pointer; -#else -typedef char *pointer; -#endif - -#ifndef NULL -#define NULL 0 -#endif - -/* Define STACK_DIRECTION if you know the direction of stack - growth for your system; otherwise it will be automatically - deduced at run-time. - - STACK_DIRECTION > 0 => grows toward higher addresses - STACK_DIRECTION < 0 => grows toward lower addresses - STACK_DIRECTION = 0 => direction of growth unknown */ - -#ifndef STACK_DIRECTION -#define STACK_DIRECTION 0 /* Direction unknown. */ -#endif - -#if STACK_DIRECTION != 0 - -#define STACK_DIR STACK_DIRECTION /* Known at compile-time. */ - -#else /* STACK_DIRECTION == 0; need run-time code. */ - -static int stack_dir; /* 1 or -1 once known. */ -#define STACK_DIR stack_dir - -static void -find_stack_direction () -{ - static char *addr = NULL; /* Address of first `dummy', once known. */ - auto char dummy; /* To get stack address. */ - - if (addr == NULL) - { /* Initial entry. */ - addr = ADDRESS_FUNCTION (dummy); - - find_stack_direction (); /* Recurse once. */ - } - else - { - /* Second entry. */ - if (ADDRESS_FUNCTION (dummy) > addr) - stack_dir = 1; /* Stack grew upward. */ - else - stack_dir = -1; /* Stack grew downward. */ - } -} - -#endif /* STACK_DIRECTION == 0 */ - -/* An "alloca header" is used to: - (a) chain together all alloca'ed blocks; - (b) keep track of stack depth. - - It is very important that sizeof(header) agree with malloc - alignment chunk size. The following default should work okay. */ - -#ifndef ALIGN_SIZE -#define ALIGN_SIZE sizeof(double) -#endif - -typedef union hdr -{ - char align[ALIGN_SIZE]; /* To force sizeof(header). */ - struct - { - union hdr *next; /* For chaining headers. */ - char *deep; /* For stack depth measure. */ - } h; -} header; - -static header *last_alloca_header = NULL; /* -> last alloca header. */ - -/* Return a pointer to at least SIZE bytes of storage, - which will be automatically reclaimed upon exit from - the procedure that called alloca. Originally, this space - was supposed to be taken from the current stack frame of the - caller, but that method cannot be made to work for some - implementations of C, for example under Gould's UTX/32. */ - -pointer -alloca (size) - size_t size; -{ - auto char probe; /* Probes stack depth: */ - register char *depth = ADDRESS_FUNCTION (probe); - -#if STACK_DIRECTION == 0 - if (STACK_DIR == 0) /* Unknown growth direction. */ - find_stack_direction (); -#endif - - /* Reclaim garbage, defined as all alloca'd storage that - was allocated from deeper in the stack than currently. */ - - { - register header *hp; /* Traverses linked list. */ - -#ifdef emacs - BLOCK_INPUT; -#endif - - for (hp = last_alloca_header; hp != NULL;) - if ((STACK_DIR > 0 && hp->h.deep > depth) - || (STACK_DIR < 0 && hp->h.deep < depth)) - { - register header *np = hp->h.next; - - free ((pointer) hp); /* Collect garbage. */ - - hp = np; /* -> next header. */ - } - else - break; /* Rest are not deeper. */ - - last_alloca_header = hp; /* -> last valid storage. */ - -#ifdef emacs - UNBLOCK_INPUT; -#endif - } - - if (size == 0) - return NULL; /* No allocation required. */ - - /* Allocate combined header + user data storage. */ - - { - register pointer new = malloc (sizeof (header) + size); - /* Address of header. */ - - if (new == 0) - abort(); - - ((header *) new)->h.next = last_alloca_header; - ((header *) new)->h.deep = depth; - - last_alloca_header = (header *) new; - - /* User storage begins just after header. */ - - return (pointer) ((char *) new + sizeof (header)); - } -} - -#if defined (CRAY) && defined (CRAY_STACKSEG_END) - -#ifdef DEBUG_I00AFUNC -#include <stdio.h> -#endif - -#ifndef CRAY_STACK -#define CRAY_STACK -#ifndef CRAY2 -/* Stack structures for CRAY-1, CRAY X-MP, and CRAY Y-MP */ -struct stack_control_header - { - long shgrow:32; /* Number of times stack has grown. */ - long shaseg:32; /* Size of increments to stack. */ - long shhwm:32; /* High water mark of stack. */ - long shsize:32; /* Current size of stack (all segments). */ - }; - -/* The stack segment linkage control information occurs at - the high-address end of a stack segment. (The stack - grows from low addresses to high addresses.) The initial - part of the stack segment linkage control information is - 0200 (octal) words. This provides for register storage - for the routine which overflows the stack. */ - -struct stack_segment_linkage - { - long ss[0200]; /* 0200 overflow words. */ - long sssize:32; /* Number of words in this segment. */ - long ssbase:32; /* Offset to stack base. */ - long:32; - long sspseg:32; /* Offset to linkage control of previous - segment of stack. */ - long:32; - long sstcpt:32; /* Pointer to task common address block. */ - long sscsnm; /* Private control structure number for - microtasking. */ - long ssusr1; /* Reserved for user. */ - long ssusr2; /* Reserved for user. */ - long sstpid; /* Process ID for pid based multi-tasking. */ - long ssgvup; /* Pointer to multitasking thread giveup. */ - long sscray[7]; /* Reserved for Cray Research. */ - long ssa0; - long ssa1; - long ssa2; - long ssa3; - long ssa4; - long ssa5; - long ssa6; - long ssa7; - long sss0; - long sss1; - long sss2; - long sss3; - long sss4; - long sss5; - long sss6; - long sss7; - }; - -#else /* CRAY2 */ -/* The following structure defines the vector of words - returned by the STKSTAT library routine. */ -struct stk_stat - { - long now; /* Current total stack size. */ - long maxc; /* Amount of contiguous space which would - be required to satisfy the maximum - stack demand to date. */ - long high_water; /* Stack high-water mark. */ - long overflows; /* Number of stack overflow ($STKOFEN) calls. */ - long hits; /* Number of internal buffer hits. */ - long extends; /* Number of block extensions. */ - long stko_mallocs; /* Block allocations by $STKOFEN. */ - long underflows; /* Number of stack underflow calls ($STKRETN). */ - long stko_free; /* Number of deallocations by $STKRETN. */ - long stkm_free; /* Number of deallocations by $STKMRET. */ - long segments; /* Current number of stack segments. */ - long maxs; /* Maximum number of stack segments so far. */ - long pad_size; /* Stack pad size. */ - long current_address; /* Current stack segment address. */ - long current_size; /* Current stack segment size. This - number is actually corrupted by STKSTAT to - include the fifteen word trailer area. */ - long initial_address; /* Address of initial segment. */ - long initial_size; /* Size of initial segment. */ - }; - -/* The following structure describes the data structure which trails - any stack segment. I think that the description in 'asdef' is - out of date. I only describe the parts that I am sure about. */ - -struct stk_trailer - { - long this_address; /* Address of this block. */ - long this_size; /* Size of this block (does not include - this trailer). */ - long unknown2; - long unknown3; - long link; /* Address of trailer block of previous - segment. */ - long unknown5; - long unknown6; - long unknown7; - long unknown8; - long unknown9; - long unknown10; - long unknown11; - long unknown12; - long unknown13; - long unknown14; - }; - -#endif /* CRAY2 */ -#endif /* not CRAY_STACK */ - -#ifdef CRAY2 -/* Determine a "stack measure" for an arbitrary ADDRESS. - I doubt that "lint" will like this much. */ - -static long -i00afunc (long *address) -{ - struct stk_stat status; - struct stk_trailer *trailer; - long *block, size; - long result = 0; - - /* We want to iterate through all of the segments. The first - step is to get the stack status structure. We could do this - more quickly and more directly, perhaps, by referencing the - $LM00 common block, but I know that this works. */ - - STKSTAT (&status); - - /* Set up the iteration. */ - - trailer = (struct stk_trailer *) (status.current_address - + status.current_size - - 15); - - /* There must be at least one stack segment. Therefore it is - a fatal error if "trailer" is null. */ - - if (trailer == 0) - abort (); - - /* Discard segments that do not contain our argument address. */ - - while (trailer != 0) - { - block = (long *) trailer->this_address; - size = trailer->this_size; - if (block == 0 || size == 0) - abort (); - trailer = (struct stk_trailer *) trailer->link; - if ((block <= address) && (address < (block + size))) - break; - } - - /* Set the result to the offset in this segment and add the sizes - of all predecessor segments. */ - - result = address - block; - - if (trailer == 0) - { - return result; - } - - do - { - if (trailer->this_size <= 0) - abort (); - result += trailer->this_size; - trailer = (struct stk_trailer *) trailer->link; - } - while (trailer != 0); - - /* We are done. Note that if you present a bogus address (one - not in any segment), you will get a different number back, formed - from subtracting the address of the first block. This is probably - not what you want. */ - - return (result); -} - -#else /* not CRAY2 */ -/* Stack address function for a CRAY-1, CRAY X-MP, or CRAY Y-MP. - Determine the number of the cell within the stack, - given the address of the cell. The purpose of this - routine is to linearize, in some sense, stack addresses - for alloca. */ - -static long -i00afunc (long address) -{ - long stkl = 0; - - long size, pseg, this_segment, stack; - long result = 0; - - struct stack_segment_linkage *ssptr; - - /* Register B67 contains the address of the end of the - current stack segment. If you (as a subprogram) store - your registers on the stack and find that you are past - the contents of B67, you have overflowed the segment. - - B67 also points to the stack segment linkage control - area, which is what we are really interested in. */ - - stkl = CRAY_STACKSEG_END (); - ssptr = (struct stack_segment_linkage *) stkl; - - /* If one subtracts 'size' from the end of the segment, - one has the address of the first word of the segment. - - If this is not the first segment, 'pseg' will be - nonzero. */ - - pseg = ssptr->sspseg; - size = ssptr->sssize; - - this_segment = stkl - size; - - /* It is possible that calling this routine itself caused - a stack overflow. Discard stack segments which do not - contain the target address. */ - - while (!(this_segment <= address && address <= stkl)) - { -#ifdef DEBUG_I00AFUNC - fprintf (stderr, "%011o %011o %011o\n", this_segment, address, stkl); -#endif - if (pseg == 0) - break; - stkl = stkl - pseg; - ssptr = (struct stack_segment_linkage *) stkl; - size = ssptr->sssize; - pseg = ssptr->sspseg; - this_segment = stkl - size; - } - - result = address - this_segment; - - /* If you subtract pseg from the current end of the stack, - you get the address of the previous stack segment's end. - This seems a little convoluted to me, but I'll bet you save - a cycle somewhere. */ - - while (pseg != 0) - { -#ifdef DEBUG_I00AFUNC - fprintf (stderr, "%011o %011o\n", pseg, size); -#endif - stkl = stkl - pseg; - ssptr = (struct stack_segment_linkage *) stkl; - size = ssptr->sssize; - pseg = ssptr->sspseg; - result += size; - } - return (result); -} - -#endif /* not CRAY2 */ -#endif /* CRAY */ - -#endif /* no alloca */ -#endif /* not GCC version 2 */ -#endif /* HAVE_ALLOCA */ diff --git a/main/config.w32.h b/main/config.w32.h deleted file mode 100644 index 81501d7d7c..0000000000 --- a/main/config.w32.h +++ /dev/null @@ -1,316 +0,0 @@ -/* config.w32.h. Configure file for win32 platforms */ -/* tested only with MS Visual C++ V5 */ - - -/* if you have resolv.lib and lib44bsd95.lib you can compile the extra - dns functions located in dns.c. Set this to 1. add resolv.lib and - lib33bsd95.lib to the project settings, and add the path to the - bind include directory to the preprocessor settings. These libs - are availabe in the ntbind distribution */ -#define HAVE_BINDLIB 1 - -/* set to enable bcmath */ -#define WITH_BCMATH 1 - -/* set to enable bundled PCRE library */ -#define HAVE_BUNDLED_PCRE 1 - -/* should be added to runtime config*/ -#define PHP3_URL_FOPEN 1 - -#define STDIN_FILENO 0 -#define STDOUT_FILENO 1 -#define STDERR_FILENO 2 - -/* ---------------------------------------------------------------- - The following are defaults for run-time configuration - ---------------------------------------------------------------*/ - -#define PHP_SAFE_MODE 0 -#define MAGIC_QUOTES 0 -/* This is the default configuration file to read */ -#define CONFIGURATION_FILE_PATH "php.ini" -#define USE_CONFIG_FILE 1 - -/* Undefine if you want stricter XML/SGML compliance by default */ -/* this disables "<?expression?>" and "<?=expression?>" */ -#define DEFAULT_SHORT_OPEN_TAG 1 - -#define PHP_TRACK_VARS 1 - -/* ---------------------------------------------------------------- - The following defines are for those modules which require - external libraries to compile. These will be removed from - here in a future beta, as these modules will be moved out to dll's - ---------------------------------------------------------------*/ -#if !defined(COMPILE_DL) -#define HAVE_SNMP 0 -# define HAVE_ERRMSG_H 0 /*needed for mysql 3.21.17 and up*/ -#define HAVE_LDAP 0 -#define DBASE 0 -#define NDBM 0 -#define GDBM 0 -#define BSD2 0 -#define HAVE_CRYPT 0 -#define HAVE_ORACLE 0 -#undef HAVE_ADABAS -#undef HAVE_SOLID -#define HAVE_MSQL 0 -#define HAVE_PGSQL 0 -#define HAVE_SYBASE 0 -#define HAVE_LIBGD 0 -#define HAVE_FILEPRO 0 -#define HAVE_ZLIB 0 -#endif -/* ---------------------------------------------------------------- - The following may or may not be (or need to be) ported to the - windows environment. - ---------------------------------------------------------------*/ - -/* Define if you have the link function. */ -#undef HAVE_LINK - -/* Define if you have the lockf function. */ -/* #undef HAVE_LOCKF */ - -/* Define if you have the lrand48 function. */ -/* #undef HAVE_LRAND48 */ - -/* Define if you have the srand48 function. */ -/* #undef HAVE_SRAND48 */ - -/* Define if you have the symlink function. */ -#undef HAVE_SYMLINK - -/* Define if you have the usleep function. */ -#undef HAVE_USLEEP - - -#define HAVE_GETCWD 1 - -#define NEED_ISBLANK 1 -/* ---------------------------------------------------------------- - The following may be changed and played with right now, but - will move to the "don't touch" list below eventualy. - ---------------------------------------------------------------*/ - -/*#define APACHE 0 defined in preprocessor section*/ - - -/* ---------------------------------------------------------------- - The following should never need to be played with - Functions defined to 0 or remarked out are either already - handled by the standard VC libraries, or are no longer needed, or - simply will/can not be ported. - - DONT TOUCH!!!!! Unless you realy know what your messing with! - ---------------------------------------------------------------*/ - -#define DISCARD_PATH 1 -#undef HAVE_SETITIMER -#undef HAVE_IODBC -#define HAVE_UODBC 1 -#define HAVE_LIBDL 1 -#define HAVE_SENDMAIL 1 -#define HAVE_GETTIMEOFDAY 1 -#define HAVE_PUTENV 1 -#define HAVE_LIMITS_H 1 - -#define HAVE_TZSET 1 -/* Define if you have the flock function. */ -#undef HAVE_FLOCK - -/* Define if using alloca.c. */ -/* #undef C_ALLOCA */ - -/* Define to one of _getb67, GETB67, getb67 for Cray-2 and Cray-YMP systems. - This function is required for alloca.c support on those systems. */ -/* #undef CRAY_STACKSEG_END */ - -/* Define to `int' if <sys/types.h> doesn't define. */ -/* #undef gid_t */ - -/* Define if you have alloca, as a function or macro. */ -#define HAVE_ALLOCA 1 - -/* Define if you have <alloca.h> and it should be used (not on Ultrix). */ -/* #undef HAVE_ALLOCA_H */ - -/* Define if you have <sys/time.h> */ -#undef HAVE_SYS_TIME_H - -/* Define if you have <signal.h> */ -#define HAVE_SIGNAL_H 1 - -/* Define if you don't have vprintf but do have _doprnt. */ -/* #undef HAVE_DOPRNT */ - -/* Define if your struct stat has st_blksize. */ -#undef HAVE_ST_BLKSIZE - -/* Define if your struct stat has st_blocks. */ -#undef HAVE_ST_BLOCKS - -/* Define if your struct stat has st_rdev. */ -#define HAVE_ST_RDEV 1 - -/* Define if utime(file, NULL) sets file's timestamp to the present. */ -#define HAVE_UTIME_NULL 1 - -/* Define if you have the vprintf function. */ -#define HAVE_VPRINTF 1 - -/* Define to `unsigned' if <sys/types.h> doesn't define. */ -/* #undef size_t */ - -/* If using the C implementation of alloca, define if you know the - direction of stack growth for your system; otherwise it will be - automatically deduced at run-time. - STACK_DIRECTION > 0 => grows toward higher addresses - STACK_DIRECTION < 0 => grows toward lower addresses - STACK_DIRECTION = 0 => direction of growth unknown - */ -/* #undef STACK_DIRECTION */ - -/* Define if you have the ANSI C header files. */ -#define STDC_HEADERS 1 - -/* Define if your <sys/time.h> declares struct tm. */ -/* #undef TM_IN_SYS_TIME */ - -/* Define to `int' if <sys/types.h> doesn't define. */ -/* #undef uid_t */ - -/* Define both of these if you want the bundled REGEX library */ -#define REGEX 1 -#define HSREGEX 1 - -#define HAVE_PCRE 1 - -/* Define if you have the gcvt function. */ -#define HAVE_GCVT 1 - -/* Define if you have the getlogin function. */ -#define HAVE_GETLOGIN 1 - -/* Define if you have the gettimeofday function. */ -#define HAVE_GETTIMEOFDAY 1 - -/* Define if you have the memcpy function. */ -#define HAVE_MEMCPY 1 - -/* Define if you have the strlcat function. */ -/* #undef HAVE_STRLCAT */ - -/* Define if you have the strlcpy function. */ -/* #undef HAVE_STRLCPY */ - -/* Define if you have the memmove function. */ -#define HAVE_MEMMOVE 1 - -/* Define if you have the putenv function. */ -#define HAVE_PUTENV 1 - -/* Define if you have the regcomp function. */ -#define HAVE_REGCOMP 1 - -/* Define if you have the setlocale function. */ -#define HAVE_SETLOCALE 1 - -#define HAVE_LOCALE_H 1 - -/* Define if you have the setvbuf function. */ -#ifndef HAVE_BINDLIB -#define HAVE_SETVBUF 1 -#endif - -/* Define if you have the snprintf function. */ -#define HAVE_SNPRINTF 1 -#define HAVE_VSNPRINTF 1 -/* Define if you have the strcasecmp function. */ -#define HAVE_STRCASECMP 1 - -/* Define if you have the strdup function. */ -#define HAVE_STRDUP 1 - -/* Define if you have the strerror function. */ -#define HAVE_STRERROR 1 - -/* Define if you have the strstr function. */ -#define HAVE_STRSTR 1 - -/* Define if you have the tempnam function. */ -#define HAVE_TEMPNAM 1 - -/* Define if you have the utime function. */ -#define HAVE_UTIME 1 - -/* Define if you have the <crypt.h> header file. */ -/* #undef HAVE_CRYPT_H */ - -/* Define if you have the <dirent.h> header file. */ -#undef HAVE_DIRENT_H - -/* Define if you have the <fcntl.h> header file. */ -#define HAVE_FCNTL_H 1 - -/* Define if you have the <grp.h> header file. */ -#define HAVE_GRP_H 0 - -/* Define if you have the <memory.h> header file. */ -#define HAVE_MEMORY_H 1 - -/* Define if you have the <ndir.h> header file. */ -/* #undef HAVE_NDIR_H */ - -/* Define if you have the <pwd.h> header file. */ -#define HAVE_PWD_H 1 - -/* Define if you have the <string.h> header file. */ -#define HAVE_STRING_H 1 - -/* Define if you have the <sys/dir.h> header file. */ -/* #undef HAVE_SYS_DIR_H */ - -/* Define if you have the <sys/file.h> header file. */ -#undef HAVE_SYS_FILE_H - -/* Define if you have the <sys/ndir.h> header file. */ -/* #undef HAVE_SYS_NDIR_H */ - -/* Define if you have the <sys/socket.h> header file. */ -#undef HAVE_SYS_SOCKET_H - -/* Define if you have the <sys/wait.h> header file. */ -#undef HAVE_SYS_WAIT_H - -/* Define if you have the <syslog.h> header file. */ -#define HAVE_SYSLOG_H 1 - -/* Define if you have the <unistd.h> header file. */ -#undef HAVE_UNISTD_H - -/* Define if you have the crypt library (-lcrypt). */ -/* #undef HAVE_LIBCRYPT 0 */ - -/* Define if you have the dl library (-ldl). */ -#define HAVE_LIBDL 1 - -/* Define if you have the m library (-lm). */ -#define HAVE_LIBM 1 - -/* Define if you have the nsl library (-lnsl). */ -/* #undef HAVE_LIBNSL */ - -/* Define if you have the socket library (-lsocket). */ -/* #undef HAVE_LIBSOCKET */ - -/* Define if you have the cuserid function. */ -#define HAVE_CUSERID 0 - -/* Define if you have the rint function. */ -#undef HAVE_RINT - -#define HAVE_STRFTIME 1 - -#define SIZEOF_INT 4 diff --git a/main/configuration-parser.y b/main/configuration-parser.y deleted file mode 100644 index 079edd4bb4..0000000000 --- a/main/configuration-parser.y +++ /dev/null @@ -1,440 +0,0 @@ -%{ -/* - +----------------------------------------------------------------------+ - | PHP version 4.0 | - +----------------------------------------------------------------------+ - | Copyright (c) 1997, 1998, 1999 The PHP Group | - +----------------------------------------------------------------------+ - | This source file is subject to version 2.0 of the PHP license, | - | that is bundled with this package in the file LICENSE, and is | - | available at through the world-wide-web at | - | http://www.php.net/license/2_0.txt. | - | If you did not receive a copy of the PHP license and are unable to | - | obtain it through the world-wide-web, please send a note to | - | license@php.net so we can mail you a copy immediately. | - +----------------------------------------------------------------------+ - | Authors: Zeev Suraski <zeev@zend.com> | - +----------------------------------------------------------------------+ - */ - - - -/* $Id$ */ - -#define DEBUG_CFG_PARSER 1 -#include "php.h" -#include "php_globals.h" -#include "php_ini.h" -#include "ext/standard/dl.h" -#include "ext/standard/file.h" -#include "ext/standard/php_browscap.h" -#include "zend_extensions.h" - -#undef YYPARSE_PARAM -#undef YYLEX_PARAM - -#if WIN32 -#define WIN32_LEAN_AND_MEAN -#include <windows.h> -#include <winbase.h> -#include "win32/wfile.h" -#endif - -#define YYSTYPE pval - -#define PARSING_MODE_CFG 0 -#define PARSING_MODE_BROWSCAP 1 - -static HashTable configuration_hash; -#ifndef THREAD_SAFE -extern HashTable browser_hash; -PHPAPI extern char *php3_ini_path; -#endif -static HashTable *active_zend_hash_table; -static pval *current_section; -static char *currently_parsed_filename; - -static int parsing_mode; - -pval yylval; - -extern int cfglex(pval *cfglval); -extern FILE *cfgin; -extern int cfglineno; -extern void init_cfg_scanner(void); - -pval *cfg_get_entry(char *name, uint name_length) -{ - pval *tmp; - - if (zend_hash_find(&configuration_hash, name, name_length, (void **) &tmp)==SUCCESS) { - return tmp; - } else { - return NULL; - } -} - - -PHPAPI int cfg_get_long(char *varname,long *result) -{ - pval *tmp,var; - - if (zend_hash_find(&configuration_hash,varname,strlen(varname)+1,(void **) &tmp)==FAILURE) { - *result=(long)NULL; - return FAILURE; - } - var = *tmp; - pval_copy_constructor(&var); - convert_to_long(&var); - *result = var.value.lval; - return SUCCESS; -} - - -PHPAPI int cfg_get_double(char *varname,double *result) -{ - pval *tmp,var; - - if (zend_hash_find(&configuration_hash,varname,strlen(varname)+1,(void **) &tmp)==FAILURE) { - *result=(double)0; - return FAILURE; - } - var = *tmp; - pval_copy_constructor(&var); - convert_to_double(&var); - *result = var.value.dval; - return SUCCESS; -} - - -PHPAPI int cfg_get_string(char *varname, char **result) -{ - pval *tmp; - - if (zend_hash_find(&configuration_hash,varname,strlen(varname)+1,(void **) &tmp)==FAILURE) { - *result=NULL; - return FAILURE; - } - *result = tmp->value.str.val; - return SUCCESS; -} - - -static void yyerror(char *str) -{ - fprintf(stderr,"PHP: Error parsing %s on line %d\n",currently_parsed_filename,cfglineno); -} - - -static int pvalue_config_destructor(pval *pvalue) -{ - if (pvalue->type == IS_STRING && pvalue->value.str.val != empty_string) { - free(pvalue->value.str.val); - } - return 1; -} - - -static int pvalue_browscap_destructor(pval *pvalue) -{ - if (pvalue->type == IS_OBJECT || pvalue->type == IS_ARRAY) { - zend_hash_destroy(pvalue->value.ht); - free(pvalue->value.ht); - } - return 1; -} - - -int php3_init_config(void) -{ - PLS_FETCH(); - - if (zend_hash_init(&configuration_hash, 0, NULL, (int (*)(void *))pvalue_config_destructor, 1)==FAILURE) { - return FAILURE; - } - -#if USE_CONFIG_FILE - { - char *env_location,*default_location,*php_ini_path; - int safe_mode_state = PG(safe_mode); - char *open_basedir = PG(open_basedir); - char *opened_path; - int free_default_location=0; - - env_location = getenv("PHPRC"); - if (!env_location) { - env_location=""; - } -#if WIN32|WINNT - { - if (php3_ini_path) { - default_location = php3_ini_path; - } else { - default_location = (char *) malloc(512); - - if (!GetWindowsDirectory(default_location,255)) { - default_location[0]=0; - } - free_default_location=1; - } - } -#else - if (!php3_ini_path) { - default_location = CONFIGURATION_FILE_PATH; - } else { - default_location = php3_ini_path; - } -#endif - -/* build a path */ - php_ini_path = (char *) malloc(sizeof(".")+strlen(env_location)+strlen(default_location)+2+1); - - if (!php3_ini_path) { -#if WIN32|WINNT - sprintf(php_ini_path,".;%s;%s",env_location,default_location); -#else - sprintf(php_ini_path,".:%s:%s",env_location,default_location); -#endif - } else { - /* if path was set via -c flag, only look there */ - strcpy(php_ini_path,default_location); - } - PG(safe_mode) = 0; - PG(open_basedir) = NULL; - cfgin = php3_fopen_with_path("php.ini","r",php_ini_path,&opened_path); - free(php_ini_path); - if (free_default_location) { - free(default_location); - } - PG(safe_mode) = safe_mode_state; - PG(open_basedir) = open_basedir; - - if (!cfgin) { -# if WIN32|WINNT - return FAILURE; -# else - return SUCCESS; /* having no configuration file is ok */ -# endif - } - - if (opened_path) { - pval tmp; - - tmp.value.str.val = opened_path; - tmp.value.str.len = strlen(opened_path); - tmp.type = IS_STRING; - zend_hash_update(&configuration_hash,"cfg_file_path",sizeof("cfg_file_path"),(void *) &tmp,sizeof(pval),NULL); -#if 0 - php_printf("INI file opened at '%s'\n",opened_path); -#endif - } - - init_cfg_scanner(); - active_zend_hash_table = &configuration_hash; - parsing_mode = PARSING_MODE_CFG; - currently_parsed_filename = "php.ini"; - yyparse(); - fclose(cfgin); - } - -#endif - - return SUCCESS; -} - - -PHP_MINIT_FUNCTION(browscap) -{ - char *browscap = INI_STR("browscap"); - - if (browscap) { - if (zend_hash_init(&browser_hash, 0, NULL, (int (*)(void *))pvalue_browscap_destructor, 1)==FAILURE) { - return FAILURE; - } - - cfgin = fopen(browscap, "r"); - if (!cfgin) { - php_error(E_WARNING,"Cannot open '%s' for reading", browscap); - return FAILURE; - } - init_cfg_scanner(); - active_zend_hash_table = &browser_hash; - parsing_mode = PARSING_MODE_BROWSCAP; - currently_parsed_filename = browscap; - yyparse(); - fclose(cfgin); - } - - return SUCCESS; -} - - -int php3_shutdown_config(void) -{ - zend_hash_destroy(&configuration_hash); - return SUCCESS; -} - - -PHP_MSHUTDOWN_FUNCTION(browscap) -{ - if (INI_STR("browscap")) { - zend_hash_destroy(&browser_hash); - } - return SUCCESS; -} - - -static void convert_browscap_pattern(pval *pattern) -{ - register int i,j; - char *t; - - for (i=0; i<pattern->value.str.len; i++) { - if (pattern->value.str.val[i]=='*' || pattern->value.str.val[i]=='?') { - break; - } - } - - if (i==pattern->value.str.len) { /* no wildcards */ - return; - } - - t = (char *) malloc(pattern->value.str.len*2); - - for (i=0,j=0; i<pattern->value.str.len; i++,j++) { - switch (pattern->value.str.val[i]) { - case '?': - t[j] = '.'; - break; - case '*': - t[j++] = '.'; - t[j] = '*'; - break; - case '.': - t[j++] = '\\'; - t[j] = '.'; - break; - default: - t[j] = pattern->value.str.val[i]; - break; - } - } - t[j]=0; - free(pattern->value.str.val); - pattern->value.str.val = t; - pattern->value.str.len = j; - return; -} - -%} - -%pure_parser -%token TC_STRING -%token TC_ENCAPSULATED_STRING -%token SECTION -%token CFG_TRUE -%token CFG_FALSE -%token EXTENSION -%token T_ZEND_EXTENSION -%token T_ZEND_EXTENSION_TS -%token T_ZEND_EXTENSION_DEBUG -%token T_ZEND_EXTENSION_DEBUG_TS - -%% - -statement_list: - statement_list statement - | /* empty */ -; - -statement: - string '=' string_or_value { -#if 0 - printf("'%s' = '%s'\n",$1.value.str.val,$3.value.str.val); -#endif - $3.type = IS_STRING; - if (parsing_mode==PARSING_MODE_CFG) { - zend_hash_update(active_zend_hash_table, $1.value.str.val, $1.value.str.len+1, &$3, sizeof(pval), NULL); - if (active_zend_hash_table == &configuration_hash) { - php_alter_ini_entry($1.value.str.val, $1.value.str.len+1, $3.value.str.val, $3.value.str.len+1, PHP_INI_SYSTEM); - } - } else if (parsing_mode==PARSING_MODE_BROWSCAP) { - php3_str_tolower($1.value.str.val,$1.value.str.len); - zend_hash_update(current_section->value.ht, $1.value.str.val, $1.value.str.len+1, &$3, sizeof(pval), NULL); - } - free($1.value.str.val); - } - | string { free($1.value.str.val); } - | EXTENSION '=' string { - pval dummy; -#if 0 - printf("Loading '%s'\n",$3.value.str.val); -#endif - - php_dl(&$3,MODULE_PERSISTENT,&dummy); - } - | T_ZEND_EXTENSION '=' string { -#if !defined(ZTS) && !ZEND_DEBUG - zend_load_extension($3.value.str.val); -#endif - free($3.value.str.val); - } - | T_ZEND_EXTENSION_TS '=' string { -#if defined(ZTS) && !ZEND_DEBUG - zend_load_extension($3.value.str.val); -#endif - free($3.value.str.val); - } - | T_ZEND_EXTENSION_DEBUG '=' string { -#if !defined(ZTS) && ZEND_DEBUG - zend_load_extension($3.value.str.val); -#endif - free($3.value.str.val); - } - | T_ZEND_EXTENSION_DEBUG_TS '=' string { -#if defined(ZTS) && ZEND_DEBUG - zend_load_extension($3.value.str.val); -#endif - free($3.value.str.val); - } - | SECTION { - if (parsing_mode==PARSING_MODE_BROWSCAP) { - pval tmp; - - /*printf("'%s' (%d)\n",$1.value.str.val,$1.value.str.len+1);*/ - tmp.value.ht = (HashTable *) malloc(sizeof(HashTable)); - zend_hash_init(tmp.value.ht, 0, NULL, (int (*)(void *))pvalue_config_destructor, 1); - tmp.type = IS_OBJECT; - zend_hash_update(active_zend_hash_table, $1.value.str.val, $1.value.str.len+1, (void *) &tmp, sizeof(pval), (void **) ¤t_section); - tmp.value.str.val = php3_strndup($1.value.str.val,$1.value.str.len); - tmp.value.str.len = $1.value.str.len; - tmp.type = IS_STRING; - convert_browscap_pattern(&tmp); - zend_hash_update(current_section->value.ht,"browser_name_pattern",sizeof("browser_name_pattern"),(void *) &tmp, sizeof(pval), NULL); - } - free($1.value.str.val); - } - | '\n' -; - - -string: - TC_STRING { $$ = $1; } - | TC_ENCAPSULATED_STRING { $$ = $1; } -; - -string_or_value: - string { $$ = $1; } - | CFG_TRUE { $$ = $1; } - | CFG_FALSE { $$ = $1; } - | '\n' { $$.value.str.val = strdup(""); $$.value.str.len=0; $$.type = IS_STRING; } -; - - -/* - * Local variables: - * tab-width: 4 - * c-basic-offset: 4 - * End: - */ diff --git a/main/configuration-scanner.l b/main/configuration-scanner.l deleted file mode 100644 index 91d5f3d6f2..0000000000 --- a/main/configuration-scanner.l +++ /dev/null @@ -1,179 +0,0 @@ -%{ - -/* - +----------------------------------------------------------------------+ - | PHP version 4.0 | - +----------------------------------------------------------------------+ - | Copyright (c) 1997, 1998, 1999 The PHP Group | - +----------------------------------------------------------------------+ - | This source file is subject to version 2.0 of the PHP license, | - | that is bundled with this package in the file LICENSE, and is | - | available at through the world-wide-web at | - | http://www.php.net/license/2_0.txt. | - | If you did not receive a copy of the PHP license and are unable to | - | obtain it through the world-wide-web, please send a note to | - | license@php.net so we can mail you a copy immediately. | - +----------------------------------------------------------------------+ - | Authors: Zeev Suraski <zeev@zend.com> | - +----------------------------------------------------------------------+ -*/ - - -#include "php.h" -#include "configuration-parser.h" - -#undef YYSTYPE -#define YYSTYPE pval - -#define YY_DECL cfglex(pval *cfglval) - - -void init_cfg_scanner() -{ - cfglineno=1; -} - - -%} - -%option noyywrap -%option yylineno - -%% - -<INITIAL>"extension" { -#if 0 - printf("found extension\n"); -#endif - return EXTENSION; -} - - -<INITIAL>"zend_extension" { - return T_ZEND_EXTENSION; -} - - -<INITIAL>"zend_extension_ts" { - return T_ZEND_EXTENSION_TS; -} - - -<INITIAL>"zend_extension_debug" { - return T_ZEND_EXTENSION_DEBUG; -} - - -<INITIAL>"zend_extension_debug_ts" { - return T_ZEND_EXTENSION_DEBUG_TS; -} - - -<INITIAL>[ ]*("true"|"on"|"yes")[ ]* { - cfglval->value.str.val = php3_strndup("1",1); - cfglval->value.str.len = 1; - cfglval->type = IS_STRING; - return CFG_TRUE; -} - - -<INITIAL>[ ]*("false"|"off"|"no")[ ]* { - cfglval->value.str.val = php3_strndup("",0); - cfglval->value.str.len = 0; - cfglval->type = IS_STRING; - return CFG_FALSE; -} - - -<INITIAL>[[][^[]+[\]]([\n]?|"\r\n"?) { - /* SECTION */ - - /* eat trailng ] */ - while (yyleng>0 && (yytext[yyleng-1]=='\n' || yytext[yyleng-1]=='\r' || yytext[yyleng-1]==']')) { - yyleng--; - yytext[yyleng]=0; - } - - /* eat leading [ */ - yytext++; - yyleng--; - - cfglval->value.str.val = php3_strndup(yytext,yyleng); - cfglval->value.str.len = yyleng; - cfglval->type = IS_STRING; - return SECTION; -} - - -<INITIAL>["][^\n\r"]*["] { - /* ENCAPSULATED TC_STRING */ - - /* eat trailing " */ - yytext[yyleng-1]=0; - - /* eat leading " */ - yytext++; - - cfglval->value.str.val = php3_strndup(yytext,yyleng); - cfglval->value.str.len = yyleng; - cfglval->type = IS_STRING; - return TC_ENCAPSULATED_STRING; -} - - -<INITIAL>[^=\n\r\t;"]+ { - /* STRING */ - register int i; - - /* eat trailing whitespace */ - for (i=yyleng-1; i>=0; i--) { - if (yytext[i]==' ' || yytext[i]=='\t') { - yytext[i]=0; - yyleng--; - } else { - break; - } - } - /* eat leading whitespace */ - while (yytext[0]) { - if (yytext[0]==' ' || yytext[0]=='\t') { - yytext++; - yyleng--; - } else { - break; - } - } - if (yyleng!=0) { - cfglval->value.str.val = php3_strndup(yytext,yyleng); - cfglval->value.str.len = yyleng; - cfglval->type = IS_STRING; - return TC_STRING; - } else { - /* whitespace */ - } -} - - - -<INITIAL>[=\n] { - return yytext[0]; -} - -<INITIAL>"\r\n" { - return '\n'; -} - -<INITIAL>[;][^\r\n]*[\r\n]? { - /* comment */ - return '\n'; -} - -<INITIAL>[ \t] { - /* eat whitespace */ -} - -<INITIAL>. { -#if DEBUG - php_error(E_NOTICE,"Unexpected character on line %d: '%s' (ASCII %d)\n",yylineno,yytext,yytext[0]); -#endif -} diff --git a/main/fopen_wrappers.c b/main/fopen_wrappers.c deleted file mode 100644 index c3f32dd15b..0000000000 --- a/main/fopen_wrappers.c +++ /dev/null @@ -1,1007 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | PHP version 4.0 | - +----------------------------------------------------------------------+ - | Copyright (c) 1997, 1998, 1999 The PHP Group | - +----------------------------------------------------------------------+ - | This source file is subject to version 2.0 of the PHP license, | - | that is bundled with this package in the file LICENSE, and is | - | available at through the world-wide-web at | - | http://www.php.net/license/2_0.txt. | - | If you did not receive a copy of the PHP license and are unable to | - | obtain it through the world-wide-web, please send a note to | - | license@php.net so we can mail you a copy immediately. | - +----------------------------------------------------------------------+ - | Authors: Rasmus Lerdorf <rasmus@lerdorf.on.ca> | - | Jim Winstead <jimw@php.net> | - +----------------------------------------------------------------------+ - */ -/* $Id$ */ - -/* Synced with php3 revision 1.66 1999-06-18 [ssb] */ - -#include "php.h" -#include "php_globals.h" -#include "SAPI.h" - -#include <stdio.h> -#include <stdlib.h> -#include <errno.h> -#include <sys/types.h> -#include <sys/stat.h> -#include <fcntl.h> - -#if MSVC5 -#include <windows.h> -#include <winsock.h> -#define O_RDONLY _O_RDONLY -#include "win32/param.h" -#else -#include <sys/param.h> -#endif - -#include "safe_mode.h" -#include "php_realpath.h" -#include "ext/standard/head.h" -#include "ext/standard/php_standard.h" -#include "zend_compile.h" - -#if HAVE_PWD_H -#if MSVC5 -#include "win32/pwd.h" -#else -#include <pwd.h> -#endif -#endif - -#include <sys/types.h> -#if HAVE_SYS_SOCKET_H -#include <sys/socket.h> -#endif - -#ifndef S_ISREG -#define S_ISREG(mode) (((mode)&S_IFMT) == S_IFREG) -#endif - -#if MSVC5 -#include <winsock.h> -#else -#include <netinet/in.h> -#include <netdb.h> -#include <arpa/inet.h> -#endif - -#if MSVC5 -#undef AF_UNIX -#endif - -#if defined(AF_UNIX) -#include <sys/un.h> -#endif - -static FILE *php3_fopen_url_wrapper(const char *path, char *mode, int options, int *issock, int *socketd, char **opened_path); - -int _php3_getftpresult(int socketd); - -/* - When open_basedir is not NULL, check if the given filename is located in - open_basedir. Returns -1 if error or not in the open_basedir, else 0 - - When open_basedir is NULL, always return 0 -*/ -PHPAPI int _php3_check_specific_open_basedir(char *basedir, char *path PLS_DC) -{ - char resolved_name[MAXPATHLEN]; - char resolved_basedir[MAXPATHLEN]; - char local_open_basedir[MAXPATHLEN]; - int local_open_basedir_pos; - SLS_FETCH(); - - /* Special case basedir==".": Use script-directory */ - if ((strcmp(PG(open_basedir), ".") == 0) && - SG(request_info).path_translated && - *SG(request_info).path_translated - ) { - strcpy(local_open_basedir, SG(request_info).path_translated); - local_open_basedir_pos = strlen(local_open_basedir) - 1; - - /* Strip filename */ - while (( -#if WIN32|WINNT - (local_open_basedir[local_open_basedir_pos] != '\\') || -#endif - (local_open_basedir[local_open_basedir_pos] != '/') - ) && - (local_open_basedir_pos >= 0) - ) { - local_open_basedir[local_open_basedir_pos--] = 0; - } - } else { - /* Else use the unmodified path */ - strcpy(local_open_basedir, basedir); - } - - /* Resolve the real path into resolved_name */ - if ((_php3_realpath(path, resolved_name) != NULL) && (_php3_realpath(local_open_basedir, resolved_basedir) != NULL)) { - /* Check the path */ -#if WIN32|WINNT - if (strncasecmp(resolved_basedir, resolved_name, strlen(resolved_basedir)) == 0) { -#else - if (strncmp(resolved_basedir, resolved_name, strlen(resolved_basedir)) == 0) { -#endif - /* File is in the right directory */ - return 0; - } else { - return -1; - } - } else { - /* Unable to resolve the real path, return -1 */ - return -1; - } -} - -PHPAPI int _php3_check_open_basedir(char *path) -{ - PLS_FETCH(); - - /* Only check when open_basedir is available */ - if (PG(open_basedir) && *PG(open_basedir)) { - char *pathbuf; - char *ptr; - char *end; - - pathbuf = estrdup(PG(open_basedir)); - - ptr = pathbuf; - - while (ptr && *ptr) { -#if WIN32|WINNT - end = strchr(ptr, ';'); -#else - end = strchr(ptr, ':'); -#endif - if (end != NULL) { - *end = '\0'; - end++; - } - - if (_php3_check_specific_open_basedir(ptr, path PLS_CC) == 0) { - efree(pathbuf); - return 0; - } - - ptr = end; - } - php_error(E_WARNING, "open_basedir restriction in effect. File is in wrong directory."); - efree(pathbuf); - return -1; - } - - /* Nothing to check... */ - return 0; -} - -PHPAPI FILE *php3_fopen_wrapper(char *path, char *mode, int options, int *issock, int *socketd, char **opened_path) -{ - int cm=2; /* checkuid mode: 2 = if file does not exist, check directory */ - PLS_FETCH(); - - if (opened_path) { - *opened_path = NULL; - } - - /* FIXME Lets not get in the habit of doing stuff like this. This should - be runtime enabled, NOT compile time. */ -#if PHP3_URL_FOPEN - if (!(options & IGNORE_URL)) { - return php3_fopen_url_wrapper(path, mode, options, issock, socketd, opened_path); - } -#endif - - if (options & USE_PATH && PG(include_path) != NULL) { - return php3_fopen_with_path(path, mode, PG(include_path), opened_path); - } else { - if(!strcmp(mode,"r") || !strcmp(mode,"r+")) cm=0; - if (options & ENFORCE_SAFE_MODE && PG(safe_mode) && (!_php3_checkuid(path, cm))) { - return NULL; - } - if (_php3_check_open_basedir(path)) return NULL; - return fopen(path, mode); - } -} - -#if CGI_BINARY || FHTTPD || USE_SAPI - -PHPAPI FILE *php3_fopen_for_parser(void) -{ - FILE *fp; - struct stat st; - char *temp, *path_info, *fn; - int l; - PLS_FETCH(); - SLS_FETCH(); - - fn = SG(request_info).path_translated; - path_info = SG(request_info).request_uri; -#if HAVE_PWD_H - if (PG(user_dir) && *PG(user_dir) - && path_info && '/' == path_info[0] && '~' == path_info[1]) { - - char user[32]; - struct passwd *pw; - char *s = strchr(path_info + 2, '/'); - - fn = NULL; /* discard the original filename, it must not be used */ - if (s) { /* if there is no path name after the file, do not bother - to try open the directory */ - l = s - (path_info + 2); - if (l > sizeof(user) - 1) - l = sizeof(user) - 1; - memcpy(user, path_info + 2, l); - user[l] = '\0'; - - pw = getpwnam(user); - if (pw && pw->pw_dir) { - fn = emalloc(strlen(PG(user_dir)) + strlen(path_info) + strlen(pw->pw_dir) + 4); - if (fn) { - strcpy(fn, pw->pw_dir); /* safe */ - strcat(fn, "/"); /* safe */ - strcat(fn, PG(user_dir)); /* safe */ - strcat(fn, "/"); /* safe */ - strcat(fn, s + 1); /* safe (shorter than path_info) */ - STR_FREE(SG(request_info).path_translated); - SG(request_info).path_translated = fn; - } - } - } - } else -#endif -#if WIN32 - if (PG(doc_root) && path_info && ('/' == *PG(doc_root) || - '\\' == *PG(doc_root) || strstr(PG(doc_root),":\\") || - strstr(PG(doc_root),":/"))) { -#else - if (PG(doc_root) && '/' == *PG(doc_root) && path_info) { -#endif - l = strlen(PG(doc_root)); - fn = emalloc(l + strlen(path_info) + 2); - if (fn) { - memcpy(fn, PG(doc_root), l); - if ('/' != fn[l - 1] || '\\' != fn[l - 1]) /* l is never 0 */ - fn[l++] = '/'; - if ('/' == path_info[0]) - l--; - strcpy(fn + l, path_info); - STR_FREE(SG(request_info).path_translated); - SG(request_info).path_translated = fn; - } - } /* if doc_root && path_info */ - if (!fn) { - /* we have to free SG(request_info).path_translated here because - php3_destroy_request_info assumes that it will get - freed when the include_names hash is emptied, but - we're not adding it in this case */ - STR_FREE(SG(request_info).path_translated); - SG(request_info).path_translated = NULL; - return NULL; - } - fp = fopen(fn, "r"); - - /* refuse to open anything that is not a regular file */ - if (fp && (0 > fstat(fileno(fp), &st) || !S_ISREG(st.st_mode))) { - fclose(fp); - fp = NULL; - } - if (!fp) { - php_error(E_CORE_ERROR, "Unable to open %s", fn); - STR_FREE(SG(request_info).path_translated); /* for same reason as above */ - return NULL; - } - - temp = estrdup(fn); - php_dirname(temp, strlen(temp)); - if (*temp) { - chdir(temp); - } - efree(temp); - SG(request_info).path_translated = fn; - - return fp; -} - -#endif /* CGI_BINARY || USE_SAPI */ - -/* - * Tries to open a file with a PATH-style list of directories. - * If the filename starts with "." or "/", the path is ignored. - */ -PHPAPI FILE *php3_fopen_with_path(char *filename, char *mode, char *path, char **opened_path) -{ - char *pathbuf, *ptr, *end; - char trypath[MAXPATHLEN + 1]; - struct stat sb; - FILE *fp; - int cm=2; - PLS_FETCH(); - - if (opened_path) { - *opened_path = NULL; - } - - if(!strcmp(mode,"r") || !strcmp(mode,"r+")) cm=0; - /* Relative path open */ - if (*filename == '.') { - if (PG(safe_mode) && (!_php3_checkuid(filename, cm))) { - return NULL; - } - if (_php3_check_open_basedir(filename)) return NULL; - fp = fopen(filename, mode); - if (fp && opened_path) { - *opened_path = expand_filepath(filename); - } - return fp; - } - /* Absolute path open - prepend document_root in safe mode */ -#if WIN32|WINNT - if ((*filename == '\\') || (*filename == '/') || (filename[1] == ':')) { -#else - if (*filename == '/') { -#endif - if (PG(safe_mode)) { - if(PG(doc_root)) { - snprintf(trypath, MAXPATHLEN, "%s%s", PG(doc_root), filename); - } else { - strlcpy(trypath,filename,sizeof(trypath)); - } - if (!_php3_checkuid(trypath, cm)) { - return NULL; - } - if (_php3_check_open_basedir(trypath)) return NULL; - fp = fopen(trypath, mode); - if (fp && opened_path) { - *opened_path = expand_filepath(trypath); - } - return fp; - } else { - if (_php3_check_open_basedir(filename)) return NULL; - return fopen(filename, mode); - } - } - if (!path || (path && !*path)) { - if (PG(safe_mode) && (!_php3_checkuid(filename, cm))) { - return NULL; - } - if (_php3_check_open_basedir(filename)) return NULL; - fp = fopen(filename, mode); - if (fp && opened_path) { - *opened_path = strdup(filename); - } - return fp; - } - pathbuf = estrdup(path); - - ptr = pathbuf; - - while (ptr && *ptr) { -#if WIN32|WINNT - end = strchr(ptr, ';'); -#else - end = strchr(ptr, ':'); -#endif - if (end != NULL) { - *end = '\0'; - end++; - } - snprintf(trypath, MAXPATHLEN, "%s/%s", ptr, filename); - if (PG(safe_mode)) { - if (stat(trypath, &sb) == 0 && (!_php3_checkuid(trypath, cm))) { - efree(pathbuf); - return NULL; - } - } - if ((fp = fopen(trypath, mode)) != NULL) { - if (_php3_check_open_basedir(trypath)) { - fclose(fp); - efree(pathbuf); - return NULL; - } - if (opened_path) { - *opened_path = expand_filepath(trypath); - } - efree(pathbuf); - return fp; - } - ptr = end; - } - efree(pathbuf); - return NULL; -} - -/* - * If the specified path starts with "http://" (insensitive to case), - * a socket is opened to the specified web server and a file pointer is - * position at the start of the body of the response (past any headers). - * This makes a HTTP/1.0 request, and knows how to pass on the username - * and password for basic authentication. - * - * If the specified path starts with "ftp://" (insensitive to case), - * a pair of sockets are used to request the specified file and a file - * pointer to the requested file is returned. Passive mode ftp is used, - * so if the server doesn't support this, it will fail! - * - * Otherwise, fopen is called as usual and the file pointer is returned. - */ - -static FILE *php3_fopen_url_wrapper(const char *path, char *mode, int options, int *issock, int *socketd, char **opened_path) -{ - url *resource; - int result; - char *scratch; - unsigned char *tmp; - - char tmp_line[512]; - char location[512]; - char hdr_line[8192]; - char *tpath, *ttpath; - int body = 0; - int reqok = 0; - int i, len; - - FILE *fp = NULL; - struct sockaddr_in server; - unsigned short portno; - - if (!strncasecmp(path, "http://", 7)) { - resource = url_parse((char *) path); - if (resource == NULL) { - php_error(E_WARNING, "Invalid URL specified, %s", path); - *issock = BAD_URL; - return NULL; - } - /* use port 80 if one wasn't specified */ - if (resource->port == 0) - resource->port = 80; - - *socketd = socket(AF_INET, SOCK_STREAM, 0); - if (*socketd == SOCK_ERR) { - SOCK_FCLOSE(*socketd); - *socketd = 0; - free_url(resource); - return NULL; - } - server.sin_family = AF_INET; - - if (lookup_hostname(resource->host, &server.sin_addr)) { - SOCK_FCLOSE(*socketd); - *socketd = 0; - free_url(resource); - return NULL; - } - server.sin_port = htons(resource->port); - - if (connect(*socketd, (struct sockaddr *) &server, sizeof(server)) == SOCK_CONN_ERR) { - SOCK_FCLOSE(*socketd); - *socketd = 0; - free_url(resource); - return NULL; - } -#if 0 - if ((fp = fdopen(*socketd, "r+")) == NULL) { - free_url(resource); - return NULL; - } -#ifdef HAVE_SETVBUF - if ((setvbuf(fp, NULL, _IONBF, 0)) != 0) { - free_url(resource); - return NULL; - } -#endif -#endif /*win32 */ - - strcpy(hdr_line, "GET "); - - /* tell remote http which file to get */ - if (resource->path != NULL) { - strlcat(hdr_line, resource->path, sizeof(hdr_line)); - } else { - strlcat(hdr_line, "/", sizeof(hdr_line)); - } - /* append the query string, if any */ - if (resource->query != NULL) { - strlcat(hdr_line, "?", sizeof(hdr_line)); - strlcat(hdr_line, resource->query, sizeof(hdr_line)); - } - strlcat(hdr_line, " HTTP/1.0\r\n", sizeof(hdr_line)); - SOCK_WRITE(hdr_line, *socketd); - - /* send authorization header if we have user/pass */ - if (resource->user != NULL && resource->pass != NULL) { - scratch = (char *) emalloc(strlen(resource->user) + strlen(resource->pass) + 2); - if (!scratch) { - free_url(resource); - return NULL; - } - strcpy(scratch, resource->user); - strcat(scratch, ":"); - strcat(scratch, resource->pass); - tmp = _php3_base64_encode((unsigned char *)scratch, strlen(scratch), NULL); - - if (snprintf(hdr_line, sizeof(hdr_line), - "Authorization: Basic %s\r\n", tmp) > 0) { - SOCK_WRITE(hdr_line, *socketd); - } - - efree(scratch); - efree(tmp); - } - /* if the user has configured who they are, send a From: line */ - if (cfg_get_string("from", &scratch) == SUCCESS) { - if (snprintf(hdr_line, sizeof(hdr_line), - "From: %s\r\n", scratch) > 0) { - SOCK_WRITE(hdr_line, *socketd); - } - - } - /* send a Host: header so name-based virtual hosts work */ - if (resource->port != 80) { - len = snprintf(hdr_line, sizeof(hdr_line), - "Host: %s:%i\r\n", resource->host, resource->port); - } else { - len = snprintf(hdr_line, sizeof(hdr_line), - "Host: %s\r\n", resource->host); - } - if (len > 0) { - SOCK_WRITE(hdr_line, *socketd); - } - - /* identify ourselves and end the headers */ - SOCK_WRITE("User-Agent: PHP/" PHP_VERSION "\r\n\r\n", *socketd); - - body = 0; - location[0] = '\0'; - if (!SOCK_FEOF(*socketd)) { - /* get response header */ - if (SOCK_FGETS(tmp_line, sizeof(tmp_line)-1, *socketd) != NULL) { - if (strncmp(tmp_line + 8, " 200 ", 5) == 0) { - reqok = 1; - } - } - } - /* Read past HTTP headers */ - while (!body && !SOCK_FEOF(*socketd)) { - if (SOCK_FGETS(tmp_line, sizeof(tmp_line)-1, *socketd) != NULL) { - char *p = tmp_line; - - tmp_line[sizeof(tmp_line)-1] = '\0'; - - while (*p) { - if (*p == '\n' || *p == '\r') { - *p = '\0'; - } - p++; - } - - if (!strncasecmp(tmp_line, "Location: ", 10)) { - strcpy(location, tmp_line + 10); - } - - if (tmp_line[0] == '\0') { - body = 1; - } - } - } - if (!reqok) { - SOCK_FCLOSE(*socketd); - *socketd = 0; - free_url(resource); - if (location[0] != '\0') { - return php3_fopen_url_wrapper(location, mode, options, issock, socketd, opened_path); - } else { - return NULL; - } - } - free_url(resource); - *issock = 1; - return (fp); - } else if (!strncasecmp(path, "php://", 6)) { - const char *res = path + 6; - - if (!strcasecmp(res, "stdin")) { - return fdopen(STDIN_FILENO, mode); - } else if (!strcasecmp(res, "stdout")) { - return fdopen(STDOUT_FILENO, mode); - } else if (!strcasecmp(res, "stderr")) { - return fdopen(STDERR_FILENO, mode); - } - } else if (!strncasecmp(path, "ftp://", 6)) { - resource = url_parse((char *) path); - if (resource == NULL) { - php_error(E_WARNING, "Invalid URL specified, %s", path); - *issock = BAD_URL; - return NULL; - } else if (resource->path == NULL) { - php_error(E_WARNING, "No file-path specified"); - free_url(resource); - *issock = BAD_URL; - return NULL; - } - /* use port 21 if one wasn't specified */ - if (resource->port == 0) - resource->port = 21; - - *socketd = socket(AF_INET, SOCK_STREAM, 0); - if (*socketd == SOCK_ERR) { - SOCK_FCLOSE(*socketd); - *socketd = 0; - free_url(resource); - return NULL; - } - server.sin_family = AF_INET; - - if (lookup_hostname(resource->host, &server.sin_addr)) { - SOCK_FCLOSE(*socketd); - *socketd = 0; - free_url(resource); - return NULL; - } - server.sin_port = htons(resource->port); - - if (connect(*socketd, (struct sockaddr *) &server, sizeof(server)) == SOCK_CONN_ERR) { - SOCK_FCLOSE(*socketd); - *socketd = 0; - free_url(resource); - return NULL; - } -#if 0 - if ((fpc = fdopen(*socketd, "r+")) == NULL) { - free_url(resource); - return NULL; - } -#ifdef HAVE_SETVBUF - if ((setvbuf(fpc, NULL, _IONBF, 0)) != 0) { - free_url(resource); - fclose(fpc); - return NULL; - } -#endif -#endif - - /* Start talking to ftp server */ - result = _php3_getftpresult(*socketd); - if (result > 299 || result < 200) { - free_url(resource); - SOCK_FCLOSE(*socketd); - *socketd = 0; - return NULL; - } - /* send the user name */ - SOCK_WRITE("USER ", *socketd); - if (resource->user != NULL) { - _php3_rawurldecode(resource->user, strlen(resource->user)); - SOCK_WRITE(resource->user, *socketd); - } else { - SOCK_WRITE("anonymous", *socketd); - } - SOCK_WRITE("\r\n", *socketd); - - /* get the response */ - result = _php3_getftpresult(*socketd); - - /* if a password is required, send it */ - if (result >= 300 && result <= 399) { - SOCK_WRITE("PASS ", *socketd); - if (resource->pass != NULL) { - _php3_rawurldecode(resource->pass, strlen(resource->pass)); - SOCK_WRITE(resource->pass, *socketd); - } else { - /* if the user has configured who they are, - send that as the password */ - if (cfg_get_string("from", &scratch) == SUCCESS) { - SOCK_WRITE(scratch, *socketd); - } else { - SOCK_WRITE("anonymous", *socketd); - } - } - SOCK_WRITE("\r\n", *socketd); - - /* read the response */ - result = _php3_getftpresult(*socketd); - if (result > 299 || result < 200) { - free_url(resource); - SOCK_FCLOSE(*socketd); - *socketd = 0; - return NULL; - } - } else if (result > 299 || result < 200) { - free_url(resource); - SOCK_FCLOSE(*socketd); - *socketd = 0; - return NULL; - } - - /* set the connection to be binary */ - SOCK_WRITE("TYPE I\r\n", *socketd); - result = _php3_getftpresult(*socketd); - if (result > 299 || result < 200) { - free_url(resource); - SOCK_FCLOSE(*socketd); - *socketd = 0; - return NULL; - } - - /* find out the size of the file (verifying it exists) */ - SOCK_WRITE("SIZE ", *socketd); - SOCK_WRITE(resource->path, *socketd); - SOCK_WRITE("\r\n", *socketd); - - /* read the response */ - result = _php3_getftpresult(*socketd); - if (mode[0] == 'r') { - /* when reading file, it must exist */ - if (result > 299 || result < 200) { - php_error(E_WARNING, "File not found"); - free_url(resource); - SOCK_FCLOSE(*socketd); - *socketd = 0; - errno = ENOENT; - return NULL; - } - } else { - /* when writing file, it must NOT exist */ - if (result <= 299 && result >= 200) { - php_error(E_WARNING, "File already exists"); - free_url(resource); - SOCK_FCLOSE(*socketd); - *socketd = 0; - errno = EEXIST; - return NULL; - } - } - - /* set up the passive connection */ - SOCK_WRITE("PASV\r\n", *socketd); - while (SOCK_FGETS(tmp_line, sizeof(tmp_line)-1, *socketd) && - !(isdigit((int) tmp_line[0]) && isdigit((int) tmp_line[1]) && - isdigit((int) tmp_line[2]) && tmp_line[3] == ' ')); - - /* make sure we got a 227 response */ - if (strncmp(tmp_line, "227", 3)) { - free_url(resource); - SOCK_FCLOSE(*socketd); - *socketd = 0; - return NULL; - } - /* parse pasv command (129,80,95,25,13,221) */ - tpath = tmp_line; - - /* skip over the "227 Some message " part */ - for (tpath += 4; *tpath && !isdigit((int) *tpath); tpath++); - if (!*tpath) { - free_url(resource); - SOCK_FCLOSE(*socketd); - *socketd = 0; - return NULL; - } - /* skip over the host ip, we just assume it's the same */ - for (i = 0; i < 4; i++) { - for (; isdigit((int) *tpath); tpath++); - if (*tpath == ',') { - tpath++; - } else { - SOCK_FCLOSE(*socketd); - *socketd = 0; - return NULL; - } - } - - /* pull out the MSB of the port */ - portno = (unsigned short) strtol(tpath, &ttpath, 10) * 256; - if (ttpath == NULL) { - /* didn't get correct response from PASV */ - free_url(resource); - SOCK_FCLOSE(*socketd); - *socketd = 0; - return NULL; - } - tpath = ttpath; - if (*tpath == ',') { - tpath++; - } else { - free_url(resource); - SOCK_FCLOSE(*socketd); - *socketd = 0; - return NULL; - } - - /* pull out the LSB of the port */ - portno += (unsigned short) strtol(tpath, &ttpath, 10); - - if (ttpath == NULL) { - /* didn't get correct response from PASV */ - free_url(resource); - SOCK_FCLOSE(*socketd); - *socketd = 0; - return NULL; - } - - if (mode[0] == 'r') { - /* retrieve file */ - SOCK_WRITE("RETR ", *socketd); - } else { - /* store file */ - SOCK_WRITE("STOR ", *socketd); - } - if (resource->path != NULL) { - SOCK_WRITE(resource->path, *socketd); - } else { - SOCK_WRITE("/", *socketd); - } - - /* close control connection */ - SOCK_WRITE("\r\nQUIT\r\n", *socketd); - SOCK_FCLOSE(*socketd); - - /* open the data channel */ - *socketd = socket(AF_INET, SOCK_STREAM, 0); - if (*socketd == SOCK_ERR) { - SOCK_FCLOSE(*socketd); - *socketd = 0; - free_url(resource); - return NULL; - } - server.sin_family = AF_INET; - - if (lookup_hostname(resource->host, &server.sin_addr)) { - free_url(resource); - SOCK_FCLOSE(*socketd); - *socketd = 0; - return NULL; - } - server.sin_port = htons(portno); - - if (connect(*socketd, (struct sockaddr *) &server, sizeof(server)) == SOCK_CONN_ERR) { - free_url(resource); - SOCK_FCLOSE(*socketd); - *socketd = 0; - return NULL; - } -#if 0 - if (mode[0] == 'r') { - if ((fp = fdopen(*socketd, "r+")) == NULL) { - free_url(resource); - return NULL; - } - } else { - if ((fp = fdopen(*socketd, "w+")) == NULL) { - free_url(resource); - return NULL; - } - } -#ifdef HAVE_SETVBUF - if ((setvbuf(fp, NULL, _IONBF, 0)) != 0) { - free_url(resource); - fclose(fp); - return NULL; - } -#endif -#endif - free_url(resource); - *issock = 1; - return (fp); - } else { - PLS_FETCH(); - - if (options & USE_PATH) { - fp = php3_fopen_with_path((char *) path, mode, PG(include_path), opened_path); - } else { - int cm=2; - if(!strcmp(mode,"r") || !strcmp(mode,"r+")) cm=0; - if (options & ENFORCE_SAFE_MODE && PG(safe_mode) && (!_php3_checkuid(path, cm))) { - fp = NULL; - } else { - if (_php3_check_open_basedir((char *) path)) { - fp = NULL; - } else { - fp = fopen(path, mode); - } - } - } - - *issock = 0; - - return (fp); - } - - /* NOTREACHED */ - SOCK_FCLOSE(*socketd); - *socketd = 0; - return NULL; -} - -int _php3_getftpresult(int socketd) -{ - char tmp_line[513]; - - while (SOCK_FGETS(tmp_line, sizeof(tmp_line)-1, socketd) && - !(isdigit((int) tmp_line[0]) && isdigit((int) tmp_line[1]) && - isdigit((int) tmp_line[2]) && tmp_line[3] == ' ')); - - return strtol(tmp_line, NULL, 10); -} - -PHPAPI int php3_isurl(char *path) -{ - return (!strncasecmp(path, "http://", 7) || !strncasecmp(path, "ftp://", 6)); -} - - -PHPAPI char *php3_strip_url_passwd(char *url) -{ - register char *p = url, *url_start; - - while (*p) { - if (*p==':' && *(p+1)=='/' && *(p+2)=='/') { - /* found protocol */ - url_start = p = p+3; - - while (*p) { - if (*p=='@') { - int i; - - for (i=0; i<3 && url_start<p; i++, url_start++) { - *url_start = '.'; - } - for (; *p; p++) { - *url_start++ = *p; - } - *url_start=0; - break; - } - p++; - } - return url; - } - p++; - } - return url; -} - - -PHPAPI char *expand_filepath(char *filepath) -{ - char *retval = NULL; - - if (filepath[0] == '.') { - char *cwd = malloc(MAXPATHLEN + 1); - - if (getcwd(cwd, MAXPATHLEN)) { - char *cwd_end = cwd + strlen(cwd); - - if (filepath[1] == '.') { /* parent directory - .. */ - /* erase the last directory name from the path */ - while (*cwd_end != '/') { - *cwd_end-- = 0; - } - filepath++; /* make filepath appear as a current directory path */ - } - if (cwd_end > cwd && *cwd_end == '/') { /* remove trailing slashes */ - *cwd_end-- = 0; - } - retval = (char *) malloc(strlen(cwd) + strlen(filepath) - 1 + 1); - strcpy(retval, cwd); - strcat(retval, filepath + 1); - free(cwd); - } - } - if (!retval) { - retval = strdup(filepath); - } - return retval; -} - -/* - * Local variables: - * tab-width: 4 - * c-basic-offset: 4 - * End: - */ diff --git a/main/fopen_wrappers.h b/main/fopen_wrappers.h deleted file mode 100644 index e92bd83a88..0000000000 --- a/main/fopen_wrappers.h +++ /dev/null @@ -1,89 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | PHP version 4.0 | - +----------------------------------------------------------------------+ - | Copyright (c) 1997, 1998, 1999 The PHP Group | - +----------------------------------------------------------------------+ - | This source file is subject to version 2.0 of the PHP license, | - | that is bundled with this package in the file LICENSE, and is | - | available at through the world-wide-web at | - | http://www.php.net/license/2_0.txt. | - | If you did not receive a copy of the PHP license and are unable to | - | obtain it through the world-wide-web, please send a note to | - | license@php.net so we can mail you a copy immediately. | - +----------------------------------------------------------------------+ - | Authors: Jim Winstead <jimw@php.net> | - +----------------------------------------------------------------------+ - */ -/* $Id$ */ - -/* Synced with php3 revision 1.25 1999-06-16 [ssb] */ - -#ifndef _FOPEN_WRAPPERS_H -#define _FOPEN_WRAPPERS_H - -#include "php_globals.h" - -#define IGNORE_PATH 0 -#define USE_PATH 1 -#define IGNORE_URL 2 -/* There's no USE_URL. */ -#if WIN32|WINNT -# define IGNORE_URL_WIN 2 -#else -# define IGNORE_URL_WIN 0 -#endif -#define ENFORCE_SAFE_MODE 4 - -#if WIN32|WINNT -# define SOCK_ERR INVALID_SOCKET -# define SOCK_CONN_ERR SOCKET_ERROR -# define SOCK_RECV_ERR SOCKET_ERROR -#else -# define SOCK_ERR -1 -# define SOCK_CONN_ERR -1 -# define SOCK_RECV_ERR -1 -#endif -#define SOCK_WRITE(d,s) send(s,d,strlen(d),0) -#define SOCK_WRITEL(d,l,s) send(s,d,l,0) -#define SOCK_FGETC(s) _php3_sock_fgetc((s)) -#define SOCK_FGETS(b,l,s) _php3_sock_fgets((b),(l),(s)) -#define SOCK_FEOF(sock) _php3_sock_feof((sock)) -#define SOCK_FREAD(ptr,size,sock) _php3_sock_fread((ptr),(size),(sock)) -#define SOCK_FCLOSE(s) _php3_sock_close(s) - -#define FP_FGETS(buf,len,sock,fp,issock) \ - ((issock)?SOCK_FGETS(buf,len,sock):fgets(buf,len,fp)) -#define FP_FREAD(buf,len,sock,fp,issock) \ - ((issock)?SOCK_FREAD(buf,len,sock):fread(buf,1,len,fp)) -#define FP_FEOF(sock,fp,issock) \ - ((issock)?SOCK_FEOF(sock):feof(fp)) -#define FP_FGETC(sock,fp,issock) \ - ((issock)?SOCK_FGETC(sock):fgetc(fp)) - -/* values for issock */ -#define IS_NOT_SOCKET 0 -#define IS_SOCKET 1 -#define BAD_URL 2 - -extern PHPAPI FILE *php3_fopen_wrapper(char *filename, char *mode, int options, int *issock, int *socketd, char **opened_path); - -PHPAPI FILE *php3_fopen_for_parser(void); - -extern PHPAPI int _php3_check_open_basedir(char *path); -extern PHPAPI int _php3_check_specific_open_basedir(char *basedir, char *path PLS_DC); - -extern PHPAPI FILE *php3_fopen_with_path(char *filename, char *mode, char *path, char **opened_path); - -extern PHPAPI int php3_isurl(char *path); -extern PHPAPI char *php3_strip_url_passwd(char *path); - -extern PHPAPI char *expand_filepath(char *filepath); - -#endif -/* - * Local variables: - * tab-width: 4 - * c-basic-offset: 4 - * End: - */ diff --git a/main/internal_functions.c.in b/main/internal_functions.c.in deleted file mode 100644 index da89aaab04..0000000000 --- a/main/internal_functions.c.in +++ /dev/null @@ -1,86 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | PHP version 4.0 | - +----------------------------------------------------------------------+ - | Copyright (c) 1997, 1998, 1999 The PHP Group | - +----------------------------------------------------------------------+ - | This source file is subject to version 2.0 of the PHP license, | - | that is bundled with this package in the file LICENSE, and is | - | available at through the world-wide-web at | - | http://www.php.net/license/2_0.txt. | - | If you did not receive a copy of the PHP license and are unable to | - | obtain it through the world-wide-web, please send a note to | - | license@php.net so we can mail you a copy immediately. | - +----------------------------------------------------------------------+ - | Authors: Andi Gutmans <andi@zend.com> | - | Zeev Suraski <zeev@zend.com> | - +----------------------------------------------------------------------+ - */ - - -/* $Id$ */ - -#include "php.h" -#include "main.h" -#include "modules.h" -#include "internal_functions_registry.h" -#include "zend_compile.h" -#include <stdarg.h> -#include <stdlib.h> -#include <stdio.h> - -@EXT_INCLUDE_CODE@ - -/* SNMP has to be moved to ext */ -/* #include "dl/snmp/php3_snmp.h" */ - -unsigned char first_arg_force_ref[] = { 1, BYREF_FORCE }; -unsigned char first_arg_allow_ref[] = { 1, BYREF_ALLOW }; -unsigned char second_arg_force_ref[] = { 2, BYREF_NONE, BYREF_FORCE }; -unsigned char second_arg_allow_ref[] = { 2, BYREF_NONE, BYREF_ALLOW }; - -zend_module_entry *php_builtin_extensions[] = { - phpext_regex_ptr, - phpext_dl_ptr, - phpext_file_ptr, - phpext_fsock_ptr, - phpext_head_ptr, - phpext_pack_ptr, - phpext_browscap_ptr, - phpext_crypt_ptr, - phpext_dir_ptr, - phpext_filestat_ptr, - phpext_mail_ptr, - phpext_syslog_ptr, - phpext_lcg_ptr, - phpext_metaphone_ptr, - phpext_output_ptr, - phpext_array_ptr, - phpext_assert_ptr, -@EXT_MODULE_PTRS@ -}; - -#define EXTCOUNT (sizeof(php_builtin_extensions)/sizeof(zend_module_entry *)) - - -int php_startup_internal_extensions(void) -{ - return php_startup_extensions(php_builtin_extensions, EXTCOUNT); -} - -int php_global_startup_internal_extensions(void) -{ - return php_global_startup_extensions(php_builtin_extensions, EXTCOUNT); -} - -int php_global_shutdown_internal_extensions(void) -{ - return php_global_shutdown_extensions(php_builtin_extensions, EXTCOUNT); -} - -/* - * Local variables: - * tab-width: 4 - * c-basic-offset: 4 - * End: - */ diff --git a/main/internal_functions_registry.h b/main/internal_functions_registry.h deleted file mode 100644 index b7d2a16129..0000000000 --- a/main/internal_functions_registry.h +++ /dev/null @@ -1,46 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | PHP version 4.0 | - +----------------------------------------------------------------------+ - | Copyright (c) 1997, 1998, 1999 The PHP Group | - +----------------------------------------------------------------------+ - | This source file is subject to version 2.0 of the PHP license, | - | that is bundled with this package in the file LICENSE, and is | - | available at through the world-wide-web at | - | http://www.php.net/license/2_0.txt. | - | If you did not receive a copy of the PHP license and are unable to | - | obtain it through the world-wide-web, please send a note to | - | license@php.net so we can mail you a copy immediately. | - +----------------------------------------------------------------------+ - | Authors: Andi Gutmans <andi@zend.com> | - | Zeev Suraski <zeev@zend.com> | - +----------------------------------------------------------------------+ - */ - - -/* $Id$ */ - -#ifndef _INTERNAL_FUNCTIONS_REGISTRY_H -#define _INTERNAL_FUNCTIONS_REGISTRY_H - -extern int php3_init_mime(INIT_FUNC_ARGS); - -#if APACHE -extern php3_module_entry apache_module_entry; -#define phpext_apache_ptr &apache_module_entry -extern void php3_virtual(INTERNAL_FUNCTION_PARAMETERS); -#else -#define phpext_apache_ptr NULL -#endif - -/* environment functions */ -extern int php3_init_environment(void); - -#endif - -/* - * Local variables: - * tab-width: 4 - * c-basic-offset: 4 - * End: - */ diff --git a/main/internal_functions_win32.c b/main/internal_functions_win32.c deleted file mode 100644 index b4666e8703..0000000000 --- a/main/internal_functions_win32.c +++ /dev/null @@ -1,117 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | PHP version 4.0 | - +----------------------------------------------------------------------+ - | Copyright (c) 1997, 1998, 1999 The PHP Group | - +----------------------------------------------------------------------+ - | This source file is subject to version 2.0 of the PHP license, | - | that is bundled with this package in the file LICENSE, and is | - | available at through the world-wide-web at | - | http://www.php.net/license/2_0.txt. | - | If you did not receive a copy of the PHP license and are unable to | - | obtain it through the world-wide-web, please send a note to | - | license@php.net so we can mail you a copy immediately. | - +----------------------------------------------------------------------+ - | Authors: Andi Gutmans <andi@zend.com> | - | Zeev Suraski <zeev@zend.com> | - +----------------------------------------------------------------------+ - */ - - -/* $Id$ */ - - -#include "php.h" -#include "main.h" -#include "modules.h" -#include "internal_functions_registry.h" -#include "zend_compile.h" -#include <stdarg.h> -#include <stdlib.h> -#include <stdio.h> - -#include "ext/bcmath/php_bcmath.h" -#include "ext/db/php_db.h" -#include "ext/gd/php_gd.h" -#include "ext/standard/dl.h" -#include "ext/standard/file.h" -#include "ext/standard/fsock.h" -#include "ext/standard/head.h" -#include "ext/standard/pack.h" -#include "ext/standard/php_browscap.h" -#include "ext/standard/php_crypt.h" -#include "ext/standard/php_dir.h" -#include "ext/standard/php_filestat.h" -#include "ext/standard/php_mail.h" -#include "ext/standard/php_syslog.h" -#include "ext/standard/php_standard.h" -#include "ext/standard/php_lcg.h" -#include "ext/standard/php_output.h" -#include "ext/standard/php_array.h" -#include "ext/standard/php_assert.h" -#include "ext/COM/php_COM.h" -#include "ext/standard/reg.h" -#include "ext/pcre/php_pcre.h" -#include "ext/odbc/php_odbc.h" -#include "ext/session/php_session.h" - -/* SNMP has to be moved to ext */ -/* #include "dl/snmp/php_snmp.h" */ - -unsigned char first_arg_force_ref[] = { 1, BYREF_FORCE }; -unsigned char first_arg_allow_ref[] = { 1, BYREF_ALLOW }; -unsigned char second_arg_force_ref[] = { 2, BYREF_NONE, BYREF_FORCE }; -unsigned char second_arg_allow_ref[] = { 2, BYREF_NONE, BYREF_ALLOW }; - -zend_module_entry *php_builtin_extensions[] = { - phpext_dl_ptr, - phpext_file_ptr, - phpext_fsock_ptr, - phpext_head_ptr, - phpext_pack_ptr, - phpext_browscap_ptr, - phpext_crypt_ptr, - phpext_dir_ptr, - phpext_filestat_ptr, - phpext_mail_ptr, - phpext_syslog_ptr, -#if WITH_BCMATH - phpext_bcmath_ptr, -#endif - phpext_standard_ptr, - COM_module_ptr, - phpext_regex_ptr, - phpext_pcre_ptr, - phpext_odbc_ptr, - phpext_lcg_ptr, - phpext_session_ptr, - phpext_output_ptr, - phpext_array_ptr, - phpext_assert_ptr -}; - -#define EXTCOUNT (sizeof(php_builtin_extensions)/sizeof(zend_module_entry *)) - - -int php_startup_internal_extensions(void) -{ - return php_startup_extensions(php_builtin_extensions, EXTCOUNT); -} - -int php_global_startup_internal_extensions(void) -{ - return php_global_startup_extensions(php_builtin_extensions, EXTCOUNT); -} - -int php_global_shutdown_internal_extensions(void) -{ - return php_global_shutdown_extensions(php_builtin_extensions, EXTCOUNT); -} - - -/* - * Local variables: - * tab-width: 4 - * c-basic-offset: 4 - * End: - */ diff --git a/main/logos.h b/main/logos.h deleted file mode 100644 index 348172eae3..0000000000 --- a/main/logos.h +++ /dev/null @@ -1,942 +0,0 @@ -#define CONTEXT_TYPE_IMAGE_GIF "Content-Type: image/gif" - -unsigned char php4_logo[] = { - 71, 73, 70, 56, 57, 97, 143, 0, 65, 0, - 247, 255, 0, 255, 255, 255, 8, 8, 8, 16, - 16, 16, 24, 24, 24, 33, 33, 33, 41, 41, - 41, 49, 49, 49, 66, 66, 66, 74, 74, 74, - 82, 82, 82, 90, 90, 90, 99, 99, 99, 107, - 107, 107, 115, 115, 115, 123, 123, 123, 132, 132, - 132, 140, 140, 140, 148, 148, 148, 156, 156, 156, - 165, 165, 165, 173, 173, 173, 181, 181, 181, 189, - 189, 189, 198, 198, 198, 206, 206, 206, 214, 214, - 214, 222, 222, 222, 231, 231, 231, 239, 239, 239, - 247, 247, 247, 165, 156, 156, 90, 82, 82, 231, - 222, 206, 255, 255, 247, 214, 214, 206, 189, 189, - 173, 165, 165, 148, 123, 123, 107, 41, 41, 33, - 115, 115, 90, 189, 189, 140, 156, 156, 107, 148, - 148, 99, 173, 173, 115, 198, 198, 132, 165, 165, - 107, 173, 173, 99, 198, 198, 107, 165, 165, 82, - 189, 189, 90, 214, 214, 99, 198, 198, 90, 181, - 181, 82, 198, 198, 82, 222, 222, 90, 41, 41, - 16, 231, 231, 90, 107, 107, 41, 173, 173, 66, - 66, 66, 24, 156, 156, 57, 231, 231, 82, 214, - 214, 74, 239, 239, 82, 24, 24, 8, 99, 99, - 33, 198, 198, 66, 148, 148, 49, 132, 132, 41, - 16, 16, 0, 214, 222, 90, 165, 173, 90, 140, - 148, 82, 156, 165, 99, 132, 140, 82, 173, 181, - 140, 156, 165, 123, 99, 107, 82, 90, 99, 82, - 99, 107, 99, 231, 239, 239, 148, 156, 156, 66, - 74, 74, 90, 99, 107, 231, 239, 247, 239, 247, - 255, 132, 140, 148, 90, 107, 132, 90, 99, 115, - 57, 66, 82, 66, 82, 115, 181, 189, 206, 148, - 156, 173, 140, 148, 165, 82, 90, 107, 74, 82, - 99, 8, 16, 33, 189, 206, 247, 132, 148, 189, - 66, 82, 123, 57, 74, 115, 74, 99, 165, 222, - 231, 255, 189, 198, 222, 90, 99, 123, 123, 140, - 189, 198, 206, 231, 165, 173, 198, 99, 107, 132, - 82, 90, 115, 181, 198, 255, 74, 82, 107, 156, - 173, 231, 107, 123, 173, 49, 57, 82, 41, 49, - 74, 90, 107, 165, 74, 90, 140, 82, 99, 156, - 33, 41, 66, 189, 198, 231, 123, 132, 165, 165, - 181, 239, 90, 99, 132, 140, 156, 214, 107, 123, - 181, 57, 66, 99, 99, 115, 173, 90, 107, 173, - 82, 99, 165, 99, 123, 214, 49, 66, 132, 24, - 33, 66, 33, 49, 107, 214, 222, 255, 206, 214, - 247, 181, 189, 222, 173, 181, 214, 165, 173, 206, - 148, 156, 189, 140, 148, 181, 132, 140, 173, 156, - 165, 206, 115, 123, 156, 107, 115, 148, 90, 99, - 140, 156, 173, 247, 115, 132, 206, 49, 57, 90, - 57, 66, 107, 41, 49, 82, 90, 107, 181, 82, - 99, 173, 41, 57, 123, 24, 33, 74, 57, 82, - 189, 206, 214, 255, 165, 173, 214, 148, 156, 198, - 115, 123, 165, 82, 90, 132, 148, 165, 255, 66, - 74, 115, 99, 115, 198, 41, 49, 90, 90, 107, - 198, 82, 99, 181, 33, 41, 82, 57, 74, 156, - 57, 74, 165, 74, 99, 214, 49, 66, 148, 66, - 90, 206, 41, 57, 132, 66, 90, 214, 41, 66, - 189, 24, 41, 123, 189, 198, 247, 173, 181, 231, - 156, 165, 214, 123, 132, 181, 90, 99, 148, 90, - 99, 156, 140, 156, 247, 74, 82, 132, 66, 74, - 123, 99, 115, 206, 107, 123, 222, 49, 57, 107, - 82, 99, 206, 66, 82, 173, 33, 41, 90, 57, - 74, 173, 74, 99, 239, 49, 66, 165, 49, 66, - 173, 57, 82, 231, 181, 189, 247, 148, 156, 214, - 140, 148, 206, 115, 123, 181, 107, 115, 173, 99, - 107, 165, 82, 90, 148, 66, 74, 132, 107, 123, - 239, 90, 107, 222, 74, 90, 198, 66, 82, 198, - 57, 74, 206, 148, 156, 222, 99, 107, 173, 107, - 115, 189, 123, 132, 222, 99, 107, 181, 99, 107, - 189, 74, 82, 148, 49, 57, 123, 33, 41, 115, - 57, 74, 214, 24, 33, 123, 16, 24, 107, 140, - 148, 239, 132, 140, 231, 115, 123, 214, 132, 140, - 247, 99, 107, 198, 41, 49, 140, 33, 41, 140, - 231, 231, 239, 247, 247, 255, 206, 206, 214, 181, - 181, 189, 156, 156, 165, 107, 107, 115, 123, 123, - 132, 214, 214, 231, 222, 222, 239, 90, 90, 99, - 115, 115, 132, 222, 222, 255, 99, 99, 115, 90, - 90, 107, 74, 74, 90, 148, 148, 181, 189, 189, - 239, 115, 115, 148, 198, 198, 255, 41, 41, 57, - 156, 156, 231, 156, 156, 239, 148, 148, 247, 33, - 33, 57, 24, 24, 57, 8, 8, 49, 0, 0, - 0, 44, 0, 0, 0, 0, 143, 0, 65, 0, - 0, 8, 255, 0, 1, 8, 28, 72, 176, 160, - 193, 131, 8, 19, 42, 92, 200, 176, 161, 67, - 135, 237, 182, 48, 138, 3, 201, 86, 45, 72, - 141, 214, 112, 120, 200, 177, 163, 67, 115, 28, - 216, 157, 75, 180, 198, 209, 34, 70, 141, 26, - 229, 201, 243, 169, 165, 203, 149, 41, 25, 45, - 90, 180, 102, 203, 25, 13, 84, 60, 122, 52, - 183, 37, 143, 45, 58, 182, 150, 213, 193, 85, - 103, 153, 29, 161, 144, 214, 228, 212, 201, 148, - 97, 135, 114, 231, 206, 40, 90, 68, 113, 153, - 85, 161, 145, 132, 94, 21, 90, 167, 171, 215, - 175, 68, 191, 214, 169, 245, 137, 94, 205, 12, - 229, 204, 53, 53, 168, 70, 204, 52, 59, 117, - 198, 120, 105, 114, 162, 238, 19, 47, 184, 172, - 214, 97, 179, 101, 173, 95, 129, 229, 212, 40, - 162, 165, 204, 150, 29, 59, 181, 150, 37, 190, - 26, 73, 108, 157, 172, 142, 29, 131, 194, 69, - 153, 104, 101, 202, 93, 35, 229, 89, 115, 110, - 41, 211, 68, 113, 108, 141, 153, 135, 100, 198, - 143, 211, 168, 127, 212, 40, 161, 165, 142, 45, - 102, 86, 202, 253, 229, 104, 142, 93, 34, 170, - 133, 109, 233, 182, 184, 213, 168, 81, 59, 186, - 233, 0, 21, 46, 92, 25, 29, 227, 198, 129, - 254, 52, 172, 251, 170, 215, 203, 149, 153, 213, - 193, 184, 70, 3, 199, 14, 157, 254, 212, 241, - 131, 4, 71, 234, 239, 167, 109, 168, 255, 24, - 83, 171, 14, 154, 12, 106, 103, 39, 12, 172, - 40, 78, 50, 101, 127, 114, 55, 55, 26, 156, - 184, 253, 251, 248, 243, 231, 55, 110, 88, 239, - 80, 232, 184, 48, 3, 201, 34, 231, 200, 166, - 144, 57, 142, 36, 195, 76, 2, 53, 128, 231, - 224, 105, 49, 180, 33, 20, 27, 34, 116, 160, - 94, 65, 84, 156, 33, 6, 50, 113, 116, 168, - 76, 110, 181, 0, 247, 147, 126, 36, 150, 104, - 162, 126, 71, 253, 55, 6, 51, 184, 140, 145, - 11, 40, 121, 108, 225, 89, 65, 138, 104, 231, - 132, 119, 15, 226, 160, 131, 15, 223, 205, 208, - 134, 29, 99, 188, 131, 129, 133, 234, 117, 112, - 134, 35, 27, 34, 131, 204, 123, 187, 141, 120, - 98, 137, 128, 8, 23, 37, 29, 83, 86, 41, - 229, 147, 196, 29, 21, 9, 101, 43, 186, 8, - 227, 22, 68, 10, 196, 142, 50, 203, 204, 99, - 196, 131, 63, 12, 17, 192, 63, 1, 240, 152, - 154, 143, 203, 136, 98, 197, 144, 127, 181, 131, - 200, 49, 98, 28, 147, 6, 50, 133, 29, 166, - 223, 148, 88, 6, 42, 40, 138, 203, 112, 153, - 139, 151, 244, 88, 7, 128, 39, 116, 84, 2, - 3, 154, 53, 172, 249, 207, 63, 58, 128, 231, - 130, 80, 111, 76, 176, 193, 90, 237, 116, 194, - 199, 49, 124, 164, 145, 12, 115, 131, 146, 56, - 141, 26, 84, 148, 147, 234, 170, 106, 76, 83, - 106, 160, 65, 181, 255, 56, 198, 172, 204, 228, - 1, 26, 46, 77, 160, 137, 3, 16, 147, 78, - 90, 41, 120, 108, 216, 34, 202, 59, 23, 132, - 201, 209, 33, 178, 192, 1, 199, 49, 75, 26, - 246, 106, 137, 98, 136, 80, 192, 180, 211, 154, - 96, 128, 6, 200, 60, 155, 31, 160, 247, 217, - 50, 212, 161, 99, 80, 70, 9, 13, 104, 238, - 208, 235, 164, 228, 130, 151, 132, 80, 94, 76, - 160, 232, 71, 134, 20, 35, 175, 49, 217, 58, - 171, 45, 137, 137, 72, 112, 238, 164, 5, 148, - 243, 199, 189, 131, 10, 53, 134, 40, 148, 72, - 129, 35, 120, 57, 76, 122, 67, 194, 148, 58, - 40, 67, 81, 111, 64, 80, 172, 67, 84, 112, - 18, 70, 24, 178, 164, 97, 47, 192, 36, 170, - 177, 192, 190, 255, 44, 192, 14, 199, 131, 146, - 73, 201, 29, 39, 60, 56, 196, 164, 69, 8, - 65, 132, 175, 14, 226, 112, 133, 45, 111, 60, - 80, 193, 166, 11, 153, 99, 136, 33, 22, 31, - 227, 231, 125, 86, 82, 121, 165, 208, 68, 7, - 109, 229, 52, 28, 24, 0, 114, 4, 137, 144, - 44, 40, 32, 203, 200, 113, 7, 18, 14, 70, - 58, 41, 15, 63, 188, 220, 176, 131, 14, 216, - 33, 202, 3, 238, 46, 68, 133, 25, 85, 24, - 50, 203, 31, 118, 56, 109, 34, 50, 27, 8, - 0, 242, 5, 98, 168, 29, 104, 212, 115, 80, - 253, 157, 16, 69, 76, 26, 132, 14, 58, 4, - 255, 49, 41, 17, 110, 126, 215, 181, 40, 14, - 72, 144, 65, 66, 230, 80, 97, 142, 57, 135, - 164, 177, 140, 147, 196, 113, 171, 182, 35, 232, - 128, 60, 0, 182, 114, 99, 185, 12, 37, 115, - 40, 1, 222, 13, 32, 239, 75, 4, 120, 239, - 120, 253, 64, 4, 135, 31, 100, 78, 21, 0, - 152, 131, 200, 198, 153, 235, 183, 197, 3, 32, - 31, 208, 78, 228, 67, 27, 157, 251, 238, 69, - 243, 14, 136, 29, 148, 88, 146, 242, 119, 230, - 134, 222, 43, 214, 169, 225, 80, 75, 45, 95, - 71, 128, 193, 65, 85, 168, 85, 133, 39, 118, - 4, 98, 98, 50, 137, 156, 145, 253, 246, 218, - 119, 207, 125, 34, 138, 28, 147, 12, 137, 237, - 36, 0, 178, 3, 84, 36, 98, 211, 246, 91, - 36, 130, 228, 248, 248, 33, 243, 253, 250, 244, - 107, 191, 190, 34, 98, 192, 79, 92, 37, 150, - 100, 97, 3, 120, 62, 224, 155, 0, 253, 246, - 15, 192, 129, 231, 5, 112, 249, 66, 225, 82, - 71, 16, 214, 1, 192, 12, 105, 72, 219, 137, - 18, 97, 1, 6, 48, 160, 1, 23, 204, 32, - 6, 55, 120, 193, 211, 81, 32, 3, 182, 209, - 159, 112, 146, 193, 129, 2, 212, 174, 1, 40, - 220, 96, 3, 28, 0, 1, 9, 84, 0, 132, - 142, 112, 21, 113, 206, 224, 1, 11, 166, 240, - 134, 56, 108, 192, 3, 36, 96, 1, 13, 176, - 67, 17, 240, 195, 133, 28, 255, 40, 145, 4, - 52, 161, 70, 107, 191, 250, 14, 19, 68, 35, - 15, 176, 189, 75, 32, 209, 3, 64, 59, 148, - 33, 193, 19, 177, 67, 1, 198, 203, 226, 164, - 16, 96, 1, 14, 28, 227, 74, 98, 56, 135, - 164, 180, 8, 178, 0, 40, 64, 4, 236, 200, - 150, 112, 218, 161, 52, 50, 150, 49, 1, 23, - 104, 7, 45, 160, 230, 7, 74, 40, 224, 96, - 15, 66, 34, 120, 112, 240, 8, 59, 248, 65, - 135, 20, 216, 200, 64, 168, 16, 61, 53, 208, - 161, 138, 215, 43, 71, 27, 221, 24, 58, 41, - 100, 128, 81, 194, 81, 132, 7, 24, 153, 197, - 7, 248, 139, 14, 108, 27, 0, 37, 203, 232, - 0, 14, 196, 45, 23, 148, 160, 132, 10, 140, - 248, 3, 30, 76, 42, 112, 168, 89, 194, 31, - 114, 241, 133, 7, 204, 41, 76, 230, 32, 155, - 33, 226, 128, 72, 19, 137, 33, 3, 99, 220, - 228, 185, 12, 224, 69, 225, 156, 129, 1, 186, - 12, 93, 5, 28, 65, 7, 49, 96, 32, 152, - 32, 83, 0, 21, 196, 96, 135, 74, 80, 194, - 15, 49, 32, 165, 16, 26, 244, 29, 22, 244, - 161, 14, 243, 208, 97, 216, 6, 114, 136, 157, - 209, 2, 145, 186, 35, 154, 35, 40, 16, 186, - 53, 5, 192, 156, 100, 252, 64, 57, 198, 199, - 142, 69, 34, 115, 82, 31, 56, 3, 29, 18, - 17, 1, 227, 157, 147, 77, 110, 100, 192, 20, - 235, 80, 255, 9, 94, 188, 225, 5, 164, 4, - 15, 11, 34, 232, 135, 120, 172, 67, 98, 97, - 106, 71, 49, 194, 192, 204, 161, 157, 232, 12, - 14, 0, 153, 1, 50, 64, 209, 115, 100, 0, - 3, 23, 152, 192, 2, 114, 121, 46, 116, 40, - 130, 14, 25, 112, 219, 190, 22, 112, 129, 10, - 152, 212, 164, 20, 120, 128, 38, 37, 58, 50, - 143, 129, 44, 1, 26, 200, 192, 57, 44, 122, - 14, 11, 72, 32, 1, 28, 157, 84, 0, 48, - 192, 40, 92, 84, 194, 15, 162, 72, 65, 64, - 81, 131, 2, 100, 52, 179, 137, 15, 160, 0, - 206, 4, 210, 9, 61, 24, 163, 150, 39, 154, - 70, 57, 14, 0, 178, 5, 156, 225, 15, 113, - 224, 16, 50, 210, 224, 137, 155, 32, 32, 116, - 11, 80, 3, 50, 42, 16, 58, 116, 28, 131, - 22, 105, 64, 171, 24, 196, 160, 136, 11, 136, - 116, 151, 236, 144, 170, 59, 39, 21, 1, 68, - 96, 85, 171, 141, 240, 132, 26, 50, 96, 66, - 144, 61, 96, 11, 81, 170, 131, 40, 42, 65, - 6, 117, 0, 212, 136, 44, 232, 130, 53, 176, - 225, 7, 119, 56, 224, 1, 30, 200, 64, 152, - 212, 192, 7, 99, 20, 102, 80, 153, 244, 43, - 36, 241, 227, 9, 13, 188, 181, 87, 215, 114, - 4, 237, 246, 37, 128, 12, 36, 231, 62, 103, - 152, 235, 63, 14, 160, 6, 90, 120, 246, 109, - 98, 56, 173, 56, 245, 149, 204, 145, 255, 9, - 39, 46, 162, 16, 69, 46, 28, 192, 132, 23, - 200, 0, 7, 192, 149, 193, 11, 152, 240, 8, - 160, 48, 99, 30, 83, 120, 0, 216, 206, 97, - 44, 79, 236, 9, 170, 39, 18, 195, 5, 66, - 71, 1, 90, 252, 169, 29, 95, 221, 23, 1, - 216, 113, 134, 143, 237, 203, 0, 182, 197, 143, - 26, 84, 155, 128, 45, 120, 130, 172, 251, 26, - 0, 7, 212, 136, 159, 63, 136, 17, 100, 82, - 8, 239, 33, 91, 4, 46, 162, 100, 101, 49, - 70, 193, 133, 31, 20, 248, 0, 8, 124, 208, - 88, 236, 136, 67, 31, 100, 27, 40, 122, 150, - 241, 28, 255, 210, 207, 21, 45, 183, 129, 118, - 80, 117, 95, 13, 144, 39, 126, 0, 113, 142, - 149, 158, 203, 1, 142, 72, 196, 104, 207, 133, - 128, 219, 145, 232, 28, 159, 221, 162, 124, 133, - 3, 151, 203, 60, 71, 20, 126, 64, 110, 3, - 14, 234, 194, 165, 14, 36, 17, 182, 80, 70, - 45, 94, 245, 75, 137, 26, 146, 124, 15, 222, - 101, 170, 8, 0, 50, 9, 124, 52, 126, 232, - 221, 215, 4, 60, 193, 14, 243, 237, 203, 1, - 18, 206, 207, 52, 46, 144, 211, 4, 140, 248, - 56, 36, 246, 207, 50, 198, 192, 185, 199, 182, - 240, 133, 130, 44, 8, 35, 44, 2, 221, 19, - 97, 183, 170, 77, 211, 79, 102, 247, 133, 0, - 42, 224, 18, 100, 24, 136, 27, 103, 33, 112, - 96, 49, 108, 128, 255, 199, 251, 162, 0, 49, - 245, 67, 11, 114, 130, 140, 1, 73, 38, 81, - 114, 198, 96, 137, 57, 168, 3, 2, 21, 208, - 128, 177, 10, 242, 9, 171, 64, 14, 75, 127, - 40, 71, 95, 207, 21, 129, 205, 114, 118, 186, - 126, 237, 128, 157, 207, 69, 128, 117, 230, 39, - 17, 222, 61, 87, 1, 52, 224, 137, 99, 238, - 43, 0, 26, 176, 174, 126, 58, 17, 209, 30, - 135, 249, 73, 66, 156, 195, 20, 32, 96, 129, - 65, 23, 36, 49, 174, 41, 149, 107, 67, 252, - 15, 184, 145, 15, 152, 111, 163, 66, 169, 207, - 149, 0, 15, 227, 135, 29, 57, 238, 149, 147, - 59, 65, 91, 74, 95, 50, 63, 127, 112, 48, - 200, 4, 160, 1, 53, 71, 181, 14, 156, 147, - 7, 171, 179, 124, 144, 242, 196, 122, 80, 142, - 8, 114, 175, 46, 215, 7, 253, 40, 2, 3, - 121, 35, 115, 170, 130, 61, 169, 191, 74, 142, - 14, 82, 133, 243, 185, 32, 160, 62, 92, 115, - 248, 201, 196, 161, 32, 88, 125, 253, 164, 168, - 221, 193, 11, 54, 163, 182, 65, 202, 131, 139, - 180, 133, 83, 119, 179, 131, 111, 57, 244, 115, - 12, 13, 168, 246, 31, 22, 184, 137, 133, 123, - 133, 142, 57, 223, 39, 13, 103, 222, 151, 5, - 244, 170, 218, 5, 156, 250, 62, 137, 208, 192, - 162, 123, 181, 83, 135, 159, 8, 16, 184, 152, - 195, 29, 154, 88, 1, 125, 23, 36, 15, 148, - 255, 153, 241, 160, 202, 119, 62, 121, 2, 66, - 25, 211, 72, 6, 45, 186, 154, 129, 236, 238, - 171, 215, 158, 128, 244, 185, 152, 45, 234, 251, - 100, 123, 217, 26, 72, 67, 133, 65, 6, 1, - 98, 194, 60, 230, 92, 173, 233, 198, 123, 245, - 128, 49, 9, 106, 12, 34, 143, 71, 82, 77, - 78, 16, 122, 80, 102, 25, 131, 74, 70, 57, - 212, 221, 171, 8, 104, 224, 28, 23, 56, 7, - 6, 48, 128, 142, 155, 230, 244, 31, 5, 200, - 128, 252, 216, 252, 221, 114, 200, 16, 181, 13, - 168, 157, 28, 39, 125, 174, 9, 100, 32, 236, - 98, 47, 105, 4, 14, 254, 15, 119, 116, 128, - 189, 88, 170, 196, 29, 238, 208, 128, 105, 43, - 228, 28, 204, 24, 67, 29, 6, 101, 204, 114, - 162, 243, 236, 148, 214, 192, 71, 23, 188, 47, - 6, 192, 123, 26, 202, 134, 240, 25, 60, 177, - 225, 115, 157, 83, 82, 144, 239, 213, 1, 58, - 224, 108, 205, 201, 1, 31, 89, 56, 232, 196, - 18, 210, 129, 45, 141, 225, 208, 38, 82, 68, - 177, 223, 249, 143, 4, 108, 224, 163, 152, 95, - 250, 63, 36, 208, 137, 252, 196, 97, 3, 11, - 159, 212, 4, 28, 161, 8, 35, 211, 254, 31, - 10, 40, 135, 199, 159, 52, 141, 92, 204, 129, - 31, 243, 56, 157, 8, 210, 147, 144, 69, 184, - 104, 241, 129, 82, 131, 187, 145, 25, 128, 6, - 244, 146, 14, 174, 205, 105, 255, 154, 243, 115, - 12, 157, 115, 92, 4, 98, 56, 3, 215, 131, - 73, 128, 8, 44, 243, 85, 148, 224, 199, 29, - 164, 174, 84, 134, 112, 0, 20, 185, 200, 5, - 236, 245, 35, 215, 119, 14, 160, 1, 27, 32, - 86, 196, 225, 8, 19, 192, 96, 128, 23, 111, - 108, 119, 46, 38, 32, 71, 24, 16, 122, 90, - 212, 126, 70, 34, 66, 88, 2, 114, 119, 192, - 15, 89, 208, 95, 93, 212, 16, 107, 144, 91, - 204, 128, 37, 179, 38, 81, 8, 128, 0, 7, - 32, 130, 33, 152, 0, 12, 176, 67, 113, 212, - 22, 247, 177, 5, 19, 112, 0, 35, 248, 130, - 250, 164, 31, 103, 176, 119, 36, 232, 130, 77, - 151, 6, 149, 83, 59, 36, 248, 5, 35, 136, - 0, 10, 192, 0, 16, 48, 1, 24, 208, 14, - 173, 37, 28, 151, 96, 34, 128, 2, 8, 80, - 35, 7, 252, 224, 103, 235, 144, 14, 79, 180, - 16, 144, 144, 91, 184, 240, 36, 231, 197, 96, - 237, 192, 14, 90, 184, 133, 220, 181, 5, 142, - 64, 24, 19, 38, 6, 92, 184, 133, 237, 240, - 69, 249, 65, 100, 89, 56, 134, 98, 224, 8, - 245, 180, 47, 5, 64, 5, 89, 88, 15, 245, - 176, 133, 106, 160, 61, 158, 192, 39, 82, 114, - 9, 231, 6, 52, 145, 19, 8, 130, 199, 15, - 173, 100, 5, 23, 48, 35, 11, 145, 1, 90, - 64, 6, 162, 128, 117, 80, 18, 112, 223, 117, - 59, 214, 255, 67, 28, 143, 184, 135, 36, 242, - 136, 38, 66, 137, 246, 113, 6, 113, 183, 47, - 31, 16, 94, 226, 96, 10, 37, 98, 10, 226, - 240, 113, 246, 49, 8, 191, 96, 129, 14, 96, - 15, 92, 16, 133, 12, 177, 129, 149, 144, 136, - 38, 82, 100, 47, 117, 99, 177, 19, 40, 128, - 48, 85, 32, 99, 5, 137, 128, 9, 82, 82, - 13, 186, 160, 135, 190, 168, 132, 74, 168, 11, - 158, 40, 138, 116, 144, 11, 164, 80, 8, 150, - 208, 0, 246, 64, 11, 23, 160, 19, 92, 64, - 88, 174, 168, 31, 90, 167, 123, 13, 240, 99, - 179, 136, 37, 200, 160, 1, 193, 247, 15, 107, - 96, 12, 215, 32, 14, 122, 88, 10, 197, 160, - 15, 187, 80, 142, 187, 224, 12, 186, 80, 10, - 224, 80, 10, 152, 176, 135, 220, 18, 37, 185, - 96, 9, 133, 128, 10, 202, 240, 9, 56, 72, - 136, 15, 209, 5, 149, 176, 143, 216, 135, 31, - 198, 148, 83, 19, 80, 122, 215, 104, 34, 158, - 96, 1, 64, 103, 93, 215, 80, 13, 130, 224, - 11, 117, 0, 1, 246, 192, 6, 246, 240, 14, - 108, 128, 13, 181, 48, 10, 215, 208, 11, 165, - 112, 9, 26, 9, 140, 192, 40, 52, 152, 144, - 13, 115, 96, 9, 131, 128, 10, 184, 128, 13, - 198, 112, 8, 22, 178, 58, 14, 244, 16, 86, - 240, 83, 126, 80, 133, 146, 163, 8, 5, 248, - 54, 18, 56, 144, 248, 146, 128, 160, 255, 69, - 5, 174, 18, 8, 215, 160, 15, 89, 128, 1, - 27, 192, 1, 66, 185, 1, 27, 0, 2, 7, - 112, 9, 187, 32, 8, 24, 121, 13, 26, 105, - 10, 215, 96, 10, 26, 121, 9, 111, 145, 13, - 131, 160, 13, 131, 112, 13, 94, 0, 2, 8, - 240, 13, 146, 192, 9, 240, 96, 6, 240, 64, - 125, 31, 241, 140, 63, 21, 141, 51, 180, 125, - 147, 66, 0, 231, 96, 147, 88, 66, 121, 231, - 194, 0, 178, 8, 8, 165, 32, 7, 29, 128, - 1, 43, 196, 0, 35, 0, 0, 15, 144, 9, - 165, 80, 10, 170, 192, 10, 208, 240, 12, 24, - 217, 11, 170, 240, 151, 207, 112, 13, 129, 144, - 13, 217, 48, 12, 190, 96, 10, 155, 240, 6, - 33, 48, 15, 223, 224, 6, 110, 96, 8, 100, - 35, 150, 14, 209, 1, 232, 160, 5, 126, 224, - 7, 149, 80, 133, 196, 81, 14, 11, 64, 0, - 212, 82, 0, 4, 208, 0, 136, 192, 150, 81, - 85, 14, 9, 64, 154, 212, 66, 0, 20, 112, - 106, 151, 240, 13, 162, 144, 0, 6, 240, 8, - 86, 80, 0, 27, 160, 1, 148, 80, 10, 186, - 160, 10, 131, 224, 5, 86, 176, 14, 126, 48, - 14, 193, 67, 9, 235, 240, 0, 126, 80, 8, - 169, 224, 11, 198, 153, 156, 16, 16, 153, 183, - 224, 6, 247, 0, 15, 81, 196, 20, 26, 192, - 6, 207, 4, 84, 88, 7, 8, 50, 66, 5, - 224, 185, 42, 229, 255, 32, 144, 170, 153, 31, - 103, 16, 158, 171, 2, 135, 162, 6, 8, 215, - 80, 12, 223, 96, 10, 200, 224, 6, 89, 80, - 1, 0, 144, 0, 166, 32, 8, 206, 192, 11, - 13, 0, 0, 33, 0, 0, 29, 96, 2, 19, - 32, 2, 214, 209, 159, 37, 160, 13, 195, 144, - 0, 27, 65, 36, 8, 48, 157, 247, 96, 8, - 85, 112, 157, 58, 177, 1, 93, 64, 48, 207, - 148, 11, 138, 88, 158, 215, 104, 10, 186, 80, - 13, 213, 112, 11, 104, 80, 2, 122, 41, 15, - 146, 176, 11, 168, 240, 1, 0, 16, 119, 3, - 176, 0, 154, 144, 5, 0, 128, 1, 252, 208, - 15, 19, 0, 0, 7, 128, 15, 33, 112, 1, - 248, 208, 15, 14, 0, 0, 243, 224, 13, 148, - 105, 157, 43, 201, 20, 117, 201, 6, 206, 68, - 9, 159, 121, 161, 19, 230, 59, 72, 218, 59, - 74, 250, 111, 14, 245, 113, 186, 160, 15, 199, - 176, 0, 0, 80, 1, 115, 160, 15, 225, 224, - 11, 8, 176, 1, 230, 32, 1, 19, 144, 0, - 221, 64, 12, 119, 192, 1, 16, 160, 13, 209, - 48, 7, 39, 170, 0, 29, 192, 15, 175, 176, - 13, 144, 57, 15, 12, 234, 160, 139, 227, 23, - 29, 176, 1, 19, 208, 6, 117, 244, 76, 162, - 208, 143, 24, 74, 50, 128 , - 32, 14, 213, 160, 15, 223, 160, 9, 23, 192, - 1, 7, 144, 8, 179, 240, 14, 115, 32, 165, - 29, 32, 2, 27, 255, 240, 4, 228, 16, 12, - 154, 192, 1, 17, 0, 11, 193, 112, 7, 33, - 240, 0, 11, 192, 1, 253, 64, 12, 196, 160, - 5, 145, 169, 15, 212, 105, 157, 113, 250, 23, - 29, 160, 1, 92, 224, 5, 161, 20, 74, 159, - 233, 111, 68, 179, 167, 131, 210, 167, 249, 240, - 13, 183, 144, 13, 57, 186, 0, 6, 96, 5, - 82, 80, 1, 14, 0, 6, 32, 138, 83, 3, - 128, 0, 227, 16, 166, 17, 192, 13, 96, 26, - 2, 16, 80, 0, 0, 16, 1, 242, 168, 14, - 245, 169, 7, 150, 57, 170, 23, 194, 1, 25, - 208, 5, 88, 144, 170, 120, 26, 107, 146, 232, - 170, 80, 50, 10, 213, 144, 12, 38, 234, 159, - 28, 16, 148, 201, 186, 12, 191, 64, 2, 0, - 192, 1, 29, 16, 2, 7, 0, 6, 146, 58, - 8, 149, 26, 2, 81, 224, 15, 15, 224, 159, - 155, 50, 2, 150, 112, 15, 63, 122, 33, 3, - 33, 173, 20, 192, 6, 117, 52, 68, 21, 122, - 109, 217, 170, 173, 248, 161, 11, 149, 112, 0, - 42, 148, 66, 6, 128, 13, 168, 80, 8, 142, - 229, 0, 243, 128, 13, 164, 208, 4, 6, 128, - 12, 161, 80, 9, 10, 112, 0, 163, 128, 9, - 217, 132, 169, 117, 224, 13, 247, 128, 153, 250, - 186, 175, 26, 80, 1, 15, 240, 6, 148, 32, - 7, 150, 0, 176, 162, 144, 23, 63, 49, 176, - 174, 202, 158, 186, 176, 142, 215, 176, 6, 232, - 255, 176, 6, 56, 187, 8, 129, 112, 149, 214, - 96, 7, 190, 128, 13, 182, 128, 12, 199, 32, - 13, 198, 32, 11, 156, 224, 6, 146, 32, 13, - 178, 16, 6, 110, 224, 13, 147, 112, 12, 178, - 192, 51, 247, 96, 6, 34, 59, 178, 2, 49, - 167, 24, 144, 14, 239, 128, 170, 42, 187, 178, - 68, 218, 178, 143, 35, 37, 174, 18, 37, 76, - 186, 164, 73, 170, 59, 128, 48, 13, 151, 192, - 148, 152, 208, 21, 222, 96, 8, 250, 144, 15, - 114, 155, 15, 216, 240, 6, 241, 16, 7, 123, - 34, 6, 53, 161, 6, 13, 106, 6, 102, 112, - 180, 94, 105, 8, 247, 208, 163, 209, 179, 58, - 95, 105, 181, 172, 39, 173, 23, 208, 5, 234, - 224, 5, 89, 32, 7, 93, 203, 178, 185, 64, - 20, 192, 193, 59, 218, 242, 142, 196, 17, 20, - 216, 192, 12, 160, 36, 7, 115, 144, 13, 105, - 192, 12, 188, 144, 13, 210, 81, 11, 246, 208, - 95, 18, 224, 8, 210, 128, 7, 132, 84, 5, - 126, 27, 61, 96, 105, 157, 84, 0, 15, 59, - 163, 56, 3, 17, 75, 249, 138, 184, 5, 209, - 1, 138, 75, 1, 86, 16, 15, 95, 0, 185, - 33, 25, 146, 0, 235, 153, 45, 91, 20, 97, - 203, 135, 47, 23, 37, 99, 171, 12, 231, 54, - 31, 117, 144, 11, 40, 150, 178, 125, 54, 120, - 119, 112, 10, 181, 64, 9, 243, 128, 5, 58, - 4, 1, 17, 48, 1, 20, 255, 128, 1, 62, - 52, 181, 13, 1, 173, 4, 177, 58, 186, 155, - 51, 225, 138, 1, 22, 48, 1, 235, 160, 14, - 88, 224, 7, 42, 59, 7, 244, 27, 146, 43, - 59, 68, 157, 185, 143, 185, 165, 91, 0, 82, - 25, 210, 155, 91, 251, 120, 167, 158, 43, 114, - 214, 107, 189, 115, 48, 15, 95, 192, 6, 143, - 160, 92, 223, 75, 1, 23, 144, 1, 27, 16, - 38, 133, 203, 16, 85, 123, 187, 233, 219, 16, - 79, 161, 1, 236, 75, 1, 81, 176, 14, 104, - 32, 15, 95, 48, 15, 194, 91, 191, 36, 92, - 194, 38, 44, 114, 244, 91, 192, 42, 60, 7, - 89, 144, 5, 8, 60, 5, 221, 27, 1, 92, - 90, 1, 15, 172, 1, 232, 122, 193, 56, 156, - 153, 225, 122, 81, 22, 64, 1, 19, 32, 1, - 16, 240, 190, 88, 224, 5, 95, 16, 194, 243, - 208, 194, 143, 59, 192, 36, 236, 185, 114, 144, - 5, 218, 139, 192, 95, 224, 5, 242, 160, 14, - 43, 212, 95, 50, 236, 1, 20, 80, 1, 22, - 32, 190, 65, 233, 106, 57, 252, 197, 13, 17, - 2, 169, 18, 83, 24, 101, 1, 21, 224, 195, - 233, 32, 1, 81, 16, 1, 108, 12, 1, 110, - 252, 198, 112, 236, 198, 108, 44, 195, 92, 74, - 1, 20, 96, 1, 91, 44, 160, 54, 220, 1, - 94, 12, 198, 126, 172, 19, 124, 204, 187, 68, - 169, 1, 49, 117, 81, 99, 119, 1, 136, 156, - 200, 136, 16, 60, 118, 24, 64, 81, 132, 76, - 148, 232, 202, 199, 127, 172, 19, 1, 1, 0, - 59 }; - -unsigned char zend_logo[] = { - 71, 73, 70, 56, 57, 97, 100, 0, 58, 0, - 247, 255, 0, 255, 255, 255, 8, 8, 8, 24, - 24, 24, 57, 57, 57, 74, 74, 74, 90, 90, - 90, 99, 99, 99, 123, 123, 123, 132, 132, 132, - 140, 140, 140, 148, 148, 148, 189, 189, 189, 214, - 214, 214, 231, 231, 231, 239, 239, 239, 90, 99, - 99, 222, 231, 239, 57, 66, 74, 165, 173, 181, - 0, 8, 16, 214, 222, 231, 57, 66, 82, 16, - 33, 66, 0, 8, 24, 24, 41, 82, 222, 231, - 255, 57, 66, 90, 198, 206, 231, 181, 189, 214, - 99, 107, 132, 0, 8, 33, 189, 198, 231, 123, - 132, 165, 148, 165, 231, 123, 140, 206, 123, 148, - 239, 49, 66, 132, 24, 33, 66, 49, 74, 165, - 214, 222, 255, 206, 214, 247, 181, 189, 222, 148, - 156, 189, 123, 132, 173, 156, 173, 247, 132, 148, - 214, 99, 115, 181, 49, 57, 90, 41, 49, 82, - 90, 107, 181, 82, 99, 173, 24, 33, 74, 57, - 82, 189, 49, 74, 173, 16, 24, 57, 8, 16, - 49, 198, 206, 247, 181, 189, 231, 165, 173, 214, - 99, 107, 148, 74, 82, 123, 140, 156, 239, 66, - 74, 115, 115, 132, 222, 41, 49, 90, 57, 74, - 165, 49, 66, 148, 49, 66, 156, 41, 57, 140, - 57, 82, 206, 33, 49, 123, 57, 82, 214, 16, - 24, 66, 198, 206, 255, 181, 189, 239, 189, 198, - 255, 156, 165, 214, 140, 148, 198, 132, 140, 189, - 115, 123, 173, 90, 99, 148, 132, 148, 247, 123, - 140, 239, 107, 123, 214, 115, 132, 231, 57, 66, - 115, 107, 123, 222, 115, 132, 239, 57, 66, 123, - 99, 115, 214, 90, 107, 214, 74, 90, 181, 74, - 90, 189, 66, 82, 173, 57, 74, 173, 49, 66, - 165, 66, 90, 231, 49, 66, 173, 24, 33, 90, - 41, 57, 156, 33, 49, 140, 8, 16, 66, 181, - 189, 247, 165, 173, 231, 148, 156, 214, 132, 140, - 198, 115, 123, 181, 82, 90, 148, 49, 57, 115, - 99, 115, 231, 90, 107, 231, 82, 99, 214, 82, - 99, 222, 74, 90, 206, 82, 99, 231, 66, 82, - 189, 33, 41, 99, 57, 74, 189, 57, 74, 198, - 57, 74, 206, 49, 66, 181, 41, 57, 165, 24, - 33, 99, 16, 24, 82, 8, 16, 74, 173, 181, - 247, 173, 181, 255, 165, 173, 247, 140, 148, 214, - 156, 165, 239, 165, 173, 255, 156, 165, 247, 132, - 140, 214, 140, 148, 231, 99, 107, 173, 107, 115, - 189, 115, 123, 206, 123, 132, 222, 99, 107, 189, - 82, 90, 165, 90, 99, 181, 74, 82, 156, 82, - 90, 173, 90, 99, 189, 66, 74, 140, 57, 66, - 140, 57, 66, 148, 41, 49, 115, 74, 90, 222, - 74, 90, 231, 41, 49, 132, 66, 82, 222, 33, - 41, 115, 33, 41, 123, 24, 33, 107, 24, 33, - 123, 16, 24, 90, 148, 156, 247, 140, 148, 239, - 132, 140, 231, 140, 148, 247, 132, 140, 239, 123, - 132, 231, 107, 115, 206, 123, 132, 239, 123, 132, - 247, 99, 107, 206, 99, 107, 214, 82, 90, 181, - 90, 99, 206, 49, 57, 148, 41, 49, 148, 33, - 41, 140, 239, 239, 247, 247, 247, 255, 198, 198, - 206, 214, 214, 222, 173, 173, 181, 189, 189, 198, - 148, 148, 156, 156, 156, 165, 231, 231, 247, 239, - 239, 255, 173, 173, 189, 90, 90, 99, 231, 231, - 255, 222, 222, 247, 140, 140, 156, 66, 66, 74, - 132, 132, 148, 198, 198, 222, 123, 123, 140, 173, - 173, 198, 107, 107, 123, 222, 222, 255, 57, 57, - 66, 49, 49, 57, 156, 156, 181, 198, 198, 231, - 140, 140, 165, 181, 181, 214, 90, 90, 107, 214, - 214, 255, 165, 165, 198, 82, 82, 99, 123, 123, - 148, 74, 74, 90, 115, 115, 140, 33, 33, 41, - 99, 99, 123, 156, 156, 198, 90, 90, 115, 132, - 132, 173, 173, 173, 231, 165, 165, 222, 24, 24, - 33, 82, 82, 115, 156, 156, 222, 115, 115, 165, - 57, 57, 82, 107, 107, 156, 123, 123, 181, 33, - 33, 49, 156, 156, 231, 82, 82, 123, 49, 49, - 74, 107, 107, 165, 74, 74, 115, 148, 148, 231, - 57, 57, 90, 41, 41, 66, 82, 82, 132, 66, - 66, 107, 132, 132, 214, 140, 140, 231, 99, 99, - 165, 123, 123, 206, 66, 66, 115, 82, 82, 148, - 123, 123, 222, 66, 66, 123, 8, 8, 16, 41, - 41, 82, 49, 49, 99, 24, 24, 49, 41, 41, - 90, 24, 24, 66, 8, 8, 24, 16, 16, 57, - 8, 8, 41, 8, 8, 49, 8, 8, 57, 0, - 0, 8, 0, 0, 16, 0, 0, 24, 0, 0, - 0, 44, 0, 0, 0, 0, 100, 0, 58, 0, - 0, 8, 255, 0, 255, 9, 28, 72, 176, 160, - 193, 131, 8, 19, 42, 92, 200, 176, 161, 195, - 135, 188, 146, 37, 131, 246, 176, 226, 193, 94, - 188, 10, 6, 203, 104, 177, 99, 67, 99, 31, - 140, 25, 75, 230, 177, 227, 200, 130, 39, 75, - 170, 60, 104, 12, 87, 128, 103, 198, 40, 174, - 108, 248, 1, 87, 193, 154, 51, 115, 10, 52, - 198, 236, 31, 175, 15, 196, 124, 246, 58, 150, - 17, 227, 203, 0, 2, 122, 9, 240, 121, 140, - 232, 191, 94, 201, 130, 57, 229, 213, 148, 227, - 63, 103, 199, 96, 218, 36, 104, 172, 89, 47, - 140, 2, 159, 57, 19, 232, 236, 153, 206, 143, - 199, 130, 33, 43, 118, 213, 216, 50, 96, 31, - 4, 24, 139, 230, 204, 152, 179, 100, 198, 4, - 240, 50, 166, 2, 88, 76, 144, 200, 144, 17, - 53, 86, 12, 46, 69, 188, 133, 113, 114, 229, - 11, 55, 104, 49, 14, 1, 226, 113, 56, 118, - 150, 33, 72, 99, 207, 2, 252, 3, 70, 249, - 222, 200, 98, 199, 122, 141, 236, 165, 226, 159, - 138, 98, 206, 150, 113, 240, 92, 44, 192, 215, - 211, 169, 145, 45, 93, 214, 235, 95, 128, 148, - 3, 63, 4, 179, 13, 172, 54, 177, 145, 184, - 140, 5, 173, 172, 176, 37, 87, 146, 255, 70, - 23, 251, 0, 90, 119, 114, 99, 28, 158, 45, - 197, 45, 50, 250, 210, 228, 200, 21, 15, 52, - 254, 175, 169, 192, 99, 129, 41, 19, 255, 231, - 103, 142, 31, 203, 158, 3, 139, 45, 227, 5, - 19, 26, 94, 96, 204, 66, 82, 124, 187, 173, - 236, 94, 244, 255, 150, 173, 103, 159, 177, 24, - 178, 8, 120, 225, 183, 211, 49, 196, 224, 149, - 76, 63, 252, 252, 6, 212, 66, 252, 152, 87, - 145, 57, 30, 176, 132, 156, 64, 208, 112, 0, - 82, 52, 255, 64, 163, 155, 0, 31, 44, 67, - 33, 50, 74, 228, 128, 12, 52, 184, 85, 8, - 24, 69, 208, 32, 35, 18, 78, 14, 254, 19, - 82, 72, 102, 245, 211, 207, 63, 130, 49, 56, - 163, 69, 48, 208, 115, 16, 52, 154, 17, 20, - 0, 49, 215, 253, 131, 75, 60, 255, 108, 227, - 141, 64, 252, 208, 163, 193, 112, 60, 22, 68, - 204, 112, 3, 17, 3, 141, 0, 68, 182, 56, - 37, 49, 247, 8, 116, 207, 5, 117, 89, 117, - 80, 63, 19, 180, 248, 144, 61, 230, 204, 196, - 15, 130, 252, 120, 83, 130, 152, 30, 177, 57, - 80, 63, 30, 168, 224, 97, 66, 112, 186, 217, - 208, 61, 224, 220, 168, 210, 4, 253, 204, 80, - 142, 78, 13, 30, 196, 143, 7, 214, 96, 67, - 103, 62, 122, 90, 196, 79, 59, 24, 204, 212, - 79, 60, 232, 228, 3, 168, 157, 255, 240, 147, - 143, 62, 148, 122, 224, 1, 165, 13, 149, 160, - 205, 13, 156, 50, 228, 79, 62, 80, 72, 170, - 83, 162, 5, 121, 80, 70, 62, 108, 242, 51, - 65, 62, 155, 170, 255, 212, 15, 15, 226, 220, - 224, 15, 159, 97, 226, 10, 230, 174, 97, 54, - 24, 232, 160, 85, 156, 147, 37, 160, 168, 34, - 233, 1, 31, 248, 120, 208, 107, 131, 23, 232, - 147, 44, 167, 215, 228, 115, 77, 177, 72, 222, - 144, 134, 19, 24, 224, 3, 171, 7, 247, 116, - 219, 45, 183, 223, 198, 19, 79, 0, 174, 246, - 67, 135, 33, 166, 2, 122, 129, 160, 249, 240, - 177, 71, 62, 247, 140, 27, 192, 61, 250, 240, - 161, 15, 181, 3, 221, 67, 79, 56, 229, 192, - 96, 14, 168, 3, 241, 19, 128, 7, 108, 4, - 98, 141, 59, 24, 216, 99, 195, 194, 12, 51, - 76, 15, 61, 210, 114, 235, 129, 61, 46, 208, - 17, 79, 168, 22, 249, 211, 42, 63, 55, 136, - 161, 7, 18, 55, 72, 124, 195, 30, 72, 196, - 202, 96, 60, 54, 148, 179, 195, 57, 155, 186, - 26, 207, 61, 54, 72, 130, 130, 25, 138, 68, - 194, 198, 36, 56, 231, 140, 51, 29, 98, 204, - 96, 129, 13, 244, 76, 130, 134, 17, 218, 226, - 235, 209, 5, 254, 20, 196, 207, 61, 248, 232, - 145, 137, 30, 51, 148, 64, 143, 13, 30, 235, - 67, 228, 67, 150, 142, 115, 142, 61, 19, 220, - 35, 173, 13, 108, 120, 146, 203, 18, 158, 88, - 49, 69, 22, 103, 79, 113, 202, 217, 169, 116, - 65, 2, 29, 116, 44, 242, 13, 36, 249, 228, - 179, 79, 62, 73, 43, 250, 101, 132, 72, 242, - 255, 19, 143, 7, 72, 104, 194, 10, 17, 152, - 96, 48, 131, 38, 152, 204, 224, 193, 197, 21, - 45, 61, 79, 19, 240, 212, 51, 3, 6, 24, - 24, 241, 67, 18, 174, 228, 146, 196, 18, 156, - 115, 190, 249, 18, 130, 128, 194, 69, 23, 228, - 152, 33, 9, 61, 209, 210, 83, 198, 13, 23, - 152, 23, 232, 5, 30, 92, 19, 175, 140, 247, - 132, 121, 177, 157, 253, 232, 179, 110, 131, 127, - 95, 51, 3, 38, 171, 124, 177, 138, 17, 70, - 168, 66, 7, 62, 215, 244, 26, 112, 131, 50, - 226, 126, 13, 36, 213, 144, 19, 131, 36, 108, - 64, 50, 133, 31, 185, 0, 0, 128, 43, 220, - 111, 207, 125, 230, 126, 72, 177, 4, 14, 93, - 248, 140, 4, 29, 152, 32, 206, 70, 21, 243, - 200, 83, 78, 57, 219, 208, 115, 65, 60, 176, - 75, 235, 79, 188, 189, 146, 75, 16, 63, 251, - 232, 115, 143, 223, 250, 154, 129, 24, 44, 49, - 4, 46, 60, 162, 17, 142, 24, 67, 61, 44, - 128, 4, 120, 45, 235, 76, 19, 208, 212, 176, - 12, 210, 143, 124, 96, 33, 16, 56, 240, 132, - 41, 136, 113, 13, 1, 64, 163, 131, 83, 10, - 161, 7, 71, 8, 141, 10, 173, 65, 18, 139, - 64, 68, 54, 190, 145, 142, 67, 24, 129, 14, - 51, 136, 161, 13, 22, 39, 174, 111, 105, 10, - 92, 241, 242, 155, 175, 252, 182, 15, 36, 220, - 205, 3, 55, 176, 128, 24, 255, 38, 65, 132, - 24, 112, 224, 131, 196, 88, 132, 17, 48, 161, - 135, 61, 36, 235, 30, 254, 64, 218, 61, 36, - 72, 169, 165, 221, 192, 29, 223, 80, 70, 18, - 130, 212, 144, 3, 228, 226, 15, 102, 248, 195, - 33, 26, 177, 10, 34, 104, 98, 6, 72, 128, - 88, 180, 174, 113, 13, 77, 229, 227, 6, 55, - 88, 216, 195, 110, 208, 70, 111, 141, 235, 101, - 251, 224, 4, 39, 98, 136, 129, 122, 16, 81, - 8, 136, 128, 133, 102, 4, 16, 131, 49, 172, - 34, 19, 154, 216, 195, 221, 46, 85, 55, 88, - 5, 74, 80, 241, 200, 135, 5, 136, 48, 133, - 36, 200, 164, 33, 3, 112, 133, 45, 146, 48, - 10, 35, 120, 12, 19, 155, 96, 162, 24, 12, - 103, 1, 123, 32, 97, 97, 37, 40, 193, 228, - 48, 48, 202, 61, 76, 78, 106, 106, 236, 86, - 62, 108, 160, 7, 77, 100, 2, 19, 153, 176, - 4, 17, 134, 16, 132, 64, 106, 230, 26, 169, - 192, 195, 42, 44, 161, 9, 78, 32, 161, 12, - 251, 184, 193, 182, 254, 87, 197, 8, 218, 0, - 3, 68, 24, 197, 53, 4, 114, 0, 90, 40, - 64, 1, 214, 196, 102, 2, 122, 244, 143, 5, - 0, 224, 15, 93, 152, 68, 61, 244, 64, 7, - 75, 144, 161, 140, 150, 120, 33, 220, 198, 57, - 78, 244, 101, 194, 8, 233, 92, 34, 220, 48, - 144, 74, 160, 77, 13, 3, 182, 36, 3, 17, - 86, 49, 255, 134, 47, 212, 160, 14, 63, 16, - 228, 63, 4, 144, 5, 47, 172, 130, 137, 122, - 68, 22, 188, 186, 165, 49, 133, 136, 139, 30, - 208, 252, 196, 117, 24, 160, 73, 87, 120, 15, - 0, 10, 24, 72, 1, 0, 224, 135, 57, 168, - 179, 156, 252, 12, 131, 72, 195, 96, 130, 49, - 8, 65, 8, 68, 72, 233, 42, 134, 240, 133, - 48, 124, 1, 15, 97, 168, 193, 23, 136, 96, - 137, 121, 174, 18, 19, 68, 24, 67, 30, 90, - 234, 133, 158, 210, 32, 160, 154, 129, 70, 22, - 194, 64, 4, 158, 113, 130, 100, 250, 192, 155, - 140, 16, 148, 16, 129, 121, 109, 18, 159, 176, - 69, 1, 8, 64, 0, 6, 36, 193, 15, 75, - 224, 158, 50, 100, 209, 35, 1, 52, 64, 25, - 169, 136, 196, 11, 49, 161, 203, 49, 132, 1, - 15, 115, 136, 195, 35, 82, 193, 5, 60, 224, - 161, 167, 117, 240, 66, 29, 236, 96, 135, 59, - 164, 53, 21, 143, 216, 66, 35, 134, 64, 4, - 156, 97, 2, 158, 121, 16, 41, 30, 234, 192, - 133, 84, 164, 226, 13, 63, 104, 192, 32, 181, - 16, 6, 98, 138, 225, 168, 253, 83, 214, 163, - 152, 218, 212, 123, 148, 128, 17, 202, 88, 2, - 10, 114, 193, 89, 63, 68, 97, 9, 0, 56, - 65, 18, 134, 49, 16, 90, 184, 226, 10, 38, - 176, 4, 206, 140, 144, 83, 19, 112, 225, 16, - 211, 136, 192, 147, 152, 241, 4, 45, 255, 20, - 225, 8, 69, 200, 130, 26, 180, 112, 132, 31, - 104, 195, 25, 79, 170, 64, 52, 92, 224, 5, - 33, 68, 66, 8, 47, 29, 108, 29, 70, 225, - 4, 102, 12, 131, 24, 195, 152, 70, 44, 130, - 154, 133, 47, 212, 84, 12, 123, 80, 100, 200, - 226, 209, 60, 78, 249, 45, 31, 116, 168, 6, - 14, 78, 225, 136, 69, 40, 34, 11, 109, 16, - 196, 38, 205, 48, 139, 129, 16, 0, 0, 102, - 224, 66, 95, 233, 48, 9, 18, 32, 247, 17, - 29, 224, 162, 64, 152, 33, 2, 74, 180, 161, - 25, 241, 56, 70, 19, 6, 96, 16, 1, 116, - 96, 11, 255, 164, 171, 29, 226, 192, 4, 3, - 112, 83, 32, 93, 29, 170, 37, 244, 128, 93, - 146, 193, 138, 187, 143, 106, 230, 196, 214, 144, - 132, 63, 160, 226, 164, 65, 208, 130, 25, 132, - 225, 7, 65, 80, 96, 154, 3, 109, 64, 46, - 74, 225, 5, 44, 76, 130, 172, 95, 152, 67, - 58, 182, 114, 16, 98, 84, 163, 52, 182, 185, - 218, 65, 162, 17, 135, 34, 220, 246, 13, 41, - 240, 146, 65, 160, 97, 138, 26, 212, 116, 15, - 144, 213, 135, 7, 118, 69, 89, 131, 44, 45, - 31, 51, 88, 135, 25, 112, 80, 8, 68, 168, - 227, 15, 73, 232, 195, 21, 212, 107, 128, 129, - 40, 0, 0, 75, 40, 69, 28, 186, 16, 132, - 71, 152, 226, 19, 228, 216, 141, 64, 226, 97, - 128, 4, 32, 32, 255, 40, 1, 136, 5, 10, - 40, 64, 128, 130, 16, 32, 1, 9, 192, 15, - 63, 156, 112, 132, 75, 196, 161, 15, 248, 129, - 70, 48, 20, 16, 140, 32, 9, 64, 11, 214, - 213, 68, 133, 241, 161, 100, 127, 112, 247, 145, - 78, 134, 147, 13, 230, 97, 8, 52, 152, 193, - 12, 125, 72, 135, 35, 226, 224, 7, 87, 112, - 85, 32, 196, 216, 222, 85, 253, 208, 135, 68, - 252, 128, 173, 77, 232, 17, 47, 24, 144, 1, - 205, 66, 160, 154, 56, 176, 130, 39, 40, 64, - 96, 219, 208, 98, 108, 56, 104, 197, 116, 5, - 130, 11, 55, 92, 34, 20, 18, 24, 136, 1, - 40, 176, 1, 28, 216, 162, 1, 5, 160, 144, - 41, 172, 107, 84, 69, 42, 25, 195, 77, 118, - 114, 0, 250, 225, 53, 123, 204, 67, 156, 154, - 216, 130, 25, 92, 161, 139, 225, 4, 224, 21, - 218, 115, 69, 6, 250, 112, 138, 26, 212, 128, - 6, 90, 232, 242, 63, 136, 225, 128, 64, 248, - 186, 18, 159, 64, 1, 14, 220, 0, 6, 48, - 4, 130, 22, 2, 33, 192, 18, 172, 64, 137, - 74, 80, 1, 5, 25, 29, 168, 40, 42, 145, - 3, 153, 48, 99, 3, 87, 168, 4, 37, 172, - 128, 3, 197, 14, 84, 194, 154, 192, 64, 118, - 35, 203, 221, 71, 51, 200, 101, 23, 160, 135, - 17, 216, 161, 12, 205, 97, 72, 32, 193, 8, - 119, 18, 72, 81, 4, 185, 114, 193, 20, 104, - 255, 144, 137, 2, 62, 144, 182, 44, 200, 65, - 14, 112, 0, 195, 37, 46, 209, 134, 93, 228, - 91, 20, 245, 190, 4, 37, 164, 0, 129, 171, - 165, 193, 10, 183, 128, 48, 7, 124, 61, 243, - 75, 80, 129, 2, 65, 77, 69, 99, 233, 128, - 100, 39, 42, 121, 169, 209, 174, 108, 61, 92, - 96, 134, 19, 152, 161, 19, 77, 24, 136, 0, - 28, 224, 10, 18, 183, 129, 176, 113, 240, 47, - 1, 184, 25, 128, 178, 151, 29, 26, 33, 184, - 132, 204, 213, 238, 6, 155, 255, 131, 0, 35, - 152, 121, 191, 229, 128, 130, 90, 175, 96, 4, - 1, 231, 69, 40, 212, 206, 247, 43, 8, 84, - 0, 203, 46, 234, 99, 157, 173, 172, 71, 99, - 140, 31, 54, 192, 130, 33, 206, 144, 229, 40, - 148, 34, 10, 164, 21, 72, 44, 92, 177, 132, - 78, 148, 66, 10, 140, 95, 66, 20, 164, 32, - 100, 130, 8, 160, 26, 107, 151, 121, 27, 18, - 144, 111, 82, 168, 93, 230, 149, 88, 66, 157, - 255, 177, 130, 30, 32, 64, 32, 5, 104, 131, - 204, 103, 47, 10, 129, 10, 245, 11, 47, 60, - 234, 30, 86, 181, 56, 4, 69, 189, 32, 253, - 192, 64, 19, 86, 152, 142, 31, 156, 162, 13, - 109, 216, 129, 123, 1, 96, 11, 206, 157, 64, - 24, 202, 16, 134, 43, 146, 16, 138, 206, 107, - 253, 12, 106, 127, 185, 27, 174, 224, 118, 2, - 72, 129, 18, 148, 224, 187, 255, 18, 86, 223, - 122, 210, 251, 196, 215, 179, 55, 250, 223, 171, - 251, 194, 236, 42, 116, 201, 221, 69, 72, 60, - 110, 0, 133, 38, 184, 163, 10, 144, 112, 196, - 90, 219, 160, 142, 235, 4, 128, 1, 218, 195, - 124, 87, 245, 7, 125, 80, 11, 40, 16, 10, - 178, 16, 11, 215, 129, 0, 177, 208, 128, 177, - 176, 0, 125, 32, 7, 200, 87, 9, 96, 208, - 118, 55, 151, 126, 151, 96, 6, 228, 23, 10, - 177, 32, 16, 2, 240, 3, 51, 71, 123, 72, - 55, 80, 169, 48, 4, 158, 52, 3, 72, 197, - 45, 59, 36, 40, 212, 118, 14, 58, 208, 14, - 51, 80, 5, 141, 176, 127, 165, 128, 31, 8, - 176, 61, 2, 120, 2, 182, 80, 104, 2, 32, - 1, 161, 48, 2, 102, 160, 110, 5, 96, 117, - 75, 96, 6, 75, 48, 8, 161, 112, 5, 107, - 87, 115, 249, 38, 5, 124, 167, 118, 26, 40, - 16, 43, 112, 116, 87, 19, 13, 49, 199, 119, - 84, 0, 1, 65, 245, 8, 145, 64, 7, 24, - 128, 4, 72, 160, 100, 247, 64, 89, 110, 194, - 60, 215, 112, 14, 213, 176, 14, 238, 112, 8, - 234, 224, 9, 81, 48, 8, 108, 145, 111, 1, - 200, 124, 39, 160, 61, 201, 246, 15, 180, 48, - 8, 143, 183, 0, 3, 17, 12, 74, 112, 5, - 110, 208, 6, 82, 64, 13, 221, 32, 7, 106, - 55, 122, 55, 87, 116, 50, 55, 126, 2, 65, - 13, 116, 255, 103, 126, 252, 176, 3, 68, 39, - 7, 103, 96, 126, 132, 100, 4, 245, 128, 4, - 140, 54, 134, 190, 98, 35, 55, 240, 4, 214, - 128, 3, 40, 160, 12, 186, 32, 12, 181, 112, - 73, 4, 16, 12, 6, 160, 138, 170, 184, 138, - 50, 113, 107, 202, 208, 113, 119, 248, 15, 222, - 16, 12, 218, 192, 13, 117, 22, 15, 210, 0, - 7, 151, 96, 129, 111, 39, 10, 69, 167, 118, - 125, 176, 122, 212, 112, 9, 61, 208, 10, 80, - 18, 1, 59, 0, 2, 191, 16, 121, 235, 22, - 3, 147, 48, 3, 16, 83, 59, 24, 179, 63, - 150, 50, 3, 88, 224, 8, 136, 64, 8, 133, - 208, 1, 21, 65, 11, 39, 240, 7, 161, 240, - 9, 27, 0, 37, 67, 150, 13, 148, 160, 5, - 110, 199, 11, 137, 64, 87, 113, 112, 4, 71, - 16, 133, 255, 0, 2, 151, 0, 7, 31, 240, - 10, 250, 69, 16, 241, 80, 12, 93, 128, 9, - 22, 32, 59, 58, 134, 53, 93, 51, 75, 208, - 164, 6, 22, 65, 11, 61, 64, 3, 65, 16, - 4, 34, 192, 0, 2, 18, 37, 177, 240, 1, - 71, 160, 5, 181, 241, 15, 3, 128, 8, 38, - 240, 79, 62, 86, 13, 28, 1, 2, 240, 152, - 5, 186, 240, 10, 181, 86, 16, 188, 32, 11, - 136, 144, 7, 116, 80, 2, 139, 83, 141, 144, - 228, 1, 244, 64, 2, 128, 48, 11, 5, 96, - 0, 52, 89, 147, 54, 121, 147, 6, 255, 240, - 10, 202, 176, 5, 186, 20, 4, 236, 0, 1, - 177, 96, 0, 3, 80, 66, 5, 64, 11, 13, - 144, 3, 169, 96, 7, 169, 112, 11, 52, 169, - 0, 79, 112, 92, 95, 48, 87, 57, 160, 0, - 52, 169, 2, 115, 32, 87, 89, 176, 1, 174, - 64, 11, 5, 80, 66, 196, 96, 0, 177, 224, - 11, 46, 96, 72, 116, 64, 15, 226, 194, 146, - 210, 70, 15, 144, 208, 7, 228, 160, 3, 27, - 176, 89, 22, 53, 135, 114, 201, 124, 40, 96, - 12, 56, 96, 6, 142, 64, 7, 36, 176, 10, - 143, 144, 13, 40, 160, 11, 181, 80, 11, 20, - 128, 12, 135, 16, 4, 66, 96, 2, 142, 160, - 3, 190, 224, 11, 28, 176, 6, 116, 0, 79, - 253, 36, 2, 34, 97, 12, 78, 32, 4, 67, - 160, 10, 95, 208, 5, 45, 240, 1, 186, 208, - 10, 181, 0, 1, 41, 224, 4, 144, 128, 9, - 100, 165, 7, 55, 240, 63, 109, 130, 50, 139, - 96, 6, 139, 128, 1, 147, 224, 8, 160, 160, - 12, 182, 240, 61, 180, 201, 61, 182, 144, 1, - 127, 224, 8, 70, 32, 4, 132, 240, 7, 144, - 128, 62, 171, 144, 7, 93, 32, 3, 50, 208, - 8, 238, 96, 4, 171, 69, 60, 150, 224, 98, - 243, 64, 7, 64, 0, 55, 172, 69, 4, 40, - 133, 5, 99, 5, 79, 252, 20, 4, 142, 32, - 3, 139, 224, 14, 108, 0, 55, 64, 32, 6, - 233, 211, 64, 97, 255, 98, 17, 55, 48, 15, - 238, 128, 6, 235, 80, 15, 11, 83, 15, 143, - 96, 6, 185, 96, 11, 39, 16, 139, 242, 41, - 159, 89, 150, 8, 150, 16, 53, 24, 192, 8, - 103, 208, 8, 191, 179, 10, 100, 80, 83, 60, - 83, 15, 125, 36, 6, 236, 100, 56, 62, 19, - 67, 98, 0, 55, 152, 96, 83, 148, 163, 160, - 240, 4, 160, 134, 83, 2, 63, 3, 134, 217, - 85, 50, 104, 249, 15, 254, 160, 50, 220, 32, - 14, 24, 112, 49, 94, 35, 6, 138, 176, 4, - 154, 131, 105, 127, 80, 162, 38, 90, 162, 234, - 208, 8, 245, 0, 49, 249, 80, 2, 144, 32, - 2, 104, 132, 75, 122, 64, 74, 11, 99, 1, - 22, 16, 67, 104, 36, 71, 83, 131, 4, 172, - 68, 97, 72, 160, 48, 54, 96, 74, 24, 64, - 78, 154, 64, 97, 51, 0, 52, 209, 178, 45, - 30, 160, 15, 145, 197, 146, 23, 80, 14, 47, - 176, 80, 174, 243, 55, 245, 128, 8, 162, 24, - 8, 228, 64, 8, 234, 176, 165, 92, 170, 14, - 233, 192, 8, 147, 176, 15, 220, 34, 46, 30, - 0, 15, 80, 128, 15, 72, 160, 7, 31, 3, - 71, 215, 160, 76, 55, 128, 15, 101, 112, 74, - 110, 250, 166, 72, 224, 46, 21, 10, 71, 116, - 138, 100, 106, 42, 6, 167, - 4, 43, 221, 34, 47, 211, 6, 68, 254, 131, - 49, 247, 16, 14, 124, 179, 63, 3, 83, 15, - 104, 128, 2, 214, 255, 192, 14, 134, 96, 8, - 235, 16, 169, 146, 186, 14, 80, 128, 14, 42, - 121, 150, 126, 131, 15, 162, 89, 167, 198, 164, - 76, 117, 3, 71, 61, 84, 6, 248, 0, 71, - 111, 116, 3, 117, 154, 93, 36, 163, 45, 111, - 234, 46, 122, 164, 71, 32, 67, 67, 191, 34, - 16, 21, 148, 44, 191, 151, 47, 244, 80, 69, - 247, 0, 5, 74, 144, 6, 231, 208, 14, 47, - 80, 15, 47, 48, 15, 47, 16, 172, 243, 32, - 172, 51, 112, 154, 14, 226, 58, 248, 0, 5, - 108, 80, 161, 154, 114, 1, 223, 114, 41, 73, - 245, 172, 83, 84, 55, 76, 250, 67, 83, 228, - 1, 118, 83, 167, 238, 210, 64, 204, 116, 16, - 23, 208, 72, 173, 243, 37, 183, 218, 84, 51, - 224, 4, 91, 211, 72, 55, 36, 65, 235, 106, - 113, 4, 209, 15, 123, 224, 14, 98, 128, 55, - 227, 178, 67, 13, 18, 38, 228, 66, 46, 190, - 18, 15, 19, 96, 120, 2, 243, 40, 110, 196, - 45, 70, 83, 41, 174, 114, 63, 13, 165, 143, - 215, 16, 42, 30, 176, 3, 232, 176, 146, 249, - 154, 175, 13, 82, 118, 2, 3, 105, 111, 178, - 15, 108, 208, 14, 172, 210, 56, 149, 34, 40, - 145, 193, 93, 88, 179, 52, 209, 54, 176, 2, - 33, 15, 207, 224, 1, 250, 170, 52, 27, 203, - 32, 118, 99, 3, 225, 144, 46, 57, 225, 58, - 23, 138, 36, 227, 137, 53, 227, 240, 2, 140, - 61, 163, 18, 131, 146, 15, 220, 229, 13, 19, - 100, 38, 20, 139, 53, 34, 171, 52, 224, 80, - 14, 181, 90, 17, 21, 212, 58, 253, 48, 45, - 47, 187, 130, 29, 241, 179, 10, 193, 15, 225, - 16, 14, 183, 131, 36, 109, 2, 173, 14, 114, - 179, 12, 225, 58, 78, 102, 175, 109, 226, 32, - 1, 1, 0, 59 }; diff --git a/main/main.c b/main/main.c deleted file mode 100644 index 7ffc5b1b7e..0000000000 --- a/main/main.c +++ /dev/null @@ -1,1293 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | PHP version 4.0 | - +----------------------------------------------------------------------+ - | Copyright (c) 1997, 1998, 1999 The PHP Group | - +----------------------------------------------------------------------+ - | This source file is subject to version 2.0 of the PHP license, | - | that is bundled with this package in the file LICENSE, and is | - | available at through the world-wide-web at | - | http://www.php.net/license/2_0.txt. | - | If you did not receive a copy of the PHP license and are unable to | - | obtain it through the world-wide-web, please send a note to | - | license@php.net so we can mail you a copy immediately. | - +----------------------------------------------------------------------+ - | Authors: Andi Gutmans <andi@zend.com> | - | Rasmus Lerdorf <rasmus@lerdorf.on.ca> | - | Zeev Suraski <zeev@zend.com> | - +----------------------------------------------------------------------+ -*/ - - -/* $Id$ */ - - -#include <stdio.h> -#include "php.h" -#ifdef MSVC5 -#include "win32/time.h" -#include "win32/signal.h" -#include <process.h> -#else -#include "build-defs.h" -#endif -#if HAVE_SYS_TIME_H -#include <sys/time.h> -#endif -#if HAVE_UNISTD_H -#include <unistd.h> -#endif -#if HAVE_SIGNAL_H -#include <signal.h> -#endif -#if HAVE_SETLOCALE -#include <locale.h> -#endif -#include "zend.h" -#include "php_ini.h" -#include "php_globals.h" -#include "main.h" -#include "fopen-wrappers.h" -#include "ext/standard/php_standard.h" -#include "snprintf.h" -#if WIN32|WINNT -#include <io.h> -#include <fcntl.h> -#include "win32/syslog.h" -#include "win32/php_registry.h" -#else -#include <syslog.h> -#endif - -#include "zend_compile.h" -#include "zend_execute.h" -#include "zend_highlight.h" -#include "zend_indent.h" - -#include "php_content_types.h" - -#include "SAPI.h" - -#if MSVC5 || !defined(HAVE_GETOPT) -#include "php_getopt.h" -#endif - - -#ifndef ZTS -php_core_globals core_globals; -#else -PHPAPI int core_globals_id; -#endif - -#define NO_GLOBAL_LOCK - -/* temporary workaround for thread-safety issues in libzend */ -#if defined(ZTS) && !defined(NO_GLOBAL_LOCK) -static MUTEX_T global_lock; -#define global_lock() tsrm_mutex_lock(global_lock) -#define global_unlock() tsrm_mutex_unlock(global_lock); -#define global_lock_init() global_lock = tsrm_mutex_alloc() -#define global_lock_destroy() tsrm_mutex_free(global_lock) -#else -#define global_lock() -#define global_unlock() -#define global_lock_init() -#define global_lock_destroy() -#endif - - -void _php_build_argv(char * ELS_DC); -static void php_timeout(int dummy); -static void php_set_timeout(long seconds); - -void *gLock; /*mutex variable */ - - -/* True globals (no need for thread safety) */ -HashTable configuration_hash; -PHPAPI char *php3_ini_path = NULL; - - -#define SAFE_FILENAME(f) ((f)?(f):"-") - -static PHP_INI_MH(OnSetPrecision) -{ - ELS_FETCH(); - - EG(precision) = atoi(new_value); - return SUCCESS; -} - - -static PHP_INI_MH(OnChangeMaxExecutionTime) -{ - int new_timeout; - PLS_FETCH(); - - if (new_value) { - new_timeout = atoi(new_value); - } else { - new_timeout = 0; - } - PG(max_execution_time) = new_timeout; - php_set_timeout(new_timeout); - return SUCCESS; -} - - -static PHP_INI_MH(OnChangeMemoryLimit) -{ - int new_limit; - - if (new_value) { - new_limit = atoi(new_value); - } else { - new_limit = 1<<30; /* effectively, no limit */ - } - return zend_set_memory_limit(new_limit); -} - - -static PHP_INI_MH(OnUpdateErrorReporting) -{ - ELS_FETCH(); - - if (!new_value) { - EG(error_reporting) = E_ALL & ~E_NOTICE; - } else { - EG(error_reporting) = atoi(new_value); - } - return SUCCESS; -} - - -/* Need to convert to strings and make use of: - * DEFAULT_SHORT_OPEN_TAG - * PHP_SAFE_MODE - * - * Need to be read from the environment (?): - * PHP_AUTO_PREPEND_FILE - * PHP_AUTO_APPEND_FILE - * PHP_DOCUMENT_ROOT - * PHP_USER_DIR - * PHP_INCLUDE_PATH - */ - -#ifndef SAFE_MODE_EXEC_DIR -# define SAFE_MODE_EXEC_DIR "/" -#endif - -#ifdef PHP_PROG_SENDMAIL -# define DEFAULT_SENDMAIL_PATH PHP_PROG_SENDMAIL " -t" -#else -# define DEFAULT_SENDMAIL_PATH NULL -#endif -PHP_INI_BEGIN() - STD_PHP_INI_BOOLEAN("short_open_tag", "1", PHP_INI_ALL, OnUpdateBool, short_tags, php_core_globals, core_globals) - STD_PHP_INI_BOOLEAN("asp_tags", "0", PHP_INI_ALL, OnUpdateBool, asp_tags, php_core_globals, core_globals) - PHP_INI_ENTRY("precision", "14", PHP_INI_ALL, OnSetPrecision) - STD_PHP_INI_BOOLEAN("output_buffering", "0", PHP_INI_PERDIR|PHP_INI_SYSTEM, OnUpdateBool, output_buffering, php_core_globals, core_globals) - - PHP_INI_ENTRY_EX("highlight.comment", HL_COMMENT_COLOR, PHP_INI_ALL, NULL, php_ini_color_displayer_cb) - PHP_INI_ENTRY_EX("highlight.default", HL_DEFAULT_COLOR, PHP_INI_ALL, NULL, php_ini_color_displayer_cb) - PHP_INI_ENTRY_EX("highlight.html", HL_HTML_COLOR, PHP_INI_ALL, NULL, php_ini_color_displayer_cb) - PHP_INI_ENTRY_EX("highlight.string", HL_STRING_COLOR, PHP_INI_ALL, NULL, php_ini_color_displayer_cb) - PHP_INI_ENTRY_EX("highlight.bg", HL_BG_COLOR, PHP_INI_ALL, NULL, php_ini_color_displayer_cb) - PHP_INI_ENTRY_EX("highlight.keyword", HL_KEYWORD_COLOR, PHP_INI_ALL, NULL, php_ini_color_displayer_cb) - - STD_PHP_INI_BOOLEAN("magic_quotes_gpc", "1", PHP_INI_ALL, OnUpdateBool, magic_quotes_gpc, php_core_globals, core_globals) - STD_PHP_INI_BOOLEAN("magic_quotes_runtime", "0", PHP_INI_ALL, OnUpdateBool, magic_quotes_runtime, php_core_globals, core_globals) - STD_PHP_INI_BOOLEAN("magic_quotes_sybase", "0", PHP_INI_ALL, OnUpdateBool, magic_quotes_sybase, php_core_globals, core_globals) - - STD_PHP_INI_BOOLEAN("safe_mode", "0", PHP_INI_SYSTEM, OnUpdateBool, safe_mode, php_core_globals, core_globals) - STD_PHP_INI_BOOLEAN("sql.safe_mode", "0", PHP_INI_SYSTEM, OnUpdateBool, sql_safe_mode, php_core_globals, core_globals) - STD_PHP_INI_ENTRY("safe_mode_exec_dir", "1", PHP_INI_SYSTEM, OnUpdateString, safe_mode_exec_dir, php_core_globals, core_globals) - STD_PHP_INI_BOOLEAN("enable_dl", "1", PHP_INI_SYSTEM, OnUpdateBool, enable_dl, php_core_globals, core_globals) - STD_PHP_INI_BOOLEAN("expose_php", "1", PHP_INI_SYSTEM, OnUpdateBool, expose_php, php_core_globals, core_globals) - - PHP_INI_ENTRY("SMTP", "localhost", PHP_INI_ALL, NULL) - PHP_INI_ENTRY("sendmail_path", DEFAULT_SENDMAIL_PATH, PHP_INI_SYSTEM, NULL) - PHP_INI_ENTRY("sendmail_from", NULL, PHP_INI_ALL, NULL) - - PHP_INI_ENTRY("error_reporting", NULL, PHP_INI_ALL, OnUpdateErrorReporting) - STD_PHP_INI_BOOLEAN("display_errors", "1", PHP_INI_ALL, OnUpdateBool, display_errors, php_core_globals, core_globals) - STD_PHP_INI_BOOLEAN("track_errors", "0", PHP_INI_ALL, OnUpdateBool, track_errors, php_core_globals, core_globals) - STD_PHP_INI_BOOLEAN("log_errors", "0", PHP_INI_ALL, OnUpdateBool, log_errors, php_core_globals, core_globals) - STD_PHP_INI_ENTRY("error_log", NULL, PHP_INI_ALL, OnUpdateString, error_log, php_core_globals, core_globals) - - - STD_PHP_INI_ENTRY("auto_prepend_file", NULL, PHP_INI_ALL, OnUpdateString, auto_prepend_file, php_core_globals, core_globals) - STD_PHP_INI_ENTRY("auto_append_file", NULL, PHP_INI_ALL, OnUpdateString, auto_append_file, php_core_globals, core_globals) - - STD_PHP_INI_BOOLEAN("y2k_compliance", "0", PHP_INI_ALL, OnUpdateBool, y2k_compliance, php_core_globals, core_globals) - - STD_PHP_INI_ENTRY("doc_root", NULL, PHP_INI_SYSTEM, OnUpdateStringUnempty, doc_root, php_core_globals, core_globals) - STD_PHP_INI_ENTRY("user_dir", NULL, PHP_INI_SYSTEM, OnUpdateStringUnempty, user_dir, php_core_globals, core_globals) - STD_PHP_INI_ENTRY("include_path", NULL, PHP_INI_ALL, OnUpdateStringUnempty, include_path, php_core_globals, core_globals) - STD_PHP_INI_ENTRY("open_basedir", NULL, PHP_INI_SYSTEM, OnUpdateStringUnempty, open_basedir, php_core_globals, core_globals) - STD_PHP_INI_ENTRY("extension_dir", NULL, PHP_INI_SYSTEM, OnUpdateStringUnempty, extension_dir, php_core_globals, core_globals) - - STD_PHP_INI_ENTRY("upload_tmp_dir", NULL, PHP_INI_SYSTEM, OnUpdateStringUnempty, upload_tmp_dir, php_core_globals, core_globals) - STD_PHP_INI_ENTRY("upload_max_filesize", "2097152", PHP_INI_ALL, OnUpdateInt, upload_max_filesize, php_core_globals, core_globals) - - PHP_INI_ENTRY("browscap", NULL, PHP_INI_SYSTEM, NULL) - - PHP_INI_ENTRY_EX("define_syslog_variables", "0", PHP_INI_ALL, NULL, php_ini_boolean_displayer_cb) - - PHP_INI_ENTRY("max_execution_time", "30", PHP_INI_ALL, OnChangeMaxExecutionTime) -#if MEMORY_LIMIT - PHP_INI_ENTRY("memory_limit", "8388608", PHP_INI_ALL, OnChangeMemoryLimit) -#endif - -#if PHP_TRACK_VARS /* "cc -32" on IRIX 6.4 does not like (PHP_TRACK_VARS?"1":"0") - thies 991004 */ - STD_PHP_INI_BOOLEAN("track_vars", "1", PHP_INI_ALL, OnUpdateBool, track_vars, php_core_globals, core_globals) -#else - STD_PHP_INI_BOOLEAN("track_vars", "0", PHP_INI_ALL, OnUpdateBool, track_vars, php_core_globals, core_globals) -#endif - - STD_PHP_INI_BOOLEAN("gpc_globals", "1", PHP_INI_ALL, OnUpdateBool, gpc_globals, php_core_globals, core_globals) - STD_PHP_INI_ENTRY("gpc_order", "GPC", PHP_INI_ALL, OnUpdateStringUnempty, gpc_order, php_core_globals, core_globals) - STD_PHP_INI_ENTRY("arg_separator", "&", PHP_INI_ALL, OnUpdateStringUnempty, arg_separator, php_core_globals, core_globals) - STD_PHP_INI_BOOLEAN("ignore_user_abort", "1", PHP_INI_ALL, OnUpdateBool, ignore_user_abort, php_core_globals, core_globals) -PHP_INI_END() - - - -/* True global (no need for thread safety */ -static int module_initialized = 0; - -#if 0 -#if APACHE -void php3_apache_puts(const char *s) -{ - SLS_FETCH(); - - if (SG(server_context)) { - if(rputs(s, (request_rec *) SG(server_context))==-1) { - PG(connection_status) |= PHP_CONNECTION_ABORTED; - } - } else { - fputs(s, stdout); - } -} - -void php3_apache_putc(char c) -{ - SLS_FETCH(); - - if (SG(server_context)) { - if(rputc(c, (request_rec *) SG(server_context))!=c) { - PG(connection_status) |= PHP_CONNECTION_ABORTED; - } - } else { - fputc(c, stdout); - } -} -#endif -#endif - -void php3_log_err(char *log_message) -{ - FILE *log_file; - PLS_FETCH(); -#if APACHE - SLS_FETCH(); -#endif - - /* Try to use the specified logging location. */ - if (PG(error_log) != NULL) { -#if HAVE_SYSLOG_H - if (!strcmp(PG(error_log), "syslog")) { - syslog(LOG_NOTICE, log_message); - return; - } else { -#endif - log_file = fopen(PG(error_log), "a"); - if (log_file != NULL) { - fprintf(log_file, log_message); - fprintf(log_file, "\n"); - fclose(log_file); - return; - } -#if HAVE_SYSLOG_H - } -#endif - } - /* Otherwise fall back to the default logging location. */ -#if APACHE - if (SG(server_context)) { -#if MODULE_MAGIC_NUMBER >= 19970831 - aplog_error(NULL, 0, APLOG_ERR | APLOG_NOERRNO, ((request_rec *) SG(server_context))->server, log_message); -#else - log_error(log_message, ((requset_rec *) SG(server_context))->server); -#endif - } else { - fprintf(stderr, log_message); - fprintf(stderr, "\n"); - } -#endif /*APACHE */ - -#if CGI_BINARY - if (php3_header()) { - fprintf(stderr, log_message); - fprintf(stderr, "\n"); - } -#endif -} - - -/* is 4K big enough? */ -#define PRINTF_BUFFER_SIZE 1024*4 - -/* wrapper for modules to use PHPWRITE */ -PHPAPI int php3_write(void *buf, int size) -{ - return PHPWRITE(buf, size); -} - -PHPAPI int php_printf(const char *format,...) -{ - va_list args; - int ret; - char buffer[PRINTF_BUFFER_SIZE]; - int size; - - va_start(args, format); - size = vsnprintf(buffer, sizeof(buffer), format, args); - ret = PHPWRITE(buffer, size); - va_end(args); - - return ret; -} - - -/* extended error handling function */ -PHPAPI void php_error(int type, const char *format,...) -{ - va_list args; - char *error_filename = NULL; - uint error_lineno; - char buffer[1024]; - int size = 0; - ELS_FETCH(); - PLS_FETCH(); - - - switch (type) { - case E_CORE_ERROR: - case E_CORE_WARNING: - error_filename = NULL; - error_lineno = 0; - break; - case E_PARSE: - case E_COMPILE_ERROR: - case E_COMPILE_WARNING: { - CLS_FETCH(); - - error_filename = zend_get_compiled_filename(); - error_lineno = CG(zend_lineno); - if (!error_filename) { - error_filename = zend_get_executed_filename(ELS_C); - } - } - break; - case E_ERROR: - case E_NOTICE: - case E_WARNING: - error_filename = zend_get_executed_filename(ELS_C); - error_lineno = zend_get_executed_lineno(ELS_C); - break; - default: - error_filename = NULL; - error_lineno = 0; - break; - } - - if (!error_filename) { - error_filename = "Unknown"; - } - - if (EG(error_reporting) & type || (type & E_CORE)) { - char *error_type_str; - - switch (type) { - case E_ERROR: - case E_CORE_ERROR: - case E_COMPILE_ERROR: - error_type_str = "Fatal error"; - break; - case E_WARNING: - case E_CORE_WARNING: - case E_COMPILE_WARNING: - error_type_str = "Warning"; - break; - case E_PARSE: - error_type_str = "Parse error"; - break; - case E_NOTICE: - error_type_str = "Warning"; - break; - default: - error_type_str = "Unknown error"; - break; - } - - /* get include file name */ - if (PG(log_errors) || PG(display_errors) || (!module_initialized)) { - va_start(args, format); - size = vsnprintf(buffer, sizeof(buffer) - 1, format, args); - va_end(args); - buffer[sizeof(buffer) - 1] = 0; - - if (PG(log_errors) || (!module_initialized)) { - char log_buffer[1024]; - - snprintf(log_buffer, 1024, "PHP %s: %s in %s on line %d", error_type_str, buffer, error_filename, error_lineno); - php3_log_err(log_buffer); - } - if (PG(display_errors)) { - char *prepend_string = INI_STR("error_prepend_string"); - char *append_string = INI_STR("error_append_string"); - - if (prepend_string) { - PUTS(prepend_string); - } - php_printf("<br>\n<b>%s</b>: %s in <b>%s</b> on line <b>%d</b><br>\n", error_type_str, buffer, error_filename, error_lineno); - if (append_string) { - PUTS(append_string); - } - } - } - } - if (PG(track_errors)) { - pval *tmp; - - va_start(args, format); - size = vsnprintf(buffer, sizeof(buffer) - 1, format, args); - va_end(args); - buffer[sizeof(buffer) - 1] = 0; - - tmp = (pval *)emalloc(sizeof(pval)); - INIT_PZVAL(tmp); - tmp->value.str.val = (char *) estrndup(buffer, size); - tmp->value.str.len = size; - tmp->type = IS_STRING; - - zend_hash_update(EG(active_symbol_table), "php_errormsg", sizeof("php_errormsg"), (void **) & tmp, sizeof(pval *), NULL); - } - - switch (type) { - case E_ERROR: - case E_CORE_ERROR: - /*case E_PARSE: the parser would return 1 (failure), we can bail out nicely */ - case E_COMPILE_ERROR: - if (module_initialized) { - zend_bailout(); - } - break; - } -} - - -static long php_timeout_seconds; - -#ifdef HAVE_SETITIMER -static void php_timeout(int dummy) -{ - PLS_FETCH(); - - PG(connection_status) |= PHP_CONNECTION_TIMEOUT; - php_error(E_ERROR, "Maximum execution time of %d second%s exceeded", - php_timeout_seconds, php_timeout_seconds == 1 ? "" : "s"); -} -#endif - -/* This one doesn't exists on QNX */ -#ifndef SIGPROF -#define SIGPROF 27 -#endif - -static void php_set_timeout(long seconds) -{ -#if WIN32|WINNT -#else -# ifdef HAVE_SETITIMER - struct itimerval t_r; /* timeout requested */ - - t_r.it_value.tv_sec = seconds; - t_r.it_value.tv_usec = t_r.it_interval.tv_sec = t_r.it_interval.tv_usec = 0; - - php_timeout_seconds = seconds; - setitimer(ITIMER_PROF, &t_r, NULL); - signal(SIGPROF, php_timeout); -# endif -#endif -} - - -static void php_unset_timeout(void) -{ -#if WIN32|WINNT -#else -# ifdef HAVE_SETITIMER - struct itimerval no_timeout; - - no_timeout.it_value.tv_sec = no_timeout.it_value.tv_usec = no_timeout.it_interval.tv_sec = no_timeout.it_interval.tv_usec = 0; - - setitimer(ITIMER_PROF, &no_timeout, NULL); -# endif -#endif -} - - -PHP_FUNCTION(set_time_limit) -{ - pval *new_timeout; - PLS_FETCH(); - - if (PG(safe_mode)) { - php_error(E_WARNING, "Cannot set time limit in safe mode"); - RETURN_FALSE; - } - if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &new_timeout) == FAILURE) { - WRONG_PARAM_COUNT; - } - convert_to_long(new_timeout); - /* FIXME ** This is BAD...in a threaded situation, any user - can set the timeout for php on a server wide basis. - INI variables should not be reset via a user script - - Fix what? At least on Unix, timers like these are - per-thread timers. Well, with a little work they will - be. If we use a bound thread and proper masking it - should work fine. Is this FIXME a WIN32 problem? Is - there no way to do per-thread timers on WIN32? - */ - php_unset_timeout(); - php_set_timeout(new_timeout->value.lval); -} - - -static FILE *php_fopen_wrapper_for_zend(const char *filename, char **opened_path) -{ - int issock=0, socketd=0; - int old_chunk_size; - FILE *retval; - - old_chunk_size = _php3_sock_set_def_chunk_size(1); - retval=php3_fopen_wrapper((char *) filename, "r", USE_PATH|IGNORE_URL_WIN, &issock, &socketd, opened_path); - _php3_sock_set_def_chunk_size(old_chunk_size); - - if (issock) { - retval = fdopen(socketd, "r"); - } - return retval; -} - - -static int php_get_ini_entry_for_zend(char *name, uint name_length, zval *contents) -{ - zval *retval = cfg_get_entry(name, name_length); - - if (retval) { - *contents = *retval; - return SUCCESS; - } else { - return FAILURE; - } -} - - -static void php_message_handler_for_zend(long message, void *data) -{ - switch (message) { - case ZMSG_ENABLE_TRACK_VARS: { - PLS_FETCH(); - - PG(track_vars) = 1; - } - break; - case ZMSG_FAILED_INCLUDE_FOPEN: { - PLS_FETCH(); - - php_error(E_WARNING, "Failed opening '%s' for inclusion (include_path='%s')", php3_strip_url_passwd((char *) data), STR_PRINT(PG(include_path))); - } - break; - case ZMSG_FAILED_REQUIRE_FOPEN: { - PLS_FETCH(); - - php_error(E_COMPILE_ERROR, "Failed opening required '%s' (include_path='%s')", php3_strip_url_passwd((char *) data), STR_PRINT(PG(include_path))); - } - break; - case ZMSG_FAILED_HIGHLIGHT_FOPEN: - php_error(E_WARNING, "Failed opening '%s' for highlighting", php3_strip_url_passwd((char *) data)); - break; - case ZMSG_MEMORY_LEAK_DETECTED: - case ZMSG_MEMORY_LEAK_REPEATED: { - ELS_FETCH(); - - if (EG(error_reporting)&E_WARNING) { -#if ZEND_DEBUG - char memory_leak_buf[512]; - SLS_FETCH(); - - if (message==ZMSG_MEMORY_LEAK_DETECTED) { - mem_header *t = (mem_header *) data; - void *ptr = (void *)((char *)t+sizeof(mem_header)+PLATFORM_PADDING); - - snprintf(memory_leak_buf, 512, "%s(%d) : Freeing 0x%.8lX (%d bytes), script=%s\n", t->filename, t->lineno, (unsigned long)ptr, t->size, SAFE_FILENAME(SG(request_info).path_translated)); - if (t->orig_filename) { - char relay_buf[512]; - - snprintf(relay_buf, 512, "%s(%d) : Actual location (location was relayed)\n", t->orig_filename, t->orig_lineno); - strcat(memory_leak_buf, relay_buf); - } - } else { - unsigned long leak_count = (unsigned long) data; - - snprintf(memory_leak_buf, 512, "Last leak repeated %ld time%s\n", leak_count, (leak_count>1?"s":"")); - } -# if WIN32||WINNT - OutputDebugString(memory_leak_buf); -# else - fprintf(stderr, memory_leak_buf); -# endif -#endif - } - } - break; - case ZMSG_LOG_SCRIPT_NAME: { - struct tm *ta, tmbuf; - time_t curtime; - char *datetime_str, asctimebuf[52]; - SLS_FETCH(); - - time(&curtime); - ta = localtime_r(&curtime, &tmbuf); - datetime_str = asctime_r(ta, asctimebuf); - datetime_str[strlen(datetime_str)-1]=0; /* get rid of the trailing newline */ - fprintf(stderr, "[%s] Script: '%s'\n", datetime_str, SAFE_FILENAME(SG(request_info).path_translated)); - } - break; - } -} - -static void php_start_post_request_startup(void *data) -{ - php_post_request_startup *ptr = (php_post_request_startup *) data; - - ptr->func(ptr->userdata); -} - -static void php_finish_post_request_startup(PLS_D) -{ - zend_llist_apply(&PG(ll_post_request_startup), php_start_post_request_startup); - zend_llist_destroy(&PG(ll_post_request_startup)); -} - -static void php_init_post_request_startup(PLS_D) -{ - zend_llist_init(&PG(ll_post_request_startup), sizeof(php_post_request_startup), NULL, 0); -} - -void php_register_post_request_startup(void (*func)(void *), void *userdata) -{ - php_post_request_startup ptr; - PLS_FETCH(); - - ptr.func = func; - ptr.userdata = userdata; - - zend_llist_add_element(&PG(ll_post_request_startup), &ptr); -} - -int php_request_startup(CLS_D ELS_DC PLS_DC SLS_DC) -{ - global_lock(); - - php_output_startup(); - php_init_post_request_startup(PLS_C); - -#if APACHE - /* - * For the Apache module version, this bit of code registers a cleanup - * function that gets triggered when our request pool is destroyed. - * We need this because at any point in our code we can be interrupted - * and that may happen before we have had time to free our memory. - * The php3_shutdown function needs to free all outstanding allocated - * memory. - */ - block_alarms(); - register_cleanup(((request_rec *) SG(server_context))->pool, NULL, php_request_shutdown, php_request_shutdown_for_exec); - unblock_alarms(); -#endif - - /* initialize global variables */ - { - PG(header_is_being_sent)=0; - } - - if (php3_init_request_info(NULL)) { - php_printf("Unable to initialize request info.\n"); - return FAILURE; - } - - zend_activate(CLS_C ELS_CC); - sapi_activate(SLS_C); - - php_set_timeout(PG(max_execution_time)); - - if (PG(expose_php)) { - sapi_add_header(estrdup(SAPI_PHP_VERSION_HEADER), sizeof(SAPI_PHP_VERSION_HEADER) - 1); - } - - if (PG(output_buffering)) { - php_start_ob_buffering(); - } - - if (SG(request_info).auth_user) { - zval *auth_user; - - MAKE_STD_ZVAL(auth_user); - auth_user->type = IS_STRING; - auth_user->value.str.val = SG(request_info).auth_user; - auth_user->value.str.len = strlen(auth_user->value.str.val); - - zend_hash_update(&EG(symbol_table), "PHP_AUTH_USER", sizeof("PHP_AUTH_USER"), &auth_user, sizeof(zval *), NULL); - } - if (SG(request_info).auth_password) { - zval *auth_password; - - MAKE_STD_ZVAL(auth_password); - auth_password->type = IS_STRING; - auth_password->value.str.val = SG(request_info).auth_password; - auth_password->value.str.len = strlen(auth_password->value.str.val); - - zend_hash_update(&EG(symbol_table), "PHP_AUTH_PW", sizeof("PHP_AUTH_PW"), &auth_password, sizeof(zval *), NULL); - } - - php_finish_post_request_startup(PLS_C); - - return SUCCESS; -} - - -void php_request_shutdown_for_exec(void *dummy) -{ - /* used to close fd's in the 3..255 range here, but it's problematic - */ - shutdown_memory_manager(1, 1); -} - - -static int return_one(void *p) -{ - return 1; -} - - -void php_request_shutdown(void *dummy) -{ - CLS_FETCH(); - ELS_FETCH(); - SLS_FETCH(); - - sapi_send_headers(); - php_end_ob_buffering(SG(request_info).headers_only?0:1); - - php_call_shutdown_functions(); - - php_ini_rshutdown(); - - zend_deactivate(CLS_C ELS_CC); - sapi_deactivate(SLS_C); - - php3_destroy_request_info(NULL); - shutdown_memory_manager(CG(unclean_shutdown), 0); - php_unset_timeout(); - - -#if CGI_BINARY - fflush(stdout); - if(request_info.php_argv0) { - free(request_info.php_argv0); - request_info.php_argv0 = NULL; - } -#endif - - global_unlock(); -} - - -static int php3_config_ini_startup(void) -{ - if (php3_init_config() == FAILURE) { - php_printf("PHP: Unable to parse configuration file.\n"); - return FAILURE; - } - return SUCCESS; -} - -static void php3_config_ini_shutdown(void) -{ - php3_shutdown_config(); -} - - -static int php_body_write_wrapper(const char *str, uint str_length) -{ - return php_body_write(str, str_length); -} - -#ifdef ZTS -static void php_new_thread_end_handler(THREAD_T thread_id) -{ - php_ini_refresh_caches(); -} -#endif - - -#ifdef ZTS -static void core_globals_ctor(php_core_globals *core_globals) -{ - memset(core_globals,0,sizeof(*core_globals)); -} - -#endif - - -int php_startup_extensions(zend_module_entry **ptr, int count) -{ - zend_module_entry **end = ptr+count; - - while (ptr < end) { - if (*ptr) { - if (zend_startup_module(*ptr)==FAILURE) { - return FAILURE; - } - } - ptr++; - } - return SUCCESS; -} - -int php_global_startup_extensions(zend_module_entry **ptr, int count) -{ - zend_module_entry **end = ptr+count; - - while (ptr < end) { - if (*ptr) { - if ((*ptr)->global_startup_func && - (*ptr)->global_startup_func()==FAILURE) { - return FAILURE; - } - } - ptr++; - } - return SUCCESS; -} - -int php_global_shutdown_extensions(zend_module_entry **ptr, int count) -{ - zend_module_entry **end = ptr+count; - - while (ptr < end) { - if (*ptr) { - if ((*ptr)->global_shutdown_func && - (*ptr)->global_shutdown_func()==FAILURE) { - return FAILURE; - } - } - ptr++; - } - return SUCCESS; -} - - -int php_module_startup(sapi_module_struct *sf) -{ - zend_utility_functions zuf; - zend_utility_values zuv; - int module_number=0; /* for REGISTER_INI_ENTRIES() */ -#ifdef ZTS - zend_executor_globals *executor_globals; - php_core_globals *core_globals; - sapi_globals_struct *sapi_globals = ts_resource(sapi_globals_id); -#endif -#if (WIN32|WINNT) && !(USE_SAPI) - WORD wVersionRequested = MAKEWORD(2, 0); - WSADATA wsaData; -#endif - - global_lock_init(); - SG(server_context) = NULL; - SG(request_info).request_method = NULL; - sapi_activate(SLS_C); - - if (module_initialized) { - return SUCCESS; - } - - sapi_module = *sf; - - php_output_startup(); - - zuf.error_function = php_error; - zuf.printf_function = php_printf; - zuf.write_function = php_body_write_wrapper; - zuf.fopen_function = php_fopen_wrapper_for_zend; - zuf.message_handler = php_message_handler_for_zend; - zuf.block_interruptions = BLOCK_INTERRUPTIONS; - zuf.unblock_interruptions = UNBLOCK_INTERRUPTIONS; - zuf.get_ini_entry = php_get_ini_entry_for_zend; - zend_startup(&zuf, NULL); - -#ifdef ZTS - tsrm_set_new_thread_end_handler(php_new_thread_end_handler); - executor_globals = ts_resource(executor_globals_id); - core_globals_id = ts_allocate_id(sizeof(php_core_globals), (ts_allocate_ctor) core_globals_ctor, NULL); - core_globals = ts_resource(core_globals_id); -#endif - EG(error_reporting) = E_ALL & ~E_NOTICE; - - PG(header_is_being_sent) = 0; - SG(request_info).headers_only = 0; - PG(connection_status) = PHP_CONNECTION_NORMAL; - -#if HAVE_SETLOCALE - setlocale(LC_CTYPE, ""); -#endif - -#if (WIN32|WINNT) && !(USE_SAPI) - /* start up winsock services */ - if (WSAStartup(wVersionRequested, &wsaData) != 0) { - php_printf("\nwinsock.dll unusable. %d\n", WSAGetLastError()); - return FAILURE; - } -#endif - - SET_MUTEX(gLock); - le_index_ptr = _register_list_destructors(NULL, NULL, 0); - FREE_MUTEX(gLock); - - php_ini_mstartup(); - - if (php3_config_ini_startup() == FAILURE) { - return FAILURE; - } - - REGISTER_INI_ENTRIES(); - - zuv.short_tags = (unsigned char) PG(short_tags); - zuv.asp_tags = (unsigned char) PG(asp_tags); - zuv.import_use_extension = ".php"; - zend_set_utility_values(&zuv); - php_startup_SAPI_content_types(); - - if (php_startup_internal_extensions() == FAILURE) { - php_printf("Unable to start builtin modules\n"); - return FAILURE; - } - module_initialized = 1; - sapi_deactivate(SLS_C); - return SUCCESS; -} - - - -void php_module_shutdown_for_exec() -{ - /* used to close fd's in the range 3.255 here, but it's problematic */ -} - - -int php_module_shutdown_wrapper(sapi_module_struct *sapi_globals) -{ - php_module_shutdown(); - return SUCCESS; -} - - -void php_module_shutdown() -{ - int module_number=0; /* for UNREGISTER_INI_ENTRIES() */ - - if (!module_initialized) { - return; - } -#if !USE_SAPI - /* close down the ini config */ - php3_config_ini_shutdown(); -#endif - -#if (WIN32|WINNT) && !(USE_SAPI) - /*close winsock */ - WSACleanup(); -#endif - -#if CGI_BINARY - fflush(stdout); -#endif -#if 0 /* SAPI */ - sapi_rqst->flush(sapi_rqst->scid); -#endif - - global_lock_destroy(); - zend_shutdown(); - UNREGISTER_INI_ENTRIES(); - php_ini_mshutdown(); - shutdown_memory_manager(0, 1); - module_initialized = 0; -} - - -/* in 3.1 some of this should move into sapi */ -static int zend_hash_environment(PLS_D ELS_DC SLS_DC) -{ - char **env, *p, *t; - unsigned char _gpc_flags[3] = {0,0,0}; - pval *tmp; - - p = PG(gpc_order); - while(*p) { - switch(*p++) { - case 'p': - case 'P': - if (!_gpc_flags[0] && !SG(headers_sent) && SG(request_info).request_method && !strcasecmp(SG(request_info).request_method, "POST")) { - php_treat_data(PARSE_POST, NULL ELS_CC PLS_CC SLS_CC); /* POST Data */ - _gpc_flags[0]=1; - } - break; - case 'c': - case 'C': - if (!_gpc_flags[1]) { - php_treat_data(PARSE_COOKIE, NULL ELS_CC PLS_CC SLS_CC); /* Cookie Data */ - _gpc_flags[1]=1; - } - break; - case 'g': - case 'G': - if (!_gpc_flags[2]) { - php_treat_data(PARSE_GET, NULL ELS_CC PLS_CC SLS_CC); /* GET Data */ - _gpc_flags[2]=1; - } - break; - } - } - - - for (env = environ; env != NULL && *env != NULL; env++) { - p = strchr(*env, '='); - if (!p) { /* malformed entry? */ - continue; - } - t = estrndup(*env, p - *env); - tmp = (pval *) emalloc(sizeof(pval)); - tmp->value.str.len = strlen(p + 1); - tmp->value.str.val = estrndup(p + 1, tmp->value.str.len); - tmp->type = IS_STRING; - INIT_PZVAL(tmp); - /* environmental variables never take precedence over get/post/cookie variables */ - zend_hash_add(&EG(symbol_table), t, p - *env + 1, &tmp, sizeof(pval *), NULL); - efree(t); - } - -#if APACHE - { - pval **tmp_ptr; - register int i; - array_header *arr = table_elts(((request_rec *) SG(server_context))->subprocess_env); - table_entry *elts = (table_entry *) arr->elts; - int len; - - for (i = 0; i < arr->nelts; i++) { - len = strlen(elts[i].key); - t = elts[i].key; - tmp = (pval *) emalloc(sizeof(pval)); - if (elts[i].val) { - tmp->value.str.len = strlen(elts[i].val); - tmp->value.str.val = estrndup(elts[i].val, tmp->value.str.len); - } else { - tmp->value.str.len = 0; - tmp->value.str.val = empty_string; - } - INIT_PZVAL(tmp); - tmp->type = IS_STRING; - zend_hash_update(&EG(symbol_table), t, strlen(t)+1, &tmp, sizeof(pval *), NULL); - } - /* insert special variables */ - if (zend_hash_find(&EG(symbol_table), "SCRIPT_FILENAME", sizeof("SCRIPT_FILENAME"), (void **) &tmp_ptr) == SUCCESS) { - (*tmp_ptr)->refcount++; - zend_hash_update(&EG(symbol_table), "PATH_TRANSLATED", sizeof("PATH_TRANSLATED"), tmp_ptr, sizeof(pval *), NULL); - } - tmp = (pval *) emalloc(sizeof(pval)); - tmp->value.str.len = strlen(((request_rec *) SG(server_context))->uri); - tmp->value.str.val = estrndup(((request_rec *) SG(server_context))->uri, tmp->value.str.len); - INIT_PZVAL(tmp); - tmp->type = IS_STRING; - zend_hash_update(&EG(symbol_table), "PHP_SELF", sizeof("PHP_SELF"), (void *) &tmp, sizeof(pval *), NULL); - } -#else - { - /* Build the special-case PHP_SELF variable for the CGI version */ - char *pi; -#if FORCE_CGI_REDIRECT - pi = SG(request_info).request_uri; - tmp = (pval *) emalloc(sizeof(pval)); - tmp->value.str.val = emalloc(((pi)?strlen(pi):0) + 1); - tmp->value.str.len = php_sprintf(tmp->value.str.val, "%s", (pi ? pi : "")); /* SAFE */ - tmp->type = IS_STRING; - INIT_PZVAL(tmp); -#else - int l = 0; - char *sn; - sn = request_info.script_name; - pi = SG(request_info).request_uri; - if (sn) - l += strlen(sn); - if (pi) - l += strlen(pi); - if (pi && sn && !strcmp(pi, sn)) { - l -= strlen(pi); - pi = NULL; - } - tmp = (pval *) emalloc(sizeof(pval)); - tmp->value.str.val = emalloc(l + 1); - tmp->value.str.len = php_sprintf(tmp->value.str.val, "%s%s", (sn ? sn : ""), (pi ? pi : "")); /* SAFE */ - tmp->type = IS_STRING; - INIT_PZVAL(tmp); -#endif - zend_hash_update(&EG(symbol_table), "PHP_SELF", sizeof("PHP_SELF"), (void *) & tmp, sizeof(pval *), NULL); - } -#endif - - - /* need argc/argv support as well */ - _php_build_argv(SG(request_info).query_string ELS_CC); - - return SUCCESS; -} - -void _php_build_argv(char *s ELS_DC) -{ - pval *arr, *tmp; - int count = 0; - char *ss, *space; - - arr = (pval *) emalloc(sizeof(pval)); - arr->value.ht = (HashTable *) emalloc(sizeof(HashTable)); - if (zend_hash_init(arr->value.ht, 0, NULL, PVAL_PTR_DTOR, 0) == FAILURE) { - php_error(E_WARNING, "Unable to create argv array"); - } else { - arr->type = IS_ARRAY; - INIT_PZVAL(arr); - zend_hash_update(&EG(symbol_table), "argv", sizeof("argv"), &arr, sizeof(pval *), NULL); - } - /* now pick out individual entries */ - ss = s; - while (ss) { - space = strchr(ss, '+'); - if (space) { - *space = '\0'; - } - /* auto-type */ - tmp = (pval *) emalloc(sizeof(pval)); - tmp->type = IS_STRING; - tmp->value.str.len = strlen(ss); - tmp->value.str.val = estrndup(ss, tmp->value.str.len); - INIT_PZVAL(tmp); - count++; - if (zend_hash_next_index_insert(arr->value.ht, &tmp, sizeof(pval *), NULL)==FAILURE) { - if (tmp->type == IS_STRING) { - efree(tmp->value.str.val); - } - } - if (space) { - *space = '+'; - ss = space + 1; - } else { - ss = space; - } - } - tmp = (pval *) emalloc(sizeof(pval)); - tmp->value.lval = count; - tmp->type = IS_LONG; - INIT_PZVAL(tmp); - zend_hash_add(&EG(symbol_table), "argc", sizeof("argc"), &tmp, sizeof(pval *), NULL); -} - - -#include "logos.h" - -PHPAPI void php_execute_script(zend_file_handle *primary_file CLS_DC ELS_DC PLS_DC) -{ - zend_file_handle *prepend_file_p, *append_file_p; - zend_file_handle prepend_file, append_file; - SLS_FETCH(); - - if (SG(request_info).query_string && SG(request_info).query_string[0]=='=' - && PG(expose_php)) { - if (!strcmp(SG(request_info).query_string+1, "PHPE9568F34-D428-11d2-A769-00AA001ACF42")) { - char *header_line = estrndup(CONTEXT_TYPE_IMAGE_GIF, sizeof(CONTEXT_TYPE_IMAGE_GIF)); - - php4i_add_header_information(header_line, sizeof(CONTEXT_TYPE_IMAGE_GIF)-1); - PHPWRITE(php4_logo, sizeof(php4_logo)); - return; - } else if (!strcmp(SG(request_info).query_string+1, "PHPE9568F35-D428-11d2-A769-00AA001ACF42")) { - char *header_line = estrndup(CONTEXT_TYPE_IMAGE_GIF, sizeof(CONTEXT_TYPE_IMAGE_GIF)); - - php4i_add_header_information(header_line, sizeof(CONTEXT_TYPE_IMAGE_GIF)-1); - PHPWRITE(zend_logo, sizeof(zend_logo)); - return; - } else if (!strcmp(SG(request_info).query_string+1, "PHPB8B5F2A0-3C92-11d3-A3A9-4C7B08C10000")) { - php_print_credits(PHP_CREDITS_ALL); - return; - } - } - - if (setjmp(EG(bailout))!=0) { - return; - } - -#if WIN32||WINNT - UpdateIniFromRegistry(primary_file->filename); -#endif - - if (PG(auto_prepend_file) && PG(auto_prepend_file)[0]) { - prepend_file.filename = PG(auto_prepend_file); - prepend_file.free_filename = 0; - prepend_file.type = ZEND_HANDLE_FILENAME; - prepend_file_p = &prepend_file; - } else { - prepend_file_p = NULL; - } - if (PG(auto_append_file) && PG(auto_append_file)[0]) { - append_file.filename = PG(auto_append_file); - append_file.free_filename = 0; - append_file.type = ZEND_HANDLE_FILENAME; - append_file_p = &append_file; - } else { - append_file_p = NULL; - } - EG(main_op_array) = zend_compile_files(0 CLS_CC, 3, prepend_file_p, primary_file, append_file_p); - if (EG(main_op_array)) { - zend_hash_environment(PLS_C ELS_CC SLS_CC); - EG(active_op_array) = EG(main_op_array); - zend_execute(EG(main_op_array) ELS_CC); - } -} - -#if WIN32||WINNT -/* just so that this symbol gets exported... */ -PHPAPI void dummy_indent() -{ - zend_indent(); -} -#endif - -/* - * Local variables: - * tab-width: 4 - * c-basic-offset: 4 - * End: - */ diff --git a/main/mergesort.c b/main/mergesort.c deleted file mode 100644 index 36c4dcab7f..0000000000 --- a/main/mergesort.c +++ /dev/null @@ -1,344 +0,0 @@ -/*- - * Copyright (c) 1992, 1993 - * The Regents of the University of California. All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * Peter McIlroy. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#if defined(LIBC_SCCS) && !defined(lint) -static char sccsid[] = "@(#)merge.c 8.2 (Berkeley) 2/14/94"; -#endif /* LIBC_SCCS and not lint */ - -/* - * Hybrid exponential search/linear search merge sort with hybrid - * natural/pairwise first pass. Requires about .3% more comparisons - * for random data than LSMS with pairwise first pass alone. - * It works for objects as small as two bytes. - */ - -#define NATURAL -#define THRESHOLD 16 /* Best choice for natural merge cut-off. */ - -/* #define NATURAL to get hybrid natural merge. - * (The default is pairwise merging.) - */ - -#include <sys/types.h> - -#include <errno.h> -#include <stdlib.h> -#include <string.h> - -#include "php.h" - -#if (WINNT|WIN32) -#include <winsock.h> /* Includes definition for u_char */ -#endif - -static void setup(u_char *list1, u_char *list2, size_t n, size_t size, int (*cmp)(const void *, const void *)); -static void insertionsort(u_char *a, size_t n, size_t size, int (*cmp)(const void *, const void *)); - -#define ISIZE sizeof(int) -#define PSIZE sizeof(u_char *) -#define ICOPY_LIST(src, dst, last) \ - do \ - *(int*)dst = *(int*)src, src += ISIZE, dst += ISIZE; \ - while(src < last) -#define ICOPY_ELT(src, dst, i) \ - do \ - *(int*) dst = *(int*) src, src += ISIZE, dst += ISIZE; \ - while (i -= ISIZE) - -#define CCOPY_LIST(src, dst, last) \ - do \ - *dst++ = *src++; \ - while (src < last) -#define CCOPY_ELT(src, dst, i) \ - do \ - *dst++ = *src++; \ - while (i -= 1) - -/* - * Find the next possible pointer head. (Trickery for forcing an array - * to do double duty as a linked list when objects do not align with word - * boundaries. - */ -/* Assumption: PSIZE is a power of 2. */ -#define EVAL(p) (u_char **) \ - ((u_char *)0 + \ - (((u_char *)p + PSIZE - 1 - (u_char *) 0) & ~(PSIZE - 1))) - -/* - * Arguments are as for qsort. - */ -int mergesort(void *base, size_t nmemb, size_t size, int (*cmp)(const void *, const void *)) -{ - register unsigned int i; - register int sense; - int big, iflag; - register u_char *f1, *f2, *t, *b, *tp2, *q, *l1, *l2; - u_char *list2, *list1, *p2, *p, *last, **p1; - - if (size < PSIZE / 2) { /* Pointers must fit into 2 * size. */ - errno = EINVAL; - return (-1); - } - - if (nmemb == 0) - return (0); - - /* - * XXX - * Stupid subtraction for the Cray. - */ - iflag = 0; - if (!(size % ISIZE) && !(((char *)base - (char *)0) % ISIZE)) - iflag = 1; - - if ((list2 = malloc(nmemb * size + PSIZE)) == NULL) - return (-1); - - list1 = base; - setup(list1, list2, nmemb, size, cmp); - last = list2 + nmemb * size; - i = big = 0; - while (*EVAL(list2) != last) { - l2 = list1; - p1 = EVAL(list1); - for (tp2 = p2 = list2; p2 != last; p1 = EVAL(l2)) { - p2 = *EVAL(p2); - f1 = l2; - f2 = l1 = list1 + (p2 - list2); - if (p2 != last) - p2 = *EVAL(p2); - l2 = list1 + (p2 - list2); - while (f1 < l1 && f2 < l2) { - if ((*cmp)(f1, f2) <= 0) { - q = f2; - b = f1, t = l1; - sense = -1; - } else { - q = f1; - b = f2, t = l2; - sense = 0; - } - if (!big) { /* here i = 0 */ - while ((b += size) < t && cmp(q, b) >sense) - if (++i == 6) { - big = 1; - goto EXPONENTIAL; - } - } else { -EXPONENTIAL: for (i = size; ; i <<= 1) - if ((p = (b + i)) >= t) { - if ((p = t - size) > b && - (*cmp)(q, p) <= sense) - t = p; - else - b = p; - break; - } else if ((*cmp)(q, p) <= sense) { - t = p; - if (i == size) - big = 0; - goto FASTCASE; - } else - b = p; - while (t > b+size) { - i = (((t - b) / size) >> 1) * size; - if ((*cmp)(q, p = b + i) <= sense) - t = p; - else - b = p; - } - goto COPY; -FASTCASE: while (i > size) - if ((*cmp)(q, - p = b + (i >>= 1)) <= sense) - t = p; - else - b = p; -COPY: b = t; - } - i = size; - if (q == f1) { - if (iflag) { - ICOPY_LIST(f2, tp2, b); - ICOPY_ELT(f1, tp2, i); - } else { - CCOPY_LIST(f2, tp2, b); - CCOPY_ELT(f1, tp2, i); - } - } else { - if (iflag) { - ICOPY_LIST(f1, tp2, b); - ICOPY_ELT(f2, tp2, i); - } else { - CCOPY_LIST(f1, tp2, b); - CCOPY_ELT(f2, tp2, i); - } - } - } - if (f2 < l2) { - if (iflag) - ICOPY_LIST(f2, tp2, l2); - else - CCOPY_LIST(f2, tp2, l2); - } else if (f1 < l1) { - if (iflag) - ICOPY_LIST(f1, tp2, l1); - else - CCOPY_LIST(f1, tp2, l1); - } - *p1 = l2; - } - tp2 = list1; /* swap list1, list2 */ - list1 = list2; - list2 = tp2; - last = list2 + nmemb*size; - } - if (base == list2) { - memmove(list2, list1, nmemb*size); - list2 = list1; - } - free(list2); - return (0); -} - -#define swap(a, b) { \ - s = b; \ - i = size; \ - do { \ - tmp = *a; *a++ = *s; *s++ = tmp; \ - } while (--i); \ - a -= size; \ - } -#define reverse(bot, top) { \ - s = top; \ - do { \ - i = size; \ - do { \ - tmp = *bot; *bot++ = *s; *s++ = tmp; \ - } while (--i); \ - s -= size2; \ - } while(bot < s); \ -} - -/* - * Optional hybrid natural/pairwise first pass. Eats up list1 in runs of - * increasing order, list2 in a corresponding linked list. Checks for runs - * when THRESHOLD/2 pairs compare with same sense. (Only used when NATURAL - * is defined. Otherwise simple pairwise merging is used.) - */ -static void setup(u_char *list1, u_char *list2, size_t n, size_t size, int (*cmp)(const void *, const void *)) -{ - int i, length, size2, tmp, sense; - u_char *f1, *f2, *s, *l2, *last, *p2; - - size2 = size*2; - if (n <= 5) { - insertionsort(list1, n, size, cmp); - *EVAL(list2) = (u_char*) list2 + n*size; - return; - } - /* - * Avoid running pointers out of bounds; limit n to evens - * for simplicity. - */ - i = 4 + (n & 1); - insertionsort(list1 + (n - i) * size, i, size, cmp); - last = list1 + size * (n - i); - *EVAL(list2 + (last - list1)) = list2 + n * size; - -#ifdef NATURAL - p2 = list2; - f1 = list1; - sense = (cmp(f1, f1 + size) > 0); - for (; f1 < last; sense = !sense) { - length = 2; - /* Find pairs with same sense. */ - for (f2 = f1 + size2; f2 < last; f2 += size2) { - if ((cmp(f2, f2+ size) > 0) != sense) - break; - length += 2; - } - if (length < THRESHOLD) { /* Pairwise merge */ - do { - p2 = *EVAL(p2) = f1 + size2 - list1 + list2; - if (sense > 0) - swap (f1, f1 + size); - } while ((f1 += size2) < f2); - } else { /* Natural merge */ - l2 = f2; - for (f2 = f1 + size2; f2 < l2; f2 += size2) { - if ((cmp(f2-size, f2) > 0) != sense) { - p2 = *EVAL(p2) = f2 - list1 + list2; - if (sense > 0) - reverse(f1, f2-size); - f1 = f2; - } - } - if (sense > 0) - reverse (f1, f2-size); - f1 = f2; - if (f2 < last || cmp(f2 - size, f2) > 0) - p2 = *EVAL(p2) = f2 - list1 + list2; - else - p2 = *EVAL(p2) = list2 + n*size; - } - } -#else /* pairwise merge only. */ - for (f1 = list1, p2 = list2; f1 < last; f1 += size2) { - p2 = *EVAL(p2) = p2 + size2; - if (cmp (f1, f1 + size) > 0) - swap(f1, f1 + size); - } -#endif /* NATURAL */ -} - -/* - * This is to avoid out-of-bounds addresses in sorting the - * last 4 elements. - */ -static void insertionsort(u_char *a, size_t n, size_t size, int (*cmp)(const void *, const void *)) -{ - u_char *ai, *s, *t, *u, tmp; - int i; - - for (ai = a+size; --n >= 1; ai += size) - for (t = ai; t > a; t -= size) { - u = t - size; - if (cmp(u, t) <= 0) - break; - swap(u, t); - } -} diff --git a/main/output.c b/main/output.c deleted file mode 100644 index a4b022313c..0000000000 --- a/main/output.c +++ /dev/null @@ -1,386 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | PHP version 4.0 | - +----------------------------------------------------------------------+ - | Copyright (c) 1997, 1998, 1999 The PHP Group | - +----------------------------------------------------------------------+ - | This source file is subject to version 2.0 of the PHP license, | - | that is bundled with this package in the file LICENSE, and is | - | available at through the world-wide-web at | - | http://www.php.net/license/2_0.txt. | - | If you did not receive a copy of the PHP license and are unable to | - | obtain it through the world-wide-web, please send a note to | - | license@php.net so we can mail you a copy immediately. | - +----------------------------------------------------------------------+ - | Authors: Andi Gutmans <andi@zend.com> | - | Zeev Suraski <zeev@zend.com> | - | Thies C. Arntzen <thies@digicol.de> | - +----------------------------------------------------------------------+ -*/ - - -#include "php.h" -#include "ext/standard/head.h" -#include "ext/session/php_session.h" -#include "SAPI.h" - -/* output functions */ -static int php_ub_body_write(const char *str, uint str_length); -static int php_ub_body_write_no_header(const char *str, uint str_length); -static int php_b_body_write(const char *str, uint str_length); - -static void php_ob_init(uint initial_size, uint block_size); -static void php_ob_destroy(void); -static void php_ob_append(const char *text, uint text_length); -#if 0 -static void php_ob_prepend(const char *text, uint text_length); -#endif -static inline void php_ob_send(void); - -void php_start_ob_buffering(void); -void php_end_ob_buffering(int send_buffer); -int php_ob_get_buffer(pval *p); - -/* HEAD support */ -void set_header_request(int value); - -typedef struct { - int (*php_body_write)(const char *str, uint str_length); /* string output */ - int (*php_header_write)(const char *str, uint str_length); /* unbuffer string output */ - char *ob_buffer; - uint ob_size; - uint ob_block_size; - uint ob_text_length; -} php_output_globals; - -#ifdef ZTS -#define OLS_D php_output_globals *output_globals -#define OLS_C output_globals -#define OG(v) (output_globals->v) -#define OLS_FETCH() php_output_globals *output_globals = ts_resource(output_globals_id) -int output_globals_id; -#else -#define OLS_D void -#define OLS_C -#define OG(v) (output_globals.v) -#define OLS_FETCH() -php_output_globals output_globals; -#endif - - -PHP_FUNCTION(ob_start); -PHP_FUNCTION(ob_end_flush); -PHP_FUNCTION(ob_end_clean); -PHP_FUNCTION(ob_get_contents); - - -static void php_output_init_globals(OLS_D) -{ - OG(php_body_write) = NULL; - OG(php_header_write) = NULL; - OG(ob_buffer) = NULL; - OG(ob_size) = 0; - OG(ob_block_size) = 0; - OG(ob_text_length) = 0; -} - - -PHP_GINIT_FUNCTION(output) -{ -#ifdef ZTS - output_globals_id = ts_allocate_id(sizeof(php_output_globals), NULL, NULL); -#else - php_output_init_globals(OLS_C); -#endif - - return SUCCESS; -} - -static zend_function_entry php_output_functions[] = { - PHP_FE(ob_start, NULL) - PHP_FE(ob_end_flush, NULL) - PHP_FE(ob_end_clean, NULL) - PHP_FE(ob_get_contents, NULL) - {NULL, NULL, NULL} -}; - -PHP_RINIT_FUNCTION(output); -PHP_RSHUTDOWN_FUNCTION(output); - -php3_module_entry output_module_entry = { - "PHP_output", - php_output_functions, - NULL, /* extension-wide startup function */ - NULL, /* extension-wide shutdown function */ - PHP_RINIT(output), /* per-request startup function */ - PHP_RSHUTDOWN(output), /* per-request shutdown function */ - NULL, /* information function */ - PHP_GINIT(output), /* global startup function */ - NULL, /* global shutdown function */ - STANDARD_MODULE_PROPERTIES_EX -}; - -PHP_RINIT_FUNCTION(output) -{ - php_output_startup(); - - return SUCCESS; -} - -PHP_RSHUTDOWN_FUNCTION(output) -{ - /* XXX needs filling in */ - return SUCCESS; -} - -/* Start output layer */ -PHPAPI void php_output_startup() -{ - OLS_FETCH(); - - OG(ob_buffer) = NULL; - OG(php_body_write) = php_ub_body_write; - OG(php_header_write) = sapi_module.ub_write; -} - -PHPAPI int php_body_write(const char *str, uint str_length) -{ - OLS_FETCH(); - return OG(php_body_write)(str, str_length); -} - -PHPAPI int php_header_write(const char *str, uint str_length) -{ - OLS_FETCH(); - return OG(php_header_write)(str, str_length); -} - -/* Start output buffering */ -PHPAPI void php_start_ob_buffering() -{ - OLS_FETCH(); - - php_ob_init(4096, 1024); - OG(php_body_write) = php_b_body_write; -} - - -/* End output buffering */ -PHPAPI void php_end_ob_buffering(int send_buffer) -{ - SLS_FETCH(); - OLS_FETCH(); - - if (!OG(ob_buffer)) { - return; - } - if (SG(headers_sent) && !SG(request_info).headers_only) { - OG(php_body_write) = php_ub_body_write_no_header; - } else { - OG(php_body_write) = php_ub_body_write; - } - if (send_buffer) { - php_ob_send(); - } - php_ob_destroy(); -} - - -/* - * Output buffering - implementation - */ - -static inline void php_ob_allocate(void) -{ - OLS_FETCH(); - - if (OG(ob_size)<OG(ob_text_length)) { - while (OG(ob_size) <= OG(ob_text_length)) - OG(ob_size)+=OG(ob_block_size); - - OG(ob_buffer) = (char *) erealloc(OG(ob_buffer), OG(ob_size)+1); - } -} - - -static void php_ob_init(uint initial_size, uint block_size) -{ - OLS_FETCH(); - - if (OG(ob_buffer)) { - return; - } - OG(ob_block_size) = block_size; - OG(ob_size) = initial_size; - OG(ob_buffer) = (char *) emalloc(initial_size+1); - OG(ob_text_length) = 0; -} - - -static void php_ob_destroy() -{ - OLS_FETCH(); - - if (OG(ob_buffer)) { - efree(OG(ob_buffer)); - OG(ob_buffer) = NULL; - } -} - - -static void php_ob_append(const char *text, uint text_length) -{ - char *target; - int original_ob_text_length; - OLS_FETCH(); - - original_ob_text_length=OG(ob_text_length); - - OG(ob_text_length) += text_length; - php_ob_allocate(); - target = OG(ob_buffer)+original_ob_text_length; - memcpy(target, text, text_length); - target[text_length]=0; -} - -#if 0 -static void php_ob_prepend(const char *text, uint text_length) -{ - char *p, *start; - OLS_FETCH(); - - OG(ob_text_length) += text_length; - php_ob_allocate(); - - /* php_ob_allocate() may change OG(ob_buffer), so we can't initialize p&start earlier */ - p = OG(ob_buffer)+OG(ob_text_length); - start = OG(ob_buffer); - - while (--p>=start) { - p[text_length] = *p; - } - memcpy(OG(ob_buffer), text, text_length); - OG(ob_buffer)[OG(ob_text_length)]=0; -} -#endif - -static inline void php_ob_send() -{ - OLS_FETCH(); - - /* header_write is a simple, unbuffered output function */ - OG(php_body_write)(OG(ob_buffer), OG(ob_text_length)); -} - - -/* Return the current output buffer */ -int php_ob_get_buffer(pval *p) -{ - OLS_FETCH(); - - if (!OG(ob_buffer)) { - return FAILURE; - } - p->type = IS_STRING; - p->value.str.val = estrndup(OG(ob_buffer), OG(ob_text_length)); - p->value.str.len = OG(ob_text_length); - return SUCCESS; -} - - -/* - * Wrapper functions - implementation - */ - - -/* buffered output function */ -static int php_b_body_write(const char *str, uint str_length) -{ - php_ob_append(str, str_length); - return str_length; -} - - -static int php_ub_body_write_no_header(const char *str, uint str_length) -{ - char *newstr = NULL; - uint new_length=0; - int result; - OLS_FETCH(); - - session_adapt_uris(str, str_length, &newstr, &new_length); - - if (newstr) { - str = newstr; - str_length = new_length; - } - - result = OG(php_header_write)(str, str_length); - - if (newstr) { - free(newstr); - } - - return result; -} - - -static int php_ub_body_write(const char *str, uint str_length) -{ - int result = 0; - SLS_FETCH(); - OLS_FETCH(); - - if (SG(request_info).headers_only) { - zend_bailout(); - } - if (php3_header()) { - OG(php_body_write) = php_ub_body_write_no_header; - result = php_ub_body_write_no_header(str, str_length); - } - - return result; -} - - -/* - * HEAD support - */ - -void set_header_request(int value) -{ - /* deprecated */ -} - -PHP_FUNCTION(ob_start) -{ - php_start_ob_buffering(); -} - - -PHP_FUNCTION(ob_end_flush) -{ - php_end_ob_buffering(1); -} - - -PHP_FUNCTION(ob_end_clean) -{ - php_end_ob_buffering(0); -} - - -PHP_FUNCTION(ob_get_contents) -{ - if (php_ob_get_buffer(return_value)==FAILURE) { - RETURN_FALSE; - } -} - - -/* - * Local variables: - * tab-width: 4 - * c-basic-offset: 4 - * End: - */ diff --git a/main/php.h b/main/php.h deleted file mode 100644 index 6caa8c445c..0000000000 --- a/main/php.h +++ /dev/null @@ -1,390 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | PHP version 4.0 | - +----------------------------------------------------------------------+ - | Copyright (c) 1997, 1998, 1999 The PHP Group | - +----------------------------------------------------------------------+ - | This source file is subject to version 2.0 of the PHP license, | - | that is bundled with this package in the file LICENSE, and is | - | available at through the world-wide-web at | - | http://www.php.net/license/2_0.txt. | - | If you did not receive a copy of the PHP license and are unable to | - | obtain it through the world-wide-web, please send a note to | - | license@php.net so we can mail you a copy immediately. | - +----------------------------------------------------------------------+ - | Authors: Andi Gutmans <andi@zend.com> | - | Zeev Suraski <zeev@zend.com> | - +----------------------------------------------------------------------+ - */ - -/* $Id$ */ - -#ifndef _PHP_H -#define _PHP_H - -#ifdef HAVE_DMALLOC -#include <dmalloc.h> -#endif - -#define PHP_API_VERSION 19990421 - -#define YYDEBUG 0 - -#define CGI_BINARY (!APACHE && !USE_SAPI && !FHTTPD) - -#include "php_version.h" -#include "zend.h" - -/* automake defines PACKAGE and VERSION for Zend too */ -#ifdef PACKAGE -# undef PACKAGE -#endif -#ifdef VERSION -# undef VERSION -#endif - -#include "zend_API.h" - - -extern unsigned char first_arg_force_ref[]; -extern unsigned char first_arg_allow_ref[]; -extern unsigned char second_arg_force_ref[]; -extern unsigned char second_arg_allow_ref[]; - - -/* somebody stealing BOOL from windows. pick something else! -#ifndef BOOL -#define BOOL MYBOOL -#endif -*/ - - -#if WIN32 -#include "config.w32.h" -#include "win95nt.h" -# ifdef PHP_EXPORTS -# define PHPAPI __declspec(dllexport) -# else -# define PHPAPI __declspec(dllimport) -# endif -#else -#include "php_config.h" -#define PHPAPI -#define THREAD_LS -#endif - -#include "php_regex.h" - -/* PHP's DEBUG value must match Zend's ZEND_DEBUG value */ -#undef DEBUG -#define DEBUG ZEND_DEBUG - - -#if DEBUG || !(defined(__GNUC__)||defined(WIN32)) -#ifdef inline -#undef inline -#endif -#define inline -#endif - - -#if HAVE_UNIX_H -#include <unix.h> -#endif - -#if HAVE_ALLOCA_H -#include <alloca.h> -#endif - -#ifndef HAVE_STRLCPY -size_t strlcpy(char *dst, const char *src, size_t siz); -#endif - -#ifndef HAVE_STRLCAT -size_t strlcat(char *dst, const char *src, size_t siz); -#endif - -#ifndef HAVE_STRTOK_R -char *strtok_r(char *s, const char *delim, char **last); -#endif - -#include "request_info.h" - -#if HAVE_LIBDL -# if MSVC5 -# include <windows.h> -# define dlclose FreeLibrary -# define dlopen(a,b) LoadLibrary(a) -# define dlsym GetProcAddress -# else -#if HAVE_DLFCN_H && !((defined(_AIX) || defined(AIX)) && APACHE) -# include <dlfcn.h> -#endif -# endif -#endif - -#define CREATE_MUTEX(a,b) -#define SET_MUTEX(a) -#define FREE_MUTEX(a) - -/* - * Then the ODBC support can use both iodbc and Solid, - * uncomment this. - * #define HAVE_ODBC (HAVE_IODBC|HAVE_SOLID) - */ - -#include <stdlib.h> -#include <ctype.h> -#if HAVE_UNISTD_H -#include <unistd.h> -#endif -#if HAVE_STDARG_H -#include <stdarg.h> -#else -# if HAVE_SYS_VARARGS_H -# include <sys/varargs.h> -# endif -#endif - - -#include "zend_hash.h" -#include "php3_compat.h" -#include "zend_alloc.h" -#include "zend_stack.h" - -typedef zval pval; - -#define pval_copy_constructor zval_copy_ctor -#define pval_destructor zval_dtor - -#if STDC_HEADERS -# include <string.h> -#else -# ifndef HAVE_MEMCPY -# define memcpy(d, s, n) bcopy((s), (d), (n)) -# define memmove(d, s, n) bcopy ((s), (d), (n)) -# endif -#endif - -#include "safe_mode.h" - -#ifndef HAVE_STRERROR -extern char *strerror(int); -#endif - -#include "fopen-wrappers.h" - -#if APACHE /* apache httpd */ -# if HAVE_AP_CONFIG_H -#include "ap_config_auto.h" -#ifdef RHAPSODY -#undef HAVE_SNPRINTF -#endif -#include "ap_config.h" -#ifdef RHAPSODY -#undef HAVE_SNPRINTF -#define HAVE_SNPRINTF 1 -#endif -# endif -# if HAVE_OLD_COMPAT_H -#include "compat.h" -# endif -# if HAVE_AP_COMPAT_H -#include "ap_compat.h" -# endif -#include "httpd.h" -#include "http_main.h" -#include "http_core.h" -#include "http_request.h" -#include "http_protocol.h" -#include "http_config.h" -#include "http_log.h" -#define BLOCK_INTERRUPTIONS block_alarms -#define UNBLOCK_INTERRUPTIONS unblock_alarms -#endif - -#if REGEX == 1 || REGEX == 0 -#include "regex/regex_extra.h" -#endif - -#if HAVE_PWD_H -# if WIN32||WINNT -#include "win32/pwd.h" -#include "win32/param.h" -# else -#include <pwd.h> -#include <sys/param.h> -# endif -#endif -#if CGI_BINARY /* CGI version */ -#define BLOCK_INTERRUPTIONS NULL -#define UNBLOCK_INTERRUPTIONS NULL -#endif - -#if HAVE_LIMITS_H -#include <limits.h> -#endif - -#ifndef LONG_MAX -#define LONG_MAX 2147483647L -#endif - -#ifndef LONG_MIN -#define LONG_MIN (- LONG_MAX - 1) -#endif - -#if (!HAVE_SNPRINTF) -#define snprintf ap_snprintf -#define vsnprintf ap_vsnprintf -extern int ap_snprintf(char *, size_t, const char *, ...); -extern int ap_vsnprintf(char *, size_t, const char *, va_list); -#endif - -#define EXEC_INPUT_BUF 4096 - - -#define DONT_FREE 0 -#define DO_FREE 1 - -#define PHP3_MIME_TYPE "application/x-httpd-php3" - -/* macros */ -#undef MIN -#undef MAX -#undef COPY_STRING -#define DO_OR_DIE(retvalue) if (retvalue==FAILURE) { return FAILURE; } -#define MAX(a,b) (((a)>(b))?(a):(b)) -#define MIN(a,b) (((a)<(b))?(a):(b)) -#define STR_FREE(ptr) if (ptr && ptr!=empty_string && ptr!=undefined_variable_string) { efree(ptr); } -#define COPY_STRING(yy) (yy).value.str.val = (char *) estrndup((yy).value.str.val,(yy).value.str.len) -#define STR_PRINT(str) ((str)?(str):"") - -#ifndef MAXPATHLEN -#define MAXPATHLEN 256 /* Should be safe for any weird systems that do not define it */ -#endif - -#define PHP_FN(name) php3_##name -#define PHP_NAMED_FUNCTION(name) void name(INTERNAL_FUNCTION_PARAMETERS) -#define PHP_FUNCTION(name) PHP_NAMED_FUNCTION(php3_##name) - -#define PHP_NAMED_FE(php_name, name, arg_types) { #php_name, name, arg_types }, -#define PHP_FE(name, arg_types) PHP_NAMED_FE(name, php3_##name, arg_types) -#define PHP_FALIAS(name, alias, arg_types) PHP_NAMED_FE(name, php3_##alias, arg_types) - -#define PHP_MINIT(module) php3_minit_##module -#define PHP_MSHUTDOWN(module) php3_mshutdown_##module -#define PHP_RINIT(module) php3_rinit_##module -#define PHP_RSHUTDOWN(module) php3_rshutdown_##module -#define PHP_MINFO(module) php3_info_##module -#define PHP_GINIT(module) php3_ginit_##module -#define PHP_GSHUTDOWN(module) php3_gshutdown_##module - -#define PHP_MINIT_FUNCTION(module) int PHP_MINIT(module)(INIT_FUNC_ARGS) -#define PHP_MSHUTDOWN_FUNCTION(module) int PHP_MSHUTDOWN(module)(SHUTDOWN_FUNC_ARGS) -#define PHP_RINIT_FUNCTION(module) int PHP_RINIT(module)(INIT_FUNC_ARGS) -#define PHP_RSHUTDOWN_FUNCTION(module) int PHP_RSHUTDOWN(module)(SHUTDOWN_FUNC_ARGS) -#define PHP_MINFO_FUNCTION(module) void PHP_MINFO(module)(ZEND_MODULE_INFO_FUNC_ARGS) -#define PHP_GINIT_FUNCTION(module) static int PHP_GINIT(module)(void) -#define PHP_GSHUTDOWN_FUNCTION(module) static int PHP_GSHUTDOWN(module)(void) - - -/* global variables */ -extern pval *data; -#if !(WIN32||WINNT) -extern char **environ; -#endif - -extern void phperror(char *error); -extern PHPAPI void php_error(int type, const char *format,...); -extern PHPAPI int php3_write(void *buf, int size); -extern PHPAPI int php_printf(const char *format,...); -extern void php3_log_err(char *log_message); -extern int Debug(char *format,...); -extern int cfgparse(void); - -extern void html_putc(char c); - -#define zenderror phperror -#define zendlex phplex - -#define phpparse zendparse -#define phprestart zendrestart -#define phpin zendin - -/* functions */ -int php_startup_internal_extensions(void); -int php_global_startup_internal_extensions(void); -int php_global_shutdown_internal_extensions(void); - -int mergesort(void *base, size_t nmemb, register size_t size, int (*cmp) (const void *, const void *)); - -/*from basic functions*/ -extern PHPAPI int _php_error_log(int opt_err,char *message,char *opt,char *headers); - -PHPAPI void php_register_post_request_startup(void (*func)(void *), void *userdata); - -PHPAPI int cfg_get_long(char *varname, long *result); -PHPAPI int cfg_get_double(char *varname, double *result); -PHPAPI int cfg_get_string(char *varname, char **result); - - -/* Output support */ -#include "ext/standard/php_output.h" -#define PHPWRITE(str, str_len) php_body_write((str), (str_len)) -#define PUTS(str) php_body_write((str), strlen((str))) -#define PUTC(c) (php_body_write(&(c), 1), (c)) -#define PHPWRITE_H(str, str_len) php_header_write((str), (str_len)) -#define PUTS_H(str) php_header_write((str), strlen((str))) -#define PUTC_H(c) (php_header_write(&(c), 1), (c)) - - -#include "zend_operators.h" -#include "zend_variables.h" -#include "zend_constants.h" - -/* connection status states */ -#define PHP_CONNECTION_NORMAL 0 -#define PHP_CONNECTION_ABORTED 1 -#define PHP_CONNECTION_TIMEOUT 2 - -#include "php_reentrancy.h" - -/* Finding offsets of elements within structures. - * Taken from the Apache code, which in turn, was taken from X code... - */ - -#if defined(CRAY) || (defined(__arm) && !defined(LINUX)) -#ifdef __STDC__ -#define XtOffset(p_type,field) _Offsetof(p_type,field) -#else -#ifdef CRAY2 -#define XtOffset(p_type,field) \ - (sizeof(int)*((unsigned int)&(((p_type)NULL)->field))) - -#else /* !CRAY2 */ - -#define XtOffset(p_type,field) ((unsigned int)&(((p_type)NULL)->field)) - -#endif /* !CRAY2 */ -#endif /* __STDC__ */ -#else /* ! (CRAY || __arm) */ - -#define XtOffset(p_type,field) \ - ((long) (((char *) (&(((p_type)NULL)->field))) - ((char *) NULL))) - -#endif /* !CRAY */ - -#ifdef offsetof -#define XtOffsetOf(s_type,field) offsetof(s_type,field) -#else -#define XtOffsetOf(s_type,field) XtOffset(s_type*,field) -#endif - -#endif - -/* - * Local variables: - * tab-width: 4 - * c-basic-offset: 4 - * End: - */ diff --git a/main/php3_compat.h b/main/php3_compat.h deleted file mode 100644 index be0a5fa281..0000000000 --- a/main/php3_compat.h +++ /dev/null @@ -1,93 +0,0 @@ -#ifndef _PHP_COMPAT_H -#define _PHP_COMPAT_H - -#define _php3_hash_init zend_hash_init -#define _php3_hash_destroy zend_hash_destroy - -#define _php3_hash_clean zend_hash_clean - -#define _php3_hash_add_or_update zend_hash_add_or_update -#define _php3_hash_add zend_hash_add -#define _php3_hash_update zend_hash_update -#define _php3_hash_update_ptr zend_hash_update_ptr - -#define _php3_hash_quick_add_or_update zend_hash_quick_add_or_update -#define _php3_hash_quick_add zend_hash_quick_add -#define _php3_hash_quick_update zend_hash_quick_update - -#define _php3_hash_index_update_or_next_insert zend_hash_index_update_or_next_insert -#define _php3_hash_index_update zend_hash_index_update -#define _php3_hash_next_index_insert zend_hash_next_index_insert - -#define _php3_hash_pointer_update zend_hash_pointer_update - -#define _php3_hash_pointer_index_update_or_next_insert zend_hash_pointer_index_update_or_next_insert -#define _php3_hash_pointer_index_update zend_hash_pointer_index_update -#define _php3_hash_next_index_pointer_update zend_hash_next_index_pointer_update -#define _php3_hash_next_index_pointer_insert zend_hash_next_index_pointer_insert - -#define _php3_hash_del_key_or_index zend_hash_del_key_or_index -#define _php3_hash_del zend_hash_del -#define _php3_hash_index_del zend_hash_index_del - -#define _php3_hash_find zend_hash_find -#define _php3_hash_quick_find zend_hash_quick_find -#define _php3_hash_index_find zend_hash_index_find - -#define _php3_hash_exists zend_hash_exists -#define _php3_hash_index_exists zend_hash_index_exists -#define _php3_hash_is_pointer zend_hash_is_pointer -#define _php3_hash_index_is_pointer zend_hash_index_is_pointer -#define _php3_hash_next_free_element zend_hash_next_free_element - -#define _php3_hash_move_forward zend_hash_move_forward -#define _php3_hash_move_backwards zend_hash_move_backwards -#define _php3_hash_get_current_key zend_hash_get_current_key -#define _php3_hash_get_current_data zend_hash_get_current_data -#define _php3_hash_internal_pointer_reset zend_hash_internal_pointer_reset -#define _php3_hash_internal_pointer_end zend_hash_internal_pointer_end - -#define _php3_hash_copy zend_hash_copy -#define _php3_hash_merge zend_hash_merge -#define _php3_hash_sort zend_hash_sort -#define _php3_hash_minmax zend_hash_minmax - -#define _php3_hash_num_elements zend_hash_num_elements - -#define _php3_hash_apply zend_hash_apply -#define _php3_hash_apply_with_argument zend_hash_apply_with_argument - - -#define php3_error php_error - -#define php3_printf php_printf -#define _php3_sprintf php_sprintf - - - -#define php3_module_entry zend_module_entry - -#define php3_strndup zend_strndup -#define php3_str_tolower zend_str_tolower -#define php3_binary_strcmp zend_binary_strcmp - - -#define php3_list_insert zend_list_insert -#define php3_list_find zend_list_find -#define php3_list_delete zend_list_delete - -#define php3_plist_insert zend_plist_insert -#define php3_plist_find zend_plist_find -#define php3_plist_delete zend_plist_delete - -#define zend_print_pval zend_print_zval -#define zend_print_pval_r zend_print_zval_r - - -#define function_entry zend_function_entry - -#define _php3_addslashes php_addslashes -#define _php3_stripslashes php_stripslashes -#define php3_dl php_dl - -#endif /* _PHP_COMPAT_H */ diff --git a/main/php_content_types.c b/main/php_content_types.c deleted file mode 100644 index e273723eb8..0000000000 --- a/main/php_content_types.c +++ /dev/null @@ -1,29 +0,0 @@ -#include "php.h" -#include "SAPI.h" -#include "rfc1867.h" - -#include "php_content_types.h" - -static sapi_post_content_type_reader php_post_content_types[] = { - { MULTIPART_CONTENT_TYPE, sizeof(MULTIPART_CONTENT_TYPE)-1, rfc1867_post_reader }, - { NULL, 0, NULL } -}; - - -SAPI_POST_READER_FUNC(php_default_post_reader) -{ - char *data; - ELS_FETCH(); - - sapi_read_standard_form_data(content_type_dup SLS_CC); - data = estrndup(SG(request_info).post_data,SG(request_info).post_data_length); - SET_VAR_STRINGL("HTTP_RAW_POST_DATA", data, SG(request_info).post_data_length); -} - - -int php_startup_SAPI_content_types(void) -{ - sapi_register_post_readers(php_post_content_types); - sapi_register_default_post_reader(php_default_post_reader); - return SUCCESS; -} diff --git a/main/php_content_types.h b/main/php_content_types.h deleted file mode 100644 index 429d9a7502..0000000000 --- a/main/php_content_types.h +++ /dev/null @@ -1,7 +0,0 @@ -#ifndef _PHP_CONTENT_TYPES_H -#define _PHP_CONTENT_TYPES_H - -SAPI_POST_READER_FUNC(php_default_post_reader); -int php_startup_SAPI_content_types(void); - -#endif /* _PHP_CONTENT_TYPES_H */ diff --git a/main/php_globals.h b/main/php_globals.h deleted file mode 100644 index b11f8a7816..0000000000 --- a/main/php_globals.h +++ /dev/null @@ -1,112 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | PHP version 4.0 | - +----------------------------------------------------------------------+ - | Copyright (c) 1997, 1998, 1999 The PHP Group | - +----------------------------------------------------------------------+ - | This source file is subject to version 2.0 of the PHP license, | - | that is bundled with this package in the file LICENSE, and is | - | available at through the world-wide-web at | - | http://www.php.net/license/2_0.txt. | - | If you did not receive a copy of the PHP license and are unable to | - | obtain it through the world-wide-web, please send a note to | - | license@php.net so we can mail you a copy immediately. | - +----------------------------------------------------------------------+ - | Authors: Zeev Suraski <zeev@zend.com> | - +----------------------------------------------------------------------+ -*/ - - -#ifndef _PHP_GLOBALS_H -#define _PHP_GLOBALS_H - -#include "zend_globals.h" - -typedef struct _php_core_globals php_core_globals; - -#ifdef ZTS -# define PLS_D php_core_globals *core_globals -# define PLS_DC , PLS_D -# define PLS_C core_globals -# define PLS_CC , PLS_C -# define PG(v) (core_globals->v) -# define PLS_FETCH() php_core_globals *core_globals = ts_resource(core_globals_id) -extern PHPAPI int core_globals_id; -#else -# define PLS_D -# define PLS_DC -# define PLS_C -# define PLS_CC -# define PG(v) (core_globals.v) -# define PLS_FETCH() -extern ZEND_API struct _php_core_globals core_globals; -#endif - - -struct _php_core_globals { - zend_bool magic_quotes_gpc; - zend_bool magic_quotes_runtime; - zend_bool magic_quotes_sybase; - - zend_bool asp_tags; - zend_bool short_tags; - zend_bool output_buffering; - - zend_bool safe_mode; - zend_bool sql_safe_mode; - char *safe_mode_exec_dir; - zend_bool enable_dl; - - long memory_limit; - - zend_bool track_errors; - zend_bool display_errors; - zend_bool log_errors; - char *error_log; - - char *doc_root; - char *user_dir; - char *include_path; - char *open_basedir; - char *extension_dir; - - char *upload_tmp_dir; - long upload_max_filesize; - - char *auto_prepend_file; - char *auto_append_file; - - char *arg_separator; - char *gpc_order; - - zend_bool expose_php; - - zend_bool track_vars; - zend_bool gpc_globals; - - zend_bool y2k_compliance; - - short connection_status; - short ignore_user_abort; - - long max_execution_time; - - unsigned char header_is_being_sent; - - zend_llist ll_post_request_startup; -}; - - -typedef struct { - void (*func)(void *); - void *userdata; -} php_post_request_startup; - -#endif /* _PHP_GLOBALS_H */ - -/* - * Local variables: - * tab-width: 4 - * c-basic-offset: 4 - * End: - */ diff --git a/main/php_ini.c b/main/php_ini.c deleted file mode 100644 index 7848008652..0000000000 --- a/main/php_ini.c +++ /dev/null @@ -1,460 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | PHP version 4.0 | - +----------------------------------------------------------------------+ - | Copyright (c) 1997, 1998, 1999 The PHP Group | - +----------------------------------------------------------------------+ - | This source file is subject to version 2.0 of the PHP license, | - | that is bundled with this package in the file LICENSE, and is | - | available at through the world-wide-web at | - | http://www.php.net/license/2_0.txt. | - | If you did not receive a copy of the PHP license and are unable to | - | obtain it through the world-wide-web, please send a note to | - | license@php.net so we can mail you a copy immediately. | - +----------------------------------------------------------------------+ - | Author: Zeev Suraski <zeev@zend.com> | - +----------------------------------------------------------------------+ - */ - - -#include <stdlib.h> - -#include "php.h" -#include "php_ini.h" -#include "zend_alloc.h" -#include "php_globals.h" -#include "ext/standard/info.h" - -static HashTable known_directives; - - -/* - * hash_apply functions - */ -static int php_remove_ini_entries(php_ini_entry *ini_entry, int *module_number) -{ - if (ini_entry->module_number == *module_number) { - return 1; - } else { - return 0; - } -} - - -static int php_restore_ini_entry_cb(php_ini_entry *ini_entry) -{ - if (ini_entry->modified) { - if (ini_entry->on_modify) { - ini_entry->on_modify(ini_entry, ini_entry->orig_value, ini_entry->orig_value_length, ini_entry->mh_arg1, ini_entry->mh_arg2, ini_entry->mh_arg3); - } - efree(ini_entry->value); - ini_entry->value = ini_entry->orig_value; - ini_entry->value_length = ini_entry->orig_value_length; - ini_entry->modified = 0; - ini_entry->orig_value = NULL; - ini_entry->orig_value_length = 0; - } - return 0; -} - -/* - * Startup / shutdown - */ -int php_ini_mstartup() -{ - if (zend_hash_init(&known_directives, 100, NULL, NULL, 1)==FAILURE) { - return FAILURE; - } - return SUCCESS; -} - - -int php_ini_mshutdown() -{ - zend_hash_destroy(&known_directives); - return SUCCESS; -} - - -int php_ini_rshutdown() -{ - zend_hash_apply(&known_directives, (int (*)(void *)) php_restore_ini_entry_cb); - return SUCCESS; -} - -/* - * Registration / unregistration - */ - -PHPAPI int php_register_ini_entries(php_ini_entry *ini_entry, int module_number) -{ - php_ini_entry *p = ini_entry; - php_ini_entry *hashed_ini_entry; - pval *default_value; - - while (p->name) { - p->module_number = module_number; - if (zend_hash_add(&known_directives, p->name, p->name_length, p, sizeof(php_ini_entry), (void **) &hashed_ini_entry)==FAILURE) { - php_unregister_ini_entries(module_number); - return FAILURE; - } - if (hashed_ini_entry->on_modify) { - hashed_ini_entry->on_modify(hashed_ini_entry, hashed_ini_entry->value, hashed_ini_entry->value_length, hashed_ini_entry->mh_arg1, hashed_ini_entry->mh_arg2, hashed_ini_entry->mh_arg3); - } - if ((default_value=cfg_get_entry(p->name, p->name_length))) { - if (!hashed_ini_entry->on_modify - || hashed_ini_entry->on_modify(hashed_ini_entry, default_value->value.str.val, default_value->value.str.len, hashed_ini_entry->mh_arg1, hashed_ini_entry->mh_arg2, hashed_ini_entry->mh_arg3)==SUCCESS) { - hashed_ini_entry->value = default_value->value.str.val; - hashed_ini_entry->value_length = default_value->value.str.len; - } - } else { - if (hashed_ini_entry->on_modify) { - hashed_ini_entry->on_modify(hashed_ini_entry, hashed_ini_entry->value, hashed_ini_entry->value_length, hashed_ini_entry->mh_arg1, hashed_ini_entry->mh_arg2, hashed_ini_entry->mh_arg3); - } - } - hashed_ini_entry->modified = 0; - p++; - } - return SUCCESS; -} - - -PHPAPI void php_unregister_ini_entries(int module_number) -{ - zend_hash_apply_with_argument(&known_directives, (int (*)(void *, void *)) php_remove_ini_entries, (void *) &module_number); -} - - -static int php_ini_refresh_cache(php_ini_entry *p) -{ - if (p->on_modify) { - p->on_modify(p, p->value, p->value_length, p->mh_arg1, p->mh_arg2, p->mh_arg3); - } - return 0; -} - - -PHPAPI void php_ini_refresh_caches() -{ - zend_hash_apply(&known_directives, (int (*)(void *)) php_ini_refresh_cache); -} - - -PHPAPI int php_alter_ini_entry(char *name, uint name_length, char *new_value, uint new_value_length, int modify_type) -{ - php_ini_entry *ini_entry; - char *duplicate; - - if (zend_hash_find(&known_directives, name, name_length, (void **) &ini_entry)==FAILURE) { - return FAILURE; - } - - if (!(ini_entry->modifyable & modify_type)) { - return FAILURE; - } - - duplicate = estrndup(new_value, new_value_length); - - if (!ini_entry->on_modify - || ini_entry->on_modify(ini_entry, duplicate, new_value_length, ini_entry->mh_arg1, ini_entry->mh_arg2, ini_entry->mh_arg3)==SUCCESS) { - if (!ini_entry->modified) { - ini_entry->orig_value = ini_entry->value; - ini_entry->orig_value_length = ini_entry->value_length; - } else { /* we already changed the value, free the changed value */ - efree(ini_entry->value); - } - ini_entry->value = duplicate; - ini_entry->value_length = new_value_length; - ini_entry->modified = 1; - } else { - efree(duplicate); - } - - return SUCCESS; -} - - -PHPAPI int php_restore_ini_entry(char *name, uint name_length) -{ - php_ini_entry *ini_entry; - - if (zend_hash_find(&known_directives, name, name_length, (void **) &ini_entry)==FAILURE) { - return FAILURE; - } - - php_restore_ini_entry_cb(ini_entry); - return SUCCESS; -} - - -PHPAPI int php_ini_register_displayer(char *name, uint name_length, void (*displayer)(php_ini_entry *ini_entry, int type)) -{ - php_ini_entry *ini_entry; - - if (zend_hash_find(&known_directives, name, name_length, (void **) &ini_entry)==FAILURE) { - return FAILURE; - } - - ini_entry->displayer = displayer; - return SUCCESS; -} - - - -/* - * Data retrieval - */ - -PHPAPI long php_ini_long(char *name, uint name_length, int orig) -{ - php_ini_entry *ini_entry; - - if (zend_hash_find(&known_directives, name, name_length, (void **) &ini_entry)==SUCCESS) { - if (orig && ini_entry->modified) { - return (ini_entry->orig_value ? strtol(ini_entry->orig_value, NULL, 0) : 0); - } else if (ini_entry->value) { - return strtol(ini_entry->value, NULL, 0); - } - } - - return 0; -} - - -PHPAPI double php_ini_double(char *name, uint name_length, int orig) -{ - php_ini_entry *ini_entry; - - if (zend_hash_find(&known_directives, name, name_length, (void **) &ini_entry)==SUCCESS) { - if (orig && ini_entry->modified) { - return (double) (ini_entry->orig_value ? strtod(ini_entry->orig_value, NULL) : 0.0); - } else if (ini_entry->value) { - return (double) strtod(ini_entry->value, NULL); - } - } - - return 0.0; -} - - -PHPAPI char *php_ini_string(char *name, uint name_length, int orig) -{ - php_ini_entry *ini_entry; - - if (zend_hash_find(&known_directives, name, name_length, (void **) &ini_entry)==SUCCESS) { - if (orig && ini_entry->modified) { - return ini_entry->orig_value; - } else { - return ini_entry->value; - } - } - - return ""; -} - - -php_ini_entry *get_ini_entry(char *name, uint name_length) -{ - php_ini_entry *ini_entry; - - if (zend_hash_find(&known_directives, name, name_length, (void **) &ini_entry)==SUCCESS) { - return ini_entry; - } else { - return NULL; - } -} - - -static void php_ini_displayer_cb(php_ini_entry *ini_entry, int type) -{ - if (ini_entry->displayer) { - ini_entry->displayer(ini_entry, type); - } else { - char *display_string; - uint display_string_length; - - if (type==PHP_INI_DISPLAY_ORIG && ini_entry->modified) { - if (ini_entry->orig_value) { - display_string = ini_entry->orig_value; - display_string_length = ini_entry->orig_value_length; - } else { - display_string = "<i>no value</i>"; - display_string_length = sizeof("<i>no value</i>")-1; - } - } else if (ini_entry->value && ini_entry->value[0]) { - display_string = ini_entry->value; - display_string_length = ini_entry->value_length; - } else { - display_string = "<i>no value</i>"; - display_string_length = sizeof("<i>no value</i>")-1; - } - PHPWRITE(display_string, display_string_length); - } -} - - -PHP_INI_DISP(php_ini_boolean_displayer_cb) -{ - int value; - - if (type==PHP_INI_DISPLAY_ORIG && ini_entry->modified) { - value = (ini_entry->orig_value ? atoi(ini_entry->orig_value) : 0); - } else if (ini_entry->value) { - value = atoi(ini_entry->value); - } else { - value = 0; - } - if (value) { - PUTS("On"); - } else { - PUTS("Off"); - } -} - - -PHP_INI_DISP(php_ini_color_displayer_cb) -{ - char *value; - - if (type==PHP_INI_DISPLAY_ORIG && ini_entry->modified) { - value = ini_entry->orig_value; - } else if (ini_entry->value) { - value = ini_entry->value; - } else { - value = NULL; - } - if (value) { - php_printf("<font color=\"%s\">%s</font>", value, value); - } else { - PUTS("<i>no value</i>;"); - } -} - - -static int php_ini_displayer(php_ini_entry *ini_entry, int module_number) -{ - if (ini_entry->module_number != module_number) { - return 0; - } - - PUTS("<tr><td align=\"center\" bgcolor=\"" PHP_ENTRY_NAME_COLOR "\"><b>"); - PHPWRITE(ini_entry->name, ini_entry->name_length-1); - PUTS("</b></td><td align=\"center\" bgcolor=\"" PHP_CONTENTS_COLOR "\">"); - php_ini_displayer_cb(ini_entry, PHP_INI_DISPLAY_ACTIVE); - PUTS("</td><td align=\"center\" bgcolor=\"" PHP_CONTENTS_COLOR "\">"); - php_ini_displayer_cb(ini_entry, PHP_INI_DISPLAY_ORIG); - PUTS("</td></tr>\n"); - return 0; -} - - -PHPAPI void display_ini_entries(zend_module_entry *module) -{ - int module_number; - - if (module) { - module_number = module->module_number; - } else { - module_number = 0; - } - PUTS("<table border=5 width=\"600\">\n"); - php_info_print_table_header(3, "Directive", "Local Value", "Master Value"); - zend_hash_apply_with_argument(&known_directives, (int (*)(void *, void *)) php_ini_displayer, (void *) (long) module_number); - PUTS("</table>\n"); -} - - -/* Standard message handlers */ - -PHPAPI PHP_INI_MH(OnUpdateBool) -{ - zend_bool *p; -#ifndef ZTS - char *base = (char *) mh_arg2; -#else - char *base; - - base = (char *) ts_resource(*((int *) mh_arg2)); -#endif - - p = (zend_bool *) (base+(size_t) mh_arg1); - - *p = (zend_bool) atoi(new_value); - return SUCCESS; -} - - -PHPAPI PHP_INI_MH(OnUpdateInt) -{ - long *p; -#ifndef ZTS - char *base = (char *) mh_arg2; -#else - char *base; - - base = (char *) ts_resource(*((int *) mh_arg2)); -#endif - - p = (long *) (base+(size_t) mh_arg1); - - *p = atoi(new_value); - return SUCCESS; -} - - -PHPAPI PHP_INI_MH(OnUpdateReal) -{ - double *p; -#ifndef ZTS - char *base = (char *) mh_arg2; -#else - char *base; - - base = (char *) ts_resource(*((int *) mh_arg2)); -#endif - - p = (double *) (base+(size_t) mh_arg1); - - *p = strtod(new_value, NULL); - return SUCCESS; -} - - -PHPAPI PHP_INI_MH(OnUpdateString) -{ - char **p; -#ifndef ZTS - char *base = (char *) mh_arg2; -#else - char *base; - - base = (char *) ts_resource(*((int *) mh_arg2)); -#endif - - p = (char **) (base+(size_t) mh_arg1); - - *p = new_value; - return SUCCESS; -} - - -PHPAPI PHP_INI_MH(OnUpdateStringUnempty) -{ - char **p; -#ifndef ZTS - char *base = (char *) mh_arg2; -#else - char *base; - - base = (char *) ts_resource(*((int *) mh_arg2)); -#endif - - if (new_value && !new_value[0]) { - return FAILURE; - } - - p = (char **) (base+(size_t) mh_arg1); - - *p = new_value; - return SUCCESS; -} diff --git a/main/php_ini.h b/main/php_ini.h deleted file mode 100644 index 05d7efde75..0000000000 --- a/main/php_ini.h +++ /dev/null @@ -1,149 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | PHP version 4.0 | - +----------------------------------------------------------------------+ - | Copyright (c) 1997, 1998, 1999 The PHP Group | - +----------------------------------------------------------------------+ - | This source file is subject to version 2.0 of the PHP license, | - | that is bundled with this package in the file LICENSE, and is | - | available at through the world-wide-web at | - | http://www.php.net/license/2_0.txt. | - | If you did not receive a copy of the PHP license and are unable to | - | obtain it through the world-wide-web, please send a note to | - | license@php.net so we can mail you a copy immediately. | - +----------------------------------------------------------------------+ - | Authors: Zeev Suraski <zeev@zend.com> | - +----------------------------------------------------------------------+ -*/ - -#ifndef _PHP_INI_H -#define _PHP_INI_H - -#define PHP_INI_USER (1<<0) -#define PHP_INI_PERDIR (1<<1) -#define PHP_INI_SYSTEM (1<<2) - -#define PHP_INI_ALL (PHP_INI_USER|PHP_INI_PERDIR|PHP_INI_SYSTEM) - -typedef struct _php_ini_entry php_ini_entry; - -#define PHP_INI_MH(name) int name(php_ini_entry *entry, char *new_value, uint new_value_length, void *mh_arg1, void *mh_arg2, void *mh_arg3) -#define PHP_INI_DISP(name) void name(php_ini_entry *ini_entry, int type) - -struct _php_ini_entry { - int module_number; - int modifyable; - char *name; - uint name_length; - PHP_INI_MH((*on_modify)); - void *mh_arg1; - void *mh_arg2; - void *mh_arg3; - - char *value; - uint value_length; - - char *orig_value; - uint orig_value_length; - int modified; - - void (*displayer)(php_ini_entry *ini_entry, int type); -}; - - -int php_ini_mstartup(void); -int php_ini_mshutdown(void); -int php_ini_rshutdown(void); - -PHPAPI int php_register_ini_entries(php_ini_entry *ini_entry, int module_number); -PHPAPI void php_unregister_ini_entries(int module_number); -PHPAPI void php_ini_refresh_caches(void); -PHPAPI int php_alter_ini_entry(char *name, uint name_length, char *new_value, uint new_value_length, int modify_type); -PHPAPI int php_restore_ini_entry(char *name, uint name_length); -PHPAPI void display_ini_entries(zend_module_entry *module); - -PHPAPI long php_ini_long(char *name, uint name_length, int orig); -PHPAPI double php_ini_double(char *name, uint name_length, int orig); -PHPAPI char *php_ini_string(char *name, uint name_length, int orig); -php_ini_entry *get_ini_entry(char *name, uint name_length); - -PHPAPI int php_ini_register_displayer(char *name, uint name_length, void (*displayer)(php_ini_entry *ini_entry, int type)); -PHPAPI PHP_INI_DISP(php_ini_boolean_displayer_cb); -PHPAPI PHP_INI_DISP(php_ini_color_displayer_cb); - -#define PHP_INI_BEGIN() static php_ini_entry ini_entries[] = { -#define PHP_INI_END() { 0, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, 0, NULL } }; - -#define PHP_INI_ENTRY3_EX(name, default_value, modifyable, on_modify, arg1, arg2, arg3, displayer) \ - { 0, modifyable, name, sizeof(name), on_modify, arg1, arg2, arg3, default_value, sizeof(default_value)-1, NULL, 0, 0, displayer }, - -#define PHP_INI_ENTRY3(name, default_value, modifyable, on_modify, arg1, arg2, arg3) \ - PHP_INI_ENTRY3_EX(name, default_value, modifyable, on_modify, arg1, arg2, arg3, NULL) - -#define PHP_INI_ENTRY2_EX(name, default_value, modifyable, on_modify, arg1, arg2, displayer) \ - PHP_INI_ENTRY3_EX(name, default_value, modifyable, on_modify, arg1, arg2, NULL, displayer) - -#define PHP_INI_ENTRY2(name, default_value, modifyable, on_modify, arg1, arg2) \ - PHP_INI_ENTRY2_EX(name, default_value, modifyable, on_modify, arg1, arg2, NULL) - -#define PHP_INI_ENTRY1_EX(name, default_value, modifyable, on_modify, arg1, displayer) \ - PHP_INI_ENTRY3_EX(name, default_value, modifyable, on_modify, arg1, NULL, NULL, displayer) - -#define PHP_INI_ENTRY1(name, default_value, modifyable, on_modify, arg1) \ - PHP_INI_ENTRY1_EX(name, default_value, modifyable, on_modify, arg1, NULL) - -#define PHP_INI_ENTRY_EX(name, default_value, modifyable, on_modify, displayer) \ - PHP_INI_ENTRY3_EX(name, default_value, modifyable, on_modify, NULL, NULL, NULL, displayer) - -#define PHP_INI_ENTRY(name, default_value, modifyable, on_modify) \ - PHP_INI_ENTRY_EX(name, default_value, modifyable, on_modify, NULL) - -#ifdef ZTS -#define STD_PHP_INI_ENTRY(name, default_value, modifyable, on_modify, property_name, struct_type, struct_ptr) \ - PHP_INI_ENTRY2(name, default_value, modifyable, on_modify, (void *) XtOffsetOf(struct_type, property_name), (void *) &struct_ptr##_id) -#define STD_PHP_INI_ENTRY_EX(name, default_value, modifyable, on_modify, property_name, struct_type, struct_ptr, displayer) \ - PHP_INI_ENTRY2_EX(name, default_value, modifyable, on_modify, (void *) XtOffsetOf(struct_type, property_name), (void *) &struct_ptr##_id, displayer) -#define STD_PHP_INI_BOOLEAN(name, default_value, modifyable, on_modify, property_name, struct_type, struct_ptr) \ - PHP_INI_ENTRY3_EX(name, default_value, modifyable, on_modify, (void *) XtOffsetOf(struct_type, property_name), (void *) &struct_ptr##_id, NULL, php_ini_boolean_displayer_cb) -#else -#define STD_PHP_INI_ENTRY(name, default_value, modifyable, on_modify, property_name, struct_type, struct_ptr) \ - PHP_INI_ENTRY2(name, default_value, modifyable, on_modify, (void *) XtOffsetOf(struct_type, property_name), (void *) &struct_ptr) -#define STD_PHP_INI_ENTRY_EX(name, default_value, modifyable, on_modify, property_name, struct_type, struct_ptr, displayer) \ - PHP_INI_ENTRY2_EX(name, default_value, modifyable, on_modify, (void *) XtOffsetOf(struct_type, property_name), (void *) &struct_ptr, displayer) -#define STD_PHP_INI_BOOLEAN(name, default_value, modifyable, on_modify, property_name, struct_type, struct_ptr) \ - PHP_INI_ENTRY3_EX(name, default_value, modifyable, on_modify, (void *) XtOffsetOf(struct_type, property_name), (void *) &struct_ptr, NULL, php_ini_boolean_displayer_cb) -#endif - -#define INI_INT(name) php_ini_long((name), sizeof(name), 0) -#define INI_FLT(name) php_ini_double((name), sizeof(name), 0) -#define INI_STR(name) php_ini_string((name), sizeof(name), 0) -#define INI_BOOL(name) ((zend_bool) INI_INT(name)) - -#define INI_ORIG_INT(name) php_ini_long((name), sizeof(name), 1) -#define INI_ORIG_FLT(name) php_ini_double((name), sizeof(name), 1) -#define INI_ORIG_STR(name) php_ini_string((name), sizeof(name), 1) -#define INI_ORIG_BOOL(name) ((zend_bool) INI_ORIG_INT(name)) - - -#define REGISTER_INI_ENTRIES() php_register_ini_entries(ini_entries, module_number) -#define UNREGISTER_INI_ENTRIES() php_unregister_ini_entries(module_number) -#define DISPLAY_INI_ENTRIES() display_ini_entries(zend_module) - -#define REGISTER_INI_DISPLAYER(name, displayer) php_ini_register_displayer((name), sizeof(name), displayer) -#define REGISTER_INI_BOOLEAN(name) REGISTER_INI_DISPLAYER(name, php_ini_boolean_displayer_cb) - -pval *cfg_get_entry(char *name, uint name_length); - - -/* Standard message handlers */ -PHPAPI PHP_INI_MH(OnUpdateBool); -PHPAPI PHP_INI_MH(OnUpdateInt); -PHPAPI PHP_INI_MH(OnUpdateReal); -PHPAPI PHP_INI_MH(OnUpdateString); -PHPAPI PHP_INI_MH(OnUpdateStringUnempty); - - -#define PHP_INI_DISPLAY_ORIG 1 -#define PHP_INI_DISPLAY_ACTIVE 2 - -#endif /* _PHP_INI_H */ diff --git a/main/php_output.h b/main/php_output.h deleted file mode 100644 index 9eeb17c80b..0000000000 --- a/main/php_output.h +++ /dev/null @@ -1,34 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | PHP version 4.0 | - +----------------------------------------------------------------------+ - | Copyright (c) 1997, 1998, 1999 The PHP Group | - +----------------------------------------------------------------------+ - | This source file is subject to version 2.0 of the PHP license, | - | that is bundled with this package in the file LICENSE, and is | - | available at through the world-wide-web at | - | http://www.php.net/license/2_0.txt. | - | If you did not receive a copy of the PHP license and are unable to | - | obtain it through the world-wide-web, please send a note to | - | license@php.net so we can mail you a copy immediately. | - +----------------------------------------------------------------------+ - | Authors: Zeev Suraski <zeev@zend.com> | - +----------------------------------------------------------------------+ -*/ - - -#ifndef _OUTPUT_BUFFER -#define _OUTPUT_BUFFER - -#include "php.h" - -PHPAPI void php_output_startup(void); -PHPAPI int php_body_write(const char *str, uint str_length); -PHPAPI int php_header_write(const char *str, uint str_length); -PHPAPI void php_start_ob_buffering(void); -PHPAPI void php_end_ob_buffering(int send_buffer); - -extern zend_module_entry output_module_entry; -#define phpext_output_ptr &output_module_entry - -#endif /* _OUTPUT_BUFFER */ diff --git a/main/php_realpath.h b/main/php_realpath.h deleted file mode 100644 index 92ecdf8574..0000000000 --- a/main/php_realpath.h +++ /dev/null @@ -1,30 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | PHP version 4.0 | - +----------------------------------------------------------------------+ - | Copyright (c) 1997, 1998, 1999 The PHP Group | - +----------------------------------------------------------------------+ - | This source file is subject to version 2.0 of the PHP license, | - | that is bundled with this package in the file LICENSE, and is | - | available at through the world-wide-web at | - | http://www.php.net/license/2_0.txt. | - | If you did not receive a copy of the PHP license and are unable to | - | obtain it through the world-wide-web, please send a note to | - | license@php.net so we can mail you a copy immediately. | - +----------------------------------------------------------------------+ - | Author: Sander Steffann (sander@steffann.nl) | - +----------------------------------------------------------------------+ - */ - -#ifndef _PHP_REALPATH_H_ -#define _PHP_REALPATH_H_ - -extern char *_php3_realpath(const char *path, char resolved_path []); - -#endif -/* - * Local variables: - * tab-width: 4 - * c-basic-offset: 4 - * End: - */ diff --git a/main/php_reentrancy.h b/main/php_reentrancy.h deleted file mode 100644 index d9cffb11a3..0000000000 --- a/main/php_reentrancy.h +++ /dev/null @@ -1,85 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | PHP version 4.0 | - +----------------------------------------------------------------------+ - | Copyright (c) 1997, 1998, 1999 The PHP Group | - +----------------------------------------------------------------------+ - | This source file is subject to version 2.0 of the PHP license, | - | that is bundled with this package in the file LICENSE, and is | - | available at through the world-wide-web at | - | http://www.php.net/license/2_0.txt. | - | If you did not receive a copy of the PHP license and are unable to | - | obtain it through the world-wide-web, please send a note to | - | license@php.net so we can mail you a copy immediately. | - +----------------------------------------------------------------------+ - | Authors: Sascha Schumann <sascha@schumann.cx> | - +----------------------------------------------------------------------+ - */ - - -#ifndef PHP_REENTRANCY_H -#define PHP_REENTRANCY_H - -#include "php.h" - -#include <time.h> - -/* currently, PHP does not check for these functions, but assumes - that they are available on all systems. */ - -#define HAVE_LOCALTIME 1 -#define HAVE_GMTIME 1 -#define HAVE_ASCTIME 1 -#define HAVE_CTIME 1 - - -#if !defined(HAVE_LOCALTIME_R) && defined(HAVE_LOCALTIME) -#define PHP_NEED_REENTRANCY 1 -#define localtime_r php_localtime_r -PHPAPI struct tm *localtime_r(const time_t *const timep, struct tm *p_tm); -#endif - - -#if !defined(HAVE_CTIME_R) && defined(HAVE_CTIME) -#define PHP_NEED_REENTRANCY 1 -#define ctime_r php_ctime_r -PHPAPI char *ctime_r(const time_t *clock, char *buf); -#endif - - -#if !defined(HAVE_ASCTIME_R) && defined(HAVE_ASCTIME) -#define PHP_NEED_REENTRANCY 1 -#define asctime_r php_asctime_r -PHPAPI char *asctime_r(const struct tm *tm, char *buf); -#endif - - -#if !defined(HAVE_GMTIME_R) && defined(HAVE_GMTIME) -#define PHP_NEED_REENTRANCY 1 -#define gmtime_r php_gmtime_r -PHPAPI struct tm *gmtime_r(const time_t *const timep, struct tm *p_tm); -#endif - -#if !defined(HAVE_STRTOK_R) -#define strtok_r php_strtok_r -PHPAPI char *strtok_r(char *s, const char *delim, char **last); -#endif - -#if !defined(HAVE_RAND_R) -#define rand_r php_rand_r -PHPAPI int rand_r(unsigned int *seed); -#endif - -#if !defined(ZTS) -#undef PHP_NEED_REENTRANCY -#endif - -#if defined(PHP_NEED_REENTRANCY) -void reentrancy_startup(void); -void reentrancy_shutdown(void); -#else -#define reentrancy_startup() -#define reentrancy_shutdown() -#endif - -#endif diff --git a/main/php_regex.h b/main/php_regex.h deleted file mode 100644 index be0f445af7..0000000000 --- a/main/php_regex.h +++ /dev/null @@ -1,43 +0,0 @@ -#ifndef _PHP_REGEX_H -#define _PHP_REGEX_H - -/* - * REGEX means: - * 0.. system regex - * 1.. bundled regex - * 2.. Apache's regex - */ - -#if REGEX == 1 -/* get aliases */ -#include "regex/regex_extra.h" -#include "regex/regex.h" - -/* get rid of aliases */ -#define PHP_NO_ALIASES -#include "regex/regex_extra.h" -#undef PHP_NO_ALIASES - -#ifndef _REGEX_H -#define _REGEX_H 1 /* this should stop Apache from loading the system version of regex.h */ -#endif -#ifndef _REGEX_H_ -#define _REGEX_H_ 1 -#endif -#ifndef _RX_H -#define _RX_H 1 /* Try defining these for Linux to */ -#endif -#ifndef __REGEXP_LIBRARY_H__ -#define __REGEXP_LIBRARY_H__ 1 /* avoid Apache including regex.h */ -#endif -#ifndef _H_REGEX -#define _H_REGEX 1 /* This one is for AIX */ -#endif -#elif REGEX == 0 -#include <regex.h> -#ifndef _REGEX_H_ -#define _REGEX_H_ 1 -#endif -#endif - -#endif /* _PHP_REGEX_H */ diff --git a/main/php_version.h b/main/php_version.h deleted file mode 100644 index abcfe084c4..0000000000 --- a/main/php_version.h +++ /dev/null @@ -1,3 +0,0 @@ -/* automatically generated by configure */ -/* edit configure.in.in to change version number */ -#define PHP_VERSION "4.0b4-dev" diff --git a/main/reentrancy.c b/main/reentrancy.c deleted file mode 100644 index 0faf76c4aa..0000000000 --- a/main/reentrancy.c +++ /dev/null @@ -1,309 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | PHP version 4.0 | - +----------------------------------------------------------------------+ - | Copyright (c) 1997, 1998, 1999 The PHP Group | - +----------------------------------------------------------------------+ - | This source file is subject to version 2.0 of the PHP license, | - | that is bundled with this package in the file LICENSE, and is | - | available at through the world-wide-web at | - | http://www.php.net/license/2_0.txt. | - | If you did not receive a copy of the PHP license and are unable to | - | obtain it through the world-wide-web, please send a note to | - | license@php.net so we can mail you a copy immediately. | - +----------------------------------------------------------------------+ - | Authors: Sascha Schumann <sascha@schumann.cx> | - +----------------------------------------------------------------------+ - */ - -#include "php_reentrancy.h" - -#include <string.h> - -enum { - LOCALTIME_R, - CTIME_R, - ASCTIME_R, - GMTIME_R, - NUMBER_OF_LOCKS -}; - -#if defined(PHP_NEED_REENTRANCY) - -#include <TSRM.h> - -static MUTEX_T reentrant_locks[NUMBER_OF_LOCKS]; - -#define local_lock(x) tsrm_mutex_lock(reentrant_locks[x]) -#define local_unlock(x) tsrm_mutex_unlock(reentrant_locks[x]) - -#else - -#define local_lock(x) -#define local_unlock(x) - -#endif - - -#if !defined(HAVE_LOCALTIME_R) && defined(HAVE_LOCALTIME) - -PHPAPI struct tm *localtime_r(const time_t *const timep, struct tm *p_tm) -{ - struct tm *tmp; - - local_lock(LOCALTIME_R); - - tmp = localtime(timep); - memcpy(p_tm, tmp, sizeof(struct tm)); - - local_unlock(LOCALTIME_R); - - return p_tm; -} - -#endif - -#if !defined(HAVE_CTIME_R) && defined(HAVE_CTIME) - -PHPAPI char *ctime_r(const time_t *clock, char *buf) -{ - char *tmp; - - local_lock(CTIME_R); - - tmp = ctime(clock); - strcpy(buf, tmp); - - local_unlock(CTIME_R); - - return buf; -} - -#endif - -#if !defined(HAVE_ASCTIME_R) && defined(HAVE_ASCTIME) - -PHPAPI char *asctime_r(const struct tm *tm, char *buf) -{ - char *tmp; - - local_lock(ASCTIME_R); - - tmp = asctime(tm); - strcpy(buf, tmp); - - local_unlock(ASCTIME_R); - - return buf; -} - -#endif - -#if !defined(HAVE_GMTIME_R) && defined(HAVE_GMTIME) - -PHPAPI struct tm *gmtime_r(const time_t *const timep, struct tm *p_tm) -{ - struct tm *tmp; - - local_lock(GMTIME_R); - - tmp = gmtime(timep); - memcpy(p_tm, tmp, sizeof(struct tm)); - - local_unlock(GMTIME_R); - - return p_tm; -} - -#endif - -#if defined(PHP_NEED_REENTRANCY) - -void reentrancy_startup(void) -{ - int i; - - for (i = 0; i < NUMBER_OF_LOCKS; i++) { - reentrant_locks[i] = tsrm_mutex_alloc(); - } -} - -void reentrancy_shutdown(void) -{ - int i; - - for (i = 0; i < NUMBER_OF_LOCKS; i++) { - tsrm_mutex_free(reentrant_locks[i]); - } -} - -#endif - -#ifndef HAVE_RAND_R - -/*- - * Copyright (c) 1990, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * Posix rand_r function added May 1999 by Wes Peters <wes@softweyr.com>. - */ - -#include <sys/types.h> -#include <stdlib.h> - -static int -do_rand(unsigned long *ctx) -{ - return ((*ctx = *ctx * 1103515245 + 12345) % ((u_long)RAND_MAX + 1)); -} - - -PHPAPI int -rand_r(unsigned int *ctx) -{ - u_long val = (u_long) *ctx; - *ctx = do_rand(&val); - return (int) *ctx; -} - -#endif - - -#ifndef HAVE_STRTOK_R - -/* - * Copyright (c) 1998 Softweyr LLC. All rights reserved. - * - * strtok_r, from Berkeley strtok - * Oct 13, 1998 by Wes Peters <wes@softweyr.com> - * - * Copyright (c) 1988, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notices, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notices, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * - * This product includes software developed by Softweyr LLC, the - * University of California, Berkeley, and its contributors. - * - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY SOFTWEYR LLC, THE REGENTS AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A - * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SOFTWEYR LLC, THE - * REGENTS, OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include <stddef.h> - -PHPAPI char * -strtok_r(char *s, const char *delim, char **last) -{ - char *spanp; - int c, sc; - char *tok; - - if (s == NULL && (s = *last) == NULL) - { - return NULL; - } - - /* - * Skip (span) leading delimiters (s += strspn(s, delim), sort of). - */ -cont: - c = *s++; - for (spanp = (char *)delim; (sc = *spanp++) != 0; ) - { - if (c == sc) - { - goto cont; - } - } - - if (c == 0) /* no non-delimiter characters */ - { - *last = NULL; - return NULL; - } - tok = s - 1; - - /* - * Scan token (scan for delimiters: s += strcspn(s, delim), sort of). - * Note that delim must have one NUL; we stop if we see that, too. - */ - for (;;) - { - c = *s++; - spanp = (char *)delim; - do - { - if ((sc = *spanp++) == c) - { - if (c == 0) - { - s = NULL; - } - else - { - char *w = s - 1; - *w = '\0'; - } - *last = s; - return tok; - } - } - while (sc != 0); - } - /* NOTREACHED */ -} - -#endif diff --git a/main/rfc1867.c b/main/rfc1867.c deleted file mode 100644 index ea80949393..0000000000 --- a/main/rfc1867.c +++ /dev/null @@ -1,265 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | PHP version 4.0 | - +----------------------------------------------------------------------+ - | Copyright (c) 1997, 1998, 1999 The PHP Group | - +----------------------------------------------------------------------+ - | This source file is subject to version 2.0 of the PHP license, | - | that is bundled with this package in the file LICENSE, and is | - | available at through the world-wide-web at | - | http://www.php.net/license/2_0.txt. | - | If you did not receive a copy of the PHP license and are unable to | - | obtain it through the world-wide-web, please send a note to | - | license@php.net so we can mail you a copy immediately. | - +----------------------------------------------------------------------+ - | Authors: Rasmus Lerdorf <rasmus@lerdorf.on.ca> | - +----------------------------------------------------------------------+ - */ -/* $Id$ */ - -#include <stdio.h> -#include "php.h" -#include "ext/standard/php_standard.h" -#include "ext/standard/file.h" /* for php_file_le_uploads() */ -#include "zend_globals.h" -#include "php_globals.h" -#include "rfc1867.h" - - -#define NEW_BOUNDARY_CHECK 1 -#define SAFE_RETURN { if (namebuf) efree(namebuf); if (filenamebuf) efree(filenamebuf); if (lbuf) efree(lbuf); return; } - -/* - * Split raw mime stream up into appropriate components - */ -static void php_mime_split(char *buf, int cnt, char *boundary) -{ - char *ptr, *loc, *loc2, *s, *name, *filename, *u, *fn; - int len, state = 0, Done = 0, rem, urem; - long bytes, max_file_size = 0; - char *namebuf=NULL, *filenamebuf=NULL, *lbuf=NULL; - FILE *fp; - int itype; - zval *http_post_vars=NULL; - ELS_FETCH(); - PLS_FETCH(); - - if (PG(track_vars)) { - http_post_vars = (pval *) emalloc(sizeof(pval)); - array_init(http_post_vars); - INIT_PZVAL(http_post_vars); - - zend_hash_add(&EG(symbol_table), "HTTP_POST_VARS", sizeof("HTTP_POST_VARS"), &http_post_vars, sizeof(pval *), NULL); - } - - ptr = buf; - rem = cnt; - len = strlen(boundary); - while ((ptr - buf < cnt) && !Done) { - switch (state) { - case 0: /* Looking for mime boundary */ - loc = memchr(ptr, *boundary, cnt); - if (loc) { - if (!strncmp(loc, boundary, len)) { - - state = 1; - rem -= (loc - ptr) + len + 2; - ptr = loc + len + 2; - } else { - rem -= (loc - ptr) + 1; - ptr = loc + 1; - } - } else { - Done = 1; - } - break; - case 1: /* Check content-disposition */ - if (strncasecmp(ptr, "Content-Disposition: form-data;", 31)) { - if (rem < 31) { - SAFE_RETURN; - } - php_error(E_WARNING, "File Upload Mime headers garbled [%c%c%c%c%c]", *ptr, *(ptr + 1), *(ptr + 2), *(ptr + 3), *(ptr + 4)); - SAFE_RETURN; - } - loc = memchr(ptr, '\n', rem); - name = strstr(ptr, " name=\""); - if (name && name < loc) { - name += 7; - s = memchr(name, '\"', loc - name); - if (!s) { - php_error(E_WARNING, "File Upload Mime headers garbled [%c%c%c%c%c]", *name, *(name + 1), *(name + 2), *(name + 3), *(name + 4)); - SAFE_RETURN; - } - if (namebuf) { - efree(namebuf); - } - namebuf = estrndup(name, s-name); - if (lbuf) { - efree(lbuf); - } - lbuf = emalloc(s-name + MAX(MAX(sizeof("_name"),sizeof("_size")),sizeof("_type"))); - state = 2; - loc2 = memchr(loc + 1, '\n', rem); - rem -= (loc2 - ptr) + 1; - ptr = loc2 + 1; - } else { - php_error(E_WARNING, "File upload error - no name component in content disposition"); - SAFE_RETURN; - } - filename = strstr(s, " filename=\""); - if (filename && filename < loc) { - filename += 11; - s = memchr(filename, '\"', loc - filename); - if (!s) { - php_error(E_WARNING, "File Upload Mime headers garbled [%c%c%c%c%c]", *filename, *(filename + 1), *(filename + 2), *(filename + 3), *(filename + 4)); - SAFE_RETURN; - } - if (filenamebuf) { - efree(filenamebuf); - } - filenamebuf = estrndup(filename, s-filename); - sprintf(lbuf, "%s_name", namebuf); - s = strrchr(filenamebuf, '\\'); - if (s && s > filenamebuf) { - SET_VAR_STRING(lbuf, estrdup(s + 1)); - } else { - SET_VAR_STRING(lbuf, estrdup(filenamebuf)); - } - state = 3; - if ((loc2 - loc) > 2) { - if (!strncasecmp(loc + 1, "Content-Type:", 13)) { - *(loc2 - 1) = '\0'; - sprintf(lbuf, "%s_type", namebuf); - SET_VAR_STRING(lbuf, estrdup(loc + 15)); - *(loc2 - 1) = '\n'; - } - rem -= 2; - ptr += 2; - } - } - break; - - case 2: /* handle form-data fields */ - loc = memchr(ptr, *boundary, rem); - u = ptr; - while (loc) { - if (!strncmp(loc, boundary, len)) - break; - u = loc + 1; - urem = rem - (loc - ptr) - 1; - loc = memchr(u, *boundary, urem); - } - if (!loc) { - php_error(E_WARNING, "File Upload Field Data garbled"); - SAFE_RETURN; - } - *(loc - 4) = '\0'; - - /* Magic function that figures everything out */ - php_parse_gpc_data2(ptr,namebuf,http_post_vars ELS_CC PLS_CC); - - /* And a little kludge to pick out special MAX_FILE_SIZE */ - itype = php3_check_ident_type(namebuf); - if (itype) { - u = strchr(namebuf, '['); - if (u) - *u = '\0'; - } - if (!strcmp(namebuf, "MAX_FILE_SIZE")) { - max_file_size = atol(ptr); - } - if (itype) { - if (u) - *u = '['; - } - rem -= (loc - ptr); - ptr = loc; - state = 0; - break; - - case 3: /* Handle file */ - loc = memchr(ptr, *boundary, rem); - u = ptr; - while (loc) { - if (!strncmp(loc, boundary, len) -#if NEW_BOUNDARY_CHECK - && (loc-2>buf && *(loc-2)=='-' && *(loc-1)=='-') /* ensure boundary is prefixed with -- */ - && (loc-2==buf || *(loc-3)=='\n') /* ensure beginning of line */ -#endif - ) { - break; - } - u = loc + 1; - urem = rem - (loc - ptr) - 1; - loc = memchr(u, *boundary, urem); - } - if (!loc) { - php_error(E_WARNING, "File Upload Error - No Mime boundary found after start of file header"); - SAFE_RETURN; - } - fn = tempnam(PG(upload_tmp_dir), "php"); - if ((loc - ptr - 4) > PG(upload_max_filesize)) { - php_error(E_WARNING, "Max file size of %ld bytes exceeded - file [%s] not saved", PG(upload_max_filesize),namebuf); - bytes=0; - SET_VAR_STRING(namebuf, estrdup("none")); - } else if (max_file_size && ((loc - ptr - 4) > max_file_size)) { - php_error(E_WARNING, "Max file size exceeded - file [%s] not saved", namebuf); - bytes = 0; - SET_VAR_STRING(namebuf, estrdup("none")); - } else if ((loc - ptr - 4) <= 0) { - bytes = 0; - SET_VAR_STRING(namebuf, estrdup("none")); - } else { - fp = fopen(fn, "w"); - if (!fp) { - php_error(E_WARNING, "File Upload Error - Unable to open temporary file [%s]", fn); - SAFE_RETURN; - } - bytes = fwrite(ptr, 1, loc - ptr - 4, fp); - fclose(fp); - php3_list_insert(fn,php_file_le_uploads()); /* Tell PHP about the file so the destructor can unlink it later */ - if (bytes < (loc - ptr - 4)) { - php_error(E_WARNING, "Only %d bytes were written, expected to write %ld", bytes, loc - ptr - 4); - } - SET_VAR_STRING(namebuf, estrdup(fn)); - } - sprintf(lbuf, "%s_size", namebuf); - SET_VAR_LONG(lbuf, bytes); - state = 0; - rem -= (loc - ptr); - ptr = loc; - break; - } - } - SAFE_RETURN; -} - - -SAPI_POST_READER_FUNC(rfc1867_post_reader) -{ - char *boundary; - uint boundary_len; - - boundary = strstr(content_type_dup, "boundary"); - if (!boundary || !(boundary=strchr(boundary, '='))) { - sapi_module.sapi_error(E_COMPILE_ERROR, "Missing boundary in multipart/form-data POST data"); - return; - } - boundary++; - boundary_len = strlen(boundary); - - sapi_read_standard_form_data(content_type_dup SLS_CC); - if (SG(request_info).post_data) { - php_mime_split(SG(request_info).post_data, SG(request_info).post_data_length, boundary); - efree(SG(request_info).post_data); - SG(request_info).post_data = NULL; - } -} - - -/* - * Local variables: - * tab-width: 4 - * c-basic-offset: 4 - * End: - */ diff --git a/main/rfc1867.h b/main/rfc1867.h deleted file mode 100644 index 97c1475e80..0000000000 --- a/main/rfc1867.h +++ /dev/null @@ -1,12 +0,0 @@ -#ifndef _RFC1867_H -#define _RFC1867_H - -#include "SAPI.h" - -#define MULTIPART_CONTENT_TYPE "multipart/form-data" - -SAPI_POST_READER_FUNC(rfc1867_post_reader); - -#define FILE_UPLOAD_INPUT_BUFFER_SIZE 8192 - -#endif /* _RFC1867_H */ diff --git a/main/safe_mode.c b/main/safe_mode.c deleted file mode 100644 index 02bd31b9bf..0000000000 --- a/main/safe_mode.c +++ /dev/null @@ -1,144 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | PHP version 4.0 | - +----------------------------------------------------------------------+ - | Copyright (c) 1997, 1998, 1999 The PHP Group | - +----------------------------------------------------------------------+ - | This source file is subject to version 2.0 of the PHP license, | - | that is bundled with this package in the file LICENSE, and is | - | available at through the world-wide-web at | - | http://www.php.net/license/2_0.txt. | - | If you did not receive a copy of the PHP license and are unable to | - | obtain it through the world-wide-web, please send a note to | - | license@php.net so we can mail you a copy immediately. | - +----------------------------------------------------------------------+ - | Authors: Rasmus Lerdorf <rasmus@lerdorf.on.ca> | - +----------------------------------------------------------------------+ - */ -/* $Id$ */ - -#include "php.h" - -#include <stdio.h> -#include <stdlib.h> - -#if HAVE_UNISTD_H -#include <unistd.h> -#endif -#include <sys/stat.h> -#include "ext/standard/pageinfo.h" -#include "safe_mode.h" -#include "SAPI.h" - -/* - * _php3_checkuid - * - * This function has four modes: - * - * 0 - return invalid (0) if file does not exist - * 1 - return valid (1) if file does not exist - * 2 - if file does not exist, check directory - * 3 - only check directory (needed for mkdir) - */ -PHPAPI int _php3_checkuid(const char *fn, int mode) { - struct stat sb; - int ret; - long uid=0L, duid=0L; - char *s; - - if (!fn) return(0); /* path must be provided */ - - /* - * If given filepath is a URL, allow - safe mode stuff - * related to URL's is checked in individual functions - */ - if (!strncasecmp(fn,"http://",7) || !strncasecmp(fn,"ftp://",6)) { - return(1); - } - - if (mode<3) { - ret = stat(fn,&sb); - if (ret<0 && mode < 2) { - php_error(E_WARNING,"Unable to access %s",fn); - return(mode); - } - if (ret>-1) { - uid=sb.st_uid; - if (uid==_php3_getuid()) return(1); - } - } - s = strrchr(fn,'/'); - - /* This loop gets rid of trailing slashes which could otherwise be - * used to confuse the function. - */ - while(s && *(s+1)=='\0' && s>fn) { - s='\0'; - s = strrchr(fn,'/'); - } - - if (s) { - *s='\0'; - ret = stat(fn,&sb); - *s='/'; - if (ret<0) { - php_error(E_WARNING, "Unable to access %s",fn); - return(0); - } - duid = sb.st_uid; - } else { - s = emalloc(MAXPATHLEN+1); - if (!getcwd(s,MAXPATHLEN)) { - php_error(E_WARNING, "Unable to access current working directory"); - return(0); - } - ret = stat(s,&sb); - efree(s); - if (ret<0) { - php_error(E_WARNING, "Unable to access %s",s); - return(0); - } - duid = sb.st_uid; - } - if (duid == (uid=_php3_getuid())) return(1); - else { - php_error(E_WARNING, "SAFE MODE Restriction in effect. The script whose uid is %ld is not allowed to access %s owned by uid %ld",uid,fn,duid); - return(0); - } -} - - -PHPAPI char *_php3_get_current_user() -{ -#if CGI_BINARY || USE_SAPI || FHTTPD - struct stat statbuf; -#endif - struct passwd *pwd; - int uid; - SLS_FETCH(); - - if (request_info.current_user) { - return request_info.current_user; - } - - /* FIXME: I need to have this somehow handled if - USE_SAPI is defined, because cgi will also be - interfaced in USE_SAPI */ -#if CGI_BINARY || USE_SAPI || FHTTPD - if (!SG(request_info).path_translated || (stat(SG(request_info).path_translated,&statbuf)==-1)) { - return empty_string; - } - uid = statbuf.st_uid; -#endif -#if APACHE - uid = ((request_rec *) SG(server_context))->finfo.st_uid; -#endif - - if ((pwd=getpwuid(uid))==NULL) { - return empty_string; - } - request_info.current_user_length = strlen(pwd->pw_name); - request_info.current_user = estrndup(pwd->pw_name,request_info.current_user_length); - - return request_info.current_user; -} diff --git a/main/safe_mode.h b/main/safe_mode.h deleted file mode 100644 index 3ae320b46d..0000000000 --- a/main/safe_mode.h +++ /dev/null @@ -1,7 +0,0 @@ -#ifndef _SAFE_MODE_H_ -#define _SAFE_MODE_H_ - -extern PHPAPI int _php3_checkuid(const char *filename, int mode); -extern PHPAPI char *_php3_get_current_user(void); - -#endif diff --git a/main/snprintf.c b/main/snprintf.c deleted file mode 100644 index 4437dee003..0000000000 --- a/main/snprintf.c +++ /dev/null @@ -1,934 +0,0 @@ -/* ==================================================================== - * Copyright (c) 1995-1998 The Apache Group. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. All advertising materials mentioning features or use of this - * software must display the following acknowledgment: - * "This product includes software developed by the Apache Group - * for use in the Apache HTTP server project (http://www.apache.org/)." - * - * 4. The names "Apache Server" and "Apache Group" must not be used to - * endorse or promote products derived from this software without - * prior written permission. - * - * 5. Redistributions of any form whatsoever must retain the following - * acknowledgment: - * "This product includes software developed by the Apache Group - * for use in the Apache HTTP server project (http://www.apache.org/)." - * - * THIS SOFTWARE IS PROVIDED BY THE APACHE GROUP ``AS IS'' AND ANY - * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE APACHE GROUP OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Group and was originally based - * on public domain software written at the National Center for - * Supercomputing Applications, University of Illinois, Urbana-Champaign. - * For more information on the Apache Group and the Apache HTTP server - * project, please see <http://www.apache.org/>. - * - * This code is based on, and used with the permission of, the - * SIO stdio-replacement strx_* functions by Panos Tsirigotis - * <panos@alumni.cs.colorado.edu> for xinetd. - */ - -#include "php.h" - -#if !defined(APACHE) || (!APACHE) -#if !defined(HAVE_SNPRINTF) || !defined(HAVE_VSNPRINTF) - -#include <stdio.h> -#include <ctype.h> -#include <sys/types.h> -#include <stdarg.h> -#include <string.h> -#include <stdlib.h> -#include <math.h> - - -#ifdef HAVE_GCVT - -#define ap_ecvt ecvt -#define ap_fcvt fcvt -#define ap_gcvt gcvt - -#else - -/* - * cvt.c - IEEE floating point formatting routines for FreeBSD - * from GNU libc-4.6.27 - */ - -/* - * ap_ecvt converts to decimal - * the number of digits is specified by ndigit - * decpt is set to the position of the decimal point - * sign is set to 0 for positive, 1 for negative - */ - -#define NDIG 80 - -static char * - ap_cvt(double arg, int ndigits, int *decpt, int *sign, int eflag) -{ - register int r2; - double fi, fj; - register char *p, *p1; - static char buf[NDIG]; - - if (ndigits >= NDIG - 1) - ndigits = NDIG - 2; - r2 = 0; - *sign = 0; - p = &buf[0]; - if (arg < 0) { - *sign = 1; - arg = -arg; - } - arg = modf(arg, &fi); - p1 = &buf[NDIG]; - /* - * Do integer part - */ - if (fi != 0) { - p1 = &buf[NDIG]; - while (fi != 0) { - fj = modf(fi / 10, &fi); - *--p1 = (int) ((fj + .03) * 10) + '0'; - r2++; - } - while (p1 < &buf[NDIG]) - *p++ = *p1++; - } else if (arg > 0) { - while ((fj = arg * 10) < 1) { - arg = fj; - r2--; - } - } - p1 = &buf[ndigits]; - if (eflag == 0) - p1 += r2; - *decpt = r2; - if (p1 < &buf[0]) { - buf[0] = '\0'; - return (buf); - } - while (p <= p1 && p < &buf[NDIG]) { - arg *= 10; - arg = modf(arg, &fj); - *p++ = (int) fj + '0'; - } - if (p1 >= &buf[NDIG]) { - buf[NDIG - 1] = '\0'; - return (buf); - } - p = p1; - *p1 += 5; - while (*p1 > '9') { - *p1 = '0'; - if (p1 > buf) - ++ * --p1; - else { - *p1 = '1'; - (*decpt)++; - if (eflag == 0) { - if (p > buf) - *p = '0'; - p++; - } - } - } - *p = '\0'; - return (buf); -} - -static char * - ap_ecvt(double arg, int ndigits, int *decpt, int *sign) -{ - return (ap_cvt(arg, ndigits, decpt, sign, 1)); -} - -static char * - ap_fcvt(double arg, int ndigits, int *decpt, int *sign) -{ - return (ap_cvt(arg, ndigits, decpt, sign, 0)); -} - -/* - * ap_gcvt - Floating output conversion to - * minimal length string - */ - -static char * - ap_gcvt(double number, int ndigit, char *buf) -{ - int sign, decpt; - register char *p1, *p2; - register i; - - p1 = ap_ecvt(number, ndigit, &decpt, &sign); - p2 = buf; - if (sign) - *p2++ = '-'; - for (i = ndigit - 1; i > 0 && p1[i] == '0'; i--) - ndigit--; - if ((decpt >= 0 && decpt - ndigit > 4) - || (decpt < 0 && decpt < -3)) { /* use E-style */ - decpt--; - *p2++ = *p1++; - *p2++ = '.'; - for (i = 1; i < ndigit; i++) - *p2++ = *p1++; - *p2++ = 'e'; - if (decpt < 0) { - decpt = -decpt; - *p2++ = '-'; - } else - *p2++ = '+'; - if (decpt / 100 > 0) - *p2++ = decpt / 100 + '0'; - if (decpt / 10 > 0) - *p2++ = (decpt % 100) / 10 + '0'; - *p2++ = decpt % 10 + '0'; - } else { - if (decpt <= 0) { - if (*p1 != '0') - *p2++ = '.'; - while (decpt < 0) { - decpt++; - *p2++ = '0'; - } - } - for (i = 1; i <= ndigit; i++) { - *p2++ = *p1++; - if (i == decpt) - *p2++ = '.'; - } - if (ndigit < decpt) { - while (ndigit++ < decpt) - *p2++ = '0'; - *p2++ = '.'; - } - } - if (p2[-1] == '.') - p2--; - *p2 = '\0'; - return (buf); -} - -#endif /* HAVE_CVT */ - -typedef enum { - NO = 0, YES = 1 -} boolean_e; - -#define FALSE 0 -#define TRUE 1 -#define NUL '\0' -#define INT_NULL ((int *)0) -#define WIDE_INT long - -typedef WIDE_INT wide_int; -typedef unsigned WIDE_INT u_wide_int; -typedef int bool_int; - -#define S_NULL "(null)" -#define S_NULL_LEN 6 - -#define FLOAT_DIGITS 6 -#define EXPONENT_LENGTH 10 - -/* - * NUM_BUF_SIZE is the size of the buffer used for arithmetic conversions - * - * XXX: this is a magic number; do not decrease it - */ -#define NUM_BUF_SIZE 512 - - -/* - * Descriptor for buffer area - */ -struct buf_area { - char *buf_end; - char *nextb; /* pointer to next byte to read/write */ -}; - -typedef struct buf_area buffy; - -/* - * The INS_CHAR macro inserts a character in the buffer and writes - * the buffer back to disk if necessary - * It uses the char pointers sp and bep: - * sp points to the next available character in the buffer - * bep points to the end-of-buffer+1 - * While using this macro, note that the nextb pointer is NOT updated. - * - * NOTE: Evaluation of the c argument should not have any side-effects - */ -#define INS_CHAR( c, sp, bep, cc ) \ - { \ - if ( sp < bep ) \ - { \ - *sp++ = c ; \ - cc++ ; \ - } \ - } - -#define NUM( c ) ( c - '0' ) - -#define STR_TO_DEC( str, num ) \ - num = NUM( *str++ ) ; \ - while ( isdigit((int)*str ) ) \ - { \ - num *= 10 ; \ - num += NUM( *str++ ) ; \ - } - -/* - * This macro does zero padding so that the precision - * requirement is satisfied. The padding is done by - * adding '0's to the left of the string that is going - * to be printed. - */ -#define FIX_PRECISION( adjust, precision, s, s_len ) \ - if ( adjust ) \ - while ( s_len < precision ) \ - { \ - *--s = '0' ; \ - s_len++ ; \ - } - -/* - * Macro that does padding. The padding is done by printing - * the character ch. - */ -#define PAD( width, len, ch ) do \ - { \ - INS_CHAR( ch, sp, bep, cc ) ; \ - width-- ; \ - } \ - while ( width > len ) - -/* - * Prefix the character ch to the string str - * Increase length - * Set the has_prefix flag - */ -#define PREFIX( str, length, ch ) *--str = ch ; length++ ; has_prefix = YES - - -/* - * Convert num to its decimal format. - * Return value: - * - a pointer to a string containing the number (no sign) - * - len contains the length of the string - * - is_negative is set to TRUE or FALSE depending on the sign - * of the number (always set to FALSE if is_unsigned is TRUE) - * - * The caller provides a buffer for the string: that is the buf_end argument - * which is a pointer to the END of the buffer + 1 (i.e. if the buffer - * is declared as buf[ 100 ], buf_end should be &buf[ 100 ]) - */ -static char * - conv_10(register wide_int num, register bool_int is_unsigned, - register bool_int * is_negative, char *buf_end, register int *len) -{ - register char *p = buf_end; - register u_wide_int magnitude; - - if (is_unsigned) { - magnitude = (u_wide_int) num; - *is_negative = FALSE; - } else { - *is_negative = (num < 0); - - /* - * On a 2's complement machine, negating the most negative integer - * results in a number that cannot be represented as a signed integer. - * Here is what we do to obtain the number's magnitude: - * a. add 1 to the number - * b. negate it (becomes positive) - * c. convert it to unsigned - * d. add 1 - */ - if (*is_negative) { - wide_int t = num + 1; - - magnitude = ((u_wide_int) - t) + 1; - } else - magnitude = (u_wide_int) num; - } - - /* - * We use a do-while loop so that we write at least 1 digit - */ - do { - register u_wide_int new_magnitude = magnitude / 10; - - *--p = magnitude - new_magnitude * 10 + '0'; - magnitude = new_magnitude; - } - while (magnitude); - - *len = buf_end - p; - return (p); -} - - - -/* - * Convert a floating point number to a string formats 'f', 'e' or 'E'. - * The result is placed in buf, and len denotes the length of the string - * The sign is returned in the is_negative argument (and is not placed - * in buf). - */ -static char * - conv_fp(register char format, register double num, - boolean_e add_dp, int precision, bool_int * is_negative, char *buf, int *len) -{ - register char *s = buf; - register char *p; - int decimal_point; - - if (format == 'f') - p = ap_fcvt(num, precision, &decimal_point, is_negative); - else /* either e or E format */ - p = ap_ecvt(num, precision + 1, &decimal_point, is_negative); - - /* - * Check for Infinity and NaN - */ - if (isalpha((int)*p)) { - *len = strlen(strcpy(buf, p)); - *is_negative = FALSE; - return (buf); - } - if (format == 'f') { - if (decimal_point <= 0) { - *s++ = '0'; - if (precision > 0) { - *s++ = '.'; - while (decimal_point++ < 0) - *s++ = '0'; - } else if (add_dp) { - *s++ = '.'; - } - } else { - while (decimal_point-- > 0) { - *s++ = *p++; - } - if (precision > 0 || add_dp) { - *s++ = '.'; - } - } - } else { - *s++ = *p++; - if (precision > 0 || add_dp) - *s++ = '.'; - } - - /* - * copy the rest of p, the NUL is NOT copied - */ - while (*p) - *s++ = *p++; - - if (format != 'f') { - char temp[EXPONENT_LENGTH]; /* for exponent conversion */ - int t_len; - bool_int exponent_is_negative; - - *s++ = format; /* either e or E */ - decimal_point--; - if (decimal_point != 0) { - p = conv_10((wide_int) decimal_point, FALSE, &exponent_is_negative, - &temp[EXPONENT_LENGTH], &t_len); - *s++ = exponent_is_negative ? '-' : '+'; - - /* - * Make sure the exponent has at least 2 digits - */ - if (t_len == 1) - *s++ = '0'; - while (t_len--) - *s++ = *p++; - } else { - *s++ = '+'; - *s++ = '0'; - *s++ = '0'; - } - } - *len = s - buf; - return (buf); -} - - -/* - * Convert num to a base X number where X is a power of 2. nbits determines X. - * For example, if nbits is 3, we do base 8 conversion - * Return value: - * a pointer to a string containing the number - * - * The caller provides a buffer for the string: that is the buf_end argument - * which is a pointer to the END of the buffer + 1 (i.e. if the buffer - * is declared as buf[ 100 ], buf_end should be &buf[ 100 ]) - */ -static char * - conv_p2(register u_wide_int num, register int nbits, - char format, char *buf_end, register int *len) -{ - register int mask = (1 << nbits) - 1; - register char *p = buf_end; - static char low_digits[] = "0123456789abcdef"; - static char upper_digits[] = "0123456789ABCDEF"; - register char *digits = (format == 'X') ? upper_digits : low_digits; - - do { - *--p = digits[num & mask]; - num >>= nbits; - } - while (num); - - *len = buf_end - p; - return (p); -} - - -/* - * Do format conversion placing the output in buffer - */ -static int format_converter(register buffy * odp, const char *fmt, - va_list ap) -{ - register char *sp; - register char *bep; - register int cc = 0; - register int i; - - register char *s = NULL; - char *q; - int s_len; - - register int min_width = 0; - int precision = 0; - enum { - LEFT, RIGHT - } adjust; - char pad_char; - char prefix_char; - - double fp_num; - wide_int i_num = (wide_int) 0; - u_wide_int ui_num; - - char num_buf[NUM_BUF_SIZE]; - char char_buf[2]; /* for printing %% and %<unknown> */ - - /* - * Flag variables - */ - boolean_e is_long; - boolean_e alternate_form; - boolean_e print_sign; - boolean_e print_blank; - boolean_e adjust_precision; - boolean_e adjust_width; - bool_int is_negative; - - sp = odp->nextb; - bep = odp->buf_end; - - while (*fmt) { - if (*fmt != '%') { - INS_CHAR(*fmt, sp, bep, cc); - } else { - /* - * Default variable settings - */ - adjust = RIGHT; - alternate_form = print_sign = print_blank = NO; - pad_char = ' '; - prefix_char = NUL; - - fmt++; - - /* - * Try to avoid checking for flags, width or precision - */ - if (isascii((int)*fmt) && !islower((int)*fmt)) { - /* - * Recognize flags: -, #, BLANK, + - */ - for (;; fmt++) { - if (*fmt == '-') - adjust = LEFT; - else if (*fmt == '+') - print_sign = YES; - else if (*fmt == '#') - alternate_form = YES; - else if (*fmt == ' ') - print_blank = YES; - else if (*fmt == '0') - pad_char = '0'; - else - break; - } - - /* - * Check if a width was specified - */ - if (isdigit((int)*fmt)) { - STR_TO_DEC(fmt, min_width); - adjust_width = YES; - } else if (*fmt == '*') { - min_width = va_arg(ap, int); - fmt++; - adjust_width = YES; - if (min_width < 0) { - adjust = LEFT; - min_width = -min_width; - } - } else - adjust_width = NO; - - /* - * Check if a precision was specified - * - * XXX: an unreasonable amount of precision may be specified - * resulting in overflow of num_buf. Currently we - * ignore this possibility. - */ - if (*fmt == '.') { - adjust_precision = YES; - fmt++; - if (isdigit((int)*fmt)) { - STR_TO_DEC(fmt, precision); - } else if (*fmt == '*') { - precision = va_arg(ap, int); - fmt++; - if (precision < 0) - precision = 0; - } else - precision = 0; - } else - adjust_precision = NO; - } else - adjust_precision = adjust_width = NO; - - /* - * Modifier check - */ - if (*fmt == 'l') { - is_long = YES; - fmt++; - } else - is_long = NO; - - /* - * Argument extraction and printing. - * First we determine the argument type. - * Then, we convert the argument to a string. - * On exit from the switch, s points to the string that - * must be printed, s_len has the length of the string - * The precision requirements, if any, are reflected in s_len. - * - * NOTE: pad_char may be set to '0' because of the 0 flag. - * It is reset to ' ' by non-numeric formats - */ - switch (*fmt) { - case 'u': - if (is_long) - i_num = va_arg(ap, u_wide_int); - else - i_num = (wide_int) va_arg(ap, unsigned int); - /* - * The rest also applies to other integer formats, so fall - * into that case. - */ - case 'd': - case 'i': - /* - * Get the arg if we haven't already. - */ - if ((*fmt) != 'u') { - if (is_long) - i_num = va_arg(ap, wide_int); - else - i_num = (wide_int) va_arg(ap, int); - }; - s = conv_10(i_num, (*fmt) == 'u', &is_negative, - &num_buf[NUM_BUF_SIZE], &s_len); - FIX_PRECISION(adjust_precision, precision, s, s_len); - - if (*fmt != 'u') { - if (is_negative) - prefix_char = '-'; - else if (print_sign) - prefix_char = '+'; - else if (print_blank) - prefix_char = ' '; - } - break; - - - case 'o': - if (is_long) - ui_num = va_arg(ap, u_wide_int); - else - ui_num = (u_wide_int) va_arg(ap, unsigned int); - s = conv_p2(ui_num, 3, *fmt, - &num_buf[NUM_BUF_SIZE], &s_len); - FIX_PRECISION(adjust_precision, precision, s, s_len); - if (alternate_form && *s != '0') { - *--s = '0'; - s_len++; - } - break; - - - case 'x': - case 'X': - if (is_long) - ui_num = (u_wide_int) va_arg(ap, u_wide_int); - else - ui_num = (u_wide_int) va_arg(ap, unsigned int); - s = conv_p2(ui_num, 4, *fmt, - &num_buf[NUM_BUF_SIZE], &s_len); - FIX_PRECISION(adjust_precision, precision, s, s_len); - if (alternate_form && i_num != 0) { - *--s = *fmt; /* 'x' or 'X' */ - *--s = '0'; - s_len += 2; - } - break; - - - case 's': - s = va_arg(ap, char *); - if (s != NULL) { - s_len = strlen(s); - if (adjust_precision && precision < s_len) - s_len = precision; - } else { - s = S_NULL; - s_len = S_NULL_LEN; - } - pad_char = ' '; - break; - - - case 'f': - case 'e': - case 'E': - fp_num = va_arg(ap, double); - - s = conv_fp(*fmt, fp_num, alternate_form, - (adjust_precision == NO) ? FLOAT_DIGITS : precision, - &is_negative, &num_buf[1], &s_len); - if (is_negative) - prefix_char = '-'; - else if (print_sign) - prefix_char = '+'; - else if (print_blank) - prefix_char = ' '; - break; - - - case 'g': - case 'G': - if (adjust_precision == NO) - precision = FLOAT_DIGITS; - else if (precision == 0) - precision = 1; - /* - * * We use &num_buf[ 1 ], so that we have room for the sign - */ - s = ap_gcvt(va_arg(ap, double), precision, &num_buf[1]); - if (*s == '-') - prefix_char = *s++; - else if (print_sign) - prefix_char = '+'; - else if (print_blank) - prefix_char = ' '; - - s_len = strlen(s); - - if (alternate_form && (q = strchr(s, '.')) == NULL) - s[s_len++] = '.'; - if (*fmt == 'G' && (q = strchr(s, 'e')) != NULL) - *q = 'E'; - break; - - - case 'c': - char_buf[0] = (char) (va_arg(ap, int)); - s = &char_buf[0]; - s_len = 1; - pad_char = ' '; - break; - - - case '%': - char_buf[0] = '%'; - s = &char_buf[0]; - s_len = 1; - pad_char = ' '; - break; - - - case 'n': - *(va_arg(ap, int *)) = cc; - break; - - /* - * Always extract the argument as a "char *" pointer. We - * should be using "void *" but there are still machines - * that don't understand it. - * If the pointer size is equal to the size of an unsigned - * integer we convert the pointer to a hex number, otherwise - * we print "%p" to indicate that we don't handle "%p". - */ - case 'p': - ui_num = (u_wide_int) va_arg(ap, char *); - - if (sizeof(char *) <= sizeof(u_wide_int)) - s = conv_p2(ui_num, 4, 'x', - &num_buf[NUM_BUF_SIZE], &s_len); - else { - s = "%p"; - s_len = 2; - } - pad_char = ' '; - break; - - - case NUL: - /* - * The last character of the format string was %. - * We ignore it. - */ - continue; - - - /* - * The default case is for unrecognized %'s. - * We print %<char> to help the user identify what - * option is not understood. - * This is also useful in case the user wants to pass - * the output of format_converter to another function - * that understands some other %<char> (like syslog). - * Note that we can't point s inside fmt because the - * unknown <char> could be preceded by width etc. - */ - default: - char_buf[0] = '%'; - char_buf[1] = *fmt; - s = char_buf; - s_len = 2; - pad_char = ' '; - break; - } - - if (prefix_char != NUL) { - *--s = prefix_char; - s_len++; - } - if (adjust_width && adjust == RIGHT && min_width > s_len) { - if (pad_char == '0' && prefix_char != NUL) { - INS_CHAR(*s, sp, bep, cc) - s++; - s_len--; - min_width--; - } - PAD(min_width, s_len, pad_char); - } - /* - * Print the string s. - */ - for (i = s_len; i != 0; i--) { - INS_CHAR(*s, sp, bep, cc); - s++; - } - - if (adjust_width && adjust == LEFT && min_width > s_len) - PAD(min_width, s_len, pad_char); - } - fmt++; - } - odp->nextb = sp; - return (cc); -} - - -/* - * This is the general purpose conversion function. - */ -static void strx_printv(int *ccp, char *buf, size_t len, const char *format, - va_list ap) -{ - buffy od; - int cc; - - /* - * First initialize the descriptor - * Notice that if no length is given, we initialize buf_end to the - * highest possible address. - */ - od.buf_end = len ? &buf[len] : (char *) ~0; - od.nextb = buf; - - /* - * Do the conversion - */ - cc = format_converter(&od, format, ap); - if (len == 0 || od.nextb <= od.buf_end) - *(od.nextb) = '\0'; - if (ccp) - *ccp = cc; -} - - -int ap_snprintf(char *buf, size_t len, const char *format,...) -{ - int cc; - va_list ap; - - va_start(ap, format); - strx_printv(&cc, buf, (len - 1), format, ap); - va_end(ap); - return (cc); -} - - -int ap_vsnprintf(char *buf, size_t len, const char *format, va_list ap) -{ - int cc; - - strx_printv(&cc, buf, (len - 1), format, ap); - return (cc); -} - -#endif /* HAVE_SNPRINTF */ -#endif /* APACHE */ diff --git a/main/snprintf.h b/main/snprintf.h deleted file mode 100644 index 4a453b2693..0000000000 --- a/main/snprintf.h +++ /dev/null @@ -1,45 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | PHP version 4.0 | - +----------------------------------------------------------------------+ - | Copyright (c) 1997, 1998, 1999 The PHP Group | - +----------------------------------------------------------------------+ - | This source file is subject to version 2.0 of the PHP license, | - | that is bundled with this package in the file LICENSE, and is | - | available at through the world-wide-web at | - | http://www.php.net/license/2_0.txt. | - | If you did not receive a copy of the PHP license and are unable to | - | obtain it through the world-wide-web, please send a note to | - | license@php.net so we can mail you a copy immediately. | - +----------------------------------------------------------------------+ - | Authors: Stig Sæther Bakken <ssb@guardian.no> | - +----------------------------------------------------------------------+ - */ - -#ifndef _PHP3_SNPRINTF_H -#define _PHP3_SNPRINTF_H - -#ifndef HAVE_SNPRINTF -extern int ap_snprintf(char *, size_t, const char *, ...); -#define snprintf ap_snprintf -#endif - -#ifndef HAVE_VSNPRINTF -extern int ap_vsnprintf(char *, size_t, const char *, va_list ap); -#define vsnprintf ap_vsnprintf -#endif - -#if BROKEN_SPRINTF -int php_sprintf (char* s, const char* format, ...); -#else -#define php_sprintf sprintf -#endif - -#endif /* _PHP3_SNPRINTF_H */ - -/* - * Local variables: - * tab-width: 4 - * c-basic-offset: 4 - * End: - */ diff --git a/main/strlcat.c b/main/strlcat.c deleted file mode 100644 index 6b2cc1f679..0000000000 --- a/main/strlcat.c +++ /dev/null @@ -1,77 +0,0 @@ -#include "php.h" - -#ifndef HAVE_STRLCAT - -/* $OpenBSD: strlcat.c,v 1.2 1999/06/17 16:28:58 millert Exp $ */ - -/* - * Copyright (c) 1998 Todd C. Miller <Todd.Miller@courtesan.com> - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY - * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL - * THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#if defined(LIBC_SCCS) && !defined(lint) -static char *rcsid = "$OpenBSD: strlcat.c,v 1.2 1999/06/17 16:28:58 millert Exp $"; -#endif /* LIBC_SCCS and not lint */ - -#include <sys/types.h> -#include <string.h> - -/* - * Appends src to string dst of size siz (unlike strncat, siz is the - * full size of dst, not space left). At most siz-1 characters - * will be copied. Always NUL terminates (unless siz == 0). - * Returns strlen(src); if retval >= siz, truncation occurred. - */ -size_t strlcat(dst, src, siz) - char *dst; - const char *src; - size_t siz; -{ - register char *d = dst; - register const char *s = src; - register size_t n = siz; - size_t dlen; - - /* Find the end of dst and adjust bytes left but don't go past end */ - while (*d != '\0' && n-- != 0) - d++; - dlen = d - dst; - n = siz - dlen; - - if (n == 0) - return(dlen + strlen(s)); - while (*s != '\0') { - if (n != 1) { - *d++ = *s; - n--; - } - s++; - } - *d = '\0'; - - return(dlen + (s - src)); /* count does not include NUL */ -} - -#endif /* !HAVE_STRLCAT */ diff --git a/main/strlcpy.c b/main/strlcpy.c deleted file mode 100644 index c34bf0a001..0000000000 --- a/main/strlcpy.c +++ /dev/null @@ -1,74 +0,0 @@ -#include "php.h" - -#ifndef HAVE_STRLCPY - -/* $OpenBSD: strlcpy.c,v 1.4 1999/05/01 18:56:41 millert Exp $ */ - -/* - * Copyright (c) 1998 Todd C. Miller <Todd.Miller@courtesan.com> - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY - * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL - * THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#if defined(LIBC_SCCS) && !defined(lint) -static char *rcsid = "$OpenBSD: strlcpy.c,v 1.4 1999/05/01 18:56:41 millert Exp $"; -#endif /* LIBC_SCCS and not lint */ - -#include <sys/types.h> -#include <string.h> - -/* - * Copy src to string dst of size siz. At most siz-1 characters - * will be copied. Always NUL terminates (unless siz == 0). - * Returns strlen(src); if retval >= siz, truncation occurred. - */ -size_t strlcpy(dst, src, siz) - char *dst; - const char *src; - size_t siz; -{ - register char *d = dst; - register const char *s = src; - register size_t n = siz; - - /* Copy as many bytes as will fit */ - if (n != 0 && --n != 0) { - do { - if ((*d++ = *s++) == 0) - break; - } while (--n != 0); - } - - /* Not enough room in dst, add NUL and traverse rest of src */ - if (n == 0) { - if (siz != 0) - *d = '\0'; /* NUL-terminate dst */ - while (*s++) - ; - } - - return(s - src - 1); /* count does not include NUL */ -} - -#endif /* !HAVE_STRLCPY */ diff --git a/main/win95nt.h b/main/win95nt.h deleted file mode 100644 index 0808a84638..0000000000 --- a/main/win95nt.h +++ /dev/null @@ -1,74 +0,0 @@ -/* Defines and types for Windows 95/NT */ -#define WIN32_LEAN_AND_MEAN -#include <io.h> -#include <malloc.h> -#include <direct.h> -#include <stdlib.h> -#include <stdio.h> -#include <stdarg.h> -#include <sys/types.h> -typedef int uid_t; -typedef int gid_t; -typedef int mode_t; -typedef char * caddr_t; -#define lstat(x, y) stat(x, y) -#define _IFIFO 0010000 /* fifo */ -#define _IFBLK 0060000 /* block special */ -#define _IFLNK 0120000 /* symbolic link */ -#define S_IFIFO _IFIFO -#define S_IFBLK _IFBLK -#define S_IFLNK _IFLNK -#define pclose _pclose -#define popen _popen -#define chdir(path) SetCurrentDirectory(path) -#define mkdir(a,b) _mkdir(a) -#define rmdir _rmdir -#define getpid _getpid -#if !(APACHE) -#define sleep(t) Sleep(t*1000) -#endif -#define getcwd _getcwd -#define snprintf _snprintf -#define off_t _off_t -#define vsnprintf _vsnprintf -typedef unsigned int uint; -typedef unsigned long ulong; -#if !NSAPI -#define strcasecmp(s1, s2) stricmp(s1, s2) -#define strncasecmp(s1, s2, n) strnicmp(s1, s2, n) -typedef long pid_t; -#endif - -/* missing in vc5 math.h */ -#define M_PI 3.14159265358979323846 -#define M_TWOPI (M_PI * 2.0) -#define M_PI_2 1.57079632679489661923 -#define M_PI_4 0.78539816339744830962 - -#if !DEBUG -#ifdef inline -#undef inline -#endif -#define inline __inline -#endif - -/* General Windows stuff */ -#define WINDOWS 1 - -/* Prevent use of VC5 OpenFile function */ -#define NOOPENFILE - -/* sendmail is built-in */ -#ifdef PHP_PROG_SENDMAIL -#undef PHP_PROG_SENDMAIL -#define PHP_PROG_SENDMAIL "Built in mailer" -#endif - -#define CONVERT_TO_WIN_FS(Filename) \ -{ \ - char *stemp; \ - if (Filename) \ - for (stemp = Filename; *stemp; stemp++) \ - if ( *stemp == '/') \ - *stemp = '\\'; \ -} |