From 4ac34cf246c0390bb6df246f2533680936933d59 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Andreas=20=C3=85kre=20Solberg?= <andreas.solberg@uninett.no>
Date: Tue, 25 Sep 2007 17:45:19 +0000
Subject: [PATCH] fix exception with fingerprint mismatch. Fix discovery of
 HTTP-HOST when Host: header contains port number.

git-svn-id: https://simplesamlphp.googlecode.com/svn/trunk@12 44740490-163a-0410-bde0-09ae8108e29a
---
 lib/SimpleSAML/XML/MetaDataStore.php        | 6 ++++++
 lib/SimpleSAML/XML/SAML20/AuthnResponse.php | 2 +-
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/lib/SimpleSAML/XML/MetaDataStore.php b/lib/SimpleSAML/XML/MetaDataStore.php
index 8d15a3ed8..5f3d3a72d 100644
--- a/lib/SimpleSAML/XML/MetaDataStore.php
+++ b/lib/SimpleSAML/XML/MetaDataStore.php
@@ -66,6 +66,12 @@ class SimpleSAML_XML_MetaDataStore {
 			$this->load($set);
 		}
 		$currenthost = $_SERVER['HTTP_HOST'];
+		
+		if(strstr($currenthost, ":")) {
+				$currenthostdecomposed = explode(":", $currenthost);
+				$currenthost = $currenthostdecomposed[0];
+		}
+		
 		if (!isset($this->hostmap[$set])) {
 			throw new Exception('No default entities defined for metadata set [' . $set . ']');
 		}
diff --git a/lib/SimpleSAML/XML/SAML20/AuthnResponse.php b/lib/SimpleSAML/XML/SAML20/AuthnResponse.php
index 1e7b18920..2a46accc3 100644
--- a/lib/SimpleSAML/XML/SAML20/AuthnResponse.php
+++ b/lib/SimpleSAML/XML/SAML20/AuthnResponse.php
@@ -141,7 +141,7 @@ class SimpleSAML_XML_SAML20_AuthnResponse extends SimpleSAML_XML_AuthnResponse {
 		}
 
 		if ($fingerprint != $issuerFingerprint) {
-			echo "Expecting fingerprint $issuerFingerprint but got fingerprint $fingerprint .st";
+			throw new Exception("Expecting fingerprint $issuerFingerprint but got fingerprint $fingerprint .");
 		}
 	
 		return ($fingerprint == $issuerFingerprint);
-- 
GitLab