rofi-pass: use umask instead of chmod.

Also avoids race conditions as a happy side effect
This commit is contained in:
Moviuro 2017-03-12 11:57:30 +01:00
parent fab0475fba
commit 19afc1e269

View File

@ -43,6 +43,8 @@ help="Alt+h"
switch="Alt+x" switch="Alt+x"
insert_pass="Alt+n" insert_pass="Alt+n"
# Safe permissions
umask 077
# get all password files and create an array # get all password files and create an array
list_passwords() { list_passwords() {
@ -69,14 +71,12 @@ doClip () {
checkIfPass () { checkIfPass () {
rm -f "$HOME/.cache/rofi-pass/last_used" rm -f "$HOME/.cache/rofi-pass/last_used"
echo "${root}: $selected_password" > "$HOME/.cache/rofi-pass/last_used" echo "${root}: $selected_password" > "$HOME/.cache/rofi-pass/last_used"
chmod 600 "$HOME/.cache/rofi-pass/last_used"
} }
autopass () { autopass () {
rm -f "$HOME/.cache/rofi-pass/last_used" rm -f "$HOME/.cache/rofi-pass/last_used"
echo "${root}: $selected_password" > "$HOME/.cache/rofi-pass/last_used" echo "${root}: $selected_password" > "$HOME/.cache/rofi-pass/last_used"
chmod 600 "$HOME/.cache/rofi-pass/last_used"
if [[ -z "${stuff["$AUTOTYPE_field"]}" ]]; then if [[ -z "${stuff["$AUTOTYPE_field"]}" ]]; then
if [[ "${stuff["${USERNAME_field}"]}" ]]; then if [[ "${stuff["${USERNAME_field}"]}" ]]; then
echo -n "${stuff["${USERNAME_field}"]}" | xdotool type --clearmodifiers --file - echo -n "${stuff["${USERNAME_field}"]}" | xdotool type --clearmodifiers --file -