As said before, I put some code in the auth.php to log the $username in the ntlmsso_magic function, and I saw the user logs in as:
DOMAIN\user1
Then, I modified the /etc/samba/smb.conf and uncommented:
winbind use default domain = Yes
Then, in /var/www/moodle/auth/ldap/auth.php, i change the switch
switch ($this->config->ntlmsso_type) {
case 'ntlm':
$username = substr(strrchr($username, '\\'), 1);
break;
And commented out the line which changes $username, so the resulting line is:
switch ($this->config->ntlmsso_type) {
case 'ntlm':
// $username = substr(strrchr($username, '\\'), 1);
break;
case 'kerberos':
// Format is username@DOMAIN
$username = substr($username, 0, strpos($username, '@'));
break;
default:
error_log($this->errorlogtag.get_string ('ntlmsso_unknowntype', 'auth_ldap'));
return false; // Should never happen!
}
I put an error_log before and after the switch block to understand how the $_SERVER['REMOTE_USER'] is set and what $username becomes, and I get:
ntlmsso_magic: Before strrchr: username: a6319, referer: https://
ntlmsso_magic: After strrchr: username: a6319,
Now the login via NTLM WORKS, but it's taking ages (2+ minutes) for the user to get in.
Any idea on how can I debug this?
Anyhow, I'll keep on investigating.
Thanks again for your attention