From b2ac78109207b526de29184a26ce42c5136e5243 Mon Sep 17 00:00:00 2001 From: Juergen Hoetzel Date: Tue, 4 Oct 2016 18:00:00 +0200 Subject: [PATCH 1/2] Don't evaluate \ when reading username This allows entering Microsoft Domain users like DOMAIN\USER. --- pwd.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pwd.sh b/pwd.sh index 72f6aae..8164abf 100755 --- a/pwd.sh +++ b/pwd.sh @@ -74,7 +74,7 @@ read_pass () { fi if [[ -z "${2+x}" ]] ; then - read -p " + read -r -p " Username to read? (default: all) " username else username="${2}" @@ -146,7 +146,7 @@ create_username () { # Create username with password. if [[ -z "${2+x}" ]] ; then - read -p " + read -r -p " Username: " username else username="${2}" From 43a34d303bc610d210d7806b4339d053537bfee2 Mon Sep 17 00:00:00 2001 From: Juergen Hoetzel Date: Tue, 4 Oct 2016 18:00:00 +0200 Subject: [PATCH 2/2] Use fixed strings for searching the password safe Instead of passing the username as regular expression. This allows matching usernames which contain regex syntax characters like DOMAIN\user. --- pwd.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pwd.sh b/pwd.sh index 8164abf..20588b5 100755 --- a/pwd.sh +++ b/pwd.sh @@ -87,7 +87,7 @@ read_pass () { get_pass " Enter password to unlock ${safe}: " printf "\n\n" - decrypt ${password} ${safe} | grep " ${username}" || fail "Decryption failed" + decrypt ${password} ${safe} | grep -F " ${username}" || fail "Decryption failed" }