diff options
| author | Lars Magne Ingebrigtsen | 2011-06-22 16:48:31 +0200 |
|---|---|---|
| committer | Lars Magne Ingebrigtsen | 2011-06-22 16:48:31 +0200 |
| commit | ddb7ffeeb8ace6501eb453f50f0f9f6852eda21f (patch) | |
| tree | d15181da4f25be194cb80cae8556cdabc2f887bf | |
| parent | d5a19415d0bc308557d754e4438a2656e16bb0ab (diff) | |
| download | emacs-ddb7ffeeb8ace6501eb453f50f0f9f6852eda21f.tar.gz emacs-ddb7ffeeb8ace6501eb453f50f0f9f6852eda21f.zip | |
When the .authinfo file has a user name but not a password, prompt
for the password.
| -rw-r--r-- | lisp/ChangeLog | 2 | ||||
| -rw-r--r-- | lisp/gnus/auth-source.el | 10 | ||||
| -rw-r--r-- | lisp/mail/smtpmail.el | 15 |
3 files changed, 19 insertions, 8 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 0c72fbf47db..57f4608ab72 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -2,6 +2,8 @@ | |||
| 2 | 2 | ||
| 3 | * mail/smtpmail.el (smtpmail-via-smtp): Make sure we don't send | 3 | * mail/smtpmail.el (smtpmail-via-smtp): Make sure we don't send |
| 4 | QUIT twice. | 4 | QUIT twice. |
| 5 | (smtpmail-try-auth-methods): Require user name and password from | ||
| 6 | auth-source. | ||
| 5 | 7 | ||
| 6 | 2011-06-22 Martin Rudalics <rudalics@gmx.at> | 8 | 2011-06-22 Martin Rudalics <rudalics@gmx.at> |
| 7 | 9 | ||
diff --git a/lisp/gnus/auth-source.el b/lisp/gnus/auth-source.el index d3261b137b2..6fe033fea79 100644 --- a/lisp/gnus/auth-source.el +++ b/lisp/gnus/auth-source.el | |||
| @@ -713,7 +713,8 @@ Returns the deleted entries." | |||
| 713 | when (string-match (concat "^" auth-source-magic) | 713 | when (string-match (concat "^" auth-source-magic) |
| 714 | (symbol-name sym)) | 714 | (symbol-name sym)) |
| 715 | ;; remove that key | 715 | ;; remove that key |
| 716 | do (password-cache-remove (symbol-name sym)))) | 716 | do (password-cache-remove (symbol-name sym))) |
| 717 | (setq auth-source-netrc-cache nil)) | ||
| 717 | 718 | ||
| 718 | (defun auth-source-remember (spec found) | 719 | (defun auth-source-remember (spec found) |
| 719 | "Remember FOUND search results for SPEC." | 720 | "Remember FOUND search results for SPEC." |
| @@ -1144,6 +1145,9 @@ See `auth-source-search' for details on SPEC." | |||
| 1144 | ;; we know (because of an assertion in auth-source-search) that the | 1145 | ;; we know (because of an assertion in auth-source-search) that the |
| 1145 | ;; :create parameter is either t or a list (which includes nil) | 1146 | ;; :create parameter is either t or a list (which includes nil) |
| 1146 | (create-extra (if (eq t create) nil create)) | 1147 | (create-extra (if (eq t create) nil create)) |
| 1148 | (current-data (car (auth-source-search :max 1 | ||
| 1149 | :host host | ||
| 1150 | :port port))) | ||
| 1147 | (required (append base-required create-extra)) | 1151 | (required (append base-required create-extra)) |
| 1148 | (file (oref backend source)) | 1152 | (file (oref backend source)) |
| 1149 | (add "") | 1153 | (add "") |
| @@ -1178,7 +1182,9 @@ See `auth-source-search' for details on SPEC." | |||
| 1178 | (dolist (r required) | 1182 | (dolist (r required) |
| 1179 | (let* ((data (aget valist r)) | 1183 | (let* ((data (aget valist r)) |
| 1180 | ;; take the first element if the data is a list | 1184 | ;; take the first element if the data is a list |
| 1181 | (data (auth-source-netrc-element-or-first data)) | 1185 | (data (or (auth-source-netrc-element-or-first data) |
| 1186 | (plist-get current-data | ||
| 1187 | (intern (format ":%s" r) obarray)))) | ||
| 1182 | ;; this is the default to be offered | 1188 | ;; this is the default to be offered |
| 1183 | (given-default (aget auth-source-creation-defaults r)) | 1189 | (given-default (aget auth-source-creation-defaults r)) |
| 1184 | ;; the default supplementals are simple: | 1190 | ;; the default supplementals are simple: |
diff --git a/lisp/mail/smtpmail.el b/lisp/mail/smtpmail.el index 58a517ba836..b1685067c08 100644 --- a/lisp/mail/smtpmail.el +++ b/lisp/mail/smtpmail.el | |||
| @@ -483,12 +483,15 @@ The list is in preference order.") | |||
| 483 | '((user . "SMTP user at %h: ") | 483 | '((user . "SMTP user at %h: ") |
| 484 | (secret . "SMTP password for %u@%h: "))) | 484 | (secret . "SMTP password for %u@%h: "))) |
| 485 | (auth-info (car | 485 | (auth-info (car |
| 486 | (auth-source-search :max 1 | 486 | (auth-source-search |
| 487 | :host host | 487 | :max 1 |
| 488 | :port (if port | 488 | :host host |
| 489 | (format "%s" port) | 489 | :port (if port |
| 490 | "smtp") | 490 | (format "%s" port) |
| 491 | :create ask-for-password))) | 491 | "smtp") |
| 492 | :require (and ask-for-password | ||
| 493 | '(:user :secret)) | ||
| 494 | :create ask-for-password))) | ||
| 492 | (user (plist-get auth-info :user)) | 495 | (user (plist-get auth-info :user)) |
| 493 | (password (plist-get auth-info :secret)) | 496 | (password (plist-get auth-info :secret)) |
| 494 | (save-function (and ask-for-password | 497 | (save-function (and ask-for-password |