From: Jelle van der Waa Date: Sat, 22 Nov 2025 13:44:15 +0000 (+0100) Subject: home: prefer using SD_JSON_BUILD_PAIR_* over SD_JSON_BUILD_PAIR() X-Git-Tag: v259-rc2~5^2~3 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=18615041a5e38bcedd7ae213a19adf69d95321d0;p=thirdparty%2Fsystemd.git home: prefer using SD_JSON_BUILD_PAIR_* over SD_JSON_BUILD_PAIR() No functional change, just refactoring. --- diff --git a/src/home/homectl-fido2.c b/src/home/homectl-fido2.c index 41f8f206db1..d351b1db5e1 100644 --- a/src/home/homectl-fido2.c +++ b/src/home/homectl-fido2.c @@ -89,12 +89,12 @@ static int add_fido2_salt( return log_error_errno(errno_or_else(EINVAL), "Failed to UNIX hash secret key: %m"); r = sd_json_buildo(&e, - SD_JSON_BUILD_PAIR("credential", SD_JSON_BUILD_BASE64(cid, cid_size)), + SD_JSON_BUILD_PAIR_BASE64("credential", cid, cid_size), SD_JSON_BUILD_PAIR("salt", JSON_BUILD_IOVEC_BASE64(salt)), - SD_JSON_BUILD_PAIR("hashedPassword", SD_JSON_BUILD_STRING(hashed)), - SD_JSON_BUILD_PAIR("up", SD_JSON_BUILD_BOOLEAN(FLAGS_SET(lock_with, FIDO2ENROLL_UP))), - SD_JSON_BUILD_PAIR("uv", SD_JSON_BUILD_BOOLEAN(FLAGS_SET(lock_with, FIDO2ENROLL_UV))), - SD_JSON_BUILD_PAIR("clientPin", SD_JSON_BUILD_BOOLEAN(FLAGS_SET(lock_with, FIDO2ENROLL_PIN)))); + SD_JSON_BUILD_PAIR_STRING("hashedPassword", hashed), + SD_JSON_BUILD_PAIR_BOOLEAN("up", FLAGS_SET(lock_with, FIDO2ENROLL_UP)), + SD_JSON_BUILD_PAIR_BOOLEAN("uv", FLAGS_SET(lock_with, FIDO2ENROLL_UV)), + SD_JSON_BUILD_PAIR_BOOLEAN("clientPin", FLAGS_SET(lock_with, FIDO2ENROLL_PIN))); if (r < 0) return log_error_errno(r, "Failed to build FIDO2 salt JSON key object: %m"); diff --git a/src/home/homed-varlink.c b/src/home/homed-varlink.c index 9cae051cf98..d4015de622e 100644 --- a/src/home/homed-varlink.c +++ b/src/home/homed-varlink.c @@ -330,8 +330,8 @@ int vl_method_get_memberships(sd_varlink *link, sd_json_variant *parameters, sd_ if (last) { r = sd_varlink_notifybo( link, - SD_JSON_BUILD_PAIR("userName", SD_JSON_BUILD_STRING(last)), - SD_JSON_BUILD_PAIR("groupName", SD_JSON_BUILD_STRING(p.group_name))); + SD_JSON_BUILD_PAIR_STRING("userName", last), + SD_JSON_BUILD_PAIR_STRING("groupName", p.group_name)); if (r < 0) return r; } @@ -342,8 +342,8 @@ int vl_method_get_memberships(sd_varlink *link, sd_json_variant *parameters, sd_ if (last) return sd_varlink_replybo( link, - SD_JSON_BUILD_PAIR("userName", SD_JSON_BUILD_STRING(last)), - SD_JSON_BUILD_PAIR("groupName", SD_JSON_BUILD_STRING(p.group_name))); + SD_JSON_BUILD_PAIR_STRING("userName", last), + SD_JSON_BUILD_PAIR_STRING("groupName", p.group_name)); } else { const char *last = NULL; @@ -352,8 +352,8 @@ int vl_method_get_memberships(sd_varlink *link, sd_json_variant *parameters, sd_ if (last) { r = sd_varlink_notifybo( link, - SD_JSON_BUILD_PAIR("userName", SD_JSON_BUILD_STRING(last)), - SD_JSON_BUILD_PAIR("groupName", SD_JSON_BUILD_STRING(last))); + SD_JSON_BUILD_PAIR_STRING("userName", last), + SD_JSON_BUILD_PAIR_STRING("groupName", last)); if (r < 0) return r; @@ -362,8 +362,8 @@ int vl_method_get_memberships(sd_varlink *link, sd_json_variant *parameters, sd_ r = sd_varlink_notifybo( link, - SD_JSON_BUILD_PAIR("userName", SD_JSON_BUILD_STRING(h->user_name)), - SD_JSON_BUILD_PAIR("groupName", SD_JSON_BUILD_STRING(*j))); + SD_JSON_BUILD_PAIR_STRING("userName", h->user_name), + SD_JSON_BUILD_PAIR_STRING("groupName", *j)); if (r < 0) return r; } @@ -374,8 +374,8 @@ int vl_method_get_memberships(sd_varlink *link, sd_json_variant *parameters, sd_ if (last) return sd_varlink_replybo( link, - SD_JSON_BUILD_PAIR("userName", SD_JSON_BUILD_STRING(last)), - SD_JSON_BUILD_PAIR("groupName", SD_JSON_BUILD_STRING(last))); + SD_JSON_BUILD_PAIR_STRING("userName", last), + SD_JSON_BUILD_PAIR_STRING("groupName", last)); } return sd_varlink_error(link, "io.systemd.UserDatabase.NoRecordFound", NULL); diff --git a/src/home/user-record-sign.c b/src/home/user-record-sign.c index 46e5ea7c992..7a80ef1e7ab 100644 --- a/src/home/user-record-sign.c +++ b/src/home/user-record-sign.c @@ -58,8 +58,8 @@ int user_record_sign(UserRecord *ur, EVP_PKEY *private_key, UserRecord **ret) { &v, "signature", SD_JSON_BUILD_ARRAY( - SD_JSON_BUILD_OBJECT(SD_JSON_BUILD_PAIR("data", SD_JSON_BUILD_BASE64(signature, signature_size)), - SD_JSON_BUILD_PAIR("key", SD_JSON_BUILD_STRING(key))))); + SD_JSON_BUILD_OBJECT(SD_JSON_BUILD_PAIR_BASE64("data", signature, signature_size), + SD_JSON_BUILD_PAIR_STRING("key", key)))); if (r < 0) return r;