bin/53560: logging domain names in wtmp is retarded

Matthew George mdg at secureworks.net
Thu Jul 3 15:00:37 PDT 2003


The following reply was made to PR bin/53560; it has been noted by GNATS.

From: Matthew George <mdg at secureworks.net>
To: freebsd-gnats-submit at freebsd.org, muir at idiom.com
Cc:  
Subject: Re: bin/53560: logging domain names in wtmp is retarded
Date: Thu, 3 Jul 2003 17:52:14 -0400 (EDT)

 This patch will attempt to translate hostnames to IP addresses if they
 aren't going to end up fitting inside of the ll.ll_host buffer.  It
 doesn't do anything to hostnames shorter than the buffer.
 
 ===================================================================
 RCS file: /home/ncvs/src/lib/libpam/modules/pam_lastlog/pam_lastlog.c,v
 retrieving revision 1.18
 diff -r1.18 pam_lastlog.c
 59a60
 > #include <netdb.h>
 66a68,69
 > #include <arpa/inet.h>
 >
 73a77
 >       struct addrinfo *ai;
 75a80
 >       char numeric_rhost[16];
 133,134c138,149
 <               /* note: does not need to be NUL-terminated */
 <               strncpy(ll.ll_host, rhost, sizeof(ll.ll_host));
 ---
 >         {
 >           if (strlen(rhost) >= UT_HOSTSIZE && getaddrinfo(rhost, NULL, NULL, &ai) == 0)
 >             {
 >               addr2ascii(ai->ai_family, ai->ai_addr, sizeof(struct in_addr), numeric_rhost);
 >               rhost = numeric_rhost;
 >               freeaddrinfo(ai);
 >             }
 >
 >           /* note: does not need to be NUL-terminated */
 >           strncpy(ll.ll_host, rhost, sizeof(ll.ll_host));
 >         }
 >
 
 -- 
 Matthew George
 SecureWorks Technical Operations
 


More information about the freebsd-bugs mailing list