GUACAMOLE-641: Index records by username ONLY if not related to a hostname.

Doing otherwise would mean that a particular user would never be able
to be associated with a specific password/key by their username if they
have any explicit server-specific account.
This commit is contained in:
Michael Jumper
2022-01-21 15:23:41 -08:00
parent 87b26fe2c8
commit 1cfd2ee835

View File

@@ -238,11 +238,15 @@ public class KsmClient {
// Store based on UID ...
cachedRecordsByUid.put(record.getRecordUid(), record);
// ... and hostname/address ...
addRecordForHost(record, recordService.getHostname(record));
// ... and hostname/address
String hostname = recordService.getHostname(record);
addRecordForHost(record, hostname);
// ... and username
addRecordForLogin(record, recordService.getUsername(record));
// Store based on username ONLY if no hostname (will otherwise
// result in ambiguous entries for servers tied to identical
// accounts)
if (hostname == null)
addRecordForLogin(record, recordService.getUsername(record));
});