]>
Commit | Line | Data |
---|---|---|
9d6174b1 | 1 | diff -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 @@ | |
d39a6d5a | 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 | |
9d6174b1 | 14 | @@ -465,65 +462,8 @@ |
d39a6d5a | 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); | |
d1fc9dcc | 31 | - Z_TYPE_P(repl_temp) = IS_STRING; |
d39a6d5a | 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); | |
9d6174b1 | 58 | - result_len = ptr_len+conv_len; |
d39a6d5a | 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); | |
9d6174b1 | 75 | - } |
d39a6d5a | 76 | -#else |
77 | if(PG(safe_mode)) { | |
78 | myuid = php_getuid(); | |
79 | result = emalloc(32); | |
9d6174b1 | 80 | @@ -534,7 +474,6 @@ |
d39a6d5a | 81 | sapi_header.header_len = newlen; |
82 | efree(result); | |
83 | } | |
84 | -#endif | |
85 | } | |
86 | if (sapi_header.header==header_line) { | |
87 | *colon_offset = ':'; |