Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 8 May 2001 22:24:41 -0400
From:      "R.D. Lacoste" <super@purpledreams.com>
To:        <stable@freebsd.org>
Subject:   invalid hostname
Message-ID:  <003301c0d82f$34593d20$0d0c0b0a@purpledreams.com>

next in thread | raw e-mail | index | archive | help
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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?003301c0d82f$34593d20$0d0c0b0a>