dropped c++ dependency plus various fixes

This commit is contained in:
Jaromil 2011-01-16 23:43:45 +01:00
parent bee816111f
commit 36565e2ef4
6 changed files with 33 additions and 30 deletions

View File

@ -64,7 +64,6 @@ AC_CONFIG_SRCDIR([src/tomb])
dnl Checks for reguired programs. dnl Checks for reguired programs.
AC_PROG_CC AC_PROG_CC
AC_PROG_CXX
AC_PROG_INSTALL AC_PROG_INSTALL
AC_CHECK_PROG(have_zsh,zsh,yes,no) AC_CHECK_PROG(have_zsh,zsh,yes,no)

View File

@ -1,15 +1,19 @@
bin_SCRIPTS = tomb tomb-open bin_SCRIPTS = tomb tomb-open
bin_PROGRAMS = tomb-status tomb-notify bin_PROGRAMS = tomb-status tomb-notify tomb-askpass
tomb_status_SOURCES = tomb-status.cpp tomb_status_SOURCES = tomb-status.c
tomb_status_LDADD = @GTK2_LIBS@ @NOTIFY_LIBS@ tomb_status_LDADD = @GTK2_LIBS@ @NOTIFY_LIBS@
tomb_status_CXXFLAGS = @GTK2_CFLAGS@ @NOTIFY_CFLAGS@ tomb_status_CFLAGS = @GTK2_CFLAGS@ @NOTIFY_CFLAGS@
tomb_notify_SOURCES = tomb-notify.cpp tomb_notify_SOURCES = tomb-notify.c
tomb_notify_LDADD = @NOTIFY_LIBS@ tomb_notify_LDADD = @NOTIFY_LIBS@
tomb_notify_CXXFLAGS = @NOTIFY_CFLAGS@ tomb_notify_CFLAGS = @NOTIFY_CFLAGS@
tomb_askpass_SOURCES = tomb-askpass.c
tomb_askpass_LDADD = @GTK2_LIBS@
tomb_askpass_CFLAGS = @GTK2_CFLAGS@
EXTRA_DIST = monmort.xpm EXTRA_DIST = monmort.xpm
pixmapdir = $(prefix)/share/pixmaps pixmapdir = $(prefix)/share/pixmaps

View File

