Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 26 Jan 2001 12:33:03 -0800 (PST)
From:      Jim.Pirzyk@disney.com
To:        FreeBSD-gnats-submit@freebsd.org
Subject:   bin/24659: realhostname_sa does not call trimdomain before IP number is stored
Message-ID:  <200101262033.f0QKX3x09073@snoopy.fan.fa.disney.com>

next in thread | raw e-mail | index | archive | help


>Number:         24659
>Category:       bin
>Synopsis:       realhostname_sa does not call trimdomain for IPv4 addresses
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Fri Jan 26 12:40:01 PST 2001
>Closed-Date:
>Last-Modified:
>Originator:     Jim Pirzyk
>Release:        FreeBSD 4.2-RELEASE i386
>Organization:
>Environment:

	Using ssh to login to remote FreeBSD boxes and hostnames > 16 characters
	in the local domain.

>Description:

	in the realhostname_sa routine (libutil), if the hostname of the remote
	system is > 16 characters long, the IP number is stored in the wtmp
	file.  This happens even for hosts that are in the same DNS Domain.
	Conversely, in the login program, which does not call realhostname_sa,
	it trims the hostname before writing the hostname into the file.
	realhostname_sa is called by sshd. 

>How-To-Repeat:

	Login to a remote FreeBSD host from a host that has a long hostname.
	First login with rsh, then do a finger -sh, it should show a short
	hostname for 'Where'.  Then login via ssh, do the finger -sh and it
	will show the IP number instead.

>Fix:

*** realhostname.c.orig Tue Jul 18 03:25:37 2000
--- realhostname.c      Fri Jan 26 12:23:46 2001
***************
*** 131,150 ****
                                                freeaddrinfo(ores);
                                                goto numeric;
                                        }
!                                       if (strlen(ores->ai_canonname) > hsize) {
                                                if (addr->sa_family == AF_INET) {
                                                        freeaddrinfo(ores);
                                                        goto numeric;
                                                }
!                                               strncpy(buf,
!                                                       ores->ai_canonname,
!                                                       sizeof(buf));
!                                               trimdomain(buf, hsize);
!                                               strncpy(host, buf, hsize);
!                                       } else
!                                               strncpy(host,
!                                                       ores->ai_canonname,
!                                                       hsize);
                                        break;
                                }
                                ((struct sockinet *)addr)->si_port = port;
--- 134,150 ----
                                                freeaddrinfo(ores);
                                                goto numeric;
                                        }
!                                       strncpy(buf,
!                                               ores->ai_canonname,
!                                               sizeof(buf));
!                                       trimdomain(buf, hsize);
!                                       strncpy(host, buf, hsize);
!                                       if (strlen(host) > hsize) {
                                                if (addr->sa_family == AF_INET) {
                                                        freeaddrinfo(ores);
                                                        goto numeric;
                                                }
!                                       }
                                        break;
                                }
                                ((struct sockinet *)addr)->si_port = port;



>Release-Note:
>Audit-Trail:
>Unformatted:


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200101262033.f0QKX3x09073>