Summary:     Clients for remote access commands (rsh, rlogin, rcp).
Summary(ja): リモートアクセスコマンド (rsh, rlogin, rcp) のクライアント
Name: rsh
Version: 0.17
Release: 36%{?_dist_release}

License: BSD
Group: Applications/Internet
URL: ftp://ftp.uk.linux.org/pub/linux/Networking/netkit

Source: ftp://ftp.uk.linux.org/pub/linux/Networking/netkit/netkit-rsh-%{version}.tar.gz
Source1: rexec.pam
Source2: rlogin.pam
Source3: rsh.pam
Source4: http://www.tc.cornell.edu/~sadd/rexec-1.5.tar.gz
Source5: rsh-xinetd
Source6: rlogin-xinetd
Source7: rexec-xinetd

Patch1: netkit-rsh-0.17-sectty.patch
# Make rexec installation process working
Patch2: netkit-rsh-0.17-rexec.patch
Patch3: netkit-rsh-0.10-stdarg.patch
# Improve installation process
Patch4: netkit-rsh-0.16-jbj.patch
# Link rshd against libpam
Patch8: netkit-rsh-0.16-jbj4.patch
Patch9: netkit-rsh-0.16-prompt.patch
Patch10: netkit-rsh-0.16-rlogin=rsh.patch
# Improve documentation
Patch11: netkit-rsh-0.16-nokrb.patch
# Remove spurious double-reporting of errors
Patch12: netkit-rsh-0.17-pre20000412-jbj5.patch
# RH #42880
Patch13: netkit-rsh-0.17-userandhost.patch
# Don't strip binaries during installation
Patch14: netkit-rsh-0.17-strip.patch
# RH #67362
Patch15: netkit-rsh-0.17-lfs.patch
# RH #57392
Patch16: netkit-rsh-0.17-chdir.patch
# RH #63806
Patch17: netkit-rsh-0.17-pam-nologin.patch
# RH #135643
Patch19: netkit-rsh-0.17-rexec-netrc.patch
# RH #68590
Patch20: netkit-rsh-0.17-pam-sess.patch
# RH #67361
Patch21: netkit-rsh-0.17-errno.patch
# RH #118630
Patch22: netkit-rsh-0.17-rexec-sig.patch
# RH #135827
Patch23: netkit-rsh-0.17-nohost.patch
# RH #122315
Patch24: netkit-rsh-0.17-ignchld.patch
# RH #146464
Patch25: netkit-rsh-0.17-checkdir.patch
Patch26: netkit-rsh-0.17-pam-conv.patch
# RH #174045
Patch27: netkit-rsh-0.17-rcp-largefile.patch
# RH #174146
Patch28: netkit-rsh-0.17-pam-rhost.patch
# RH #178916
Patch29: netkit-rsh-0.17-rlogin-linefeed.patch
Patch30: netkit-rsh-0.17-ipv6.patch
Patch31: netkit-rsh-0.17-pam_env.patch
Patch33: netkit-rsh-0.17-dns.patch
Patch34: netkit-rsh-0.17-nohostcheck-compat.patch
# RH #448904
Patch35: netkit-rsh-0.17-audit.patch
Patch36: netkit-rsh-0.17-longname.patch
# RH #440867
Patch37: netkit-rsh-0.17-arg_max.patch
Patch38: netkit-rsh-0.17-rh448904.patch
Patch39: netkit-rsh-0.17-rh461903.patch
Patch40: netkit-rsh-0.17-rh473492.patch
Patch41: netkit-rsh-0.17-rh650119.patch

BuildRoot: %{_tmppath}/%{name}-%{version}-root
BuildRequires: perl
BuildRequires: ncurses-devel
BuildRequires: pam-devel
BuildRequires: audit-libs-devel
#BuildRequires: libtermcap-devel

%description
The rsh package contains a set of programs which allow users to run
commmands on remote machines, login to other machines and copy files
between machines (rsh, rlogin and rcp).  All three of these commands
use rhosts style authentication.  This package contains the clients
needed for all of these services.
The rsh package should be installed to enable remote access to other
machines.

%description -l ja
rsh パッケージにはリモートマシン上でコマンドを実行させたり (rsh),
他のマシンにログインしたり (rlogin),マシン間でファイルをコピーしたり
(rcp) するプログラムが収められています.この3つのコマンドは全て
rhosts スタイルの認証形式をとります.このパッケージにはこれらの
サービスに必要なクライアントプログラムが収められています.
他のマシンの遠隔操作を可能にする為には rsh パッケージをインストール
して下さい.


