From owner-freebsd-stable Tue May 8 19:21:50 2001 Delivered-To: freebsd-stable@freebsd.org Received: from purpledreams.com (purpledreams.com [64.26.155.251]) by hub.freebsd.org (Postfix) with SMTP id 6118A37B422 for ; Tue, 8 May 2001 19:21:46 -0700 (PDT) (envelope-from super@purpledreams.com) Received: (qmail 35569 invoked by uid 7770); 9 May 2001 02:22:02 -0000 Received: from win98.purpledreams.com (HELO purple) (10.11.12.13) by purpledreams.com with SMTP; 9 May 2001 02:22:02 -0000 Message-ID: <003301c0d82f$34593d20$0d0c0b0a@purpledreams.com> From: "R.D. Lacoste" To: Subject: invalid hostname Date: Tue, 8 May 2001 22:24:41 -0400 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 5.50.4522.1200 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4522.1200 Sender: owner-freebsd-stable@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG ok, this has got me confused : # finger user Login: user Name: user Directory: /home/user Shell: /bin/tcsh Last login Tue May 8 12:17 (EDT) on ttyp0 from invalid hostname No Mail. what the hell is "invalid hostname"? so I checked the source code : (from lib/libutil/logwtmp.c. similar code is in login.c :) if (strlen(host) > UT_HOSTSIZE) { int error; struct addrinfo hints, *res; bzero(&hints, sizeof(struct addrinfo)); hints.ai_family = AF_UNSPEC; hints.ai_flags = AI_CANONNAME; error = getaddrinfo(host, NULL, &hints, &res); if (error != 0 || res->ai_addr == NULL) host = "invalid hostname"; else { error = getnameinfo(res->ai_addr, res->ai_addrlen, fullhost, strlen(fullhost), NULL, 0, NI_NUMERICHOST|NI_WITHSCOPEID); if (error != 0) { fprintf(stderr, "%d", error); host = "invalid hostname"; } } } So, if I understand this correctly, the utmp updater gets passed only the hostname, not the IP. And if the hostname is too long, it does a forward-lookup to identify the IP from the hostname. So the only way this would result in "invalid hostname" in my utmp file is if it couldn't complete the reverse lookup. after more looking around, i found the real IP, which exists both in the real world and in reverse-DNS world : # nslookup 47.129.153.69 Server: localhost Address: 127.0.0.1 Name: h69s153a129n47.user.nortelnetworks.com Address: 47.129.153.69 # nslookup h69s153a129n47.user.nortelnetworks.com Server: localhost.purpledreams.com Address: 127.0.0.1 Name: h69s153a129n47.user.nortelnetworks.com Address: 47.129.153.69 so why does it show "invalid hostname"?????? (yeah, i'm kinda going batty on this one :) it's not cuz the hostname's too long (fullhost has maxlength MAXHOSTNAMELEN which is 256 from sys/sys/param.h) so what is it???? Dana Lacoste super@purpledreams.com To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-stable" in the body of the message