@ -43,9 +43,9 @@ fi
# which wipe command to use # which wipe command to use
which wipe > /dev/null which wipe > /dev/null
if [ $? = 0 ]; then if [ $? = 0 ]; then
WIPE="wipe -f -s -q" WIPE=(wipe -f -s -q)
else else
WIPE="rm -f" WIPE=(rm -f)
fi fi
# usb auto detect using dmesg # usb auto detect using dmesg
@ -96,11 +96,16 @@ ask_usbkey() {
# user interface (just to ask the password) # user interface (just to ask the password)
ask_password() { ask_password() {
xhost 2>/dev/null exec_as_user xhost 2>/dev/null
if [ $? = 0 ]; then # we have access to the X display if [ $? = 0 ]; then # we have access to the X display
if [ -x /usr/bin/ssh-askpass ]; then # debian has this exec_as_user which tomb-askpass
export scolopendro="`ssh-askpass "Tomb: provide the password to unlock"`" if [ $? = 0 ]; then
keyname=`echo $enc_key | cut -d. -f1`
export scolopendro="`exec_as_user tomb-askpass $keyname`"
return
elif [ -x /usr/bin/ssh-askpass ]; then # debian has this
export scolopendro="`exec_as_user ssh-askpass "Tomb: provide the password to unlock"`"
return return
fi fi
@ -122,8 +127,7 @@ ask_password() {
# drop privileges # drop privileges
exec_as_user() { exec_as_user() {
func "executing as user '$SUDO_USER': ${(f)@}" func "executing as user '$SUDO_USER': ${(f)@}"
sudo -u $SUDO_USER ${@} & sudo -u $SUDO_USER ${@}
disown
} }
@ -288,7 +292,7 @@ create_tomb() {
cryptsetup --key-file ${keytmp} --cipher aes luksOpen ${nstloop} tomb.tmp cryptsetup --key-file ${keytmp} --cipher aes luksOpen ${nstloop} tomb.tmp
${WIPE} ${keytmp} ${WIPE[@]} ${keytmp}
notice "Your tomb is ready on ${FILE} and secured with key ${FILE}.gpg" notice "Your tomb is ready on ${FILE} and secured with key ${FILE}.gpg"
act "Would you like to save the key on an external usb device?" act "Would you like to save the key on an external usb device?"
@ -306,7 +310,7 @@ create_tomb() {
mkdir -p ${usbkey_mount}/.tomb mkdir -p ${usbkey_mount}/.tomb
cp -v ${FILE}.gpg ${usbkey_mount}/.tomb/ cp -v ${FILE}.gpg ${usbkey_mount}/.tomb/
chmod -R go-rwx ${usbkey_mount}/.tomb chmod -R go-rwx ${usbkey_mount}/.tomb
rm -rf ${FILE}.gpg ${WIPE[@]} ${FILE}.gpg
fi fi
fi fi
# cryptsetup luksDump ${nstloop} # cryptsetup luksDump ${nstloop}
@ -418,7 +422,8 @@ mount_tomb() {
mount -o rw,noatime,nodev /dev/mapper/${mapper} ${MOUNT} mount -o rw,noatime,nodev /dev/mapper/${mapper} ${MOUNT}
notice "encrypted storage $FILE succesfully mounted on $MOUNT" notice "encrypted storage $FILE succesfully mounted on $MOUNT"
exec_as_user tomb-status ${mapper} ${FILE} ${MOUNT} exec_as_user tomb-status ${mapper} ${FILE} ${MOUNT} &
disown
} }
umount_tomb() { umount_tomb() {

View File

@ -22,13 +22,6 @@
# startup wrapper to open tombs # startup wrapper to open tombs
explore() {
which ${1} > /dev/null
if [ $? = 0 ]; then
${1} ${2}
exit 0
fi
}
try() { try() {
which ${1} > /dev/null which ${1} > /dev/null
@ -102,7 +95,7 @@ Create a new Tomb
the computer you are using. the computer you are using.
If you will, I'll be your Crypto Undertaker. If you will, I'll be your Crypto Undertaker.
Do you want to proceed, Master? (yes/no)" Do you want to proceed, Master? (y/n)"
EOF EOF
echo -n "> " echo -n "> "
read -q read -q
@ -122,7 +115,7 @@ echo " You have commanded the creation of this Tomb:"
echo " $filename ( $size MBytes )"; echo " $filename ( $size MBytes )";
echo echo
echo " Please confirm if you want to proceed now," echo " Please confirm if you want to proceed now,"
echo " digging will take quite some time! (yes/no)" echo " digging will take quite some time! (y/n)"
echo -n "> " echo -n "> "
read -q read -q
if [ $? != 0 ]; then if [ $? != 0 ]; then
@ -141,3 +134,4 @@ if ! [ -r /usr/share/applications/tomb.desktop ]; then
sudo tomb install sudo tomb install
fi fi
exit 0

View File

@ -56,7 +56,7 @@ gboolean cb_about(GtkWidget *w, GdkEvent *e);
int main(int argc, char **argv) { int main(int argc, char **argv) {
GtkWidget *item_close, *item_view, *item_about; GtkWidget *item_close, *item_view, *item_about;
gint menu_x, menu_y; gint menu_x, menu_y;
gboolean push_in = true; gboolean push_in = TRUE;
char tomb_file[512]; char tomb_file[512];
char tooltip[256]; char tooltip[256];
@ -155,13 +155,13 @@ gboolean cb_view(GtkWidget *w, GdkEvent *e) {
pid_t cpid = fork(); pid_t cpid = fork();
if (cpid == -1) { if (cpid == -1) {
fprintf(stderr,"error: problem forking process\n"); fprintf(stderr,"error: problem forking process\n");
return false; return FALSE;
} }
if (cpid == 0) { // Child if (cpid == 0) { // Child
execlp("tomb-open", "tomb-open", mountpoint ,(char*)NULL); execlp("tomb-open", "tomb-open", mountpoint ,(char*)NULL);
exit(1); exit(1);
} }
return true; return TRUE;
} }
gboolean cb_close(GtkWidget *w, GdkEvent *e) { gboolean cb_close(GtkWidget *w, GdkEvent *e) {
@ -169,7 +169,7 @@ gboolean cb_close(GtkWidget *w, GdkEvent *e) {
int res; int res;
if (cpid == -1) { if (cpid == -1) {
fprintf(stderr,"error: problem forking process\n"); fprintf(stderr,"error: problem forking process\n");
return false; return FALSE;
} }
if (cpid == 0) { // Child if (cpid == 0) { // Child
execlp("tomb","tomb","-S","umount",mapper,(char*)NULL); execlp("tomb","tomb","-S","umount",mapper,(char*)NULL);
@ -181,6 +181,7 @@ gboolean cb_close(GtkWidget *w, GdkEvent *e) {
notify_uninit(); notify_uninit();
exit(0); exit(0);
} }
return TRUE;
} }
// callbacks right click // callbacks right click