Summary:   A privileged helper for utmp/wtmp updates.
Name:      utempter
Version:   0.5.5
Release:   6%{?_dist_release}
License:   MIT/LGPL
Group:     System Environment/Base
Source:    utempter-%{version}.tar.gz
Prereq:    /usr/sbin/groupadd, /sbin/ldconfig, fileutils
BuildRoot: %{_tmppath}/%{name}-%{version}-root

%define build_compat32 %{?_with_compat32:1}%{!?_with_compat32:0}


%description
Utempter is a utility which allows some non-privileged programs to
have required root access without compromising system
security. Utempter accomplishes this feat by acting as a buffer
between root and the programs.


%package -n compat32-%{name}
Summary:   A privileged helper for utmp/wtmp updates.
Group:     System Environment/Base
Requires: %{name} = %{version}-%{release}


%description -n compat32-%{name}
Utempter is a utility which allows some non-privileged programs to
have required root access without compromising system
security. Utempter accomplishes this feat by acting as a buffer
between root and the programs.


%prep
%setup  -q


%build
make RPM_OPT_FLAGS="$RPM_OPT_FLAGS"


%install
rm -rf $RPM_BUILD_ROOT
make PREFIX=$RPM_BUILD_ROOT LIBDIR=%{_libdir} install
/sbin/ldconfig -n $RPM_BUILD_ROOT/%{_libdir}


%clean
rm -rf $RPM_BUILD_ROOT


%pre 
/usr/sbin/groupadd -g 22 -r -f utmp


%post
{
    /sbin/ldconfig
    for file in /var/log/wtmp /var/run/utmp ; do
        if [ -f $file ]; then
            chown root:utmp $file
            chmod 664 $file
        fi
    done
}


%postun -p /sbin/ldconfig


%post -n compat32-%{name} -p /sbin/ldconfig


%postun -n compat32-%{name} -p /sbin/ldconfig


%files
%defattr(-,root,root)
%attr(02755, root, utmp) %{_sbindir}/utempter
%doc COPYING
%{_libdir}/libutempter.so*
%{_includedir}/utempter.h


%if %{build_compat32}
%files -n compat32-%{name}
%defattr(-,root,root)
%{_libdir}/libutempter.so*
%endif


%changelog
* Fri Aug 15 2008 Shu KONNO <owa@bg.wakwak.com> 0.5.5-6vl5
- applied new versioning policy

* Fri Oct 28 2005 NAKAMURA Kenta <kenta@c.csce.kyushu-u.ac.jp> 0.5.5-6vl2
- added compat32- packages for x86_64 architecture support

* Mon Jun 13 2005 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 0.5.5-6vl1
- based on Fedora 0.5.5-6
  * Mon Apr 19 2004 Mike A. Harris <mharris@redhat.com> 0.5.5-1
  - [SECURITY] Fix CAN-2004-0233 utempter directory traversal symlink attack
    issue for immediate erratum release.
  - Build all-arch test package 0.5.5-1 in dist-fc2-scratch
  * Mon Feb 23 2004 Mike A. Harris <mharris@redhat.com> 0.5.4-1
  - Rewrote post install script to be a bit cleaner and rebuilt in rawhide to
    pick up twaugh's chown change
  - Added 'srpm-x' target to Makefile for package maintainer SRPM building
  * Mon Feb 23 2004 Tim Waugh <twaugh@redhat.com>
  - Use ':' instead of '.' as separator for chown.

* Sat Oct  4 2003 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 0.5.3-2vl1
- based on Redhat Rawhide 0.5.3-2
  -  Fri May 30 2003 Mike A. Harris <mharris@redhat.com> 0.5.3-1
  - Bump version and release and rebuild to strip debug info into .debuginfo
    package, as the Red Hat Linux 9 package shipped unstripped (#91664)
  - Updated license field to reflect dual license MIT style + LGPL
  - Changed spec file Copyright tag to proper License tag
  - Removed stupid crackrock "version" macro define

  - Thu Jun 20 2002 Elliot Lee <sopwith@redhat.com> 0.5.2-9
  - Don't strip binary
  - Thu Feb 24 2000 Erik Troan <ewt@redhat.com>
  - added LGPL notice

* Wed Feb 20 2002 Daisuke SUZUKI <daisuke@linux.or.jp> 0.5.2-4vl2
- rebuild to remove rpmlib dependancy

* Tue May 29 2001 MATSUBAYASHI 'Shaolin' Kohji <shaolin@vinelinux.org>
- 0.5.2-4vl1
- rebuilt for Vine Linux

* Thu Jul 13 2000 Prospector <bugzilla@redhat.com>
- automatic rebuild

* Sat Jun 17 2000 Matt Wilson <msw@redhat.com>
- defattr root

* Thu Feb 24 2000 Erik Troan <ewt@redhat.com>
- added LGPL notice

* Mon Sep 13 1999 Bill Nottingham <notting@redhat.com>
- strip utempter

* Mon Aug 30 1999 Bill Nottingham <notting@redhat.com>
- add utmp as group 22

* Fri Jun  4 1999 Jeff Johnson <jbj@redhat.com>
- ignore SIGCHLD while processing utmp.
