From: Lennart Poettering Date: Fri, 5 Jan 2024 11:39:28 +0000 (+0100) Subject: tree-wide: use JSON_ALLOW_EXTENSIONS when disptching at various places X-Git-Tag: v256-rc1~1265^2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F30785%2Fhead;p=thirdparty%2Fsystemd.git 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. --- diff --git a/src/hibernate-resume/hibernate-resume-config.c b/src/hibernate-resume/hibernate-resume-config.c index a751a0ac4cd..c6db83a9d3b 100644 --- a/src/hibernate-resume/hibernate-resume-config.c +++ b/src/hibernate-resume/hibernate-resume-config.c @@ -192,7 +192,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; diff --git a/src/network/networkctl.c b/src/network/networkctl.c index 8e677cc0108..95e22cd9e39 100644 --- a/src/network/networkctl.c +++ b/src/network/networkctl.c @@ -113,7 +113,7 @@ static int check_netns_match(void) { {}, }; - r = json_dispatch(reply, dispatch_table, JSON_LOG, &id); + r = json_dispatch(reply, dispatch_table, JSON_LOG|JSON_ALLOW_EXTENSIONS, &id); if (r < 0) return r; diff --git a/src/nss-resolve/nss-resolve.c b/src/nss-resolve/nss-resolve.c index c4e02bc7c13..822ad4f6221 100644 --- a/src/nss-resolve/nss-resolve.c +++ b/src/nss-resolve/nss-resolve.c @@ -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(); diff --git a/src/shared/group-record.c b/src/shared/group-record.c index 1e33bdfed58..4fed5c671cd 100644 --- a/src/shared/group-record.c +++ b/src/shared/group-record.c @@ -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; diff --git a/src/shared/user-record.c b/src/shared/user-record.c index 3fe3e80b833..035e2a71247 100644 --- a/src/shared/user-record.c +++ b/src/shared/user-record.c @@ -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; diff --git a/src/shared/userdb.c b/src/shared/userdb.c index f60d48ace4f..540573390c8 100644 --- a/src/shared/userdb.c +++ b/src/shared/userdb.c @@ -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;