From 2142cfe2deb050aaf9264ed562a5cc6771d8f634 Mon Sep 17 00:00:00 2001
From: Olav Morken <olav.morken@uninett.no>
Date: Thu, 13 Sep 2012 08:12:12 +0000
Subject: [PATCH] multiauth: Fix bug that breaks compatibility with old IE
 versions.

git-svn-id: https://simplesamlphp.googlecode.com/svn/trunk@3160 44740490-163a-0410-bde0-09ae8108e29a
---
 modules/multiauth/templates/selectsource.php |  7 +++----
 modules/multiauth/www/selectsource.php       | 14 +++++++++++++-
 2 files changed, 16 insertions(+), 5 deletions(-)

diff --git a/modules/multiauth/templates/selectsource.php b/modules/multiauth/templates/selectsource.php
index 39a09c72b..1f16f31a7 100644
--- a/modules/multiauth/templates/selectsource.php
+++ b/modules/multiauth/templates/selectsource.php
@@ -19,11 +19,10 @@ foreach($this->data['sources'] as $source) {
 	} else {
 		$autofocus = '';
 	}
-	echo '<button type="submit" name="source"' . $autofocus . ' ' .
+	$name = 'src-' . base64_encode($source['source']);
+	echo '<input type="submit" name="' . htmlspecialchars($name) . '"' . $autofocus . ' ' .
 		'id="button-' . htmlspecialchars($source['source']) . '" ' .
-		'value="' . htmlspecialchars($source['source']) . '">';
-	echo htmlspecialchars($this->t($source['text']));
-	echo '</button>';
+		'value="' . htmlspecialchars($this->t($source['text'])) . '" />';
 	echo '</li>';
 }
 ?>
diff --git a/modules/multiauth/www/selectsource.php b/modules/multiauth/www/selectsource.php
index 0f19cff3e..329a1bf49 100644
--- a/modules/multiauth/www/selectsource.php
+++ b/modules/multiauth/www/selectsource.php
@@ -26,13 +26,25 @@ if (array_key_exists("SimpleSAML_Auth_Default.id", $state)) {
 	$as = NULL;
 }
 
+$source = NULL;
 if (array_key_exists('source', $_REQUEST)) {
 	$source = $_REQUEST['source'];
+} else {
+	foreach ($_REQUEST as $k => $v) {
+		$k = explode('-', $k, 2);
+		if (count($k) === 2 && $k[0] === 'src') {
+			$source = base64_decode($k[1]);
+		}
+	}
+}
+if ($source !== NULL) {
 	if ($as !== NULL) {
 		$as->setPreviousSource($source);
 	}
 	sspmod_multiauth_Auth_Source_MultiAuth::delegateAuthentication($source, $state);
-} elseif (array_key_exists('multiauth:preselect', $state)) {
+}
+
+if (array_key_exists('multiauth:preselect', $state)) {
 	$source = $state['multiauth:preselect'];
 	sspmod_multiauth_Auth_Source_MultiAuth::delegateAuthentication($source, $state);
 }
-- 
GitLab