From a0901c4b7f2db488cb4fb3be2dd921a0308f4659 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 28 Apr 2024 14:36:40 +0200 Subject: Adding upstream version 1.0.2. Signed-off-by: Daniel Baumann --- library/Icingadb/ProvidedHook/X509/Sni.php | 57 ++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 library/Icingadb/ProvidedHook/X509/Sni.php (limited to 'library/Icingadb/ProvidedHook/X509/Sni.php') diff --git a/library/Icingadb/ProvidedHook/X509/Sni.php b/library/Icingadb/ProvidedHook/X509/Sni.php new file mode 100644 index 0000000..d6e1415 --- /dev/null +++ b/library/Icingadb/ProvidedHook/X509/Sni.php @@ -0,0 +1,57 @@ +getDb()); + + $queryHost->getSelectBase(); + + $hostStatusCols = [ + 'host_name' => 'name', + 'host_address' => 'address', + 'host_address6' => 'address6' + ]; + + $queryHost = $queryHost->columns($hostStatusCols); + + $this->applyRestrictions($queryHost); + + if ($filter !== null) { + $queryString = $filter->toQueryString(); + $filterCondition = QueryString::parse($queryString); + $queryHost->filter($filterCondition); + } + + $hosts = $this->getdb()->select($queryHost->assembleSelect()); + + foreach ($hosts as $host) { + if (! empty($host->host_address)) { + yield $host->host_address => $host->host_name; + } + + if (! empty($host->host_address6)) { + yield $host->host_address6 => $host->host_name; + } + } + } +} -- cgit v1.2.3