File telnet.spec of Package telnet.26550

#
# spec file for package telnet
#
# Copyright (c) 2022 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via https://bugs.opensuse.org/
#


Name:           telnet
Version:        1.2
Release:        0
Summary:        A client program for the telnet remote login protocol
License:        BSD-3-Clause
Group:          Productivity/Networking/Other
URL:            http://svnweb.freebsd.org/base/head/contrib/telnet/
Source:         http://distfiles.gentoo.org/distfiles/f3/telnet-bsd-%{version}.tar.bz2
Source1:        telnet.xinetd
Source2:        telnet.firewall
Patch1:         telnet-bsd-1.2-suppress_hostname.patch
Patch2:         telnet-bsd-1.2-man-page.patch
Patch3:         telnet-bsd-1.2-no_gethostbyname.patch
#PATCH-FIX-UPSTREAM fix crash when using -b option bnc#700229
Patch4:         telnet-bsd-1.2-hostalias.patch
# PATCH-FIX-SECURITY bsc#1203759 danilo.spinella@suse.com CVE-2022-39028
# NULL pointer dereference in telnetd
Patch5:         CVE-2022-39028.patch
BuildRequires:  ncurses-devel
Requires:       netcfg
Provides:       nkitb:%{_bindir}/telnet
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

%description
Telnet is an old protocol for logging into remote systems.  It is
rarely used, since the transfer is not encrypted (ssh is mostly used
these days).  The telnet client is often used for debugging other
network services. The command

telnet localhost 25

connects to the local smtp server, for example.

%package server
Summary:        A Server Program for the Telnet Remote Login Protocol
Group:          Productivity/Networking/Other
Requires:       netcfg
Requires:       xinetd
Provides:       nkitserv:%{_sbindir}/in.telnetd
Obsoletes:      nkitserv

%description server
Telnet is a popular protocol for logging into remote systems. This
package provides the telnet daemon, which will allow remote logins into
this machine.

%prep
%setup -q -n telnet-bsd-%{version}
%patch1
%patch2
%patch3
%patch4 -p1
%patch5 -p1

%build
export CFLAGS="%{optflags} -fpie $(ncurses5-config --cflags)"
export LDFLAGS="-pie $(ncurses5-config --libs)"
%configure
make %{?_smp_mflags}

%install
export NO_BRP_STRIP_DEBUG=true
install -d -m 755 %{buildroot}%{_prefix}/bin
install -d -m 755 %{buildroot}%{_prefix}/sbin
install -d -m 755 %{buildroot}%{_sysconfdir}/xinetd.d
install -d -m 755 %{buildroot}%{_mandir}/man1
install -d -m 755 %{buildroot}%{_mandir}/man5
install -d -m 755 %{buildroot}%{_mandir}/man8
make DESTDIR=%{buildroot} install %{?_smp_mflags}
install -m 644 %{SOURCE1} %{buildroot}%{_sysconfdir}/xinetd.d/telnet
install -d %{buildroot}%{_sysconfdir}/sysconfig/SuSEfirewall2.d/services/
install -m 644 %{SOURCE2} %{buildroot}%{_sysconfdir}/sysconfig/SuSEfirewall2.d/services/%{name}-server

%files
%defattr(644,root,root,755)
%doc COPYING ChangeLog README NEWS
%attr(755,root,root) %{_bindir}/telnet
%doc %{_mandir}/man1/telnet.1.gz

%files server
%defattr(644,root,root,755)
%doc COPYING ChangeLog README NEWS
%doc %{_mandir}/man8/in.telnetd.8.gz
%doc %{_mandir}/man8/telnetd.8.gz
%doc %{_mandir}/man5/issue.net.5.gz
%config(noreplace) %{_sysconfdir}/xinetd.d/telnet
%attr(755,root,root) %{_sbindir}/in.telnetd
%config %{_sysconfdir}/sysconfig/SuSEfirewall2.d/services/%{name}-server

%changelog
openSUSE Build Service is sponsored by