Skip to content

Commit

Permalink
GUACAMOLE-1868: Add support for new PAM Hostname field.
Browse files Browse the repository at this point in the history
  • Loading branch information
jmuehlner committed Oct 20, 2023
1 parent 3514a21 commit ea4d6ed
Showing 1 changed file with 11 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import com.keepersecurity.secretsManager.core.KeyPair;
import com.keepersecurity.secretsManager.core.KeyPairs;
import com.keepersecurity.secretsManager.core.Login;
import com.keepersecurity.secretsManager.core.PamHostnames;
import com.keepersecurity.secretsManager.core.Password;
import com.keepersecurity.secretsManager.core.SecretsManager;
import com.keepersecurity.secretsManager.core.Text;
Expand Down Expand Up @@ -393,9 +394,11 @@ public Future<String> download(final KeeperFile file) {
/**
* Returns the single hostname (or address) associated with the given
* record. If the record has no associated hostname, or multiple hostnames,
* null is returned. Hostnames are retrieved from "Hosts" fields, as well
* as "Text" and "Hidden" fields that have the label "hostname", "address",
* or "ip address" (case-insensitive, space optional).
* null is returned. Hostnames are retrieved from "Hosts" or "PamHostnames"
* fields, as well as "Text" and "Hidden" fields that have the label
* "hostname", "address", or "ip address" (case-insensitive, space optional).
* These field types are checked in the above order, and the first matching
* field is returned.
*
* @param record
* The record to retrieve the hostname from.
Expand All @@ -411,6 +414,11 @@ public String getHostname(KeeperRecord record) {
if (hostsField != null)
return getSingleStringValue(hostsField.getValue(), Host::getHostName);

// Next, try a PAM hostname
PamHostnames pamHostsField = getField(record, PamHostnames.class, null);
if (pamHostsField != null)
return getSingleStringValue(pamHostsField.getValue(), Host::getHostName);

KeeperRecordData data = record.getData();
List<KeeperRecordField> custom = data.getCustom();

Expand Down

0 comments on commit ea4d6ed

Please sign in to comment.