diff --git a/docs/USER_RECORD.md b/docs/USER_RECORD.md index 4ec6f4fa73..60c78ce1c5 100644 --- a/docs/USER_RECORD.md +++ b/docs/USER_RECORD.md @@ -872,6 +872,18 @@ sub-object of the top-level user record object is keyed by the machine ID, which points to the object with the fields defined here. The following fields are defined: +`aliases` → An array of strings, each being a valid UNIX user name. This is +similar to the top-level field of the same name. The purpose of this field is +to allow user record providers to dynamically insert additional alias names +into the user record, depending on the precise query. This is useful to +implement case-insensitive user names (or support for similar non-normalized +user record naming), as it allows the provider to insert the precise +casing/spelling of the user name used for the look-up in the record data, +without this being part of the persisted record. Note that clients doing a +look-up typically re-validate user records against the lookup keys they +provided, hence it's essential that any dynamic alias name appears in the +user record, without this being part of the persistent part of the record. + `diskUsage` → An unsigned 64-bit integer. The currently used disk space of the home directory in bytes. This value might be determined in different ways, depending on the selected storage mechanism. diff --git a/src/shared/user-record.c b/src/shared/user-record.c index 09e96f0c9a..dfe4379e9f 100644 --- a/src/shared/user-record.c +++ b/src/shared/user-record.c @@ -1403,6 +1403,7 @@ static int dispatch_status(const char *name, sd_json_variant *variant, sd_json_d { "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 }, { "defaultArea", SD_JSON_VARIANT_STRING, json_dispatch_filename, offsetof(UserRecord, default_area), 0 }, + { "aliases", SD_JSON_VARIANT_ARRAY, json_dispatch_user_group_list, offsetof(UserRecord, aliases), SD_JSON_RELAX }, {}, };