Blob Blame History Raw
diff -up netkit-rsh-0.17/rshd/rshd.8.nodns netkit-rsh-0.17/rshd/rshd.8
--- netkit-rsh-0.17/rshd/rshd.8.nodns	2000-07-31 01:57:04.000000000 +0200
+++ netkit-rsh-0.17/rshd/rshd.8	2007-07-26 13:45:04.000000000 +0200
@@ -40,7 +40,7 @@
 .Nd remote shell server
 .Sh SYNOPSIS
 .Nm rshd
-.Op Fl ahlnL
+.Op Fl aDhlnL
 .Sh DESCRIPTION
 The
 .Nm rshd
diff -up netkit-rsh-0.17/rshd/rshd.c.nodns netkit-rsh-0.17/rshd/rshd.c
--- netkit-rsh-0.17/rshd/rshd.c.nodns	2007-07-26 13:45:04.000000000 +0200
+++ netkit-rsh-0.17/rshd/rshd.c	2007-07-26 13:49:37.000000000 +0200
@@ -295,6 +295,7 @@ static const char *findhostname(struct s
 	char remote_hostname[NI_MAXHOST];
 	struct addrinfo hints;
 	struct addrinfo *res0, *res;
+	int flags = no_host_check ? NI_NUMERICHOST : 0;
 
 	if (! inet_ntop(fromp->sa_family,
 		(( fromp->sa_family == AF_INET6 )
@@ -307,7 +308,7 @@ static const char *findhostname(struct s
 	}
 
 	if (getnameinfo(fromp, fromlen, remote_hostname, NI_MAXHOST,
-		NULL, 0, 0)) {
+		NULL, 0, flags)) {
 	    syslog(LOG_NOTICE|LOG_AUTH,
 	    	"Failed to retrieve the hostname information for %s",
 	    	remote_address);
@@ -565,6 +566,7 @@ static void network_init(int fd,
 	int error;
 	int on=1;
 	int port;
+	int flags = no_host_check ? NI_NUMERICSERV|NI_NUMERICHOST : NI_NUMERICSERV;
 
 	if (getpeername(fd, (struct sockaddr *)fromp, fromlenp) < 0) {
 		syslog(LOG_ERR, "getpeername: %m");
@@ -589,7 +591,7 @@ static void network_init(int fd,
 
 	error = getnameinfo((struct sockaddr *)fromp, *fromlenp,
 		hostname, sizeof(hostname), portname, sizeof(portname),
-		NI_NUMERICSERV);
+		flags);
 	if (error) {
 	    syslog(LOG_NOTICE|LOG_AUTH,
 	    	"Failed to retrieve address and port of the connection: %s",
diff -up netkit-rsh-0.17/rlogind/rlogind.8.nodns netkit-rsh-0.17/rlogind/rlogind.8
--- netkit-rsh-0.17/rlogind/rlogind.8.nodns	2000-07-31 01:57:04.000000000 +0200
+++ netkit-rsh-0.17/rlogind/rlogind.8	2007-07-26 13:45:04.000000000 +0200
@@ -53,6 +53,8 @@ Options supported by
 .Bl -tag -width Ds
 .It Fl a
 Ask hostname for verification.
+.It Fl D
+Disable reverse client checking. Security is lower
 .It Fl h
 Permit use of superuser 
 .Dq Pa .rhosts
diff -up netkit-rsh-0.17/rlogind/network.c.nodns netkit-rsh-0.17/rlogind/network.c
--- netkit-rsh-0.17/rlogind/network.c.nodns	2007-07-26 13:45:04.000000000 +0200
+++ netkit-rsh-0.17/rlogind/network.c	2007-07-26 13:45:04.000000000 +0200
@@ -127,6 +127,12 @@ find_hostname(struct sockaddr *fromp, so
 	error = getnameinfo(fromp, fromlen,
 		hname_buf, sizeof(hname_buf), portname, NI_MAXSERV,
 		NI_NUMERICSERV);
+	if((error == EAI_AGAIN) && no_host_check)
+	{
+		error = getnameinfo(fromp, fromlen,
+                hname_buf, sizeof(hname_buf), portname, NI_MAXSERV,
+                NI_NUMERICSERV | NI_NUMERICHOST);
+	}
 	assert(error == 0);
 
 	if ((check_all || local_domain(hname_buf)) && !no_host_check ) {