#
# spec file for package libtirpc
#
# Copyright (c) 2016 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via http://bugs.opensuse.org/
#


Name:           libtirpc
# src/crypt_client.c and tirpc/rpcsvc/crypt.x have the BSD advertising clause
Version:        1.0.1
Release:        4.1
Summary:        Transport Independent RPC Library
License:        BSD-4-Clause
Group:          System/Libraries
%if 0%{suse_version} >= 1300
BuildRequires:  krb5-mini-devel
%else
BuildRequires:  krb5-devel
%endif
BuildRequires:  autoconf
BuildRequires:  libtool
BuildRequires:  pkg-config
Url:            http://sourceforge.net/projects/libtirpc/
Source:         %{name}-%{version}.tar.bz2
Source1:        baselibs.conf
Patch0:         000-bindresvport_blacklist.patch
# Patch2 is only needed for SLES11
Patch2:         002-old-automake.patch
Patch5:         005-libtirpc-1.0.2-rc1.patch
Patch6:         006-Remove-old-meanwhile-wrong-comment-about-FD_SETSIZE-.patch
Patch7:         007-Change-rtime-function-to-use-poll-instead-of-select.patch
Patch8:         008-Add-parameters-to-local-prototypes-to-fix-compiler-w.patch
Patch9:         009-makefd_xprt-checks-that-the-filedesriptor-is-lower-t.patch
Patch10:        010-The-goto-again-statement-was-an-left-over-from-the-p.patch
Patch11:        011-Fix-typo-in-src-libtirpc.map-which-prevents-that-key.patch
Patch12:        012-libtirpc-needs-rpcsvc-nis.h-for-compiling-but-does-n.patch
Patch13:        013-If-we-don-t-compile-in-YP-support-don-t-include-YP-h.patch
Patch14:        014-Add-des_crypt.c-and-des_impl.c-to-become-independent.patch
Patch15:        015-Fix-includes-to-compile-without-deprecated-glibc-fun.patch
Patch25:        patch6_7.diff
# Patch37 is only needed on openSUSE >= 13.1, SLE >= 12
Patch37:        libtirpc-new-path-rpcbindsock.patch
Patch38:        decls.patch
Patch39:        explicit_bzero.patch
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
%define debug_package_requires libtirpc3 = %{version}-%{release}

%description
The Transport Independent RPC library (TI-RPC) is a replacement for the
standard SunRPC library in glibc which does not support IPv6 addresses.
This implementation allows the support of other transports than UDP and
TCP over IPv4

%package -n libtirpc3
Summary:        Transport Independent RPC Library
Group:          System/Libraries
Requires:       libtirpc-netconfig >= %{version}

%description -n libtirpc3
The Transport Independent RPC library (TI-RPC) is a replacement for the
standard SunRPC library in glibc which does not support IPv6 addresses.
This implementation allows the support of other transports than UDP and
TCP over IPv4

%package netconfig
Summary:        Netconfig configuration file for TI-RPC Library
Group:          System/Base

%description netconfig
This RPM contains the netconfig configuration file and manual page for
the TI-RPC Library.

%package devel
# src/crypt_client.c tirpc/spinlock.h and tirpc/rpcsvc/crypt.x have the BSD
# advertising clause
Summary:        Transport Independent RPC Library
Group:          Development/Libraries/C and C++
Requires:       glibc-devel
Requires:       libtirpc3 = %{version}

%description devel
The Transport Independent RPC library (TI-RPC) is a replacement for the
standard SunRPC library in glibc which does not support IPv6 addresses.
This implementation allows the support of other transports than UDP and
TCP over IPv4

%prep
%setup -q -n %name-%version
%patch0 -p0
%patch2 -p1
%patch5 -p1
%patch6 -p1
%patch7 -p1
%patch8 -p1
%patch9 -p1
%patch10 -p1
%patch11 -p1
%patch12 -p1
%patch13 -p1
%patch14 -p1
%patch15 -p1
%patch25 -p1
%if 0%{suse_version} >= 1310
%patch37 -p1
%endif
%patch38 -p1
%patch39 -p1

