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

Miroslav Grepl mgrepl at redhat.com
Thu May 15 09:54:35 PDT 2014


On 05/15/2014 06:24 PM, Lennart Poettering wrote:
> 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);
Sorry for that.
> 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...
Well I thought it too but it was not working without this initialization.
>>           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?
See

https://bugzilla.redhat.com/show_bug.cgi?id=1092059#c0
>
> Lennart
>
Regards,
Miroslav


More information about the systemd-devel mailing list