Re: cvs: php4 /main SAPI.c

From: Date: Sun, 21 Oct 2001 19:00:37 +0000
Subject: Re: cvs: php4 /main SAPI.c
References: 1  Groups: php.cvs 
Request: Send a blank email to php-cvs+get-7899@lists.php.net to get a copy of this message
Ack, let's just always enable pcre and you won't have to use this conditional crap. At 05:41 PM 10/21/01 +0000, Rasmus Lerdorf wrote:
rasmus          Sun Oct 21 13:41:15 2001 EDT
Modified files:
    /php4/main  SAPI.c
Log: 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. Index: php4/main/SAPI.c diff -u php4/main/SAPI.c:1.118 php4/main/SAPI.c:1.119
--- php4/main/SAPI.c:1.118      Sat Oct 20 18:01:56 2001
+++ php4/main/SAPI.c    Sun Oct 21 13:41:15 2001
@@ -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 @@
        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 @@ 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 @@
                                        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 = ':';
                }
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-cvs-unsubscribe@lists.php.net For additional commands, e-mail: php-cvs-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net
-Andrei

« previous php.cvs (#7899) next »