]> git.ipfire.org Git - thirdparty/systemd.git/commit
nsresourced: use a hashed rather than a mangled name as fallback
authorLennart Poettering <lennart@poettering.net>
Tue, 26 Aug 2025 07:00:06 +0000 (09:00 +0200)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Tue, 26 Aug 2025 13:30:39 +0000 (15:30 +0200)
commit3ef74e44b81add0191a59c624a0119a7aaca2ea2
tree09b837d584d6ad7b7474cb47472bf65fa0edd2ac
parent06de39b3bdb20496e6ca96600c145151de58ca84
nsresourced: use a hashed rather than a mangled name as fallback

If we are asked to come up with our own name for the namespace to
allocate (because client enabled "mangle"), then we so far created a
randomized name if shortening what was proposed didn't work. This broke
polkit authorization however, because when polkit is in the mix, we
process method calls twice, submitting the polkit request on the first
and then assuming a response is known on the second invocation. But if
we generate a randomized name for the two checks we'll not be ablet to
match up the requests because it's going to be different. Let's fix that
by not using a randomized name, but one hashed from the socket
connection we are processing mixed with the client provided name. This
will ensure that for the same method call we'll generate the same name,
but different calls (i.e. calls with different names on the same socket,
or with any name on any socket) we'll end up with different names,
minimizing chance of collision.

This ensures PK starts to work with nsresourced userns registration when
a bad or no name is specified, which previously would end up in a PK
query loop.
src/nsresourced/nsresourcework.c