Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
emulab
emulab-devel
Commits
58eb4767
Commit
58eb4767
authored
Jul 08, 2011
by
Jonathon Duerig
Browse files
Check to make sure the namespace is a valid version on requests.
parent
ae350a6e
Changes
3
Hide whitespace changes
Inline
Side-by-side
protogeni/lib/GeniCM.pm.in
View file @
58eb4767
...
...
@@ -522,6 +522,12 @@ sub GetTicketAuxAux($$$$$$$$$)
"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.
#
...
...
protogeni/lib/GeniCMV2.pm.in
View file @
58eb4767
...
...
@@ -1715,6 +1715,13 @@ sub ReserveVlanTags($)
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
.
#
...
...
protogeni/lib/GeniXML.pm.in
View file @
58eb4767
...
...
@@ -11,7 +11,7 @@ use Exporter;
use
vars
qw
(@
ISA
@
EXPORT
);
@
ISA
=
"Exporter"
;
@
EXPORT
=
qw
(
Parse
ParseFile
IsVersion0
FindNodes
FindNodesNS
@
EXPORT
=
qw
(
Parse
ParseFile
GetXmlVersion
IsVersion0
FindNodes
FindNodesNS
FindFirst
FindElement
FindAttr
GetNodeByVirtualId
GetLinkByVirtualId
IsLanNode
IsLocalNode
IsTunnel
GetExpires
GetBandwidth
GetIp
GetVnodeId
GetNodeId
GetVirtualId
GetInterfaceId
GetInterfaceNodeId
GetSliverId
...
...
@@ -82,10 +82,10 @@ sub ParseFile($)
}
#
Determines
the
rspec
version
of
a
node
by
examining
is
namespace
URI
sub
GetVersion
($)
sub
Get
Xml
Version
($)
{
my
($
node
)
=
@
_
;
my
$
result
=
$
RSPEC_0_1
;
my
$
result
=
undef
;
my
$
ns
=
$
node
->
namespaceURI
();
if
(
defined
($
ns
))
{
if
($
ns
=~
/
protogeni
.
net
\/
resources
\/
rspec
\/
0.1
$/)
{
...
...
@@ -104,8 +104,9 @@ sub GetVersion($)
sub
IsVersion0
($)
{
my
$
version
=
GetVersion
($
_
[
0
]);
return
$
version
eq
$
RSPEC_0_1
||
$
version
eq
$
RSPEC_0_2
;
my
$
version
=
GetXmlVersion
($
_
[
0
]);
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
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment