]> git.pld-linux.org Git - packages/php.git/blame - php-no_php_pcre_in_SAPI_c.patch
- updated for 4.2.0rc3
[packages/php.git] / php-no_php_pcre_in_SAPI_c.patch
CommitLineData
ba08c1eb
AM
1diff -urN php-4_2_0RC3.org/main/SAPI.c php-4_2_0RC3/main/SAPI.c
2--- php-4_2_0RC3.org/main/SAPI.c Sat Apr 13 01:18:30 2002
3+++ php-4_2_0RC3/main/SAPI.c Sat Apr 13 01:38:42 2002
4@@ -27,9 +27,6 @@
7d178bd6 5 #include "SAPI.h"
6 #include "ext/standard/php_string.h"
7 #include "ext/standard/pageinfo.h"
8-#if HAVE_PCRE || HAVE_BUNDLED_PCRE
9-#include "ext/pcre/php_pcre.h"
10-#endif
11 #ifdef ZTS
12 #include "TSRM.h"
13 #endif
ba08c1eb 14@@ -465,65 +462,8 @@
7d178bd6 15 } else if (!STRCASECMP(header_line, "WWW-Authenticate")) { /* HTTP Authentication */
16 int newlen;
17 char *result, *newheader;
18-#if HAVE_PCRE || HAVE_BUNDLED_PCRE
19- zval *repl_temp;
20- char *ptr = colon_offset+1;
21- int ptr_len=0, result_len = 0;
22-#endif
23
24 SG(sapi_headers).http_response_code = 401; /* authentication-required */
25-#if HAVE_PCRE || HAVE_BUNDLED_PCRE
26- if(PG(safe_mode)) {
27- myuid = php_getuid();
28-
29- ptr_len = strlen(ptr);
30- MAKE_STD_ZVAL(repl_temp);
31- Z_TYPE_P(repl_temp) = IS_STRING;
32- Z_STRVAL_P(repl_temp) = emalloc(32);
33- Z_STRLEN_P(repl_temp) = sprintf(Z_STRVAL_P(repl_temp), "realm=\"\\1-%ld\"", myuid);
34- /* Modify quoted realm value */
35- result = php_pcre_replace("/realm=\"(.*?)\"/i", 16,
36- ptr, ptr_len,
37- repl_temp,
38- 0, &result_len, -1 TSRMLS_CC);
39- if(result_len==ptr_len) {
40- efree(result);
41- sprintf(Z_STRVAL_P(repl_temp), "realm=\\1-%ld\\2", myuid);
42- /* modify unquoted realm value */
43- result = php_pcre_replace("/realm=([^\\s]+)(.*)/i", 21,
44- ptr, ptr_len,
45- repl_temp,
46- 0, &result_len, -1 TSRMLS_CC);
47- if(result_len==ptr_len) {
48- char *lower_temp = estrdup(ptr);
49- char conv_temp[32];
50- int conv_len;
51-
52- php_strtolower(lower_temp,strlen(lower_temp));
53- /* If there is no realm string at all, append one */
54- if(!strstr(lower_temp,"realm")) {
55- efree(result);
56- conv_len = sprintf(conv_temp," realm=\"%ld\"",myuid);
57- result = emalloc(ptr_len+conv_len+1);
ba08c1eb 58- result_len = ptr_len+conv_len;
7d178bd6 59- memcpy(result, ptr, ptr_len);
60- memcpy(result+ptr_len, conv_temp, conv_len);
61- *(result+ptr_len+conv_len) = '\0';
62- }
63- efree(lower_temp);
64- }
65- }
66- newlen = sizeof("WWW-Authenticate: ") + result_len;
67- newheader = emalloc(newlen+1);
68- sprintf(newheader,"WWW-Authenticate: %s", result);
69- efree(header_line);
70- sapi_header.header = newheader;
71- sapi_header.header_len = newlen;
72- efree(result);
73- efree(Z_STRVAL_P(repl_temp));
74- efree(repl_temp);
ba08c1eb 75- }
7d178bd6 76-#else
77 if(PG(safe_mode)) {
78 myuid = php_getuid();
79 result = emalloc(32);
ba08c1eb 80@@ -534,7 +474,6 @@
7d178bd6 81 sapi_header.header_len = newlen;
82 efree(result);
83 }
84-#endif
85 }
86 if (sapi_header.header==header_line) {
87 *colon_offset = ':';
This page took 1.889455 seconds and 4 git commands to generate.