From 447d5052729faf457e68e2e2597fcc5bb6579a99 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Andreas=20=C3=85kre=20Solberg?= <andreas.solberg@uninett.no>
Date: Fri, 9 Jan 2009 13:02:46 +0000
Subject: [PATCH] LDAP library return jpeg photos base64encoded

git-svn-id: https://simplesamlphp.googlecode.com/svn/trunk@1117 44740490-163a-0410-bde0-09ae8108e29a
---
 lib/SimpleSAML/Auth/LDAP.php | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/lib/SimpleSAML/Auth/LDAP.php b/lib/SimpleSAML/Auth/LDAP.php
index 328bd6e9c..945ec4ff8 100644
--- a/lib/SimpleSAML/Auth/LDAP.php
+++ b/lib/SimpleSAML/Auth/LDAP.php
@@ -155,9 +155,11 @@ class SimpleSAML_Auth_LDAP {
 		for ($i = 0; $i < $ldapAttributes['count']; $i++) {
 			$attributeName = $ldapAttributes[$i];
 
+			$base64encode = FALSE;
+			
 			/* Skip the 'jpegphoto' attribute. */
 			if (strtolower($attributeName) === 'jpegphoto') {
-				continue;
+				$base64encode = TRUE;
 			}
 
 			$attribute = $ldapAttributes[$attributeName];
@@ -165,7 +167,7 @@ class SimpleSAML_Auth_LDAP {
 
 			$values = array();
 			for ($j = 0; $j < $valueCount; $j++) {
-				$values[] = $attribute[$j];
+				$values[] = ($base64encode ? base64_encode($attribute[$j]) : $attribute[$j] );
 			}
 
 			$attributes[$attributeName] = $values;
-- 
GitLab