diff --git a/SOURCES/telnet-log-address.patch b/SOURCES/telnet-log-address.patch new file mode 100644 index 0000000..ae8bd42 --- /dev/null +++ b/SOURCES/telnet-log-address.patch @@ -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); + diff --git a/SPECS/telnet.spec b/SPECS/telnet.spec index e26067f..7fce6e2 100644 --- a/SPECS/telnet.spec +++ b/SPECS/telnet.spec @@ -3,7 +3,7 @@ Summary: The client program for the Telnet remote login protocol Name: telnet Version: 0.17 -Release: 59%{?dist} +Release: 60%{?dist} Epoch: 1 License: BSD Group: Applications/Internet @@ -35,6 +35,7 @@ Patch23: telnet-rh678324.patch Patch24: telnet-rh674942.patch Patch25: telnet-rh704604.patch Patch26: telnet-rh825946.patch +Patch27: telnet-log-address.patch BuildRequires: ncurses-devel systemd @@ -84,6 +85,7 @@ mv telnet telnet-NETKIT %patch24 -p1 -b .rh674942 %patch25 -p1 -b .rh704604 %patch26 -p1 -b .rh825946 +%patch27 -p1 -b .rh1323094 %build %ifarch s390 s390x @@ -149,6 +151,11 @@ install -p -m644 %SOURCE6 ${RPM_BUILD_ROOT}%{_unitdir}/telnet.socket %{_mandir}/man8/telnetd.8* %changelog +* Fri Jul 01 2016 Martin Sehnoutka - 1:0.17-60 +- Introduce new -i switch +- ip addresses will be logged into utmp instead of hostname +- Resolves: #1323094 + * Fri Jan 24 2014 Daniel Mach - 1:0.17-59 - Mass rebuild 2014-01-24