--- /tmp/ldap_authentication.module	2011-11-01 16:36:56.000000000 -0400
+++ ldap/ldap_authentication/ldap_authentication.module	2011-11-01 16:42:30.000000000 -0400
@@ -379,32 +379,35 @@
 /**
  * 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_authentication_boot() {
   if ($GLOBALS['user']->uid == 0) {
-    if (!(isset($_COOKIE['seamless_login'])) || $_COOKIE['seamless_login'] == 'auto login'){
-      if ((arg(0) == 'user' && !(is_numeric(arg(1)))) || arg(0) == 'logout' ){
+    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']))
+        if (isset($_COOKIE['seamless_login_attempted'])) {
           $login_attempted = $_COOKIE['seamless_login_attempted'];
+        }
         else {
           $login_attempted = FALSE;
         }
-        //Full bootstrap needed to load common.inc for redirects and for ldap_authentication_get_valid_conf()
-        // to function.
-        drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
+        // Load code needed for ldap_authentication_get_valid_conf().
+        $my_path = preg_replace('{/[^/]*?$}', '', __FILE__);
+        require_once("$my_path/../ldap_servers/ldap_servers.module");
+        drupal_load('module', 'user');
         $auth_conf = ldap_authentication_get_valid_conf();
-        if ( $auth_conf && $auth_conf->seamlessLogin == 1 && ($login_attempted != 'true')) {
-          setcookie("seamless_login_attempted", 'true', time() + (int)$auth_conf->cookieExpire, base_path(), "");
+        if ($auth_conf && $auth_conf->seamlessLogin == 1 && ($login_attempted != 'true')) {
+          require_once(DRUPAL_ROOT . '/includes/common.inc');
+          setcookie('seamless_login_attempted', 'true', time() + (int)$auth_conf->cookieExpire, base_path(), '');
           $_SESSION['seamless_login_attempted'] = $login_attempted;
 
           drupal_goto('user/login/sso', array('query' => array('destination' => rawurlencode($_GET['q']))));
         }
         else {
           return;
         }
       }
