SHA256
3
0
forked from pool/libcap
OBS User unknown 2006-12-19 22:24:01 +00:00 committed by Git OBS Bridge
commit bc083380dc
15 changed files with 616 additions and 0 deletions

23
.gitattributes vendored Normal file
View File

@ -0,0 +1,23 @@
## Default LFS
*.7z filter=lfs diff=lfs merge=lfs -text
*.bsp filter=lfs diff=lfs merge=lfs -text
*.bz2 filter=lfs diff=lfs merge=lfs -text
*.gem filter=lfs diff=lfs merge=lfs -text
*.gz filter=lfs diff=lfs merge=lfs -text
*.jar filter=lfs diff=lfs merge=lfs -text
*.lz filter=lfs diff=lfs merge=lfs -text
*.lzma filter=lfs diff=lfs merge=lfs -text
*.obscpio filter=lfs diff=lfs merge=lfs -text
*.oxt filter=lfs diff=lfs merge=lfs -text
*.pdf filter=lfs diff=lfs merge=lfs -text
*.png filter=lfs diff=lfs merge=lfs -text
*.rpm filter=lfs diff=lfs merge=lfs -text
*.tbz filter=lfs diff=lfs merge=lfs -text
*.tbz2 filter=lfs diff=lfs merge=lfs -text
*.tgz filter=lfs diff=lfs merge=lfs -text
*.ttf filter=lfs diff=lfs merge=lfs -text
*.txz filter=lfs diff=lfs merge=lfs -text
*.whl filter=lfs diff=lfs merge=lfs -text
*.xz filter=lfs diff=lfs merge=lfs -text
*.zip filter=lfs diff=lfs merge=lfs -text
*.zst filter=lfs diff=lfs merge=lfs -text

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
.osc

18
README Normal file
View File

@ -0,0 +1,18 @@
The code to be found here is all stuff intended to be integrated with
2.3.
Currently, its a patch in progress against 2.2
You can get a copy of the defunct POSIX draft specification for
capabilities and some other interesting things here:
http://www.guug.de/~winni/posix.1e/download.html
If you are looking for ACL patches for kernels, take a look here:
http://aerobee.informatik.uni-bremen.de/acl_download.html
Cheers
Andrew

3
capfaq-0.2.txt.gz Normal file
View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:7c867ee8708872be2f18dc324ba730c3d3a3a9abc90152f0c74dc1baeb257ad2
size 4566

11
header.patch Normal file
View File

