Adding -i option for disabling reverse DNS lookup
This commit is contained in:
parent
a88283db8c
commit
7e39d44649
|
@ -0,0 +1,75 @@
|
|||
diff --git a/telnetd/telnetd.8 b/telnetd/telnetd.8
|
||||
index 02b48c7..c72ab76 100644
|
||||
--- a/telnetd/telnetd.8
|
||||
+++ b/telnetd/telnetd.8
|
||||
@@ -42,7 +42,7 @@
|
||||
protocol server
|
||||
.Sh SYNOPSIS
|
||||
.Nm /usr/sbin/in.telnetd
|
||||
-.Op Fl hnNs
|
||||
+.Op Fl ihnNs
|
||||
.Op Fl a Ar authmode
|
||||
.Op Fl D Ar debugmode
|
||||
.Op Fl L Ar loginprg
|
||||
@@ -158,6 +158,10 @@ option may be used to enable encryption debugging code.
|
||||
.It Fl h
|
||||
Disables the printing of host-specific information before
|
||||
login has been completed.
|
||||
+.It Fl i
|
||||
+Disable reverse DNS lookups and use the numeric IP address in logs
|
||||
+and REMOTEHOST environment variable. (-i switch corresponds to
|
||||
+utilities like last)
|
||||
.It Fl L Ar loginprg
|
||||
This option may be used to specify a different login program.
|
||||
By default,
|
||||
diff --git a/telnetd/telnetd.c b/telnetd/telnetd.c
|
||||
index a4988a9..2ac8bc1 100644
|
||||
--- a/telnetd/telnetd.c
|
||||
+++ b/telnetd/telnetd.c
|
||||
@@ -84,6 +84,7 @@ int hostinfo = 1; /* do we print login banner? */
|
||||
int debug = 0;
|
||||
int debugsix = 0;
|
||||
int keepalive = 1;
|
||||
+int numeric_hosts = 0;
|
||||
char *loginprg = _PATH_LOGIN;
|
||||
char *progname;
|
||||
int lookupself = 1;
|
||||
@@ -113,7 +114,7 @@ main(int argc, char *argv[], char *env[])
|
||||
|
||||
progname = *argv;
|
||||
|
||||
- while ((ch = getopt(argc, argv, "d:a:e:lhnr:I:D:B:sS:a:X:L:N")) != EOF) {
|
||||
+ while ((ch = getopt(argc, argv, "d:a:e:ilhnr:I:D:B:sS:a:X:L:N")) != EOF) {
|
||||
switch(ch) {
|
||||
|
||||
#ifdef AUTHENTICATE
|
||||
@@ -196,6 +197,14 @@ main(int argc, char *argv[], char *env[])
|
||||
break;
|
||||
#endif /* AUTHENTICATE */
|
||||
|
||||
+ /*
|
||||
+ * Use ip address instead of hostname when
|
||||
+ * calling login process.
|
||||
+ */
|
||||
+ case 'i':
|
||||
+ numeric_hosts = 1;
|
||||
+ break;
|
||||
+
|
||||
case 'h':
|
||||
hostinfo = 0;
|
||||
break;
|
||||
@@ -663,10 +672,12 @@ doit(struct sockaddr *who, socklen_t wholen)
|
||||
int error = -1;
|
||||
char namebuf[255];
|
||||
|
||||
- error = getnameinfo(who, wholen, namebuf, sizeof(namebuf), NULL, 0, 0);
|
||||
+ /* if we don't want hostname '-i', skip this call to getnameinfo */
|
||||
+ if (numeric_hosts == 0)
|
||||
+ error = getnameinfo(who, wholen, namebuf, sizeof(namebuf), NULL, 0, 0);
|
||||
|
||||
/* if we can't get a hostname now, settle for an address */
|
||||
- if(error == EAI_AGAIN)
|
||||
+ if(error == EAI_AGAIN || numeric_hosts != 0)
|
||||
error = getnameinfo(who, wholen, namebuf, sizeof(namebuf),
|
||||
NULL, 0, NI_NUMERICHOST);
|
||||
|
|
@ -3,7 +3,7 @@
|
|||
Summary: The client program for the Telnet remote login protocol
|
||||
Name: telnet
|
||||
Version: 0.17
|
||||
Release: 74%{?dist}
|
||||
Release: 75%{?dist}
|
||||
Epoch: 1
|
||||
License: BSD
|
||||
Group: Applications/Internet
|
||||
|
@ -40,6 +40,7 @@ Patch28: netkit-telnet-0.17-core-dump.patch
|
|||
Patch29: netkit-telnet-0.17-gcc7.patch
|
||||
Patch30: netkit-telnet-0.17-manpage.patch
|
||||
Patch31: netkit-telnet-0.17-telnetrc.patch
|
||||
Patch32: telnet-log-address.patch
|
||||
|
||||
BuildRequires: ncurses-devel systemd gcc gcc-c++
|
||||
BuildRequires: perl-interpreter
|
||||
|
@ -95,6 +96,7 @@ mv telnet telnet-NETKIT
|
|||
%patch29 -p1 -b .gcc7
|
||||
%patch30 -p1 -b .manpage
|
||||
%patch31 -p1 -b .telnetrc
|
||||
%patch32 -p1 -b .log-address
|
||||
|
||||
%build
|
||||
%ifarch s390 s390x
|
||||
|
@ -159,6 +161,9 @@ install -p -m644 %SOURCE6 ${RPM_BUILD_ROOT}%{_unitdir}/telnet.socket
|
|||
%{_mandir}/man8/telnetd.8*
|
||||
|
||||
%changelog
|
||||
* Wed Oct 10 2018 Michal Ruprich <mruprich@redhat.com> - 1:0.17-75
|
||||
- Adding -i option for disabling reverse DNS lookup
|
||||
|
||||
* Mon Jul 23 2018 Michal Ruprich <mruprich@redhat.com> - 1:0.17-74
|
||||
- Resolves: #1606506 - telnet: FTBFS in Fedora rawhide
|
||||
- Resolves: #1505954 - telnet failing to parse .telnetrc due to strncpy used on overlaping buffers
|
||||
|
|
Loading…
Reference in New Issue