From: Max Kanat-Alexander Date: Mon, 6 Dec 2010 19:01:36 +0000 (-0800) Subject: Bug 617030 - Add an error code for json_rpc_invalid_callback, and fix the X-Git-Tag: bugzilla-4.0rc2~43 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=072a131593273cc81483ea1b1e0fdde09c9ac69c;p=thirdparty%2Fbugzilla.git Bug 617030 - Add an error code for json_rpc_invalid_callback, and fix the regex used by _bz_callback in Bugzilla::WebService::Server::JSONRPC to accept numbers other than 0 or 1. r=LpSolit, a=mkanat --- diff --git a/Bugzilla/WebService/Constants.pm b/Bugzilla/WebService/Constants.pm index 3813c01415..383f148f53 100644 --- a/Bugzilla/WebService/Constants.pm +++ b/Bugzilla/WebService/Constants.pm @@ -137,6 +137,7 @@ use constant WS_ERROR_CODE => { xmlrpc_invalid_value => -32600, unknown_method => -32601, json_rpc_post_only => 32610, + json_rpc_invalid_callback => 32611, }; # These are the fallback defaults for errors not in ERROR_CODE. diff --git a/Bugzilla/WebService/Server/JSONRPC.pm b/Bugzilla/WebService/Server/JSONRPC.pm index b55194fdaa..49520505a2 100644 --- a/Bugzilla/WebService/Server/JSONRPC.pm +++ b/Bugzilla/WebService/Server/JSONRPC.pm @@ -381,7 +381,7 @@ sub _bz_callback { if (defined $value) { $value = trim($value); # We don't use \w because we don't want to allow Unicode here. - if ($value !~ /^[A-Za-z0-1_\.\[\]]+$/) { + if ($value !~ /^[A-Za-z0-9_\.\[\]]+$/) { ThrowUserError('json_rpc_invalid_callback', { callback => $value }); } $self->{_bz_callback} = $value;