aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLars Ingebrigtsen2019-10-21 22:38:34 +0200
committerLars Ingebrigtsen2019-10-21 22:38:44 +0200
commitd5fdde42d2c662628f83fdbf3e11f6567f151236 (patch)
treec99b0a3da9eea5c3fafce97aa6ae69b8a8268e92
parent7f5db3f40caa3050135dae85294849f8375d97b8 (diff)
downloademacs-d5fdde42d2c662628f83fdbf3e11f6567f151236.tar.gz
emacs-d5fdde42d2c662628f83fdbf3e11f6567f151236.zip
Try to not put SMTP passwords in the *Messages* buffer
* lisp/mail/smtpmail.el (smtpmail--sanitize-error-message): New function. (smtpmail-send-it): Use it. (smtpmail-send-queued-mail): Ditto.
-rw-r--r--lisp/mail/smtpmail.el10
1 files changed, 8 insertions, 2 deletions
diff --git a/lisp/mail/smtpmail.el b/lisp/mail/smtpmail.el
index 802c9ba788d..9cf28fbe8a5 100644
--- a/lisp/mail/smtpmail.el
+++ b/lisp/mail/smtpmail.el
@@ -354,7 +354,8 @@ for `smtpmail-try-auth-method'.")
354 (when (setq result 354 (when (setq result
355 (smtpmail-via-smtp 355 (smtpmail-via-smtp
356 smtpmail-recipient-address-list tembuf)) 356 smtpmail-recipient-address-list tembuf))
357 (error "Sending failed: %s" result)) 357 (error "Sending failed: %s"
358 (smtpmail--sanitize-error-message result)))
358 (error "Sending failed; no recipients")) 359 (error "Sending failed; no recipients"))
359 (let* ((file-data 360 (let* ((file-data
360 (expand-file-name 361 (expand-file-name
@@ -437,13 +438,18 @@ for `smtpmail-try-auth-method'.")
437 (when (setq result (smtpmail-via-smtp 438 (when (setq result (smtpmail-via-smtp
438 smtpmail-recipient-address-list 439 smtpmail-recipient-address-list
439 (current-buffer))) 440 (current-buffer)))
440 (error "Sending failed: %s" result)) 441 (error "Sending failed: %s"
442 (smtpmail--sanitize-error-message result)))
441 (error "Sending failed; no recipients")))) 443 (error "Sending failed; no recipients"))))
442 (delete-file file-data) 444 (delete-file file-data)
443 (delete-file file-elisp) 445 (delete-file file-elisp)
444 (delete-region (point-at-bol) (point-at-bol 2))) 446 (delete-region (point-at-bol) (point-at-bol 2)))
445 (write-region (point-min) (point-max) qfile)))) 447 (write-region (point-min) (point-max) qfile))))
446 448
449(defun smtpmail--sanitize-error-message (string)
450 "Try to remove passwords and the like from SMTP error messages."
451 (replace-regexp-in-string "\\bAUTH\\b.*" "AUTH" string))
452
447(defun smtpmail-fqdn () 453(defun smtpmail-fqdn ()
448 (if smtpmail-local-domain 454 (if smtpmail-local-domain
449 (concat (system-name) "." smtpmail-local-domain) 455 (concat (system-name) "." smtpmail-local-domain)