@ -0,0 +1,11 @@
--- libcap/_makenames.c-dist 1999-05-14 06:46:15.000000000 +0200
+++ libcap/_makenames.c 2006-12-19 17:56:11.000000000 +0100
@@ -9,7 +9,7 @@
#include <stdio.h>
#include <stdlib.h>
-#include <linux/capability.h>
+#include "include/sys/capability.h"
/*
* #include 'sed' generated array

104
libcap-1.10.diff Normal file
View File

@ -0,0 +1,104 @@
--- Make.Rules-dist 1999-11-18 07:06:02.000000000 +0100
+++ Make.Rules 2006-12-19 18:18:57.000000000 +0100
@@ -14,17 +14,21 @@
# Otherwise binaries and libraraies are installed in /{lib,sbin}/,
# header files in /usr/include/ and documentation in /usr/man/man?/.
+ifndef lib
+lib=lib
+endif
+
ifdef prefix
exec_prefix=$(prefix)
lib_prefix=$(exec_prefix)
inc_prefix=$(lib_prefix)
-man_prefix=$(prefix)
+man_prefix=$(prefix)/share
else
prefix=/usr
exec_prefix=
lib_prefix=$(exec_prefix)
inc_prefix=$(prefix)
-man_prefix=$(prefix)
+man_prefix=$(prefix)/share
endif
# Target directories
@@ -32,7 +36,7 @@
MANDIR=$(FAKEROOT)$(man_prefix)/man
SBINDIR=$(FAKEROOT)$(exec_prefix)/sbin
INCDIR=$(FAKEROOT)$(inc_prefix)/include
-LIBDIR=$(FAKEROOT)$(lib_prefix)/lib
+LIBDIR=$(FAKEROOT)$(lib_prefix)/$(lib)
# common defines for libcap (suitable for 2.2.1+ Linux kernels)
VERSION=1
@@ -43,11 +47,11 @@
CC=gcc
COPTFLAGS=-O2
-DEBUG=-g #-DDEBUG
-WARNINGS=-ansi -D_POSIX_SOURCE -Wall -Wwrite-strings \
+DEBUG=-O2 -g #-DDEBUG
+WARNINGS=-D_POSIX_SOURCE -Wall -Wwrite-strings \
-Wpointer-arith -Wcast-qual -Wcast-align \
- -Wtraditional -Wstrict-prototypes -Wmissing-prototypes \
- -Wnested-externs -Winline -Wshadow -pedantic
+ -Wstrict-prototypes -Wmissing-prototypes \
+ -Wnested-externs -Winline -Wshadow
LD=ld
LDFLAGS=-s #-g
--- libcap/Makefile-dist 1999-04-18 00:16:31.000000000 +0200
+++ libcap/Makefile 2006-12-19 18:18:44.000000000 +0100
@@ -32,7 +32,7 @@
LIBNAME=libcap.so
#
-FILES=cap_alloc cap_proc cap_extint cap_flag cap_text cap_sys
+FILES=cap_alloc cap_proc cap_extint cap_flag cap_text cap_sys #cap_sys2
# for later when there is filesystem support for cap's:
#FILES += cap_file
@@ -63,6 +63,9 @@
%.o: %.c $(INCLS)
$(CC) $(CFLAGS) -c $< -o $@
+cap_sys2.o: cap_sys2.c $(INCLS)
+ $(CC) -Wall -O2 -c $< -o $@
+
install: all
mkdir -p -m 0755 $(INCDIR)/sys
install -m 0644 include/sys/capability.h $(INCDIR)/sys
--- libcap/cap_sys.c-dist 1999-04-18 00:16:31.000000000 +0200
+++ libcap/cap_sys.c 2006-12-19 18:18:44.000000000 +0100
@@ -11,6 +11,8 @@
#define __LIBRARY__
#include <linux/unistd.h>
+
+#if 0
_syscall2(int, capget,
cap_user_header_t, header,
cap_user_data_t, data)
@@ -18,6 +20,7 @@ _syscall2(int, capget,
_syscall2(int, capset,
cap_user_header_t, header,
const cap_user_data_t, data)
+#endif
/*
* $Log: cap_sys.c,v $
--- libcap/cap_sys2.c-dist 2006-12-19 18:18:44.000000000 +0100
+++ libcap/cap_sys2.c 2006-12-19 18:18:44.000000000 +0100
@@ -0,0 +1,10 @@
+#include <linux/unistd.h>
+#include <linux/capability.h>
+
+_syscall2(int, capget,
+ cap_user_header_t, header,
+ cap_user_data_t, data)
+
+_syscall2(int, capset,
+ cap_user_header_t, header,
+ const cap_user_data_t, data)

3
libcap-1.10.tar.bz2 Normal file
View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:66c3f033fdc8f9ba0bd9d0ae2d1f2c11f9fa51bf0d1418e5cb75e29e6577a5bc
size 26686

View File

@ -0,0 +1,61 @@
--- progs/execcap.c-dist 1999-04-18 00:16:31.000000000 +0200
+++ progs/execcap.c 2006-12-19 18:21:22.000000000 +0100
@@ -13,6 +13,7 @@
#include <sys/capability.h>
#include <unistd.h>
#include <string.h>
+#include <stdlib.h>
static void usage(void)
{
@@ -28,7 +29,7 @@ static void usage(void)
exit(1);
}
-void main(int argc, char **argv)
+int main(int argc, char **argv)
{
cap_t new_caps;
@@ -62,4 +63,5 @@ void main(int argc, char **argv)
fprintf(stderr, "Unable to execute command: %s\n", strerror(errno));
usage();
+ return 0;
}
--- progs/sucap.c-dist 1999-04-18 00:16:31.000000000 +0200
+++ progs/sucap.c 2006-12-19 18:21:22.000000000 +0100
@@ -48,7 +48,7 @@ wait_on_fd(int fd)
}
-void main(int argc, char **argv)
+int main(int argc, char **argv)
{
cap_t old_caps;
uid_t uid;
@@ -193,4 +193,5 @@ void main(int argc, char **argv)
/* exit to signal mother process that we are ready */
_exit(0);
}
+ return 0;
}
--- libcap/cap_extint.c-dist 1999-04-18 00:16:31.000000000 +0200
+++ libcap/cap_extint.c 2006-12-19 18:21:22.000000000 +0100
@@ -91,7 +91,7 @@ cap_t cap_copy_int(const void *cap_ext)
(const struct cap_ext_struct *) cap_ext;
cap_t cap_d;
int set, blen;
- __u32 * to = (__u32 *) &cap_d->set;
+ __u32 * to;
/* Does the external representation make sense? */
if (export == NULL || !memcmp(export->magic, external_magic
@@ -104,6 +104,7 @@ cap_t cap_copy_int(const void *cap_ext)
if (!(cap_d = cap_init()))
return NULL;
+ to = (__u32 *) &cap_d->set;
blen = export->length_of_capset;
for (set=0; set<=NUMBER_OF_CAP_SETS; ++set) {
int blk;

View File

@ -0,0 +1,34 @@
--- progs/getpcaps.c-dist 1999-11-18 07:04:25.000000000 +0100
+++ progs/getpcaps.c 2006-12-19 17:51:31.000000000 +0100
@@ -52,9 +52,11 @@ int main(int argc, char **argv)
continue;
} else {
char *result = cap_to_text(cap_d, &length);
- fprintf(stderr, "Capabilities for `%s': %s\n", *argv, result);
- cap_free(result);
- result = NULL;
+ if (result) {
+ fprintf(stderr, "Capabilities for `%s': %s\n", *argv, result);
+ cap_free(result);
+ result = NULL;
+ }
}
}
--- progs/setpcaps.c-dist 1999-11-18 07:04:26.000000000 +0100
+++ progs/setpcaps.c 2006-12-19 17:51:57.000000000 +0100
@@ -100,9 +100,11 @@ int main(int argc, char **argv)
char *result;
result = cap_to_text(cap_d, &length);
- fprintf(stderr, "[caps set to:\n%s\n]\n", result);
- cap_free(result);
- result = NULL;
+ if (result) {
+ fprintf(stderr, "[caps set to:\n%s\n]\n", result);
+ cap_free(result);
+ result = NULL;
+ }
}
#endif

