multiple email adresses in HTTP_SHIB_MAIL + patch
| Project: | Shibboleth authentication |
| Version: | 5.x-2.2 |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | dorion |
| Status: | closed |
Jump to:
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
Why is it mail attribute multi value?
#2
#3
Fixed.