multiple email adresses in HTTP_SHIB_MAIL + patch

wim42 - July 8, 2008 - 11:42
Project:Shibboleth authentication
Version:5.x-2.2
Component:Code
Category:bug report
Priority:normal
Assigned:dorion
Status:closed
Description

When you have multiple email adresses (HTTP_SHIB_MAIL is multi-value) they are all saved in drupal which causes problems :-)
This simple patch takes only the first e-mail address

--- shib_auth/shib_auth.module 2008-05-27 12:57:48.000000000 +0200
+++ shib_auth.module 2008-07-08 12:35:26.000000000 +0200
@@ -43,7 +43,10 @@ function shib_auth_init() {
}
}
if ($user->uid && ($_SERVER['HTTP_SHIB_IDENTITY_PROVIDER'] || $_SERVER['Shib-Identity-Provider'])) {
- $account = user_save($user,array('mail' => $_SERVER[$umailVar]));
+ // fix for multi-value emails, only use the first
+ $singleEmail = preg_replace('/;.*/','',$_SERVER[$umailVar]);
+ //$account = user_save($user,array('mail' => $_SERVER[$umailVar]));
+ $account = user_save($user,array('mail' => $singleEmail));
// Terminate if an error occured during user_save().
if (!$account) {
drupal_set_message(t("Error saving user account."), 'error');

#1

dorion - July 14, 2008 - 07:36

Why is it mail attribute multi value?

#2

dorion - July 24, 2008 - 12:31
Assigned to:Anonymous» dorion

#3

bajnokk - September 3, 2008 - 19:29
Status:active» closed

Fixed.

 
 

Drupal is a registered trademark of Dries Buytaert.