aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJosh <josh.t.richards@gmail.com>2025-01-30 19:31:27 -0500
committerGitHub <noreply@github.com>2025-01-30 19:31:27 -0500
commita1be491c27df49d30acc460f1778d08b8cbb0773 (patch)
tree305670f0adebe1ae0c9a2e996f7049faa9f2344c
parente07c89d0e2a4e71748ef2ab5235a170f316859b1 (diff)
downloadnextcloud-server-jtr-fix-dnspin-port-logging.tar.gz
nextcloud-server-jtr-fix-dnspin-port-logging.zip
fix: log request port instead since it's more relevant to the adminjtr-fix-dnspin-port-logging
Signed-off-by: Josh <josh.t.richards@gmail.com>
-rw-r--r--lib/private/Http/Client/DnsPinMiddleware.php9
1 files changed, 5 insertions, 4 deletions
diff --git a/lib/private/Http/Client/DnsPinMiddleware.php b/lib/private/Http/Client/DnsPinMiddleware.php
index 721c38760e6..699c5d9d9c0 100644
--- a/lib/private/Http/Client/DnsPinMiddleware.php
+++ b/lib/private/Http/Client/DnsPinMiddleware.php
@@ -110,15 +110,15 @@ class DnsPinMiddleware {
}
$hostName = (string)$request->getUri()->getHost();
- $port = $request->getUri()->getPort();
+ $requestPort = $request->getUri()->getPort();
$ports = [
'80',
'443',
];
- if ($port !== null) {
- $ports[] = (string)$port;
+ if ($requestPort !== null) {
+ $ports[] = (string)$requestPort;
}
$targetIps = $this->dnsResolve(idn_to_utf8($hostName), 0);
@@ -135,7 +135,8 @@ class DnsPinMiddleware {
foreach ($targetIps as $ip) {
if ($this->ipAddressClassifier->isLocalAddress($ip)) {
// TODO: continue with all non-local IPs?
- throw new LocalServerException('Host "' . $ip . '" (' . $hostName . ') violates local access rules');
+ // log requestPort because that's more relevant to the admin
+ throw new LocalServerException('Host "' . $ip . '" (' . $hostName . ':' . $requestPort . ') violates local access rules');
}
$curlResolves["$hostName:$port"][] = $ip;
}