%package server
Summary: Servers for remote access commands (rsh, rlogin, rcp).
Summary(ja): リモートアクセスコマンド (rsh, rlogin, rcp) のサーバ 
Group: System Environment/Daemons
#Requires: pam >= 0.59, /etc/pam.d/system-auth
Requires: pam >= 0.72
Requires: xinetd

%description server
The rsh-server package contains a set of programs which allow users
to run commmands on remote machines, login to other machines and copy
files between machines (rsh, rlogin and rcp).  All three of these
commands use rhosts style authentication.  This package contains the
servers needed for all of these services.  It also contains a server
for rexec, an alternate method of executing remote commands.
All of these servers are run by inetd and configured using
/etc/inetd.conf and PAM.  The rexecd server is disabled by default,
but the other servers are enabled.

The rsh-server package should be installed to enable remote access
from other machines.

%description server -l ja
rsh-server パッケージにはリモートマシン上でコマンドを実行させたり (rsh),
他のマシンにログインしたり (rlogin),マシン間でファイルをコピーしたり
(rcp) するプログラムが収められています.この3つのコマンドは全て
rhosts スタイルの認証形式をとります.このパッケージにはこれらの
サービスに必要なサーバプログラムが収められています.その他
rexec という別の種類のリモートコマンド実行の為のサーバも収められています.
これらサーバは全て inetd から起動し,/etc/inetd.conf や PAM を介して
設定を行います.rexecd サーバはデフォルトでは起動しませんが,
他のサーバはデフォルトで起動する様になっています.

他のマシンから遠隔操作を可能にする為には rsh-server パッケージを
インストールして下さい.


%prep
%setup -q -n netkit-rsh-%{version} -a 4
%patch1 -p1 -b .sectty
%patch2 -p1 -b .rexec
%patch3 -p1 -b .stdarg
%patch4 -p1 -b .jbj
%patch8 -p1 -b .jbj4
%patch9 -p1 -b .prompt
%patch10 -p1 -b .rsh
%patch11 -p1 -b .rsh.nokrb
%patch12 -p1 -b .jbj5
%patch13 -p1 -b .userandhost
%patch14 -p1 -b .strip
%patch15 -p1 -b .lfs
%patch16 -p1 -b .chdir
%patch17 -p1 -b .pam-nologin
%patch19 -p1 -b .rexec-netrc
%patch20 -p1 -b .pam-sess
%patch21 -p1 -b .errno
%patch22 -p1 -b .rexec-sig
%patch23 -p1 -b .nohost
%patch24 -p1 -b .ignchld
%patch25 -p1 -b .checkdir
%patch26 -p1 -b .pam-conv
%patch27 -p1 -b .largefile
%patch28 -p1 -b .pam-rhost
%patch29 -p1 -b .linefeed
%patch30 -p1 -b .ipv6
%patch31 -p1 -b .pam_env
%patch33 -p1 -b .dns
%patch34 -p1 -b .compat
%patch35 -p1 -b .audit
%patch36 -p1 -b .longname
%patch37 -p1 -b .arg_max
%patch38 -p1 -b .rh448904
%patch39 -p1 -b .rh461903
%patch40 -p1 -b .rh473492
%patch41 -p1 -b .rh650119

# No, I don't know what this is doing in the tarball.
rm -f rexec/rexec


%build
sh configure --with-c-compiler=gcc
perl -pi -e '
    s,^CC=.*$,CC=cc,;
    s,-O2,\$(RPM_OPT_FLAGS) -fpic -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE,;
    s,^LDFLAGS=,LDFLAGS=-pie,;
    s,^BINDIR=.*$,BINDIR=%{_bindir},;
    s,^MANDIR=.*$,MANDIR=%{_mandir},;
    s,^SBINDIR=.*$,SBINDIR=%{_sbindir},;
    ' MCONFIG

make %{?_smp_mfalgs}


%install
rm -rf ${RPM_BUILD_ROOT}
mkdir -p ${RPM_BUILD_ROOT}%{_bindir}
mkdir -p ${RPM_BUILD_ROOT}%{_sbindir}
mkdir -p ${RPM_BUILD_ROOT}%{_mandir}/man{1,5,8}
mkdir -p ${RPM_BUILD_ROOT}/etc/pam.d

make INSTALLROOT=${RPM_BUILD_ROOT} BINDIR=%{_bindir} MANDIR=%{_mandir} install

install -m 644 $RPM_SOURCE_DIR/rexec.pam ${RPM_BUILD_ROOT}/etc/pam.d/rexec
install -m 644 $RPM_SOURCE_DIR/rlogin.pam ${RPM_BUILD_ROOT}/etc/pam.d/rlogin
install -m 644 $RPM_SOURCE_DIR/rsh.pam ${RPM_BUILD_ROOT}/etc/pam.d/rsh

