Bug #69088 [NEW]: PHP_MINIT_FUNCTION does not fully initialize cURL on Win32

From: Date: Fri, 20 Feb 2015 12:14:54 +0000
Subject: Bug #69088 [NEW]: PHP_MINIT_FUNCTION does not fully initialize cURL on Win32
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-190841@lists.php.net to get a copy of this message
From:             grant at digitaldj dot net
Operating system: Windows (all)
PHP version:      5.6.6
Package:          cURL related
Bug Type:         Bug
Bug description:PHP_MINIT_FUNCTION does not fully initialize cURL on Win32

Description:
------------
Since cURL 7.40.0, HTTP Digest Authentication support is now handled by
Windows SSPI.

To initialize cURL, the php_curl module uses
curl_global_init(CURL_GLOBAL_SSL); This call skips initializing any
Win32 specific features (see curl_global_init in cURL lib/easy.c). 

As a result, the SSPI interface is not initialized and attempting to use
HTTP Digest Authentication results in referencing a null pointer,
s_pSecFn, in Curl_sasl_create_digest_http_message
(lib/curl_sasl_sspi.c).

To fix, PHP_MINIT_FUNCTION should call curl_global_init with
CURL_GLOBAL_DEFAULT. This will not affect non-Win32 platforms and is the
cURL recommended default.

This was tested with the official Windows PHP binaries, 5.6.6 VC11 x86
Thread Safe, running on Windows 8.1 x64.



Test script:
---------------
<?php
$url = "http://httpbin.org/digest-auth/auth/user/passwd";
$userPass = "user:pass";
$curl = curl_init($url);
curl_setopt($curl, CURLOPT_VERBOSE, true);
curl_setopt($curl, CURLOPT_USERPWD, $userPass);
curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_DIGEST);
$response = curl_exec($curl);
curl_close($curl);
?>

Expected result:
----------------
cURL successfully sends a request to the server and PHP exits with code
0.

Actual result:
--------------
PHP crahes with null pointer reference s_pSecFn, in
Curl_sasl_create_digest_http_message (lib/curl_sasl_sspi.c)

-- 
Edit bug report at https://bugs.php.net/bug.php?id=69088&edit=1
-- 
Try a snapshot (PHP 5.4):   https://bugs.php.net/fix.php?id=69088&r=trysnapshot54
Try a snapshot (PHP 5.5):   https://bugs.php.net/fix.php?id=69088&r=trysnapshot55
Try a snapshot (trunk):     https://bugs.php.net/fix.php?id=69088&r=trysnapshottrunk
Fixed in SVN:               https://bugs.php.net/fix.php?id=69088&r=fixed
Fixed in release:           https://bugs.php.net/fix.php?id=69088&r=alreadyfixed
Need backtrace:             https://bugs.php.net/fix.php?id=69088&r=needtrace
Need Reproduce Script:      https://bugs.php.net/fix.php?id=69088&r=needscript
Try newer version:          https://bugs.php.net/fix.php?id=69088&r=oldversion
Not developer issue:        https://bugs.php.net/fix.php?id=69088&r=support
Expected behavior:          https://bugs.php.net/fix.php?id=69088&r=notwrong
Not enough info:            https://bugs.php.net/fix.php?id=69088&r=notenoughinfo
Submitted twice:            https://bugs.php.net/fix.php?id=69088&r=submittedtwice
register_globals:           https://bugs.php.net/fix.php?id=69088&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=69088&r=php4
Daylight Savings:           https://bugs.php.net/fix.php?id=69088&r=dst
IIS Stability:              https://bugs.php.net/fix.php?id=69088&r=isapi
Install GNU Sed:            https://bugs.php.net/fix.php?id=69088&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=69088&r=float
No Zend Extensions:         https://bugs.php.net/fix.php?id=69088&r=nozend
MySQL Configuration Error:  https://bugs.php.net/fix.php?id=69088&r=mysqlcfg



Thread (7 messages)

« previous php.bugs (#190841) next »