diff options
author | Rasmus Lerdorf <rasmus@php.net> | 2001-10-21 17:41:15 +0000 |
---|---|---|
committer | Rasmus Lerdorf <rasmus@php.net> | 2001-10-21 17:41:15 +0000 |
commit | 8064e685be6d80882533e4ddde68ca266706abf5 (patch) | |
tree | 7098acef34e5f54d5f0f7f516878e5a09107940c /main/SAPI.c | |
parent | 2b8e0d43e90e2b8cb127570c0c845beecf7db296 (diff) | |
download | php-git-8064e685be6d80882533e4ddde68ca266706abf5.tar.gz |
Check if PCRE support is compiled in and only use the pcre functions if
it is. Otherwise just set the realm to the safe mode user id if it isn't.
Diffstat (limited to 'main/SAPI.c')
-rw-r--r-- | main/SAPI.c | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/main/SAPI.c b/main/SAPI.c index 76ccad8c0f..0f049cb60c 100644 --- a/main/SAPI.c +++ b/main/SAPI.c @@ -25,7 +25,9 @@ #include "SAPI.h" #include "ext/standard/php_string.h" #include "ext/standard/pageinfo.h" +#if HAVE_PCRE || HAVE_BUNDLED_PCRE #include "ext/pcre/php_pcre.h" +#endif #ifdef ZTS #include "TSRM.h" #endif @@ -375,7 +377,6 @@ SAPI_API int sapi_add_header_ex(char *header_line, uint header_line_len, zend_bo int retval, free_header = 0; sapi_header_struct sapi_header; char *colon_offset; - int result_len = 0; long myuid = 0L; if (SG(headers_sent) && !SG(request_info).no_headers) { @@ -446,11 +447,16 @@ SAPI_API int sapi_add_header_ex(char *header_line, uint header_line_len, zend_bo SG(sapi_headers).http_response_code = 302; } } else if (!STRCASECMP(header_line, "WWW-Authenticate")) { /* HTTP Authentication */ + int newlen; + char *result, *newheader; +#if HAVE_PCRE || HAVE_BUNDLED_PCRE zval *repl_temp; - char *result, *newheader, *ptr = colon_offset+1; - int newlen, ptr_len=0; + char *ptr = colon_offset+1; + int ptr_len=0, result_len = 0; +#endif SG(sapi_headers).http_response_code = 401; /* authentication-required */ +#if HAVE_PCRE || HAVE_BUNDLED_PCRE if(PG(safe_mode)) { myuid = php_getuid(); @@ -499,6 +505,18 @@ SAPI_API int sapi_add_header_ex(char *header_line, uint header_line_len, zend_bo efree(Z_STRVAL_P(repl_temp)); efree(repl_temp); } +#else + if(PG(safe_mode)) { + myuid = php_getuid(); + result = emalloc(32); + newlen = sprintf(result, "WWW-Authenticate: %ld", myuid); + newheader = estrndup(result,newlen); + efree(header_line); + sapi_header.header = newheader; + sapi_header.header_len = newlen; + efree(result); + } +#endif } *colon_offset = ':'; } |