* fhandler.h (class fhandler_socket): Add peer_sun_path member.

(fhandler_socket::set_peer_sun_path): New method.
	(fhandler_socket::get_peer_sun_path): New method.
	* fhandler_socket.cc (fhandler_socket::fhandler_socket): Initialize
	peer_sun_path to NULL.
	(fhandler_socket::~fhandler_socket): Free peer_sun_path if necessary.
	(fhandler_socket::dup): Duplicate peer_sun_path.
	(fhandler_socket::accept): Ditto.  Return fake unbound peer content
	and len in case of AF_LOCAL sockets.
	(fhandler_socket::getsockname): Always use local sockaddr_storage to
	store socket address and copy over to incoming address.  Handle every
	namelen correctly per POSIX.
	(fhandler_socket::getpeername): Ditto.  Add code path to return
	correct value for AF_LOCAL sockets.
	(fhandler_socket::set_peer_sun_path): New method.
	* net.cc (socketpair): Set peer_sun_path to empty string, just like
	sun_path.
This commit is contained in:
Corinna Vinschen
2009-08-13 10:26:42 +00:00
parent af0a038ecb
commit d3d4aa96aa
4 changed files with 94 additions and 24 deletions

View File

@ -2867,6 +2867,7 @@ socketpair (int family, int type, int protocol, int *sb)
if (sb0 >= 0 && fdsock (sb0, dev, insock))
{
((fhandler_socket *) sb0)->set_sun_path ("");
((fhandler_socket *) sb0)->set_peer_sun_path ("");
((fhandler_socket *) sb0)->set_addr_family (family);
((fhandler_socket *) sb0)->set_socket_type (type);
((fhandler_socket *) sb0)->connect_state (connected);
@ -2878,6 +2879,7 @@ socketpair (int family, int type, int protocol, int *sb)
if (sb1 >= 0 && fdsock (sb1, dev, outsock))
{
((fhandler_socket *) sb1)->set_sun_path ("");
((fhandler_socket *) sb1)->set_peer_sun_path ("");
((fhandler_socket *) sb1)->set_addr_family (family);
((fhandler_socket *) sb1)->set_socket_type (type);
((fhandler_socket *) sb1)->connect_state (connected);