File compartment-1.1.diff of Package compartm
--- compartment-1.1/compartment.c
+++ compartment-1.1/compartment.c 2008/04/29 13:59:03
@@ -29,6 +29,7 @@
#include <string.h>
#include <stdlib.h>
#include <sys/stat.h>
+#define _LINUX_STRING_H_
#include <linux/capability.h>
#include <stdarg.h>
#include <syslog.h>
@@ -74,18 +75,18 @@
void help() {
fprintf(stderr, "%s %s %s %s\n\n", PROGRAM_NAME, VERSION, AUTHOR, POINTER);
fprintf(stderr, "Syntax: %s [options] /full/path/to/program\n", prg);
- fprintf(stderr, "Options:
-\t --chroot path\t chroot to path
-\t --user user\t change uid to this user
-\t --group group\t change gid to this group
-\t --init program\t execute this program/script before doing anything
-\t --cap capset\t set capset name. This option can be used several times.
-\t --verbose\t be verbose
-\t --quiet\t do no logging (to syslog)
-\t --fork\t\t fork (if everything is fine)
-\nHints: always try to chroot; use --user&group if possible; chroot and chown all
-files to another user than root if you use capabilties. Read the README file!
-\nKnown capset names: none");
+ fprintf(stderr, "Options:\n"
+"\t --chroot path\t chroot to path\n"
+"\t --user user\t change uid to this user\n"
+"\t --group group\t change gid to this group\n"
+"\t --init program\t execute this program/script before doing anything\n"
+"\t --cap capset\t set capset name. This option can be used several times.\n"
+"\t --verbose\t be verbose\n"
+"\t --quiet\t do no logging (to syslog)\n"
+"\t --fork\t\t fork (if everything is fine)\n"
+"\nHints: always try to chroot; use --user&group if possible; chroot and chown all\n"
+"files to another user than root if you use capabilties. Read the README file!\n"
+"\nKnown capset names: none");
tmp = 0;
while(strlen(cap_set_names[tmp])>0)
fprintf(stderr," %s",cap_set_names[tmp++]);
@@ -175,9 +176,9 @@
my_secure();
openlog("SuSEcompartment", LOG_PID, LOG_DAEMON);
if (sizeof(uid_t) == 4) {
- (unsigned long int) uidrange = 65535;
+ uidrange = 65535;
} else { if (sizeof(uid_t) == 8) {
- (unsigned long int) uidrange = (unsigned long int) 2147483646; //4294967295;
+ uidrange = (unsigned long int) 2147483646; //4294967295;
} else
fprintf(stderr, "Warning: weird uid size: %d\n", sizeof(uid_t));
}
@@ -418,11 +419,11 @@
if (access(_argv[0], X_OK) < 0)
print_msg("Execute bit missing, or no permissions to execute %s\n", _argv[0]);
else
- print_msg("Could not properly execute %s - the chroot environment might not be
-set up correctly:
-Create the directories /etc and /lib in chroot_dir and run \"ldd %s\"
-to see which libraries are needed. Copy these to chroot_dir/lib, then chdir to
-chroot_dir and execute \"ldconfig -X -r .\"\n", _argv[0], _argv[0]);
+ print_msg("Could not properly execute %s - the chroot environment might not be\n"
+"set up correctly:\n"
+"Create the directories /etc and /lib in chroot_dir and run \"ldd %s\"\n"
+"to see which libraries are needed. Copy these to chroot_dir/lib, then chdir to\n"
+"chroot_dir and execute \"ldconfig -X -r .\"\n", _argv[0], _argv[0]);
}
return 1;
--- compartment-1.1/Makefile
+++ compartment-1.1/Makefile 2008/04/29 13:59:03
@@ -1,24 +1,40 @@
-CC=gcc
-OPTS=-Wall -O2
-BIN_DIR=/usr/sbin
+# Makefile for compartment
+
+OPTS=$(RPM_OPT_FLAGS)
+ROOT=$(RPM_BUILD_ROOT)
+
+ifeq ($(CC),)
+ CC=gcc
+endif
+ifeq ($(RPM_OPT_FLAGS),)
+ OPTS=-Wall -O2
+endif
+ifeq ($(RPM_BUILD_ROOT),)
+ ROOT=/
+endif
+
+BIN_DIR=$(ROOT)/usr/sbin
+MAN_DIR=$(ROOT)/usr/share/man/man1
+DOC_DIR=$(ROOT)/usr/doc/packages/compartment
+
BIN_LIST=compartment
-DOC_DIR=/usr/doc/packages/compartment
DOC_LIST=README LICENCE CHANGES TODO
-MAN_DIR=/usr/share/man/man1
MAN_LIST=compartment.1
all: compartment
compartment: compartment.c
${CC} ${OPTS} -o ${BIN_LIST} compartment.c
- strip ${BIN_LIST}
clean:
rm -f ${BIN_LIST} core *~
-install: compartment
+install: ${BIN_LIST}
install -o root -g root -m 751 ${BIN_LIST} ${BIN_DIR}
- install -d -o root -g root -m 755 ${DOC_DIR}
- install -o root -g root -m 644 ${DOC_LIST} ${DOC_DIR}
install -d -o root -g root -m 755 ${MAN_DIR}
install -o root -g root -m 644 ${MAN_LIST} ${MAN_DIR}
+
+install.doc: ${DOC_LIST}
+ install -d -o root -g root -m 755 ${DOC_DIR}
+ install -o root -g root -m 644 ${DOC_LIST} ${DOC_DIR}
+