summaryrefslogtreecommitdiff
path: root/openbsd-compat/port-linux.c
diff options
context:
space:
mode:
authorColin Watson <cjwatson@debian.org>2011-01-27 12:12:48 +0000
committerColin Watson <cjwatson@debian.org>2011-01-27 12:12:48 +0000
commit04d4f897e99d3698a5b74088865cfdf1dd5243f1 (patch)
treef574a0e2a5be368887d99f6bb75d0f3e2faf56cd /openbsd-compat/port-linux.c
parent86e1c45f8f87b8da3ac1a8be06a09ee6576efe2e (diff)
Fix crash in ssh_selinux_setfscreatecon when SELinux is disabled
(LP: #708571).
Diffstat (limited to 'openbsd-compat/port-linux.c')
-rw-r--r--openbsd-compat/port-linux.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/openbsd-compat/port-linux.c b/openbsd-compat/port-linux.c
index 11385326e..a2498dc15 100644
--- a/openbsd-compat/port-linux.c
+++ b/openbsd-compat/port-linux.c
@@ -224,12 +224,15 @@ ssh_selinux_setfscreatecon(const char *path)
224{ 224{
225 security_context_t context; 225 security_context_t context;
226 226
227 if (!ssh_selinux_enabled())
228 return;
229
227 if (path == NULL) { 230 if (path == NULL) {
228 setfscreatecon(NULL); 231 setfscreatecon(NULL);
229 return; 232 return;
230 } 233 }
231 matchpathcon(path, 0700, &context); 234 if (matchpathcon(path, 0700, &context) == 0)
232 setfscreatecon(context); 235 setfscreatecon(context);
233} 236}
234 237
235#endif /* WITH_SELINUX */ 238#endif /* WITH_SELINUX */