diff options
author | Lennart Poettering <lennart@poettering.net> | 2023-11-07 14:17:10 +0100 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2023-11-07 14:25:40 +0100 |
commit | 9942f855a920c2bf56b61749193dba46d514dbbb (patch) | |
tree | f3dfaf89048956f7012e19298e2ddadc84acb205 /src/resolve/resolved-dns-rr.c | |
parent | json: teach dispatch logic to also take numbers formatted as strings (diff) | |
download | systemd-9942f855a920c2bf56b61749193dba46d514dbbb.tar.xz systemd-9942f855a920c2bf56b61749193dba46d514dbbb.zip |
tree-wide: take in all *our* JSON structures also decimal strings
Let's be friendly in what we accept: whenever we define a JSON
structure, let's also allow decimal strings where we want an integer.
This patch purely replaces JSON_VARIANT_UNSIGNED by
_JSON_VARIANT_TYPE_INVALID in the various JsonDispatch[] tables, so that
we'll happily accept any type in json_dispatch(), so that
json_dispatch_uint64() and related tools can do their thing.
This does not switch over OCI (as a JSON structure not defined by us).
Diffstat (limited to 'src/resolve/resolved-dns-rr.c')
-rw-r--r-- | src/resolve/resolved-dns-rr.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/resolve/resolved-dns-rr.c b/src/resolve/resolved-dns-rr.c index 5a16e18eed..00f7beacc8 100644 --- a/src/resolve/resolved-dns-rr.c +++ b/src/resolve/resolved-dns-rr.c @@ -1860,9 +1860,9 @@ int dns_resource_key_from_json(JsonVariant *v, DnsResourceKey **ret) { int r; JsonDispatch dispatch_table[] = { - { "class", JSON_VARIANT_INTEGER, json_dispatch_uint16, PTR_TO_SIZE(&class), JSON_MANDATORY }, - { "type", JSON_VARIANT_INTEGER, json_dispatch_uint16, PTR_TO_SIZE(&type), JSON_MANDATORY }, - { "name", JSON_VARIANT_STRING, json_dispatch_const_string, PTR_TO_SIZE(&name), JSON_MANDATORY }, + { "class", _JSON_VARIANT_TYPE_INVALID, json_dispatch_uint16, PTR_TO_SIZE(&class), JSON_MANDATORY }, + { "type", _JSON_VARIANT_TYPE_INVALID, json_dispatch_uint16, PTR_TO_SIZE(&type), JSON_MANDATORY }, + { "name", JSON_VARIANT_STRING, json_dispatch_const_string, PTR_TO_SIZE(&name), JSON_MANDATORY }, {} }; |