From 19726dc640c78b7576551f69ff5241158e5406b1 Mon Sep 17 00:00:00 2001 From: Hakan Halil Date: Tue, 24 Oct 2023 19:23:06 +0300 Subject: [PATCH] Add functionality for checking whether the provided thumbprint is known to the soap client --- vim25/soap/client.go | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/vim25/soap/client.go b/vim25/soap/client.go index ee1452ba9..912aaf5a3 100644 --- a/vim25/soap/client.go +++ b/vim25/soap/client.go @@ -318,6 +318,20 @@ func (c *Client) Thumbprint(host string) string { return c.hosts[host] } +// KnownThumbprint checks whether the provided thumbprint is known to this client. +func (c *Client) KnownThumbprint(tp string) bool { + c.hostsMu.Lock() + defer c.hostsMu.Unlock() + + for _, v := range c.hosts { + if v == tp { + return true + } + } + + return false +} + // LoadThumbprints from file with the give name. // If name is empty or name does not exist this function will return nil. func (c *Client) LoadThumbprints(file string) error {