From owner-freebsd-bugs@FreeBSD.ORG Thu Jul 3 15:40:21 2003 Return-Path: Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 476CD37B401 for ; Thu, 3 Jul 2003 15:40:21 -0700 (PDT) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id DD48C4402D for ; Thu, 3 Jul 2003 15:40:20 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.12.9/8.12.9) with ESMTP id h63MeKUp011752 for ; Thu, 3 Jul 2003 15:40:20 -0700 (PDT) (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.12.9/8.12.9/Submit) id h63MeKPe011751; Thu, 3 Jul 2003 15:40:20 -0700 (PDT) Date: Thu, 3 Jul 2003 15:40:20 -0700 (PDT) Message-Id: <200307032240.h63MeKPe011751@freefall.freebsd.org> To: freebsd-bugs@FreeBSD.org From: Matthew George Subject: Re: bin/53560: logging domain names in wtmp is retarded X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: Matthew George List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Jul 2003 22:40:21 -0000 The following reply was made to PR bin/53560; it has been noted by GNATS. From: Matthew George To: freebsd-gnats-submit@freebsd.org, muir@idiom.com Cc: Subject: Re: bin/53560: logging domain names in wtmp is retarded Date: Thu, 3 Jul 2003 18:37:54 -0400 (EDT) My apologies, the last patch I sent was slightly braindead, as I was only considering the IPv4 case. This patch should be used instead, as it will deal with any address family. If the resolved address is longer than 16 bytes, it will still be truncated by lastlog/utmp, but any IPv4 address should fit. Perhaps someone should consider raising UT_HOSTSIZE in utmp.h to handle this? IPv6 is already one of these cases, others I'm sure. =================================================================== 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 66a68,69 > #include > 73a77 > struct addrinfo *ai; 75a80 > char *numeric_rhost; 133,134c138,151 < /* 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) > { > numeric_rhost = addr2ascii(ai->ai_family, ai->ai_addr, ai->ai_addrlen, NULL); > if (numeric_rhost != NULL) > 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