summaryrefslogtreecommitdiffstats
path: root/Bugzilla/Config
diff options
context:
space:
mode:
authorlpsolit%gmail.com <>2008-03-27 06:23:41 +0100
committerlpsolit%gmail.com <>2008-03-27 06:23:41 +0100
commit9345e477eccc933af13d7181cdf1a83c6a3deaa3 (patch)
tree7ac77ba67c655647a68f3bc2f96b6e1514d4719f /Bugzilla/Config
parentba10f28c9215b2ebeae7a6620183eec6c4721b35 (diff)
downloadbugzilla-9345e477eccc933af13d7181cdf1a83c6a3deaa3.tar.gz
bugzilla-9345e477eccc933af13d7181cdf1a83c6a3deaa3.tar.xz
Bug 358588: The sslbase's port is harcoded, but shouldn't (allow the port to be specified with the parameter) - Patch by Frédéric Buclin <LpSolit@gmail.com> r=glob a=LpSolit
Diffstat (limited to 'Bugzilla/Config')
-rw-r--r--Bugzilla/Config/Common.pm14
1 files changed, 9 insertions, 5 deletions
diff --git a/Bugzilla/Config/Common.pm b/Bugzilla/Config/Common.pm
index f5f5a3fb2..e6f0398e3 100644
--- a/Bugzilla/Config/Common.pm
+++ b/Bugzilla/Config/Common.pm
@@ -101,17 +101,21 @@ sub check_sslbase {
return "must be a legal URL, that starts with https and ends with a slash.";
}
my $host = $1;
- if ($host =~ /:\d+$/) {
- return "must not contain a port.";
+ # Fall back to port 443 if for some reason getservbyname() fails.
+ my $port = getservbyname('https', 'tcp') || 443;
+ if ($host =~ /^(.+):(\d+)$/) {
+ $host = $1;
+ $port = $2;
}
local *SOCK;
my $proto = getprotobyname('tcp');
socket(SOCK, PF_INET, SOCK_STREAM, $proto);
- my $sin = sockaddr_in(443, inet_aton($host));
+ my $iaddr = inet_aton($host) || return "The host $host cannot be resolved";
+ my $sin = sockaddr_in($port, $iaddr);
if (!connect(SOCK, $sin)) {
- return "Failed to connect to " . html_quote($host) .
- ":443, unable to enable SSL.";
+ return "Failed to connect to $host:$port; unable to enable SSL";
}
+ close(SOCK);
}
return "";
}