build patches for checkpolicy, libselinux, policycoreutils
Subsystems (2)
Hi,
I'm working on getting a 2.5 SELinux system going so I can update my coreutils patch, and as part of that I'm making Debian packages of the various bits at:
http://www.nsa.gov/selinux/lk/
I've so far only got packages of checkpolicy, selinux, and policycoreutils, but if anyone's interested, they're up at:
http://web.verbum.org/selinux/
I'm going to work on updating the various other Debian packages with the SELinux patches next.
One thing I ran into is that my Debian package build system automatically passes CFLAGS to make like:
make CFLAGS='-g -Wall -O2'
However the various makefiles have important things like -I../includes in CFLAGS, which would otherwise be overridden by the command line argument. Thus the fix is to use the 'override' keyword so the include flags are always added, while the other CFLAGS like -Wall can be changed by the user.
Also one Makefile was calling /sbin/ldconfig in the install rule, which broke my Debian package builds. Admins should just have to know to run ldconfig after installing libraries. Or maybe we could turn it into a libtool-style notice.
Finally, newrole.c was missing an #include <errno.h>, and we need to create $(DESTDIR)/etc/pam.d if it doesn't exist.
There should be 5 patches attached.
Makefile.new renamed from Makefile +5 -4
@@ -4,7 +4,8 @@ PREFIX ?= ${DESTDIR}/usr BINDIR ?= $(PREFIX)/bin -CFLAGS = -g -Wall -O2 -pipe -include global.h -I. -Iinclude +CFLAGS = -g -Wall -O2 +INCLUDES = -include global.h -I. -Iinclude OBJS = ebitmap.o hashtab.o symtab.o sidtab.o avtab.o policydb.o services.o y.tab.o lex.yy.o queue.o write.o checkpolicy.o
@@ -16,13 +17,13 @@ $(CC) -o $@ $^ $(LIBS) %.o: %.c - $(CC) $(CFLAGS) -o $@ -c $< + $(CC) $(CFLAGS) $(INCLUDES) -o $@ -c $< y.tab.o: y.tab.c - $(CC) $(CFLAGS) -o $@ -c $< + $(CC) $(CFLAGS) $(INCLUDES) -o $@ -c $< lex.yy.o: lex.yy.c - $(CC) $(CFLAGS) -o $@ -c $< + $(CC) $(CFLAGS) $(INCLUDES) -o $@ -c $< y.tab.c: policy_parse.y $(YACC) -d policy_parse.y
Makefile renamed from Makefile~ +2 -1
@@ -2,7 +2,8 @@ PREFIX ?= $(DESTDIR)/usr BINDIR ?= $(PREFIX)/bin -CFLAGS += -Wall -I../include +CFLAGS = -Wall +override CFLAGS += -I../include LDLIBS += -L../src -lselinux -lattr TARGETS=$(patsubst %.c,%,$(wildcard *.c))
Makefile renamed from Makefile~ +2 -2
@@ -9,7 +9,8 @@ TARGET=libselinux.so LIBSO=$(TARGET).$(LIBVERSION) OBJS= $(patsubst %.c,%.o,$(wildcard *.c)) -CFLAGS = -fPIC -Wall -I../include +CFLAGS = -Wall +override CFLAGS += -fPIC -I../include all: $(LIBA) $(LIBSO)
@@ -29,7 +30,6 @@ install -m 644 -o root -g root $(LIBA) $(LIBDIR) install -m 755 -o root -g root $(LIBSO) $(LIBDIR) cd $(LIBDIR) && ln -sf $(LIBSO) $(TARGET) - /sbin/ldconfig clean: rm -f $(OBJS) $(LIBA) $(LIBSO) $(TARGET)
newrole.c renamed from newrole.c~ +1 -0
@@ -57,6 +57,7 @@#include <getopt.h> /* for getopt_long() form of getopt() */ #include <fcntl.h> #include <string.h> +#include <errno.h> #include <selinux/selinux.h> /* for is_selinux_enabled() */ #include <selinux/flask.h> /* for SECCLASS_CHR_FILE */ #include <selinux/context.h> /* for context-mangling functions */
Makefile renamed from Makefile~ +3 -1
@@ -4,7 +4,8 @@ MANDIR ?= $(PREFIX)/share/man ETCDIR ?= $(DESTDIR)/etc -CFLAGS += -Wall -DUSE_PAM +CFLAGS = -Wall +override CFLAGS += -DUSE_PAM LDLIBS += -lselinux -lattr -ldl -lpam -lpam_misc TARGETS=$(patsubst %.c,%,$(wildcard *.c))
@@ -13,6 +14,7 @@ install: all test -d $(BINDIR) || install -m 755 -o root -g root -d $(BINDIR) + test -d $(ETCDIR)/pam.d || install -m 755 -o root -g root -d $(ETCDIR)/pam.d test -d $(MANDIR)/man1 || install -m 755 -o root -g root -d $(MANDIR)/man1 install -m 555 -o root -g root newrole $(BINDIR) install -m 644 -o root -g root newrole.1 $(MANDIR)/man1/
Makefile renamed from Makefile~ +1 -1
@@ -2,7 +2,7 @@ PREFIX ?= ${DESTDIR}/usr SBINDIR ?= $(PREFIX)/sbin -CFLAGS += -Wall +CFLAGS = -Wall LDLIBS += -lselinux # Build static so that we can put it on an initrd.
Makefile renamed from Makefile~ +2 -1
@@ -4,7 +4,8 @@ MANDIR ?= $(PREFIX)/share/man ETCDIR ?= $(DESTDIR)/etc -CFLAGS += -Wall -DUSE_PAM +CFLAGS = -Wall +override CFLAGS += -DUSE_PAM LDLIBS += -lselinux -lattr -ldl -lpam -lpam_misc TARGETS=$(patsubst %.c,%,$(wildcard *.c))
Makefile renamed from Makefile~ +2 -1
@@ -3,7 +3,8 @@ SBINDIR ?= $(PREFIX)/sbin MANDIR = $(PREFIX)/share/man -CFLAGS += -Wall -D_FILE_OFFSET_BITS=64 +CFLAGS = -Wall +override CFLAGS += -D_FILE_OFFSET_BITS=64 LDLIBS += -lselinux -lattr all: setfiles
Oops, sorry, the first patch (for checkpolicy) was not the correct fix. An updated patch is attached.
Makefile renamed from Makefile~ +2 -1
@@ -4,7 +4,8 @@ PREFIX ?= ${DESTDIR}/usr BINDIR ?= $(PREFIX)/bin -CFLAGS = -g -Wall -O2 -pipe -include global.h -I. -Iinclude +CFLAGS = -g -Wall -O2 -pipe +override CFLAGS += -include global.h -I. -Iinclude OBJS = ebitmap.o hashtab.o symtab.o sidtab.o avtab.o policydb.o services.o y.tab.o lex.yy.o queue.o write.o checkpolicy.o