%build
autoreconf -fiv
%configure --disable-static \
		--with-pic \
%if 0%{suse_version} < 1200
		--disable-gssapi \
%endif
		--libdir=/%{_lib}
%{__make} %{?_smp_mflags}

%install
# Don't strip .symtab to allow debugging
export STRIP_KEEP_SYMTAB=libtirpc*.so*
# NO_BRP_CHECK_ROOTFS is for SLES11 only, but does not harm for Factory
export NO_BRP_CHECK_ROOTFS=true
make install DESTDIR=$RPM_BUILD_ROOT
# move devel so link to _libdir
mkdir -p $RPM_BUILD_ROOT%{_libdir}
%{__ln_s} -v /%{_lib}/$(readlink %{buildroot}/%{_lib}/%{name}.so) %{buildroot}%{_libdir}/%{name}.so
%{__rm} -v %{buildroot}/%{_lib}/%{name}.{la,so}
mv -v $RPM_BUILD_ROOT/%{_lib}/pkgconfig $RPM_BUILD_ROOT/%{_libdir}

%clean
rm -rf $RPM_BUILD_ROOT

%post -n libtirpc3 -p /sbin/ldconfig

%postun -n libtirpc3 -p /sbin/ldconfig

%files -n libtirpc3
%defattr(-,root,root)
/%{_lib}/libtirpc.so.3*

%files netconfig
%defattr(-,root,root)
%config %{_sysconfdir}/netconfig
%{_mandir}/man5/netconfig.5.gz

