On Wed, May 18, 2011 at 07:24:49PM +0200, Ђорђе Тодоровић wrote:
On Wed, 18 May 2011, Ђорђе Тодоровић wrote:

On Wed, 18 May 2011, Richard wrote:
imap_pass = `echo -n $(pwsafe -p ACCOUNT_NAME -e -q | tail -n 1) `

That works fine, thank you. Also I found this link:
 http://www.mail-archive.com/mutt-users@mutt.org/msg36375.html

I just noticed that this example doesn't work with passwords that contain
certain special characters (#"'). Anyone know how to sanitize input so mutt can
read passwords from stdin?

If a password contains "#", mutt reads an empty string.
If a password contains quotes, imap_pass gets a password + entire muttrc file
below a "set imap_pass..." field.

Mutt treats the output of a command in backticks as if it were typed directly into the config file. So if your password is abc#123, then
  imap_pass = `echo -n $(pwsafe -p ACCOUNT_NAME -e -q | tail -n 1) `
will translate to
  imap_pass = abc#123

Mutt will parse # as the beginning of a comment, ignore it and the rest of the line, and set your password to "abc".

The solution is to tell mutt that the output of the command is a literal string:
  imap_pass = "`echo -n $(pwsafe -p ACCOUNT_NAME -e -q | tail -n 1) `"

Some brief testing indicates that Mutt does the right thing for output that contains # and ", but I don't use IMAP so I'm not completely certain.

--
Ed Blackman

Attachment: signature.txt
Description: Digital signature

Reply via email to