From 831849b93f9397d06c89ddfb9338694ff2a25926 Mon Sep 17 00:00:00 2001 From: lars Date: Sun, 24 Jul 2005 16:04:08 +0000 Subject: [PATCH] validation fixed "cryptsetup remove" fixed --- cryptobox.conf.d/usr/lib/cryptobox/cbox-manage.sh | 4 ++-- cryptobox.conf.d/var/www/cgi-bin/cryptobox.pl | 14 +++++++------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/cryptobox.conf.d/usr/lib/cryptobox/cbox-manage.sh b/cryptobox.conf.d/usr/lib/cryptobox/cbox-manage.sh index b78624f..7c1fc18 100755 --- a/cryptobox.conf.d/usr/lib/cryptobox/cbox-manage.sh +++ b/cryptobox.conf.d/usr/lib/cryptobox/cbox-manage.sh @@ -209,7 +209,7 @@ function mount_crypto() $CRYPTSETUP -h "$HASH" -c "$ALGO" create "`basename $CRYPTMAPPER_DEV`" "${device}2" if mount "$CRYPTMAPPER_DEV" "$CRYPTO_DIR" then /etc/init.d/samba start - else dmsetup remove "$CRYPTMAPPER_DEV" + else dmsetup remove $(basename $CRYPTMAPPER_DEV) return 1 fi } @@ -225,7 +225,7 @@ function umount_crypto() ps -e | grep -q " smbd$" && killall -9 smbd ps -e | grep -q " nmbd$" && killall -9 nmbd umount "$CRYPTO_DIR" - $CRYPTSETUP remove "$CRYPTMAPPER_DEV" + $CRYPTSETUP remove $(basename $CRYPTMAPPER_DEV) set -e } diff --git a/cryptobox.conf.d/var/www/cgi-bin/cryptobox.pl b/cryptobox.conf.d/var/www/cgi-bin/cryptobox.pl index bc4e0f5..726b480 100755 --- a/cryptobox.conf.d/var/www/cgi-bin/cryptobox.pl +++ b/cryptobox.conf.d/var/www/cgi-bin/cryptobox.pl @@ -227,7 +227,7 @@ sub validate_language() { my $language = shift; # check for non-alphanumeric character - return 0 if ($language = ~/\W/); + return 0 if ($language =~ /\W/); return 0 if ( ! -e "$LANGUAGE_DIR/$language" . '.hdf'); return 1; } @@ -385,15 +385,15 @@ if ( ! &check_ssl()) { $pagedata->setValue('Data.Warning', 'NotConfigured'); $pagedata->setValue('Data.Action', 'init_form'); } else { - if ( ! &validate_language()) { + if ( ! &validate_language($query->param('language'))) { $pagedata->setValue('Data.Warning', 'InvalidLanguage'); - $pagedata->setValue('Data.Action', 'config_ask'); - } elsif ( ! &validate_ip()) { + $pagedata->setValue('Data.Action', 'config_form'); + } elsif ( ! &validate_ip($query->param('ip'))) { $pagedata->setValue('Data.Warning', 'InvalidIP'); - $pagedata->setValue('Data.Action', 'config_ask'); - } elsif ( ! &validate_timeout()) { + $pagedata->setValue('Data.Action', 'config_form'); + } elsif ( ! &validate_timeout($query->param('timeout'))) { $pagedata->setValue('Data.Warning', 'InvalidTimeOut'); - $pagedata->setValue('Data.Action', 'config_ask'); + $pagedata->setValue('Data.Action', 'config_form'); } else { system("$CB_SCRIPT", "set_config", "language", $query->param('language')); system("$CB_SCRIPT", "set_config", "timeout", $query->param('timeout'));