summaryrefslogtreecommitdiff
path: root/openbsd-compat
diff options
context:
space:
mode:
authorDamien Miller <djm@mindrot.org>2011-02-04 11:43:04 +1100
committerDamien Miller <djm@mindrot.org>2011-02-04 11:43:04 +1100
commit442366e667b29bba6c6a0bb400308a76e5db48bc (patch)
treea6f66f29af39db4a55d76fc8ac231f30353b7625 /openbsd-compat
parent8ba5292c25655a1002ec790f5840a7b8420091bf (diff)
20110128
- (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')
-rw-r--r--openbsd-compat/port-linux.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/openbsd-compat/port-linux.c b/openbsd-compat/port-linux.c
index ee4290b98..ede533fdd 100644
--- a/openbsd-compat/port-linux.c
+++ b/openbsd-compat/port-linux.c
@@ -1,4 +1,4 @@
1/* $Id: port-linux.c,v 1.11.4.1 2011/02/04 00:42:21 djm Exp $ */ 1/* $Id: port-linux.c,v 1.11.4.2 2011/02/04 00:43:08 djm Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 2005 Daniel Walsh <dwalsh@redhat.com> 4 * Copyright (c) 2005 Daniel Walsh <dwalsh@redhat.com>
@@ -209,13 +209,15 @@ ssh_selinux_change_context(const char *newname)
209void 209void
210ssh_selinux_setfscreatecon(const char *path) 210ssh_selinux_setfscreatecon(const char *path)
211{ 211{
212 security_context_t context; 212 security_context_t context;
213 213
214 if (path == NULL) { 214 if (!ssh_selinux_enabled())
215 setfscreatecon(NULL); 215 return;
216 return; 216 if (path == NULL)
217 } 217 setfscreatecon(NULL);
218 matchpathcon(path, 0700, &context); 218 return;
219 }
220 if (matchpathcon(path, 0700, &context) == 0)
219 setfscreatecon(context); 221 setfscreatecon(context);
220} 222}
221 223