jaromail

a commandline tool to easily and privately handle your e-mail
git clone git://parazyd.org/jaromail.git
Log | Files | Refs | Submodules | README

commit d201bca9d8bb0a67ac2f611f74d2b993f2286b82
parent 64bb186e335de720ad608ac77dd53bbef31b91dd
Author: Jaromil <jaromil@dyne.org>
Date:   Mon,  5 May 2014 20:32:15 +0200

string sanitization across code to support paths with spaces

Diffstat:
Msrc/zlibs/accounts | 19++++++++++---------
Msrc/zlibs/addressbook | 8++++----
Msrc/zlibs/email | 100++++++++++++++++++++++++++++++++++++++++----------------------------------------
Msrc/zlibs/filters | 115+++++++++++++++++++++++++++++++++++++++----------------------------------------
Msrc/zlibs/keyring | 14+++++++-------
5 files changed, 128 insertions(+), 128 deletions(-)

diff --git a/src/zlibs/accounts b/src/zlibs/accounts @@ -24,8 +24,8 @@ switch_identity() { if [ "$name" != "" ]; then act "switch to identity: $name <$login>" - rm -f $MAILDIRS/Identity - cat <<EOF > $MAILDIRS/Identity + rm -f "$MAILDIRS/Identity" + cat <<EOF > "$MAILDIRS/Identity" # Automatically generated, do not modify # change or add configs into Accounts instead set hostname = $host @@ -34,18 +34,19 @@ set from = "$name <$login>" EOF else error "No identity found, left blank." - touch $MAILDIRS/Identity + touch "$MAILDIRS/Identity" fi } list_accounts() { - for a in `${=find} $ACCOUNTS -type f | grep -v README | sed 's/.txt//'`; do + accts=`${=find} "$ACCOUNTS" -type f | grep -v README | sed 's/.txt//'` + for a in ${(f)accts}; do act -n "`basename $a`\t :: " awk ' /^name/ { for(i=2;i<=NF;i++) printf "%s ", $i } /^email/ { printf "<%s>", $2 } /^host/ { printf " on %s", $2 } -{next}' $a.txt +{next}' "$a.txt" print " (`basename $a | cut -d. -f1`)" done } @@ -59,13 +60,13 @@ read_account() { unset name email host login transport \ port auth cert options folders # parse arguments - { test "$1" != "" } && { account=$1 } + { test "$1" != "" } && { account="$1" } account=".${account}" type=`print ${account} | cut -d. -f2` account=`print ${account} | cut -d. -f3` - { test "$2" != "" } && { account=$2 } + { test "$2" != "" } && { account="$2" } { test "$type" = "default" } && { error "No account type specified" @@ -76,13 +77,13 @@ read_account() { # find the account func "read_account looking for ${type} ${account}" - accountlist=`${=find} $ACCOUNTS -name "$type.$account*" | grep -v 'lock$' | grep -v 'pid$'` + accountlist=`${=find} "$ACCOUNTS" -name "$type.$account*" | grep -v 'lock$' | grep -v 'pid$'` for a in ${(f)accountlist}; do # check if it is locked func "found account: $a" { test -r "${a}.lock" } && { pidcheck "${a}" } - all+=($a) + all+=("$a") done if [ ${#all} = 0 ]; then error "No $type account found: $account" diff --git a/src/zlibs/addressbook b/src/zlibs/addressbook @@ -21,7 +21,7 @@ # Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -ADDRESSBOOK=$MAILDIRS/Addressbook +ADDRESSBOOK="$MAILDIRS/Addressbook" ################### # Jaro Brother DB @@ -116,16 +116,16 @@ complete() { func "complete: $1 (list $list)" # completion on configured groups - { test -r $MAILDIRS/Groups } && { + { test -r "$MAILDIRS/Groups" } && { if [[ "$1" =~ "group/" ]]; then func "completion will look into groups" needle="${1[(ws:/:)2]}" if [ "$needle" = "" ]; then act "Listing all mailout groups" - matches="`${=find} $MAILDIRS/Groups -type f`" + matches=`${=find} "$MAILDIRS/Groups" -type f` else act "Searching for \"$needle\" in mailout groups" - matches="`${=find} $MAILDIRS/Groups -type f -name \"*$needle*\"`" + matches=`${=find} "$MAILDIRS/Groups" -type f -name \"*$needle*\"` fi print "Groups: `print $matches | wc -l` matches" print diff --git a/src/zlibs/email b/src/zlibs/email @@ -55,37 +55,37 @@ queue() { { print $0 } ' > "$TMPDIR/${queue_body}.mail" - maildirmake $MAILDIRS/outbox + maildirmake "$MAILDIRS/outbox" { test $? = 0 } || { act "updating outbox format to Maildir" # silently migrate the outbox from the old format to the new - tmpp=(`find $MAILDIRS/outbox -type f`) + tmpp=(`find "$MAILDIRS/outbox" -type f`) if [ ${#tmpp} = 0 ]; then # the old format outbox is just empty - rmdir $MAILDIRS/outbox - maildirmake $MAILDIRS/outbox + rmdir "$MAILDIRS/outbox" + maildirmake "$MAILDIRS/outbox" else # there are some mails to be sent in the old format outbox # preserve them while migrating to the new format # this code is less interesting, since it handles an old # format in JaroMail - tmppp=$TMPDIR/jaro-outbox-migration-$RANDOM + tmppp="$TMPDIR/jaro-outbox-migration-$RANDOM" mkdir -p $tmppp - mv $MAILDIRS/outbox/* $tmppp/ - rmdir $MAILDIRS/outbox - maildirmake $MAILDIRS/outbox - mkdir -p $MAILDIRS/outbox/send + mv "$MAILDIRS/outbox/*" $tmppp/ + rmdir "$MAILDIRS/outbox" + maildirmake "$MAILDIRS/outbox" + mkdir -p "$MAILDIRS/outbox/send" # here we devince two useful arrays: # bodies: the list of mail bodies to send # corresponding to files with same name and extension .msmtp bodies=(`find $tmppp -type f -name '*.mail'`) - for i in ${bodies}; do mv $i $MAILDIRS/outbox/new/; done + for i in ${bodies}; do mv $i "$MAILDIRS/outbox/new/"; done rmdir $tmppp fi } - ${=mkdir} $MAILDIRS/outbox/send + ${=mkdir} "$MAILDIRS/outbox/send" - lock $MAILDIRS/outbox + lock "$MAILDIRS/outbox" # check if recipients are a Group if [[ "${=queue_to}" =~ '@jaromail.group' ]]; then @@ -94,16 +94,16 @@ queue() { groupfile="`print ${=queue_to}|cut -d@ -f1`" act "email recipients are in group ${groupfile}" - { test -r $MAILDIRS/Groups/$groupfile } || { - maildirmake $MAILDIRS/postponed - mv ${TMPDIR}/${queue_body}.mail $MAILDIRS/postponed/new - unlock $MAILDIRS/outbox + { test -r "$MAILDIRS/Groups/$groupfile" } || { + maildirmake "$MAILDIRS/postponed" + mv "${TMPDIR}/${queue_body}.mail" "$MAILDIRS/postponed/new" + unlock "$MAILDIRS/outbox" error "Group not found: $groupfile" return 1 } - recipients=`cat $MAILDIRS/Groups/$groupfile | grep -v '^#'` - groupnum="`print ${recipients} | wc -l`" - groupmode="`head -n1 $MAILDIRS/Groups/$groupfile | awk '/^#mode/ { print $2 } { next }'`" + recipients=`cat "$MAILDIRS/Groups/$groupfile" | grep -v '^#'` + groupnum=`print ${recipients} | wc -l` + groupmode=`head -n1 "$MAILDIRS/Groups/$groupfile" | awk '/^#mode/ { print $2 } { next }'` { test "$groupmode" = "" } && { groupmode="individual" } act "$groupnum recipients in total, sending mode $groupmode" @@ -117,7 +117,7 @@ queue() { ig=${base}-${RANDOM} cat "${TMPDIR}/${queue_body}.mail" | \ awk '/^To:/ { print "'"To: $i"'"; next } { print $0 }' \ - > ${MAILDIRS}/outbox/new/${ig}.mail + > "${MAILDIRS}/outbox/new/${ig}.mail" done ;; @@ -133,18 +133,18 @@ queue() { cat "${TMPDIR}/${queue_body}.mail" | \ awk '/^To:/ { print "'"To: $cc"'"; print "'"Reply-To: $cc"'"; next } { print $0 }' \ - > ${MAILDIRS}/outbox/new/${ig}.mail + > "${MAILDIRS}/outbox/new/${ig}.mail" ;; esac else # recipients are set in the email envelope - mv $TMPDIR/$queue_body.mail $MAILDIRS/outbox/new/$queue_body.mail + mv "$TMPDIR/$queue_body.mail" "$MAILDIRS/outbox/new/$queue_body.mail" fi - unlock $MAILDIRS/outbox - { test -r ${TMPDIR}/${queue_body}.mail } && { - ${=rm} ${TMPDIR}/${queue_body}.mail } + unlock "$MAILDIRS/outbox" + { test -r "${TMPDIR}/${queue_body}.mail" } && { + ${=rm} "${TMPDIR}/${queue_body}.mail" } } @@ -180,7 +180,7 @@ fetch() { # fetch works with imap and pop, skip smtp { test "$account_type" = "smtp" } && { return 0 } - if ! [ -r $PROCMAILDIR/rc ]; then + if ! [ -r "$PROCMAILDIR/rc" ]; then act "updating procmail configuration" { test $DRYRUN != 1 } && { update } fi @@ -255,12 +255,12 @@ fetch() { esac # archive old procmail log - if [ -r $MAILDIRS/logs/procmail.log ]; then - newlock $MAILDIRS/logs/procmail-${datestamp}.log - cat $MAILDIRS/logs/procmail.log \ - >> $MAILDIRS/logs/procmail-${datestamp}.log - rm -f $MAILDIRS/logs/procmail.log - unlock $MAILDIRS/logs/procmail-${datestamp}.log + if [ -r "$MAILDIRS/logs/procmail.log" ]; then + newlock "$MAILDIRS/logs/procmail-${datestamp}.log" + cat "$MAILDIRS/logs/procmail.log" \ + >> "$MAILDIRS/logs/procmail-${datestamp}.log" + rm -f "$MAILDIRS/logs/procmail.log" + unlock "$MAILDIRS/logs/procmail-${datestamp}.log" fi act "please wait while downloading mails..." @@ -271,8 +271,8 @@ fetch() { - total=`mailstat -k $MAILDIRS/logs/procmail.log | tail -n1 | awk '{print $2}'` - briefing=`mailstat -kt $MAILDIRS/logs/procmail.log |awk '!/procmail/ { print " " $2 "\t" $3 }'|sort -nr` + total=`mailstat -k "$MAILDIRS/logs/procmail.log" | tail -n1 | awk '{print $2}'` + briefing=`mailstat -kt "$MAILDIRS/logs/procmail.log" | awk '!/procmail/ { print " " $2 "\t" $3 }'|sort -nr` notice "$total emails fetched" print "${briefing}" @@ -286,12 +286,12 @@ fetch() { # SEND # this function should send all mails in outbox send() { - adir=$WORKDIR/Accounts + adir="$WORKDIR/Accounts" typeset -al all # list mails to send - queue_outbox=(`${=find} ${MAILDIRS}/outbox -type f -name '*.mail'`) + queue_outbox=(`${=find} "${MAILDIRS}/outbox" -type f -name '*.mail'`) { test ${#queue_outbox} = 0 } && { act "Outbox is empty, no mails to send." return 0 } @@ -315,16 +315,16 @@ send() { { test $DRYRUN = 1 } && { return 0 } # from here on we must unlock on error - lock ${MAILDIRS}/outbox + lock "${MAILDIRS}/outbox" ask_password $login $host { test $? = 0 } || { error "Error retrieving password for $login on $host" unset password all - unlock ${MAILDIRS}/outbox + unlock "${MAILDIRS}/outbox" return 1 } - tmp=$TMPDIR/msmtp.$host.$datestamp.$RANDOM + tmp="$TMPDIR/msmtp.$host.$datestamp.$RANDOM" newlock $tmp cat <<EOF > $tmp account default @@ -335,12 +335,12 @@ port ${port} tls on tls_starttls on tls_certcheck off -logfile ${MAILDIRS}/logs/msmtp.log +logfile "${MAILDIRS}/logs/msmtp.log" auth ${auth} password ${password} EOF - for qbody in ${queue_outbox}; do + for qbody in ${(f)queue_outbox}; do # check if this is an anonymous mail head -n 20 "$qbody" | grep -i '^from: anon' > /dev/null @@ -411,14 +411,14 @@ BEGIN { head=1 } else notice "Mail sent succesfully" # whitelist those to whom we send mails - cat "$qbody" | $WORKDIR/bin/jaro -q learn recipient - mv "$qbody" $MAILDIRS/sent/new/ + cat "$qbody" | "$WORKDIR/bin/jaro" -q learn recipient + mv "$qbody" "$MAILDIRS/sent/new/" fi done unset password - unlock $MAILDIRS/outbox + unlock "$MAILDIRS/outbox" unlock $tmp ${=rm} $tmp @@ -467,22 +467,22 @@ peek() { error "Error retrieving password for $login on $host" unset password all; return 1 } - tmp=$TMPDIR/$host.peek.$RANDOM + tmp="$TMPDIR/$host.peek.$RANDOM" newlock $tmp cat <<EOF >> $tmp set imap_pass = "${password}" # set imap_peek = yes EOF unset password - print "source '$tmp'" > $TMPDIR/muttpass + print "source '$tmp'" > "$TMPDIR/muttpass" # when peeking don't mark unread messages as Old # and sort date received with no threading (latest up) - cat <<EOF >> $TMPDIR/muttpass + cat <<EOF >> "$TMPDIR/muttpass" unset mark_old set sort=reverse-date-received EOF (sleep 1; - cp /dev/null $TMPDIR/muttpass + cp /dev/null "$TMPDIR/muttpass" unlink $tmp # secure delete in ram ) & ${=mutt} -F $MUTTDIR/rc -f ${iproto}://${ilogin}@${host}${folder} @@ -497,6 +497,6 @@ later() { # hostname was set by the main jaro routine func "Filename: $filename" - { maildircheck ${MAILDIRS}/remember } || { maildirmake ${MAILDIRS}/remember } - cat > ${MAILDIRS}/remember/new/$filename + { maildircheck "${MAILDIRS}/remember" } || { maildirmake "${MAILDIRS}/remember" } + cat > "${MAILDIRS}/remember/new/$filename" } diff --git a/src/zlibs/filters b/src/zlibs/filters @@ -36,14 +36,14 @@ update() { func "PROCMAILDIR: $PROCMAILDIR" # make sure maildirs where to put mails exist - ${=mkdir} $MAILDIRS - maildirmake $MAILDIRS/known - maildirmake $MAILDIRS/sent - maildirmake $MAILDIRS/priv - maildirmake $MAILDIRS/postponed - maildirmake $MAILDIRS/unsorted - maildirmake $MAILDIRS/unsorted.ml - ${=mkdir} $MAILDIRS/outbox + ${=mkdir} "$MAILDIRS" + maildirmake "$MAILDIRS/known" + maildirmake "$MAILDIRS/sent" + maildirmake "$MAILDIRS/priv" + maildirmake "$MAILDIRS/postponed" + maildirmake "$MAILDIRS/unsorted" + maildirmake "$MAILDIRS/unsorted.ml" + ${=mkdir} "$MAILDIRS/outbox" ###### @@ -90,7 +90,7 @@ source '$TMPDIR/muttpass' EOF # support user made configuration of mutt - { test -r $MAILDIRS/Mutt.txt } && { + { test -r "$MAILDIRS/Mutt.txt" } && { print "source '$MAILDIRS/Mutt.txt'" >> $MUTTDIR/rc } @@ -98,7 +98,7 @@ EOF ##################### # helper applications act "configuring helper applications" -cat <<EOF >> $MUTTDIR/rc +cat <<EOF >> "$MUTTDIR/rc" ## end of Jaro Mail generated muttrc #################################### @@ -126,9 +126,9 @@ text/html; lynx -dump -assume_charset=%{charset} %s; nametemplate=%s.html; copio EOF fi - { test -r ${MAILDIRS}/Applications.txt } && { + { test -r "${MAILDIRS}/Applications.txt" } && { - apptypes=`cat ${MAILDIRS}/Applications.txt` + apptypes=`cat "${MAILDIRS}/Applications.txt"` for t in ${(f)apptypes}; do eval `print $t | awk ' { print "_type=" $1 "; _app=" $2 ";" }'` @@ -158,12 +158,11 @@ EOF # SIEVE act "generating procmail and sieve filter rules" id=$datestamp.$RANDOM - sieve=$MAILDIRS/Filters.sieve - newlock $sieve - rm -f $sieve - touch $sieve - chmod 600 $sieve - cat <<EOF >> $sieve + newlock "$MAILDIRS/Filters.sieve" + rm -f "$MAILDIRS/Filters.sieve" + touch "$MAILDIRS/Filters.sieve" + chmod 600 "$MAILDIRS/Filters.sieve" + cat <<EOF >> "$MAILDIRS/Filters.sieve" require "fileinto"; # blacklist @@ -180,13 +179,13 @@ EOF unlink $TMPDIR/blacklist.sieve.$id c=${#blacklist} for b in $blacklist; do - print -n "\"$b\"" >> $sieve + print -n "\"$b\"" >> "$MAILDIRS/Filters.sieve" c=$(( $c - 1 )) - { test $c != 0 } && { print -n "," >> $sieve } - print >> $sieve + { test $c != 0 } && { print -n "," >> "$MAILDIRS/Filters.sieve" } + print >> "$MAILDIRS/Filters.sieve" done -cat <<EOF >> $sieve +cat <<EOF >> "$MAILDIRS/Filters.sieve" ] { fileinto "zz.blacklist"; stop; } @@ -201,16 +200,16 @@ EOF # continue later on while we parse filters -touch $MAILDIRS/Filters.txt +touch "$MAILDIRS/Filters.txt" ########## # PROCMAIL - ${=mkdir} $PROCMAILDIR - rm -f $PROCMAILDIR/rc - touch $PROCMAILDIR/rc - cat<<EOF >> $PROCMAILDIR/rc + ${=mkdir} "$PROCMAILDIR" + rm -f "$PROCMAILDIR/rc" + touch "$PROCMAILDIR/rc" + cat<<EOF >> "$PROCMAILDIR/rc" # procmail configuration file generated by Jaro Mail -MAILDIR=$MAILDIRS +MAILDIR=\"$MAILDIRS\" JARO=$WORKDIR/bin/jaro DEFAULT=\$MAILDIR/unsorted/ VERBOSE=off @@ -220,7 +219,7 @@ UMASK = 007 # James Bond :-) LINEBUF = 8192 # avoid procmail choke # Using Procmail Module Library http://sf.net/projects/pm-lib -PMSRC = $WORKDIR/.procmail +PMSRC = "$WORKDIR/.procmail" # Load the central initial startup code. INCLUDERC = \$PMSRC/pm-javar.rc PF_DEST = "" # clear these vars @@ -250,7 +249,7 @@ EOF typeset -alU filter_from typeset -alU filter_to - for f in `cat $MAILDIRS/Filters.txt | awk ' + for f in `cat "$MAILDIRS/Filters.txt" | awk ' /^#/ {next} /^./ { print $1 ";" $2 ";" $3 ";" $4 }'`; do header="${f[(ws:;:)1]}" @@ -260,16 +259,16 @@ EOF case $header in to) print "ADDR=${address}\tDEST=${destination}/\tINCLUDERC=\$PMSRC/pf-chkto.rc" \ - >> $PROCMAILDIR/rc + >> "$PROCMAILDIR/rc" func "messages to <${address}> in folder: ${destination}" - maildirmake $MAILDIRS/$destination + maildirmake "$MAILDIRS/$destination" filter_to+=($address) ;; from) print "ADDR=${address}\tDEST=${destination}/\tINCLUDERC=\$PMSRC/pf-check.rc" \ - >> $PROCMAILDIR/rc + >> "$PROCMAILDIR/rc" func "messages from <${address}> in folder: {$destination}" - maildirmake $MAILDIRS/$destination + maildirmake "$MAILDIRS/$destination" filter_from+=($address) ;; *) @@ -277,24 +276,24 @@ EOF ;; esac # MUTT (generate mailboxes priority this parser) - print " \\" >> $MUTTDIR/mboxes - print -n " +${destination} " >> $MUTTDIR/mboxes + print " \\" >> "$MUTTDIR/mboxes" + print -n " +${destination} " >> "$MUTTDIR/mboxes" done # now do the sieve { test ${#filter_to} -gt 0 } && { - cat <<EOF >> $sieve + cat <<EOF >> "$MAILDIRS/Filters.sieve" # filter to if header :contains "To" [ EOF c=${#filter_to} for f in $filter_to; do - print -n "\"$f\"" >> $sieve + print -n "\"$f\"" >> "$MAILDIRS/Filters.sieve" c=$(( $c - 1 )) - { test $c != 0 } && { print -n "," >> $sieve } - print >> $sieve + { test $c != 0 } && { print -n "," >> "$MAILDIRS/Filters.sieve" } + print >> "$MAILDIRS/Filters.sieve" done - cat <<EOF >> $sieve + cat <<EOF >> "$MAILDIRS/Filters.sieve" ] { fileinto "filters"; stop; } @@ -302,18 +301,18 @@ EOF } { test ${#filter_from} -gt 0 } && { - cat <<EOF >> $sieve + cat <<EOF >> "$MAILDIRS/Filters.sieve" # filter from if header :contains "From" [ EOF c=${#filter_from} for f in $filter_from; do - print -n "\"$f\"" >> $sieve + print -n "\"$f\"" >> "$MAILDIRS/Filters.sieve" c=$(( $c - 1 )) - { test $c != 0 } && { print -n "," >> $sieve } - print >> $sieve + { test $c != 0 } && { print -n "," >> "$MAILDIRS/Filters.sieve" } + print >> "$MAILDIRS/Filters.sieve" done - cat <<EOF >> $sieve + cat <<EOF >> "$MAILDIRS/Filters.sieve" ] { fileinto "filters"; stop; } @@ -329,7 +328,7 @@ EOF #### SIEVE act "compiling whitelist rules from addressbook" func "generating whitelist for sieve filters" -cat <<EOF >> $sieve +cat <<EOF >> "$MAILDIRS/Filters.sieve" # whitelist if header :contains "From" [ EOF @@ -348,12 +347,12 @@ unlink $TMPDIR/whitelist.sieve.$id c=${#whitelist} for w in $whitelist; do - print -n "\"$w\"" >> $sieve + print -n "\"$w\"" >> "$MAILDIRS/Filters.sieve" c=$(( $c - 1 )) - { test $c != 0 } && { print -n "," >> $sieve } - print >> $sieve + { test $c != 0 } && { print -n "," >> "$MAILDIRS/Filters.sieve" } + print >> "$MAILDIRS/Filters.sieve" done -cat <<EOF >> $sieve +cat <<EOF >> "$MAILDIRS/Filters.sieve" ] { fileinto "INBOX"; stop; } @@ -395,7 +394,7 @@ EOF * ? test \$PMSRC/pf-chkto.rc { EOF - cat <<EOF >> $sieve + cat <<EOF >> "$MAILDIRS/Filters.sieve" # sent to our own address if header :contains "To" [ EOF @@ -414,15 +413,15 @@ EOF >> $PROCMAILDIR/rc # sieve - print -n "\"${rr}\"" >> $sieve + print -n "\"${rr}\"" >> "$MAILDIRS/Filters.sieve" c=$(( $c - 1 )) - { test $c != 0 } && { print -n "," >> $sieve } - print >> $sieve + { test $c != 0 } && { print -n "," >> "$MAILDIRS/Filters.sieve" } + print >> "$MAILDIRS/Filters.sieve" act "private account: <${rr}>" done - cat <<EOF >> $sieve + cat <<EOF >> "$MAILDIRS/Filters.sieve" ] { fileinto "priv"; stop; } @@ -466,12 +465,12 @@ EOF # conclude sieve -cat <<EOF >> $sieve +cat <<EOF >> "$MAILDIRS/Filters.sieve" fileinto "unsorted"; EOF -unlock $sieve +unlock "$MAILDIRS/Filters.sieve" return 0 } # end of update() diff --git a/src/zlibs/keyring b/src/zlibs/keyring @@ -79,7 +79,7 @@ ask_password() { func "path: jaromail/${type}/${email}" print "protocol=${type}\npath=jaromail/${type}/${email}\nusername=${login}\nhost=${host}\n\n" \ - | $WORKDIR/bin/jaro-gnome-keyring check + | "$WORKDIR/bin/jaro-gnome-keyring" check if [ $? != 0 ]; then # its a new password new_password { test $? != 0 } && { @@ -87,10 +87,10 @@ ask_password() { return 1 } else # password found into gnome keyring act "Using saved password for $1 @ $2" - password=`print "protocol=${type}\npath=jaromail/${type}/${email}\nusername=${login}\nhost=${host}\n\n" | $WORKDIR/bin/jaro-gnome-keyring get` + password=`print "protocol=${type}\npath=jaromail/${type}/${email}\nusername=${login}\nhost=${host}\n\n" | "$WORKDIR/bin/jaro-gnome-keyring" get` fi return 0 - elif [ -r $KEYRING ]; then + elif [ -r "$KEYRING" ]; then func "Looking for password in local keyring for $type account $account on $host" func "new pass hash for: $type:$login:$host" _hash=`print "$type:$login:$host" | shasum | awk '{print $1}'` @@ -177,7 +177,7 @@ new_password() { if [ "$GNOMEKEY" = "1" ]; then act "using gnome-keyring password storage" func "path: jaromail/${type}/${email}" - cat <<EOF | $WORKDIR/bin/jaro-gnome-keyring store + cat <<EOF | "$WORKDIR/bin/jaro-gnome-keyring" store protocol=${type} path=jaromail/${type}/${email} username=${login} @@ -198,13 +198,13 @@ EOF notice "Select the password to lock this keyring entry:" _password="`print $password | gpg -c --cipher-algo AES256 --openpgp --no-options | base64`" if [ "$lookup" = "" ]; then # new entry - cat <<EOF | ${SQL} -batch $KEYRING + cat <<EOF | ${SQL} -batch "$KEYRING" INSERT INTO secrets (hash, password) VALUES ("${_hash}", "${_password}"); EOF act "saved new password in local keyring" else # update entry - cat <<EOF | ${SQL} -batch $KEYRING + cat <<EOF | ${SQL} -batch "$KEYRING" UPDATE secrets SET password="${_password}" WHERE hash LIKE "${_hash}"; EOF act "updated local keyring with new password" @@ -218,7 +218,7 @@ EOF # save it into gnome keyring if [ $GNOMEKEY = 1 ]; then - cat <<EOF | $WORKDIR/bin/jaro-gnome-keyring erase + cat <<EOF | "$WORKDIR/bin/jaro-gnome-keyring" erase protocol=${type} path=jaromail/${email} username=${login}