1dc236
Name:           rpcbind
1dc236
Version:        0.2.0
1dc236
Release:        27.atomic.0%{?dist}
1dc236
Summary:        Universal Addresses to RPC Program Number Mapper
1dc236
Group:          System Environment/Daemons
1dc236
License:        BSD
1dc236
URL:            http://nfsv4.bullopensource.org
1dc236
1dc236
BuildRoot:      %{_tmppath}/%{name}-%{version}-root-%(%{__id_u} -n)
1dc236
Source0:        http://downloads.sourceforge.net/rpcbind/%{name}-%{version}.tar.bz2
1dc236
Source1: rpcbind.service
1dc236
Source2: rpcbind.socket
1dc236
Source3: rpcbind.sysconfig
1dc236
1dc236
Patch001: rpcbind-0_2_1-rc4.patch
1dc236
Patch002: rpcbind-0.2.0-warnings.patch
1dc236
Patch003: rpcbind-0.2.0-rpcinfo-mantypo.patch
1dc236
Patch004: 0001-nfs-Add-with-nss-modules-configure-option-to-specify.patch
1dc236
1dc236
Requires: glibc-common setup
1dc236
Conflicts: man-pages < 2.43-12
1dc236
BuildRequires: automake, autoconf, libtool, systemd-units
1dc236
BuildRequires: libtirpc-devel, quota-devel, tcp_wrappers-devel
1dc236
Requires(pre): coreutils shadow-utils
1dc236
Requires(post): chkconfig systemd-units systemd-sysv
1dc236
Requires(preun): systemd-units
1dc236
Requires(postun): systemd-units coreutils
1dc236
1dc236
Provides: portmap = %{version}-%{release}
1dc236
Obsoletes: portmap <= 4.0-65.3
1dc236
1dc236
%description
1dc236
The rpcbind utility is a server that converts RPC program numbers into
1dc236
universal addresses.  It must be running on the host to be able to make
1dc236
RPC calls on a server on that machine.
1dc236
1dc236
%prep
1dc236
%setup -q
1dc236
%patch001 -p1
1dc236
# 884165 - Package rpcbind-0.2.0-16.el7 failed RHEL7 RPMdiff testing
1dc236
%patch002 -p1
1dc236
# 963512 - Cmd rpcinfo usage info is not correct
1dc236
%patch003 -p1
1dc236
%patch004 -p1
1dc236
1dc236
1dc236
%build
1dc236
%ifarch s390 s390x
1dc236
PIE="-fPIE"
1dc236
%else
1dc236
PIE="-fpie"
1dc236
%endif
1dc236
export PIE
1dc236
1dc236
RELRO="-Wl,-z,relro,-z,now"
1dc236
1dc236
RPCBUSR=rpc
1dc236
RPCBDIR=/var/lib/rpcbind
1dc236
CFLAGS="`echo $RPM_OPT_FLAGS $ARCH_OPT_FLAGS $PIE $RELRO`"
1dc236
1dc236
autoreconf -fisv
1dc236
%configure CFLAGS="$CFLAGS" LDFLAGS="-pie" \
1dc236
    --enable-warmstarts \
1dc236
    --with-statedir="$RPCBDIR" \
1dc236
    --with-rpcuser="$RPCBUSR" \
1dc236
    --with-nss-modules="files altfiles" \
1dc236
    --enable-libwrap \
1dc236
    --enable-debug
