Summary: The client for the Trivial File Transfer Protocol (TFTP).
Summary(ja): TFTP (Trivial File Transfer Protocol) クライアント
Name: tftp
Version: 0.49
Release: 2%{?_dist_release}
License: BSD
Group: Applications/Internet
Source: http://www.kernel.org/pub/software/network/tftp/tftp-hpa-%{version}.tar.bz2
URL: http://www.kernel.org/pub/software/network/tftp/

Patch0: tftp-0.40-remap.patch
Patch2: tftp-hpa-0.39-tzfix.patch
Patch3: tftp-0.42-tftpboot.patch
Patch4: tftp-0.49-chk_retcodes.patch
Patch5: tftp-hpa-0.49-fortify-strcpy-crash.patch
Patch6: tftp-0.49-cmd_arg.patch
Patch7: tftp-hpa-0.49-stats.patch

BuildRequires: tcp_wrappers readline-devel
BuildRoot: %{_tmppath}/%{name}-%{version}-root

%description
The Trivial File Transfer Protocol (TFTP) is normally used only for
booting diskless workstations.  The tftp package provides the user
interface for TFTP, which allows users to transfer files to and from a
remote machine.  This program and TFTP provide very little security,
and should not be enabled unless it is expressly needed.

%description -l ja
TFTP (Trivial File Transfer Protocol) は通常
ディスクレスワークステーションの起動時にのみ使われます。
tftp パッケージはこの TFTP のインタフェースを提供し、リモート機から
ファイルを転送することが出来ます。このプログラムと TFTP は
セキュリティ面に於いて非常に弱いので、どうしても必要な場合以外は
使わない方が良いでしょう。


%package server
Group: System Environment/Daemons
Summary: The server for the Trivial File Transfer Protocol (TFTP).
Summary(ja): TFTP (Trivial File Transfer Protocol) サーバ
Requires: xinetd


%description server
The Trivial File Transfer Protocol (TFTP) is normally used only for
booting diskless workstations.  The tftp-server package provides the
server for TFTP, which allows users to transfer files to and from a
remote machine. TFTP provides very little security, and should not be
enabled unless it is expressly needed.  The TFTP server is run from
%{_sysconfdir}/xinetd.d/tftp, and is disabled by default.

%description server -l ja
TFTP (Trivial File Transfer Protocol) は通常
ディスクレスワークステーションの起動時にのみ使われます。
tftp-server パッケージには TFTP のサーバプログラムが収められており、
リモート機間とのファイル転送を可能にします。このプログラムと TFTP は
セキュリティ面に於いて非常に弱いので、どうしても必要な場合以外は
使わない方が良いでしょう。TFTP サーバは /etc/xinetd.d/tftp から起動され、
デフォルトでは オフにされています。


%prep
%setup -q -n tftp-hpa-%{version} 
%patch0 -p1 -b .zero
%patch2 -p1 -b .tzfix
%patch3 -p1 -b .tftpboot
%patch4 -p1 -b .chk_retcodes
%patch5 -p1 -b .fortify-strcpy-crash
%patch6 -p1 -b .cmd_arg
%patch7 -p1 -b .stats


%build
autoreconf
%configure
make %{?_smp_mflags}


%install
rm -rf $RPM_BUILD_ROOT
mkdir -p ${RPM_BUILD_ROOT}%{_bindir}
mkdir -p ${RPM_BUILD_ROOT}%{_mandir}/man{1,8}
mkdir -p ${RPM_BUILD_ROOT}%{_sbindir}
mkdir -p ${RPM_BUILD_ROOT}%{_localstatedir}/lib/tftpboot

make INSTALLROOT=${RPM_BUILD_ROOT} SBINDIR=%{_sbindir} MANDIR=%{_mandir} INSTALL='install -p' install
install -m755 -d -p ${RPM_BUILD_ROOT}%{_sysconfdir}/xinetd.d/ ${RPM_BUILD_ROOT}%{_localstatedir}/lib/tftpboot
sed -e 's:/var:%{_localstatedir}:' -e 's:/usr/sbin:%{_sbindir}:' \
 tftp-xinetd > ${RPM_BUILD_ROOT}%{_sysconfdir}/xinetd.d/tftp
touch -r tftp-xinetd ${RPM_BUILD_ROOT}%{_sysconfdir}/xinetd.d/tftp


%clean
rm -rf $RPM_BUILD_ROOT


%post server
/sbin/service xinetd reload > /dev/null 2>&1 || :


%postun server
if [ $1 = 0 ]; then
    /sbin/service xinetd reload > /dev/null 2>&1 || :
fi


%files
%defattr(-,root,root,-)
%doc README README.security CHANGES
%{_bindir}/tftp
%{_mandir}/man1/*


%files server
%defattr(-,root,root,-)
%doc README README.security CHANGES
%config(noreplace) %{_sysconfdir}/xinetd.d/tftp
%dir %{_localstatedir}/lib/tftpboot
%{_sbindir}/in.tftpd
%{_mandir}/man8/*


%changelog
* Sat Mar 19 2011 MATSUBAYASHI Kohji <shaolin@vinelinux.org> - 0.49-2
- Fixed Requires on server subpackage (s/inetd/xinetd)

* Sat Mar 19 2011 MATSUBAYASHI Kohji <shaolin@vinelinux.org> - 0.49-1
- updated to 0.49; patches added and revised based on Fedora 0.49-8
- restored the config file for xinetd
- s/BuildPreReq/BuildRequires/

* Sun Oct 12 2008 Shu KONNO <owa@bg.wakwak.com> 0.42-4vl5
- applied new versioning policy, spec in utf-8

* Sat Apr 15 2006 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 0.42-3vl1
- rebuilt with readline 5.1
- new upstream release
- added patches from Fedora
  * Mon Apr 10 2006 Radek Vok叩l <rvokal@redhat.com> 0.42-3
  - show localtime instead of GMT (#172274)
  * Wed Mar 22 2006 Radek Vok叩l <rvokal@redhat.com> 0.42-2
  - fix double free error when hitting ^C (#186201)

* Sat May 28 2005 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 0.40-6vl1
- updated to 0.40 based on Fedora
  * Tue Apr 19 2005 Radek Vokal <rvokal@redhat.com> 0.40-6
  - fix remap rules convert error <pjones@redhat.com>
- changed tftp Group

* Thu Jul 24 2003 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 0.33-2vl1
- updated to 0.33
- rebuild with new toolchains
- s/Copyright/License/
- add BuildPreReq on tcp_wrappers (based on Rawhide)

* Wed Jan 10 2001 MATSUBAYASHI 'Shaolin' Kohji <shaolin@rhythmaning.org>
- 0.16-5vl1
- use better macros (%%{_bindir},%%{_sbindir},%%{_mandir})
- added Japanese summary and description

* Fri Feb 11 2000 Bill Nottingham <notting@redhat.com>
- fix description

* Wed Feb  9 2000 Jeff Johnson <jbj@redhat.com>
- compress man pages (again).

* Wed Feb 02 2000 Cristian Gafton <gafton@redhat.com>
- man pages are compressed
- fix description and summary

* 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.

* Sat Aug 28 1999 Jeff Johnson <jbj@redhat.com>
- update to 0.15.

* Wed Apr  7 1999 Jeff Johnson <jbj@redhat.com>
- tftpd should truncate file when overwriting (#412)

* 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 Aug  7 1998 Jeff Johnson <jbj@redhat.com>
- build root

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

* Mon Sep 22 1997 Erik Troan <ewt@redhat.com>
- added check for getpwnam() failure

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