summaryrefslogtreecommitdiffstats
path: root/libexec/rexecd
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/rexecd
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/rexecd')
-rw-r--r--libexec/rexecd/rexecd.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/libexec/rexecd/rexecd.c b/libexec/rexecd/rexecd.c
index ac7dca9..740368f 100644
--- a/libexec/rexecd/rexecd.c
+++ b/libexec/rexecd/rexecd.c
@@ -42,7 +42,7 @@ static const char copyright[] =
static char sccsid[] = "@(#)rexecd.c 8.1 (Berkeley) 6/4/93";
#endif
static const char rcsid[] =
- "$Id$";
+ "$Id: rexecd.c,v 1.15 1997/11/26 07:29:04 charnier Exp $";
#endif /* not lint */
#include <sys/param.h>
@@ -55,6 +55,7 @@ static const char rcsid[] =
#include <err.h>
#include <netdb.h>
+#include <libutil.h>
#include <paths.h>
#include <pwd.h>
#include <signal.h>
@@ -72,7 +73,7 @@ char path[sizeof(_PATH_DEFPATH) + sizeof("PATH=")] = "PATH=";
char *envinit[] =
{homedir, shell, path, username, 0};
char **environ;
-char *remote;
+char remote[MAXHOSTNAMELEN + 1];
struct sockaddr_in asin = { AF_INET };
@@ -103,10 +104,7 @@ main(argc, argv)
if (getpeername(0, (struct sockaddr *)&from, &fromlen) < 0)
err(1, "getpeername");
- hp = gethostbyaddr((char *) &from.sin_addr, sizeof(from.sin_addr),
- from.sin_family);
- remote = inet_ntoa(from.sin_addr);
- remote = (hp != NULL) ? hp->h_name : inet_ntoa(from.sin_addr);
+ realhostname(remote, sizeof remote - 1, &from.sin_addr);
doit(0, &from);
return(0);
OpenPOWER on IntegriCloud