Commit 3318c94c authored by Franco Fichtner's avatar Franco Fichtner

inc: log_auth() is a lie

LOG_AUTH is not a level, it's a facility which can't be cherry-picked
from the syslog() call.  Remove it.  Also stops spewing of auth message
into console.
parent 347d5807
...@@ -1114,15 +1114,16 @@ function ldap_backed($username, $passwd, $authcfg) { ...@@ -1114,15 +1114,16 @@ function ldap_backed($username, $passwd, $authcfg) {
/* that way we don't have to search twice. */ /* that way we don't have to search twice. */
/*****************************************************************/ /*****************************************************************/
if ($debug) if ($debug)
log_auth(sprintf(gettext("Now Searching for %s in directory."), $username)); log_error(sprintf(gettext("Now Searching for %s in directory."), $username));
/* Iterate through the user containers for search */ /* Iterate through the user containers for search */
foreach ($ldac_splits as $i => $ldac_split) { foreach ($ldac_splits as $i => $ldac_split) {
$ldac_split = isset($authcfg['ldap_utf8']) ? utf8_encode($ldac_split) : $ldac_split; $ldac_split = isset($authcfg['ldap_utf8']) ? utf8_encode($ldac_split) : $ldac_split;
$ldapfilter = isset($authcfg['ldap_utf8']) ? utf8_encode($ldapfilter) : $ldapfilter; $ldapfilter = isset($authcfg['ldap_utf8']) ? utf8_encode($ldapfilter) : $ldapfilter;
$ldapsearchbasedn = isset($authcfg['ldap_utf8']) ? utf8_encode("{$ldac_split},{$ldapbasedn}") : "{$ldac_split},{$ldapbasedn}"; $ldapsearchbasedn = isset($authcfg['ldap_utf8']) ? utf8_encode("{$ldac_split},{$ldapbasedn}") : "{$ldac_split},{$ldapbasedn}";
/* Make sure we just use the first user we find */ /* Make sure we just use the first user we find */
if ($debug) if ($debug) {
log_auth(sprintf(gettext('Now Searching in server %1$s, container %2$s with filter %3$s.'), $ldapname, utf8_decode($ldac_split), utf8_decode($ldapfilter))); log_error(sprintf(gettext('Now Searching in server %1$s, container %2$s with filter %3$s.'), $ldapname, utf8_decode($ldac_split), utf8_decode($ldapfilter)));
}
if ($ldapscope == "one") if ($ldapscope == "one")
$ldapfunc = "ldap_list"; $ldapfunc = "ldap_list";
else else
...@@ -1163,7 +1164,7 @@ function ldap_backed($username, $passwd, $authcfg) { ...@@ -1163,7 +1164,7 @@ function ldap_backed($username, $passwd, $authcfg) {
if ($debug) { if ($debug) {
$userdn = isset($authcfg['ldap_utf8']) ? utf8_decode($userdn) : $userdn; $userdn = isset($authcfg['ldap_utf8']) ? utf8_decode($userdn) : $userdn;
log_auth(sprintf(gettext('Logged in successfully as %1$s via LDAP server %2$s with DN = %3$s.'), $username, $ldapname, $userdn)); log_error(sprintf(gettext('Logged in successfully as %1$s via LDAP server %2$s with DN = %3$s.'), $username, $ldapname, $userdn));
} }
/* At this point we are bound to LDAP so the user was auth'd okay. Close connection. */ /* At this point we are bound to LDAP so the user was auth'd okay. Close connection. */
...@@ -1366,8 +1367,8 @@ function session_auth() { ...@@ -1366,8 +1367,8 @@ function session_auth() {
$_SESSION['Username'] = $_POST['usernamefld']; $_SESSION['Username'] = $_POST['usernamefld'];
$_SESSION['last_access'] = time(); $_SESSION['last_access'] = time();
$_SESSION['protocol'] = $config['system']['webgui']['protocol']; $_SESSION['protocol'] = $config['system']['webgui']['protocol'];
if(! isset($config['system']['webgui']['quietlogin'])) { if (!isset($config['system']['webgui']['quietlogin'])) {
log_auth(sprintf(gettext("Successful login for user '%1\$s' from: %2\$s"), $_POST['usernamefld'], $_SERVER['REMOTE_ADDR'])); log_error(sprintf(gettext("Successful login for user '%1\$s' from: %2\$s"), $_POST['usernamefld'], $_SERVER['REMOTE_ADDR']));
} }
if (isset($_POST['postafterlogin'])) if (isset($_POST['postafterlogin']))
return true; return true;
...@@ -1380,7 +1381,7 @@ function session_auth() { ...@@ -1380,7 +1381,7 @@ function session_auth() {
} else { } else {
/* give the user an error message */ /* give the user an error message */
$_SESSION['Login_Error'] = "Username or Password incorrect"; $_SESSION['Login_Error'] = "Username or Password incorrect";
log_auth("webConfigurator authentication error for '{$_POST['usernamefld']}' from {$_SERVER['REMOTE_ADDR']}"); log_error("webConfigurator authentication error for '{$_POST['usernamefld']}' from {$_SERVER['REMOTE_ADDR']}");
if(isAjax()) { if(isAjax()) {
echo "showajaxmessage('{$_SESSION['Login_Error']}');"; echo "showajaxmessage('{$_SESSION['Login_Error']}');";
return; return;
......
...@@ -1103,34 +1103,21 @@ function get_interface_list($mode = "active", $keyby = "physical", $vfaces = "") ...@@ -1103,34 +1103,21 @@ function get_interface_list($mode = "active", $keyby = "physical", $vfaces = "")
* RESULT * RESULT
* null * null
******/ ******/
function log_error($error) { function log_error($error)
{
global $g; global $g;
$page = $_SERVER['SCRIPT_NAME']; $page = $_SERVER['SCRIPT_NAME'];
if (empty($page)) { if (empty($page)) {
$files = get_included_files(); $files = get_included_files();
$page = basename($files[0]); $page = basename($files[0]);
} }
syslog(LOG_ERR, "$page: $error"); syslog(LOG_ERR, "$page: $error");
if ($g['debug'])
syslog(LOG_WARNING, var_dump(debug_backtrace()));
return;
}
/****f* util/log_auth if ($g['debug']) {
* NAME
* log_auth - 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())); syslog(LOG_WARNING, var_dump(debug_backtrace()));
return; }
} }
/****f* util/exec_command /****f* util/exec_command
......
<?php <?php
/*
$Id$
xmlrpc.php /*
Copyright (C) 2009, 2010 Scott Ullrich Copyright (C) 2009, 2010 Scott Ullrich
Copyright (C) 2005 Colin Smith Copyright (C) 2005 Colin Smith
All rights reserved. All rights reserved.
...@@ -84,8 +82,9 @@ $exec_php_sig = array( ...@@ -84,8 +82,9 @@ $exec_php_sig = array(
) )
); );
function xmlrpc_authfail() { function xmlrpc_authfail()
log_auth("webConfigurator authentication error for 'admin' from {$_SERVER['REMOTE_ADDR']}"); {
log_error("webConfigurator authentication error for 'admin' from {$_SERVER['REMOTE_ADDR']}");
} }
function exec_php_xmlrpc($raw_params) { function exec_php_xmlrpc($raw_params) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment