History log of /freebsd-9.3-release/lib/libutil/realhostname.c
Revision Date Author Comments
(<<< Hide modified files)
(Show modified files >>>)
# 267654 19-Jun-2014 gjb

Copy stable/9 to releng/9.3 as part of the 9.3-RELEASE cycle.

Approved by: re (implicit)
Sponsored by: The FreeBSD Foundation

# 225736 22-Sep-2011 kensmith

Copy head to stable/9 as part of 9.0-RELEASE release cycle.

Approved by: re (implicit)


# 185277 25-Nov-2008 avatar

Fixing !INET6 builds.


# 184683 05-Nov-2008 des

Like many other functions that handle sockaddrs, realhostname_sa() takes a
struct sockaddr * that it casts internally to the appropriate type based on
sa_family. However, struct sockaddr has very lax alignment requirements,
which causes the compiler to complain when you cast a struct sockaddr * to,
say, a struct sockaddr_in6 *.

I find it reasonable to assume that the pointer we received is in fact
correctly aligned. Therefore, we can work around the compiler warnings by
casting to void * before casting to the desired type. For readability's
sake, this is done with macros.

The same technique should prove useful in other parts of the tree that
deal with socket addresses.

MFC after: 3 weeks


# 183989 17-Oct-2008 delphij

Use strlcpy() when we mean it.


# 146187 13-May-2005 ume

NI_WITHSCOPEID cleanup. Neither RFC 2553 nor RFC 3493 defines
NI_WITHSCOPEID, and our getaddrinfo(3) does nothing special
for it, now.


# 121193 18-Oct-2003 markm

ANSIfy, WARNSify, CONSTify. Bit of style(9)-ify.


# 116344 14-Jun-2003 markm

Tidy up. Sort headers.


# 98021 07-Jun-2002 ume

Return HOSTNAME_INVALIDADDR when reverse lookup is fail.

Submitted by: Sergey Zorin <sergey@cc.tpu.edu.ru>


# 84225 30-Sep-2001 dillon

Add __FBSDID()s to libutil


# 80223 23-Jul-2001 ume

Simplify IPv4 mapped IPv6 address handling.

Reviewed by: brian
MFC after: 5 days


# 80056 20-Jul-2001 brian

Hint getaddrinfo() correctly if we're looking up a name that we got from
an AF_INET6 address.

MFC after: 1 week


# 74260 14-Mar-2001 brian

MAXHOSTNAMELEN includes space for the NUL
Don't read past the end of the host passed to realhostname()

Not objected to by: freebsd-audit
Interface disliked by: imp


# 71753 28-Jan-2001 brian

Call trimdomain properly for ip4 addresses.

PR: 24659
realhostname_sa() stuff submitted by: Jim.Pirzyk@disney.com


# 63164 14-Jul-2000 ume

Sshd writes connected host into utmp directly. If the connection is
via IPv6, the hostname is trimed due to the length of IPv6 address.
This change saves it as possible.
I have a grudge against the shortage of UT_HOSTSIZE.


# 60870 24-May-2000 ume

We should see the ai_canonname menber of the first addrinfo
structure in the linked list. RFC2553 mentions only first.

Reviewed by: shin


# 58495 23-Mar-2000 ume

Return IPv4 native address for IPv4 mapped IPv6 address, even if
A RR is not found.

Reviewed by: shin


# 57789 07-Mar-2000 ume

Since crypto/openssh/login.c was changed to use realhostname_sa(),
when connecting via IPv6, hostname was not recorded to utmp anymore.
Because, if hostname is longer than buffer size, getnameinfo() returns
with ENI_MEMORY.

Reviewed by: shin
Approved by: jkh


# 56682 27-Jan-2000 shin

Avoid core dump when ai_canonname is NULL.
(Now this happens for numeric addrs, as getaddrinfo() 1.3 -> 1.4 change)

Reviewed by: Mark Huizer <xaa@timewasters.nl>


# 56590 25-Jan-2000 shin

several tcp apps IPv6 update
-inetd
-rshd
-rlogind
-telnetd
-rsh
-rlogin

Reviewed by: freebsd-arch, cvs-committers
Obtained from: KAME project


# 50476 27-Aug-1999 peter

$Id$ -> $FreeBSD$


# 45420 07-Apr-1999 brian

Put parenthesis around sizeof args.
Allow for host names up to MAXHOSTNAMELEN - 1 in length.

Prompted by: bde


# 45392 06-Apr-1999 brian

Add realhostname() - a function to correctly lookup
a name by address and ensure that the name resolves
back to the original address.