Index: auth.php
===================================================================
RCS file: /cvsroot/moodle/moodle/auth/ldap/auth.php,v
retrieving revision 1.47
diff -u -r1.47 auth.php
--- auth.php	8 Jan 2008 00:13:49 -0000	1.47
+++ auth.php	18 Feb 2008 06:09:22 -0000
@@ -1820,7 +1820,11 @@
     function ntlmsso_magic($sesskey) {
         if (isset($_SERVER['REMOTE_USER']) && !empty($_SERVER['REMOTE_USER'])) {
             $username = $_SERVER['REMOTE_USER'];
-            $username = substr(strrchr($username, '\\'), 1); //strip domain info
+            if ( strrchr($username, '@') !== false ) {
+                $username = substr($username, 0, strpos($username, '@'));
+            } else {
+                $username = substr(strrchr($username, '\\'),1);
+            }
             $username = moodle_strtolower($username); //compatibility hack
             set_cache_flag('auth/ldap/ntlmsess', $sesskey, $username, AUTH_NTLMTIMEOUT);
             return true;

