mirror of
https://github.com/Llewellynvdm/Tomb.git
synced 2024-12-28 20:12:45 +00:00
Merge pull request #305 from dyne/assuan_deduplication
put assuan commands to pinentry into a single function
This commit is contained in:
commit
3440a32839
68
tomb
68
tomb
@ -362,6 +362,19 @@ _check_swap() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pinentry_assuan_getpass() {
|
||||||
|
# simply prints out commands for pinentry's stdin to activate the
|
||||||
|
# password dialog
|
||||||
|
cat <<EOF
|
||||||
|
OPTION ttyname=$TTY
|
||||||
|
OPTION lc-ctype=$LANG
|
||||||
|
SETTITLE $title
|
||||||
|
SETDESC $description
|
||||||
|
SETPROMPT Password:
|
||||||
|
GETPIN
|
||||||
|
EOF
|
||||||
|
}
|
||||||
|
|
||||||
# Ask user for a password
|
# Ask user for a password
|
||||||
# Wraps around the pinentry command, from the GnuPG project, as it
|
# Wraps around the pinentry command, from the GnuPG project, as it
|
||||||
# provides better security and conveniently use the right toolkit.
|
# provides better security and conveniently use the right toolkit.
|
||||||
@ -389,14 +402,7 @@ ask_password() {
|
|||||||
|
|
||||||
if _is_found "pinentry-curses"; then
|
if _is_found "pinentry-curses"; then
|
||||||
_verbose "using pinentry-curses"
|
_verbose "using pinentry-curses"
|
||||||
output=`cat <<EOF | pinentry-curses
|
output=$(pinentry_assuan_getpass | pinentry-curses)
|
||||||
OPTION ttyname=$TTY
|
|
||||||
OPTION lc-ctype=$LANG
|
|
||||||
SETTITLE $title
|
|
||||||
SETDESC $description
|
|
||||||
SETPROMPT Password:
|
|
||||||
GETPIN
|
|
||||||
EOF`
|
|
||||||
else
|
else
|
||||||
_failure "Cannot find pinentry-curses and no DISPLAY detected."
|
_failure "Cannot find pinentry-curses and no DISPLAY detected."
|
||||||
fi
|
fi
|
||||||
@ -419,54 +425,25 @@ EOF`
|
|||||||
gtkrc_old="$GTK2_RC_FILES"
|
gtkrc_old="$GTK2_RC_FILES"
|
||||||
export GTK2_RC_FILES="$gtkrc"
|
export GTK2_RC_FILES="$gtkrc"
|
||||||
}
|
}
|
||||||
output=`cat <<EOF | pinentry-gtk-2
|
output=$(pinentry_assuan_getpass | pinentry-gtk-2)
|
||||||
OPTION ttyname=$TTY
|
|
||||||
OPTION lc-ctype=$LANG
|
|
||||||
SETTITLE $title
|
|
||||||
SETDESC $description
|
|
||||||
SETPROMPT Password:
|
|
||||||
GETPIN
|
|
||||||
EOF`
|
|
||||||
[[ "$gtkrc" = "" ]] || export GTK2_RC_FILES="$gtkrc_old"
|
[[ "$gtkrc" = "" ]] || export GTK2_RC_FILES="$gtkrc_old"
|
||||||
|
|
||||||
# TODO QT5 customization of dialog
|
# TODO QT5 customization of dialog
|
||||||
elif _is_found "pinentry-qt5"; then
|
elif _is_found "pinentry-qt5"; then
|
||||||
_verbose "using pinentry-qt5"
|
_verbose "using pinentry-qt5"
|
||||||
|
|
||||||
output=`cat <<EOF | pinentry-qt5
|
output=$(pinentry_assuan_getpass | pinentry-qt5)
|
||||||
OPTION ttyname=$TTY
|
|
||||||
OPTION lc-ctype=$LANG
|
|
||||||
SETTITLE $title
|
|
||||||
SETDESC $description
|
|
||||||
SETPROMPT Password:
|
|
||||||
GETPIN
|
|
||||||
EOF`
|
|
||||||
|
|
||||||
# TODO QT4 customization of dialog
|
# TODO QT4 customization of dialog
|
||||||
elif _is_found "pinentry-qt4"; then
|
elif _is_found "pinentry-qt4"; then
|
||||||
_verbose "using pinentry-qt4"
|
_verbose "using pinentry-qt4"
|
||||||
|
|
||||||
output=`cat <<EOF | pinentry-qt4
|
output=$(pinentry_assuan_getpass | pinentry-qt4)
|
||||||
OPTION ttyname=$TTY
|
|
||||||
OPTION lc-ctype=$LANG
|
|
||||||
SETTITLE $title
|
|
||||||
SETDESC $description
|
|
||||||
SETPROMPT Password:
|
|
||||||
GETPIN
|
|
||||||
EOF`
|
|
||||||
|
|
||||||
# TODO X11 customization of dialog
|
# TODO X11 customization of dialog
|
||||||
elif _is_found "pinentry-x11"; then
|
elif _is_found "pinentry-x11"; then
|
||||||
_verbose "using pinentry-x11"
|
_verbose "using pinentry-x11"
|
||||||
|
|
||||||
output=`cat <<EOF | pinentry-x11
|
output=$(pinentry_assuan_getpass | pinentry-x11)
|
||||||
OPTION ttyname=$TTY
|
|
||||||
OPTION lc-ctype=$LANG
|
|
||||||
SETTITLE $title
|
|
||||||
SETDESC $description
|
|
||||||
SETPROMPT Password:
|
|
||||||
GETPIN
|
|
||||||
EOF`
|
|
||||||
|
|
||||||
else
|
else
|
||||||
|
|
||||||
@ -474,14 +451,7 @@ EOF`
|
|||||||
_verbose "using pinentry-curses"
|
_verbose "using pinentry-curses"
|
||||||
|
|
||||||
_warning "Detected DISPLAY, but only pinentry-curses is found."
|
_warning "Detected DISPLAY, but only pinentry-curses is found."
|
||||||
output=`cat <<EOF | pinentry-curses
|
output=$(pinentry_assuan_getpass | pinentry-curses)
|
||||||
OPTION ttyname=$TTY
|
|
||||||
OPTION lc-ctype=$LANG
|
|
||||||
SETTITLE $title
|
|
||||||
SETDESC $description
|
|
||||||
SETPROMPT Password:
|
|
||||||
GETPIN
|
|
||||||
EOF`
|
|
||||||
else
|
else
|
||||||
_failure "Cannot find any pinentry: impossible to ask for password."
|
_failure "Cannot find any pinentry: impossible to ask for password."
|
||||||
fi
|
fi
|
||||||
|
Loading…
Reference in New Issue
Block a user