Bug 41321

Summary: apr_socket_addr_get() fails - getpeername invalid after AcceptEx
Product: APR Reporter: Tom Donovan <Tom.Donovan>
Component: APRAssignee: Apache Portable Runtime bugs mailinglist <bugs>
Status: RESOLVED FIXED    
Severity: normal    
Priority: P2    
Version: 1.2.8   
Target Milestone: ---   
Hardware: Other   
OS: Windows 2000   

Description Tom Donovan 2007-01-08 15:39:29 UTC
Change 480213 (& 480212) to network_io/win32/sockets.c
now causes apr_socket_addr_get() in network_io/unix/sockaddr.c 
to call get_remote_addr() because remote_addr_unknown is set.

get_remote_addr() calls the Windows function getpeername().

This step is unnecessary on Windows - the remote IP is already present.

getpeername() does not work correctly on Windows 2000, it always returns
0.0.0.0. It works correctly on XP and Win2003. Windows bug?

getpeername() doc is at http://msdn2.microsoft.com/en-us/library/ms738533.aspx
Comment 1 William A. Rowe Jr. 2007-01-09 11:22:20 UTC
Fixed remote_host_unknown in APR trunk/1.2 branch for apr_socket_make.

Following AcceptEx, apr_socket_make must be passed the collected remote socket
on such platforms as it inhibits the proper behavior of getpeername in some
circumstances.

Workaround is to avoid AcceptEx altogether on affected systems.