emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] master d5fdde4: Try to not put SMTP passwords in the *Mess


From: Lars Ingebrigtsen
Subject: [Emacs-diffs] master d5fdde4: Try to not put SMTP passwords in the *Messages* buffer
Date: Mon, 21 Oct 2019 16:38:50 -0400 (EDT)

branch: master
commit d5fdde42d2c662628f83fdbf3e11f6567f151236
Author: Lars Ingebrigtsen <address@hidden>
Commit: Lars Ingebrigtsen <address@hidden>

    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.
---
 lisp/mail/smtpmail.el | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/lisp/mail/smtpmail.el b/lisp/mail/smtpmail.el
index 802c9ba..9cf28fb 100644
--- a/lisp/mail/smtpmail.el
+++ b/lisp/mail/smtpmail.el
@@ -354,7 +354,8 @@ for `smtpmail-try-auth-method'.")
                  (when (setq result
                              (smtpmail-via-smtp
                               smtpmail-recipient-address-list tembuf))
-                   (error "Sending failed: %s" result))
+                   (error "Sending failed: %s"
+                           (smtpmail--sanitize-error-message result)))
                (error "Sending failed; no recipients"))
            (let* ((file-data
                    (expand-file-name
@@ -437,13 +438,18 @@ for `smtpmail-try-auth-method'.")
                 (when (setq result (smtpmail-via-smtp
                                    smtpmail-recipient-address-list
                                    (current-buffer)))
-                 (error "Sending failed: %s" result))
+                 (error "Sending failed: %s"
+                         (smtpmail--sanitize-error-message result)))
               (error "Sending failed; no recipients"))))
        (delete-file file-data)
        (delete-file file-elisp)
        (delete-region (point-at-bol) (point-at-bol 2)))
       (write-region (point-min) (point-max) qfile))))
 
+(defun smtpmail--sanitize-error-message (string)
+  "Try to remove passwords and the like from SMTP error messages."
+  (replace-regexp-in-string "\\bAUTH\\b.*" "AUTH" string))
+
 (defun smtpmail-fqdn ()
   (if smtpmail-local-domain
       (concat (system-name) "." smtpmail-local-domain)



reply via email to

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