summaryrefslogtreecommitdiffstats
path: root/src/machine/machined-varlink.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2024-05-22 22:40:33 +0200
committerLennart Poettering <lennart@poettering.net>2024-06-12 18:42:44 +0200
commitd3be2a75aec5d9c9bd751d892321b800e8a69915 (patch)
tree76594f38bad0259db51cc4b8164352ce96ea1659 /src/machine/machined-varlink.c
parenttest: extend JSON test coverage (diff)
downloadsystemd-d3be2a75aec5d9c9bd751d892321b800e8a69915.tar.xz
systemd-d3be2a75aec5d9c9bd751d892321b800e8a69915.zip
sd-json: rename SD_JSON_SAFE → SD_JSON_STRICT
The flag is fairly generic these days and just selects a slightly stricter validation, with details depending on the selected dispatch function. Hence, let's give it more precise name, in particular one that mirrors the SD_JSON_RELAXED flag nicely (which does the opposite: relaxes parsing)
Diffstat (limited to 'src/machine/machined-varlink.c')
-rw-r--r--src/machine/machined-varlink.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/machine/machined-varlink.c b/src/machine/machined-varlink.c
index 3c1f20eff8..3c680b92a4 100644
--- a/src/machine/machined-varlink.c
+++ b/src/machine/machined-varlink.c
@@ -142,9 +142,9 @@ static int user_lookup_name(Manager *m, const char *name, uid_t *ret_uid, char *
static int vl_method_get_user_record(Varlink *link, sd_json_variant *parameters, VarlinkMethodFlags flags, void *userdata) {
static const sd_json_dispatch_field dispatch_table[] = {
- { "uid", SD_JSON_VARIANT_UNSIGNED, sd_json_dispatch_uid_gid, offsetof(LookupParameters, uid), 0 },
- { "userName", SD_JSON_VARIANT_STRING, sd_json_dispatch_const_string, offsetof(LookupParameters, user_name), SD_JSON_SAFE },
- { "service", SD_JSON_VARIANT_STRING, sd_json_dispatch_const_string, offsetof(LookupParameters, service), 0 },
+ { "uid", SD_JSON_VARIANT_UNSIGNED, sd_json_dispatch_uid_gid, offsetof(LookupParameters, uid), 0 },
+ { "userName", SD_JSON_VARIANT_STRING, sd_json_dispatch_const_string, offsetof(LookupParameters, user_name), SD_JSON_STRICT },
+ { "service", SD_JSON_VARIANT_STRING, sd_json_dispatch_const_string, offsetof(LookupParameters, service), 0 },
{}
};
@@ -307,9 +307,9 @@ static int group_lookup_name(Manager *m, const char *name, gid_t *ret_gid, char
static int vl_method_get_group_record(Varlink *link, sd_json_variant *parameters, VarlinkMethodFlags flags, void *userdata) {
static const sd_json_dispatch_field dispatch_table[] = {
- { "gid", SD_JSON_VARIANT_UNSIGNED, sd_json_dispatch_uid_gid, offsetof(LookupParameters, gid), 0 },
- { "groupName", SD_JSON_VARIANT_STRING, sd_json_dispatch_const_string, offsetof(LookupParameters, group_name), SD_JSON_SAFE },
- { "service", SD_JSON_VARIANT_STRING, sd_json_dispatch_const_string, offsetof(LookupParameters, service), 0 },
+ { "gid", SD_JSON_VARIANT_UNSIGNED, sd_json_dispatch_uid_gid, offsetof(LookupParameters, gid), 0 },
+ { "groupName", SD_JSON_VARIANT_STRING, sd_json_dispatch_const_string, offsetof(LookupParameters, group_name), SD_JSON_STRICT },
+ { "service", SD_JSON_VARIANT_STRING, sd_json_dispatch_const_string, offsetof(LookupParameters, service), 0 },
{}
};
@@ -359,9 +359,9 @@ static int vl_method_get_group_record(Varlink *link, sd_json_variant *parameters
static int vl_method_get_memberships(Varlink *link, sd_json_variant *parameters, VarlinkMethodFlags flags, void *userdata) {
static const sd_json_dispatch_field dispatch_table[] = {
- { "userName", SD_JSON_VARIANT_STRING, sd_json_dispatch_const_string, offsetof(LookupParameters, user_name), SD_JSON_SAFE },
- { "groupName", SD_JSON_VARIANT_STRING, sd_json_dispatch_const_string, offsetof(LookupParameters, group_name), SD_JSON_SAFE },
- { "service", SD_JSON_VARIANT_STRING, sd_json_dispatch_const_string, offsetof(LookupParameters, service), 0 },
+ { "userName", SD_JSON_VARIANT_STRING, sd_json_dispatch_const_string, offsetof(LookupParameters, user_name), SD_JSON_STRICT },
+ { "groupName", SD_JSON_VARIANT_STRING, sd_json_dispatch_const_string, offsetof(LookupParameters, group_name), SD_JSON_STRICT },
+ { "service", SD_JSON_VARIANT_STRING, sd_json_dispatch_const_string, offsetof(LookupParameters, service), 0 },
{}
};