mirror of
https://github.com/Llewellynvdm/Tomb.git
synced 2024-12-22 18:18:59 +00:00
dropped c++ dependency plus various fixes
This commit is contained in:
parent
bee816111f
commit
36565e2ef4
@ -64,7 +64,6 @@ AC_CONFIG_SRCDIR([src/tomb])
|
||||
|
||||
dnl Checks for reguired programs.
|
||||
AC_PROG_CC
|
||||
AC_PROG_CXX
|
||||
AC_PROG_INSTALL
|
||||
|
||||
AC_CHECK_PROG(have_zsh,zsh,yes,no)
|
||||
|
@ -1,15 +1,19 @@
|
||||
|
||||
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_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_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
|
||||
pixmapdir = $(prefix)/share/pixmaps
|
||||
|
27
src/tomb
27
src/tomb
@ -43,9 +43,9 @@ fi
|
||||
# which wipe command to use
|
||||
which wipe > /dev/null
|
||||
if [ $? = 0 ]; then
|
||||
WIPE="wipe -f -s -q"
|
||||
WIPE=(wipe -f -s -q)
|
||||
else
|
||||
WIPE="rm -f"
|
||||
WIPE=(rm -f)
|
||||
fi
|
||||
|
||||
# usb auto detect using dmesg
|
||||
@ -96,14 +96,19 @@ ask_usbkey() {
|
||||
# user interface (just to ask the 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 [ -x /usr/bin/ssh-askpass ]; then # debian has this
|
||||
export scolopendro="`ssh-askpass "Tomb: provide the password to unlock"`"
|
||||
exec_as_user which tomb-askpass
|
||||
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
|
||||
fi
|
||||
|
||||
|
||||
else # we'll collect the password from commandline
|
||||
|
||||
act "Tomb: provide the password to unlock"
|
||||
@ -122,8 +127,7 @@ ask_password() {
|
||||
# drop privileges
|
||||
exec_as_user() {
|
||||
func "executing as user '$SUDO_USER': ${(f)@}"
|
||||
sudo -u $SUDO_USER ${@} &
|
||||
disown
|
||||
sudo -u $SUDO_USER ${@}
|
||||
}
|
||||
|
||||
|
||||
@ -288,7 +292,7 @@ create_tomb() {
|
||||
|
||||
|
||||
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"
|
||||
act "Would you like to save the key on an external usb device?"
|
||||
@ -306,7 +310,7 @@ create_tomb() {
|
||||
mkdir -p ${usbkey_mount}/.tomb
|
||||
cp -v ${FILE}.gpg ${usbkey_mount}/.tomb/
|
||||
chmod -R go-rwx ${usbkey_mount}/.tomb
|
||||
rm -rf ${FILE}.gpg
|
||||
${WIPE[@]} ${FILE}.gpg
|
||||
fi
|
||||
fi
|
||||
# cryptsetup luksDump ${nstloop}
|
||||
@ -418,7 +422,8 @@ mount_tomb() {
|
||||
mount -o rw,noatime,nodev /dev/mapper/${mapper} ${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() {
|
||||
|
@ -22,13 +22,6 @@
|
||||
|
||||
# startup wrapper to open tombs
|
||||
|
||||
explore() {
|
||||
which ${1} > /dev/null
|
||||
if [ $? = 0 ]; then
|
||||
${1} ${2}
|
||||
exit 0
|
||||
fi
|
||||
}
|
||||
|
||||
try() {
|
||||
which ${1} > /dev/null
|
||||
@ -102,7 +95,7 @@ Create a new Tomb
|
||||
the computer you are using.
|
||||
|
||||
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
|
||||
echo -n "> "
|
||||
read -q
|
||||
@ -122,7 +115,7 @@ echo " You have commanded the creation of this Tomb:"
|
||||
echo " $filename ( $size MBytes )";
|
||||
echo
|
||||
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 "> "
|
||||
read -q
|
||||
if [ $? != 0 ]; then
|
||||
@ -141,3 +134,4 @@ if ! [ -r /usr/share/applications/tomb.desktop ]; then
|
||||
sudo tomb install
|
||||
fi
|
||||
|
||||
exit 0
|
||||
|
@ -56,7 +56,7 @@ gboolean cb_about(GtkWidget *w, GdkEvent *e);
|
||||
int main(int argc, char **argv) {
|
||||
GtkWidget *item_close, *item_view, *item_about;
|
||||
gint menu_x, menu_y;
|
||||
gboolean push_in = true;
|
||||
gboolean push_in = TRUE;
|
||||
|
||||
char tomb_file[512];
|
||||
char tooltip[256];
|
||||
@ -155,13 +155,13 @@ gboolean cb_view(GtkWidget *w, GdkEvent *e) {
|
||||
pid_t cpid = fork();
|
||||
if (cpid == -1) {
|
||||
fprintf(stderr,"error: problem forking process\n");
|
||||
return false;
|
||||
return FALSE;
|
||||
}
|
||||
if (cpid == 0) { // Child
|
||||
execlp("tomb-open", "tomb-open", mountpoint ,(char*)NULL);
|
||||
exit(1);
|
||||
}
|
||||
return true;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
gboolean cb_close(GtkWidget *w, GdkEvent *e) {
|
||||
@ -169,7 +169,7 @@ gboolean cb_close(GtkWidget *w, GdkEvent *e) {
|
||||
int res;
|
||||
if (cpid == -1) {
|
||||
fprintf(stderr,"error: problem forking process\n");
|
||||
return false;
|
||||
return FALSE;
|
||||
}
|
||||
if (cpid == 0) { // Child
|
||||
execlp("tomb","tomb","-S","umount",mapper,(char*)NULL);
|
||||
@ -181,6 +181,7 @@ gboolean cb_close(GtkWidget *w, GdkEvent *e) {
|
||||
notify_uninit();
|
||||
exit(0);
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
// callbacks right click
|
Loading…
Reference in New Issue
Block a user