diff options
-rw-r--r-- | libcap/Makefile | 3 | ||||
-rw-r--r-- | packaging/baselibs.conf | 2 | ||||
-rw-r--r-- | packaging/libcap.manifest | 5 | ||||
-rw-r--r-- | packaging/libcap.spec | 76 | ||||
-rw-r--r-- | progs/Makefile | 3 |
5 files changed, 88 insertions, 1 deletions
diff --git a/libcap/Makefile b/libcap/Makefile index f5dde3e..423b646 100644 --- a/libcap/Makefile +++ b/libcap/Makefile @@ -96,7 +96,8 @@ $(GPERF_OUTPUT): cap_names.list.h cap_names.header Makefile UAPI_HEADER := $(topdir)/libcap/include/uapi/linux/capability.h cap_names.list.h: Makefile $(UAPI_HEADER) @echo "=> making $@ from $(UAPI_HEADER)" - $(BUILD_EGREP) '^#define\s+CAP_([^\s]+)\s+[0-9]+\s*$$' include/uapi/linux/capability.h | $(BUILD_SED) -e 's/^#define\s\+/{"/' -e 's/\s*$$/},/' -e 's/\s\+/",/' -e 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/' > $@ + #$(BUILD_EGREP) '^#define\s+CAP_([^\s]+)\s+[0-9]+\s*$$' include/uapi/linux/capability.h | $(BUILD_SED) -e 's/^#define\s\+/{"/' -e 's/\s*$$/},/' -e 's/\s\+/",/' -e 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/' > $@ + perl -e 'while ($$l=<>) { if ($$l =~ /^\#define[ \t](CAP[_A-Z]+)[ \t]+([0-9]+)\s+$$/) { $$tok=$$1; $$val=$$2; $$tok =~ tr/A-Z/a-z/; print "{\"$$tok\",$$val},\n"; } }' $(UAPI_HEADER) | fgrep -v 0x > $@ $(STACAPLIBNAME): $(CAPOBJS) $(AR) rcs $@ $^ diff --git a/packaging/baselibs.conf b/packaging/baselibs.conf new file mode 100644 index 0000000..0216ffb --- /dev/null +++ b/packaging/baselibs.conf @@ -0,0 +1,2 @@ +libcap + targetarch ia64 block! diff --git a/packaging/libcap.manifest b/packaging/libcap.manifest new file mode 100644 index 0000000..017d22d --- /dev/null +++ b/packaging/libcap.manifest @@ -0,0 +1,5 @@ +<manifest> + <request> + <domain name="_"/> + </request> +</manifest> diff --git a/packaging/libcap.spec b/packaging/libcap.spec new file mode 100644 index 0000000..e0a20bf --- /dev/null +++ b/packaging/libcap.spec @@ -0,0 +1,76 @@ +Name: libcap +Version: 2.69 +Release: 0 +License: BSD-3-Clause or GPL-2.0 +Summary: Library for Capabilities (linux-privs) Support +Url: https://sites.google.com/site/fullycapable/ +Group: Base/Libraries +Source: %{name}-%{version}.tar.xz +Source1001: libcap.manifest +BuildRequires: libattr-devel +BuildRequires: perl +BuildRequires: grep +Buildrequires: sed +%define debug_package_requires libcap2 = %{version}-%{release} + +%description +Capabilities are a measure to limit the omnipotence of the superuser. +Currently a program started by root or setuid root has the power to do +anything. Capabilities (Linux-Privs) provide a more fine-grained access +control. Without kernel patches, you can use this library to drop +capabilities within setuid binaries. If you use patches, this can be +done automatically by the kernel. + +%package devel +Summary: Development files for libcap +Requires: glibc-devel +Requires: libcap = %{version} + +%description devel +Development files (Headers, libraries for static linking, etc) for +libcap. + +libcap is a library for getting and setting POSIX.1e (formerly POSIX 6) +draft 15 capabilities. + +Install libcap-devel if you want to develop or compile applications +using libcap. + +%package tools +Summary: Libcap utility programs +Provides: %{name}-progs + +%description tools +This package contains utility programs handling capabilities via libcap. + +%prep +%setup -q +cp %{SOURCE1001} . + +%build +lib=%{_libdir} bin=%{_bindir} sbin=%{_sbindir} make %{?_smp_mflags} all + +%install +DESTDIR=${RPM_BUILD_ROOT} lib=%{_libdir} bin=%{_bindir} sbin=%{_sbindir} make install RAISE_SETFCAP=no +rm -f %{buildroot}/%{_libdir}/*.*a + +%post -p /sbin/ldconfig + +%postun -p /sbin/ldconfig + +%files +%manifest %{name}.manifest +%license License +%{_libdir}/lib*.so.* + +%files tools +%manifest %{name}.manifest +%license License +%{_sbindir}/* + +%files devel +%manifest %{name}.manifest +%{_includedir}/sys/*.h +%{_libdir}/lib*.so +%{_libdir}/pkgconfig/lib*.pc +%exclude %{_mandir} diff --git a/progs/Makefile b/progs/Makefile index 80f890a..bf2a411 100644 --- a/progs/Makefile +++ b/progs/Makefile @@ -28,6 +28,9 @@ DEPS = ../libcap/libcap.a endif endif +CFLAGS += -fPIE +LDFLAGS += -pie + ../libcap/libcap.a: $(MAKE) -C ../libcap libcap.a |