mirror of
https://gitlab.com/davical-project/davical.git
synced 2026-01-27 00:33:34 +00:00
Make the log lines have consistent prefixes
This commit is contained in:
parent
af458f9d90
commit
1077714a83
@ -451,7 +451,7 @@ class HTTPAuthSession {
|
||||
|
||||
if (! $c->auth_cache) return 0;
|
||||
if (! isset($c->auth_cache_secret) || $c->auth_cache_secret == '') {
|
||||
dbg_error_log('LOG', "HTTPAuthSession:CheckCache: caching of credentials is enabled, but \$c->auth_cache_secret isn't set, using auth source");
|
||||
dbg_error_log('LOG', "HTTPAuth:CheckCache: caching of credentials is enabled, but \$c->auth_cache_secret isn't set, using auth source");
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -463,14 +463,14 @@ class HTTPAuthSession {
|
||||
$salt = $cache->get($cache_ns, 'salt');
|
||||
|
||||
if (!isset($salt) || (is_bool($salt) && $salt == false) || $salt == '') {
|
||||
dbg_error_log('HTTPAuthLogin', 'CheckCache: No stored salt for %s, need to use auth source', $username);
|
||||
dbg_error_log('HTTPAuth', 'CheckCache: No stored salt for %s, need to use auth source', $username);
|
||||
return 0;
|
||||
}
|
||||
|
||||
# The hashed password to fetch
|
||||
$hash = $this->_MakeHash($password, $salt);
|
||||
if (! isset($hash)) {
|
||||
dbg_error_log('LOG', 'HTTPAuthSession:CheckCache: failed to generate hash of credential, using auth source');
|
||||
dbg_error_log('LOG', 'HTTPAuth:CheckCache: failed to generate hash of credential, using auth source');
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -478,15 +478,15 @@ class HTTPAuthSession {
|
||||
|
||||
if (isset($cached_credentials)) {
|
||||
if ($cached_credentials === 'pass') {
|
||||
dbg_error_log('HTTPAuthLogin', 'CheckCache: Cached credentials for %s are good and valid', $username);
|
||||
dbg_error_log('HTTPAuth', 'CheckCache: Cached credentials for %s are good and valid', $username);
|
||||
return 1;
|
||||
|
||||
} else if ($cached_credentials === 'fail') {
|
||||
dbg_error_log('HTTPAuthLogin', 'CheckCache: Cached credentials for %s are good and invalid', $username);
|
||||
dbg_error_log('HTTPAuth', 'CheckCache: Cached credentials for %s are good and invalid', $username);
|
||||
return 2;
|
||||
}
|
||||
|
||||
dbg_error_log('HTTPAuthLogin', 'CheckCache: No stored salted password for %s, need to use auth source', $username);
|
||||
dbg_error_log('HTTPAuth', 'CheckCache: No stored salted password for %s, need to use auth source', $username);
|
||||
}
|
||||
|
||||
# All hope is lost, we must have failed to find anything decent.
|
||||
@ -502,7 +502,7 @@ class HTTPAuthSession {
|
||||
|
||||
if (! $c->auth_cache) return 0;
|
||||
if (! isset($c->auth_cache_secret) || $c->auth_cache_secret === '') {
|
||||
dbg_error_log('LOG', "HTTPAuthSession:CheckCache: caching of credentials is enabled, \$c->auth_cache_secret isn't set, not caching credential");
|
||||
dbg_error_log('LOG', "HTTPAuth:CheckCache: caching of credentials is enabled, \$c->auth_cache_secret isn't set, not caching credential");
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -513,14 +513,14 @@ class HTTPAuthSession {
|
||||
} else if ($state === 'fail') {
|
||||
$expiry = $c->auth_cache_fail;
|
||||
} else {
|
||||
dbg_error_log('ERROR', 'HTTPCheckCache: SetCache: Unexpected state %s, bailing out from caching credential.', $state);
|
||||
dbg_error_log('ERROR', 'HTTPAuth:CheckCache: SetCache: Unexpected state %s, bailing out from caching credential.', $state);
|
||||
return 0;
|
||||
}
|
||||
|
||||
# Only cache if the expiry is set to non-zero. This allows disabling
|
||||
# caching on a pass or fail basis.
|
||||
if ($expiry == 0) {
|
||||
dbg_error_log('ERROR', 'HTTPCheckCache: SetCache: Expiry set to 0, not caching credential.', $state);
|
||||
dbg_error_log('ERROR', 'HTTPAuth:CheckCache: SetCache: Expiry set to 0, not caching credential.', $state);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -540,7 +540,7 @@ class HTTPAuthSession {
|
||||
# case scenario is that we won't access the cached credentials and
|
||||
# need to fail back to the full authentication source.
|
||||
if (! $cache->set($cache_ns, 'salt', $salt) ) {
|
||||
dbg_error_log('ERROR', 'HTTPCheckCache: SetCache: Failed to store salt, bailing out from caching credential.');
|
||||
dbg_error_log('ERROR', 'HTTPAuth:CheckCache: SetCache: Failed to store salt, bailing out from caching credential.');
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@ -548,12 +548,12 @@ class HTTPAuthSession {
|
||||
# The hashed password to store
|
||||
$hash = $this->_MakeHash($password, $salt);
|
||||
if (! isset($hash)) {
|
||||
dbg_error_log('ERROR', 'HTTPCheckCache: SetCache: Failed to generate hash, bailing out from caching credential.');
|
||||
dbg_error_log('ERROR', 'HTTPAuth:CheckCache: SetCache: Failed to generate hash, bailing out from caching credential.');
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (! $cache->set($cache_ns, $hash, $state, $expiry) ) {
|
||||
dbg_error_log('ERROR', 'HTTPCheckCache: SetCache: Failed to store credential.');
|
||||
dbg_error_log('ERROR', 'HTTPAuth:CheckCache: SetCache: Failed to store credential.');
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@ -66,6 +66,5 @@ SQL Query 1 Result:
|
||||
user_no: >1001<
|
||||
username: >ldap1<
|
||||
|
||||
No stored salt for ldap1, need to use auth source
|
||||
No salt for ldap1 found, passed
|
||||
No cached credentials found, passed
|
||||
|
||||
@ -74,9 +74,8 @@ my $cached_creds = 0;
|
||||
|
||||
if (defined $request_id) {
|
||||
while (<$log>) {
|
||||
if (/davical: $request_id: ALL: HTTPAuthLogin:CheckCache: (.*)/) {
|
||||
if (/davical: $request_id: ALL: HTTPAuth:CheckCache: (.*)/) {
|
||||
my $msg = $1;
|
||||
print "$msg\n";
|
||||
if ($msg =~ /^No stored salt for ldap1,/) {
|
||||
$no_salt = 1;
|
||||
} elsif ($msg =~ /^Cached credentials for ldap1 are good/) {
|
||||
|
||||
@ -76,7 +76,7 @@ my $cached_creds = 0;
|
||||
|
||||
if (defined $request_id) {
|
||||
while (<$log>) {
|
||||
if (/davical: $request_id: ALL: HTTPAuthLogin:CheckCache: (.*)/) {
|
||||
if (/davical: $request_id: ALL: HTTPAuth:CheckCache: (.*)/) {
|
||||
my $msg = $1;
|
||||
if ($msg =~ /^No salt, assuming no cached credentials/) {
|
||||
$no_salt = 1;
|
||||
|
||||
@ -73,7 +73,7 @@ my $cached_creds = 0;
|
||||
|
||||
if (defined $request_id) {
|
||||
while (<$log>) {
|
||||
if (/davical: $request_id: ALL: HTTPAuthLogin:CheckCache: (.*)/) {
|
||||
if (/davical: $request_id: ALL: HTTPAuth:CheckCache: (.*)/) {
|
||||
my $msg = $1;
|
||||
|
||||
if ($msg =~ /^Cached credentials for ldap2/) {
|
||||
|
||||
@ -79,7 +79,7 @@ my $ldap_conn = 0;
|
||||
|
||||
if (defined $request_id) {
|
||||
while (<$log>) {
|
||||
if (/davical: $request_id: ALL: (HTTPAuthLogin:CheckCache|LDAP:drivers_ldap ): (.*)/) {
|
||||
if (/davical: $request_id: ALL: (HTTPAuth:CheckCache|LDAP:drivers_ldap ): (.*)/) {
|
||||
my $msg = $2;
|
||||
if ($msg =~ /^No stored salt for ldap2,/) {
|
||||
$no_salt = 1;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user