emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Committing new smtpmail.el later tonight


From: Ted Zlatanov
Subject: Re: Committing new smtpmail.el later tonight
Date: Wed, 22 Jun 2011 10:51:08 -0500
User-agent: Gnus/5.110018 (No Gnus v0.18) Emacs/24.0.50 (gnu/linux)

On Wed, 22 Jun 2011 16:25:50 +0200 Lars Magne Ingebrigtsen <address@hidden> 
wrote: 

LMI> Lars Magne Ingebrigtsen <address@hidden> writes:
>> I'll investigate later today, but I don't have time the next few hours,
>> I think...

LMI> Ok, I've now investigated, and it's both a bug in smtpmail.el, and a
LMI> misfeature in auth-source.el, I think.

LMI> What we want is to be able to say "give me the credentials for
LMI> server:port, and prompt and create the missing bits".  This doesn't seem
LMI> possible today.  If there is a "user" entry in ~/.authinfo, that should
LMI> obviously be used, and it should just prompt for the password.

LMI> From what I'm reading in the code, auth-source doesn't do that, so I'm
LMI> going to add that.

Have you looked at :create and :require in `auth-source-search'?  Also
see the `auth-source-creation-{prompts,defaults}' dynamic overrides.

At least for netrc files, :create should DTRT as you describe.  It's
used that way in nnimap.el:

#+begin_src lisp
(defun nnimap-credentials (address ports user)
  (let* ((auth-source-creation-prompts
          '((user  . "IMAP user at %h: ")
            (secret . "IMAP password for address@hidden: ")))
         (found (nth 0 (auth-source-search :max 1
                                           :host address
                                           :port ports
                                           :user user
                                           :require '(:user :secret)
                                           :create t))))
    (if found
        (list (plist-get found :user)
              (let ((secret (plist-get found :secret)))
                (if (functionp secret)
                    (funcall secret)
                  secret))
              (plist-get found :save-function))
      nil)))

#+end_src


Ted




reply via email to

[Prev in Thread] Current Thread [Next in Thread]