Package: hotway
Version: 1:0.8.2-1
Severity: important
Tags: patch


-- System Information:
Debian Release: 3.1
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: i386 (i686)
Kernel: Linux 2.6.10
Locale: LANG=C, LC_CTYPE=C (charmap=ANSI_X3.4-1968)

Versions of packages hotway depends on:
ii  libc6                       2.3.2.ds1-20 GNU C Library: Shared libraries an
ii  libxml2                     2.6.16-2     GNOME XML library
ii  netbase                     4.20         Basic TCP/IP networking system
ii  zlib1g                      1:1.2.2-4    compression library - runtime

-- no debconf information

When run on a machine with an IPV6 enabled kernel, hotwayd
crashes. The following patch corrects the problem. It will apply
cleanly to both 0.8 and the newer 0.8.2 upstream version, as there are
no changes in the affected file between the 2 versions.

Thanks,
-Larry
*** inet.c.orig	Mon Apr 21 04:42:38 2003
--- inet.c	Mon Feb  7 02:16:36 2005
***************
*** 37,43 ****
  char inet_server_addr[N_BUFLEN] = "0.0.0.0";
  
  void inet_init(void) {
! 	struct sockaddr_in sock;
  	int	slen = sizeof(struct sockaddr);	
  
  	/* get hostname of this machine as servername */
--- 37,43 ----
  char inet_server_addr[N_BUFLEN] = "0.0.0.0";
  
  void inet_init(void) {
! 	struct sockaddr_storage sock;
  	int	slen = sizeof(struct sockaddr);	
  
  	/* get hostname of this machine as servername */
***************
*** 47,72 ****
  	/* get ip addr of server (inet_server_addr) */
  	if (getsockname(0, (struct sockaddr *) &sock, &slen) == 0) {
  
! 		strncpy(inet_server_addr, inet_ntoa(sock.sin_addr), N_BUFLEN - 1);
  		inet_server_addr[N_BUFLEN - 1] = '\0';
  		
  #ifdef USE_DNS
  	  {
! 		struct hostent *hostent;
! 		/* get reverse of the port the client connected to (inet_server_name) */
! 		hostent = gethostbyaddr((char *)&sock.sin_addr, sizeof (sock.sin_addr), AF_INET);
! 	    if (hostent != NULL) {
! 			strncpy(inet_server_name, hostent->h_name, N_BUFLEN - 1);
! 			inet_server_name[N_BUFLEN - 1] = '\0';
! 		}
  	  }
  #endif
  	}	
  
  	/* get addr of client (we're not doing reverses) - inet_client_name */
  	if (getpeername(0, (struct sockaddr *) &sock, &slen) == 0) {
  
- 		strncpy(inet_client_name, inet_ntoa(sock.sin_addr), N_BUFLEN - 1);
  		inet_client_name[N_BUFLEN - 1] = '\0';
  	}
  			
--- 47,79 ----
  	/* get ip addr of server (inet_server_addr) */
  	if (getsockname(0, (struct sockaddr *) &sock, &slen) == 0) {
  
! 		getnameinfo((struct sockaddr *)&sock,
! 			    sizeof(struct sockaddr_storage),
! 			    inet_server_addr, N_BUFLEN-1,
! 			    NULL, 0,
! 			    NI_NUMERICHOST);
  		inet_server_addr[N_BUFLEN - 1] = '\0';
  		
  #ifdef USE_DNS
  	  {
! 		getnameinfo((struct sockaddr *)&sock,
! 			    sizeof(struct sockaddr_storage),
! 			    inet_server_name, N_BUFLEN-1,
! 			    NULL, 0,
! 			    0);
! 		inet_server_name[N_BUFLEN - 1] = '\0';
  	  }
  #endif
  	}	
  
  	/* get addr of client (we're not doing reverses) - inet_client_name */
  	if (getpeername(0, (struct sockaddr *) &sock, &slen) == 0) {
+ 		getnameinfo((struct sockaddr *)&sock,
+ 			    sizeof(struct sockaddr_storage),
+ 			    inet_client_name, N_BUFLEN-1,
+ 			    NULL, 0,
+ 			    NI_NUMERICHOST);
  
  		inet_client_name[N_BUFLEN - 1] = '\0';
  	}
  			

Reply via email to