%define rel 16
%define _libdir /lib

Summary: Libsafe: Protecting Critical Elements of Stacks
Summary(ja): Libsafe - バッファオーバーフロー脆弱製に対する防御ライブラリ
Name: libsafe
Version: 2.0
Release: %{rel}.1%{?_dist_release}
License: LGPL
Group: System Environment/Libraries
Source: http://www.research.avayalabs.com/project/libsafe/libsafe-%{version}-%{rel}.tgz
Source1: libsafe.sh
Source2: libsafe.csh
#Patch0: libsafe-2.0-makefile.patch
URL: http://www.research.avayalabs.com/project/libsafe/index.html
Buildroot: %{_tmppath}/%{name}-%{version}-root

Vendor: Project Vine
Distribution: Vine Linux

%description
The libsafe library protects a process against the exploitation of buffer
overflow vulnerabilities in process stacks. Libsafe works with any
existing pre-compiled executable and can be used transparently, even on a
system-wide basis. The method intercepts all calls to library functions
that are known to be vulnerable. A substitute version of the corresponding
function implements the original functionality, but in a manner that
ensures that any buffer overflows are contained within the current stack
frame. Libsafe has been shown to detect several known attacks and can
potentially prevent yet unknown attacks. Experiments indicate that the
performance overhead of libsafe is negligible.

%prep
#rm -rf %{buildroot}
%setup -q -n libsafe-%{version}-%{rel}

#%patch0 -p1

%build
mkdir -p %{buildroot}{%{_libdir},%{_mandir}/man8,%{_sysconfdir}/profile.d}
make

%install
install -s -m 0755 src/libsafe.so.%{version}.%{rel} %{buildroot}%{_libdir}
install -s -m 0755 src/libsafe.so %{buildroot}%{_libdir}
install -m 0644 doc/libsafe.8 %{buildroot}%{_mandir}/man8
install -m 755 %{SOURCE1} %{buildroot}%{_sysconfdir}/profile.d
install -m 755 %{SOURCE2} %{buildroot}%{_sysconfdir}/profile.d

touch %{buildroot}%{_sysconfdir}/libsafe.notify

%clean
rm -rf %{buildroot}

%post -p /sbin/ldconfig

%postun -p /sbin/ldconfig

%files
%defattr(-,root,root)
%doc README EMAIL_NOTIFICATION COPYING ChangeLog exploits/
%doc doc/whitepaper-1.3 doc/whitepaper-2.0 doc/libsafe.8.html
%{_libdir}/libsafe.so.%{version}.%{rel}
%{_libdir}/libsafe.so
%{_mandir}/*/*
%config(missingok,noreplace) %{_sysconfdir}/profile.d/libsafe.sh
%config(missingok,noreplace) %{_sysconfdir}/profile.d/libsafe.csh
%config(missingok,noreplace) %{_sysconfdir}/libsafe.notify

%changelog
* Mon Sep 29 2008 Shu KONNO <owa@bg.wakwak.com> 2.0-16.1vl5
- applied new versioning policy, spec in utf-8

* Thu Dec 22 2005 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 2.0-16vl3
- s/Copyright/License/
- changed Group:
- added Japanese summary

* Sun May 18 2003 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 2.0-16vl2
- fixed libsafe.[c]sh

* Fri May  2 2003 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 2.0-16vl1
- rebuild with new toolchains
- update to 2.0-16 from upstream
- dropped patch

* Tue Mar 27 2001 Jun Nishii <jun@vinelinux.org>
- 2.0-0vl1

* Thu Feb 15 2001 Jun Nishii <jun@vinelinux.org>
- 1.3-0vl1

* Mon May 15 2000 Tim Powers <timp@redhat.com> 
- using this spec for 7.0 since it's a bit better than my orig for 6.2
- ditch redundant defines
- use %{_prefix} where possible
- quiet setup

* Tue Apr 25 2000 William Stearns <wstearns@pobox.com>
- install no longer tries to strip the man page or shell scripts.

* Fri Apr 21 2000 Jeremy Hansen <jeremy@xxedgexx.com>
- updated rpm.
- updated rpm again, got bugfix tar ball from Arash Baratloo <arash@research.bell-labs.com>

* Thu Apr 20 2000 Jeremy Hansen <jeremy@xxedgexx.com>
- initial package build.


