From 01d85e26fb48909e508880ae9dca0bcb49c09dd3 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Andreas=20=C3=85kre=20Solberg?= <andreas.solberg@uninett.no>
Date: Mon, 2 Feb 2009 14:02:57 +0000
Subject: [PATCH] Use port 636 if ldaps as default

git-svn-id: https://simplesamlphp.googlecode.com/svn/trunk@1226 44740490-163a-0410-bde0-09ae8108e29a
---
 modules/ldapstatus/www/index.php | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/modules/ldapstatus/www/index.php b/modules/ldapstatus/www/index.php
index c9e5aa546..318a9d7c6 100644
--- a/modules/ldapstatus/www/index.php
+++ b/modules/ldapstatus/www/index.php
@@ -31,7 +31,7 @@ function phpping($host, $port) {
 	$socket = @fsockopen($host, $port, $errno, $errstr, $timeout);
 	@fclose($socket);
 	if ($errno) {
-		return array(FALSE, $errno . ':' . $errstr);
+		return array(FALSE, $errno . ':' . $errstr . ' [' . $host . ':' . $port . ']');
 	} else {		
 		return array(TRUE,NULL);
 	}
@@ -68,6 +68,7 @@ foreach ($orgs AS $orgkey => $orgconfig) {
 	$urldef = explode(' ', $orgconfig['hostname']);
 	$url = parse_url($urldef[0]);
 	$port = 389;
+	if (!empty($url['scheme']) && $url['scheme'] === 'ldaps') $port = 636;
 	if (!empty($url['port'])) $port = $url['port'];
 	
 	SimpleSAML_Logger::debug('ldapstatus Url parse [' . $orgconfig['hostname'] . '] => [' . $url['host'] . ']:[' . $port . ']' );
-- 
GitLab