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
a572da5c
Commit
a572da5c
authored
Oct 11, 2013
by
Leigh B Stoller
Browse files
Fix for Frontier dates, which represents them as a struct.
parent
59bd7625
Changes
1
Hide whitespace changes
Inline
Side-by-side
protogeni/lib/GeniCM.pm.in
View file @
a572da5c
...
...
@@ -5063,13 +5063,18 @@ sub CreateSliceFromCertificate($$)
}
my
$
expires
=
$
credential
->
expires
();
#
This
is
already
a
localtime
.
my
$
when
=
timelocal
(
strptime
($
expires
));
my
$
diff
=
$
when
-
time
();
if
($
diff
>
(
3600
*
24
*
$
max_sliver_lifetime
))
{
#
Shorten
to
policy
maximum
.
Okay
to
use
a
unix
time
.
my
$
when
=
eval
{
timelocal
(
strptime
($
expires
));
};
if
($@)
{
$
expires
=
time
()
+
(
3600
*
$
max_sliver_lifetime
);
}
else
{
my
$
diff
=
$
when
-
time
();
if
($
diff
>
(
3600
*
24
*
$
max_sliver_lifetime
))
{
#
Shorten
to
policy
maximum
.
Okay
to
use
a
unix
time
.
$
expires
=
time
()
+
(
3600
*
$
max_sliver_lifetime
);
}
}
$
slice
->
SetExpiration
($
expires
);
$
slice
->
SetPublicID
();
return
$
slice
;
...
...
@@ -6400,8 +6405,17 @@ sub SetSliceExpiration($$$@)
}
if
(
defined
($
expiration
))
{
#
Gack
,
why
does
Frontier
do
this
.
It
is
stupid
.
if
(
ref
($
expiration
)
eq
'Frontier::RPC2::DateTime::ISO8601'
)
{
$
expiration
=
$
expiration
->
value
;
}
#
Convert
to
a
localtime
.
$
when
=
timegm
(
strptime
($
expiration
));
$
when
=
eval
{
timegm
(
strptime
($
expiration
));
};
if
($@)
{
$
message
=
$@;
goto
bad
;
}
if
(
!defined($when)) {
$
message
=
"Could not parse expiration"
;
goto
bad
;
...
...
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