diff options
author | brian <brian@FreeBSD.org> | 1999-04-06 23:06:00 +0000 |
---|---|---|
committer | brian <brian@FreeBSD.org> | 1999-04-06 23:06:00 +0000 |
commit | a77173a7cd162a0aa47a96361a70cd43d178b4f6 (patch) | |
tree | 745fbd61bf8b21361a25b2cd0184e45153a0211c /libexec/ftpd | |
parent | cf0ba219f719b19bf1fc5862d698b2713d849705 (diff) | |
download | FreeBSD-src-a77173a7cd162a0aa47a96361a70cd43d178b4f6.zip FreeBSD-src-a77173a7cd162a0aa47a96361a70cd43d178b4f6.tar.gz |
Use realhostname() rather than various combinations of
gethostbyaddr() & gethostbyname().
Remove brokeness in ftpd for hosts of MAXHOSTNAMELEN length.
Diffstat (limited to 'libexec/ftpd')
-rw-r--r-- | libexec/ftpd/ftpd.c | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/libexec/ftpd/ftpd.c b/libexec/ftpd/ftpd.c index e844fe9..3012fab 100644 --- a/libexec/ftpd/ftpd.c +++ b/libexec/ftpd/ftpd.c @@ -44,7 +44,7 @@ static char copyright[] = static char sccsid[] = "@(#)ftpd.c 8.4 (Berkeley) 4/16/94"; #endif static const char rcsid[] = - "$Id: ftpd.c,v 1.51 1998/06/03 11:33:44 jb Exp $"; + "$Id: ftpd.c,v 1.52 1998/10/13 20:42:01 des Exp $"; #endif /* not lint */ /* @@ -166,7 +166,7 @@ static struct ftphost { } *thishost, *firsthost; #endif -char remotehost[MAXHOSTNAMELEN]; +char remotehost[MAXHOSTNAMELEN + 1]; char *ident = NULL; static char ttyline[20]; @@ -1896,14 +1896,8 @@ static void dolog(sin) struct sockaddr_in *sin; { - struct hostent *hp = gethostbyaddr((char *)&sin->sin_addr, - sizeof(struct in_addr), AF_INET); + realhostname(remotehost, sizeof remotehost - 1, &sin->sin_addr); - if (hp) - (void) strncpy(remotehost, hp->h_name, sizeof(remotehost)); - else - (void) strncpy(remotehost, inet_ntoa(sin->sin_addr), - sizeof(remotehost)); #ifdef SETPROCTITLE #ifdef VIRTUAL_HOSTING if (thishost != firsthost) |