diff options
author | Andrew Morgan <morgan@kernel.org> | 2007-07-10 22:38:22 -0700 |
---|---|---|
committer | Andrew Morgan <morgan@kernel.org> | 2007-07-10 22:38:22 -0700 |
commit | 5216fff5db51f777029b6baed7134a6bfc23c9aa (patch) | |
tree | 99f84e363efe6a246a9b1ab798c82e7d0cc383c5 | |
parent | f2e0a44e65728acc17d6d11d8988be8fdc36574b (diff) | |
download | libcap-5216fff5db51f777029b6baed7134a6bfc23c9aa.tar.gz |
Prepare for 1.95 release.
-rw-r--r-- | Make.Rules | 20 | ||||
-rw-r--r-- | README | 2 | ||||
-rw-r--r-- | doc/capget.2 | 3 | ||||
-rw-r--r-- | libcap/Makefile | 28 | ||||
-rw-r--r-- | libcap/_makenames.c | 29 | ||||
-rw-r--r-- | libcap/cap_alloc.c | 30 | ||||
-rw-r--r-- | libcap/cap_extint.c | 24 | ||||
-rw-r--r-- | libcap/cap_file.c | 33 | ||||
-rw-r--r-- | libcap/cap_flag.c | 24 | ||||
-rw-r--r-- | libcap/cap_proc.c | 35 | ||||
-rw-r--r-- | libcap/cap_sys.c | 25 | ||||
-rw-r--r-- | libcap/cap_text.c | 51 | ||||
-rw-r--r-- | libcap/include/sys/capability.h | 2 | ||||
-rw-r--r-- | libcap/libcap.h | 40 | ||||
-rw-r--r-- | progs/Makefile | 24 | ||||
-rw-r--r-- | progs/execcap.c | 11 | ||||
-rw-r--r-- | progs/getpcaps.c | 26 | ||||
-rw-r--r-- | progs/old/getcap.c | 20 | ||||
-rw-r--r-- | progs/old/setcap.c | 17 | ||||
-rw-r--r-- | progs/setpcaps.c | 31 | ||||
-rw-r--r-- | progs/sucap.c | 5 | ||||
-rw-r--r-- | template.c | 8 |
22 files changed, 69 insertions, 419 deletions
@@ -14,17 +14,21 @@ FAKEROOT= # 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,22 +36,22 @@ endif 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 -MINOR=10 +MINOR=95 # # Compilation specifics CC=gcc COPTFLAGS=-O2 -DEBUG=-g #-DDEBUG -WARNINGS=-ansi -D_POSIX_SOURCE -Wall -Wwrite-strings \ +DEBUG=-O2 -g #-DDEBUG +WARNINGS=-fPIC -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 @@ -26,4 +26,4 @@ More information on capabilities in the Linux kernel can be found at Cheers -Andrew G. Morgan <morgan@linux.kernel.org> +Andrew G. Morgan <morgan@kernel.org> diff --git a/doc/capget.2 b/doc/capget.2 index af428f5..6dd5dc7 100644 --- a/doc/capget.2 +++ b/doc/capget.2 @@ -1,6 +1,5 @@ .\" -.\" $Id: capget.2,v 1.1.1.1 1999/04/17 22:16:31 morgan Exp $ -.\" written by Andrew Morgan <morgan@linux.kernel.org> +.\" written by Andrew Morgan <morgan@kernel.org> .\" .TH CAPGET 2 "17th May 1998" "Linux 2.1" "Linux Programmer's Manual" .SH NAME diff --git a/libcap/Makefile b/libcap/Makefile index 4572673..4af306b 100644 --- a/libcap/Makefile +++ b/libcap/Makefile @@ -1,26 +1,3 @@ -## -## $Log: Makefile,v $ -## Revision 1.1.1.1 1999/04/17 22:16:31 morgan -## release 1.0 of libcap -## -## Revision 1.5 1998/05/24 22:54:09 morgan -## updated for 2.1.104 -## -## Revision 1.4 1997/05/14 05:17:13 morgan -## autoconf rearrangement from Zefram -## -## Revision 1.3 1997/05/04 05:34:59 morgan -## cleaner -## -## Revision 1.2 1997/04/28 00:57:11 morgan -## fixes and zefram's patches -## -## Revision 1.1 1997/04/21 04:33:29 morgan -## Initial revision -## -## -## - # # defines # @@ -56,13 +33,16 @@ cap_names.sed: Makefile /usr/include/linux/capability.h # @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) -Wl,-soname -Wl,$(MAJLIBNAME) -Wl,-x -shared -o $@ $(OBJS) ln -sf $(MINLIBNAME) $(MAJLIBNAME) ln -sf $(MAJLIBNAME) $(LIBNAME) %.o: %.c $(INCLS) $(CC) $(CFLAGS) -c $< -o $@ +cap_sys.o: cap_sys.c $(INCLS) + $(CC) -fPIC -Wall -O2 -c $< -o $@ + install: all mkdir -p -m 0755 $(INCDIR)/sys install -m 0644 include/sys/capability.h $(INCDIR)/sys diff --git a/libcap/_makenames.c b/libcap/_makenames.c index ebb17f6..61a7c47 100644 --- a/libcap/_makenames.c +++ b/libcap/_makenames.c @@ -1,7 +1,5 @@ /* - * $Id: _makenames.c,v 1.3 1999/05/14 04:46:15 morgan Exp $ - * - * Copyright (c) 1997-8 Andrew G. Morgan <morgan@linux.kernel.org> + * Copyright (c) 1997-8 Andrew G. Morgan <morgan@kernel.org> * * This is a file to make the capability <-> string mappings for * libcap. @@ -61,28 +59,3 @@ int main(void) exit(0); } - -/* - * $Log: _makenames.c,v $ - * Revision 1.3 1999/05/14 04:46:15 morgan - * another attempt to fix the bug Chris Evans found - * - * Revision 1.2 1999/05/14 04:38:06 morgan - * Fix from Chris Evans: off by one error when computing the name array - * - * Revision 1.1.1.1 1999/04/17 22:16:31 morgan - * release 1.0 of libcap - * - * Revision 1.4 1998/06/07 15:50:12 morgan - * updated to accommodate kernel's real header file :*) - * - * Revision 1.3 1998/05/24 22:54:09 morgan - * updated for 2.1.104 - * - * Revision 1.2 1997/05/04 05:35:46 morgan - * cleaned up to #include sed output. also generates whole cap_names.c file - * - * Revision 1.1 1997/04/28 00:57:11 morgan - * Initial revision - * - */ diff --git a/libcap/cap_alloc.c b/libcap/cap_alloc.c index 3d3168e..a3b22a7 100644 --- a/libcap/cap_alloc.c +++ b/libcap/cap_alloc.c @@ -1,9 +1,5 @@ /* - * $Id: cap_alloc.c,v 1.3 1999/11/18 07:23:24 morgan Exp $ - * - * Copyright (c) 1997-8 Andrew G Morgan <morgan@linux.kernel.org> - * - * See end of file for Log. + * Copyright (c) 1997-8 Andrew G Morgan <morgan@kernel.org> * * This file deals with allocation and deallocation of internal * capability sets as specified by POSIX.1e (formerlly, POSIX 6). @@ -97,6 +93,8 @@ cap_t cap_dup(cap_t cap_d) int cap_free(void *data_p) { + if ( !data_p ) + return 0; if ( good_cap_t(data_p) ) { data_p = -1 + (__u32 *) data_p; @@ -119,25 +117,3 @@ int cap_free(void *data_p) errno = EINVAL; return -1; } - -/* - * $Log: cap_alloc.c,v $ - * Revision 1.3 1999/11/18 07:23:24 morgan - * final fixes tested on a RH6.0 system for release-1.10 - * - * Revision 1.2 1999/11/18 06:03:26 morgan - * fixed cap_free to work as indicated in manuals - * - * Revision 1.1.1.1 1999/04/17 22:16:31 morgan - * release 1.0 of libcap - * - * Revision 1.3 1998/05/24 22:54:09 morgan - * updated for 2.1.104 - * - * Revision 1.2 1997/04/28 00:57:11 morgan - * fixes and zefram's patches - * - * Revision 1.1 1997/04/21 04:32:52 morgan - * Initial revision - * - */ diff --git a/libcap/cap_extint.c b/libcap/cap_extint.c index 3b0536b..1d858a1 100644 --- a/libcap/cap_extint.c +++ b/libcap/cap_extint.c @@ -1,9 +1,5 @@ /* - * $Id: cap_extint.c,v 1.1.1.1 1999/04/17 22:16:31 morgan Exp $ - * - * Copyright (c) 1997-8 Andrew G Morgan <morgan@linux.kernel.org> - * - * See end of file for Log. + * Copyright (c) 1997-8 Andrew G Morgan <morgan@kernel.org> * * This file deals with exchanging internal and external * representations of capability sets. @@ -91,7 +87,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 +100,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; @@ -128,18 +125,3 @@ cap_t cap_copy_int(const void *cap_ext) return cap_d; } -/* - * $Log: cap_extint.c,v $ - * Revision 1.1.1.1 1999/04/17 22:16:31 morgan - * release 1.0 of libcap - * - * Revision 1.3 1998/05/24 22:54:09 morgan - * updated for 2.1.104 - * - * Revision 1.2 1997/04/28 00:57:11 morgan - * fixes and zefram's patches - * - * Revision 1.1 1997/04/21 04:32:52 morgan - * Initial revision - * - */ diff --git a/libcap/cap_file.c b/libcap/cap_file.c index ba51f15..85d72cb 100644 --- a/libcap/cap_file.c +++ b/libcap/cap_file.c @@ -1,9 +1,5 @@ /* - * $Id: cap_file.c,v 1.1.1.1 1999/04/17 22:16:31 morgan Exp $ - * - * Copyright (c) 1997 Andrew G Morgan <morgan@linux.kernel.org> - * - * See end of file for Log. + * Copyright (c) 1997 Andrew G Morgan <morgan@kernel.org> * * This file deals with setting capabilities on files. */ @@ -29,7 +25,8 @@ cap_t cap_get_fd(int fildes) &result->set[CAP_INHERITABLE], &result->set[CAP_PERMITTED], &result->set[CAP_EFFECTIVE] )) { - cap_free(&result); + cap_free(result); + result = NULL; } } @@ -54,7 +51,8 @@ cap_t cap_get_file(const char *filename) &result->set[CAP_INHERITABLE], &result->set[CAP_PERMITTED], &result->set[CAP_EFFECTIVE] )) - cap_free(&result); + cap_free(result); + result = NULL; } return result; @@ -97,24 +95,3 @@ int cap_set_file(const char *filename, cap_t cap_d) &cap_d->set[CAP_EFFECTIVE] ); } -/* - * $Log: cap_file.c,v $ - * Revision 1.1.1.1 1999/04/17 22:16:31 morgan - * release 1.0 of libcap - * - * Revision 1.5 1998/05/24 22:54:09 morgan - * updated for 2.1.104 - * - * Revision 1.4 1997/05/14 05:17:13 morgan - * bug-fix from zefram (errno no set on success) - * - * Revision 1.3 1997/05/04 05:35:46 morgan - * fixed errno setting. syscalls do this part - * - * Revision 1.2 1997/04/28 00:57:11 morgan - * fixes and zefram's patches - * - * Revision 1.1 1997/04/21 04:32:52 morgan - * Initial revision - * - */ diff --git a/libcap/cap_flag.c b/libcap/cap_flag.c index 2181ade..a8567c0 100644 --- a/libcap/cap_flag.c +++ b/libcap/cap_flag.c @@ -1,9 +1,5 @@ /* - * $Id: cap_flag.c,v 1.1.1.1 1999/04/17 22:16:31 morgan Exp $ - * - * Copyright (c) 1997-8 Andrew G. Morgan <morgan@linux.kernel.org> - * - * See end of file for Log. + * Copyright (c) 1997-8 Andrew G. Morgan <morgan@kernel.org> * * This file deals with flipping of capabilities on internal * capability sets as specified by POSIX.1e (formerlly, POSIX 6). @@ -105,21 +101,3 @@ int cap_clear(cap_t cap_d) } } -/* - * $Log: cap_flag.c,v $ - * Revision 1.1.1.1 1999/04/17 22:16:31 morgan - * release 1.0 of libcap - * - * Revision 1.4 1998/09/20 23:07:59 morgan - * fixed lower bound check on 'set'. - * - * Revision 1.3 1998/05/24 22:54:09 morgan - * updated for 2.1.104 - * - * Revision 1.2 1997/04/28 00:57:11 morgan - * fixes and zefram's patches - * - * Revision 1.1 1997/04/21 04:32:52 morgan - * Initial revision - * - */ diff --git a/libcap/cap_proc.c b/libcap/cap_proc.c index a7a6b73..5c2ac48 100644 --- a/libcap/cap_proc.c +++ b/libcap/cap_proc.c @@ -1,9 +1,5 @@ /* - * $Id: cap_proc.c,v 1.2 1999/04/18 20:50:01 morgan Exp $ - * - * Copyright (c) 1997-8 Andrew G Morgan <morgan@linux.kernel.org> - * - * See end of file for Log. + * Copyright (c) 1997-8 Andrew G Morgan <morgan@kernel.org> * * This file deals with setting capabilities on processes. */ @@ -21,7 +17,8 @@ cap_t cap_get_proc(void) /* fill the capability sets via a system call */ if (capget(&result->head, &result->set)) { - cap_free(&result); + cap_free(result); + result = NULL; } } @@ -87,29 +84,3 @@ int capsetp(pid_t pid, cap_t cap_d) return error; } -/* - * $Log: cap_proc.c,v $ - * Revision 1.2 1999/04/18 20:50:01 morgan - * reliable behavior when trying to talk with a kernel that has a more - * modern capability implementation than the one the library was compiled - * with. - * - * Revision 1.1.1.1 1999/04/17 22:16:31 morgan - * release 1.0 of libcap - * - * Revision 1.5 1998/05/24 22:54:09 morgan - * updated for 2.1.104 - * - * Revision 1.4 1997/05/14 05:17:13 morgan - * bug-fix from zefram (errno no set on success) - * - * Revision 1.3 1997/05/04 05:35:46 morgan - * fixed errno setting. syscalls do this part - * - * Revision 1.2 1997/04/28 00:57:11 morgan - * fixes and zefram's patches - * - * Revision 1.1 1997/04/21 04:32:52 morgan - * Initial revision - * - */ diff --git a/libcap/cap_sys.c b/libcap/cap_sys.c index f28e8a3..27c137d 100644 --- a/libcap/cap_sys.c +++ b/libcap/cap_sys.c @@ -1,15 +1,12 @@ /* - * $Id: cap_sys.c,v 1.1.1.1 1999/04/17 22:16:31 morgan Exp $ - * - * Copyright (c) 1997-8 Andrew G. Morgan <morgan@linux.kernel.org> + * Copyright (c) 1997-8 Andrew G. Morgan <morgan@kernel.org> * * This file contains the system calls for getting and setting * capabilities */ -#include "libcap.h" -#define __LIBRARY__ #include <linux/unistd.h> +#include <linux/capability.h> _syscall2(int, capget, cap_user_header_t, header, @@ -19,21 +16,3 @@ _syscall2(int, capset, cap_user_header_t, header, const cap_user_data_t, data) -/* - * $Log: cap_sys.c,v $ - * Revision 1.1.1.1 1999/04/17 22:16:31 morgan - * release 1.0 of libcap - * - * Revision 1.4 1998/06/08 00:14:01 morgan - * change to accommodate alpha (glibc?) - * - * Revision 1.3 1998/05/24 22:54:09 morgan - * updated for 2.1.104 - * - * Revision 1.2 1997/04/28 00:57:11 morgan - * fixes and zefram's patches - * - * Revision 1.1 1997/04/21 04:32:52 morgan - * Initial revision - * - */ diff --git a/libcap/cap_text.c b/libcap/cap_text.c index c69e89b..5814093 100644 --- a/libcap/cap_text.c +++ b/libcap/cap_text.c @@ -1,11 +1,7 @@ /* - * $Id: cap_text.c,v 1.3 1999/11/18 06:03:26 morgan Exp $ - * - * Copyright (c) 1997-8 Andrew G Morgan <morgan@linux.kernel.org> + * Copyright (c) 1997-8 Andrew G Morgan <morgan@kernel.org> * Copyright (c) 1997 Andrew Main <zefram@dcs.warwick.ac.uk> * - * See end of file for Log. - * * This file deals with exchanging internal and textual * representations of capability sets. */ @@ -57,18 +53,23 @@ static char const *namcmp(char const *str, char const *nam) static int lookupname(char const **strp) { - char const *str = *strp; - if (isdigit(*str)) { - unsigned long n = strtoul(str, (char **)&str, 0); + union { + char const *constp; + char *p; + } str; + + str.constp = *strp; + if (isdigit(*str.constp)) { + unsigned long n = strtoul(str.constp, &str.p, 0); if (n >= __CAP_BITS) return -1; - *strp = str; + *strp = str.constp; return n; } else { char const *s; int n; for (n = __CAP_BITS; n--; ) - if (_cap_names[n] && (s = namcmp(str, _cap_names[n]))) { + if (_cap_names[n] && (s = namcmp(str.constp, _cap_names[n]))) { *strp = s; return n; } @@ -209,9 +210,10 @@ cap_t cap_from_text(const char *str) } bad: - cap_free(&res); + cap_free(res); + res = NULL; errno = EINVAL; - return NULL; + return res; } /* @@ -306,28 +308,3 @@ char *cap_to_text(cap_t caps, ssize_t *length_p) return (_libcap_strdup(buf)); } - -/* - * $Log: cap_text.c,v $ - * Revision 1.3 1999/11/18 06:03:26 morgan - * fixed cap_free to work as indicated in manuals - * - * Revision 1.2 1999/04/17 23:25:09 morgan - * fixes from peeterj - * - * Revision 1.1.1.1 1999/04/17 22:16:31 morgan - * release 1.0 of libcap - * - * Revision 1.4 1998/05/24 22:54:09 morgan - * updated for 2.1.104 - * - * Revision 1.3 1997/05/04 05:37:00 morgan - * case sensitvity to capability flags - * - * Revision 1.2 1997/04/28 00:57:11 morgan - * zefram's replacement file with a number of bug fixes from AGM - * - * Revision 1.1 1997/04/21 04:32:52 morgan - * Initial revision - * - */ diff --git a/libcap/include/sys/capability.h b/libcap/include/sys/capability.h index 5afd3b0..f38f81d 100644 --- a/libcap/include/sys/capability.h +++ b/libcap/include/sys/capability.h @@ -3,7 +3,7 @@ * * * Copyright (C) 1997 Aleph One - * Copyright (C) 1997-8 Andrew G. Morgan <morgan@linux.kernel.org> + * Copyright (C) 1997-8 Andrew G. Morgan <morgan@kernel.org> * * defunct POSIX.1e Standard: 25.2 Capabilities <sys/capability.h> */ diff --git a/libcap/libcap.h b/libcap/libcap.h index eff5f8b..20acb6b 100644 --- a/libcap/libcap.h +++ b/libcap/libcap.h @@ -1,9 +1,5 @@ /* - * $Id: libcap.h,v 1.5 1999/11/18 07:23:24 morgan Exp $ - * - * Copyright (c) 1997 Andrew G Morgan <morgan@linux.kernel.org> - * - * See end of file for Log. + * Copyright (c) 1997 Andrew G Morgan <morgan@kernel.org> * * This file contains internal definitions for the various functions in * this small capability library. @@ -117,37 +113,3 @@ extern int capgetp(pid_t pid, cap_t cap_d); extern int capsetp(pid_t pid, cap_t cap_d); #endif /* LIBCAP_H */ - -/* - * $Log: libcap.h,v $ - * Revision 1.5 1999/11/18 07:23:24 morgan - * final fixes tested on a RH6.0 system for release-1.10 - * - * Revision 1.4 1999/11/18 06:25:02 morgan - * added prototype for _libcap_strdup - * - * Revision 1.3 1999/11/18 06:03:26 morgan - * fixed cap_free to work as indicated in manuals - * - * Revision 1.2 1999/04/17 23:25:10 morgan - * fixes from peeterj - * - * Revision 1.1.1.1 1999/04/17 22:16:31 morgan - * release 1.0 of libcap - * - * Revision 1.5 1998/06/08 00:15:28 morgan - * accommodate alpha (glibc?) - * - * Revision 1.4 1998/06/07 15:58:23 morgan - * accommodate real kernel header files :*) - * - * Revision 1.3 1998/05/24 22:54:09 morgan - * updated for 2.1.104 - * - * Revision 1.2 1997/04/28 00:57:11 morgan - * zefram's replacement file with a number of bug fixes from AGM - * - * Revision 1.1 1997/04/21 04:32:52 morgan - * Initial revision - * - */ diff --git a/progs/Makefile b/progs/Makefile index 1f78a5e..deb1d80 100644 --- a/progs/Makefile +++ b/progs/Makefile @@ -1,27 +1,3 @@ -## -## $Log: Makefile,v $ -## Revision 1.1.1.1 1999/04/17 22:16:31 morgan -## release 1.0 of libcap -## -## Revision 1.6 1998/09/20 23:17:32 morgan -## added sucap.c -## -## Revision 1.5 1998/06/07 01:54:43 morgan -## updated for 0.104. Added execcap. -## -## Revision 1.4 1997/05/14 05:18:23 morgan -## autoconf rearrangement from Zefram -## -## Revision 1.3 1997/05/04 05:34:03 morgan -## took care of case that install cannot handle more than one file -## -## Revision 1.2 1997/04/28 01:01:20 morgan -## update with zefram's patches -## -## Revision 1.1 1997/04/21 04:34:04 morgan -## Initial revision -## -## topdir=$(shell pwd)/.. include $(topdir)/Make.Rules diff --git a/progs/execcap.c b/progs/execcap.c index 68b86d2..330cc93 100644 --- a/progs/execcap.c +++ b/progs/execcap.c @@ -1,5 +1,5 @@ /* - * This was written by Andrew G. Morgan <morgan@linux.kernel.org> + * This was written by Andrew G. Morgan <morgan@kernel.org> * * This is a program that is intended to exec a subsequent program. * The purpose of this 'execcap' wrapper is to limit the inheritable @@ -13,6 +13,7 @@ #include <sys/capability.h> #include <unistd.h> #include <string.h> +#include <stdlib.h> static void usage(void) { @@ -23,12 +24,12 @@ static void usage(void) " intended to assist in overcoming a lack of support for filesystem\n" " capability attributes and should be used to launch other files.\n" " This program should _NOT_ be made setuid-0.\n\n" -"[Copyright (c) 1998 Andrew G. Morgan <morgan@linux.kernel.org>]\n"); +"[Copyright (c) 1998 Andrew G. Morgan <morgan@kernel.org>]\n"); exit(1); } -void main(int argc, char **argv) +int main(int argc, char **argv) { cap_t new_caps; @@ -52,7 +53,7 @@ void main(int argc, char **argv) /* set these capabilities for the current process */ if (cap_set_proc(new_caps) != 0) { fprintf(stderr, "unable to set capabilities: %s\n", strerror(errno)); - usage(); + usage(); } /* exec the program indicated by args 2 ... */ @@ -62,4 +63,6 @@ void main(int argc, char **argv) fprintf(stderr, "Unable to execute command: %s\n", strerror(errno)); usage(); + + return 0; } diff --git a/progs/getpcaps.c b/progs/getpcaps.c index cb3c9d7..26dee82 100644 --- a/progs/getpcaps.c +++ b/progs/getpcaps.c @@ -1,7 +1,7 @@ /* * $Id: getpcaps.c,v 1.2 1999/11/18 06:04:25 morgan Exp $ * - * Copyright (c) 1997 Andrew G. Morgan <morgan@linux.kernel.org> + * Copyright (c) 1997 Andrew G. Morgan <morgan@kernel.org> * * This displays the capabilities of a given process. */ @@ -20,7 +20,7 @@ static void usage(void) "usage: getcaps <pid> [<pid> ...]\n\n" " This program displays the capabilities on the queried process(es).\n" " The capabilities are displayed in the cap_from_text(3) format.\n\n" -"[Copyright (c) 1997-8 Andrew G. Morgan <morgan@linux.kernel.org>]\n" +"[Copyright (c) 1997-8 Andrew G. Morgan <morgan@kernel.org>]\n" ); exit(1); } @@ -60,25 +60,3 @@ int main(int argc, char **argv) return 0; } - -/* - * $Log: getpcaps.c,v $ - * Revision 1.2 1999/11/18 06:04:25 morgan - * use cap_free and not free for string from cap_to_text() - * - * Revision 1.1.1.1 1999/04/17 22:16:31 morgan - * release 1.0 of libcap - * - * Revision 1.4 1998/09/20 23:07:08 morgan - * fixed comment at top - * - * Revision 1.3 1998/06/08 00:16:58 morgan - * change to accommodate alpha (glibc?) - * - * Revision 1.2 1998/06/07 01:49:39 morgan - * added copyright info and some usage info. Small tidy up. - * - * Revision 1.1 1998/04/30 02:53:00 morgan - * Initial revision - * - */ diff --git a/progs/old/getcap.c b/progs/old/getcap.c index 8a7102d..7561f1c 100644 --- a/progs/old/getcap.c +++ b/progs/old/getcap.c @@ -1,7 +1,5 @@ /* - * $Id: getcap.c,v 1.1.1.1 1999/04/17 22:16:31 morgan Exp $ - * - * Copyright (c) 1997 Andrew G. Morgan <morgan@parc.power.net> + * Copyright (c) 1997 Andrew G. Morgan <morgan@kernel.org> * * This displays the capabilities of a given file. */ @@ -49,19 +47,3 @@ int main(int argc, char **argv) return 0; } - -/* - * $Log: getcap.c,v $ - * Revision 1.1.1.1 1999/04/17 22:16:31 morgan - * release 1.0 of libcap - * - * Revision 1.3 1997/05/04 05:34:32 morgan - * non void main - * - * Revision 1.2 1997/04/28 01:01:20 morgan - * update to allow more than one argument file - * - * Revision 1.1 1997/04/21 04:34:04 morgan - * Initial revision - * - */ diff --git a/progs/old/setcap.c b/progs/old/setcap.c index 15418da..ebf8608 100644 --- a/progs/old/setcap.c +++ b/progs/old/setcap.c @@ -1,7 +1,5 @@ /* - * $Id: setcap.c,v 1.1.1.1 1999/04/17 22:16:31 morgan Exp $ - * - * Copyright (c) 1997 Andrew G. Morgan <morgan@parc.power.net> + * Copyright (c) 1997 Andrew G. Morgan <morgan@kernel.org> * * This sets the capabilities of a given file. */ @@ -110,16 +108,3 @@ int main(int argc, char **argv) return 0; } - -/* - * $Log: setcap.c,v $ - * Revision 1.1.1.1 1999/04/17 22:16:31 morgan - * release 1.0 of libcap - * - * Revision 1.2 1997/05/04 05:34:32 morgan - * non void main - * - * Revision 1.1 1997/04/28 01:01:20 morgan - * Initial revision - * - */ diff --git a/progs/setpcaps.c b/progs/setpcaps.c index 7441420..3720fce 100644 --- a/progs/setpcaps.c +++ b/progs/setpcaps.c @@ -1,7 +1,5 @@ /* - * $Id: setpcaps.c,v 1.2 1999/11/18 06:04:26 morgan Exp $ - * - * Copyright (c) 1997-8 Andrew G. Morgan <morgan@linux.kernel.org> + * Copyright (c) 1997-8 Andrew G. Morgan <morgan@kernel.org> * * This sets the capabilities of a given process. */ @@ -24,7 +22,7 @@ static void usage(void) " raised, and the only capabilities that this program can bestow on others\n" " are a subset of its effective set. This program is mostly intended as an\n" " example -- a safe use of CAP_SETPCAP has yet to be demonstrated!\n\n" -"[Copyright (c) 1997-8 Andrew G. Morgan <morgan@linux.kernel.org>]\n" +"[Copyright (c) 1997-8 Andrew G. Morgan <morgan@kernel.org>]\n" ); exit(1); } @@ -124,28 +122,3 @@ int main(int argc, char **argv) return 0; } - -/* - * $Log: setpcaps.c,v $ - * Revision 1.2 1999/11/18 06:04:26 morgan - * use cap_free and not free for string from cap_to_text() - * - * Revision 1.1.1.1 1999/04/17 22:16:31 morgan - * release 1.0 of libcap - * - * Revision 1.3 1998/09/20 23:07:08 morgan - * fixed comment at top - * - * Revision 1.2 1998/06/08 00:17:38 morgan - * change to accommodate alpha (glibc?) - * - * Revision 1.1 1998/06/07 01:46:51 morgan - * Initial revision - * - * Revision 1.2 1997/05/04 05:34:32 morgan - * non void main - * - * Revision 1.1 1997/04/28 01:01:20 morgan - * Initial revision - * - */ diff --git a/progs/sucap.c b/progs/sucap.c index b567430..366a093 100644 --- a/progs/sucap.c +++ b/progs/sucap.c @@ -20,6 +20,7 @@ #include <sys/wait.h> #include <errno.h> #include <string.h> +#include <stdlib.h> static void usage(void) { @@ -48,7 +49,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 +194,6 @@ void main(int argc, char **argv) /* exit to signal mother process that we are ready */ _exit(0); } + + return 0; } @@ -1,14 +1,6 @@ /* - * $Id: template.c,v 1.1.1.1 1999/04/17 22:16:31 morgan Exp $ - * * Copyright (c) 1997 <Author> <@> * * <Content> */ -/* - * $Log: template.c,v $ - * Revision 1.1.1.1 1999/04/17 22:16:31 morgan - * release 1.0 of libcap - * - */ |