summaryrefslogtreecommitdiff
path: root/debian/patches/selinux-setfscreatecon-crash.patch
blob: 8d09d35297adf5c1eec1d57a5b7b3075f0a38de5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
Description: Fix crash in ssh_selinux_setfscreatecon when SELinux is disabled
Author: Colin Watson <cjwatson@ubuntu.com>
Bug-Ubuntu: https://bugs.launchpad.net/bugs/708571
Forwarded: https://bugzilla.mindrot.org/show_bug.cgi?id=1851
Last-Update: 2011-01-27

Index: b/openbsd-compat/port-linux.c
===================================================================
--- a/openbsd-compat/port-linux.c
+++ b/openbsd-compat/port-linux.c
@@ -224,12 +224,15 @@
 {
 		security_context_t context;
 
+		if (!ssh_selinux_enabled())
+			return;
+
 		if (path == NULL) {
 			setfscreatecon(NULL);
 			return;
 		}
-		matchpathcon(path, 0700, &context);
-		setfscreatecon(context);
+		if (matchpathcon(path, 0700, &context) == 0)
+			setfscreatecon(context);
 }
 
 #endif /* WITH_SELINUX */