Commit b4a2cfc6 authored by Leigh Stoller's avatar Leigh Stoller

A bit of argument error checking.

parent 1586f1b3
......@@ -57,6 +57,10 @@ sub FilterCredentials
my ($credentials) = @_;
my $result = [];
if (defined($credentials)) {
if (ref($credentials) ne "ARRAY") {
warn("Credentials is not an array!");
return $result;
}
foreach my $cred (@{ $credentials }) {
if (ref($cred) eq "HASH" &&
(($cred->{'geni_type'} eq "geni_sfa" &&
......
......@@ -68,7 +68,7 @@ sub CreateSlice($$)
{
my ($credential_args, $options) = @_;
if (! defined($credential_args) ||
! defined($options) ||
! defined($options) || ref($options) ne "ARRAY" ||
! exists($options->{'fields'}) ||
! exists($options->{'fields'}->{'SLICE_NAME'}))
{
......@@ -206,7 +206,7 @@ sub ModifySliceMembership()
my ($slice_urn, $credential_args, $options) = @_;
if (! defined($slice_urn) ||
! defined($credential_args) ||
! defined($options))
! defined($options) || ref($options) ne "ARRAY")
{
return GeniResponse->MalformedArgsResponse('Requires a slice urn, a list of credentials, and an options field');
}
......@@ -362,7 +362,7 @@ sub CreateSliverInfo($$$$)
{
my ($credential_args, $options) = @_;
if (! defined($credential_args) ||
! defined($options))
! defined($options) || ref($options) ne "ARRAY")
{
return GeniResponse->MalformedArgsResponse('Requires a list of credentials, and an options field');
}
......@@ -415,7 +415,8 @@ sub LookupSliverInfo($$)
{
my ($credential_args, $options) = @_;
if (! (defined($credential_args) && defined($options))) {
if (! (defined($credential_args) && defined($options) &&
ref($options) eq "ARRAY")) {
return
GeniResponse->MalformedArgsResponse('Requires a list of '.
'credentials, and an options field');
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment