From fcf51896ea64862b43e651657ea775319c1abd31 Mon Sep 17 00:00:00 2001 From: Frédéric Buclin Date: Sat, 6 Feb 2010 18:53:32 +0100 Subject: Bug 515568: handle_login() doesn't check $@ after eval r/a=mkanat --- Bugzilla/WebService/Constants.pm | 2 ++ Bugzilla/WebService/Server.pm | 3 +++ template/en/default/global/code-error.html.tmpl | 3 +++ 3 files changed, 8 insertions(+) diff --git a/Bugzilla/WebService/Constants.pm b/Bugzilla/WebService/Constants.pm index 7fd7e2ae8..a51389faa 100644 --- a/Bugzilla/WebService/Constants.pm +++ b/Bugzilla/WebService/Constants.pm @@ -112,6 +112,8 @@ use constant WS_ERROR_CODE => { invalid_user_group => 504, user_access_by_id_denied => 505, user_access_by_match_denied => 505, + # Fatal errors (must be negative). + unknown_method => -32601, }; # These are the fallback defaults for errors not in ERROR_CODE. diff --git a/Bugzilla/WebService/Server.pm b/Bugzilla/WebService/Server.pm index 115c7df89..9571e8030 100644 --- a/Bugzilla/WebService/Server.pm +++ b/Bugzilla/WebService/Server.pm @@ -18,9 +18,12 @@ package Bugzilla::WebService::Server; use strict; +use Bugzilla::Error; + sub handle_login { my ($self, $class, $method, $full_method) = @_; eval "require $class"; + ThrowCodeError('unknown_method', {method => $full_method}) if $@; return if ($class->login_exempt($method) and !defined Bugzilla->input_params->{Bugzilla_login}); Bugzilla->login(); diff --git a/template/en/default/global/code-error.html.tmpl b/template/en/default/global/code-error.html.tmpl index 2c2eb9891..b8a87fb58 100644 --- a/template/en/default/global/code-error.html.tmpl +++ b/template/en/default/global/code-error.html.tmpl @@ -483,6 +483,9 @@ I could not figure out what you wanted to do. [% END %] + [% ELSIF error == "unknown_method" %] + The requested method '[% method FILTER html %]' was not found. + [% ELSIF error == "usage_mode_invalid" %] '[% invalid_usage_mode FILTER html %]' is not a valid usage mode. -- cgit v1.2.3-24-g4f1b