1--TEST-- 2Bug #69215: Crypto servers should send client CA list 3--SKIPIF-- 4<?php 5if (!extension_loaded("openssl")) die("skip openssl not loaded"); 6if (!function_exists("proc_open")) die("skip no proc_open"); 7?> 8--FILE-- 9<?php 10$caCertFile = __DIR__ . DIRECTORY_SEPARATOR . 'bug69215-ca.pem.tmp'; 11$clientCertFile = __DIR__ . DIRECTORY_SEPARATOR . 'bug69215-client.pem.tmp'; 12$serverCertFile = __DIR__ . DIRECTORY_SEPARATOR . 'bug69215-server.pem.tmp'; 13 14$serverCode = <<<'CODE' 15 $serverUri = "ssl://127.0.0.1:64321"; 16 $serverFlags = STREAM_SERVER_BIND | STREAM_SERVER_LISTEN; 17 $serverCtx = stream_context_create(['ssl' => [ 18 'local_cert' => '%s', 19 'cafile' => '%s', 20 'verify_peer' => true, 21 'verify_peer_name' => true, 22 'peer_name' => 'bug69215-client', 23 ]]); 24 25 $server = stream_socket_server($serverUri, $errno, $errstr, $serverFlags, $serverCtx); 26 phpt_notify(); 27 28 stream_socket_accept($server, 30); 29CODE; 30$serverCode = sprintf($serverCode, $serverCertFile, $caCertFile); 31 32$clientCode = <<<'CODE' 33 $serverUri = "ssl://127.0.0.1:64321"; 34 $clientFlags = STREAM_CLIENT_CONNECT; 35 $clientCtx = stream_context_create(['ssl' => [ 36 'local_cert' => '%s', 37 'cafile' => '%s', 38 'verify_peer' => true, 39 'verify_peer_name' => true, 40 'peer_name' => 'bug69215-server', 41 ]]); 42 43 phpt_wait(); 44 45 var_dump(stream_socket_client($serverUri, $errno, $errstr, 1, $clientFlags, $clientCtx)); 46CODE; 47$clientCode = sprintf($clientCode, $clientCertFile, $caCertFile); 48 49include 'CertificateGenerator.inc'; 50$certificateGenerator = new CertificateGenerator(); 51$certificateGenerator->saveCaCert($caCertFile); 52$certificateGenerator->saveNewCertAsFileWithKey('bug69215-client', $clientCertFile); 53$certificateGenerator->saveNewCertAsFileWithKey('bug69215-server', $serverCertFile); 54 55include 'ServerClientTestCase.inc'; 56ServerClientTestCase::getInstance()->run($clientCode, $serverCode); 57?> 58--CLEAN-- 59<?php 60@unlink(__DIR__ . DIRECTORY_SEPARATOR . 'bug69215-ca.pem.tmp'); 61@unlink(__DIR__ . DIRECTORY_SEPARATOR . 'bug69215-client.pem.tmp'); 62@unlink(__DIR__ . DIRECTORY_SEPARATOR . 'bug69215-server.pem.tmp'); 63?> 64--EXPECTF-- 65resource(%d) of type (stream) 66