diff --git a/phpgwapi/inc/class.auth_ldap.inc.php b/phpgwapi/inc/class.auth_ldap.inc.php index f2c7e1a6ea..0dda40bfd7 100644 --- a/phpgwapi/inc/class.auth_ldap.inc.php +++ b/phpgwapi/inc/class.auth_ldap.inc.php @@ -38,6 +38,11 @@ error_reporting(0); $ldap = ldap_connect($phpgw_info['server']['ldap_host']); + if (! $ldap) + { + $phpgw->log->message('F-Abort, Failed connecting to LDAP server for authenication, execution stopped'); + $phpgw->log->commit(); + } /* find the dn for this uid, the uid is not always in the dn */ $sri = ldap_search($ldap, $phpgw_info['server']['ldap_context'], 'uid='.$username); diff --git a/phpgwapi/inc/class.common.inc.php b/phpgwapi/inc/class.common.inc.php index 0fbd16abc9..5838bfe540 100644 --- a/phpgwapi/inc/class.common.inc.php +++ b/phpgwapi/inc/class.common.inc.php @@ -196,7 +196,7 @@ */ function ldapConnect($host = '', $dn = '', $passwd = '') { - global $phpgw_info; + global $phpgw_info, $phpgw; if (! $host) { @@ -216,6 +216,9 @@ // connect to ldap server if (! $ds = ldap_connect($host)) { + $phpgw->log->message('F-Abort, Failed connecting to LDAP server'); + $phpgw->log->commit(); + printf("Error: Can't connect to LDAP server %s!
",$host); return False; } @@ -223,6 +226,9 @@ // bind as admin, we not to able to do everything if (! ldap_bind($ds,$dn,$passwd)) { + $phpgw->log->message('F-Abort, Failed binding to LDAP server'); + $phpgw->log->commit(); + printf("Error: Can't bind to LDAP server: %s!
",$dn); return False; } diff --git a/phpgwapi/inc/class.sessions.inc.php b/phpgwapi/inc/class.sessions.inc.php index 5266983910..463baab20f 100644 --- a/phpgwapi/inc/class.sessions.inc.php +++ b/phpgwapi/inc/class.sessions.inc.php @@ -127,6 +127,8 @@ $this->read_repositories($phpgw_info['server']['cache_phpgw_info']); if ($this->user['expires'] != -1 && $this->user['expires'] < time()) { + $phpgw->log->message('W-VerifySession, account loginid %1 is expired',$this->account_lid); + $phpgw->log->commit(); return False; } @@ -138,6 +140,9 @@ if ($userid_array[1] != $phpgw_info['user']['domain']) { + $phpgw->log->message('W-VerifySession, the domains %1 and %2 don\t match',$userid_array[1],$phpgw_info['user']['domain']); + $phpgw->log->commit(); + return False; } @@ -145,6 +150,10 @@ { if (PHP_OS != 'Windows' && (! $phpgw_info['user']['session_ip'] || $phpgw_info['user']['session_ip'] != $this->getuser_ip())) { + // This needs some better wording + $phpgw->log->message('W-VerifySession, IP %1 doesn\'t match IP %2 in session table',$this->getuser_ip(),$phpgw_info['user']['session_ip']); + $phpgw->log->commit(); + return False; } } @@ -156,6 +165,10 @@ if (! $this->account_lid) { + // This needs some better wording + $phpgw->log->message('W-VerifySession, account_id is empty'); + $phpgw->log->commit(); + return False; } else @@ -251,6 +264,9 @@ $this->read_repositories(False); if ($this->user['expires'] != -1 && $this->user['expires'] < time()) { + $phpgw->log->message('W-LoginFailure, account loginid %1 is expired',$this->account_lid); + $phpgw->log->commit(); + return False; }