apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From traw...@locus.apache.org
Subject cvs commit: apr/network_io/win32 sockets.c
Date Thu, 14 Dec 2000 18:42:39 GMT
trawick     00/12/14 10:42:38

  Modified:    .        CHANGES
               network_io/unix sockets.c
               network_io/win32 sockets.c
  Log:
  Fix a bug in apr_accept() for Win32 and Unix where the local
  apr_sockaddr_t in the new connected socket was not initialized
  properly.  This could result in a bad string for apr_get_ipaddr(),
  among other things.
  
  Revision  Changes    Path
  1.22      +5 -0      apr/CHANGES
  
  Index: CHANGES
  ===================================================================
  RCS file: /home/cvs/apr/CHANGES,v
  retrieving revision 1.21
  retrieving revision 1.22
  diff -u -r1.21 -r1.22
  --- CHANGES	2000/12/13 22:30:19	1.21
  +++ CHANGES	2000/12/14 18:42:35	1.22
  @@ -1,5 +1,10 @@
   Changes with APR b1
   
  +  *) Fix a bug in apr_accept() for Win32 and Unix where the local 
  +     apr_sockaddr_t in the new connected socket was not initialized
  +     properly.  This could result in a bad string for apr_get_ipaddr(),
  +     among other things.  [Jeff Trawick]
  +
     *) Add apr_getnameinfo(), a replacement for apr_get_hostname() which
        supports IPv6 and will be friendlier for use with eventual 
        SOCK_DGRAM support.  [Jeff Trawick]
  
  
  
  1.67      +9 -0      apr/network_io/unix/sockets.c
  
  Index: sockets.c
  ===================================================================
  RCS file: /home/cvs/apr/network_io/unix/sockets.c,v
  retrieving revision 1.66
  retrieving revision 1.67
  diff -u -r1.66 -r1.67
  --- sockets.c	2000/12/04 16:09:29	1.66
  +++ sockets.c	2000/12/14 18:42:36	1.67
  @@ -205,6 +205,15 @@
           return errno;
       }
       *(*new)->local_addr = *sock->local_addr;
  +    /* fix up any pointers which are no longer valid */
  +    if (sock->local_addr->sa.sin.sin_family == AF_INET) {
  +        (*new)->local_addr->ipaddr_ptr = &(*new)->local_addr->sa.sin.sin_addr;
  +    }
  +#if APR_HAVE_IPV6
  +    else if (sock->local_addr->sa.sin.sin_family == AF_INET6) {
  +        (*new)->local_addr->ipaddr_ptr = &(*new)->local_addr->sa.sin6.sin6_addr;
  +    }
  +#endif
   
       if (sock->local_port_unknown) {
           /* not likely for a listening socket, but theoretically possible :) */
  
  
  
  1.47      +9 -0      apr/network_io/win32/sockets.c
  
  Index: sockets.c
  ===================================================================
  RCS file: /home/cvs/apr/network_io/win32/sockets.c,v
  retrieving revision 1.46
  retrieving revision 1.47
  diff -u -r1.46 -r1.47
  --- sockets.c	2000/12/04 16:09:32	1.46
  +++ sockets.c	2000/12/14 18:42:38	1.47
  @@ -232,6 +232,15 @@
           return apr_get_netos_error();
       }
       *(*new)->local_addr = *sock->local_addr;
  +    /* fix up any pointers which are no longer valid */
  +    if (sock->local_addr->sa.sin.sin_family == AF_INET) {
  +        (*new)->local_addr->ipaddr_ptr = &(*new)->local_addr->sa.sin.sin_addr;
  +    }
  +#if APR_HAVE_IPV6
  +    else if (sock->local_addr->sa.sin.sin_family == AF_INET6) {
  +        (*new)->local_addr->ipaddr_ptr = &(*new)->local_addr->sa.sin6.sin6_addr;
  +    }
  +#endif
   
       if (sock->local_port_unknown) {
           /* not likely for a listening socket, but theoretically possible :) */
  
  
  

Mime
View raw message