diff options
author | Darren Tucker <dtucker@zip.com.au> | 2008-03-27 07:27:20 +1100 |
---|---|---|
committer | Darren Tucker <dtucker@zip.com.au> | 2008-03-27 07:27:20 +1100 |
commit | b8eb586412f338dcee69639ae375d5f72e26a094 (patch) | |
tree | 01aae213b6980e733522d5c1fa235519aaf82649 | |
parent | a19390067474ab3a8ad806dbf551fd84164e78a4 (diff) |
- (dtucker) Cache selinux status earlier so we know if it's enabled after a
chroot. Allows ChrootDirectory to work with selinux support compiled in
but not enabled. Using it with selinux enabled will require some selinux
support inside the chroot. "looks sane" djm@
-rw-r--r-- | ChangeLog | 8 | ||||
-rw-r--r-- | openbsd-compat/port-linux.c | 4 | ||||
-rw-r--r-- | openbsd-compat/port-linux.h | 3 | ||||
-rw-r--r-- | session.c | 5 |
4 files changed, 16 insertions, 4 deletions
@@ -1,3 +1,9 @@ | |||
1 | 20080327 | ||
2 | - (dtucker) Cache selinux status earlier so we know if it's enabled after a | ||
3 | chroot. Allows ChrootDirectory to work with selinux support compiled in | ||
4 | but not enabled. Using it with selinux enabled will require some selinux | ||
5 | support inside the chroot. "looks sane" djm@ | ||
6 | |||
1 | 20080315 | 7 | 20080315 |
2 | - (djm) [regress/test-exec.sh] Quote putty-related variables in case they are | 8 | - (djm) [regress/test-exec.sh] Quote putty-related variables in case they are |
3 | empty; report and patch from Peter Stuge | 9 | empty; report and patch from Peter Stuge |
@@ -3765,4 +3771,4 @@ | |||
3765 | OpenServer 6 and add osr5bigcrypt support so when someone migrates | 3771 | OpenServer 6 and add osr5bigcrypt support so when someone migrates |
3766 | passwords between UnixWare and OpenServer they will still work. OK dtucker@ | 3772 | passwords between UnixWare and OpenServer they will still work. OK dtucker@ |
3767 | 3773 | ||
3768 | $Id: ChangeLog,v 1.4879 2008/03/15 06:27:58 djm Exp $ | 3774 | $Id: ChangeLog,v 1.4880 2008/03/26 20:27:20 dtucker Exp $ |
diff --git a/openbsd-compat/port-linux.c b/openbsd-compat/port-linux.c index 2f697e7d9..ad262758e 100644 --- a/openbsd-compat/port-linux.c +++ b/openbsd-compat/port-linux.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $Id: port-linux.c,v 1.4 2007/06/27 22:48:03 djm Exp $ */ | 1 | /* $Id: port-linux.c,v 1.5 2008/03/26 20:27:21 dtucker Exp $ */ |
2 | 2 | ||
3 | /* | 3 | /* |
4 | * Copyright (c) 2005 Daniel Walsh <dwalsh@redhat.com> | 4 | * Copyright (c) 2005 Daniel Walsh <dwalsh@redhat.com> |
@@ -36,7 +36,7 @@ | |||
36 | #include <selinux/get_context_list.h> | 36 | #include <selinux/get_context_list.h> |
37 | 37 | ||
38 | /* Wrapper around is_selinux_enabled() to log its return value once only */ | 38 | /* Wrapper around is_selinux_enabled() to log its return value once only */ |
39 | static int | 39 | int |
40 | ssh_selinux_enabled(void) | 40 | ssh_selinux_enabled(void) |
41 | { | 41 | { |
42 | static int enabled = -1; | 42 | static int enabled = -1; |
diff --git a/openbsd-compat/port-linux.h b/openbsd-compat/port-linux.h index 05e520e1c..5cd39bf83 100644 --- a/openbsd-compat/port-linux.h +++ b/openbsd-compat/port-linux.h | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $Id: port-linux.h,v 1.1 2006/04/22 11:26:08 djm Exp $ */ | 1 | /* $Id: port-linux.h,v 1.2 2008/03/26 20:27:21 dtucker Exp $ */ |
2 | 2 | ||
3 | /* | 3 | /* |
4 | * Copyright (c) 2006 Damien Miller <djm@openbsd.org> | 4 | * Copyright (c) 2006 Damien Miller <djm@openbsd.org> |
@@ -20,6 +20,7 @@ | |||
20 | #define _PORT_LINUX_H | 20 | #define _PORT_LINUX_H |
21 | 21 | ||
22 | #ifdef WITH_SELINUX | 22 | #ifdef WITH_SELINUX |
23 | int ssh_selinux_enabled(void); | ||
23 | void ssh_selinux_setup_pty(char *, const char *); | 24 | void ssh_selinux_setup_pty(char *, const char *); |
24 | void ssh_selinux_setup_exec_context(char *); | 25 | void ssh_selinux_setup_exec_context(char *); |
25 | #endif | 26 | #endif |
@@ -1345,6 +1345,11 @@ do_setusercontext(struct passwd *pw) | |||
1345 | { | 1345 | { |
1346 | char *chroot_path, *tmp; | 1346 | char *chroot_path, *tmp; |
1347 | 1347 | ||
1348 | #ifdef WITH_SELINUX | ||
1349 | /* Cache selinux status for later use */ | ||
1350 | (void)ssh_selinux_enabled(); | ||
1351 | #endif | ||
1352 | |||
1348 | #ifndef HAVE_CYGWIN | 1353 | #ifndef HAVE_CYGWIN |
1349 | if (getuid() == 0 || geteuid() == 0) | 1354 | if (getuid() == 0 || geteuid() == 0) |
1350 | #endif /* HAVE_CYGWIN */ | 1355 | #endif /* HAVE_CYGWIN */ |