summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJaromil <jaromil@dyne.org>2016-04-15 10:43:56 (GMT)
committer Jaromil <jaromil@dyne.org>2016-04-15 10:43:56 (GMT)
commit783f4a8bb5eecb86b2c75e9123f4360fd8c24000 (patch)
treec7eebe9e7997092f9d43138e806ddf72a80a5fde
parent82e4069c80174893eed77c7355b263cb790d75ae (diff)
avoid writing a temporary password file
-rwxr-xr-xsrc/jaro16
-rwxr-xr-xsrc/zlibs/email22
2 files changed, 19 insertions, 19 deletions
diff --git a/src/jaro b/src/jaro
index 5265c8e..c08e133 100755
--- a/src/jaro
+++ b/src/jaro
@@ -808,6 +808,22 @@ main() {
'source') return 0 ;;
+ askpass)
+ read_account $account
+ ask_password
+ # shell escape special chars
+ print - "$password" | sed '
+s/\&/\\&/g
+s/\$/\\$/g
+s/ /\\ /g
+s/;/\\;/g
+s/\?/\\?/g
+s/\*/\\*/g
+'
+ # TODO: verify if this works with all passwords
+ exitcode=$?
+ ;;
+
imap)
imapcmd="$1"
case $1 in
diff --git a/src/zlibs/email b/src/zlibs/email
index d8a9375..35f8d5c 100755
--- a/src/zlibs/email
+++ b/src/zlibs/email
@@ -559,21 +559,6 @@ peek() {
type=imap
host=$imap
port=$imap_port
- [[ "$password" = "" ]] && {
- ask_password
- [[ $? = 0 ]] || {
- error "Error retrieving imap password for $login on $imap"
- unset password all; return 1
- }
- }
-
- ztmp
- _pass_tmp=$ztmpfile
- sysread -o 1 <<EOF >> "$_pass_tmp"
-set imap_pass = "${password}"
-# set imap_peek = yes
-EOF
- unset password
# when peeking and using mutt-kz use the sidebar
is_mutt_kz && {
@@ -596,18 +581,17 @@ EOF
# also set the spoolfile name to INBOX (imap's default)
rm -f "$MAILDIRS/.mutt/muttpass"
sysread -o 1 <<EOF > "$MAILDIRS/.mutt/muttpass"
-source '$_pass_tmp'
+set imap_pass = \`$WORKDIR/bin/jaro -a ${account} askpass\`
unset mark_old
set sort=reverse-date-received
set folder=${iproto}://${ilogin}@${imap}:${imap_port}
set spoolfile=${iproto}://${ilogin}@${imap}:${imap_port}/INBOX
EOF
- # schedule deletion of pass files after use
+ # schedule deletion of muttpass file after use
sched +3 "
rm -f $MAILDIRS/.mutt/muttpass
-touch $MAILDIRS/.mutt/muttpass
-${=rm} -f $_pass_tmp" # zero the tmp passfile after a second
+touch $MAILDIRS/.mutt/muttpass"
_mutt -f ${iproto}://${ilogin}@${imap}:${imap_port}/${folder}