1dc236
1dc236
make all
1dc236
1dc236
%install
1dc236
rm -rf %{buildroot}
1dc236
mkdir -p %{buildroot}{/sbin,/usr/sbin,/etc/sysconfig}
1dc236
mkdir -p %{buildroot}%{_unitdir}
1dc236
mkdir -p %{buildroot}%{_mandir}/man8
1dc236
mkdir -p %{buildroot}/var/lib/rpcbind
1dc236
make DESTDIR=$RPM_BUILD_ROOT install
1dc236
1dc236
mv -f ${RPM_BUILD_ROOT}%{_bindir}/rpcbind ${RPM_BUILD_ROOT}%{_sbindir}
1dc236
mv -f ${RPM_BUILD_ROOT}%{_bindir}/rpcinfo ${RPM_BUILD_ROOT}%{_sbindir}
1dc236
install -m644 %{SOURCE1} %{buildroot}%{_unitdir}
1dc236
install -m644 %{SOURCE2} %{buildroot}%{_unitdir}
1dc236
install -m644 %{SOURCE3} %{buildroot}/etc/sysconfig/rpcbind
1dc236
1dc236
%clean
1dc236
rm -rf %{buildroot}
1dc236
1dc236
%pre
1dc236
1dc236
# Check the validity of the rpc uid and gid.
1dc236
# If they don't exist, create them
1dc236
# If they exist but are the wrong value, remove them 
1dc236
#   and recreate them with the correct value
1dc236
# If they exist and are the correct value do nothing
1dc236
rpcid=`getent passwd rpc | cut -d: -f 3`
1dc236
if [ -n "$rpcid" -a "$rpcid" != "32" ]; then
1dc236
	/usr/sbin/userdel  rpc 2> /dev/null || :
1dc236
	/usr/sbin/groupdel rpc 2> /dev/null || : 
1dc236
fi
1dc236
if [ -z "$rpcid" -o "$rpcid" != "32" ]; then
1dc236
	/usr/sbin/groupadd -o -g 32 rpc > /dev/null 2>&1
1dc236
	/usr/sbin/useradd -o -l -c "Rpcbind Daemon" -d /var/lib/rpcbind -g 32 \
1dc236
    	-M -s /sbin/nologin -u 32 rpc > /dev/null 2>&1
1dc236
fi
1dc236
%post
1dc236
if [ $1 -eq 1 ] ; then 
1dc236
    # Initial installation
1dc236
    /bin/systemctl enable rpcbind.service >/dev/null 2>&1 || :
1dc236
fi
1dc236
1dc236
%preun
1dc236
if [ $1 -eq 0 ]; then
1dc236
	# Package removal, not upgrade
1dc236
	/bin/systemctl --no-reload disable rpcbind.service >/dev/null 2>&1 || :
1dc236
	/bin/systemctl stop rpcbind.service >/dev/null 2>&1 || :
1dc236
	/usr/sbin/userdel  rpc 2>/dev/null || :
1dc236
	/usr/sbin/groupdel rpc 2>/dev/null || :
1dc236
	rm -rf /var/lib/rpcbind
1dc236
fi
1dc236
1dc236
%postun
1dc236
/bin/systemctl daemon-reload >/dev/null 2>&1 || :
1dc236
if [ $1 -ge 1 ]; then
1dc236
	# Package upgrade, not uninstall
1dc236
	/bin/systemctl try-restart rpcbind.service >/dev/null 2>&1 || :
