gui: apply CUSTOM_EMAIL_QUERY_FUNCTION to sso user in ntlm auth

Signed-off-by: Janos SUTO <sj@acts.hu>
This commit is contained in:
Janos SUTO 2017-12-23 18:14:17 +01:00
parent e3f53863b7
commit a49591f4f3

View File

@ -437,16 +437,16 @@ class ModelUserAuth extends Model {
$u = explode("\\", $_SERVER['REMOTE_USER']); $u = explode("\\", $_SERVER['REMOTE_USER']);
if(isset($u[1])) { $username = $u[1]; } if(isset($u[1])) { $sso_user = $u[1]; }
else { $username = $_SERVER['REMOTE_USER']; } else { $sso_user = $_SERVER['REMOTE_USER']; }
if(LOG_LEVEL >= NORMAL) { syslog(LOG_INFO, "sso login: $username"); } if(LOG_LEVEL >= NORMAL) { syslog(LOG_INFO, "sso login: $sso_user"); }
$ldap = new LDAP(LDAP_HOST, LDAP_HELPER_DN, LDAP_HELPER_PASSWORD); $ldap = new LDAP(LDAP_HOST, LDAP_HELPER_DN, LDAP_HELPER_PASSWORD);
if($ldap->is_bind_ok()) { if($ldap->is_bind_ok()) {
$query = $ldap->query(LDAP_BASE_DN, "(&(objectClass=user)(samaccountname=" . $username . "))", array()); $query = $ldap->query(LDAP_BASE_DN, "(&(objectClass=user)(samaccountname=" . $sso_user . "))", array());
if(isset($query->row['dn'])) { if(isset($query->row['dn'])) {
$a = $query->row; $a = $query->row;
@ -488,7 +488,7 @@ class ModelUserAuth extends Model {
AUDIT(ACTION_LOGIN, $username, '', '', 'successful auth against LDAP'); AUDIT(ACTION_LOGIN, $username, '', '', 'successful auth against LDAP');
if(CUSTOM_EMAIL_QUERY_FUNCTION && function_exists(CUSTOM_EMAIL_QUERY_FUNCTION)) { if(CUSTOM_EMAIL_QUERY_FUNCTION && function_exists(CUSTOM_EMAIL_QUERY_FUNCTION)) {
call_user_func(CUSTOM_EMAIL_QUERY_FUNCTION, $username); call_user_func(CUSTOM_EMAIL_QUERY_FUNCTION, $sso_user);
} }
return 1; return 1;