tadded post-hooks - tomb - the crypto undertaker
 (HTM) git clone git://parazyd.org/tomb.git
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) README
 (DIR) LICENSE
       ---
 (DIR) commit 6078356b642520423ec962a56156093100eef61c
 (DIR) parent 09d63eac2513ea2472b6e5ce41f28f5b943ff4dd
 (HTM) Author: Jaromil <jaromil@dyne.org>
       Date:   Mon,  7 Feb 2011 11:56:11 +0100
       
       added post-hooks
       
       Diffstat:
         M src/tomb                            |      16 ++++++++++++++++
         M src/tomb-status.c                   |       1 -
       
       2 files changed, 16 insertions(+), 1 deletion(-)
       ---
 (DIR) diff --git a/src/tomb b/src/tomb
       t@@ -586,6 +586,7 @@ mount_tomb() {
            
            notice "encrypted storage $tombfile succesfully mounted on $tombmount"
            exec_bind_hooks ${tombmount}
       +    exec_post_hooks ${tombmount}
            exec_as_user tomb-status ${mapper} ${tombfile} ${tombmount} &!
            return 0
        }
       t@@ -610,6 +611,21 @@ exec_bind_hooks() {
            eval $hook
        }
        
       +exec_post_hooks() {
       +    mnt=$1 # first argument is where the tomb is mounted
       +    if ! [ -x ${mnt}/post-hooks ]; then return; fi
       +    # if 'post-hooks' is found inside the tomb, check it: if it is an
       +    # executable, launch it as a user this might need a dialog for
       +    # security on what is being run, however we expect you know well
       +    # what is inside your tomb.  this feature opens the possibility to
       +    # make encrypted executables.
       +    cat ${mnt}/post-hooks | head -n1 | grep '^#!/'
       +    if [ $? = 0 ]; then
       +        act "post hooks found, executing as user $SUDO_USER"
       +        exec_as_user ${mnt}/post-hooks
       +    fi
       +}
       +
        umount_tomb() {
        
            if ! [ $1 ]; then
 (DIR) diff --git a/src/tomb-status.c b/src/tomb-status.c
       t@@ -198,7 +198,6 @@ gboolean cb_close(GtkWidget *w, GdkEvent *e) {
          close(pipefd[1]); // reader will see EOF
        
          waitpid(cpid, &res, 0);
       -  fprintf(stderr,"forked child returns %i",res);
          if(res==0) {
            gtk_main_quit();
            notify_uninit();