diff options
author | Bernie Innocenti <bernie@codewiz.org> | 2008-12-18 02:34:44 (GMT) |
---|---|---|
committer | Bernie Innocenti <bernie@codewiz.org> | 2008-12-18 02:34:44 (GMT) |
commit | 6cb8eeb2f2c21ce545e13567fcdd12aa554b4441 (patch) | |
tree | a52735a7c53d818cd79fcb037aed6dfae44a2c51 | |
parent | bf980ae4b5c5d349dbd1370b05492854c6ec2c33 (diff) |
Improve configurability of the source code.
-rw-r--r-- | Makefile.build | 23 | ||||
-rw-r--r-- | config/debug.h | 3 | ||||
-rw-r--r-- | config/shell.h | 2 | ||||
-rw-r--r-- | config/spool.h | 2 | ||||
-rw-r--r-- | nss-rainbow.c | 6 |
5 files changed, 25 insertions, 11 deletions
diff --git a/Makefile.build b/Makefile.build index 1976678..02e1889 100644 --- a/Makefile.build +++ b/Makefile.build @@ -6,12 +6,18 @@ WARNFLAGS = \ -Wextra -Wstrict-aliasing=2 \ -Wunsafe-loop-optimizations +# Compiler flags for generating dependencies +DEPFLAGS = -MMD -MP + +ALLCFLAGS = -g -std=gnu99 -fPIC $(WARNFLAGS) $(DEPFLAGS) $(CFLAGS) + # declarations RAINBOW_OBJS = nss-rainbow.o buf.o nat.o UIDS_OBJS = uids.o GIDS_OBJS = gids.o TEST_NAT_OBJS = test_nat.o nat.o +ALL_OBJS = $(RAINBOW_OBJS) $(UIDS_OBJS) $(GIDS_OBJS) $(TEST_NAT_OBJS) BINARIES = libnss_rainbow.so.2 uids gids test_nat # targets @@ -19,33 +25,34 @@ BINARIES = libnss_rainbow.so.2 uids gids test_nat all: $(BINARIES) clean: - rm -f $(BINARIES) $(RAINBOW_OBJS) $(UIDS_OBJS) $(GIDS_OBJS) $(TEST_NAT_OBJS) + rm -f $(BINARIES) *.d *.o install: - install -D -m 0755 libnss_rainbow.so.2 $(DESTDIR)/usr/lib/libnss_rainbow.so.2 - + install -D -m 0755 libnss_rainbow.so.2 $(LIBDIR)/libnss_rainbow.so.2 # objects %.o: %.c - $(CC) -g -std=gnu99 -fPIC $(WARNFLAGS) $(CFLAGS) -c -o $@ $< + $(CC) $(ALLCFLAGS) -c -o $@ $< # linked binaries test_nat: $(TEST_NAT_OBJS) - $(CC) -g -std=gnu99 $(WARNFLAGS) $(CFLAGS) -o $@ $^ + $(CC) $(ALLCFLAGS) -o $@ $^ uids: $(UIDS_OBJS) - $(CC) -g -std=gnu99 $(WARNFLAGS) $(CFLAGS) -o $@ $^ + $(CC) $(ALLCFLAGS) -o $@ $^ gids: $(GIDS_OBJS) - $(CC) -g -std=gnu99 $(WARNFLAGS) $(CFLAGS) -o $@ $^ + $(CC) $(ALLCFLAGS) -o $@ $^ libnss_rainbow.so.2: $(RAINBOW_OBJS) - $(CC) -g -std=gnu99 -shared $(LDFLAGS) -o $@ -Wl,-soname,$@ $^ + $(CC) -g -shared $(LDFLAGS) -o $@ -Wl,-soname,$@ $^ .PHONY: clean install +-include $(ALL_OBJS:%.o=%.d) + # vim: noet sts=4 ts=4 sw=4 : diff --git a/config/debug.h b/config/debug.h new file mode 100644 index 0000000..a4e10bf --- /dev/null +++ b/config/debug.h @@ -0,0 +1,3 @@ +/* Name of the environment variable whose definition will trigger nss-rainbow + * debug output. */ +#define DEBUG "NSS_RAINBOW_DEBUG" diff --git a/config/shell.h b/config/shell.h new file mode 100644 index 0000000..d88348b --- /dev/null +++ b/config/shell.h @@ -0,0 +1,2 @@ +/* Default shell for rainbow-created uids. */ +#define SHELL "/bin/bash" diff --git a/config/spool.h b/config/spool.h new file mode 100644 index 0000000..44c685e --- /dev/null +++ b/config/spool.h @@ -0,0 +1,2 @@ +/* Location where the rainbow user/group database is stored. */ +#define SPOOL "/var/spool/rainbow/2" diff --git a/nss-rainbow.c b/nss-rainbow.c index ae7bb8c..bc51102 100644 --- a/nss-rainbow.c +++ b/nss-rainbow.c @@ -23,9 +23,9 @@ #include "list.h" /* constants */ -#define SHELL "/bin/bash" -#define SPOOL "/home/olpc/isolation/1" -#define DEBUG "RAINBOW_NSS_DEBUG" +#include "config/shell.h" +#include "config/debug.h" +#include "config/spool.h" static unsigned char g_uids[65536]; static unsigned short g_uid = 0; |