diff options
author | dkl%redhat.com <> | 2009-01-26 21:40:22 +0100 |
---|---|---|
committer | dkl%redhat.com <> | 2009-01-26 21:40:22 +0100 |
commit | c49af480dcb59aadfa1edb76f246c68917a59765 (patch) | |
tree | 86ee9438a99ae209ea0fd8bbc5eddc2376b30b1c /Bugzilla/WebService/Bug.pm | |
parent | 2319f5f6660df8ed65c44dc29a5b2f42f9d81629 (diff) | |
download | bugzilla-c49af480dcb59aadfa1edb76f246c68917a59765.tar.gz bugzilla-c49af480dcb59aadfa1edb76f246c68917a59765.tar.xz |
Bug 473646 - WebService methods should check list parameters for scalars and convert before use
Patch by Dave Lawrence <dkl@redhat.com> - r/a=mkanat
Diffstat (limited to 'Bugzilla/WebService/Bug.pm')
-rwxr-xr-x | Bugzilla/WebService/Bug.pm | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/Bugzilla/WebService/Bug.pm b/Bugzilla/WebService/Bug.pm index 1c0df32ac..21645af3d 100755 --- a/Bugzilla/WebService/Bug.pm +++ b/Bugzilla/WebService/Bug.pm @@ -27,7 +27,7 @@ use Bugzilla::Constants; use Bugzilla::Error; use Bugzilla::Field; use Bugzilla::WebService::Constants; -use Bugzilla::WebService::Util qw(filter); +use Bugzilla::WebService::Util qw(filter validate); use Bugzilla::Bug; use Bugzilla::BugMail; use Bugzilla::Util qw(trim); @@ -67,7 +67,8 @@ BEGIN { *get_bugs = \&get } ########### sub comments { - my ($self, $params) = @_; + my ($self, $params) = validate(@_, 'bug_ids', 'comment_ids'); + if (!(defined $params->{bug_ids} || defined $params->{comment_ids})) { ThrowCodeError('params_required', { function => 'Bug.comments', @@ -145,7 +146,8 @@ sub _translate_comment { } sub get { - my ($self, $params) = @_; + my ($self, $params) = validate(@_, 'ids'); + my $ids = $params->{ids}; defined $ids || ThrowCodeError('param_required', { param => 'ids' }); @@ -162,7 +164,7 @@ sub get { # it can be called as the following: # $call = $rpc->call( 'Bug.get_history', { ids => [1,2] }); sub get_history { - my ($self, $params) = @_; + my ($self, $params) = validate(@_, 'ids'); my $ids = $params->{ids}; defined $ids || ThrowCodeError('param_required', { param => 'ids' }); |