nspawn: make sure --private-users-ownership=no and =off work the same way
authorLennart Poettering <lennart@poettering.net>
Wed, 27 Nov 2024 09:20:21 +0000 (10:20 +0100)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Wed, 27 Nov 2024 15:47:14 +0000 (00:47 +0900)
We usually want to use "extended booleans" for cases like this, i.e.
that "off", "no" and "0" can be used interchangably for turning
something off.

src/nspawn/nspawn-settings.c

index 587da92cb27c334ab59d831cb6b8cfdf14d1f25c..7842d93c34a9ecea997a99cef22fd81f594bc2ea 100644 (file)
@@ -936,7 +936,8 @@ static const char *const user_namespace_ownership_table[_USER_NAMESPACE_OWNERSHI
         [USER_NAMESPACE_OWNERSHIP_AUTO]  = "auto",
 };
 
-DEFINE_STRING_TABLE_LOOKUP(user_namespace_ownership, UserNamespaceOwnership);
+/* Note: while "yes" maps to "auto" here, we don't really document that, in order to make things clearer and less confusing to users. */
+DEFINE_STRING_TABLE_LOOKUP_WITH_BOOLEAN(user_namespace_ownership, UserNamespaceOwnership, USER_NAMESPACE_OWNERSHIP_AUTO);
 
 int config_parse_userns_chown(
                 const char *unit,