Commit b11e7973 authored by Leigh B Stoller's avatar Leigh B Stoller
Browse files

Fix for issue #299 ... waiting for Rob to test before closing.

parent b7d65aa3
...@@ -144,7 +144,7 @@ sub StartMonitor(); ...@@ -144,7 +144,7 @@ sub StartMonitor();
sub StartMonitorInternal(;$@); sub StartMonitorInternal(;$@);
sub DoImageTrackerStuff($$$$$$$); sub DoImageTrackerStuff($$$$$$$);
sub DenyExtensionInternal($); sub DenyExtensionInternal($);
sub ExtendInternal($$$$); sub ExtendInternal($$$$$);
# #
# Parse command arguments. Once we return from getopts, all that should be # Parse command arguments. Once we return from getopts, all that should be
...@@ -1543,7 +1543,7 @@ sub DoExtend() ...@@ -1543,7 +1543,7 @@ sub DoExtend()
my $seconds = $granted * 3600; my $seconds = $granted * 3600;
$seconds *= 24 if (!$inhours); $seconds *= 24 if (!$inhours);
if ($errcode = ExtendInternal($slice, $seconds, 0, \$errmsg)) { if ($errcode = ExtendInternal($slice, $seconds, 0, 0, \$errmsg)) {
goto bad; goto bad;
} }
} }
...@@ -1660,9 +1660,9 @@ sub DoExtend() ...@@ -1660,9 +1660,9 @@ sub DoExtend()
} }
exit($errcode); exit($errcode);
} }
sub ExtendInternal($$$$) sub ExtendInternal($$$$$)
{ {
my ($slice, $seconds, $force, $perrmsg) = @_; my ($slice, $seconds, $force, $nolockdown, $perrmsg) = @_;
my $lockdown = 0; my $lockdown = 0;
my $errcode = -1; my $errcode = -1;
my $errmsg; my $errmsg;
...@@ -1671,7 +1671,7 @@ sub ExtendInternal($$$$) ...@@ -1671,7 +1671,7 @@ sub ExtendInternal($$$$)
my $oldexpires = $slice->expires(); my $oldexpires = $slice->expires();
# Lockdown on admin extensions longer then XX days. # Lockdown on admin extensions longer then XX days.
if (defined($this_user) && $this_user->IsAdmin() && if (defined($this_user) && $this_user->IsAdmin() && !$nolockdown &&
($seconds / (24 * 60 * 60)) > 10) { ($seconds / (24 * 60 * 60)) > 10) {
$lockdown = 1 $lockdown = 1
} }
...@@ -3823,9 +3823,16 @@ sub DoSchedTerminate() ...@@ -3823,9 +3823,16 @@ sub DoSchedTerminate()
# a legal thing to do (although our CM actually permits this). # a legal thing to do (although our CM actually permits this).
# #
if ($expires_time < time() + ($days * 3600 * 24)) { if ($expires_time < time() + ($days * 3600 * 24)) {
my $seconds = (time() + ($days * 3600 * 24)) - $expires_time; my $seconds;
if ($errcode = ExtendInternal($slice, $seconds, 1, \$errmsg)) { if ($slice->IsExpired()) {
# ExtendInternal handles expired slices differently.
$seconds = ($days * 3600 * 24);
}
else {
$seconds = (time() + ($days * 3600 * 24)) - $expires_time;
}
if ($errcode = ExtendInternal($slice, $seconds, 1, 1, \$errmsg)) {
goto bad; goto bad;
} }
} }
......
Supports Markdown
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