tfixed expr bug and added tomb mktemp internal command - tomb - the crypto undertaker
 (HTM) git clone git://parazyd.org/tomb.git
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) README
 (DIR) LICENSE
       ---
 (DIR) commit d2d86686a866a079eac6750b8ef8b354895cde84
 (DIR) parent e1ba5a4b4be5ee1fe2007f5f361ec32d162bf0bb
 (HTM) Author: Jaromil <jaromil@dyne.org>
       Date:   Thu, 28 Apr 2011 20:42:45 +0200
       
       fixed expr bug and added tomb mktemp internal command
       
       Diffstat:
         M src/tomb                            |      14 ++++++++++----
       
       1 file changed, 10 insertions(+), 4 deletions(-)
       ---
 (DIR) diff --git a/src/tomb b/src/tomb
       t@@ -84,7 +84,7 @@ check_bin() {
        
        # safe dir creation function
        safe_dir() {
       -    dir="/tmp/$1.$RANDOM.$RANDOM.$$"
       +    dir="/dev/shm/$1.$RANDOM.$RANDOM.$$"
            (umask 077 && mkdir "$dir") || echo "-1"
            echo "$dir"
        }
       t@@ -377,8 +377,12 @@ create_tomb() {
            cryptsetup luksClose tomb.tmp
            losetup -d ${nstloop}
        
       +    # set permissions on the tomb
       +    sudo chown $UID:$GID ${tombfile}
       +    sudo chmod go-rwx ${tombfile}
       +
            act "done creating $tombname encrypted storage (using Luks dm-crypt AES/SHA256)"
       -    notice "Your tomb is ready in ${tombdir}/${tombfile} and secured with key ${tombname}.tomb.key"
       +    notice "Your tomb is ready in ${tombdir}/${tombfile} and secured with key ${tombfile}.key"
        
        }
        
       t@@ -426,7 +430,8 @@ mount_tomb() {
            fi
        
            # save date of mount in minutes since 1970
       -    mapdate="expr `date +%s` / 60"
       +    mapdate=`date +%s`
       +    mapdate="`expr $mapdate / 60`"
        
            mapper="tomb.${tombname}.${mapdate}.`basename $nstloop`"
            keyname=`basename $tombkey | cut -d. -f1`
       t@@ -917,7 +922,7 @@ main () {
                 umount) check_priv ; umount_tomb ${CMD2} ;;
                unmount) check_priv ; umount_tomb ${CMD2} ;;
                  close) check_priv ; umount_tomb ${CMD2} ;;
       -          slam) chack_priv ; SLAM=1; umount_tomb ${CMD2} ;;
       +           slam) check_priv ; SLAM=1; umount_tomb ${CMD2} ;;
                   bury) if [ "$STEGHIDE" = 0 ]; then
                            error "steghide not installed. Cannot bury your key"
                            return 1
       t@@ -931,6 +936,7 @@ main () {
                install) check_priv ; install_tomb ;;
                askpass) ask_password $CMD2 ;;
                 status) tomb-status ;;
       +         mktemp) safe_dir ${CMD2} ;;
                      *) error "command \"$CMD\" not recognized"
                         act "try -h for help"
                         return 1