|
|
|
@ -282,6 +282,12 @@ sub check_init_running {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Parameter: device
|
|
|
|
|
sub check_device_encryption {
|
|
|
|
|
return (system("$CB_SCRIPT","is_encrypted",$1) == 0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
sub is_harddisk_available {
|
|
|
|
|
my @all_disks = &exec_cb_script("get_available_disks");
|
|
|
|
|
return @all_disks > 0;
|
|
|
|
@ -335,9 +341,13 @@ sub mount_vol {
|
|
|
|
|
if (&check_mounted($device)) {
|
|
|
|
|
$pagedata->setValue('Data.Warning', 'IsMounted');
|
|
|
|
|
} else {
|
|
|
|
|
open(PW_INPUT, "| $CB_SCRIPT crypto-up $device");
|
|
|
|
|
print PW_INPUT $pw;
|
|
|
|
|
close(PW_INPUT);
|
|
|
|
|
if ($pw eq '') {
|
|
|
|
|
&exec_cb_script("crypto-up", $device);
|
|
|
|
|
} else {
|
|
|
|
|
open(PW_INPUT, "| $CB_SCRIPT crypto-up $device");
|
|
|
|
|
print PW_INPUT $pw;
|
|
|
|
|
close(PW_INPUT);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -541,6 +551,7 @@ if ( ! &check_ssl()) {
|
|
|
|
|
}
|
|
|
|
|
################ mount_do ########################
|
|
|
|
|
} elsif ($action eq 'mount_do') {
|
|
|
|
|
my $is_encrypted = &check_device_encryption($device) if ($device ne '');
|
|
|
|
|
if ($device eq '') {
|
|
|
|
|
&debug_msg(DEBUG_INFO, "invalid device: " . $query->param('device'));
|
|
|
|
|
$pagedata->setValue('Data.Warning', 'InvalidDevice');
|
|
|
|
@ -556,13 +567,17 @@ if ( ! &check_ssl()) {
|
|
|
|
|
} elsif (&check_mounted($device)) {
|
|
|
|
|
$pagedata->setValue('Data.Warning', 'IsMounted');
|
|
|
|
|
$pagedata->setValue('Data.Action', 'show_volume');
|
|
|
|
|
} elsif ($query->param('crypto_password') eq '') {
|
|
|
|
|
} elsif ($is_encrypted && ($query->param('crypto_password') eq '')) {
|
|
|
|
|
# leeres Passwort
|
|
|
|
|
$pagedata->setValue('Data.Warning', 'EmptyCryptoPassword');
|
|
|
|
|
$pagedata->setValue('Data.Action', 'show_volume');
|
|
|
|
|
} else {
|
|
|
|
|
# mounten
|
|
|
|
|
&mount_vol($device, $query->param('crypto_password'));
|
|
|
|
|
if ($is_encrypted) {
|
|
|
|
|
&mount_vol($device, $query->param('crypto_password'));
|
|
|
|
|
} else {
|
|
|
|
|
&mount_vol($device);
|
|
|
|
|
}
|
|
|
|
|
if (!&check_mounted($device)) {
|
|
|
|
|
$pagedata->setValue('Data.Warning', 'MountFailed');
|
|
|
|
|
$pagedata->setValue('Data.Action', 'show_volume');
|
|
|
|
@ -747,11 +762,11 @@ if ( ! &check_ssl()) {
|
|
|
|
|
&& $current_admin_pw ne $query->param('current_admin_password')) {
|
|
|
|
|
$pagedata->setValue('Data.Warning', 'WrongAdminPassword');
|
|
|
|
|
$pagedata->setValue('Data.Action', 'form_init_partition');
|
|
|
|
|
} elsif ($query->param('crypto_password') ne $query->param('crypto_password2')) {
|
|
|
|
|
} elsif (defined($query->param('encryption')) && ($query->param('crypto_password') ne $query->param('crypto_password2'))) {
|
|
|
|
|
# different crypto-passwords
|
|
|
|
|
$pagedata->setValue('Data.Warning', 'DifferentCryptoPasswords');
|
|
|
|
|
$pagedata->setValue('Data.Action', 'form_init_partition');
|
|
|
|
|
} elsif ($query->param('crypto_password') eq '') {
|
|
|
|
|
} elsif (defined($query->param('encryption')) && ($query->param('crypto_password') eq '')) {
|
|
|
|
|
# empty password
|
|
|
|
|
$pagedata->setValue('Data.Warning', 'EmptyCryptoPassword');
|
|
|
|
|
$pagedata->setValue('Data.Action', 'form_init_partition');
|
|
|
|
@ -760,7 +775,13 @@ if ( ! &check_ssl()) {
|
|
|
|
|
$pagedata->setValue('Data.Warning', 'InitNotConfirmed');
|
|
|
|
|
$pagedata->setValue('Data.Action', 'form_init_partition');
|
|
|
|
|
} else {
|
|
|
|
|
if (&volume_init($device,$query->param('crypto_password'))) {
|
|
|
|
|
my $init_result;
|
|
|
|
|
if (defined($query->param('encryption'))) {
|
|
|
|
|
$init_result = &volume_init($device,$query->param('crypto_password'));
|
|
|
|
|
} else {
|
|
|
|
|
$init_result = &volume_init($device);
|
|
|
|
|
}
|
|
|
|
|
if ($init_result) {
|
|
|
|
|
#$pagedata->setValue('Data.Success', 'InitRunning');
|
|
|
|
|
$pagedata->setValue('Data.Action', 'show_volume');
|
|
|
|
|
} else {
|
|
|
|
@ -863,28 +884,33 @@ $pagedata->setValue('Data.QueryString', "$querystring") if ($querystring ne '');
|
|
|
|
|
|
|
|
|
|
$pagedata->setValue('Data.Version', CRYPTOBOX_VERSION);
|
|
|
|
|
|
|
|
|
|
my ($one_disk, $one_name, $isActive);
|
|
|
|
|
my ($one_disk, $one_name, $isActive, $isEncrypted);
|
|
|
|
|
my $avail_counter = 0; my $active_counter = 0; my $passive_counter = 0;
|
|
|
|
|
for $one_disk (&get_available_disks()) {
|
|
|
|
|
$one_name = &get_disk_name($one_disk);
|
|
|
|
|
$isEncrypted = &check_device_encryption($one_disk);
|
|
|
|
|
$pagedata->setValue("Data.Disks.available.${avail_counter}.device",$one_disk);
|
|
|
|
|
$pagedata->setValue("Data.Disks.available.${avail_counter}.name",$one_name);
|
|
|
|
|
$pagedata->setValue("Data.Disks.available.${avail_counter}.encryption", $isEncrypted? 1 : 0);
|
|
|
|
|
$isActive = &check_mounted($one_disk);
|
|
|
|
|
if ($isActive) {
|
|
|
|
|
$pagedata->setValue("Data.Disks.available.${avail_counter}.isActive",1);
|
|
|
|
|
$pagedata->setValue("Data.Disks.active.${active_counter}.device",$one_disk);
|
|
|
|
|
$pagedata->setValue("Data.Disks.active.${active_counter}.name",$one_name);
|
|
|
|
|
$pagedata->setValue("Data.Disks.active.${avail_counter}.encryption", $isEncrypted? 1 : 0);
|
|
|
|
|
$active_counter++;
|
|
|
|
|
} else {
|
|
|
|
|
$pagedata->setValue("Data.Disks.available.${avail_counter}.isActive",0);
|
|
|
|
|
$pagedata->setValue("Data.Disks.passive.${passive_counter}.device",$one_disk);
|
|
|
|
|
$pagedata->setValue("Data.Disks.passive.${passive_counter}.name",$one_name);
|
|
|
|
|
$pagedata->setValue("Data.Disks.passive.${avail_counter}.encryption", $isEncrypted? 1 : 0);
|
|
|
|
|
$passive_counter++;
|
|
|
|
|
}
|
|
|
|
|
if ($device eq $one_disk) {
|
|
|
|
|
$pagedata->setValue('Data.CurrentDisk.device', $one_disk);
|
|
|
|
|
$pagedata->setValue('Data.CurrentDisk.name', $one_name);
|
|
|
|
|
$pagedata->setValue('Data.CurrentDisk.active', $isActive? 1 : 0);
|
|
|
|
|
$pagedata->setValue("Data.CurrentDisk.encryption", $isEncrypted? 1 : 0);
|
|
|
|
|
# retrieve capacity information if the device is mounted
|
|
|
|
|
if (&check_mounted($device)) {
|
|
|
|
|
my $cap_info = &exec_cb_script("get_capacity_info",$device);
|
|
|
|
|