Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GUACAMOLE-1868: Add support for new PAM Hostname field. #921

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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);
necouchman marked this conversation as resolved.
Show resolved Hide resolved

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

Expand Down