]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
nspawn: don't muck with caps if no network setting is used in settings file 21283/head
authorLennart Poettering <lennart@poettering.net>
Tue, 9 Nov 2021 17:27:40 +0000 (18:27 +0100)
committerLennart Poettering <lennart@poettering.net>
Tue, 9 Nov 2021 17:32:30 +0000 (18:32 +0100)
Our goal here (as in the previous commits) is to ensure that a settings
file loaded in --settings=override mode is truly a NOP. Previously this
was not the case as we'd drop CAP_NET_ADMIN from the caps if the
settings file didn't enable networking.

With this change we'll drop it only if explicitly turned off in the
settings file, and otherwise let the built-in defaults and cmdline
params reign supreme as documented.

Fixes: #20055
src/nspawn/nspawn.c

index 9adc166aa9cc0436294d5830b2f9bce71f40686d..66daeb4f649cd927d13e9993566d85fd5fe327d4 100644 (file)
@@ -4337,7 +4337,8 @@ static int merge_settings(Settings *settings, const char *path) {
                 plus = settings->capability;
                 minus = settings->drop_capability;
 
-                if ((arg_settings_mask & SETTING_NETWORK) == 0) {
+                if ((arg_settings_mask & SETTING_NETWORK) == 0 &&
+                    settings_network_configured(settings)) {
                         if (settings_private_network(settings))
                                 plus |= UINT64_C(1) << CAP_NET_ADMIN;
                         else