Commit 58eb4767 authored by Jonathon Duerig's avatar Jonathon Duerig
Browse files

Check to make sure the namespace is a valid version on requests.

parent ae350a6e
...@@ -522,6 +522,12 @@ sub GetTicketAuxAux($$$$$$$$$) ...@@ -522,6 +522,12 @@ sub GetTicketAuxAux($$$$$$$$$)
"Error Parsing rspec XML"); "Error Parsing rspec XML");
} }
my $rspecVersion = GeniXML::GetXmlVersion($rspec);
if (! defined($rspecVersion)) {
return GeniResponse->Create(GENIRESPONSE_BADARGS, undef,
"Unknown RSpec Version");
}
# #
# A sitevar controls whether external users can get any nodes. # A sitevar controls whether external users can get any nodes.
# #
......
...@@ -1715,6 +1715,13 @@ sub ReserveVlanTags($) ...@@ -1715,6 +1715,13 @@ sub ReserveVlanTags($)
goto done; goto done;
} }
my $rspecVersion = GeniXML::GetXmlVersion($rspec);
if (! defined($rspecVersion)) {
$response = GeniResponse->Create(GENIRESPONSE_BADARGS, undef,
"Unknown RSpec Version");
goto done;
}
# #
# Find the linkref for the one link we care about. # Find the linkref for the one link we care about.
# #
......
...@@ -11,7 +11,7 @@ use Exporter; ...@@ -11,7 +11,7 @@ use Exporter;
use vars qw(@ISA @EXPORT); use vars qw(@ISA @EXPORT);
@ISA = "Exporter"; @ISA = "Exporter";
@EXPORT = qw(Parse ParseFile IsVersion0 FindNodes FindNodesNS @EXPORT = qw(Parse ParseFile GetXmlVersion IsVersion0 FindNodes FindNodesNS
FindFirst FindElement FindAttr GetNodeByVirtualId GetLinkByVirtualId FindFirst FindElement FindAttr GetNodeByVirtualId GetLinkByVirtualId
IsLanNode IsLocalNode IsTunnel GetExpires GetBandwidth GetIp GetVnodeId IsLanNode IsLocalNode IsTunnel GetExpires GetBandwidth GetIp GetVnodeId
GetNodeId GetVirtualId GetInterfaceId GetInterfaceNodeId GetSliverId GetNodeId GetVirtualId GetInterfaceId GetInterfaceNodeId GetSliverId
...@@ -82,10 +82,10 @@ sub ParseFile($) ...@@ -82,10 +82,10 @@ sub ParseFile($)
} }
# Determines the rspec version of a node by examining is namespace URI # Determines the rspec version of a node by examining is namespace URI
sub GetVersion($) sub GetXmlVersion($)
{ {
my ($node) = @_; my ($node) = @_;
my $result = $RSPEC_0_1; my $result = undef;
my $ns = $node->namespaceURI(); my $ns = $node->namespaceURI();
if (defined($ns)) { if (defined($ns)) {
if ($ns =~ /protogeni.net\/resources\/rspec\/0.1$/) { if ($ns =~ /protogeni.net\/resources\/rspec\/0.1$/) {
...@@ -104,8 +104,9 @@ sub GetVersion($) ...@@ -104,8 +104,9 @@ sub GetVersion($)
sub IsVersion0($) sub IsVersion0($)
{ {
my $version = GetVersion($_[0]); my $version = GetXmlVersion($_[0]);
return $version eq $RSPEC_0_1 || $version eq $RSPEC_0_2; return defined($version)
&& ($version eq $RSPEC_0_1 || $version eq $RSPEC_0_2);
} }
# Returns a NodeList for a given XPath using a given node as # Returns a NodeList for a given XPath using a given node as
......
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