resolve: fix varink message verification
authorYu Watanabe <watanabe.yu+github@gmail.com>
Sun, 26 Nov 2023 04:10:15 +0000 (13:10 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Mon, 27 Nov 2023 19:10:25 +0000 (04:10 +0900)
Fixes #30199.

src/shared/varlink-io.systemd.Resolve.Monitor.c

index 179b9bc..d95b613 100644 (file)
@@ -25,7 +25,46 @@ VARLINK_DEFINE_STRUCT_TYPE(
                 VARLINK_DEFINE_FIELD(refresh, VARLINK_INT, VARLINK_NULLABLE),
                 VARLINK_DEFINE_FIELD(expire, VARLINK_INT, VARLINK_NULLABLE),
                 VARLINK_DEFINE_FIELD(minimum, VARLINK_INT, VARLINK_NULLABLE),
-                VARLINK_DEFINE_FIELD(exchange, VARLINK_STRING, VARLINK_NULLABLE));
+                VARLINK_DEFINE_FIELD(exchange, VARLINK_STRING, VARLINK_NULLABLE),
+                VARLINK_DEFINE_FIELD(version, VARLINK_INT, VARLINK_NULLABLE),
+                VARLINK_DEFINE_FIELD(size, VARLINK_INT, VARLINK_NULLABLE),
+                VARLINK_DEFINE_FIELD(horiz_pre, VARLINK_INT, VARLINK_NULLABLE),
+                VARLINK_DEFINE_FIELD(vert_pre, VARLINK_INT, VARLINK_NULLABLE),
+                VARLINK_DEFINE_FIELD(latitude, VARLINK_INT, VARLINK_NULLABLE),
+                VARLINK_DEFINE_FIELD(longitude, VARLINK_INT, VARLINK_NULLABLE),
+                VARLINK_DEFINE_FIELD(altitude, VARLINK_INT, VARLINK_NULLABLE),
+                VARLINK_DEFINE_FIELD(keyTag, VARLINK_INT, VARLINK_NULLABLE),
+                VARLINK_DEFINE_FIELD(algorithm, VARLINK_INT, VARLINK_NULLABLE),
+                VARLINK_DEFINE_FIELD(digestType, VARLINK_INT, VARLINK_NULLABLE),
+                VARLINK_DEFINE_FIELD(digest, VARLINK_STRING, VARLINK_NULLABLE),
+                VARLINK_DEFINE_FIELD(fptype, VARLINK_INT, VARLINK_NULLABLE),
+                VARLINK_DEFINE_FIELD(fingerprint, VARLINK_STRING, VARLINK_NULLABLE),
+                VARLINK_DEFINE_FIELD(flags, VARLINK_INT, VARLINK_NULLABLE),
+                VARLINK_DEFINE_FIELD(protocol, VARLINK_INT, VARLINK_NULLABLE),
+                VARLINK_DEFINE_FIELD(dnskey, VARLINK_STRING, VARLINK_NULLABLE),
+                VARLINK_DEFINE_FIELD(signer, VARLINK_STRING, VARLINK_NULLABLE),
+                VARLINK_DEFINE_FIELD(typeCovered, VARLINK_INT, VARLINK_NULLABLE),
+                VARLINK_DEFINE_FIELD(labels, VARLINK_INT, VARLINK_NULLABLE),
+                VARLINK_DEFINE_FIELD(originalTtl, VARLINK_INT, VARLINK_NULLABLE),
+                VARLINK_DEFINE_FIELD(expiration, VARLINK_INT, VARLINK_NULLABLE),
+                VARLINK_DEFINE_FIELD(inception, VARLINK_INT, VARLINK_NULLABLE),
+                VARLINK_DEFINE_FIELD(signature, VARLINK_STRING, VARLINK_NULLABLE),
+                VARLINK_DEFINE_FIELD(nextDomain, VARLINK_STRING, VARLINK_NULLABLE),
+                VARLINK_DEFINE_FIELD(types, VARLINK_INT, VARLINK_NULLABLE|VARLINK_ARRAY),
+                VARLINK_DEFINE_FIELD(iterations, VARLINK_INT, VARLINK_NULLABLE),
+                VARLINK_DEFINE_FIELD(salt, VARLINK_STRING, VARLINK_NULLABLE),
+                VARLINK_DEFINE_FIELD(hash, VARLINK_STRING, VARLINK_NULLABLE),
+                VARLINK_DEFINE_FIELD(certUsage, VARLINK_INT, VARLINK_NULLABLE),
+                VARLINK_DEFINE_FIELD(selector, VARLINK_INT, VARLINK_NULLABLE),
+                VARLINK_DEFINE_FIELD(matchingType, VARLINK_INT, VARLINK_NULLABLE),
+                VARLINK_DEFINE_FIELD(data, VARLINK_STRING, VARLINK_NULLABLE),
+                VARLINK_DEFINE_FIELD(tag, VARLINK_STRING, VARLINK_NULLABLE),
+                VARLINK_DEFINE_FIELD(value, VARLINK_STRING, VARLINK_NULLABLE));
+
+VARLINK_DEFINE_STRUCT_TYPE(
+                ResourceRecordArray,
+                VARLINK_DEFINE_FIELD_BY_TYPE(rr, ResourceRecord, VARLINK_NULLABLE),
+                VARLINK_DEFINE_FIELD(raw, VARLINK_STRING, 0));
 
 VARLINK_DEFINE_STRUCT_TYPE(
                 Answer,
@@ -48,7 +87,7 @@ VARLINK_DEFINE_METHOD(
 VARLINK_DEFINE_STRUCT_TYPE(
                 CacheEntry,
                 VARLINK_DEFINE_FIELD_BY_TYPE(key, ResourceKey, 0),
-                VARLINK_DEFINE_FIELD_BY_TYPE(rrs, ResourceRecord, VARLINK_NULLABLE|VARLINK_ARRAY),
+                VARLINK_DEFINE_FIELD_BY_TYPE(rrs, ResourceRecordArray, VARLINK_NULLABLE|VARLINK_ARRAY),
                 VARLINK_DEFINE_FIELD(type, VARLINK_STRING, VARLINK_NULLABLE),
                 VARLINK_DEFINE_FIELD(until, VARLINK_INT, 0));
 
@@ -127,6 +166,7 @@ VARLINK_DEFINE_INTERFACE(
                 &vl_method_ResetStatistics,
                 &vl_type_ResourceKey,
                 &vl_type_ResourceRecord,
+                &vl_type_ResourceRecordArray,
                 &vl_type_Answer,
                 &vl_type_CacheEntry,
                 &vl_type_ScopeCache,