stream_socket_server() creates wrong Abstract Namespace UNIX sockets
This commit is contained in:
Michael Wallner 2014-04-02 11:09:26 +02:00
parent f244513fc0
commit 91a9d24aa3
3 changed files with 27 additions and 1 deletions

5
NEWS
View File

@ -1,6 +1,11 @@
PHP NEWS
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
?? ??? 2014, PHP 5.4.28
- Core:
. Fixed bug #64330 (stream_socket_server() creates wrong Abstract Namespace
UNIX sockets). (Mike)
- Embed:
. Fixed bug #65715 (php5embed.lib isn't provided anymore). (Anatol)

View File

@ -0,0 +1,20 @@
--TEST--
Bug #64330 (stream_socket_server() creates wrong Abstract Namespace UNIX sockets)
--SKIPIF--
<?php
if (!in_array("unix", stream_get_transports())) die("SKIP unix domain sockets unavailable");
?>
--FILE--
<?php
echo "Test\n";
$server = stream_socket_server("unix://\x00/MyBindName");
$client = stream_socket_client("unix://\x00/MyBindName");
if ($client) {
echo "ok\n";
}
?>
===DONE===
--EXPECT--
Test
ok
===DONE===

View File

@ -588,7 +588,8 @@ static inline int php_tcp_sockop_bind(php_stream *stream, php_netstream_data_t *
parse_unix_address(xparam, &unix_addr TSRMLS_CC);
return bind(sock->socket, (struct sockaddr *)&unix_addr, sizeof(unix_addr));
return bind(sock->socket, (const struct sockaddr *)&unix_addr,
(socklen_t) XtOffsetOf(struct sockaddr_un, sun_path) + xparam->inputs.namelen);
}
#endif