From 54caf223254e5ec16d8ba47258b952476855587e Mon Sep 17 00:00:00 2001 From: Dmitry Stogov Date: Fri, 28 May 2010 12:18:03 +0000 Subject: [PATCH] Fixed bug #50976 (Soap headers Authorization not allowed) --- NEWS | 2 ++ ext/soap/php_http.c | 15 ++++++++++++--- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/NEWS b/NEWS index 2662a43be5..769dd698bc 100644 --- a/NEWS +++ b/NEWS @@ -150,6 +150,8 @@ PHP NEWS - 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 diff --git a/ext/soap/php_http.c b/ext/soap/php_http.c index 6257e79151..d7dc4decfb 100644 --- a/ext/soap/php_http.c +++ b/ext/soap/php_http.c @@ -212,6 +212,9 @@ int make_http_soap_request(zval *this_ptr, 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 @@ try_again: 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 @@ try_again: /* Proxy HTTP Authentication */ if (use_proxy && !use_ssl) { + has_proxy_authorization = 1; proxy_authentication(this_ptr, &soap_headers TSRMLS_CC); } @@ -660,6 +665,7 @@ try_again: 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 @@ try_again: 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); -- 2.40.0