commit b42754b9329d8ca19f01e42fb44c8affb4186e0c
Author: Assos Assos <assos+forge@centrale-marseille.fr>
Date:   Thu Aug 31 00:06:39 2017 +0200

    Weekly update of contrib modules

diff --git a/drupal7/sites/all/modules/ldap/ldap_authentication/ldap_authentication.inc b/drupal7/sites/all/modules/ldap/ldap_authentication/ldap_authentication.inc
index bc6494ef..ac2e9d1e 100644
--- a/drupal7/sites/all/modules/ldap/ldap_authentication/ldap_authentication.inc
+++ b/drupal7/sites/all/modules/ldap/ldap_authentication/ldap_authentication.inc
@@ -49,7 +49,6 @@ function _ldap_authentication_login_form_alter(&$form, &$form_state, $form_id) {
 
     $form['links']['#markup'] = theme('ldap_authentication_user_login_block_links', $vars);
   }
-  ldap_servers_disable_http_check($form);
 
   // Add help information for entering in username/password
   $auth_conf = ldap_authentication_get_valid_conf();
@@ -391,7 +390,7 @@ function _ldap_authentication_user_login_authenticate_validate(&$form_state, $re
   if (!$drupal_account_exists) {
 
     // VI.C.1 Do not provision Drupal account if another account has same email.
-    if ($account_with_same_email = user_load_by_mail($ldap_user['mail'])) {
+    if (($auth_conf->ldapUser->acctCreation == LDAP_USER_ACCOUNTS_WITH_SAME_EMAIL_DISABLED) && ($account_with_same_email = user_load_by_mail($ldap_user['mail']))) {
       $error = TRUE;
       /**
        * username does not exist but email does.  Since user_external_login_register does not deal with
diff --git a/drupal7/sites/all/modules/ldap/ldap_authentication/ldap_authentication.info b/drupal7/sites/all/modules/ldap/ldap_authentication/ldap_authentication.info
index daada06e..97c0617c 100644
--- a/drupal7/sites/all/modules/ldap/ldap_authentication/ldap_authentication.info
+++ b/drupal7/sites/all/modules/ldap/ldap_authentication/ldap_authentication.info
@@ -14,9 +14,11 @@ files[] = ldap_authentication.theme.inc
 files[] = ldap_authentication.admin.inc
 files[] = tests/ldap_authentication.test
 
-; Information added by Drupal.org packaging script on 2017-05-30
-version = "7.x-2.2"
+test_dependencies[] = ldap_sso:ldap_sso
+
+; Information added by Drupal.org packaging script on 2017-08-27
+version = "7.x-2.3"
 core = "7.x"
 project = "ldap"
-datestamp = "1496167150"
+datestamp = "1503841448"
 
diff --git a/drupal7/sites/all/modules/ldap/ldap_authorization/ldap_authorization.info b/drupal7/sites/all/modules/ldap/ldap_authorization/ldap_authorization.info
index 2292d5fd..b808c9ec 100644
--- a/drupal7/sites/all/modules/ldap/ldap_authorization/ldap_authorization.info
+++ b/drupal7/sites/all/modules/ldap/ldap_authorization/ldap_authorization.info
@@ -17,9 +17,11 @@ files[] = tests/BasicTests.test
 files[] = tests/Og2Tests.test
 configure = admin/config/people/ldap/authorization
 
-; Information added by Drupal.org packaging script on 2017-05-30
-version = "7.x-2.2"
+test_dependencies[] = ldap_sso:ldap_sso
+
+; Information added by Drupal.org packaging script on 2017-08-27
+version = "7.x-2.3"
 core = "7.x"
 project = "ldap"
-datestamp = "1496167150"
+datestamp = "1503841448"
 
diff --git a/drupal7/sites/all/modules/ldap/ldap_authorization/ldap_authorization_drupal_role/ldap_authorization_drupal_role.info b/drupal7/sites/all/modules/ldap/ldap_authorization/ldap_authorization_drupal_role/ldap_authorization_drupal_role.info
index 53e8ac10..35d67c28 100644
--- a/drupal7/sites/all/modules/ldap/ldap_authorization/ldap_authorization_drupal_role/ldap_authorization_drupal_role.info
+++ b/drupal7/sites/all/modules/ldap/ldap_authorization/ldap_authorization_drupal_role/ldap_authorization_drupal_role.info
@@ -9,9 +9,9 @@ files[] = LdapAuthorizationConsumerRole.class.php
 files[] = ldap_authorization_drupal_role.module
 files[] = ldap_authorization_drupal_role.inc
 
-; Information added by Drupal.org packaging script on 2017-05-30
-version = "7.x-2.2"
+; Information added by Drupal.org packaging script on 2017-08-27
+version = "7.x-2.3"
 core = "7.x"
 project = "ldap"
-datestamp = "1496167150"
+datestamp = "1503841448"
 
diff --git a/drupal7/sites/all/modules/ldap/ldap_authorization/ldap_authorization_og/ldap_authorization_og.info b/drupal7/sites/all/modules/ldap/ldap_authorization/ldap_authorization_og/ldap_authorization_og.info
index ff5b08aa..54da349d 100644
--- a/drupal7/sites/all/modules/ldap/ldap_authorization/ldap_authorization_og/ldap_authorization_og.info
+++ b/drupal7/sites/all/modules/ldap/ldap_authorization/ldap_authorization_og/ldap_authorization_og.info
@@ -13,9 +13,9 @@ files[] = ldap_authorization_og.inc
 
 core = "7.x"
 
-; Information added by Drupal.org packaging script on 2017-05-30
-version = "7.x-2.2"
+; Information added by Drupal.org packaging script on 2017-08-27
+version = "7.x-2.3"
 core = "7.x"
 project = "ldap"
-datestamp = "1496167150"
+datestamp = "1503841448"
 
diff --git a/drupal7/sites/all/modules/ldap/ldap_feeds/ldap_feeds.info b/drupal7/sites/all/modules/ldap/ldap_feeds/ldap_feeds.info
index af9c671c..ba61f95b 100644
--- a/drupal7/sites/all/modules/ldap/ldap_feeds/ldap_feeds.info
+++ b/drupal7/sites/all/modules/ldap/ldap_feeds/ldap_feeds.info
@@ -12,9 +12,9 @@ configure = admin/structure/feeds
 core = 7.x
 php = 5.2
 
-; Information added by Drupal.org packaging script on 2017-05-30
-version = "7.x-2.2"
+; Information added by Drupal.org packaging script on 2017-08-27
+version = "7.x-2.3"
 core = "7.x"
 project = "ldap"
-datestamp = "1496167150"
+datestamp = "1503841448"
 
diff --git a/drupal7/sites/all/modules/ldap/ldap_help/ldap_help.info b/drupal7/sites/all/modules/ldap/ldap_help/ldap_help.info
index 9315c114..dada297b 100644
--- a/drupal7/sites/all/modules/ldap/ldap_help/ldap_help.info
+++ b/drupal7/sites/all/modules/ldap/ldap_help/ldap_help.info
@@ -5,9 +5,9 @@ core = 7.x
 
 dependencies[] = ldap_servers
 dependencies[] = ldap_test
-; Information added by Drupal.org packaging script on 2017-05-30
-version = "7.x-2.2"
+; Information added by Drupal.org packaging script on 2017-08-27
+version = "7.x-2.3"
 core = "7.x"
 project = "ldap"
-datestamp = "1496167150"
+datestamp = "1503841448"
 
diff --git a/drupal7/sites/all/modules/ldap/ldap_query/ldap_query.info b/drupal7/sites/all/modules/ldap/ldap_query/ldap_query.info
index c7cf0ba3..8c4ddb59 100644
--- a/drupal7/sites/all/modules/ldap/ldap_query/ldap_query.info
+++ b/drupal7/sites/all/modules/ldap/ldap_query/ldap_query.info
@@ -17,9 +17,9 @@ files[] = tests/ldap_query.test
 
 configure = admin/config/people/ldap/query
 
-; Information added by Drupal.org packaging script on 2017-05-30
-version = "7.x-2.2"
+; Information added by Drupal.org packaging script on 2017-08-27
+version = "7.x-2.3"
 core = "7.x"
 project = "ldap"
-datestamp = "1496167150"
+datestamp = "1503841448"
 
diff --git a/drupal7/sites/all/modules/ldap/ldap_servers/ldap_servers.info b/drupal7/sites/all/modules/ldap/ldap_servers/ldap_servers.info
index c39db415..33428463 100644
--- a/drupal7/sites/all/modules/ldap/ldap_servers/ldap_servers.info
+++ b/drupal7/sites/all/modules/ldap/ldap_servers/ldap_servers.info
@@ -17,9 +17,9 @@ files[] = ldap_servers.theme.inc
 files[] = tests/ldap_servers.test
 configure = admin/config/people/ldap/servers
 
-; Information added by Drupal.org packaging script on 2017-05-30
-version = "7.x-2.2"
+; Information added by Drupal.org packaging script on 2017-08-27
+version = "7.x-2.3"
 core = "7.x"
 project = "ldap"
-datestamp = "1496167150"
+datestamp = "1503841448"
 
diff --git a/drupal7/sites/all/modules/ldap/ldap_servers/ldap_servers.install b/drupal7/sites/all/modules/ldap/ldap_servers/ldap_servers.install
index 8d5c1f17..a6a9423f 100644
--- a/drupal7/sites/all/modules/ldap/ldap_servers/ldap_servers.install
+++ b/drupal7/sites/all/modules/ldap/ldap_servers/ldap_servers.install
@@ -878,6 +878,15 @@ function ldap_servers_update_7207() {
     }
 }
 
+/**
+ * Removes HTTPS checking.
+ */
+function ldap_servers_update_7208() {
+  variable_del('ldap_servers_require_ssl_for_credentials');
+  return t('HTTPS validation was removed, if you need mixed mode consider another module such as securelogin for this. Mixed mode is strongly discouraged.');
+
+}
+
 function ldap_servers_install_update_schema($schema, &$change_log) {
   foreach ($schema as $table_name => $table_schema) {
     foreach ($table_schema['fields'] as $field_name => $field_schema) {
@@ -887,4 +896,4 @@ function ldap_servers_install_update_schema($schema, &$change_log) {
       }
     }
   }
-}
+}
\ No newline at end of file
diff --git a/drupal7/sites/all/modules/ldap/ldap_servers/ldap_servers.module b/drupal7/sites/all/modules/ldap/ldap_servers/ldap_servers.module
index 531b9ea9..6317762a 100644
--- a/drupal7/sites/all/modules/ldap/ldap_servers/ldap_servers.module
+++ b/drupal7/sites/all/modules/ldap/ldap_servers/ldap_servers.module
@@ -256,11 +256,6 @@ function ldap_servers_theme() {
       'variables' => array('ldap_server' => NULL, 'actions' => FALSE, 'type' => 'detail'),
       'render element' => 'element',
       'file' => 'ldap_servers.theme.inc'
-    ),
-     'ldap_servers_https_required' => array(
-      'variables' => array('site_name' => NULL, 'site_mail' => FALSE, 'site_contact_link' => FALSE),
-      'render element' => 'element',
-      'file' => 'ldap_servers.theme.inc'
     ),
     'ldap_server_token_table' => array(
       'variables' => array('tokens' => array()),
@@ -802,26 +797,6 @@ function ldap_servers_convert_attribute($value, $conversion = NULL) {
   return $value;
 }
 
-
-/**
- * disable a logon form if ldap preferences exclude http logon forms
- *
- * @param drupal logon form array $form
- */
-function ldap_servers_disable_http_check(&$form) {
-
-  if (variable_get('ldap_servers_require_ssl_for_credentials', 0) == 1 && !drupal_is_https()) {
-
-    $tokens = array(
-      'site_name' => variable_get('site_name', 'this site'),
-      'site_mail' =>  variable_get('site_mail', ''),
-      );
-
-    drupal_set_message(t(theme('ldap_servers_https_required', $tokens)), 'error');
-    $form['#disabled'] = TRUE;
-  }
-}
-
 function ldap_servers_ldap_extension_summary($op = 'data') {
   ldap_servers_module_load_include('inc', 'ldap_servers', 'ldap_servers.status');
   return _ldap_servers_ldap_extension_summary($op);
@@ -864,8 +839,6 @@ function ldap_servers_help($path, $arg) {
    case 'admin/help#ldap_servers':
       $servers_help .= '<h3>' . t('Configuration - Settings') . '</h3>';
       $servers_help .= '<dl>';
-      $servers_help .= '<dt>' . t('REQUIRE HTTPS ON CREDENTIAL PAGES') . '</dt>';
-      $servers_help .= '<dd>' . t('If checked, modules using LDAP will not allow credentials to be entered on or submitted to HTTP pages, only HTTPS. This option should be used with an approach to get all logon forms to be HTTPS.') . '</dd>';
       $servers_help .= '<dt>' . t('ENCRYPTION') . '</dt>';
       $servers_help .= '<dd>' . t('With encryption enabled, passwords will be stored in encrypted form. This is two way encryption because the actual password needs to used to bind to LDAP. So it offers minimal defense if someone gets in the filespace. It mainly helps avoid the accidental discovery of a clear text password.') . '</dd>';
       $servers_help .= '<dt>' . t('LOG DETAILED LDAP ACTIONS') . '</dt>';
diff --git a/drupal7/sites/all/modules/ldap/ldap_servers/ldap_servers.settings.inc b/drupal7/sites/all/modules/ldap/ldap_servers/ldap_servers.settings.inc
index 8aaf262c..2bf9d4a6 100644
--- a/drupal7/sites/all/modules/ldap/ldap_servers/ldap_servers.settings.inc
+++ b/drupal7/sites/all/modules/ldap/ldap_servers/ldap_servers.settings.inc
@@ -13,21 +13,8 @@ function ldap_servers_settings() {
     drupal_set_message(t('PHP LDAP Extension is not loaded.'), "warning");
   }
 
-  $https_approaches = array();
-  $https_approaches[] = t('Use secure pages or secure login module to redirect to SSL (https)');
-  $https_approaches[] = t('Run entire site with SSL (https)');
-  $https_approaches[] = t('Remove logon block and redirect all /user page to https via webserver redirect');
-
   $form['#title'] = "Configure LDAP Preferences";
-  $form['ssl'] = array('#type' => 'fieldset', '#title' => t('Require HTTPS on Credential Pages'));
-  $form['ssl']['ldap_servers_require_ssl_for_credentials'] = array(
-    '#type' => 'checkbox',
-    '#title' => t('If checked, modules using LDAP will not allow credentials to
-      be entered on or submitted to HTTP pages, only HTTPS. This option should be used with an
-      approach to get all logon forms to be https, such as:') .
-      theme('item_list', array('items' => $https_approaches)),
-    '#default_value' => variable_get('ldap_servers_require_ssl_for_credentials', 0),
-  );
+
 
   $options = ldap_servers_encrypt_types('encrypt');
 
diff --git a/drupal7/sites/all/modules/ldap/ldap_servers/ldap_servers.theme.inc b/drupal7/sites/all/modules/ldap/ldap_servers/ldap_servers.theme.inc
index eea40490..d665c7b0 100644
--- a/drupal7/sites/all/modules/ldap/ldap_servers/ldap_servers.theme.inc
+++ b/drupal7/sites/all/modules/ldap/ldap_servers/ldap_servers.theme.inc
@@ -93,19 +93,6 @@ function theme_ldap_servers_server($variables) {
   return $output;
 }
 
-function theme_ldap_servers_https_required($vars) {
-
-  if (!isset($vars['site_contact_link']) || empty($vars['site_contact_link'])) {
-    $vars['site_contact_link'] = 'site admin';
-  }
-  return t("You are accessing site_name using an unencrypted connection. For your security,
-     site_name only supports account logins using a secure protocol such as HTTPS. You can switch
-     to HTTPS by trying to view this page again after changing the URL in your browser's
-     location bar to begin with \"https\" instead of \"http\". Please contact
-      site_contact_link for help if this error continues.", $vars);
-
-}
-
 function theme_ldap_server_token_table($variables) {
   $header = array(
     array('data' => 'Token', 'sort' => 'asc'),
diff --git a/drupal7/sites/all/modules/ldap/ldap_sso/MSTMG.notes.txt b/drupal7/sites/all/modules/ldap/ldap_sso/MSTMG.notes.txt
deleted file mode 100644
index e512b824..00000000
--- a/drupal7/sites/all/modules/ldap/ldap_sso/MSTMG.notes.txt
+++ /dev/null
@@ -1,23 +0,0 @@
-
-
-Microsoft Forefront Threat Management Gateway
-http://technet.microsoft.com/en-us/library/cc441438.aspx
-
-Overview of authentication in Forefront TMG
-http://technet.microsoft.com/en-us/library/cc441695.aspx
-
-
-About authentication in Web publishing
-http://technet.microsoft.com/en-us/library/cc441671.aspx
--- third component of TMG authentication for web publishing is: "Delegation of authentication ot web servers behind FTMG".  This is where LDAP modules need to be integrated.  This aspect is configured in the "publishing rule" such that a single listener can have multiple types of delegation.
-
-1) The Web server must be configured to use the authentication scheme that matches the delegation method used by Forefront TMG. Delegation of client credentials is configured on the publishing rule. In the Publishing Rule wizard, configure this on the Authentication Delegation page. In the publishing rule properties, the authentication settings are on the Authentication Delegation tab.
-
-2) Delegation options are (sorted in order of what I think are desireable)
-- NTLM/Kerberos (Negotiate).  Tries for Kerberos ticket and goes for credentials via NTLM.
-- NTLM. "In NTLM delegation, Forefront TMG delegates the credentials by using the NTLM challenge/response authentication protocol. If authentication fails, Forefront TMG replaces the delegation with the authentication type used by the Web listener. If the server requires a different type of credentials, Forefront TMG triggers an alert."
-- No delegation, and client cannot authenticate directly.  Not useful.  Just for avoiding false passing of credentials when not needed.
-- No delegation, but client may authenticate directly.  User credentials passed to drupal.  Not desireable.
-- Basic.  cleartext passing of credentials to drupal.  Not desireable.
-- SecurID
-- Kerberos constrained delegation
diff --git a/drupal7/sites/all/modules/ldap/ldap_sso/README.txt b/drupal7/sites/all/modules/ldap/ldap_sso/README.txt
deleted file mode 100644
index 228ec100..00000000
--- a/drupal7/sites/all/modules/ldap/ldap_sso/README.txt
+++ /dev/null
@@ -1,114 +0,0 @@
-
-=======================================
-LDAP Single Sign-On
-=======================================
-
-
-To use the single sign-on feature, your web server must provide an authentication
-mechanism for LDAP. The only authentication mechanism used in development
-was mod_auth_sspi for Apache/Windows, but so long as the web server's LDAP
-authentication mechanism is configured to provide the $_SERVER variable
-$_SERVER['REMOTE_USER'] or $_SERVER['REDIRECT_REMOTE_USER'] corresponding
-directly to a user's LDAP user name, this should work all the same. This
-will require some sort of LDAP authentication mechanism; mod_auth_sspi is
-available here: http://mod-auth-sspi.sourceforge.net/, while mod_ntlm is
-available here: http://modntlm.sourceforge.net/, and mod_auth_ntlm_winbind is
-available here: http://samba.org/ftp/unpacked/lorikeet/mod_auth_ntlm_winbind/.
-If a Linux distribution is being used, Apache authentication modules are likely
-available within the distro's package manager.
-
-Unless an administrator wishes to require that all visitors be authenticated,
-NTLM and/or basic authentication should be set up only on the path
-user/login/sso, which will authentify the visitor but not deny access to view
-the site if the visitor is not authenticated. An administrator may wish to
-require LDAP authentication to view any portion of the site; this can be
-achieved by changing the location directive below to "/". An administrator may
-also wish to automatically log in visitors to Drupal; this can be achieved by
-checking "Turn on automated single sign-on" in the modules' configuration page.
-
-An example of an Apache configuration for a named virtualhost configuration
-using mod_auth_sspi on Windows is as follows:
-
-
-httpd.conf:
-_______________________________________________________________________________
-_______________________________________________________________________________
-
-
-
-
-# Virtual hosts
-Include conf/extra/httpd-vhosts.conf
-
-# Pass NTLM authentication to Apache
-LoadModule sspi_auth_module modules/mod_auth_sspi.so
-
-<IfModule !mod_auth_sspi.c>
-  LoadModule sspi_auth_module modules/mod_auth_sspi.so
-</IfModule>
-
-
-
-_______________________________________________________________________________
-_______________________________________________________________________________
-
-
-
-
-httpd-vhosts.conf:
-_______________________________________________________________________________
-_______________________________________________________________________________
-
-
-
-
-NameVirtualHost example.com
-
-<VirtualHost example.com>
-  DocumentRoot "D:/www/example.com/htdocs"
-  ServerName example.com
-
-  <directory "D:/www/example.com/htdocs">
-    Options Indexes FollowSymLinks MultiViews
-    AllowOverride All
-    Order Allow,Deny
-    Allow from all
-  </directory>
-
-  <Location /user/login/sso>
-    AuthType SSPI
-    AuthName "Example.com - Login using your LDAP user name and password"
-    SSPIAuth On
-    SSPIAuthoritative On
-    ### The domain used to authenticate with LDAP; this should match the domain
-    ### configured in the LDAP integration configuration within Drupal
-    SSPIDomain ad.example.com
-    SSPIOmitDomain On
-    SSPIOfferBasic On
-    Require valid-user
-    #SSPIBasicPreferred On
-    #SSPIofferSSPI off
-  </Location>
-</VirtualHost>
-
-_______________________________________________________________________________
-_______________________________________________________________________________
-
-
-After enabling and configuring an LDAP authentication module within Apache,
-visit user/login/sso in the Drupal installation on example.com. With or without
-the ldap sso feature enabled, the browser should prompt for a user name and
-password if using Internet Explorer 8 or a non-Microsoft browser. Internet
-Explorer 7 by default will pass NTLM authentication credentials to local
-websites, and IE8 and Firefox can be configured to do this as well.
-
-If prompted for credentials on that path, enter a valid LDAP user name,
-omitting the domain if "SSPIOmitDomain On" is configured, as well as a password.
-If the credentials are correct, or if NTLM credentials are passed automatically
-by the browser and successfully authenticated, a Drupal 404 "Page not found"
-message will be displayed if the module is not enabled; an "access is denied"
-message will be displayed if the module is enabled and the browser is already
-logged in; and if the ldap_sso module is fully configured and there is no
-existing session, the browser will display the message "You have been
-successfully authenticated" after redirecting to the sites' home page if you
-have checked "Notify user of successful authentication".
diff --git a/drupal7/sites/all/modules/ldap/ldap_sso/ldap_sso.info b/drupal7/sites/all/modules/ldap/ldap_sso/ldap_sso.info
deleted file mode 100644
index 6a76f2a1..00000000
--- a/drupal7/sites/all/modules/ldap/ldap_sso/ldap_sso.info
+++ /dev/null
@@ -1,14 +0,0 @@
-name = LDAP SSO
-description = Implements Single Sign On (SSO) LDAP Authentication
-package = Lightweight Directory Access Protocol
-dependencies[] = ldap_servers
-dependencies[] = ldap_authentication
-core = 7.x
-configure = admin/config/people/ldap/authentication
-
-; Information added by Drupal.org packaging script on 2017-05-30
-version = "7.x-2.2"
-core = "7.x"
-project = "ldap"
-datestamp = "1496167150"
-
diff --git a/drupal7/sites/all/modules/ldap/ldap_sso/ldap_sso.module b/drupal7/sites/all/modules/ldap/ldap_sso/ldap_sso.module
deleted file mode 100644
index f75e4228..00000000
--- a/drupal7/sites/all/modules/ldap/ldap_sso/ldap_sso.module
+++ /dev/null
@@ -1,431 +0,0 @@
-<?php
-
-/**
- * @file
- * This module injects itself into Drupal's Authentication stack.
- */
-
-/**
- * Implements hook_menu().
- */
-function ldap_sso_menu() {
-  $items = array();
-
-  $items['user/login/sso'] = array(
-    'title' => 'Log In',
-    'page callback' => 'ldap_sso_user_login_sso',
-    'access callback' => '_ldap_authentication_user_access',
-    'type' => MENU_NORMAL_ITEM,
-  );
-
-  return $items;
-}
-
-
-/**
- * Implements hook_user_logout().
- *
- * The user just logged out.
- */
-function ldap_sso_user_logout($account) {
-  $auth_conf = ldap_authentication_get_valid_conf();
-  if ($auth_conf->seamlessLogin == 1) {
-    $cookie_string = 'do not auto login';
-    $cookie_timeout = (int) $auth_conf->cookieExpire;
-    setcookie('seamless_login', $cookie_string, (($cookie_timeout == -1) ? 0 : $cookie_timeout + time()), base_path(), "");
-    ldap_servers_set_globals('_SESSION', 'seamless_login', $cookie_string);
-  }
-}
-
-/**
- * Implements hook_boot().
- *
- * Perform setup tasks. This entry point is used because hook_user_load no
- * longer runs on anonymous users, and hook_boot is guaranteed to run,
- * regardless of cache.
- */
-function ldap_sso_boot() {
-
-  if (!drupal_is_cli() && ($GLOBALS['user']->uid == 0)) {
-
-    if (ldap_sso_path_excluded_from_sso()) {
-      return;
-    }
-    module_load_include('module', 'ldap_servers');
-
-    if (!(isset($_COOKIE['seamless_login'])) || $_COOKIE['seamless_login'] == 'auto login') {
-      if ((arg(0) == 'user' && !(is_numeric(arg(1)))) || arg(0) == 'logout') {
-        return;
-      }
-      else {
-        if (isset($_COOKIE['seamless_login_attempted'])) {
-          $login_attempted = $_COOKIE['seamless_login_attempted'];
-        }
-        else {
-          $login_attempted = FALSE;
-        }
-
-        require_once DRUPAL_ROOT . '/includes/common.inc';
-        require_once DRUPAL_ROOT . '/' . variable_get('path_inc', 'includes/path.inc');
-        $ldap_authentication_conf = variable_get('ldap_authentication_conf', array());
-
-        if (isset($ldap_authentication_conf['seamlessLogin']) && $ldap_authentication_conf['seamlessLogin'] == 1 && ($login_attempted != 'true')) {
-          if ($ldap_authentication_conf['cookieExpire'] == 0) {
-            setcookie("seamless_login_attempted", 'true', 0, base_path(), "");
-          }
-          else {
-            setcookie('seamless_login_attempted', 'true', time() + (int) $ldap_authentication_conf['cookieExpire'], base_path(), "");
-          }
-          ldap_servers_set_globals('_SESSION', 'seamless_login_attempted', $login_attempted);
-
-          drupal_bootstrap(DRUPAL_BOOTSTRAP_LANGUAGE);
-          // Seems redundant, but need to check this again after additional
-          // bootstrap.
-          if (ldap_sso_path_excluded_from_sso()) {
-            return;
-          }
-          // Add the query key to the drupal_goto() options array only if there
-          // is a destination set. This prevents infinite redirect loops.
-          $options = array();
-          $destination = drupal_get_destination();
-          if (!empty($destination['destination'])) {
-            $options['query'] = $destination;
-          }
-          drupal_goto('user/login/sso', $options);
-        }
-        else {
-          return;
-        }
-      }
-    }
-  }
-}
-
-/**
- * Default excluded paths.
- */
-function ldap_sso_default_excluded_paths() {
-  return array(
-    'admin/config/search/clean-urls/check',
-  );
-}
-
-/**
- * Paths excluded from SSO.
- */
-function ldap_sso_path_excluded_from_sso($path = FALSE) {
-  module_load_include('module', 'ldap_servers');
-  $result = FALSE;
-  if ($path) {
-    // Don't derive.
-  }
-  elseif (ldap_servers_get_globals('_SERVER', 'PHP_SELF') == '/index.php') {
-    $path = $_GET['q'];
-  }
-  else {
-    // Cron.php, etc.
-    $path = ltrim(ldap_servers_get_globals('_SERVER', 'PHP_SELF'), '/');
-  }
-
-  if (in_array($path, ldap_sso_default_excluded_paths())) {
-    return TRUE;
-  }
-
-  $ldap_authentication_conf = variable_get('ldap_authentication_conf', array());
-
-  if (isset($ldap_authentication_conf['ssoExcludedHosts']) && is_array($ldap_authentication_conf['ssoExcludedHosts'])) {
-    $host = ldap_servers_get_globals('_SERVER', 'SERVER_NAME');
-    foreach ($ldap_authentication_conf['ssoExcludedHosts'] as $host_to_check) {
-      if ($host_to_check == $host) {
-        return TRUE;
-      }
-    }
-  }
-
-  if (isset($ldap_authentication_conf['ssoExcludedPaths'])) {
-    $patterns = implode("\r\n", $ldap_authentication_conf['ssoExcludedPaths']);
-    if ($patterns) {
-      if (function_exists('drupal_get_path_alias')) {
-        $path = drupal_get_path_alias($path);
-      }
-      $path = (function_exists('drupal_strtolower')) ? drupal_strtolower($path) : strtolower($path);
-
-      $to_replace = array(
-        // Newlines.
-        '/(\r\n?|\n)/',
-        // Asterisks.
-        '/\\\\\*/',
-        // <front>.
-        '/(^|\|)\\\\<front\\\\>($|\|)/',
-      );
-      $replacements = array(
-        '|',
-        '.*',
-        '\1' . preg_quote(variable_get('site_frontpage', 'node'), '/') . '\2',
-      );
-      $patterns_quoted = preg_quote($patterns, '/');
-      $regex = '/^(' . preg_replace($to_replace, $replacements, $patterns_quoted) . ')$/';
-      $result = (bool) preg_match($regex, $path);
-    }
-  }
-
-  return $result;
-
-}
-
-
-/**
- * A proxy function for the actual authentication routine.
- *
- * This is in place so various implementations of grabbing NTLM credentials can
- * be used and selected from an administration page. This is the real gatekeeper
- * since this assumes that any NTLM authentication from the underlying web
- * server is good enough, and only checks that there are values in place for the
- * user name, and anything else that is set for a particular implementation. In
- * the case that there are no credentials set by the underlying web server, the
- * user is redirected to the normal user login form.
- */
-function ldap_sso_user_login_sso() {
-
-  $detailed_watchdog_log = variable_get('ldap_help_watchdog_detail', 0);
-  $auth_conf = ldap_authentication_get_valid_conf();
-
-  if ($detailed_watchdog_log) {
-    $watchdog_tokens = array(
-      '!implementation' => $auth_conf->ldapImplementation,
-      '!enabled' => $auth_conf->ssoEnabled,
-      '!server_remote_user' => @$_SERVER['REMOTE_USER'],
-      '!server_redirect_remote_user' => @$_SERVER['REDIRECT_REMOTE_USER'],
-      '!ssoRemoteUserStripDomainName' => $auth_conf->ssoRemoteUserStripDomainName,
-      '!seamlessLogin' => $auth_conf->seamlessLogin,
-    );
-
-    watchdog(
-      'ldap_sso',
-      'ldap_sso_user_login_sso.step1: implementation: !implementation, enabled: !enabled, server_remote_user: !server_remote_user, server_redirect_remote_user: !server_redirect_remote_user, ssoRemoteUserStripDomainName: !ssoRemoteUserStripDomainName,seamlessLogin: !seamlessLogin',
-      $watchdog_tokens,
-      WATCHDOG_DEBUG
-    );
-  }
-
-  // Step 1.  Derive $remote_user, $realm, and $domain from $_SERVER variable.
-  $remote_user = NULL;
-  $realm = NULL;
-  $domain = NULL;
-
-  switch ($auth_conf->ldapImplementation) {
-    case 'mod_auth_sspi':
-      $remote_user = FALSE;
-      if ($remote_user = ldap_servers_get_globals('_SERVER', 'REMOTE_USER')) {
-      }
-      else {
-        $remote_user = ldap_servers_get_globals('_SERVER', 'REDIRECT_REMOTE_USER');
-      }
-      break;
-
-    case 'mod_auth_kerb':
-      if ($remote_user = ldap_servers_get_globals('_SERVER', 'REMOTE_USER')) {
-      }
-      else {
-        $remote_user = ldap_servers_get_globals('_SERVER', 'REDIRECT_REMOTE_USER');
-      }
-
-      if ($remote_user && preg_match('/^([A-Za-z0-9_\-\.]+)@([A-Za-z0-9_\-.]+)$/', $remote_user, $matches)) {
-        $remote_user = $matches[1];
-        // This can be used later if realms is ever supported properly.
-        $realm = $matches[2];
-      }
-      break;
-  }
-
-  if ($detailed_watchdog_log) {
-    $watchdog_tokens['!remote_user'] = $remote_user;
-    $watchdog_tokens['!realm'] = $realm;
-    watchdog('ldap_authentication', 'ldap_sso_user_login_sso.implementation: username=!remote_user, (realm=!realm) found',
-              $watchdog_tokens, WATCHDOG_DEBUG);
-  }
-
-  if ($remote_user) {
-    if ($auth_conf->ssoRemoteUserStripDomainName) {
-      // Might be in form <remote_user>@<domain> or <domain>\<remote_user>.
-      $domain = NULL;
-      $exploded = preg_split('/[\@\\\\]/', $remote_user);
-      if (count($exploded) == 2) {
-        if (strpos($remote_user, '@') !== FALSE) {
-          $remote_user = $exploded[0];
-          $domain = $exploded[1];
-        }
-        else {
-          $domain = $exploded[0];
-          $remote_user = $exploded[1];
-        }
-        if ($detailed_watchdog_log) {
-          $watchdog_tokens['!remote_user'] = $remote_user;
-          $watchdog_tokens['!domain'] = $domain;
-          watchdog('ldap_authentication', 'ldap_sso_user_login_sso.stripdomain: remote_user=!remote_user, domain=!domain', $watchdog_tokens, WATCHDOG_DEBUG);
-        }
-      }
-    }
-
-    if ($detailed_watchdog_log) {
-      $watchdog_tokens['!remote_user'] = $remote_user;
-      $watchdog_tokens['!realm'] = $realm;
-      $watchdog_tokens['!domain'] = $domain;
-      watchdog('ldap_authentication', 'ldap_sso_user_login_sso.remote_user: username=!remote_user, (realm=!realm, domain=!domain) found', $watchdog_tokens, WATCHDOG_DEBUG);
-    }
-    $fake_form_state = array(
-      'values' => array(
-        'name' => check_plain($remote_user),
-        'pass' => user_password(20),
-      ),
-      'sso_login' => TRUE,
-    );
-
-    // Make sure we're populating the global user object so that we can log this
-    // user in.
-    global $user;
-    $user = ldap_authentication_user_login_authenticate_validate(array(), $fake_form_state, TRUE);
-
-
-    if ($detailed_watchdog_log) {
-      $watchdog_tokens['!uid'] = is_object($user) ? $user->uid : NULL;
-      watchdog('ldap_authentication', 'ldap_sso_user_login_sso.remote_user: uid of user=!uid', $watchdog_tokens, WATCHDOG_DEBUG);
-    }
-
-    if ($user && $user->uid > 0) {
-      // Reload the account to ensure we have a fully populated user object.
-      $user = user_load($user->uid);
-
-      if ($auth_conf->seamlessLogin == 1) {
-        if ($detailed_watchdog_log) {
-          watchdog('ldap_authentication', 'ldap_sso_user_login_sso.remote_user.user_success.seamlessLogin', $watchdog_tokens, WATCHDOG_DEBUG);
-        }
-        setcookie("seamless_login", 'auto login', time() + $auth_conf->cookieExpire, base_path(), "");
-        ldap_servers_set_globals('_SESSION', 'seamless_login', 'auto login');
-        setcookie("seamless_login_attempted", '', time() - 3600, base_path(), "");
-        ldap_servers_delete_globals('_SESSION', 'seamless_login_attempted');
-        // Make sure we tell Drupal to create the session cookie for this
-        // authenticated user.
-      }
-      user_login_finalize();
-      if ($auth_conf->ssoNotifyAuthentication) {
-        drupal_set_message(theme('ldap_authentication_login_message',
-          array('message' => t('You have been successfully authenticated'))));
-      }
-      if ($detailed_watchdog_log) {
-        watchdog('ldap_authentication', 'ldap_sso_user_login_sso.remote_user.user_success.drupal_goto front', $watchdog_tokens, WATCHDOG_DEBUG);
-      }
-      drupal_goto('<front>');
-    }
-    else {
-      if ($auth_conf->seamlessLogin == 1) {
-        if ($detailed_watchdog_log) {
-          watchdog('ldap_authentication', 'ldap_sso_user_login_sso.remote_user.user_fail.seamlessLogin', $watchdog_tokens, WATCHDOG_DEBUG);
-        }
-        setcookie("seamless_login", 'do not auto login', time() + $auth_conf->cookieExpire, base_path(), "");
-        ldap_servers_set_globals('_SESSION', 'seamless_login', 'do not auto login');
-      }
-      drupal_set_message(theme('ldap_authentication_message_not_found', array(
-        'message' => t('Sorry, your LDAP credentials were not found, or the LDAP server is not available. You may log in with other credentials on the !user_login_form.',
-          array('!user_login_form' => l(t('user login form'), 'user/login'))))
-        ), 'error');
-      if ($detailed_watchdog_log) {
-        watchdog('ldap_authentication', 'ldap_sso_user_login_sso.remote_user.user_fail.drupal_goto user/logint', $watchdog_tokens, WATCHDOG_DEBUG);
-      }
-      drupal_goto('user/login');
-    }
-  }
-  else {
-    if ($detailed_watchdog_log) {
-      watchdog('ldap_authentication', '$_SERVER[\'REMOTE_USER\'] not found', array(), WATCHDOG_DEBUG);
-    }
-    if ($auth_conf->seamlessLogin == 1) {
-      setcookie("seamless_login", 'do not auto login', time() + $auth_conf->cookieExpire, base_path(), "");
-      ldap_servers_set_globals('_SESSION', 'seamless_login', 'do not auto login');
-      if ($detailed_watchdog_log) {
-        watchdog('ldap_authentication', 'ldap_sso_user_login_sso.no_remote_user.seamlessLogin', $watchdog_tokens, WATCHDOG_DEBUG);
-      }
-    }
-    drupal_set_message(theme('ldap_authentication_message_not_authenticated', array(
-      'message' => t('You were not authenticated by the server. You may log in with your credentials below.'),
-      )), 'error');
-    if ($detailed_watchdog_log) {
-      watchdog('ldap_authentication', 'ldap_sso_user_login_sso.no_remote_user.drupal_goto user/login', $watchdog_tokens, WATCHDOG_DEBUG);
-    }
-    drupal_goto('user/login');
-  }
-}
-
-
-/**
- * Used to mock $_SERVER, $_SESSION, etc globals for simpletests.
- *
- * @param string $global_type
- *   _SERVER, _ENV, _COOKIE, _GET, _POST, _REQUEST.
- * @param string $key
- *   Such as 'SERVER_ADDR', 'SERVER_PROTOCOL', etc.
- * @param bool $only_mock_values
- *   Don't get actual values when mock values don't exist.
- *
- * @return mixed
- *   ldap_simpletest_globals variable for global and key or $_SERVER[][],
- *   $_ENV[][], etv value if not in a simpletest or mock variable not available.
- */
-function ldap_servers_get_globals($global_type, $key, $only_mock_values = FALSE) {
-  $simpletest_globals = variable_get('ldap_simpletest_globals', array());
-  $simpletest = variable_get('ldap_simpletest', FALSE);
-
-  if ($simpletest && (isset($simpletest_globals[$global_type][$key]) || $only_mock_values)) {
-    return ($simpletest_globals[$global_type][$key]) ? $simpletest_globals[$global_type][$key] : NULL;
-  }
-  else {
-    return (isset($GLOBALS[$global_type][$key]) && !$only_mock_values) ? $GLOBALS[$global_type][$key] : NULL;
-  }
-
-}
-
-/**
- * Set globals.
- *
- * @param string $global_type
- *   _SERVER, _ENV, _COOKIE, _GET, _POST, _REQUEST.
- * @param string $key
- *   Such as 'SERVER_ADDR', 'SERVER_PROTOCOL', etc.
- * @param string $value
- *   The value to be set.
- */
-function ldap_servers_set_globals($global_type, $key, $value) {
-  $simpletest_globals = variable_get('ldap_simpletest_globals', array());
-  $simpletest = variable_get('ldap_simpletest', FALSE);
-  if ($simpletest) {
-    $simpletest_globals[$global_type][$key] = $value;
-    variable_set('ldap_simpletest_globals', $simpletest_globals);
-  }
-  else {
-    $GLOBALS[$global_type][$key] = $value;
-  }
-
-}
-
-/**
- * Delete globals.
- *
- * @param string $global_type
- *   _SERVER, _ENV, _COOKIE, _GET, _POST, _REQUEST.
- * @param string $key
- *   Such as 'SERVER_ADDR', 'SERVER_PROTOCOL', etc.
- * @param bool $only_mock_values
- *   Don't get actual values when mock values don't exist.
- */
-function ldap_servers_delete_globals($global_type, $key, $only_mock_values = FALSE) {
-  $simpletest_globals = variable_get('ldap_simpletest_globals', array());
-  $simpletest = variable_get('ldap_simpletest', FALSE);
-  if ($simpletest && isset($simpletest_globals[$global_type][$key])) {
-    unset($simpletest_globals[$global_type][$key]);
-    variable_set('ldap_simpletest_globals', $simpletest_globals);
-  }
-  elseif (!$only_mock_values && isset($GLOBALS[$global_type][$key])) {
-    unset($GLOBALS[$global_type][$key]);
-  }
-
-}
diff --git a/drupal7/sites/all/modules/ldap/ldap_test/ldap_test.info b/drupal7/sites/all/modules/ldap/ldap_test/ldap_test.info
index d26cae0e..68a61487 100644
--- a/drupal7/sites/all/modules/ldap/ldap_test/ldap_test.info
+++ b/drupal7/sites/all/modules/ldap/ldap_test/ldap_test.info
@@ -18,9 +18,9 @@ files[] = LdapServerTest.class.php
 files[] = LdapTestFunctions.class.php
 files[] = LdapUserTestCase.class.php
 
-; Information added by Drupal.org packaging script on 2017-05-30
-version = "7.x-2.2"
+; Information added by Drupal.org packaging script on 2017-08-27
+version = "7.x-2.3"
 core = "7.x"
 project = "ldap"
-datestamp = "1496167150"
+datestamp = "1503841448"
 
diff --git a/drupal7/sites/all/modules/ldap/ldap_user/LdapUserConf.class.php b/drupal7/sites/all/modules/ldap/ldap_user/LdapUserConf.class.php
index 1d220ed5..dec94636 100644
--- a/drupal7/sites/all/modules/ldap/ldap_user/LdapUserConf.class.php
+++ b/drupal7/sites/all/modules/ldap/ldap_user/LdapUserConf.class.php
@@ -69,6 +69,17 @@ class LdapUserConf {
    */
   public $userConflictResolve = LDAP_USER_CONFLICT_RESOLVE_DEFAULT;
 
+  /**
+   * Whether to allow/disallow provisioning accounts that have the same email.
+   * Depending on whether the "sharedemail" module is enabled, this variable
+   * will (by default) be set accordingly.  It can be overridden by an admin.
+   *
+   * @var int
+   *    LDAP_USER_ACCOUNTS_WITH_SAME_EMAIL_DISABLED (0)
+   *    LDAP_USER_ACCOUNTS_WITH_SAME_EMAIL_ENABLED (1)
+   */
+  public $accountsWithSameEmail = LDAP_USER_ACCOUNTS_WITH_SAME_EMAIL_DISABLED;
+
   /**
    * drupal account creation model
    *
@@ -181,6 +192,7 @@ class LdapUserConf {
     'orphanedDrupalAcctBehavior',
     'orphanedCheckQty',
     'userConflictResolve',
+    'accountsWithSameEmail',
     'manualAccountConflict',
     'acctCreation',
     'ldapUserSynchMappings',
@@ -231,6 +243,9 @@ class LdapUserConf {
     }
     else {
       $this->inDatabase = FALSE;
+      // By default this variable should be 0 if the "sharedemail" module
+      // is not enabled, or 1 if the module is.
+      $this->accountsWithSameEmail = (int)module_exists('sharedemail');
     }
     // determine account creation configuration
     $user_register = variable_get('user_register', USER_REGISTER_VISITORS_ADMINISTRATIVE_APPROVAL);
@@ -1078,7 +1093,7 @@ class LdapUserConf {
             );
             return FALSE;
           }
-          if ($account_with_same_email = user_load_by_mail($user_edit['mail'])) {
+          if(($this->accountsWithSameEmail == LDAP_USER_ACCOUNTS_WITH_SAME_EMAIL_DISABLED) && ($account_with_same_email = user_load_by_mail($user_edit['mail']))) {
             $watchdog_tokens['%email'] = $user_edit['mail'];
             $watchdog_tokens['%duplicate_name'] = $account_with_same_email->name;
             watchdog('ldap_user', 'LDAP user %drupal_username has email address
diff --git a/drupal7/sites/all/modules/ldap/ldap_user/LdapUserConfAdmin.class.php b/drupal7/sites/all/modules/ldap/ldap_user/LdapUserConfAdmin.class.php
index c9fffa8f..84df561f 100644
--- a/drupal7/sites/all/modules/ldap/ldap_user/LdapUserConfAdmin.class.php
+++ b/drupal7/sites/all/modules/ldap/ldap_user/LdapUserConfAdmin.class.php
@@ -33,6 +33,9 @@ class LdapUserConfAdmin extends LdapUserConf {
   public $userConflictResolveDefault = LDAP_USER_CONFLICT_RESOLVE_DEFAULT;
   public $userConflictOptions;
 
+  public $accountsWithSameEmailDescription;
+  public $accountsWithSameEmailOptions;
+
   public $acctCreationDescription = '';
   public $acctCreationDefault = LDAP_USER_ACCT_CREATION_LDAP_BEHAVIOR_DEFAULT;
   public $acctCreationOptions;
@@ -163,6 +166,15 @@ class LdapUserConfAdmin extends LdapUserConf {
       '#description' => t( $this->userConflictResolveDescription),
     );
 
+    $form['basic_to_drupal']['accountsWithSameEmail'] = array(
+      '#type' => 'radios',
+      '#title' => t('Existing Account with Same Email Address'),
+      '#default_value' => $this->accountsWithSameEmail,
+      '#options' => $this->accountsWithSameEmailOptions,
+      '#description' => t($this->accountsWithSameEmailDescription),
+      '#disabled' => (module_exists('sharedemail') === FALSE),
+    );
+
     $form['basic_to_drupal']['acctCreation'] = array(
       '#type' => 'radios',
       '#title' => t('Application of Drupal Account settings to LDAP Authenticated Users'),
@@ -382,7 +394,7 @@ EOT;
       $this->addServerMappingFields($form, $direction);
     }
 
-    foreach (array('orphanedCheckQty', 'orphanedDrupalAcctBehavior', 'acctCreation', 'userConflictResolve', 'drupalAcctProvisionTriggers', 'mappings__' . LDAP_USER_PROV_DIRECTION_TO_DRUPAL_USER) as $input_name) {
+    foreach (array('orphanedCheckQty', 'orphanedDrupalAcctBehavior', 'acctCreation', 'userConflictResolve', 'accountsWithSameEmail', 'drupalAcctProvisionTriggers', 'mappings__' . LDAP_USER_PROV_DIRECTION_TO_DRUPAL_USER) as $input_name) {
       $form['basic_to_drupal'][$input_name]['#states']['invisible'] =
         array(
           ':input[name=drupalAcctProvisionServer]' => array('value' => 'none'),
@@ -596,6 +608,7 @@ EOT;
 
     $this->manualAccountConflict = $values['manualAccountConflict'];
     $this->userConflictResolve  = ($values['userConflictResolve']) ? (int)$values['userConflictResolve'] : NULL;
+    $this->accountsWithSameEmail = ($values['accountsWithSameEmail']) ? (int)$values['accountsWithSameEmail'] : NULL;
     $this->acctCreation  = ($values['acctCreation']) ? (int)$values['acctCreation'] : NULL;
     $this->disableAdminPasswordField = $values['disableAdminPasswordField'];
    // $this->wsKey  = ($values['wsKey']) ? $values['wsKey'] : NULL;
@@ -741,11 +754,14 @@ EOT;
           ||
           (isset($mapping['configurable_to_ldap']) && $mapping['configurable_to_ldap']  && $direction == LDAP_USER_PROV_DIRECTION_TO_LDAP_ENTRY)
           ) {
-          $user_attr_options[$target_id] = substr($mapping['name'], 0, 25);
+          $user_attr_options[$target_id] = substr($target_id, 1, -1);
         }
       }
     }
-    $user_attr_options['user_tokens'] = '-- user tokens --';
+
+    if ($direction == LDAP_USER_PROV_DIRECTION_TO_LDAP_ENTRY) {
+      $user_attr_options['user_tokens'] = '-- user tokens --';
+    }
 
     $row = 0;
 
@@ -1016,7 +1032,14 @@ EOT;
       LDAP_USER_CONFLICT_RESOLVE => t('Associate Drupal account with the LDAP entry.  This option
       is useful for creating accounts and assigning roles before an LDAP user authenticates.'),
       );
-
+    $values['accountsWithSameEmailDescription'] = t('Allows provisioning a Drupal user account from LDAP regardless of whether another Drupal user account has the same email address. This setting depends on the "sharedemail" contrib module being enabled. ');
+    if (!module_exists('sharedemail')) {
+      $values['accountsWithSameEmailDescription'] .= t('The module is not currently enabled; you must install/enable it if you want to use this setting.');
+    }
+    $values['accountsWithSameEmailOptions'] = array(
+      LDAP_USER_ACCOUNTS_WITH_SAME_EMAIL_DISABLED => t('Prevent provisioning a user account if an existing account has the same email address.'),
+      LDAP_USER_ACCOUNTS_WITH_SAME_EMAIL_ENABLED => t('Allow provisioning a user account that has the same email address as another user account.'),
+      );
     $values['acctCreationOptions'] = array(
       LDAP_USER_ACCT_CREATION_LDAP_BEHAVIOR => t('Account creation settings at
         /admin/config/people/accounts/settings do not affect "LDAP Associated" Drupal accounts.'),
diff --git a/drupal7/sites/all/modules/ldap/ldap_user/ldap_user.cron.inc b/drupal7/sites/all/modules/ldap/ldap_user/ldap_user.cron.inc
index 2c617c39..35e92b8b 100644
--- a/drupal7/sites/all/modules/ldap/ldap_user/ldap_user.cron.inc
+++ b/drupal7/sites/all/modules/ldap/ldap_user/ldap_user.cron.inc
@@ -167,7 +167,7 @@ function _ldap_user_orphans($ldap_user_conf) {
                *     user_cancel_reassign, user_cancel_delete
                */
               if ($ldap_user_conf->orphanedDrupalAcctBehavior == 'ldap_user_orphan_email') {
-                 $email_list[] = $account->name . "," . $account->mail . "," . $base_url . "/user/$uid/edit";
+                 $email_list[] = $account->name . "," . $account->mail . "," . $base_url . "/user/" . $account->uid . "/edit";
               }
               else {
                  _user_cancel(array(), $account, $ldap_user_conf->orphanedDrupalAcctBehavior);
diff --git a/drupal7/sites/all/modules/ldap/ldap_user/ldap_user.info b/drupal7/sites/all/modules/ldap/ldap_user/ldap_user.info
index 414546cb..0f7c5f33 100644
--- a/drupal7/sites/all/modules/ldap/ldap_user/ldap_user.info
+++ b/drupal7/sites/all/modules/ldap/ldap_user/ldap_user.info
@@ -23,9 +23,11 @@ files[] = tests/ldap_user.test
 stylesheets[all][] = ldap_user.css
 configure = admin/config/people/ldap/user
 
-; Information added by Drupal.org packaging script on 2017-05-30
-version = "7.x-2.2"
+test_dependencies[] = ldap_sso:ldap_sso
+
+; Information added by Drupal.org packaging script on 2017-08-27
+version = "7.x-2.3"
 core = "7.x"
 project = "ldap"
-datestamp = "1496167150"
+datestamp = "1503841448"
 
diff --git a/drupal7/sites/all/modules/ldap/ldap_user/ldap_user.install b/drupal7/sites/all/modules/ldap/ldap_user/ldap_user.install
index 05136a9f..0ebcd2ed 100644
--- a/drupal7/sites/all/modules/ldap/ldap_user/ldap_user.install
+++ b/drupal7/sites/all/modules/ldap/ldap_user/ldap_user.install
@@ -522,3 +522,25 @@ function ldap_user_update_check_user_fields($query = FALSE) {
   return $fields_added;
 
 }
+
+/**
+ * Set an appropriate default value for accountsWithSameEmail.
+ */
+function ldap_user_update_7206() {
+  $message = NULL;
+  $ldap_user_conf = ldap_user_conf('admin', TRUE);
+  // If the configuration variable is not set, set a reasonable default and
+  // advise the administrator.
+  if (module_exists('sharedemail')) {
+    $message = t('The module "sharedemail" was detected. LDAP User configuration has been set so that user accounts can be provisioned regardless of whether an existing user account has the same email address.');
+    $ldap_user_conf->accountsWithSameEmail = LDAP_USER_ACCOUNTS_WITH_SAME_EMAIL_ENABLED;
+  }
+  else {
+    // The "sharedemail" module is not enabled; do not enable this setting.
+    // Do not mention anything in the hook_update_N output.
+    $ldap_user_conf->accountsWithSameEmail = LDAP_USER_ACCOUNTS_WITH_SAME_EMAIL_DISABLED;
+  }
+  $ldap_user_conf->save();
+
+  return $message;
+}
diff --git a/drupal7/sites/all/modules/ldap/ldap_user/ldap_user.module b/drupal7/sites/all/modules/ldap/ldap_user/ldap_user.module
index 1fe17391..5d9a4913 100644
--- a/drupal7/sites/all/modules/ldap/ldap_user/ldap_user.module
+++ b/drupal7/sites/all/modules/ldap/ldap_user/ldap_user.module
@@ -35,6 +35,10 @@ define('LDAP_USER_CONFLICT_LOG', 1);
 define('LDAP_USER_CONFLICT_RESOLVE', 2);
 define('LDAP_USER_CONFLICT_RESOLVE_DEFAULT', 2);
 
+// options for what to do if another Drupal account has the same email address
+define('LDAP_USER_ACCOUNTS_WITH_SAME_EMAIL_DISABLED', 0);
+define('LDAP_USER_ACCOUNTS_WITH_SAME_EMAIL_ENABLED', 1);
+
 // options for dealing with manual account creation that conflict with ldap entries
 define('LDAP_USER_MANUAL_ACCT_CONFLICT_REJECT', 1);
 define('LDAP_USER_MANUAL_ACCT_CONFLICT_LDAP_ASSOCIATE', 2);
diff --git a/drupal7/sites/all/modules/ldap/ldap_views/ldap_views.info b/drupal7/sites/all/modules/ldap/ldap_views/ldap_views.info
index 38dd725a..7af80730 100644
--- a/drupal7/sites/all/modules/ldap/ldap_views/ldap_views.info
+++ b/drupal7/sites/all/modules/ldap/ldap_views/ldap_views.info
@@ -21,9 +21,9 @@ files[] = handlers/ldap_views_handler_filter.inc
 files[] = handlers/ldap_views_handler_filter_attribute.inc
 files[] = handlers/ldap_views_handler_sort.inc
 files[] = handlers/ldap_views_handler_sort_attribute.inc
-; Information added by Drupal.org packaging script on 2017-05-30
-version = "7.x-2.2"
+; Information added by Drupal.org packaging script on 2017-08-27
+version = "7.x-2.3"
 core = "7.x"
 project = "ldap"
-datestamp = "1496167150"
+datestamp = "1503841448"
 
diff --git a/drupal7/sites/all/modules/ldap/ldap_views/plugins/ldap_views_plugin_query_ldap.inc b/drupal7/sites/all/modules/ldap/ldap_views/plugins/ldap_views_plugin_query_ldap.inc
index 4a80ee6d..50175ea5 100644
--- a/drupal7/sites/all/modules/ldap/ldap_views/plugins/ldap_views_plugin_query_ldap.inc
+++ b/drupal7/sites/all/modules/ldap/ldap_views/plugins/ldap_views_plugin_query_ldap.inc
@@ -204,7 +204,7 @@ class ldap_views_plugin_query_ldap extends views_plugin_query {
    * $view->result should contain an array of objects.
    */
   function execute(&$view) {
-    $start       = microtime();
+    $start       = microtime(TRUE);
     $entries     = array();
     $num_entries = 0;
 
@@ -258,7 +258,10 @@ class ldap_views_plugin_query_ldap extends views_plugin_query {
 
     foreach ($entries as $key => &$entry) {
       if (isset($entry['jpegphoto'])) {
-        $entry['jpegphoto'][0] = "<img src='data:image/jpeg;base64," . base64_encode($entry['jpegphoto'][0]) . "' alt='photo' />";
+        $entry['jpegphoto'][0] = '<img src="data:image/jpeg;base64,' . base64_encode($entry['jpegphoto'][0]) . '" alt="photo" />';
+      }
+      if (isset($entry['thumbnailphoto'])) {
+        $entry['thumbnailphoto'][0] = '<img src="data:image/jpeg;base64,' . base64_encode($entry['thumbnailphoto'][0]) . '" alt="photo" />';
       }
       foreach ($view->field as $field) {
         if (! isset($field_alias[$field->field_alias])) {
@@ -338,7 +341,7 @@ class ldap_views_plugin_query_ldap extends views_plugin_query {
 
     $view->result       = $result;
     $view->total_rows   = $num_entries;
-    $view->execute_time = microtime() - $start;
+    $view->execute_time = microtime(TRUE) - $start;
     $view->query->pager->total_items  = $num_entries;
     $view->query->pager->update_page_info();
 
