From b86f2aecd78befd7a9758046843257d767afa917 Mon Sep 17 00:00:00 2001 From: Karsten Hopp Date: Tue, 14 May 2013 11:54:08 +0200 Subject: [PATCH 1/3] add patch from Mark Wielaard to fix use of uninitialized memory in _fcaps_load, rhbz #911878 --- libcap-2.22-signed-sizeof-compare.patch | 21 +++++++++++++++++++++ libcap.spec | 8 +++++++- 2 files changed, 28 insertions(+), 1 deletion(-) create mode 100644 libcap-2.22-signed-sizeof-compare.patch diff --git a/libcap-2.22-signed-sizeof-compare.patch b/libcap-2.22-signed-sizeof-compare.patch new file mode 100644 index 0000000..4ada3fa --- /dev/null +++ b/libcap-2.22-signed-sizeof-compare.patch @@ -0,0 +1,21 @@ +diff -up libcap-2.22/libcap/cap_file.c.911878 libcap-2.22/libcap/cap_file.c +--- libcap-2.22/libcap/cap_file.c.911878 2013-05-14 11:45:25.569448468 +0200 ++++ libcap-2.22/libcap/cap_file.c 2013-05-14 11:47:04.712036407 +0200 +@@ -187,7 +187,7 @@ cap_t cap_get_fd(int fildes) + /* fill the capability sets via a system call */ + sizeofcaps = fgetxattr(fildes, XATTR_NAME_CAPS, + &rawvfscap, sizeof(rawvfscap)); +- if (sizeofcaps < sizeof(rawvfscap.magic_etc)) { ++ if (sizeofcaps < (int) sizeof(rawvfscap.magic_etc)) { + cap_free(result); + result = NULL; + } else { +@@ -217,7 +217,7 @@ cap_t cap_get_file(const char *filename) + /* fill the capability sets via a system call */ + sizeofcaps = getxattr(filename, XATTR_NAME_CAPS, + &rawvfscap, sizeof(rawvfscap)); +- if (sizeofcaps < sizeof(rawvfscap.magic_etc)) { ++ if (sizeofcaps < (int) sizeof(rawvfscap.magic_etc)) { + cap_free(result); + result = NULL; + } else { diff --git a/libcap.spec b/libcap.spec index d377c60..f5b1d03 100644 --- a/libcap.spec +++ b/libcap.spec @@ -1,8 +1,9 @@ Name: libcap Version: 2.22 -Release: 3%{?dist} +Release: 4%{?dist} Summary: Library for getting and setting POSIX.1e capabilities Source: http://www.kernel.org/pub/linux/libs/security/linux-privs/kernel-2.6/%{name}-%{version}.tar.bz2 +Patch0: libcap-2.22-signed-sizeof-compare.patch URL: http://ftp.kernel.org/pub/linux/libs/security/linux-privs/kernel-2.6/ License: LGPLv2+ @@ -30,6 +31,7 @@ libcap. %prep %setup -q +%patch0 -p1 %build # libcap can not be build with _smp_mflags: @@ -76,6 +78,10 @@ chmod +x ${RPM_BUILD_ROOT}/%{_lib}/*.so.* rm -rf ${RPM_BUILD_ROOT} %changelog +* Tue May 14 2013 Karsten Hopp 2.22-4 +- add patch from Mark Wielaard to fix use of uninitialized memory in _fcaps_load + rhbz #911878 + * Thu Jul 19 2012 Fedora Release Engineering - 2.22-3 - Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild From 889762dced2b3ed0f4a8ef847065bc6565970074 Mon Sep 17 00:00:00 2001 From: Karsten Hopp Date: Tue, 14 May 2013 13:58:09 +0200 Subject: [PATCH 2/3] add getpcaps man page --- getpcaps.8 | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 getpcaps.8 diff --git a/getpcaps.8 b/getpcaps.8 new file mode 100644 index 0000000..6bbf46a --- /dev/null +++ b/getpcaps.8 @@ -0,0 +1,23 @@ +.\" Hey, EMACS: -*- nroff -*- +.TH GETPCAPS 8 "2001-05-29" +.\" Please adjust this date whenever revising the manpage. +.SH NAME +getpcaps \- display process capabilities +.SH SYNOPSIS +.B getpcaps +.IR pid ... +.SH DESCRIPTION +.B getpcaps +displays the capabilities on the processes indicated by the +.I pid +value(s) given on the commandline. The capabilities +are displayed in the +.BR cap_from_text (3) +format. +.SH SEE ALSO +.BR execcap (8). +.br +.SH AUTHOR +This manual page was written by Robert Bihlmeyer , +for the Debian GNU/Linux system (but may be used by others). + From 092440402b0066e00c47e5b04597f2ac805ee782 Mon Sep 17 00:00:00 2001 From: Karsten Hopp Date: Tue, 14 May 2013 13:58:22 +0200 Subject: [PATCH 3/3] mv libraries to /usr/lib* add getpcaps man page spec file cleanup fix URL of tarball --- libcap.spec | 50 +++++++++++++++++++++++++++++--------------------- 1 file changed, 29 insertions(+), 21 deletions(-) diff --git a/libcap.spec b/libcap.spec index f5b1d03..d0d946e 100644 --- a/libcap.spec +++ b/libcap.spec @@ -1,14 +1,17 @@ Name: libcap Version: 2.22 -Release: 4%{?dist} +Release: 5%{?dist} Summary: Library for getting and setting POSIX.1e capabilities -Source: http://www.kernel.org/pub/linux/libs/security/linux-privs/kernel-2.6/%{name}-%{version}.tar.bz2 +# Original tarball should be here, but got deleted: +#Source: http://www.kernel.org/pub/linux/libs/security/linux-privs/kernel-2.6/libcap-2.22.tar.bz2 +Source: http://mirror.linux.org.au/linux/libs/security/linux-privs/libcap2/%{name}-%{version}.tar.bz2 +# http://manned.org/getpcaps/299a4949/src: +Source1: getpcaps.8 Patch0: libcap-2.22-signed-sizeof-compare.patch URL: http://ftp.kernel.org/pub/linux/libs/security/linux-privs/kernel-2.6/ License: LGPLv2+ Group: System Environment/Libraries -BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) BuildRequires: libattr-devel pam-devel %description @@ -35,49 +38,54 @@ libcap. %build # libcap can not be build with _smp_mflags: -make PREFIX=%{_prefix} LIBDIR=%{_lib} SBINDIR=%{_sbindir} \ - INCDIR=%{_includedir} MANDIR=%{_mandir} COPTFLAG="$RPM_OPT_FLAGS" +make PREFIX=%{_prefix} LIBDIR=%{_libdir} SBINDIR=%{_sbindir} \ + INCDIR=%{_includedir} MANDIR=%{_mandir} COPTFLAG="%{optflags}" %install -rm -rf ${RPM_BUILD_ROOT} make install RAISE_SETFCAP=no \ - DESTDIR=${RPM_BUILD_ROOT} \ - LIBDIR=${RPM_BUILD_ROOT}/%{_lib} \ - SBINDIR=${RPM_BUILD_ROOT}/%{_sbindir} \ - INCDIR=${RPM_BUILD_ROOT}/%{_includedir} \ - MANDIR=${RPM_BUILD_ROOT}/%{_mandir}/ \ - COPTFLAG="$RPM_OPT_FLAGS" -mkdir -p ${RPM_BUILD_ROOT}/%{_mandir}/man{2,3,8} -#mv -f doc/*.2 ${RPM_BUILD_ROOT}/%{_mandir}/man2/ -mv -f doc/*.3 ${RPM_BUILD_ROOT}/%{_mandir}/man3/ + DESTDIR=%{buildroot} \ + LIBDIR=%{buildroot}/%{_libdir} \ + SBINDIR=%{buildroot}/%{_sbindir} \ + INCDIR=%{buildroot}/%{_includedir} \ + MANDIR=%{buildroot}/%{_mandir}/ \ + COPTFLAG="%{optflags}" +mkdir -p %{buildroot}/%{_mandir}/man{2,3,8} +mv -f doc/*.3 %{buildroot}/%{_mandir}/man3/ +cp -f %{SOURCE1} %{buildroot}/%{_mandir}/man8/ # remove static lib -rm -f ${RPM_BUILD_ROOT}/%{_lib}/libcap.a +rm -f %{buildroot}/%{_libdir}/libcap.a -chmod +x ${RPM_BUILD_ROOT}/%{_lib}/*.so.* +chmod +x %{buildroot}/%{_libdir}/*.so.* %post -p /sbin/ldconfig %postun -p /sbin/ldconfig %files %defattr(-,root,root,-) -/%{_lib}/*.so.* +/%{_libdir}/*.so.* %{_sbindir}/* %{_mandir}/man1/* %{_mandir}/man8/* -/%{_lib}/security/pam_cap.so +/%{_libdir}/security/pam_cap.so %doc doc/capability.notes License %files devel %defattr(-,root,root,-) %{_includedir}/* -/%{_lib}/*.so +/%{_libdir}/*.so %{_mandir}/man3/* %clean -rm -rf ${RPM_BUILD_ROOT} +rm -rf %{buildroot} %changelog +* Tue May 14 2013 Karsten Hopp 2.22-5 +- mv libraries to /usr/lib* +- add getpcaps man page +- spec file cleanup +- fix URL of tarball + * Tue May 14 2013 Karsten Hopp 2.22-4 - add patch from Mark Wielaard to fix use of uninitialized memory in _fcaps_load rhbz #911878