|
Zbigniew Jędrzejewski-Szmek |
2b6823 |
From 4f1ae61da9eda1115c1461e77a44101d96532700 Mon Sep 17 00:00:00 2001
|
|
Zbigniew Jędrzejewski-Szmek |
2b6823 |
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
|
|
Zbigniew Jędrzejewski-Szmek |
2b6823 |
Date: Wed, 2 Mar 2016 10:16:39 -0500
|
|
Zbigniew Jędrzejewski-Szmek |
2b6823 |
Subject: [PATCH] selinux: use raw variants of security_compute_create and
|
|
Zbigniew Jędrzejewski-Szmek |
2b6823 |
setfscreatecon
|
|
Zbigniew Jędrzejewski-Szmek |
2b6823 |
|
|
Zbigniew Jędrzejewski-Szmek |
2b6823 |
As suggested by Evgeny Vereshchagin as a follow up for
|
|
Zbigniew Jędrzejewski-Szmek |
2b6823 |
https://github.com/systemd/systemd/pull/2781#issuecomment-191043402.
|
|
Zbigniew Jędrzejewski-Szmek |
2b6823 |
|
|
Zbigniew Jędrzejewski-Szmek |
2b6823 |
(cherry picked from commit 5c5433ad32c3d911f0c66cc124d190d40a2b5f5b)
|
|
Zbigniew Jędrzejewski-Szmek |
2b6823 |
---
|
|
Zbigniew Jędrzejewski-Szmek |
2b6823 |
src/basic/selinux-util.c | 6 +++---
|
|
Zbigniew Jędrzejewski-Szmek |
2b6823 |
1 file changed, 3 insertions(+), 3 deletions(-)
|
|
Zbigniew Jędrzejewski-Szmek |
2b6823 |
|
|
Zbigniew Jędrzejewski-Szmek |
2b6823 |
diff --git a/src/basic/selinux-util.c b/src/basic/selinux-util.c
|
|
Zbigniew Jędrzejewski-Szmek |
2b6823 |
index 71ceac1bcd..5e6181f662 100644
|
|
Zbigniew Jędrzejewski-Szmek |
2b6823 |
--- a/src/basic/selinux-util.c
|
|
Zbigniew Jędrzejewski-Szmek |
2b6823 |
+++ b/src/basic/selinux-util.c
|
|
Zbigniew Jędrzejewski-Szmek |
2b6823 |
@@ -217,7 +217,7 @@ int mac_selinux_get_create_label_from_exe(const char *exe, char **label) {
|
|
Zbigniew Jędrzejewski-Szmek |
2b6823 |
return -errno;
|
|
Zbigniew Jędrzejewski-Szmek |
2b6823 |
|
|
Zbigniew Jędrzejewski-Szmek |
2b6823 |
sclass = string_to_security_class("process");
|
|
Zbigniew Jędrzejewski-Szmek |
2b6823 |
- r = security_compute_create(mycon, fcon, sclass, (security_context_t *) label);
|
|
Zbigniew Jędrzejewski-Szmek |
2b6823 |
+ r = security_compute_create_raw(mycon, fcon, sclass, (security_context_t *) label);
|
|
Zbigniew Jędrzejewski-Szmek |
2b6823 |
if (r < 0)
|
|
Zbigniew Jędrzejewski-Szmek |
2b6823 |
return -errno;
|
|
Zbigniew Jędrzejewski-Szmek |
2b6823 |
#endif
|
|
Zbigniew Jędrzejewski-Szmek |
2b6823 |
@@ -296,7 +296,7 @@ int mac_selinux_get_child_mls_label(int socket_fd, const char *exe, const char *
|
|
Zbigniew Jędrzejewski-Szmek |
2b6823 |
return -ENOMEM;
|
|
Zbigniew Jędrzejewski-Szmek |
2b6823 |
|
|
Zbigniew Jędrzejewski-Szmek |
2b6823 |
sclass = string_to_security_class("process");
|
|
Zbigniew Jędrzejewski-Szmek |
2b6823 |
- r = security_compute_create(mycon, fcon, sclass, (security_context_t *) label);
|
|
Zbigniew Jędrzejewski-Szmek |
2b6823 |
+ r = security_compute_create_raw(mycon, fcon, sclass, (security_context_t *) label);
|
|
Zbigniew Jędrzejewski-Szmek |
2b6823 |
if (r < 0)
|
|
Zbigniew Jędrzejewski-Szmek |
2b6823 |
return -errno;
|
|
Zbigniew Jędrzejewski-Szmek |
2b6823 |
#endif
|
|
Zbigniew Jędrzejewski-Szmek |
2b6823 |
@@ -350,7 +350,7 @@ int mac_selinux_create_file_prepare(const char *path, mode_t mode) {
|
|
Zbigniew Jędrzejewski-Szmek |
2b6823 |
|
|
Zbigniew Jędrzejewski-Szmek |
2b6823 |
log_enforcing("Failed to determine SELinux security context for %s: %m", path);
|
|
Zbigniew Jędrzejewski-Szmek |
2b6823 |
} else {
|
|
Zbigniew Jędrzejewski-Szmek |
2b6823 |
- if (setfscreatecon(filecon) >= 0)
|
|
Zbigniew Jędrzejewski-Szmek |
2b6823 |
+ if (setfscreatecon_raw(filecon) >= 0)
|
|
Zbigniew Jędrzejewski-Szmek |
2b6823 |
return 0; /* Success! */
|
|
Zbigniew Jędrzejewski-Szmek |
2b6823 |
|
|
Zbigniew Jędrzejewski-Szmek |
2b6823 |
log_enforcing("Failed to set SELinux security context %s for %s: %m", filecon, path);
|