mkdir -p ${RPM_BUILD_ROOT}/etc/xinetd.d/
install -m644 %SOURCE5 ${RPM_BUILD_ROOT}/etc/xinetd.d/rsh
install -m644 %SOURCE6 ${RPM_BUILD_ROOT}/etc/xinetd.d/rlogin
install -m644 %SOURCE7 ${RPM_BUILD_ROOT}/etc/xinetd.d/rexec

%clean
rm -rf ${RPM_BUILD_ROOT}


%files
%defattr(-,root,root)
%attr(4755,root,root)	%{_bindir}/rcp
%{_bindir}/rexec
%attr(4755,root,root)	%{_bindir}/rlogin
%attr(4755,root,root)	%{_bindir}/rsh
%{_mandir}/man1/*.1*

%files server
%defattr(-,root,root)
%config	/etc/pam.d/rsh
%config	/etc/pam.d/rlogin
%config	/etc/pam.d/rexec
%{_sbindir}/in.rexecd
%{_sbindir}/in.rlogind
%{_sbindir}/in.rshd
/etc/xinetd.d/*
%{_mandir}/man8/*.8*


%changelog
* Sun Apr 10 2011 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 0.17-36
- rebuilt with current VineSeed
- added Patch38-41 from Fedora
  * Mon Nov 09 2010 Adam Tkac <atkac redhat com> - 0.17-64
  - fix typo in rexec.c (#650119)
  * Tue Jan 5 2010 Jan Gorig  <jgorig redhat com> - 0.17-62
  - add check for return values (#473492)
  * Thu Mar 26 2009 Adam Tkac <atkac redhat com> 0.17-53
  - check return value from close to catch errors on NFS filesystems (#461903)
  * Fri Oct 03 2008 Adam Tkac <atkac redhat com> 0.17-51
  - make in.rshd working on kernels without audit support (#448904)

* Sun Sep 07 2008 Daisuke SUZUKI <daisuke@linux.or.jp> 0.17-35
- new versioning policy, spec in UTF-8
- import Patch3[0-7] from fedora

* Thu Jun 29 2006 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 0.17-34vl1
- added Patches from Fedora 0.17-34.1
  * Thu Feb  9 2006 Karel Zak <kzak@redhat.com> 0.17-34
  - fix #178916 - Line feeds when password needs changing with rlogin
  * Mon Nov 28 2005 Karel Zak <kzak@redhat.com> 0.17-33
  - fix #174146 - pam_access.so does not work with rexecd
  * Thu Nov 24 2005 Karel Zak <kzak@redhat.com> 0.17-32
  - fix #174045 - rcp outputs negative file size when over 2GB

* Sun Feb 20 2005 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 0.17-28vl1
- based on Redhat Rawhide 0.17-28
  * Thu Feb  3 2005 Karel Zak <kzak@redhat.com> 0.17-28
  - malicious rcp server can cause rcp to write to arbitrary files 
    (like scp CAN-2004-0175) (#146464)
  * Mon Dec  6 2004 Karel Zak <kzak@redhat.com> 0.17-27
  - removed BSD stuff "signal(SIGCHLD, SIG_IGN)". It's unsupported 
    by POSIX/linux. (#122315)
  * Wed Nov 17 2004 Karel Zak <kzak@redhat.com> 0.17-25
  - rexecd uses PAM session now (#68590)
  - fixed errno usage in rcp (#67361)
  - fixed  rexec fails with "Invalid Argument" (#118630)
  * Mon Oct 18 2004 Radek Vokal <rvokal@redhat.com> 0.17-24
  - The username and password for ~/.netrc are used (#135643)
  * Thu Feb  5 2004 Thomas Woerner <twoerner@redhat.com> 0.17-20
  - in.rexecd, in.rlogind and in.rshd are pie, now
  * Tue Oct 21 2003 Phil Knirsch <pknirsch@redhat.com> 0.17-19
  - Included updated patch from #105733.
  * Thu Oct 02 2003 Phil Knirsch <pknirsch@redhat.com> 0.17-18
  - Fixed YAT (#79391).
  - Included feature request #105733 (-D option).

* Mon Jun 16 2003 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 0.17-15vl1
- based on Redhat Rawhide 0.17-15
  - replaced Patch2, Patch3 and Patch14 by newer ones
  - added Patch15, Patch16
- rebuild with new toolchains
- to use License instead of Copyright

* Thu Jan 18 2001 MATSUBAYASHI 'Shaolin' Kohji <shaolin@rhythmaning.org>
- 0.17-2.4vl2
- Requires: /etc/pam.d/system-auth -> pam >= 0.72 for rsh-server

* Wed Jan 10 2001 MATSUBAYASHI 'Shaolin' Kohji <shaolin@rhythmaning.org>
- 0.17-2.4vl1
- based on 0.17-2.4 from Rawhide
- added Japanese summary and description

* Tue Oct 10 2000 Nalin Dahyabhai <nalin@redhat.com>
- fix PAM config files to always honor nologin and securetty, to use rhosts,
  and to fall back to password auth only for rlogin and rexec (#17183)
- add references to pam_env to the PAM configs as well (#16170)
- disable rlogin and rsh by default

* Mon Oct 02 2000 Nalin Dahyabhai <nalin@redhat.com>
- fix typo in the rexec xinetd configuration file (#18107)

* Fri Jul 21 2000 Nalin Dahyabhai <nalin@redhat.com>
- fix typo in the rlogin PAM config file
- continue the tradition of messed-up release numbers

* Tue Jul 18 2000 Bill Nottingham <notting@redhat.com>
- add description & default to xinetd file

* Wed Jul 12 2000 Prospector <bugzilla@redhat.com>
- automatic rebuild

* Sun Jun 18 2000 Jeff Johnson <jbj@redhat.com>
- FHS packaging.
- update to 0.17.

* Thu Jun  1 2000 Nalin Dahyabhai <nalin@redhat.com>
- modify PAM setup to use system-auth

* Mon May 29 2000 Nalin Dahyabhai <nalin@redhat.com>
- expunge all mentions of kerberos authentication or DES encryption using
  kerberos from the man pages

* Thu May 25 2000 Trond Eivind Glomsr <teg@redhat.com>
- switched to xinetd

* Tue Mar  7 2000 Jeff Johnson <jbj@redhat.com>
- rebuild for sparc baud rates > 38400.

* Fri Mar 04 2000 Nalin Dahyabhai <nalin@redhat.com>
- make rlogin still work correctly when argv[0] = "rsh"

* Mon Feb 28 2000 Jeff Johnson <jbj@redhat.com>
- workaround (by explicitly prompting for password) #4328 and #9715.

* Wed Feb  9 2000 Jeff Johnson <jbj@redhat.com>
- mark pam config files as %config.

* Fri Feb  4 2000 Bill Nottingham <notting@redhat.com>
- handle compressed manpages

* Wed Feb 02 2000 Cristian Gafton <gafton@redhat.com>
- fix description

* Sun Jan 30 2000 Bill Nottingham <notting@redhat.com>
- remove bogus rexec binary when building; it causes weirdness

* Fri Jan 28 2000 Jeff Johnson <jbj@redhat.com>
- Make sure that rshd is compiled with -DUSE_PAM.

* Mon Jan 10 2000 Jeff Johnson <jbj@redhat.com>
- Fix bug in rshd (hangs forever with zombie offspring) (#8313).

* Wed Jan  5 2000 Jeff Johnson <jbj@redhat.com>
- fix the PAM fix yet again (#8133).

* Tue Jan  4 2000 Bill Nottingham <notting@redhat.com>
- split client and server

* Tue Dec 21 1999 Jeff Johnson <jbj@redhat.com>
- update to 0.16.
- dup setuid bits into files list.

* Fri Jul 30 1999 Jeff Johnson <jbj@redhat.com>
- update to rexec-1.5 client (#4262)

* Wed May 19 1999 Jeff Johnson <jbj@redhat.com>
- fix broken rexec protocol in in.rexecd (#2318).

* Tue May  4 1999 Justin Vallon <vallon@mindspring.com>
- rcp with error was tricked by stdarg side effect (#2300)

* Thu Apr 15 1999 Michael K. Johnson <johnsonm@redhat.com>
- rlogin pam file was missing comment magic

* Tue Apr 06 1999 Preston Brown <pbrown@redhat.com>
- strip rexec

* Fri Mar 26 1999 Jeff Johnson <jbj@redhat.com>
- rexec needs pam_set_item() (#60).
- clarify protocol in rexecd.8.
- add rexec client from contrib.

* Sun Mar 21 1999 Cristian Gafton <gafton@redhat.com> 
- auto rebuild in the new build environment (release 22)

* Mon Mar 15 1999 Jeff Johnson <jbj@redhat.com>
- compile for 6.0.

* Fri Apr 24 1998 Prospector System <bugs@redhat.com>
- translations modified for de, fr, tr

* Tue Apr 14 1998 Erik Troan <ewt@redhat.com>
- built against new ncurses

* Sat Apr  5 1998 Marcelo F. Vianna <m-vianna@usa.net>
- Packaged for RH5.0 (Hurricane)

* Tue Oct 14 1997 Michael K. Johnson <johnsonm@redhat.com>
- new pam conventions

* Tue Jul 15 1997 Erik Troan <ewt@redhat.com>
- initial build