1
0
mirror of https://github.com/systemd/systemd.git synced 2025-01-11 09:18:07 +03:00

tree-wide: fix type confusion around parsing JSON booleans

Sometimes we store them in a tristate, sometimes in C stdbool booleans.
Sometimes we fucked up picking the right parsing function however. Fix
that.
This commit is contained in:
Lennart Poettering 2024-05-02 15:25:34 +02:00 committed by Luca Boccassi
parent 5535a9484e
commit 61ab5ddcdc
3 changed files with 6 additions and 6 deletions

View File

@ -417,7 +417,7 @@ static int oci_process(const char *name, JsonVariant *v, JsonDispatchFlags flags
{ "rlimits", JSON_VARIANT_ARRAY, oci_rlimits, 0, 0 },
{ "apparmorProfile", JSON_VARIANT_STRING, oci_unsupported, 0, JSON_PERMISSIVE },
{ "capabilities", JSON_VARIANT_OBJECT, oci_capabilities, 0, 0 },
{ "noNewPrivileges", JSON_VARIANT_BOOLEAN, json_dispatch_boolean, offsetof(Settings, no_new_privileges), 0 },
{ "noNewPrivileges", JSON_VARIANT_BOOLEAN, json_dispatch_tristate,offsetof(Settings, no_new_privileges), 0 },
{ "oomScoreAdj", JSON_VARIANT_INTEGER, oci_oom_score_adj, 0, 0 },
{ "selinuxLabel", JSON_VARIANT_STRING, oci_unsupported, 0, JSON_PERMISSIVE },
{ "user", JSON_VARIANT_OBJECT, oci_user, 0, 0 },
@ -433,7 +433,7 @@ static int oci_root(const char *name, JsonVariant *v, JsonDispatchFlags flags, v
static const JsonDispatch table[] = {
{ "path", JSON_VARIANT_STRING, json_dispatch_string, offsetof(Settings, root) },
{ "readonly", JSON_VARIANT_BOOLEAN, json_dispatch_boolean, offsetof(Settings, read_only) },
{ "readonly", JSON_VARIANT_BOOLEAN, json_dispatch_tristate,offsetof(Settings, read_only) },
{}
};

View File

@ -1401,7 +1401,7 @@ static int dispatch_status(const char *name, JsonVariant *variant, JsonDispatchF
{ "lastBadAuthenticationUSec", _JSON_VARIANT_TYPE_INVALID, json_dispatch_uint64, offsetof(UserRecord, last_bad_authentication_usec), 0 },
{ "rateLimitBeginUSec", _JSON_VARIANT_TYPE_INVALID, json_dispatch_uint64, offsetof(UserRecord, ratelimit_begin_usec), 0 },
{ "rateLimitCount", _JSON_VARIANT_TYPE_INVALID, json_dispatch_uint64, offsetof(UserRecord, ratelimit_count), 0 },
{ "removable", JSON_VARIANT_BOOLEAN, json_dispatch_boolean, offsetof(UserRecord, removable), 0 },
{ "removable", JSON_VARIANT_BOOLEAN, json_dispatch_tristate, offsetof(UserRecord, removable), 0 },
{ "accessMode", JSON_VARIANT_UNSIGNED, json_dispatch_access_mode, offsetof(UserRecord, access_mode), 0 },
{ "fileSystemType", JSON_VARIANT_STRING, json_dispatch_string, offsetof(UserRecord, file_system_type), JSON_SAFE },
{ "fallbackShell", JSON_VARIANT_STRING, json_dispatch_filename_or_path, offsetof(UserRecord, fallback_shell), 0 },

View File

@ -1922,9 +1922,9 @@ static int parse_merge_parameters(Varlink *link, JsonVariant *parameters, Method
static const JsonDispatch dispatch_table[] = {
{ "class", JSON_VARIANT_STRING, json_dispatch_const_string, offsetof(MethodMergeParameters, class), 0 },
{ "force", JSON_VARIANT_BOOLEAN, json_dispatch_boolean, offsetof(MethodMergeParameters, force), 0 },
{ "noReload", JSON_VARIANT_BOOLEAN, json_dispatch_boolean, offsetof(MethodMergeParameters, no_reload), 0 },
{ "noexec", JSON_VARIANT_BOOLEAN, json_dispatch_boolean, offsetof(MethodMergeParameters, noexec), 0 },
{ "force", JSON_VARIANT_BOOLEAN, json_dispatch_tristate, offsetof(MethodMergeParameters, force), 0 },
{ "noReload", JSON_VARIANT_BOOLEAN, json_dispatch_tristate, offsetof(MethodMergeParameters, no_reload), 0 },
{ "noexec", JSON_VARIANT_BOOLEAN, json_dispatch_tristate, offsetof(MethodMergeParameters, noexec), 0 },
{}
};