summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorScott Ullrich <sullrich@pfsense.org>2010-12-10 16:02:18 -0500
committerScott Ullrich <sullrich@pfsense.org>2010-12-10 16:02:18 -0500
commit3aba1835f9d1a45e4f0d17823af2e13a4de19787 (patch)
tree248edb20629448851d3b01b76681565231abf38d
parent6735d0929eee41ef1cf2f253fa2a50740c066660 (diff)
downloadpfsense-3aba1835f9d1a45e4f0d17823af2e13a4de19787.zip
pfsense-3aba1835f9d1a45e4f0d17823af2e13a4de19787.tar.gz
Add log_auth() which with send items to syslogd using LOG_AUTH facilities. Use this new log_authh() for login error and success entries
-rw-r--r--etc/inc/auth.inc5
-rw-r--r--etc/inc/util.inc19
2 files changed, 20 insertions, 4 deletions
diff --git a/etc/inc/auth.inc b/etc/inc/auth.inc
index c648519..bbcb53a 100644
--- a/etc/inc/auth.inc
+++ b/etc/inc/auth.inc
@@ -1212,7 +1212,7 @@ function session_auth() {
$_SESSION['Logged_In'] = "True";
$_SESSION['Username'] = $_POST['usernamefld'];
$_SESSION['last_access'] = time();
- log_error("Successful webConfigurator login for user '{$_POST['usernamefld']}' host: {$_SERVER['REMOTE_ADDR']}");
+ log_auth("Successful webConfigurator login for user '{$_POST['usernamefld']}' host: {$_SERVER['REMOTE_ADDR']}");
$HTTP_SERVER_VARS['AUTH_USER'] = $_SESSION['Username'];
if (isset($_POST['postafterlogin']))
return true;
@@ -1225,8 +1225,7 @@ function session_auth() {
} else {
/* give the user an error message */
$_SESSION['Login_Error'] = "Username or Password incorrect";
- log_error("webConfigurator authentication error for '{$_POST['usernamefld']}' host: '{$_SERVER['REMOTE_ADDR']}'");
-
+ log_auth("webConfigurator authentication error for '{$_POST['usernamefld']}' host: '{$_SERVER['REMOTE_ADDR']}'");
if(isAjax()) {
echo "showajaxmessage('{$_SESSION['Login_Error']}');";
return;
diff --git a/etc/inc/util.inc b/etc/inc/util.inc
index 6c40c45..3cc88e9 100644
--- a/etc/inc/util.inc
+++ b/etc/inc/util.inc
@@ -790,6 +790,23 @@ function log_error($error) {
return;
}
+/****f* util/log_auth
+* NAME
+* log_error - Sends a string to syslog as LOG_AUTH facility
+* INPUTS
+* $error - string containing the syslog message.
+* RESULT
+* null
+******/
+function log_auth($error) {
+ global $g;
+ $page = $_SERVER['SCRIPT_NAME'];
+ syslog(LOG_AUTH, "$page: $error");
+ if ($g['debug'])
+ syslog(LOG_WARNING, var_dump(debug_backtrace()));
+ return;
+}
+
/****f* util/exec_command
* NAME
* exec_command - Execute a command and return a string of the result.
@@ -1468,4 +1485,4 @@ function array_merge_recursive_unique($array0, $array1)
return $result;
}
-?>
+?> \ No newline at end of file
OpenPOWER on IntegriCloud