summaryrefslogtreecommitdiffstats
path: root/libexec/uucpd/uucpd.c
diff options
context:
space:
mode:
authorbrian <brian@FreeBSD.org>1999-04-06 23:06:00 +0000
committerbrian <brian@FreeBSD.org>1999-04-06 23:06:00 +0000
commita77173a7cd162a0aa47a96361a70cd43d178b4f6 (patch)
tree745fbd61bf8b21361a25b2cd0184e45153a0211c /libexec/uucpd/uucpd.c
parentcf0ba219f719b19bf1fc5862d698b2713d849705 (diff)
downloadFreeBSD-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/uucpd/uucpd.c')
-rw-r--r--libexec/uucpd/uucpd.c24
1 files changed, 5 insertions, 19 deletions
diff --git a/libexec/uucpd/uucpd.c b/libexec/uucpd/uucpd.c
index 59a6932..e15c05b 100644
--- a/libexec/uucpd/uucpd.c
+++ b/libexec/uucpd/uucpd.c
@@ -45,7 +45,7 @@ static const char copyright[] =
static char sccsid[] = "@(#)uucpd.c 8.1 (Berkeley) 6/4/93";
#endif
static const char rcsid[] =
- "$Id: uucpd.c,v 1.15 1998/06/30 15:19:51 bde Exp $";
+ "$Id: uucpd.c,v 1.16 1999/03/30 10:23:35 joerg Exp $";
#endif /* not lint */
/*
@@ -121,16 +121,8 @@ void main(int argc, char **argv)
void badlogin(char *name, struct sockaddr_in *sin)
{
char remotehost[MAXHOSTNAMELEN];
- struct hostent *hp = gethostbyaddr((char *)&sin->sin_addr,
- sizeof (struct in_addr), AF_INET);
-
- if (hp) {
- strncpy(remotehost, hp->h_name, sizeof (remotehost));
- endhostent();
- } else
- strncpy(remotehost, inet_ntoa(sin->sin_addr),
- sizeof (remotehost));
+ realhostname(remotehost, sizeof remotehost - 1, &sin->sin_addr);
remotehost[sizeof remotehost - 1] = '\0';
syslog(LOG_NOTICE, "LOGIN FAILURE FROM %s", remotehost);
@@ -251,19 +243,13 @@ void dologout(void)
void dologin(struct passwd *pw, struct sockaddr_in *sin)
{
char line[32];
- char remotehost[MAXHOSTNAMELEN];
+ char remotehost[UT_HOSTSIZE + 1];
int f;
time_t cur_time;
- struct hostent *hp = gethostbyaddr((char *)&sin->sin_addr,
- sizeof (struct in_addr), AF_INET);
- if (hp) {
- strncpy(remotehost, hp->h_name, sizeof (remotehost));
- endhostent();
- } else
- strncpy(remotehost, inet_ntoa(sin->sin_addr),
- sizeof (remotehost));
+ realhostname(remotehost, sizeof remotehost - 1, &sin->sin_addr);
remotehost[sizeof remotehost - 1] = '\0';
+
/* hack, but must be unique and no tty line */
sprintf(line, "uucp%ld", (long)getpid());
time(&cur_time);
OpenPOWER on IntegriCloud