summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorguns <self@sungpae.com>2012-10-16 17:28:15 -0500
committerJason A. Donenfeld <Jason@zx2c4.com>2012-10-17 00:53:50 +0200
commit8c46958d559d6fbb852f341f0fc2d5d60127ed91 (patch)
treec54c00eb0a4d2be174cccc629ee222b759aa2a29 /src
parentde5282d1a6b17cd62122084e06eaaac36716a2c8 (diff)
downloadpass-8c46958d559d6fbb852f341f0fc2d5d60127ed91.tar.gz
pass-8c46958d559d6fbb852f341f0fc2d5d60127ed91.tar.bz2
pass-8c46958d559d6fbb852f341f0fc2d5d60127ed91.zip
Do not interpret backslashes when reading passwords
The `read` builtin accepts backslash notation for common non-printing characters by default, like `\t` and `\n`. This requires that any literal backslashes must also be escaped as `\\`. Given that `gpg -e` does not interpret input, the `read` invocations are changed to do the same. Also, the right hand side of an `==` comparison within `[[ ]]` must be quoted in order to suppress pattern metacharacter expansion. Quoting the bash manual: When the == and != operators are used, the string to the right of the operator is considered a pattern and matched according to the rules described below under Pattern Matching.
Diffstat (limited to 'src')
-rwxr-xr-xsrc/password-store.sh8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/password-store.sh b/src/password-store.sh
index eabbb50..8dea924 100755
--- a/src/password-store.sh
+++ b/src/password-store.sh
@@ -261,11 +261,11 @@ case "$command" in
gpg2 -e -r "$ID" -o "$passfile" $GPG_OPTS
elif [[ $noecho -eq 1 ]]; then
while true; do
- read -p "Enter password for $path: " -s password
+ read -r -p "Enter password for $path: " -s password
echo
- read -p "Retype password for $path: " -s password_again
+ read -r -p "Retype password for $path: " -s password_again
echo
- if [[ $password == $password_again ]]; then
+ if [[ $password == "$password_again" ]]; then
gpg2 -e -r "$ID" -o "$passfile" $GPG_OPTS <<<"$password"
break
else
@@ -273,7 +273,7 @@ case "$command" in
fi
done
else
- read -p "Enter password for $path: " -e password
+ read -r -p "Enter password for $path: " -e password
gpg2 -e -r "$ID" -o "$passfile" $GPG_OPTS <<<"$password"
fi
git_add_file "$passfile" "Added given password for $path to store."
08-05some translation fixes :)necoro2-0/+3 2007-08-05some translation fixes :)necoro1-1/+1 2007-08-05some translation fixes :)necoro7-358/+357 2007-08-05pocompile testnecoro1-2/+2 2007-08-05pocompile testnecoro1-2/+3 2007-08-05pocompile testnecoro1-1/+6 2007-08-05i18n support and german translationsnecoro3-3/+11 2007-08-05i18n support and german translationsnecoro19-87/+1391 2007-08-04added an uncaught exception dialognecoro2-2/+1 2007-08-04added an uncaught exception dialognecoro4-3/+93 2007-08-04bugfixesnecoro3-5/+20 2007-08-01Removed "(GTK)" from desktop filenecoro1-1/+1 2007-07-30updatesnecoro1-1/+1 2007-07-30updatesnecoro2-21/+64 2007-07-28some more pause emerge itemsnecoro5-276/+423 2007-07-27changed design / added linknecoro3-66/+154 2007-07-26changed design / added linknecoro2-34/+27 2007-07-25changed design / added linknecoro5-86/+188 2007-07-24made the resume_loop-plugin change titles toonecoro5-7/+22 2007-07-21added logviewersnecoro7-215/+429 2007-07-21updated howtonecoro1-14/+24 2007-07-20new Plugin Schemenecoro1-5/+4 2007-07-20new Plugin Schemenecoro1-1/+1 2007-07-20new Plugin Schemenecoro9-162/+214 2007-07-13fixesnecoro4-27/+37 2007-07-13new fancier log outputnecoro14-127/+116 2007-07-11added SIGSTOP/SIGCONT support; SIGTERM now works ;)necoro8-208/+275 2007-07-09bug in shutdown pluginnecoro2-5/+12 2007-07-09added resume_loop pluginnecoro1-1/+1 2007-07-09added resume_loop pluginnecoro10-22/+162 2007-07-07some more documentationnecoro6-4/+108 2007-07-07Some documentation worknecoro7-18/+129