From d3cbab9b3cf9bdfc0af94830fa2b7b373f7f66de Mon Sep 17 00:00:00 2001 From: netblue30 Date: Sat, 14 Nov 2015 13:20:47 -0500 Subject: fixed sysconfdir --- src/firejail/Makefile.in | 4 +++- src/firejail/main.c | 4 ++-- src/firejail/profile.c | 2 +- src/firejail/restricted_shell.c | 6 +++++- 4 files changed, 11 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/firejail/Makefile.in b/src/firejail/Makefile.in index 255784ac7..c2663f1a9 100644 --- a/src/firejail/Makefile.in +++ b/src/firejail/Makefile.in @@ -3,6 +3,7 @@ all: firejail prefix=@prefix@ exec_prefix=@exec_prefix@ libdir=@libdir@ +sysconfdir=@sysconfdir@ VERSION=@PACKAGE_VERSION@ NAME=@PACKAGE_NAME@ @@ -12,11 +13,12 @@ HAVE_CHROOT=@HAVE_CHROOT@ HAVE_BIND=@HAVE_BIND@ HAVE_FATAL_WARNINGS=@HAVE_FATAL_WARNINGS@ + H_FILE_LIST = $(wildcard *.[h]) C_FILE_LIST = $(wildcard *.c) OBJS = $(C_FILE_LIST:.c=.o) BINOBJS = $(foreach file, $(OBJS), $file) -CFLAGS += -ggdb $(HAVE_FATAL_WARNINGS) -O2 -DVERSION='"$(VERSION)"' -DPREFIX='"$(prefix)"' -DLIBDIR='"$(libdir)"' $(HAVE_SECCOMP) $(HAVE_SECCOMP_H) $(HAVE_CHROOT) $(HAVE_BIND) -fstack-protector-all -D_FORTIFY_SOURCE=2 -fPIE -pie -Wformat -Wformat-security +CFLAGS += -ggdb $(HAVE_FATAL_WARNINGS) -O2 -DVERSION='"$(VERSION)"' -DPREFIX='"$(prefix)"' -DSYSCONFDIR='"$(sysconfdir)/firejail"' -DLIBDIR='"$(libdir)"' $(HAVE_SECCOMP) $(HAVE_SECCOMP_H) $(HAVE_CHROOT) $(HAVE_BIND) -fstack-protector-all -D_FORTIFY_SOURCE=2 -fPIE -pie -Wformat -Wformat-security LDFLAGS += -pie -Wl,-z,relro -Wl,-z,now -lpthread %.o : %.c $(H_FILE_LIST) diff --git a/src/firejail/main.c b/src/firejail/main.c index 601999db5..3a2da0852 100644 --- a/src/firejail/main.c +++ b/src/firejail/main.c @@ -1222,7 +1222,7 @@ int main(int argc, char **argv) { } if (!custom_profile) { // look for a user profile in /etc/firejail directory - int rv = profile_find(cfg.command_name, "/etc/firejail"); + int rv = profile_find(cfg.command_name, SYSCONFDIR); custom_profile = rv; } } @@ -1252,7 +1252,7 @@ int main(int argc, char **argv) { if (!custom_profile) { // look for the profile in /etc/firejail directory - custom_profile = profile_find(profile_name, "/etc/firejail"); + custom_profile = profile_find(profile_name, SYSCONFDIR); } if (custom_profile && !arg_quiet) diff --git a/src/firejail/profile.c b/src/firejail/profile.c index 5ab6bc776..de89cf40f 100644 --- a/src/firejail/profile.c +++ b/src/firejail/profile.c @@ -429,7 +429,7 @@ void profile_read(const char *fname) { // open profile file: FILE *fp = fopen(fname, "r"); if (fp == NULL) { - fprintf(stderr, "Error: cannot open profile file\n"); + fprintf(stderr, "Error: cannot open profile file %s\n", fname); exit(1); } diff --git a/src/firejail/restricted_shell.c b/src/firejail/restricted_shell.c index 72354d71b..5b1ce12e0 100644 --- a/src/firejail/restricted_shell.c +++ b/src/firejail/restricted_shell.c @@ -27,7 +27,11 @@ int restricted_shell(const char *user) { assert(user); // open profile file: - FILE *fp = fopen("/etc/firejail/login.users", "r"); + char *fname; + if (asprintf(&fname, "%s/login.users", SYSCONFDIR) == -1) + errExit("asprintf"); + FILE *fp = fopen(fname, "r"); + free(fname); if (fp == NULL) return 0; -- cgit v1.2.3-54-g00ecf