]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
tree-wide: use JSON_ALLOW_EXTENSIONS when disptching at various places 30785/head
authorLennart Poettering <lennart@poettering.net>
Fri, 5 Jan 2024 11:39:28 +0000 (12:39 +0100)
committerLennart Poettering <lennart@poettering.net>
Fri, 5 Jan 2024 11:43:06 +0000 (12:43 +0100)
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.

src/hibernate-resume/hibernate-resume-config.c
src/network/networkctl.c
src/nss-resolve/nss-resolve.c
src/shared/group-record.c
src/shared/user-record.c
src/shared/userdb.c

index a751a0ac4cdad9dc07963c494c40e2321f68bfda..c6db83a9d3b0ca26d6c29f90cacc35ff8310c4e1 100644 (file)
@@ -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;
 
index 8e677cc01085b4b0ac706994cc2b071f942d9d4c..95e22cd9e3981181e60a9611e20307b0472146a6 100644 (file)
@@ -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;
 
index c4e02bc7c13ef15b336bb4c9b33a10b2ec2055eb..822ad4f6221eae37674cf0825abc8acdfacd3ee0 100644 (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();
index 1e33bdfed58fb1d19c3bfa50f01f55bd134138e6..4fed5c671cd3d9271eca65fb294c754c3689bf87 100644 (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;
 
index 3fe3e80b833ba0baa0cf25771ec638b8b6df79a4..035e2a71247cf60e0b5041ed78cee2d71b2bb005 100644 (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;
 
index f60d48ace4f7297e310988469faea9eb8dbae1db..540573390c877d086c5ebb13f34fac074e28a74b 100644 (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;