mirror of
https://github.com/gyurix1968/guacamole-client.git
synced 2025-09-06 13:17:41 +00:00
GUACAMOLE-641: Use "KeyPair" typed field for private key only if non-empty.
An SSH server record in KSM has an associated "KeyPair" field, but this field need not be set. If unset, the current logic ignores the rest of the record and assumes there is no private key at all. Instead, the standard fallbacks of locating an attached PEM file, locating an alternative password field, etc. should be used.
This commit is contained in:
@@ -434,8 +434,11 @@ public class KsmRecordService {
|
|||||||
|
|
||||||
// Attempt to find single matching keypair field
|
// Attempt to find single matching keypair field
|
||||||
KeyPairs keyPairsField = getField(record, KeyPairs.class, PRIVATE_KEY_LABEL_PATTERN);
|
KeyPairs keyPairsField = getField(record, KeyPairs.class, PRIVATE_KEY_LABEL_PATTERN);
|
||||||
if (keyPairsField != null)
|
if (keyPairsField != null) {
|
||||||
return CompletableFuture.completedFuture(getSingleValue(keyPairsField.getValue(), KeyPair::getPrivateKey));
|
String privateKey = getSingleValue(keyPairsField.getValue(), KeyPair::getPrivateKey);
|
||||||
|
if (privateKey != null && !privateKey.isEmpty())
|
||||||
|
return CompletableFuture.completedFuture(privateKey);
|
||||||
|
}
|
||||||
|
|
||||||
// Lacking a typed keypair field, prefer a PEM-type attachment
|
// Lacking a typed keypair field, prefer a PEM-type attachment
|
||||||
KeeperFile keyFile = getFile(record, PRIVATE_KEY_FILENAME_PATTERN);
|
KeeperFile keyFile = getFile(record, PRIVATE_KEY_FILENAME_PATTERN);
|
||||||
|
Reference in New Issue
Block a user