diff options
author | Damien Miller <djm@mindrot.org> | 2011-01-28 00:30:18 +0100 |
---|---|---|
committer | Damien Miller <djm@mindrot.org> | 2011-01-28 00:30:18 +0100 |
commit | d4a5504cb19acf061bc6d68362b666416b21d9b3 (patch) | |
tree | 29cd39855abe1013454115014a9873729f23b225 /openbsd-compat/port-linux.c | |
parent | 20110127 (diff) | |
download | openssh-d4a5504cb19acf061bc6d68362b666416b21d9b3.tar.xz openssh-d4a5504cb19acf061bc6d68362b666416b21d9b3.zip |
- (djm) [openbsd-compat/port-linux.c] Check whether SELinux is enabled
before attempting setfscreatecon(). Check whether matchpathcon()
succeeded before using its result. Patch from cjwatson AT debian.org;
bz#1851
Diffstat (limited to 'openbsd-compat/port-linux.c')
-rw-r--r-- | openbsd-compat/port-linux.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/openbsd-compat/port-linux.c b/openbsd-compat/port-linux.c index b152efc29..eb280e616 100644 --- a/openbsd-compat/port-linux.c +++ b/openbsd-compat/port-linux.c @@ -1,4 +1,4 @@ -/* $Id: port-linux.c,v 1.12 2011/01/25 01:16:18 djm Exp $ */ +/* $Id: port-linux.c,v 1.13 2011/01/27 23:30:20 djm Exp $ */ /* * Copyright (c) 2005 Daniel Walsh <dwalsh@redhat.com> @@ -209,13 +209,15 @@ ssh_selinux_change_context(const char *newname) void ssh_selinux_setfscreatecon(const char *path) { - security_context_t context; + security_context_t context; - if (path == NULL) { - setfscreatecon(NULL); - return; - } - matchpathcon(path, 0700, &context); + if (!ssh_selinux_enabled()) + return; + if (path == NULL) + setfscreatecon(NULL); + return; + } + if (matchpathcon(path, 0700, &context) == 0) setfscreatecon(context); } |