dmitry                                   Fri, 28 May 2010 12:18:03 +0000

Revision: http://svn.php.net/viewvc?view=revision&revision=299903

Log:
Fixed bug #50976 (Soap headers Authorization not allowed)

Bug: http://bugs.php.net/50976 (Assigned) Soap headers Authorization not allowed
      
Changed paths:
    U   php/php-src/branches/PHP_5_3/NEWS
    U   php/php-src/branches/PHP_5_3/ext/soap/php_http.c
    U   php/php-src/trunk/ext/soap/php_http.c

Modified: php/php-src/branches/PHP_5_3/NEWS
===================================================================
--- php/php-src/branches/PHP_5_3/NEWS   2010-05-28 12:01:03 UTC (rev 299902)
+++ php/php-src/branches/PHP_5_3/NEWS   2010-05-28 12:18:03 UTC (rev 299903)
@@ -150,6 +150,8 @@
 - Fixed bug #51023 (filter doesn't detect int overflows with GCC 4.4).
   (Raphael Geissert)
 - Fixed bug #50999 (unaligned memory access in dba_fetch()). (Felipe)
+- Fixed bug #50976 (Soap headers Authorization not allowed).
+  (Brain France, Dmitry)
 - Fixed bug #50828 (DOMNotation is not subclass of DOMNode). (Rob)
 - Fixed bug #50810 (property_exists does not work for private). (Felipe)
 - Fixed bug #50762 (in WSDL mode Soap Header handler function only being called

Modified: php/php-src/branches/PHP_5_3/ext/soap/php_http.c
===================================================================
--- php/php-src/branches/PHP_5_3/ext/soap/php_http.c    2010-05-28 12:01:03 UTC 
(rev 299902)
+++ php/php-src/branches/PHP_5_3/ext/soap/php_http.c    2010-05-28 12:18:03 UTC 
(rev 299903)
@@ -212,6 +212,9 @@
        char *http_msg = NULL;
        zend_bool old_allow_url_fopen;
        php_stream_context *context = NULL;
+       zend_bool has_authorization = 0;
+       zend_bool has_proxy_authorization = 0;
+       zend_bool has_cookies = 0;

        if (this_ptr == NULL || Z_TYPE_P(this_ptr) != IS_OBJECT) {
                return FALSE;
@@ -480,6 +483,7 @@
                    Z_TYPE_PP(login) == IS_STRING) {
                        zval **digest;

+                       has_authorization = 1;
                        if (zend_hash_find(Z_OBJPROP_P(this_ptr), "_digest", 
sizeof("_digest"), (void **)&digest) == SUCCESS) {
                                if (Z_TYPE_PP(digest) == IS_ARRAY) {
                                        char          HA1[33], HA2[33], 
response[33], cnonce[33], nc[9];
@@ -651,6 +655,7 @@

                /* Proxy HTTP Authentication */
                if (use_proxy && !use_ssl) {
+                       has_proxy_authorization = 1;
                        proxy_authentication(this_ptr, &soap_headers TSRMLS_CC);
                }

@@ -660,6 +665,7 @@
                        char *key;
                        int i, n;

+                       has_cookies = 1;
                        n = zend_hash_num_elements(Z_ARRVAL_PP(cookies));
                        if (n > 0) {
                                
zend_hash_internal_pointer_reset(Z_ARRVAL_PP(cookies));
@@ -734,11 +740,14 @@
                                             strncasecmp(s, "content-length", 
sizeof("content-length")-1) != 0) &&
                                            (name_len != 
sizeof("content-type")-1 ||
                                             strncasecmp(s, "content-type", 
sizeof("content-type")-1) != 0) &&
-                                           (name_len != sizeof("cookie")-1 ||
+                                           (!has_cookies ||
+                                            name_len != sizeof("cookie")-1 ||
                                             strncasecmp(s, "cookie", 
sizeof("cookie")-1) != 0) &&
-                                           (name_len != 
sizeof("authorization")-1 ||
+                                           (!has_authorization ||
+                                            name_len != 
sizeof("authorization")-1 ||
                                             strncasecmp(s, "authorization", 
sizeof("authorization")-1) != 0) &&
-                                           (name_len != 
sizeof("proxy-authorization")-1 ||
+                                           (!has_proxy_authorization ||
+                                            name_len != 
sizeof("proxy-authorization")-1 ||
                                             strncasecmp(s, 
"proxy-authorization", sizeof("proxy-authorization")-1) != 0)) {
                                            /* add header */
                                                
smart_str_appendl(&soap_headers, s, p-s);

Modified: php/php-src/trunk/ext/soap/php_http.c
===================================================================
--- php/php-src/trunk/ext/soap/php_http.c       2010-05-28 12:01:03 UTC (rev 
299902)
+++ php/php-src/trunk/ext/soap/php_http.c       2010-05-28 12:18:03 UTC (rev 
299903)
@@ -212,6 +212,9 @@
        char *http_msg = NULL;
        zend_bool old_allow_url_fopen;
        php_stream_context *context = NULL;
+       zend_bool has_authorization = 0;
+       zend_bool has_proxy_authorization = 0;
+       zend_bool has_cookies = 0;

        if (this_ptr == NULL || Z_TYPE_P(this_ptr) != IS_OBJECT) {
                return FALSE;
@@ -480,6 +483,7 @@
                    Z_TYPE_PP(login) == IS_STRING) {
                        zval **digest;

+                       has_authorization = 1;
                        if (zend_hash_find(Z_OBJPROP_P(this_ptr), "_digest", 
sizeof("_digest"), (void **)&digest) == SUCCESS) {
                                if (Z_TYPE_PP(digest) == IS_ARRAY) {
                                        char          HA1[33], HA2[33], 
response[33], cnonce[33], nc[9];
@@ -651,6 +655,7 @@

                /* Proxy HTTP Authentication */
                if (use_proxy && !use_ssl) {
+                       has_proxy_authorization = 1;
                        proxy_authentication(this_ptr, &soap_headers TSRMLS_CC);
                }

@@ -660,6 +665,7 @@
                        char *key;
                        int i, n;

+                       has_cookies = 1;
                        n = zend_hash_num_elements(Z_ARRVAL_PP(cookies));
                        if (n > 0) {
                                
zend_hash_internal_pointer_reset(Z_ARRVAL_PP(cookies));
@@ -734,11 +740,14 @@
                                             strncasecmp(s, "content-length", 
sizeof("content-length")-1) != 0) &&
                                            (name_len != 
sizeof("content-type")-1 ||
                                             strncasecmp(s, "content-type", 
sizeof("content-type")-1) != 0) &&
-                                           (name_len != sizeof("cookie")-1 ||
+                                           (!has_cookies ||
+                                            name_len != sizeof("cookie")-1 ||
                                             strncasecmp(s, "cookie", 
sizeof("cookie")-1) != 0) &&
-                                           (name_len != 
sizeof("authorization")-1 ||
+                                           (!has_authorization ||
+                                            name_len != 
sizeof("authorization")-1 ||
                                             strncasecmp(s, "authorization", 
sizeof("authorization")-1) != 0) &&
-                                           (name_len != 
sizeof("proxy-authorization")-1 ||
+                                           (!has_proxy_authorization ||
+                                            name_len != 
sizeof("proxy-authorization")-1 ||
                                             strncasecmp(s, 
"proxy-authorization", sizeof("proxy-authorization")-1) != 0)) {
                                            /* add header */
                                                
smart_str_appendl(&soap_headers, s, p-s);

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to