Project Kunai associates cloud account with a mix of various items, including board serial number, resulting in several machines being bound to the same cloud account because the momo serial number is always empty.
Note: this patch doesn't follow the systemd guidelines of not exposing directly /etc/machine-id content (but Wine already exposes /etc/machine-id as Windows machine GUID).
Signed-off-by: Eric Pouech epouech@codeweavers.com
From: Eric Pouech epouech@codeweavers.com
Project Kunai associates cloud account with a mix of various items, including board serial number, resulting in several machines being bound to the same cloud account because the momo serial number is always empty.
Note: this patch doesn't follow the systemd guidelines of not exposing directly /etc/machine-id content (but Wine already exposes /etc/machine-id as Windows machine GUID).
Signed-off-by: Eric Pouech epouech@codeweavers.com --- dlls/ntdll/unix/system.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+)
diff --git a/dlls/ntdll/unix/system.c b/dlls/ntdll/unix/system.c index 879a5893758..0b09d9f6c8d 100644 --- a/dlls/ntdll/unix/system.c +++ b/dlls/ntdll/unix/system.c @@ -1617,6 +1617,13 @@ static void get_system_uuid( GUID *uuid ) } }
+static size_t fixup_missing_information( const GUID *uuid, const char *divert, char *buffer, size_t buflen ) +{ + const UINT32 *pu = (const UINT32 *)uuid; + int ret = snprintf(buffer, buflen, "%s%08x%08x%08x%08x", divert, pu[0], pu[1], pu[2], pu[3]); + return (ret >= buflen) ? buflen - 1 : ret; +} + static NTSTATUS get_firmware_info( SYSTEM_FIRMWARE_TABLE_INFORMATION *sfti, ULONG available_len, ULONG *required_len ) { @@ -1678,6 +1685,17 @@ static NTSTATUS get_firmware_info( SYSTEM_FIRMWARE_TABLE_INFORMATION *sfti, ULON chassis_args.serial = chassis_serial; chassis_args.asset_tag_len = get_smbios_string("/sys/class/dmi/id/chassis_tag", S(chassis_asset_tag)); chassis_args.asset_tag = chassis_asset_tag; + + /* Some fields may not have been read + * (either, they are not filled by the BIOS, or some of the files above are only readable by root). + * Ensure that some fields are always filled in. + */ + if (!board_args.serial_len) + board_args.serial_len = fixup_missing_information( &system_args.uuid, "1", S(board_serial)); + if (!chassis_args.serial_len) + chassis_args.serial_len = fixup_missing_information( &system_args.uuid, "2", S(chassis_serial)); + if (!system_args.serial_len) + system_args.serial_len = fixup_missing_information( &system_args.uuid, "3", S(system_serial)); #undef S
return create_smbios_tables( sfti, available_len, required_len,
This merge request was closed by eric pouech.