Hello community,
here is the log from the commit of package libcap
checked in at Thu Aug 7 01:22:24 CEST 2008.
--------
--- libcap/libcap.changes 2008-08-04 00:57:19.000000000 +0200
+++ /mounts/work_src_done/STABLE/libcap/libcap.changes 2008-08-06 15:22:26.000000000 +0200
@@ -1,0 +2,9 @@
+Wed Aug 6 14:45:32 CEST 2008 - tiwai@suse.de
+
+- updated to libcap-2.11:
+ * makefile fixes, minor clean-ups
+ * fix cap_copy_int(), new cap_get_pid() and cap_compare()
+ * fix cap_copy_ext()
+- fix build with libcap-2.11.
+
+-------------------------------------------------------------------
Old:
----
libcap-2.10.tar.bz2
New:
----
libcap-2.11-build-fix.diff
libcap-2.11.tar.bz2
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ libcap.spec ++++++
--- /var/tmp/diff_new_pack.u18527/_old 2008-08-07 01:22:01.000000000 +0200
+++ /var/tmp/diff_new_pack.u18527/_new 2008-08-07 01:22:01.000000000 +0200
@@ -1,10 +1,17 @@
#
-# spec file for package libcap (Version 2.10)
+# spec file for package libcap (Version 2.11)
#
# Copyright (c) 2008 SUSE LINUX Products GmbH, Nuernberg, Germany.
-# This file and all modifications and additions to the pristine
-# package are under the same license as the package itself.
#
+# 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/
#
@@ -17,10 +24,11 @@
Group: System/Libraries
AutoReqProv: on
Summary: Library for Capabilities (linux-privs) Support
-Version: 2.10
-Release: 2
+Version: 2.11
+Release: 1
Source: ftp://ftp.de.kernel.org/pub/linux/libs/security/linux-privs/libcap2/libcap-%{version}.tar.bz2
Patch: libcap-dynamic-link.diff
+Patch1: libcap-2.11-build-fix.diff
#URL: http://www.kernel.org/
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%define debug_package_requires libcap2 = %{version}
@@ -82,12 +90,16 @@
%prep
%setup -q
%patch
+%patch1
%build
-lib=%{_lib} make %{?jobs:-j %jobs} LDFLAGS= COPTFLAG="$RPM_OPT_FLAGS"
+# lib=%{_lib} make %{?jobs:-j %jobs} COPTFLAG="$RPM_OPT_FLAGS"
+lib=%{_lib} make %{?jobs:-j %jobs} DEBUG="-g $RPM_OPT_FLAGS"
%install
make install DESTDIR=$RPM_BUILD_ROOT LIBDIR=$RPM_BUILD_ROOT/%{_lib} MANDIR=$RPM_BUILD_ROOT%{_mandir}
+# remove unneeded fi
+rm -f $RPM_BUILD_ROOT/%{_lib}/*.*a
# move *.so file to libdir and relink
rm -f $RPM_BUILD_ROOT/%{_lib}/*.so
mkdir -p $RPM_BUILD_ROOT%{_libdir}
@@ -104,7 +116,7 @@
%files progs
%defattr(-,root,root)
-%doc %{_mandir}/man8/*
+%{_mandir}/man8/*
/sbin/*
%files devel
@@ -112,9 +124,15 @@
%doc License README CHANGELOG
%{_includedir}/sys/capability.h
%{_libdir}/*.so
-%doc %{_mandir}/man?/*
+%{_mandir}/man3/*
%changelog
+* Wed Aug 06 2008 tiwai@suse.de
+- updated to libcap-2.11:
+ * makefile fixes, minor clean-ups
+ * fix cap_copy_int(), new cap_get_pid() and cap_compare()
+ * fix cap_copy_ext()
+- fix build with libcap-2.11.
* Mon Aug 04 2008 ro@suse.de
- fix requires for debuginfo package
* Wed Jun 11 2008 tiwai@suse.de
++++++ libcap-2.11-build-fix.diff ++++++
--- libcap/Makefile-dist 2008-08-06 14:56:15.000000000 +0200
+++ libcap/Makefile 2008-08-06 14:56:46.000000000 +0200
@@ -27,7 +27,7 @@
endif
_makenames: _makenames.c cap_names.sed
- $(BUILD_CC) $(BUILD_CFLAGS) $< -o $@
+ $(BUILD_CC) $(BUILD_CFLAGS) -Iinclude $< -o $@
cap_names.h: _makenames
./_makenames > cap_names.h
++++++ libcap-2.10.tar.bz2 -> libcap-2.11.tar.bz2 ++++++
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/libcap-2.10/contrib/bug400591/bug.c new/libcap-2.11/contrib/bug400591/bug.c
--- old/libcap-2.10/contrib/bug400591/bug.c 1970-01-01 01:00:00.000000000 +0100
+++ new/libcap-2.11/contrib/bug400591/bug.c 2008-07-10 08:18:40.000000000 +0200
@@ -0,0 +1,43 @@
+#include
+#include
+#include
+
+/*
+ * Original from http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=400591
+ *
+ * Modified to test more functions.. AGM - 2008/07/06.
+ */
+
+int main (int argc, char *argv[])
+{
+ cap_t caps, caps2;
+ ssize_t size, copy_size;
+ void *buffer;
+ char *text1, *text2;
+
+ assert((caps = cap_get_pid(1)));
+
+ text1 = cap_to_text(caps, NULL);
+ assert(text1);
+
+ size = cap_size (caps);
+ assert (size>0 && size<1024);
+
+ buffer = malloc (size);
+ assert (buffer);
+
+ copy_size = cap_copy_ext (buffer, caps, size);
+ assert (copy_size == size);
+
+ caps2 = cap_copy_int(buffer);
+ assert (caps2);
+
+ text2 = cap_to_text(caps2, NULL);
+ assert(text2);
+
+ assert(strcmp(text1, text2) == 0);
+
+ assert(cap_compare(caps, caps2) == 0);
+
+ return 0;
+}
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/libcap-2.10/contrib/bug400591/Makefile new/libcap-2.11/contrib/bug400591/Makefile
--- old/libcap-2.10/contrib/bug400591/Makefile 1970-01-01 01:00:00.000000000 +0100
+++ new/libcap-2.11/contrib/bug400591/Makefile 2008-07-10 08:18:40.000000000 +0200
@@ -0,0 +1,9 @@
+all: bug
+
+bug: bug.c ../../libcap Makefile
+ make -C ../../libcap
+ cc -g -I../../libcap/include --static -o $@ $< -L../../libcap -lcap
+ ./bug
+
+clean:
+ rm -f bug.o bug
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/libcap-2.10/contrib/Makefile new/libcap-2.11/contrib/Makefile
--- old/libcap-2.10/contrib/Makefile 1970-01-01 01:00:00.000000000 +0100
+++ new/libcap-2.11/contrib/Makefile 2008-07-10 08:18:40.000000000 +0200
@@ -0,0 +1,3 @@
+.PHONY: all clean
+all clean:
+ for x in bug* ; do make -C $$x $@ || exit 1 ; done
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/libcap-2.10/doc/cap_clear.3 new/libcap-2.11/doc/cap_clear.3
--- old/libcap-2.10/doc/cap_clear.3 2008-05-27 02:37:19.000000000 +0200
+++ new/libcap-2.11/doc/cap_clear.3 2008-07-10 08:18:40.000000000 +0200
@@ -1,6 +1,6 @@
.TH CAP_CLEAR 3 "2008-05-11" "" "Linux Programmer's Manual"
.SH NAME
-cap_clear, cap_get_flag, cap_set_flag \- capability data object manipulation
+cap_clear, cap_clear_flag, cap_get_flag, cap_set_flag, cap_compare \- capability data object manipulation
.SH SYNOPSIS
.nf
.B #include
@@ -16,6 +16,8 @@
.BI " const cap_value_t *" caps \
", cap_flag_value_t " value ");"
.sp
+.BI "int cap_compare(cap_t " cap_a ", cap_t " cap_b ");"
+.sp
Link with \fI-lcap\fP.
.fi
.SH DESCRIPTION
@@ -82,13 +84,33 @@
.IR ncap ,
is used to specify the number of capabilities in the array,
.IR caps .
+.PP
+.BR cap_compare ()
+compares two full capability sets and, in the spirit of
+.BR memcmp (),
+returns zero if the two capability sets are identical. A positive
+return value,
+.BR status ,
+indicates there is a difference between them. The
+returned value carries further information about which of three sets,
+.I cap_flag_t
+.BR flag ,
+differ. Specifically, the macro
+.B CAP_DIFFERS
+.RI ( status ", " flag )
+evaluates to 0 if the returned status differs in its
+.I flag
+components.
.SH "RETURN VALUE"
.BR cap_clear (),
.BR cap_clear_flag (),
.BR cap_get_flag ()
-and
.BR cap_set_flag ()
-return zero on success, and \-1 on failure.
+and
+.BR cap_compare ()
+return zero on success, and \-1 on failure. Other return values for
+.BR cap_compare ()
+are described above.
.PP
On failure,
.I errno
@@ -98,7 +120,9 @@
.SH "CONFORMING TO"
These functions are as per the withdrawn POSIX.1e draft specification.
.BR cap_clear_flag ()
-is a Linux extension.
+and
+.BR cap_compare ()
+are Linux extensions.
.SH "SEE ALSO"
.BR cap_copy_ext (3),
.BR cap_from_text (3),
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/libcap-2.10/doc/cap_compare.3 new/libcap-2.11/doc/cap_compare.3
--- old/libcap-2.10/doc/cap_compare.3 1970-01-01 01:00:00.000000000 +0100
+++ new/libcap-2.11/doc/cap_compare.3 2008-07-10 08:18:40.000000000 +0200
@@ -0,0 +1 @@
+.so man3/cap_clear.3
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/libcap-2.10/doc/cap_from_text.3 new/libcap-2.11/doc/cap_from_text.3
--- old/libcap-2.10/doc/cap_from_text.3 2008-05-27 02:37:19.000000000 +0200
+++ new/libcap-2.11/doc/cap_from_text.3 2008-07-10 08:18:40.000000000 +0200
@@ -224,6 +224,7 @@
.fi
.SH "SEE ALSO"
.BR cap_clear (3),
+.BR cap_compare (3),
.BR cap_copy_ext (3),
.BR cap_get_file (3),
.BR cap_get_proc (3),
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/libcap-2.10/libcap/cap_extint.c new/libcap-2.11/libcap/cap_extint.c
--- old/libcap-2.10/libcap/cap_extint.c 2008-01-22 01:16:58.000000000 +0100
+++ new/libcap-2.11/libcap/cap_extint.c 2008-07-10 08:18:40.000000000 +0200
@@ -9,7 +9,7 @@
/*
* External representation for capabilities. (exported as a fixed
- * length (void *))
+ * length)
*/
#define CAP_EXT_MAGIC "\220\302\001\121"
#define CAP_EXT_MAGIC_SIZE 4
@@ -18,8 +18,10 @@
struct cap_ext_struct {
__u8 magic[CAP_EXT_MAGIC_SIZE];
__u8 length_of_capset;
-/* note, we arrange these so the caps are stacked with byte-size
- resolution */
+ /*
+ * note, we arrange these so the caps are stacked with byte-size
+ * resolution
+ */
__u8 bytes[CAP_SET_SIZE][NUMBER_OF_CAP_SETS];
};
@@ -77,11 +79,6 @@
* the internal rep should be liberated with cap_free().
*/
-/*
- * XXX - need to take a little more care when importing small
- * capability sets.
- */
-
cap_t cap_copy_int(const void *cap_ext)
{
const struct cap_ext_struct *export =
@@ -90,8 +87,8 @@
int set, blen;
/* Does the external representation make sense? */
- if (export == NULL || !memcmp(export->magic, external_magic
- , CAP_EXT_MAGIC_SIZE)) {
+ if ((export == NULL)
+ || memcmp(export->magic, external_magic, CAP_EXT_MAGIC_SIZE)) {
errno = EINVAL;
return NULL;
}
@@ -101,7 +98,7 @@
return NULL;
blen = export->length_of_capset;
- for (set=0; set<=NUMBER_OF_CAP_SETS; ++set) {
+ for (set=0; set
-#include
+#include
#include
#include
#include
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/libcap-2.10/libcap/cap_flag.c new/libcap-2.11/libcap/cap_flag.c
--- old/libcap-2.10/libcap/cap_flag.c 2008-05-27 02:37:19.000000000 +0200
+++ new/libcap-2.11/libcap/cap_flag.c 2008-07-10 08:18:40.000000000 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997-8 Andrew G. Morgan
+ * Copyright (c) 1997-8,2008 Andrew G. Morgan
*
* This file deals with flipping of capabilities on internal
* capability sets as specified by POSIX.1e (formerlly, POSIX 6).
@@ -122,3 +122,29 @@
}
}
+/*
+ * Compare two capability sets
+ */
+
+int cap_compare(cap_t a, cap_t b)
+{
+ unsigned i;
+ int result;
+
+ if (!(good_cap_t(a) && good_cap_t(b))) {
+ _cap_debug("invalid arguments");
+ errno = EINVAL;
+ return -1;
+ }
+
+ for (i=0, result=0; i<_LIBCAP_CAPABILITY_U32S; i++) {
+ result |=
+ ((a->u[i].flat[CAP_EFFECTIVE] != b->u[i].flat[CAP_EFFECTIVE])
+ ? LIBCAP_EFF : 0)
+ | ((a->u[i].flat[CAP_INHERITABLE] != b->u[i].flat[CAP_INHERITABLE])
+ ? LIBCAP_INH : 0)
+ | ((a->u[i].flat[CAP_PERMITTED] != b->u[i].flat[CAP_PERMITTED])
+ ? LIBCAP_PER : 0);
+ }
+ return result;
+}
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/libcap-2.10/libcap/cap_proc.c new/libcap-2.11/libcap/cap_proc.c
--- old/libcap-2.10/libcap/cap_proc.c 2008-05-27 02:37:19.000000000 +0200
+++ new/libcap-2.11/libcap/cap_proc.c 2008-07-10 08:18:40.000000000 +0200
@@ -62,6 +62,27 @@
return error;
}
+/* allocate space for and return capabilities of target process */
+
+cap_t cap_get_pid(pid_t pid)
+{
+ cap_t result;
+
+ result = cap_init();
+ if (result) {
+ if (capgetp(pid, result) != 0) {
+ int my_errno;
+
+ my_errno = errno;
+ cap_free(result);
+ errno = my_errno;
+ result = NULL;
+ }
+ }
+
+ return result;
+}
+
/* set the caps on a specific process/pg etc.. */
int capsetp(pid_t pid, cap_t cap_d)
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/libcap-2.10/libcap/cap_text.c new/libcap-2.11/libcap/cap_text.c
--- old/libcap-2.10/libcap/cap_text.c 2008-05-27 02:37:19.000000000 +0200
+++ new/libcap-2.11/libcap/cap_text.c 2008-07-10 08:18:40.000000000 +0200
@@ -23,10 +23,6 @@
/* Maximum output text length (16 per cap) */
#define CAP_TEXT_SIZE (16*__CAP_MAXBITS)
-#define LIBCAP_EFF 01
-#define LIBCAP_INH 02
-#define LIBCAP_PER 04
-
/*
* Parse a textual representation of capabilities, returning an internal
* representation.
@@ -406,13 +402,21 @@
memset(histo, 0, sizeof(histo));
- for (n = cap_maxbits; n--; )
+ /* default prevailing state to the upper - unnamed bits */
+ for (n = cap_maxbits-1; n > __CAP_BITS; n--)
histo[getstateflags(caps, n)]++;
+ /* find which combination of capability sets shares the most bits */
for (m=t=7; t--; )
if (histo[t] > histo[m])
m = t;
+ /* capture remaining bits - selecting m from only the unnamed bits,
+ we maximize the likelihood that we won't see numeric capability
+ values in the text output. */
+ while (n--)
+ histo[getstateflags(caps, n)]++;
+
/* blank is not a valid capability set */
p = sprintf(buf, "=%s%s%s",
(m & LIBCAP_EFF) ? "e" : "",
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/libcap-2.10/libcap/include/linux/capability.h new/libcap-2.11/libcap/include/linux/capability.h
--- old/libcap-2.10/libcap/include/linux/capability.h 2008-05-27 02:37:19.000000000 +0200
+++ new/libcap-2.11/libcap/include/linux/capability.h 2008-07-10 08:18:40.000000000 +0200
@@ -31,7 +31,7 @@
#define _LINUX_CAPABILITY_VERSION_1 0x19980330
#define _LINUX_CAPABILITY_U32S_1 1
-#define _LINUX_CAPABILITY_VERSION_2 0x20071026 /* depreciated - use v3 */
+#define _LINUX_CAPABILITY_VERSION_2 0x20071026 /* deprecated - use v3 */
#define _LINUX_CAPABILITY_U32S_2 2
#define _LINUX_CAPABILITY_VERSION_3 0x20080522
@@ -501,6 +501,8 @@
extern const kernel_cap_t __cap_full_set;
extern const kernel_cap_t __cap_init_eff_set;
+kernel_cap_t cap_set_effective(const kernel_cap_t pE_new);
+
int capable(int cap);
int __capable(struct task_struct *t, int cap);
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/libcap-2.10/libcap/include/sys/capability.h new/libcap-2.11/libcap/include/sys/capability.h
--- old/libcap-2.10/libcap/include/sys/capability.h 2008-05-01 04:18:10.000000000 +0200
+++ new/libcap-2.11/libcap/include/sys/capability.h 2008-07-10 08:18:40.000000000 +0200
@@ -95,6 +95,7 @@
/* libcap/cap_proc.c */
extern cap_t cap_get_proc(void);
+extern cap_t cap_get_pid(pid_t);
extern int cap_set_proc(cap_t);
/* libcap/cap_extint.c */
@@ -108,9 +109,17 @@
extern int cap_from_name(const char *, cap_value_t *);
extern char * cap_to_name(cap_value_t);
+#define CAP_DIFFERS(result, flag) (((result) & (1 << (flag))) != 0)
+extern int cap_compare(cap_t, cap_t);
+
+/* system calls - look to libc for function to system call mapping */
extern int capset(cap_user_header_t header, cap_user_data_t data);
extern int capget(cap_user_header_t header, const cap_user_data_t data);
+
+/* deprecated - use cap_get_pid() */
extern int capgetp(pid_t pid, cap_t cap_d);
+
+/* not valid with filesystem capability support - use cap_set_proc() */
extern int capsetp(pid_t pid, cap_t cap_d);
#ifdef __cplusplus
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/libcap-2.10/libcap/libcap.h new/libcap-2.11/libcap/libcap.h
--- old/libcap-2.10/libcap/libcap.h 2008-05-27 02:37:19.000000000 +0200
+++ new/libcap-2.11/libcap/libcap.h 2008-07-10 08:18:40.000000000 +0200
@@ -142,6 +142,13 @@
#define good_cap_string(c) __libcap_check_magic(c, CAP_S_MAGIC)
/*
+ * These match CAP_DIFFERS() expectations
+ */
+#define LIBCAP_EFF (1 << CAP_EFFECTIVE)
+#define LIBCAP_INH (1 << CAP_INHERITABLE)
+#define LIBCAP_PER (1 << CAP_PERMITTED)
+
+/*
* library debugging
*/
#ifdef DEBUG
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/libcap-2.10/libcap/Makefile new/libcap-2.11/libcap/Makefile
--- old/libcap-2.10/libcap/Makefile 2008-02-23 18:46:57.000000000 +0100
+++ new/libcap-2.11/libcap/Makefile 2008-07-10 08:18:40.000000000 +0200
@@ -17,7 +17,7 @@
MAJLIBNAME=$(LIBNAME).$(VERSION)
MINLIBNAME=$(MAJLIBNAME).$(MINOR)
GPERF_OUTPUT = _caps_output.gperf
-LDFLAGS+=-lattr
+LDFLAGS += -lattr
all: $(MINLIBNAME) $(STALIBNAME)
@@ -27,7 +27,7 @@
endif
_makenames: _makenames.c cap_names.sed
- $(CC) $(CFLAGS) $< -o $@
+ $(BUILD_CC) $(BUILD_CFLAGS) $< -o $@
cap_names.h: _makenames
./_makenames > cap_names.h
@@ -40,11 +40,11 @@
@sed -ne '/^#define[ \t]CAP[_A-Z]\+[ \t]\+[0-9]\+/{s/^#define \([^ \t]*\)[ \t]*\([^ \t]*\)/\{\"\1\",\2\},/;y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/;p;}' < $(KERNEL_HEADERS)/linux/capability.h | fgrep -v 0x > $@
$(STALIBNAME): $(OBJS)
- $(AR) rcs $(STALIBNAME) $(OBJS)
- $(RANLIB) $(STALIBNAME)
+ $(AR) rcs $@ $^
+ $(RANLIB) $@
$(MINLIBNAME): $(OBJS)
- $(LD) $(LDFLAGS) $(COPTFLAG) -Wl,-soname,$(MAJLIBNAME) -o $@ $(OBJS)
+ $(LD) $(CFLAGS) $(LDFLAGS) -Wl,-soname,$(MAJLIBNAME) -o $@ $^
ln -sf $(MINLIBNAME) $(MAJLIBNAME)
ln -sf $(MAJLIBNAME) $(LIBNAME)
@@ -58,7 +58,7 @@
mkdir -p -m 0755 $(INCDIR)/sys
install -m 0644 include/sys/capability.h $(INCDIR)/sys
mkdir -p -m 0755 $(LIBDIR)
- install -m 0644 $(STALIBNAME) $(LIBDIR)/$(MINLIBNAME)
+ install -m 0644 $(STALIBNAME) $(LIBDIR)/$(STALIBNAME)
install -m 0644 $(MINLIBNAME) $(LIBDIR)/$(MINLIBNAME)
ln -sf $(MINLIBNAME) $(LIBDIR)/$(MAJLIBNAME)
ln -sf $(MAJLIBNAME) $(LIBDIR)/$(LIBNAME)
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/libcap-2.10/Makefile new/libcap-2.11/Makefile
--- old/libcap-2.10/Makefile 2008-01-22 01:16:58.000000000 +0100
+++ new/libcap-2.11/Makefile 2008-07-10 08:18:40.000000000 +0200
@@ -9,12 +9,12 @@
#
all install clean: %: %-here
- $(MAKE) -C libcap $(MAKE_DEFS) $@
+ $(MAKE) -C libcap $@
ifneq ($(PAM_CAP),no)
- $(MAKE) -C pam_cap $(MAKE_DEFS) $@
+ $(MAKE) -C pam_cap $@
endif
- $(MAKE) -C progs $(MAKE_DEFS) $@
- $(MAKE) -C doc $(MAKE_DEFS) $@
+ $(MAKE) -C progs $@
+ $(MAKE) -C doc $@
all-here:
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/libcap-2.10/Make.Rules new/libcap-2.11/Make.Rules
--- old/libcap-2.10/Make.Rules 2008-05-27 02:38:43.000000000 +0200
+++ new/libcap-2.11/Make.Rules 2008-07-10 08:22:22.000000000 +0200
@@ -37,39 +37,33 @@
# common defines for libcap
LIBTITLE=libcap
VERSION=2
-MINOR=10
+MINOR=11
#
# Compilation specifics
-CC ?= gcc
-AR ?= ar
-RANLIB ?= ranlib
-COPTFLAGS=-O2
-DEBUG=-O2 -g #-DDEBUG
+CC := gcc
+CFLAGS := -O2
+BUILD_CC := $(CC)
+BUILD_CFLAGS := $(CFLAGS)
+AR := ar
+RANLIB := ranlib
+DEBUG = -g #-DDEBUG
WARNINGS=-fPIC -Wall -Wwrite-strings \
-Wpointer-arith -Wcast-qual -Wcast-align \
-Wstrict-prototypes -Wmissing-prototypes \
-Wnested-externs -Winline -Wshadow
LD=$(CC) -Wl,-x -shared
-LDFLAGS=#-g
+LDFLAGS := #-g
-KERNEL_HEADERS = $(topdir)/libcap/include
+KERNEL_HEADERS := $(topdir)/libcap/include
SYSTEM_HEADERS = /usr/include
IPATH += -I$(topdir)/libcap/include -I$(KERNEL_HEADERS)
INCS=$(topdir)/libcap/include/sys/capability.h
-LIBS=-L$(topdir)/libcap -lcap
-CFLAGS=-Dlinux $(WARNINGS) $(DEBUG) $(COPTFLAG) $(IPATH)
-PAM_CAP ?= $(shell if [ -f /usr/include/security/pam_modules.h ]; then echo yes ; else echo no ; fi)
+LDFLAGS += -L$(topdir)/libcap
+CFLAGS += -Dlinux $(WARNINGS) $(DEBUG) $(IPATH)
+PAM_CAP := $(shell if [ -f /usr/include/security/pam_modules.h ]; then echo yes ; else echo no ; fi)
# Global cleanup stuff
LOCALCLEAN=rm -f *~ core
DISTCLEAN=@find . \( -name '*.orig' -o -name '*.rej' \) | xargs rm -f
-
-# Flags to pass down recursive makes
-
-MAKE_DEFS = CC='$(CC)' CFLAGS='$(CFLAGS)' \
- LD='$(LD)' LIBS='$(LIBS)' LDFLAGS='$(LDFLAGS)' \
- VERSION='$(VERSION)' MINOR='$(MINOR)' \
- LIBDIR='$(LIBDIR)' INCDIR='$(INCDIR)' \
- SBINDIR='$(SBINDIR)' MANDIR='$(MANDIR)'
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/libcap-2.10/pam_cap/Makefile new/libcap-2.11/pam_cap/Makefile
--- old/libcap-2.10/pam_cap/Makefile 2008-05-01 04:18:10.000000000 +0200
+++ new/libcap-2.11/pam_cap/Makefile 2008-07-10 08:18:40.000000000 +0200
@@ -3,6 +3,9 @@
topdir=$(shell pwd)/..
include ../Make.Rules
+LDLIBS += -lcap
+CFLAGS += -fPIC
+
all: pam_cap.so
$(MAKE) testcompile
@@ -11,13 +14,13 @@
install -m 0755 pam_cap.so $(LIBDIR)/security
pam_cap.so: pam_cap.o
- $(LD) -o pam_cap.so $< $(LIBS)
+ $(LD) $(CFLAGS) -o pam_cap.so $< $(LDLIBS)
pam_cap.o: pam_cap.c
$(CC) $(CFLAGS) -c $< -o $@
testcompile: test.c pam_cap.o
- $(CC) $(CFLAGS) -o $@ $+ -lpam -ldl $(LIBS)
+ $(CC) $(CFLAGS) -o $@ $+ -lpam -ldl $(LDLIBS)
clean:
rm -f *.o *.so testcompile *~
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/libcap-2.10/progs/getpcaps.c new/libcap-2.11/progs/getpcaps.c
--- old/libcap-2.10/progs/getpcaps.c 2008-01-22 01:16:58.000000000 +0100
+++ new/libcap-2.11/progs/getpcaps.c 2008-07-10 08:18:40.000000000 +0200
@@ -1,9 +1,7 @@
/*
- * $Id: getpcaps.c,v 1.2 1999/11/18 06:04:25 morgan Exp $
+ * Copyright (c) 1997,2008 Andrew G. Morgan
*
- * Copyright (c) 1997 Andrew G. Morgan
- *
- * This displays the capabilities of a given process.
+ * This displays the capabilities of given target process(es).
*/
#include
@@ -11,7 +9,6 @@
#include
#include
#include
-#undef _POSIX_SOURCE
#include
static void usage(void)
@@ -28,28 +25,22 @@
int main(int argc, char **argv)
{
int retval = 0;
- cap_t cap_d;
if (argc < 2) {
usage();
}
- cap_d = cap_init();
for ( ++argv; --argc > 0; ++argv ) {
ssize_t length;
int pid;
-
- if (cap_d == NULL) {
- fprintf(stderr, "Failed to make a blank capability set\n"
- " (%s)\n", strerror(errno));
- exit(1);
- }
+ cap_t cap_d;
pid = atoi(argv[0]);
- /* this is a non-POSIX function */
- if (capgetp(pid, cap_d)) {
+
+ cap_d = cap_get_pid(pid);
+ if (cap_d == NULL) {
fprintf(stderr, "Failed to get cap's for proccess %d:"
- " (%s) - need new libcap?\n", pid, strerror(errno));
+ " (%s)\n", pid, strerror(errno));
retval = 1;
continue;
} else {
@@ -57,6 +48,7 @@
fprintf(stderr, "Capabilities for `%s': %s\n", *argv, result);
cap_free(result);
result = NULL;
+ cap_free(cap_d);
}
}
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/libcap-2.10/progs/Makefile new/libcap-2.11/progs/Makefile
--- old/libcap-2.10/progs/Makefile 2008-03-06 07:59:43.000000000 +0100
+++ new/libcap-2.11/progs/Makefile 2008-07-10 08:18:40.000000000 +0200
@@ -6,10 +6,13 @@
#
PROGS=getpcaps getcap setcap capsh
+LDFLAGS += --static
+LDLIBS += -lcap
+
all: $(PROGS)
$(PROGS): %: %.o
- $(CC) --static $(COPTFLAG) $(LDFLAGS) -o $@ $< $(LIBS)
+ $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< $(LDLIBS)
%.o: %.c $(INCS)
$(CC) $(CFLAGS) -c $< -o $@
++++++ libcap-dynamic-link.diff ++++++
--- /var/tmp/diff_new_pack.u18527/_old 2008-08-07 01:22:01.000000000 +0200
+++ /var/tmp/diff_new_pack.u18527/_new 2008-08-07 01:22:01.000000000 +0200
@@ -1,11 +1,11 @@
---- progs/Makefile-dist 2008-04-23 15:28:10.000000000 +0200
-+++ progs/Makefile 2008-04-23 15:28:24.000000000 +0200
-@@ -9,7 +9,7 @@
- all: $(PROGS)
+--- progs/Makefile-dist 2008-08-06 14:45:01.000000000 +0200
++++ progs/Makefile 2008-08-06 14:45:06.000000000 +0200
+@@ -6,7 +6,7 @@
+ #
+ PROGS=getpcaps getcap setcap capsh
- $(PROGS): %: %.o
-- $(CC) --static $(COPTFLAG) $(LDFLAGS) -o $@ $< $(LIBS)
-+ $(CC) $(COPTFLAG) $(LDFLAGS) -o $@ $< $(LIBS)
+-LDFLAGS += --static
++# LDFLAGS += --static
+ LDLIBS += -lcap
- %.o: %.c $(INCS)
- $(CC) $(CFLAGS) -c $< -o $@
+ all: $(PROGS)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Remember to have fun...
---------------------------------------------------------------------
To unsubscribe, e-mail: opensuse-commit+unsubscribe@opensuse.org
For additional commands, e-mail: opensuse-commit+help@opensuse.org