Started adding in some eventlog reporting

This commit is contained in:
jengo 2001-08-05 09:54:44 +00:00
parent 7017e7223c
commit 3c64f8fc3e
3 changed files with 28 additions and 1 deletions

View File

@ -38,6 +38,11 @@
error_reporting(0); error_reporting(0);
$ldap = ldap_connect($phpgw_info['server']['ldap_host']); $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 */ /* 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); $sri = ldap_search($ldap, $phpgw_info['server']['ldap_context'], 'uid='.$username);

View File

@ -196,7 +196,7 @@
*/ */
function ldapConnect($host = '', $dn = '', $passwd = '') function ldapConnect($host = '', $dn = '', $passwd = '')
{ {
global $phpgw_info; global $phpgw_info, $phpgw;
if (! $host) if (! $host)
{ {
@ -216,6 +216,9 @@
// connect to ldap server // connect to ldap server
if (! $ds = ldap_connect($host)) if (! $ds = ldap_connect($host))
{ {
$phpgw->log->message('F-Abort, Failed connecting to LDAP server');
$phpgw->log->commit();
printf("<b>Error: Can't connect to LDAP server %s!</b><br>",$host); printf("<b>Error: Can't connect to LDAP server %s!</b><br>",$host);
return False; return False;
} }
@ -223,6 +226,9 @@
// bind as admin, we not to able to do everything // bind as admin, we not to able to do everything
if (! ldap_bind($ds,$dn,$passwd)) if (! ldap_bind($ds,$dn,$passwd))
{ {
$phpgw->log->message('F-Abort, Failed binding to LDAP server');
$phpgw->log->commit();
printf("<b>Error: Can't bind to LDAP server: %s!</b><br>",$dn); printf("<b>Error: Can't bind to LDAP server: %s!</b><br>",$dn);
return False; return False;
} }

View File

@ -127,6 +127,8 @@
$this->read_repositories($phpgw_info['server']['cache_phpgw_info']); $this->read_repositories($phpgw_info['server']['cache_phpgw_info']);
if ($this->user['expires'] != -1 && $this->user['expires'] < time()) 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; return False;
} }
@ -138,6 +140,9 @@
if ($userid_array[1] != $phpgw_info['user']['domain']) 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; return False;
} }
@ -145,6 +150,10 @@
{ {
if (PHP_OS != 'Windows' && (! $phpgw_info['user']['session_ip'] || $phpgw_info['user']['session_ip'] != $this->getuser_ip())) 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; return False;
} }
} }
@ -156,6 +165,10 @@
if (! $this->account_lid) if (! $this->account_lid)
{ {
// This needs some better wording
$phpgw->log->message('W-VerifySession, account_id is empty');
$phpgw->log->commit();
return False; return False;
} }
else else
@ -251,6 +264,9 @@
$this->read_repositories(False); $this->read_repositories(False);
if ($this->user['expires'] != -1 && $this->user['expires'] < time()) 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; return False;
} }