%files devel
%defattr(-,root,root)
%{_libdir}/libtirpc.so
%dir /usr/include/tirpc/
/usr/include/tirpc/*
/usr/%{_lib}/pkgconfig/*
%{_mandir}/man3/*

%changelog
* Wed Jul  5 2017 schwab@suse.de
- decls.patch: fix missing declarations
- explicit_bzero.patch: use explicit_bzero if available
* Mon Mar 14 2016 kukuk@suse.de
- Add some patches to get libtirpc compiled without needing glibc
  deprecated functions:
  - 015-Fix-includes-to-compile-without-deprecated-glibc-fun.patch
  - 014-Add-des_crypt.c-and-des_impl.c-to-become-independent.patch
  - 013-If-we-don-t-compile-in-YP-support-don-t-include-YP-h.patch
- Add 012-libtirpc-needs-rpcsvc-nis.h-for-compiling-but-does-n.patch
  to allow bootstrapping of libtirpc without glibc sunrpc code or
  libnsl NIS+ code.
* Mon Mar 14 2016 kukuk@suse.de
- Add 011-Fix-typo-in-src-libtirpc.map-which-prevents-that-key.patch
  (fix export of key_secretkey_is_set)
* Thu Feb 25 2016 kukuk@suse.de
- Add the following patches to fix some bugs from the poll()
  port and an endless loop:
  - 006-Remove-old-meanwhile-wrong-comment-about-FD_SETSIZE-.patch
  - 007-Change-rtime-function-to-use-poll-instead-of-select.patch
  - 008-Add-parameters-to-local-prototypes-to-fix-compiler-w.patch
  - 009-makefd_xprt-checks-that-the-filedesriptor-is-lower-t.patch
  - 010-The-goto-again-statement-was-an-left-over-from-the-p.patch
* Thu Jan 21 2016 kukuk@suse.de
- Remove 004-netconfig-prefer-IPv6.patch for SLES12.
- Remove libtirpc-getnetconfig-races.patch (was backport).
  [FATE#320393]
* Wed Jan 20 2016 kukuk@suse.de
- Split the netconfig configuration file and manual page off into
  an own RPM. Else it is not possible to install the old and new
  libtirpc libraries in parallel.
* Tue Nov 17 2015 kukuk@suse.de
- Update to libtirpc-1.0.1
  - new major soname
  - Adjust auth code to match other RPC implementations
  - Implement more gss auth stuff
  - use poll() instead of select() in svc_run()
  - Add more sunrpc compat functions
  - Sync compat headers with real functions
- Drop 005-missing-symvers.patch (upstream)
- Drop 006-memleak1.patch (upstream)
- Drop 007-memleak2.patch (upstream)
- Drop 008-fix-undef-ref.patch (upstream)
- Drop 009-authdes_pk_create.patch (upstream)
- Drop 010-xdr_sizeof.patch (upstream)
- Drop 011-authdes_create.patch (upstream)
- Drop 012-xp_sock.patch (upstream)
- Drop 099-poll.patch (upstream)
- Drop libtirpc-xdr-header.patch (was backport)
- Add 005-libtirpc-1.0.2-rc1.patch (fixes deadlock)
* Thu Jul 23 2015 okir@suse.com
- Fix public xdr.h header - xdr_rpcvers() were broken (bsc#902439)
  Added: libtirpc-xdr-header.patch
* Thu Jul 16 2015 kukuk@suse.de
- Update 099-poll.patch with newest version send upstream.
* Fri Jul 10 2015 kukuk@suse.de
- Add 099-poll.patch: change svc_run from select() to poll().
* Thu Jul  9 2015 kukuk@suse.de
- Add 012-xp_sock.patch: add sunrpc compatibility define
* Thu Jul  2 2015 kukuk@suse.de
- Update 009-authdes_pk_create.patch (fix syncaddr handling)
- Add 011-authdes_create.patch (fix syncaddr handling)
* Sat Jun 27 2015 kukuk@suse.com
- Add 010-xdr_sizeof.patch (enable xdr_sizeof)
* Fri Jun 26 2015 kukuk@suse.com
- Add 009-authdes_pk_create.patch (missing SunRPC compat function)
* Wed Jun 24 2015 kukuk@suse.de
- Add 008-fix-undef-ref.patch to fix a undefined reference bug
* Tue Jun 23 2015 kukuk@suse.de
- Update to version 0.3.2 (bring authdes back)
- Remove 005-no_IPv6_for_old_code.patch (accepted upstream)
- Remove 001-tirpc-features.patch (obsolete)
- Add 005-missing-symvers.patch (fix missing, new symbols)
- Add 006-memleak1.patch (fix memory leak)
- Add 007-memleak2.patch (fix memory leak)
* Mon Jun  1 2015 kukuk@suse.de
- Remove krb5-devel from -devel requires, not needed anymore
* Mon Jun  1 2015 kukuk@suse.de
- Update to libtirpc 0.3.1, which incorporates the following
  patches:
  - 011-gssapi-update1.patch
  - 012-gssapi-update2.patch
  - 013-gssapi-update3.patch
  - 014-gssapi-update4.patch
  - 015-gssapi-update5.patch
  - 016-gssapi-update6.patch
  - 017-gssapi-update7.patch
  - 018-gssapi-update8.patch
  Not needed anymore:
  - 007-fix-tirpc_map.patch
  Adjusted:
  - 001-tirpc-features.patch, merged with 006-rework-features.diff
  - 002-old-automake.patch
* Tue May 26 2015 kukuk@suse.de
- 007-fix-tirpc_map.patch: fix symbol version for new global names
* Tue May 26 2015 kukuk@suse.de
- 006-rework-features.diff: Adjust for set of gssapi patches
- 003-fix-gssapi.patch replaced by 011-gssapi-update1.patch
- 012-gssapi-update2.patch: fix krb5-config usage
- 013-gssapi-update3.patch: check for gssapi.h
- 014-gssapi-update4.patch: don't include rpcsec_gss.h
- 015-gssapi-update5.patch: don't install GSSAPI files if disabled
- 016-gssapi-update6.patch: fix rpc_gss_seccreate
- 017-gssapi-update7.patch: officialy export two internal functions
- 018-gssapi-update8.patch: don't use glibc special header files
* Tue May 12 2015 kukuk@suse.de
- 003-fix-gssapi.patch: Correct fix for GSS ABI breakage
- 005-no_IPv6_for_old_code.patch: Update comment
- 006-rework-features.diff: Rework tirpc-features.h
* Fri May  8 2015 kukuk@suse.de
- 003-fix-gssapi.patch: Update, one chunk did go lost
* Fri May  8 2015 kukuk@suse.de
- 001-tirpc-features.patch: update with official git version
- 002-old-automake.patch: re-add for SLES11
- 003-fix-gssapi.patch: try to fix the disable-gssapi option correct
* Thu May  7 2015 kukuk@suse.de
- Fix HAVE_AUTHDES/HAVE_GSSAPI in public header files
  (001-tirpc-features.patch)
* Wed May  6 2015 kukuk@suse.de
- Update to official release 0.3.0. authdes was disabled by default
  upstream.
- Following patches were merged:
  - 001-symbol-versions-v5.patch
  - 003-add-des_crypt.diff
- Remove 002-old-automake.patch, not needed anymore
* Mon May  4 2015 kukuk@suse.de
- Update 001-symbol-versions-v4.patch with
  001-symbol-versions-v5.patch: Add --disable-symvers option
* Thu Apr 30 2015 kukuk@suse.de
- Update 003-add-des_crypt.diff, fix unresolved des functions
* Thu Apr 30 2015 kukuk@suse.de
- Update to git
- Add 003-add-des_crypt.diff to fix unresolved *_crypt() functions
* Thu Apr 30 2015 kukuk@suse.de
- Disable gssapi for SLE11, kerberos version is too old
* Thu Apr 30 2015 kukuk@suse.de
- rpc/rpc.h requires now indirectly gssapi.h from krb5-devel
* Thu Apr 30 2015 kukuk@suse.de
- Update to current git.
- The following patches were accepted upstream:
  - 003-xdr_h-fix.patch
  - 005-disable-rpcent.patch
  - 006-no-libnsl.patch
  - patch1_7.diff
  - patch2_7.diff
  - patch3_7.diff
- patch7_7.diff: removed, rejected upstream
- 001-symbol-versions-v3.patch: replace with 001-symbol-versions-v4.patch
* Fri Apr 24 2015 kukuk@suse.de
- Add the following patches from the libtirpc-devel mailing list:
  - patch1_7.diff (remove wrong config.h.in)
  - patch2_7.diff (fix function name of yp_check)
  - patch3_7.diff (make sure config.h is included)
  - patch6_7.diff (use getaddrinfo in getrpcport)
  - patch7_7.diff (remove prototypes from headers we don't supply)
* Fri Apr 24 2015 kukuk@suse.de
- Add following patches:
  - 003-xdr_h-fix.patch (fix wrong defines using xdr_u_int32)
  - 005-disable-rpcent.patch (use rpcent functions from glibc)
  - 006-no-libnsl.patch (don't link against libnsl)
* Thu Apr 23 2015 kukuk@suse.de
- Update to 0.2.5.git from 20150423
  - following patches are accepted upstream:
  - 003-rpc_broadcast_misformed_replies.patch
  - libtirpc-misc-segfaults.patch
  - replace 001-symbol-versions-v2.patch with
    001-symbol-versions-v3.patch
  - enable symbol versioning patch
* Tue Feb  3 2015 lchiquitto@suse.com
- Fix race conditions in getnetconfig (bsc#899576, bsc#882973)
  Added: libtirpc-getnetconfig-races.patch
* Fri Dec 19 2014 kukuk@suse.de
- 004-netconfig-prefer-IPv6.patch: Prever IPv6 over IPv4 (configured
  in /etc/netconfig)
* Fri Dec 19 2014 kukuk@suse.de
- 002-old-automake.patch: make buildable on old systems
* Wed Dec 17 2014 kukuk@suse.de
- Update to 0.2.5.git from 20141217
  - following patches are accepted upstream:
  - 002-clnt_broadcast_fix.patch
  - 004-getpmaphandle.patch
  - libtirpc-clntunix_create.patch
  - libtirpc-getbroadifs-crash.patch
  - libtirpc-taddr2uaddr-local.patch
* Mon Dec 15 2014 kukuk@suse.de
- Update to upstream 0.2.5 release
- Add symbol versioning to fix symbol conflicts
  (001-symbol-versions-v2.patch), but disable until commited upstream
- Adjust libtirpc-clnt_broadcast_fix.patch and rename to
  002-clnt_broadcast_fix.patch
- Adjust libtirpc-rpc_broadcast_misformed_replies.patch and rename
  to 003-rpc_broadcast_misformed_replies.patch
- Rename libtirpc-getpmaphandle.patch to 004-getpmaphandle.patch
- Adjust libtirpc-bindresvport_blacklist.patch and rename to
  000-bindresvport_blacklist.patch
- Drop libtirpc-pmap-setunset.patch, not needed anymore
- Apply libtirpc-new-path-rpcbindsock.patch only on openSUSE 13.1
  and later
* Fri Jan 31 2014 okir@suse.com
- Prevent a segfault of 'rpcinfo -b' on systems with tuntap devices (bnc#861577).
  Added: libtirpc-getbroadifs-crash.patch
* Fri Jan 10 2014 okir@suse.com
- taddr2uaddr would return trailing garbage for AF_LOCAL addresses (libtirpc-taddr2uaddr-local.patch)
* Thu Jan  9 2014 okir@suse.com
- Fix a segfault in clntunix_create (libtirpc-clntunix_create.patch)
- Fix misc segfaults in rpcb_* function (libtirpc-misc-segfaults.patch)
- Fix _PATH_RPCBSOCK to match rpcbind behavior under systemd
  (libtirpc-new-path-rpcbindsock.patch)
* Mon Dec  2 2013 nfbrown@suse.com
- Change BuildDepends from krb5-devel to krb5-mini-devel
  for those releases which provide it
  as the later is sufficient and has fewer down-stream
  dependencies.
* Wed Nov 13 2013 nfbrown@suse.com
- Use krb5 rather than gssglue to provide gss
  access routines.
  Both krb5 and gssglue provide routines of the same
  name, and both can get linked into rpc.gssd, resulting
  in some confusion.
  Upstream support seems to be leaning heavily towards
  avoiding libgssglue.  nfs-utils is built without it,
  and best to build libtirpc without it.
  (bnc#841788)
* Mon Aug 19 2013 okir@suse.com
- Updated to latest upstream revision, and removed
  libtirpc-revert-des_crypt.patch which is now upstream
- Verified that the bugfix for bnc#702472 is in upstream
- verified that SLE patches are present (bnc#831296)
* Mon Apr 15 2013 mmeister@suse.com
- Added url as source.
  Please see http://en.opensuse.org/SourceUrls
* Thu Dec  8 2011 cfarrell@suse.com
- license update: BSD-4-Clause
  Remove deprecated rpm license string. Use SPDX syntax. Highlight
  BSD-4-Clause (advertising clause) nature of package
* Wed Dec  7 2011 aj@suse.de
- Update license (bnc#735008).
* Wed Nov 30 2011 coolo@suse.com
- add libtool as buildrequire to avoid implicit dependency
* Fri Jul  8 2011 coolo@novell.com
- add baselibs.conf to allow pam-32bit to link against it
* Fri Jun 17 2011 aj@suse.de
- Fix library with reverting a patch in 0.22 release
  (libtirpc-revert-des_crypt.patch)
* Tue Jun 14 2011 aj@suse.de
- Update to libtirpc 0.22 which brings (compared to latest release):
  * various bugfixes
  * Replaces SISL files with BSD 3-clause
- Remove patch libtirpc-use-correct-source-addr-on-replies.patch
  since it's part of the 0.22 release.
* Tue Feb 22 2011 nfbrown@novell.com
- Use correct source address on replies [bnc#587934,bnc#587811]
- Prevent bindresvport from binding to blacklisted ports [bnc#579315]
* Sun Oct 31 2010 jengelh@medozas.de
- Use %%_smp_mflags
* Wed Sep 29 2010 max@novell.com
- Fix showmount -e hostname (bnc#633007).
* Wed Sep 15 2010 max@novell.com
- Fix interoperability of libtirpc with the old portmapper:
  * Add libtirpc-getpmaphandle.patch
  * Add libtirpc-pmap-setunset.patch
  * bnc#633007
* Thu May 27 2010 cristian.rodriguez@opensuse.org
- Update to a current git snapshot, important fixes:
  * don't call abort() in the AUTH_UNIX creation codepaths
  * Support 64-bit bit mask operations in svc_getreqset()
  * Automount with nis maps crashes and generates a core
  * memory leaks in rpcb_clnt.c:add_cache() and getclnthandle()
* Wed Dec 16 2009 ro@suse.de
- update to version 0.2.1 which integrates the fixes previously
  in single patches from git and works with current nfs-client
  recent changes include:
  - rpcb_getaddr: Handle only "udp" and "tcp" netids when using
    PMAP_GETPORT
  - rpcb_getaddr: Always do PMAP_GETPORT first for NC_INET
    transports
  - getnetconfig: Fix NC_BADFILE return from getnetconfigent(3t)
  - Added HAVE_LIBGSSAPI defines around gss code
    so the --disble-gss configure option would work
  - rpcb_clnt: RPC_PROGNOTREGISTERED is a permanent error
  - clnt_dg: Fix infinite loop when datagram call times out
* Fri Mar 13 2009 crrodriguez@suse.de
- fix -devel package dependencies
* Mon Nov 17 2008 mkoenig@suse.de
- Fix a bug in clnt broadcast and handle misformed rpcbind replies
  [bnc#436038]
* Wed Oct 22 2008 mrueckert@suse.de
- fix debug_packages_requires define
* Wed Oct  1 2008 mkoenig@suse.de
- add recent patches from git which fix some more bugs
  * fix __rpc_getconfip
  * fix getpeereid
  * svc_getcaller_netbuf macro seems broken
  * introduce __rpc_set_netbuf helper
  * kill map_ipv4_to_ipv6
  * Fix xp_raddr handling in svc_fd_create etc
  * fix for taddr2addr conversion bug of local addresses [bnc#426883]
* Tue Sep  2 2008 mkoenig@suse.de
- update to version 0.1.9
  * several bugfixes
- fix rpc_broadcast [bnc#421950]
- fix ipv4+ipv6 binding [bnc#421976]
- removed patches
  libtirpc-0.1.7-arm.patch
  libtirpc-0.1.7-bindresvport-ntohs.patch
  libtirpc-0.1.7-bindresvport_ports.patch
  libtirpc-0.1.7-bufoverflow.patch
  libtirpc-0.1.7-clnt_raw-mutex.patch
  libtirpc-0.1.7-dgcall-iprecverr.patch
  libtirpc-0.1.7-gssglue.patch
  libtirpc-0.1.7-libtirpc-pc.patch
  libtirpc-0.1.7-man-install.patch
  libtirpc-0.1.7-netconfig.patch
  libtirpc-0.1.7-ppc64.patch
  libtirpc-0.1.7-snprintf.patch
  libtirpc-0.1.7-svcauthdestroy.patch
  libtirpc-0.1.7-svc_auth_gss_lvalue_fix.patch
  libtirpc-0.1.7-svcauthnone.patch
  libtirpc-0.1.7-svc-rtaddr.patch
  libtirpc-0.1.7-svc-run.patch
  libtirpc-0.1.7-version.patch
  libtirpc-0.1.7-xdr_bufferoverlow.patch
* Fri Aug  1 2008 ro@suse.de
- fix requires for debuginfo package
* Wed Mar 19 2008 mkoenig@suse.de
- initial packaging, version 0.1.7 [fate#300607]
- apply some fixes/enhancements from Steve Dickson
- includes fix for CVE-2007-3999
- set shlib soname version initially to 1.0.7,
  keeping compatibility with RH
- fix some compiling issues