42
libcap-shlib-fix.diff Normal file
View File

@ -0,0 +1,42 @@
--- progs/Makefile-dist 1999-04-18 00:16:31.000000000 +0200
+++ progs/Makefile 2006-12-19 18:30:24.000000000 +0100
@@ -36,15 +36,15 @@
all: $(PROGS)
$(PROGS): %: %.o
- $(CC) $(LDFLAGS) -o $@ $< $(LIBS)
+ $(CC) $(COPTFLAG) $(LDFLAGS) -o $@ $< $(LIBS)
%.o: %.c $(INCS)
- $(CC) $(CFLAGS) -c $< -o $@
+ $(CC) $(COPTFLAG) $(CFLAGS) -c $< -o $@
install: all
mkdir -p -m 0755 $(SBINDIR)
for p in $(PROGS) ; do \
- install -s -m 0755 $$p $(SBINDIR) ; \
+ install -m 0755 $$p $(SBINDIR) ; \
done
clean:
--- libcap/Makefile-dist 2006-12-19 18:28:36.000000000 +0100
+++ libcap/Makefile 2006-12-19 18:30:53.000000000 +0100
@@ -56,15 +56,15 @@
# @sed -ne '/^#define[ \t]CAP[_A-Z]\+[ \t]\+[0-9]\+/{s/^#define CAP_\([^ \t]*\)[ \t]*\([^ \t]*\)/ \{ \2, \"\1\" \},/;y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/;p;}' < /usr/include/linux/capability.h | fgrep -v 0x > cap_names.sed
$(MINLIBNAME): $(OBJS)
- $(LD) -soname $(MAJLIBNAME) -x -shared -o $@ $(OBJS)
+ $(CC) $(COPTFLAG) -Wl,-soname,$(MAJLIBNAME) -shared -o $@ $(OBJS)
ln -sf $(MINLIBNAME) $(MAJLIBNAME)
ln -sf $(MAJLIBNAME) $(LIBNAME)
%.o: %.c $(INCLS)
- $(CC) $(CFLAGS) -c $< -o $@
+ $(CC) $(COPTFLAG) $(CFLAGS) -fpic -c $< -o $@
cap_sys2.o: cap_sys2.c $(INCLS)
- $(CC) -Wall -O2 -c $< -o $@
+ $(CC) $(COPTFLAG) $(CFLAGS) -fpic -c $< -o $@
install: all
mkdir -p -m 0755 $(INCDIR)/sys

