From ed064c1dd109fdb9df49efce0c05a021d91ede16 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Andreas=20=C3=85kre=20Solberg?= <andreas.solberg@uninett.no>
Date: Sun, 11 Jan 2009 15:16:11 +0000
Subject: [PATCH] use cn if contains multiple parts

git-svn-id: https://simplesamlphp.googlecode.com/svn/trunk@1141 44740490-163a-0410-bde0-09ae8108e29a
---
 modules/smartnameattribute/lib/Auth/Process/SmartName.php | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/modules/smartnameattribute/lib/Auth/Process/SmartName.php b/modules/smartnameattribute/lib/Auth/Process/SmartName.php
index 86ebc6a05..906c036e8 100644
--- a/modules/smartnameattribute/lib/Auth/Process/SmartName.php
+++ b/modules/smartnameattribute/lib/Auth/Process/SmartName.php
@@ -21,6 +21,11 @@ class sspmod_smartnameattribute_Auth_Process_SmartName extends SimpleSAML_Auth_P
 		if (isset($attributes['displayName']))
 			return $attributes['displayName'][0];
 		
+		if (isset($attributes['cn'])) {
+			if (count(explode(' ', $attributes['cn'][0])) > 1)
+				return $attributes['cn'][0];
+		}
+		
 		if (isset($attributes['sn']) && isset($attributes['givenName']))
 			return $attributes['givenName'][0] . ' ' . $attributes['sn'][0];
 
-- 
GitLab