1
0
mirror of https://github.com/systemd/systemd synced 2026-03-29 19:24:50 +02:00

Compare commits

...

6 Commits

Author SHA1 Message Date
Yu Watanabe
e6baa5ba0b
Use SD_JSON_BUILD_PAIR_* macros if possible in shared/core/home (#39845) 2025-11-22 10:04:02 +09:00
Nick Rosbrook
7d23e27e4c test: skip test-reread-partition-table if missing privileges
Right now, this test runs inside unprivileged chroots, despite the
running_in_chroot() check. This is because running_in_chroot() fails
with -EACCES, which is ignored.

Hence, check for privileges before calling running_in_chroot(),
otherwise call is inconclusive. Note, the test will fail later on if
running without privileges anyways.
2025-11-21 19:28:05 +00:00
Luca Boccassi
12d2abe082 test: check for all errors in test-reread-partition-table
Otherwise if opening the loop dev fails, the test segfaults
dereferencing a NULL variable later

Follow-up for 757887d01dd96125be1774f4b23b12f2fbda9a8b
2025-11-21 19:13:39 +01:00
Jelle van der Waa
2a3f05400a resolve: prefer using SD_JSON_BUILD_PAIR_* over SD_JSON_BUILD_PAIR()
No functional change, just refactoring.
2025-11-21 17:34:58 +01:00
Jelle van der Waa
2ba6cdc1b9 home: prefer using SD_JSON_BUILD_PAIR_* over SD_JSON_BUILD_PAIR()
No functional change, just refactoring.
2025-11-21 17:34:57 +01:00
Jelle van der Waa
7dda32a544 shared: prefer using SD_JSON_BUILD_PAIR_* over SD_JSON_BUILD_PAIR()
No functional change, just refactoring.
2025-11-21 17:34:43 +01:00
20 changed files with 215 additions and 210 deletions

View File

@ -124,9 +124,9 @@ static int add_pkcs11_encrypted_key(
return log_error_errno(errno_or_else(EINVAL), "Failed to UNIX hash secret key: %m");
r = sd_json_buildo(&e,
SD_JSON_BUILD_PAIR("uri", SD_JSON_BUILD_STRING(uri)),
SD_JSON_BUILD_PAIR("data", SD_JSON_BUILD_BASE64(encrypted_key, encrypted_key_size)),
SD_JSON_BUILD_PAIR("hashedPassword", SD_JSON_BUILD_STRING(hashed)));
SD_JSON_BUILD_PAIR_STRING("uri", uri),
SD_JSON_BUILD_PAIR_BASE64("data", encrypted_key, encrypted_key_size),
SD_JSON_BUILD_PAIR_STRING("hashedPassword", hashed));
if (r < 0)
return log_error_errno(r, "Failed to build encrypted JSON key object: %m");

View File

@ -20,7 +20,7 @@ static int add_privileged(sd_json_variant **v, const char *hashed) {
assert(hashed);
r = sd_json_buildo(&e, SD_JSON_BUILD_PAIR("type", JSON_BUILD_CONST_STRING("modhex64")),
SD_JSON_BUILD_PAIR("hashedPassword", SD_JSON_BUILD_STRING(hashed)));
SD_JSON_BUILD_PAIR_STRING("hashedPassword", hashed));
if (r < 0)
return log_error_errno(r, "Failed to build recover key JSON object: %m");

View File

@ -3805,8 +3805,8 @@ static int parse_argv(int argc, char *argv[]) {
r = sd_json_variant_set_fieldbo(
&arg_identity_extra_rlimits, t,
SD_JSON_BUILD_PAIR("cur", SD_JSON_BUILD_VARIANT(jcur)),
SD_JSON_BUILD_PAIR("max", SD_JSON_BUILD_VARIANT(jmax)));
SD_JSON_BUILD_PAIR_VARIANT("cur", jcur),
SD_JSON_BUILD_PAIR_VARIANT("max", jmax));
if (r < 0)
return log_error_errno(r, "Failed to set %s field: %m", rlimit_to_string(l));

View File

@ -28,7 +28,7 @@ int bus_message_read_secret(sd_bus_message *m, UserRecord **ret, sd_bus_error *e
if (r < 0)
return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Failed to parse JSON secret record at %u:%u: %m", line, column);
r = sd_json_buildo(&full, SD_JSON_BUILD_PAIR("secret", SD_JSON_BUILD_VARIANT(v)));
r = sd_json_buildo(&full, SD_JSON_BUILD_PAIR_VARIANT("secret", v));
if (r < 0)
return r;

View File

@ -2687,7 +2687,7 @@ int home_augment_status(
disk_ceiling = USER_DISK_SIZE_MAX;
r = sd_json_buildo(&status,
SD_JSON_BUILD_PAIR("state", SD_JSON_BUILD_STRING(home_state_to_string(state))),
SD_JSON_BUILD_PAIR_STRING("state", home_state_to_string(state)),
SD_JSON_BUILD_PAIR("service", JSON_BUILD_CONST_STRING("io.systemd.Home")),
SD_JSON_BUILD_PAIR("useFallback", SD_JSON_BUILD_BOOLEAN(!HOME_STATE_IS_ACTIVE(state))),
SD_JSON_BUILD_PAIR("fallbackShell", JSON_BUILD_CONST_STRING(BINDIR "/systemd-home-fallback-shell")),

View File

@ -60,8 +60,8 @@ static int build_user_json(Home *h, bool trusted, sd_json_variant **ret) {
return r;
return sd_json_buildo(ret,
SD_JSON_BUILD_PAIR("record", SD_JSON_BUILD_VARIANT(augmented->json)),
SD_JSON_BUILD_PAIR("incomplete", SD_JSON_BUILD_BOOLEAN(augmented->incomplete)));
SD_JSON_BUILD_PAIR_VARIANT("record", augmented->json),
SD_JSON_BUILD_PAIR_BOOLEAN("incomplete", augmented->incomplete));
}
static bool home_user_match_lookup_parameters(LookupParameters *p, Home *h) {
@ -176,7 +176,7 @@ static int build_group_json(Home *h, sd_json_variant **ret) {
assert(!FLAGS_SET(g->mask, USER_RECORD_SECRET));
assert(!FLAGS_SET(g->mask, USER_RECORD_PRIVILEGED));
return sd_json_buildo(ret, SD_JSON_BUILD_PAIR("record", SD_JSON_BUILD_VARIANT(g->json)));
return sd_json_buildo(ret, SD_JSON_BUILD_PAIR_VARIANT("record", g->json));
}
static bool home_group_match_lookup_parameters(LookupParameters *p, Home *h) {

View File

@ -94,16 +94,16 @@ int user_record_synthesize(
r = sd_json_buildo(
&h->json,
SD_JSON_BUILD_PAIR("userName", SD_JSON_BUILD_STRING(user_name)),
SD_JSON_BUILD_PAIR_STRING("userName", user_name),
SD_JSON_BUILD_PAIR_CONDITION(!!rr, "realm", SD_JSON_BUILD_STRING(realm)),
SD_JSON_BUILD_PAIR("disposition", JSON_BUILD_CONST_STRING("regular")),
SD_JSON_BUILD_PAIR("binding", SD_JSON_BUILD_OBJECT(
SD_JSON_BUILD_PAIR(SD_ID128_TO_STRING(mid), SD_JSON_BUILD_OBJECT(
SD_JSON_BUILD_PAIR("imagePath", SD_JSON_BUILD_STRING(image_path)),
SD_JSON_BUILD_PAIR("homeDirectory", SD_JSON_BUILD_STRING(hd)),
SD_JSON_BUILD_PAIR("storage", SD_JSON_BUILD_STRING(user_storage_to_string(storage))),
SD_JSON_BUILD_PAIR("uid", SD_JSON_BUILD_UNSIGNED(uid)),
SD_JSON_BUILD_PAIR("gid", SD_JSON_BUILD_UNSIGNED(gid)))))));
SD_JSON_BUILD_PAIR_STRING("imagePath", image_path),
SD_JSON_BUILD_PAIR_STRING("homeDirectory", hd),
SD_JSON_BUILD_PAIR_STRING("storage", user_storage_to_string(storage)),
SD_JSON_BUILD_PAIR_UNSIGNED("uid", uid),
SD_JSON_BUILD_PAIR_UNSIGNED("gid", gid))))));
if (r < 0)
return r;
@ -154,9 +154,9 @@ int group_record_synthesize(GroupRecord *g, UserRecord *h) {
r = sd_json_buildo(
&g->json,
SD_JSON_BUILD_PAIR("groupName", SD_JSON_BUILD_STRING(un)),
SD_JSON_BUILD_PAIR_STRING("groupName", un),
SD_JSON_BUILD_PAIR_CONDITION(!!rr, "realm", SD_JSON_BUILD_STRING(rr)),
SD_JSON_BUILD_PAIR("description", SD_JSON_BUILD_STRING(description)),
SD_JSON_BUILD_PAIR_STRING("description", description),
SD_JSON_BUILD_PAIR("binding", SD_JSON_BUILD_OBJECT(
SD_JSON_BUILD_PAIR(SD_ID128_TO_STRING(mid), SD_JSON_BUILD_OBJECT(
SD_JSON_BUILD_PAIR("gid", SD_JSON_BUILD_UNSIGNED(user_record_gid(h))))))),
@ -348,7 +348,7 @@ int user_record_add_binding(
r = sd_json_buildo(
&new_binding_entry,
SD_JSON_BUILD_PAIR("blobDirectory", SD_JSON_BUILD_STRING(blob)),
SD_JSON_BUILD_PAIR_STRING("blobDirectory", blob),
SD_JSON_BUILD_PAIR_CONDITION(!!image_path, "imagePath", SD_JSON_BUILD_STRING(image_path)),
SD_JSON_BUILD_PAIR_CONDITION(!sd_id128_is_null(partition_uuid), "partitionUuid", SD_JSON_BUILD_STRING(SD_ID128_TO_UUID_STRING(partition_uuid))),
SD_JSON_BUILD_PAIR_CONDITION(!sd_id128_is_null(luks_uuid), "luksUuid", SD_JSON_BUILD_STRING(SD_ID128_TO_UUID_STRING(luks_uuid))),

View File

@ -364,18 +364,18 @@ int mdns_manage_services_answer(DnsServiceBrowser *sb, DnsAnswer *answer, int ow
r = sd_json_buildo(
&entry,
SD_JSON_BUILD_PAIR(
SD_JSON_BUILD_PAIR_STRING(
"updateFlag",
SD_JSON_BUILD_STRING(browse_service_update_event_to_string(
BROWSE_SERVICE_UPDATE_ADDED))),
SD_JSON_BUILD_PAIR("family", SD_JSON_BUILD_INTEGER(owner_family)),
browse_service_update_event_to_string(
BROWSE_SERVICE_UPDATE_ADDED)),
SD_JSON_BUILD_PAIR_INTEGER("family", owner_family),
SD_JSON_BUILD_PAIR_CONDITION(
!isempty(name), "name", SD_JSON_BUILD_STRING(name)),
SD_JSON_BUILD_PAIR_CONDITION(
!isempty(type), "type", SD_JSON_BUILD_STRING(type)),
SD_JSON_BUILD_PAIR_CONDITION(
!isempty(domain), "domain", SD_JSON_BUILD_STRING(domain)),
SD_JSON_BUILD_PAIR("ifindex", SD_JSON_BUILD_INTEGER(sb->ifindex)));
SD_JSON_BUILD_PAIR_INTEGER("ifindex", sb->ifindex));
if (r < 0) {
log_error_errno(r, "Failed to build JSON for new service: %m");
goto finish;
@ -427,15 +427,15 @@ int mdns_manage_services_answer(DnsServiceBrowser *sb, DnsAnswer *answer, int ow
r = sd_json_buildo(
&entry,
SD_JSON_BUILD_PAIR(
SD_JSON_BUILD_PAIR_STRING(
"updateFlag",
SD_JSON_BUILD_STRING(browse_service_update_event_to_string(
BROWSE_SERVICE_UPDATE_REMOVED))),
SD_JSON_BUILD_PAIR("family", SD_JSON_BUILD_INTEGER(owner_family)),
SD_JSON_BUILD_PAIR("name", SD_JSON_BUILD_STRING(name ?: "")),
SD_JSON_BUILD_PAIR("type", SD_JSON_BUILD_STRING(type ?: "")),
SD_JSON_BUILD_PAIR("domain", SD_JSON_BUILD_STRING(domain ?: "")),
SD_JSON_BUILD_PAIR("ifindex", SD_JSON_BUILD_INTEGER(sb->ifindex)));
browse_service_update_event_to_string(
BROWSE_SERVICE_UPDATE_REMOVED)),
SD_JSON_BUILD_PAIR_INTEGER("family", owner_family),
SD_JSON_BUILD_PAIR_STRING("name", name ?: ""),
SD_JSON_BUILD_PAIR_STRING("type", type ?: ""),
SD_JSON_BUILD_PAIR_STRING("domain", domain ?: ""),
SD_JSON_BUILD_PAIR_INTEGER("ifindex", sb->ifindex));
if (r < 0) {
log_error_errno(r, "Failed to build JSON for removed service: %m");
goto finish;
@ -451,7 +451,7 @@ int mdns_manage_services_answer(DnsServiceBrowser *sb, DnsAnswer *answer, int ow
if (!sd_json_variant_is_blank_array(array)) {
_cleanup_(sd_json_variant_unrefp) sd_json_variant *vm = NULL;
r = sd_json_buildo(&vm, SD_JSON_BUILD_PAIR("browserServiceData", SD_JSON_BUILD_VARIANT(array)));
r = sd_json_buildo(&vm, SD_JSON_BUILD_PAIR_VARIANT("browserServiceData", array));
if (r < 0) {
log_error_errno(r,
"Failed to build JSON object for browser service data: %m");

View File

@ -1307,7 +1307,7 @@ int manager_monitor_send(Manager *m, DnsQuery *q) {
r = sd_json_variant_append_arraybo(
&janswer,
SD_JSON_BUILD_PAIR_CONDITION(!!v, "rr", SD_JSON_BUILD_VARIANT(v)),
SD_JSON_BUILD_PAIR("raw", SD_JSON_BUILD_BASE64(rri->rr->wire_format, rri->rr->wire_format_size)),
SD_JSON_BUILD_PAIR_BASE64("raw", rri->rr->wire_format, rri->rr->wire_format_size),
SD_JSON_BUILD_PAIR_CONDITION(rri->ifindex > 0, "ifindex", SD_JSON_BUILD_INTEGER(rri->ifindex)));
if (r < 0)
return log_debug_errno(r, "Failed to append notification entry to array: %m");
@ -1315,7 +1315,7 @@ int manager_monitor_send(Manager *m, DnsQuery *q) {
r = varlink_many_notifybo(
m->varlink_query_results_subscription,
SD_JSON_BUILD_PAIR("state", SD_JSON_BUILD_STRING(dns_transaction_state_to_string(q->state))),
SD_JSON_BUILD_PAIR_STRING("state", dns_transaction_state_to_string(q->state)),
SD_JSON_BUILD_PAIR_CONDITION(q->state == DNS_TRANSACTION_DNSSEC_FAILED,
"result", SD_JSON_BUILD_STRING(dnssec_result_to_string(q->answer_dnssec_result))),
SD_JSON_BUILD_PAIR_CONDITION(q->state == DNS_TRANSACTION_RCODE_FAILURE,
@ -1332,7 +1332,7 @@ int manager_monitor_send(Manager *m, DnsQuery *q) {
DNS_TRANSACTION_RCODE_FAILURE) &&
q->answer_ede_rcode >= 0 && !isempty(q->answer_ede_msg),
"extendedDNSErrorMessage", SD_JSON_BUILD_STRING(q->answer_ede_msg)),
SD_JSON_BUILD_PAIR("question", SD_JSON_BUILD_VARIANT(jquestion)),
SD_JSON_BUILD_PAIR_VARIANT("question", jquestion),
SD_JSON_BUILD_PAIR_CONDITION(!!jcollected_questions,
"collectedQuestions", SD_JSON_BUILD_VARIANT(jcollected_questions)),
SD_JSON_BUILD_PAIR_CONDITION(!!janswer,

View File

@ -235,8 +235,8 @@ static int find_addr_records(
r = sd_json_buildo(
&entry,
SD_JSON_BUILD_PAIR_CONDITION(ifindex > 0, "ifindex", SD_JSON_BUILD_INTEGER(ifindex)),
SD_JSON_BUILD_PAIR("family", SD_JSON_BUILD_INTEGER(family)),
SD_JSON_BUILD_PAIR("address", SD_JSON_BUILD_BYTE_ARRAY(p, FAMILY_ADDRESS_SIZE(family))));
SD_JSON_BUILD_PAIR_INTEGER("family", family),
SD_JSON_BUILD_PAIR_BYTE_ARRAY("address", p, FAMILY_ADDRESS_SIZE(family)));
if (r < 0)
return r;
@ -291,9 +291,9 @@ static void vl_method_resolve_hostname_complete(DnsQuery *query) {
r = sd_varlink_replybo(
q->varlink_request,
SD_JSON_BUILD_PAIR("addresses", SD_JSON_BUILD_VARIANT(array)),
SD_JSON_BUILD_PAIR("name", SD_JSON_BUILD_STRING(normalized)),
SD_JSON_BUILD_PAIR("flags", SD_JSON_BUILD_INTEGER(dns_query_reply_flags_make(q))));
SD_JSON_BUILD_PAIR_VARIANT("addresses", array),
SD_JSON_BUILD_PAIR_STRING("name", normalized),
SD_JSON_BUILD_PAIR_INTEGER("flags", dns_query_reply_flags_make(q)));
finish:
if (r < 0) {
log_full_errno(ERRNO_IS_DISCONNECT(r) ? LOG_DEBUG : LOG_ERR, r, "Failed to send hostname reply: %m");
@ -332,11 +332,11 @@ static int parse_as_address(sd_varlink *link, LookupParameters *p) {
SD_JSON_BUILD_ARRAY(
SD_JSON_BUILD_OBJECT(
SD_JSON_BUILD_PAIR_CONDITION(ifindex > 0, "ifindex", SD_JSON_BUILD_INTEGER(ifindex)),
SD_JSON_BUILD_PAIR("family", SD_JSON_BUILD_INTEGER(ff)),
SD_JSON_BUILD_PAIR("address", SD_JSON_BUILD_BYTE_ARRAY(&parsed, FAMILY_ADDRESS_SIZE(ff)))))),
SD_JSON_BUILD_PAIR("name", SD_JSON_BUILD_STRING(canonical)),
SD_JSON_BUILD_PAIR("flags", SD_JSON_BUILD_INTEGER(SD_RESOLVED_FLAGS_MAKE(dns_synthesize_protocol(p->flags), ff, true, true)|
SD_RESOLVED_SYNTHETIC)));
SD_JSON_BUILD_PAIR_INTEGER("family", ff),
SD_JSON_BUILD_PAIR_BYTE_ARRAY("address", &parsed, FAMILY_ADDRESS_SIZE(ff))))),
SD_JSON_BUILD_PAIR_STRING("name", canonical),
SD_JSON_BUILD_PAIR_INTEGER("flags", SD_RESOLVED_FLAGS_MAKE(dns_synthesize_protocol(p->flags), ff, true, true)|
SD_RESOLVED_SYNTHETIC));
}
static int vl_method_resolve_hostname(sd_varlink *link, sd_json_variant *parameters, sd_varlink_method_flags_t flags, void *userdata) {
@ -450,7 +450,7 @@ static void vl_method_resolve_address_complete(DnsQuery *query) {
r = sd_json_variant_append_arraybo(
&array,
SD_JSON_BUILD_PAIR_CONDITION(ifindex > 0, "ifindex", SD_JSON_BUILD_INTEGER(ifindex)),
SD_JSON_BUILD_PAIR("name", SD_JSON_BUILD_STRING(normalized)));
SD_JSON_BUILD_PAIR_STRING("name", normalized));
if (r < 0)
goto finish;
}
@ -460,8 +460,8 @@ static void vl_method_resolve_address_complete(DnsQuery *query) {
r = sd_varlink_replybo(
q->varlink_request,
SD_JSON_BUILD_PAIR("names", SD_JSON_BUILD_VARIANT(array)),
SD_JSON_BUILD_PAIR("flags", SD_JSON_BUILD_INTEGER(dns_query_reply_flags_make(q))));
SD_JSON_BUILD_PAIR_VARIANT("names", array),
SD_JSON_BUILD_PAIR_INTEGER("flags", dns_query_reply_flags_make(q)));
finish:
if (r < 0) {
log_full_errno(ERRNO_IS_DISCONNECT(r) ? LOG_DEBUG : LOG_ERR, r, "Failed to send address reply: %m");
@ -624,10 +624,10 @@ static int append_srv(
r = sd_json_buildo(
&v,
SD_JSON_BUILD_PAIR("priority", SD_JSON_BUILD_UNSIGNED(rr->srv.priority)),
SD_JSON_BUILD_PAIR("weight", SD_JSON_BUILD_UNSIGNED(rr->srv.weight)),
SD_JSON_BUILD_PAIR("port", SD_JSON_BUILD_UNSIGNED(rr->srv.port)),
SD_JSON_BUILD_PAIR("hostname", SD_JSON_BUILD_STRING(normalized)));
SD_JSON_BUILD_PAIR_UNSIGNED("priority", rr->srv.priority),
SD_JSON_BUILD_PAIR_UNSIGNED("weight", rr->srv.weight),
SD_JSON_BUILD_PAIR_UNSIGNED("port", rr->srv.port),
SD_JSON_BUILD_PAIR_STRING("hostname", normalized));
if (r < 0)
return r;
@ -802,13 +802,13 @@ static void resolve_service_all_complete(DnsQuery *query) {
r = sd_varlink_replybo(
query->varlink_request,
SD_JSON_BUILD_PAIR("services", SD_JSON_BUILD_VARIANT(srv)),
SD_JSON_BUILD_PAIR_VARIANT("services", srv),
SD_JSON_BUILD_PAIR_CONDITION(!sd_json_variant_is_blank_object(txt), "txt", SD_JSON_BUILD_VARIANT(txt)),
SD_JSON_BUILD_PAIR("canonical", SD_JSON_BUILD_OBJECT(
SD_JSON_BUILD_PAIR("name", SD_JSON_BUILD_STRING(name)),
SD_JSON_BUILD_PAIR("type", SD_JSON_BUILD_STRING(type)),
SD_JSON_BUILD_PAIR("domain", SD_JSON_BUILD_STRING(domain)))),
SD_JSON_BUILD_PAIR("flags", SD_JSON_BUILD_UNSIGNED(dns_query_reply_flags_make(query))));
SD_JSON_BUILD_PAIR_STRING("name", name),
SD_JSON_BUILD_PAIR_STRING("type", type),
SD_JSON_BUILD_PAIR_STRING("domain", domain))),
SD_JSON_BUILD_PAIR_UNSIGNED("flags", dns_query_reply_flags_make(query)));
finish:
if (r < 0) {
@ -1087,7 +1087,7 @@ static void vl_method_resolve_record_complete(DnsQuery *query) {
&array,
SD_JSON_BUILD_PAIR_CONDITION(ifindex > 0, "ifindex", SD_JSON_BUILD_INTEGER(ifindex)),
SD_JSON_BUILD_PAIR_CONDITION(!!v, "rr", SD_JSON_BUILD_VARIANT(v)),
SD_JSON_BUILD_PAIR("raw", SD_JSON_BUILD_BASE64(rr->wire_format, rr->wire_format_size)));
SD_JSON_BUILD_PAIR_BASE64("raw", rr->wire_format, rr->wire_format_size));
if (r < 0)
goto finish;
@ -1099,8 +1099,8 @@ static void vl_method_resolve_record_complete(DnsQuery *query) {
r = sd_varlink_replybo(
q->varlink_request,
SD_JSON_BUILD_PAIR("rrs", SD_JSON_BUILD_VARIANT(array)),
SD_JSON_BUILD_PAIR("flags", SD_JSON_BUILD_INTEGER(dns_query_reply_flags_make(q))));
SD_JSON_BUILD_PAIR_VARIANT("rrs", array),
SD_JSON_BUILD_PAIR_INTEGER("flags", dns_query_reply_flags_make(q)));
finish:
if (r < 0) {
log_full_errno(ERRNO_IS_DISCONNECT(r) ? LOG_DEBUG : LOG_ERR, r, "Failed to send record reply: %m");
@ -1292,7 +1292,7 @@ static int vl_method_dump_cache(sd_varlink *link, sd_json_variant *parameters, s
return r;
}
return sd_varlink_replybo(link, SD_JSON_BUILD_PAIR("dump", SD_JSON_BUILD_VARIANT(list)));
return sd_varlink_replybo(link, SD_JSON_BUILD_PAIR_VARIANT("dump", list));
}
static int dns_server_dump_state_to_json_list(DnsServer *server, sd_json_variant **list) {
@ -1344,7 +1344,7 @@ static int vl_method_dump_server_state(sd_varlink *link, sd_json_variant *parame
return r;
}
return sd_varlink_replybo(link, SD_JSON_BUILD_PAIR("dump", SD_JSON_BUILD_VARIANT(list)));
return sd_varlink_replybo(link, SD_JSON_BUILD_PAIR_VARIANT("dump", list));
}
static int vl_method_dump_statistics(sd_varlink *link, sd_json_variant *parameters, sd_varlink_method_flags_t flags, void *userdata) {

View File

@ -1813,7 +1813,7 @@ static int json_cmdline(
r = sd_json_variant_merge_objectbo(
v,
SD_JSON_BUILD_PAIR("addons", SD_JSON_BUILD_VARIANT(addons_array)),
SD_JSON_BUILD_PAIR_VARIANT("addons", addons_array),
SD_JSON_BUILD_PAIR_CONDITION(!!combined_cmdline, "cmdline", SD_JSON_BUILD_STRING(combined_cmdline)));
if (r < 0)
return log_oom();
@ -1959,8 +1959,8 @@ int boot_entry_to_json(const BootConfig *c, size_t i, sd_json_variant **ret) {
r = sd_json_variant_merge_objectbo(
&v,
SD_JSON_BUILD_PAIR("type", SD_JSON_BUILD_STRING(boot_entry_type_to_string(e->type))),
SD_JSON_BUILD_PAIR("source", SD_JSON_BUILD_STRING(boot_entry_source_to_string(e->source))),
SD_JSON_BUILD_PAIR_STRING("type", boot_entry_type_to_string(e->type)),
SD_JSON_BUILD_PAIR_STRING("source", boot_entry_source_to_string(e->source)),
SD_JSON_BUILD_PAIR_CONDITION(!!e->id, "id", SD_JSON_BUILD_STRING(e->id)),
SD_JSON_BUILD_PAIR_CONDITION(!!e->path, "path", SD_JSON_BUILD_STRING(e->path)),
SD_JSON_BUILD_PAIR_CONDITION(!!e->root, "root", SD_JSON_BUILD_STRING(e->root)),
@ -1987,7 +1987,7 @@ int boot_entry_to_json(const BootConfig *c, size_t i, sd_json_variant **ret) {
&v,
SD_JSON_BUILD_PAIR_CONDITION(!!e->device_tree, "devicetree", SD_JSON_BUILD_STRING(e->device_tree)),
SD_JSON_BUILD_PAIR_CONDITION(!strv_isempty(e->device_tree_overlay), "devicetreeOverlay", SD_JSON_BUILD_STRV(e->device_tree_overlay)),
SD_JSON_BUILD_PAIR("isReported", SD_JSON_BUILD_BOOLEAN(e->reported_by_loader)),
SD_JSON_BUILD_PAIR_BOOLEAN("isReported", e->reported_by_loader),
SD_JSON_BUILD_PAIR_CONDITION(e->tries_left != UINT_MAX, "triesLeft", SD_JSON_BUILD_UNSIGNED(e->tries_left)),
SD_JSON_BUILD_PAIR_CONDITION(e->tries_done != UINT_MAX, "triesDone", SD_JSON_BUILD_UNSIGNED(e->tries_done)),
SD_JSON_BUILD_PAIR_CONDITION(c->default_entry >= 0, "isDefault", SD_JSON_BUILD_BOOLEAN(i == (size_t) c->default_entry)),

View File

@ -1588,7 +1588,7 @@ int ipc_encrypt_credential(const char *name, usec_t timestamp, usec_t not_after,
&reply,
&error_id,
SD_JSON_BUILD_PAIR_CONDITION(!!name, "name", SD_JSON_BUILD_STRING(name)),
SD_JSON_BUILD_PAIR("data", SD_JSON_BUILD_VARIANT(jinput)),
SD_JSON_BUILD_PAIR_VARIANT("data", jinput),
SD_JSON_BUILD_PAIR_CONDITION(timestamp != USEC_INFINITY, "timestamp", SD_JSON_BUILD_UNSIGNED(timestamp)),
SD_JSON_BUILD_PAIR_CONDITION(not_after != USEC_INFINITY, "notAfter", SD_JSON_BUILD_UNSIGNED(not_after)),
SD_JSON_BUILD_PAIR_CONDITION(!FLAGS_SET(flags, CREDENTIAL_ANY_SCOPE), "scope", SD_JSON_BUILD_STRING(uid_is_valid(uid) ? "user" : "system")),
@ -1648,7 +1648,7 @@ int ipc_decrypt_credential(const char *validate_name, usec_t validate_timestamp,
&reply,
&error_id,
SD_JSON_BUILD_PAIR_CONDITION(!!validate_name, "name", SD_JSON_BUILD_STRING(validate_name)),
SD_JSON_BUILD_PAIR("blob", SD_JSON_BUILD_VARIANT(jinput)),
SD_JSON_BUILD_PAIR_VARIANT("blob", jinput),
SD_JSON_BUILD_PAIR_CONDITION(validate_timestamp != USEC_INFINITY, "timestamp", SD_JSON_BUILD_UNSIGNED(validate_timestamp)),
SD_JSON_BUILD_PAIR_CONDITION(!FLAGS_SET(flags, CREDENTIAL_ANY_SCOPE), "scope", SD_JSON_BUILD_STRING(uid_is_valid(uid) ? "user" : "system")),
SD_JSON_BUILD_PAIR_CONDITION(uid_is_valid(uid), "uid", SD_JSON_BUILD_UNSIGNED(uid)),

View File

@ -4807,16 +4807,16 @@ int mountfsd_mount_image(
"io.systemd.MountFileSystem.MountImage",
&reply,
&error_id,
SD_JSON_BUILD_PAIR("imageFileDescriptor", SD_JSON_BUILD_UNSIGNED(0)),
SD_JSON_BUILD_PAIR_UNSIGNED("imageFileDescriptor", 0),
SD_JSON_BUILD_PAIR_CONDITION(userns_fd >= 0, "userNamespaceFileDescriptor", SD_JSON_BUILD_UNSIGNED(1)),
SD_JSON_BUILD_PAIR("readOnly", SD_JSON_BUILD_BOOLEAN(FLAGS_SET(flags, DISSECT_IMAGE_MOUNT_READ_ONLY))),
SD_JSON_BUILD_PAIR("growFileSystems", SD_JSON_BUILD_BOOLEAN(FLAGS_SET(flags, DISSECT_IMAGE_GROWFS))),
SD_JSON_BUILD_PAIR_BOOLEAN("readOnly", FLAGS_SET(flags, DISSECT_IMAGE_MOUNT_READ_ONLY)),
SD_JSON_BUILD_PAIR_BOOLEAN("growFileSystems", FLAGS_SET(flags, DISSECT_IMAGE_GROWFS)),
SD_JSON_BUILD_PAIR_CONDITION(!!ps, "imagePolicy", SD_JSON_BUILD_STRING(ps)),
SD_JSON_BUILD_PAIR("veritySharing", SD_JSON_BUILD_BOOLEAN(FLAGS_SET(flags, DISSECT_IMAGE_VERITY_SHARE))),
SD_JSON_BUILD_PAIR_BOOLEAN("veritySharing", FLAGS_SET(flags, DISSECT_IMAGE_VERITY_SHARE)),
SD_JSON_BUILD_PAIR_CONDITION(verity_data_fd >= 0, "verityDataFileDescriptor", SD_JSON_BUILD_UNSIGNED(userns_fd >= 0 ? 2 : 1)),
JSON_BUILD_PAIR_IOVEC_HEX("verityRootHash", &verity->root_hash),
JSON_BUILD_PAIR_IOVEC_BASE64("verityRootHashSignature", &verity->root_hash_sig),
SD_JSON_BUILD_PAIR("allowInteractiveAuthentication", SD_JSON_BUILD_BOOLEAN(FLAGS_SET(flags, DISSECT_IMAGE_ALLOW_INTERACTIVE_AUTH))));
SD_JSON_BUILD_PAIR_BOOLEAN("allowInteractiveAuthentication", FLAGS_SET(flags, DISSECT_IMAGE_ALLOW_INTERACTIVE_AUTH)));
if (r < 0)
return r;

View File

@ -2313,11 +2313,11 @@ int dns_resource_record_to_json(DnsResourceRecord *rr, sd_json_variant **ret) {
case DNS_TYPE_SRV:
return sd_json_buildo(
ret,
SD_JSON_BUILD_PAIR("key", SD_JSON_BUILD_VARIANT(k)),
SD_JSON_BUILD_PAIR("priority", SD_JSON_BUILD_UNSIGNED(rr->srv.priority)),
SD_JSON_BUILD_PAIR("weight", SD_JSON_BUILD_UNSIGNED(rr->srv.weight)),
SD_JSON_BUILD_PAIR("port", SD_JSON_BUILD_UNSIGNED(rr->srv.port)),
SD_JSON_BUILD_PAIR("name", SD_JSON_BUILD_STRING(rr->srv.name)));
SD_JSON_BUILD_PAIR_VARIANT("key", k),
SD_JSON_BUILD_PAIR_UNSIGNED("priority", rr->srv.priority),
SD_JSON_BUILD_PAIR_UNSIGNED("weight", rr->srv.weight),
SD_JSON_BUILD_PAIR_UNSIGNED("port", rr->srv.port),
SD_JSON_BUILD_PAIR_STRING("name", rr->srv.name));
case DNS_TYPE_PTR:
case DNS_TYPE_NS:
@ -2325,15 +2325,15 @@ int dns_resource_record_to_json(DnsResourceRecord *rr, sd_json_variant **ret) {
case DNS_TYPE_DNAME:
return sd_json_buildo(
ret,
SD_JSON_BUILD_PAIR("key", SD_JSON_BUILD_VARIANT(k)),
SD_JSON_BUILD_PAIR("name", SD_JSON_BUILD_STRING(rr->ptr.name)));
SD_JSON_BUILD_PAIR_VARIANT("key", k),
SD_JSON_BUILD_PAIR_STRING("name", rr->ptr.name));
case DNS_TYPE_HINFO:
return sd_json_buildo(
ret,
SD_JSON_BUILD_PAIR("key", SD_JSON_BUILD_VARIANT(k)),
SD_JSON_BUILD_PAIR("cpu", SD_JSON_BUILD_STRING(rr->hinfo.cpu)),
SD_JSON_BUILD_PAIR("os", SD_JSON_BUILD_STRING(rr->hinfo.os)));
SD_JSON_BUILD_PAIR_VARIANT("key", k),
SD_JSON_BUILD_PAIR_STRING("cpu", rr->hinfo.cpu),
SD_JSON_BUILD_PAIR_STRING("os", rr->hinfo.os));
case DNS_TYPE_SPF:
case DNS_TYPE_TXT: {
@ -2345,90 +2345,90 @@ int dns_resource_record_to_json(DnsResourceRecord *rr, sd_json_variant **ret) {
return sd_json_buildo(
ret,
SD_JSON_BUILD_PAIR("key", SD_JSON_BUILD_VARIANT(k)),
SD_JSON_BUILD_PAIR("items", SD_JSON_BUILD_VARIANT(l)));
SD_JSON_BUILD_PAIR_VARIANT("key", k),
SD_JSON_BUILD_PAIR_VARIANT("items", l));
}
case DNS_TYPE_A:
return sd_json_buildo(
ret,
SD_JSON_BUILD_PAIR("key", SD_JSON_BUILD_VARIANT(k)),
SD_JSON_BUILD_PAIR_VARIANT("key", k),
SD_JSON_BUILD_PAIR("address", JSON_BUILD_IN4_ADDR(&rr->a.in_addr)));
case DNS_TYPE_AAAA:
return sd_json_buildo(
ret,
SD_JSON_BUILD_PAIR("key", SD_JSON_BUILD_VARIANT(k)),
SD_JSON_BUILD_PAIR_VARIANT("key", k),
SD_JSON_BUILD_PAIR("address", JSON_BUILD_IN6_ADDR(&rr->aaaa.in6_addr)));
case DNS_TYPE_SOA:
return sd_json_buildo(
ret,
SD_JSON_BUILD_PAIR("key", SD_JSON_BUILD_VARIANT(k)),
SD_JSON_BUILD_PAIR("mname", SD_JSON_BUILD_STRING(rr->soa.mname)),
SD_JSON_BUILD_PAIR("rname", SD_JSON_BUILD_STRING(rr->soa.rname)),
SD_JSON_BUILD_PAIR("serial", SD_JSON_BUILD_UNSIGNED(rr->soa.serial)),
SD_JSON_BUILD_PAIR("refresh", SD_JSON_BUILD_UNSIGNED(rr->soa.refresh)),
SD_JSON_BUILD_PAIR("expire", SD_JSON_BUILD_UNSIGNED(rr->soa.retry)),
SD_JSON_BUILD_PAIR("minimum", SD_JSON_BUILD_UNSIGNED(rr->soa.minimum)));
SD_JSON_BUILD_PAIR_VARIANT("key", k),
SD_JSON_BUILD_PAIR_STRING("mname", rr->soa.mname),
SD_JSON_BUILD_PAIR_STRING("rname", rr->soa.rname),
SD_JSON_BUILD_PAIR_UNSIGNED("serial", rr->soa.serial),
SD_JSON_BUILD_PAIR_UNSIGNED("refresh", rr->soa.refresh),
SD_JSON_BUILD_PAIR_UNSIGNED("expire", rr->soa.retry),
SD_JSON_BUILD_PAIR_UNSIGNED("minimum", rr->soa.minimum));
case DNS_TYPE_MX:
return sd_json_buildo(
ret,
SD_JSON_BUILD_PAIR("key", SD_JSON_BUILD_VARIANT(k)),
SD_JSON_BUILD_PAIR("priority", SD_JSON_BUILD_UNSIGNED(rr->mx.priority)),
SD_JSON_BUILD_PAIR("exchange", SD_JSON_BUILD_STRING(rr->mx.exchange)));
SD_JSON_BUILD_PAIR_VARIANT("key", k),
SD_JSON_BUILD_PAIR_UNSIGNED("priority", rr->mx.priority),
SD_JSON_BUILD_PAIR_STRING("exchange", rr->mx.exchange));
case DNS_TYPE_LOC:
return sd_json_buildo(
ret,
SD_JSON_BUILD_PAIR("key", SD_JSON_BUILD_VARIANT(k)),
SD_JSON_BUILD_PAIR("version", SD_JSON_BUILD_UNSIGNED(rr->loc.version)),
SD_JSON_BUILD_PAIR("size", SD_JSON_BUILD_UNSIGNED(rr->loc.size)),
SD_JSON_BUILD_PAIR("horiz_pre", SD_JSON_BUILD_UNSIGNED(rr->loc.horiz_pre)),
SD_JSON_BUILD_PAIR("vert_pre", SD_JSON_BUILD_UNSIGNED(rr->loc.vert_pre)),
SD_JSON_BUILD_PAIR("latitude", SD_JSON_BUILD_UNSIGNED(rr->loc.latitude)),
SD_JSON_BUILD_PAIR("longitude", SD_JSON_BUILD_UNSIGNED(rr->loc.longitude)),
SD_JSON_BUILD_PAIR("altitude", SD_JSON_BUILD_UNSIGNED(rr->loc.altitude)));
SD_JSON_BUILD_PAIR_VARIANT("key", k),
SD_JSON_BUILD_PAIR_UNSIGNED("version", rr->loc.version),
SD_JSON_BUILD_PAIR_UNSIGNED("size", rr->loc.size),
SD_JSON_BUILD_PAIR_UNSIGNED("horiz_pre", rr->loc.horiz_pre),
SD_JSON_BUILD_PAIR_UNSIGNED("vert_pre", rr->loc.vert_pre),
SD_JSON_BUILD_PAIR_UNSIGNED("latitude", rr->loc.latitude),
SD_JSON_BUILD_PAIR_UNSIGNED("longitude", rr->loc.longitude),
SD_JSON_BUILD_PAIR_UNSIGNED("altitude", rr->loc.altitude));
case DNS_TYPE_DS:
return sd_json_buildo(
ret,
SD_JSON_BUILD_PAIR("key", SD_JSON_BUILD_VARIANT(k)),
SD_JSON_BUILD_PAIR("keyTag", SD_JSON_BUILD_UNSIGNED(rr->ds.key_tag)),
SD_JSON_BUILD_PAIR("algorithm", SD_JSON_BUILD_UNSIGNED(rr->ds.algorithm)),
SD_JSON_BUILD_PAIR("digestType", SD_JSON_BUILD_UNSIGNED(rr->ds.digest_type)),
SD_JSON_BUILD_PAIR("digest", SD_JSON_BUILD_HEX(rr->ds.digest, rr->ds.digest_size)));
SD_JSON_BUILD_PAIR_VARIANT("key", k),
SD_JSON_BUILD_PAIR_UNSIGNED("keyTag", rr->ds.key_tag),
SD_JSON_BUILD_PAIR_UNSIGNED("algorithm", rr->ds.algorithm),
SD_JSON_BUILD_PAIR_UNSIGNED("digestType", rr->ds.digest_type),
SD_JSON_BUILD_PAIR_HEX("digest", rr->ds.digest, rr->ds.digest_size));
case DNS_TYPE_SSHFP:
return sd_json_buildo(
ret,
SD_JSON_BUILD_PAIR("key", SD_JSON_BUILD_VARIANT(k)),
SD_JSON_BUILD_PAIR("algorithm", SD_JSON_BUILD_UNSIGNED(rr->sshfp.algorithm)),
SD_JSON_BUILD_PAIR("fptype", SD_JSON_BUILD_UNSIGNED(rr->sshfp.fptype)),
SD_JSON_BUILD_PAIR("fingerprint", SD_JSON_BUILD_HEX(rr->sshfp.fingerprint, rr->sshfp.fingerprint_size)));
SD_JSON_BUILD_PAIR_VARIANT("key", k),
SD_JSON_BUILD_PAIR_UNSIGNED("algorithm", rr->sshfp.algorithm),
SD_JSON_BUILD_PAIR_UNSIGNED("fptype", rr->sshfp.fptype),
SD_JSON_BUILD_PAIR_HEX("fingerprint", rr->sshfp.fingerprint, rr->sshfp.fingerprint_size));
case DNS_TYPE_DNSKEY:
return sd_json_buildo(
ret,
SD_JSON_BUILD_PAIR("key", SD_JSON_BUILD_VARIANT(k)),
SD_JSON_BUILD_PAIR("flags", SD_JSON_BUILD_UNSIGNED(rr->dnskey.flags)),
SD_JSON_BUILD_PAIR("protocol", SD_JSON_BUILD_UNSIGNED(rr->dnskey.protocol)),
SD_JSON_BUILD_PAIR("algorithm", SD_JSON_BUILD_UNSIGNED(rr->dnskey.algorithm)),
SD_JSON_BUILD_PAIR("dnskey", SD_JSON_BUILD_BASE64(rr->dnskey.key, rr->dnskey.key_size)));
SD_JSON_BUILD_PAIR_VARIANT("key", k),
SD_JSON_BUILD_PAIR_UNSIGNED("flags", rr->dnskey.flags),
SD_JSON_BUILD_PAIR_UNSIGNED("protocol", rr->dnskey.protocol),
SD_JSON_BUILD_PAIR_UNSIGNED("algorithm", rr->dnskey.algorithm),
SD_JSON_BUILD_PAIR_BASE64("dnskey", rr->dnskey.key, rr->dnskey.key_size));
case DNS_TYPE_RRSIG:
return sd_json_buildo(
ret,
SD_JSON_BUILD_PAIR("key", SD_JSON_BUILD_VARIANT(k)),
SD_JSON_BUILD_PAIR("signer", SD_JSON_BUILD_STRING(rr->rrsig.signer)),
SD_JSON_BUILD_PAIR("typeCovered", SD_JSON_BUILD_UNSIGNED(rr->rrsig.type_covered)),
SD_JSON_BUILD_PAIR("algorithm", SD_JSON_BUILD_UNSIGNED(rr->rrsig.algorithm)),
SD_JSON_BUILD_PAIR("labels", SD_JSON_BUILD_UNSIGNED(rr->rrsig.labels)),
SD_JSON_BUILD_PAIR("originalTtl", SD_JSON_BUILD_UNSIGNED(rr->rrsig.original_ttl)),
SD_JSON_BUILD_PAIR("expiration", SD_JSON_BUILD_UNSIGNED(rr->rrsig.expiration)),
SD_JSON_BUILD_PAIR("inception", SD_JSON_BUILD_UNSIGNED(rr->rrsig.inception)),
SD_JSON_BUILD_PAIR("keyTag", SD_JSON_BUILD_UNSIGNED(rr->rrsig.key_tag)),
SD_JSON_BUILD_PAIR("signature", SD_JSON_BUILD_BASE64(rr->rrsig.signature, rr->rrsig.signature_size)));
SD_JSON_BUILD_PAIR_VARIANT("key", k),
SD_JSON_BUILD_PAIR_STRING("signer", rr->rrsig.signer),
SD_JSON_BUILD_PAIR_UNSIGNED("typeCovered", rr->rrsig.type_covered),
SD_JSON_BUILD_PAIR_UNSIGNED("algorithm", rr->rrsig.algorithm),
SD_JSON_BUILD_PAIR_UNSIGNED("labels", rr->rrsig.labels),
SD_JSON_BUILD_PAIR_UNSIGNED("originalTtl", rr->rrsig.original_ttl),
SD_JSON_BUILD_PAIR_UNSIGNED("expiration", rr->rrsig.expiration),
SD_JSON_BUILD_PAIR_UNSIGNED("inception", rr->rrsig.inception),
SD_JSON_BUILD_PAIR_UNSIGNED("keyTag", rr->rrsig.key_tag),
SD_JSON_BUILD_PAIR_BASE64("signature", rr->rrsig.signature, rr->rrsig.signature_size));
case DNS_TYPE_NSEC: {
_cleanup_(sd_json_variant_unrefp) sd_json_variant *bm = NULL;
@ -2439,9 +2439,9 @@ int dns_resource_record_to_json(DnsResourceRecord *rr, sd_json_variant **ret) {
return sd_json_buildo(
ret,
SD_JSON_BUILD_PAIR("key", SD_JSON_BUILD_VARIANT(k)),
SD_JSON_BUILD_PAIR("nextDomain", SD_JSON_BUILD_STRING(rr->nsec.next_domain_name)),
SD_JSON_BUILD_PAIR("types", SD_JSON_BUILD_VARIANT(bm)));
SD_JSON_BUILD_PAIR_VARIANT("key", k),
SD_JSON_BUILD_PAIR_STRING("nextDomain", rr->nsec.next_domain_name),
SD_JSON_BUILD_PAIR_VARIANT("types", bm));
}
case DNS_TYPE_NSEC3: {
@ -2453,23 +2453,23 @@ int dns_resource_record_to_json(DnsResourceRecord *rr, sd_json_variant **ret) {
return sd_json_buildo(
ret,
SD_JSON_BUILD_PAIR("key", SD_JSON_BUILD_VARIANT(k)),
SD_JSON_BUILD_PAIR("algorithm", SD_JSON_BUILD_UNSIGNED(rr->nsec3.algorithm)),
SD_JSON_BUILD_PAIR("flags", SD_JSON_BUILD_UNSIGNED(rr->nsec3.flags)),
SD_JSON_BUILD_PAIR("iterations", SD_JSON_BUILD_UNSIGNED(rr->nsec3.iterations)),
SD_JSON_BUILD_PAIR("salt", SD_JSON_BUILD_HEX(rr->nsec3.salt, rr->nsec3.salt_size)),
SD_JSON_BUILD_PAIR("hash", SD_JSON_BUILD_BASE32HEX(rr->nsec3.next_hashed_name, rr->nsec3.next_hashed_name_size)),
SD_JSON_BUILD_PAIR("types", SD_JSON_BUILD_VARIANT(bm)));
SD_JSON_BUILD_PAIR_VARIANT("key", k),
SD_JSON_BUILD_PAIR_UNSIGNED("algorithm", rr->nsec3.algorithm),
SD_JSON_BUILD_PAIR_UNSIGNED("flags", rr->nsec3.flags),
SD_JSON_BUILD_PAIR_UNSIGNED("iterations", rr->nsec3.iterations),
SD_JSON_BUILD_PAIR_HEX("salt", rr->nsec3.salt, rr->nsec3.salt_size),
SD_JSON_BUILD_PAIR_BASE32HEX("hash", rr->nsec3.next_hashed_name, rr->nsec3.next_hashed_name_size),
SD_JSON_BUILD_PAIR_VARIANT("types", bm));
}
case DNS_TYPE_TLSA:
return sd_json_buildo(
ret,
SD_JSON_BUILD_PAIR("key", SD_JSON_BUILD_VARIANT(k)),
SD_JSON_BUILD_PAIR("certUsage", SD_JSON_BUILD_UNSIGNED(rr->tlsa.cert_usage)),
SD_JSON_BUILD_PAIR("selector", SD_JSON_BUILD_UNSIGNED(rr->tlsa.selector)),
SD_JSON_BUILD_PAIR("matchingType", SD_JSON_BUILD_UNSIGNED(rr->tlsa.matching_type)),
SD_JSON_BUILD_PAIR("data", SD_JSON_BUILD_HEX(rr->tlsa.data, rr->tlsa.data_size)));
SD_JSON_BUILD_PAIR_VARIANT("key", k),
SD_JSON_BUILD_PAIR_UNSIGNED("certUsage", rr->tlsa.cert_usage),
SD_JSON_BUILD_PAIR_UNSIGNED("selector", rr->tlsa.selector),
SD_JSON_BUILD_PAIR_UNSIGNED("matchingType", rr->tlsa.matching_type),
SD_JSON_BUILD_PAIR_HEX("data", rr->tlsa.data, rr->tlsa.data_size));
case DNS_TYPE_SVCB:
case DNS_TYPE_HTTPS: {
@ -2480,31 +2480,31 @@ int dns_resource_record_to_json(DnsResourceRecord *rr, sd_json_variant **ret) {
return sd_json_buildo(
ret,
SD_JSON_BUILD_PAIR("key", SD_JSON_BUILD_VARIANT(k)),
SD_JSON_BUILD_PAIR("priority", SD_JSON_BUILD_UNSIGNED(rr->svcb.priority)),
SD_JSON_BUILD_PAIR("target", SD_JSON_BUILD_STRING(rr->svcb.target_name)),
SD_JSON_BUILD_PAIR("svcparams", SD_JSON_BUILD_VARIANT(p)));
SD_JSON_BUILD_PAIR_VARIANT("key", k),
SD_JSON_BUILD_PAIR_UNSIGNED("priority", rr->svcb.priority),
SD_JSON_BUILD_PAIR_STRING("target", rr->svcb.target_name),
SD_JSON_BUILD_PAIR_VARIANT("svcparams", p));
}
case DNS_TYPE_CAA:
return sd_json_buildo(
ret,
SD_JSON_BUILD_PAIR("key", SD_JSON_BUILD_VARIANT(k)),
SD_JSON_BUILD_PAIR("flags", SD_JSON_BUILD_UNSIGNED(rr->caa.flags)),
SD_JSON_BUILD_PAIR("tag", SD_JSON_BUILD_STRING(rr->caa.tag)),
SD_JSON_BUILD_PAIR("value", SD_JSON_BUILD_OCTESCAPE(rr->caa.value, rr->caa.value_size)));
SD_JSON_BUILD_PAIR_VARIANT("key", k),
SD_JSON_BUILD_PAIR_UNSIGNED("flags", rr->caa.flags),
SD_JSON_BUILD_PAIR_STRING("tag", rr->caa.tag),
SD_JSON_BUILD_PAIR_OCTESCAPE("value", rr->caa.value, rr->caa.value_size));
case DNS_TYPE_NAPTR:
return sd_json_buildo(
ret,
SD_JSON_BUILD_PAIR("key", SD_JSON_BUILD_VARIANT(k)),
SD_JSON_BUILD_PAIR("order", SD_JSON_BUILD_UNSIGNED(rr->naptr.order)),
SD_JSON_BUILD_PAIR("preference", SD_JSON_BUILD_UNSIGNED(rr->naptr.preference)),
SD_JSON_BUILD_PAIR_VARIANT("key", k),
SD_JSON_BUILD_PAIR_UNSIGNED("order", rr->naptr.order),
SD_JSON_BUILD_PAIR_UNSIGNED("preference", rr->naptr.preference),
/* NB: we name this flags field here naptrFlags, because there's already another "flags" field (for example in CAA) which has a different type */
SD_JSON_BUILD_PAIR("naptrFlags", SD_JSON_BUILD_STRING(rr->naptr.flags)),
SD_JSON_BUILD_PAIR("services", SD_JSON_BUILD_STRING(rr->naptr.services)),
SD_JSON_BUILD_PAIR("regexp", SD_JSON_BUILD_STRING(rr->naptr.regexp)),
SD_JSON_BUILD_PAIR("replacement", SD_JSON_BUILD_STRING(rr->naptr.replacement)));
SD_JSON_BUILD_PAIR_STRING("naptrFlags", rr->naptr.flags),
SD_JSON_BUILD_PAIR_STRING("services", rr->naptr.services),
SD_JSON_BUILD_PAIR_STRING("regexp", rr->naptr.regexp),
SD_JSON_BUILD_PAIR_STRING("replacement", rr->naptr.replacement));
default:
/* Can't provide broken-down format */

View File

@ -139,11 +139,11 @@ static int convert_user(
r = user_record_build(
&converted_user,
SD_JSON_BUILD_OBJECT(
SD_JSON_BUILD_PAIR("userName", SD_JSON_BUILD_STRING(u->user_name)),
SD_JSON_BUILD_PAIR("uid", SD_JSON_BUILD_UNSIGNED(allocate_uid)),
SD_JSON_BUILD_PAIR("gid", SD_JSON_BUILD_UNSIGNED(allocate_uid)),
SD_JSON_BUILD_PAIR_STRING("userName", u->user_name),
SD_JSON_BUILD_PAIR_UNSIGNED("uid", allocate_uid),
SD_JSON_BUILD_PAIR_UNSIGNED("gid", allocate_uid),
SD_JSON_BUILD_PAIR_CONDITION(u->disposition >= 0, "disposition", SD_JSON_BUILD_STRING(user_disposition_to_string(u->disposition))),
SD_JSON_BUILD_PAIR("homeDirectory", SD_JSON_BUILD_STRING(h)),
SD_JSON_BUILD_PAIR_STRING("homeDirectory", h),
SD_JSON_BUILD_PAIR("service", JSON_BUILD_CONST_STRING("io.systemd.NSpawn")),
JSON_BUILD_PAIR_STRING_NON_EMPTY("shell", shell),
SD_JSON_BUILD_PAIR_STRV("memberOf", groups),
@ -156,8 +156,8 @@ static int convert_user(
r = group_record_build(
&converted_group,
SD_JSON_BUILD_OBJECT(
SD_JSON_BUILD_PAIR("groupName", SD_JSON_BUILD_STRING(g->group_name)),
SD_JSON_BUILD_PAIR("gid", SD_JSON_BUILD_UNSIGNED(allocate_uid)),
SD_JSON_BUILD_PAIR_STRING("groupName", g->group_name),
SD_JSON_BUILD_PAIR_UNSIGNED("gid", allocate_uid),
SD_JSON_BUILD_PAIR_CONDITION(g->disposition >= 0, "disposition", SD_JSON_BUILD_STRING(user_disposition_to_string(g->disposition))),
SD_JSON_BUILD_PAIR("service", JSON_BUILD_CONST_STRING("io.systemd.NSpawn"))));
if (r < 0)

View File

@ -99,10 +99,10 @@ int nsresource_allocate_userns(const char *name, uint64_t size) {
"io.systemd.NamespaceResource.AllocateUserRange",
&reply,
&error_id,
SD_JSON_BUILD_PAIR("name", SD_JSON_BUILD_STRING(name)),
SD_JSON_BUILD_PAIR("mangleName", SD_JSON_BUILD_BOOLEAN(true)),
SD_JSON_BUILD_PAIR("size", SD_JSON_BUILD_UNSIGNED(size)),
SD_JSON_BUILD_PAIR("userNamespaceFileDescriptor", SD_JSON_BUILD_UNSIGNED(userns_fd_idx)));
SD_JSON_BUILD_PAIR_STRING("name", name),
SD_JSON_BUILD_PAIR_BOOLEAN("mangleName", true),
SD_JSON_BUILD_PAIR_UNSIGNED("size", size),
SD_JSON_BUILD_PAIR_UNSIGNED("userNamespaceFileDescriptor", userns_fd_idx));
if (r < 0)
return log_debug_errno(r, "Failed to call AllocateUserRange() varlink call: %m");
if (streq_ptr(error_id, "io.systemd.NamespaceResource.UserNamespaceInterfaceNotSupported"))
@ -156,9 +156,9 @@ int nsresource_register_userns(const char *name, int userns_fd) {
"io.systemd.NamespaceResource.RegisterUserNamespace",
&reply,
&error_id,
SD_JSON_BUILD_PAIR("name", SD_JSON_BUILD_STRING(name)),
SD_JSON_BUILD_PAIR("mangleName", SD_JSON_BUILD_BOOLEAN(true)),
SD_JSON_BUILD_PAIR("userNamespaceFileDescriptor", SD_JSON_BUILD_UNSIGNED(userns_fd_idx)));
SD_JSON_BUILD_PAIR_STRING("name", name),
SD_JSON_BUILD_PAIR_BOOLEAN("mangleName", true),
SD_JSON_BUILD_PAIR_UNSIGNED("userNamespaceFileDescriptor", userns_fd_idx));
if (r < 0)
return log_debug_errno(r, "Failed to call RegisterUserNamespace() varlink call: %m");
if (streq_ptr(error_id, "io.systemd.NamespaceResource.UserNamespaceInterfaceNotSupported"))
@ -207,8 +207,8 @@ int nsresource_add_mount(int userns_fd, int mount_fd) {
"io.systemd.NamespaceResource.AddMountToUserNamespace",
&reply,
&error_id,
SD_JSON_BUILD_PAIR("userNamespaceFileDescriptor", SD_JSON_BUILD_UNSIGNED(userns_fd_idx)),
SD_JSON_BUILD_PAIR("mountFileDescriptor", SD_JSON_BUILD_UNSIGNED(mount_fd_idx)));
SD_JSON_BUILD_PAIR_UNSIGNED("userNamespaceFileDescriptor", userns_fd_idx),
SD_JSON_BUILD_PAIR_UNSIGNED("mountFileDescriptor", mount_fd_idx));
if (r < 0)
return log_error_errno(r, "Failed to call AddMountToUserNamespace() varlink call: %m");
if (streq_ptr(error_id, "io.systemd.NamespaceResource.UserNamespaceNotRegistered")) {
@ -259,8 +259,8 @@ int nsresource_add_cgroup(int userns_fd, int cgroup_fd) {
"io.systemd.NamespaceResource.AddControlGroupToUserNamespace",
&reply,
&error_id,
SD_JSON_BUILD_PAIR("userNamespaceFileDescriptor", SD_JSON_BUILD_UNSIGNED(userns_fd_idx)),
SD_JSON_BUILD_PAIR("controlGroupFileDescriptor", SD_JSON_BUILD_UNSIGNED(cgroup_fd_idx)));
SD_JSON_BUILD_PAIR_UNSIGNED("userNamespaceFileDescriptor", userns_fd_idx),
SD_JSON_BUILD_PAIR_UNSIGNED("controlGroupFileDescriptor", cgroup_fd_idx));
if (r < 0)
return log_debug_errno(r, "Failed to call AddControlGroupToUserNamespace() varlink call: %m");
if (streq_ptr(error_id, "io.systemd.NamespaceResource.UserNamespaceNotRegistered")) {
@ -336,8 +336,8 @@ int nsresource_add_netif_veth(
"io.systemd.NamespaceResource.AddNetworkToUserNamespace",
&reply,
&error_id,
SD_JSON_BUILD_PAIR("userNamespaceFileDescriptor", SD_JSON_BUILD_UNSIGNED(userns_fd_idx)),
SD_JSON_BUILD_PAIR("networkNamespaceFileDescriptor", SD_JSON_BUILD_UNSIGNED(netns_fd_idx)),
SD_JSON_BUILD_PAIR_UNSIGNED("userNamespaceFileDescriptor", userns_fd_idx),
SD_JSON_BUILD_PAIR_UNSIGNED("networkNamespaceFileDescriptor", netns_fd_idx),
SD_JSON_BUILD_PAIR("mode", JSON_BUILD_CONST_STRING("veth")),
SD_JSON_BUILD_PAIR_CONDITION(!!namespace_ifname, "namespaceInterfaceName", SD_JSON_BUILD_STRING(namespace_ifname)));
if (r < 0)
@ -406,7 +406,7 @@ int nsresource_add_netif_tap(
"io.systemd.NamespaceResource.AddNetworkToUserNamespace",
&reply,
&error_id,
SD_JSON_BUILD_PAIR("userNamespaceFileDescriptor", SD_JSON_BUILD_UNSIGNED(userns_fd_idx)),
SD_JSON_BUILD_PAIR_UNSIGNED("userNamespaceFileDescriptor", userns_fd_idx),
SD_JSON_BUILD_PAIR("mode", JSON_BUILD_CONST_STRING("tap")));
if (r < 0)
return log_debug_errno(r, "Failed to call AddNetworkToUserNamespace() varlink call: %m");

View File

@ -6612,7 +6612,7 @@ static int tpm2_userspace_log(
r = sd_json_variant_append_arraybo(
&array,
SD_JSON_BUILD_PAIR_STRING("hashAlg", a),
SD_JSON_BUILD_PAIR("digest", SD_JSON_BUILD_HEX(&values->digests[i].digest, EVP_MD_size(implementation))));
SD_JSON_BUILD_PAIR_HEX("digest", &values->digests[i].digest, EVP_MD_size(implementation)));
if (r < 0)
return log_debug_errno(r, "Failed to append digest object to JSON array: %m");
}
@ -6627,13 +6627,13 @@ static int tpm2_userspace_log(
&v,
SD_JSON_BUILD_PAIR_CONDITION(pcr_index != UINT_MAX, "pcr", SD_JSON_BUILD_UNSIGNED(pcr_index)),
SD_JSON_BUILD_PAIR_CONDITION(nv_index != UINT32_MAX, "nv_index", SD_JSON_BUILD_UNSIGNED(nv_index)),
SD_JSON_BUILD_PAIR("digests", SD_JSON_BUILD_VARIANT(array)),
SD_JSON_BUILD_PAIR("content_type", SD_JSON_BUILD_STRING("systemd")),
SD_JSON_BUILD_PAIR_VARIANT("digests", array),
SD_JSON_BUILD_PAIR_STRING("content_type", "systemd"),
SD_JSON_BUILD_PAIR("content", SD_JSON_BUILD_OBJECT(
SD_JSON_BUILD_PAIR_CONDITION(!!nv_index_name, "nvIndexName", SD_JSON_BUILD_STRING(nv_index_name)),
SD_JSON_BUILD_PAIR_CONDITION(!!description, "string", SD_JSON_BUILD_STRING(description)),
SD_JSON_BUILD_PAIR("bootId", SD_JSON_BUILD_ID128(boot_id)),
SD_JSON_BUILD_PAIR("timestamp", SD_JSON_BUILD_UNSIGNED(now(CLOCK_BOOTTIME))),
SD_JSON_BUILD_PAIR_ID128("bootId", boot_id),
SD_JSON_BUILD_PAIR_UNSIGNED("timestamp", now(CLOCK_BOOTTIME)),
SD_JSON_BUILD_PAIR_CONDITION(event_type >= 0, "eventType", SD_JSON_BUILD_STRING(tpm2_userspace_event_type_to_string(event_type))))));
if (r < 0)
return log_debug_errno(r, "Failed to build log record JSON: %m");
@ -8466,11 +8466,11 @@ int tpm2_make_luks2_json(
&v,
SD_JSON_BUILD_PAIR("type", JSON_BUILD_CONST_STRING("systemd-tpm2")),
SD_JSON_BUILD_PAIR("keyslots", SD_JSON_BUILD_ARRAY(SD_JSON_BUILD_STRING(keyslot_as_string))),
SD_JSON_BUILD_PAIR("tpm2-blob", SD_JSON_BUILD_VARIANT(bj)),
SD_JSON_BUILD_PAIR("tpm2-pcrs", SD_JSON_BUILD_VARIANT(hmj)),
SD_JSON_BUILD_PAIR_VARIANT("tpm2-blob", bj),
SD_JSON_BUILD_PAIR_VARIANT("tpm2-pcrs", hmj),
SD_JSON_BUILD_PAIR_CONDITION(pcr_bank != 0 && tpm2_hash_alg_to_string(pcr_bank), "tpm2-pcr-bank", SD_JSON_BUILD_STRING(tpm2_hash_alg_to_string(pcr_bank))),
SD_JSON_BUILD_PAIR_CONDITION(primary_alg != 0 && tpm2_asym_alg_to_string(primary_alg), "tpm2-primary-alg", SD_JSON_BUILD_STRING(tpm2_asym_alg_to_string(primary_alg))),
SD_JSON_BUILD_PAIR("tpm2-policy-hash", SD_JSON_BUILD_VARIANT(phj)),
SD_JSON_BUILD_PAIR_VARIANT("tpm2-policy-hash", phj),
SD_JSON_BUILD_PAIR_CONDITION(FLAGS_SET(flags, TPM2_FLAGS_USE_PIN), "tpm2-pin", SD_JSON_BUILD_BOOLEAN(true)),
SD_JSON_BUILD_PAIR_CONDITION(FLAGS_SET(flags, TPM2_FLAGS_USE_PCRLOCK), "tpm2_pcrlock", SD_JSON_BUILD_BOOLEAN(true)),
SD_JSON_BUILD_PAIR_CONDITION(pubkey_pcr_mask != 0, "tpm2_pubkey_pcrs", SD_JSON_BUILD_VARIANT(pkmj)),

View File

@ -149,13 +149,13 @@ int nss_passwd_to_user_record(
hr->json = sd_json_variant_unref(hr->json);
r = sd_json_buildo(
&hr->json,
SD_JSON_BUILD_PAIR("userName", SD_JSON_BUILD_STRING(hr->user_name)),
SD_JSON_BUILD_PAIR("uid", SD_JSON_BUILD_UNSIGNED(hr->uid)),
SD_JSON_BUILD_PAIR("gid", SD_JSON_BUILD_UNSIGNED(user_record_gid(hr))),
SD_JSON_BUILD_PAIR_STRING("userName", hr->user_name),
SD_JSON_BUILD_PAIR_UNSIGNED("uid", hr->uid),
SD_JSON_BUILD_PAIR_UNSIGNED("gid", user_record_gid(hr)),
SD_JSON_BUILD_PAIR_CONDITION(!!hr->real_name, "realName", SD_JSON_BUILD_STRING(hr->real_name)),
SD_JSON_BUILD_PAIR_CONDITION(!!hr->home_directory, "homeDirectory", SD_JSON_BUILD_STRING(hr->home_directory)),
SD_JSON_BUILD_PAIR_CONDITION(!!hr->shell, "shell", SD_JSON_BUILD_STRING(hr->shell)),
SD_JSON_BUILD_PAIR_CONDITION(!strv_isempty(hr->hashed_password), "privileged", SD_JSON_BUILD_OBJECT(SD_JSON_BUILD_PAIR("hashedPassword", SD_JSON_BUILD_STRV(hr->hashed_password)))),
SD_JSON_BUILD_PAIR_CONDITION(!strv_isempty(hr->hashed_password), "privileged", SD_JSON_BUILD_OBJECT(SD_JSON_BUILD_PAIR_STRV("hashedPassword", hr->hashed_password))),
SD_JSON_BUILD_PAIR_CONDITION(hr->locked >= 0, "locked", SD_JSON_BUILD_BOOLEAN(hr->locked)),
SD_JSON_BUILD_PAIR_CONDITION(hr->not_after_usec != UINT64_MAX, "notAfterUSec", SD_JSON_BUILD_UNSIGNED(hr->not_after_usec)),
SD_JSON_BUILD_PAIR_CONDITION(hr->password_change_now >= 0, "passwordChangeNow", SD_JSON_BUILD_BOOLEAN(hr->password_change_now)),
@ -331,10 +331,10 @@ int nss_group_to_group_record(
r = sd_json_buildo(
&g->json,
SD_JSON_BUILD_PAIR("groupName", SD_JSON_BUILD_STRING(g->group_name)),
SD_JSON_BUILD_PAIR("gid", SD_JSON_BUILD_UNSIGNED(g->gid)),
SD_JSON_BUILD_PAIR_STRING("groupName", g->group_name),
SD_JSON_BUILD_PAIR_UNSIGNED("gid", g->gid),
SD_JSON_BUILD_PAIR_CONDITION(!strv_isempty(g->members), "members", SD_JSON_BUILD_STRV(g->members)),
SD_JSON_BUILD_PAIR_CONDITION(!strv_isempty(g->hashed_password), "privileged", SD_JSON_BUILD_OBJECT(SD_JSON_BUILD_PAIR("hashedPassword", SD_JSON_BUILD_STRV(g->hashed_password)))),
SD_JSON_BUILD_PAIR_CONDITION(!strv_isempty(g->hashed_password), "privileged", SD_JSON_BUILD_OBJECT(SD_JSON_BUILD_PAIR_STRV("hashedPassword", g->hashed_password))),
SD_JSON_BUILD_PAIR_CONDITION(!strv_isempty(g->administrators), "administrators", SD_JSON_BUILD_STRV(g->administrators)));
if (r < 0)
return r;

View File

@ -736,12 +736,12 @@ static int synthetic_foreign_user_build(uid_t foreign_uid, UserRecord **ret) {
return user_record_buildo(
ret,
SD_JSON_BUILD_PAIR("userName", SD_JSON_BUILD_STRING(un)),
SD_JSON_BUILD_PAIR("realName", SD_JSON_BUILD_STRING(rn)),
SD_JSON_BUILD_PAIR("uid", SD_JSON_BUILD_UNSIGNED(FOREIGN_UID_BASE + foreign_uid)),
SD_JSON_BUILD_PAIR("gid", SD_JSON_BUILD_UNSIGNED(FOREIGN_UID_BASE + foreign_uid)),
SD_JSON_BUILD_PAIR_STRING("userName", un),
SD_JSON_BUILD_PAIR_STRING("realName", rn),
SD_JSON_BUILD_PAIR_UNSIGNED("uid", FOREIGN_UID_BASE + foreign_uid),
SD_JSON_BUILD_PAIR_UNSIGNED("gid", FOREIGN_UID_BASE + foreign_uid),
SD_JSON_BUILD_PAIR("shell", JSON_BUILD_CONST_STRING(NOLOGIN)),
SD_JSON_BUILD_PAIR("locked", SD_JSON_BUILD_BOOLEAN(true)),
SD_JSON_BUILD_PAIR_BOOLEAN("locked", true),
SD_JSON_BUILD_PAIR("disposition", JSON_BUILD_CONST_STRING("foreign")));
}
@ -916,7 +916,7 @@ int userdb_by_name(const char *name, const UserDBMatch *match, UserDBFlags flags
if (!valid_user_group_name(name, VALID_USER_RELAX))
return -EINVAL;
r = sd_json_buildo(&query, SD_JSON_BUILD_PAIR("userName", SD_JSON_BUILD_STRING(name)));
r = sd_json_buildo(&query, SD_JSON_BUILD_PAIR_STRING("userName", name));
if (r < 0)
return r;
@ -1006,7 +1006,7 @@ int userdb_by_uid(uid_t uid, const UserDBMatch *match, UserDBFlags flags, UserRe
if (!uid_is_valid(uid))
return -EINVAL;
r = sd_json_buildo(&query, SD_JSON_BUILD_PAIR("uid", SD_JSON_BUILD_UNSIGNED(uid)));
r = sd_json_buildo(&query, SD_JSON_BUILD_PAIR_UNSIGNED("uid", uid));
if (r < 0)
return r;
@ -1258,9 +1258,9 @@ static int synthetic_foreign_group_build(gid_t foreign_gid, GroupRecord **ret) {
return group_record_buildo(
ret,
SD_JSON_BUILD_PAIR("groupName", SD_JSON_BUILD_STRING(gn)),
SD_JSON_BUILD_PAIR("description", SD_JSON_BUILD_STRING(d)),
SD_JSON_BUILD_PAIR("gid", SD_JSON_BUILD_UNSIGNED(FOREIGN_UID_BASE + foreign_gid)),
SD_JSON_BUILD_PAIR_STRING("groupName", gn),
SD_JSON_BUILD_PAIR_STRING("description", d),
SD_JSON_BUILD_PAIR_UNSIGNED("gid", FOREIGN_UID_BASE + foreign_gid),
SD_JSON_BUILD_PAIR("disposition", JSON_BUILD_CONST_STRING("foreign")));
}
@ -1372,7 +1372,7 @@ int groupdb_by_name(const char *name, const UserDBMatch *match, UserDBFlags flag
if (!valid_user_group_name(name, VALID_USER_RELAX))
return -EINVAL;
r = sd_json_buildo(&query, SD_JSON_BUILD_PAIR("groupName", SD_JSON_BUILD_STRING(name)));
r = sd_json_buildo(&query, SD_JSON_BUILD_PAIR_STRING("groupName", name));
if (r < 0)
return r;
@ -1458,7 +1458,7 @@ int groupdb_by_gid(gid_t gid, const UserDBMatch *match, UserDBFlags flags, Group
if (!gid_is_valid(gid))
return -EINVAL;
r = sd_json_buildo(&query, SD_JSON_BUILD_PAIR("gid", SD_JSON_BUILD_UNSIGNED(gid)));
r = sd_json_buildo(&query, SD_JSON_BUILD_PAIR_UNSIGNED("gid", gid));
if (r < 0)
return r;
@ -1686,7 +1686,7 @@ int membershipdb_by_user(const char *name, UserDBFlags flags, UserDBIterator **r
if (!valid_user_group_name(name, VALID_USER_RELAX))
return -EINVAL;
r = sd_json_buildo(&query, SD_JSON_BUILD_PAIR("userName", SD_JSON_BUILD_STRING(name)));
r = sd_json_buildo(&query, SD_JSON_BUILD_PAIR_STRING("userName", name));
if (r < 0)
return r;
@ -1731,7 +1731,7 @@ int membershipdb_by_group(const char *name, UserDBFlags flags, UserDBIterator **
if (!valid_user_group_name(name, VALID_USER_RELAX))
return -EINVAL;
r = sd_json_buildo(&query, SD_JSON_BUILD_PAIR("groupName", SD_JSON_BUILD_STRING(name)));
r = sd_json_buildo(&query, SD_JSON_BUILD_PAIR_STRING("groupName", name));
if (r < 0)
return r;

View File

@ -4,6 +4,7 @@
#include <sys/file.h>
#include "blockdev-util.h"
#include "capability-util.h"
#include "fd-util.h"
#include "loop-util.h"
#include "memfd-util.h"
@ -45,6 +46,8 @@ TEST(rereadpt) {
if (detect_container() > 0)
return (void) log_tests_skipped("test not available in container");
if (geteuid() != 0 || have_effective_cap(CAP_SYS_ADMIN) <= 0)
return (void) log_tests_skipped("test requires privileges");
if (running_in_chroot() > 0)
return (void) log_tests_skipped("test not available in chroot()");
@ -70,6 +73,8 @@ TEST(rereadpt) {
LOCK_EX, &loop);
if (ERRNO_IS_NEG_PRIVILEGE(r) || ERRNO_IS_NOT_SUPPORTED(r))
return (void) log_tests_skipped("loopback block devices not available");
if (r < 0)
return (void) log_error_errno(r, "Failed to create loop device: %m");
_cleanup_free_ char *p = NULL;
ASSERT_OK(partition_node_of(loop->node, 1, &p));