121
libcap.changes Normal file
View File

@ -0,0 +1,121 @@
-------------------------------------------------------------------
Tue Dec 19 18:32:28 CET 2006 - tiwai@suse.de
- update to libcap-1.10 to support fscaps (#229722, FATE#301748)
-------------------------------------------------------------------
Wed May 24 16:56:48 CEST 2006 - schwab@suse.de
- Don't strip binaries.
-------------------------------------------------------------------
Thu May 11 15:27:18 CEST 2006 - tiwai@suse.de
- fix invalid calls of free() (#174561)
-------------------------------------------------------------------
Wed Jan 25 21:37:23 CET 2006 - mls@suse.de
- converted neededforbuild to BuildRequires
-------------------------------------------------------------------
Fri Aug 19 15:20:33 CEST 2005 - kukuk@suse.de
- Create -devel subpackage
-------------------------------------------------------------------
Thu Jun 23 09:49:59 CEST 2005 - meissner@suse.de
- use RPM_OPT_FLAGS.
-------------------------------------------------------------------
Wed May 25 11:48:42 CEST 2005 - tiwai@suse.de
- fixed memory leak (#85659)
-------------------------------------------------------------------
Wed Jan 19 17:43:49 CET 2005 - tiwai@suse.de
- fixed compile warnings with gcc-4.0.
-------------------------------------------------------------------
Thu Mar 25 14:06:21 CET 2004 - thomas@suse.de
- added EAL3 man-page patch
-------------------------------------------------------------------
Tue Jan 27 10:21:00 CET 2004 - kukuk@suse.de
- Remove capget.2/capset.2 from package (version from man-pages
is newer).
-------------------------------------------------------------------
Sun Jan 11 12:03:51 CET 2004 - adrian@suse.de
- add %run_ldconfig
-------------------------------------------------------------------
Mon Feb 24 17:45:38 CET 2003 - schwab@suse.de
- Don't include kernel headers, instead copy the contents here.
-------------------------------------------------------------------
Thu Feb 6 11:12:34 CET 2003 - garloff@suse.de
- Avoid inclusion of glibc's linux/fs.h (it's broken) [#23324].
- Use BuildRoot.
-------------------------------------------------------------------
Wed Nov 27 14:06:08 CET 2002 - coolo@suse.de
- link the library with the compiler so the depedencies
are tracked correctly (#21996)
-------------------------------------------------------------------
Tue Sep 17 17:34:28 CEST 2002 - ro@suse.de
- removed bogus self-provides
-------------------------------------------------------------------
Wed Sep 4 12:53:18 CEST 2002 - sf@suse.de
- fix biarch error (added patch to Make.Rules)
-------------------------------------------------------------------
Sun Aug 11 22:04:58 CEST 2002 - kukuk@suse.de
- Remove kernel-source from neededforbuild
-------------------------------------------------------------------
Sat Apr 20 15:41:55 MEST 2002 - garloff@suse.de
- Include capfaq-0.2.txt
- Disable syscall wrapper (capset/capget); it's defined in glibc.
-------------------------------------------------------------------
Sat Apr 20 11:12:42 MEST 2002 - garloff@suse.de
- Compile syscall wrapper without -fPIC
-------------------------------------------------------------------
Tue Apr 9 16:57:15 CEST 2002 - ro@suse.de
- apply gcc-3 fixes only for gcc-3
-------------------------------------------------------------------
Mon Mar 25 13:54:51 CET 2002 - stepan@suse.de
- remove -ansi, as it forbids inline. (gcc3)
- use -fpic for building libraries (gcc3)
-------------------------------------------------------------------
Wed Sep 5 23:45:54 CEST 2001 - ro@suse.de
- updated neededforbuild and updated specfile (man and doc relocation)
-------------------------------------------------------------------
Wed Sep 29 00:25:38 CEST 1999 - garloff@suse.de
- Initial check in of libcap.
- Kernel patches are provided within the docdir.

15
libcap.eal3.diff Normal file
View File

@ -0,0 +1,15 @@
diff -pruN libcap/libcap-1.92/doc/capget.2 libcap.eal3/libcap-1.92/doc/capget.2
--- libcap/libcap-1.92/doc/capget.2 1999-04-18 00:16:31.000000000 +0200
+++ libcap.eal3/libcap-1.92/doc/capget.2 2003-11-17 13:36:34.000000000 +0100
@@ -38,5 +38,9 @@ One of the arguments was invalid.
An attempt was made to add a capability to the Permitted set, or to set
a capability in the Effective or Inheritable sets that is not in the
Permitted set.
-
-
+.TP
+.SB EFAULT
+Various problems with user information.
+.TP
+.SB ESRCH
+No such process.

154
libcap.spec Normal file
View File

@ -0,0 +1,154 @@
#
# spec file for package libcap (Version 1.10)
#
# Copyright (c) 2006 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.
#
# Please submit bugfixes or comments via http://bugs.opensuse.org/
#
# norootforbuild
Name: libcap
License: BSD License and BSD-like
Group: System/Libraries
Autoreqprov: on
Summary: Library and Binaries for Capabilities (linux-privs) Support
Version: 1.10
Release: 1
Source: ftp://ftp.de.kernel.org/pub/linux/libs/security/linux-privs/old/kernel-2.4/libcap-1.10.tar.bz2
Source3: ftp://ftp.de.kernel.org/pub/linux/libs/security/linux-privs/kernel-2.4/uid-proc.patch
Source4: ftp://ftp.de.kernel.org/pub/linux/libs/security/linux-privs/old/kernel-2.4/README
Source5: ftp://ftp.de.kernel.org/pub/linux/libs/security/linux-privs/kernel-2.4/capfaq-0.2.txt.gz
Patch: libcap-%{version}.diff
# Patch1: gcc3.diff
Patch2: header.patch
Patch1: libcap-shlib-fix.diff
Patch3: libcap.eal3.diff
Patch4: libcap-gcc-warning-fixes.diff
Patch6: libcap-invalid-free-fix.diff
#URL: http://www.kernel.org/
#Prefix: /usr
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%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
Group: Development/Libraries/C and C++
Requires: glibc-devel %{name} = %{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.
%prep
%setup
%patch
%patch1
%patch2
%patch3 -p2
%patch4
%patch6
%build
lib=%{_lib} make LDFLAGS= COPTFLAG="$RPM_OPT_FLAGS"
%install
make install FAKEROOT=$RPM_BUILD_ROOT LIBDIR=$RPM_BUILD_ROOT/%{_lib} MANDIR=$RPM_BUILD_ROOT%{_mandir}
cp -p %SOURCE3 .
cp -p %SOURCE4 ./README.libcap
cp -p %SOURCE5 .
rm $RPM_BUILD_ROOT%{_mandir}/man2/{capget,capset}.2*
%post -p /sbin/ldconfig
%postun -p /sbin/ldconfig
%files
%defattr(-,root,root)
%doc License README CHANGELOG uid-proc.patch README.libcap capfaq-0.2.txt.gz
#%doc fcaps-2.2.9-990610.patch.bz2 fcap-module-990613.tar.bz2
%attr(755,root,root) /%{_lib}/libcap.so.*
/sbin/getpcaps
/sbin/setpcaps
/sbin/execcap
/sbin/sucap
%files devel
%defattr(-,root,root)
%dir %{_includedir}/sys
%{_includedir}/sys/capability.h
/%{_lib}/*.so
%{_mandir}/man3/*
%changelog -n libcap
* Tue Dec 19 2006 - tiwai@suse.de
- update to libcap-1.10 to support fscaps (#229722, FATE#301748)
* Wed May 24 2006 - schwab@suse.de
- Don't strip binaries.
* Thu May 11 2006 - tiwai@suse.de
- fix invalid calls of free() (#174561)
* Wed Jan 25 2006 - mls@suse.de
- converted neededforbuild to BuildRequires
* Fri Aug 19 2005 - kukuk@suse.de
- Create -devel subpackage
* Thu Jun 23 2005 - meissner@suse.de
- use RPM_OPT_FLAGS.
* Wed May 25 2005 - tiwai@suse.de
- fixed memory leak (#85659)
* Wed Jan 19 2005 - tiwai@suse.de
- fixed compile warnings with gcc-4.0.
* Thu Mar 25 2004 - thomas@suse.de
- added EAL3 man-page patch
* Tue Jan 27 2004 - kukuk@suse.de
- Remove capget.2/capset.2 from package (version from man-pages
is newer).
* Sun Jan 11 2004 - adrian@suse.de
- add %%run_ldconfig
* Mon Feb 24 2003 - schwab@suse.de
- Don't include kernel headers, instead copy the contents here.
* Thu Feb 06 2003 - garloff@suse.de
- Avoid inclusion of glibc's linux/fs.h (it's broken) [#23324].
- Use BuildRoot.
* Wed Nov 27 2002 - coolo@suse.de
- link the library with the compiler so the depedencies
are tracked correctly (#21996)
* Tue Sep 17 2002 - ro@suse.de
- removed bogus self-provides
* Wed Sep 04 2002 - sf@suse.de
- fix biarch error (added patch to Make.Rules)
* Sun Aug 11 2002 - kukuk@suse.de
- Remove kernel-source from neededforbuild
* Sat Apr 20 2002 - garloff@suse.de
- Include capfaq-0.2.txt
- Disable syscall wrapper (capset/capget); it's defined in glibc.
* Sat Apr 20 2002 - garloff@suse.de
- Compile syscall wrapper without -fPIC
* Tue Apr 09 2002 - ro@suse.de
- apply gcc-3 fixes only for gcc-3
* Mon Mar 25 2002 - stepan@suse.de
- remove -ansi, as it forbids inline. (gcc3)
- use -fpic for building libraries (gcc3)
* Wed Sep 05 2001 - ro@suse.de
- updated neededforbuild and updated specfile (man and doc relocation)
* Wed Sep 29 1999 - garloff@suse.de
- Initial check in of libcap.
- Kernel patches are provided within the docdir.

0
ready Normal file
View File

26
uid-proc.patch Normal file
View File

@ -0,0 +1,26 @@
diff -urN linux-2.2.1/fs/proc/inode.c linux-caps/fs/proc/inode.c
--- linux-2.2.1/fs/proc/inode.c Fri May 8 18:10:30 1998
+++ linux-caps/fs/proc/inode.c Sun Jan 31 00:02:05 1999
@@ -267,10 +267,19 @@
inode->u.generic_ip = (void *) de;
if (de) {
- if (de->mode) {
+ if (de->mode) { /* why conditional on non-zero mode? */
+ struct inode *sbi;
+
inode->i_mode = de->mode;
- inode->i_uid = de->uid;
- inode->i_gid = de->gid;
+
+ if ((ino != PROC_ROOT_INO)
+ && (sbi = sb->s_root->d_inode)) {
+ inode->i_uid = sbi->i_uid;
+ inode->i_gid = sbi->i_gid;
+ } else {
+ inode->i_uid = de->uid;
+ inode->i_gid = de->gid;
+ }
}
if (de->size)
inode->i_size = de->size;