1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2025-03-12 08:58:20 +03:00

tree-wide: use JSON_ALLOW_EXTENSIONS when disptching at various places

If we want to allow method replies to be extended without this breaking
compat, then we should set this flag. Do so at various method call
replies hence.

Also do it when parsing user/group records, which are expressly
documented to be extensible, as well as the hibernate JSON record.

(cherry picked from commit f0e4244b2fda1b3de3da1c2792ed1cd21c72087b)
This commit is contained in:
Lennart Poettering 2024-01-05 12:39:28 +01:00 committed by Luca Boccassi
parent 4e78e189a3
commit 0283b9b43b
5 changed files with 7 additions and 7 deletions

View File

@ -173,7 +173,7 @@ static int get_efi_hibernate_location(EFIHibernateLocation **ret) {
if (!e)
return log_oom();
r = json_dispatch(v, dispatch_table, JSON_LOG, e);
r = json_dispatch(v, dispatch_table, JSON_LOG|JSON_ALLOW_EXTENSIONS, e);
if (r < 0)
return r;

View File

@ -20,7 +20,7 @@
#include "strv.h"
#include "varlink.h"
static JsonDispatchFlags json_dispatch_flags = 0;
static JsonDispatchFlags json_dispatch_flags = JSON_ALLOW_EXTENSIONS;
static void setup_logging(void) {
log_parse_environment_variables();

View File

@ -230,7 +230,7 @@ int group_record_load(
if (r < 0)
return r;
r = json_dispatch(h->json, group_dispatch_table, json_flags, h);
r = json_dispatch(h->json, group_dispatch_table, json_flags | JSON_ALLOW_EXTENSIONS, h);
if (r < 0)
return r;

View File

@ -1625,7 +1625,7 @@ int user_record_load(UserRecord *h, JsonVariant *v, UserRecordLoadFlags load_fla
if (r < 0)
return r;
r = json_dispatch(h->json, user_dispatch_table, json_flags, h);
r = json_dispatch(h->json, user_dispatch_table, json_flags | JSON_ALLOW_EXTENSIONS, h);
if (r < 0)
return r;

View File

@ -199,7 +199,7 @@ static int userdb_on_query_reply(
assert_se(!iterator->found_user);
r = json_dispatch(parameters, dispatch_table, 0, &user_data);
r = json_dispatch(parameters, dispatch_table, JSON_ALLOW_EXTENSIONS, &user_data);
if (r < 0)
goto finish;
@ -256,7 +256,7 @@ static int userdb_on_query_reply(
assert_se(!iterator->found_group);
r = json_dispatch(parameters, dispatch_table, 0, &group_data);
r = json_dispatch(parameters, dispatch_table, JSON_ALLOW_EXTENSIONS, &group_data);
if (r < 0)
goto finish;
@ -309,7 +309,7 @@ static int userdb_on_query_reply(
assert(!iterator->found_user_name);
assert(!iterator->found_group_name);
r = json_dispatch(parameters, dispatch_table, 0, &membership_data);
r = json_dispatch(parameters, dispatch_table, JSON_ALLOW_EXTENSIONS, &membership_data);
if (r < 0)
goto finish;