diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/core/core-varlink.c | 18 | ||||
-rw-r--r-- | src/home/homed-varlink.c | 18 | ||||
-rw-r--r-- | src/libsystemd/sd-json/json-util.c | 2 | ||||
-rw-r--r-- | src/libsystemd/sd-json/sd-json.c | 8 | ||||
-rw-r--r-- | src/machine/machine-varlink.c | 2 | ||||
-rw-r--r-- | src/machine/machined-varlink.c | 18 | ||||
-rw-r--r-- | src/shared/group-record.c | 36 | ||||
-rw-r--r-- | src/shared/user-record.c | 408 | ||||
-rw-r--r-- | src/systemd/sd-json.h | 4 |
9 files changed, 257 insertions, 257 deletions
diff --git a/src/core/core-varlink.c b/src/core/core-varlink.c index 36d5e5a593..42d045a8ad 100644 --- a/src/core/core-varlink.c +++ b/src/core/core-varlink.c @@ -279,9 +279,9 @@ static int manager_varlink_send_managed_oom_initial(Manager *m) { 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 }, {} }; @@ -386,9 +386,9 @@ static bool group_match_lookup_parameters(LookupParameters *p, const char *name, 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 }, {} }; @@ -469,9 +469,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 }, {} }; diff --git a/src/home/homed-varlink.c b/src/home/homed-varlink.c index f2f5d48132..41f99c429b 100644 --- a/src/home/homed-varlink.c +++ b/src/home/homed-varlink.c @@ -73,9 +73,9 @@ static bool home_user_match_lookup_parameters(LookupParameters *p, Home *h) { 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 }, {} }; @@ -188,9 +188,9 @@ static bool home_group_match_lookup_parameters(LookupParameters *p, Home *h) { 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 }, {} }; @@ -257,9 +257,9 @@ int vl_method_get_group_record(Varlink *link, sd_json_variant *parameters, Varli 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 }, {} }; diff --git a/src/libsystemd/sd-json/json-util.c b/src/libsystemd/sd-json/json-util.c index 7c14c03a99..e039ed5197 100644 --- a/src/libsystemd/sd-json/json-util.c +++ b/src/libsystemd/sd-json/json-util.c @@ -123,7 +123,7 @@ int json_dispatch_path(const char *name, sd_json_variant *variant, sd_json_dispa return json_log(variant, flags, SYNTHETIC_ERRNO(EINVAL), "JSON field '%s' is not a string.", strna(name)); path = sd_json_variant_string(variant); - if (!((flags & SD_JSON_SAFE) ? path_is_normalized(path) : path_is_valid(path))) + if (!((flags & SD_JSON_STRICT) ? path_is_normalized(path) : path_is_valid(path))) return json_log(variant, flags, SYNTHETIC_ERRNO(EINVAL), "JSON field '%s' is not a normalized file system path.", strna(name)); if (!path_is_absolute(path)) return json_log(variant, flags, SYNTHETIC_ERRNO(EINVAL), "JSON field '%s' is not an absolute file system path.", strna(name)); diff --git a/src/libsystemd/sd-json/sd-json.c b/src/libsystemd/sd-json/sd-json.c index 5414b2257f..3a0b838c51 100644 --- a/src/libsystemd/sd-json/sd-json.c +++ b/src/libsystemd/sd-json/sd-json.c @@ -4964,7 +4964,7 @@ _public_ int sd_json_dispatch_string(const char *name, sd_json_variant *variant, if (!sd_json_variant_is_string(variant)) return json_log(variant, flags, SYNTHETIC_ERRNO(EINVAL), "JSON field '%s' is not a string.", strna(name)); - if ((flags & SD_JSON_SAFE) && !string_is_safe(sd_json_variant_string(variant))) + if ((flags & SD_JSON_STRICT) && !string_is_safe(sd_json_variant_string(variant))) return json_log(variant, flags, SYNTHETIC_ERRNO(EINVAL), "JSON field '%s' contains unsafe characters, refusing.", strna(name)); r = free_and_strdup(s, sd_json_variant_string(variant)); @@ -4987,7 +4987,7 @@ _public_ int sd_json_dispatch_const_string(const char *name, sd_json_variant *va if (!sd_json_variant_is_string(variant)) return json_log(variant, flags, SYNTHETIC_ERRNO(EINVAL), "JSON field '%s' is not a string.", strna(name)); - if ((flags & SD_JSON_SAFE) && !string_is_safe(sd_json_variant_string(variant))) + if ((flags & SD_JSON_STRICT) && !string_is_safe(sd_json_variant_string(variant))) return json_log(variant, flags, SYNTHETIC_ERRNO(EINVAL), "JSON field '%s' contains unsafe characters, refusing.", strna(name)); *s = sd_json_variant_string(variant); @@ -5009,7 +5009,7 @@ _public_ int sd_json_dispatch_strv(const char *name, sd_json_variant *variant, s /* Let's be flexible here: accept a single string in place of a single-item array */ if (sd_json_variant_is_string(variant)) { - if ((flags & SD_JSON_SAFE) && !string_is_safe(sd_json_variant_string(variant))) + if ((flags & SD_JSON_STRICT) && !string_is_safe(sd_json_variant_string(variant))) return json_log(variant, flags, SYNTHETIC_ERRNO(EINVAL), "JSON field '%s' contains unsafe characters, refusing.", strna(name)); l = strv_new(sd_json_variant_string(variant)); @@ -5027,7 +5027,7 @@ _public_ int sd_json_dispatch_strv(const char *name, sd_json_variant *variant, s if (!sd_json_variant_is_string(e)) return json_log(e, flags, SYNTHETIC_ERRNO(EINVAL), "JSON array element is not a string."); - if ((flags & SD_JSON_SAFE) && !string_is_safe(sd_json_variant_string(e))) + if ((flags & SD_JSON_STRICT) && !string_is_safe(sd_json_variant_string(e))) return json_log(e, flags, SYNTHETIC_ERRNO(EINVAL), "JSON field '%s' contains unsafe characters, refusing.", strna(name)); r = strv_extend(&l, sd_json_variant_string(e)); diff --git a/src/machine/machine-varlink.c b/src/machine/machine-varlink.c index a6bf6528c4..6f437c06c4 100644 --- a/src/machine/machine-varlink.c +++ b/src/machine/machine-varlink.c @@ -134,7 +134,7 @@ int vl_method_register(Varlink *link, sd_json_variant *parameters, VarlinkMethod { "rootDirectory", SD_JSON_VARIANT_STRING, json_dispatch_path, offsetof(Machine, root_directory), 0 }, { "ifIndices", SD_JSON_VARIANT_ARRAY, machine_ifindices, 0, 0 }, { "vSockCid", SD_JSON_VARIANT_UNSIGNED, machine_cid, offsetof(Machine, vsock_cid), 0 }, - { "sshAddress", SD_JSON_VARIANT_STRING, sd_json_dispatch_string, offsetof(Machine, ssh_address), SD_JSON_SAFE }, + { "sshAddress", SD_JSON_VARIANT_STRING, sd_json_dispatch_string, offsetof(Machine, ssh_address), SD_JSON_STRICT }, { "sshPrivateKeyPath", SD_JSON_VARIANT_STRING, json_dispatch_path, offsetof(Machine, ssh_private_key_path), 0 }, {} }; 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 }, {} }; diff --git a/src/shared/group-record.c b/src/shared/group-record.c index f0ea1781d4..47a4655a69 100644 --- a/src/shared/group-record.c +++ b/src/shared/group-record.c @@ -47,7 +47,7 @@ DEFINE_TRIVIAL_REF_UNREF_FUNC(GroupRecord, group_record, group_record_free); static int dispatch_privileged(const char *name, sd_json_variant *variant, sd_json_dispatch_flags_t flags, void *userdata) { static const sd_json_dispatch_field privileged_dispatch_table[] = { - { "hashedPassword", _SD_JSON_VARIANT_TYPE_INVALID, sd_json_dispatch_strv, offsetof(GroupRecord, hashed_password), SD_JSON_SAFE }, + { "hashedPassword", _SD_JSON_VARIANT_TYPE_INVALID, sd_json_dispatch_strv, offsetof(GroupRecord, hashed_password), SD_JSON_STRICT }, {}, }; @@ -123,7 +123,7 @@ static int dispatch_per_machine(const char *name, sd_json_variant *variant, sd_j static int dispatch_status(const char *name, sd_json_variant *variant, sd_json_dispatch_flags_t flags, void *userdata) { static const sd_json_dispatch_field status_dispatch_table[] = { - { "service", SD_JSON_VARIANT_STRING, sd_json_dispatch_string, offsetof(GroupRecord, service), SD_JSON_SAFE }, + { "service", SD_JSON_VARIANT_STRING, sd_json_dispatch_string, offsetof(GroupRecord, service), SD_JSON_STRICT }, {}, }; @@ -171,28 +171,28 @@ int group_record_load( UserRecordLoadFlags load_flags) { static const sd_json_dispatch_field group_dispatch_table[] = { - { "groupName", SD_JSON_VARIANT_STRING, json_dispatch_user_group_name, offsetof(GroupRecord, group_name), SD_JSON_RELAX }, - { "realm", SD_JSON_VARIANT_STRING, json_dispatch_realm, offsetof(GroupRecord, realm), 0 }, - { "description", SD_JSON_VARIANT_STRING, json_dispatch_gecos, offsetof(GroupRecord, description), 0 }, - { "disposition", SD_JSON_VARIANT_STRING, json_dispatch_user_disposition, offsetof(GroupRecord, disposition), 0 }, - { "service", SD_JSON_VARIANT_STRING, sd_json_dispatch_string, offsetof(GroupRecord, service), SD_JSON_SAFE }, - { "lastChangeUSec", _SD_JSON_VARIANT_TYPE_INVALID, sd_json_dispatch_uint64, offsetof(GroupRecord, last_change_usec), 0 }, - { "gid", SD_JSON_VARIANT_UNSIGNED, sd_json_dispatch_uid_gid, offsetof(GroupRecord, gid), 0 }, - { "members", SD_JSON_VARIANT_ARRAY, json_dispatch_user_group_list, offsetof(GroupRecord, members), SD_JSON_RELAX }, - { "administrators", SD_JSON_VARIANT_ARRAY, json_dispatch_user_group_list, offsetof(GroupRecord, administrators), SD_JSON_RELAX }, - - { "privileged", SD_JSON_VARIANT_OBJECT, dispatch_privileged, 0, 0 }, + { "groupName", SD_JSON_VARIANT_STRING, json_dispatch_user_group_name, offsetof(GroupRecord, group_name), SD_JSON_RELAX }, + { "realm", SD_JSON_VARIANT_STRING, json_dispatch_realm, offsetof(GroupRecord, realm), 0 }, + { "description", SD_JSON_VARIANT_STRING, json_dispatch_gecos, offsetof(GroupRecord, description), 0 }, + { "disposition", SD_JSON_VARIANT_STRING, json_dispatch_user_disposition, offsetof(GroupRecord, disposition), 0 }, + { "service", SD_JSON_VARIANT_STRING, sd_json_dispatch_string, offsetof(GroupRecord, service), SD_JSON_STRICT }, + { "lastChangeUSec", _SD_JSON_VARIANT_TYPE_INVALID, sd_json_dispatch_uint64, offsetof(GroupRecord, last_change_usec), 0 }, + { "gid", SD_JSON_VARIANT_UNSIGNED, sd_json_dispatch_uid_gid, offsetof(GroupRecord, gid), 0 }, + { "members", SD_JSON_VARIANT_ARRAY, json_dispatch_user_group_list, offsetof(GroupRecord, members), SD_JSON_RELAX }, + { "administrators", SD_JSON_VARIANT_ARRAY, json_dispatch_user_group_list, offsetof(GroupRecord, administrators), SD_JSON_RELAX }, + + { "privileged", SD_JSON_VARIANT_OBJECT, dispatch_privileged, 0, 0 }, /* Not defined for now, for groups, but let's at least generate sensible errors about it */ - { "secret", SD_JSON_VARIANT_OBJECT, sd_json_dispatch_unsupported, 0, 0 }, + { "secret", SD_JSON_VARIANT_OBJECT, sd_json_dispatch_unsupported, 0, 0 }, /* Ignore the perMachine, binding and status stuff here, and process it later, so that it overrides whatever is set above */ - { "perMachine", SD_JSON_VARIANT_ARRAY, NULL, 0, 0 }, - { "binding", SD_JSON_VARIANT_OBJECT, NULL, 0, 0 }, - { "status", SD_JSON_VARIANT_OBJECT, NULL, 0, 0 }, + { "perMachine", SD_JSON_VARIANT_ARRAY, NULL, 0, 0 }, + { "binding", SD_JSON_VARIANT_OBJECT, NULL, 0, 0 }, + { "status", SD_JSON_VARIANT_OBJECT, NULL, 0, 0 }, /* Ignore 'signature', we check it with explicit accessors instead */ - { "signature", SD_JSON_VARIANT_ARRAY, NULL, 0, 0 }, + { "signature", SD_JSON_VARIANT_ARRAY, NULL, 0, 0 }, {}, }; diff --git a/src/shared/user-record.c b/src/shared/user-record.c index daf9927b27..262109b68a 100644 --- a/src/shared/user-record.c +++ b/src/shared/user-record.c @@ -1042,12 +1042,12 @@ static int dispatch_rebalance_weight(const char *name, sd_json_variant *variant, static int dispatch_privileged(const char *name, sd_json_variant *variant, sd_json_dispatch_flags_t flags, void *userdata) { static const sd_json_dispatch_field privileged_dispatch_table[] = { - { "passwordHint", SD_JSON_VARIANT_STRING, sd_json_dispatch_string, offsetof(UserRecord, password_hint), 0 }, - { "hashedPassword", _SD_JSON_VARIANT_TYPE_INVALID, sd_json_dispatch_strv, offsetof(UserRecord, hashed_password), SD_JSON_SAFE }, - { "sshAuthorizedKeys", _SD_JSON_VARIANT_TYPE_INVALID, sd_json_dispatch_strv, offsetof(UserRecord, ssh_authorized_keys), 0 }, - { "pkcs11EncryptedKey", SD_JSON_VARIANT_ARRAY, dispatch_pkcs11_key, 0, 0 }, - { "fido2HmacSalt", SD_JSON_VARIANT_ARRAY, dispatch_fido2_hmac_salt, 0, 0 }, - { "recoveryKey", SD_JSON_VARIANT_ARRAY, dispatch_recovery_key, 0, 0 }, + { "passwordHint", SD_JSON_VARIANT_STRING, sd_json_dispatch_string, offsetof(UserRecord, password_hint), 0 }, + { "hashedPassword", _SD_JSON_VARIANT_TYPE_INVALID, sd_json_dispatch_strv, offsetof(UserRecord, hashed_password), SD_JSON_STRICT }, + { "sshAuthorizedKeys", _SD_JSON_VARIANT_TYPE_INVALID, sd_json_dispatch_strv, offsetof(UserRecord, ssh_authorized_keys), 0 }, + { "pkcs11EncryptedKey", SD_JSON_VARIANT_ARRAY, dispatch_pkcs11_key, 0, 0 }, + { "fido2HmacSalt", SD_JSON_VARIANT_ARRAY, dispatch_fido2_hmac_salt, 0, 0 }, + { "recoveryKey", SD_JSON_VARIANT_ARRAY, dispatch_recovery_key, 0, 0 }, {}, }; @@ -1057,19 +1057,19 @@ static int dispatch_privileged(const char *name, sd_json_variant *variant, sd_js static int dispatch_binding(const char *name, sd_json_variant *variant, sd_json_dispatch_flags_t flags, void *userdata) { static const sd_json_dispatch_field binding_dispatch_table[] = { - { "blobDirectory", SD_JSON_VARIANT_STRING, json_dispatch_path, offsetof(UserRecord, blob_directory), SD_JSON_SAFE }, - { "imagePath", SD_JSON_VARIANT_STRING, json_dispatch_image_path, offsetof(UserRecord, image_path), 0 }, - { "homeDirectory", SD_JSON_VARIANT_STRING, json_dispatch_home_directory, offsetof(UserRecord, home_directory), 0 }, - { "partitionUuid", SD_JSON_VARIANT_STRING, sd_json_dispatch_id128, offsetof(UserRecord, partition_uuid), 0 }, - { "luksUuid", SD_JSON_VARIANT_STRING, sd_json_dispatch_id128, offsetof(UserRecord, luks_uuid), 0 }, - { "fileSystemUuid", SD_JSON_VARIANT_STRING, sd_json_dispatch_id128, offsetof(UserRecord, file_system_uuid), 0 }, - { "uid", SD_JSON_VARIANT_UNSIGNED, sd_json_dispatch_uid_gid, offsetof(UserRecord, uid), 0 }, - { "gid", SD_JSON_VARIANT_UNSIGNED, sd_json_dispatch_uid_gid, offsetof(UserRecord, gid), 0 }, - { "storage", SD_JSON_VARIANT_STRING, json_dispatch_user_storage, offsetof(UserRecord, storage), 0 }, - { "fileSystemType", SD_JSON_VARIANT_STRING, sd_json_dispatch_string, offsetof(UserRecord, file_system_type), SD_JSON_SAFE }, - { "luksCipher", SD_JSON_VARIANT_STRING, sd_json_dispatch_string, offsetof(UserRecord, luks_cipher), SD_JSON_SAFE }, - { "luksCipherMode", SD_JSON_VARIANT_STRING, sd_json_dispatch_string, offsetof(UserRecord, luks_cipher_mode), SD_JSON_SAFE }, - { "luksVolumeKeySize", _SD_JSON_VARIANT_TYPE_INVALID, sd_json_dispatch_uint64, offsetof(UserRecord, luks_volume_key_size), 0 }, + { "blobDirectory", SD_JSON_VARIANT_STRING, json_dispatch_path, offsetof(UserRecord, blob_directory), SD_JSON_STRICT }, + { "imagePath", SD_JSON_VARIANT_STRING, json_dispatch_image_path, offsetof(UserRecord, image_path), 0 }, + { "homeDirectory", SD_JSON_VARIANT_STRING, json_dispatch_home_directory, offsetof(UserRecord, home_directory), 0 }, + { "partitionUuid", SD_JSON_VARIANT_STRING, sd_json_dispatch_id128, offsetof(UserRecord, partition_uuid), 0 }, + { "luksUuid", SD_JSON_VARIANT_STRING, sd_json_dispatch_id128, offsetof(UserRecord, luks_uuid), 0 }, + { "fileSystemUuid", SD_JSON_VARIANT_STRING, sd_json_dispatch_id128, offsetof(UserRecord, file_system_uuid), 0 }, + { "uid", SD_JSON_VARIANT_UNSIGNED, sd_json_dispatch_uid_gid, offsetof(UserRecord, uid), 0 }, + { "gid", SD_JSON_VARIANT_UNSIGNED, sd_json_dispatch_uid_gid, offsetof(UserRecord, gid), 0 }, + { "storage", SD_JSON_VARIANT_STRING, json_dispatch_user_storage, offsetof(UserRecord, storage), 0 }, + { "fileSystemType", SD_JSON_VARIANT_STRING, sd_json_dispatch_string, offsetof(UserRecord, file_system_type), SD_JSON_STRICT }, + { "luksCipher", SD_JSON_VARIANT_STRING, sd_json_dispatch_string, offsetof(UserRecord, luks_cipher), SD_JSON_STRICT }, + { "luksCipherMode", SD_JSON_VARIANT_STRING, sd_json_dispatch_string, offsetof(UserRecord, luks_cipher_mode), SD_JSON_STRICT }, + { "luksVolumeKeySize", _SD_JSON_VARIANT_TYPE_INVALID, sd_json_dispatch_uint64, offsetof(UserRecord, luks_volume_key_size), 0 }, {}, }; @@ -1254,81 +1254,81 @@ int per_machine_match(sd_json_variant *entry, sd_json_dispatch_flags_t flags) { static int dispatch_per_machine(const char *name, sd_json_variant *variant, sd_json_dispatch_flags_t flags, void *userdata) { static const sd_json_dispatch_field per_machine_dispatch_table[] = { - { "matchMachineId", _SD_JSON_VARIANT_TYPE_INVALID, NULL, 0, 0 }, - { "matchHostname", _SD_JSON_VARIANT_TYPE_INVALID, NULL, 0, 0 }, - { "blobDirectory", SD_JSON_VARIANT_STRING, json_dispatch_path, offsetof(UserRecord, blob_directory), SD_JSON_SAFE }, - { "blobManifest", SD_JSON_VARIANT_OBJECT, dispatch_blob_manifest, offsetof(UserRecord, blob_manifest), 0 }, - { "iconName", SD_JSON_VARIANT_STRING, sd_json_dispatch_string, offsetof(UserRecord, icon_name), SD_JSON_SAFE }, - { "location", SD_JSON_VARIANT_STRING, sd_json_dispatch_string, offsetof(UserRecord, location), 0 }, - { "shell", SD_JSON_VARIANT_STRING, json_dispatch_filename_or_path, offsetof(UserRecord, shell), 0 }, - { "umask", SD_JSON_VARIANT_UNSIGNED, json_dispatch_umask, offsetof(UserRecord, umask), 0 }, - { "environment", SD_JSON_VARIANT_ARRAY, json_dispatch_environment, offsetof(UserRecord, environment), 0 }, - { "timeZone", SD_JSON_VARIANT_STRING, sd_json_dispatch_string, offsetof(UserRecord, time_zone), SD_JSON_SAFE }, - { "preferredLanguage", SD_JSON_VARIANT_STRING, json_dispatch_locale, offsetof(UserRecord, preferred_language), 0 }, - { "additionalLanguages", SD_JSON_VARIANT_ARRAY, json_dispatch_locales, offsetof(UserRecord, additional_languages), 0 }, - { "niceLevel", _SD_JSON_VARIANT_TYPE_INVALID, json_dispatch_nice, offsetof(UserRecord, nice_level), 0 }, - { "resourceLimits", _SD_JSON_VARIANT_TYPE_INVALID, json_dispatch_rlimits, offsetof(UserRecord, rlimits), 0 }, - { "locked", SD_JSON_VARIANT_BOOLEAN, sd_json_dispatch_tristate, offsetof(UserRecord, locked), 0 }, - { "notBeforeUSec", _SD_JSON_VARIANT_TYPE_INVALID, sd_json_dispatch_uint64, offsetof(UserRecord, not_before_usec), 0 }, - { "notAfterUSec", _SD_JSON_VARIANT_TYPE_INVALID, sd_json_dispatch_uint64, offsetof(UserRecord, not_after_usec), 0 }, - { "storage", SD_JSON_VARIANT_STRING, json_dispatch_user_storage, offsetof(UserRecord, storage), 0 }, - { "diskSize", _SD_JSON_VARIANT_TYPE_INVALID, sd_json_dispatch_uint64, offsetof(UserRecord, disk_size), 0 }, - { "diskSizeRelative", _SD_JSON_VARIANT_TYPE_INVALID, sd_json_dispatch_uint64, offsetof(UserRecord, disk_size_relative), 0 }, - { "skeletonDirectory", SD_JSON_VARIANT_STRING, json_dispatch_path, offsetof(UserRecord, skeleton_directory), SD_JSON_SAFE }, - { "accessMode", SD_JSON_VARIANT_UNSIGNED, json_dispatch_access_mode, offsetof(UserRecord, access_mode), 0 }, - { "tasksMax", SD_JSON_VARIANT_UNSIGNED, json_dispatch_tasks_or_memory_max, offsetof(UserRecord, tasks_max), 0 }, - { "memoryHigh", SD_JSON_VARIANT_UNSIGNED, json_dispatch_tasks_or_memory_max, offsetof(UserRecord, memory_high), 0 }, - { "memoryMax", SD_JSON_VARIANT_UNSIGNED, json_dispatch_tasks_or_memory_max, offsetof(UserRecord, memory_max), 0 }, - { "cpuWeight", SD_JSON_VARIANT_UNSIGNED, json_dispatch_weight, offsetof(UserRecord, cpu_weight), 0 }, - { "ioWeight", SD_JSON_VARIANT_UNSIGNED, json_dispatch_weight, offsetof(UserRecord, io_weight), 0 }, - { "mountNoDevices", SD_JSON_VARIANT_BOOLEAN, sd_json_dispatch_stdbool, offsetof(UserRecord, nodev), 0 }, - { "mountNoSuid", SD_JSON_VARIANT_BOOLEAN, sd_json_dispatch_stdbool, offsetof(UserRecord, nosuid), 0 }, - { "mountNoExecute", SD_JSON_VARIANT_BOOLEAN, sd_json_dispatch_stdbool, offsetof(UserRecord, noexec), 0 }, - { "cifsDomain", SD_JSON_VARIANT_STRING, sd_json_dispatch_string, offsetof(UserRecord, cifs_domain), SD_JSON_SAFE }, - { "cifsUserName", SD_JSON_VARIANT_STRING, sd_json_dispatch_string, offsetof(UserRecord, cifs_user_name), SD_JSON_SAFE }, - { "cifsService", SD_JSON_VARIANT_STRING, sd_json_dispatch_string, offsetof(UserRecord, cifs_service), SD_JSON_SAFE }, - { "cifsExtraMountOptions", SD_JSON_VARIANT_STRING, sd_json_dispatch_string, offsetof(UserRecord, cifs_extra_mount_options), 0 }, - { "imagePath", SD_JSON_VARIANT_STRING, json_dispatch_path, offsetof(UserRecord, image_path), SD_JSON_SAFE }, - { "uid", SD_JSON_VARIANT_UNSIGNED, sd_json_dispatch_uid_gid, offsetof(UserRecord, uid), 0 }, - { "gid", SD_JSON_VARIANT_UNSIGNED, sd_json_dispatch_uid_gid, offsetof(UserRecord, gid), 0 }, - { "memberOf", SD_JSON_VARIANT_ARRAY, json_dispatch_user_group_list, offsetof(UserRecord, member_of), SD_JSON_RELAX }, - { "capabilityBoundingSet", SD_JSON_VARIANT_ARRAY, sd_json_dispatch_strv, offsetof(UserRecord, capability_bounding_set), SD_JSON_SAFE }, - { "capabilityAmbientSet", SD_JSON_VARIANT_ARRAY, sd_json_dispatch_strv, offsetof(UserRecord, capability_ambient_set), SD_JSON_SAFE }, - { "fileSystemType", SD_JSON_VARIANT_STRING, sd_json_dispatch_string, offsetof(UserRecord, file_system_type), SD_JSON_SAFE }, - { "partitionUuid", SD_JSON_VARIANT_STRING, sd_json_dispatch_id128, offsetof(UserRecord, partition_uuid), 0 }, - { "luksUuid", SD_JSON_VARIANT_STRING, sd_json_dispatch_id128, offsetof(UserRecord, luks_uuid), 0 }, - { "fileSystemUuid", SD_JSON_VARIANT_STRING, sd_json_dispatch_id128, offsetof(UserRecord, file_system_uuid), 0 }, - { "luksDiscard", _SD_JSON_VARIANT_TYPE_INVALID, sd_json_dispatch_tristate, offsetof(UserRecord, luks_discard), 0, }, - { "luksOfflineDiscard", _SD_JSON_VARIANT_TYPE_INVALID, sd_json_dispatch_tristate, offsetof(UserRecord, luks_offline_discard), 0, }, - { "luksCipher", SD_JSON_VARIANT_STRING, sd_json_dispatch_string, offsetof(UserRecord, luks_cipher), SD_JSON_SAFE }, - { "luksCipherMode", SD_JSON_VARIANT_STRING, sd_json_dispatch_string, offsetof(UserRecord, luks_cipher_mode), SD_JSON_SAFE }, - { "luksVolumeKeySize", _SD_JSON_VARIANT_TYPE_INVALID, sd_json_dispatch_uint64, offsetof(UserRecord, luks_volume_key_size), 0 }, - { "luksPbkdfHashAlgorithm", SD_JSON_VARIANT_STRING, sd_json_dispatch_string, offsetof(UserRecord, luks_pbkdf_hash_algorithm), SD_JSON_SAFE }, - { "luksPbkdfType", SD_JSON_VARIANT_STRING, sd_json_dispatch_string, offsetof(UserRecord, luks_pbkdf_type), SD_JSON_SAFE }, - { "luksPbkdfForceIterations", _SD_JSON_VARIANT_TYPE_INVALID, sd_json_dispatch_uint64, offsetof(UserRecord, luks_pbkdf_force_iterations), 0 }, - { "luksPbkdfTimeCostUSec", _SD_JSON_VARIANT_TYPE_INVALID, sd_json_dispatch_uint64, offsetof(UserRecord, luks_pbkdf_time_cost_usec), 0 }, - { "luksPbkdfMemoryCost", _SD_JSON_VARIANT_TYPE_INVALID, sd_json_dispatch_uint64, offsetof(UserRecord, luks_pbkdf_memory_cost), 0 }, - { "luksPbkdfParallelThreads", _SD_JSON_VARIANT_TYPE_INVALID, sd_json_dispatch_uint64, offsetof(UserRecord, luks_pbkdf_parallel_threads), 0 }, - { "luksSectorSize", _SD_JSON_VARIANT_TYPE_INVALID, sd_json_dispatch_uint64, offsetof(UserRecord, luks_sector_size), 0 }, - { "luksExtraMountOptions", SD_JSON_VARIANT_STRING, sd_json_dispatch_string, offsetof(UserRecord, luks_extra_mount_options), 0 }, - { "dropCaches", SD_JSON_VARIANT_BOOLEAN, sd_json_dispatch_tristate, offsetof(UserRecord, drop_caches), 0 }, - { "autoResizeMode", _SD_JSON_VARIANT_TYPE_INVALID, dispatch_auto_resize_mode, offsetof(UserRecord, auto_resize_mode), 0 }, - { "rebalanceWeight", _SD_JSON_VARIANT_TYPE_INVALID, dispatch_rebalance_weight, offsetof(UserRecord, rebalance_weight), 0 }, - { "rateLimitIntervalUSec", _SD_JSON_VARIANT_TYPE_INVALID, sd_json_dispatch_uint64, offsetof(UserRecord, ratelimit_interval_usec), 0 }, - { "rateLimitBurst", _SD_JSON_VARIANT_TYPE_INVALID, sd_json_dispatch_uint64, offsetof(UserRecord, ratelimit_burst), 0 }, - { "enforcePasswordPolicy", SD_JSON_VARIANT_BOOLEAN, sd_json_dispatch_tristate, offsetof(UserRecord, enforce_password_policy), 0 }, - { "autoLogin", SD_JSON_VARIANT_BOOLEAN, sd_json_dispatch_tristate, offsetof(UserRecord, auto_login), 0 }, - { "preferredSessionType", SD_JSON_VARIANT_STRING, sd_json_dispatch_string, offsetof(UserRecord, preferred_session_type), SD_JSON_SAFE }, - { "preferredSessionLauncher", SD_JSON_VARIANT_STRING, sd_json_dispatch_string, offsetof(UserRecord, preferred_session_launcher), SD_JSON_SAFE }, - { "stopDelayUSec", _SD_JSON_VARIANT_TYPE_INVALID, sd_json_dispatch_uint64, offsetof(UserRecord, stop_delay_usec), 0 }, - { "killProcesses", SD_JSON_VARIANT_BOOLEAN, sd_json_dispatch_tristate, offsetof(UserRecord, kill_processes), 0 }, - { "passwordChangeMinUSec", _SD_JSON_VARIANT_TYPE_INVALID, sd_json_dispatch_uint64, offsetof(UserRecord, password_change_min_usec), 0 }, - { "passwordChangeMaxUSec", _SD_JSON_VARIANT_TYPE_INVALID, sd_json_dispatch_uint64, offsetof(UserRecord, password_change_max_usec), 0 }, - { "passwordChangeWarnUSec", _SD_JSON_VARIANT_TYPE_INVALID, sd_json_dispatch_uint64, offsetof(UserRecord, password_change_warn_usec), 0 }, - { "passwordChangeInactiveUSec", _SD_JSON_VARIANT_TYPE_INVALID, sd_json_dispatch_uint64, offsetof(UserRecord, password_change_inactive_usec), 0 }, - { "passwordChangeNow", SD_JSON_VARIANT_BOOLEAN, sd_json_dispatch_tristate, offsetof(UserRecord, password_change_now), 0 }, - { "pkcs11TokenUri", SD_JSON_VARIANT_ARRAY, dispatch_pkcs11_uri_array, offsetof(UserRecord, pkcs11_token_uri), 0 }, - { "fido2HmacCredential", SD_JSON_VARIANT_ARRAY, dispatch_fido2_hmac_credential_array, 0, 0 }, + { "matchMachineId", _SD_JSON_VARIANT_TYPE_INVALID, NULL, 0, 0 }, + { "matchHostname", _SD_JSON_VARIANT_TYPE_INVALID, NULL, 0, 0 }, + { "blobDirectory", SD_JSON_VARIANT_STRING, json_dispatch_path, offsetof(UserRecord, blob_directory), SD_JSON_STRICT }, + { "blobManifest", SD_JSON_VARIANT_OBJECT, dispatch_blob_manifest, offsetof(UserRecord, blob_manifest), 0 }, + { "iconName", SD_JSON_VARIANT_STRING, sd_json_dispatch_string, offsetof(UserRecord, icon_name), SD_JSON_STRICT }, + { "location", SD_JSON_VARIANT_STRING, sd_json_dispatch_string, offsetof(UserRecord, location), 0 }, + { "shell", SD_JSON_VARIANT_STRING, json_dispatch_filename_or_path, offsetof(UserRecord, shell), 0 }, + { "umask", SD_JSON_VARIANT_UNSIGNED, json_dispatch_umask, offsetof(UserRecord, umask), 0 }, + { "environment", SD_JSON_VARIANT_ARRAY, json_dispatch_environment, offsetof(UserRecord, environment), 0 }, + { "timeZone", SD_JSON_VARIANT_STRING, sd_json_dispatch_string, offsetof(UserRecord, time_zone), SD_JSON_STRICT }, + { "preferredLanguage", SD_JSON_VARIANT_STRING, json_dispatch_locale, offsetof(UserRecord, preferred_language), 0 }, + { "additionalLanguages", SD_JSON_VARIANT_ARRAY, json_dispatch_locales, offsetof(UserRecord, additional_languages), 0 }, + { "niceLevel", _SD_JSON_VARIANT_TYPE_INVALID, json_dispatch_nice, offsetof(UserRecord, nice_level), 0 }, + { "resourceLimits", _SD_JSON_VARIANT_TYPE_INVALID, json_dispatch_rlimits, offsetof(UserRecord, rlimits), 0 }, + { "locked", SD_JSON_VARIANT_BOOLEAN, sd_json_dispatch_tristate, offsetof(UserRecord, locked), 0 }, + { "notBeforeUSec", _SD_JSON_VARIANT_TYPE_INVALID, sd_json_dispatch_uint64, offsetof(UserRecord, not_before_usec), 0 }, + { "notAfterUSec", _SD_JSON_VARIANT_TYPE_INVALID, sd_json_dispatch_uint64, offsetof(UserRecord, not_after_usec), 0 }, + { "storage", SD_JSON_VARIANT_STRING, json_dispatch_user_storage, offsetof(UserRecord, storage), 0 }, + { "diskSize", _SD_JSON_VARIANT_TYPE_INVALID, sd_json_dispatch_uint64, offsetof(UserRecord, disk_size), 0 }, + { "diskSizeRelative", _SD_JSON_VARIANT_TYPE_INVALID, sd_json_dispatch_uint64, offsetof(UserRecord, disk_size_relative), 0 }, + { "skeletonDirectory", SD_JSON_VARIANT_STRING, json_dispatch_path, offsetof(UserRecord, skeleton_directory), SD_JSON_STRICT }, + { "accessMode", SD_JSON_VARIANT_UNSIGNED, json_dispatch_access_mode, offsetof(UserRecord, access_mode), 0 }, + { "tasksMax", SD_JSON_VARIANT_UNSIGNED, json_dispatch_tasks_or_memory_max, offsetof(UserRecord, tasks_max), 0 }, + { "memoryHigh", SD_JSON_VARIANT_UNSIGNED, json_dispatch_tasks_or_memory_max, offsetof(UserRecord, memory_high), 0 }, + { "memoryMax", SD_JSON_VARIANT_UNSIGNED, json_dispatch_tasks_or_memory_max, offsetof(UserRecord, memory_max), 0 }, + { "cpuWeight", SD_JSON_VARIANT_UNSIGNED, json_dispatch_weight, offsetof(UserRecord, cpu_weight), 0 }, + { "ioWeight", SD_JSON_VARIANT_UNSIGNED, json_dispatch_weight, offsetof(UserRecord, io_weight), 0 }, + { "mountNoDevices", SD_JSON_VARIANT_BOOLEAN, sd_json_dispatch_stdbool, offsetof(UserRecord, nodev), 0 }, + { "mountNoSuid", SD_JSON_VARIANT_BOOLEAN, sd_json_dispatch_stdbool, offsetof(UserRecord, nosuid), 0 }, + { "mountNoExecute", SD_JSON_VARIANT_BOOLEAN, sd_json_dispatch_stdbool, offsetof(UserRecord, noexec), 0 }, + { "cifsDomain", SD_JSON_VARIANT_STRING, sd_json_dispatch_string, offsetof(UserRecord, cifs_domain), SD_JSON_STRICT }, + { "cifsUserName", SD_JSON_VARIANT_STRING, sd_json_dispatch_string, offsetof(UserRecord, cifs_user_name), SD_JSON_STRICT }, + { "cifsService", SD_JSON_VARIANT_STRING, sd_json_dispatch_string, offsetof(UserRecord, cifs_service), SD_JSON_STRICT }, + { "cifsExtraMountOptions", SD_JSON_VARIANT_STRING, sd_json_dispatch_string, offsetof(UserRecord, cifs_extra_mount_options), 0 }, + { "imagePath", SD_JSON_VARIANT_STRING, json_dispatch_path, offsetof(UserRecord, image_path), SD_JSON_STRICT }, + { "uid", SD_JSON_VARIANT_UNSIGNED, sd_json_dispatch_uid_gid, offsetof(UserRecord, uid), 0 }, + { "gid", SD_JSON_VARIANT_UNSIGNED, sd_json_dispatch_uid_gid, offsetof(UserRecord, gid), 0 }, + { "memberOf", SD_JSON_VARIANT_ARRAY, json_dispatch_user_group_list, offsetof(UserRecord, member_of), SD_JSON_RELAX }, + { "capabilityBoundingSet", SD_JSON_VARIANT_ARRAY, sd_json_dispatch_strv, offsetof(UserRecord, capability_bounding_set), SD_JSON_STRICT }, + { "capabilityAmbientSet", SD_JSON_VARIANT_ARRAY, sd_json_dispatch_strv, offsetof(UserRecord, capability_ambient_set), SD_JSON_STRICT }, + { "fileSystemType", SD_JSON_VARIANT_STRING, sd_json_dispatch_string, offsetof(UserRecord, file_system_type), SD_JSON_STRICT }, + { "partitionUuid", SD_JSON_VARIANT_STRING, sd_json_dispatch_id128, offsetof(UserRecord, partition_uuid), 0 }, + { "luksUuid", SD_JSON_VARIANT_STRING, sd_json_dispatch_id128, offsetof(UserRecord, luks_uuid), 0 }, + { "fileSystemUuid", SD_JSON_VARIANT_STRING, sd_json_dispatch_id128, offsetof(UserRecord, file_system_uuid), 0 }, + { "luksDiscard", _SD_JSON_VARIANT_TYPE_INVALID, sd_json_dispatch_tristate, offsetof(UserRecord, luks_discard), 0, }, + { "luksOfflineDiscard", _SD_JSON_VARIANT_TYPE_INVALID, sd_json_dispatch_tristate, offsetof(UserRecord, luks_offline_discard), 0, }, + { "luksCipher", SD_JSON_VARIANT_STRING, sd_json_dispatch_string, offsetof(UserRecord, luks_cipher), SD_JSON_STRICT }, + { "luksCipherMode", SD_JSON_VARIANT_STRING, sd_json_dispatch_string, offsetof(UserRecord, luks_cipher_mode), SD_JSON_STRICT }, + { "luksVolumeKeySize", _SD_JSON_VARIANT_TYPE_INVALID, sd_json_dispatch_uint64, offsetof(UserRecord, luks_volume_key_size), 0 }, + { "luksPbkdfHashAlgorithm", SD_JSON_VARIANT_STRING, sd_json_dispatch_string, offsetof(UserRecord, luks_pbkdf_hash_algorithm), SD_JSON_STRICT }, + { "luksPbkdfType", SD_JSON_VARIANT_STRING, sd_json_dispatch_string, offsetof(UserRecord, luks_pbkdf_type), SD_JSON_STRICT }, + { "luksPbkdfForceIterations", _SD_JSON_VARIANT_TYPE_INVALID, sd_json_dispatch_uint64, offsetof(UserRecord, luks_pbkdf_force_iterations), 0 }, + { "luksPbkdfTimeCostUSec", _SD_JSON_VARIANT_TYPE_INVALID, sd_json_dispatch_uint64, offsetof(UserRecord, luks_pbkdf_time_cost_usec), 0 }, + { "luksPbkdfMemoryCost", _SD_JSON_VARIANT_TYPE_INVALID, sd_json_dispatch_uint64, offsetof(UserRecord, luks_pbkdf_memory_cost), 0 }, + { "luksPbkdfParallelThreads", _SD_JSON_VARIANT_TYPE_INVALID, sd_json_dispatch_uint64, offsetof(UserRecord, luks_pbkdf_parallel_threads), 0 }, + { "luksSectorSize", _SD_JSON_VARIANT_TYPE_INVALID, sd_json_dispatch_uint64, offsetof(UserRecord, luks_sector_size), 0 }, + { "luksExtraMountOptions", SD_JSON_VARIANT_STRING, sd_json_dispatch_string, offsetof(UserRecord, luks_extra_mount_options), 0 }, + { "dropCaches", SD_JSON_VARIANT_BOOLEAN, sd_json_dispatch_tristate, offsetof(UserRecord, drop_caches), 0 }, + { "autoResizeMode", _SD_JSON_VARIANT_TYPE_INVALID, dispatch_auto_resize_mode, offsetof(UserRecord, auto_resize_mode), 0 }, + { "rebalanceWeight", _SD_JSON_VARIANT_TYPE_INVALID, dispatch_rebalance_weight, offsetof(UserRecord, rebalance_weight), 0 }, + { "rateLimitIntervalUSec", _SD_JSON_VARIANT_TYPE_INVALID, sd_json_dispatch_uint64, offsetof(UserRecord, ratelimit_interval_usec), 0 }, + { "rateLimitBurst", _SD_JSON_VARIANT_TYPE_INVALID, sd_json_dispatch_uint64, offsetof(UserRecord, ratelimit_burst), 0 }, + { "enforcePasswordPolicy", SD_JSON_VARIANT_BOOLEAN, sd_json_dispatch_tristate, offsetof(UserRecord, enforce_password_policy), 0 }, + { "autoLogin", SD_JSON_VARIANT_BOOLEAN, sd_json_dispatch_tristate, offsetof(UserRecord, auto_login), 0 }, + { "preferredSessionType", SD_JSON_VARIANT_STRING, sd_json_dispatch_string, offsetof(UserRecord, preferred_session_type), SD_JSON_STRICT }, + { "preferredSessionLauncher", SD_JSON_VARIANT_STRING, sd_json_dispatch_string, offsetof(UserRecord, preferred_session_launcher), SD_JSON_STRICT }, + { "stopDelayUSec", _SD_JSON_VARIANT_TYPE_INVALID, sd_json_dispatch_uint64, offsetof(UserRecord, stop_delay_usec), 0 }, + { "killProcesses", SD_JSON_VARIANT_BOOLEAN, sd_json_dispatch_tristate, offsetof(UserRecord, kill_processes), 0 }, + { "passwordChangeMinUSec", _SD_JSON_VARIANT_TYPE_INVALID, sd_json_dispatch_uint64, offsetof(UserRecord, password_change_min_usec), 0 }, + { "passwordChangeMaxUSec", _SD_JSON_VARIANT_TYPE_INVALID, sd_json_dispatch_uint64, offsetof(UserRecord, password_change_max_usec), 0 }, + { "passwordChangeWarnUSec", _SD_JSON_VARIANT_TYPE_INVALID, sd_json_dispatch_uint64, offsetof(UserRecord, password_change_warn_usec), 0 }, + { "passwordChangeInactiveUSec", _SD_JSON_VARIANT_TYPE_INVALID, sd_json_dispatch_uint64, offsetof(UserRecord, password_change_inactive_usec), 0 }, + { "passwordChangeNow", SD_JSON_VARIANT_BOOLEAN, sd_json_dispatch_tristate, offsetof(UserRecord, password_change_now), 0 }, + { "pkcs11TokenUri", SD_JSON_VARIANT_ARRAY, dispatch_pkcs11_uri_array, offsetof(UserRecord, pkcs11_token_uri), 0 }, + { "fido2HmacCredential", SD_JSON_VARIANT_ARRAY, dispatch_fido2_hmac_credential_array, 0, 0 }, {}, }; @@ -1362,26 +1362,26 @@ static int dispatch_per_machine(const char *name, sd_json_variant *variant, sd_j static int dispatch_status(const char *name, sd_json_variant *variant, sd_json_dispatch_flags_t flags, void *userdata) { static const sd_json_dispatch_field status_dispatch_table[] = { - { "diskUsage", _SD_JSON_VARIANT_TYPE_INVALID, sd_json_dispatch_uint64, offsetof(UserRecord, disk_usage), 0 }, - { "diskFree", _SD_JSON_VARIANT_TYPE_INVALID, sd_json_dispatch_uint64, offsetof(UserRecord, disk_free), 0 }, - { "diskSize", _SD_JSON_VARIANT_TYPE_INVALID, sd_json_dispatch_uint64, offsetof(UserRecord, disk_size), 0 }, - { "diskCeiling", _SD_JSON_VARIANT_TYPE_INVALID, sd_json_dispatch_uint64, offsetof(UserRecord, disk_ceiling), 0 }, - { "diskFloor", _SD_JSON_VARIANT_TYPE_INVALID, sd_json_dispatch_uint64, offsetof(UserRecord, disk_floor), 0 }, - { "state", SD_JSON_VARIANT_STRING, sd_json_dispatch_string, offsetof(UserRecord, state), SD_JSON_SAFE }, - { "service", SD_JSON_VARIANT_STRING, sd_json_dispatch_string, offsetof(UserRecord, service), SD_JSON_SAFE }, - { "signedLocally", _SD_JSON_VARIANT_TYPE_INVALID, sd_json_dispatch_tristate, offsetof(UserRecord, signed_locally), 0 }, - { "goodAuthenticationCounter", _SD_JSON_VARIANT_TYPE_INVALID, sd_json_dispatch_uint64, offsetof(UserRecord, good_authentication_counter), 0 }, - { "badAuthenticationCounter", _SD_JSON_VARIANT_TYPE_INVALID, sd_json_dispatch_uint64, offsetof(UserRecord, bad_authentication_counter), 0 }, - { "lastGoodAuthenticationUSec", _SD_JSON_VARIANT_TYPE_INVALID, sd_json_dispatch_uint64, offsetof(UserRecord, last_good_authentication_usec), 0 }, - { "lastBadAuthenticationUSec", _SD_JSON_VARIANT_TYPE_INVALID, sd_json_dispatch_uint64, offsetof(UserRecord, last_bad_authentication_usec), 0 }, - { "rateLimitBeginUSec", _SD_JSON_VARIANT_TYPE_INVALID, sd_json_dispatch_uint64, offsetof(UserRecord, ratelimit_begin_usec), 0 }, - { "rateLimitCount", _SD_JSON_VARIANT_TYPE_INVALID, sd_json_dispatch_uint64, offsetof(UserRecord, ratelimit_count), 0 }, - { "removable", SD_JSON_VARIANT_BOOLEAN, sd_json_dispatch_tristate, offsetof(UserRecord, removable), 0 }, - { "accessMode", SD_JSON_VARIANT_UNSIGNED, json_dispatch_access_mode, offsetof(UserRecord, access_mode), 0 }, - { "fileSystemType", SD_JSON_VARIANT_STRING, sd_json_dispatch_string, offsetof(UserRecord, file_system_type), SD_JSON_SAFE }, - { "fallbackShell", SD_JSON_VARIANT_STRING, json_dispatch_filename_or_path, offsetof(UserRecord, fallback_shell), 0 }, - { "fallbackHomeDirectory", SD_JSON_VARIANT_STRING, json_dispatch_home_directory, offsetof(UserRecord, fallback_home_directory), 0 }, - { "useFallback", SD_JSON_VARIANT_BOOLEAN, sd_json_dispatch_stdbool, offsetof(UserRecord, use_fallback), 0 }, + { "diskUsage", _SD_JSON_VARIANT_TYPE_INVALID, sd_json_dispatch_uint64, offsetof(UserRecord, disk_usage), 0 }, + { "diskFree", _SD_JSON_VARIANT_TYPE_INVALID, sd_json_dispatch_uint64, offsetof(UserRecord, disk_free), 0 }, + { "diskSize", _SD_JSON_VARIANT_TYPE_INVALID, sd_json_dispatch_uint64, offsetof(UserRecord, disk_size), 0 }, + { "diskCeiling", _SD_JSON_VARIANT_TYPE_INVALID, sd_json_dispatch_uint64, offsetof(UserRecord, disk_ceiling), 0 }, + { "diskFloor", _SD_JSON_VARIANT_TYPE_INVALID, sd_json_dispatch_uint64, offsetof(UserRecord, disk_floor), 0 }, + { "state", SD_JSON_VARIANT_STRING, sd_json_dispatch_string, offsetof(UserRecord, state), SD_JSON_STRICT }, + { "service", SD_JSON_VARIANT_STRING, sd_json_dispatch_string, offsetof(UserRecord, service), SD_JSON_STRICT }, + { "signedLocally", _SD_JSON_VARIANT_TYPE_INVALID, sd_json_dispatch_tristate, offsetof(UserRecord, signed_locally), 0 }, + { "goodAuthenticationCounter", _SD_JSON_VARIANT_TYPE_INVALID, sd_json_dispatch_uint64, offsetof(UserRecord, good_authentication_counter), 0 }, + { "badAuthenticationCounter", _SD_JSON_VARIANT_TYPE_INVALID, sd_json_dispatch_uint64, offsetof(UserRecord, bad_authentication_counter), 0 }, + { "lastGoodAuthenticationUSec", _SD_JSON_VARIANT_TYPE_INVALID, sd_json_dispatch_uint64, offsetof(UserRecord, last_good_authentication_usec), 0 }, + { "lastBadAuthenticationUSec", _SD_JSON_VARIANT_TYPE_INVALID, sd_json_dispatch_uint64, offsetof(UserRecord, last_bad_authentication_usec), 0 }, + { "rateLimitBeginUSec", _SD_JSON_VARIANT_TYPE_INVALID, sd_json_dispatch_uint64, offsetof(UserRecord, ratelimit_begin_usec), 0 }, + { "rateLimitCount", _SD_JSON_VARIANT_TYPE_INVALID, sd_json_dispatch_uint64, offsetof(UserRecord, ratelimit_count), 0 }, + { "removable", SD_JSON_VARIANT_BOOLEAN, sd_json_dispatch_tristate, offsetof(UserRecord, removable), 0 }, + { "accessMode", SD_JSON_VARIANT_UNSIGNED, json_dispatch_access_mode, offsetof(UserRecord, access_mode), 0 }, + { "fileSystemType", SD_JSON_VARIANT_STRING, sd_json_dispatch_string, offsetof(UserRecord, file_system_type), SD_JSON_STRICT }, + { "fallbackShell", SD_JSON_VARIANT_STRING, json_dispatch_filename_or_path, offsetof(UserRecord, fallback_shell), 0 }, + { "fallbackHomeDirectory", SD_JSON_VARIANT_STRING, json_dispatch_home_directory, offsetof(UserRecord, fallback_home_directory), 0 }, + { "useFallback", SD_JSON_VARIANT_BOOLEAN, sd_json_dispatch_stdbool, offsetof(UserRecord, use_fallback), 0 }, {}, }; @@ -1592,100 +1592,100 @@ int user_group_record_mangle( int user_record_load(UserRecord *h, sd_json_variant *v, UserRecordLoadFlags load_flags) { static const sd_json_dispatch_field user_dispatch_table[] = { - { "userName", SD_JSON_VARIANT_STRING, json_dispatch_user_group_name, offsetof(UserRecord, user_name), SD_JSON_RELAX }, - { "realm", SD_JSON_VARIANT_STRING, json_dispatch_realm, offsetof(UserRecord, realm), 0 }, - { "blobDirectory", SD_JSON_VARIANT_STRING, json_dispatch_path, offsetof(UserRecord, blob_directory), SD_JSON_SAFE }, - { "blobManifest", SD_JSON_VARIANT_OBJECT, dispatch_blob_manifest, offsetof(UserRecord, blob_manifest), 0 }, - { "realName", SD_JSON_VARIANT_STRING, json_dispatch_gecos, offsetof(UserRecord, real_name), 0 }, - { "emailAddress", SD_JSON_VARIANT_STRING, sd_json_dispatch_string, offsetof(UserRecord, email_address), SD_JSON_SAFE }, - { "iconName", SD_JSON_VARIANT_STRING, sd_json_dispatch_string, offsetof(UserRecord, icon_name), SD_JSON_SAFE }, - { "location", SD_JSON_VARIANT_STRING, sd_json_dispatch_string, offsetof(UserRecord, location), 0 }, - { "disposition", SD_JSON_VARIANT_STRING, json_dispatch_user_disposition, offsetof(UserRecord, disposition), 0 }, - { "lastChangeUSec", _SD_JSON_VARIANT_TYPE_INVALID, sd_json_dispatch_uint64, offsetof(UserRecord, last_change_usec), 0 }, - { "lastPasswordChangeUSec", _SD_JSON_VARIANT_TYPE_INVALID, sd_json_dispatch_uint64, offsetof(UserRecord, last_password_change_usec), 0 }, - { "shell", SD_JSON_VARIANT_STRING, json_dispatch_filename_or_path, offsetof(UserRecord, shell), 0 }, - { "umask", SD_JSON_VARIANT_UNSIGNED, json_dispatch_umask, offsetof(UserRecord, umask), 0 }, - { "environment", SD_JSON_VARIANT_ARRAY, json_dispatch_environment, offsetof(UserRecord, environment), 0 }, - { "timeZone", SD_JSON_VARIANT_STRING, sd_json_dispatch_string, offsetof(UserRecord, time_zone), SD_JSON_SAFE }, - { "preferredLanguage", SD_JSON_VARIANT_STRING, json_dispatch_locale, offsetof(UserRecord, preferred_language), 0 }, - { "additionalLanguages", SD_JSON_VARIANT_ARRAY, json_dispatch_locales, offsetof(UserRecord, additional_languages), 0 }, - { "niceLevel", _SD_JSON_VARIANT_TYPE_INVALID, json_dispatch_nice, offsetof(UserRecord, nice_level), 0 }, - { "resourceLimits", _SD_JSON_VARIANT_TYPE_INVALID, json_dispatch_rlimits, offsetof(UserRecord, rlimits), 0 }, - { "locked", SD_JSON_VARIANT_BOOLEAN, sd_json_dispatch_tristate, offsetof(UserRecord, locked), 0 }, - { "notBeforeUSec", _SD_JSON_VARIANT_TYPE_INVALID, sd_json_dispatch_uint64, offsetof(UserRecord, not_before_usec), 0 }, - { "notAfterUSec", _SD_JSON_VARIANT_TYPE_INVALID, sd_json_dispatch_uint64, offsetof(UserRecord, not_after_usec), 0 }, - { "storage", SD_JSON_VARIANT_STRING, json_dispatch_user_storage, offsetof(UserRecord, storage), 0 }, - { "diskSize", _SD_JSON_VARIANT_TYPE_INVALID, sd_json_dispatch_uint64, offsetof(UserRecord, disk_size), 0 }, - { "diskSizeRelative", _SD_JSON_VARIANT_TYPE_INVALID, sd_json_dispatch_uint64, offsetof(UserRecord, disk_size_relative), 0 }, - { "skeletonDirectory", SD_JSON_VARIANT_STRING, json_dispatch_path, offsetof(UserRecord, skeleton_directory), SD_JSON_SAFE }, - { "accessMode", SD_JSON_VARIANT_UNSIGNED, json_dispatch_access_mode, offsetof(UserRecord, access_mode), 0 }, - { "tasksMax", SD_JSON_VARIANT_UNSIGNED, json_dispatch_tasks_or_memory_max, offsetof(UserRecord, tasks_max), 0 }, - { "memoryHigh", SD_JSON_VARIANT_UNSIGNED, json_dispatch_tasks_or_memory_max, offsetof(UserRecord, memory_high), 0 }, - { "memoryMax", SD_JSON_VARIANT_UNSIGNED, json_dispatch_tasks_or_memory_max, offsetof(UserRecord, memory_max), 0 }, - { "cpuWeight", SD_JSON_VARIANT_UNSIGNED, json_dispatch_weight, offsetof(UserRecord, cpu_weight), 0 }, - { "ioWeight", SD_JSON_VARIANT_UNSIGNED, json_dispatch_weight, offsetof(UserRecord, io_weight), 0 }, - { "mountNoDevices", SD_JSON_VARIANT_BOOLEAN, sd_json_dispatch_stdbool, offsetof(UserRecord, nodev), 0 }, - { "mountNoSuid", SD_JSON_VARIANT_BOOLEAN, sd_json_dispatch_stdbool, offsetof(UserRecord, nosuid), 0 }, - { "mountNoExecute", SD_JSON_VARIANT_BOOLEAN, sd_json_dispatch_stdbool, offsetof(UserRecord, noexec), 0 }, - { "cifsDomain", SD_JSON_VARIANT_STRING, sd_json_dispatch_string, offsetof(UserRecord, cifs_domain), SD_JSON_SAFE }, - { "cifsUserName", SD_JSON_VARIANT_STRING, sd_json_dispatch_string, offsetof(UserRecord, cifs_user_name), SD_JSON_SAFE }, - { "cifsService", SD_JSON_VARIANT_STRING, sd_json_dispatch_string, offsetof(UserRecord, cifs_service), SD_JSON_SAFE }, - { "cifsExtraMountOptions", SD_JSON_VARIANT_STRING, sd_json_dispatch_string, offsetof(UserRecord, cifs_extra_mount_options), 0 }, - { "imagePath", SD_JSON_VARIANT_STRING, json_dispatch_path, offsetof(UserRecord, image_path), SD_JSON_SAFE }, - { "homeDirectory", SD_JSON_VARIANT_STRING, json_dispatch_home_directory, offsetof(UserRecord, home_directory), 0 }, - { "uid", SD_JSON_VARIANT_UNSIGNED, sd_json_dispatch_uid_gid, offsetof(UserRecord, uid), 0 }, - { "gid", SD_JSON_VARIANT_UNSIGNED, sd_json_dispatch_uid_gid, offsetof(UserRecord, gid), 0 }, - { "memberOf", SD_JSON_VARIANT_ARRAY, json_dispatch_user_group_list, offsetof(UserRecord, member_of), SD_JSON_RELAX }, - { "capabilityBoundingSet", SD_JSON_VARIANT_ARRAY, sd_json_dispatch_strv, offsetof(UserRecord, capability_bounding_set), SD_JSON_SAFE }, - { "capabilityAmbientSet", SD_JSON_VARIANT_ARRAY, sd_json_dispatch_strv, offsetof(UserRecord, capability_ambient_set), SD_JSON_SAFE }, - { "fileSystemType", SD_JSON_VARIANT_STRING, sd_json_dispatch_string, offsetof(UserRecord, file_system_type), SD_JSON_SAFE }, - { "partitionUuid", SD_JSON_VARIANT_STRING, sd_json_dispatch_id128, offsetof(UserRecord, partition_uuid), 0 }, - { "luksUuid", SD_JSON_VARIANT_STRING, sd_json_dispatch_id128, offsetof(UserRecord, luks_uuid), 0 }, - { "fileSystemUuid", SD_JSON_VARIANT_STRING, sd_json_dispatch_id128, offsetof(UserRecord, file_system_uuid), 0 }, - { "luksDiscard", _SD_JSON_VARIANT_TYPE_INVALID, sd_json_dispatch_tristate, offsetof(UserRecord, luks_discard), 0 }, - { "luksOfflineDiscard", _SD_JSON_VARIANT_TYPE_INVALID, sd_json_dispatch_tristate, offsetof(UserRecord, luks_offline_discard), 0 }, - { "luksCipher", SD_JSON_VARIANT_STRING, sd_json_dispatch_string, offsetof(UserRecord, luks_cipher), SD_JSON_SAFE }, - { "luksCipherMode", SD_JSON_VARIANT_STRING, sd_json_dispatch_string, offsetof(UserRecord, luks_cipher_mode), SD_JSON_SAFE }, - { "luksVolumeKeySize", _SD_JSON_VARIANT_TYPE_INVALID, sd_json_dispatch_uint64, offsetof(UserRecord, luks_volume_key_size), 0 }, - { "luksPbkdfHashAlgorithm", SD_JSON_VARIANT_STRING, sd_json_dispatch_string, offsetof(UserRecord, luks_pbkdf_hash_algorithm), SD_JSON_SAFE }, - { "luksPbkdfType", SD_JSON_VARIANT_STRING, sd_json_dispatch_string, offsetof(UserRecord, luks_pbkdf_type), SD_JSON_SAFE }, - { "luksPbkdfForceIterations", _SD_JSON_VARIANT_TYPE_INVALID, sd_json_dispatch_uint64, offsetof(UserRecord, luks_pbkdf_force_iterations), 0 }, - { "luksPbkdfTimeCostUSec", _SD_JSON_VARIANT_TYPE_INVALID, sd_json_dispatch_uint64, offsetof(UserRecord, luks_pbkdf_time_cost_usec), 0 }, - { "luksPbkdfMemoryCost", _SD_JSON_VARIANT_TYPE_INVALID, sd_json_dispatch_uint64, offsetof(UserRecord, luks_pbkdf_memory_cost), 0 }, - { "luksPbkdfParallelThreads", _SD_JSON_VARIANT_TYPE_INVALID, sd_json_dispatch_uint64, offsetof(UserRecord, luks_pbkdf_parallel_threads), 0 }, - { "luksSectorSize", _SD_JSON_VARIANT_TYPE_INVALID, sd_json_dispatch_uint64, offsetof(UserRecord, luks_sector_size), 0 }, - { "luksExtraMountOptions", SD_JSON_VARIANT_STRING, sd_json_dispatch_string, offsetof(UserRecord, luks_extra_mount_options), 0 }, - { "dropCaches", SD_JSON_VARIANT_BOOLEAN, sd_json_dispatch_tristate, offsetof(UserRecord, drop_caches), 0 }, - { "autoResizeMode", _SD_JSON_VARIANT_TYPE_INVALID, dispatch_auto_resize_mode, offsetof(UserRecord, auto_resize_mode), 0 }, - { "rebalanceWeight", _SD_JSON_VARIANT_TYPE_INVALID, dispatch_rebalance_weight, offsetof(UserRecord, rebalance_weight), 0 }, - { "service", SD_JSON_VARIANT_STRING, sd_json_dispatch_string, offsetof(UserRecord, service), SD_JSON_SAFE }, - { "rateLimitIntervalUSec", _SD_JSON_VARIANT_TYPE_INVALID, sd_json_dispatch_uint64, offsetof(UserRecord, ratelimit_interval_usec), 0 }, - { "rateLimitBurst", _SD_JSON_VARIANT_TYPE_INVALID, sd_json_dispatch_uint64, offsetof(UserRecord, ratelimit_burst), 0 }, - { "enforcePasswordPolicy", SD_JSON_VARIANT_BOOLEAN, sd_json_dispatch_tristate, offsetof(UserRecord, enforce_password_policy), 0 }, - { "autoLogin", SD_JSON_VARIANT_BOOLEAN, sd_json_dispatch_tristate, offsetof(UserRecord, auto_login), 0 }, - { "preferredSessionType", SD_JSON_VARIANT_STRING, sd_json_dispatch_string, offsetof(UserRecord, preferred_session_type), SD_JSON_SAFE }, - { "preferredSessionLauncher", SD_JSON_VARIANT_STRING, sd_json_dispatch_string, offsetof(UserRecord, preferred_session_launcher), SD_JSON_SAFE }, - { "stopDelayUSec", _SD_JSON_VARIANT_TYPE_INVALID, sd_json_dispatch_uint64, offsetof(UserRecord, stop_delay_usec), 0 }, - { "killProcesses", SD_JSON_VARIANT_BOOLEAN, sd_json_dispatch_tristate, offsetof(UserRecord, kill_processes), 0 }, - { "passwordChangeMinUSec", _SD_JSON_VARIANT_TYPE_INVALID, sd_json_dispatch_uint64, offsetof(UserRecord, password_change_min_usec), 0 }, - { "passwordChangeMaxUSec", _SD_JSON_VARIANT_TYPE_INVALID, sd_json_dispatch_uint64, offsetof(UserRecord, password_change_max_usec), 0 }, - { "passwordChangeWarnUSec", _SD_JSON_VARIANT_TYPE_INVALID, sd_json_dispatch_uint64, offsetof(UserRecord, password_change_warn_usec), 0 }, - { "passwordChangeInactiveUSec", _SD_JSON_VARIANT_TYPE_INVALID, sd_json_dispatch_uint64, offsetof(UserRecord, password_change_inactive_usec), 0 }, - { "passwordChangeNow", SD_JSON_VARIANT_BOOLEAN, sd_json_dispatch_tristate, offsetof(UserRecord, password_change_now), 0 }, - { "pkcs11TokenUri", SD_JSON_VARIANT_ARRAY, dispatch_pkcs11_uri_array, offsetof(UserRecord, pkcs11_token_uri), 0 }, - { "fido2HmacCredential", SD_JSON_VARIANT_ARRAY, dispatch_fido2_hmac_credential_array, 0, 0 }, - { "recoveryKeyType", SD_JSON_VARIANT_ARRAY, sd_json_dispatch_strv, offsetof(UserRecord, recovery_key_type), 0 }, - - { "secret", SD_JSON_VARIANT_OBJECT, dispatch_secret, 0, 0 }, - { "privileged", SD_JSON_VARIANT_OBJECT, dispatch_privileged, 0, 0 }, + { "userName", SD_JSON_VARIANT_STRING, json_dispatch_user_group_name, offsetof(UserRecord, user_name), SD_JSON_RELAX }, + { "realm", SD_JSON_VARIANT_STRING, json_dispatch_realm, offsetof(UserRecord, realm), 0 }, + { "blobDirectory", SD_JSON_VARIANT_STRING, json_dispatch_path, offsetof(UserRecord, blob_directory), SD_JSON_STRICT }, + { "blobManifest", SD_JSON_VARIANT_OBJECT, dispatch_blob_manifest, offsetof(UserRecord, blob_manifest), 0 }, + { "realName", SD_JSON_VARIANT_STRING, json_dispatch_gecos, offsetof(UserRecord, real_name), 0 }, + { "emailAddress", SD_JSON_VARIANT_STRING, sd_json_dispatch_string, offsetof(UserRecord, email_address), SD_JSON_STRICT }, + { "iconName", SD_JSON_VARIANT_STRING, sd_json_dispatch_string, offsetof(UserRecord, icon_name), SD_JSON_STRICT }, + { "location", SD_JSON_VARIANT_STRING, sd_json_dispatch_string, offsetof(UserRecord, location), 0 }, + { "disposition", SD_JSON_VARIANT_STRING, json_dispatch_user_disposition, offsetof(UserRecord, disposition), 0 }, + { "lastChangeUSec", _SD_JSON_VARIANT_TYPE_INVALID, sd_json_dispatch_uint64, offsetof(UserRecord, last_change_usec), 0 }, + { "lastPasswordChangeUSec", _SD_JSON_VARIANT_TYPE_INVALID, sd_json_dispatch_uint64, offsetof(UserRecord, last_password_change_usec), 0 }, + { "shell", SD_JSON_VARIANT_STRING, json_dispatch_filename_or_path, offsetof(UserRecord, shell), 0 }, + { "umask", SD_JSON_VARIANT_UNSIGNED, json_dispatch_umask, offsetof(UserRecord, umask), 0 }, + { "environment", SD_JSON_VARIANT_ARRAY, json_dispatch_environment, offsetof(UserRecord, environment), 0 }, + { "timeZone", SD_JSON_VARIANT_STRING, sd_json_dispatch_string, offsetof(UserRecord, time_zone), SD_JSON_STRICT }, + { "preferredLanguage", SD_JSON_VARIANT_STRING, json_dispatch_locale, offsetof(UserRecord, preferred_language), 0 }, + { "additionalLanguages", SD_JSON_VARIANT_ARRAY, json_dispatch_locales, offsetof(UserRecord, additional_languages), 0 }, + { "niceLevel", _SD_JSON_VARIANT_TYPE_INVALID, json_dispatch_nice, offsetof(UserRecord, nice_level), 0 }, + { "resourceLimits", _SD_JSON_VARIANT_TYPE_INVALID, json_dispatch_rlimits, offsetof(UserRecord, rlimits), 0 }, + { "locked", SD_JSON_VARIANT_BOOLEAN, sd_json_dispatch_tristate, offsetof(UserRecord, locked), 0 }, + { "notBeforeUSec", _SD_JSON_VARIANT_TYPE_INVALID, sd_json_dispatch_uint64, offsetof(UserRecord, not_before_usec), 0 }, + { "notAfterUSec", _SD_JSON_VARIANT_TYPE_INVALID, sd_json_dispatch_uint64, offsetof(UserRecord, not_after_usec), 0 }, + { "storage", SD_JSON_VARIANT_STRING, json_dispatch_user_storage, offsetof(UserRecord, storage), 0 }, + { "diskSize", _SD_JSON_VARIANT_TYPE_INVALID, sd_json_dispatch_uint64, offsetof(UserRecord, disk_size), 0 }, + { "diskSizeRelative", _SD_JSON_VARIANT_TYPE_INVALID, sd_json_dispatch_uint64, offsetof(UserRecord, disk_size_relative), 0 }, + { "skeletonDirectory", SD_JSON_VARIANT_STRING, json_dispatch_path, offsetof(UserRecord, skeleton_directory), SD_JSON_STRICT }, + { "accessMode", SD_JSON_VARIANT_UNSIGNED, json_dispatch_access_mode, offsetof(UserRecord, access_mode), 0 }, + { "tasksMax", SD_JSON_VARIANT_UNSIGNED, json_dispatch_tasks_or_memory_max, offsetof(UserRecord, tasks_max), 0 }, + { "memoryHigh", SD_JSON_VARIANT_UNSIGNED, json_dispatch_tasks_or_memory_max, offsetof(UserRecord, memory_high), 0 }, + { "memoryMax", SD_JSON_VARIANT_UNSIGNED, json_dispatch_tasks_or_memory_max, offsetof(UserRecord, memory_max), 0 }, + { "cpuWeight", SD_JSON_VARIANT_UNSIGNED, json_dispatch_weight, offsetof(UserRecord, cpu_weight), 0 }, + { "ioWeight", SD_JSON_VARIANT_UNSIGNED, json_dispatch_weight, offsetof(UserRecord, io_weight), 0 }, + { "mountNoDevices", SD_JSON_VARIANT_BOOLEAN, sd_json_dispatch_stdbool, offsetof(UserRecord, nodev), 0 }, + { "mountNoSuid", SD_JSON_VARIANT_BOOLEAN, sd_json_dispatch_stdbool, offsetof(UserRecord, nosuid), 0 }, + { "mountNoExecute", SD_JSON_VARIANT_BOOLEAN, sd_json_dispatch_stdbool, offsetof(UserRecord, noexec), 0 }, + { "cifsDomain", SD_JSON_VARIANT_STRING, sd_json_dispatch_string, offsetof(UserRecord, cifs_domain), SD_JSON_STRICT }, + { "cifsUserName", SD_JSON_VARIANT_STRING, sd_json_dispatch_string, offsetof(UserRecord, cifs_user_name), SD_JSON_STRICT }, + { "cifsService", SD_JSON_VARIANT_STRING, sd_json_dispatch_string, offsetof(UserRecord, cifs_service), SD_JSON_STRICT }, + { "cifsExtraMountOptions", SD_JSON_VARIANT_STRING, sd_json_dispatch_string, offsetof(UserRecord, cifs_extra_mount_options), 0 }, + { "imagePath", SD_JSON_VARIANT_STRING, json_dispatch_path, offsetof(UserRecord, image_path), SD_JSON_STRICT }, + { "homeDirectory", SD_JSON_VARIANT_STRING, json_dispatch_home_directory, offsetof(UserRecord, home_directory), 0 }, + { "uid", SD_JSON_VARIANT_UNSIGNED, sd_json_dispatch_uid_gid, offsetof(UserRecord, uid), 0 }, + { "gid", SD_JSON_VARIANT_UNSIGNED, sd_json_dispatch_uid_gid, offsetof(UserRecord, gid), 0 }, + { "memberOf", SD_JSON_VARIANT_ARRAY, json_dispatch_user_group_list, offsetof(UserRecord, member_of), SD_JSON_RELAX }, + { "capabilityBoundingSet", SD_JSON_VARIANT_ARRAY, sd_json_dispatch_strv, offsetof(UserRecord, capability_bounding_set), SD_JSON_STRICT }, + { "capabilityAmbientSet", SD_JSON_VARIANT_ARRAY, sd_json_dispatch_strv, offsetof(UserRecord, capability_ambient_set), SD_JSON_STRICT }, + { "fileSystemType", SD_JSON_VARIANT_STRING, sd_json_dispatch_string, offsetof(UserRecord, file_system_type), SD_JSON_STRICT }, + { "partitionUuid", SD_JSON_VARIANT_STRING, sd_json_dispatch_id128, offsetof(UserRecord, partition_uuid), 0 }, + { "luksUuid", SD_JSON_VARIANT_STRING, sd_json_dispatch_id128, offsetof(UserRecord, luks_uuid), 0 }, + { "fileSystemUuid", SD_JSON_VARIANT_STRING, sd_json_dispatch_id128, offsetof(UserRecord, file_system_uuid), 0 }, + { "luksDiscard", _SD_JSON_VARIANT_TYPE_INVALID, sd_json_dispatch_tristate, offsetof(UserRecord, luks_discard), 0 }, + { "luksOfflineDiscard", _SD_JSON_VARIANT_TYPE_INVALID, sd_json_dispatch_tristate, offsetof(UserRecord, luks_offline_discard), 0 }, + { "luksCipher", SD_JSON_VARIANT_STRING, sd_json_dispatch_string, offsetof(UserRecord, luks_cipher), SD_JSON_STRICT }, + { "luksCipherMode", SD_JSON_VARIANT_STRING, sd_json_dispatch_string, offsetof(UserRecord, luks_cipher_mode), SD_JSON_STRICT }, + { "luksVolumeKeySize", _SD_JSON_VARIANT_TYPE_INVALID, sd_json_dispatch_uint64, offsetof(UserRecord, luks_volume_key_size), 0 }, + { "luksPbkdfHashAlgorithm", SD_JSON_VARIANT_STRING, sd_json_dispatch_string, offsetof(UserRecord, luks_pbkdf_hash_algorithm), SD_JSON_STRICT }, + { "luksPbkdfType", SD_JSON_VARIANT_STRING, sd_json_dispatch_string, offsetof(UserRecord, luks_pbkdf_type), SD_JSON_STRICT }, + { "luksPbkdfForceIterations", _SD_JSON_VARIANT_TYPE_INVALID, sd_json_dispatch_uint64, offsetof(UserRecord, luks_pbkdf_force_iterations), 0 }, + { "luksPbkdfTimeCostUSec", _SD_JSON_VARIANT_TYPE_INVALID, sd_json_dispatch_uint64, offsetof(UserRecord, luks_pbkdf_time_cost_usec), 0 }, + { "luksPbkdfMemoryCost", _SD_JSON_VARIANT_TYPE_INVALID, sd_json_dispatch_uint64, offsetof(UserRecord, luks_pbkdf_memory_cost), 0 }, + { "luksPbkdfParallelThreads", _SD_JSON_VARIANT_TYPE_INVALID, sd_json_dispatch_uint64, offsetof(UserRecord, luks_pbkdf_parallel_threads), 0 }, + { "luksSectorSize", _SD_JSON_VARIANT_TYPE_INVALID, sd_json_dispatch_uint64, offsetof(UserRecord, luks_sector_size), 0 }, + { "luksExtraMountOptions", SD_JSON_VARIANT_STRING, sd_json_dispatch_string, offsetof(UserRecord, luks_extra_mount_options), 0 }, + { "dropCaches", SD_JSON_VARIANT_BOOLEAN, sd_json_dispatch_tristate, offsetof(UserRecord, drop_caches), 0 }, + { "autoResizeMode", _SD_JSON_VARIANT_TYPE_INVALID, dispatch_auto_resize_mode, offsetof(UserRecord, auto_resize_mode), 0 }, + { "rebalanceWeight", _SD_JSON_VARIANT_TYPE_INVALID, dispatch_rebalance_weight, offsetof(UserRecord, rebalance_weight), 0 }, + { "service", SD_JSON_VARIANT_STRING, sd_json_dispatch_string, offsetof(UserRecord, service), SD_JSON_STRICT }, + { "rateLimitIntervalUSec", _SD_JSON_VARIANT_TYPE_INVALID, sd_json_dispatch_uint64, offsetof(UserRecord, ratelimit_interval_usec), 0 }, + { "rateLimitBurst", _SD_JSON_VARIANT_TYPE_INVALID, sd_json_dispatch_uint64, offsetof(UserRecord, ratelimit_burst), 0 }, + { "enforcePasswordPolicy", SD_JSON_VARIANT_BOOLEAN, sd_json_dispatch_tristate, offsetof(UserRecord, enforce_password_policy), 0 }, + { "autoLogin", SD_JSON_VARIANT_BOOLEAN, sd_json_dispatch_tristate, offsetof(UserRecord, auto_login), 0 }, + { "preferredSessionType", SD_JSON_VARIANT_STRING, sd_json_dispatch_string, offsetof(UserRecord, preferred_session_type), SD_JSON_STRICT }, + { "preferredSessionLauncher", SD_JSON_VARIANT_STRING, sd_json_dispatch_string, offsetof(UserRecord, preferred_session_launcher), SD_JSON_STRICT }, + { "stopDelayUSec", _SD_JSON_VARIANT_TYPE_INVALID, sd_json_dispatch_uint64, offsetof(UserRecord, stop_delay_usec), 0 }, + { "killProcesses", SD_JSON_VARIANT_BOOLEAN, sd_json_dispatch_tristate, offsetof(UserRecord, kill_processes), 0 }, + { "passwordChangeMinUSec", _SD_JSON_VARIANT_TYPE_INVALID, sd_json_dispatch_uint64, offsetof(UserRecord, password_change_min_usec), 0 }, + { "passwordChangeMaxUSec", _SD_JSON_VARIANT_TYPE_INVALID, sd_json_dispatch_uint64, offsetof(UserRecord, password_change_max_usec), 0 }, + { "passwordChangeWarnUSec", _SD_JSON_VARIANT_TYPE_INVALID, sd_json_dispatch_uint64, offsetof(UserRecord, password_change_warn_usec), 0 }, + { "passwordChangeInactiveUSec", _SD_JSON_VARIANT_TYPE_INVALID, sd_json_dispatch_uint64, offsetof(UserRecord, password_change_inactive_usec), 0 }, + { "passwordChangeNow", SD_JSON_VARIANT_BOOLEAN, sd_json_dispatch_tristate, offsetof(UserRecord, password_change_now), 0 }, + { "pkcs11TokenUri", SD_JSON_VARIANT_ARRAY, dispatch_pkcs11_uri_array, offsetof(UserRecord, pkcs11_token_uri), 0 }, + { "fido2HmacCredential", SD_JSON_VARIANT_ARRAY, dispatch_fido2_hmac_credential_array, 0, 0 }, + { "recoveryKeyType", SD_JSON_VARIANT_ARRAY, sd_json_dispatch_strv, offsetof(UserRecord, recovery_key_type), 0 }, + + { "secret", SD_JSON_VARIANT_OBJECT, dispatch_secret, 0, 0 }, + { "privileged", SD_JSON_VARIANT_OBJECT, dispatch_privileged, 0, 0 }, /* Ignore the perMachine, binding, status stuff here, and process it later, so that it overrides whatever is set above */ - { "perMachine", SD_JSON_VARIANT_ARRAY, NULL, 0, 0 }, - { "binding", SD_JSON_VARIANT_OBJECT, NULL, 0, 0 }, - { "status", SD_JSON_VARIANT_OBJECT, NULL, 0, 0 }, + { "perMachine", SD_JSON_VARIANT_ARRAY, NULL, 0, 0 }, + { "binding", SD_JSON_VARIANT_OBJECT, NULL, 0, 0 }, + { "status", SD_JSON_VARIANT_OBJECT, NULL, 0, 0 }, /* Ignore 'signature', we check it with explicit accessors instead */ - { "signature", SD_JSON_VARIANT_ARRAY, NULL, 0, 0 }, + { "signature", SD_JSON_VARIANT_ARRAY, NULL, 0, 0 }, {}, }; diff --git a/src/systemd/sd-json.h b/src/systemd/sd-json.h index c707322177..097f47a0ab 100644 --- a/src/systemd/sd-json.h +++ b/src/systemd/sd-json.h @@ -277,8 +277,8 @@ typedef enum sd_json_dispatch_flags_t { SD_JSON_PERMISSIVE = 1 << 0, /* Shall parsing errors be considered fatal for this field or object? */ SD_JSON_MANDATORY = 1 << 1, /* Should existence of this property be mandatory? */ SD_JSON_LOG = 1 << 2, /* Should the parser log about errors? */ - SD_JSON_SAFE = 1 << 3, /* Don't accept "unsafe" strings in json_dispatch_string() + json_dispatch_string() */ - SD_JSON_RELAX = 1 << 4, /* Use relaxed user name checking in json_dispatch_user_group_name */ + SD_JSON_STRICT = 1 << 3, /* Use slightly stricter validation than usually (means different things for different dispatchers, for example: don't accept "unsafe" strings in json_dispatch_string() + json_dispatch_string()) */ + SD_JSON_RELAX = 1 << 4, /* Use slightly more relaxed validation than usually (similar, for example: relaxed user name checking in json_dispatch_user_group_name()) */ SD_JSON_ALLOW_EXTENSIONS = 1 << 5, /* Subset of JSON_PERMISSIVE: allow additional fields, but no other permissive handling */ /* The following two may be passed into log_json() in addition to those above */ |