tcheck_priv: 3 attempts, error if wrong password - tomb - the crypto undertaker HTML git clone git://parazyd.org/tomb.git DIR Log DIR Files DIR Refs DIR README DIR LICENSE --- DIR commit 18febabbe5b490218f305abc12bfa3aaa7e4148d DIR parent 957e820c292848e74af1f20c03438b4a70afde3f HTML Author: BoySka <boyska@gmail.com> Date: Fri, 28 Oct 2011 12:26:01 +0200 check_priv: 3 attempts, error if wrong password Diffstat: M src/tomb | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) --- DIR diff --git a/src/tomb b/src/tomb t@@ -33,6 +33,9 @@ STEGHIDE=1 MKTEMP=1 MOUNTOPTS="rw,noatime,nodev" +#declare global variables +QUIET=0 +DEBUG=0 typeset -A global_opts typeset -A opts typeset -h username t@@ -292,7 +295,8 @@ check_priv() { sudok=false sudo -n ${TOMBEXEC} &> /dev/null if [ $? != 0 ]; then # if not then ask a password - cat <<EOF | pinentry 2>/dev/null | awk '/^D / { sub(/^D /, ""); print }' | sudo -S -v + for imnotused in 1 2 3; do + cat <<EOF | pinentry 2>/dev/null | awk '/^D / { sub(/^D /, ""); print }' | sudo -S -v OPTION ttyname=$TTY OPTION lc-ctype=$LANG SETTITLE Super user privileges required t@@ -300,6 +304,12 @@ SETDESC Sudo execution of Tomb ${OLDARGS[@]} SETPROMPT Insert your USER password: GETPIN EOF + if [[ $? == 0 ]]; then #success + break + fi + if [[ $i == 3 ]]; then + fi + done fi sudo "${TOMBEXEC}" "${(@)OLDARGS}" -U ${UID} -G ${GID} exit $?