Improve syslog integration

- correctly open log
- log only failures

Issue #6146

Signed-off-by: Michal Čihař <michal@cihar.com>
This commit is contained in:
Michal Čihař 2016-02-17 10:28:04 +01:00
parent 95819f1557
commit 6fe468f7db

View File

@ -22,10 +22,12 @@ function PMA_logUser($user, $status = 'ok')
apache_note('userID', $user);
apache_note('userStatus', $status);
}
if (function_exists('syslog')) {
if (function_exists('syslog') && $status != 'ok') {
@openlog('phpMyAdmin', LOG_NDELAY | LOG_PID, LOG_AUTHPRIV);
@syslog(
LOG_AUTHPRIV,
'phpMyAdmin: ' . $user . ' (' . $status . ') from ' . $_SERVER['REMOTE_ADDR']
LOG_WARNING,
'user denied: ' . $user . ' (' . $status . ') from ' .
$_SERVER['REMOTE_ADDR']
);
}
}