summaryrefslogtreecommitdiffstats
path: root/Bugzilla/ModPerl
diff options
context:
space:
mode:
authorDylan William Hardison <dylan@hardison.net>2018-03-30 22:20:49 +0200
committerGitHub <noreply@github.com>2018-03-30 22:20:49 +0200
commit6fb33c210e6917f32056dcffd00e55d0d97302bc (patch)
treef5da90f04e749a7b80f4fd469924459f52d127f7 /Bugzilla/ModPerl
parent2140cf79a1d1adc96d66c800871bf59e365ece40 (diff)
downloadbugzilla-6fb33c210e6917f32056dcffd00e55d0d97302bc.tar.gz
bugzilla-6fb33c210e6917f32056dcffd00e55d0d97302bc.tar.xz
Bug 1450343 - Make the SES handler use Bugzilla::Logging and log more details
Diffstat (limited to 'Bugzilla/ModPerl')
-rw-r--r--Bugzilla/ModPerl/BasicAuth.pm13
1 files changed, 9 insertions, 4 deletions
diff --git a/Bugzilla/ModPerl/BasicAuth.pm b/Bugzilla/ModPerl/BasicAuth.pm
index e93680e9d..7248a19f3 100644
--- a/Bugzilla/ModPerl/BasicAuth.pm
+++ b/Bugzilla/ModPerl/BasicAuth.pm
@@ -25,18 +25,22 @@ use warnings;
# AUTH_VAR_NAME and AUTH_VAR_PASS are the names of variables defined in
# `localconfig` which hold the authentication credentials.
-use Apache2::Const -compile => qw(OK HTTP_UNAUTHORIZED);
+use Apache2::Const -compile => qw(OK HTTP_UNAUTHORIZED); ## no critic (Freenode::ModPerl)
+use Bugzilla::Logging;
use Bugzilla ();
sub handler {
my $r = shift;
my ($status, $password) = $r->get_basic_auth_pw;
- return $status if $status != Apache2::Const::OK;
+ if ($status != Apache2::Const::OK) {
+ WARN("Got non-OK status: $status when trying to get password");
+ return $status
+ }
my $auth_var_name = $ENV{AUTH_VAR_NAME};
my $auth_var_pass = $ENV{AUTH_VAR_PASS};
unless ($auth_var_name && $auth_var_pass) {
- warn "AUTH_VAR_NAME and AUTH_VAR_PASS environmental vars not set\n";
+ ERROR('AUTH_VAR_NAME and AUTH_VAR_PASS environmental vars not set');
$r->note_basic_auth_failure;
return Apache2::Const::HTTP_UNAUTHORIZED;
}
@@ -44,13 +48,14 @@ sub handler {
my $auth_user = Bugzilla->localconfig->{$auth_var_name};
my $auth_pass = Bugzilla->localconfig->{$auth_var_pass};
unless ($auth_user && $auth_pass) {
- warn "$auth_var_name and $auth_var_pass not configured\n";
+ ERROR("$auth_var_name and $auth_var_pass not configured");
$r->note_basic_auth_failure;
return Apache2::Const::HTTP_UNAUTHORIZED;
}
unless ($r->user eq $auth_user && $password eq $auth_pass) {
$r->note_basic_auth_failure;
+ WARN('username and password do not match');
return Apache2::Const::HTTP_UNAUTHORIZED;
}