[systemd-devel] [PATCH] Reset the context of /run/user/UID to the default. Bug #1097901.

Lennart Poettering lennart at poettering.net
Thu May 15 09:24:38 PDT 2014


On Thu, 15.05.14 14:54, Miroslav Grepl (mgrepl at redhat.com) wrote:

> ---
>  src/login/logind-user.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/src/login/logind-user.c b/src/login/logind-user.c
> index 961cbcb..42946ae 100644
> --- a/src/login/logind-user.c
> +++ b/src/login/logind-user.c
> @@ -337,6 +337,7 @@ static int user_mkdir_runtime_path(User *u) {
>                  }
>          }
>  
> +        label_fix(p,false,false);

Please follow the use coding style, i.e. spaces after the ","

>          u->runtime_path = p;
>          return 0;
>  
> @@ -423,7 +424,9 @@ int user_start(User *u) {
>          log_debug("New user %s logged in.", u->name);
>  
>          /* Make XDG_RUNTIME_DIR */
> +        label_init("/var/run/user");

This looks incorrect. label_init() will be a NOP the second it is
called, and we already call it in logind, with the /etc prefix, hence
we'll only load an incomplete database for the other invocation...

>          r = user_mkdir_runtime_path(u);
> +        label_finish();
>          if (r < 0)
>                  return r;

Why is this necessary, even? I though selinux in the kernel was nowadays
able to take the file name to create into account when applying a label,
so why do we need userspace magic for this?

Lennart

-- 
Lennart Poettering, Red Hat


More information about the systemd-devel mailing list