Skip to content
GitLab
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
5ca81df7
Commit
5ca81df7
authored
Apr 26, 2013
by
Jonathon Duerig
Browse files
Add stricter format checking for incoming timestamps in an rspec
parent
48368b9d
Changes
2
Hide whitespace changes
Inline
Side-by-side
protogeni/lib/GeniCM.pm.in
View file @
5ca81df7
...
...
@@ -608,9 +608,8 @@ sub GetTicketAuxAux($$$$$$$$$)
#
my $expires = GeniXML::GetExpires($rspec);
if (defined($expires)) {
if (! ($expires =~ /^[-\w:.\/]+/)) {
return GeniResponse->Create(GENIRESPONSE_BADARGS, undef,
"Illegal valid_until in rspec");
if (GeniResponse::IsResponse($expires)) {
return $expires;
}
# Convert to a localtime.
my $when = str2time($expires);
...
...
@@ -2817,7 +2816,7 @@ sub SliverWorkAux($$$$$$$)
#
my
$
expires
=
GeniXML
::
GetExpires
($
rspec
);
if
(
defined
($
expires
))
{
if
(
! ($expires =~ /^[-\w:.\/]+/
)) {
if
(
GeniResponse
::
IsResponse
($
expires
))
{
$
message
=
"Illegal valid_until in rspec"
;
goto
bad
;
}
...
...
protogeni/lib/GeniXML.pm.in
View file @
5ca81df7
...
...
@@ -50,6 +50,7 @@ use XML::LibXML;
use
XML
::
LibXML
::
XPathContext
;
use
XML
::
LibXML
::
NodeList
;
use
GeniHRN
;
use
GeniResponse
;
use
GeniUtil
;
use
Carp
qw
(
cluck
carp
);
...
...
@@ -338,7 +339,18 @@ sub IsTunnel($)
sub GetExpires($)
{
my ($node) = @_;
return GetFirstText($node, "valid_until", "expires");
my $result = undef;
my $text = GetFirstText($node, "valid_until", "expires");
if (defined($text)) {
if ($text =~
/[0-9]{4}-[0-9]{1,2}-[0-9]{1,2}T[0-9]{1,2}:[0-9]{1,2}:[0-9]{1,2}Z/) {
$result = $text;
} else {
$result = GeniResponse->Create(GENIRESPONSE_ERROR, undef,
"$text: Invalid Datetime Format");
}
}
return $result;
}
sub SetExpires($$)
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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