Browse Source

implemented "is_plaintext" check

added lots of "html_escape" calls to clearsilver statements
master
lars 16 years ago
parent
commit
81adf89c56
  1. 17
      bin/cryptobox.pl
  2. 4
      templates/footer.cs
  3. 4
      templates/form_config.cs
  4. 11
      templates/form_init.cs
  5. 2
      templates/form_init_partition.cs
  6. 9
      templates/form_mount.cs
  7. 12
      templates/form_system.cs
  8. 6
      templates/form_umount.cs
  9. 4
      templates/header.cs
  10. 12
      templates/macros.cs
  11. 10
      templates/nav.cs
  12. 4
      templates/show_log.cs
  13. 2
      templates/show_status.cs
  14. 6
      templates/show_volume.cs

17
bin/cryptobox.pl

@ -282,6 +282,12 @@ sub check_init_running {
}
# Parameter: device
sub check_device_plaintext {
return (system("$CB_SCRIPT","is_plaintext",$1) == 0);
}
# Parameter: device
sub check_device_encryption {
return (system("$CB_SCRIPT","is_encrypted",$1) == 0);
@ -884,26 +890,30 @@ $pagedata->setValue('Data.QueryString', "$querystring") if ($querystring ne '');
$pagedata->setValue('Data.Version', CRYPTOBOX_VERSION);
my ($one_disk, $one_name, $isActive, $isEncrypted);
my ($one_disk, $one_name, $isActive, $isEncrypted, $isPlaintext);
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);
$isPlaintext = &check_device_plaintext($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);
$pagedata->setValue("Data.Disks.available.${avail_counter}.plaintext", $isPlaintext? 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);
$pagedata->setValue("Data.Disks.active.${active_counter}.encryption", $isEncrypted? 1 : 0);
$pagedata->setValue("Data.Disks.active.${active_counter}.plaintext", $isPlaintext? 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);
$pagedata->setValue("Data.Disks.passive.${passive_counter}.encryption", $isEncrypted? 1 : 0);
$pagedata->setValue("Data.Disks.passive.${passive_counter}.plaintext", $isPlaintext? 1 : 0);
$passive_counter++;
}
if ($device eq $one_disk) {
@ -911,6 +921,7 @@ for $one_disk (&get_available_disks()) {
$pagedata->setValue('Data.CurrentDisk.name', $one_name);
$pagedata->setValue('Data.CurrentDisk.active', $isActive? 1 : 0);
$pagedata->setValue("Data.CurrentDisk.encryption", $isEncrypted? 1 : 0);
$pagedata->setValue("Data.CurrentDisk.plaintext", $isPlaintext? 1 : 0);
# retrieve capacity information if the device is mounted
if (&check_mounted($device)) {
my $cap_info = &exec_cb_script("get_capacity_info",$device);

4
templates/footer.cs

@ -1,7 +1,7 @@
<?cs # $Id$ ?>
<?cs if:Data.Redirect ?>
<p class="warning"><a href="<?cs if:Data.Redirect.URL ?><?cs var:Data.Redirect.URL ?><?cs else ?><?cs call:link('action',Data.Redirect.Action,'','','','') ?><?cs /if ?>"><?cs var:Lang.Text.RedirectNote ?></a></p>
<p class="warning"><a href="<?cs if:Data.Redirect.URL ?><?cs var:Data.Redirect.URL ?><?cs else ?><?cs call:link('action',Data.Redirect.Action,'','','','') ?><?cs /if ?>"><?cs var:html_escape(Lang.Text.RedirectNote) ?></a></p>
<?cs /if ?>
</div><!-- end of 'words' -->
@ -13,7 +13,7 @@
<?cs /if ?>
<?cs # Version ?>
v<?cs var:Data.Version ?>&nbsp;&nbsp;
<a href="http://cryptobox.org" title="<?cs var:Lang.Text.ProjectHomePage ?>">CryptoBox-Home</a> <?cs var:Lang.Text.ProjectNote ?>&nbsp;<a href="https://systemausfall.org/senselab" title="systemausfall.org">sense.lab</a>
<a href="http://cryptobox.org" title="<?cs var:html_escape(Lang.Text.ProjectHomePage) ?>">CryptoBox-Home</a> <?cs var:html_escape(Lang.Text.ProjectNote) ?>&nbsp;<a href="https://systemausfall.org/senselab" title="systemausfall.org">sense.lab</a>
</div>
</div>

4
templates/form_config.cs

@ -1,7 +1,7 @@
<?cs # $Id$ ?>
<div id="config">
<h1><?cs var:Lang.Title.Config ?></h1>
<h1><?cs var:html_escape(Lang.Title.Config) ?></h1>
<?cs call:print_form_header() ?>
<?cs if:Data.Config.AdminPasswordIsSet ?>
@ -27,7 +27,7 @@
</select></p>
<input type="hidden" name="action" value="config_do" />
<button type="submit"><?cs var:Lang.Button.SaveConfig ?></button>
<button type="submit"><?cs var:html_escape(Lang.Button.SaveConfig) ?></button>
</form>
</div>

11
templates/form_init.cs

@ -1,16 +1,17 @@
<?cs # $Id$ ?>
<h1><?cs var:Lang.Title.Init ?></h1>
<h1><?cs var:html_escape(Lang.Title.Init) ?></h1>
<div class="init">
<?cs call:print_form_header() ?>
<p class="note"><?cs var:Lang.Text.InitWarning ?></p>
<p class="note"><?cs var:html_escape(Lang.Text.InitWarning) ?></p>
<p><label for="confirm"><?cs var:html_escape(Lang.Text.ConfirmInitHint) ?><br/>
<span class="note" id="confirmtext"><?cs var:Lang.Text.ConfirmInit ?></span></label><br/>
<span class="note" id="confirmtext"><?cs var:html_escape(Lang.Text.ConfirmInit)
?></span></label><br/>
<input type="text" id="confirm" name="confirm" size="30" maxlength="50" /></p>
<input type="hidden" name="action" value="init_do" />
<button type="submit"><?cs var:Lang.Button.DoInit ?></button>
<button type="submit"><?cs var:html_escape(Lang.Button.DoInit) ?></button>
</form>
</div>
@ -19,7 +20,7 @@
<!-- TODO: maybe place here some kind of initialization information
this should be open for different kinds of init methods (live-cd, ???)
<div class="partition_info">
<h2><?cs var:Lang.Text.PartitionInfo ?></h2>
<h2><?cs var:html_escape(Lang.Text.PartitionInfo) ?></h2>
<p><?cs var:Data.PartitionInfo ?></p>
</div>

2
templates/form_init_partition.cs

@ -4,7 +4,7 @@
<?cs call:print_form_header() ?>
<p class="note"><?cs var:Lang.Text.InitWarning ?></p>
<p class="note"><?cs var:html_escape(Lang.Text.InitWarning) ?></p>
<?cs if:Data.Config.AdminPasswordIsSet ?>
<p><label for="current_admin_password"><?cs
var:html_escape(Lang.Text.EnterCurrentAdminPassword) ?></label><br/>

9
templates/form_mount.cs

@ -6,14 +6,14 @@
<?cs else ?>
<h1><?cs var:Lang.Title.Mount ?></h1>
<h1><?cs var:html_escape(Lang.Title.Mount) ?></h1>
<div align="center">
<?cs call:print_form_header() ?>
<?cs if:subcount(Data.Disks.passive) > 1 ?>
<p><label for="device"><?cs var:Lang.Text.ChoosePartition ?></label>
<p><label for="device"><?cs var:html_escape(Lang.Text.ChoosePartition) ?></label>
<select name="device" id="device" size="0">
<?cs each:partition = Data.Disks.passive ?><option value="<?cs
var:partition.device ?>"><?cs
@ -26,11 +26,12 @@
<input type="hidden" name="device" value="<?cs
var:Data.Disks.passive.0.device ?>"/>
<?cs /if ?>
<p><label for="crypto_passwort"><?cs var:Lang.Text.EnterCurrentCryptoPassword ?></label>
<p><label for="crypto_passwort"><?cs var:html_escape(Lang.Text.EnterCurrentCryptoPassword)
?></label>
<input type="password" id="crypto_password" name="crypto_password" size="20" maxlength="40" /></p>
<input type="hidden" name="action" value="mount_do" />
<button type="submit"><?cs var:Lang.Button.Mount ?></button>
<button type="submit"><?cs var:html_escape(Lang.Button.Mount) ?></button>
</form>
</div>

12
templates/form_system.cs

@ -1,28 +1,28 @@
<?cs # $Id$ ?>
<h1><?cs var:Lang.Title.System ?></h1>
<h1><?cs var:html_escape(Lang.Title.System) ?></h1>
<p><ul>
<?cs # poweroff ?>
<li><a href="<?cs call:link('action','shutdown_do','type','poweroff','','') ?>" title="<?cs
var:Lang.Button.PowerOff ?>"><?cs var:Lang.Button.PowerOff ?></a></li>
var:html_escape(Lang.Button.PowerOff) ?>"><?cs var:html_escape(Lang.Button.PowerOff) ?></a></li>
<?cs # reboot ?>
<li><a href="<?cs call:link('action','shutdown_do','type','reboot','','') ?>" title="<?cs
var:Lang.Button.ReBoot ?>"><?cs var:Lang.Button.ReBoot ?></a></li>
var:html_escape(Lang.Button.ReBoot) ?>"><?cs var:html_escape(Lang.Button.ReBoot) ?></a></li>
<?cs # config ?>
<li><a href="<?cs call:link('action','config_ask','','','','') ?>" title="<?cs
var:Lang.Button.Config ?>"><?cs var:Lang.Button.Config ?></a></li>
var:html_escape(Lang.Button.Config) ?>"><?cs var:html_escape(Lang.Button.Config) ?></a></li>
<?cs # initialize ?>
<li><a href="<?cs call:link('action','init_ask','','','','') ?>" title="<?cs
var:Lang.Button.DoInit ?>"><?cs var:Lang.Button.DoInit ?></a></li>
var:html_escape(Lang.Button.DoInit) ?>"><?cs var:html_escape(Lang.Button.DoInit) ?></a></li>
<?cs # show log files ?>
<li><a href="<?cs call:link('action','show_log','','','','') ?>" title="<?cs
var:Lang.Button.Protocol ?>"><?cs var:Lang.Button.Protocol ?></a></li>
var:html_escape(Lang.Button.Protocol) ?>"><?cs var:html_escape(Lang.Button.Protocol) ?></a></li>
</ul></p>

6
templates/form_umount.cs

@ -6,13 +6,13 @@
<?cs else ?>
<h1><?cs var:Lang.Title.Umount ?></h1>
<h1><?cs var:html_escape(Lang.Title.Umount) ?></h1>
<div align="center">
<?cs call:print_form_header() ?>
<?cs if:subcount(Data.Disks.active) > 1 ?>
<p><label for="device"><?cs var:Lang.Text.ChoosePartition ?></label>
<p><label for="device"><?cs var:html_escape(Lang.Text.ChoosePartition) ?></label>
<select name="device" id="device" size="0">
<?cs each:partition = Data.Disks.active ?><option value="<?cs
var:partition.device ?>"><?cs
@ -28,7 +28,7 @@
var:Data.Disks.active.0.device ?>"/>
<?cs /if ?>
<input type="hidden" name="action" value="umount_do" />
<button type="submit"><?cs var:Lang.Button.Umount ?></button>
<button type="submit"><?cs var:html_escape(Lang.Button.Umount) ?></button>
</form>
</div>

4
templates/header.cs

@ -36,8 +36,8 @@
<?cs else ?>
<div id="head_green">
<?cs /if ?>
<h1><?cs var:Lang.Title.Top ?></h1>
<h2><?cs var:Lang.Title.Slogan ?></h2>
<h1><?cs var:html_escape(Lang.Title.Top) ?></h1>
<h2><?cs var:html_escape(Lang.Title.Slogan) ?></h2>
</div>
<div id="content">

12
templates/macros.cs

@ -4,8 +4,8 @@ def:warning(warnname)
?><div class="warning"><?cs
if:?Lang.WarningMessage[warnname].Title
?>
<h1><?cs var:Lang.WarningMessage[warnname].Title ?></h1>
<p><?cs var:Lang.WarningMessage[warnname].Text ?></p>
<h1><?cs var:html_escape(Lang.WarningMessage[warnname].Title) ?></h1>
<p><?cs var:html_escape(Lang.WarningMessage[warnname].Text) ?></p>
<?cs else ?>
<h1>unknown warning message</h1>
<p>could not find warning message: '<?cs var:warnname ?>'</p>
@ -17,8 +17,8 @@ def:error(errname)
?><div class="error"><?cs
if:?Lang.ErrorMessage[errname].Title
?>
<h1><?cs var:Lang.ErrorMessage[errname].Title ?></h1>
<p><?cs var:Lang.ErrorMessage[errname].Text ?></p>
<h1><?cs var:html_escape(Lang.ErrorMessage[errname].Title) ?></h1>
<p><?cs var:html_escape(Lang.ErrorMessage[errname].Text) ?></p>
<?cs else ?>
<h1>unknown error message</h1>
<p>could not find error message: '<?cs var:errname ?>'</p>
@ -30,8 +30,8 @@ def:success(succname)
?><div class="success"><?cs
if:?Lang.SuccessMessage[succname].Title
?>
<h1><?cs var:Lang.SuccessMessage[succname].Title ?></h1>
<p><?cs var:Lang.SuccessMessage[succname].Text ?></p>
<h1><?cs var:html_escape(Lang.SuccessMessage[succname].Title) ?></h1>
<p><?cs var:html_escape(Lang.SuccessMessage[succname].Text) ?></p>
<?cs else ?>
<h1>unknown success message</h1>
<p>could not find success message: '<?cs var:succname ?>'</p>

10
templates/nav.cs

@ -5,9 +5,9 @@
<!-- TODO: remove the following lines, as soon as we completely switched to the volume-based user interface
<?cs if:subcount(Data.Disks.passive) > 0 ?>
<a href="<?cs call:link('action','mount_ask','','','','') ?>" title="<?cs var:Lang.Text.DoMount ?>"><?cs var:Lang.Button.Mount ?></a><?cs /if ?>
<a href="<?cs call:link('action','mount_ask','','','','') ?>" title="<?cs var:html_escape(Lang.Text.DoMount) ?>"><?cs var:html_escape(Lang.Button.Mount) ?></a><?cs /if ?>
<?cs if:subcount(Data.Disks.active) > 0 ?>
<a href="<?cs call:link('action','umount_ask','','','','') ?>" title="<?cs var:Lang.Text.DoUmount ?>"><?cs var:Lang.Button.Umount ?></a><?cs /if ?>
<a href="<?cs call:link('action','umount_ask','','','','') ?>" title="<?cs var:html_escape(Lang.Text.DoUmount) ?>"><?cs var:html_escape(Lang.Button.Umount) ?></a><?cs /if ?>
-->
<a href="<?cs if:subcount(Data.Disks.available) > 1
@ -15,12 +15,12 @@
?><?cs else
?><?cs call:link('action','show_volume','device',Data.Disks.available.0.device,'','')
?><?cs /if
?>" title="<?cs var:Lang.Button.Status ?>"><?cs var:Lang.Button.Status ?></a>
?>" title="<?cs var:html_escape(Lang.Button.Status) ?>"><?cs var:html_escape(Lang.Button.Status) ?></a>
<?cs /if ?>
<?cs # manual ?>
<a href="<?cs call:link('action','doc','','','','') ?>" title="<?cs var:Lang.Button.Documentation ?>"><?cs var:Lang.Button.Documentation ?></a>
<a href="<?cs call:link('action','doc','','','','') ?>" title="<?cs var:html_escape(Lang.Button.Documentation) ?>"><?cs var:html_escape(Lang.Button.Documentation) ?></a>
<?cs # system ?>
<a href="<?cs call:link('action','system_ask','','','','') ?>" title="<?cs var:Lang.Button.System ?>"><?cs var:Lang.Button.System ?></a>
<a href="<?cs call:link('action','system_ask','','','','') ?>" title="<?cs var:html_escape(Lang.Button.System) ?>"><?cs var:html_escape(Lang.Button.System) ?></a>

4
templates/show_log.cs

@ -2,12 +2,12 @@
<div id="log">
<h1><?cs var:Lang.Title.Log ?></h1>
<h1><?cs var:html_escape(Lang.Title.Log) ?></h1>
<?cs if:Data.Log ?>
<p class="console"><?cs var:Data.Log ?></p>
<?cs else ?>
<p><?cs var:Lang.Text.EmptyLog ?></p>
<p><?cs var:html_escape(Lang.Text.EmptyLog) ?></p>
<?cs /if ?>
</div>

2
templates/show_status.cs

@ -1,6 +1,6 @@
<?cs # $Id$ ?>
<h1><?cs var:Lang.Title.Status ?></h1>
<h1><?cs var:html_escape(Lang.Title.Status) ?></h1>
<?cs if:subcount(Data.Disks.available) == 0 ?>
<?cs # there are no partitions available ?>

6
templates/show_volume.cs

@ -1,9 +1,9 @@
<?cs # $Id$ ?>
<h1><?cs var:Lang.Title.Volume ?> <i><?cs var:html_escape(Data.CurrentDisk.name) ?></i></h1>
<h1><?cs var:html_escape(Lang.Title.Volume) ?> <i><?cs var:html_escape(Data.CurrentDisk.name) ?></i></h1>
<?cs # is the disc active? ?>
<?cs if:!Data.CurrentDisk.active ?>
<?cs if:!Data.CurrentDisk.active && (Data.CurrentDisk.encryption || Data.CurrentDisk.plaintext) ?>
<h2>Mount container</h2>
<?cs call:print_form_header() ?>
<p>
@ -13,7 +13,7 @@
<?cs /if ?>
<input type="hidden" name="device" value="<?cs var:html_escape(Data.CurrentDisk.device) ?>" />
<input type="hidden" name="action" value="mount_do" />
<button type="submit"><?cs var:Lang.Button.Mount ?></button></p>
<button type="submit"><?cs var:html_escape(Lang.Button.Mount) ?></button></p>
</form>
<?cs else ?>
<h2>Unmount container</h2>

Loading…
Cancel
Save