1dc236
fi
1dc236
1dc236
%triggerun -- rpcbind < 0.2.0-15
1dc236
%{_bindir}/systemd-sysv-convert --save rpcbind >/dev/null 2>&1 ||:
1dc236
/bin/systemctl --no-reload enable rpcbind.service >/dev/null 2>&1
1dc236
/sbin/chkconfig --del rpcbind >/dev/null 2>&1 || :
1dc236
/bin/systemctl try-restart rpcbind.service >/dev/null 2>&1 || :
1dc236
1dc236
%files
1dc236
%defattr(-,root,root)
1dc236
%config(noreplace) /etc/sysconfig/rpcbind
1dc236
%doc AUTHORS ChangeLog README
1dc236
%{_sbindir}/rpcbind
1dc236
%{_sbindir}/rpcinfo
1dc236
%{_mandir}/man8/*
1dc236
%{_unitdir}/rpcbind.service
1dc236
%{_unitdir}/rpcbind.socket
1dc236
1dc236
%dir %attr(700,rpc,rpc) /var/lib/rpcbind
1dc236
1dc236
%changelog
1dc236
* Fri Dec 05 2014 Colin Walters <walters@redhat.com> - 0.2.0-27.atomic.0
1dc236
- Backport fix for altfiles (bz 1171291)
1dc236
1dc236
* Sat Nov 15 2014 Steve Dickson <steved@redhat.com> - 0.2.0-26
1dc236
- Moved rpcbind from /sbin to /usr/sbin (bz 1159683)
1dc236
1dc236
* Mon Sep 22 2014 Steve Dickson <steved@redhat.com> - 0.2.0-25
1dc236
- Fixed some warnings in in6_fillscopeid() (bz 884165)
1dc236
- Fixed typo in rpcinfo manpage (bz 963512)
1dc236
- Removed unnecessary targets from rpcbind.service  (bz 1036791)
1dc236
1dc236
* Fri Sep 19 2014 Steve Dickson <steved@redhat.com> - 0.2.0-24
1dc236
- Added the RELRO CFLAGS (bz 1092513)
1dc236
1dc236
* Fri Jan 24 2014 Daniel Mach <dmach@redhat.com> - 0.2.0-23
1dc236
- Mass rebuild 2014-01-24
1dc236
1dc236
* Fri Dec 27 2013 Daniel Mach <dmach@redhat.com> - 0.2.0-22
1dc236
- Mass rebuild 2013-12-27
1dc236
1dc236
* Thu Feb 14 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.2.0-21
1dc236
- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild
1dc236
1dc236
* Tue Oct 23 2012 Steve Dickson <steved@redhat.com> - 0.2.0-20
1dc236
- Update to the latest upstream release: rpcbind-0_2_1-rc4 (bz 869365)
1dc236
1dc236
* Tue Oct 16 2012 Steve Dickson <steved@redhat.com> - 0.2.0-19
1dc236
- Renamed RPCBINDOPTS to RPCBIND_ARGS for backward compatibility (bz 861025)
1dc236
1dc236
* Sun Oct 14 2012 Steve Dickson <steved@redhat.com> - 0.2.0-18
1dc236
- Fixed typo causing rpcbind to run as root (bz 734598)
1dc236
- Added /etc/sysconfig/rpcbind config file (bz 861025)
1dc236
1dc236
* Sat Jul 21 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.2.0-17
1dc236
- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild
1dc236
1dc236
* Sat Jan 14 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.2.0-16
1dc236
- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild
1dc236
1dc236
* Mon Sep 12 2011 Steve Dickson <steved@redhat.com> - 0.2.0-15
1dc236
- Bumped up the tigger version to this version, 0.2.0-15 (bz 713574)
1dc236
1dc236
* Fri Sep  9 2011 Tom Callaway <spot@fedoraproject.org> - 0.2.0-14
1dc236
- fix scriptlets to enable service by default
1dc236
1dc236
* Fri Jul  8 2011 Steve Dickson <steved@redhat.com> - 0.2.0-13
1dc236
- Spec file clean up
1dc236
1dc236
* Thu Jul  7 2011 Steve Dickson <steved@redhat.com> - 0.2.0-12
1dc236
- Migrated SysV initscripts to systemd (bz 713574)
1dc236
1dc236
* Thu Mar 17 2011 Steve Dickson <steved@redhat.com> - 0.2.0-11
1dc236
- Updated to the latest upstream release: rpcbind-0_2_1-rc3
1dc236
1dc236
* Wed Feb 09 2011 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.2.0-10
1dc236
- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild
1dc236
1dc236
* Mon Dec 13 2010 Steve Dickson <steved@redhat.com> - 0.2.0-9
1dc236
- Fixed an incorrect exit code for service rpcbind status (bz 662411)
1dc236
1dc236
* Tue Nov 30 2010 Steve Dickson <steved@redhat.com> - 0.2.0-8
1dc236
- Updated to the latest upstream release: rpcbind-0.2.1-rc2
1dc236
1dc236
* Fri Jul 16 2010 Tom "spot" Callaway <tcallawa@redhat.com> - 0.2.0-7
1dc236
- correct license tag to BSD
1dc236
1dc236
* Tue Jul 13 2010 Steve Dickson <steved@redhat.com> - 0.2.0-6
1dc236
- Made initscript LSB compliant (bz 614193)
1dc236
- Added no fork patch
1dc236
1dc236
* Tue Jul  6 2010 Steve Dickson <steved@redhat.com> - 0.2.0-5
1dc236
- Set SO_REUSEADDR on listening sockets (bz 597356)
1dc236
1dc236
* Sun Jul 26 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.2.0-4
1dc236
- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild
1dc236
1dc236
* Mon Jul 06 2009 Adam Jackson <ajax@redhat.com> 0.2.0-3
1dc236
- Requires(pre): coreutils for cut(1).
1dc236
1dc236
* Thu Jun 25 2009 Steve Dickson <steved@redhat.com> - 0.2.0-2
1dc236
- Fixed pre scriptle failure during upgrades (bz 507364)
1dc236
- Corrected the usage info to match what the rpcbind man
1dc236
    page says. (bz 466332)
1dc236
- Correct package issues (bz 503508)
1dc236
1dc236
* Fri May 29 2009 Steve Dickson <steved@redhat.com> - 0.2.0-1
1dc236
- Updated to latest upstream release: 0.2.0
1dc236
1dc236
* Tue May 19 2009 Tom "spot" Callaway <tcallawa@redhat.com> - 0.1.7-3
1dc236
- Replace the Sun RPC license with the BSD license, with the explicit permission of Sun Microsystems
1dc236
1dc236
* Wed Feb 25 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.1.7-2
1dc236
- Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild
1dc236
1dc236
* Wed Nov 19 2008 Steve Dickson <steved@redhat.com>  0.1.7-1
1dc236
- Update to latest upstream release: 0.1.7
1dc236
1dc236
* Tue Sep 30 2008 Steve Dickson <steved@redhat.com>  0.1.6-3
1dc236
- Fixed a typo in the rpcbind.init script that stop warm starts
1dc236
  from happening with conrestarts
1dc236
- Fixed scriptlet failure (bz 462533)
1dc236
1dc236
* Tue Sep 16 2008 Steve Dickson <steved@redhat.com> 0.1.6-2
1dc236
- Added usptream patches 01 thru 03 that do:
1dc236
    * Introduce helpers for ipprot/netid mapping
1dc236
    * Change how we decide on the netids to use for portmap
1dc236
    * Simplify port live check in pmap_svc.c
1dc236
1dc236
* Wed Jul  9 2008 Steve Dickson <steved@redhat.com> 0.1.6-1
1dc236
- Updated to latest upstream release 0.1.6
1dc236
1dc236
* Wed Jul  2 2008 Steve Dickson <steved@redhat.com> 0.1.5-5
1dc236
- Fixed SYNOPSIS section in the rpcinfo man page (bz 453729)
1dc236
1dc236
* Fri Jun 27 2008 Steve Dickson <steved@redhat.com> 0.1.5-4
1dc236
- Removed the documentation about the non-existent 
1dc236
  '-L' flag (bz 446915)
1dc236
1dc236
* Fri Jun 27 2008 Steve Dickson <steved@redhat.com> 0.1.5-3
1dc236
- Set password and service lookups to be local (bz 447092)
1dc236
1dc236
* Mon Jun 23 2008 Steve Dickson <steved@redhat.com> 0.1.5-2
1dc236
- rpcbind needs to downgrade to non-priviledgied group.
1dc236
1dc236
* Mon Jun 23 2008 Steve Dickson <steved@redhat.com> 0.1.5-1
1dc236
- Updated to latest upstream release 0.1.5
1dc236
1dc236
* Mon Feb 11 2008 Steve Dickson <steved@redhat.com> 0.1.4-14
1dc236
- Fixed a warning in pmap_svc.c
1dc236
- Cleaned up warmstarts so uid are longer needed, also
1dc236
  changed condrestarts to use warmstarts. (bz 428496)
1dc236
1dc236
* Thu Jan 24 2008 Steve Dickson <steved@redhat.com> 0.1.4-13
1dc236
- Fixed connectivity with Mac OS clients by making sure handle_reply()
1dc236
  sets the correct fromlen in its recvfrom() call (bz 244492)
1dc236
1dc236
* Mon Dec 17 2007 Steve Dickson <steved@redhat.com> 0.1.4-12
1dc236
- Changed is_loopback() and check_access() see if the calling
1dc236
  address is an address on a local interface, just not a loopback
1dc236
  address (bz 358621).
1dc236
1dc236
* Wed Oct 17 2007 Steve Dickson <steved@redhat.com> 0.1.4-11
1dc236
- Reworked logic in initscript so the correct exit is 
1dc236
  used when networking does not exist or is set up
1dc236
  incorrectly.
1dc236
1dc236
* Tue Oct 16 2007 Steve Dickson <steved@redhat.com> 0.1.4-10
1dc236
- Corrected a typo in the initscript from previous 
1dc236
  commit.
1dc236
1dc236
* Mon Oct 15 2007 Steve Dickson <steved@redhat.com> 0.1.4-9
1dc236
- Fixed typo in Summary (bz 331811)
1dc236
- Corrected init script (bz 247046)
1dc236
1dc236
* Sat Sep 15 2007 Steve Dickson <steved@redhat.com> 0.1.4-8
1dc236
- Fixed typo in init script (bz 248285)
1dc236
- Added autoconf rules to turn on secure host checking
1dc236
  via libwrap. Also turned on host check by default (bz 248284)
1dc236
- Changed init script to start service in runlevel 2 (bz 251568)
1dc236
- Added a couple missing Requires(pre) (bz 247134)
1dc236
1dc236
* Fri May 25 2007 Steve Dickson <steved@redhat.com> 0.1.4-7
1dc236
- Fixed condrestarts (bz 241332)
1dc236
1dc236
* Tue May 22 2007 Steve Dickson <steved@redhat.com> 0.1.4-6
1dc236
- Fixed an ipv6 related segfault on startup (bz 240873)
1dc236
1dc236
* Wed Apr 18 2007 Steve Dickson <steved@redhat.com> 0.1.4-5
1dc236
- Added dependency on setup which contains the correct
1dc236
  rpcbind /etc/service entry which in turns stops 
1dc236
  rpcbind from haning when NIS is enabled. (bz 236865)
1dc236
1dc236
* Wed Apr 11 2007 Jeremy Katz <katzj@redhat.com> - 0.1.4-4
1dc236
- change man-pages requires into a conflicts as we don't have to have 
1dc236
  man-pages installed, but if we do, we need the newer version
1dc236
1dc236
* Fri Apr  6 2007 Steve Dickson <steved@redhat.com> 0.1.4-3
1dc236
- Fixed the Provides and Obsoletes statments to correctly
1dc236
  obsolete the portmap package.
1dc236
* Tue Apr  3 2007 Steve Dickson <steved@redhat.com> 0.1.4-2
1dc236
- Added dependency on glibc-common which allows the
1dc236
  rpcinfo command to be installed in the correct place.
1dc236
- Added dependency on man-pages so the rpcinfo man 
1dc236
  pages don't conflict.
1dc236
- Added the creation of /var/lib/rpcbind which will be
1dc236
  used to store state files.
1dc236
- Make rpcbind run with the 'rpc' uid/gid when it exists.
1dc236
1dc236
* Wed Feb 21 2007 Steve Dickson <steved@redhat.com> 0.1.4-1
1dc236
- Initial commit
1dc236
- Spec reviewed (bz 228894)
1dc236
- Added the Provides/Obsoletes which should
1dc236
  cause rpcbind to replace portmapper