summaryrefslogtreecommitdiff
path: root/src/resolve/resolved.c
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2014-10-13 22:27:43 -0400
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2014-10-13 22:37:13 -0400
commita5a807e63a50314e190e9166d8a453cd8dd258e3 (patch)
treed906ba643b17791f74fd4611a1eb679392e8a42e /src/resolve/resolved.c
parent4713135eae4f7b6b670a98476fe413edfa1d9f41 (diff)
resolved: apply label to /run/systemd/resolve/resolv.conf
Under an SELinux system, we want the file that is created to have a proper context, different from the default for files in /run. This is so that the policy can give access to almost everyone to this file.
Diffstat (limited to 'src/resolve/resolved.c')
-rw-r--r--src/resolve/resolved.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/resolve/resolved.c b/src/resolve/resolved.c
index 88c3bcc591..ef416e5cae 100644
--- a/src/resolve/resolved.c
+++ b/src/resolve/resolved.c
@@ -38,14 +38,20 @@ int main(int argc, char *argv[]) {
log_parse_environment();
log_open();
- umask(0022);
-
if (argc != 1) {
log_error("This program takes no arguments.");
r = -EINVAL;
goto finish;
}
+ umask(0022);
+
+ r = label_init(NULL);
+ if (r < 0) {
+ log_error("SELinux setup failed: %s", strerror(-r));
+ goto finish;
+ }
+
r = get_user_creds(&user, &uid, &gid, NULL, NULL);
if (r < 0) {
log_error("Cannot resolve user name %s: %s", user, strerror(-r));