summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXiao Pan <gky44px1999@gmail.com>2024-02-28 23:14:00 -0800
committerXiao Pan <gky44px1999@gmail.com>2024-02-28 23:14:00 -0800
commit13dfec54b934922384f92826dfc7bc2fa7726223 (patch)
tree331e48c9cf815fb0b58daa19d20d28643cd043ff
parent75795e120a5a49950a24b25999521faf9cb7edf1 (diff)
unset prp pass vars just in case it being sourced
-rwxr-xr-xsh/prp8
1 files changed, 8 insertions, 0 deletions
diff --git a/sh/prp b/sh/prp
index 541b2ee..1bdab0e 100755
--- a/sh/prp
+++ b/sh/prp
@@ -1,6 +1,9 @@
#!/bin/sh
# PRactice Password
+# maybe will leak password to ps/top/htop and swap file
+# not sure I only compare the password variables will leak or not
+
read_pass () {
stty -echo
# -r necessary because password may contain backslash \
@@ -17,4 +20,9 @@ while ! [ "$entered_pass" = "$correct_pass" ]; do
echo "Wrong password, enter again:"
read_pass
done
+
+# `. /bin/prp` will set these password variables as environment variables and can be accessed by the whole shell, so I unset these just in case
+unset entered_pass
+unset correct_pass
+
echo "Correct password"