Check for suspension and termination when changing the root password

feature/node-rewrite
Sven Slootweg 12 years ago
parent b24eff0cce
commit 753e122d81

@ -628,6 +628,16 @@ class Container extends CPHPDatabaseRecordClass
}
public function SetRootPassword($password)
{
if($this->sStatus == CVM_STATUS_SUSPENDED)
{
throw new ContainerSuspendedException("The root password cannot be changed, because the container is suspended.", 1, $this->sInternalId);
}
elseif($this->sStatus == CVM_STATUS_TERMINATED)
{
throw new ContainerTerminatedException("The root password cannot be changed, because the container is terminated.", 1, $this->sInternalId);
}
else
{
$sPassword = escapeshellarg($password);
@ -635,6 +645,7 @@ class Container extends CPHPDatabaseRecordClass
'userpasswd' => "root:{$sPassword}"
));
}
}
public function EnableTunTap()
{

Loading…
Cancel
Save